summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorGeorg Ehrke <dev@georgswebsite.de>2012-04-18 12:20:09 +0200
committerGeorg Ehrke <dev@georgswebsite.de>2012-04-18 12:20:09 +0200
commiteb29c577c2b2378c1983e55ddaf4955ad9ae7fe2 (patch)
tree4a53459150c6485666e350982ef3ad61ab3936c8 /lib
parent3e0e6e35f4fa638dd42bd5adc3b26e078bf3d081 (diff)
parent57b8ff890c75169521041b4eb9cdf4582b68e551 (diff)
downloadnextcloud-server-eb29c577c2b2378c1983e55ddaf4955ad9ae7fe2.tar.gz
nextcloud-server-eb29c577c2b2378c1983e55ddaf4955ad9ae7fe2.zip
Merge branch 'master' into movable_apps
Diffstat (limited to 'lib')
-rwxr-xr-xlib/app.php2
-rw-r--r--lib/filecache.php7
-rw-r--r--lib/group/backend.php2
-rwxr-xr-xlib/helper.php5
-rw-r--r--lib/log/owncloud.php12
-rw-r--r--lib/util.php40
6 files changed, 43 insertions, 25 deletions
diff --git a/lib/app.php b/lib/app.php
index bd432109b23..9f7d23872f3 100755
--- a/lib/app.php
+++ b/lib/app.php
@@ -303,8 +303,6 @@ class OC_App{
$settings[] = array( "id" => "core_users", "order" => 2, "href" => OC_Helper::linkTo( "settings", "users.php" ), "name" => $l->t("Users"), "icon" => OC_Helper::imagePath( "settings", "users.svg" ));
// admin apps menu
$settings[] = array( "id" => "core_apps", "order" => 3, "href" => OC_Helper::linkTo( "settings", "apps.php" ).'?installed', "name" => $l->t("Apps"), "icon" => OC_Helper::imagePath( "settings", "apps.svg" ));
- // admin log menu
- $settings[] = array( "id" => "core_log", "order" => 4, "href" => OC_Helper::linkTo( "settings", "log.php" ), "name" => $l->t("Log"), "icon" => OC_Helper::imagePath( "settings", "log.svg" ));
$settings[]=array( "id" => "admin", "order" => 1000, "href" => OC_Helper::linkTo( "settings", "admin.php" ), "name" => $l->t("Admin"), "icon" => OC_Helper::imagePath( "settings", "admin.svg" ));
}
diff --git a/lib/filecache.php b/lib/filecache.php
index e62fb2189f4..19286ff746b 100644
--- a/lib/filecache.php
+++ b/lib/filecache.php
@@ -335,7 +335,12 @@ class OC_FileCache{
$query=OC_DB::prepare('SELECT path FROM *PREFIX*fscache WHERE id=? AND user=?');
$result=$query->execute(array($id,$user));
$row=$result->fetchRow();
- return $row['path'];
+ $path=$row['path'];
+ $root='/'.$user.'/files';
+ if(substr($path,0,strlen($root))!=$root){
+ return false;
+ }
+ return substr($path,strlen($root));
}
/**
diff --git a/lib/group/backend.php b/lib/group/backend.php
index d0bc970da73..af6c53c8035 100644
--- a/lib/group/backend.php
+++ b/lib/group/backend.php
@@ -89,7 +89,7 @@ abstract class OC_Group_Backend {
* @return bool
*/
public function groupExists($gid){
- if(!$backend->implementsActions(OC_GROUP_BACKEND_GET_GROUPS)){
+ if(!$this->implementsActions(OC_GROUP_BACKEND_GET_GROUPS)){
return false;
}
return in_array($gid, $this->getGroups());
diff --git a/lib/helper.php b/lib/helper.php
index 52278f5c3a2..61a57ec27e3 100755
--- a/lib/helper.php
+++ b/lib/helper.php
@@ -502,6 +502,9 @@ class OC_Helper {
*/
public static function buildNotExistingFileName($path, $filename)
{
+ if($path==='/'){
+ $path='';
+ }
if ($pos = strrpos($filename, '.')) {
$name = substr($filename, 0, $pos);
$ext = substr($filename, $pos);
@@ -518,7 +521,7 @@ class OC_Helper {
$counter++;
}
- return $newname;
+ return $newpath;
}
/*
diff --git a/lib/log/owncloud.php b/lib/log/owncloud.php
index 0ed30510134..881c67d2664 100644
--- a/lib/log/owncloud.php
+++ b/lib/log/owncloud.php
@@ -44,7 +44,7 @@ class OC_Log_Owncloud {
* @param int level
*/
public static function write($app, $message, $level) {
- $minLevel=OC_Config::getValue( "loglevel", 2 );
+ $minLevel=min(OC_Config::getValue( "loglevel", OC_Log::WARN ),OC_Log::ERROR);
if($level>=$minLevel){
$entry=array('app'=>$app, 'message'=>$message, 'level'=>$level,'time'=>time());
$fh=fopen(self::$logFile, 'a');
@@ -61,6 +61,7 @@ class OC_Log_Owncloud {
*/
public static function getEntries($limit=50, $offset=0){
self::init();
+ $minLevel=OC_Config::getValue( "loglevel", OC_Log::WARN );
$entries=array();
if(!file_exists(self::$logFile)) {
return array();
@@ -71,8 +72,13 @@ class OC_Log_Owncloud {
}
$end=max(count($contents)-$offset-1, 0);
$start=max($end-$limit,0);
- for($i=$end;$i>$start;$i--) {
- $entries[]=json_decode($contents[$i]);
+ $i=$end;
+ while(count($entries)<$limit){
+ $entry=json_decode($contents[$i]);
+ if($entry->level>=$minLevel){
+ $entries[]=$entry;
+ }
+ $i--;
}
return $entries;
}
diff --git a/lib/util.php b/lib/util.php
index e3c20ddb858..0b8ea1ec907 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -129,23 +129,23 @@ class OC_Util {
self::$headers[]=array('tag'=>$tag,'attributes'=>$attributes,'text'=>$text);
}
- /**
- * formats a timestamp in the "right" way
- *
- * @param int timestamp $timestamp
- * @param bool dateOnly option to ommit time from the result
- */
- public static function formatDate( $timestamp,$dateOnly=false){
- if(isset($_SESSION['timezone'])){//adjust to clients timezone if we know it
- $systemTimeZone = intval(date('O'));
- $systemTimeZone=(round($systemTimeZone/100,0)*60)+($systemTimeZone%100);
- $clientTimeZone=$_SESSION['timezone']*60;
- $offset=$clientTimeZone-$systemTimeZone;
- $timestamp=$timestamp+$offset*60;
- }
- $timeformat=$dateOnly?'F j, Y':'F j, Y, H:i';
- return date($timeformat,$timestamp);
- }
+ /**
+ * formats a timestamp in the "right" way
+ *
+ * @param int timestamp $timestamp
+ * @param bool dateOnly option to ommit time from the result
+ */
+ public static function formatDate( $timestamp,$dateOnly=false){
+ if(isset($_SESSION['timezone'])){//adjust to clients timezone if we know it
+ $systemTimeZone = intval(date('O'));
+ $systemTimeZone=(round($systemTimeZone/100,0)*60)+($systemTimeZone%100);
+ $clientTimeZone=$_SESSION['timezone']*60;
+ $offset=$clientTimeZone-$systemTimeZone;
+ $timestamp=$timestamp+$offset*60;
+ }
+ $timeformat=$dateOnly?'F j, Y':'F j, Y, H:i';
+ return date($timeformat,$timestamp);
+ }
/**
* Shows a pagenavi widget where you can jump to different pages.
@@ -237,6 +237,12 @@ class OC_Util {
if(!function_exists('ctype_digit')){
$errors[]=array('error'=>'PHP module ctype is not installed.<br/>','hint'=>'Please ask your server administrator to install the module.');
}
+ if(!function_exists('json_encode')){
+ $errors[]=array('error'=>'PHP module JSON is not installed.<br/>','hint'=>'Please ask your server administrator to install the module.');
+ }
+ if(!function_exists('imagepng')){
+ $errors[]=array('error'=>'PHP module GD is not installed.<br/>','hint'=>'Please ask your server administrator to install the module.');
+ }
return $errors;
}