summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/private/app.php13
-rw-r--r--lib/private/connector/sabre/node.php6
-rw-r--r--lib/private/files/view.php3
-rw-r--r--lib/private/log/owncloud.php10
-rw-r--r--lib/private/user.php4
-rw-r--r--lib/private/user/dummy.php4
6 files changed, 26 insertions, 14 deletions
diff --git a/lib/private/app.php b/lib/private/app.php
index 0ab1ee57f63..b4a71992178 100644
--- a/lib/private/app.php
+++ b/lib/private/app.php
@@ -165,10 +165,14 @@ class OC_App{
/**
* get all enabled apps
*/
+ private static $enabledAppsCache = array();
public static function getEnabledApps() {
if(!OC_Config::getValue('installed', false)) {
return array();
}
+ if(!empty(self::$enabledAppsCache)) {
+ return self::$enabledAppsCache;
+ }
$apps=array('files');
$sql = 'SELECT `appid` FROM `*PREFIX*appconfig`'
.' WHERE `configkey` = \'enabled\' AND `configvalue`=\'yes\'';
@@ -187,6 +191,7 @@ class OC_App{
$apps[]=$row['appid'];
}
}
+ self::$enabledAppsCache = $apps;
return $apps;
}
@@ -198,11 +203,11 @@ class OC_App{
* This function checks whether or not an app is enabled.
*/
public static function isEnabled( $app ) {
- if( 'files'==$app or ('yes' == OC_Appconfig::getValue( $app, 'enabled' ))) {
+ if('files' == $app) {
return true;
}
-
- return false;
+ $enabledApps = self::getEnabledApps();
+ return in_array($app, $enabledApps);
}
/**
@@ -214,6 +219,7 @@ class OC_App{
* This function set an app as enabled in appconfig.
*/
public static function enable( $app ) {
+ self::$enabledAppsCache = array(); // flush
if(!OC_Installer::isInstalled($app)) {
// check if app is a shipped app or not. OCS apps have an integer as id, shipped apps use a string
if(!is_numeric($app)) {
@@ -257,6 +263,7 @@ class OC_App{
* This function set an app as disabled in appconfig.
*/
public static function disable( $app ) {
+ self::$enabledAppsCache = array(); // flush
// check if app is a shipped app or not. if not delete
\OC_Hook::emit('OC_App', 'pre_disable', array('app' => $app));
OC_Appconfig::setValue( $app, 'enabled', 'no' );
diff --git a/lib/private/connector/sabre/node.php b/lib/private/connector/sabre/node.php
index fa27abb381a..c38e9f86375 100644
--- a/lib/private/connector/sabre/node.php
+++ b/lib/private/connector/sabre/node.php
@@ -147,12 +147,6 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
* Even if the modification time is set to a custom value the access time is set to now.
*/
public function touch($mtime) {
-
- // touch is only allowed if the update privilege is granted
- if (!\OC\Files\Filesystem::isUpdatable($this->path)) {
- throw new \Sabre_DAV_Exception_Forbidden();
- }
-
\OC\Files\Filesystem::touch($this->path, $mtime);
}
diff --git a/lib/private/files/view.php b/lib/private/files/view.php
index aa08a5f7cc9..f74b595c8da 100644
--- a/lib/private/files/view.php
+++ b/lib/private/files/view.php
@@ -324,7 +324,8 @@ class View {
return false;
}
} else {
- return $this->basicOperation('file_put_contents', $path, array('create', 'write'), $data);
+ $hooks = ($this->file_exists($path)) ? array('write') : array('create', 'write');
+ return $this->basicOperation('file_put_contents', $path, $hooks, $data);
}
}
diff --git a/lib/private/log/owncloud.php b/lib/private/log/owncloud.php
index d16b9537a16..f3b43584409 100644
--- a/lib/private/log/owncloud.php
+++ b/lib/private/log/owncloud.php
@@ -51,8 +51,14 @@ class OC_Log_Owncloud {
if($level>=$minLevel) {
// default to ISO8601
$format = OC_Config::getValue('logdateformat', 'c');
- $time = date($format, time());
- $entry=array('app'=>$app, 'message'=>$message, 'level'=>$level, 'time'=> $time);
+ $logtimezone=OC_Config::getValue( "logtimezone", 'UTC' );
+ try {
+ $timezone = new DateTimeZone($logtimezone);
+ } catch (Exception $e) {
+ $timezone = new DateTimeZone('UTC');
+ }
+ $time = new DateTime(null, $timezone);
+ $entry=array('app'=>$app, 'message'=>$message, 'level'=>$level, 'time'=> $time->format($format));
$handle = @fopen(self::$logFile, 'a');
if ($handle) {
fwrite($handle, json_encode($entry)."\n");
diff --git a/lib/private/user.php b/lib/private/user.php
index 04cd06b08bd..b68786c773c 100644
--- a/lib/private/user.php
+++ b/lib/private/user.php
@@ -198,6 +198,10 @@ class OC_User {
// Delete user files in /data/
OC_Helper::rmdirr(OC_Config::getValue('datadirectory', OC::$SERVERROOT . '/data') . '/' . $uid . '/');
+
+ return true;
+ } else {
+ return false;
}
}
diff --git a/lib/private/user/dummy.php b/lib/private/user/dummy.php
index b5b7a6c3c7a..52be7edfa75 100644
--- a/lib/private/user/dummy.php
+++ b/lib/private/user/dummy.php
@@ -88,8 +88,8 @@ class OC_User_Dummy extends OC_User_Backend {
* returns the user id or false
*/
public function checkPassword($uid, $password) {
- if (isset($this->users[$uid])) {
- return ($this->users[$uid] == $password);
+ if (isset($this->users[$uid]) && $this->users[$uid] === $password) {
+ return $uid;
} else {
return false;
}