Commit: 859e608a8719fa0a68f749ede27d0a1d2215968a Author: Hannes Magnusson <[email protected]> Sun, 29 Dec 2013 18:15:15 -0800 Parents: e107ae8134f407bee50800ffc86e1141312607c5 Branches: master
Link: http://git.php.net/?p=web/master.git;a=commitdiff;h=859e608a8719fa0a68f749ede27d0a1d2215968a Log: Move function to include/fuctions.inc Changed paths: M include/functions.inc M manage/event.php M manage/users.php Diff: diff --git a/include/functions.inc b/include/functions.inc index b29c49d..160b3c7 100644 --- a/include/functions.inc +++ b/include/functions.inc @@ -499,3 +499,32 @@ function invalid_input($in) { return false; } +function validateAction($k) { + switch($k) { + case "approve": + case "remove": + return $k; + default: + warn("that action ('" . hsc($k) . "') is not understood."); + } + + return false; +} + +function fetch_event($id) { + $query = "SELECT * FROM phpcal WHERE id=$id"; + + if ($res = db_query($query)) { + return mysql_fetch_array($res,MYSQL_ASSOC); + } + + return false; +} + +function display_options($options,$current) { + foreach ($options as $k => $v) { + echo '<option value="', $k, '"', + ($k == $current ? ' selected="selected"' : ''), + '>', html_entity_decode($v,ENT_QUOTES), "</option>\n"; + } +} diff --git a/manage/event.php b/manage/event.php index b4b423d..54341f2 100644 --- a/manage/event.php +++ b/manage/event.php @@ -296,20 +296,3 @@ while ($row = mysql_fetch_array($res,MYSQL_ASSOC)) { show_prev_next($begin,mysql_num_rows($res),$max,$total,$extra); foot(); -function fetch_event($id) { - $query = "SELECT * FROM phpcal WHERE id=$id"; - - if ($res = db_query($query)) { - return mysql_fetch_array($res,MYSQL_ASSOC); - } - - return false; -} - -function display_options($options,$current) { - foreach ($options as $k => $v) { - echo '<option value="', $k, '"', - ($k == $current ? ' selected="selected"' : ''), - '>', html_entity_decode($v,ENT_QUOTES), "</option>\n"; - } -} diff --git a/manage/users.php b/manage/users.php index ae5558f..9c235b3 100644 --- a/manage/users.php +++ b/manage/users.php @@ -55,18 +55,6 @@ if ($id) { } } -function validateAction($k) { - switch($k) { - case "approve": - case "remove": - return $k; - default: - warn("that action ('" . hsc($k) . "') is not understood."); - } - - return false; -} - $action = filter_input(INPUT_GET, "action", FILTER_CALLBACK, array("options" => "validateAction")); if ($id && $action) { if (!is_admin($_SESSION["username"])) { -- PHP Webmaster List Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
