]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #1172: URL now checked for trailing slash upon installation.
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Fri, 8 Jan 2010 20:49:45 +0000 (20:49 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Fri, 8 Jan 2010 20:49:45 +0000 (20:49 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@3787 36083f99-b078-4883-b0ff-0f9b5a30f544

actions/systemsettings/install.php
engine/lib/input.php

index 41a2a8b22b7644357328d91e9f6c0ad87b4f584d..c4f563beb5d72e532419cf6e3156373db3643b6c 100644 (file)
@@ -22,6 +22,7 @@ if (get_input('settings') == 'go') {
                // Sanitise
                $path = sanitise_filepath(get_input('path'));
                $dataroot = sanitise_filepath(get_input('dataroot'));
+               $url = sanitise_filepath(get_input('wwwroot'));
 
                // Blank?
                if ($dataroot == "/") {
@@ -40,7 +41,7 @@ if (get_input('settings') == 'go') {
 
                $site = new ElggSite();
                $site->name = get_input('sitename');
-               $site->url = get_input('wwwroot');
+               $site->url = $url;
                $site->description = get_input('sitedescription');
                $site->email = get_input('siteemail');
                $site->access_id = ACCESS_PUBLIC;
index abc2d6811100c6dea853a24cd7430908ce277d1d..f59061312f79f345f225d7b99731289cb0f1371d 100644 (file)
@@ -14,7 +14,7 @@
  *
  * Note: this function does not handle nested arrays (ex: form input of param[m][n])
  * because of the filtering done in htmlawed from the filter_tags call.
- * 
+ *
  * @param $variable string The variable we want to return.
  * @param $default mixed A default value for the variable if it is not found.
  * @param $filter_result If true then the result is filtered for bad tags.
@@ -52,7 +52,7 @@ function get_input($variable, $default = "", $filter_result = true) {
 
 /**
  * Sets an input value that may later be retrieved by get_input
- * 
+ *
  * Note: this function does not handle nested arrays (ex: form input of param[m][n])
  *
  * @param string $variable The name of the variable
@@ -96,7 +96,8 @@ function sanitise_filepath($path) {
 
        // Sort trailing slash
        $path = trim($path);
-       $path = rtrim($path, " /");
+       // rtrim defaults plus /
+       $path = rtrim($path, " \n\t\0\x0B/");
        $path = $path . "/";
 
        return $path;