Revision: 1605
http://mrbs.svn.sourceforge.net/mrbs/?rev=1605&view=rev
Author: cimorrison
Date: 2010-11-16 18:00:50 +0000 (Tue, 16 Nov 2010)
Log Message:
-----------
- Added some checks for a valid setting of $resolution
- Moved internal checking out of theme.inc and into internalconfig.inc.php
Modified Paths:
--------------
mrbs/trunk/web/edit_entry.php
mrbs/trunk/web/internalconfig.inc.php
mrbs/trunk/web/theme.inc
Modified: mrbs/trunk/web/edit_entry.php
===================================================================
--- mrbs/trunk/web/edit_entry.php 2010-11-16 17:14:18 UTC (rev 1604)
+++ mrbs/trunk/web/edit_entry.php 2010-11-16 18:00:50 UTC (rev 1605)
@@ -64,8 +64,14 @@
// local variables, not globals.
$enable_periods = $area['enable_periods'];
$resolution = ($enable_periods) ? 60 : $area['resolution'];
+ // Check that $resolution is positive to avoid an infinite loop below.
+ // (Shouldn't be possible, but just in case ...)
+ if (empty($resolution) || ($resolution < 0))
+ {
+ fatal_error(FALSE, "Internal error - resolution is NULL or <= 0");
+ }
// If they've asked for "display: none" then we'll also disable the select so
- // hat there is only one select passing through the variable to the handler
+ // that there is only one select passing through the variable to the handler
$disabled = (strtolower($display) == "none") ? " disabled=\"disabled\"" : "";
$date = getdate($time);
Modified: mrbs/trunk/web/internalconfig.inc.php
===================================================================
--- mrbs/trunk/web/internalconfig.inc.php 2010-11-16 17:14:18 UTC (rev
1604)
+++ mrbs/trunk/web/internalconfig.inc.php 2010-11-16 18:00:50 UTC (rev
1605)
@@ -2,9 +2,45 @@
// $Id$
-// This file contains internal configuration settings. You should not need
-// to change them unless you are making changes to the MRBS code.
+// This file contains internal configuration settings and checking. You
should not
+// need to change this file unless you are making changes to the MRBS code.
+/********************************************************
+ * Checking
+ ********************************************************/
+// Do some consistency checking of user settings from config.inc.php
+// (and redefine $max_slots if we're using periods)
+if ($enable_periods)
+{
+ $max_slots = count($periods); // We know exactly how many we need
+ if (count($periods) > 60)
+ {
+ die('Configuration error: too many periods defined');
+ }
+}
+else
+{
+ if (!isset($resolution))
+ {
+ die('Configuration error: $resolution has not been set.');
+ }
+ if ($resolution <= 0)
+ {
+ die('Configuration error: $resolution is less than or equal to zero.');
+ }
+ if ($resolution%60 != 0)
+ {
+ die('Configuration error: $resolution is not an integral number of
minutes.');
+ }
+ $start_first_slot = ($morningstarts*60) + $morningstarts_minutes; //
minutes
+ $start_last_slot = ($eveningends*60) + $eveningends_minutes; //
minutes
+ $start_difference = ($start_last_slot - $start_first_slot) * 60; //
seconds
+ if (($start_difference < 0) or ($start_difference%$resolution != 0))
+ {
+ die('Configuration error: make sure that $eveningends is after
$morningstarts
+ and that the length of the booking day is an integral multiple of
$resolution.');
+ }
+}
/***************************************
* DOCTYPE - internal use, do not change
@@ -138,7 +174,7 @@
$area_defaults['enable_periods'] = $enable_periods;
$area_defaults['confirmation_enabled'] = $confirmation_enabled;
$area_defaults['confirmed_default'] = $confirmed_default;
-
+
/********************************************************
* PHP System Configuration - internal use, do not change
********************************************************/
Modified: mrbs/trunk/web/theme.inc
===================================================================
--- mrbs/trunk/web/theme.inc 2010-11-16 17:14:18 UTC (rev 1604)
+++ mrbs/trunk/web/theme.inc 2010-11-16 18:00:50 UTC (rev 1605)
@@ -10,25 +10,4 @@
require_once "Themes/default/styling.inc";
@include_once "Themes/$theme/styling.inc"; // overwrite the default with the
specified styling if it exists
-// Do some consistency checking of user settings from config.inc.php
-// (and redefine $max_slots if we're using periods)
-if ($enable_periods)
-{
- $max_slots = count($periods); // We know exactly how many we need
- if (count($periods) > 60)
- {
- die('Configuration error: too many periods defined');
- }
-}
-else
-{
- $start_first_slot = ($morningstarts*60) + $morningstarts_minutes; //
minutes
- $start_last_slot = ($eveningends*60) + $eveningends_minutes; //
minutes
- $start_difference = ($start_last_slot - $start_first_slot) * 60; //
seconds
- if (($start_difference < 0) or ($start_difference%$resolution != 0))
- {
- die('Configuration error: make sure that $eveningends is after
$morningstarts
- and that the length of the booking day is an integral multiple of
$resolution.');
- }
-}
?>
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
Spend less time writing and rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits