コード例 #1
0
 public function upload()
 {
     $upload = new UploadImage();
     if ($filedata = $upload->saveImage()) {
         $this->showAjaxReturn(array('pic' => $filedata['attachment'], 'picurl' => C('attachurl') . $filedata['attachment']));
     } else {
         $this->showAjaxError(-1, $upload->error);
     }
 }
コード例 #2
0
 public static function fetchFromParameters($params, $isDatabaseRow = false)
 {
     NewsPost::$staticErrors = array();
     $newsPost = new NewsPost();
     if (isset($params['id']) && is_numeric($params['id'])) {
         $newsPost->id = intval($params['id']);
     }
     if (isset($params['category_id']) && is_numeric($params['category_id'])) {
         $newsPost->categoryId = intval($params['category_id']);
     }
     $newsPost->title = LocalizedText::fetchFromParameters($params, NewsPost::$titlePrefix);
     $newsPost->contents = LocalizedText::fetchFromParameters($params, NewsPost::$contentsPrefix);
     if ($isDatabaseRow && isset($params['image_small'])) {
         $newsPost->imageSmall = $params['image_small'];
     } else {
         if (!$isDatabaseRow && isset($_FILES['image_small']['name']) && trim($_FILES['image_small']['name']) != "") {
             $imageName = NULL;
             if (!UploadImage::upload($_FILES, "image_small", "../images", $imageName)) {
                 NewsPost::$staticErrors = UploadImage::$errors;
                 return null;
             }
             $newsPost->imageSmall = $imageName;
         }
     }
     if ($isDatabaseRow && isset($params['image_medium'])) {
         $newsPost->imageMedium = $params['image_medium'];
     } else {
         if (!$isDatabaseRow && isset($_FILES['image_medium']['name']) && trim($_FILES['image_medium']['name']) != "") {
             $imageName = NULL;
             if (!UploadImage::upload($_FILES, "image_medium", "../images", $imageName)) {
                 NewsPost::$staticErrors = UploadImage::$errors;
                 return null;
             }
             $newsPost->imageMedium = $imageName;
         }
     }
     if ($isDatabaseRow && isset($params['image_large'])) {
         $newsPost->imageLarge = $params['image_large'];
     } else {
         if (!$isDatabaseRow && isset($_FILES['image_large']['name']) && trim($_FILES['image_large']['name']) != "") {
             $imageName = NULL;
             if (!UploadImage::upload($_FILES, "image_large", "../images", $imageName)) {
                 NewsPost::$staticErrors = UploadImage::$errors;
                 return null;
             }
             $newsPost->imageLarge = $imageName;
         }
     }
     if (isset($params['poster_name'])) {
         $newsPost->posterName = trim($params['poster_name']);
     }
     if (isset($params['date_posted'])) {
         $newsPost->postedDate = Date::parse(trim($params['date_posted']));
     }
     return $newsPost;
 }
