function getLog()
{
    global $console;
    $result = "";
    $log = getDebugLog();
    foreach ($log as $i => $line) {
        if ($console) {
            $result .= "  .- " . $line . "\n";
        } else {
            $result .= "<p>" . $line . "</p>";
        }
    }
    return $result;
}
 public function processAction($action)
 {
     $this->result = array();
     $this->result["debug"] = array();
     if ($action == "ready") {
         $this->actionCheckReady();
     } else {
         //nothing
         $this->result["status"] = 0;
         $this->result["msg"] = 'no action performed';
     }
     $this->result["debug"] = getDebugLog();
     //the response is encoded in JSON on AJAX calls
     print json_encode($this->result);
 }
 public function processAction($action)
 {
     header('Content-Type: application/json');
     $this->result = array();
     $this->result["debug"] = array();
     switch ($action) {
         case "createUnit":
             $this->actionCreateUnit();
             break;
             //create a new unit
         //create a new unit
         case "getUnits":
             $this->actionGetUnits();
             break;
             //get files inside one folder
         //get files inside one folder
         case "inviteUserToUnit":
             $this->actionInviteUserToUnit();
             break;
             //create a new unit
         //create a new unit
         case "removeUserFromUnit":
             $this->actionRemoveUserFromUnit();
             break;
             //create a new unit
         //create a new unit
         case "getUnitInfo":
             $this->actionGetUnitInfo();
             break;
             //get info about all the users in a unit
         //get info about all the users in a unit
         case "setUnitInfo":
             $this->actionSetUnitInfo();
             break;
             //get info about all the users in a unit
         //get info about all the users in a unit
         case "deleteUnit":
             $this->actionDeleteUnit();
             break;
             //create a new unit
         //create a new unit
         case "getFolders":
             $this->actionGetFolders();
             break;
             //get folders tree
         //get folders tree
         case "createFolder":
             $this->actionCreateFolder();
             break;
             //create a folder
         //create a folder
         case "deleteFolder":
             $this->actionDeleteFolder();
             break;
             //create a new unit
         //create a new unit
         case "moveFolder":
             $this->actionMoveFolder();
             break;
             //move folder
         //move folder
         case "getFilesInFolder":
             $this->actionGetFilesInFolder();
             break;
             //get files inside one folder
         //get files inside one folder
         case "getFilesTree":
             $this->actionGetFilesTree();
             break;
             //get all files info
         //get all files info
         case "searchFiles":
             $this->actionSearchFiles();
             break;
             //get files matching a search
         //get files matching a search
         case "getFileInfo":
             $this->actionGetFileInfo();
             break;
             //get metainfo about one file
         //get metainfo about one file
         case "uploadFile":
             $this->actionUploadFile();
             break;
             //upload a file
         //upload a file
         case "uploadRemoteFile":
             $this->actionUploadRemoteFile();
             break;
             //upload a file from URL
         //upload a file from URL
         case "deleteFile":
             $this->actionDeleteFile();
             break;
             //delete a file (by id)
         //delete a file (by id)
         case "moveFile":
             $this->actionMoveFile();
             break;
             //change a file (also rename)
         //change a file (also rename)
         case "updateFile":
             $this->actionUpdateFile();
             break;
             //replace a file content
         //replace a file content
         case "updateFilePart":
             $this->actionUpdateFilePart();
             break;
             //replace a file content
         //replace a file content
         case "updateFilePreview":
             $this->actionUpdateFilePreview();
             break;
             //update file preview image
         //update file preview image
         case "updateFileInfo":
             $this->actionUpdateFileInfo();
             break;
             //update file meta info
         //update file meta info
         default:
             //nothing
             $this->result["status"] = 0;
             $this->result["msg"] = 'action unknown: ' . $action;
     }
     $this->result["debug"] = getDebugLog();
     //the response is encoded in JSON on AJAX calls
     print json_encode($this->result);
 }
Beispiel #4
0
 public function processAction($action)
 {
     $this->result = array();
     $this->result["debug"] = array();
     if ($action == "login") {
         $this->actionLogin();
     } else {
         if ($action == "logout") {
             $this->actionLogout();
         } else {
             if ($action == "checkToken") {
                 $this->actionCheckToken();
             } else {
                 if ($action == "forgotPassword") {
                     $this->actionForgotPassword();
                 } else {
                     if ($action == "resetPassword") {
                         $this->actionResetPassword();
                     } else {
                         if ($action == "setPassword") {
                             $this->actionChangePassword();
                         } else {
                             if ($action == "create") {
                                 $this->actionCreateUser();
                             } else {
                                 if ($action == "delete") {
                                     $this->actionDeleteUser();
                                 } else {
                                     if ($action == "addRole") {
                                         $this->actionAddRole();
                                     } else {
                                         if ($action == "getInfo") {
                                             $this->actionGetUserInfo();
                                         } else {
                                             if ($action == "exist") {
                                                 $this->actionIsUser();
                                             } else {
                                                 if ($action == "setSpace") {
                                                     $this->actionSetUserSpace();
                                                 } else {
                                                     //nothing
                                                     $this->result["status"] = 0;
                                                     $this->result["msg"] = 'no action performed';
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     $this->result["debug"] = getDebugLog();
     //the response is encoded in JSON on AJAX calls
     print json_encode($this->result);
 }