aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Mueller <thomas.mueller@tmit.eu>2012-08-29 00:50:12 +0200
committerThomas Mueller <thomas.mueller@tmit.eu>2012-08-29 00:50:12 +0200
commitfe49cbafc77f8a197dfe5c947360d9e52396d081 (patch)
tree4a2a1c027c809f0ae29d638231127a1003344959
parentf301bfd8c9f6b9beda907888708b0d465dc87a83 (diff)
downloadnextcloud-server-fe49cbafc77f8a197dfe5c947360d9e52396d081.tar.gz
nextcloud-server-fe49cbafc77f8a197dfe5c947360d9e52396d081.zip
apply coding style
-rw-r--r--apps/files/ajax/delete.php2
-rw-r--r--apps/files/ajax/list.php4
-rw-r--r--apps/files/ajax/move.php4
-rw-r--r--apps/files/ajax/newfile.php36
-rw-r--r--apps/files/ajax/newfolder.php2
-rw-r--r--apps/files/ajax/rawlist.php6
-rw-r--r--apps/files/ajax/scan.php27
-rw-r--r--apps/files/ajax/upload.php8
8 files changed, 45 insertions, 44 deletions
diff --git a/apps/files/ajax/delete.php b/apps/files/ajax/delete.php
index 695f803884e..e9bcea18932 100644
--- a/apps/files/ajax/delete.php
+++ b/apps/files/ajax/delete.php
@@ -15,7 +15,7 @@ $filesWithError = '';
$success = true;
//Now delete
foreach($files as $file) {
- if( !OC_Files::delete( $dir, $file )){
+ if( !OC_Files::delete( $dir, $file )) {
$filesWithError .= $file . "\n";
$success = false;
}
diff --git a/apps/files/ajax/list.php b/apps/files/ajax/list.php
index dae0c1a828d..94ddf0364be 100644
--- a/apps/files/ajax/list.php
+++ b/apps/files/ajax/list.php
@@ -14,11 +14,11 @@ $doBreadcrumb = isset( $_GET['breadcrumb'] ) ? true : false;
$data = array();
// Make breadcrumb
-if($doBreadcrumb){
+if($doBreadcrumb) {
$breadcrumb = array();
$pathtohere = "/";
foreach( explode( "/", $dir ) as $i ){
- if( $i != "" ){
+ if( $i != "" ) {
$pathtohere .= "$i/";
$breadcrumb[] = array( "dir" => $pathtohere, "name" => $i );
}
diff --git a/apps/files/ajax/move.php b/apps/files/ajax/move.php
index 3d4003a8edc..8b3149ef14e 100644
--- a/apps/files/ajax/move.php
+++ b/apps/files/ajax/move.php
@@ -12,8 +12,8 @@ $file = stripslashes($_GET["file"]);
$target = stripslashes($_GET["target"]);
-if(OC_Files::move($dir,$file,$target,$file)){
+if(OC_Files::move($dir, $file, $target, $file)) {
OCP\JSON::success(array("data" => array( "dir" => $dir, "files" => $file )));
-}else{
+} else {
OCP\JSON::error(array("data" => array( "message" => "Could not move $file" )));
}
diff --git a/apps/files/ajax/newfile.php b/apps/files/ajax/newfile.php
index cc9208ad08f..b572a766dac 100644
--- a/apps/files/ajax/newfile.php
+++ b/apps/files/ajax/newfile.php
@@ -3,7 +3,7 @@
// Init owncloud
global $eventSource;
-if(!OC_User::isLoggedIn()){
+if(!OC_User::isLoggedIn()) {
exit;
}
@@ -15,9 +15,9 @@ $filename = isset( $_REQUEST['filename'] ) ? stripslashes($_REQUEST['filename'])
$content = isset( $_REQUEST['content'] ) ? $_REQUEST['content'] : '';
$source = isset( $_REQUEST['source'] ) ? stripslashes($_REQUEST['source']) : '';
-if($source){
+if($source) {
$eventSource=new OC_EventSource();
-}else{
+} else {
OC_JSON::callCheck();
}
@@ -25,12 +25,12 @@ if($filename == '') {
OCP\JSON::error(array("data" => array( "message" => "Empty Filename" )));
exit();
}
-if(strpos($filename,'/')!==false){
+if(strpos($filename,'/')!==false) {
OCP\JSON::error(array("data" => array( "message" => "Invalid Filename" )));
exit();
}
-function progress($notification_code, $severity, $message, $message_code, $bytes_transferred, $bytes_max){
+function progress($notification_code, $severity, $message, $message_code, $bytes_transferred, $bytes_max) {
static $filesize = 0;
static $lastsize = 0;
global $eventSource;
@@ -45,8 +45,8 @@ function progress($notification_code, $severity, $message, $message_code, $bytes
if (!isset($filesize)) {
} else {
$progress = (int)(($bytes_transferred/$filesize)*100);
- if($progress>$lastsize){//limit the number or messages send
- $eventSource->send('progress',$progress);
+ if($progress>$lastsize) {//limit the number or messages send
+ $eventSource->send('progress', $progress);
}
$lastsize=$progress;
}
@@ -56,30 +56,30 @@ function progress($notification_code, $severity, $message, $message_code, $bytes
}
if($source){
- if(substr($source,0,8)!='https://' and substr($source,0,7)!='http://'){
+ if(substr($source, 0, 8)!='https://' and substr($source, 0, 7)!='http://') {
OCP\JSON::error(array("data" => array( "message" => "Not a valid source" )));
exit();
}
$ctx = stream_context_create(null, array('notification' =>'progress'));
- $sourceStream=fopen($source,'rb', false, $ctx);
+ $sourceStream=fopen($source, 'rb', false, $ctx);
$target=$dir.'/'.$filename;
- $result=OC_Filesystem::file_put_contents($target,$sourceStream);
- if($result){
+ $result=OC_Filesystem::file_put_contents($target, $sourceStream);
+ if($result) {
$mime=OC_Filesystem::getMimetype($target);
- $eventSource->send('success',$mime);
- }else{
- $eventSource->send('error',"Error while downloading ".$source. ' to '.$target);
+ $eventSource->send('success', $mime);
+ } else {
+ $eventSource->send('error', "Error while downloading ".$source. ' to '.$target);
}
$eventSource->close();
exit();
-}else{
- if($content){
- if(OC_Filesystem::file_put_contents($dir.'/'.$filename,$content)){
+} else {
+ if($content) {
+ if(OC_Filesystem::file_put_contents($dir.'/'.$filename, $content)) {
OCP\JSON::success(array("data" => array('content'=>$content)));
exit();
}
- }elseif(OC_Files::newFile($dir, $filename, 'file')){
+ }elseif(OC_Files::newFile($dir, $filename, 'file')) {
OCP\JSON::success(array("data" => array('content'=>$content)));
exit();
}
diff --git a/apps/files/ajax/newfolder.php b/apps/files/ajax/newfolder.php
index ae92bcf09bb..34c2d0ca145 100644
--- a/apps/files/ajax/newfolder.php
+++ b/apps/files/ajax/newfolder.php
@@ -14,7 +14,7 @@ if(trim($foldername) == '') {
OCP\JSON::error(array("data" => array( "message" => "Empty Foldername" )));
exit();
}
-if(strpos($foldername,'/')!==false){
+if(strpos($foldername, '/')!==false) {
OCP\JSON::error(array("data" => array( "message" => "Invalid Foldername" )));
exit();
}
diff --git a/apps/files/ajax/rawlist.php b/apps/files/ajax/rawlist.php
index d159f6e152f..20094563b17 100644
--- a/apps/files/ajax/rawlist.php
+++ b/apps/files/ajax/rawlist.php
@@ -5,7 +5,7 @@ $RUNTIME_APPTYPES=array('filesystem');
// Init owncloud
-require_once('lib/template.php');
+require_once 'lib/template.php';
OCP\JSON::checkLoggedIn();
@@ -15,9 +15,9 @@ $mimetype = isset($_GET['mimetype']) ? $_GET['mimetype'] : '';
// make filelist
$files = array();
-foreach( OC_Files::getdirectorycontent( $dir, $mimetype ) as $i ){
+foreach( OC_Files::getdirectorycontent( $dir, $mimetype ) as $i ) {
$i["date"] = OCP\Util::formatDate($i["mtime"] );
- $i['mimetype_icon'] = $i['type'] == 'dir' ? \mimetype_icon('dir'): \mimetype_icon($i['mimetype']);
+ $i['mimetype_icon'] = $i['type'] == 'dir' ? \mimetype_icon('dir'): \mimetype_icon($i['mimetype']);
$files[] = $i;
}
diff --git a/apps/files/ajax/scan.php b/apps/files/ajax/scan.php
index eef38858516..e38484b97dd 100644
--- a/apps/files/ajax/scan.php
+++ b/apps/files/ajax/scan.php
@@ -6,38 +6,39 @@ $force=isset($_GET['force']) and $_GET['force']=='true';
$dir=isset($_GET['dir'])?$_GET['dir']:'';
$checkOnly=isset($_GET['checkonly']) and $_GET['checkonly']=='true';
-if(!$checkOnly){
+if(!$checkOnly) {
$eventSource=new OC_EventSource();
}
session_write_close();
//create the file cache if necesary
-if($force or !OC_FileCache::inCache('')){
- if(!$checkOnly){
+if($force or !OC_FileCache::inCache('')) {
+ if(!$checkOnly) {
OCP\DB::beginTransaction();
- if(OC_Cache::isFast()){
- OC_Cache::clear('fileid/'); //make sure the old fileid's don't mess things up
+ if(OC_Cache::isFast()) {
+ //make sure the old fileid's don't mess things up
+ OC_Cache::clear('fileid/');
}
- OC_FileCache::scan($dir,$eventSource);
+ OC_FileCache::scan($dir, $eventSource);
OC_FileCache::clean();
OCP\DB::commit();
- $eventSource->send('success',true);
- }else{
+ $eventSource->send('success', true);
+ } else {
OCP\JSON::success(array('data'=>array('done'=>true)));
exit;
}
-}else{
- if($checkOnly){
+} else {
+ if($checkOnly) {
OCP\JSON::success(array('data'=>array('done'=>false)));
exit;
}
- if(isset($eventSource)){
+ if(isset($eventSource)) {
$eventSource->send('success',false);
- }else{
+ } else {
exit;
}
}
-$eventSource->close(); \ No newline at end of file
+$eventSource->close();
diff --git a/apps/files/ajax/upload.php b/apps/files/ajax/upload.php
index 74e6eb560d8..813a6c67b5c 100644
--- a/apps/files/ajax/upload.php
+++ b/apps/files/ajax/upload.php
@@ -38,24 +38,24 @@ $totalSize=0;
foreach($files['size'] as $size){
$totalSize+=$size;
}
-if($totalSize>OC_Filesystem::free_space('/')){
+if($totalSize>OC_Filesystem::free_space('/')) {
OCP\JSON::error(array("data" => array( "message" => "Not enough space available" )));
exit();
}
$result=array();
-if(strpos($dir,'..') === false){
+if(strpos($dir, '..') === false) {
$fileCount=count($files['name']);
for($i=0;$i<$fileCount;$i++){
$target = OCP\Files::buildNotExistingFileName(stripslashes($dir), $files['name'][$i]);
- if(is_uploaded_file($files['tmp_name'][$i]) and OC_Filesystem::fromTmpFile($files['tmp_name'][$i],$target)){
+ if(is_uploaded_file($files['tmp_name'][$i]) and OC_Filesystem::fromTmpFile($files['tmp_name'][$i], $target)) {
$meta=OC_FileCache_Cached::get($target);
$result[]=array( "status" => "success", 'mime'=>$meta['mimetype'],'size'=>$meta['size'],'name'=>basename($target));
}
}
OCP\JSON::encodedPrint($result);
exit();
-}else{
+} else {
$error='invalid dir';
}