aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorTom Needham <tom@owncloud.com>2012-12-16 22:29:00 +0000
committerTom Needham <tom@owncloud.com>2012-12-16 22:29:00 +0000
commit3c98f36121c10f703904d63cd531b7bbf6ee9454 (patch)
treec12c9f737e036cec5f1b235214902473b6b418d5 /lib
parent39b51997756ebb233be10ca5a8ced0d6c60d0dac (diff)
parent811b571cb3da8494797ed70c5b967067cc2a1b5b (diff)
downloadnextcloud-server-3c98f36121c10f703904d63cd531b7bbf6ee9454.tar.gz
nextcloud-server-3c98f36121c10f703904d63cd531b7bbf6ee9454.zip
Merge branch 'master' into ocs_api
Diffstat (limited to 'lib')
-rw-r--r--lib/app.php20
-rw-r--r--lib/db.php6
-rw-r--r--lib/filecache.php6
-rw-r--r--lib/files.php4
-rw-r--r--lib/helper.php2
-rw-r--r--lib/hook.php6
-rw-r--r--lib/l10n.php14
-rw-r--r--lib/migrate.php162
-rw-r--r--lib/ocsclient.php8
-rw-r--r--lib/public/contacts.php33
-rwxr-xr-xlib/request.php6
-rw-r--r--lib/templatelayout.php30
-rw-r--r--lib/updater.php18
-rwxr-xr-xlib/util.php61
14 files changed, 198 insertions, 178 deletions
diff --git a/lib/app.php b/lib/app.php
index ccd0958cd01..30f76300365 100644
--- a/lib/app.php
+++ b/lib/app.php
@@ -611,16 +611,16 @@ class OC_App{
$app1[$i]['internal'] = $app1[$i]['active'] = 0;
// rating img
- if($app['score']>=0 and $app['score']<5) $img=OC_Helper::imagePath( "core", "rating/s1.png" );
- elseif($app['score']>=5 and $app['score']<15) $img=OC_Helper::imagePath( "core", "rating/s2.png" );
- elseif($app['score']>=15 and $app['score']<25) $img=OC_Helper::imagePath( "core", "rating/s3.png" );
- elseif($app['score']>=25 and $app['score']<35) $img=OC_Helper::imagePath( "core", "rating/s4.png" );
- elseif($app['score']>=35 and $app['score']<45) $img=OC_Helper::imagePath( "core", "rating/s5.png" );
- elseif($app['score']>=45 and $app['score']<55) $img=OC_Helper::imagePath( "core", "rating/s6.png" );
- elseif($app['score']>=55 and $app['score']<65) $img=OC_Helper::imagePath( "core", "rating/s7.png" );
- elseif($app['score']>=65 and $app['score']<75) $img=OC_Helper::imagePath( "core", "rating/s8.png" );
- elseif($app['score']>=75 and $app['score']<85) $img=OC_Helper::imagePath( "core", "rating/s9.png" );
- elseif($app['score']>=85 and $app['score']<95) $img=OC_Helper::imagePath( "core", "rating/s10.png" );
+ if($app['score']>=0 and $app['score']<5) $img=OC_Helper::imagePath( "core", "rating/s1.png" );
+ elseif($app['score']>=5 and $app['score']<15) $img=OC_Helper::imagePath( "core", "rating/s2.png" );
+ elseif($app['score']>=15 and $app['score']<25) $img=OC_Helper::imagePath( "core", "rating/s3.png" );
+ elseif($app['score']>=25 and $app['score']<35) $img=OC_Helper::imagePath( "core", "rating/s4.png" );
+ elseif($app['score']>=35 and $app['score']<45) $img=OC_Helper::imagePath( "core", "rating/s5.png" );
+ elseif($app['score']>=45 and $app['score']<55) $img=OC_Helper::imagePath( "core", "rating/s6.png" );
+ elseif($app['score']>=55 and $app['score']<65) $img=OC_Helper::imagePath( "core", "rating/s7.png" );
+ elseif($app['score']>=65 and $app['score']<75) $img=OC_Helper::imagePath( "core", "rating/s8.png" );
+ elseif($app['score']>=75 and $app['score']<85) $img=OC_Helper::imagePath( "core", "rating/s9.png" );
+ elseif($app['score']>=85 and $app['score']<95) $img=OC_Helper::imagePath( "core", "rating/s10.png" );
elseif($app['score']>=95 and $app['score']<100) $img=OC_Helper::imagePath( "core", "rating/s11.png" );
$app1[$i]['score'] = '<img src="'.$img.'"> Score: '.$app['score'].'%';
diff --git a/lib/db.php b/lib/db.php
index 6524db7581a..7e60b41d230 100644
--- a/lib/db.php
+++ b/lib/db.php
@@ -445,9 +445,9 @@ class OC_DB {
* http://www.sqlite.org/lang_createtable.html
* http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions037.htm
*/
- if( $CONFIG_DBTYPE == 'pgsql' ) { //mysql support it too but sqlite doesn't
- $content = str_replace( '<default>0000-00-00 00:00:00</default>', '<default>CURRENT_TIMESTAMP</default>', $content );
- }
+ if( $CONFIG_DBTYPE == 'pgsql' ) { //mysql support it too but sqlite doesn't
+ $content = str_replace( '<default>0000-00-00 00:00:00</default>', '<default>CURRENT_TIMESTAMP</default>', $content );
+ }
file_put_contents( $file2, $content );
diff --git a/lib/filecache.php b/lib/filecache.php
index bbf55bc1f86..c3256c783e6 100644
--- a/lib/filecache.php
+++ b/lib/filecache.php
@@ -355,7 +355,7 @@ class OC_FileCache{
if($sizeDiff==0) return;
$item = OC_FileCache_Cached::get($path);
//stop walking up the filetree if we hit a non-folder or reached to root folder
- if($path == '/' || $path=='' || $item['mimetype'] !== 'httpd/unix-directory'){
+ if($path == '/' || $path=='' || $item['mimetype'] !== 'httpd/unix-directory') {
return;
}
$id = $item['id'];
@@ -363,13 +363,13 @@ class OC_FileCache{
$query=OC_DB::prepare('UPDATE `*PREFIX*fscache` SET `size`=`size`+? WHERE `id`=?');
$query->execute(array($sizeDiff, $id));
$path=dirname($path);
- if($path == '' or $path =='/'){
+ if($path == '' or $path =='/') {
return;
}
$parent = OC_FileCache_Cached::get($path);
$id = $parent['id'];
//stop walking up the filetree if we hit a non-folder
- if($parent['mimetype'] !== 'httpd/unix-directory'){
+ if($parent['mimetype'] !== 'httpd/unix-directory') {
return;
}
}
diff --git a/lib/files.php b/lib/files.php
index b4a4145a493..152ed8f34a7 100644
--- a/lib/files.php
+++ b/lib/files.php
@@ -492,7 +492,9 @@ class OC_Files {
if(is_writable(OC::$SERVERROOT.'/.htaccess')) {
file_put_contents(OC::$SERVERROOT.'/.htaccess', $htaccess);
return OC_Helper::computerFileSize($size);
- } else { OC_Log::write('files', 'Can\'t write upload limit to '.OC::$SERVERROOT.'/.htaccess. Please check the file permissions', OC_Log::WARN); }
+ } else {
+ OC_Log::write('files', 'Can\'t write upload limit to '.OC::$SERVERROOT.'/.htaccess. Please check the file permissions', OC_Log::WARN);
+ }
return false;
}
diff --git a/lib/helper.php b/lib/helper.php
index 5dec7fadfb4..be4e4e52677 100644
--- a/lib/helper.php
+++ b/lib/helper.php
@@ -540,7 +540,7 @@ class OC_Helper {
mkdir($tmpDirNoClean);
}
$file=$tmpDirNoClean.md5(time().rand()).$postfix;
- $fh=fopen($file,'w');
+ $fh=fopen($file, 'w');
fclose($fh);
return $file;
}
diff --git a/lib/hook.php b/lib/hook.php
index 26a53693748..4da331bb5d8 100644
--- a/lib/hook.php
+++ b/lib/hook.php
@@ -59,7 +59,11 @@ class OC_Hook{
// Call all slots
foreach( self::$registered[$signalclass][$signalname] as $i ) {
- call_user_func( array( $i["class"], $i["name"] ), $params );
+ try {
+ call_user_func( array( $i["class"], $i["name"] ), $params );
+ } catch (Exception $e){
+ OC_Log::write('hook', 'error while running hook (' . $i["class"] . '::' . $i["name"] . '): '.$e->getMessage(), OC_Log::ERROR);
+ }
}
// return true
diff --git a/lib/l10n.php b/lib/l10n.php
index b83d8ff86db..f70dfa5e34e 100644
--- a/lib/l10n.php
+++ b/lib/l10n.php
@@ -115,10 +115,12 @@ class OC_L10N{
$i18ndir = self::findI18nDir($app);
// Localization is in /l10n, Texts are in $i18ndir
// (Just no need to define date/time format etc. twice)
- if((OC_Helper::issubdirectory($i18ndir.$lang.'.php', OC_App::getAppPath($app).'/l10n/') ||
- OC_Helper::issubdirectory($i18ndir.$lang.'.php', OC::$SERVERROOT.'/core/l10n/') ||
- OC_Helper::issubdirectory($i18ndir.$lang.'.php', OC::$SERVERROOT.'/lib/l10n/') ||
- OC_Helper::issubdirectory($i18ndir.$lang.'.php', OC::$SERVERROOT.'/settings')) && file_exists($i18ndir.$lang.'.php')) {
+ if((OC_Helper::issubdirectory($i18ndir.$lang.'.php', OC_App::getAppPath($app).'/l10n/')
+ || OC_Helper::issubdirectory($i18ndir.$lang.'.php', OC::$SERVERROOT.'/core/l10n/')
+ || OC_Helper::issubdirectory($i18ndir.$lang.'.php', OC::$SERVERROOT.'/lib/l10n/')
+ || OC_Helper::issubdirectory($i18ndir.$lang.'.php', OC::$SERVERROOT.'/settings')
+ )
+ && file_exists($i18ndir.$lang.'.php')) {
// Include the file, save the data from $CONFIG
include strip_tags($i18ndir).strip_tags($lang).'.php';
if(isset($TRANSLATIONS) && is_array($TRANSLATIONS)) {
@@ -294,12 +296,12 @@ class OC_L10N{
}
foreach($accepted_languages as $i) {
$temp = explode(';', $i);
- $temp[0] = str_replace('-','_',$temp[0]);
+ $temp[0] = str_replace('-', '_', $temp[0]);
if( ($key = array_search($temp[0], $available)) !== false) {
return $available[$key];
}
foreach($available as $l) {
- if ( $temp[0] == substr($l,0,2) ) {
+ if ( $temp[0] == substr($l, 0, 2) ) {
return $l;
}
}
diff --git a/lib/migrate.php b/lib/migrate.php
index 2cc0a3067b8..5ff8e338a44 100644
--- a/lib/migrate.php
+++ b/lib/migrate.php
@@ -78,67 +78,67 @@ class OC_Migrate{
* @param otional $path string path to zip output folder
* @return false on error, path to zip on success
*/
- public static function export( $uid=null, $type='user', $path=null ) {
+ public static function export( $uid=null, $type='user', $path=null ) {
$datadir = OC_Config::getValue( 'datadirectory' );
- // Validate export type
- $types = array( 'user', 'instance', 'system', 'userfiles' );
- if( !in_array( $type, $types ) ) {
- OC_Log::write( 'migration', 'Invalid export type', OC_Log::ERROR );
- return json_encode( array( 'success' => false ) );
- }
- self::$exporttype = $type;
- // Userid?
- if( self::$exporttype == 'user' ) {
- // Check user exists
- self::$uid = is_null($uid) ? OC_User::getUser() : $uid;
- if(!OC_User::userExists(self::$uid)) {
- return json_encode( array( 'success' => false) );
- }
- }
- // Calculate zipname
- if( self::$exporttype == 'user' ) {
- $zipname = 'oc_export_' . self::$uid . '_' . date("y-m-d_H-i-s") . '.zip';
- } else {
- $zipname = 'oc_export_' . self::$exporttype . '_' . date("y-m-d_H-i-s") . '.zip';
- }
- // Calculate path
- if( self::$exporttype == 'user' ) {
- self::$zippath = $datadir . '/' . self::$uid . '/' . $zipname;
- } else {
- if( !is_null( $path ) ) {
- // Validate custom path
- if( !file_exists( $path ) || !is_writeable( $path ) ) {
- OC_Log::write( 'migration', 'Path supplied is invalid.', OC_Log::ERROR );
- return json_encode( array( 'success' => false ) );
- }
- self::$zippath = $path . $zipname;
- } else {
- // Default path
- self::$zippath = get_temp_dir() . '/' . $zipname;
- }
- }
- // Create the zip object
- if( !self::createZip() ) {
- return json_encode( array( 'success' => false ) );
- }
- // Do the export
- self::findProviders();
- $exportdata = array();
- switch( self::$exporttype ) {
- case 'user':
- // Connect to the db
- self::$dbpath = $datadir . '/' . self::$uid . '/migration.db';
- if( !self::connectDB() ) {
- return json_encode( array( 'success' => false ) );
- }
- self::$content = new OC_Migration_Content( self::$zip, self::$MDB2 );
- // Export the app info
- $exportdata = self::exportAppData();
+ // Validate export type
+ $types = array( 'user', 'instance', 'system', 'userfiles' );
+ if( !in_array( $type, $types ) ) {
+ OC_Log::write( 'migration', 'Invalid export type', OC_Log::ERROR );
+ return json_encode( array( 'success' => false ) );
+ }
+ self::$exporttype = $type;
+ // Userid?
+ if( self::$exporttype == 'user' ) {
+ // Check user exists
+ self::$uid = is_null($uid) ? OC_User::getUser() : $uid;
+ if(!OC_User::userExists(self::$uid)) {
+ return json_encode( array( 'success' => false) );
+ }
+ }
+ // Calculate zipname
+ if( self::$exporttype == 'user' ) {
+ $zipname = 'oc_export_' . self::$uid . '_' . date("y-m-d_H-i-s") . '.zip';
+ } else {
+ $zipname = 'oc_export_' . self::$exporttype . '_' . date("y-m-d_H-i-s") . '.zip';
+ }
+ // Calculate path
+ if( self::$exporttype == 'user' ) {
+ self::$zippath = $datadir . '/' . self::$uid . '/' . $zipname;
+ } else {
+ if( !is_null( $path ) ) {
+ // Validate custom path
+ if( !file_exists( $path ) || !is_writeable( $path ) ) {
+ OC_Log::write( 'migration', 'Path supplied is invalid.', OC_Log::ERROR );
+ return json_encode( array( 'success' => false ) );
+ }
+ self::$zippath = $path . $zipname;
+ } else {
+ // Default path
+ self::$zippath = get_temp_dir() . '/' . $zipname;
+ }
+ }
+ // Create the zip object
+ if( !self::createZip() ) {
+ return json_encode( array( 'success' => false ) );
+ }
+ // Do the export
+ self::findProviders();
+ $exportdata = array();
+ switch( self::$exporttype ) {
+ case 'user':
+ // Connect to the db
+ self::$dbpath = $datadir . '/' . self::$uid . '/migration.db';
+ if( !self::connectDB() ) {
+ return json_encode( array( 'success' => false ) );
+ }
+ self::$content = new OC_Migration_Content( self::$zip, self::$MDB2 );
+ // Export the app info
+ $exportdata = self::exportAppData();
// Add the data dir to the zip
self::$content->addDir(OC_User::getHome(self::$uid), true, '/' );
- break;
- case 'instance':
- self::$content = new OC_Migration_Content( self::$zip );
+ break;
+ case 'instance':
+ self::$content = new OC_Migration_Content( self::$zip );
// Creates a zip that is compatable with the import function
$dbfile = tempnam( get_temp_dir(), "owncloud_export_data_" );
OC_DB::getDbStructure( $dbfile, 'MDB2_SCHEMA_DUMP_ALL');
@@ -155,32 +155,32 @@ class OC_Migrate{
foreach(OC_User::getUsers() as $user) {
self::$content->addDir(OC_User::getHome($user), true, "/userdata/" );
}
- break;
+ break;
case 'userfiles':
self::$content = new OC_Migration_Content( self::$zip );
// Creates a zip with all of the users files
foreach(OC_User::getUsers() as $user) {
self::$content->addDir(OC_User::getHome($user), true, "/" );
}
- break;
+ break;
case 'system':
self::$content = new OC_Migration_Content( self::$zip );
// Creates a zip with the owncloud system files
self::$content->addDir( OC::$SERVERROOT . '/', false, '/');
foreach (array(".git", "3rdparty", "apps", "core", "files", "l10n", "lib", "ocs", "search", "settings", "tests") as $dir) {
- self::$content->addDir( OC::$SERVERROOT . '/' . $dir, true, "/");
+ self::$content->addDir( OC::$SERVERROOT . '/' . $dir, true, "/");
}
- break;
- }
- if( !$info = self::getExportInfo( $exportdata ) ) {
- return json_encode( array( 'success' => false ) );
- }
- // Add the export info json to the export zip
- self::$content->addFromString( $info, 'export_info.json' );
- if( !self::$content->finish() ) {
- return json_encode( array( 'success' => false ) );
- }
- return json_encode( array( 'success' => true, 'data' => self::$zippath ) );
+ break;
+ }
+ if( !$info = self::getExportInfo( $exportdata ) ) {
+ return json_encode( array( 'success' => false ) );
+ }
+ // Add the export info json to the export zip
+ self::$content->addFromString( $info, 'export_info.json' );
+ if( !self::$content->finish() ) {
+ return json_encode( array( 'success' => false ) );
+ }
+ return json_encode( array( 'success' => true, 'data' => self::$zippath ) );
}
/**
@@ -254,7 +254,7 @@ class OC_Migrate{
OC_Log::write( 'migration', 'Failed to delete the extracted zip', OC_Log::ERROR );
}
return json_encode( array( 'success' => true, 'data' => $appsimported ) );
- break;
+ break;
case 'instance':
/*
* EXPERIMENTAL
@@ -281,7 +281,7 @@ class OC_Migrate{
// Done
return json_encode( array( 'success' => true ) );
*/
- break;
+ break;
}
}
@@ -319,10 +319,10 @@ class OC_Migrate{
static private function extractZip( $path ) {
self::$zip = new ZipArchive;
// Validate path
- if( !file_exists( $path ) ) {
- OC_Log::write( 'migration', 'Zip not found', OC_Log::ERROR );
- return false;
- }
+ if( !file_exists( $path ) ) {
+ OC_Log::write( 'migration', 'Zip not found', OC_Log::ERROR );
+ return false;
+ }
if ( self::$zip->open( $path ) != true ) {
OC_Log::write( 'migration', "Failed to open zip file", OC_Log::ERROR );
return false;
@@ -555,9 +555,9 @@ class OC_Migrate{
if ( self::$zip->open( self::$zippath, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE ) !== true ) {
OC_Log::write('migration', 'Failed to create the zip with error: '.self::$zip->getStatusString(), OC_Log::ERROR);
return false;
- } else {
- return true;
- }
+ } else {
+ return true;
+ }
}
/**
diff --git a/lib/ocsclient.php b/lib/ocsclient.php
index 12e5026a877..24081425f1e 100644
--- a/lib/ocsclient.php
+++ b/lib/ocsclient.php
@@ -44,10 +44,10 @@ class OC_OCSClient{
* @returns string of the KB server
* This function returns the url of the OCS knowledge base server. It´s possible to set it in the config file or it will fallback to the default
*/
- private static function getKBURL() {
- $url = OC_Config::getValue('knowledgebaseurl', 'http://api.apps.owncloud.com/v1');
- return($url);
- }
+ private static function getKBURL() {
+ $url = OC_Config::getValue('knowledgebaseurl', 'http://api.apps.owncloud.com/v1');
+ return($url);
+ }
/**
* @brief Get the content of an OCS url call.
diff --git a/lib/public/contacts.php b/lib/public/contacts.php
index 4cf57ed8ff2..88d812e735a 100644
--- a/lib/public/contacts.php
+++ b/lib/public/contacts.php
@@ -54,29 +54,30 @@ namespace OCP {
* Example:
* Following function shows how to search for contacts for the name and the email address.
*
- * public static function getMatchingRecipient($term) {
- * // The API is not active -> nothing to do
+ * public static function getMatchingRecipient($term) {
+ * // The API is not active -> nothing to do
* if (!\OCP\Contacts::isEnabled()) {
- * return array();
+ * return array();
* }
*
* $result = \OCP\Contacts::search($term, array('FN', 'EMAIL'));
* $receivers = array();
* foreach ($result as $r) {
- * $id = $r['id'];
- * $fn = $r['FN'];
- * $email = $r['EMAIL'];
- * if (!is_array($email)) {
- * $email = array($email);
- * }
+ * $id = $r['id'];
+ * $fn = $r['FN'];
+ * $email = $r['EMAIL'];
+ * if (!is_array($email)) {
+ * $email = array($email);
+ * }
*
- * // loop through all email addresses of this contact
- * foreach ($email as $e) {
- * $displayName = $fn . " <$e>";
- * $receivers[] = array('id' => $id,
- * 'label' => $displayName,
- * 'value' => $displayName);
- * }
+ * // loop through all email addresses of this contact
+ * foreach ($email as $e) {
+ * $displayName = $fn . " <$e>";
+ * $receivers[] = array(
+ * 'id' => $id,
+ * 'label' => $displayName,
+ * 'value' => $displayName);
+ * }
* }
*
* return $receivers;
diff --git a/lib/request.php b/lib/request.php
index c975c84a711..99a77e1b59e 100755
--- a/lib/request.php
+++ b/lib/request.php
@@ -18,7 +18,7 @@ class OC_Request {
if(OC::$CLI) {
return 'localhost';
}
- if(OC_Config::getValue('overwritehost', '')<>''){
+ if(OC_Config::getValue('overwritehost', '')<>'') {
return OC_Config::getValue('overwritehost');
}
if (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) {
@@ -43,7 +43,7 @@ class OC_Request {
* Returns the server protocol. It respects reverse proxy servers and load balancers
*/
public static function serverProtocol() {
- if(OC_Config::getValue('overwriteprotocol', '')<>''){
+ if(OC_Config::getValue('overwriteprotocol', '')<>'') {
return OC_Config::getValue('overwriteprotocol');
}
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])) {
@@ -74,7 +74,7 @@ class OC_Request {
switch($encoding) {
case 'ISO-8859-1' :
- $path_info = utf8_encode($path_info);
+ $path_info = utf8_encode($path_info);
}
// end copy
diff --git a/lib/templatelayout.php b/lib/templatelayout.php
index 1a0570a270d..4173e008ba7 100644
--- a/lib/templatelayout.php
+++ b/lib/templatelayout.php
@@ -97,13 +97,13 @@ class OC_TemplateLayout extends OC_Template {
* @param $web base for path
* @param $file the filename
*/
- static public function appendIfExist(&$files, $root, $webroot, $file) {
- if (is_file($root.'/'.$file)) {
+ static public function appendIfExist(&$files, $root, $webroot, $file) {
+ if (is_file($root.'/'.$file)) {
$files[] = array($root, $webroot, $file);
return true;
- }
- return false;
- }
+ }
+ return false;
+ }
static public function findStylesheetFiles($styles) {
// Read the selected theme from the config file
@@ -130,8 +130,14 @@ class OC_TemplateLayout extends OC_Template {
// or in apps?
foreach( OC::$APPSROOTS as $apps_dir)
{
- if(self::appendIfExist($files, $apps_dir['path'], $apps_dir['url'], "$style$fext.css")) { $append =true; break; }
- elseif(self::appendIfExist($files, $apps_dir['path'], $apps_dir['url'], "$style.css")) { $append =true; break; }
+ if(self::appendIfExist($files, $apps_dir['path'], $apps_dir['url'], "$style$fext.css")) {
+ $append = true;
+ break;
+ }
+ elseif(self::appendIfExist($files, $apps_dir['path'], $apps_dir['url'], "$style.css")) {
+ $append = true;
+ break;
+ }
}
if(! $append) {
echo('css file not found: style:'.$style.' formfactor:'.$fext.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT);
@@ -192,8 +198,14 @@ class OC_TemplateLayout extends OC_Template {
// Is it part of an app?
$append = false;
foreach( OC::$APPSROOTS as $apps_dir) {
- if(self::appendIfExist($files, $apps_dir['path'], OC::$WEBROOT.$apps_dir['url'], "$script$fext.js")) { $append =true; break; }
- elseif(self::appendIfExist($files, $apps_dir['path'], OC::$WEBROOT.$apps_dir['url'], "$script.js")) { $append =true; break; }
+ if(self::appendIfExist($files, $apps_dir['path'], OC::$WEBROOT.$apps_dir['url'], "$script$fext.js")) {
+ $append = true;
+ break;
+ }
+ elseif(self::appendIfExist($files, $apps_dir['path'], OC::$WEBROOT.$apps_dir['url'], "$script.js")) {
+ $append = true;
+ break;
+ }
}
if(! $append) {
echo('js file not found: script:'.$script.' formfactor:'.$fext.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT);
diff --git a/lib/updater.php b/lib/updater.php
index 11081eded63..d44ac108380 100644
--- a/lib/updater.php
+++ b/lib/updater.php
@@ -52,18 +52,18 @@ class OC_Updater{
)
);
$xml=@file_get_contents($url, 0, $ctx);
- if($xml==false) {
- return array();
- }
- $data=@simplexml_load_string($xml);
+ if($xml==false) {
+ return array();
+ }
+ $data=@simplexml_load_string($xml);
$tmp=array();
- $tmp['version'] = $data->version;
- $tmp['versionstring'] = $data->versionstring;
- $tmp['url'] = $data->url;
- $tmp['web'] = $data->web;
+ $tmp['version'] = $data->version;
+ $tmp['versionstring'] = $data->versionstring;
+ $tmp['url'] = $data->url;
+ $tmp['web'] = $data->web;
- return $tmp;
+ return $tmp;
}
public static function ShowUpdatingHint() {
diff --git a/lib/util.php b/lib/util.php
index 34c4d4f9b11..fc50123b4fe 100755
--- a/lib/util.php
+++ b/lib/util.php
@@ -331,8 +331,7 @@ class OC_Util {
$parameters[$value] = true;
}
if (!empty($_POST['user'])) {
- $parameters["username"] =
- OC_Util::sanitizeHTML($_POST['user']).'"';
+ $parameters["username"] = OC_Util::sanitizeHTML($_POST['user']).'"';
$parameters['user_autofocus'] = false;
} else {
$parameters["username"] = '';
@@ -586,7 +585,7 @@ class OC_Util {
/**
* Check if the ownCloud server can connect to the internet
*/
- public static function isinternetconnectionworking() {
+ public static function isinternetconnectionworking() {
// try to connect to owncloud.org to see if http connections to the internet are possible.
$connected = @fsockopen("www.owncloud.org", 80);
@@ -685,34 +684,34 @@ class OC_Util {
* If not, file_get_element is used.
*/
- public static function getUrlContent($url){
+ public static function getUrlContent($url){
- if (function_exists('curl_init')) {
-
- $curl = curl_init();
-
- curl_setopt($curl, CURLOPT_HEADER, 0);
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10);
- curl_setopt($curl, CURLOPT_URL, $url);
- curl_setopt($curl, CURLOPT_USERAGENT, "ownCloud Server Crawler");
- $data = curl_exec($curl);
- curl_close($curl);
-
- } else {
-
- $ctx = stream_context_create(
- array(
- 'http' => array(
- 'timeout' => 10
- )
- )
- );
- $data=@file_get_contents($url, 0, $ctx);
-
- }
-
- return $data;
- }
+ if (function_exists('curl_init')) {
+
+ $curl = curl_init();
+
+ curl_setopt($curl, CURLOPT_HEADER, 0);
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
+ curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10);
+ curl_setopt($curl, CURLOPT_URL, $url);
+ curl_setopt($curl, CURLOPT_USERAGENT, "ownCloud Server Crawler");
+ $data = curl_exec($curl);
+ curl_close($curl);
+
+ } else {
+
+ $ctx = stream_context_create(
+ array(
+ 'http' => array(
+ 'timeout' => 10
+ )
+ )
+ );
+ $data=@file_get_contents($url, 0, $ctx);
+
+ }
+
+ return $data;
+ }
}