summaryrefslogtreecommitdiffstats
path: root/lib/helper.php
diff options
context:
space:
mode:
authorFrançois Kubler <francois@kubler.org>2011-05-17 22:34:31 +0200
committerFrançois Kubler <francois@kubler.org>2011-05-17 22:34:31 +0200
commit13ddf8100f7b4aace962598a75aadbf228c4aaa7 (patch)
treee5d3e868bb4efaf0025b405b1d593a8abb92959e /lib/helper.php
parenta8fb310d79d604ec0e4235dcd40828c3feb3a3be (diff)
downloadnextcloud-server-13ddf8100f7b4aace962598a75aadbf228c4aaa7.tar.gz
nextcloud-server-13ddf8100f7b4aace962598a75aadbf228c4aaa7.zip
New installer.
* Forms have been revamped (CSS + javascript), * Process has been improved : errors are displayed on the form page, * Some changes in the index.php page so that everything related to installation is in lib/setup.php * Also added a small function in OC_HELPER class to set input values. All these should improve the installation process in terms of ergonomics. Well, I do hope so.
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\" ";
+ }
}
?>