diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/base.php | 8 | ||||
-rw-r--r-- | lib/db.php | 8 | ||||
-rw-r--r-- | lib/fileproxy/quota.php | 3 | ||||
-rw-r--r-- | lib/filestorage/local.php | 2 | ||||
-rw-r--r-- | lib/filesystem.php | 8 | ||||
-rw-r--r-- | lib/installer.php | 16 | ||||
-rw-r--r-- | lib/preferences.php | 2 | ||||
-rw-r--r-- | lib/user.php | 7 |
8 files changed, 30 insertions, 24 deletions
diff --git a/lib/base.php b/lib/base.php index 9b777800764..de2e7a36eee 100644 --- a/lib/base.php +++ b/lib/base.php @@ -80,8 +80,6 @@ class OC{ date_default_timezone_set('Europe/Berlin'); ini_set('arg_separator.output','&'); - ini_set('session.cookie_httponly','1;'); - session_start(); // calculate the documentroot OC::$DOCUMENTROOT=realpath($_SERVER['DOCUMENT_ROOT']); @@ -102,6 +100,7 @@ class OC{ // redirect to https site if configured if( OC_Config::getValue( "forcessl", false )){ + ini_set("session.cookie_secure", "on"); if(!isset($_SERVER['HTTPS']) or $_SERVER['HTTPS'] != 'on') { $url = "https://". $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; header("Location: $url"); @@ -109,8 +108,11 @@ class OC{ } } + ini_set('session.cookie_httponly','1;'); + session_start(); + // Add the stuff we need always - OC_Util::addScript( "jquery-1.6.2.min" ); + OC_Util::addScript( "jquery-1.6.4.min" ); OC_Util::addScript( "jquery-ui-1.8.14.custom.min" ); OC_Util::addScript( "jquery-showpassword" ); OC_Util::addScript( "jquery-tipsy" ); diff --git a/lib/db.php b/lib/db.php index 0b7065eec8b..ede8ba897e9 100644 --- a/lib/db.php +++ b/lib/db.php @@ -92,8 +92,8 @@ class OC_DB { if( PEAR::isError( self::$DBConnection )){ echo( '<b>can not connect to database, using '.$CONFIG_DBTYPE.'. ('.self::$DBConnection->getUserInfo().')</center>'); $error = self::$DBConnection->getMessage(); - error_log( $error); - error_log( self::$DBConnection->getUserInfo()); + if(defined("DEBUG") && DEBUG) {error_log( $error);} + if(defined("DEBUG") && DEBUG) {error_log( self::$DBConnection->getUserInfo());} die( $error ); } @@ -129,7 +129,7 @@ class OC_DB { if( PEAR::isError($result)) { $entry = 'DB Error: "'.$result->getMessage().'"<br />'; $entry .= 'Offending command was: '.$query.'<br />'; - error_log( $entry ); + if(defined("DEBUG") && DEBUG) {error_log( $entry );} die( $entry ); } @@ -155,7 +155,7 @@ class OC_DB { if( PEAR::isError($result)) { $entry = 'DB Error: "'.$result->getMessage().'"<br />'; $entry .= 'Offending command was: '.$query.'<br />'; - error_log( $entry ); + if(defined("DEBUG") && DEBUG) {error_log( $entry );} die( $entry ); } diff --git a/lib/fileproxy/quota.php b/lib/fileproxy/quota.php index af8ddee1473..fe3a2333428 100644 --- a/lib/fileproxy/quota.php +++ b/lib/fileproxy/quota.php @@ -44,6 +44,9 @@ class OC_FileProxy_Quota extends OC_FileProxy{ } public function preFile_put_contents($path,$data){ + if (is_resource($data)) { + $data = stream_get_contents($data); + } return (strlen($data)<$this->getFreeSpace() or $this->getFreeSpace()==0); } diff --git a/lib/filestorage/local.php b/lib/filestorage/local.php index 07759b0e88c..180b056f344 100644 --- a/lib/filestorage/local.php +++ b/lib/filestorage/local.php @@ -195,7 +195,7 @@ class OC_Filestorage_Local extends OC_Filestorage{ } private function delTree($dir) { - error_log('del'.$dir); + if(defined("DEBUG") && DEBUG) {error_log('del'.$dir);} $dirRelative=$dir; $dir=$this->datadir.$dir; if (!file_exists($dir)) return true; diff --git a/lib/filesystem.php b/lib/filesystem.php index 76032fae204..d7c485d25b8 100644 --- a/lib/filesystem.php +++ b/lib/filesystem.php @@ -286,7 +286,7 @@ class OC_Filesystem{ return self::basicOperation('file_get_contents',$path,array('read')); } static public function file_put_contents($path,$data){ - error_log($data); + if(defined("DEBUG") && DEBUG) {error_log($data);} return self::basicOperation('file_put_contents',$path,array('create','write'),$data); } static public function unlink($path){ @@ -393,7 +393,7 @@ class OC_Filesystem{ } } static public function fromUploadedFile($tmpFile,$path){ - error_log('upload'); + if(defined("DEBUG") && DEBUG) {error_log('upload');} if(OC_FileProxy::runPreProxies('fromUploadedFile',$tmpFile,$path) and self::canWrite($path) and $storage=self::getStorage($path)){ $run=true; $exists=self::file_exists($path); @@ -403,7 +403,7 @@ class OC_Filesystem{ if($run){ OC_Hook::emit( 'OC_Filesystem', 'write', array( 'path' => $path, 'run' => &$run)); } - error_log('upload2'); + if(defined("DEBUG") && DEBUG) {error_log('upload2');} if($run){ $result=$storage->fromUploadedFile($tmpFile,self::getInternalPath($path)); if(!$exists){ @@ -454,7 +454,7 @@ class OC_Filesystem{ * @return mixed */ private static function basicOperation($operation,$path,$hooks=array(),$extraParam=null){ - if(OC_FileProxy::runPreProxies($operation,$path) and self::canRead($path) and $storage=self::getStorage($path)){ + if(OC_FileProxy::runPreProxies($operation,$path, $extraParam) and self::canRead($path) and $storage=self::getStorage($path)){ $interalPath=self::getInternalPath($path); $run=true; foreach($hooks as $hook){ diff --git a/lib/installer.php b/lib/installer.php index 83c575032ec..9416a42c972 100644 --- a/lib/installer.php +++ b/lib/installer.php @@ -56,7 +56,7 @@ class OC_Installer{ */ public static function installApp( $data = array()){ if(!isset($data['source'])){ - error_log("No source specified when installing app"); + if(defined("DEBUG") && DEBUG) {error_log("No source specified when installing app");} return false; } @@ -64,13 +64,13 @@ class OC_Installer{ if($data['source']=='http'){ $path=tempnam(sys_get_temp_dir(),'oc_installer_'); if(!isset($data['href'])){ - error_log("No href specified when installing app from http"); + if(defined("DEBUG") && DEBUG) {error_log("No href specified when installing app from http");} return false; } copy($data['href'],$path); }else{ if(!isset($data['path'])){ - error_log("No path specified when installing app from local file"); + if(defined("DEBUG") && DEBUG) {error_log("No path specified when installing app from local file");} return false; } $path=$data['path']; @@ -85,7 +85,7 @@ class OC_Installer{ $zip->extractTo($extractDir); $zip->close(); } else { - error_log("Failed to open archive when installing app"); + if(defined("DEBUG") && DEBUG) {error_log("Failed to open archive when installing app");} OC_Helper::rmdirr($extractDir); if($data['source']=='http'){ unlink($path); @@ -95,7 +95,7 @@ class OC_Installer{ //load the info.xml file of the app if(!is_file($extractDir.'/appinfo/info.xml')){ - error_log("App does not provide an info.xml file"); + if(defined("DEBUG") && DEBUG) {error_log("App does not provide an info.xml file");} OC_Helper::rmdirr($extractDir); if($data['source']=='http'){ unlink($path); @@ -107,7 +107,7 @@ class OC_Installer{ //check if an app with the same id is already installed if(self::isInstalled( $info['id'] )){ - error_log("App already installed"); + if(defined("DEBUG") && DEBUG) {error_log("App already installed");} OC_Helper::rmdirr($extractDir); if($data['source']=='http'){ unlink($path); @@ -117,7 +117,7 @@ class OC_Installer{ //check if the destination directory already exists if(is_dir($basedir)){ - error_log("App's directory already exists"); + if(defined("DEBUG") && DEBUG) {error_log("App's directory already exists");} OC_Helper::rmdirr($extractDir); if($data['source']=='http'){ unlink($path); @@ -131,7 +131,7 @@ class OC_Installer{ //copy the app to the correct place if(!mkdir($basedir)){ - error_log('Can\'t create app folder ('.$basedir.')'); + if(defined("DEBUG") && DEBUG) {error_log('Can\'t create app folder ('.$basedir.')');} OC_Helper::rmdirr($extractDir); if($data['source']=='http'){ unlink($path); diff --git a/lib/preferences.php b/lib/preferences.php index 5af007f0223..b4bd6777f9e 100644 --- a/lib/preferences.php +++ b/lib/preferences.php @@ -140,7 +140,7 @@ class OC_Preferences{ // Check if the key does exist $query = OC_DB::prepare( 'SELECT configvalue FROM *PREFIX*preferences WHERE userid = ? AND appid = ? AND configkey = ?' ); $values=$query->execute(array($user,$app,$key))->fetchAll(); - error_log(print_r($values,true)); + if(defined("DEBUG") && DEBUG) {error_log(print_r($values,true));} $exists=(count($values)>0); if( !$exists ){ diff --git a/lib/user.php b/lib/user.php index 3e73b2f1008..241d9aa8b10 100644 --- a/lib/user.php +++ b/lib/user.php @@ -348,9 +348,10 @@ class OC_User { * @param string $username username to be set */ public static function setMagicInCookie($username, $token){ - setcookie("oc_username", $username, time()+60*60*24*15); - setcookie("oc_token", $token, time()+60*60*24*15); - setcookie("oc_remember_login", true, time()+60*60*24*15); + $secure_cookie = OC_Config::getValue("forcessl", false); + setcookie("oc_username", $username, time()+60*60*24*15, '', '', $secure_cookie); + setcookie("oc_token", $token, time()+60*60*24*15, '', '', $secure_cookie); + setcookie("oc_remember_login", true, time()+60*60*24*15, '', '', $secure_cookie); } /** |