gforge-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gforge-commits] gforge/common/include escapingUtils.php,1.1,1.2


From: gsmet
Subject: [Gforge-commits] gforge/common/include escapingUtils.php,1.1,1.2
Date: Tue, 07 Dec 2004 10:09:08 -0600

Update of /cvsroot/gforge/gforge/common/include
In directory db.perdue.net:/tmp/cvs-serv17006/common/include

Modified Files:
        escapingUtils.php 
Log Message:
added getXXXFromRequest

Index: escapingUtils.php
===================================================================
RCS file: /cvsroot/gforge/gforge/common/include/escapingUtils.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- escapingUtils.php   15 Jan 2004 10:24:35 -0000      1.1
+++ escapingUtils.php   7 Dec 2004 16:09:06 -0000       1.2
@@ -1,9 +1,9 @@
 <?php
 
 /**
- * GForge Mailing Lists Facility
+ * GForge escaping library
  *
- * Copyright 2003 Guillaume Smet
+ * Copyright 2003-2004 Guillaume Smet
  * http://gforge.org/
  *
  * @version   $Id$
@@ -26,6 +26,28 @@
  */
 
 /**
+ * getIntFromRequest - get an int from REQUEST
+ *
+ * @param string $key key of the wanted value
+ * @param int $defaultValue if we can't find the wanted value, it returns the 
default value
+ * @return int the value
+ */
+function getIntFromRequest($key, $defaultValue = 0) {
+       return _getIntFromArray(_getRequestArray(), $key, $defaultValue);
+}
+
+/**
+ * getStringFromRequest - get a string from REQUEST
+ *
+ * @param string $key key of the wanted value
+ * @param string $defaultValue if we can't find the wanted value, it returns 
the default value
+ * @return string the value
+ */
+function getStringFromRequest($key, $defaultValue = '') {
+       return _getStringFromArray(_getRequestArray(), $key, $defaultValue);
+}
+
+/**
  * getIntFromPost - get an int from POST
  *
  * @param string $key key of the wanted value
@@ -184,6 +206,19 @@
 }
 
 /**
+ * _getRequestArray - wrapper to get the request array
+ *
+ * @return array the REQUEST array
+ */
+function & _getRequestArray() {
+       if(isset($_REQUEST)) {
+               return $_REQUEST;
+       } else {
+               return array_merge($GLOBALS['HTTP_GET_VARS'], 
$GLOBALS['HTTP_POST_VARS'], $GLOBALS['HTTP_COOKIE_VARS']);
+       }
+}
+
+/**
  * _getPostArray - wrapper to get the post array
  *
  * @return array the POST array
@@ -285,4 +320,4 @@
        return strtr($string, array_flip($htmlTranslationTable));
 }
 
-?>
\ No newline at end of file
+?>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]