Modified:
trunk/edit-entry.php
trunk/schoorbs-includes/lang/schoorbs.pot
trunk/schoorbs-misc/themes/contented6/edit-entry.tpl.php
trunk/schoorbs-misc/themes/contented6/footer.tpl.php
Log:
Finished input checks for edit-entry
Modified: trunk/edit-entry.php
==============================================================================
--- trunk/edit-entry.php (original)
+++ trunk/edit-entry.php Tue Mar 3 12:39:30 2009
@@ -121,15 +121,18 @@
// is in the range 0..count(periods)-1
if (!isset($_REQUEST['period'])) {
SchoorbsTPL::error(Lang::_('A starting period was not supplied.'));
+ exit(1);
}
$nPeriod = intval($_REQUEST['period']);
if (($nPeriod >= count($GLOBALS['periods'])) || ($nPeriod < 0)) {
SchoorbsTPL::error(Lang::_('Supplied value for the period is not
valid.'));
+ exit(1);
}
if (!in_array($_REQUEST['dur_units'], array('periods', 'days'))) {
SchoorbsTPL::error(Lang::_('Supplied value for the duration unit is not
valid.'));
+ exit(1);
}
} else {
// If the system runs on a non-perioded basis, check if the
@@ -143,13 +146,40 @@
$nMinute = intval($_REQUEST['minute']);
if (($nHour < 0) || ($nHour > 23)) {
SchoorbsTPL::error(Lang::_('Supplied value for the hour is not
valid.'));
+ exit(1);
}
if (($nMinute < 0) || ($nHour > 59)) {
SchoorbsTPL::error(Lang::_('Supplied value for the minute is not
valid.'));
+ exit(1);
}
if (!in_array($_REQUEST['dur_units'],
array('periods', 'days', 'minutes', 'hours', 'weeks'))) {
SchoorbsTPL::error(Lang::_('Supplied value for the duration unit is not
valid.'));
+ exit(1);
}
}
+
+ if (!isset($_REQUEST['room'])) {
+ SchoorbsTPL::error(Lang::_('The room for the edited entry was not
supplied.'));
+ exit(1);
+ }
+
+ $oRoom = Room::getById(intval($_REQUEST['room']));
+ if ($oRoom === null) {
+ SchoorbsTPL::error(Lang::_('The specified room does not exist.'));
+ exit(1);
+ }
+
+ if (!isset($_REQUEST['type'])) {
+ SchoorbsTPL::error(Lang::_('The type for edited entry was not
supplied.'));
+ exit(1);
+ }
+ if (preg_match('/^[A-Z]$/', $_REQUEST['type']) != 1) {
+ SchoorbsTPL::error(Lang::_('No valid value for the type of this entry
was supplied.'));
+ exit(1);
+ }
+ $cType = $_REQUEST['type'];
+
+ // After the input validation is done, let's commit these changes to the
+ // database.
}
Modified: trunk/schoorbs-includes/lang/schoorbs.pot
==============================================================================
--- trunk/schoorbs-includes/lang/schoorbs.pot (original)
+++ trunk/schoorbs-includes/lang/schoorbs.pot Tue Mar 3 12:39:30 2009
@@ -933,3 +933,15 @@
msgid "Supplied value for the duration unit is not valid."
msgstr ""
+
+msgid "The room for the edited entry was not supplied."
+msgstr ""
+
+msgid "The specified room does not exist."
+msgstr ""
+
+msgid "The type for edited entry was not supplied."
+msgstr ""
+
+msgid "No valid value for the type of this entry was supplied."
+msgstr ""
Modified: trunk/schoorbs-misc/themes/contented6/edit-entry.tpl.php
==============================================================================
--- trunk/schoorbs-misc/themes/contented6/edit-entry.tpl.php (original)
+++ trunk/schoorbs-misc/themes/contented6/edit-entry.tpl.php Tue Mar 3
12:39:30 2009
@@ -54,7 +54,7 @@
<?php foreach (Area::getAreas() as $oArea) { ?>
<optgroup label="<?php echo $oArea->getName(); ?>">
<?php foreach (Room::getRooms($oArea) as $oRoom) { ?>
- <option value="<?php $oRoom->getId(); ?>"<?php if
($oRoom->getId() == $nActiveRoom) echo '
selected="selected"'; ?>> <?php echo
$oRoom->getName(); ?></option>
+ <option value="<?php echo $oRoom->getId(); ?>"<?php if
($oRoom->getId() == $nActiveRoom) echo '
selected="selected"'; ?>> <?php echo
$oRoom->getName(); ?></option>
<?php } ?>
</optgroup>
<?php } ?>
Modified: trunk/schoorbs-misc/themes/contented6/footer.tpl.php
==============================================================================
--- trunk/schoorbs-misc/themes/contented6/footer.tpl.php (original)
+++ trunk/schoorbs-misc/themes/contented6/footer.tpl.php Tue Mar 3
12:39:30 2009
@@ -2,7 +2,7 @@
<div id="copyrightdesign">
Copyright © 2007-2008 <a href="http://xhochy.org">Uwe L. Korn</a>
&
other contributors |
- Design by <a href="http://ContentedDesigns.com">Contented Designs</a>
+ Design by <a href="http://contenteddesigns.org">Contented Designs</a>
</div>
<div id="footercontact">