[schoorbs commit] r714 - trunk

0 views
Skip to first unread message

codesite...@google.com

unread,
Nov 4, 2008, 10:06:14 AM11/4/08
to schoor...@googlegroups.com
Author: xhochy
Date: Tue Nov 4 07:05:47 2008
New Revision: 714

Modified:
trunk/config.xml
trunk/edit-area.php

Log:
Added some comments to edit-area

Modified: trunk/config.xml
==============================================================================
--- trunk/config.xml (original)
+++ trunk/config.xml Tue Nov 4 07:05:47 2008
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
<!--
This is the main configuration file for Schoorbs 2.0, it replaces the old
config.inc.php of Schoorbs 1.x/MRBS 1.x. Doing everything with XML Syntax,
@@ -12,7 +13,6 @@
easier and backups more efficent, since there will only be one file which
assigns a certain database connection to a certain URL.
-->
-<?xml version="1.0" encoding="UTF-8"?>
<config>
<!-- Your company name -->
<option key="company" value="XhochY" />

Modified: trunk/edit-area.php
==============================================================================
--- trunk/edit-area.php (original)
+++ trunk/edit-area.php Tue Nov 4 07:05:47 2008
@@ -1,6 +1,7 @@
<?php
/**
- * Edit an area
+ * Edit an area. Mainly the only thing which could be edited is the name
of this
+ * area.
*
* @author Uwe L. Korn <uw...@xhochy.org>
* @package Schoorbs
@@ -21,23 +22,32 @@
showAccessDenied();
}

+// Check if an area id was supplied, if there is none, we won't know which
area
+// we want to edit, a default area selecton might be nice, but if the user
+// doesn't directly knows that he is editing a random area, he might
change the
+// false area.
if (!isset($_REQUEST['area'])) {
SchoorbsTPL::error(Lang::_('No valid area(-id) was provided!'));
exit();
+// An emty area id might indicated a false call, if we would use intval()
on
+// this, it will return 0, so area 0 would be edited which might be
confusing.
} else if (empty($_REQUEST['area'])) {
SchoorbsTPL::error(Lang::_('No valid area(-id) was provided!'));
exit();
}

+// Get the area id as an integer.
$nArea = intval($_REQUEST['area']);

/** @todo report if an empty string was submitted **/
if (isset($_REQUEST['area-name']) && !empty($_REQUEST['area-name'])) {
- // Update! and redirect
+ // Get the area out of the database
$oArea = Area::getById($nArea);
+ // Update its name.
$oArea->setName(unslashes($_REQUEST['area-name']));
- // destruct to save it
+ // Destruct to save it
$oArea = null;
+ // redirect to the administration view of this area.
header(sprintf('Location: administration.php?area=%d', $nArea));
} else {
// Edit!

Reply all
Reply to author
Forward
0 new messages