Changeset:
        bf653504ba1d
        
https://sourceforge.net/p/mrbs/hg-code/ci/bf653504ba1d399b3b0f961e7ad48ef01e4840bb
Author:
        Campbell Morrison <[email protected]>
Date:
        Sun Oct 02 15:55:26 2016 +0100
Log message:

Removed the redundant $need_header parameter from fatal_error() - we always 
output a simpole header if a header hasn't already been output.

diffstat:

 web/auth/auth_ldap.inc         |   3 +--
 web/dbsys.inc                  |   2 +-
 web/edit_area_room.php         |   8 ++++----
 web/edit_entry.php             |   7 +++----
 web/edit_users.php             |   2 +-
 web/functions.inc              |   4 ++--
 web/functions_error.inc        |   7 +++----
 web/functions_ical.inc         |   2 +-
 web/mrbs_sql.inc               |  16 ++++++++--------
 web/session/session_cookie.inc |  12 ++++++------
 web/session/session_php.inc    |   2 +-
 web/upgrade/17/post.inc        |   6 +++---
 12 files changed, 34 insertions(+), 37 deletions(-)

diffs (truncated from 309 to 300 lines):

diff -r 50114b7def0d -r bf653504ba1d web/auth/auth_ldap.inc
--- a/web/auth/auth_ldap.inc    Sun Oct 02 15:39:12 2016 +0100
+++ b/web/auth/auth_ldap.inc    Sun Oct 02 15:55:26 2016 +0100
@@ -99,8 +99,7 @@
       if (count($value) != $count)
       {
         authLdapDebug("Count of LDAP array config variables doesn't match, 
aborting!");
-        fatal_error(TRUE,
-                    "MRBS configuration error: Count of LDAP array config 
variables doesn't match, aborting!",
+        fatal_error("MRBS configuration error: Count of LDAP array config 
variables doesn't match, aborting!",
                     false);
         return 0;
       }
diff -r 50114b7def0d -r bf653504ba1d web/dbsys.inc
--- a/web/dbsys.inc     Sun Oct 02 15:39:12 2016 +0100
+++ b/web/dbsys.inc     Sun Oct 02 15:55:26 2016 +0100
@@ -75,7 +75,7 @@
 // either because they don't exist or we don't have permission.
 if (!db()->table_exists($tbl_entry))
 {
-  fatal_error(FALSE, get_vocab('fatal_no_tables'), FALSE);
+  fatal_error(get_vocab('fatal_no_tables'), FALSE);
 }
 
 // Default version is 0, before we had schema versions
diff -r 50114b7def0d -r bf653504ba1d web/edit_area_room.php
--- a/web/edit_area_room.php    Sun Oct 02 15:39:12 2016 +0100
+++ b/web/edit_area_room.php    Sun Oct 02 15:55:26 2016 +0100
@@ -523,7 +523,7 @@
       // Acquire a mutex to lock out others who might be deleting the new area
       if (!db()->mutex_lock($tbl_area))
       {
-        fatal_error(TRUE, get_vocab("failed_to_acquire"));
+        fatal_error(get_vocab("failed_to_acquire"));
       }
       // Check the new area still exists
       if (db()->query1("SELECT COUNT(*) FROM $tbl_area WHERE id=? LIMIT 1", 
array($new_area)) < 1)
@@ -913,7 +913,7 @@
 
   if (empty($room_data))
   {
-    fatal_error(0, get_vocab("error_room") . $room . get_vocab("not_found"));
+    fatal_error(get_vocab("error_room") . $room . get_vocab("not_found"));
   }
   
   echo "<h2>\n";
@@ -945,7 +945,7 @@
       $areas = get_area_names($all=TRUE);
       if (empty($areas))
       {
-        fatal_error(FALSE, get_vocab('noareas'));  // should not happen
+        fatal_error(get_vocab('noareas'));  // should not happen
       }
       
       // The area select box
@@ -1129,7 +1129,7 @@
   $area_data = get_area_details($area);
   if (empty($area_data))
   {
-    fatal_error(0, get_vocab("error_area") . $area . get_vocab("not_found"));
+    fatal_error(get_vocab("error_area") . $area . get_vocab("not_found"));
   }
 
   // Get the settings for this area, from the database if they are there, 
otherwise from
diff -r 50114b7def0d -r bf653504ba1d web/edit_entry.php
--- a/web/edit_entry.php        Sun Oct 02 15:39:12 2016 +0100
+++ b/web/edit_entry.php        Sun Oct 02 15:55:26 2016 +0100
@@ -137,7 +137,7 @@
   // (Shouldn't be possible, but just in case ...)
   if (empty($area['resolution']) || ($area['resolution'] < 0))
   {
-    fatal_error(FALSE, "Internal error - resolution is NULL or <= 0");
+    fatal_error("Internal error - resolution is NULL or <= 0");
   }
   
   if ($area['enable_periods'])
@@ -695,7 +695,7 @@
   
   if (is_null($entry))
   {
-    fatal_error(1, get_vocab("entryid") . $id . get_vocab("not_found"));
+    fatal_error(get_vocab("entryid") . $id . get_vocab("not_found"));
   }
   
   // We've possibly got a new room and area, so we need to update the settings
@@ -819,8 +819,7 @@
     
     if ($res->count() != 1)
     {
-      fatal_error(1,
-                  get_vocab("repeat_id") . $rep_id . get_vocab("not_found"));
+      fatal_error(get_vocab("repeat_id") . $rep_id . get_vocab("not_found"));
     }
 
     $row = $res->row_keyed(0);
diff -r 50114b7def0d -r bf653504ba1d web/edit_users.php
--- a/web/edit_users.php        Sun Oct 02 15:39:12 2016 +0100
+++ b/web/edit_users.php        Sun Oct 02 15:55:26 2016 +0100
@@ -788,7 +788,7 @@
   $target_level = db()->query1("SELECT level FROM $tbl_users WHERE id=? LIMIT 
1", array($Id));
   if ($target_level < 0)
   {
-    fatal_error(TRUE, "Fatal error while deleting a user");
+    fatal_error("Fatal error while deleting a user");
   }
   // you can't delete a user if you're not some kind of admin, and then you 
can't
   // delete someone higher than you
diff -r 50114b7def0d -r bf653504ba1d web/functions.inc
--- a/web/functions.inc Sun Oct 02 15:39:12 2016 +0100
+++ b/web/functions.inc Sun Oct 02 15:55:26 2016 +0100
@@ -25,7 +25,7 @@
     // to prevent people running into DST problems
     $message = 'MRBS configuration error: $timezone has not been set.';
     trigger_error($message, E_USER_WARNING);
-    fatal_error(FALSE, $message);
+    fatal_error($message);
   }
   else
   {
@@ -35,7 +35,7 @@
       {
         $message = "MRBS configuration error: invalid timezone '$timezone'";
         trigger_error($message, E_USER_WARNING);
-        fatal_error(FALSE, $message);
+        fatal_error($message);
       }
     }
     else
diff -r 50114b7def0d -r bf653504ba1d web/functions_error.inc
--- a/web/functions_error.inc   Sun Oct 02 15:39:12 2016 +0100
+++ b/web/functions_error.inc   Sun Oct 02 15:55:26 2016 +0100
@@ -55,16 +55,15 @@
       break;
   }
   
-  fatal_error(false, $message, false, false);
+  fatal_error($message, false, false);
 }
 
 
 // Error handler - this is used to display serious errors such as database
 // errors without sending incomplete HTML pages. This is only used for
 // errors which "should never happen", not those caused by bad inputs.
