diff --git a/apps/files/admin.php b/apps/files/admin.php index 76616bc4373..80fd4f4e4a5 100644 --- a/apps/files/admin.php +++ b/apps/files/admin.php @@ -49,7 +49,8 @@ if($_POST && OC_Util::isCallRegistered()) { OCP\Config::setSystemValue('allowZipDownload', isset($_POST['allowZipDownload'])); } } -$maxZipInputSize = OCP\Util::humanFileSize(OCP\Config::getSystemValue('maxZipInputSize', OCP\Util::computerFileSize('800 MB'))); +$maxZipInputSizeDefault = OCP\Util::computerFileSize('800 MB'); +$maxZipInputSize = OCP\Util::humanFileSize(OCP\Config::getSystemValue('maxZipInputSize', $maxZipInputSizeDefault)); $allowZipDownload = intval(OCP\Config::getSystemValue('allowZipDownload', true)); OCP\App::setActiveNavigationEntry( "files_administration" ); diff --git a/apps/files/ajax/upload.php b/apps/files/ajax/upload.php index c3d3199a003..e7823bc4ffb 100644 --- a/apps/files/ajax/upload.php +++ b/apps/files/ajax/upload.php @@ -10,22 +10,24 @@ OCP\JSON::checkLoggedIn(); OCP\JSON::callCheck(); if (!isset($_FILES['files'])) { - OCP\JSON::error(array("data" => array( "message" => "No file was uploaded. Unknown error" ))); + OCP\JSON::error(array('data' => array( 'message' => 'No file was uploaded. Unknown error' ))); exit(); } foreach ($_FILES['files']['error'] as $error) { if ($error != 0) { $l=OC_L10N::get('files'); $errors = array( - UPLOAD_ERR_OK=>$l->t("There is no error, the file uploaded with success"), - UPLOAD_ERR_INI_SIZE=>$l->t("The uploaded file exceeds the upload_max_filesize directive in php.ini").ini_get('upload_max_filesize'), - UPLOAD_ERR_FORM_SIZE=>$l->t("The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form"), - UPLOAD_ERR_PARTIAL=>$l->t("The uploaded file was only partially uploaded"), - UPLOAD_ERR_NO_FILE=>$l->t("No file was uploaded"), - UPLOAD_ERR_NO_TMP_DIR=>$l->t("Missing a temporary folder"), + UPLOAD_ERR_OK=>$l->t('There is no error, the file uploaded with success'), + UPLOAD_ERR_INI_SIZE=>$l->t('The uploaded file exceeds the upload_max_filesize directive in php.ini: ') + .ini_get('upload_max_filesize'), + UPLOAD_ERR_FORM_SIZE=>$l->t('The uploaded file exceeds the MAX_FILE_SIZE directive that was specified' + .' in the HTML form'), + UPLOAD_ERR_PARTIAL=>$l->t('The uploaded file was only partially uploaded'), + UPLOAD_ERR_NO_FILE=>$l->t('No file was uploaded'), + UPLOAD_ERR_NO_TMP_DIR=>$l->t('Missing a temporary folder'), UPLOAD_ERR_CANT_WRITE=>$l->t('Failed to write to disk'), ); - OCP\JSON::error(array("data" => array( "message" => $errors[$error] ))); + OCP\JSON::error(array('data' => array( 'message' => $errors[$error] ))); exit(); } } @@ -39,7 +41,7 @@ foreach($files['size'] as $size) { $totalSize+=$size; } if($totalSize>OC_Filesystem::free_space($dir)) { - OCP\JSON::error(array("data" => array( "message" => "Not enough space available" ))); + OCP\JSON::error(array('data' => array( 'message' => 'Not enough space available' ))); exit(); } @@ -47,13 +49,17 @@ $result=array(); if(strpos($dir, '..') === false) { $fileCount=count($files['name']); for($i=0;$i<$fileCount;$i++) { - $target = OCP\Files::buildNotExistingFileName(stripslashes($dir), $files['name'][$i]); + $target = OCP\Files::buildNotExistingFileName(stripslashes($dir), $files['name'][$i]); // $path needs to be normalized - this failed within drag'n'drop upload to a sub-folder $target = OC_Filesystem::normalizePath($target); if(is_uploaded_file($files['tmp_name'][$i]) and OC_Filesystem::fromTmpFile($files['tmp_name'][$i], $target)) { $meta = OC_FileCache::get($target); $id = OC_FileCache::getId($target); - $result[]=array( "status" => "success", 'mime'=>$meta['mimetype'], 'size'=>$meta['size'], 'id'=>$id, 'name'=>basename($target)); + $result[]=array( 'status' => 'success', + 'mime'=>$meta['mimetype'], + 'size'=>$meta['size'], + 'id'=>$id, + 'name'=>basename($target)); } } OCP\JSON::encodedPrint($result); @@ -62,4 +68,4 @@ if(strpos($dir, '..') === false) { $error='invalid dir'; } -OCP\JSON::error(array('data' => array('error' => $error, "file" => $fileName))); +OCP\JSON::error(array('data' => array('error' => $error, 'file' => $fileName))); diff --git a/apps/files/appinfo/app.php b/apps/files/appinfo/app.php index b431ddfec02..108f02930e2 100644 --- a/apps/files/appinfo/app.php +++ b/apps/files/appinfo/app.php @@ -3,6 +3,10 @@ $l=OC_L10N::get('files'); OCP\App::registerAdmin('files', 'admin'); -OCP\App::addNavigationEntry( array( "id" => "files_index", "order" => 0, "href" => OCP\Util::linkTo( "files", "index.php" ), "icon" => OCP\Util::imagePath( "core", "places/home.svg" ), "name" => $l->t("Files") )); +OCP\App::addNavigationEntry( array( "id" => "files_index", + "order" => 0, + "href" => OCP\Util::linkTo( "files", "index.php" ), + "icon" => OCP\Util::imagePath( "core", "places/home.svg" ), + "name" => $l->t("Files") )); OC_Search::registerProvider('OC_Search_Provider_File'); diff --git a/apps/files/appinfo/filesync.php b/apps/files/appinfo/filesync.php index 0e368cb0f42..cbed56a6de5 100644 --- a/apps/files/appinfo/filesync.php +++ b/apps/files/appinfo/filesync.php @@ -24,16 +24,16 @@ $RUNTIME_APPTYPES=array('filesystem', 'authentication', 'logging'); OC_App::loadApps($RUNTIME_APPTYPES); if(!OC_User::isLoggedIn()) { - if(!isset($_SERVER['PHP_AUTH_USER'])) { - header('WWW-Authenticate: Basic realm="ownCloud Server"'); - header('HTTP/1.0 401 Unauthorized'); - echo 'Valid credentials must be supplied'; - exit(); - } else { - if(!OC_User::login($_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"])) { - exit(); - } - } + if(!isset($_SERVER['PHP_AUTH_USER'])) { + header('WWW-Authenticate: Basic realm="ownCloud Server"'); + header('HTTP/1.0 401 Unauthorized'); + echo 'Valid credentials must be supplied'; + exit(); + } else { + if(!OC_User::login($_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"])) { + exit(); + } + } } list($type, $file) = explode('/', substr($path_info, 1+strlen($service)+1), 2); diff --git a/apps/files/appinfo/routes.php b/apps/files/appinfo/routes.php index e1ab560803d..043782a9c04 100644 --- a/apps/files/appinfo/routes.php +++ b/apps/files/appinfo/routes.php @@ -8,5 +8,4 @@ $this->create('download', 'download{file}') ->requirements(array('file' => '.*')) - ->actionInclude('files/download.php'); - + ->actionInclude('files/download.php'); \ No newline at end of file diff --git a/apps/files/appinfo/update.php b/apps/files/appinfo/update.php index 29782ec643e..3503678e7c7 100644 --- a/apps/files/appinfo/update.php +++ b/apps/files/appinfo/update.php @@ -3,12 +3,15 @@ // fix webdav properties,add namespace in front of the property, update for OC4.5 $installedVersion=OCP\Config::getAppValue('files', 'installed_version'); if (version_compare($installedVersion, '1.1.6', '<')) { - $query = OC_DB::prepare( "SELECT `propertyname`, `propertypath`, `userid` FROM `*PREFIX*properties`" ); + $query = OC_DB::prepare( 'SELECT `propertyname`, `propertypath`, `userid` FROM `*PREFIX*properties`' ); $result = $query->execute(); - $updateQuery = OC_DB::prepare('UPDATE `*PREFIX*properties` SET `propertyname` = ? WHERE `userid` = ? AND `propertypath` = ?'); + $updateQuery = OC_DB::prepare('UPDATE `*PREFIX*properties`' + .' SET `propertyname` = ?' + .' WHERE `userid` = ?' + .' AND `propertypath` = ?'); while( $row = $result->fetchRow()) { - if ( $row["propertyname"][0] != '{' ) { - $updateQuery->execute(array('{DAV:}' + $row["propertyname"], $row["userid"], $row["propertypath"])); + if ( $row['propertyname'][0] != '{' ) { + $updateQuery->execute(array('{DAV:}' + $row['propertyname'], $row['userid'], $row['propertypath'])); } } } @@ -36,10 +39,11 @@ foreach($filesToRemove as $file) { if(!file_exists($filepath)) { continue; } - $success = OCP\Files::rmdirr($filepath); - if($success === false) { + $success = OCP\Files::rmdirr($filepath); + if($success === false) { //probably not sufficient privileges, give up and give a message. - OCP\Util::writeLog('files', 'Could not clean /files/ directory. Please remove everything except webdav.php from ' . OC::$SERVERROOT . '/files/', OCP\Util::ERROR); + OCP\Util::writeLog('files', 'Could not clean /files/ directory.' + .' Please remove everything except webdav.php from ' . OC::$SERVERROOT . '/files/', OCP\Util::ERROR); break; - } + } } diff --git a/apps/files/templates/admin.php b/apps/files/templates/admin.php index a60a1cebaf9..66fec4cd536 100644 --- a/apps/files/templates/admin.php +++ b/apps/files/templates/admin.php @@ -4,14 +4,22 @@
- + \ No newline at end of file diff --git a/apps/files/templates/index.php b/apps/files/templates/index.php index 725390d4505..de440a6f79c 100644 --- a/apps/files/templates/index.php +++ b/apps/files/templates/index.php @@ -6,27 +6,42 @@t('Text file');?>
t('Folder');?>
t('From link');?>
t('Text file');?>
t('Folder');?>
t('From link');?>
- t('The files you are trying to upload exceed the maximum size for file uploads on this server.');?> + t('The files you are trying to upload exceed the maximum size for file uploads on this server.');?>