From ab7d49d75707bf7831f34936b88888461f5dbd47 Mon Sep 17 00:00:00 2001
From: Ryan Walberg
Date: Sat, 17 Nov 2012 01:34:08 +0000
Subject: [PATCH] families page converted
---
src/families.php | 187 ++++++++-----------------------------
src/templates/families.tpl | 141 ++++++++++++++++++++++++++++
2 files changed, 180 insertions(+), 148 deletions(-)
create mode 100644 src/templates/families.tpl
diff --git a/src/families.php b/src/families.php
index ec4a72d..6349050 100644
--- a/src/families.php
+++ b/src/families.php
@@ -58,10 +58,10 @@ if ($action == "delete") {
exit;
}
else if ($action == "edit") {
- $query = "SELECT familyname FROM {$OPT["table_prefix"]}families WHERE familyid = " . $_GET["familyid"];
+ $query = "SELECT familyname FROM {$OPT["table_prefix"]}families WHERE familyid = " . addslashes($_GET["familyid"]);
$rs = mysql_query($query) or die("Could not query: " . mysql_error());
if ($row = mysql_fetch_array($rs,MYSQL_ASSOC)) {
- $familyname = htmlspecialchars($row["familyname"]);
+ $familyname = $row["familyname"];
}
mysql_free_result($rs);
}
@@ -105,157 +105,48 @@ else {
exit;
}
-echo "\r\n";
-?>
-
-
-
-Gift Registry - Manage Families
-
-
-
-" . $message . "";
-}
-
$query = "SELECT f.familyid, familyname, COUNT(userid) AS members " .
"FROM {$OPT["table_prefix"]}families f " .
"LEFT OUTER JOIN {$OPT["table_prefix"]}memberships m ON m.familyid = f.familyid " .
"GROUP BY f.familyid " .
"ORDER BY familyname";
-$families = mysql_query($query) or die("Could not query: " . mysql_error());
-if ($OPT["show_helptext"]) {
- ?>
-
- Here you can specify families that will use your gift registry. Members may belong to one or more family circles.
- After adding a new family, click Edit to add members to it.
-
-
+mysql_free_result($rs);
-
-
-
-
-
+ mysql_free_result($rs);
+}
+
+define('SMARTY_DIR',str_replace("\\","/",getcwd()).'/includes/Smarty-3.1.12/libs/');
+require_once(SMARTY_DIR . 'Smarty.class.php');
+$smarty = new Smarty();
+$smarty->assign('action', $action);
+$smarty->assign('haserror', $haserror);
+if (isset($familyname_error)) {
+ $smarty->assign('familyname_error', $familyname_error);
+}
+$smarty->assign('families', $families);
+$smarty->assign('familyid', $_GET["familyid"]);
+$smarty->assign('familyname', $familyname);
+if (isset($nonmembers)) {
+ $smarty->assign('nonmembers', $nonmembers);
+}
+if (isset($message)) {
+ $smarty->assign('message', $message);
+}
+$smarty->assign('isadmin', $_SESSION["admin"]);
+$smarty->assign('opt', $OPT);
+$smarty->display('families.tpl');
+?>
diff --git a/src/templates/families.tpl b/src/templates/families.tpl
new file mode 100644
index 0000000..f3ceb67
--- /dev/null
+++ b/src/templates/families.tpl
@@ -0,0 +1,141 @@
+{*
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*}
+
+
+
+
+ Gift Registry - Manage Families
+
+
+
+
+
+ {include file='navbar.tpl' isadmin=$isadmin}
+
+
+
+ {if isset($message)}
+
+
+
{$message|escape:'htmlall'}
+
+
+ {/if}
+
+ {if $opt.show_helptext}
+
+
+
+ Here you can specify families that will use your gift registry. Members may belong to one or more family circles.
+ After adding a new family, click Edit to add members to it.
+