diff options
author | Georg Ehrke <ownclouddev@georgswebsite.de> | 2011-11-12 15:09:37 +0100 |
---|---|---|
committer | Georg Ehrke <ownclouddev@georgswebsite.de> | 2011-11-12 15:09:37 +0100 |
commit | e5a3ab8aad0b0deb312a97acb3fc808b497b0544 (patch) | |
tree | 5f7074a651b979cd0c9659de3f8d3fb6066fa37b /lib | |
parent | 03d9fab3c0cf3a3c50259d6a33439a998628b45c (diff) | |
parent | ef124c3e21ceae49f0f704589a833d1208d99c65 (diff) | |
download | nextcloud-server-e5a3ab8aad0b0deb312a97acb3fc808b497b0544.tar.gz nextcloud-server-e5a3ab8aad0b0deb312a97acb3fc808b497b0544.zip |
Merge branch 'master' into fullcalendar
Diffstat (limited to 'lib')
-rw-r--r-- | lib/app.php | 4 | ||||
-rw-r--r-- | lib/base.php | 3 | ||||
-rw-r--r-- | lib/connector/sabre/file.php | 2 | ||||
-rw-r--r-- | lib/db.php | 10 | ||||
-rw-r--r-- | lib/filestorage/local.php | 5 | ||||
-rw-r--r-- | lib/hook.php | 2 | ||||
-rw-r--r-- | lib/log.php | 3 | ||||
-rw-r--r-- | lib/ocsclient.php | 2 | ||||
-rw-r--r-- | lib/setup.php | 4 | ||||
-rw-r--r-- | lib/template.php | 27 |
10 files changed, 54 insertions, 8 deletions
diff --git a/lib/app.php b/lib/app.php index 30ebcf032b3..d3d99865762 100644 --- a/lib/app.php +++ b/lib/app.php @@ -100,11 +100,11 @@ class OC_App{ } /** - * @brief enables an app + * @brief disables an app * @param $app app * @returns true/false * - * This function set an app as enabled in appconfig. + * This function set an app as disabled in appconfig. */ public static function disable( $app ){ OC_Appconfig::setValue( $app, 'enabled', 'no' ); diff --git a/lib/base.php b/lib/base.php index d5fff1e0a74..c52b4493e01 100644 --- a/lib/base.php +++ b/lib/base.php @@ -77,6 +77,9 @@ class OC{ // set some stuff //ob_start(); error_reporting(E_ALL | E_STRICT); + if (defined('DEBUG') && DEBUG){ + ini_set('display_errors', 1); + } date_default_timezone_set('Europe/Berlin'); ini_set('arg_separator.output','&'); diff --git a/lib/connector/sabre/file.php b/lib/connector/sabre/file.php index b049f39c171..98661dbb184 100644 --- a/lib/connector/sabre/file.php +++ b/lib/connector/sabre/file.php @@ -29,7 +29,7 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D */ public function get() { - return OC_Filesystem::file_get_contents($this->path); + return OC_Filesystem::fopen($this->path,'r'); } diff --git a/lib/db.php b/lib/db.php index 421b08c2320..c059f5ab336 100644 --- a/lib/db.php +++ b/lib/db.php @@ -224,6 +224,7 @@ class OC_DB { /** * @brief gets last value of autoincrement + * @param $table string The optional table name (will replace *PREFIX*) and add sequence suffix * @returns id * * MDB2 lastInsertID() @@ -231,9 +232,14 @@ class OC_DB { * Call this method right after the insert command or other functions may * cause trouble! */ - public static function insertid(){ + public static function insertid($table=null){ self::connect(); - return self::$connection->lastInsertId(); + if($table !== null){ + $prefix = OC_Config::getValue( "dbtableprefix", "oc_" ); + $suffix = OC_Config::getValue( "dbsequencesuffix", "_id_seq" ); + $table = str_replace( '*PREFIX*', $prefix, $table ); + } + return self::$connection->lastInsertId($table.$suffix); } /** diff --git a/lib/filestorage/local.php b/lib/filestorage/local.php index 01523b6b0b3..9e29f85071a 100644 --- a/lib/filestorage/local.php +++ b/lib/filestorage/local.php @@ -84,6 +84,11 @@ class OC_Filestorage_Local extends OC_Filestorage{ return $return; } public function rename($path1,$path2){ + if(! $this->file_exists($path1)){ + OC_Log::write('core','unable to rename, file does not exists : '.$path1,OC_Log::ERROR); + return false; + } + if($return=rename($this->datadir.$path1,$this->datadir.$path2)){ $this->clearFolderSizeCache($path1); $this->clearFolderSizeCache($path2); diff --git a/lib/hook.php b/lib/hook.php index b069a7da6c0..83a16106bf0 100644 --- a/lib/hook.php +++ b/lib/hook.php @@ -20,7 +20,7 @@ class OC_Hook{ * TODO: write example */ static public function connect( $signalclass, $signalname, $slotclass, $slotname ){ - // Cerate the data structure + // Create the data structure if( !array_key_exists( $signalclass, self::$registered )){ self::$registered[$signalclass] = array(); } diff --git a/lib/log.php b/lib/log.php index 98333be54fe..446ddd48848 100644 --- a/lib/log.php +++ b/lib/log.php @@ -59,6 +59,9 @@ class OC_Log{ return array(); } $fh=fopen($logFile,'r'); + if($fh === false){ // Unable to read log file! + return array(); + } while(!feof($fh)){ $line=fgets($fh); if($line){ diff --git a/lib/ocsclient.php b/lib/ocsclient.php index 654c5e0527b..072fd236fee 100644 --- a/lib/ocsclient.php +++ b/lib/ocsclient.php @@ -108,6 +108,7 @@ class OC_OCSClient{ $xml=@file_get_contents($url); if($xml==FALSE){ + OC_Log::write('core','Unable to parse OCS content',OC_Log::FATAL); return NULL; } $data=simplexml_load_string($xml); @@ -143,6 +144,7 @@ class OC_OCSClient{ $kbe=array(); $xml=@file_get_contents($url); if($xml==FALSE){ + OC_Log::write('core','Unable to parse knowledgebase content',OC_Log::FATAL); return NULL; } $data=simplexml_load_string($xml); diff --git a/lib/setup.php b/lib/setup.php index 2dcedb9b820..e2d56ddaf4a 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -82,7 +82,7 @@ class OC_Setup { $dbpass = $options['dbpass']; $dbname = $options['dbname']; $dbhost = $options['dbhost']; - $dbtableprefix = OC_Config::getValue('dbtableprefix','oc_'); + $dbtableprefix = $options['dbtableprefix']; OC_Config::setValue('dbname', $dbname); OC_Config::setValue('dbhost', $dbhost); OC_Config::setValue('dbtableprefix', $dbtableprefix); @@ -135,7 +135,7 @@ class OC_Setup { $dbpass = $options['dbpass']; $dbname = $options['dbname']; $dbhost = $options['dbhost']; - $dbtableprefix = OC_Config::getValue('dbtableprefix','oc_'); + $dbtableprefix = $options['dbtableprefix']; OC_CONFIG::setValue('dbname', $dbname); OC_CONFIG::setValue('dbhost', $dbhost); OC_CONFIG::setValue('dbtableprefix', $dbtableprefix); diff --git a/lib/template.php b/lib/template.php index 440b62003e7..d1439199e1e 100644 --- a/lib/template.php +++ b/lib/template.php @@ -98,6 +98,33 @@ function relative_modified_date($timestamp) { else { return $l->t('years ago'); } } +function html_select_options($options, $selected, $params=array()) { + if (!is_array($selected)){ + $selected=array($selected); + } + if (isset($params['combine']) && $params['combine']){ + $options = array_combine($options, $options); + } + $value_name = $label_name = false; + if (isset($params['value'])){ + $value_name = $params['value']; + } + if (isset($params['label'])){ + $label_name = $params['label']; + } + $html = ''; + foreach($options as $value => $label){ + if ($value_name && is_array($label)){ + $value = $label[$value_name]; + } + if ($label_name && is_array($label)){ + $label = $label[$label_name]; + } + $select = in_array($value, $selected) ? ' selected="selected"' : ''; + $html .= '<option value="' . $value . '"' . $select . '>' . $label . '</option>'; + } + return $html; +} /** * This class provides the templates for owncloud. |