]> source.dussan.org Git - nextcloud-server.git/commitdiff
apply coding style
authorThomas Mueller <thomas.mueller@tmit.eu>
Tue, 28 Aug 2012 22:50:12 +0000 (00:50 +0200)
committerThomas Mueller <thomas.mueller@tmit.eu>
Tue, 28 Aug 2012 22:50:12 +0000 (00:50 +0200)
apps/files/ajax/delete.php
apps/files/ajax/list.php
apps/files/ajax/move.php
apps/files/ajax/newfile.php
apps/files/ajax/newfolder.php
apps/files/ajax/rawlist.php
apps/files/ajax/scan.php
apps/files/ajax/upload.php

index 695f803884eccee8d5bd5942702e92aa933c1541..e9bcea18932aaebfe1cb70d5ddb07e2bad92d288 100644 (file)
@@ -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;
        }
index dae0c1a828dd8bacec93180133e46d19c866f6f7..94ddf0364be0dda6f669dc8c00e69a96d7d731fd 100644 (file)
@@ -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 );
                }
index 3d4003a8edc456e211d67b1dcb0dbbe27784c4b2..8b3149ef14e35106294be23c8a8c481266b0d067 100644 (file)
@@ -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" )));
 }
index cc9208ad08fcd439a574c5922421917e4cedcd47..b572a766dac62794b0f930c3a26e957fb5deda9a 100644 (file)
@@ -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();
        }
index ae92bcf09bb8f5f018a496593f361834ecc5a05b..34c2d0ca145a9d57cd855fc53087d2ce9bfd6e7b 100644 (file)
@@ -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();
 }
index d159f6e152f2bc3eddd12ca9ccb93c688adb2f21..20094563b173f9d103b19a18aad3b7f50ac0e756 100644 (file)
@@ -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;
 }
 
index eef38858516b7e7bb2d27751ed487b717c6f76a7..e38484b97dd475ee974e2c5b8249e3c5ef95df61 100644 (file)
@@ -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();
index 74e6eb560d8df0af438511cc279079262ab1842f..813a6c67b5c740d046768bf6b6947dddb1ffde8a 100644 (file)
@@ -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';
 }