-// If $need_header!=0 output the top of the page too, else assume the
-// caller did that. Always outputs the bottom of the page and exits.
-function fatal_error($need_header, $message, $show_form_data = true, 
$show_debug = true)
+// Always outputs the bottom of the page and exits.
+function fatal_error($message, $show_form_data = true, $show_debug = true)
 {
   global $simple_trailer, $weekstarts, $view_week_number, $strftime_format;
 
diff -r 50114b7def0d -r bf653504ba1d web/functions_ical.inc
--- a/web/functions_ical.inc    Sun Oct 02 15:39:12 2016 +0100
+++ b/web/functions_ical.inc    Sun Oct 02 15:55:26 2016 +0100
@@ -106,7 +106,7 @@
   // time as us (we want just one entry per timezone)
   if (!db()->mutex_lock($tbl_zoneinfo))
   {
-    fatal_error(TRUE, get_vocab("failed_to_acquire"));
+    fatal_error(get_vocab("failed_to_acquire"));
   }
   
   // Look and see if there's a component in the database
diff -r 50114b7def0d -r bf653504ba1d web/mrbs_sql.inc
--- a/web/mrbs_sql.inc  Sun Oct 02 15:39:12 2016 +0100
+++ b/web/mrbs_sql.inc  Sun Oct 02 15:55:26 2016 +0100
@@ -646,7 +646,7 @@
     // allow custom fields with spaces in them (or else have custom fields 
created by MRBS).
     if (strpos($key, ' ') !== FALSE)
     {
-      fatal_error(FALSE, "Custom field names cannot contain spaces.", FALSE);
+      fatal_error("Custom field names cannot contain spaces.", FALSE);
     }
     
     // If the key doesn't exist in the $data array then the database will just 
use its
@@ -1263,7 +1263,7 @@
     }
     else
     {
-      fatal_error(TRUE, ($series ? get_vocab("invalid_series_id") : 
get_vocab("invalid_entry_id")));
+      fatal_error(($series ? get_vocab("invalid_series_id") : 
get_vocab("invalid_entry_id")));
     }
   }
 
