From b8fea7d93c408d5491dd6a03cbcb96b5ce847927 Mon Sep 17 00:00:00 2001 From: Ryan Walberg Date: Wed, 6 Nov 2013 04:01:50 +0000 Subject: [PATCH] fixes warnings in the httpd server error logs --- src/categories.php | 6 ++---- src/event.php | 2 +- src/includes/MySmarty.class.php | 6 +++--- src/item.php | 4 ++-- src/ranks.php | 6 +++--- src/templates/categories.tpl | 12 +++++++----- src/users.php | 2 +- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/categories.php b/src/categories.php index 02c42d9..d9a5df6 100644 --- a/src/categories.php +++ b/src/categories.php @@ -34,7 +34,7 @@ if (!empty($_GET["message"])) { $message = $_GET["message"]; } -$action = $_GET["action"]; +$action = isset($_GET["action"]) ? $_GET["action"] : ""; if ($action == "insert" || $action == "update") { /* validate the data. */ @@ -123,8 +123,6 @@ $smarty->assign('category', $category); if (isset($category_error)) { $smarty->assign('category_error', $category_error); } -$smarty->assign('haserror', $haserror); -$smarty->assign('isadmin', $_SESSION["admin"]); -$smarty->assign('opt', $smarty->opt()); +$smarty->assign('haserror', isset($haserror) ? $haserror : false); $smarty->display('categories.tpl'); ?> diff --git a/src/event.php b/src/event.php index deac7e1..72137c9 100644 --- a/src/event.php +++ b/src/event.php @@ -197,7 +197,7 @@ try { $smarty->assign('message', $message); } $smarty->assign('action', $action); - $smarty->assign('haserror', $haserror); + $smarty->assign('haserror', isset($haserror) ? $haserror : false); $smarty->assign('events', $events); $smarty->assign('eventdate', $eventdate->format($opt["date_format"])); if (isset($eventdate_error)) { diff --git a/src/includes/MySmarty.class.php b/src/includes/MySmarty.class.php index 7a6c032..669c21a 100644 --- a/src/includes/MySmarty.class.php +++ b/src/includes/MySmarty.class.php @@ -27,10 +27,10 @@ class MySmarty extends Smarty { return $opt; } - public function display($t) { - parent::assign('isadmin', $_SESSION['admin']); + public function display($template, $cache_id = "", $compile_id = "") { + parent::assign('isadmin', isset($_SESSION['admin']) ? $_SESSION['admin'] : false); parent::assign('opt', $this->opt()); - parent::display($t); + parent::display($template, $cache_id, $compile_id); } } ?> diff --git a/src/item.php b/src/item.php index 0db68bb..193fa5e 100644 --- a/src/item.php +++ b/src/item.php @@ -87,7 +87,7 @@ if (!empty($_REQUEST["action"])) { } } - if (!$haserror) { + if (isset($haserror) && !$haserror && isset($_REQUEST["image"])) { if ($_REQUEST["image"] == "remove" || $_REQUEST["image"] == "replace") { deleteImageForItem((int) $_REQUEST["itemid"], $smarty->dbh(), $smarty->opt()); } @@ -264,7 +264,7 @@ while ($row = $stmt->fetch()) { $smarty->assign('userid', $userid); $smarty->assign('action', $action); -$smarty->assign('haserror', $haserror); +$smarty->assign('haserror', isset($haserror) ? $haserror : false); if (isset($_REQUEST['itemid'])) { $smarty->assign('itemid', (int) $_REQUEST['itemid']); } diff --git a/src/ranks.php b/src/ranks.php index fedc5ce..051f9fa 100644 --- a/src/ranks.php +++ b/src/ranks.php @@ -34,7 +34,7 @@ if (!empty($_GET["message"])) { $message = $_GET["message"]; } -$action = $_GET["action"]; +$action = isset($_GET["action"]) ? $_GET["action"] : ""; if ($action == "insert" || $action == "update") { /* validate the data. */ @@ -160,7 +160,7 @@ $smarty->assign('rendered', $rendered); if (isset($rendered_error)) { $smarty->assign('rendered_error', $rendered_error); } -$smarty->assign('ranking', $_GET["ranking"]); -$smarty->assign('haserror', $haserror); +$smarty->assign('ranking', isset($_GET["ranking"]) ? (int) $_GET["ranking"] : ""); +$smarty->assign('haserror', isset($haserror) ? $haserror : false); $smarty->display('ranks.tpl'); ?> diff --git a/src/templates/categories.tpl b/src/templates/categories.tpl index 6728907..b7235b2 100644 --- a/src/templates/categories.tpl +++ b/src/templates/categories.tpl @@ -105,11 +105,13 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- {if $action == "edit" || (isset($haserror) && $action == "update")} - - - {elseif $action == "" || (isset($haserror) && $action == "insert")} - + {if isset($action)} + {if $action == "edit" || (isset($haserror) && $action == "update")} + + + {elseif $action == "" || (isset($haserror) && $action == "insert")} + + {/if} {/if}
{if $action == "edit"}Edit Category '{$category|escape:'htmlall'}'{else}Add Category{/if} diff --git a/src/users.php b/src/users.php index 646538b..a808371 100644 --- a/src/users.php +++ b/src/users.php @@ -197,7 +197,7 @@ while ($row = $stmt->fetch()) { } $smarty->assign('action', $action); -$smarty->assign('edituserid', (int) $_GET["userid"]); +$smarty->assign('edituserid', isset($_GET["userid"]) ? (int) $_GET["userid"] : -1); $smarty->assign('username', $username); if (isset($username_error)) { $smarty->assign('username_error', $username_error);