summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/log/owncloud.php2
-rw-r--r--lib/private/repair.php21
-rwxr-xr-xlib/private/request.php29
-rw-r--r--lib/private/updater.php6
4 files changed, 49 insertions, 9 deletions
diff --git a/lib/private/log/owncloud.php b/lib/private/log/owncloud.php
index 15cace88f41..4c86d0e45e0 100644
--- a/lib/private/log/owncloud.php
+++ b/lib/private/log/owncloud.php
@@ -68,6 +68,8 @@ class OC_Log_Owncloud {
$timezone = new DateTimeZone('UTC');
}
$time = new DateTime(null, $timezone);
+ // remove username/passswords from URLs before writing the to the log file
+ $message = preg_replace('/\/\/(.*):(.*)@/', '//xxx:xxx@', $message);
$entry=array('app'=>$app, 'message'=>$message, 'level'=>$level, 'time'=> $time->format($format));
$entry = json_encode($entry);
$handle = @fopen(self::$logFile, 'a');
diff --git a/lib/private/repair.php b/lib/private/repair.php
new file mode 100644
index 00000000000..e9de3baa7ce
--- /dev/null
+++ b/lib/private/repair.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Copyright (c) 2013 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC;
+
+use OC\Hooks\BasicEmitter;
+
+class Repair extends BasicEmitter {
+ /**
+ * run a series of repair steps for common problems
+ * progress can be reported by emitting \OC\Repair::step events
+ */
+ public function run() {
+ $this->emit('\OC\Repair', 'step', array('No repair steps configured at the moment'));
+ }
+}
diff --git a/lib/private/request.php b/lib/private/request.php
index 7a75bf25208..37d918d2032 100755
--- a/lib/private/request.php
+++ b/lib/private/request.php
@@ -142,17 +142,30 @@ class OC_Request {
$requestUri = '/' . ltrim($requestUri, '/');
}
+ // Remove the query string from REQUEST_URI
+ if ($pos = strpos($requestUri, '?')) {
+ $requestUri = substr($requestUri, 0, $pos);
+ }
+
$scriptName = $_SERVER['SCRIPT_NAME'];
- // in case uri and script name don't match we better throw an exception
- if (strpos($requestUri, $scriptName) !== 0) {
- throw new Exception("REQUEST_URI($requestUri) does not start with the SCRIPT_NAME($scriptName)");
+ $path_info = $requestUri;
+
+ // strip off the script name's dir and file name
+ list($path, $name) = \Sabre_DAV_URLUtil::splitPath($scriptName);
+ if (!empty($path)) {
+ if( $path === $path_info || strpos($path_info, $path.'/') === 0) {
+ $path_info = substr($path_info, strlen($path));
+ } else {
+ throw new Exception("The requested uri($requestUri) cannot be processed by the script '$scriptName')");
+ }
}
- $path_info = substr($requestUri, strlen($scriptName));
- // Remove the query string from REQUEST_URI
- if ($pos = strpos($path_info, '?')) {
- $path_info = substr($path_info, 0, $pos);
+ if (strpos($path_info, '/'.$name) === 0) {
+ $path_info = substr($path_info, strlen($name) + 1);
}
- return $path_info;
+ if (strpos($path_info, $name) === 0) {
+ $path_info = substr($path_info, strlen($name));
+ }
+ return rtrim($path_info, '/');
}
/**
diff --git a/lib/private/updater.php b/lib/private/updater.php
index a1b07c5a242..764a0f14120 100644
--- a/lib/private/updater.php
+++ b/lib/private/updater.php
@@ -37,7 +37,7 @@ class Updater extends BasicEmitter {
/**
* Check if a new version is available
- * @param string $updateUrl the url to check, i.e. 'http://apps.owncloud.com/updater.php'
+ * @param string $updaterUrl the url to check, i.e. 'http://apps.owncloud.com/updater.php'
* @return array | bool
*/
public function check($updaterUrl) {
@@ -116,6 +116,10 @@ class Updater extends BasicEmitter {
\OC_App::checkAppsRequirements();
// load all apps to also upgrade enabled apps
\OC_App::loadApps();
+
+ $repair = new Repair();
+ $repair->run();
+
\OC_Config::setValue('maintenance', false);
$this->emit('\OC\Updater', 'maintenanceEnd');
}