Beispiel #1
0
 public function showImage()
 {
     $data = $this->Gallery_Model->getByID(segment(3), TRUE);
     if (!$data) {
         redirect(_webBase . _sh . getXMLang(whichLanguage()) . _sh . _gallery);
     }
     if ($data["Album"] !== "None") {
         $this->count = $this->Gallery_Model->getCount($data["Album_Nice"]);
     } else {
         $this->count = $this->Gallery_Model->getCount();
     }
     //Código para comentarios:
     /*
     if(isset($_POST["publishComment"])) {
     	$this->Set("Comment");
     }
      
     if($this->Users_Model->isMember()) {
     	$vars["publish"] = TRUE;
     }
     
     if(isset($error) and is_array($error)) {
     	$vars["error"] = $error;
     }
     
     $comments = $this->Gallery_Model->getComments($this->record["ID"]);
     if($comments == FALSE) $vars["comments"] = FALSE;
     else $vars["comments"] = $comments;		
     */
     $vars["count"] = $this->count;
     $vars["picture"] = $data;
     if (_webGalleryComments === TRUE) {
         $vars["view"][0] = $this->view("image", $this->application, TRUE);
         $vars["view"][1] = $this->view("comments", $this->application, TRUE);
     } else {
         $vars["view"] = $this->view("image", $this->application, TRUE);
     }
     $this->template("content", $vars);
     $this->Render();
 }
Beispiel #2
0
 private function editOrSave($action)
 {
     if (!POST("title")) {
         return getAlert("You need to write a title");
     }
     if (!POST("category") and POST("ID_Category") === "0") {
         $this->category = 0;
     } else {
         if (POST("category")) {
             $this->category = POST("category");
             $categorynice = nice($this->category);
             $data = $this->Db->call("setCategory('{$this->category}', '{$categorynice}', '" . getXMLang(_webLang, TRUE) . "', 'Active')");
             $this->category = $data[0]["ID_Category"];
         } else {
             $this->category = POST("ID_Category");
         }
     }
     if ($action === "edit") {
         if (FILES("file", "name") !== "") {
             $this->Files = $this->core("Files");
             $this->Files->filename = FILES("file", "name");
             $this->Files->fileType = FILES("file", "type");
             $this->Files->fileSize = FILES("file", "size");
             $this->Files->fileError = FILES("file", "error");
             $this->Files->fileTmp = FILES("file", "tmp_name");
             if (!$this->category or $this->category === 0) {
                 $dir = "www/lib/files/images/gallery/unknown/";
             } else {
                 $data = $this->Db->find($this->category, $this->table);
                 $dir = "www/lib/files/images/gallery/" . $data[0]["Nice"] . "/";
             }
             if (!file_exists($dir)) {
                 mkdir($dir, 0777);
             }
             $upload = $this->Files->upload($dir);
             if ($upload["upload"]) {
                 $this->Images = $this->core("Images");
                 $this->original = $this->Images->getResize("original", $dir, $upload["filename"], _minOriginal, _maxOriginal);
                 $this->medium = $this->Images->getResize("medium", $dir, $upload["filename"], _minOriginal, _maxOriginal);
                 $this->small = $this->Images->getResize("small", $dir, $upload["filename"], _minOriginal, _maxOriginal);
             } else {
                 return getAlert($upload["message"]);
             }
         } else {
             if ($action === "edit") {
                 $this->original = "";
                 $this->medium = "";
                 $this->small = "";
             } else {
                 return getAlert("Selected Image");
             }
         }
     }
     $this->ID = POST("ID_Image");
     $this->title = POST("title", "decode", "escape");
     $this->nice = nice($this->title);
     $this->description = POST("description");
     $this->Situation = POST("Situation");
     $this->date1 = now(4);
     $this->date2 = now(2);
 }