コード例 #1
0
 private function processTweetURLs($tweet, $lurl, $fa)
 {
     $ld = new LinkDAO($this->db, $this->logger);
     $urls = Tweet::extractURLs($tweet['tweet_text']);
     foreach ($urls as $u) {
         //if it's an image (Twitpic/Twitgoo/Yfrog/Flickr for now), insert direct path to thumb as expanded url, otherwise, just expand
         //set defaults
         $is_image = 0;
         $title = '';
         $eurl = '';
         if (substr($u, 0, strlen('http://twitpic.com/')) == 'http://twitpic.com/') {
             $eurl = 'http://twitpic.com/show/thumb/' . substr($u, strlen('http://twitpic.com/'));
             $is_image = 1;
         } elseif (substr($u, 0, strlen('http://yfrog.com/')) == 'http://yfrog.com/') {
             $eurl = $u . '.th.jpg';
             $is_image = 1;
         } elseif (substr($u, 0, strlen('http://twitgoo.com/')) == 'http://twitgoo.com/') {
             $eurl = 'http://twitgoo.com/show/thumb/' . substr($u, strlen('http://twitgoo.com/'));
             $is_image = 1;
         } elseif ($fa->api_key != null && substr($u, 0, strlen('http://flic.kr/p/')) == 'http://flic.kr/p/') {
             $eurl = $fa->getFlickrPhotoSource($u);
             if ($eurl != '') {
                 $is_image = 1;
             }
         } else {
             $eurl_arr = $lurl->expandUrl($u);
             if (isset($eurl_arr['response-code']) && $eurl_arr['response-code'] == 200) {
                 $eurl = $eurl_arr['long-url'];
                 if (isset($eurl_arr['title'])) {
                     $title = $eurl_arr['title'];
                 }
             }
         }
         if ($ld->insert($u, $eurl, $title, $tweet['status_id'], $is_image)) {
             $this->logger->logStatus("Inserted " . $u . " (" . $eurl . ") into links table", get_class($this));
         } else {
             $this->logger->logStatus("Did NOT insert " . $u . " (" . $eurl . ") into links table", get_class($this));
         }
     }
 }
コード例 #2
0
ファイル: FacilFile.php プロジェクト: reytuty/facil
 public function insert()
 {
     //inicia um retorno de ReturnResultVO
     $ReturnResultVO = new ReturnResultVO();
     //pega os dados baseado na infoPost
     $VO = new FileVO();
     if ($this->infoPost->file_info_id) {
         $VO->setId($this->infoPost->file_info_id, TRUE);
     }
     $VO->setActive($this->infoPost->file_info_active);
     $VO->setName($this->infoPost->file_info_name);
     $VO->setDescription($this->infoPost->file_info_description);
     $VO->setType($this->infoPost->file_info_type);
     $VO->setAuthor($this->infoPost->file_info_author);
     $VO->setLocale($this->infoPost->file_info_locale);
     $VO->setOrder($this->infoPost->file_info_order);
     //("JÁ") gera id para criar pasta onde vai ser guardado o arquivo
     $ReturnResultFileVO = $VO->commit();
     if ($ReturnResultFileVO->success) {
         $ReturnResultFileVO->result = $VO->getId();
     } else {
         //erro, os motivos estão na ReturnResultVO abaixo
         return $ReturnResultFileVO;
     }
     //pega o id da file
     $FILE_ID = $VO->getId();
     $ReturnResultFileVO = new ReturnResultVO();
     if (isset($this->infoPost->file_data) && !$this->infoPost->file_info_id > 0) {
         set_time_limit(0);
         $sentFileData = $this->infoPost->file_data;
         //$_FILES['Filedata'];
         $name = $sentFileData['name'];
         // extens�o enviada
         $sentExtension = DataHandler::returnExtensionOfFile($name);
         // remove caracteres escrotos
         $name = DataHandler::returnFilenameWithoutExtension($name);
         $name = DataHandler::removeAccent($name);
         $name = DataHandler::removeSpecialCharacters($name);
         $name = trim(substr($name, 0, 80));
         switch ($sentFileData["type"]) {
             case "text/plain":
                 $extension = "txt";
                 break;
             default:
                 $extension = strtolower($sentExtension);
                 break;
         }
         //verifica se a pasta existe, se não existir, inventa
         DataHandler::createFolderIfNotExist($this->defaultFolderForNewFiles);
         // pasta de upload de files está no config.php
         $tempFolder = DataHandler::removeDobleBars($this->defaultFolderForNewFiles . "/" . $FILE_ID);
         DataHandler::createFolderIfNotExist($tempFolder);
         $tempUrl = $tempFolder . "/" . strtolower($name . "." . $extension);
         $i = 2;
         while (file_exists($tempUrl)) {
             $tempUrl = $tempFolder . "/" . strtolower($name . "-" . $i . "." . $extension);
             $i++;
         }
         $VO->setUrl($tempUrl);
         $ReturnResultFileVO = $VO->commit();
         //Debug::li("aaa");
         if ($ReturnResultFileVO->success) {
             //incluir o vinculo com a linked_table e linked_table_id
             //receber 	table
             //			table_id
             if ($this->infoPost->table) {
                 $table = $this->infoPost->table;
                 $table_id = $this->infoPost->table_id;
                 include_once "library/facil3/core/dao/LinkDAO.class.php";
                 $LinkDAO = new LinkDAO();
                 //vincula a foto ao table e table_id enviado
                 $ReturnResultVinculoVO = $LinkDAO->insert($table, $table_id, $this->moduleName, $VO->getId(), 1);
                 if (!$ReturnResultVinculoVO->success) {
                     //deu erro ao vincular
                     $ReturnResultVO->success = false;
                     $ReturnResultVO->appendMessage($ReturnResultVinculoVO->array_messages);
                     return $ReturnResultVO;
                 }
             } else {
                 $ReturnResultVO->addMessage(Translation::text("LibraryLanguage::WARNING_FILE_NO_LINKED_TABLE"));
             }
             //movendo o arquivo para sua respectiva pasta.
             $localFile = $VO->getUrl();
             if (!move_uploaded_file($sentFileData['tmp_name'], $localFile)) {
                 $ReturnResultVO->success = false;
                 $ReturnResultVO->addMessage(Translation::text("Arquivo não encontrado"));
                 return $ReturnResultVO;
             } else {
                 $ReturnResultVO->success = TRUE;
                 $ReturnResultVO->result = $VO->getId();
                 $ReturnResultVO->addMessage(Translation::text("Arquivo gravado"));
             }
         } else {
             return $ReturnResultFileVO;
         }
         return $ReturnResultVO;
     } else {
         $ReturnResultFileVO = new ReturnResultVO();
         $ReturnResultFileVO->addMessage("Envie o Filedata");
         // nao veio filedata
         return $ReturnResultFileVO;
     }
 }
コード例 #3
0
ファイル: FacilHighlights.php プロジェクト: reytuty/facil
 public function insertHighlights()
 {
     //inicia um retorno de ReturnResultVO
     $ReturnResultVO = new ReturnResultVO();
     //pega os dados baseado na HighlightsInfoPostVO
     $VO = new HighLightsVO();
     //popula no objeto
     $VO->setId($this->HighlightsInfoPostVO->id);
     $VO->setActive($this->HighlightsInfoPostVO->active);
     $VO->setName($this->HighlightsInfoPostVO->name);
     $VO->setLink($this->HighlightsInfoPostVO->link, $locale);
     $VO->setContent($this->HighlightsInfoPostVO->content, $locale);
     $VO->setImageUrl($this->HighlightsInfoPostVO->image_url, $locale);
     $VO->setDate($this->HighlightsInfoPostVO->date);
     $VO->setDateIn($this->HighlightsInfoPostVO->date_in);
     $VO->setDateOut($this->HighlightsInfoPostVO->date_out);
     $VO->setOrder($this->HighlightsInfoPostVO->order);
     //("Ja") gera id para criar pasta onde vai ser guardado o arquivo
     $ReturnResultHighLightsVO = $VO->commit();
     if ($ReturnResultHighLightsVO->success) {
         $ReturnResultHighLightsVO->result = $VO->getId();
     } else {
         //erro, os motivos estão na ReturnResultVO abaixo
         return $ReturnResultHighLightsVO;
     }
     if ($ReturnResultHighLightsVO->success) {
         //incluir o vinculo com a linked_table e linked_table_id
         //receber 	table
         //			table_id
         if ($this->HighlightsInfoPostVO->request_table != NULL && $this->HighlightsInfoPostVO->request_table_id > 0) {
             $table = $this->HighlightsInfoPostVO->request_table;
             $table_id = $this->HighlightsInfoPostVO->request_table_id;
             include_once "library/facil3/core/dao/LinkDAO.class.php";
             $LinkDAO = new LinkDAO();
             //vincula a foto ao table e table_id enviado
             $ReturnResultVinculoVO = $LinkDAO->insert($table, $table_id, $this->moduleName, $VO->getId(), 1);
             if (!$ReturnResultVinculoVO->success) {
                 //deu erro ao vincular
                 $ReturnResultVO->success = false;
                 $ReturnResultVO->appendMessage($ReturnResultVinculoVO->array_messages);
                 return $ReturnResultVO;
             }
         } else {
             return $ReturnResultVO->addMessage(Translation::text("LibraryLanguage::WARNING_HIGHLIGHTS_NO_LINKED_TABLE"));
         }
     } else {
         return $ReturnResultHighLightsVO;
     }
 }
コード例 #4
0
ファイル: FacilContent.php プロジェクト: reytuty/facil
 public function insert()
 {
     //inicia um retorno de ReturnResultVO
     $ReturnResultVO = new ReturnResultVO();
     //pega os dados baseado na ContentInfoPostVO
     $VO = new ContentVO();
     //popula no objeto
     if ($this->ContentInfoPostVO->id) {
         $VO->setId($this->ContentInfoPostVO->id, TRUE);
     }
     $VO->setActive($this->ContentInfoPostVO->active);
     $VO->setName($this->ContentInfoPostVO->name);
     $VO->setTitle($this->ContentInfoPostVO->title, $this->ContentInfoPostVO->request_locale);
     $VO->setHat($this->ContentInfoPostVO->hat, $this->ContentInfoPostVO->request_locale);
     $VO->setDescription($this->ContentInfoPostVO->description, $this->ContentInfoPostVO->request_locale);
     $VO->setContent($this->ContentInfoPostVO->content, $this->ContentInfoPostVO->request_locale);
     $VO->setAuthor($this->ContentInfoPostVO->author);
     $VO->setTemplateUrl($this->ContentInfoPostVO->template_url, $this->ContentInfoPostVO->request_locale);
     $VO->setSlug($this->ContentInfoPostVO->slug, $this->ContentInfoPostVO->request_locale);
     $VO->setKeyWords($this->ContentInfoPostVO->key_words, $this->ContentInfoPostVO->request_locale);
     $VO->setDate($this->ContentInfoPostVO->date);
     $VO->setDateIn($this->ContentInfoPostVO->date_in);
     $VO->setDateOut($this->ContentInfoPostVO->date_out);
     $VO->setOrder($this->ContentInfoPostVO->order);
     include "";
     //("Ja") gera id para criar pasta onde vai ser guardado o arquivo
     $ReturnResultContentVO = $VO->commit();
     if ($ReturnResultContentVO->success) {
         $ReturnResultContentVO->result = $VO->getId();
         // TODO: AQ ADD IMGAGE  e/ou FILE - $arr_uploaded_files
         // $this->ContentInfoPostVO->arr_uploaded_files['image'][0]->table 		= 'content';
         // $this->ContentInfoPostVO->arr_uploaded_files['image'][0]->table_id 	= $ReturnResultContentVO->result ;
         // $facilFile = new FacilImage( $this->ContentInfoPostVO->arr_uploaded_files['image'][0])
         // $facilFile = new FacilFile( $this->ContentInfoPostVO->arr_uploaded_files['file'][0])
     }
     if ($ReturnResultContentVO->success) {
         //incluir o vinculo com a linked_table e linked_table_id
         //receber 	table
         //			table_id
         if ($this->ContentInfoPostVO->request_table != NULL && $this->ContentInfoPostVO->request_table_id > 0) {
             $table = $this->ContentInfoPostVO->request_table;
             $table_id = $this->ContentInfoPostVO->request_table_id;
             include_once "library/facil3/core/dao/LinkDAO.class.php";
             $LinkDAO = new LinkDAO();
             //vincula a foto ao table e table_id enviado
             $ReturnResultVinculoVO = $LinkDAO->insert($table, $table_id, $this->moduleName, $VO->getId(), 1);
             if (!$ReturnResultVinculoVO->success) {
                 //deu erro ao vincular
                 $ReturnResultContentVO->appendMessage($ReturnResultVinculoVO->array_messages);
             }
         }
     }
     return $ReturnResultContentVO;
 }
コード例 #5
0
ファイル: FacilImage.php プロジェクト: reytuty/facil
 /**
  * recebe a imagem por post
  * @return ReturnResultVO
  */
 public function insert()
 {
     //inicia um retorno de ReturnResultVO
     $ReturnResultVO = new ReturnResultVO();
     //pega os dados baseado na infoPost
     $VO = new ImageVO();
     //var_dump($this->infoPost);
     //exit();
     if ($this->infoPost->image_info_id > 0) {
         //passou o id, vai atualizar essa VO
         //					echo Debug::li("image_info_id >>>>>>>>>> ".$this->infoPost->image_info_id);
         $VO->setId($this->infoPost->image_info_id, TRUE);
     }
     $VO->setActive($this->infoPost->image_info_active);
     $VO->setName($this->infoPost->image_info_name);
     $VO->setDescription($this->infoPost->image_info_description);
     $VO->setType($this->infoPost->image_info_type);
     $VO->setAuthor($this->infoPost->image_info_author);
     $VO->setLocale($this->infoPost->image_info_locale);
     $VO->setOrder($this->infoPost->image_info_order);
     //				var_dump($_FILES);
     //				var_dump($this->infoPost->file_data);
     //comitando as infos enviadas, dados apenas
     if ($VO->getId() > 0 || $this->infoPost->file_data['tmp_name']) {
         //só comita a imagem se tiver ou id ou enviado o file_data, se não nem tem o que fazer
         $ReturnResultImageVO = $VO->commit();
     } else {
         //nem enviou o id e nem o file_data, retorna
         $ReturnResultVO->addMessage(Translation::text("Have nothing to commit."));
         return $ReturnResultVO;
     }
     if ($ReturnResultImageVO->success) {
         $ReturnResultImageVO->result = $VO->getId();
     } else {
         //erro, os motivos estão na ReturnResultVO abaixo
         return $ReturnResultImageVO;
     }
     //pega o id da imagem
     $IMAGE_ID = $VO->getId();
     $ReturnResultImageVO = new ReturnResultVO();
     //echo Debug::li("this->infoPost->file_data: ".$this->infoPost->file_data);
     if (isset($this->infoPost->file_data) && $this->infoPost->file_data['tmp_name']) {
         set_time_limit(0);
         //var_dump($_FILES);
         $sentFileData = $this->infoPost->file_data;
         //$_FILES['Filedata'];
         $name = $sentFileData['name'];
         // extens�o enviada
         $sentExtension = DataHandler::returnExtensionOfFile($name);
         // remove caracteres escrotos
         $name = DataHandler::returnFilenameWithoutExtension($name);
         $name = DataHandler::removeAccent($name);
         $name = DataHandler::removeSpecialCharacters($name);
         $name = trim(substr($name, 0, 80));
         switch ($sentFileData["type"]) {
             case "image/pjpeg":
             case "image/jpeg":
             case "image/jpg":
                 $extension = "jpg";
                 break;
             case "image/gif":
                 $extension = "gif";
                 break;
             case "image/png":
             case "image/x-png":
                 $extension = "png";
                 break;
             case "image/bmp":
                 $extension = "bmp";
                 break;
             default:
                 $extension = strtolower($sentExtension);
                 break;
         }
         //verifica se a pasta existe, se não existir, inventa
         DataHandler::createFolderIfNotExist($this->defaultFolderForNewImages);
         // pasta de upload de imagens est� no config.php
         $tempFolder = DataHandler::removeDobleBars($this->defaultFolderForNewImages . "/" . $IMAGE_ID);
         DataHandler::createFolderIfNotExist($tempFolder);
         //echo Debug::li("name: $name");
         $tempUrl = $tempFolder . "/original_" . strtolower($name . "." . $extension);
         //echo Debug::li("tempUrl: $tempUrl");
         //exit();
         $i = 2;
         while (file_exists($tempUrl)) {
             $tempUrl = $tempFolder . "/original_" . strtolower($name . "-" . $i . "." . $extension);
             $i++;
         }
         $VO->setUrl($tempUrl);
         $ReturnResultImageVO = $VO->commit();
         //Debug::li("aaa");
         //Debug::print_r($ReturnResultImageVO);
         if ($ReturnResultImageVO->success) {
             //incluir o vinculo com a linked_table e linked_table_id
             //receber 	table
             //			table_id
             if ($this->infoPost->table) {
                 $table = $this->infoPost->table;
                 $table_id = $this->infoPost->table_id;
                 include_once "library/facil3/core/dao/LinkDAO.class.php";
                 $LinkDAO = new LinkDAO();
                 //vincula a foto ao table e table_id enviado
                 $ReturnResultVinculoVO = $LinkDAO->insert($table, $table_id, $this->moduleName, $VO->getId(), 1);
                 if (!$ReturnResultVinculoVO->success) {
                     //deu erro ao vincular
                     $ReturnResultVO->success = false;
                     $ReturnResultVO->appendMessage($ReturnResultVinculoVO->array_messages);
                     return $ReturnResultVO;
                 }
             } else {
                 $ReturnResultVO->addMessage("WARNING IMAGE NO LINKED TABLE");
             }
             //movendo a foto original para sua respectiva pasta.
             $originalImage = $VO->getUrl();
             if (!move_uploaded_file($sentFileData['tmp_name'], $originalImage)) {
                 $ReturnResultVO->success = false;
                 $ReturnResultVO->addMessage(LibraryLanguage::ERROR_IMAGE_MOVE_FILE_FAIL);
                 return $ReturnResultVO;
             } else {
                 $ReturnResultVO->success = TRUE;
                 $ReturnResultVO->result = $VO->getId();
                 $ReturnResultVO->addMessage("Foto enviada com sucesso.");
             }
         } else {
             return $ReturnResultImageVO;
         }
         return $ReturnResultVO;
     } else {
         if ($VO->getId() > 0) {
             //se tem id, ele manda atualizar a parada
             $ReturnResultImageVO = $VO->commit();
             return $ReturnResultImageVO;
         }
         $ReturnResultImageVO = new ReturnResultVO();
         $ReturnResultImageVO->addMessage(Translation::text("Send file data."));
         // nao veio filedata
         return $ReturnResultImageVO;
     }
 }
コード例 #6
0
 private function processTweetURLs($tweet)
 {
     $ld = new LinkDAO($this->db, $this->logger);
     $urls = Post::extractURLs($tweet['post_text']);
     foreach ($urls as $u) {
         //if it's an image (Twitpic/Twitgoo/Yfrog/Flickr for now), insert direct path to thumb as expanded url, otherwise, just expand
         //set defaults
         $is_image = 0;
         $title = '';
         $eurl = '';
         //TODO Abstract out this image thumbnail link expansion into an Image Thumbnail plugin, modeled after the Flickr Thumbnails plugin
         if (substr($u, 0, strlen('http://twitpic.com/')) == 'http://twitpic.com/') {
             $eurl = 'http://twitpic.com/show/thumb/' . substr($u, strlen('http://twitpic.com/'));
             $is_image = 1;
         } elseif (substr($u, 0, strlen('http://yfrog.com/')) == 'http://yfrog.com/') {
             $eurl = $u . '.th.jpg';
             $is_image = 1;
         } elseif (substr($u, 0, strlen('http://twitgoo.com/')) == 'http://twitgoo.com/') {
             $eurl = 'http://twitgoo.com/show/thumb/' . substr($u, strlen('http://twitgoo.com/'));
             $is_image = 1;
         } elseif (substr($u, 0, strlen('http://flic.kr/')) == 'http://flic.kr/') {
             $is_image = 1;
         }
         if ($ld->insert($u, $eurl, $title, $tweet['post_id'], $is_image)) {
             $this->logger->logStatus("Inserted " . $u . " (" . $eurl . ", " . $is_image . "),  into links table", get_class($this));
         } else {
             $this->logger->logStatus("Did NOT insert " . $u . " (" . $eurl . ") into links table", get_class($this));
         }
     }
 }
