Changeset:
        5abfcd33114b
        
https://sourceforge.net/p/mrbs/hg-code/ci/5abfcd33114bcc88325ab76bf58c33296c24007a
Author:
        Campbell Morrison <[email protected]>
Date:
        Tue Dec 13 10:39:37 2016 +0000
Log message:

Moved the SQL query of the entry table until after the authorisation check for 
the page has been done, to avoid unnecessary database queries.

diffstat:

 web/day.php   |  13 +++++++------
 web/month.php |  13 +++++++------
 web/week.php  |  13 +++++++------
 3 files changed, 21 insertions(+), 18 deletions(-)

diffs (90 lines):

diff -r 891da51bdd07 -r 5abfcd33114b web/day.php
--- a/web/day.php       Fri Dec 09 17:08:46 2016 +0000
+++ b/web/day.php       Tue Dec 13 10:39:37 2016 +0000
@@ -10,19 +10,20 @@
 $timetohighlight = get_form_var('timetohighlight', 'int');
 $ajax = get_form_var('ajax', 'int');
 
+// Check the user is authorised for this page
+if (!checkAuthorised($just_check = $ajax))
+{
+  exit;
+}
+
 $inner_html = day_table_innerhtml($day, $month, $year, $room, $area, 
$timetohighlight);
 
 if ($ajax)
 {
-  if (checkAuthorised(TRUE))
-  {
-    echo $inner_html;
-  }
+  echo $inner_html;
   exit;
 }
 
-// Check the user is authorised for this page
-checkAuthorised();
 
 // Form the room parameter for use in query strings.    We want to preserve 
room information
 // if possible when switching between views
diff -r 891da51bdd07 -r 5abfcd33114b web/month.php
--- a/web/month.php     Fri Dec 09 17:08:46 2016 +0000
+++ b/web/month.php     Tue Dec 13 10:39:37 2016 +0000
@@ -394,19 +394,20 @@
 $debug_flag = get_form_var('debug_flag', 'int');
 $ajax = get_form_var('ajax', 'int');
 
+// Check the user is authorised for this page
+if (!checkAuthorised($just_check = $ajax))
+{
+  exit;
+}
+
 $inner_html = month_table_innerhtml($day, $month, $year, $room, $area);
 
 if ($ajax)
 {
-  if (checkAuthorised(TRUE))
-  {
-    echo $inner_html;
-  }
+  echo $inner_html;
   exit;
 }
 
-// Check the user is authorised for this page
-checkAuthorised();
 
 $user = getUserName();
 
diff -r 891da51bdd07 -r 5abfcd33114b web/week.php
--- a/web/week.php      Fri Dec 09 17:08:46 2016 +0000
+++ b/web/week.php      Tue Dec 13 10:39:37 2016 +0000
@@ -13,19 +13,20 @@
 $timetohighlight = get_form_var('timetohighlight', 'int');
 $ajax = get_form_var('ajax', 'int');
 
+// Check the user is authorised for this page
+if (!checkAuthorised($just_check = $ajax))
+{
+  exit;
+}
+
 $inner_html = week_table_innerhtml($day, $month, $year, $room, $area, 
$timetohighlight);
 
 if ($ajax)
 {
-  if (checkAuthorised(TRUE))
-  {
-    echo $inner_html;
-  }
+  echo $inner_html;
   exit;
 }
 
-// Check the user is authorised for this page
-checkAuthorised();
 
 // print the page header
 print_header($day, $month, $year, $area, isset($room) ? $room : "");

------------------------------------------------------------------------------
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