コード例 #3
0
 static function upload($array, $inputName, $location, &$uploadedImage)
 {
     global $logger;
     $logger->LogInfo("Attempting to upload file ...");
     $logger->LogInfo("Input name: " . $inputName);
     $logger->LogInfo("Location: " . $location);
     $logger->LogInfo("Array: " . var_export($array, true));
     $errors = array();
     $image = $_FILES[$inputName]['name'];
     if ($image) {
         $filename = stripslashes($image);
         //get the extension of the file in a lower case format
         $extension = UploadImage::getExtension($filename);
         $logger->LogInfo("Extension: " . $extension);
         //if it is not a known extension, we will suppose it is an error and will not  upload the file,
         //otherwise we will do more tests
         if ($extension == "jpg" || $extension == "jpeg" || $extension == "png" || $extension == "gif") {
             //we will give an unique name, for example the time in unix time format
             $imageName = time() . '_' . rand(1, 1000000) . '.' . $extension;
             //the new name will be containing the full path where will be stored (images folder)
             $newname = $location . "/" . $imageName;
             //we verify if the image has been uploaded, and print error instead
             $logger->LogInfo("Copying " . $_FILES[$inputName]['tmp_name'] . " to " . $newname);
             $copied = copy($_FILES[$inputName]['tmp_name'], $newname);
             if ($copied) {
                 $logger->LogInfo("Copy successful.");
                 $uploadedImage = $imageName;
                 return true;
             } else {
                 $logger->LogError("Error copying file " . $_FILES[$inputName]['tmp_name'] . " to images directory.");
                 $errors[sizeof($errors)] = "Error copying file " . $_FILES[$inputName]['tmp_name'] . " to images directory.";
                 return false;
             }
         } else {
             $logger->LogError("Invalid extension " . $extension);
             $errors[sizeof($errors)] = "Invalid extension " . $extension;
             return false;
         }
     } else {
         $logger->LogError("Array does not have input name " . $inputName);
         $errors[sizeof($errors)] = "Array does not have input name " . $inputName;
         return false;
     }
 }
コード例 #4
0
 public static function fetchFromParameters($postParams, $fileParams = null, $uploadLocation = "../images")
 {
     global $systemConfiguration;
     global $logger;
     GalleryImage::$staticErrors = array();
     $galleryImage = new GalleryImage();
     if (isset($postParams['id']) && is_numeric($postParams['id'])) {
         $galleryImage->id = intval($postParams['id']);
     }
     if (isset($postParams['image_name'])) {
         $galleryImage->imageFileName = $postParams['image_name'];
     } else {
         if ($fileParams != null && isset($fileParams['image_name']) && strlen(trim($fileParams['image_name']['name'])) > 0) {
             $imageName = "";
             if (!UploadImage::upload($fileParams, 'image_name', $uploadLocation, $imageName)) {
                 GalleryImage::$staticErrors = UploadImage::$errors;
                 return null;
             }
             $galleryImage->imageFileName = $imageName;
         }
     }
     if (isset($postParams['thumb_image_name'])) {
         $galleryImage->thumbImageFileName = $postParams['thumb_image_name'];
     } else {
         if ($fileParams != null && isset($fileParams['thumb_image_name']) && strlen(trim($fileParams['thumb_image_name']['name'])) > 0) {
             $imageName = "";
             if (!UploadImage::upload($fileParams, 'thumb_image_name', $uploadLocation, $imageName)) {
                 GalleryImage::$staticErrors = UploadImage::$errors;
                 return null;
             }
             $galleryImage->thumbImageFileName = $imageName;
         }
     }
     $galleryImage->description = LocalizedText::fetchFromParameters($postParams, GalleryImage::$descriptionPrefix);
     if (isset($postParams['link'])) {
         $galleryImage->link = $postParams['link'];
     }
     if (isset($postParams['display_order']) && is_numeric($postParams['display_order'])) {
         $galleryImage->displayOrder = intval($postParams['display_order']);
     }
     return $galleryImage;
 }
コード例 #5
0
<?php

/*ЗАКРЕПЛЕНИЕ ЗНАНИЙ урок 3-10
		/Создадим библиотеку которая будет загружать различные файлы на сервер(в частности фото и текстовый фалы). /Для реализации задачи создадим три класса, родительский будет абстрактным для загрузки файлов, а два дочерних класса будут для загрузки текста и картинок
		***Функция move_uploaded_file() - перемещает загруженный файл в новое место(1 - путь к загруженному файлу, 2 - НАЗНАЧЕНИЕ перемещаемого файла)
		***Массив $_FILE[] - содержит все значения файла, в нем 5 параметров 1 - name, 2 - type, 3 - tmp_name, 4 - error, 5 - size
		
	*/
