summaryrefslogtreecommitdiff
path: root/includes/pages/admin_arrive.php
diff options
context:
space:
mode:
authorPhilip Häusler <msquare@notrademark.de>2012-12-27 03:04:54 +0100
committerPhilip Häusler <msquare@notrademark.de>2012-12-27 03:04:54 +0100
commitcaeadadb2734bfc537d3e1701b2a20cad233a07e (patch)
treee0606c6eb37707b372e65cf1c5f6243254eb94fe /includes/pages/admin_arrive.php
parent32cae74a585ecc074124aa5b9668b9f0a25a2ad5 (diff)
parent0f0f847af4c9ffe8138c802086bda7eb15f9baef (diff)
Merge branch 'dev'
Diffstat (limited to 'includes/pages/admin_arrive.php')
-rw-r--r--includes/pages/admin_arrive.php100
1 files changed, 54 insertions, 46 deletions
diff --git a/includes/pages/admin_arrive.php b/includes/pages/admin_arrive.php
index 2acad0b3..70a43394 100644
--- a/includes/pages/admin_arrive.php
+++ b/includes/pages/admin_arrive.php
@@ -1,52 +1,60 @@
<?php
function admin_arrive() {
- $msg = "";
- $search = "";
- if (isset ($_REQUEST['search']))
- $search = strip_request_item('search');
+ $msg = "";
+ $search = "";
+ if (isset ($_REQUEST['search']))
+ $search = strip_request_item('search');
- if (isset ($_REQUEST['reset']) && preg_match("/^[0-9]*$/", $_REQUEST['reset'])) {
- $id = $_REQUEST['reset'];
- sql_query("UPDATE `User` SET `Gekommen`=0 WHERE `UID`=" . sql_escape($id) . " LIMIT 1");
- $msg = success("Reset done. Angel has not arrived.", true);
- }
- elseif (isset ($_REQUEST['arrived']) && preg_match("/^[0-9]*$/", $_REQUEST['arrived'])) {
- $id = $_REQUEST['arrived'];
- sql_query("UPDATE `User` SET `Gekommen`=1 WHERE `UID`=" . sql_escape($id) . " LIMIT 1");
- $msg = success("Angel has been marked as arrived.", true);
- }
+ if (isset ($_REQUEST['reset']) && preg_match("/^[0-9]*$/", $_REQUEST['reset'])) {
+ $id = $_REQUEST['reset'];
+ $user_source = User($id);
+ if($user_source != null) {
+ sql_query("UPDATE `User` SET `Gekommen`=0 WHERE `UID`=" . sql_escape($id) . " LIMIT 1");
+ engelsystem_log("User set to not arrived: " . $user_source['Nick']);
+ $msg = success("Reset done. Angel has not arrived.", true);
+ } else $msg = error("Angel not found.", true);
+ }
+ elseif (isset ($_REQUEST['arrived']) && preg_match("/^[0-9]*$/", $_REQUEST['arrived'])) {
+ $id = $_REQUEST['arrived'];
+ $user_source = User($id);
+ if($user_source != null) {
+ sql_query("UPDATE `User` SET `Gekommen`=1 WHERE `UID`=" . sql_escape($id) . " LIMIT 1");
+ engelsystem_log("User set has arrived: " . $user_source['Nick']);
+ $msg = success("Angel has been marked as arrived.", true);
+ } else $msg = error("Angel not found.", true);
+ }
- $users = sql_select("SELECT * FROM `User` ORDER BY `Nick`");
- $table = "";
- if ($search == "")
- $tokens = array ();
- else
- $tokens = explode(" ", $search);
- foreach ($users as $usr) {
- if (count($tokens) > 0) {
- $match = false;
- $index = join("", $usr);
- foreach ($tokens as $t)
- if (strstr($index, trim($t))) {
- $match = true;
- break;
- }
- if (!$match)
- continue;
- }
- $table .= '<tr>';
- $table .= '<td>' . $usr['Nick'] . '</td>';
- if ($usr['Gekommen'] == 1)
- $table .= '<td>yes</td><td><a href="' . page_link_to('admin_arrive') . '&reset=' . $usr['UID'] . '&search=' . $search . '">reset</a></td>';
- else
- $table .= '<td></td><td><a href="' . page_link_to('admin_arrive') . '&arrived=' . $usr['UID'] . '&search=' . $search . '">arrived</a></td>';
- $table .= '</tr>';
- }
- return template_render('../templates/admin_arrive.html', array (
- 'search' => $search,
- 'table' => $table,
- 'msg' => $msg,
- 'link' => page_link_to('admin_arrive')
- ));
+ $users = sql_select("SELECT * FROM `User` ORDER BY `Nick`");
+ $table = "";
+ if ($search == "")
+ $tokens = array ();
+ else
+ $tokens = explode(" ", $search);
+ foreach ($users as $usr) {
+ if (count($tokens) > 0) {
+ $match = false;
+ $index = join("", $usr);
+ foreach ($tokens as $t)
+ if (strstr($index, trim($t))) {
+ $match = true;
+ break;
+ }
+ if (!$match)
+ continue;
+ }
+ $table .= '<tr>';
+ $table .= '<td>' . $usr['Nick'] . '</td>';
+ if ($usr['Gekommen'] == 1)
+ $table .= '<td>yes</td><td><a href="' . page_link_to('admin_arrive') . '&reset=' . $usr['UID'] . '&search=' . $search . '">reset</a></td>';
+ else
+ $table .= '<td></td><td><a href="' . page_link_to('admin_arrive') . '&arrived=' . $usr['UID'] . '&search=' . $search . '">arrived</a></td>';
+ $table .= '</tr>';
+ }
+ return template_render('../templates/admin_arrive.html', array (
+ 'search' => $search,
+ 'table' => $table,
+ 'msg' => $msg,
+ 'link' => page_link_to('admin_arrive')
+ ));
}
?> \ No newline at end of file