From 454817b04f4d854da885cebe22397ccb3566b702 Mon Sep 17 00:00:00 2001 From: Graham Cole <chckens@sucs.org> Date: Thu, 17 Jan 2008 18:08:31 +0000 Subject: [PATCH] More components updated to use generic error handling. Refs #49 --- components/static.php | 2 +- components/uri.php | 6 +++--- templates/index.tpl | 7 ------- templates/uri.tpl | 8 -------- 4 files changed, 4 insertions(+), 19 deletions(-) diff --git a/components/static.php b/components/static.php index 5a98255..633c21c 100644 --- a/components/static.php +++ b/components/static.php @@ -50,7 +50,7 @@ if (isset($session->groups[$permission])) { case "Save": // ...save the file $savesuccess = @file_put_contents($myfile, $_REQUEST['body'], LOCK_EX); - if (!$savesuccess) $smarty->assign("fileerror", "Write failed"); + if (!$savesuccess) trigger_error("Write failed", E_USER_ERROR); $id = $DB->GetOne("select id from static where path=?", array($path)); $record = array(); $record['summary'] = $_REQUEST['summary']; diff --git a/components/uri.php b/components/uri.php index 37ee595..705f6bc 100644 --- a/components/uri.php +++ b/components/uri.php @@ -39,7 +39,7 @@ if (isset($pathlist[3])) { $headers=get_headers($_REQUEST['uri'], 1); if ($headers) { if (preg_match("/ 4/", $headers[0])) { - $smarty->assign("errormsg", "HTTP 4xx error detected - not creating ShortURI"); + trigger_error("HTTP 4xx error detected - not creating ShortURI", E_USER_WARNING); } else { $record['url'] = @$_REQUEST['uri']; $record['creator'] = $session->username; @@ -48,7 +48,7 @@ if (isset($pathlist[3])) { $shorturi=$DB->GetOne("select id from $uritable where url=?", array(@$_REQUEST['uri'])); } } else { - $smarty->assign("errormsg", "URI supplied is not valid"); + trigger_error("URI supplied is not valid", E_USER_WARNING); } } @@ -56,7 +56,7 @@ if (isset($pathlist[3])) { } } else { - $smarty->assign("errormsg", "You are not logged in"); + trigger_error("You are not logged in", E_USER_WARNING); } } diff --git a/templates/index.tpl b/templates/index.tpl index 4d642de..6f41725 100644 --- a/templates/index.tpl +++ b/templates/index.tpl @@ -5,13 +5,6 @@ </div></div></div> </div> {/if} -{if $fileerror} - <div class="errorbar"> - <div><div><div> - File error: {$fileerror} - </div></div></div> - </div> -{/if} {if $secondary} <div id="primary"> diff --git a/templates/uri.tpl b/templates/uri.tpl index 2b7e08a..ab706b7 100644 --- a/templates/uri.tpl +++ b/templates/uri.tpl @@ -8,14 +8,6 @@ $script .= "</script>"; $this->append('extra_scripts', $script); {/php} -{if $errormsg} - <div class="errorbar"> - <div><div><div> - ShortURI: {$errormsg} - </div></div></div> - </div> -{/if} - {if $session->loggedin} <div class="box" style="width: 80%; margin: auto;"> -- GitLab