summaryrefslogtreecommitdiff
path: root/inc/pageutils.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2005-10-21 23:23:04 +0200
committerAndreas Gohr <andi@splitbrain.org>2005-10-21 23:23:04 +0200
commit42905504e134d999710eacf73253844e85cf6fec (patch)
treeadc7d8e56058fb2b5c2b8ec45eb758a4bf701495 /inc/pageutils.php
parentbc228f156741b7e3e76517034e52463eb7d73fc2 (diff)
downloadrpg-42905504e134d999710eacf73253844e85cf6fec.tar.gz
rpg-42905504e134d999710eacf73253844e85cf6fec.tar.bz2
some fixes for getID and the detail page
darcs-hash:20051021212304-7ad00-f01b3954b6b71ecc9e0cf899ed62bfb33e0c437e.gz
Diffstat (limited to 'inc/pageutils.php')
-rw-r--r--inc/pageutils.php17
1 files changed, 8 insertions, 9 deletions
diff --git a/inc/pageutils.php b/inc/pageutils.php
index bf629c097..1dc66981d 100644
--- a/inc/pageutils.php
+++ b/inc/pageutils.php
@@ -13,19 +13,16 @@
* Uses either standard $_REQUEST variable or extracts it from
* the full request URI when userewrite is set to 2
*
- * For $param='id' $conf['start'] is returned if no id was found
- * and the returned ID will be cleaned. For other params the
- * cleaning has to be done outside this function
+ * For $param='id' $conf['start'] is returned if no id was found.
+ * If the second parameter is true (default) the ID is cleaned.
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
-function getID($param='id'){
+function getID($param='id',$clean=true){
global $conf;
$id = $_REQUEST[$param];
- if($param == 'id') $id = cleanID($id);
-
//construct page id from request URI
if(empty($id) && $conf['userewrite'] == 2){
//get the script URL
@@ -52,10 +49,12 @@ function getID($param='id'){
$id = preg_replace ('/\?.*/','',$match[1]);
}
$id = urldecode($id);
- $id = cleanID($id);
+ //strip leading slashes
+ $id = preg_replace('!^/+!','',$id);
}
- if(empty($id) && $param=='id') $id = cleanID($conf['start']);
-
+ if(empty($id) && $param=='id') $id = $conf['start'];
+ if($clean) $id = cleanID($id);
+
return $id;
}