@@ -1325,7 +1325,7 @@
         {
           // If this is the entry table then check that the custom field also
           // exists in the repeat table
-          fatal_error(0, "Custom fields problem, '".$field['name']."' exists 
in entry table but not in repeat table");
+          fatal_error("Custom fields problem, '".$field['name']."' exists in 
entry table but not in repeat table");
         }
         
         array_push($terms, "T." . db()->quote($field['name']));
@@ -1368,7 +1368,7 @@
     }
     else
     {
-      fatal_error(TRUE, ($series ? get_vocab("invalid_series_id") : 
get_vocab("invalid_entry_id")));
+      fatal_error(($series ? get_vocab("invalid_series_id") : 
get_vocab("invalid_entry_id")));
     }
   }
 
@@ -1415,7 +1415,7 @@
         }
         else
         {
-          fatal_error(TRUE, get_vocab("invalid_series_id"));
+          fatal_error(get_vocab("invalid_series_id"));
         }
       }
       $row['rep_type']         = $extra_row['rep_type'];
@@ -1629,7 +1629,7 @@
   // Acquire a mutex to lock out others who might be editing the area
   if (!db()->mutex_lock("$tbl_area"))
   {
-    fatal_error(TRUE, get_vocab("failed_to_acquire"));
+    fatal_error(get_vocab("failed_to_acquire"));
   }
   // Check that the area name is unique
   if (db()->query1("SELECT COUNT(*) FROM $tbl_area WHERE area_name=? LIMIT 1", 
array($name)) > 0)
@@ -1710,7 +1710,7 @@
   // Acquire a mutex to lock out others who might be editing rooms
   if (!db()->mutex_lock($tbl_room))
   {
-    fatal_error(TRUE, get_vocab("failed_to_acquire"));
+    fatal_error(get_vocab("failed_to_acquire"));
   }
   // Check that the room name is unique within the area
   if (db()->query1("SELECT COUNT(*) FROM $tbl_room WHERE room_name=? AND 
area_id=? LIMIT 1",
@@ -1798,7 +1798,7 @@
   // Acquire mutex to lock out others trying to book the same slot(s).
   if (!db()->mutex_lock($tbl_entry))
   {
-    fatal_error(1, get_vocab("failed_to_acquire"));
+    fatal_error(get_vocab("failed_to_acquire"));
   }
 
   // Validate the booking for (a) conflicting bookings and (b) conformance to 
rules
diff -r 50114b7def0d -r bf653504ba1d web/session/session_cookie.inc
--- a/web/session/session_cookie.inc    Sun Oct 02 15:39:12 2016 +0100
+++ b/web/session/session_cookie.inc    Sun Oct 02 15:55:26 2016 +0100
@@ -97,9 +97,9 @@
     $json_data = json_encode($session_data);
     if (!function_exists('hash_hmac'))
     {
-      fatal_error(FALSE, "It appears that your PHP has the hash functions ".
-                          "disabled, which are required for the 'cookie' ".
-                          "session scheme.");
+      fatal_error("It appears that your PHP has the hash functions " .
+                  "disabled, which are required for the 'cookie' " .
+                  "session scheme.");
     }
     $hash = hash_hmac(
                       $auth["session_cookie"]["hash_algorithm"],
@@ -257,9 +257,9 @@
 
     if (!function_exists('hash_hmac'))
     {
-      fatal_error(FALSE, "It appears that your PHP has the hash functions ".
-                          "disabled, which are required for the 'cookie' ".
-                          "session scheme.");
+      fatal_error("It appears that your PHP has the hash functions ".
+                  "disabled, which are required for the 'cookie' ".
+                  "session scheme.");
     }
     if (hash_hmac(
                   $auth["session_cookie"]["hash_algorithm"],
diff -r 50114b7def0d -r bf653504ba1d web/session/session_php.inc
--- a/web/session/session_php.inc       Sun Oct 02 15:39:12 2016 +0100
+++ b/web/session/session_php.inc       Sun Oct 02 15:55:26 2016 +0100
@@ -58,7 +58,7 @@
 if (FALSE === session_start())
 {
   trigger_error("MRBS: could not start session", E_USER_WARNING);
-  fatal_error(TRUE, "MRBS: server configuration error.", FALSE);
+  fatal_error("MRBS: server configuration error.", FALSE);
 }
 
 // Check to see if we've been inactive for longer than allowed and if so logout
diff -r 50114b7def0d -r bf653504ba1d web/upgrade/17/post.inc
--- a/web/upgrade/17/post.inc   Sun Oct 02 15:39:12 2016 +0100
+++ b/web/upgrade/17/post.inc   Sun Oct 02 15:55:26 2016 +0100
@@ -32,7 +32,7 @@
 // who know the database username and password, but just in case ...)
 if (!$admin_handle->mutex_lock($tbl_entry))
 {
-  fatal_error(1, get_vocab("failed_to_acquire"));
+  fatal_error(get_vocab("failed_to_acquire"));
 }
 
 $sql = "UPDATE $tbl_entry
@@ -53,7 +53,7 @@
 // who know the database username and password, but just in case ...)
 if (!$admin_handle->mutex_lock($tbl_repeat))
 {
-  fatal_error(1, get_vocab("failed_to_acquire"));
+  fatal_error(get_vocab("failed_to_acquire"));
 }
 
 $sql = "UPDATE $tbl_repeat

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to