From 356b2582f3e6a43ecf2607acad4a7fe0b37f659a Mon Sep 17 00:00:00 2001 From: Bot Date: Tue, 3 Jan 2017 03:22:48 +0100 Subject: PPHDoc, formatting, fixes, cleanup --- includes/pages/admin_active.php | 13 +++++-- includes/pages/admin_arrive.php | 8 ++++- includes/pages/admin_free.php | 6 ++++ includes/pages/admin_groups.php | 7 +++- includes/pages/admin_import.php | 31 ++++++++++++++++ includes/pages/admin_log.php | 6 ++++ includes/pages/admin_news.php | 12 +++---- includes/pages/admin_questions.php | 10 ++++++ includes/pages/admin_rooms.php | 9 ++++- includes/pages/admin_shifts.php | 17 ++++++--- includes/pages/admin_user.php | 13 +++++-- includes/pages/guest_credits.php | 7 ++++ includes/pages/guest_login.php | 18 ++++++++-- includes/pages/guest_start.php | 1 + includes/pages/user_atom.php | 18 ++++++++-- includes/pages/user_ical.php | 3 +- includes/pages/user_messages.php | 11 ++++++ includes/pages/user_myshifts.php | 14 ++++++-- includes/pages/user_news.php | 73 +++++++++++++++++++++++++++++++++----- includes/pages/user_questions.php | 8 +++++ includes/pages/user_settings.php | 28 ++++++++------- includes/pages/user_shifts.php | 41 +++++++++++++++------ 22 files changed, 295 insertions(+), 59 deletions(-) (limited to 'includes/pages') diff --git a/includes/pages/admin_active.php b/includes/pages/admin_active.php index 38edbfdb..34b9eb14 100644 --- a/includes/pages/admin_active.php +++ b/includes/pages/admin_active.php @@ -1,10 +1,16 @@ _("Nickname"), 'shirt_size' => _("Size"), diff --git a/includes/pages/admin_arrive.php b/includes/pages/admin_arrive.php index cd910bd0..d0ed4ffc 100644 --- a/includes/pages/admin_arrive.php +++ b/includes/pages/admin_arrive.php @@ -1,10 +1,16 @@ 0) { - list($group) = $group; $privileges = sql_select(" SELECT `Privileges`.*, `GroupPrivileges`.`group_id` FROM `Privileges` diff --git a/includes/pages/admin_import.php b/includes/pages/admin_import.php index 46c13ac7..bef2b86e 100644 --- a/includes/pages/admin_import.php +++ b/includes/pages/admin_import.php @@ -1,10 +1,16 @@ '; } diff --git a/includes/pages/admin_questions.php b/includes/pages/admin_questions.php index c65280d5..032b010e 100644 --- a/includes/pages/admin_questions.php +++ b/includes/pages/admin_questions.php @@ -1,5 +1,8 @@ $shifttype_id ]; } elseif ($mode == 'multi') { - $shift_start = $start; + $shift_start = (int)$start; do { - $shift_end = $shift_start + $length * 60; + $shift_end = $shift_start + (int)$length * 60; if ($shift_end > $end) { $shift_end = $end; @@ -298,6 +304,7 @@ function admin_shifts() redirect(page_link_to('admin_shifts')); } + $needed_angel_types_info = []; foreach ($_SESSION['admin_shifts_shifts'] as $shift) { $shift['URL'] = null; $shift['PSID'] = null; @@ -312,7 +319,7 @@ function admin_shifts() . " from " . date("Y-m-d H:i", $shift['start']) . " to " . date("Y-m-d H:i", $shift['end']) ); - $needed_angel_types_info = []; + foreach ($_SESSION['admin_shifts_types'] as $type_id => $count) { $angel_type_source = sql_select("SELECT * FROM `AngelTypes` WHERE `id`='" . sql_escape($type_id) . "' LIMIT 1"); if (count($angel_type_source) > 0) { diff --git a/includes/pages/admin_user.php b/includes/pages/admin_user.php index 12d92720..c6ce628f 100644 --- a/includes/pages/admin_user.php +++ b/includes/pages/admin_user.php @@ -1,13 +1,19 @@ = '" . sql_escape($my_highest_group) . "' ORDER BY `Groups`.`Name`"); foreach ($groups as $group) { - $html .= '' . $group['Name'] . ''; + $html .= '' . $group['Name'] . ''; } $html .= ''; @@ -167,6 +173,7 @@ function admin_user() case 'save': $force_active = $user['force_active']; + $user_source = User($user_id); if (in_array('admin_active', $privileges)) { $force_active = $_REQUEST['force_active']; } @@ -178,7 +185,7 @@ function admin_user() `Handy` = '" . sql_escape($_POST["eHandy"]) . "', `Alter` = '" . sql_escape($_POST["eAlter"]) . "', `DECT` = '" . sql_escape($_POST["eDECT"]) . "', - " . ($user_source['email_by_human_allowed'] ? "`email` = '" . sql_escape($_POST["eemail"]) . "'" : "") . " + " . ($user_source['email_by_human_allowed'] ? "`email` = '" . sql_escape($_POST["eemail"]) . "'," : "") . " `jabber` = '" . sql_escape($_POST["ejabber"]) . "', `Size` = '" . sql_escape($_POST["eSize"]) . "', `Gekommen`= '" . sql_escape($_POST["eGekommen"]) . "', diff --git a/includes/pages/guest_credits.php b/includes/pages/guest_credits.php index 00b12f73..2e652b6f 100644 --- a/includes/pages/guest_credits.php +++ b/includes/pages/guest_credits.php @@ -1,9 +1,16 @@ diff --git a/includes/pages/user_ical.php b/includes/pages/user_ical.php index 05c67d51..929dc7c7 100644 --- a/includes/pages/user_ical.php +++ b/includes/pages/user_ical.php @@ -47,7 +47,8 @@ function send_ical_from_shifts($shifts) /** * Renders an ical vevent from given shift. * - * @param Shift $shift + * @param array $shift + * @return string */ function make_ical_entry_from_shift($shift) { diff --git a/includes/pages/user_messages.php b/includes/pages/user_messages.php index b7ff093f..5e8c2491 100644 --- a/includes/pages/user_messages.php +++ b/includes/pages/user_messages.php @@ -1,10 +1,16 @@ 0) { $shift = $shift[0]; - if (($shift['start'] > time() + $LETZTES_AUSTRAGEN * 3600) || in_array('user_shifts_admin', $privileges)) { + if (($shift['start'] > time() + $last_unsubscribe * 3600) || in_array('user_shifts_admin', $privileges)) { $result = ShiftEntry_delete($user_id); if ($result === false) { engelsystem_error('Unable to delete shift entry.'); @@ -146,4 +153,5 @@ function user_myshifts() } redirect(page_link_to('users') . '&action=view&user_id=' . $shifts_user['UID']); + return ''; } diff --git a/includes/pages/user_news.php b/includes/pages/user_news.php index 31f38eaa..01da8d27 100644 --- a/includes/pages/user_news.php +++ b/includes/pages/user_news.php @@ -1,23 +1,35 @@

' . meetings_title() . '

' . msg(); @@ -27,12 +39,18 @@ function user_meetings() $page = 0; } - $news = sql_select("SELECT * FROM `News` WHERE `Treffen`=1 ORDER BY `Datum` DESC LIMIT " . sql_escape($page * $DISPLAY_NEWS) . ", " . sql_escape($DISPLAY_NEWS)); + $news = sql_select(" + SELECT * + FROM `News` + WHERE `Treffen`=1 + ORDER BY `Datum`DESC + LIMIT " . sql_escape($page * $display_news) . ", " . sql_escape($display_news) + ); foreach ($news as $entry) { $html .= display_news($entry); } - $dis_rows = ceil(sql_num_query("SELECT * FROM `News`") / $DISPLAY_NEWS); + $dis_rows = ceil(sql_num_query("SELECT * FROM `News`") / $display_news); $html .= '
' . '
'; $html .= ''; return $html; } +/** + * @return string + */ function user_news_comments() { global $user; @@ -93,7 +123,15 @@ function user_news_comments() list($news) = sql_select("SELECT * FROM `News` WHERE `ID`='" . sql_escape($nid) . "' LIMIT 1"); if (isset($_REQUEST["text"])) { $text = preg_replace("/([^\p{L}\p{P}\p{Z}\p{N}\n]{1,})/ui", '', strip_tags($_REQUEST['text'])); - sql_query("INSERT INTO `NewsComments` (`Refid`, `Datum`, `Text`, `UID`) VALUES ('" . sql_escape($nid) . "', '" . date("Y-m-d H:i:s") . "', '" . sql_escape($text) . "', '" . sql_escape($user["UID"]) . "')"); + sql_query(" + INSERT INTO `NewsComments` (`Refid`, `Datum`, `Text`, `UID`) + VALUES ( + '" . sql_escape($nid) . "', + '" . date("Y-m-d H:i:s") . "', + '" . sql_escape($text) . "', + '" . sql_escape($user["UID"]) . "' + ) + "); engelsystem_log("Created news_comment: " . $text); $html .= success(_("Entry saved."), true); } @@ -125,9 +163,12 @@ function user_news_comments() return $html . ''; } +/** + * @return string + */ function user_news() { - global $DISPLAY_NEWS, $privileges, $user; + global $display_news, $privileges, $user; $html = '

' . news_title() . '

' . msg(); @@ -135,7 +176,16 @@ function user_news() if (!isset($_POST["treffen"]) || !in_array("admin_news", $privileges)) { $_POST["treffen"] = 0; } - sql_query("INSERT INTO `News` (`Datum`, `Betreff`, `Text`, `UID`, `Treffen`) " . "VALUES ('" . sql_escape(time()) . "', '" . sql_escape($_POST["betreff"]) . "', '" . sql_escape($_POST["text"]) . "', '" . sql_escape($user['UID']) . "', '" . sql_escape($_POST["treffen"]) . "');"); + sql_query(" + INSERT INTO `News` (`Datum`, `Betreff`, `Text`, `UID`, `Treffen`) + VALUES ( + '" . sql_escape(time()) . "', + '" . sql_escape($_POST["betreff"]) . "', + '" . sql_escape($_POST["text"]) . "', + '" . sql_escape($user['UID']) . "', + '" . sql_escape($_POST["treffen"]) . "' + ) + "); engelsystem_log("Created news: " . $_POST["betreff"] . ", treffen: " . $_POST["treffen"]); success(_("Entry saved.")); redirect(page_link_to('news')); @@ -147,12 +197,17 @@ function user_news() $page = 0; } - $news = sql_select("SELECT * FROM `News` ORDER BY `Datum` DESC LIMIT " . sql_escape($page * $DISPLAY_NEWS) . ", " . sql_escape($DISPLAY_NEWS)); + $news = sql_select(" + SELECT * + FROM `News` + ORDER BY `Datum` + DESC LIMIT " . sql_escape($page * $display_news) . ", " . sql_escape($display_news) + ); foreach ($news as $entry) { $html .= display_news($entry); } - $dis_rows = ceil(sql_num_query("SELECT * FROM `News`") / $DISPLAY_NEWS); + $dis_rows = ceil(sql_num_query("SELECT * FROM `News`") / $display_news); $html .= '
' . '
    '; for ($i = 0; $i < $dis_rows; $i++) { if (isset($_REQUEST['page']) && $i == $_REQUEST['page']) { diff --git a/includes/pages/user_questions.php b/includes/pages/user_questions.php index d1a90292..fa66e8db 100644 --- a/includes/pages/user_questions.php +++ b/includes/pages/user_questions.php @@ -1,10 +1,16 @@ $themes - * List of available themes + * @param array $user_source The user + * @param array $themes List of available themes + * @return mixed */ function user_settings_theme($user_source, $themes) { @@ -140,10 +143,9 @@ function user_settings_theme($user_source, $themes) /** * Change use locale * - * @param User $user_source - * The user - * @param array $locales - * List of available locales + * @param array $user_source The user + * @param array $locales List of available locales + * @return array */ function user_settings_locale($user_source, $locales) { @@ -168,6 +170,8 @@ function user_settings_locale($user_source, $locales) /** * Main user settings page/controller + * + * @return string */ function user_settings() { diff --git a/includes/pages/user_shifts.php b/includes/pages/user_shifts.php index e325989c..405b36ab 100644 --- a/includes/pages/user_shifts.php +++ b/includes/pages/user_shifts.php @@ -1,6 +1,9 @@ '1' . _("The tasks shown here are influenced by the angeltypes you joined already!") - . " " + . ' ' . _("Description of the jobs.") - . "", + . '', 'shifts_table' => msg() . $shiftCalendarRenderer->render(), 'ical_text' => '

    ' . _("iCal export") . '

    ' . sprintf( _("Export of shown shifts. iCal format or JSON format available (please keep secret, otherwise reset the api key)."), @@ -213,6 +230,10 @@ function view_user_shifts() ]); } +/** + * @param array $array + * @return array + */ function get_ids_from_array($array) { return $array["id"]; @@ -227,9 +248,9 @@ function make_select($items, $selected, $name, $title = null) foreach ($items as $i) { $html_items[] = '

    ' - . '' + . ' > ' . $i['name'] . '' . (!isset($i['enabled']) || $i['enabled'] ? '' : glyph("lock")) . '

    '; } -- cgit v1.3.1