require_once "lib/uploadtext.php";
require_once "lib/uploadimage.php";
if ($_POST["upload"]) {
    $upload_text = new UploadText();
    $upload_image = new UploadImage();
    $success_text = $upload_text->uploadFile($_FILES["text"]);
    $success_image = $upload_image->uploadFile($_FILES["image"]);
}
?>

<!DOCTYPE HTML>
<html>
<head>
	<meta charset="UTF-8">
	<title></title>
</head>
<body>
	<h1 align="center">Загрузка файлов</h1>
	<?php 
if ($_POST["upload"]) {
    if ($success_text) {
        echo "<h2 style='color:green;'>Текстовый файл успешно загружен</h2>";
    } else {
コード例 #6
0
ファイル: UploadImage.php プロジェクト: neil-chen/NeilChen
	/**
	 * 初始化可以上传文件类型
	 */
	public function initUpTypes () {
		$upTypes = @$_REQUEST['upTypes'];
		if (!$upTypes) {
			return;
		}
		$typeArr = explode(',', $upTypes);
		if (!$typeArr) {
			return;
		}
		$arr = array();
		foreach ($typeArr as $v) {
			$v = strtolower(trim($v));
			array_push($arr, $v);
		}
		//var_dump($arr);
		self::$uptypes = $arr;
	}
コード例 #7
0
ファイル: Image.php プロジェクト: VisualAppeal/stock
 /**
  * Parse exif data and save to database.
  *
  * @param UploadImage $image
  * @param Stock\Image $model
  *
  * @return boolean
  */
 protected static function parseExifData($image, $model)
 {
     $data = $image->exif();
     if (!is_array($data)) {
         return false;
     }
     foreach ($data as $key => $value) {
         if (is_array($value) || empty($value)) {
             continue;
         }
         if (substr($key, 0, 4) == 'File') {
             continue;
         }
         $exif = new ImageData();
         $exif->image_id = $model->id;
         $exif->key = $key;
         $exif->value = $value;
         $exif->save();
     }
     return true;
 }
コード例 #8
0
ファイル: moduleimageRequest.php プロジェクト: neoartdoo/CMS
 public function doAction()
 {
     $out = '';
     $cName = $this->doorGets->controllerNameNow();
     // Init langue
     $lgActuel = $this->doorGets->getLangueTradution();
     $moduleInfos = $this->doorGets->moduleInfos($this->doorGets->Uri, $lgActuel);
     $User = $this->doorGets->user;
     // Init url redirection
     $redirectUrl = './?controller=module' . $moduleInfos['type'] . '&uri=' . $this->doorGets->Uri . '&lg=' . $lgActuel;
     // Check if is content modo
     in_array($moduleInfos['id'], $User['liste_module_modo']) ? $is_modo = true : ($is_modo = false);
     // Check if is module modo
     in_array('module', $User['liste_module_interne']) && in_array('module_' . $moduleInfos['type'], $User['liste_module_interne']) ? $is_modules_modo = true : ($is_modules_modo = false);
     // check if user can edit content
     in_array($moduleInfos['id'], $User['liste_module_edit']) ? $user_can_edit = true : ($user_can_edit = false);
     // check if user can delete content
     in_array($moduleInfos['id'], $User['liste_module_delete']) ? $user_can_delete = true : ($user_can_delete = false);
     // Init count total contents
     $countContents = 0;
     $arrForCountSearchQuery[] = array('key' => "id_user", 'type' => '=', 'value' => $User['id']);
     $countContents = $this->doorGets->getCountTable($this->doorGets->Table, $arrForCountSearchQuery);
     // Check limit to add content
     $isLimited = 0;
     if (array_key_exists($moduleInfos['id'], $User['liste_module_limit']) && $User['liste_module_limit'] !== '0') {
         $isLimited = (int) $User['liste_module_limit'][$moduleInfos['id']];
     }
     // get Content for edit / delete
     $params = $this->doorGets->Params();
     if (array_key_exists('id', $params['GET'])) {
         $id = $params['GET']['id'];
         $isContent = $this->doorGets->dbQS($id, $this->doorGets->Table);
         if (!empty($isContent)) {
             if ($lgGroupe = @unserialize($isContent['groupe_traduction'])) {
                 $idLgGroupe = $lgGroupe[$lgActuel];
                 $isContentTraduction = $this->doorGets->dbQS($idLgGroupe, $this->doorGets->Table . '_traduction');
                 if (!empty($isContentTraduction)) {
                     $isContent = array_merge($isContent, $isContentTraduction);
                 }
                 // test if user can edit content
                 if ($isContent['id_user'] !== $this->doorGets->user['id'] && !in_array($isContent['id_groupe'], $this->doorGets->user['liste_enfant_modo'])) {
                     FlashInfo::set($this->doorGets->__("Vous n'avez pas les droits pour afficher ce contenu"), "error");
                     $this->doorGets->_redirect($redirectUrl);
                 }
             }
         }
     }
     $champsNonObligatoire = array('article_tinymce', 'meta_titre', 'meta_description', 'meta_keys', 'sendto', 'id_disqus', 'image_gallery', 'meta_facebook_titre', 'meta_facebook_description', 'meta_facebook_image', 'meta_twitter_titre', 'meta_twitter_description', 'meta_twitter_image', 'meta_twitter_player');
     $messageSuccess = $this->doorGets->__("Vos informations ont bien été mises à jour");
     switch ($this->Action) {
         case 'add':
             if (!empty($this->doorGets->Form->i)) {
                 $this->doorGets->checkMode();
                 $cResultsInt = $this->doorGets->getCountTable($this->doorGets->Table);
                 $listToCategories = '';
                 // gestion des champs vide
                 foreach ($this->doorGets->Form->i as $k => $v) {
                     if (!in_array($k, $champsNonObligatoire) && empty($v)) {
                         $this->doorGets->Form->e[$cName . '_add_' . $k] = 'ok';
                     }
                     $iCat = explode('_', $k);
                     if (!empty($iCat) && $iCat[0] === 'categories' && is_numeric($iCat[1])) {
                         $listToCategories .= $iCat[1] . ',';
                         unset($this->doorGets->Form->i[$k]);
                     }
                 }
                 $extension = '.png';
                 if (isset($_FILES[$cName . '_add_image']) && ($_FILES[$cName . '_add_image']["type"] == "image/jpeg" || $_FILES[$cName . '_add_image']["type"] == "image/png") && $_FILES[$cName . '_add_image']["error"] === 0) {
                     if ($_FILES[$cName . '_add_image']["type"] == "image/jpeg") {
                         $extension = '.jpg';
                     }
                 } else {
                     $this->doorGets->Form->e[$cName . '_add_image'] = 'ok';
                 }
                 if (empty($this->doorGets->Form->e)) {
                     $uni = time() . '-' . uniqid('doorgets') . '';
                     $nameFileImage = $uni . '-' . $this->doorGets->Uri;
                     $this->doorGets->Form->i['image'] = $nameFileImage;
                     $send_img = UploadImage::send($this->doorGets->getRealUri($this->doorGets->Uri), $_FILES[$cName . '_add_image']['tmp_name'], $_FILES[$cName . '_add_image']['name'], $nameFileImage, 257);
                     if ($send_img !== null) {
                         $this->doorGets->Form->i['image'] = strtolower($send_img);
                     }
                 }
                 if (empty($this->doorGets->Form->e)) {
                     $image_gallery = $this->doorGets->Form->i['image_gallery'];
                     // Copy images gallery to real path
                     $this->doorGets->copyFileToRealPath($this->doorGets->Uri, $image_gallery);
                 }
                 // validation si aucune erreur
                 if (empty($this->doorGets->Form->e)) {
                     if (!array_key_exists('active', $this->doorGets->Form->i)) {
                         $this->doorGets->Form->i['active'] = 3;
                     }
                     if (!array_key_exists('author_badge', $this->doorGets->Form->i)) {
                         $this->doorGets->Form->i['author_badge'] = $is_modo ? 0 : $moduleInfos['author_badge'];
                     }
                     if (!array_key_exists('comments', $this->doorGets->Form->i)) {
                         $this->doorGets->Form->i['comments'] = 0;
                     }
                     if (!array_key_exists('partage', $this->doorGets->Form->i)) {
                         $this->doorGets->Form->i['partage'] = 0;
                     }
                     if (!array_key_exists('facebook', $this->doorGets->Form->i)) {
                         $this->doorGets->Form->i['facebook'] = 0;
                     }
                     if (!array_key_exists('disqus', $this->doorGets->Form->i)) {
                         $this->doorGets->Form->i['disqus'] = 0;
                     }
                     if (!array_key_exists('in_rss', $this->doorGets->Form->i)) {
                         $this->doorGets->Form->i['in_rss'] = 0;
                     }
                     //
                     $data['pseudo'] = $User['pseudo'];
                     $data['author_badge'] = $this->doorGets->Form->i['author_badge'];
                     $data['id_user'] = $this->doorGets->user['id'];
                     $data['id_groupe'] = $this->doorGets->user['groupe'];
                     $data['categorie'] = $listToCategories;
                     $data['ordre'] = $cResultsInt + 1;
                     $data['active'] = $this->doorGets->Form->i['active'];
                     if (!$is_modo) {
                         $data['active'] = 3;
                     }
                     $data['comments'] = $this->doorGets->Form->i['comments'];
                     $data['partage'] = $this->doorGets->Form->i['partage'];
                     $data['facebook'] = $this->doorGets->Form->i['facebook'];
                     $data['disqus'] = $this->doorGets->Form->i['disqus'];
                     $data['in_rss'] = $this->doorGets->Form->i['in_rss'];
                     $data['date_creation'] = time();
                     $idContent = $this->doorGets->dbQI($data, $this->doorGets->Table);
                     //
                     foreach ($this->doorGets->getAllLanguages() as $k => $v) {
                         $dataNext = array('titre' => $this->doorGets->Form->i['titre'], 'uri' => $this->doorGets->Form->i['uri'], 'article_tinymce' => $this->doorGets->Form->i['article_tinymce'], 'meta_titre' => $this->doorGets->Form->i['meta_titre'], 'meta_description' => $this->doorGets->Form->i['meta_description'], 'meta_keys' => $this->doorGets->Form->i['meta_keys'], 'image' => $this->doorGets->Form->i['image'], 'image_gallery' => $image_gallery, 'meta_facebook_type' => $this->doorGets->Form->i['meta_facebook_type'], 'meta_facebook_titre' => $this->doorGets->Form->i['meta_facebook_titre'], 'meta_facebook_description' => $this->doorGets->Form->i['meta_facebook_description'], 'meta_facebook_image' => $this->doorGets->Form->i['meta_facebook_image'], 'meta_twitter_type' => $this->doorGets->Form->i['meta_twitter_type'], 'meta_twitter_titre' => $this->doorGets->Form->i['meta_twitter_titre'], 'meta_twitter_description' => $this->doorGets->Form->i['meta_twitter_description'], 'meta_twitter_image' => $this->doorGets->Form->i['meta_twitter_image'], 'meta_twitter_player' => $this->doorGets->Form->i['meta_twitter_player']);
                         $dataNext['categorie'] = $listToCategories;
                         $dataNext['date_modification'] = $data['date_creation'];
                         $dataNext['id_content'] = $idContent;
                         $dataNext['langue'] = $k;
                         $dataNext['uri'] = $this->doorGets->Form->i['uri'] . '-' . $idContent . '-' . $k;
                         $idTraduction[$k] = $this->doorGets->dbQI($dataNext, $this->doorGets->Table . '_traduction');
                     }
                     // Tracker
                     $usersTracking = new UsersTrackEntity(null, $this->doorGets);
                     $usersTracking->setIdSession(session_id())->setIpUser($_SERVER['REMOTE_ADDR'])->setUrlPage($_SERVER['REQUEST_URI'])->setUrlReferer($_SERVER['HTTP_REFERER'])->setIdUser($User['id'])->setTitle($dataNext['titre'])->setIdGroupe($User['groupe'])->setLangue($lgActuel)->setUriModule($this->doorGets->Uri)->setIdContent($idContent)->setAction($this->Action)->setDate(time())->save();
                     if (!$is_modo) {
                         $moderation = new ModerationEntity(null, $this->doorGets);
                         $moderation->setIdContent($idContent)->setIdUser($User['id'])->setPseudo($User['pseudo'])->setIdGroupe($User['groupe'])->setUriModule($this->doorGets->Uri)->setTypeModule('image')->setAction($this->Action)->setLangue($lgActuel)->setDateCreation(time())->save();
                         $this->doorGets->sendEmailNotificationToGroupe($moduleInfos['uri_notification_moderator'], $moduleInfos['id']);
                         $messageSuccess = $this->doorGets->__("Votre contenu est en cours de modération");
                     }
                     $dataModification['groupe_traduction'] = serialize($idTraduction);
                     $this->doorGets->dbQU($idContent, $dataModification, $this->doorGets->Table);
                     $this->doorGets->successHeaderResponse($messageSuccess, $redirectUrl . '&action=edit&id=' . $idContent);
                 }
                 $this->doorGets->errorHeaderResponse($this->doorGets->__("Veuillez remplir correctement le formulaire"), $this->doorGets->Form->e);
             }
             break;
         case 'edit':
             if (!empty($this->doorGets->Form->i) && $user_can_edit) {
                 $this->doorGets->checkMode();
                 $this->doorGets->Form->i['image'] = $isContent['image'];
                 $listToCategories = '';
                 // gestion des champs vide
                 foreach ($this->doorGets->Form->i as $k => $v) {
                     if (!in_array($k, $champsNonObligatoire) && empty($v)) {
                         $this->doorGets->Form->e[$cName . '_edit_' . $k] = 'ok';
                     }
                     $iCat = explode('_', $k);
                     if (!empty($iCat) && $iCat[0] === 'categories' && is_numeric($iCat[1])) {
                         $listToCategories .= $iCat[1] . ',';
                         unset($this->doorGets->Form->i[$k]);
                     }
                 }
                 $extension = '.png';
                 if (isset($_FILES[$cName . '_edit_image']) && ($_FILES[$cName . '_edit_image']["type"] == "image/jpeg" || $_FILES[$cName . '_edit_image']["type"] == "image/png") && $_FILES[$cName . '_edit_image']["error"] === 0) {
                     if ($_FILES[$cName . '_edit_image']["type"] == "image/jpeg") {
                         $extension = '.jpg';
                     }
                 }
                 if (empty($this->doorGets->Form->e)) {
                     $uni = time() . '-' . uniqid('doorgets') . '';
                     $nameFileImage = $uni . '-' . $this->doorGets->Uri;
                     $send_img = UploadImage::send($this->doorGets->getRealUri($this->doorGets->Uri), $_FILES[$cName . '_edit_image']['tmp_name'], $_FILES[$cName . '_edit_image']['name'], $nameFileImage, 257);
                     if ($send_img !== null) {
                         $this->doorGets->Form->i['image'] = strtolower($send_img);
                     }
                 }
                 if (empty($this->doorGets->Form->e)) {
                     $image_gallery = $this->doorGets->Form->i['image_gallery'];
                     // Copy images gallery to real path
                     $this->doorGets->copyFileToRealPath($this->doorGets->Uri, $image_gallery);
                 }
                 if (empty($this->doorGets->Form->e)) {
                     if (!array_key_exists('active', $this->doorGets->Form->i)) {
                         $this->doorGets->Form->i['active'] = $isContent['active'];
                     }
                     if (!array_key_exists('author_badge', $this->doorGets->Form->i)) {
                         $this->doorGets->Form->i['author_badge'] = $is_modo ? 0 : $isContent['author_badge'];
                     }
                     if (!array_key_exists('comments', $this->doorGets->Form->i)) {
                         $this->doorGets->Form->i['comments'] = $is_modo ? 0 : $isContent['comments'];
                     }
                     if (!array_key_exists('partage', $this->doorGets->Form->i)) {
                         $this->doorGets->Form->i['partage'] = $is_modo ? 0 : $isContent['partage'];
                     }
                     if (!array_key_exists('facebook', $this->doorGets->Form->i)) {
                         $this->doorGets->Form->i['facebook'] = $is_modo ? 0 : $isContent['facebook'];
                     }
                     if (!array_key_exists('disqus', $this->doorGets->Form->i)) {
                         $this->doorGets->Form->i['disqus'] = $is_modo ? 0 : $isContent['disqus'];
                     }
                     if (!array_key_exists('in_rss', $this->doorGets->Form->i)) {
                         $this->doorGets->Form->i['in_rss'] = $is_modo ? 0 : $isContent['in_rss'];
                     }
                     $dataContenu['categorie'] = $listToCategories;
                     $dataContenu['author_badge'] = $this->doorGets->Form->i['author_badge'];
                     $dataContenu['active'] = $this->doorGets->Form->i['active'];
                     if (!$is_modo) {
                         $dataContenu['active'] = 3;
                     }
                     $dataContenu['comments'] = $this->doorGets->Form->i['comments'];
                     $dataContenu['partage'] = $this->doorGets->Form->i['partage'];
                     $dataContenu['facebook'] = $this->doorGets->Form->i['facebook'];
                     $dataContenu['disqus'] = $this->doorGets->Form->i['disqus'];
                     $dataContenu['in_rss'] = $this->doorGets->Form->i['in_rss'];
                     $dataTraduction = array('titre' => $this->doorGets->Form->i['titre'], 'uri' => $this->doorGets->Form->i['uri'], 'article_tinymce' => $this->doorGets->Form->i['article_tinymce'], 'meta_titre' => $this->doorGets->Form->i['meta_titre'], 'meta_description' => $this->doorGets->Form->i['meta_description'], 'meta_keys' => $this->doorGets->Form->i['meta_keys'], 'categorie' => $listToCategories, 'image' => $this->doorGets->Form->i['image'], 'image_gallery' => $image_gallery, 'meta_facebook_type' => $this->doorGets->Form->i['meta_facebook_type'], 'meta_facebook_titre' => $this->doorGets->Form->i['meta_facebook_titre'], 'meta_facebook_description' => $this->doorGets->Form->i['meta_facebook_description'], 'meta_facebook_image' => $this->doorGets->Form->i['meta_facebook_image'], 'meta_twitter_type' => $this->doorGets->Form->i['meta_twitter_type'], 'meta_twitter_titre' => $this->doorGets->Form->i['meta_twitter_titre'], 'meta_twitter_description' => $this->doorGets->Form->i['meta_twitter_description'], 'meta_twitter_image' => $this->doorGets->Form->i['meta_twitter_image'], 'meta_twitter_player' => $this->doorGets->Form->i['meta_twitter_player'], 'date_modification' => time());
                     $dataVersion = $dataTraduction;
                     $this->saveLastContentVersion($isContent['id_content'], $dataVersion);
                     // Tracker
                     $usersTracking = new UsersTrackEntity(null, $this->doorGets);
                     $usersTracking->setIdSession(session_id())->setIpUser($_SERVER['REMOTE_ADDR'])->setUrlPage($_SERVER['REQUEST_URI'])->setUrlReferer($_SERVER['HTTP_REFERER'])->setIdUser($User['id'])->setTitle($dataTraduction['titre'])->setIdGroupe($User['groupe'])->setLangue($lgActuel)->setUriModule($this->doorGets->Uri)->setIdContent($isContent['id_content'])->setAction($this->Action)->setDate(time())->save();
                     if (!$is_modo) {
                         $moderation = new ModerationEntity(null, $this->doorGets);
                         $moderation->setIdContent($isContent['id_content'])->setIdUser($User['id'])->setPseudo($User['pseudo'])->setIdGroupe($User['groupe'])->setUriModule($this->doorGets->Uri)->setTypeModule('image')->setAction($this->Action)->setLangue($lgActuel)->setDateCreation(time())->save();
                         $this->doorGets->sendEmailNotificationToGroupe($moduleInfos['uri_notification_moderator'], $moduleInfos['id']);
                         $messageSuccess = $this->doorGets->__("Votre contenu est en cours de modération");
                     } else {
                         $uri_module = $this->doorGets->Uri;
                         $id_content = $isContent['id_content'];
                         $this->doorGets->dbQL("\n                                DELETE FROM _moderation \n                                WHERE id_content = '{$id_content}' \n                                AND uri_module = '{$uri_module}'\n                                LIMIT 1000\n                            ");
                         $uriNotification = $dataContenu['active'] === '2' ? $moduleInfos['uri_notification_user_success'] : $moduleInfos['uri_notification_user_error'];
                         $this->doorGets->sendEmailNotificationToUser($uriNotification, $isContent['id_user']);
                     }
                     // Update Data
                     $this->doorGets->dbQU($isContent['id_content'], $dataContenu, $this->doorGets->Table);
                     $this->doorGets->dbQU($isContent['id'], $dataTraduction, $this->doorGets->Table . '_traduction');
                     $this->doorGets->successHeaderResponse($messageSuccess);
                 }
                 $this->doorGets->errorHeaderResponse($this->doorGets->__("Veuillez remplir correctement le formulaire"), $this->doorGets->Form->e);
             }
             break;
         case 'delete':
             if (!empty($this->doorGets->Form->i) && $user_can_delete) {
                 $this->doorGets->checkMode();
                 if (empty($this->doorGets->Form->e)) {
                     $lgGroupe = unserialize($isContent['groupe_traduction']);
                     foreach ($lgGroupe as $v) {
                         @$this->doorGets->dbQD($v, $this->doorGets->Table . '_traduction');
                     }
                     @unlink(BASE . 'data/' . $this->doorGets->getRealUri($this->doorGets->Uri) . '/' . $isContent['image']);
                     $this->doorGets->dbQD($isContent['id_content'], $this->doorGets->Table);
                     $this->doorGets->dbQL("DELETE FROM _dg_comments WHERE uri_module = '" . $this->doorGets->Uri . "' AND uri_content = '" . $isContent['id_content'] . "' ");
                     $this->doorGets->dbQL("UPDATE " . $this->doorGets->Table . " SET ordre = ordre - 1 WHERE ordre > " . $isContent['ordre'] . " ");
                     //$this->doorGets->clearDBCache();
                     // Tracker
                     $usersTracking = new UsersTrackEntity(null, $this->doorGets);
                     $usersTracking->setIdSession(session_id())->setIpUser($_SERVER['REMOTE_ADDR'])->setUrlPage($_SERVER['REQUEST_URI'])->setUrlReferer($_SERVER['HTTP_REFERER'])->setIdUser($User['id'])->setTitle($isContent['titre'])->setIdGroupe($User['groupe'])->setLangue($lgActuel)->setUriModule($this->doorGets->Uri)->setIdContent($isContent['id_content'])->setAction($this->Action)->setDate(time())->save();
                     $this->doorGets->successHeaderResponse($this->doorGets->__("Les données sont supprimées"), $redirectUrl);
                 }
             }
             break;
     }
 }