summaryrefslogtreecommitdiffstats
path: root/lib/helper.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/helper.php')
-rw-r--r--lib/helper.php26
1 files changed, 24 insertions, 2 deletions
diff --git a/lib/helper.php b/lib/helper.php
index da566a318ac..c57c83e1ef9 100644
--- a/lib/helper.php
+++ b/lib/helper.php
@@ -60,8 +60,8 @@ class OC_HELPER {
global $SERVERROOT;
global $WEBROOT;
// Check if the app is in the app folder
- if( file_exists( "$SERVERROOT/apps/$app/img/$image" )){
- return "$WEBROOT/apps/$app/img/$image";
+ if( file_exists( "$SERVERROOT/apps/img/$app/$image" )){
+ return "$WEBROOT/apps/img/$app/$image";
}
if( !empty( $app )){
return "$WEBROOT/$app/img/$image";
@@ -187,6 +187,28 @@ class OC_HELPER {
else
return FALSE;
}
+
+ /**
+ * @brief Checks $_REQUEST contains a var for the $s key. If so, returns the html-escaped value of this var; otherwise returns the default value provided by $d.
+ * @param $s name of the var to escape, if set.
+ * @param $d default value.
+ * @returns the print-safe value.
+ *
+ */
+
+ //FIXME: should also check for value validation (i.e. the email is an email).
+ public static function init_var($s, $d="") {
+ $r = $d;
+ if(isset($_REQUEST[$s]) && !empty($_REQUEST[$s]))
+ $r = stripslashes(htmlspecialchars($_REQUEST[$s]));
+
+ return $r;
+ }
+
+ public static function init_radio($s, $v, $d) {
+ if((isset($_REQUEST[$s]) && $_REQUEST[$s]==$v) || $v == $d)
+ print "checked=\"checked\" ";
+ }
}
?>