public function processQuery() { try { $action = $_GET["action"]; $user = $_GET["user"]; $follow = $_GET["follow"]; /* on préviens le cas ou $_GET["action"] n'est pas spécifié ou pas définit, on lui donne par défaut la valeur "main" */ if (!isset($action) || $action == "") { $action = "frontpage"; } if (!in_array($action, $this->authKey)) { $action = "frontpage"; } switch ($action) { /* PAGE */ case 'frontpage': $controller = new ControllerUser(); $controller->displayUserHome($user); break; case 'followers': $controller = new ControllerUser(); $controller->displayUserFollowers($user); break; /* TRAITEMENT */ /* TRAITEMENT */ case 'uploadNewPicture': $controller = new ControllerUpload(); $controller->uploadPicture(); break; case 'uploadProfilePicture': $controller = new ControllerUpload(); $controller->uploadPicture("account_picture.jpg"); break; case 'uploadBannerPicture': $controller = new ControllerUpload(); $controller->uploadPicture("banner_picture.jpg"); break; case 'follow': $controller = new ControllerUser(); $controller->follow($follow); break; case 'deletePicture': $controller = new ControllerUser(); $controller->deletePicture($_POST["idPictureToDelete"]); break; } } catch (Exception $error) { $this->processError($error->getMessage()); } }
protected function action_upload($base = '') { $path = $this->buildPath($base); $ctrl = new ControllerUpload($this->db); $ctrl->addFilter('filebrowser-upload')->path('filebrowser-upload', $path, true)->action('main'); $this->result = $ctrl->result; }