Changeset: 65b140aa769b https://sourceforge.net/p/mrbs/hg-code/ci/65b140aa769bdc30da2ebaf26b6cde76086cc4ff Author: Campbell Morrison <cimorri...@hg.code.sf.net> Date: Sun Mar 05 16:30:28 2017 +0000 Log message:
Restuctured code, changing calls to print_header(). diffstat: web/admin.php | 2 +- web/approve_entry_handler.php | 2 +- web/day.php | 2 +- web/dbsys.inc | 2 +- web/del.php | 4 ++-- web/del_entry.php | 2 +- web/edit_area_room.php | 6 +++--- web/edit_entry.php | 4 ++-- web/edit_entry_handler.php | 8 ++++---- web/edit_users.php | 8 ++++---- web/functions.inc | 8 ++++---- web/help.php | 2 +- web/month.php | 2 +- web/mrbs_auth.inc | 24 ++++++++++-------------- web/pending.php | 2 +- web/report.php | 2 +- web/search.php | 2 +- web/session/session_cookie.inc | 8 ++++---- web/session/session_joomla.inc | 8 ++++---- web/session/session_php.inc | 8 ++++---- web/session/session_wordpress.inc | 8 ++++---- web/view_entry.php | 2 +- web/week.php | 2 +- 23 files changed, 57 insertions(+), 61 deletions(-) diffs (truncated from 515 to 300 lines): diff -r f35a17b2b760 -r 65b140aa769b web/admin.php --- a/web/admin.php Sun Mar 05 15:55:04 2017 +0000 +++ b/web/admin.php Sun Mar 05 16:30:28 2017 +0000 @@ -36,7 +36,7 @@ $required_level = (isset($max_level) ? $max_level : 2); $is_admin = (authGetUserLevel($user) >= $required_level); -print_header($day, $month, $year, isset($area) ? $area : "", isset($room) ? $room : ""); +print_header($day, $month, $year, isset($area) ? $area : null, isset($room) ? $room : null); // Get the details we need for this area if (isset($area)) diff -r f35a17b2b760 -r 65b140aa769b web/approve_entry_handler.php --- a/web/approve_entry_handler.php Sun Mar 05 15:55:04 2017 +0000 +++ b/web/approve_entry_handler.php Sun Mar 05 16:30:28 2017 +0000 @@ -46,7 +46,7 @@ if ((($action == "approve") || ($action == "reject")) && !auth_book_admin($user, $room_id)) { - showAccessDenied($day, $month, $year, $area, isset($room) ? $room : ""); + showAccessDenied($day, $month, $year, $area, isset($room) ? $room : null); exit; } diff -r f35a17b2b760 -r 65b140aa769b web/day.php --- a/web/day.php Sun Mar 05 15:55:04 2017 +0000 +++ b/web/day.php Sun Mar 05 16:30:28 2017 +0000 @@ -31,7 +31,7 @@ $timestamp = mktime(12, 0, 0, $month, $day, $year); // print the page header -print_header($day, $month, $year, $area, isset($room) ? $room : ""); +print_header($day, $month, $year, $area, isset($room) ? $room : null); echo "<div id=\"dwm_header\" class=\"screenonly\">\n"; diff -r f35a17b2b760 -r 65b140aa769b web/dbsys.inc --- a/web/dbsys.inc Sun Mar 05 15:55:04 2017 +0000 +++ b/web/dbsys.inc Sun Mar 05 16:30:28 2017 +0000 @@ -46,7 +46,7 @@ // Get a database username and password function db_get_userpass() { - print_header(0, 0, 0, 0, ""); + print_header(); ?> <form class="form_general" id="db_logon" method="post" action="<?php htmlspecialchars(this_page()); ?>"> <fieldset> diff -r f35a17b2b760 -r 65b140aa769b web/del.php --- a/web/del.php Sun Mar 05 15:55:04 2017 +0000 +++ b/web/del.php Sun Mar 05 16:30:28 2017 +0000 @@ -42,7 +42,7 @@ } else { - print_header($day, $month, $year, $area, isset($room) ? $room : ""); + print_header($day, $month, $year, $area, isset($room) ? $room : null); // We tell them how bad what they're about to do is // Find out how many appointments would be deleted @@ -95,7 +95,7 @@ else { // There are rooms left in the area - print_header($day, $month, $year, $area, isset($room) ? $room : ""); + print_header($day, $month, $year, $area, isset($room) ? $room : null); echo "<p>\n"; echo get_vocab("delarea"); echo "<a href=\"admin.php\">" . get_vocab("backadmin") . "</a>"; diff -r f35a17b2b760 -r 65b140aa769b web/del_entry.php --- a/web/del_entry.php Sun Mar 05 15:55:04 2017 +0000 +++ b/web/del_entry.php Sun Mar 05 16:30:28 2017 +0000 @@ -111,5 +111,5 @@ } // If you got this far then we got an access denied. -showAccessDenied($day, $month, $year, $area, ""); +showAccessDenied($day, $month, $year, $area); diff -r f35a17b2b760 -r 65b140aa769b web/edit_area_room.php --- a/web/edit_area_room.php Sun Mar 05 15:55:04 2017 +0000 +++ b/web/edit_area_room.php Sun Mar 05 16:30:28 2017 +0000 @@ -461,7 +461,7 @@ { if (!$is_admin) { - showAccessDenied($day, $month, $year, $area, ""); + showAccessDenied($day, $month, $year, $area); exit(); } } @@ -862,7 +862,7 @@ // PHASE 1 - GET THE USER INPUT // ---------------------------- -print_header($day, $month, $year, isset($area) ? $area : "", isset($room) ? $room : ""); +print_header($day, $month, $year, isset($area) ? $area : null, isset($room) ? $room : null); if ($is_admin) { @@ -1088,7 +1088,7 @@ // Only admins can see this form if (!$is_admin) { - showAccessDenied($day, $month, $year, $area, ""); + showAccessDenied($day, $month, $year, $area); exit(); } diff -r f35a17b2b760 -r 65b140aa769b web/edit_entry.php --- a/web/edit_entry.php Sun Mar 05 15:55:04 2017 +0000 +++ b/web/edit_entry.php Sun Mar 05 16:30:28 2017 +0000 @@ -1033,11 +1033,11 @@ if (!getWritable($create_by, $user, $room_id)) { - showAccessDenied($day, $month, $year, $area, isset($room) ? $room : ""); + showAccessDenied($day, $month, $year, $area, isset($room) ? $room : null); exit; } -print_header($day, $month, $year, $area, isset($room) ? $room : ""); +print_header($day, $month, $year, $area, isset($room) ? $room : null); // Get the details of all the enabled rooms $rooms = array(); diff -r f35a17b2b760 -r 65b140aa769b web/edit_entry_handler.php --- a/web/edit_entry_handler.php Sun Mar 05 15:55:04 2017 +0000 +++ b/web/edit_entry_handler.php Sun Mar 05 16:30:28 2017 +0000 @@ -10,7 +10,7 @@ { global $day, $month, $year, $area, $room; - print_header($day, $month, $year, $area, isset($room) ? $room : ""); + print_header($day, $month, $year, $area, isset($room) ? $room : null); echo "<h1>" . get_vocab('invalid_booking') . "</h1>\n"; echo "<p>$message</p>\n"; // Print footer and exit @@ -441,7 +441,7 @@ } if (!getWritable($create_by, $user, $target_room)) { - showAccessDenied($day, $month, $year, $area, isset($room) ? $room : ""); + showAccessDenied($day, $month, $year, $area, isset($room) ? $room : null); exit; } @@ -627,7 +627,7 @@ !$is_admin && !empty($auth['only_admin_can_book_repeat'])) { - showAccessDenied($day, $month, $year, $area, isset($room) ? $room : ""); + showAccessDenied($day, $month, $year, $area, isset($room) ? $room : null); exit; } @@ -761,7 +761,7 @@ else { - print_header($day, $month, $year, $area, isset($room) ? $room : ""); + print_header($day, $month, $year, $area, isset($room) ? $room : null); echo "<h2>" . get_vocab("sched_conflict") . "</h2>\n"; if (!empty($result['rules_broken'])) diff -r f35a17b2b760 -r 65b140aa769b web/edit_users.php --- a/web/edit_users.php Sun Mar 05 15:55:04 2017 +0000 +++ b/web/edit_users.php Sun Mar 05 16:30:28 2017 +0000 @@ -297,11 +297,11 @@ /* First make sure the user is authorized */ if (!$initial_user_creation && !auth_can_edit_user($user, $data['name'])) { - showAccessDenied(0, 0, 0, "", ""); + showAccessDenied(); exit(); } - print_header(0, 0, 0, 0, ""); + print_header(); if ($initial_user_creation == 1) { @@ -792,7 +792,7 @@ // delete someone higher than you if (($level < $min_user_editing_level) || ($level < $target_level)) { - showAccessDenied(0, 0, 0, "", ""); + showAccessDenied(); exit(); } @@ -809,7 +809,7 @@ if (!$ajax) { - print_header(0, 0, 0, "", ""); + print_header(); print "<h2>" . get_vocab("user_list") . "</h2>\n"; diff -r f35a17b2b760 -r 65b140aa769b web/functions.inc --- a/web/functions.inc Sun Mar 05 15:55:04 2017 +0000 +++ b/web/functions.inc Sun Mar 05 16:30:28 2017 +0000 @@ -175,7 +175,7 @@ // Print the page header -function print_header($day, $month, $year, $area, $room, $simple=false, $search_str='') +function print_header($day=null, $month=null, $year=null, $area=null, $room=null, $simple=false, $search_str='') { global $theme; @@ -199,15 +199,15 @@ } // If we dont know the right date then make it up - if (!$day) + if (!isset($day)) { $day = date("d"); } - if (!$month) + if (!isset($month)) { $month = date("m"); } - if (!$year) + if (!isset($year)) { $year = date("Y"); } diff -r f35a17b2b760 -r 65b140aa769b web/help.php --- a/web/help.php Sun Mar 05 15:55:04 2017 +0000 +++ b/web/help.php Sun Mar 05 16:30:28 2017 +0000 @@ -10,7 +10,7 @@ $user = getUserName(); $is_admin = (authGetUserLevel($user) >= $max_level); -print_header($day, $month, $year, $area, isset($room) ? $room : ""); +print_header($day, $month, $year, $area, isset($room) ? $room : null); echo "<h3>" . get_vocab("about_mrbs") . "</h3>\n"; diff -r f35a17b2b760 -r 65b140aa769b web/month.php --- a/web/month.php Sun Mar 05 15:55:04 2017 +0000 +++ b/web/month.php Sun Mar 05 16:30:28 2017 +0000 @@ -402,7 +402,7 @@ // print the page header -print_header($day, $month, $year, $area, isset($room) ? $room : ""); +print_header($day, $month, $year, $area, isset($room) ? $room : null); // Note $room will be 0 if there are no rooms; this is checked for below. diff -r f35a17b2b760 -r 65b140aa769b web/mrbs_auth.inc --- a/web/mrbs_auth.inc Sun Mar 05 15:55:04 2017 +0000 +++ b/web/mrbs_auth.inc Sun Mar 05 16:30:28 2017 +0000 @@ -129,7 +129,7 @@ { $area = get_default_area(); } - showAccessDenied($day, $month, $year, $area, isset($room) ? $room : ""); + showAccessDenied($day, $month, $year, $area, isset($room) ? $room : null); exit(); } @@ -172,22 +172,18 @@ * * Returns: Nothing */ -function showAccessDenied($day, $month, $year, $area, $room) +function showAccessDenied($day=null, $month=null, $year=null, $area=null, $room=null) { global $HTTP_REFERER; - print_header($day, $month, $year, $area, isset($room) ? $room : ""); -?> - <h1><?php echo get_vocab("accessdenied")?></h1> - <p> - <?php echo get_vocab("norights")?> - </p> - <p> - <a href="<?php echo htmlspecialchars($HTTP_REFERER); ?>"> - <?php echo get_vocab("returnprev"); ?> - </a> - </p> -<?php + print_header($day, $month, $year, $area, isset($room) ? $room : null); + + echo "<h1>" . get_vocab("accessdenied") . "</h1>\n"; + echo "<p>" . get_vocab("norights") . "</p>\n"; + echo "<p>\n"; + echo "<a href=\"" . htmlspecialchars($HTTP_REFERER) . "\">\n" . get_vocab("returnprev") . "</a>\n"; + echo "</p>\n"; + // Print footer and exit print_footer(TRUE); } diff -r f35a17b2b760 -r 65b140aa769b web/pending.php ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ Mrbs-commits mailing list Mrbs-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mrbs-commits