コード例 #7
0
ファイル: Content.php プロジェクト: reytuty/facil
 /**
  * Da redirect
  * Envie redirect_with_id para o seu redirect_to ir com o parametro id no final
  * @return void
  */
 public function commit($redirect_page = TRUE, $link_table = "image")
 {
     $contentVO = new ContentSiteVO();
     if (isset($_POST["id"])) {
         $contentVO->setId($_POST["id"], TRUE);
     }
     $contentVO->setFetchArray($_POST);
     //antes de tudo, faz a validação
     $ValidationReturnResultVO = new ReturnResultVO();
     $ValidationReturnResultVO->success = TRUE;
     if (DataHandler::getValueByArrayIndex($_POST, "array_validation")) {
         $array_validation = DataHandler::getValueByArrayIndex($_POST, "array_validation");
         //array de fields que deveriam ser validados e estão errados
         $array_fields_errors = array();
         if (is_array($array_validation)) {
             //se for array, valida a array
             //varre a validação
             foreach ($array_validation as $field_name) {
                 $temp_ReturnResultVO = $this->validateContentFields($field_name, $contentVO);
                 if (!$temp_ReturnResultVO->success) {
                     //echo Debug::li("Content.php erro na validacao : $field_name ");
                     //da o push na array_fields error
                     $array_fields_errors[] = $field_name;
                     //já muda o success do result para false para saber que não precisa mais commitar
                     $ValidationReturnResultVO->success = FALSE;
                 }
             }
         } else {
             if (is_string($array_validation)) {
                 //se for só uma string valida só 1 deles
                 $temp_ReturnResultVO = $this->validateContentFields($field_name, $contentVO);
                 if (!$temp_ReturnResultVO->success) {
                     //da o push na array_fields error
                     $array_fields_errors[] = $field_name;
                     //já muda o success do result para false para saber que não precisa mais commitar
                     $ValidationReturnResultVO->success = FALSE;
                 }
             }
         }
     }
     if (!$ValidationReturnResultVO->success) {
         //coloco na result a array de fields com error
         $ValidationReturnResultVO->result = $array_fields_errors;
         //retorna para o edit de quem extends essa classe
         return $this->{$my_edit_method}($ValidationReturnResultVO);
         //daqui nao passa
         exit;
     }
     //vai criar as key_words do content
     $key_words = "";
     $key_words .= " " . DataHandler::removeAccent($contentVO->getAuthor());
     $key_words .= " " . DataHandler::removeAccent($contentVO->getContent());
     $key_words .= " " . DataHandler::removeAccent($contentVO->getDescription());
     $key_words .= " " . DataHandler::removeAccent($contentVO->getHat());
     $key_words .= " " . DataHandler::removeAccent($contentVO->getName());
     $key_words .= " " . DataHandler::removeAccent($contentVO->getSlug());
     $key_words .= " " . DataHandler::removeAccent($contentVO->getTitle());
     $contentVO->setKeyWords($key_words);
     $returnResultVO = $contentVO->commit();
     $content_id = $contentVO->getId();
     //adicionando link com categoria(s) enviada(s)
     //pega a instancia
     $LinkDAO = LinkDAO::getInstance();
     if (FALSE) {
         $LinkDAO = new LinkDAO();
     }
     //deleta vinculos com categoria
     $LinkDAO->deleteAllFromLinkedTableByTableAndTableId('content', $content_id, 'category');
     $have_category_to_commit = FALSE;
     if (!is_array($_POST["category"])) {
         $_POST["category"] = array($_POST["category"]);
     }
     $arrayCategory = $_POST["category"];
     //Debug::print_r($arrayCategory);exit();
     $order = 10;
     if (!is_array($_POST["order"])) {
         $order = $_POST["order"];
     }
     foreach ($arrayCategory as $category_id) {
         ///print_r($category_id);
         //echo Debug::li("categoria id:".$category_id);
         //cada categoria enviada é mais um link com categoria que deve ser adicionado
         //echo $order;exit();
         $LinkDAO->insert('category', $category_id, 'content', $contentVO->getId(), 1, $order);
         // $contentVO->addLink("category", $category_id);
         $have_category_to_commit = TRUE;
     }
     //exit();
     //caso tenha o que adicionar como link em categoria, commita
     if ($have_category_to_commit) {
         $contentVO->commit();
     }
     //fim da adição do content em categoria
     //-----------------------------==================================== [[[  add imagens ]]]
     $array_image_file = DataHandler::getValueByArrayIndex($_FILES, "image");
     include_once "library/facil3/core/controller/image/FacilImage.php";
     $FacilImage = new FacilImage();
     //echo Debug::li(":link_table   [".$link_table."]");exit();
     $FacilImage->moduleName = $link_table;
     $FacilImage->defaultFolderForNewImages = "upload/image/";
     for ($i = 0; $i < count($array_image_file["name"]); $i++) {
         //Debug::print_r($array_image_file);
         $file_image = array();
         $file_image["name"] = $array_image_file["name"][$i];
         $file_image["type"] = $array_image_file["type"][$i];
         $file_image["tmp_name"] = $array_image_file["tmp_name"][$i];
         $file_image["error"] = $array_image_file["error"][$i];
         $file_image["size"] = $array_image_file["size"][$i];
         //adicionar cada image utilizando o módulo de imagem
         $array_config_info_post = array();
         $image_id = NULL;
         if (DataHandler::getValueByArrayIndex($_POST, "image_info_id")) {
             if (DataHandler::getValueByArrayIndex($_POST["image_info_id"], $i)) {
                 $image_id = $_POST["image_info_id"][$i];
             }
         }
         $array_config_info_post["image_info_id"] = $image_id;
         $array_config_info_post["image_info_name"] = isset($_POST["image_info_name"]) ? $_POST["image_info_name"][$i] : "";
         $array_config_info_post["image_info_description"] = isset($_POST["image_info_description"]) ? $_POST["image_info_description"][$i] : "";
         $array_config_info_post["image_info_order"] = isset($_POST["image_info_order"]) ? $_POST["image_info_order"][$i] : "";
         $array_config_info_post["image_info_locale"] = NULL;
         //$_POST["image_info_locale"][$i];
         $array_config_info_post["image_info_author"] = isset($_POST["image_info_author"][$i]) ? $_POST["image_info_author"][$i] : "";
         $array_config_info_post["table"] = "content";
         $array_config_info_post["table_id"] = $content_id;
         $array_config_info_post["Filedata"] = $file_image;
         $ImageInfoPostVO = new ImageInfoPostVO($array_config_info_post);
         //agora inicia o módulo passando esse info post configurado
         $FacilImage->resetInfoPost($ImageInfoPostVO);
         $ReturnResultVO = $FacilImage->insert();
     }
     //-----------------------------==================================== [[[  add file ]]]
     $array_image_file = DataHandler::getValueByArrayIndex($_FILES, "file");
     include_once "library/facil3/core/controller/file/FacilFile.php";
     $FacilFile = new FacilFile();
     //nome do módulo no sistema
     $FacilFile->moduleName = "file";
     $FacilFile->defaultFolderForNewFiles = "upload/file/";
     for ($i = 0; $i < count($array_image_file["name"]); $i++) {
         $file_image = array();
         $file_image["name"] = $array_image_file["name"][$i];
         $file_image["type"] = $array_image_file["type"][$i];
         $file_image["tmp_name"] = $array_image_file["tmp_name"][$i];
         $file_image["error"] = $array_image_file["error"][$i];
         $file_image["size"] = $array_image_file["size"][$i];
         //adicionar cada image utilizando o módulo de imagem
         $array_config_info_post = array();
         $array_config_info_post["file_info_id"] = isset($_POST["file_info_id"]) ? $_POST["file_info_id"][$i] : "";
         //$_POST["file_info_id"][$i];
         $array_config_info_post["file_info_name"] = isset($_POST["file_info_name"]) ? $_POST["file_info_name"][$i] : "";
         //$_POST["file_info_name"][$i];
         $array_config_info_post["file_info_description"] = isset($_POST["file_info_description"]) ? $_POST["file_info_description"][$i] : "";
         //$_POST["file_info_description"][$i];
         $array_config_info_post["file_info_order"] = isset($_POST["file_info_order"]) ? $_POST["file_info_order"][$i] : "";
         //$_POST["file_info_order"][$i];
         $array_config_info_post["file_info_locale"] = NULL;
         //$_POST["file_info_locale"][$i];
         $array_config_info_post["file_info_author"] = isset($_POST["file_info_author"]) ? $_POST["file_info_author"][$i] : "";
         //$_POST["file_info_author"][$i];
         $array_config_info_post["table"] = "content";
         $array_config_info_post["table_id"] = $content_id;
         $array_config_info_post["Filedata"] = $file_image;
         $FileInfoPostVO = new FileInfoPostVO($array_config_info_post);
         //agora inicia o módulo passando esse info post configurado
         $FacilFile->resetInfoPost($FileInfoPostVO);
         $FacilFile->insert();
     }
     //falta terminar
     //Navigation::redirect("admin/content/");
     $redirect_to = $this->my_redirect;
     if (DataHandler::getValueByArrayIndex($_POST, "redirect_to")) {
         $redirect_to = DataHandler::getValueByArrayIndex($_POST, "redirect_to");
     }
     if ($this->redirect_with_id) {
         $redirect_to .= "/id." . $content_id;
     }
     if ($redirect_page) {
         Navigation::redirect($redirect_to);
         exit;
     } else {
         return $contentVO;
     }
 }