From eebc15dce0da88dff91dc5249938341cd50b8a85 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Wed, 29 May 2013 12:01:43 +0200 Subject: connect preview lib to filesystem hooks --- lib/base.php | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/base.php') diff --git a/lib/base.php b/lib/base.php index 724bd250a5c..ae384225bed 100644 --- a/lib/base.php +++ b/lib/base.php @@ -474,6 +474,7 @@ class OC { self::registerCacheHooks(); self::registerFilesystemHooks(); + self::registerPreviewHooks(); self::registerShareHooks(); //make sure temporary files are cleaned up @@ -539,6 +540,14 @@ class OC { OC_Hook::connect('OC_Filesystem', 'rename', 'OC_Filesystem', 'isBlacklisted'); } + /** + * register hooks for previews + */ + public static function registerPreviewHooks() { + OC_Hook::connect('OC_Filesystem', 'post_write', 'OC_Preview', 'post_write'); + OC_Hook::connect('OC_Filesystem', 'delete', 'OC_Preview', 'post_delete'); + } + /** * register hooks for sharing */ -- cgit v1.2.3 From fa6b96090abc341da4f9320af02ee75b29a204e6 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Wed, 29 May 2013 12:33:24 +0200 Subject: move to OC namespace --- core/routes.php | 4 +-- lib/base.php | 4 +-- lib/preview.php | 64 +++++++++++++++++++++++++----------------------- lib/preview/images.php | 6 +++-- lib/preview/movies.php | 8 +++--- lib/preview/mp3.php | 10 +++++--- lib/preview/pdf.php | 8 +++--- lib/preview/provider.php | 4 ++- lib/preview/svg.php | 16 +++++++++--- lib/preview/txt.php | 6 +++-- lib/preview/unknown.php | 6 +++-- 11 files changed, 80 insertions(+), 56 deletions(-) (limited to 'lib/base.php') diff --git a/core/routes.php b/core/routes.php index c45ffee26fd..4b3ad53da01 100644 --- a/core/routes.php +++ b/core/routes.php @@ -43,9 +43,9 @@ $this->create('js_config', '/core/js/config.js') $this->create('core_ajax_routes', '/core/routes.json') ->action('OC_Router', 'JSRoutes'); $this->create('core_ajax_preview', '/core/preview.png') - ->action('OC_Preview', 'previewRouter'); + ->action('OC\Preview', 'previewRouter'); $this->create('core_ajax_public_preview', '/core/publicpreview.png') - ->action('OC_Preview', 'publicPreviewRouter'); + ->action('OC\Preview', 'publicPreviewRouter'); OC::$CLASSPATH['OC_Core_LostPassword_Controller'] = 'core/lostpassword/controller.php'; $this->create('core_lostpassword_index', '/lostpassword/') ->get() diff --git a/lib/base.php b/lib/base.php index ae384225bed..525b259f673 100644 --- a/lib/base.php +++ b/lib/base.php @@ -544,8 +544,8 @@ class OC { * register hooks for previews */ public static function registerPreviewHooks() { - OC_Hook::connect('OC_Filesystem', 'post_write', 'OC_Preview', 'post_write'); - OC_Hook::connect('OC_Filesystem', 'delete', 'OC_Preview', 'post_delete'); + OC_Hook::connect('OC_Filesystem', 'post_write', 'OC\Preview', 'post_write'); + OC_Hook::connect('OC_Filesystem', 'delete', 'OC\Preview', 'post_delete'); } /** diff --git a/lib/preview.php b/lib/preview.php index 7c4db971dfb..31812035c49 100755 --- a/lib/preview.php +++ b/lib/preview.php @@ -11,6 +11,8 @@ * /data/user/thumbnails/pathhash/x-y.png * */ +namespace OC; + require_once('preview/images.php'); require_once('preview/movies.php'); require_once('preview/mp3.php'); @@ -19,7 +21,7 @@ require_once('preview/svg.php'); require_once('preview/txt.php'); require_once('preview/unknown.php'); -class OC_Preview { +class Preview { //the thumbnail folder const THUMBNAILS_FOLDER = 'thumbnails'; @@ -57,9 +59,9 @@ class OC_Preview { */ public function __construct($user = null, $root = '', $file = '', $maxX = 0, $maxY = 0, $scalingup = true, $force = false){ //set config - $this->max_x = OC_Config::getValue('preview_max_x', null); - $this->max_y = OC_Config::getValue('preview_max_y', null); - $this->max_scale_factor = OC_Config::getValue('preview_max_scale_factor', 10); + $this->max_x = \OC_Config::getValue('preview_max_x', null); + $this->max_y = \OC_Config::getValue('preview_max_y', null); + $this->max_scale_factor = \OC_Config::getValue('preview_max_scale_factor', 10); //save parameters $this->file = $file; @@ -74,14 +76,14 @@ class OC_Preview { if($force !== true){ if(!is_null($this->max_x)){ if($this->maxX > $this->max_x){ - OC_Log::write('core', 'maxX reduced from ' . $this->maxX . ' to ' . $this->max_x, OC_Log::DEBUG); + \OC_Log::write('core', 'maxX reduced from ' . $this->maxX . ' to ' . $this->max_x, \OC_Log::DEBUG); $this->maxX = $this->max_x; } } if(!is_null($this->max_y)){ if($this->maxY > $this->max_y){ - OC_Log::write('core', 'maxY reduced from ' . $this->maxY . ' to ' . $this->max_y, OC_Log::DEBUG); + \OC_Log::write('core', 'maxY reduced from ' . $this->maxY . ' to ' . $this->max_y, \OC_Log::DEBUG); $this->maxY = $this->max_y; } } @@ -93,26 +95,26 @@ class OC_Preview { //check if there are any providers at all if(empty(self::$providers)){ - OC_Log::write('core', 'No preview providers exist', OC_Log::ERROR); - throw new Exception('No providers'); + \OC_Log::write('core', 'No preview providers exist', \OC_Log::ERROR); + throw new \Exception('No providers'); } //validate parameters if($file === ''){ - OC_Log::write('core', 'No filename passed', OC_Log::ERROR); - throw new Exception('File not found'); + \OC_Log::write('core', 'No filename passed', \OC_Log::ERROR); + throw new \Exception('File not found'); } //check if file exists if(!$this->fileview->file_exists($file)){ - OC_Log::write('core', 'File:"' . $file . '" not found', OC_Log::ERROR); - throw new Exception('File not found'); + \OC_Log::write('core', 'File:"' . $file . '" not found', \OC_Log::ERROR); + throw new \Exception('File not found'); } //check if given size makes sense if($maxX === 0 || $maxY === 0){ - OC_Log::write('core', 'Can not create preview with 0px width or 0px height', OC_Log::ERROR); - throw new Exception('Height and/or width set to 0'); + \OC_Log::write('core', 'Can not create preview with 0px width or 0px height', \OC_Log::ERROR); + throw new \Exception('Height and/or width set to 0'); } } } @@ -353,7 +355,7 @@ class OC_Preview { * @return void */ public function showPreview(){ - OCP\Response::enableCaching(3600 * 24); // 24 hour + \OCP\Response::enableCaching(3600 * 24); // 24 hour $preview = $this->getPreview(); if($preview){ $preview->show(); @@ -373,7 +375,7 @@ class OC_Preview { $scalingup = $this->scalingup; if(!($image instanceof \OC_Image)){ - OC_Log::write('core', 'Object passed to resizeAndCrop is not an instance of OC_Image', OC_Log::DEBUG); + OC_Log::write('core', 'Object passed to resizeAndCrop is not an instance of OC_Image', \OC_Log::DEBUG); return; } @@ -399,7 +401,7 @@ class OC_Preview { } if(!is_null($this->max_scale_factor)){ if($factor > $this->max_scale_factor){ - OC_Log::write('core', 'scalefactor reduced from ' . $factor . ' to ' . $this->max_scale_factor, OC_Log::DEBUG); + \OC_Log::write('core', 'scalefactor reduced from ' . $factor . ' to ' . $this->max_scale_factor, \OC_Log::DEBUG); $factor = $this->max_scale_factor; } } @@ -462,7 +464,7 @@ class OC_Preview { /** * @brief register a new preview provider to be used - * @param string $provider class name of a OC_Preview_Provider + * @param string $provider class name of a Preview_Provider * @return void */ public static function registerProvider($class, $options=array()){ @@ -496,7 +498,7 @@ class OC_Preview { * @return void */ public static function previewRouter($params){ - OC_Util::checkLoggedIn(); + \OC_Util::checkLoggedIn(); $file = ''; $maxX = 0; @@ -514,15 +516,15 @@ class OC_Preview { if($file !== '' && $maxX !== 0 && $maxY !== 0){ try{ - $preview = new OC_Preview(OC_User::getUser(), 'files', $file, $maxX, $maxY, $scalingup); + $preview = new Preview(\OC_User::getUser(), 'files', $file, $maxX, $maxY, $scalingup); $preview->showPreview(); }catch(Exception $e){ - OC_Response::setStatus(404); - OC_Log::write('core', $e->getmessage(), OC_Log::ERROR); + \OC_Response::setStatus(404); + \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR); exit; } }else{ - OC_Response::setStatus(404); + \OC_Response::setStatus(404); exit; } } @@ -547,11 +549,11 @@ class OC_Preview { if(array_key_exists('scalingup', $_GET)) $scalingup = (bool) $_GET['scalingup']; if(array_key_exists('t', $_GET)) $token = (string) $_GET['t']; - $linkItem = OCP\Share::getShareByToken($token); + $linkItem = \OCP\Share::getShareByToken($token); if (is_array($linkItem) && isset($linkItem['uid_owner']) && isset($linkItem['file_source'])) { $userid = $linkItem['uid_owner']; - OC_Util::setupFS($userid); + \OC_Util::setupFS($userid); $pathid = $linkItem['file_source']; $path = \OC\Files\Filesystem::getPath($pathid); } @@ -559,7 +561,7 @@ class OC_Preview { //clean up file parameter $file = \OC\Files\Filesystem::normalizePath($file); if(!\OC\Files\Filesystem::isValidPath($file)){ - OC_Response::setStatus(403); + \OC_Response::setStatus(403); exit; } @@ -570,15 +572,15 @@ class OC_Preview { if($userid !== null && $path !== null){ try{ - $preview = new OC_Preview($userid, 'files/' . $path, $file, $maxX, $maxY, $scalingup); + $preview = new Preview($userid, 'files/' . $path, $file, $maxX, $maxY, $scalingup); $preview->showPreview(); }catch(Exception $e){ - OC_Response::setStatus(404); - OC_Log::write('core', $e->getmessage(), OC_Log::ERROR); + \OC_Response::setStatus(404); + \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR); exit; } }else{ - OC_Response::setStatus(404); + \OC_Response::setStatus(404); exit; } } @@ -592,7 +594,7 @@ class OC_Preview { if(substr($path, 0, 1) == '/'){ $path = substr($path, 1); } - $preview = new OC_Preview(OC_User::getUser(), 'files/', $path, 0, 0, false, true); + $preview = new Preview(\OC_User::getUser(), 'files/', $path, 0, 0, false, true); $preview->deleteAllPreviews(); } } \ No newline at end of file diff --git a/lib/preview/images.php b/lib/preview/images.php index a8f203528c5..c62fc5397e5 100644 --- a/lib/preview/images.php +++ b/lib/preview/images.php @@ -6,7 +6,9 @@ * later. * See the COPYING-README file. */ -class OC_Preview_Image extends OC_Preview_Provider{ +namespace OC\Preview; + +class Image extends Provider{ public function getMimeType(){ return '/image\/.*/'; @@ -31,4 +33,4 @@ class OC_Preview_Image extends OC_Preview_Provider{ } } -OC_Preview::registerProvider('OC_Preview_Image'); \ No newline at end of file +\OC\Preview::registerProvider('OC\Preview\Image'); \ No newline at end of file diff --git a/lib/preview/movies.php b/lib/preview/movies.php index d2aaf730d67..14ac97b552d 100644 --- a/lib/preview/movies.php +++ b/lib/preview/movies.php @@ -6,8 +6,10 @@ * later. * See the COPYING-README file. */ +namespace OC\Preview; + if(!is_null(shell_exec('ffmpeg -version'))){ - class OC_Preview_Movie extends OC_Preview_Provider{ + class Movie extends Provider{ public function getMimeType(){ return '/video\/.*/'; @@ -18,7 +20,7 @@ if(!is_null(shell_exec('ffmpeg -version'))){ $fileinfo = $fileview->getFileInfo($path); $abspath = $fileview->toTmpFile($path); - $tmppath = OC_Helper::tmpFile(); + $tmppath = \OC_Helper::tmpFile(); //$cmd = 'ffmpeg -y -i ' . escapeshellarg($abspath) . ' -f mjpeg -vframes 1 -ss 1 -s ' . escapeshellarg($maxX) . 'x' . escapeshellarg($maxY) . ' ' . $tmppath; $cmd = 'ffmpeg -y -i ' . escapeshellarg($abspath) . ' -f mjpeg -vframes 1 -ss 1 ' . $tmppath; @@ -35,5 +37,5 @@ if(!is_null(shell_exec('ffmpeg -version'))){ } } - OC_Preview::registerProvider('OC_Preview_Movie'); + \OC\Preview::registerProvider('OC\Preview\Movie'); } \ No newline at end of file diff --git a/lib/preview/mp3.php b/lib/preview/mp3.php index 18f5cfde375..d62c7230788 100644 --- a/lib/preview/mp3.php +++ b/lib/preview/mp3.php @@ -5,22 +5,24 @@ * later. * See the COPYING-README file. */ +namespace OC\Preview; + require_once('getid3/getid3.php'); -class OC_Preview_MP3 extends OC_Preview_Provider{ +class MP3 extends Provider{ public function getMimeType(){ return '/audio\/mpeg/'; } public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) { - $getID3 = new getID3(); + $getID3 = new \getID3(); $tmppath = $fileview->toTmpFile($path); //Todo - add stream support $tags = $getID3->analyze($tmppath); - getid3_lib::CopyTagsToComments($tags); + \getid3_lib::CopyTagsToComments($tags); $picture = @$tags['id3v2']['APIC'][0]['data']; unlink($tmppath); @@ -38,4 +40,4 @@ class OC_Preview_MP3 extends OC_Preview_Provider{ } -OC_Preview::registerProvider('OC_Preview_MP3'); \ No newline at end of file +\OC\Preview::registerProvider('OC\Preview\MP3'); \ No newline at end of file diff --git a/lib/preview/pdf.php b/lib/preview/pdf.php index de5263f91d8..4dd4538545c 100644 --- a/lib/preview/pdf.php +++ b/lib/preview/pdf.php @@ -5,9 +5,11 @@ * later. * See the COPYING-README file. */ +namespace OC\Preview; + if (extension_loaded('imagick')){ - class OC_Preview_PDF extends OC_Preview_Provider{ + class PDF extends Provider{ public function getMimeType(){ return '/application\/pdf/'; @@ -17,7 +19,7 @@ if (extension_loaded('imagick')){ $tmppath = $fileview->toTmpFile($path); //create imagick object from pdf - $pdf = new imagick($tmppath . '[0]'); + $pdf = new \imagick($tmppath . '[0]'); $pdf->setImageFormat('jpg'); unlink($tmppath); @@ -31,5 +33,5 @@ if (extension_loaded('imagick')){ } } - OC_Preview::registerProvider('OC_Preview_PDF'); + \OC\Preview::registerProvider('OC\Preview\PDF'); } diff --git a/lib/preview/provider.php b/lib/preview/provider.php index 2f2a0e68486..1e8d537adc8 100644 --- a/lib/preview/provider.php +++ b/lib/preview/provider.php @@ -2,7 +2,9 @@ /** * provides search functionalty */ -abstract class OC_Preview_Provider{ +namespace OC\Preview; + +abstract class Provider{ private $options; public function __construct($options) { diff --git a/lib/preview/svg.php b/lib/preview/svg.php index 415b7751c2b..70be263189d 100644 --- a/lib/preview/svg.php +++ b/lib/preview/svg.php @@ -5,18 +5,26 @@ * later. * See the COPYING-README file. */ +namespace OC\Preview; + if (extension_loaded('imagick')){ - class OC_Preview_SVG extends OC_Preview_Provider{ + class SVG extends Provider{ public function getMimeType(){ return '/image\/svg\+xml/'; } public function getThumbnail($path,$maxX,$maxY,$scalingup,$fileview) { - $svg = new Imagick(); + $svg = new \Imagick(); $svg->setResolution($maxX, $maxY); - $svg->readImageBlob('' . $fileview->file_get_contents($path)); + + $content = stream_get_contents($fileview->fopen($path, 'r')); + if(substr($content, 0, 5) !== '' . $content; + } + + $svg->readImageBlob($content); $svg->setImageFormat('jpg'); //new image object @@ -28,6 +36,6 @@ if (extension_loaded('imagick')){ } } - OC_Preview::registerProvider('OC_Preview_SVG'); + \OC\Preview::registerProvider('OC\Preview\SVG'); } \ No newline at end of file diff --git a/lib/preview/txt.php b/lib/preview/txt.php index 1e88aec69fd..4004ecd3fce 100644 --- a/lib/preview/txt.php +++ b/lib/preview/txt.php @@ -5,7 +5,9 @@ * later. * See the COPYING-README file. */ -class OC_Preview_TXT extends OC_Preview_Provider{ +namespace OC\Preview; + +class TXT extends Provider{ public function getMimeType(){ return '/text\/.*/'; @@ -46,4 +48,4 @@ class OC_Preview_TXT extends OC_Preview_Provider{ } } -OC_Preview::registerProvider('OC_Preview_TXT'); \ No newline at end of file +\OC\Preview::registerProvider('OC\Preview\TXT'); \ No newline at end of file diff --git a/lib/preview/unknown.php b/lib/preview/unknown.php index 5bbdcf847f1..6a8d2fbb75c 100644 --- a/lib/preview/unknown.php +++ b/lib/preview/unknown.php @@ -6,7 +6,9 @@ * later. * See the COPYING-README file. */ -class OC_Preview_Unknown extends OC_Preview_Provider{ +namespace OC\Preview; + +class Unknown extends Provider{ public function getMimeType(){ return '/.*/'; @@ -22,4 +24,4 @@ class OC_Preview_Unknown extends OC_Preview_Provider{ } } -OC_Preview::registerProvider('OC_Preview_Unknown'); +\OC\Preview::registerProvider('OC\Preview\Unknown'); -- cgit v1.2.3 From 57370353ad1b21156094adc3d1e735582bbd2bb0 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Fri, 28 Jun 2013 19:22:51 +0200 Subject: Check if the app is enabled and the app path is found before trying to load the script file --- lib/base.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'lib/base.php') diff --git a/lib/base.php b/lib/base.php index fd4870974fe..af0a30ea173 100644 --- a/lib/base.php +++ b/lib/base.php @@ -661,12 +661,15 @@ class OC { $app = $param['app']; $file = $param['file']; $app_path = OC_App::getAppPath($app); - $file = $app_path . '/' . $file; - unset($app, $app_path); - if (file_exists($file)) { - require_once $file; - return true; + if (OC_App::isEnabled($app) && $app_path !== false) { + $file = $app_path . '/' . $file; + unset($app, $app_path); + if (file_exists($file)) { + require_once $file; + return true; + } } + header('HTTP/1.0 404 Not Found'); return false; } -- cgit v1.2.3 From ca495758bd8bcbea66f00296d36d87f66cd5f4a8 Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Wed, 14 Aug 2013 23:06:43 +0200 Subject: Fix octemplate string escaping. --- core/js/octemplate.js | 8 ++++---- lib/base.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'lib/base.php') diff --git a/core/js/octemplate.js b/core/js/octemplate.js index e69c6cc56e0..f7ee316f3b2 100644 --- a/core/js/octemplate.js +++ b/core/js/octemplate.js @@ -60,9 +60,9 @@ var self = this; if(typeof this.options.escapeFunction === 'function') { - for (var key = 0; key < this.vars.length; key++) { - if(typeof this.vars[key] === 'string') { - this.vars[key] = self.options.escapeFunction(this.vars[key]); + for (var key = 0; key < Object.keys(this.vars).length; key++) { + if(typeof this.vars[Object.keys(this.vars)[key]] === 'string') { + this.vars[Object.keys(this.vars)[key]] = self.options.escapeFunction(this.vars[Object.keys(this.vars)[key]]); } } } @@ -85,7 +85,7 @@ } }, options: { - escapeFunction: function(str) {return $('').text(str).html();} + escapeFunction: escapeHTML } }; diff --git a/lib/base.php b/lib/base.php index eaee8424651..18c172759b4 100644 --- a/lib/base.php +++ b/lib/base.php @@ -257,8 +257,8 @@ class OC { OC_Util::addScript("compatibility"); OC_Util::addScript("jquery.ocdialog"); OC_Util::addScript("oc-dialogs"); - OC_Util::addScript("octemplate"); OC_Util::addScript("js"); + OC_Util::addScript("octemplate"); OC_Util::addScript("eventsource"); OC_Util::addScript("config"); //OC_Util::addScript( "multiselect" ); -- cgit v1.2.3 From 81a45cfcf1c7064615429bb3f9759e9455868614 Mon Sep 17 00:00:00 2001 From: Stephane Martin Date: Mon, 26 Aug 2013 15:16:41 +0200 Subject: fixes #4574 --- lib/base.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'lib/base.php') diff --git a/lib/base.php b/lib/base.php index 2613e88d053..c73eb9413d6 100644 --- a/lib/base.php +++ b/lib/base.php @@ -795,11 +795,16 @@ class OC { ) { return false; } - OC_App::loadApps(array('authentication')); - if (OC_User::login($_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"])) { - //OC_Log::write('core',"Logged in with HTTP Authentication", OC_Log::DEBUG); - OC_User::unsetMagicInCookie(); - $_SERVER['HTTP_REQUESTTOKEN'] = OC_Util::callRegister(); + // don't redo authentication if user is already logged in + // otherwise session would be invalidated in OC_User::login with + // session_regenerate_id at every page load + if (!OC_User::isLoggedIn()) { + OC_App::loadApps(array('authentication')); + if (OC_User::login($_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"])) { + //OC_Log::write('core',"Logged in with HTTP Authentication", OC_Log::DEBUG); + OC_User::unsetMagicInCookie(); + $_SERVER['HTTP_REQUESTTOKEN'] = OC_Util::callRegister(); + } } return true; } -- cgit v1.2.3 From b5e2842e0049f64b0f7c7ba9ce8b831bd84a0d78 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Fri, 5 Jul 2013 22:24:36 +0200 Subject: Very simple log rotation --- lib/base.php | 1 + lib/log/rotate.php | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 lib/log/rotate.php (limited to 'lib/base.php') diff --git a/lib/base.php b/lib/base.php index 0c9fe329b8f..22aed1c5664 100644 --- a/lib/base.php +++ b/lib/base.php @@ -491,6 +491,7 @@ class OC { self::registerCacheHooks(); self::registerFilesystemHooks(); self::registerShareHooks(); + \OCP\BackgroundJob::registerJob('OC\Log\Rotate', OC_Config::getValue("datadirectory", OC::$SERVERROOT.'/data').'/owncloud.log'); //make sure temporary files are cleaned up register_shutdown_function(array('OC_Helper', 'cleanTmp')); diff --git a/lib/log/rotate.php b/lib/log/rotate.php new file mode 100644 index 00000000000..d5b970c1a9e --- /dev/null +++ b/lib/log/rotate.php @@ -0,0 +1,26 @@ + + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ + +namespace OC\Log; + +class Rotate extends \OC\BackgroundJob\Job { + const LOG_SIZE_LIMIT = 104857600; // 100 MB + public function run($logFile) { + $filesize = filesize($logFile); + if ($filesize >= self::LOG_SIZE_LIMIT) { + $this->rotate($logFile); + } + } + + protected function rotate($logfile) { + $rotated_logfile = $logfile.'.1'; + rename($logfile, $rotated_logfile); + $msg = 'Log file "'.$logfile.'" was over 100MB, moved to "'.$rotated_logfile.'"'; + \OC_Log::write('OC\Log\Rotate', $msg, \OC_Log::WARN); + } +} -- cgit v1.2.3 From 42f3ecb60fb14ef9739b436f115d302b5d4432a1 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Wed, 10 Jul 2013 18:07:43 +0200 Subject: Check for installed state before registering the logrotate background job --- lib/base.php | 16 +++++++++++++++- lib/log/rotate.php | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-) (limited to 'lib/base.php') diff --git a/lib/base.php b/lib/base.php index 22aed1c5664..f45012bb83c 100644 --- a/lib/base.php +++ b/lib/base.php @@ -491,7 +491,7 @@ class OC { self::registerCacheHooks(); self::registerFilesystemHooks(); self::registerShareHooks(); - \OCP\BackgroundJob::registerJob('OC\Log\Rotate', OC_Config::getValue("datadirectory", OC::$SERVERROOT.'/data').'/owncloud.log'); + self::registerLogRotate(); //make sure temporary files are cleaned up register_shutdown_function(array('OC_Helper', 'cleanTmp')); @@ -553,6 +553,20 @@ class OC { } } + /** + * register hooks for the cache + */ + public static function registerLogRotate() { + if (OC_Config::getValue('installed', false)) { //don't try to do this before we are properly setup + // register cache cleanup jobs + try { //if this is executed before the upgrade to the new backgroundjob system is completed it will throw an exception + \OCP\BackgroundJob::registerJob('OC\Log\Rotate', OC_Config::getValue("datadirectory", OC::$SERVERROOT.'/data').'/owncloud.log'); + } catch (Exception $e) { + + } + } + } + /** * register hooks for the filesystem */ diff --git a/lib/log/rotate.php b/lib/log/rotate.php index 3b976d50dce..41ef2ea299c 100644 --- a/lib/log/rotate.php +++ b/lib/log/rotate.php @@ -16,7 +16,7 @@ namespace OC\Log; * location and manage that with your own tools. */ class Rotate extends \OC\BackgroundJob\Job { - const LOG_SIZE_LIMIT = 104857600; // 100 MB + const LOG_SIZE_LIMIT = 104857600; // 100 MiB public function run($logFile) { $filesize = @filesize($logFile); if ($filesize >= self::LOG_SIZE_LIMIT) { -- cgit v1.2.3 From 3fd2df4088d17547a3a31023a75cf538c95ade18 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Wed, 28 Aug 2013 17:41:27 +0200 Subject: Only enable logrotate when configured. Also rotate size is settable. --- config/config.sample.php | 15 ++++++++++++--- lib/base.php | 3 ++- lib/log/rotate.php | 16 +++++++++------- 3 files changed, 23 insertions(+), 11 deletions(-) (limited to 'lib/base.php') diff --git a/config/config.sample.php b/config/config.sample.php index 24ba541ac5c..f5cb33732f8 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -141,10 +141,22 @@ $CONFIG = array( /* Loglevel to start logging at. 0=DEBUG, 1=INFO, 2=WARN, 3=ERROR (default is WARN) */ "loglevel" => "", +/* date format to be used while writing to the owncloud logfile */ +'logdateformat' => 'F d, Y H:i:s', + /* Append all database queries and parameters to the log file. (watch out, this option can increase the size of your log file)*/ "log_query" => false, +/* + * Configure the size in bytes log rotation should happen, 0 or false disables the rotation. + * This rotates the current owncloud logfile to a new name, this way the total log usage + * will stay limited and older entries are available for a while longer. The + * total disk usage is twice the configured size. + * WARNING: When you use this, the log entries will eventually be lost. + */ +'log_rotate_size' => false, // 104857600, // 100 MiB + /* Lifetime of the remember login cookie, default is 15 days */ "remember_login_cookie_lifetime" => 60*60*24*15, @@ -189,7 +201,4 @@ $CONFIG = array( 'customclient_desktop' => '', //http://owncloud.org/sync-clients/ 'customclient_android' => '', //https://play.google.com/store/apps/details?id=com.owncloud.android 'customclient_ios' => '', //https://itunes.apple.com/us/app/owncloud/id543672169?mt=8 - -// date format to be used while writing to the owncloud logfile -'logdateformat' => 'F d, Y H:i:s' ); diff --git a/lib/base.php b/lib/base.php index f45012bb83c..2e6a37c9f4e 100644 --- a/lib/base.php +++ b/lib/base.php @@ -557,7 +557,8 @@ class OC { * register hooks for the cache */ public static function registerLogRotate() { - if (OC_Config::getValue('installed', false)) { //don't try to do this before we are properly setup + if (OC_Config::getValue('installed', false) && OC_Config::getValue('log_rotate_size', false)) { + //don't try to do this before we are properly setup // register cache cleanup jobs try { //if this is executed before the upgrade to the new backgroundjob system is completed it will throw an exception \OCP\BackgroundJob::registerJob('OC\Log\Rotate', OC_Config::getValue("datadirectory", OC::$SERVERROOT.'/data').'/owncloud.log'); diff --git a/lib/log/rotate.php b/lib/log/rotate.php index 41ef2ea299c..b620f0be15c 100644 --- a/lib/log/rotate.php +++ b/lib/log/rotate.php @@ -10,24 +10,26 @@ namespace OC\Log; /** * This rotates the current logfile to a new name, this way the total log usage - * will stay limited and older entries are available for a while longer. The - * total disk usage is twice LOG_SIZE_LIMIT. + * will stay limited and older entries are available for a while longer. * For more professional log management set the 'logfile' config to a different * location and manage that with your own tools. */ class Rotate extends \OC\BackgroundJob\Job { - const LOG_SIZE_LIMIT = 104857600; // 100 MiB + private $max_log_size; public function run($logFile) { - $filesize = @filesize($logFile); - if ($filesize >= self::LOG_SIZE_LIMIT) { - $this->rotate($logFile); + $this->max_log_size = OC_Config::getValue('log_rotate_size', false); + if ($this->max_log_size) { + $filesize = @filesize($logFile); + if ($filesize >= $this->max_log_size) { + $this->rotate($logFile); + } } } protected function rotate($logfile) { $rotatedLogfile = $logfile.'.1'; rename($logfile, $rotatedLogfile); - $msg = 'Log file "'.$logfile.'" was over 100MB, moved to "'.$rotatedLogfile.'"'; + $msg = 'Log file "'.$logfile.'" was over '.$this->max_log_size.' bytes, moved to "'.$rotatedLogfile.'"'; \OC_Log::write('OC\Log\Rotate', $msg, \OC_Log::WARN); } } -- cgit v1.2.3 From cc8e19ad115f296e54e46d8821e9c577230e8453 Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Fri, 30 Aug 2013 11:38:49 +0200 Subject: move CSS for apps out of styles.css into new apps.css --- core/css/apps.css | 236 +++++++++++++++++++++++++++++++++++++++++++++++++++ core/css/styles.css | 239 ---------------------------------------------------- lib/base.php | 3 +- 3 files changed, 238 insertions(+), 240 deletions(-) create mode 100644 core/css/apps.css (limited to 'lib/base.php') diff --git a/core/css/apps.css b/core/css/apps.css new file mode 100644 index 00000000000..445a3b9b59f --- /dev/null +++ b/core/css/apps.css @@ -0,0 +1,236 @@ +/* ---- APP STYLING ---- */ + +#app { + height: 100%; + width: 100%; +} +#app * { + -moz-box-sizing: border-box; box-sizing: border-box; +} + +/* Navigation: folder like structure */ +#app-navigation { + width: 300px; + height: 100%; + float: left; + -moz-box-sizing: border-box; box-sizing: border-box; + background-color: #f8f8f8; + border-right: 1px solid #ccc; +} +#app-navigation > ul { + height: 100%; + overflow: auto; + -moz-box-sizing: border-box; box-sizing: border-box; +} +#app-navigation li { + position: relative; + width: 100%; + -moz-box-sizing: border-box; box-sizing: border-box; + text-shadow: 0 1px 0 rgba(255,255,255,.9); +} +#app-navigation .active, +#app-navigation .active a, +#app-navigation li:hover > a { + background-color: #ddd; + text-shadow: 0 1px 0 rgba(255,255,255,.7); +} + +/* special rules for first-level entries and folders */ +#app-navigation > ul > li { + background-color: #f8f8f8; +} + +#app-navigation .with-icon a { + padding-left: 44px; + background-size: 16px 16px; + background-position: 14px center; + background-repeat: no-repeat; +} + +#app-navigation li > a { + display: block; + width: 100%; + height: 44px; + padding: 12px; + overflow: hidden; + -moz-box-sizing: border-box; box-sizing: border-box; + white-space: nowrap; + text-overflow: ellipsis; + color: #333; +} + +#app-navigation .collapse { + display: none; /* hide collapse button intially */ +} +#app-navigation .collapsible > .collapse { + position: absolute; + height: 44px; + width: 44px; + margin: 0; + padding: 0; + background: none; background-image: url('../img/actions/triangle-s.svg'); + background-size: 16px; background-repeat: no-repeat; background-position: center; + border: none; + border-radius: 0; + outline: none !important; + box-shadow: none; +} +#app-navigation .collapsible:hover > a { + background-image: none; +} +#app-navigation .collapsible:hover > .collapse { + display: block; +} + +#app-navigation .collapsible .collapse { + -moz-transform: rotate(-90deg); + -webkit-transform: rotate(-90deg); + -ms-transform:rotate(-90deg); + -o-transform:rotate(-90deg); + transform: rotate(-90deg); +} +#app-navigation .collapsible.open .collapse { + -moz-transform: rotate(0); + -webkit-transform: rotate(0); + -ms-transform:rotate(0); + -o-transform:rotate(0); + transform: rotate(0); +} + +/* Second level nesting for lists */ +#app-navigation > ul ul { + display: none; +} +#app-navigation > ul ul li > a { + padding-left: 32px; +} +#app-navigation > .with-icon ul li > a { + padding-left: 48px; + background-position: 24px center; +} + +#app-navigation .open { + background-image: linear-gradient(top, rgb(238,238,238) 0%, rgb(245,245,245) 100%); + background-image: -o-linear-gradient(top, rgb(238,238,238) 0%, rgb(245,245,245) 100%); + background-image: -moz-linear-gradient(top, rgb(238,238,238) 0%, rgb(245,245,245) 100%); + background-image: -webkit-linear-gradient(top, rgb(238,238,238) 0%, rgb(245,245,245) 100%); + background-image: -ms-linear-gradient(top, rgb(238,238,238) 0%, rgb(245,245,245) 100%); +} + +#app-navigation > ul .open:hover { + -moz-box-shadow: inset 0 0 3px #ccc; -webkit-box-shadow: inset 0 0 3px #ccc; box-shadow: inset 0 0 3px #ccc; +} + +#app-navigation > ul .open ul { + display: block; +} + + +/* counter and actions */ +#app-navigation .utils { + position: absolute; + right: 0; + top: 0; + bottom: 0; + font-size: 12px; +} + #app-navigation .utils button, + #app-navigation .utils .counter { + width: 44px; + height: 44px; + padding-top: 12px; + } + + +/* drag and drop */ +#app-navigation .drag-and-drop { + -moz-transition: padding-bottom 500ms ease 0s; + -o-transition: padding-bottom 500ms ease 0s; + -webkit-transition: padding-bottom 500ms ease 0s; + -ms-transition: padding-bottom 500ms ease 0s; + transition: padding-bottom 500ms ease 0s; + padding-bottom: 40px; +} +#app-navigation .personalblock > legend { /* TODO @Raydiation: still needed? */ + padding: 10px 0; margin: 0; +} +#app-navigation .error { + color: #dd1144; +} + +#app-navigation .app-navigation-separator { + border-bottom: 1px solid #ddd; +} + + + +/* Part where the content will be loaded into */ +#app-content { + height: 100%; + overflow-y: auto; +} + +/* settings area */ +#app-settings { + position: fixed; + width: 299px; + bottom: 0; + border-top: 1px solid #ccc; +} +#app-settings-header { + background-color: #eee; +} +#app-settings-content { + display: none; + padding: 10px; + background-color: #eee; +} +#app-settings.open #app-settings-content { + display: block; +} + +.settings-button { + display: block; + height: 32px; + width: 100%; + padding: 0; + margin: 0; + background-color: transparent; background-image: url('../img/actions/settings.svg'); + background-position: 10px center; background-repeat: no-repeat; + box-shadow: none; + border: 0; + border-radius: 0; +} +.settings-button:hover { + background-color: #ddd; +} + +/* icons */ +.folder-icon, .delete-icon, .edit-icon, .progress-icon { + background-repeat: no-repeat; + background-position: center; +} +.folder-icon { background-image: url('../img/places/folder.svg'); } +.delete-icon { background-image: url('../img/actions/delete.svg'); } +.delete-icon:hover, .delete-icon:focus { + background-image: url('../img/actions/delete-hover.svg'); +} +.edit-icon { background-image: url('../img/actions/rename.svg'); } +.progress-icon { + background-image: url('../img/loading.gif'); + background-size: 16px; + /* force show the loading icon, not only on hover */ + -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + filter:alpha(opacity=100); + opacity: 1 !important; + display: inline !important; +} + +/* buttons */ +button.loading { + background-image: url('../img/loading.gif'); + background-position: right 10px center; background-repeat: no-repeat; + background-size: 16px; + padding-right: 30px; +} + diff --git a/core/css/styles.css b/core/css/styles.css index ce0d5abfc78..d435e223b31 100644 --- a/core/css/styles.css +++ b/core/css/styles.css @@ -711,245 +711,6 @@ div.crumb:active { -/* ---- APP STYLING ---- */ -#app { - height: 100%; - width: 100%; -} -#app * { - -moz-box-sizing: border-box; box-sizing: border-box; -} - -/* Navigation: folder like structure */ -#app-navigation { - width: 300px; - height: 100%; - float: left; - -moz-box-sizing: border-box; box-sizing: border-box; - background-color: #f8f8f8; - border-right: 1px solid #ccc; -} -#app-navigation > ul { - height: 100%; - overflow: auto; - -moz-box-sizing: border-box; box-sizing: border-box; -} -#app-navigation li { - position: relative; - width: 100%; - -moz-box-sizing: border-box; box-sizing: border-box; - text-shadow: 0 1px 0 rgba(255,255,255,.9); -} -#app-navigation .active, -#app-navigation .active a, -#app-navigation li:hover > a { - background-color: #ddd; - text-shadow: 0 1px 0 rgba(255,255,255,.7); -} - -/* special rules for first-level entries and folders */ -#app-navigation > ul > li { - background-color: #f8f8f8; -} - -#app-navigation .with-icon a { - padding-left: 44px; - background-size: 16px 16px; - background-position: 14px center; - background-repeat: no-repeat; -} - -#app-navigation li > a { - display: block; - width: 100%; - height: 44px; - padding: 12px; - overflow: hidden; - -moz-box-sizing: border-box; box-sizing: border-box; - white-space: nowrap; - text-overflow: ellipsis; - color: #333; -} - -#app-navigation .collapse { - display: none; /* hide collapse button intially */ -} -#app-navigation .collapsible > .collapse { - position: absolute; - height: 44px; - width: 44px; - margin: 0; - padding: 0; - background: none; background-image: url('../img/actions/triangle-s.svg'); - background-size: 16px; background-repeat: no-repeat; background-position: center; - border: none; - border-radius: 0; - outline: none !important; - box-shadow: none; -} -#app-navigation .collapsible:hover > a { - background-image: none; -} -#app-navigation .collapsible:hover > .collapse { - display: block; -} - -#app-navigation .collapsible .collapse { - -moz-transform: rotate(-90deg); - -webkit-transform: rotate(-90deg); - -ms-transform:rotate(-90deg); - -o-transform:rotate(-90deg); - transform: rotate(-90deg); -} -#app-navigation .collapsible.open .collapse { - -moz-transform: rotate(0); - -webkit-transform: rotate(0); - -ms-transform:rotate(0); - -o-transform:rotate(0); - transform: rotate(0); -} - -/* Second level nesting for lists */ -#app-navigation > ul ul { - display: none; -} -#app-navigation > ul ul li > a { - padding-left: 32px; -} -#app-navigation > .with-icon ul li > a { - padding-left: 48px; - background-position: 24px center; -} - -#app-navigation .open { - background-image: linear-gradient(top, rgb(238,238,238) 0%, rgb(245,245,245) 100%); - background-image: -o-linear-gradient(top, rgb(238,238,238) 0%, rgb(245,245,245) 100%); - background-image: -moz-linear-gradient(top, rgb(238,238,238) 0%, rgb(245,245,245) 100%); - background-image: -webkit-linear-gradient(top, rgb(238,238,238) 0%, rgb(245,245,245) 100%); - background-image: -ms-linear-gradient(top, rgb(238,238,238) 0%, rgb(245,245,245) 100%); -} - -#app-navigation > ul .open:hover { - -moz-box-shadow: inset 0 0 3px #ccc; -webkit-box-shadow: inset 0 0 3px #ccc; box-shadow: inset 0 0 3px #ccc; -} - -#app-navigation > ul .open ul { - display: block; -} - - -/* counter and actions */ -#app-navigation .utils { - position: absolute; - right: 0; - top: 0; - bottom: 0; - font-size: 12px; -} - #app-navigation .utils button, - #app-navigation .utils .counter { - width: 44px; - height: 44px; - padding-top: 12px; - } - - -/* drag and drop */ -#app-navigation .drag-and-drop { - -moz-transition: padding-bottom 500ms ease 0s; - -o-transition: padding-bottom 500ms ease 0s; - -webkit-transition: padding-bottom 500ms ease 0s; - -ms-transition: padding-bottom 500ms ease 0s; - transition: padding-bottom 500ms ease 0s; - padding-bottom: 40px; -} -#app-navigation .personalblock > legend { /* TODO @Raydiation: still needed? */ - padding: 10px 0; margin: 0; -} -#app-navigation .error { - color: #dd1144; -} - -#app-navigation .app-navigation-separator { - border-bottom: 1px solid #ddd; -} - - - -/* Part where the content will be loaded into */ -#app-content { - height: 100%; - overflow-y: auto; -} - -/* settings area */ -#app-settings { - position: fixed; - width: 299px; - bottom: 0; - border-top: 1px solid #ccc; -} -#app-settings-header { - background-color: #eee; -} -#app-settings-content { - display: none; - padding: 10px; - background-color: #eee; -} -#app-settings.open #app-settings-content { - display: block; -} - -.settings-button { - display: block; - height: 32px; - width: 100%; - padding: 0; - margin: 0; - background-color: transparent; background-image: url('../img/actions/settings.svg'); - background-position: 10px center; background-repeat: no-repeat; - box-shadow: none; - border: 0; - border-radius: 0; -} -.settings-button:hover { - background-color: #ddd; -} - -/* icons */ -.folder-icon, .delete-icon, .edit-icon, .progress-icon { - background-repeat: no-repeat; - background-position: center; -} -.folder-icon { background-image: url('../img/places/folder.svg'); } -.delete-icon { background-image: url('../img/actions/delete.svg'); } -.delete-icon:hover, .delete-icon:focus { - background-image: url('../img/actions/delete-hover.svg'); -} -.edit-icon { background-image: url('../img/actions/rename.svg'); } -.progress-icon { - background-image: url('../img/loading.gif'); - background-size: 16px; - /* force show the loading icon, not only on hover */ - -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - filter:alpha(opacity=100); - opacity: 1 !important; - display: inline !important; -} - -/* buttons */ -button.loading { - background-image: url('../img/loading.gif'); - background-position: right 10px center; background-repeat: no-repeat; - background-size: 16px; - padding-right: 30px; -} - - - - - /* ---- BROWSER-SPECIFIC FIXES ---- */ /* remove dotted outlines in Firefox */ diff --git a/lib/base.php b/lib/base.php index 2e6a37c9f4e..4309aaaa976 100644 --- a/lib/base.php +++ b/lib/base.php @@ -264,13 +264,14 @@ class OC { //OC_Util::addScript( "multiselect" ); OC_Util::addScript('search', 'result'); OC_Util::addScript('router'); + OC_Util::addScript("oc-requesttoken"); OC_Util::addStyle("styles"); + OC_Util::addStyle("apps"); OC_Util::addStyle("multiselect"); OC_Util::addStyle("jquery-ui-1.10.0.custom"); OC_Util::addStyle("jquery-tipsy"); OC_Util::addStyle("jquery.ocdialog"); - OC_Util::addScript("oc-requesttoken"); } public static function initSession() { -- cgit v1.2.3 From 9c23ed580ac02bfb21d277bc8c073b8eb331f85d Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Fri, 30 Aug 2013 11:42:32 +0200 Subject: move CSS for browser-specific fixes out of styles.css into new fixes.css --- core/css/fixes.css | 46 ++++++++++++++++++++++++++++++++++++++++++++++ core/css/styles.css | 44 -------------------------------------------- lib/base.php | 1 + 3 files changed, 47 insertions(+), 44 deletions(-) create mode 100644 core/css/fixes.css (limited to 'lib/base.php') diff --git a/core/css/fixes.css b/core/css/fixes.css new file mode 100644 index 00000000000..3df60ad5b5c --- /dev/null +++ b/core/css/fixes.css @@ -0,0 +1,46 @@ +/* ---- BROWSER-SPECIFIC FIXES ---- */ + +/* remove dotted outlines in Firefox */ +::-moz-focus-inner { + border: 0; +} + +.lte8 .delete-icon { background-image: url('../img/actions/delete.png'); } +.lte8 .delete-icon:hover, .delete-icon:focus { + background-image: url('../img/actions/delete-hover.png'); +} + +/* IE8 needs background to be set to same color to make transparency look good. */ +.lte9 #body-login form input[type="text"] { + border: 1px solid lightgrey; /* use border to add 1px line between input fields */ + background-color: white; /* don't change background on hover */ +} +.lte9 #body-login form input[type="password"] { + /* leave out top border for 1px line between input fields*/ + border-left: 1px solid lightgrey; + border-right: 1px solid lightgrey; + border-bottom: 1px solid lightgrey; + background-color: white; /* don't change background on hover */ +} +.lte9 #body-login form label.infield { + background-color: white; /* don't change background on hover */ + -ms-filter: "progid:DXImageTransform.Microsoft.Chroma(color='white')"; +} + +/* disable opacity of info text on gradient + since we cannot set a good backround color to use the filter&background hack as with the input labels */ +.lte9 #body-login p.info { + filter: initial; +} + +/* deactivate show password toggle for IE. Does not work for 8 and 9+ have their own implementation. */ +.ie #show, .ie #show+label { + display: none; + visibility: hidden; +} + +/* fix installation screen rendering issue for IE8+9 */ +.lte9 #body-login { + height: auto !important; +} + diff --git a/core/css/styles.css b/core/css/styles.css index d435e223b31..8f6fc6f27d1 100644 --- a/core/css/styles.css +++ b/core/css/styles.css @@ -709,47 +709,3 @@ div.crumb:active { opacity:.7; } - - -/* ---- BROWSER-SPECIFIC FIXES ---- */ - -/* remove dotted outlines in Firefox */ -::-moz-focus-inner { - border: 0; -} -.lte8 .delete-icon { background-image: url('../img/actions/delete.png'); } -.lte8 .delete-icon:hover, .delete-icon:focus { - background-image: url('../img/actions/delete-hover.png'); -} - -/* IE8 needs background to be set to same color to make transparency look good. */ -.lte9 #body-login form input[type="text"] { - border: 1px solid lightgrey; /* use border to add 1px line between input fields */ - background-color: white; /* don't change background on hover */ -} -.lte9 #body-login form input[type="password"] { - /* leave out top border for 1px line between input fields*/ - border-left: 1px solid lightgrey; - border-right: 1px solid lightgrey; - border-bottom: 1px solid lightgrey; - background-color: white; /* don't change background on hover */ -} -.lte9 #body-login form label.infield { - background-color: white; /* don't change background on hover */ - -ms-filter: "progid:DXImageTransform.Microsoft.Chroma(color='white')"; -} -/* disable opacity of info text on gradient - sice we cannot set a good backround color to use the filter&background hack as with the input labels */ -.lte9 #body-login p.info { - filter: initial; -} -/* deactivate show password toggle for IE. Does not work for 8 and 9+ have their own implementation. */ -.ie #show, .ie #show+label { - display: none; - visibility: hidden; -} - -/* fix installation screen rendering issue for IE8+9 */ -.lte9 #body-login { - height: auto !important; -} diff --git a/lib/base.php b/lib/base.php index 4309aaaa976..309455879bf 100644 --- a/lib/base.php +++ b/lib/base.php @@ -268,6 +268,7 @@ class OC { OC_Util::addStyle("styles"); OC_Util::addStyle("apps"); + OC_Util::addStyle("fixes"); OC_Util::addStyle("multiselect"); OC_Util::addStyle("jquery-ui-1.10.0.custom"); OC_Util::addStyle("jquery-tipsy"); -- cgit v1.2.3 From 7d398ba62227cf77066585b47adfcb5188dd991b Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Fri, 30 Aug 2013 00:33:48 +0200 Subject: Use the real username in preferences and magic cookie instead of case-insensitive user input. Fixes 4616. --- lib/base.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib/base.php') diff --git a/lib/base.php b/lib/base.php index 2e6a37c9f4e..c6e031e61d6 100644 --- a/lib/base.php +++ b/lib/base.php @@ -791,14 +791,15 @@ class OC { self::$session->set('timezone', $_POST['timezone-offset']); } - self::cleanupLoginTokens($_POST['user']); + $userid = OC_User::getUser(); + self::cleanupLoginTokens($userid); if (!empty($_POST["remember_login"])) { if (defined("DEBUG") && DEBUG) { OC_Log::write('core', 'Setting remember login to cookie', OC_Log::DEBUG); } $token = OC_Util::generate_random_bytes(32); - OC_Preferences::setValue($_POST['user'], 'login_token', $token, time()); - OC_User::setMagicInCookie($_POST["user"], $token); + OC_Preferences::setValue($userid, 'login_token', $token, time()); + OC_User::setMagicInCookie($userid, $token); } else { OC_User::unsetMagicInCookie(); } -- cgit v1.2.3