public function __construct(&$doorGets) { $this->doorGets = $doorGets; parent::__construct($doorGets); if (empty($doorGets->user)) { header('Location:./?controller=authentification&error-login=true&back=' . urlencode($_SERVER['REQUEST_URI'])); exit; } if (!in_array('promotion', $doorGets->user['liste_module_interne']) || in_array('promotion', $doorGets->user['liste_module_interne']) && SAAS_ENV && !SAAS_ADDRESS) { FlashInfo::set($this->doorGets->__("Vous n'avez pas les droits pour afficher ce module"), "error"); header('Location:./'); exit; } $me = $doorGets->user; $params = $doorGets->Params(); $redirectUrl = './?controller=promotion'; // get Content for edit / delete if (array_key_exists('id', $params['GET'])) { $id = $params['GET']['id']; $isContent = $doorGets->dbQS($id, '_promotion'); if (!is_numeric($id)) { $id = '-!-'; } if (empty($isContent)) { //var_dump($isContent); //exit(); FlashInfo::set($doorGets->l("Le contenu n'existe pas"), "error"); header('Location:' . $redirectUrl); exit; } } }
public function __construct(&$doorGets) { $doorGets->Table = '_dg_files'; $params = $doorGets->Params(); if (empty($doorGets->user)) { header('Location:./?controller=authentification&error-login=true&back=' . urlencode($_SERVER['REQUEST_URI'])); exit; } if (!in_array('media', $doorGets->user['liste_module_interne']) || in_array('media', $doorGets->user['liste_module_interne']) && SAAS_ENV && !SAAS_MEDIA) { FlashInfo::set($this->doorGets->__("Vous n'avez pas les droits pour afficher ce module"), "error"); header('Location:./'); exit; } // get Content for edit / delete if (array_key_exists('id', $params['GET'])) { $id = $params['GET']['id']; $isContent = $doorGets->dbQS($id, $doorGets->Table); if (!is_numeric($id)) { $id = '-!-'; } if (empty($isContent)) { FlashInfo::set($doorGets->__("Le contenu n'existe pas"), "error"); header('Location:./?controller=media'); exit; } } parent::__construct($doorGets); }
public function doAction() { $out = ''; $this->doorGets->Table = '_dg_links'; // Init langue $lgActuel = $this->doorGets->getLangueTradution(); $moduleInfos = $this->doorGets->moduleInfos($this->doorGets->Uri, $lgActuel); // Init url redirection $redirectUrl = './?controller=module' . $moduleInfos['type'] . '&uri=' . $this->doorGets->Uri . '&lg=' . $lgActuel; // get Content for edit $params = $this->doorGets->Params(); if (array_key_exists('uri', $params['GET'])) { $uri = $params['GET']['uri']; $isContent = $this->doorGets->dbQS($uri, $this->doorGets->Table, 'uri_module', " AND langue = '{$lgActuel}' LIMIT 1"); } $champsObligatoire = array('label', 'link'); if (!empty($this->doorGets->Form->i)) { $this->doorGets->checkMode(); // gestion des champs vide foreach ($this->doorGets->Form->i as $k => $v) { if (empty($v)) { $this->doorGets->Form->e[$this->doorGets->controllerNameNow() . '_edit_' . $k] = 'ok'; } } if (empty($this->doorGets->Form->e)) { $data = array('label' => $this->doorGets->Form->i['label'], 'link' => $this->doorGets->Form->i['link']); $this->doorGets->dbQU($isContent['id'], $data, $this->doorGets->Table); FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); header('Location:' . $redirectUrl); exit; } FlashInfo::set($this->doorGets->__("Veuillez remplir correctement le formulaire"), "error"); } }
public function __construct(&$doorGets) { parent::__construct($doorGets); $User = $doorGets->user; if (empty($doorGets->user)) { header('Location:./?controller=authentification&error-login=true&back=' . urlencode($_SERVER['REQUEST_URI'])); exit; } if (!in_array('support', $doorGets->user['liste_module_interne']) && !in_array('support_client', $doorGets->user['liste_module_interne']) || (in_array('support', $doorGets->user['liste_module_interne']) || in_array('support_client', $doorGets->user['liste_module_interne'])) && SAAS_ENV && !SAAS_SUPPORT) { FlashInfo::set($this->doorGets->__("Vous n'avez pas les droits pour afficher ce module"), "error"); header('Location:./'); exit; } // 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, '_support'); if (empty($isContent)) { FlashInfo::set($this->doorGets->__("Le contenu n'existe pas"), "error"); header('Location:./?controller=support'); exit; $this->isContent = $isContent; } if (!in_array('support', $doorGets->user['liste_module_interne']) && $User['id'] !== $isContent['id_user']) { FlashInfo::set($this->doorGets->__("Vous n'avez pas les droits pour afficher ce ticket"), "error"); header('Location:./?controller=support'); exit; } } }
public function deleteAction() { if (SAAS_ENV && !SAAS_THEME_DELETE) { FlashInfo::set($this->doorGets->__("Vous n'avez pas les droits pour afficher ce module"), "error"); header('Location:./'); exit; } $this->doorGets->Form = new Formulaire('delete_theme'); // Generate the model $this->getRequest(); // return the view return $this->getView(); }
public function __construct(&$doorGets) { parent::__construct($doorGets); if (empty($doorGets->user)) { header('Location:./?controller=authentification&error-login=true&back=' . urlencode($_SERVER['REQUEST_URI'])); exit; } if (!in_array('campagne_email', $doorGets->user['liste_module_interne']) || in_array('campagne_email', $doorGets->user['liste_module_interne']) && SAAS_ENV && !SAAS_NEWSLETTER) { FlashInfo::set($this->doorGets->__("Vous n'avez pas les droits pour afficher ce module"), "error"); header('Location:./'); exit; } }
public function doAction() { $out = ''; // 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)) { header('Location:./?controller=' . $this->doorGets->controllerNameNow()); exit; } } switch ($this->Action) { case 'select': if (!empty($this->doorGets->Form['status']->i)) { $this->doorGets->checkMode(); $data['status'] = $this->doorGets->Form['status']->i['new_status']; $this->doorGets->dbQU($isContent['id'], $data, $this->doorGets->Table); FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); header('Location:' . $_SERVER['REQUEST_URI']); exit; } break; case 'delete': if (!empty($this->doorGets->Form->i)) { $this->doorGets->checkMode(); if (empty($this->doorGets->Form->e)) { $this->doorGets->dbQD($isContent['id'], $this->doorGets->Table); FlashInfo::set($this->doorGets->__("Le commentaire à été corréctement supprimer")); header('Location:./?controller=' . $this->doorGets->controllerNameNow()); exit; } } break; case 'massdelete': if (!empty($this->doorGets->Form['massdelete_index']->i) && isset($this->doorGets->Form['massdelete_index']->i['groupe_delete_index'])) { $this->doorGets->checkMode(); if (empty($this->doorGets->Form['massdelete_index']->e)) { $ListeForDeleted = $this->doorGets->_toArray($this->doorGets->Form['massdelete_index']->i['groupe_delete_index']); foreach ($ListeForDeleted as $id) { $this->doorGets->dbQD($id, $this->doorGets->Table); } FlashInfo::set($this->doorGets->__("Les données sont supprimées")); header('Location:./?controller=' . $this->doorGets->controllerNameNow()); exit; } } break; } }
public function __construct(&$doorGets) { $doorGets->Table = '_order_status'; parent::__construct($doorGets); if (empty($doorGets->user)) { header('Location:./?controller=authentification&error-login=true&back=' . urlencode($_SERVER['REQUEST_URI'])); exit; } if (!in_array('order', $doorGets->user['liste_module_interne'])) { FlashInfo::set($this->doorGets->__("Vous n'avez pas les droits pour afficher ce module"), "error"); header('Location:./'); exit; } }
public function doAction() { $out = ''; $User = $this->doorGets->user; $tableName = '_users_inbox'; $controllerName = 'myinbox'; // 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, $tableName); if (empty($isContent)) { return null; } } switch ($this->Action) { case 'select': if ($isContent['readed'] == '2' && $isContent['id_user'] == $User['id']) { $data['readed'] = 1; $data['date_readed'] = time(); $this->doorGets->dbQU($id, $data, $tableName); } break; case 'delete': $sentUrl = ''; if (!empty($this->doorGets->Form->i)) { $this->doorGets->checkMode(); if (empty($this->doorGets->Form->e)) { $data = array(); if ($isContent['id_user'] == $User['id']) { $data['user_delete'] = 1; $data['date_deleted'] = time(); } if ($isContent['id_user_sent'] == $User['id']) { $data['user_sent_delete'] = 1; $data['date_sent_deleted'] = time(); $sentUrl = '&action=sent'; } if (!empty($data)) { $this->doorGets->dbQU($id, $data, $tableName); FlashInfo::set("Le message à été corréctement supprimer."); header('Location:./?controller=' . $controllerName . $sentUrl); exit; } } } break; } }
public function doAction() { $out = ''; $tableName = '_dg_inbox'; $controllerName = 'inbox'; // 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, $tableName); if (empty($isContent)) { return null; } } switch ($this->Action) { case 'select': if ($isContent['lu'] == '2') { $data['lu'] = 1; $data['date_lu'] = time(); $this->doorGets->dbQU($id, $data, '_dg_inbox'); } break; case 'delete': if (!empty($this->doorGets->Form->i)) { $this->doorGets->checkMode(); if (empty($this->doorGets->Form->e)) { $this->doorGets->dbQD($isContent['id'], $tableName); FlashInfo::set($this->doorGets->__("Le message à été corréctement supprimer")); header('Location:./?controller=' . $controllerName); exit; } } break; case 'massdelete': if (!empty($this->doorGets->Form['massdelete_index']->i) && isset($this->doorGets->Form['massdelete_index']->i['groupe_delete_index'])) { $this->doorGets->checkMode(); if (empty($this->doorGets->Form['massdelete_index']->e)) { $ListeForDeleted = $this->doorGets->_toArray($this->doorGets->Form['massdelete_index']->i['groupe_delete_index']); foreach ($ListeForDeleted as $id) { $this->doorGets->dbQD($id, $tableName); } FlashInfo::set($this->doorGets->__("Les données sont supprimées")); header('Location:./?controller=' . $controllerName); exit; } } break; } }
public function __construct(&$doorGets) { if (empty($doorGets->user)) { header('Location:./?controller=authentification&error-login=true&back=' . urlencode($_SERVER['REQUEST_URI'])); exit; } // Test if $uri module is valid $isUri = array(); $User = $doorGets->user; $params = $doorGets->Params(); $lgActuel = $doorGets->getLangueTradution(); $moduleInfos = $doorGets->moduleInfos($doorGets->Uri, $lgActuel); if (array_key_exists('uri', $params['GET'])) { $uri = $params['GET']['uri']; $isUri = $doorGets->dbQS($uri, '_modules', 'uri'); } $moduleInfos = $doorGets->moduleInfos($doorGets->Uri, $lgActuel); parent::__construct($doorGets); $this->table = '_categories'; $lgActuel = $doorGets->getLangueTradution(); $redirectUrl = './?controller=' . $doorGets->controllerNameNow() . '&uri=' . $this->doorGets->Uri . '&lg=' . $lgActuel; $redirectUrlModule = './?controller=modules&lg=' . $lgActuel; // If isn't valid uri do rediction to modules controller if (!array_key_exists('uri', $params['GET']) || empty($params['GET']['uri']) || empty($this->doorGets->Uri)) { FlashInfo::set($doorGets->__("Le module n'existe pas"), "error"); header('Location:' . $redirectUrlModule); exit; } // get Content for edit / delete if (array_key_exists('id', $params['GET'])) { $id = $params['GET']['id']; $isContent = $doorGets->dbQS($id, $this->table); if (!is_numeric($id)) { $id = '-!-'; } if (empty($isContent)) { FlashInfo::set($doorGets->__("Le contenu n'existe pas"), "error"); header('Location:' . $redirectUrl); exit; } } if (!in_array($moduleInfos['id'], $this->doorGets->user['liste_module_admin'])) { FlashInfo::set($doorGets->l("Vous n'avez pas les droits pour gérer les catégories"), "error"); header('Location:./'); exit; } }
public function __construct(&$doorGets) { if (!is_object($doorGets)) { return null; } $this->doorGets = $doorGets; $this->Params = $doorGets->Params; $this->Action = $doorGets->Action(); $this->zoneArea = $doorGets->zoneArea(); $lgActuel = $doorGets->getLangueTradution(); $redirectUrlModule = './?controller=modules&lg=' . $lgActuel; if (empty($doorGets->user) && $doorGets->controllerNameNow() !== 'authentification') { header('Location:./?controller=authentification&error-login=true&back=' . urlencode($_SERVER['REQUEST_URI'])); exit; } // Test if $uri module is valid $isUri = array(); $params = $doorGets->Params(); if (array_key_exists('uri', $params['GET'])) { $uri = $params['GET']['uri']; $isUri = $doorGets->dbQS($uri, '_modules', 'uri'); if (!empty($isUri)) { $doorGets->Uri = $uri; $doorGets->Table = '_m_' . $this->doorGets->getRealUri($uri); } else { FlashInfo::set($this->doorGets->__("L'URI n'existe pas"), "error"); header('Location:' . $redirectUrlModule); exit; } } else { $moduleWithUri = Constant::$modules; if (in_array($doorGets->controllerNameNow(), $moduleWithUri)) { FlashInfo::set($this->doorGets->__("L'URI est vide"), "error"); header('Location:' . $redirectUrlModule); exit; } } $this->getActionMethod(); $doorGets->setController($this); $doorGets->Categories = $doorGets->loadCategories($doorGets->Uri); $this->doorGets = $doorGets; $doorGets->Content = $this->Content; }
public function __construct(&$doorGets) { $doorGets->Table = '_users_inbox'; parent::__construct($doorGets); $User = $doorGets->user; $params = $doorGets->Params(); $redirectUrl = './?controller=myinbox'; if (empty($User)) { header('Location:./?controller=authentification&error-login=true&back=' . urlencode($_SERVER['REQUEST_URI'])); exit; } if (!in_array('myinbox', $User['liste_module_interne']) || in_array('myinbox', $doorGets->user['liste_module_interne']) && SAAS_ENV && !SAAS_MYINBOX) { FlashInfo::set($this->doorGets->__("Vous n'avez pas les droits pour afficher ce module"), "error"); header('Location:./'); exit; } // get Content for edit / delete if (array_key_exists('id', $params['GET'])) { $id = $params['GET']['id']; $isContent = $doorGets->dbQS($id, $doorGets->Table); if (!is_numeric($id)) { $id = '-!-'; } if (empty($isContent)) { FlashInfo::set($doorGets->l("Le contenu n'existe pas"), "error"); header('Location:' . $redirectUrl); exit; } elseif (!empty($isContent) && $isContent['id_user'] !== $User['id'] && $isContent['id_user_sent'] !== $User['id']) { FlashInfo::set($doorGets->l("Vous ne pouvez pas afficher cette page"), "error"); header('Location:' . $redirectUrl); exit; } elseif (!empty($isContent) && $isContent['id_user'] == $User['id'] && $isContent['user_delete'] != 0) { FlashInfo::set($doorGets->l("Le contenu n'existe pas"), "error"); header('Location:' . $redirectUrl); exit; } elseif (!empty($isContent) && $isContent['id_user_sent'] == $User['id'] && $isContent['user_sent_delete'] != 0) { FlashInfo::set($doorGets->l("Le contenu n'existe pas"), "error"); header('Location:' . $redirectUrl); exit; } } }
public function doAction() { $out = ''; $this->doorGets->Table = '_dg_survey'; // Init langue $lgActuel = $this->doorGets->getLangueTradution(); $moduleInfos = $this->doorGets->moduleInfos($this->doorGets->Uri, $lgActuel); // Init url redirection $redirectUrl = './?controller=module' . $moduleInfos['type'] . '&uri=' . $this->doorGets->Uri . '&lg=' . $lgActuel; // get Content for edit / delete $params = $this->doorGets->Params(); if (array_key_exists('uri', $params['GET'])) { $uri = $params['GET']['uri']; $isContent = $this->doorGets->dbQS($uri, $this->doorGets->Table, 'uri'); if (!empty($isContent)) { if ($lgGroupe = @unserialize($isContent['groupe_traduction'])) { $idLgGroupe = $lgGroupe[$lgActuel]; $isContentTraduction = $this->doorGets->dbQS($idLgGroupe, $this->doorGets->Table . '_traduction'); if (!empty($isContentTraduction)) { unset($isContent['id']); $isContent = $isContent + $isContentTraduction; } } } } $champsObligatoire = array('titre', 'article_tinymce'); if (!empty($this->doorGets->Form->i)) { $this->doorGets->checkMode(); if (empty($this->doorGets->Form->e)) { $data = array('question' => $this->doorGets->Form->i['question'], 'response_a' => $this->doorGets->Form->i['response_a'], 'response_b' => $this->doorGets->Form->i['response_b'], 'response_c' => $this->doorGets->Form->i['response_c'], 'response_d' => $this->doorGets->Form->i['response_d'], 'response_e' => $this->doorGets->Form->i['response_e'], 'response_f' => $this->doorGets->Form->i['response_f'], 'response_g' => $this->doorGets->Form->i['response_g'], 'response_h' => $this->doorGets->Form->i['response_h'], 'response_i' => $this->doorGets->Form->i['response_i']); $data['date_modification'] = time(); $dataContenu['date_modification'] = time(); $this->doorGets->dbQU($isContent['id_survey'], $dataContenu, $this->doorGets->Table); $this->doorGets->dbQU($isContent['id'], $data, $this->doorGets->Table . '_traduction', "id", " AND langue='{$lgActuel}' LIMIT 1 "); //$this->doorGets->clearDBCache(); FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); $this->doorGets->_redirect($redirectUrl); } FlashInfo::set($this->doorGets->__("Veuillez remplir correctement le formulaire"), "error"); } }
public function errorHeaderResponse($message = '', $errors = array()) { $ajax = false; if ($ajax) { $this->_errorJson($message, $errors); } else { FlashInfo::set($message, "error"); } }
public function doAction() { $out = ''; $params = $this->doorGets->Params(); if (array_key_exists('id', $params['GET'])) { $id = $params['GET']['id']; $isContent = $this->doorGets->dbQS($id, '_rubrique'); if (empty($isContent)) { header('Location:./?controller=rubriques'); exit; } } switch ($this->Action) { case 'add': $cResultsInt = $this->doorGets->getCountTable('_rubrique'); if (!empty($this->doorGets->Form->i)) { $this->doorGets->checkMode(); foreach ($this->doorGets->Form->i as $k => $v) { if (empty($v) && $k !== 'idModule') { $this->doorGets->Form->e['rubriques_add_' . $k] = 'ok'; } } if (empty($this->doorGets->Form->e)) { $data['name'] = $this->doorGets->Form->i['name']; $data['ordre'] = $cResultsInt + 1; $data['idModule'] = $this->doorGets->Form->i['idModule']; $data['showinmenu'] = $this->doorGets->Form->i['showinmenu']; $data['date_creation'] = time(); $idContent = $this->doorGets->dbQI($data, '_rubrique'); FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); header('Location:./?controller=rubriques'); exit; } FlashInfo::set($this->doorGets->__("Veuillez remplir correctement le formulaire"), "error"); } break; case 'edit': if (!empty($this->doorGets->Form->i)) { $this->doorGets->checkMode(); foreach ($this->doorGets->Form->i as $k => $v) { if (empty($v) && $k !== 'idModule') { $this->doorGets->Form->e['rubriques_edit_' . $k] = 'ok'; } } if (empty($this->doorGets->Form->e)) { $data = $this->doorGets->Form->i; $data = array('name' => $this->doorGets->Form->i['name'], 'idModule' => $this->doorGets->Form->i['idModule'], 'showinmenu' => $this->doorGets->Form->i['showinmenu']); $this->doorGets->dbQU($isContent['id'], $data, '_rubrique'); FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); //$this->doorGets->clearDBCache(); header('Location:./?controller=rubriques'); exit; } } break; case 'delete': if (!empty($this->doorGets->Form->i) && empty($this->doorGets->Form->e)) { $this->doorGets->checkMode(); $this->doorGets->dbQD($isContent['id'], '_rubrique', 'id'); $this->doorGets->dbQL("UPDATE _rubrique SET ordre = ordre - 1 WHERE ordre > " . $isContent['ordre'] . " "); $this->doorGets->clearModuleDBCache('_rubrique'); FlashInfo::set($this->doorGets->__("Vos informations sont bien supprimées")); header('Location:./?controller=rubriques'); exit; } break; } }
public function doAction() { $out = ''; $tableName = '_dg_saas'; $User = $this->doorGets->user; $controllerName = 'saas'; // 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, $tableName); if (empty($isContent)) { header('Location:./?controller=' . $controllerName); exit; } } switch ($this->Action) { case 'index': break; case 'add': $time = time(); $msgInfo = "Veuillez remplir correctement le formulaire"; if (!empty($this->doorGets->Form->i) && $User['saas_options']['saas_add']) { $this->doorGets->checkMode(); foreach ($this->doorGets->Form->i as $k => $v) { if (empty($v)) { $this->doorGets->Form->e[$controllerName . '_add_' . $k] = 'ok'; } } $subdomaine = strtolower($this->doorGets->Form->i['domain']); $lenSub = strlen($subdomaine); $isDomainExist = $this->doorGets->dbQS($subdomaine, $tableName, 'domain'); if (!empty($isDomainExist) || $lenSub > 16) { $this->doorGets->Form->e[$controllerName . '_add_domain'] = 'ok'; } $isValidDomain = $this->isValidDomain($subdomaine); if (!$isValidDomain && !array_key_exists($controllerName . '_add_domain', $this->doorGets->Form->e)) { $msgInfo = "Cette adresse est déja utilisée"; $this->doorGets->Form->e[$controllerName . '_add_domain'] = 'ok'; } if (empty($this->doorGets->Form->e)) { $saasWebsite = new DgSaasEntity(array(), $this->doorGets); $saasWebsite->setData($this->doorGets->Form->i); $saasWebsite->setDomain($subdomaine); $saasWebsite->setPseudo($User['pseudo']); $saasWebsite->setIdUser($User['id']); $saasWebsite->setIdGroupe($User['groupe']); $saasWebsite->setLangue($this->doorGets->Form->i['language']); $saasWebsite->setTimezone($this->doorGets->Form->i['time_zone']); $saasWebsite->setDateCreation($time); $saasWebsite->setDateModification($time); $saasWebsite->save(); //$isInstalledDatabase = $this->cloneDatabase('d611',$subdomaine); //$isClonedFiles = $this->cloneFiles($subdomaine); $this->installNewWebsite($subdomaine, $saasWebsite, $this->doorGets->Form->i['password'], $this->doorGets->Form->i['language'], $this->doorGets->Form->i['time_zone']); $this->configSaas($subdomaine); FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); header('Location:./?controller=' . $controllerName . '&action=edit&id=' . $saasWebsite->getId()); exit; } FlashInfo::set($this->doorGets->__($msgInfo), "error"); } break; case 'edit': if (!empty($this->doorGets->Form->i)) { $this->doorGets->checkMode(); if (empty($this->doorGets->Form->e)) { FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); header('Location:./?controller=' . $controllerName); exit; } FlashInfo::set($this->doorGets->__("Veuillez remplir correctement le formulaire"), "error"); } break; case 'delete': if (!empty($this->doorGets->Form->i) && $User['saas_options']['saas_delete']) { $this->doorGets->checkMode(); if (empty($this->doorGets->Form->e)) { $saasWebsite = new DgSaasEntity($isContent['id'], $this->doorGets); $saasWebsite->delete(); $this->removeWebsite($isContent['domain']); FlashInfo::set($this->doorGets->__("Le site a été corréctement supprimer")); header('Location:./?controller=' . $controllerName); exit; } } break; } }
public function doAction() { $out = ''; // Init langue $lgActuel = $this->doorGets->getLangueTradution(); $moduleInfos = $this->doorGets->moduleInfos($this->doorGets->Uri, $lgActuel); // Init url redirection $redirectUrl = './?controller=module' . $moduleInfos['type'] . '&uri=' . $this->doorGets->Uri . '&lg=' . $lgActuel; // 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); } } } } $champsNonObligatoire = array('description', 'image', 'meta_titre', 'meta_description', 'meta_keys', 'sendto', 'id_disqus', 'meta_facebook_titre', 'meta_facebook_description', 'meta_facebook_image', 'meta_twitter_titre', 'meta_twitter_description', 'meta_twitter_image', 'meta_twitter_player'); switch ($this->Action) { case 'add': if (!empty($this->doorGets->Form->i)) { $this->doorGets->checkMode(); $cResultsInt = $this->doorGets->getCountTable($this->doorGets->Table); // gestion des champs vide foreach ($this->doorGets->Form->i as $k => $v) { if (!in_array($k, $champsNonObligatoire) && empty($v)) { $this->doorGets->Form->e[$this->doorGets->controllerNameNow() . '_add_' . $k] = 'ok'; } } // validation si aucune erreur if (empty($this->doorGets->Form->e)) { if (!array_key_exists('active', $this->doorGets->Form->i)) { $this->doorGets->Form->i['active'] = 0; } // $data['pseudo'] = $User['pseudo']; $data['id_user'] = $this->doorGets->user['id']; $data['id_groupe'] = $this->doorGets->user['groupe']; $data['ordre'] = $cResultsInt + 1; $data['active'] = $this->doorGets->Form->i['active']; $data['date_creation'] = time(); $idContent = $this->doorGets->dbQI($data, $this->doorGets->Table); // foreach ($this->doorGets->getAllLanguages() as $k => $v) { $dataNext = array(); $dataNext = $this->doorGets->Form->i; unset($dataNext['active']); $dataNext['date_modification'] = $data['date_creation']; $dataNext['id_content'] = $idContent; $dataNext['langue'] = $k; $idTraduction[$k] = $this->doorGets->dbQI($dataNext, $this->doorGets->Table . '_traduction'); } $dataModification['groupe_traduction'] = serialize($idTraduction); $this->doorGets->dbQU($idContent, $dataModification, $this->doorGets->Table); FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); $this->doorGets->_redirect($redirectUrl); } FlashInfo::set($this->doorGets->__("Veuillez remplir correctement le formulaire"), "error"); } break; case 'edit': if (!empty($this->doorGets->Form->i)) { $this->doorGets->checkMode(); $listToCategories = ''; // gestion des champs vide foreach ($this->doorGets->Form->i as $k => $v) { if (!in_array($k, $champsNonObligatoire) && empty($v)) { $this->doorGets->Form->e[$this->doorGets->controllerNameNow() . '_edit_' . $k] = 'ok'; } } if (empty($this->doorGets->Form->e)) { if (!array_key_exists('active', $this->doorGets->Form->i)) { $this->doorGets->Form->i['active'] = 0; } $dataContenu['active'] = $this->doorGets->Form->i['active']; $data = $this->doorGets->Form->i; unset($data['active']); // Update Data $this->doorGets->dbQU($isContent['id_content'], $dataContenu, $this->doorGets->Table); $this->doorGets->dbQU($isContent['id'], $data, $this->doorGets->Table . '_traduction'); FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); $this->doorGets->_redirect(); } FlashInfo::set($this->doorGets->__("Veuillez remplir correctement le formulaire"), "error"); } break; case 'delete': if (!empty($this->doorGets->Form->i)) { $this->doorGets->checkMode(); if (empty($this->doorGets->Form->e)) { $this->doorGets->dbQD($isContent['id'], $this->doorGets->Table); //$this->doorGets->clearDBCache(); FlashInfo::set("Les données sont supprimées."); $this->doorGets->_redirect($redirectUrl); } } break; case 'massdelete': if (!empty($this->doorGets->Form['massdelete_index']->i) && isset($this->doorGets->Form['massdelete_index']->i['groupe_delete_index'])) { $this->doorGets->checkMode(); if (empty($this->doorGets->Form['massdelete_index']->e)) { $ListeForDeleted = $this->doorGets->_toArray($this->doorGets->Form['massdelete_index']->i['groupe_delete_index']); foreach ($ListeForDeleted as $id) { $this->doorGets->dbQD($id, $this->doorGets->Table); } FlashInfo::set("Les données sont supprimées."); $this->doorGets->_redirect($redirectUrl); } } break; } }
public function doAction() { $lgActuel = $this->doorGets->getLangueTradution(); $typeFile["image/png"] = "data/upload/png/"; $typeFile["image/jpeg"] = "data/upload/jpg/"; $typeFile["image/gif"] = "data/upload/gif/"; $typeFile["application/zip"] = "data/upload/zip/"; $typeFile["application/x-zip-compressed"] = "data/upload/xzip/"; $typeFile["application/pdf"] = "data/upload/pdf/"; $typeFile["application/x-shockwave-flash"] = "data/upload/swf/"; $typeExtension["image/png"] = "png"; $typeExtension["image/jpeg"] = "jpg"; $typeExtension["image/gif"] = "gif"; $typeExtension["application/zip"] = "zip"; $typeExtension["application/x-zip-compressed"] = "zip"; $typeExtension["application/pdf"] = "pdf"; $typeExtension["application/x-shockwave-flash"] = "swf"; $typeImage["image/png"] = '<img src="' . BASE_IMG . 'png.png" class="ico_fichier" >'; $typeImage["image/jpeg"] = '<img src="' . BASE_IMG . 'jpg.png" class="ico_fichier" >'; $typeImage["image/gif"] = '<img src="' . BASE_IMG . 'gif.png" class="ico_fichier" >'; $typeImage["application/zip"] = '<img src="' . BASE_IMG . 'zip.png" class="ico_fichier" >'; $typeImage["application/x-zip-compressed"] = '<img src="' . BASE_IMG . 'zip.png" class="ico_fichier" >'; $typeImage["application/pdf"] = '<img src="' . BASE_IMG . 'pdf.png" class="ico_fichier" >'; $typeImage["application/x-shockwave-flash"] = '<img src="' . BASE_IMG . 'swf.png" class="ico_fichier" >'; $this->typeFile = $typeFile; $this->typeExtension = $typeExtension; $this->typeImage = $typeImage; $out = ''; // 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); $this->isContent = $isContent; } } } } switch ($this->Action) { case 'add': if (!empty($this->doorGets->Form->i) && empty($this->doorGets->Form->e)) { $this->doorGets->checkMode(); if (!is_dir(BASE_DATA . 'upload')) { @mkdir(BASE_DATA . 'upload', 0777, true); copy(BASE_DATA . 'index.php', BASE_DATA . 'upload/index.php'); } if (empty($this->doorGets->Form->i['title'])) { FlashInfo::set($this->doorGets->__("Veuillez saisir le nom du fichier"), "error"); $this->doorGets->Form->e['media_add_title'] = 'ok'; } if (isset($_FILES['media_add_path']) && $_FILES['media_add_path']['error'] != 0) { FlashInfo::set($this->doorGets->__("Veuillez importer un fichier valide"), "error"); $this->doorGets->Form->e['media_add_path'] = 'ok'; } if (isset($_FILES['media_add_path']) && empty($this->doorGets->Form->e)) { if (!array_key_exists($_FILES['media_add_path']["type"], $this->typeFile)) { FlashInfo::set($this->doorGets->__("Veuillez importer un fichier valide"), "error"); $this->doorGets->Form->e['media_add_path'] = 'ok'; } if ($_FILES['media_add_path']["size"] > $this->sizeMax) { FlashInfo::set($this->doorGets->__("Votre fichier est trop lourd"), "error"); $this->doorGets->Form->e['media_add_path'] = 'ok'; } } $uri = $this->doorGets->Form->i['uri']; $isValidUri = $this->doorGets->isValidUri($uri, '_dg_files'); if (!$isValidUri) { $this->doorGets->Form->e[$this->doorGets->controllerNameNow() . '_add_uri'] = 'ok'; } if (empty($this->doorGets->Form->e)) { $ttff = $_FILES['media_add_path']["type"]; $sSize = $_FILES['media_add_path']['size']; $ttf = $this->typeExtension[$ttff]; $uni = time() . '-' . uniqid($ttf); if (!is_dir(BASE_DATA . 'upload/' . $ttf)) { @mkdir(BASE_DATA . 'upload/' . $ttf, 0777, true); copy(BASE_DATA . 'index.php', BASE_DATA . 'upload/' . $ttf . '/index.php'); } $nameFileImage = $uni . '-doorgets.' . $ttf; $uploaddir = $this->typeFile[$ttff]; $uploadfile = BASE . $uploaddir . $nameFileImage; if (move_uploaded_file($_FILES['media_add_path']['tmp_name'], $uploadfile)) { $this->doorGets->Form->i['fichier'] = $nameFileImage; } $data['uri'] = $this->doorGets->Form->i['uri']; $data['id_user'] = $this->doorGets->user['id']; $data['id_groupe'] = $this->doorGets->user['groupe']; $data['type'] = $ttff; $data['date_creation'] = time(); $idContent = $this->doorGets->dbQI($data, $this->doorGets->Table); foreach ($this->doorGets->getAllLanguages() as $k => $v) { $dataTraduction['id_file'] = $idContent; $dataTraduction['title'] = $this->doorGets->Form->i['title']; $dataTraduction['path'] = $nameFileImage; $dataTraduction['langue'] = $k; $dataTraduction['size'] = $sSize; $idsTraduction[$k] = $this->doorGets->dbQI($dataTraduction, $this->doorGets->Table . '_traduction'); } $dataModification['groupe_traduction'] = serialize($idsTraduction); $this->doorGets->dbQU($idContent, $dataModification, $this->doorGets->Table); FlashInfo::set($this->doorGets->__("Le fichier a bien été télécharger")); header('Location:./?controller=media&action=select&id=' . $idContent . '&lg=' . $lgActuel); exit; } } break; case 'edit': $error = false; if (!empty($this->doorGets->Form->i)) { $this->doorGets->checkMode(); if (empty($this->doorGets->Form->i['title'])) { FlashInfo::set($this->doorGets->__("Veuillez saisir le nom du fichier"), "error"); $this->doorGets->Form->e['media_edit_title'] = 'ok'; $error = true; } if ($_FILES['media_edit_path']['error'] === 0) { if (isset($_FILES['media_edit_path']) && empty($this->doorGets->Form->e)) { if ($_FILES['media_edit_path']["type"] !== $isContent['type']) { FlashInfo::set($this->doorGets->__("Veuillez importer un fichier du même type"), "error"); $this->doorGets->Form->e['media_edit_path'] = 'ok'; $error = true; } if ($_FILES['media_edit_path']["size"] > $this->sizeMax) { FlashInfo::set($this->doorGets->__("Votre fichier est trop lourd"), "error"); $this->doorGets->Form->e['media_edit_path'] = 'ok'; $error = true; } } } $uri = $this->doorGets->Form->i['uri']; $isValidUri = $this->doorGets->isValidUri($uri, '_dg_files', $isContent); if (!$isValidUri) { $this->doorGets->Form->e[$this->doorGets->controllerNameNow() . '_edit_uri'] = 'ok'; } if (empty($this->doorGets->Form->e)) { $sSize = $isContent['size']; $pathFileImage = $isContent['path']; if ($_FILES['media_edit_path']['error'] === 0) { $ttff = $_FILES['media_edit_path']["type"]; $sSize = $_FILES['media_edit_path']['size']; $ttf = $this->typeExtension[$ttff]; $uni = time() . '-' . uniqid($ttf); $pathFileImage = $uni . '-doorgets.' . $ttf; $uploaddir = $this->typeFile[$ttff]; $uploadfile = BASE . $uploaddir . $pathFileImage; @move_uploaded_file($_FILES['media_edit_path']['tmp_name'], $uploadfile); } $data['uri'] = $this->doorGets->Form->i['uri']; $dataTraduction['title'] = $this->doorGets->Form->i['title']; $dataTraduction['size'] = $sSize; $dataTraduction['path'] = $pathFileImage; $dataTraduction['date_modification'] = time(); $this->doorGets->dbQU($isContent['id_file'], $data, $this->doorGets->Table); $this->doorGets->dbQU($isContent['id'], $dataTraduction, $this->doorGets->Table . '_traduction'); FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); header('Location:./?controller=media&action=select&id=' . $isContent['id_file'] . '&lg=' . $lgActuel); exit; } if (!$error) { FlashInfo::set($this->doorGets->__("Veuillez remplir correctement le formulaire"), "error"); } } break; case 'delete': $urlFile = $isContent['path']; $uploaddir = $this->typeFile[$isContent['type']]; $uploadfile = BASE . $uploaddir . $urlFile; if (!empty($this->doorGets->Form->i)) { $this->doorGets->checkMode(); if (empty($this->doorGets->Form->e)) { $this->doorGets->dbQD($isContent['id_file'], $this->doorGets->Table); $this->doorGets->dbQD($isContent['id_file'], $this->doorGets->Table . '_traduction', 'id_file', '=', ''); if (is_file($uploadfile)) { @unlink($uploadfile); } FlashInfo::set($this->doorGets->__("Le fichier à été corréctement supprimer")); header('Location:./?controller=media'); exit; } } break; case 'massdelete': if (!empty($this->doorGets->Form['massdelete_index']->i) && isset($this->doorGets->Form['massdelete_index']->i['groupe_delete_index'])) { $this->doorGets->checkMode(); if (empty($this->doorGets->Form['massdelete_index']->e)) { $ListeForDeleted = $this->doorGets->_toArray($this->doorGets->Form['massdelete_index']->i['groupe_delete_index']); foreach ($ListeForDeleted as $id) { $isCont = $this->doorGets->dbQS($id, $this->doorGets->Table); if (!empty($isCont)) { $urlFile = $isCont['fichier']; $uploaddir = $this->typeFile[$isCont['type']]; $uploadfile = BASE . $uploaddir . $urlFile; if (is_file($uploadfile)) { @unlink($uploadfile); } } $this->doorGets->dbQD($id, $this->doorGets->Table); $this->doorGets->dbQD($id, $this->doorGets->Table . '_traduction', 'id_file', '=', ''); } FlashInfo::set($this->doorGets->__("Les données sont supprimées")); header('Location:./?controller=' . $this->doorGets->controllerNameNow()); exit; } } break; } }
public function editblockAction() { if (!in_array('module_block', $this->doorGets->user['liste_module_interne']) || in_array('module_block', $this->doorGets->user['liste_module_interne']) && SAAS_ENV && !SAAS_WIDGET_BLOCK) { FlashInfo::set($this->doorGets->__("Vous n'avez pas les droits pour afficher ce module"), "error"); header('Location:./'); exit; } $this->doorGets->Form = new Formulaire('modules_editblock'); // Generate the model $this->getRequest(); // return the view return $this->getView(); }
public function doAction() { $out = ''; $cName = $this->doorGets->controllerNameNow(); $me = $this->doorGets->user; // 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, '_taxes'); } switch ($this->Action) { case 'index': break; case 'add': // Champs du formulaire non obligatoire $noObligatoire = array('taxe_value', 'priority', 'active'); $checkedFields = array(); if (!empty($this->doorGets->Form->i)) { $this->doorGets->checkMode(); foreach ($this->doorGets->Form->i as $k => $v) { if (empty($v) && !in_array($k, $noObligatoire)) { $this->doorGets->Form->e[$this->doorGets->controllerNameNow() . '_add_' . $k] = 'ok'; } } if (empty($this->doorGets->Form->e)) { $this->doorGets->Form->i['percent'] = (double) $this->doorGets->Form->i['percent'] < 100 ? (double) $this->doorGets->Form->i['percent'] : 0.0; $now = time(); $TaxesEntity = new TaxesEntity(null, $this->doorGets); $TaxesEntity->setData($this->doorGets->Form->i); $TaxesEntity->setIdUser($me['id']); $TaxesEntity->setDateCreation($now); $TaxesEntity->setDateModification($now); $TaxesEntity->save(false); $idContent = $TaxesEntity->getId(); FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); header('Location:./?controller=taxes'); exit; } FlashInfo::set($this->doorGets->__("Veuillez remplir correctement le formulaire"), "error"); } break; case 'edit': // Champs du formulaire non obligatoire $noObligatoire = array('taxe_value', 'priority', 'active'); $checkedFields = array(); if (!empty($this->doorGets->Form->i)) { $this->doorGets->checkMode(); foreach ($this->doorGets->Form->i as $k => $v) { if (empty($v) && !in_array($k, $noObligatoire)) { $this->doorGets->Form->e[$this->doorGets->controllerNameNow() . '_add_' . $k] = 'ok'; } } if (empty($this->doorGets->Form->e)) { $this->doorGets->Form->i['percent'] = (double) $this->doorGets->Form->i['percent'] < 100 ? (double) $this->doorGets->Form->i['percent'] : 0.0; $now = time(); $TaxesEntity = new TaxesEntity($isContent['id'], $this->doorGets); $TaxesEntity->setData($this->doorGets->Form->i); $TaxesEntity->setDateModification($now); $TaxesEntity->save(false); FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); header('Location:./?controller=taxes'); exit; } FlashInfo::set($this->doorGets->__("Veuillez remplir correctement le formulaire"), "error"); } break; case 'delete': if (!empty($this->doorGets->Form->i) && empty($this->doorGets->Form->e)) { $this->doorGets->checkMode(); $this->doorGets->dbQD($isContent['id'], '_taxes', 'id', '=', ''); //$this->doorGets->clearDBCache(); FlashInfo::set($this->doorGets->__("Une taxe vient d'être supprimé avec succès")); header('Location:./?controller=taxes'); exit; } break; } return $out; }
public function doAction() { $out = ''; $lgActuel = $this->doorGets->getLangueTradution(); $groupes = $this->doorGets->loadGroupes(); // 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, '_users_groupes_attributes'); if (!empty($isContent)) { if ($lgGroupe = @unserialize($isContent['groupe_traduction'])) { $idLgAttribute = $lgGroupe[$lgActuel]; $isContentTraduction = $this->doorGets->dbQS($idLgAttribute, '_users_groupes_attributes_traduction'); if (!empty($isContentTraduction)) { $isContent = array_merge($isContent, $isContentTraduction); $this->isContent = $isContent; } } } } switch ($this->Action) { case 'index': // to do break; case 'add': // Champs du formulaire non obligatoire $noObligatoire = array('filter', 'filter_select', 'description'); if (!empty($this->doorGets->Form->i)) { $this->doorGets->checkMode(); $paramsAttibute = array(); foreach ($this->doorGets->Form->i as $k => $v) { if (empty($v) && !in_array($k, $noObligatoire)) { $this->doorGets->Form->e[$this->doorGets->controllerNameNow() . '_add_' . $k] = 'ok'; } } $uri = $this->doorGets->Form->i['uri']; $isValidUri = $this->doorGets->isValidUri($uri, '_users_groupes_attributes'); if (!$isValidUri) { $this->doorGets->Form->e[$this->doorGets->controllerNameNow() . '_add_uri'] = 'ok'; } $paramsAttibute['filter'] = 'simple'; $paramsAttibute['filter_file_zip'] = 0; $paramsAttibute['filter_file_png'] = 0; $paramsAttibute['filter_file_jpg'] = 0; $paramsAttibute['filter_file_gif'] = 0; $paramsAttibute['filter_file_swf'] = 0; $paramsAttibute['filter_file_pdf'] = 0; $paramsAttibute['filter_file_doc'] = 0; $paramsAttibute['filter_select'] = ''; $filters = $this->doorGets->getArrayForms('input_filter'); if (array_key_exists('filter', $this->doorGets->Form->i) && $this->doorGets->Form->i['type'] === 'text' && array_key_exists($this->doorGets->Form->i['filter'], $filters)) { $paramsAttibute['filter'] = $this->doorGets->Form->i['filter']; } if ($this->doorGets->Form->i['type'] === 'file') { if (array_key_exists('filter_file_zip', $this->doorGets->Form->i)) { $paramsAttibute['filter_file_zip'] = 1; } if (array_key_exists('filter_file_png', $this->doorGets->Form->i)) { $paramsAttibute['filter_file_png'] = 1; } if (array_key_exists('filter_file_jpg', $this->doorGets->Form->i)) { $paramsAttibute['filter_file_jpg'] = 1; } if (array_key_exists('filter_file_gif', $this->doorGets->Form->i)) { $paramsAttibute['filter_file_gif'] = 1; } if (array_key_exists('filter_file_swf', $this->doorGets->Form->i)) { $paramsAttibute['filter_file_swf'] = 1; } if (array_key_exists('filter_file_pdf', $this->doorGets->Form->i)) { $paramsAttibute['filter_file_pdf'] = 1; } if (array_key_exists('filter_file_doc', $this->doorGets->Form->i)) { $paramsAttibute['filter_file_doc'] = 1; } } if ($this->doorGets->Form->i['type'] !== 'file' && $this->doorGets->Form->i['type'] !== 'text') { $paramsAttibute['filter_select'] = $this->doorGets->_toArray($this->doorGets->Form->i['filter_select']); } $isActived = '2'; if (in_array($this->doorGets->Form->i['active'], array('1', '2'))) { $isActived = $this->doorGets->Form->i['active']; } $isRequired = '2'; if (in_array($this->doorGets->Form->i['required'], array('1', '2'))) { $isRequired = $this->doorGets->Form->i['required']; } if (empty($this->doorGets->Form->e)) { $dataAttributes = array('active' => $isActived, 'required' => $isRequired, 'uri' => $this->doorGets->Form->i['uri'], 'type' => $this->doorGets->Form->i['type'], 'params' => serialize($paramsAttibute), 'date_creation' => time()); $idContent = $this->doorGets->dbQI($dataAttributes, '_users_groupes_attributes'); foreach ($this->doorGets->getAllLanguages() as $k => $v) { $dataTraduction['title'] = $this->doorGets->Form->i['title']; $dataTraduction['description'] = $this->doorGets->Form->i['description']; $dataTraduction['langue'] = $k; $dataTraduction['id_attribute'] = $idContent; $idsTraduction[$k] = $this->doorGets->dbQI($dataTraduction, '_users_groupes_attributes_traduction'); } $dataModification['groupe_traduction'] = serialize($idsTraduction); $this->doorGets->dbQU($idContent, $dataModification, '_users_groupes_attributes'); FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); header('Location:./?controller=attributes&action=edit&id=' . $idContent); exit; } FlashInfo::set($this->doorGets->__("Veuillez remplir correctement le formulaire"), "error"); } break; case 'edit': // Champs du formulaire non obligatoire $noObligatoire = array('filter', 'filter_select', 'description'); if (!empty($this->doorGets->Form->i)) { $this->doorGets->checkMode(); $paramsAttibute = array(); foreach ($this->doorGets->Form->i as $k => $v) { if (empty($v) && !in_array($k, $noObligatoire)) { $this->doorGets->Form->e[$this->doorGets->controllerNameNow() . '_edit_' . $k] = 'ok'; } } $uri = $this->doorGets->Form->i['uri']; $isValidUri = $this->doorGets->isValidUri($uri, '_users_groupes_attributes', $isContent); if (!$isValidUri) { $this->doorGets->Form->e[$this->doorGets->controllerNameNow() . '_edit_uri'] = 'ok'; } $paramsAttibute['filter'] = 'text'; $paramsAttibute['filter_file_zip'] = 0; $paramsAttibute['filter_file_png'] = 0; $paramsAttibute['filter_file_jpg'] = 0; $paramsAttibute['filter_file_gif'] = 0; $paramsAttibute['filter_file_swf'] = 0; $paramsAttibute['filter_file_pdf'] = 0; $paramsAttibute['filter_file_doc'] = 0; $paramsAttibute['filter_select'] = ''; $filters = $this->doorGets->getArrayForms('input_filter'); if (array_key_exists('filter', $this->doorGets->Form->i) && $this->doorGets->Form->i['type'] === 'text' && array_key_exists($this->doorGets->Form->i['filter'], $filters)) { $paramsAttibute['filter'] = $this->doorGets->Form->i['filter']; } if ($this->doorGets->Form->i['type'] === 'file') { if (array_key_exists('filter_file_zip', $this->doorGets->Form->i)) { $paramsAttibute['filter_file_zip'] = 1; } if (array_key_exists('filter_file_png', $this->doorGets->Form->i)) { $paramsAttibute['filter_file_png'] = 1; } if (array_key_exists('filter_file_jpg', $this->doorGets->Form->i)) { $paramsAttibute['filter_file_jpg'] = 1; } if (array_key_exists('filter_file_gif', $this->doorGets->Form->i)) { $paramsAttibute['filter_file_gif'] = 1; } if (array_key_exists('filter_file_swf', $this->doorGets->Form->i)) { $paramsAttibute['filter_file_swf'] = 1; } if (array_key_exists('filter_file_pdf', $this->doorGets->Form->i)) { $paramsAttibute['filter_file_pdf'] = 1; } if (array_key_exists('filter_file_doc', $this->doorGets->Form->i)) { $paramsAttibute['filter_file_doc'] = 1; } } if ($this->doorGets->Form->i['type'] !== 'file' && $this->doorGets->Form->i['type'] !== 'text') { $paramsAttibute['filter_select'] = $this->doorGets->_toArray($this->doorGets->Form->i['filter_select']); } $isActived = '2'; if (in_array($this->doorGets->Form->i['active'], array('1', '2'))) { $isActived = $this->doorGets->Form->i['active']; } $isRequired = '2'; if (in_array($this->doorGets->Form->i['required'], array('1', '2'))) { $isRequired = $this->doorGets->Form->i['required']; } if (empty($this->doorGets->Form->e)) { $dataAttributes = array('active' => $isActived, 'required' => $isRequired, 'uri' => $this->doorGets->Form->i['uri'], 'type' => $this->doorGets->Form->i['type'], 'params' => serialize($paramsAttibute)); $dataTraduction = array('title' => $this->doorGets->Form->i['title'], 'description' => $this->doorGets->Form->i['description']); $this->doorGets->dbQU($isContent['id_attribute'], $dataAttributes, '_users_groupes_attributes'); if (!empty($idLgAttribute)) { $this->doorGets->dbQU($idLgAttribute, $dataTraduction, '_users_groupes_attributes_traduction'); } FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); //$this->doorGets->clearDBCache(); $redirectUrl = './?controller=attributes&action=edit&id=' . $isContent['id_attribute'] . '&lg=' . $lgActuel; header('Location:' . $redirectUrl); exit; } FlashInfo::set($this->doorGets->__("Veuillez remplir correctement le formulaire"), "error"); } break; case 'delete': if (!empty($this->doorGets->Form->i) && empty($this->doorGets->Form->e)) { $this->doorGets->checkMode(); $this->doorGets->dbQD($isContent['id_attribute'], '_users_groupes_attributes', 'id', '=', ''); $this->doorGets->dbQD($isContent['id_attribute'], '_users_groupes_attributes_traduction', 'id_attribute', '=', ''); //$this->doorGets->clearDBCache(); FlashInfo::set("Un attribut vient d'être supprimé avec succès"); header('Location:./?controller=attributes'); exit; } break; } return $out; }
public function doAction() { $out = ''; $lgActuel = $this->doorGets->getLangueTradution(); $arrayFilter = array(); $idLgGroupe = ''; $Attributes = $this->doorGets->loadAttributes(); $groupes = $this->doorGets->loadGroupes(); $modules = $this->doorGets->loadModules(); // 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, '_users_groupes'); if (!empty($isContent)) { $arrayFilter[] = array('key' => 'network', 'type' => '=', 'value' => $isContent['id']); if ($lgGroupe = @unserialize($isContent['groupe_traduction'])) { $idLgGroupe = $lgGroupe[$this->doorGets->getLangueTradution()]; $isContentTraduction = $this->doorGets->dbQS($idLgGroupe, '_users_groupes_traduction'); if (!empty($isContentTraduction)) { $isContent = array_merge($isContent, $isContentTraduction); $this->isContent = $isContent; } } } } $cUsers = $this->doorGets->getCountTable('_users_info', $arrayFilter); $cModules = count($modules); if (!empty($isContent)) { $activeWidgets = $this->doorGets->_toArray($isContent['liste_widget']); $activeModules = $this->doorGets->_toArray($isContent['liste_module']); $activeModulesLimit = $this->doorGets->_toArrayKeys($isContent['liste_module_limit']); $activeModulesList = $this->doorGets->_toArray($isContent['liste_module_list']); $activeModulesShow = $this->doorGets->_toArray($isContent['liste_module_show']); $activeModulesAdd = $this->doorGets->_toArray($isContent['liste_module_add']); $activeModulesEdit = $this->doorGets->_toArray($isContent['liste_module_edit']); $activeModulesDelete = $this->doorGets->_toArray($isContent['liste_module_delete']); $activeModulesModo = $this->doorGets->_toArray($isContent['liste_module_modo']); $activeModulesInterne = $this->doorGets->_toArray($isContent['liste_module_interne']); $activeModulesInterneModo = $this->doorGets->_toArray($isContent['liste_module_interne_modo']); $activeGroupesEnfants = $this->doorGets->_toArray($isContent['liste_enfant']); $activeGroupesEnfantsModo = $this->doorGets->_toArray($isContent['liste_enfant_modo']); $activeGroupesParents = $this->doorGets->_toArray($isContent['liste_parent']); $iEnfant = count($activeGroupesEnfants); $iParent = count($activeGroupesParents); } $modulesInterne['file'] = $this->doorGets->__("Fichier"); $subModule = $this->doorGets->getArrayForms('sub_module'); $cUsers = $this->doorGets->getCountTable('_users_info', $arrayFilter); $listeModulesInterne = $listeModules = $listeGroupesEnfants = ''; $listeModulesAdmin = ''; $listeModulesInterneModo = $listeModulesModo = $listeModulesList = $listeModulesShow = ''; $listeModulesAdd = $listeModulesEdit = $listeModulesDelete = $listeGroupesEnfantsModo = ''; $listeModulesLimit = $subName = $listeWidgets = ''; $listeWidgetsLimit = $listeWidgetsModo = ''; $_attributes = array(); $nonObligatoire = array('payment', 'payment_amount_month', 'payment_tranche', 'payment_group_expired', 'payment_group_upgrade'); switch ($this->Action) { case 'index': // to do break; case 'add': if (!empty($this->doorGets->Form->i)) { foreach ($this->doorGets->Form->i as $k => $v) { $subNameHidden = substr($k, 0, 21); $subNameHiddenWidget = substr($k, 0, 24); if (empty($v) && $k !== 'attributes' && $k !== 'can_subscribe' && $subNameHidden !== 'module_doorgets_limit' && $subNameHidden !== 'widget_doorgets_limit' && $subNameHiddenWidget !== 'widget_doorgets_can_modo' && !in_array($k, $nonObligatoire)) { $this->doorGets->Form->e[$this->doorGets->controllerNameNow() . '_add_' . $k] = 'ok'; } if (!array_key_exists($v, $subModule) && $subNameHidden !== 'module_doorgets_limit') { $subName = substr($k, 0, 15); if ($subName === 'modules_interne') { $listeModulesInterne .= $v . ','; if (array_key_exists($this->doorGets->controllerNameNow() . '_add_modules_interne_can_modo_' . $v, $params['POST'])) { $listeModulesInterneModo .= $v . ','; } } elseif ($subName === 'module_doorgets') { $isModuleChecked = array_key_exists('module_doorgets_' . $v, $this->doorGets->Form->i) ? true : false; if (!$isModuleChecked) { continue; } $listeModules .= $v . ','; $numberLimit = 0; if (array_key_exists('module_doorgets_limit_' . $v, $this->doorGets->Form->i) && is_numeric($this->doorGets->Form->i['module_doorgets_limit_' . $v])) { $numberLimit = (int) $this->doorGets->Form->i['module_doorgets_limit_' . $v]; } $listeModulesLimit .= $v . '|' . $numberLimit . ','; if (array_key_exists($this->doorGets->controllerNameNow() . '_add_module_doorgets_can_modo_' . $v, $params['POST'])) { $listeModulesModo .= $v . ','; } if (array_key_exists($this->doorGets->controllerNameNow() . '_add_module_doorgets_can_list_' . $v, $params['POST'])) { $listeModulesList .= $v . ','; } if (array_key_exists($this->doorGets->controllerNameNow() . '_add_module_doorgets_can_show_' . $v, $params['POST'])) { $listeModulesShow .= $v . ','; } if (array_key_exists($this->doorGets->controllerNameNow() . '_add_module_doorgets_can_add_' . $v, $params['POST'])) { $listeModulesAdd .= $v . ','; } if (array_key_exists($this->doorGets->controllerNameNow() . '_add_module_doorgets_can_edit_' . $v, $params['POST'])) { $listeModulesEdit .= $v . ','; } if (array_key_exists($this->doorGets->controllerNameNow() . '_add_module_doorgets_can_delete_' . $v, $params['POST'])) { $listeModulesDelete .= $v . ','; } if (array_key_exists($this->doorGets->controllerNameNow() . '_add_module_doorgets_can_admin_' . $v, $params['POST'])) { $listeModulesAdmin .= $v . ','; } } elseif ($subName === 'widget_doorgets') { $listeWidgets .= $v . ','; $numberLimit = 0; $valueLimit = 'widget_doorgets_limit_' . $v; if (array_key_exists($valueLimit, $this->doorGets->Form->i) && is_numeric($this->doorGets->Form->i[$valueLimit])) { $numberLimit = (int) $this->doorGets->Form->i['widget_doorgets_limit_' . $v]; } $listeWidgetsLimit .= $v . '|' . $numberLimit . ','; if (array_key_exists($this->doorGets->controllerNameNow() . '_edit_widget_doorgets_can_modo_' . $v, $params['POST'])) { $listeWidgetsModo .= $v . ','; } } elseif ($subName === 'groupes_enfants') { $listeGroupesEnfants .= $v . ','; if (array_key_exists($this->doorGets->controllerNameNow() . '_add_groupes_enfants_can_modo_' . $v, $params['POST'])) { $listeGroupesEnfantsModo .= $v . ','; } } } } if (!array_key_exists('editor_ckeditor', $this->doorGets->Form->i)) { $this->doorGets->Form->i['editor_ckeditor'] = 0; } else { $this->doorGets->Form->i['editor_ckeditor'] = 1; } if (!array_key_exists('editor_tinymce', $this->doorGets->Form->i)) { $this->doorGets->Form->i['editor_tinymce'] = 0; } else { $this->doorGets->Form->i['editor_tinymce'] = 1; } if (!array_key_exists('payment', $this->doorGets->Form->i)) { $this->doorGets->Form->i['payment'] = 0; } else { $this->doorGets->Form->i['payment'] = 1; } $uri = $this->doorGets->Form->i['uri']; $isValidUri = $this->doorGets->isValidUri($uri, '_users_groupes'); if (!$isValidUri) { $this->doorGets->Form->e[$this->doorGets->controllerNameNow() . '_add_uri'] = 'ok'; } $_attributes = explode(',', $this->doorGets->Form->i['attributes']); foreach ($_attributes as $key => $value) { if (empty($value) || !array_key_exists($value, $Attributes)) { unset($_attributes[$key]); } } if (empty($this->doorGets->Form->e)) { $data = array('uri' => $this->doorGets->Form->i['uri'], 'can_subscribe' => $this->doorGets->Form->i['can_subscribe'], 'liste_widget' => $listeWidgets, 'liste_module' => $listeModules, 'liste_module_limit' => $listeModulesLimit, 'liste_module_admin' => $listeModulesAdmin, 'liste_module_modo' => $listeModulesModo, 'liste_module_list' => $listeModulesList, 'liste_module_show' => $listeModulesShow, 'liste_module_add' => $listeModulesAdd, 'liste_module_edit' => $listeModulesEdit, 'liste_module_delete' => $listeModulesDelete, 'liste_module_interne' => $listeModulesInterne, 'liste_module_interne_modo' => $listeModulesInterneModo, 'liste_enfant' => $listeGroupesEnfants, 'liste_enfant_modo' => $listeGroupesEnfantsModo, 'editor_ckeditor' => $this->doorGets->Form->i['editor_ckeditor'], 'editor_tinymce' => $this->doorGets->Form->i['editor_tinymce'], 'attributes' => serialize($_attributes), 'date_creation' => time()); $idContent = $this->doorGets->dbQI($data, '_users_groupes'); foreach ($this->doorGets->getAllLanguages() as $k => $v) { $dataTraduction['title'] = $this->doorGets->Form->i['title']; $dataTraduction['description'] = $this->doorGets->Form->i['description']; $dataTraduction['langue'] = $k; $dataTraduction['id_groupe'] = $idContent; $idsTraduction[$k] = $this->doorGets->dbQI($dataTraduction, '_users_groupes_traduction'); } $dataModification['groupe_traduction'] = serialize($idsTraduction); $this->doorGets->dbQU($idContent, $dataModification, '_users_groupes'); foreach ($groupes as $k => $v) { if (array_key_exists('groupes_enfants_' . $k, $this->doorGets->Form->i)) { $this->doorGets->updateNewListToParent('_users_groupes', $k, $idContent, 'add'); } else { $this->doorGets->updateNewListToParent('_users_groupes', $k, $idContent, 'delete'); } } $this->addGroupeToChildrenList($idContent); FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); //$this->doorGets->clearDBCache(); header('Location:./?controller=groupes'); exit; } FlashInfo::set($this->doorGets->__("Veuillez remplir correctement le formulaire"), "error"); } break; case 'edit': if (!empty($this->doorGets->Form->i)) { foreach ($this->doorGets->Form->i as $k => $v) { if (!empty($v)) { $subNameHidden = substr($k, 0, 21); if (empty($v) && $k !== 'can_subscribe' && $subNameHidden !== 'module_doorgets_limit' && !in_array($k, $nonObligatoire)) { $this->doorGets->Form->e[$this->doorGets->controllerNameNow() . '_edit_' . $k] = 'ok'; } if (!array_key_exists($v, $subModule) && $subNameHidden !== 'module_doorgets_limit') { $subName = substr($k, 0, 15); if ($subName === 'modules_interne') { $listeModulesInterne .= $v . ','; if (array_key_exists($this->doorGets->controllerNameNow() . '_edit_modules_interne_can_modo_' . $v, $params['POST'])) { $listeModulesInterneModo .= $v . ','; } } elseif ($subName === 'module_doorgets' && is_numeric($v)) { $listeModules .= $v . ','; $numberLimit = 0; if (array_key_exists('module_doorgets_limit_' . $v, $this->doorGets->Form->i) && is_numeric($this->doorGets->Form->i['module_doorgets_limit_' . $v])) { $numberLimit = (int) $this->doorGets->Form->i['module_doorgets_limit_' . $v]; } $listeModulesLimit .= $v . '|' . $numberLimit . ','; if (array_key_exists($this->doorGets->controllerNameNow() . '_edit_module_doorgets_can_modo_' . $v, $params['POST'])) { $listeModulesModo .= $v . ','; } if (array_key_exists($this->doorGets->controllerNameNow() . '_edit_module_doorgets_can_list_' . $v, $params['POST'])) { $listeModulesList .= $v . ','; } if (array_key_exists($this->doorGets->controllerNameNow() . '_edit_module_doorgets_can_show_' . $v, $params['POST'])) { $listeModulesShow .= $v . ','; } if (array_key_exists($this->doorGets->controllerNameNow() . '_edit_module_doorgets_can_add_' . $v, $params['POST'])) { $listeModulesAdd .= $v . ','; } if (array_key_exists($this->doorGets->controllerNameNow() . '_edit_module_doorgets_can_edit_' . $v, $params['POST'])) { $listeModulesEdit .= $v . ','; } if (array_key_exists($this->doorGets->controllerNameNow() . '_edit_module_doorgets_can_delete_' . $v, $params['POST'])) { $listeModulesDelete .= $v . ','; } if (array_key_exists($this->doorGets->controllerNameNow() . '_edit_module_doorgets_can_admin_' . $v, $params['POST'])) { $listeModulesAdmin .= $v . ','; } } elseif ($subName === 'widget_doorgets') { $listeWidgets .= $v . ','; $numberLimit = 0; if (is_numeric($this->doorGets->Form->i['widget_doorgets_limit_' . $v])) { $numberLimit = (int) $this->doorGets->Form->i['widget_doorgets_limit_' . $v]; } $listeWidgetsLimit .= $v . '|' . $numberLimit . ','; if (array_key_exists($this->doorGets->controllerNameNow() . '_edit_widget_doorgets_can_modo_' . $v, $params['POST'])) { $listeWidgetsModo .= $v . ','; } } elseif ($subName === 'groupes_enfants') { $listeGroupesEnfants .= $v . ','; if (array_key_exists($this->doorGets->controllerNameNow() . '_edit_groupes_enfants_can_modo_' . $v, $params['POST'])) { $listeGroupesEnfantsModo .= $v . ','; } } } } } if (!array_key_exists('editor_ckeditor', $this->doorGets->Form->i)) { $this->doorGets->Form->i['editor_ckeditor'] = 0; } else { $this->doorGets->Form->i['editor_ckeditor'] = 1; } if (!array_key_exists('editor_tinymce', $this->doorGets->Form->i)) { $this->doorGets->Form->i['editor_tinymce'] = 0; } else { $this->doorGets->Form->i['editor_tinymce'] = 1; } if (!array_key_exists('payment', $this->doorGets->Form->i)) { $this->doorGets->Form->i['payment'] = 0; } else { $this->doorGets->Form->i['payment'] = 1; } $uri = $this->doorGets->Form->i['uri']; $isValidUri = $this->doorGets->isValidUri($uri, '_users_groupes_attributes', $isContent); if (!$isValidUri) { $this->doorGets->Form->e[$this->doorGets->controllerNameNow() . '_edit_uri'] = 'ok'; } $_attributes = explode(',', $this->doorGets->Form->i['attributes']); foreach ($_attributes as $key => $value) { if (empty($value) || !array_key_exists($value, $Attributes)) { unset($_attributes[$key]); } } if (empty($this->doorGets->Form->e)) { $data = array('uri' => $this->doorGets->Form->i['uri'], 'can_subscribe' => $this->doorGets->Form->i['can_subscribe'], 'liste_widget' => $listeWidgets, 'liste_module' => $listeModules, 'liste_module_limit' => $listeModulesLimit, 'liste_module_admin' => $listeModulesAdmin, 'liste_module_modo' => $listeModulesModo, 'liste_module_list' => $listeModulesList, 'liste_module_show' => $listeModulesShow, 'liste_module_add' => $listeModulesAdd, 'liste_module_edit' => $listeModulesEdit, 'liste_module_delete' => $listeModulesDelete, 'liste_module_interne' => $listeModulesInterne, 'liste_module_interne_modo' => $listeModulesInterneModo, 'liste_enfant' => $listeGroupesEnfants, 'liste_enfant_modo' => $listeGroupesEnfantsModo, 'editor_ckeditor' => $this->doorGets->Form->i['editor_ckeditor'], 'editor_tinymce' => $this->doorGets->Form->i['editor_tinymce'], 'attributes' => serialize($_attributes)); $dataTraduction = array('title' => $this->doorGets->Form->i['title'], 'description' => $this->doorGets->Form->i['description']); foreach ($groupes as $k => $v) { if (array_key_exists('groupes_enfants_' . $k, $this->doorGets->Form->i)) { $this->doorGets->updateNewListToParent('_users_groupes', $k, $isContent['id_groupe'], 'add'); } else { $this->doorGets->updateNewListToParent('_users_groupes', $k, $isContent['id_groupe'], 'delete'); } } $this->doorGets->dbQU($isContent['id_groupe'], $data, '_users_groupes', 'id'); if (!empty($idLgGroupe)) { $this->doorGets->dbQU($idLgGroupe, $dataTraduction, '_users_groupes_traduction'); } FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); //$this->doorGets->clearDBCache(); $redirectUrl = './?controller=groupes&action=edit&id=' . $isContent['id_groupe'] . '&lg=' . $this->doorGets->getLangueTradution(); header('Location:' . $redirectUrl); exit; } } break; case 'delete': if (!empty($this->doorGets->Form->i) && empty($this->doorGets->Form->e) && $cUsers == 0) { $this->doorGets->dbQD($isContent['id_groupe'], '_users_groupes'); $this->doorGets->dbQD($isContent['id_groupe'], '_users_groupes_traduction', 'id_groupe', '=', ''); FlashInfo::set("Vos informations sont bien supprimées"); header('Location:./?controller=groupes'); exit; } break; } return $out; }
public function doAction() { try { $out = ''; $cName = $this->doorGets->controllerNameNow(); // Init langue $lgActuel = $this->doorGets->getLangueTradution(); $moduleInfos = $this->doorGets->moduleInfos($this->doorGets->Uri, $lgActuel); $User = $this->doorGets->user; // Check if is content modo $is_modo = in_array($moduleInfos['id'], $User['liste_module_modo']) ? true : 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 $user_can_edit = in_array($moduleInfos['id'], $User['liste_module_edit']) ? true : false; // check if user can delete content $user_can_delete = in_array($moduleInfos['id'], $User['liste_module_delete']) ? true : false; // Init url redirection $redirectUrl = './?controller=module' . $moduleInfos['type'] . '&uri=' . $this->doorGets->Uri . '&lg=' . $lgActuel; // 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(''); $messageSuccess = $this->doorGets->__("Vos informations ont bien été mises à jour"); switch ($this->Action) { case 'add': $this->doorGets->checkMode(); if (!empty($this->doorGets->Form->i)) { $cResultsInt = $this->doorGets->getCountTable($this->doorGets->Table); // 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'; } } $var = $this->doorGets->Form->i['url']; $varUrl = filter_var($var, FILTER_VALIDATE_URL); if (empty($varUrl)) { $this->doorGets->Form->e[$cName . '_add_url'] = 'ok'; } // validation si aucune erreur if (empty($this->doorGets->Form->e)) { if (!array_key_exists('active', $this->doorGets->Form->i)) { $this->doorGets->Form->i['active'] = 0; } // $data['pseudo'] = $User['pseudo']; $data['id_user'] = $this->doorGets->user['id']; $data['id_groupe'] = $this->doorGets->user['groupe']; $data['ordre'] = $cResultsInt + 1; $data['active'] = !$is_modo ? 3 : $this->doorGets->Form->i['active']; $data['date_creation'] = time(); $idContent = $this->doorGets->dbQI($data, $this->doorGets->Table); // foreach ($this->doorGets->getAllLanguages() as $k => $v) { $dataNext = array('image' => $this->doorGets->Form->i['image'], 'titre' => $this->doorGets->Form->i['titre'], 'description' => $this->doorGets->Form->i['description'], 'url' => $this->doorGets->Form->i['url']); $dataNext['date_modification'] = $data['date_creation']; $dataNext['id_content'] = $idContent; $dataNext['langue'] = $k; $idTraduction[$k] = $this->doorGets->dbQI($dataNext, $this->doorGets->Table . '_traduction'); } // Copy image to real path $this->doorGets->copyFileToRealPath($this->doorGets->Uri, $this->doorGets->Form->i['image']); $dataModification['groupe_traduction'] = serialize($idTraduction); $this->doorGets->dbQU($idContent, $dataModification, $this->doorGets->Table); // 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('partner')->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"); } $this->doorGets->successHeaderResponse($messageSuccess, $redirectUrl); } $this->doorGets->errorHeaderResponse($this->doorGets->__("Veuillez remplir correctement le formulaire"), $this->doorGets->Form->e); } break; case 'edit': if (!empty($this->doorGets->Form->i)) { $this->doorGets->checkMode(); $listToCategories = ''; // gestion des champs vide foreach ($this->doorGets->Form->i as $k => $v) { if (!in_array($k, $champsNonObligatoire) && $k !== 'image' && empty($v)) { $this->doorGets->Form->e[$cName . '_edit_' . $k] = 'ok'; } } if (empty($this->doorGets->Form->i['image'])) { $this->doorGets->Form->i['image'] = $isContent['image']; } if (empty($this->doorGets->Form->e)) { // Copy image to real path $this->doorGets->copyFileToRealPath($this->doorGets->Uri, $this->doorGets->Form->i['image']); $dataContenu['active'] = !$is_modo ? 3 : $this->doorGets->Form->i['active']; $dataTraduction = array('image' => $this->doorGets->Form->i['image'], 'titre' => $this->doorGets->Form->i['titre'], 'description' => $this->doorGets->Form->i['description'], 'url' => $this->doorGets->Form->i['url']); $dataVersion = $dataTraduction; $dataVersion['active'] = $this->doorGets->Form->i['active']; $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('blog')->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)) { $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'] . " "); // 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(); FlashInfo::set($this->doorGets->__("Les données sont supprimées")); $this->doorGets->_redirect($redirectUrl); } } break; } } catch (Exception $e) { } }
public function doAction() { $out = ''; $lgActuel = $this->doorGets->getLangueTradution(); // 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, '_modules'); if (empty($isContent)) { header('Location:./?controller=modules'); exit; } if (!empty($isContent)) { $lgGroupe = @unserialize($isContent['groupe_traduction']); $idLgGroupe = $lgGroupe[$lgActuel]; $isContentTraduction = $this->doorGets->dbQS($idLgGroupe, '_modules_traduction'); if (!empty($isContentTraduction)) { unset($isContentTraduction['id']); $isContent = array_merge($isContent, $isContentTraduction); } else { $isContentTraductionTemp = $this->doorGets->dbQS($this->doorGets->configWeb['langue_front'], '_modules_traduction', 'langue'); unset($isContentTraductionTemp['id']); $isContentTraductionTemp['langue'] = $lgActuel; $idNewContent = $this->doorGets->dbQI($isContentTraductionTemp, '_modules_traduction'); $lgGroupe[$lgActuel] = $idNewContent; $sLgGroupe['groupe_traduction'] = serialize($lgGroupe); $this->doorGets->dbQU($id, $sLgGroupe, $this->doorGets->table); $isContentTraduction = $this->doorGets->dbQS($idLgGroupe, '_modules_traduction'); $isContent = array_merge($isContent, $isContentTraduction); } } } $cResultsInt = $this->doorGets->getCountTable('_rubrique'); $nonObligatoire = array('description', 'top_tinymce', 'bottom_tinymce', 'image', 'meta_titre', 'meta_description', 'meta_keys', 'meta_facebook_titre', 'meta_facebook_description', 'meta_facebook_image', 'meta_twitter_titre', 'meta_twitter_description', 'meta_twitter_image', 'meta_twitter_player', 'uri_notification_moderator', 'uri_notification_user_success', 'uri_notification_user_error', 'password'); switch ($this->Action) { case 'addgenform': $Form = $this->doorGets->Form->i; $Obligatoire = array('titre', 'uri', 'send_mail_to'); if (!empty($Form)) { $this->doorGets->checkMode(); $dataForm = $this->getArraysForm(); foreach ($Form as $k => $v) { if (empty($v) && in_array($k, $Obligatoire)) { $this->doorGets->Form->e['modules_addgenform_' . $k] = 'ok'; } } // gestion de l'url if (!empty($this->doorGets->Form->i['redirection'])) { $var = $this->doorGets->Form->i['redirection']; $isUrl = filter_var($var, FILTER_VALIDATE_URL); if (empty($isUrl)) { $this->doorGets->Form->e['modules_addgenform_redirection'] = 'ok'; } } // gestion de l'uri $Form['uri'] = $uri = strtolower($Form['uri']); $isValidUri = $this->doorGets->isValidUri($uri, '_modules'); if (!$isValidUri) { $this->doorGets->Form->e['modules_addgenform_uri'] = 'ok'; } if (strtolower($Form['uri']) === 'doorgets') { $this->doorGets->Form->e['modules_addgenform_uri'] = 'ok'; } if (empty($dataForm)) { $this->doorGets->Form->e['modules_addgenform_dataform'] = 'ok'; } if (empty($this->doorGets->Form->e)) { if (!array_key_exists('active', $Form)) { $Form['active'] = 0; } if (!array_key_exists('send_mail', $Form)) { $Form['send_mail'] = 0; } if (!array_key_exists('recaptcha', $Form)) { $Form['recaptcha'] = 0; } $data['uri'] = $Form['uri']; $data['type'] = 'genform'; $data['active'] = $Form['active']; $data['notification_mail'] = $Form['send_mail']; $data['extras'] = serialize($dataForm); $data['redirection'] = $Form['redirection']; $data['recaptcha'] = $Form['recaptcha']; $data['date_creation'] = time(); $idModule = $this->doorGets->dbQI($data, '_modules'); $dataNext = array('titre' => $this->doorGets->Form->i['titre']); foreach ($this->doorGets->getAllLanguages() as $k => $v) { $dataNext['id_module'] = $idModule; $dataNext['langue'] = $k; $dataNext['extras'] = serialize($dataForm); $dataNext['date_modification'] = time(); $idTraduction[$k] = $this->doorGets->dbQI($dataNext, '_modules_traduction'); } $dataModification['groupe_traduction'] = serialize($idTraduction); $this->doorGets->dbQU($idModule, $dataModification, '_modules'); $this->doorGets->dbQL($this->createGenformInstance($data['uri'], $dataForm)); $this->addModuleToGroupeList($idModule, 'widget'); FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); header('Location:./?controller=modules'); exit; } FlashInfo::set($this->doorGets->__("Veuillez remplir correctement le formulaire"), "error"); } break; case 'addblock': $Form = $this->doorGets->Form->i; if (!empty($Form)) { $this->doorGets->checkMode(); foreach ($Form as $k => $v) { if (empty($v) && !in_array($k, $nonObligatoire)) { $this->doorGets->Form->e['modules_addblock_' . $k] = 'ok'; } } // gestion de l'uri $Form['uri'] = $uri = strtolower($Form['uri']); $isValidUri = $this->doorGets->isValidUri($uri, '_modules'); if (!$isValidUri) { $this->doorGets->Form->e['modules_addblock_uri'] = 'ok'; } if (strtolower($Form['uri']) === 'doorgets') { $this->doorGets->Form->e['modules_addblock_uri'] = 'ok'; } if (empty($this->doorGets->Form->e)) { if (!array_key_exists('active', $Form)) { $Form['active'] = 0; } $data['uri'] = $Form['uri']; $data['type'] = 'block'; $data['active'] = $Form['active']; $data['date_creation'] = time(); $idModule = $this->doorGets->dbQI($data, '_modules'); $dataNext = array('titre' => $Form['titre']); foreach ($this->doorGets->getAllLanguages() as $k => $v) { $dataNext['id_module'] = $idModule; $dataNext['langue'] = $k; $dataNext['date_modification'] = time(); $idTraduction[$k] = $this->doorGets->dbQI($dataNext, '_modules_traduction'); } $dataModification['groupe_traduction'] = serialize($idTraduction); $this->doorGets->dbQU($idModule, $dataModification, '_modules'); $this->createBlockInstance($data['uri'], $Form['titre']); $this->addModuleToGroupeList($idModule, 'widget'); FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); header('Location:./?controller=moduleblock&uri=' . $Form['uri']); exit; } FlashInfo::set($this->doorGets->__("Veuillez remplir correctement le formulaire"), "error"); } break; case 'addpage': $Form = $this->doorGets->Form->i; $defaultTemplateIndex = 'modules/page/page_content.tpl.php'; if (!empty($Form)) { $this->doorGets->checkMode(); foreach ($Form as $k => $v) { if (empty($v) && !in_array($k, $nonObligatoire)) { $this->doorGets->Form->e['modules_addpage_' . $k] = 'ok'; } } // gestion de l'uri $Form['uri'] = $uri = strtolower($Form['uri']); $isValidUri = $this->doorGets->isValidUri($uri, '_modules'); if (!$isValidUri) { $this->doorGets->Form->e['modules_addpage_uri'] = 'ok'; } if (strtolower($Form['uri']) === 'doorgets') { $this->doorGets->Form->e['modules_addpage_uri'] = 'ok'; } if (empty($this->doorGets->Form->e)) { if (!array_key_exists('active', $Form)) { $Form['active'] = 0; } if (!array_key_exists('notification_mail', $Form)) { $Form['notification_mail'] = 0; } if (!array_key_exists('with_password', $Form)) { $Form['with_password'] = 0; } if (!array_key_exists('public_module', $Form)) { $Form['public_module'] = 0; } if (!array_key_exists('public_comment', $Form)) { $Form['public_comment'] = 0; } if (!array_key_exists('public_add', $Form)) { $Form['public_add'] = 0; } if (!array_key_exists('is_first', $Form)) { $Form['is_first'] = 0; } if ($Form['type'] == 'block') { $Form['is_first'] = 0; } $newTopic = false; if (array_key_exists('new_topic', $Form)) { $newTopic = true; unset($Form['new_topic']); } if ($Form['template_index'] !== $defaultTemplateIndex) { $fFrom = THEME . $this->doorGets->configWeb['theme'] . '/website/template/' . $defaultTemplateIndex; $fTo = THEME . $this->doorGets->configWeb['theme'] . '/website/template/' . $Form['template_index']; if (!is_file($fTo)) { copy($fFrom, $fTo); } } $Form['template_index'] = str_replace('.tpl.php', '', $Form['template_index']); $Form['template_content'] = str_replace('.tpl.php', '', $Form['template_content']); $data['with_password'] = $Form['with_password']; $data['public_module'] = $Form['public_module']; $data['public_comment'] = $Form['public_comment']; $data['public_add'] = $Form['public_add']; $data['password'] = $Form['password']; $data['uri'] = $Form['uri']; $data['type'] = 'page'; $data['active'] = $Form['active']; $data['is_first'] = $Form['is_first']; $data['notification_mail'] = $Form['notification_mail']; $data['template_index'] = $Form['template_index']; $data['template_content'] = $Form['template_content']; $data['date_creation'] = time(); if ($data['is_first'] == 1) { $this->doorGets->dbQL("UPDATE _modules SET is_first = 0 WHERE id >= 1"); } $idModule = $this->doorGets->dbQI($data, '_modules'); if ($data['is_first'] == 1) { $dataModuleWebsite['module_homepage'] = $data['uri']; $this->doorGets->dbQU(1, $dataModuleWebsite, '_website'); } $dataNext = array('nom' => $Form['nom'], 'titre' => $Form['titre'], 'description' => $Form['description'], 'top_tinymce' => $Form['top_tinymce'], 'bottom_tinymce' => $Form['bottom_tinymce'], 'meta_titre' => $Form['meta_titre'], 'meta_description' => $Form['meta_description'], 'meta_keys' => $Form['meta_keys'], 'meta_facebook_type' => $Form['meta_facebook_type'], 'meta_facebook_titre' => $Form['meta_facebook_titre'], 'meta_facebook_description' => $Form['meta_facebook_description'], 'meta_facebook_image' => $Form['meta_facebook_image'], 'meta_twitter_type' => $Form['meta_twitter_type'], 'meta_twitter_titre' => $Form['meta_twitter_titre'], 'meta_twitter_description' => $Form['meta_twitter_description'], 'meta_twitter_image' => $Form['meta_twitter_image'], 'meta_twitter_player' => $Form['meta_twitter_player']); foreach ($this->doorGets->getAllLanguages() as $k => $v) { $dataNext['id_module'] = $idModule; $dataNext['langue'] = $k; $dataNext['date_modification'] = time(); $idTraduction[$k] = $this->doorGets->dbQI($dataNext, '_modules_traduction'); } $dataModification['groupe_traduction'] = serialize($idTraduction); $this->doorGets->dbQU($idModule, $dataModification, '_modules'); $this->createPageInstance($data['uri'], $Form); if ($newTopic) { $dataRub['name'] = $Form['uri']; $dataRub['ordre'] = $cResultsInt + 1; $dataRub['idModule'] = $idModule; $dataRub['showinmenu'] = 1; $dataRub['date_creation'] = time(); $this->doorGets->dbQI($dataRub, '_rubrique'); } $this->addModuleToGroupeList($idModule); FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); header('Location:./?controller=modulepage&uri=' . $Form['uri']); exit; } FlashInfo::set($this->doorGets->__("Veuillez remplir correctement le formulaire"), "error"); } break; case 'addmultipage': $Form = $this->doorGets->Form->i; $defaultTemplateIndex = 'modules/multipage/multipage_listing.tpl.php'; if (!empty($Form)) { $this->doorGets->checkMode(); foreach ($Form as $k => $v) { if (empty($v) && !in_array($k, $nonObligatoire)) { $this->doorGets->Form->e['modules_addmultipage_' . $k] = 'ok'; } } // gestion de l'uri $Form['uri'] = $uri = strtolower($Form['uri']); $isValidUri = $this->doorGets->isValidUri($uri, '_modules'); if (!$isValidUri) { $this->doorGets->Form->e['modules_addmultipage_uri'] = 'ok'; } if (strtolower($Form['uri']) === 'doorgets') { $this->doorGets->Form->e['modules_addmultipage_uri'] = 'ok'; } if (empty($this->doorGets->Form->e)) { if (!array_key_exists('active', $Form)) { $Form['active'] = 0; } if (!array_key_exists('notification_mail', $Form)) { $Form['notification_mail'] = 0; } if (!array_key_exists('with_password', $Form)) { $Form['with_password'] = 0; } if (!array_key_exists('public_module', $Form)) { $Form['public_module'] = 0; } if (!array_key_exists('public_comment', $Form)) { $Form['public_comment'] = 0; } if (!array_key_exists('public_add', $Form)) { $Form['public_add'] = 0; } if (!array_key_exists('is_first', $Form)) { $Form['is_first'] = 0; } if ($Form['type'] == 'block') { $Form['is_first'] = 0; } $newTopic = false; if (array_key_exists('new_topic', $Form)) { $newTopic = true; unset($Form['new_topic']); } if ($Form['template_index'] !== $defaultTemplateIndex) { $fFrom = THEME . $this->doorGets->configWeb['theme'] . '/website/template/' . $defaultTemplateIndex; $fTo = THEME . $this->doorGets->configWeb['theme'] . '/website/template/' . $Form['template_index']; if (!is_file($fTo)) { copy($fFrom, $fTo); } } $Form['template_index'] = str_replace('.tpl.php', '', $Form['template_index']); $Form['template_content'] = str_replace('.tpl.php', '', $Form['template_content']); $data['with_password'] = $Form['with_password']; $data['public_module'] = $Form['public_module']; $data['public_comment'] = $Form['public_comment']; $data['public_add'] = $Form['public_add']; $data['password'] = $Form['password']; $data['uri'] = $Form['uri']; $data['type'] = 'multipage'; $data['active'] = $Form['active']; $data['is_first'] = $Form['is_first']; $data['template_index'] = $Form['template_index']; $data['template_content'] = $Form['template_content']; $data['notification_mail'] = $Form['notification_mail']; $data['date_creation'] = time(); if ($data['is_first'] == 1) { $this->doorGets->dbQL("UPDATE _modules SET is_first = 0 WHERE id >= 1"); } $idModule = $this->doorGets->dbQI($data, '_modules'); if ($data['is_first'] == 1) { $dataModuleWebsite['module_homepage'] = $data['uri']; $this->doorGets->dbQU(1, $dataModuleWebsite, '_website'); } $dataNext = array('nom' => $Form['nom'], 'titre' => $Form['titre'], 'description' => $Form['description'], 'top_tinymce' => $Form['top_tinymce'], 'bottom_tinymce' => $Form['bottom_tinymce'], 'meta_titre' => $Form['meta_titre'], 'meta_description' => $Form['meta_description'], 'meta_keys' => $Form['meta_keys'], 'meta_facebook_type' => $Form['meta_facebook_type'], 'meta_facebook_titre' => $Form['meta_facebook_titre'], 'meta_facebook_description' => $Form['meta_facebook_description'], 'meta_facebook_image' => $Form['meta_facebook_image'], 'meta_twitter_type' => $Form['meta_twitter_type'], 'meta_twitter_titre' => $Form['meta_twitter_titre'], 'meta_twitter_description' => $Form['meta_twitter_description'], 'meta_twitter_image' => $Form['meta_twitter_image'], 'meta_twitter_player' => $Form['meta_twitter_player']); foreach ($this->doorGets->getAllLanguages() as $k => $v) { $dataNext['id_module'] = $idModule; $dataNext['langue'] = $k; $dataNext['date_modification'] = time(); $idTraduction[$k] = $this->doorGets->dbQI($dataNext, '_modules_traduction'); } $dataModification['groupe_traduction'] = serialize($idTraduction); $this->doorGets->dbQU($idModule, $dataModification, '_modules'); $this->doorGets->dbQL($this->createSqlMultipage($data['uri'])); if ($newTopic) { $dataRub['name'] = $Form['uri']; $dataRub['ordre'] = $cResultsInt + 1; $dataRub['idModule'] = $idModule; $dataRub['showinmenu'] = 1; $dataRub['date_creation'] = time(); $this->doorGets->dbQI($dataRub, '_rubrique'); } $this->addModuleToGroupeList($idModule); FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); header('Location:./?controller=modulemultipage&uri=' . $Form['uri']); exit; } FlashInfo::set($this->doorGets->__("Veuillez remplir correctement le formulaire"), "error"); } break; case 'addsharedlinks': $Form = $this->doorGets->Form->i; $defaultTemplateIndex = 'modules/sharedlinks/sharedlinks_listing.tpl.php'; $defaultTemplateContent = 'modules/sharedlinks/sharedlinks_content.tpl.php'; if (!empty($Form)) { $this->doorGets->checkMode(); foreach ($Form as $k => $v) { if (empty($v) && !in_array($k, $nonObligatoire)) { $this->doorGets->Form->e['modules_addsharedlinks_' . $k] = 'ok'; } } // gestion de l'uri $Form['uri'] = $uri = strtolower($Form['uri']); $isValidUri = $this->doorGets->isValidUri($uri, '_modules'); if (!$isValidUri) { $this->doorGets->Form->e['modules_addsharedlinks_uri'] = 'ok'; } if (strtolower($Form['uri']) === 'doorgets') { $this->doorGets->Form->e['modules_addsharedlinks_uri'] = 'ok'; } if (empty($this->doorGets->Form->e)) { if (!array_key_exists('active', $Form)) { $Form['active'] = 0; } if (!array_key_exists('author_badge', $Form)) { $Form['author_badge'] = 0; } if (!array_key_exists('notification_mail', $Form)) { $Form['notification_mail'] = 0; } if (!array_key_exists('with_password', $Form)) { $Form['with_password'] = 0; } if (!array_key_exists('public_module', $Form)) { $Form['public_module'] = 0; } if (!array_key_exists('public_comment', $Form)) { $Form['public_comment'] = 0; } if (!array_key_exists('public_add', $Form)) { $Form['public_add'] = 0; } if (!array_key_exists('is_first', $Form)) { $Form['is_first'] = 0; } if ($Form['type'] == 'block') { $Form['is_first'] = 0; } $newTopic = false; if (array_key_exists('new_topic', $Form)) { $newTopic = true; unset($Form['new_topic']); } if ($Form['template_index'] !== $defaultTemplateIndex) { $fFrom = THEME . $this->doorGets->configWeb['theme'] . '/website/template/' . $defaultTemplateIndex; $fTo = THEME . $this->doorGets->configWeb['theme'] . '/website/template/' . $Form['template_index']; if (!is_file($fTo)) { copy($fFrom, $fTo); } } if ($Form['template_content'] !== $defaultTemplateContent) { $fFrom = THEME . $this->doorGets->configWeb['theme'] . '/website/template/' . $defaultTemplateIndex; $fTo = THEME . $this->doorGets->configWeb['theme'] . '/website/template/' . $Form['template_content']; if (!is_file($fTo)) { copy($fFrom, $fTo); } } $Form['template_index'] = str_replace('.tpl.php', '', $Form['template_index']); $Form['template_content'] = str_replace('.tpl.php', '', $Form['template_content']); $data['with_password'] = $Form['with_password']; $data['public_module'] = $Form['public_module']; $data['public_comment'] = $Form['public_comment']; $data['public_add'] = $Form['public_add']; $data['password'] = $Form['password']; $data['uri'] = $Form['uri']; $data['author_badge'] = $Form['author_badge']; $data['type'] = 'sharedlinks'; $data['active'] = $Form['active']; $data['is_first'] = $Form['is_first']; $data['template_index'] = $Form['template_index']; $data['template_content'] = $Form['template_content']; $data['bynum'] = $Form['bynum']; $data['avoiraussi'] = $Form['avoiraussi']; $data['notification_mail'] = $Form['notification_mail']; $data['date_creation'] = time(); $data['uri_notification_moderator'] = $Form['uri_notification_moderator']; $data['uri_notification_user_success'] = $Form['uri_notification_user_success']; $data['uri_notification_user_error'] = $Form['uri_notification_user_error']; if ($data['is_first'] == 1) { $this->doorGets->dbQL("UPDATE _modules SET is_first = 0 WHERE id >= 1"); } $idModule = $this->doorGets->dbQI($data, '_modules'); if ($data['is_first'] == 1) { $dataModuleWebsite['module_homepage'] = $data['uri']; $this->doorGets->dbQU(1, $dataModuleWebsite, '_website'); } $dataNext = array('nom' => $Form['nom'], 'titre' => $Form['titre'], 'description' => $Form['description'], 'top_tinymce' => $Form['top_tinymce'], 'bottom_tinymce' => $Form['bottom_tinymce'], 'meta_titre' => $Form['meta_titre'], 'meta_description' => $Form['meta_description'], 'meta_keys' => $Form['meta_keys'], 'meta_facebook_type' => $Form['meta_facebook_type'], 'meta_facebook_titre' => $Form['meta_facebook_titre'], 'meta_facebook_description' => $Form['meta_facebook_description'], 'meta_facebook_image' => $Form['meta_facebook_image'], 'meta_twitter_type' => $Form['meta_twitter_type'], 'meta_twitter_titre' => $Form['meta_twitter_titre'], 'meta_twitter_description' => $Form['meta_twitter_description'], 'meta_twitter_image' => $Form['meta_twitter_image'], 'meta_twitter_player' => $Form['meta_twitter_player']); foreach ($this->doorGets->getAllLanguages() as $k => $v) { $dataNext['id_module'] = $idModule; $dataNext['langue'] = $k; $dataNext['date_modification'] = time(); $idTraduction[$k] = $this->doorGets->dbQI($dataNext, '_modules_traduction'); } $dataModification['groupe_traduction'] = serialize($idTraduction); $this->doorGets->dbQU($idModule, $dataModification, '_modules'); $this->doorGets->dbQL($this->createSqlSharedlinks($data['uri'])); if ($newTopic) { $dataRub['name'] = $Form['uri']; $dataRub['ordre'] = $cResultsInt + 1; $dataRub['idModule'] = $idModule; $dataRub['showinmenu'] = 1; $dataRub['date_creation'] = time(); $this->doorGets->dbQI($dataRub, '_rubrique'); } $this->addModuleToGroupeList($idModule); FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); header('Location:./?controller=modulesharedlinks&uri=' . $Form['uri']); exit; } FlashInfo::set($this->doorGets->__("Veuillez remplir correctement le formulaire"), "error"); } break; case 'addnews': $Form = $this->doorGets->Form->i; $defaultTemplateIndex = 'modules/news/news_listing.tpl.php'; $defaultTemplateContent = 'modules/news/news_content.tpl.php'; if (!empty($Form)) { $this->doorGets->checkMode(); foreach ($Form as $k => $v) { if (empty($v) && !in_array($k, $nonObligatoire)) { $this->doorGets->Form->e['modules_addnews_' . $k] = 'ok'; } } // gestion de l'uri $Form['uri'] = $uri = strtolower($Form['uri']); $isValidUri = $this->doorGets->isValidUri($uri, '_modules'); if (!$isValidUri) { $this->doorGets->Form->e['modules_addnews_uri'] = 'ok'; } if (strtolower($Form['uri']) === 'doorgets') { $this->doorGets->Form->e['modules_addnews_uri'] = 'ok'; } if (empty($this->doorGets->Form->e)) { if (!array_key_exists('active', $Form)) { $Form['active'] = 0; } if (!array_key_exists('author_badge', $Form)) { $Form['author_badge'] = 0; } if (!array_key_exists('notification_mail', $Form)) { $Form['notification_mail'] = 0; } if (!array_key_exists('with_password', $Form)) { $Form['with_password'] = 0; } if (!array_key_exists('public_module', $Form)) { $Form['public_module'] = 0; } if (!array_key_exists('public_comment', $Form)) { $Form['public_comment'] = 0; } if (!array_key_exists('public_add', $Form)) { $Form['public_add'] = 0; } if (!array_key_exists('is_first', $Form)) { $Form['is_first'] = 0; } if ($Form['type'] == 'block') { $Form['is_first'] = 0; } $newTopic = false; if (array_key_exists('new_topic', $Form)) { $newTopic = true; unset($Form['new_topic']); } if ($Form['template_index'] !== $defaultTemplateIndex) { $fFrom = THEME . $this->doorGets->configWeb['theme'] . '/website/template/' . $defaultTemplateIndex; $fTo = THEME . $this->doorGets->configWeb['theme'] . '/website/template/' . $Form['template_index']; if (!is_file($fTo)) { copy($fFrom, $fTo); } } if ($Form['template_content'] !== $defaultTemplateContent) { $fFrom = THEME . $this->doorGets->configWeb['theme'] . '/website/template/' . $defaultTemplateIndex; $fTo = THEME . $this->doorGets->configWeb['theme'] . '/website/template/' . $Form['template_content']; if (!is_file($fTo)) { copy($fFrom, $fTo); } } $Form['template_index'] = str_replace('.tpl.php', '', $Form['template_index']); $Form['template_content'] = str_replace('.tpl.php', '', $Form['template_content']); $data['with_password'] = $Form['with_password']; $data['public_module'] = $Form['public_module']; $data['public_comment'] = $Form['public_comment']; $data['public_add'] = $Form['public_add']; $data['password'] = $Form['password']; $data['uri'] = $Form['uri']; $data['author_badge'] = $Form['author_badge']; $data['type'] = 'news'; $data['active'] = $Form['active']; $data['is_first'] = $Form['is_first']; $data['template_index'] = $Form['template_index']; $data['template_content'] = $Form['template_content']; $data['bynum'] = $Form['bynum']; $data['avoiraussi'] = $Form['avoiraussi']; $data['notification_mail'] = $Form['notification_mail']; $data['date_creation'] = time(); $data['uri_notification_moderator'] = $Form['uri_notification_moderator']; $data['uri_notification_user_success'] = $Form['uri_notification_user_success']; $data['uri_notification_user_error'] = $Form['uri_notification_user_error']; if ($data['is_first'] == 1) { $this->doorGets->dbQL("UPDATE _modules SET is_first = 0 WHERE id >= 1"); } $idModule = $this->doorGets->dbQI($data, '_modules'); if ($data['is_first'] == 1) { $dataModuleWebsite['module_homepage'] = $data['uri']; $this->doorGets->dbQU(1, $dataModuleWebsite, '_website'); } $dataNext = array('nom' => $Form['nom'], 'titre' => $Form['titre'], 'description' => $Form['description'], 'top_tinymce' => $Form['top_tinymce'], 'bottom_tinymce' => $Form['bottom_tinymce'], 'meta_titre' => $Form['meta_titre'], 'meta_description' => $Form['meta_description'], 'meta_keys' => $Form['meta_keys'], 'meta_facebook_type' => $Form['meta_facebook_type'], 'meta_facebook_titre' => $Form['meta_facebook_titre'], 'meta_facebook_description' => $Form['meta_facebook_description'], 'meta_facebook_image' => $Form['meta_facebook_image'], 'meta_twitter_type' => $Form['meta_twitter_type'], 'meta_twitter_titre' => $Form['meta_twitter_titre'], 'meta_twitter_description' => $Form['meta_twitter_description'], 'meta_twitter_image' => $Form['meta_twitter_image'], 'meta_twitter_player' => $Form['meta_twitter_player']); foreach ($this->doorGets->getAllLanguages() as $k => $v) { $dataNext['id_module'] = $idModule; $dataNext['langue'] = $k; $dataNext['date_modification'] = time(); $idTraduction[$k] = $this->doorGets->dbQI($dataNext, '_modules_traduction'); } $dataModification['groupe_traduction'] = serialize($idTraduction); $this->doorGets->dbQU($idModule, $dataModification, '_modules'); $this->doorGets->dbQL($this->createSqlNews($data['uri'])); if ($newTopic) { $dataRub['name'] = $Form['uri']; $dataRub['ordre'] = $cResultsInt + 1; $dataRub['idModule'] = $idModule; $dataRub['showinmenu'] = 1; $dataRub['date_creation'] = time(); $this->doorGets->dbQI($dataRub, '_rubrique'); } $this->addModuleToGroupeList($idModule); FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); header('Location:./?controller=modulenews&uri=' . $Form['uri']); exit; } FlashInfo::set($this->doorGets->__("Veuillez remplir correctement le formulaire"), "error"); } break; case 'addblog': $Form = $this->doorGets->Form->i; $defaultTemplateIndex = 'modules/blog/blog_listing.tpl.php'; $defaultTemplateContent = 'modules/blog/blog_content.tpl.php'; if (!empty($Form)) { $this->doorGets->checkMode(); foreach ($Form as $k => $v) { if (empty($v) && !in_array($k, $nonObligatoire)) { $this->doorGets->Form->e['modules_addblog_' . $k] = 'ok'; } } // gestion de l'uri $Form['uri'] = $uri = strtolower($Form['uri']); $isValidUri = $this->doorGets->isValidUri($uri, '_modules'); if (!$isValidUri) { $this->doorGets->Form->e['modules_addblog_uri'] = 'ok'; } if (strtolower($Form['uri']) === 'doorgets') { $this->doorGets->Form->e['modules_addblog_uri'] = 'ok'; } if (empty($this->doorGets->Form->e)) { if (!array_key_exists('active', $Form)) { $Form['active'] = 0; } if (!array_key_exists('author_badge', $Form)) { $Form['author_badge'] = 0; } if (!array_key_exists('notification_mail', $Form)) { $Form['notification_mail'] = 0; } if (!array_key_exists('with_password', $Form)) { $Form['with_password'] = 0; } if (!array_key_exists('public_module', $Form)) { $Form['public_module'] = 0; } if (!array_key_exists('public_comment', $Form)) { $Form['public_comment'] = 0; } if (!array_key_exists('public_add', $Form)) { $Form['public_add'] = 0; } if (!array_key_exists('is_first', $Form)) { $Form['is_first'] = 0; } if ($Form['type'] == 'block') { $Form['is_first'] = 0; } $newTopic = false; if (array_key_exists('new_topic', $Form)) { $newTopic = true; unset($Form['new_topic']); } if ($Form['template_index'] !== $defaultTemplateIndex) { $fFrom = THEME . $this->doorGets->configWeb['theme'] . '/website/template/' . $defaultTemplateIndex; $fTo = THEME . $this->doorGets->configWeb['theme'] . '/website/template/' . $Form['template_index']; if (!is_file($fTo)) { copy($fFrom, $fTo); } } if ($Form['template_content'] !== $defaultTemplateContent) { $fFrom = THEME . $this->doorGets->configWeb['theme'] . '/website/template/' . $defaultTemplateIndex; $fTo = THEME . $this->doorGets->configWeb['theme'] . '/website/template/' . $Form['template_content']; if (!is_file($fTo)) { copy($fFrom, $fTo); } } $Form['template_index'] = str_replace('.tpl.php', '', $Form['template_index']); $Form['template_content'] = str_replace('.tpl.php', '', $Form['template_content']); $data['with_password'] = $Form['with_password']; $data['public_module'] = $Form['public_module']; $data['public_comment'] = $Form['public_comment']; $data['public_add'] = $Form['public_add']; $data['password'] = $Form['password']; $data['uri'] = $Form['uri']; $data['author_badge'] = $Form['author_badge']; $data['type'] = 'blog'; $data['active'] = $Form['active']; $data['is_first'] = $Form['is_first']; $data['template_index'] = $Form['template_index']; $data['template_content'] = $Form['template_content']; $data['bynum'] = $Form['bynum']; $data['avoiraussi'] = $Form['avoiraussi']; $data['notification_mail'] = $Form['notification_mail']; $data['date_creation'] = time(); $data['uri_notification_moderator'] = $Form['uri_notification_moderator']; $data['uri_notification_user_success'] = $Form['uri_notification_user_success']; $data['uri_notification_user_error'] = $Form['uri_notification_user_error']; if ($data['is_first'] == 1) { $this->doorGets->dbQL("UPDATE _modules SET is_first = 0 WHERE id >= 1"); } $idModule = $this->doorGets->dbQI($data, '_modules'); if ($data['is_first'] == 1) { $dataModuleWebsite['module_homepage'] = $data['uri']; $this->doorGets->dbQU(1, $dataModuleWebsite, '_website'); } $dataNext = array('nom' => $Form['nom'], 'titre' => $Form['titre'], 'description' => $Form['description'], 'top_tinymce' => $Form['top_tinymce'], 'bottom_tinymce' => $Form['bottom_tinymce'], 'meta_titre' => $Form['meta_titre'], 'meta_description' => $Form['meta_description'], 'meta_keys' => $Form['meta_keys'], 'meta_facebook_type' => $Form['meta_facebook_type'], 'meta_facebook_titre' => $Form['meta_facebook_titre'], 'meta_facebook_description' => $Form['meta_facebook_description'], 'meta_facebook_image' => $Form['meta_facebook_image'], 'meta_twitter_type' => $Form['meta_twitter_type'], 'meta_twitter_titre' => $Form['meta_twitter_titre'], 'meta_twitter_description' => $Form['meta_twitter_description'], 'meta_twitter_image' => $Form['meta_twitter_image'], 'meta_twitter_player' => $Form['meta_twitter_player']); foreach ($this->doorGets->getAllLanguages() as $k => $v) { $dataNext['id_module'] = $idModule; $dataNext['langue'] = $k; $dataNext['date_modification'] = time(); $idTraduction[$k] = $this->doorGets->dbQI($dataNext, '_modules_traduction'); } $dataModification['groupe_traduction'] = serialize($idTraduction); $this->doorGets->dbQU($idModule, $dataModification, '_modules'); $this->doorGets->dbQL($this->createSqlBlog($data['uri'])); if ($newTopic) { $dataRub['name'] = $Form['uri']; $dataRub['ordre'] = $cResultsInt + 1; $dataRub['idModule'] = $idModule; $dataRub['showinmenu'] = 1; $dataRub['date_creation'] = time(); $this->doorGets->dbQI($dataRub, '_rubrique'); } $this->addModuleToGroupeList($idModule); FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); header('Location:./?controller=moduleblog&uri=' . $Form['uri']); exit; } FlashInfo::set($this->doorGets->__("Veuillez remplir correctement le formulaire"), "error"); } break; case 'addvideo': $Form = $this->doorGets->Form->i; $defaultTemplateIndex = 'modules/video/video_listing.tpl.php'; $defaultTemplateContent = 'modules/video/video_content.tpl.php'; if (!empty($Form)) { $this->doorGets->checkMode(); foreach ($Form as $k => $v) { if (empty($v) && !in_array($k, $nonObligatoire)) { $this->doorGets->Form->e['modules_addvideo_' . $k] = 'ok'; } } // gestion de l'uri $Form['uri'] = $uri = strtolower($Form['uri']); $isValidUri = $this->doorGets->isValidUri($uri, '_modules'); if (!$isValidUri) { $this->doorGets->Form->e['modules_addvideo_uri'] = 'ok'; } if (strtolower($Form['uri']) === 'doorgets') { $this->doorGets->Form->e['modules_addvideo_uri'] = 'ok'; } if (empty($this->doorGets->Form->e)) { if (!array_key_exists('active', $Form)) { $Form['active'] = 0; } if (!array_key_exists('author_badge', $Form)) { $Form['author_badge'] = 0; } if (!array_key_exists('notification_mail', $Form)) { $Form['notification_mail'] = 0; } if (!array_key_exists('with_password', $Form)) { $Form['with_password'] = 0; } if (!array_key_exists('public_module', $Form)) { $Form['public_module'] = 0; } if (!array_key_exists('public_comment', $Form)) { $Form['public_comment'] = 0; } if (!array_key_exists('public_add', $Form)) { $Form['public_add'] = 0; } if (!array_key_exists('is_first', $Form)) { $Form['is_first'] = 0; } if ($Form['type'] == 'block') { $Form['is_first'] = 0; } $newTopic = false; if (array_key_exists('new_topic', $Form)) { $newTopic = true; unset($Form['new_topic']); } if ($Form['template_index'] !== $defaultTemplateIndex) { $fFrom = THEME . $this->doorGets->configWeb['theme'] . '/website/template/' . $defaultTemplateIndex; $fTo = THEME . $this->doorGets->configWeb['theme'] . '/website/template/' . $Form['template_index']; if (!is_file($fTo)) { copy($fFrom, $fTo); } } if ($Form['template_content'] !== $defaultTemplateContent) { $fFrom = THEME . $this->doorGets->configWeb['theme'] . '/website/template/' . $defaultTemplateIndex; $fTo = THEME . $this->doorGets->configWeb['theme'] . '/website/template/' . $Form['template_content']; if (!is_file($fTo)) { copy($fFrom, $fTo); } } $Form['template_index'] = str_replace('.tpl.php', '', $Form['template_index']); $Form['template_content'] = str_replace('.tpl.php', '', $Form['template_content']); $data['with_password'] = $Form['with_password']; $data['public_module'] = $Form['public_module']; $data['public_comment'] = $Form['public_comment']; $data['public_add'] = $Form['public_add']; $data['password'] = $Form['password']; $data['uri'] = $Form['uri']; $data['author_badge'] = $Form['author_badge']; $data['type'] = 'video'; $data['active'] = $Form['active']; $data['is_first'] = $Form['is_first']; $data['template_index'] = $Form['template_index']; $data['template_content'] = $Form['template_content']; $data['bynum'] = $Form['bynum']; $data['avoiraussi'] = $Form['avoiraussi']; $data['notification_mail'] = $Form['notification_mail']; $data['date_creation'] = time(); $data['uri_notification_moderator'] = $Form['uri_notification_moderator']; $data['uri_notification_user_success'] = $Form['uri_notification_user_success']; $data['uri_notification_user_error'] = $Form['uri_notification_user_error']; if ($data['is_first'] == 1) { $this->doorGets->dbQL("UPDATE _modules SET is_first = 0 WHERE id >= 1"); } $idModule = $this->doorGets->dbQI($data, '_modules'); if ($data['is_first'] == 1) { $dataModuleWebsite['module_homepage'] = $data['uri']; $this->doorGets->dbQU(1, $dataModuleWebsite, '_website'); } $dataNext = array('nom' => $Form['nom'], 'titre' => $Form['titre'], 'description' => $Form['description'], 'top_tinymce' => $Form['top_tinymce'], 'bottom_tinymce' => $Form['bottom_tinymce'], 'meta_titre' => $Form['meta_titre'], 'meta_description' => $Form['meta_description'], 'meta_keys' => $Form['meta_keys'], 'meta_facebook_type' => $Form['meta_facebook_type'], 'meta_facebook_titre' => $Form['meta_facebook_titre'], 'meta_facebook_description' => $Form['meta_facebook_description'], 'meta_facebook_image' => $Form['meta_facebook_image'], 'meta_twitter_type' => $Form['meta_twitter_type'], 'meta_twitter_titre' => $Form['meta_twitter_titre'], 'meta_twitter_description' => $Form['meta_twitter_description'], 'meta_twitter_image' => $Form['meta_twitter_image'], 'meta_twitter_player' => $Form['meta_twitter_player']); foreach ($this->doorGets->getAllLanguages() as $k => $v) { $dataNext['id_module'] = $idModule; $dataNext['langue'] = $k; $dataNext['date_modification'] = time(); $idTraduction[$k] = $this->doorGets->dbQI($dataNext, '_modules_traduction'); } $dataModification['groupe_traduction'] = serialize($idTraduction); $this->doorGets->dbQU($idModule, $dataModification, '_modules'); $this->doorGets->dbQL($this->createSqlVideo($data['uri'])); if ($newTopic) { $dataRub['name'] = $Form['uri']; $dataRub['ordre'] = $cResultsInt + 1; $dataRub['idModule'] = $idModule; $dataRub['showinmenu'] = 1; $dataRub['date_creation'] = time(); $this->doorGets->dbQI($dataRub, '_rubrique'); } $this->addModuleToGroupeList($idModule); FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); header('Location:./?controller=modulevideo&uri=' . $Form['uri']); exit; } FlashInfo::set($this->doorGets->__("Veuillez remplir correctement le formulaire"), "error"); } break; case 'addimage': $Form = $this->doorGets->Form->i; $defaultTemplateIndex = 'modules/image/image_listing.tpl.php'; $defaultTemplateContent = 'modules/image/image_content.tpl.php'; if (!empty($Form)) { $this->doorGets->checkMode(); foreach ($Form as $k => $v) { if (empty($v) && !in_array($k, $nonObligatoire)) { $this->doorGets->Form->e['modules_addimage_' . $k] = 'ok'; } } // gestion de l'uri $Form['uri'] = $uri = strtolower($Form['uri']); $isValidUri = $this->doorGets->isValidUri($uri, '_modules'); if (!$isValidUri) { $this->doorGets->Form->e['modules_addimage_uri'] = 'ok'; } if (strtolower($Form['uri']) === 'doorgets') { $this->doorGets->Form->e['modules_addimage_uri'] = 'ok'; } if (empty($this->doorGets->Form->e)) { if (!array_key_exists('active', $Form)) { $Form['active'] = 0; } if (!array_key_exists('author_badge', $Form)) { $Form['author_badge'] = 0; } if (!array_key_exists('notification_mail', $Form)) { $Form['notification_mail'] = 0; } if (!array_key_exists('with_password', $Form)) { $Form['with_password'] = 0; } if (!array_key_exists('public_module', $Form)) { $Form['public_module'] = 0; } if (!array_key_exists('public_comment', $Form)) { $Form['public_comment'] = 0; } if (!array_key_exists('public_add', $Form)) { $Form['public_add'] = 0; } if (!array_key_exists('is_first', $Form)) { $Form['is_first'] = 0; } if ($Form['type'] == 'block') { $Form['is_first'] = 0; } $newTopic = false; if (array_key_exists('new_topic', $Form)) { $newTopic = true; unset($Form['new_topic']); } if ($Form['template_index'] !== $defaultTemplateIndex) { $fFrom = THEME . $this->doorGets->configWeb['theme'] . '/website/template/' . $defaultTemplateIndex; $fTo = THEME . $this->doorGets->configWeb['theme'] . '/website/template/' . $Form['template_index']; if (!is_file($fTo)) { copy($fFrom, $fTo); } } if ($Form['template_content'] !== $defaultTemplateContent) { $fFrom = THEME . $this->doorGets->configWeb['theme'] . '/website/template/' . $defaultTemplateIndex; $fTo = THEME . $this->doorGets->configWeb['theme'] . '/website/template/' . $Form['template_content']; if (!is_file($fTo)) { copy($fFrom, $fTo); } } $Form['template_index'] = str_replace('.tpl.php', '', $Form['template_index']); $Form['template_content'] = str_replace('.tpl.php', '', $Form['template_content']); $data['with_password'] = $Form['with_password']; $data['public_module'] = $Form['public_module']; $data['public_comment'] = $Form['public_comment']; $data['public_add'] = $Form['public_add']; $data['password'] = $Form['password']; $data['uri'] = $Form['uri']; $data['author_badge'] = $Form['author_badge']; $data['type'] = 'image'; $data['active'] = $Form['active']; $data['is_first'] = $Form['is_first']; $data['template_index'] = $Form['template_index']; $data['template_content'] = $Form['template_content']; $data['bynum'] = $Form['bynum']; $data['avoiraussi'] = $Form['avoiraussi']; $data['notification_mail'] = $Form['notification_mail']; $data['date_creation'] = time(); $data['uri_notification_moderator'] = $Form['uri_notification_moderator']; $data['uri_notification_user_success'] = $Form['uri_notification_user_success']; $data['uri_notification_user_error'] = $Form['uri_notification_user_error']; if ($data['is_first'] == 1) { $this->doorGets->dbQL("UPDATE _modules SET is_first = 0 WHERE id >= 1"); } $idModule = $this->doorGets->dbQI($data, '_modules'); if ($data['is_first'] == 1) { $dataModuleWebsite['module_homepage'] = $data['uri']; $this->doorGets->dbQU(1, $dataModuleWebsite, '_website'); } $dataNext = array('nom' => $Form['nom'], 'titre' => $Form['titre'], 'description' => $Form['description'], 'top_tinymce' => $Form['top_tinymce'], 'bottom_tinymce' => $Form['bottom_tinymce'], 'meta_titre' => $Form['meta_titre'], 'meta_description' => $Form['meta_description'], 'meta_keys' => $Form['meta_keys'], 'meta_facebook_type' => $Form['meta_facebook_type'], 'meta_facebook_titre' => $Form['meta_facebook_titre'], 'meta_facebook_description' => $Form['meta_facebook_description'], 'meta_facebook_image' => $Form['meta_facebook_image'], 'meta_twitter_type' => $Form['meta_twitter_type'], 'meta_twitter_titre' => $Form['meta_twitter_titre'], 'meta_twitter_description' => $Form['meta_twitter_description'], 'meta_twitter_image' => $Form['meta_twitter_image'], 'meta_twitter_player' => $Form['meta_twitter_player']); foreach ($this->doorGets->getAllLanguages() as $k => $v) { $dataNext['id_module'] = $idModule; $dataNext['langue'] = $k; $dataNext['date_modification'] = time(); $idTraduction[$k] = $this->doorGets->dbQI($dataNext, '_modules_traduction'); } $dataModification['groupe_traduction'] = serialize($idTraduction); $this->doorGets->dbQU($idModule, $dataModification, '_modules'); $this->doorGets->dbQL($this->createSqlImage($data['uri'])); if ($newTopic) { $dataRub['name'] = $Form['uri']; $dataRub['ordre'] = $cResultsInt + 1; $dataRub['idModule'] = $idModule; $dataRub['showinmenu'] = 1; $dataRub['date_creation'] = time(); $this->doorGets->dbQI($dataRub, '_rubrique'); } $this->addModuleToGroupeList($idModule); FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); header('Location:./?controller=moduleimage&uri=' . $Form['uri']); exit; } FlashInfo::set($this->doorGets->__("Veuillez remplir correctement le formulaire"), "error"); } break; case 'addinbox': $Form = $this->doorGets->Form->i; $defaultTemplateIndex = 'modules/inbox/inbox_form.tpl.php'; if (!empty($Form)) { $this->doorGets->checkMode(); foreach ($Form as $k => $v) { if (empty($v) && !in_array($k, $nonObligatoire)) { $this->doorGets->Form->e['modules_addinbox_' . $k] = 'ok'; } } // @todo // gestion de l'uri $Form['uri'] = $uri = strtolower($Form['uri']); $isValidUri = $this->doorGets->isValidUri($uri, '_modules'); if (!$isValidUri) { $this->doorGets->Form->e['modules_addinbox_uri'] = 'ok'; } if (strtolower($Form['uri']) === 'doorgets') { $this->doorGets->Form->e['modules_addinbox_uri'] = 'ok'; } if (empty($this->doorGets->Form->e)) { if (!array_key_exists('active', $Form)) { $Form['active'] = 0; } if (!array_key_exists('notification_mail', $Form)) { $Form['notification_mail'] = 0; } if (!array_key_exists('is_first', $Form)) { $Form['is_first'] = 0; } if (!array_key_exists('with_password', $Form)) { $Form['with_password'] = 0; } if (!array_key_exists('public_module', $Form)) { $Form['public_module'] = 0; } if (!array_key_exists('public_comment', $Form)) { $Form['public_comment'] = 0; } if (!array_key_exists('public_add', $Form)) { $Form['public_add'] = 0; } if ($Form['type'] == 'block') { $Form['is_first'] = 0; } $newTopic = false; if (array_key_exists('new_topic', $Form)) { $newTopic = true; unset($Form['new_topic']); } if ($Form['template_index'] !== $defaultTemplateIndex) { $fFrom = THEME . $this->doorGets->configWeb['theme'] . '/website/template/' . $defaultTemplateIndex; $fTo = THEME . $this->doorGets->configWeb['theme'] . '/website/template/' . $Form['template_index']; if (!is_file($fTo)) { copy($fFrom, $fTo); } } $Form['template_index'] = str_replace('.tpl.php', '', $Form['template_index']); $Form['template_content'] = str_replace('.tpl.php', '', $Form['template_content']); $data['with_password'] = $Form['with_password']; $data['public_module'] = $Form['public_module']; $data['public_comment'] = $Form['public_comment']; $data['public_add'] = $Form['public_add']; $data['password'] = $Form['password']; $data['uri'] = $Form['uri']; $data['type'] = 'inbox'; $data['active'] = $Form['active']; $data['is_first'] = $Form['is_first']; $data['template_index'] = $Form['template_index']; $data['template_content'] = $Form['template_content']; $data['notification_mail'] = $Form['notification_mail']; $data['date_creation'] = time(); if ($data['is_first'] == 1) { $this->doorGets->dbQL("UPDATE _modules SET is_first = 0 WHERE id >= 1"); } $idModule = $this->doorGets->dbQI($data, '_modules'); if ($data['is_first'] == 1) { $dataModuleWebsite['module_homepage'] = $data['uri']; $this->doorGets->dbQU(1, $dataModuleWebsite, '_website'); } $dataNext = array('nom' => $Form['nom'], 'titre' => $Form['titre'], 'description' => $Form['description'], 'top_tinymce' => $Form['top_tinymce'], 'bottom_tinymce' => $Form['bottom_tinymce'], 'meta_titre' => $Form['meta_titre'], 'meta_description' => $Form['meta_description'], 'meta_keys' => $Form['meta_keys'], 'meta_facebook_type' => $Form['meta_facebook_type'], 'meta_facebook_titre' => $Form['meta_facebook_titre'], 'meta_facebook_description' => $Form['meta_facebook_description'], 'meta_facebook_image' => $Form['meta_facebook_image'], 'meta_twitter_type' => $Form['meta_twitter_type'], 'meta_twitter_titre' => $Form['meta_twitter_titre'], 'meta_twitter_description' => $Form['meta_twitter_description'], 'meta_twitter_image' => $Form['meta_twitter_image'], 'meta_twitter_player' => $Form['meta_twitter_player']); foreach ($this->doorGets->getAllLanguages() as $k => $v) { $dataNext['id_module'] = $idModule; $dataNext['langue'] = $k; $dataNext['date_modification'] = time(); $idTraduction[$k] = $this->doorGets->dbQI($dataNext, '_modules_traduction'); } $dataModification['groupe_traduction'] = serialize($idTraduction); $this->doorGets->dbQU($idModule, $dataModification, '_modules'); if ($newTopic) { $dataRub['name'] = $Form['uri']; $dataRub['ordre'] = $cResultsInt + 1; $dataRub['idModule'] = $idModule; $dataRub['showinmenu'] = 1; $dataRub['date_creation'] = time(); $this->doorGets->dbQI($dataRub, '_rubrique'); } $this->addModuleToGroupeList($idModule); FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); header('Location:./?controller=modules'); exit; } FlashInfo::set($this->doorGets->__("Veuillez remplir correctement le formulaire"), "error"); } break; case 'addfaq': $Form = $this->doorGets->Form->i; $defaultTemplateIndex = 'modules/faq/faq_listing.tpl.php'; if (!empty($Form)) { $this->doorGets->checkMode(); foreach ($Form as $k => $v) { if (empty($v) && !in_array($k, $nonObligatoire)) { $this->doorGets->Form->e['modules_addfaq_' . $k] = 'ok'; } } // gestion de l'uri $Form['uri'] = $uri = strtolower($Form['uri']); $isValidUri = $this->doorGets->isValidUri($uri, '_modules'); if (!$isValidUri) { $this->doorGets->Form->e['modules_addfaq_uri'] = 'ok'; } if (strtolower($Form['uri']) === 'doorgets') { $this->doorGets->Form->e['modules_addfaq_uri'] = 'ok'; } if (empty($this->doorGets->Form->e)) { if (!array_key_exists('active', $Form)) { $Form['active'] = 0; } if (!array_key_exists('notification_mail', $Form)) { $Form['notification_mail'] = 0; } if (!array_key_exists('is_first', $Form)) { $Form['is_first'] = 0; } if (!array_key_exists('with_password', $Form)) { $Form['with_password'] = 0; } if (!array_key_exists('public_module', $Form)) { $Form['public_module'] = 0; } if (!array_key_exists('public_comment', $Form)) { $Form['public_comment'] = 0; } if (!array_key_exists('public_add', $Form)) { $Form['public_add'] = 0; } if ($Form['type'] == 'block') { $Form['is_first'] = 0; } $newTopic = false; if (array_key_exists('new_topic', $Form)) { $newTopic = true; unset($Form['new_topic']); } if ($Form['template_index'] !== $defaultTemplateIndex) { $fFrom = THEME . $this->doorGets->configWeb['theme'] . '/website/template/' . $defaultTemplateIndex; $fTo = THEME . $this->doorGets->configWeb['theme'] . '/website/template/' . $Form['template_index']; if (!is_file($fTo)) { copy($fFrom, $fTo); } } $Form['template_index'] = str_replace('.tpl.php', '', $Form['template_index']); $Form['template_content'] = str_replace('.tpl.php', '', $Form['template_content']); $data['with_password'] = $Form['with_password']; $data['public_module'] = $Form['public_module']; $data['public_comment'] = $Form['public_comment']; $data['public_add'] = $Form['public_add']; $data['password'] = $Form['password']; $data['uri'] = $Form['uri']; $data['type'] = 'faq'; $data['active'] = $Form['active']; $data['is_first'] = $Form['is_first']; $data['template_index'] = $Form['template_index']; $data['template_content'] = $Form['template_content']; $data['notification_mail'] = $Form['notification_mail']; $data['date_creation'] = time(); if ($data['is_first'] == 1) { $this->doorGets->dbQL("UPDATE _modules SET is_first = 0 WHERE id >= 1"); } $idModule = $this->doorGets->dbQI($data, '_modules'); if ($data['is_first'] == 1) { $dataModuleWebsite['module_homepage'] = $data['uri']; $this->doorGets->dbQU(1, $dataModuleWebsite, '_website'); } $dataNext = array('nom' => $Form['nom'], 'titre' => $Form['titre'], 'description' => $Form['description'], 'top_tinymce' => $Form['top_tinymce'], 'bottom_tinymce' => $Form['bottom_tinymce'], 'meta_titre' => $Form['meta_titre'], 'meta_description' => $Form['meta_description'], 'meta_keys' => $Form['meta_keys'], 'meta_facebook_type' => $Form['meta_facebook_type'], 'meta_facebook_titre' => $Form['meta_facebook_titre'], 'meta_facebook_description' => $Form['meta_facebook_description'], 'meta_facebook_image' => $Form['meta_facebook_image'], 'meta_twitter_type' => $Form['meta_twitter_type'], 'meta_twitter_titre' => $Form['meta_twitter_titre'], 'meta_twitter_description' => $Form['meta_twitter_description'], 'meta_twitter_image' => $Form['meta_twitter_image'], 'meta_twitter_player' => $Form['meta_twitter_player']); foreach ($this->doorGets->getAllLanguages() as $k => $v) { $dataNext['id_module'] = $idModule; $dataNext['langue'] = $k; $dataNext['date_modification'] = time(); $idTraduction[$k] = $this->doorGets->dbQI($dataNext, '_modules_traduction'); } $dataModification['groupe_traduction'] = serialize($idTraduction); $this->doorGets->dbQU($idModule, $dataModification, '_modules'); $this->doorGets->dbQL($this->createSqlFaq($data['uri'])); if ($newTopic) { $dataRub['name'] = $Form['uri']; $dataRub['ordre'] = $cResultsInt + 1; $dataRub['idModule'] = $idModule; $dataRub['showinmenu'] = 1; $dataRub['date_creation'] = time(); $this->doorGets->dbQI($dataRub, '_rubrique'); } $this->addModuleToGroupeList($idModule); FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); header('Location:./?controller=modulefaq&uri=' . $Form['uri']); exit; } FlashInfo::set($this->doorGets->__("Veuillez remplir correctement le formulaire"), "error"); } break; case 'addpartner': $Form = $this->doorGets->Form->i; $defaultTemplateIndex = 'modules/partner/partner_listing.tpl.php'; if (!empty($Form)) { $this->doorGets->checkMode(); foreach ($Form as $k => $v) { if (empty($v) && !in_array($k, $nonObligatoire)) { $this->doorGets->Form->e['modules_addpartner_' . $k] = 'ok'; } } // gestion de l'uri $Form['uri'] = $uri = strtolower($Form['uri']); $isValidUri = $this->doorGets->isValidUri($uri, '_modules'); if (!$isValidUri) { $this->doorGets->Form->e['modules_addpartner_uri'] = 'ok'; } if (strtolower($Form['uri']) === 'doorgets') { $this->doorGets->Form->e['modules_addpartner_uri'] = 'ok'; } if (empty($this->doorGets->Form->e)) { if (!array_key_exists('active', $Form)) { $Form['active'] = 0; } if (!array_key_exists('notification_mail', $Form)) { $Form['notification_mail'] = 0; } if (!array_key_exists('is_first', $Form)) { $Form['is_first'] = 0; } if (!array_key_exists('with_password', $Form)) { $Form['with_password'] = 0; } if (!array_key_exists('public_module', $Form)) { $Form['public_module'] = 0; } if (!array_key_exists('public_comment', $Form)) { $Form['public_comment'] = 0; } if (!array_key_exists('public_add', $Form)) { $Form['public_add'] = 0; } if ($Form['type'] == 'block') { $Form['is_first'] = 0; } $newTopic = false; if (array_key_exists('new_topic', $Form)) { $newTopic = true; unset($Form['new_topic']); } if ($Form['template_index'] !== $defaultTemplateIndex) { $fFrom = THEME . $this->doorGets->configWeb['theme'] . '/website/template/' . $defaultTemplateIndex; $fTo = THEME . $this->doorGets->configWeb['theme'] . '/website/template/' . $Form['template_index']; if (!is_file($fTo)) { copy($fFrom, $fTo); } } $Form['template_index'] = str_replace('.tpl.php', '', $Form['template_index']); $Form['template_content'] = str_replace('.tpl.php', '', $Form['template_content']); $data['with_password'] = $Form['with_password']; $data['public_module'] = $Form['public_module']; $data['public_comment'] = $Form['public_comment']; $data['public_add'] = $Form['public_add']; $data['password'] = $Form['password']; $data['uri'] = $Form['uri']; $data['type'] = 'partner'; $data['active'] = $Form['active']; $data['is_first'] = $Form['is_first']; $data['template_index'] = $Form['template_index']; $data['template_content'] = $Form['template_content']; $data['notification_mail'] = $Form['notification_mail']; $data['date_creation'] = time(); if ($data['is_first'] == 1) { $this->doorGets->dbQL("UPDATE _modules SET is_first = 0 WHERE id >= 1"); } $idModule = $this->doorGets->dbQI($data, '_modules'); if ($data['is_first'] == 1) { $dataModuleWebsite['module_homepage'] = $data['uri']; $this->doorGets->dbQU(1, $dataModuleWebsite, '_website'); } $dataNext = array('nom' => $Form['nom'], 'titre' => $Form['titre'], 'description' => $Form['description'], 'top_tinymce' => $Form['top_tinymce'], 'bottom_tinymce' => $Form['bottom_tinymce'], 'meta_titre' => $Form['meta_titre'], 'meta_description' => $Form['meta_description'], 'meta_keys' => $Form['meta_keys'], 'meta_facebook_type' => $Form['meta_facebook_type'], 'meta_facebook_titre' => $Form['meta_facebook_titre'], 'meta_facebook_description' => $Form['meta_facebook_description'], 'meta_facebook_image' => $Form['meta_facebook_image'], 'meta_twitter_type' => $Form['meta_twitter_type'], 'meta_twitter_titre' => $Form['meta_twitter_titre'], 'meta_twitter_description' => $Form['meta_twitter_description'], 'meta_twitter_image' => $Form['meta_twitter_image'], 'meta_twitter_player' => $Form['meta_twitter_player']); foreach ($this->doorGets->getAllLanguages() as $k => $v) { $dataNext['id_module'] = $idModule; $dataNext['langue'] = $k; $dataNext['date_modification'] = time(); $idTraduction[$k] = $this->doorGets->dbQI($dataNext, '_modules_traduction'); } $dataModification['groupe_traduction'] = serialize($idTraduction); $this->doorGets->dbQU($idModule, $dataModification, '_modules'); $this->doorGets->dbQL($this->createSqlPartner($data['uri'])); if ($newTopic) { $dataRub['name'] = $Form['uri']; $dataRub['ordre'] = $cResultsInt + 1; $dataRub['idModule'] = $idModule; $dataRub['showinmenu'] = 1; $dataRub['date_creation'] = time(); $this->doorGets->dbQI($dataRub, '_rubrique'); } $this->addModuleToGroupeList($idModule); FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); header('Location:./?controller=modulepartner&uri=' . $Form['uri']); exit; } FlashInfo::set($this->doorGets->__("Veuillez remplir correctement le formulaire"), "error"); } break; case 'addlink': $Form = $this->doorGets->Form->i; if (!empty($Form)) { $this->doorGets->checkMode(); foreach ($Form as $k => $v) { if (empty($v) && !in_array($k, $nonObligatoire)) { $this->doorGets->Form->e['modules_addlink_' . $k] = 'ok'; } } // gestion de l'uri $Form['uri'] = $uri = strtolower($Form['uri']); $isValidUri = $this->doorGets->isValidUri($uri, '_modules'); if (!$isValidUri) { $this->doorGets->Form->e['modules_addlink_uri'] = 'ok'; } if (strtolower($Form['uri']) === 'doorgets') { $this->doorGets->Form->e['modules_addlink_uri'] = 'ok'; } if (empty($this->doorGets->Form->e)) { if (!array_key_exists('active', $Form)) { $Form['active'] = 0; } $newTopic = false; if (array_key_exists('new_topic', $Form)) { $newTopic = true; unset($Form['new_topic']); } $data['uri'] = $Form['uri']; $data['type'] = 'link'; $data['active'] = $Form['active']; $data['is_first'] = 0; $data['notification_mail'] = 0; $data['date_creation'] = time(); $idModule = $this->doorGets->dbQI($data, '_modules'); $dataNext = array('nom' => $Form['nom'], 'titre' => $Form['titre'], 'description' => $Form['description']); foreach ($this->doorGets->getAllLanguages() as $k => $v) { $dataNext['id_module'] = $idModule; $dataNext['langue'] = $k; $dataNext['date_modification'] = time(); $idTraduction[$k] = $this->doorGets->dbQI($dataNext, '_modules_traduction'); } $dataModification['groupe_traduction'] = serialize($idTraduction); $this->doorGets->dbQU($idModule, $dataModification, '_modules'); $this->createLinkInstance($data['uri']); if ($newTopic) { $dataRub['name'] = $Form['uri']; $dataRub['ordre'] = $cResultsInt + 1; $dataRub['idModule'] = $idModule; $dataRub['showinmenu'] = 1; $dataRub['date_creation'] = time(); $this->doorGets->dbQI($dataRub, '_rubrique'); } $this->addModuleToGroupeList($idModule); FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); header('Location:./?controller=modulelink&uri=' . $Form['uri']); exit; } FlashInfo::set($this->doorGets->__("Veuillez remplir correctement le formulaire"), "error"); } break; case 'editpage': $Form = $this->doorGets->Form->i; if (!empty($Form)) { $this->doorGets->checkMode(); foreach ($Form as $k => $v) { if (empty($v) && !in_array($k, $nonObligatoire)) { $this->doorGets->Form->e['modules_' . $this->doorGets->Action . '_' . $k] = 'ok'; } } if (empty($this->doorGets->Form->e)) { if (!array_key_exists('active', $Form)) { $Form['active'] = 0; } if (!array_key_exists('notification_mail', $Form)) { $Form['notification_mail'] = 0; } if (!array_key_exists('with_password', $Form)) { $Form['with_password'] = 0; } if (!array_key_exists('public_module', $Form)) { $Form['public_module'] = 0; } if (!array_key_exists('public_comment', $Form)) { $Form['public_comment'] = 0; } if (!array_key_exists('public_add', $Form)) { $Form['public_add'] = 0; } if (!array_key_exists('is_first', $Form)) { $Form['is_first'] = 0; } $Form['template_index'] = str_replace('.tpl.php', '', $Form['template_index']); $Form['template_content'] = str_replace('.tpl.php', '', $Form['template_content']); $dataContenu['with_password'] = $Form['with_password']; $dataContenu['public_module'] = $Form['public_module']; $dataContenu['public_comment'] = $Form['public_comment']; $dataContenu['public_add'] = $Form['public_add']; $dataContenu['password'] = $Form['password']; $dataContenu['active'] = $Form['active']; $dataContenu['template_index'] = $Form['template_index']; $dataContenu['template_content'] = $Form['template_content']; $dataContenu['notification_mail'] = $Form['notification_mail']; $dataContenu['is_first'] = $Form['is_first']; if ($dataContenu['is_first'] == 1) { $this->doorGets->dbQL("UPDATE _modules SET is_first = 0 WHERE id >= 1"); $dataModuleWebsite['module_homepage'] = $isContent['uri']; $this->doorGets->dbQU(1, $dataModuleWebsite, '_website'); } $data = array('nom' => $Form['nom'], 'titre' => $Form['titre'], 'description' => $Form['description'], 'top_tinymce' => $Form['top_tinymce'], 'bottom_tinymce' => $Form['bottom_tinymce'], 'meta_titre' => $Form['meta_titre'], 'meta_description' => $Form['meta_description'], 'meta_keys' => $Form['meta_keys'], 'meta_facebook_type' => $Form['meta_facebook_type'], 'meta_facebook_titre' => $Form['meta_facebook_titre'], 'meta_facebook_description' => $Form['meta_facebook_description'], 'meta_facebook_image' => $Form['meta_facebook_image'], 'meta_twitter_type' => $Form['meta_twitter_type'], 'meta_twitter_titre' => $Form['meta_twitter_titre'], 'meta_twitter_description' => $Form['meta_twitter_description'], 'meta_twitter_image' => $Form['meta_twitter_image'], 'meta_twitter_player' => $Form['meta_twitter_player']); $this->doorGets->dbQU($isContent['id'], $dataContenu, '_modules', 'id'); $this->doorGets->dbQU($isContent['id'], $data, '_modules_traduction', 'id_module', " AND langue = '{$lgActuel}' LIMIT 1 "); //$this->doorGets->clearDBCache(); FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); header('Location:' . $_SERVER['REQUEST_URI']); exit; } FlashInfo::set($this->doorGets->__("Veuillez remplir correctement le formulaire"), "error"); } break; case 'editblog': case 'editnews': case 'editvideo': case 'editimage': $Form = $this->doorGets->Form->i; if (!empty($Form)) { $this->doorGets->checkMode(); foreach ($Form as $k => $v) { if (empty($v) && !in_array($k, $nonObligatoire)) { $this->doorGets->Form->e['modules_' . $this->doorGets->Action . '_' . $k] = 'ok'; } } if (empty($this->doorGets->Form->e)) { if (!array_key_exists('active', $Form)) { $Form['active'] = 0; } if (!array_key_exists('author_badge', $Form)) { $Form['author_badge'] = 0; } if (!array_key_exists('with_password', $Form)) { $Form['with_password'] = 0; } if (!array_key_exists('public_module', $Form)) { $Form['public_module'] = 0; } if (!array_key_exists('public_comment', $Form)) { $Form['public_comment'] = 0; } if (!array_key_exists('public_add', $Form)) { $Form['public_add'] = 0; } if (!array_key_exists('notification_mail', $Form)) { $Form['notification_mail'] = 0; } if (!array_key_exists('is_first', $Form)) { $Form['is_first'] = 0; } $Form['template_index'] = str_replace('.tpl.php', '', $Form['template_index']); $Form['template_content'] = str_replace('.tpl.php', '', $Form['template_content']); $dataContenu['with_password'] = $Form['with_password']; $dataContenu['public_module'] = $Form['public_module']; $dataContenu['public_comment'] = $Form['public_comment']; $dataContenu['public_add'] = $Form['public_add']; $dataContenu['password'] = $Form['password']; $dataContenu['active'] = $Form['active']; $dataContenu['author_badge'] = $Form['author_badge']; $dataContenu['bynum'] = $Form['bynum']; $dataContenu['avoiraussi'] = $Form['avoiraussi']; $dataContenu['template_index'] = $Form['template_index']; $dataContenu['template_content'] = $Form['template_content']; $dataContenu['notification_mail'] = $Form['notification_mail']; $dataContenu['uri_notification_moderator'] = $Form['uri_notification_moderator']; $dataContenu['uri_notification_user_success'] = $Form['uri_notification_user_success']; $dataContenu['uri_notification_user_error'] = $Form['uri_notification_user_error']; $dataContenu['is_first'] = $Form['is_first']; if ($dataContenu['is_first'] == 1) { $this->doorGets->dbQL("UPDATE _modules SET is_first = 0 WHERE id >= 1"); $dataModuleWebsite['module_homepage'] = $isContent['uri']; $this->doorGets->dbQU(1, $dataModuleWebsite, '_website'); } $data = array('nom' => $Form['nom'], 'titre' => $Form['titre'], 'description' => $Form['description'], 'top_tinymce' => $Form['top_tinymce'], 'bottom_tinymce' => $Form['bottom_tinymce'], 'meta_titre' => $Form['meta_titre'], 'meta_description' => $Form['meta_description'], 'meta_keys' => $Form['meta_keys'], 'meta_facebook_type' => $Form['meta_facebook_type'], 'meta_facebook_titre' => $Form['meta_facebook_titre'], 'meta_facebook_description' => $Form['meta_facebook_description'], 'meta_facebook_image' => $Form['meta_facebook_image'], 'meta_twitter_type' => $Form['meta_twitter_type'], 'meta_twitter_titre' => $Form['meta_twitter_titre'], 'meta_twitter_description' => $Form['meta_twitter_description'], 'meta_twitter_image' => $Form['meta_twitter_image'], 'meta_twitter_player' => $Form['meta_twitter_player']); $this->doorGets->dbQU($isContent['id'], $dataContenu, '_modules', 'id'); $this->doorGets->dbQU($isContent['id'], $data, '_modules_traduction', 'id_module', " AND langue = '{$lgActuel}' LIMIT 1 "); //$this->doorGets->clearDBCache(); FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); header('Location:' . $_SERVER['REQUEST_URI']); exit; } FlashInfo::set($this->doorGets->__("Veuillez remplir correctement le formulaire"), "error"); } break; case 'editblock': $Form = $this->doorGets->Form->i; if (!empty($Form)) { $this->doorGets->checkMode(); foreach ($Form as $k => $v) { if (empty($v) && !in_array($k, $nonObligatoire)) { $this->doorGets->Form->e['modules_' . $this->doorGets->Action . '_' . $k] = 'ok'; } } if (empty($this->doorGets->Form->e)) { if (!array_key_exists('active', $Form)) { $Form['active'] = 0; } if (!array_key_exists('notification_mail', $Form)) { $Form['notification_mail'] = 0; } if (!array_key_exists('is_first', $Form)) { $Form['is_first'] = 0; } $dataContenu['active'] = $Form['active']; $dataContenu['notification_mail'] = $Form['notification_mail']; $dataContenu['is_first'] = $Form['is_first']; if ($dataContenu['is_first'] == 1) { $this->doorGets->dbQL("UPDATE _modules SET is_first = 0 WHERE id >= 1"); $dataModuleWebsite['module_homepage'] = $isContent['uri']; $this->doorGets->dbQU(1, $dataModuleWebsite, '_website'); } $data = array('titre' => $Form['titre']); $this->doorGets->dbQU($isContent['id'], $dataContenu, '_modules', 'id'); $this->doorGets->dbQU($isContent['id'], $data, '_modules_traduction', 'id_module', " AND langue = '{$lgActuel}' LIMIT 1 "); //$this->doorGets->clearDBCache(); FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); header('Location:' . $_SERVER['REQUEST_URI']); exit; } FlashInfo::set($this->doorGets->__("Veuillez remplir correctement le formulaire"), "error"); } break; case 'editlink': $Form = $this->doorGets->Form->i; if (!empty($Form)) { $this->doorGets->checkMode(); foreach ($Form as $k => $v) { if (empty($v) && !in_array($k, $nonObligatoire)) { $this->doorGets->Form->e['modules_' . $this->doorGets->Action . '_' . $k] = 'ok'; } } if (empty($this->doorGets->Form->e)) { if (!array_key_exists('active', $Form)) { $Form['active'] = 0; } if (!array_key_exists('with_password', $Form)) { $Form['with_password'] = 0; } if (!array_key_exists('public_module', $Form)) { $Form['public_module'] = 0; } if (!array_key_exists('public_comment', $Form)) { $Form['public_comment'] = 0; } if (!array_key_exists('public_add', $Form)) { $Form['public_add'] = 0; } if (!array_key_exists('notification_mail', $Form)) { $Form['notification_mail'] = 0; } if (!array_key_exists('is_first', $Form)) { $Form['is_first'] = 0; } $dataContenu['with_password'] = $Form['with_password']; $dataContenu['public_module'] = $Form['public_module']; $dataContenu['public_comment'] = $Form['public_comment']; $dataContenu['public_add'] = $Form['public_add']; $dataContenu['active'] = $Form['active']; $dataContenu['is_first'] = $Form['is_first']; if ($dataContenu['is_first'] == 1) { $this->doorGets->dbQL("UPDATE _modules SET is_first = 0 WHERE id >= 1"); $dataModuleWebsite['module_homepage'] = $isContent['uri']; $this->doorGets->dbQU(1, $dataModuleWebsite, '_website'); } $data = array('nom' => $Form['nom'], 'titre' => $Form['titre'], 'description' => $Form['description']); $this->doorGets->dbQU($isContent['id'], $dataContenu, '_modules', 'id'); $this->doorGets->dbQU($isContent['id'], $data, '_modules_traduction', 'id_module', " AND langue = '{$lgActuel}' LIMIT 1 "); //$this->doorGets->clearDBCache(); FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); header('Location:' . $_SERVER['REQUEST_URI']); exit; } FlashInfo::set($this->doorGets->__("Veuillez remplir correctement le formulaire"), "error"); } break; case 'editmultipage': case 'editinbox': case 'editfaq': case 'editpartner': $Form = $this->doorGets->Form->i; if (!empty($Form)) { $this->doorGets->checkMode(); foreach ($Form as $k => $v) { if (empty($v) && !in_array($k, $nonObligatoire)) { $this->doorGets->Form->e['modules_' . $this->doorGets->Action . '_' . $k] = 'ok'; } } if (empty($this->doorGets->Form->e)) { if (!array_key_exists('active', $Form)) { $Form['active'] = 0; } if (!array_key_exists('with_password', $Form)) { $Form['with_password'] = 0; } if (!array_key_exists('public_module', $Form)) { $Form['public_module'] = 0; } if (!array_key_exists('public_comment', $Form)) { $Form['public_comment'] = 0; } if (!array_key_exists('public_add', $Form)) { $Form['public_add'] = 0; } if (!array_key_exists('notification_mail', $Form)) { $Form['notification_mail'] = 0; } if (!array_key_exists('is_first', $Form)) { $Form['is_first'] = 0; } $Form['template_index'] = str_replace('.tpl.php', '', $Form['template_index']); $Form['template_content'] = str_replace('.tpl.php', '', $Form['template_content']); $dataContenu['with_password'] = $Form['with_password']; $dataContenu['public_module'] = $Form['public_module']; $dataContenu['public_comment'] = $Form['public_comment']; $dataContenu['public_add'] = $Form['public_add']; $dataContenu['password'] = $Form['password']; $dataContenu['active'] = $Form['active']; $dataContenu['template_index'] = $Form['template_index']; $dataContenu['template_content'] = $Form['template_content']; $dataContenu['notification_mail'] = $Form['notification_mail']; $dataContenu['is_first'] = $Form['is_first']; if ($dataContenu['is_first'] == 1) { $this->doorGets->dbQL("UPDATE _modules SET is_first = 0 WHERE id >= 1"); $dataModuleWebsite['module_homepage'] = $isContent['uri']; $this->doorGets->dbQU(1, $dataModuleWebsite, '_website'); } $data = array('nom' => $Form['nom'], 'titre' => $Form['titre'], 'description' => $Form['description'], 'top_tinymce' => $Form['top_tinymce'], 'bottom_tinymce' => $Form['bottom_tinymce'], 'meta_titre' => $Form['meta_titre'], 'meta_description' => $Form['meta_description'], 'meta_keys' => $Form['meta_keys'], 'meta_facebook_type' => $Form['meta_facebook_type'], 'meta_facebook_titre' => $Form['meta_facebook_titre'], 'meta_facebook_description' => $Form['meta_facebook_description'], 'meta_facebook_image' => $Form['meta_facebook_image'], 'meta_twitter_type' => $Form['meta_twitter_type'], 'meta_twitter_titre' => $Form['meta_twitter_titre'], 'meta_twitter_description' => $Form['meta_twitter_description'], 'meta_twitter_image' => $Form['meta_twitter_image'], 'meta_twitter_player' => $Form['meta_twitter_player']); $this->doorGets->dbQU($isContent['id'], $dataContenu, '_modules', 'id'); $this->doorGets->dbQU($isContent['id'], $data, '_modules_traduction', 'id_module', " AND langue = '{$lgActuel}' LIMIT 1 "); //$this->doorGets->clearDBCache(); FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); header('Location:' . $_SERVER['REQUEST_URI']); exit; } FlashInfo::set($this->doorGets->__("Veuillez remplir correctement le formulaire"), "error"); } break; case 'editgenform': $Form = $this->doorGets->Form->i; $Obligatoire = array('titre', 'uri', 'send_mail_to'); if (!empty($Form)) { $this->doorGets->checkMode(); $dataForm = $this->getArraysForm(); foreach ($Form as $k => $v) { if (empty($v) && in_array($k, $Obligatoire)) { $this->doorGets->Form->e['modules_editgenform_' . $k] = 'ok'; } } // gestion de l'url if (!empty($this->doorGets->Form->i['redirection'])) { $var = $this->doorGets->Form->i['redirection']; $isUrl = filter_var($var, FILTER_VALIDATE_URL); if (empty($isUrl)) { $this->doorGets->Form->e['modules_editgenform_redirection'] = 'ok'; } } if (empty($this->doorGets->Form->e)) { if (!array_key_exists('active', $Form)) { $Form['active'] = 0; } if (!array_key_exists('send_mail', $Form)) { $Form['send_mail'] = 0; } if (!array_key_exists('recaptcha', $Form)) { $Form['recaptcha'] = 0; } $data['active'] = $Form['active']; $data['notification_mail'] = $Form['send_mail']; $data['recaptcha'] = $Form['recaptcha']; $data['redirection'] = $Form['redirection']; $data['date_creation'] = time(); $dataNext['titre'] = $Form['titre']; $dataNext['extras'] = serialize($dataForm); $dataNext['date_modification'] = time(); $this->doorGets->dbQU($isContent['id'], $data, '_modules', 'id'); $this->doorGets->dbQU($isContent['id'], $dataNext, '_modules_traduction', 'id_module', " AND langue = '{$lgActuel}' LIMIT 1 "); //$this->doorGets->clearDBCache(); FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); header('Location:' . $_SERVER['REQUEST_URI']); exit; exit; } FlashInfo::set($this->doorGets->__("Veuillez remplir correctement le formulaire"), "error"); } break; case 'delete': $Form = $this->doorGets->Form->i; if (!empty($Form)) { $this->doorGets->checkMode(); $lgGroupe = unserialize($isContent['groupe_traduction']); foreach ($lgGroupe as $v) { @$this->doorGets->dbQD($v, '_modules_traduction'); } $isContent['uri'] = $isContent['uri']; $this->doorGets->dbQD($isContent['id'], '_modules'); $this->doorGets->dbQL("DELETE FROM _modules_traduction WHERE id_module = '" . $isContent['id'] . "'; "); $this->doorGets->dbQL("DELETE FROM _dg_comments WHERE uri_module = '" . $isContent['uri'] . "'; "); $this->doorGets->dbQL("DELETE FROM _categories WHERE uri_module = '" . $isContent['uri'] . "' ; "); $this->doorGets->dbQL("DELETE FROM _categories_traduction WHERE id_cat Not In (SELECT id_cat FROM _categories) ; "); $this->doorGets->dbQL("DELETE FROM _dg_links WHERE uri_module = '" . $isContent['uri'] . "'; "); $this->doorGets->dbQL("DELETE FROM _dg_inbox WHERE uri_module = '" . $isContent['uri'] . "'; "); $this->doorGets->dbQL("DELETE FROM _dg_page WHERE uri = '" . $isContent['uri'] . "'; "); $this->doorGets->dbQL("DELETE FROM _dg_page_traduction WHERE uri_module = '" . $isContent['uri'] . "'; "); $this->doorGets->dbQL("DELETE FROM _dg_page_version WHERE uri_module = '" . $isContent['uri'] . "'; "); $this->doorGets->dbQL("DELETE FROM _dg_block WHERE uri = '" . $isContent['uri'] . "'; "); $this->doorGets->dbQL("DELETE FROM _dg_block_traduction WHERE uri_module = '" . $isContent['uri'] . "'; "); $this->doorGets->dbQL("DELETE FROM _dg_carousel WHERE uri = '" . $isContent['uri'] . "'; "); $this->doorGets->dbQL("DELETE FROM _dg_carousel_traduction WHERE uri_module = '" . $isContent['uri'] . "'; "); $this->doorGets->dbQL("DELETE FROM _users_track WHERE uri_module = '" . $isContent['uri'] . "'; "); $this->doorGets->dbQL("DELETE FROM _moderation WHERE uri_module = '" . $isContent['uri'] . "'; "); $this->doorGets->dbQL("DROP TABLE IF EXISTS _m_genform_" . $this->doorGets->getRealUri($isContent['uri']) . " "); $this->doorGets->dbQL("DROP TABLE IF EXISTS _m_" . $this->doorGets->getRealUri($isContent['uri']) . " "); $this->doorGets->dbQL("DROP TABLE IF EXISTS _m_" . $this->doorGets->getRealUri($isContent['uri']) . "_traduction "); $this->doorGets->dbQL("DROP TABLE IF EXISTS _m_" . $this->doorGets->getRealUri($isContent['uri']) . "_version "); $_rubrique = $this->doorGets->dbQS($isContent['id'], '_rubrique', 'idModule'); if (!empty($_rubrique)) { $this->doorGets->dbQD($_rubrique['id'], '_rubrique', 'id'); $this->doorGets->dbQL("UPDATE _rubrique SET ordre = ordre - 1 WHERE ordre > " . $_rubrique['ordre'] . " "); } $this->removeModuleFromGroupes($isContent['id']); //$this->doorGets->clearDBCache(); FlashInfo::set($this->doorGets->__("Le module est maintenant supprimer")); header('Location:./?controller=modules&lg=' . $lgActuel); exit; } break; } return $out; }
public function doAction() { $out = ''; $groupes = $this->doorGets->loadGroupes(); $cName = $this->doorGets->controllerNameNow(); // 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, '_users_info'); if (empty($isContent)) { return null; } $LogineExistInfoGroupe = $this->doorGets->dbQS($isContent['network'], '_users_groupes'); if (!empty($LogineExistInfoGroupe)) { $LogineExistInfoGroupe['attributes'] = @unserialize(base64_decode($LogineExistInfoGroupe['attributes'])); } } switch ($this->Action) { case 'index': // to do break; case 'add': // Champs du formulaire non obligatoire $noObligatoire = array('last_name', 'first_name', 'description', 'region'); if (!empty($this->doorGets->Form->i)) { $this->doorGets->checkMode(); foreach ($this->doorGets->Form->i as $k => $v) { if (empty($v) && !in_array($k, $noObligatoire)) { $this->doorGets->Form->e[$this->doorGets->controllerNameNow() . '_add_' . $k] = 'ok'; } } if (!in_array($this->doorGets->Form->i['network'], $this->doorGets->user['liste_enfant_modo'])) { $this->doorGets->Form->e[$this->doorGets->controllerNameNow() . '_add_network'] = 'ok'; } $var = $this->doorGets->Form->i['login']; $isEmail = filter_var($var, FILTER_VALIDATE_EMAIL); $isEmailExist = $this->doorGets->dbQS($var, '_users', 'login'); if (empty($isEmail)) { $this->doorGets->Form->e[$this->doorGets->controllerNameNow() . '_add_login'] = '******'; } if (!empty($isEmailExist)) { $this->doorGets->Form->e[$this->doorGets->controllerNameNow() . '_add_login'] = '******'; } // verification du pseudo if (empty($this->doorGets->Form->e[$this->doorGets->controllerNameNow() . '_add_pseudo'])) { if (strlen($this->doorGets->Form->i['pseudo']) < 3) { $this->doorGets->Form->e[$this->doorGets->controllerNameNow() . '_add_pseudo'] = 'Pseudo trop court'; } if (empty($this->doorGets->Form->e[$this->doorGets->controllerNameNow() . '_add_pseudo'])) { $pseudo = trim(strtolower($this->doorGets->Form->i['pseudo'])); $checkPseudo = ctype_alnum($pseudo); if (empty($checkPseudo)) { $this->doorGets->Form->e[$this->doorGets->controllerNameNow() . '_add_pseudo'] = 'Format invalid'; } $isPseudo = $this->doorGets->dbQS($this->doorGets->Form->i['login'], '_users_info', 'pseudo'); if (!empty($isPseudo)) { $this->doorGets->Form->e[$this->doorGets->controllerNameNow() . '_add_pseudo'] = 'Pseudo deja ulisise'; } } } if (empty($this->doorGets->Form->e)) { $avatar = $this->doorGets->copyGravatar($this->doorGets->Form->i['login']); $crypto = $this->doorGets->_cryptMe($this->doorGets->Form->i['password']); $dataLogin['login'] = $this->doorGets->Form->i['login']; $dataLogin['salt'] = $crypto['salt']; $dataLogin['password'] = $crypto['password']; $email = $this->doorGets->Form->i['login']; $idUser = $this->doorGets->dbQI($dataLogin, '_users'); unset($this->doorGets->Form->i['login']); unset($this->doorGets->Form->i['password']); $d['last_name'] = $this->doorGets->Form->i['last_name']; $d['first_name'] = $this->doorGets->Form->i['first_name']; $d['description'] = $this->doorGets->Form->i['description']; $d['network'] = $this->doorGets->Form->i['network']; $d['active'] = $this->doorGets->Form->i['active']; $d['langue'] = $this->doorGets->Form->i['langue']; $d['horaire'] = $this->doorGets->Form->i['horaire']; $d['pseudo'] = $pseudo; $d['avatar'] = $avatar; $d['id_user'] = $idUser; $d['email'] = $email; $d['editor_html'] = ''; $d['notification_mail'] = 1; $d['date_creation'] = time(); $idUserInfo = $this->doorGets->dbQI($d, '_users_info'); $this->doorGets->createFolderUser($d['pseudo'], $d['id_user']); $redirect = './?controller=users&action=edit&id=' . $idUserInfo; FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); header('Location:' . $redirect); exit; } FlashInfo::set($this->doorGets->__("Veuillez remplir correctement le formulaire"), "error"); } break; case 'edit': // Champs du formulaire non obligatoire $noObligatoire = array('last_name', 'first_name', 'description', 'gender', 'birthday_jour', 'birthday_mois', 'birthday_annee', 'website', 'id_facebook', 'id_twitter', 'id_youtube', 'id_google', 'id_pinterest', 'id_linkedin', 'id_myspace', 'password', 'country', 'city', 'zipcode', 'adresse', 'tel_fix', 'tel_mobil', 'tel_fax', 'region', 'notification_newsletter', 'notification_mail'); if (!empty($this->doorGets->Form->i) && in_array($isContent['network'], $this->doorGets->user['liste_enfant_modo'])) { $this->doorGets->checkMode(); if (!array_key_exists('notification_mail', $this->doorGets->Form->i)) { $this->doorGets->Form->i['notification_mail'] = 0; } if (!array_key_exists('notification_newsletter', $this->doorGets->Form->i)) { $this->doorGets->Form->i['notification_newsletter'] = 0; } // gestion des champs vide foreach ($this->doorGets->Form->i as $k => $v) { $strAttribute = 'attribute'; $isStrAttribute = substr($k, 0, strlen($strAttribute)); if (empty($v) && !in_array($k, $noObligatoire) && $strAttribute !== $isStrAttribute) { $this->doorGets->Form->e[$this->doorGets->controllerNameNow() . '_edit_' . $k] = 'ok'; } } $var = $this->doorGets->Form->i['email']; $isEmail = filter_var($var, FILTER_VALIDATE_EMAIL); if (empty($isEmail)) { $this->doorGets->Form->e[$this->doorGets->controllerNameNow() . '_edit_email'] = 'ok'; } $isEmailExist = $this->doorGets->dbQS($var, '_users_info', 'email', " AND id_user != '" . $isContent['id_user'] . "' LIMIT 1 "); if (!empty($isEmailExist)) { $this->doorGets->Form->e[$this->doorGets->controllerNameNow() . '_add_login'] = '******'; } if (empty($this->doorGets->Form->e)) { $Attributes = $this->doorGets->loadUserAttributesWithValues($isContent['id'], $LogineExistInfoGroupe['attributes']); foreach ($Attributes as $idAttribute => $value) { switch ($value['type']) { case 'file': $sizeMax = 8192000; $typeFile["application/msword"] = "data/_form/"; $typeFile["application/vnd.openxmlformats-officedocument.wordprocessingml.document"] = "data/_form/"; $typeFile["image/png"] = "data/_form/"; $typeFile["image/jpeg"] = "data/_form/"; $typeFile["image/gif"] = "data/_form/"; $typeFile["application/zip"] = "data/_form/"; $typeFile["application/x-zip-compressed"] = "data/_form/"; $typeFile["application/pdf"] = "data/_form/"; $typeFile["application/x-shockwave-flash"] = "data/_form/"; $typeExtension = Constant::$extensions; $strAttribute = $this->doorGets->Form->name . '_attribute_' . $idAttribute; if (isset($_FILES[$strAttribute]) && $_FILES[$strAttribute]['error'] != 0 && empty($value['value'])) { $this->doorGets->Form->e[$strAttribute] = 'ok'; } if (isset($_FILES[$strAttribute]) && empty($this->doorGets->Form->e) && $_FILES[$strAttribute]['error'] != 4) { if (!array_key_exists($_FILES[$strAttribute]["type"], $typeFile)) { $this->doorGets->Form->e[$strAttribute] = 'okcc'; } else { $extension = $typeExtension[$_FILES[$strAttribute]["type"]]; if ($value['params']['filter_file_zip'] === 0 && $extension === 'zip') { $this->doorGets->Form->e[$strAttribute] = 'ok1'; } if ($value['params']['filter_file_png'] === 0 && $extension === 'png') { $this->doorGets->Form->e[$strAttribute] = 'ok22'; } if ($value['params']['filter_file_jpg'] === 0 && $extension === 'jpg') { $this->doorGets->Form->e[$strAttribute] = 'ok3'; } if ($value['params']['filter_file_gif'] === 0 && $extension === 'gif') { $this->doorGets->Form->e[$strAttribute] = 'ok4'; } if ($value['params']['filter_file_swf'] === 0 && $extension === 'swf') { $this->doorGets->Form->e[$strAttribute] = 'ok5'; } if ($value['params']['filter_file_pdf'] === 0 && $extension === 'pdf') { $this->doorGets->Form->e[$strAttribute] = 'ok6'; } if ($value['params']['filter_file_doc'] === 0 && $extension === 'doc') { $this->doorGets->Form->e[$strAttribute] = 'ok7'; } } if ($_FILES[$strAttribute]["size"] > $sizeMax) { $this->doorGets->Form->e[$strAttribute] = 'ok'; } } if (isset($_FILES[$strAttribute]) && empty($this->doorGets->Form->e)) { $uni = time() . '-' . uniqid('doorgets') . ''; $nameFile = $uni . '-user' . $extension; $this->doorGets->Form->i['attribute_' . $idAttribute] = $nameFile; if (move_uploaded_file($_FILES[$strAttribute]['tmp_name'], BASE_DATA . 'users/' . $nameFile)) { $dataAttribute = array('value' => $nameFile, 'date_modification' => time()); $this->doorGets->dbQU($this->doorGets->user['id'], $dataAttribute, '_users_groupes_attributes_values', 'id_user', " AND id_attribute = '{$idAttribute}' LIMIT 1"); } } break; case 'checkbox': $checkboxValues = ''; foreach ($value['params']['filter_select'] as $key => $value) { $strAttribute = 'attribute_' . $idAttribute . '_' . $key; if (array_key_exists($strAttribute, $this->doorGets->Form->i)) { $checkboxValues .= $key . ','; } } $dataAttribute = array('value' => $checkboxValues, 'date_modification' => time()); $this->doorGets->dbQU($this->doorGets->user['id'], $dataAttribute, '_users_groupes_attributes_values', 'id_user', " AND id_attribute = '{$idAttribute}' LIMIT 1"); break; default: $strAttribute = 'attribute_' . $idAttribute; if (array_key_exists($strAttribute, $this->doorGets->Form->i)) { $dataAttribute = array('value' => $this->doorGets->Form->i[$strAttribute], 'date_modification' => time()); $this->doorGets->dbQU($this->doorGets->user['id'], $dataAttribute, '_users_groupes_attributes_values', 'id_user', " AND id_attribute = '{$idAttribute}' LIMIT 1"); } break; } } } if (!in_array($this->doorGets->Form->i['network'], $this->doorGets->user['liste_enfant_modo'])) { $this->doorGets->Form->e[$this->doorGets->controllerNameNow() . '_add_network'] = 'ok'; } // Gestion de l'avatar $extension = '.png'; if (isset($_FILES[$cName . '_edit_avatar']) && ($_FILES[$cName . '_edit_avatar']["type"] == "image/jpeg" || $_FILES[$cName . '_edit_avatar']["type"] == "image/png") && $_FILES[$cName . '_edit_avatar']["error"] === 0) { if ($_FILES[$cName . '_edit_avatar']["type"] == "image/jpeg") { $extension = '.jpg'; } } if (empty($this->doorGets->Form->e) && $_FILES[$cName . '_edit_avatar']['size'] !== 0) { $uni = time() . '-' . uniqid('doorgets') . ''; $nameFileAvatar = $uni . '-user' . $extension; $this->doorGets->Form->i['avatar'] = $nameFileAvatar; move_uploaded_file($_FILES[$cName . '_edit_avatar']['tmp_name'], BASE_DATA . 'users/' . $nameFileAvatar); } if ($_FILES[$cName . '_edit_avatar']['size'] === 0) { unset($this->doorGets->Form->i['avatar']); } if (empty($this->doorGets->Form->e)) { $dataUser['login'] = $this->doorGets->Form->i['email']; if (!empty($this->doorGets->Form->i['password'])) { $crypto = $this->doorGets->_cryptMe($this->doorGets->Form->i['password']); $dataUser['salt'] = $crypto['salt']; $dataUser['password'] = $crypto['password']; $dataUser['token'] = ''; } $d['last_name'] = $this->doorGets->Form->i['last_name']; $d['email'] = $this->doorGets->Form->i['email']; $d['first_name'] = $this->doorGets->Form->i['first_name']; $d['description'] = $this->doorGets->Form->i['description']; $d['network'] = $this->doorGets->Form->i['network']; $d['website'] = $this->doorGets->Form->i['website']; $d['id_facebook'] = $this->doorGets->Form->i['id_facebook']; $d['id_twitter'] = $this->doorGets->Form->i['id_twitter']; $d['id_youtube'] = $this->doorGets->Form->i['id_youtube']; $d['id_google'] = $this->doorGets->Form->i['id_google']; $d['id_pinterest'] = $this->doorGets->Form->i['id_pinterest']; $d['id_linkedin'] = $this->doorGets->Form->i['id_linkedin']; $d['id_myspace'] = $this->doorGets->Form->i['id_myspace']; $d['country'] = $this->doorGets->Form->i['country']; $d['region'] = $this->doorGets->Form->i['region']; $d['city'] = $this->doorGets->Form->i['city']; $d['zipcode'] = $this->doorGets->Form->i['zipcode']; $d['adresse'] = $this->doorGets->Form->i['adresse']; $d['tel_fix'] = $this->doorGets->Form->i['tel_fix']; $d['tel_mobil'] = $this->doorGets->Form->i['tel_mobil']; $d['tel_fax'] = $this->doorGets->Form->i['tel_fax']; $d['active'] = $this->doorGets->Form->i['active']; $d['langue'] = $this->doorGets->Form->i['langue']; $d['horaire'] = $this->doorGets->Form->i['horaire']; $d['profile_type'] = $this->doorGets->Form->i['profile_type']; $d['notification_mail'] = $this->doorGets->Form->i['notification_mail']; $d['notification_newsletter'] = $this->doorGets->Form->i['notification_newsletter']; if (array_key_exists('avatar', $this->doorGets->Form->i)) { $d['avatar'] = $this->doorGets->Form->i['avatar']; } $this->doorGets->dbQU($isContent['id_user'], $dataUser, '_users'); $this->doorGets->dbQU($isContent['id_user'], $d, '_users_info', 'id_user'); $this->changeUserGroupe($isContent['id_user'], $isContent['network'], $d['network']); FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); //$this->doorGets->clearDBCache(); $redirectUrl = './?controller=users&action=edit&id=' . $isContent['id']; header('Location:' . $redirectUrl); exit; } vdump($this->doorGets->Form); FlashInfo::set($this->doorGets->__("Veuillez remplir correctement le formulaire"), "error"); } break; case 'delete': if (!empty($this->doorGets->Form->i) && empty($this->doorGets->Form->e) && in_array($isContent['network'], $this->doorGets->user['liste_enfant_modo']) && $this->doorGets->user['id'] !== $isContent['id']) { $this->doorGets->checkMode(); $this->removeUserFromAll($isContent['id_user']); $this->doorGets->dbQD($isContent['id_user'], '_users', 'id'); $this->doorGets->dbQD($isContent['id_user'], '_users_info', 'id_user'); $this->doorGets->dbQD($isContent['id_user'], '_user_google', 'id_user'); $this->doorGets->dbQD($isContent['id_user'], '_user_facebook', 'id_user'); //$this->doorGets->clearDBCache(); if (is_dir(BASE . 'u/' . $isContent['pseudo'])) { $this->rrmdir(BASE . 'u/' . $isContent['pseudo']); } FlashInfo::set($this->doorGets->__("Vos informations sont bien supprimées")); header('Location:./?controller=users'); exit; } break; } return $out; }
public function requestForms() { // Login $formLogin =& $this->doorGets->Form['login']; if (!empty($formLogin->i)) { $array = array('login' => $formLogin->i['loginEmail'], 'password' => $formLogin->i['loginPassword']); $hasConnected = false; // vérification champ vide foreach ($formLogin->i as $k => $v) { if (empty($v)) { $formLogin->e['login_' . $k] = 'ok'; } } // verification de la taille du password if (strlen($formLogin->i['loginPassword']) < 4) { $formLogin->e['login_loginPassword'] = '******'; } if (!empty($formLogin->e)) { $this->doorGets->fireWallIp(); } else { $LogineExist = $this->doorGets->dbQS($formLogin->i['loginEmail'], '_users', 'login'); if (!empty($LogineExist)) { $hasPassword = $this->doorGets->_decryptMe($formLogin->i['loginPassword'], $LogineExist['salt'], $LogineExist['password']); if ($hasPassword) { $isUserInfos = $this->doorGets->dbQS($LogineExist['id'], '_users_info', 'id_user'); if (!empty($isUserInfos) && ($isUserInfos['active'] == '2' or $isUserInfos['active'] == '5')) { $this->doorGets->clearFireWallIp(); $_token = md5(uniqid(mt_rand(), true)); $_SESSION['doorgets_user']['id'] = $isUserInfos['id_user']; $_SESSION['doorgets_user']['groupe'] = $isUserInfos['network']; $_SESSION['doorgets_user']['login'] = $LogineExist['login']; $_SESSION['doorgets_user']['password'] = $LogineExist['password']; $_SESSION['doorgets_user']['langue'] = $isUserInfos['langue']; $_SESSION['doorgets_user']['token'] = $_token; $this->doorGets->dbQU($LogineExist['id'], array('token' => $_token), '_users'); FlashInfo::set($this->doorGets->__("Connexion réussie")); if ($isUserInfos['active'] == '5') { $this->doorGets->dbQU($LogineExist['id'], array('active' => '2'), '_users_info'); FlashInfo::set($this->doorGets->__("Connexion réussie") . ', ' . $this->doorGets->__("Votre compte est maintenant ouvert")); } header('Location:' . $_SERVER['REQUEST_URI']); $hasConnected = true; } else { $this->doorGets->fireWallIp(); } } } else { $this->doorGets->fireWallIp(); } if (!$hasConnected) { $formLogin->e['login_loginEmail'] = 'ok'; $formLogin->e['login_loginPassword'] = '******'; } } } // Register $formRegister =& $this->doorGets->Form['register']; if (!empty($formRegister->i)) { $groupes = $this->doorGets->loadGroupesSubscriber(); $countGroupes = count($groupes); $idGroupe = null; $hasVerification = true; $errorMsg = ''; if (empty($idActiveGroupe) && $countGroupes === 1) { foreach ($groupes as $key => $value) { $idGroupe = $groupes[$key]['id']; $hasVerfication = $groupes[$key]['verification']; } } elseif (array_key_exists($idActiveGroupe, $groupes)) { $idGroupe = $groupes[$idActiveGroupe]['id']; $hasVerfication = $groupes[$idActiveGroupe]['verification']; } $array = array('registerLastname' => $formRegister->i['registerLastname'], 'registerFirstname' => $formRegister->i['registerFirstname'], 'registerEmail' => $formRegister->i['registerEmail'], 'registerType' => $formRegister->i['registerType'], 'registerPassword' => $formRegister->i['registerPassword'], 'registerCompany' => $formRegister->i['registerCompany'], 'registerAddress' => $formRegister->i['registerAddress'], 'registerZipcode' => $formRegister->i['registerZipcode'], 'registerCity' => $formRegister->i['registerCity'], 'registerCountry' => $formRegister->i['registerCountry'], 'registerPhone' => $formRegister->i['registerPhone']); // vérification champ vide foreach ($formRegister->i as $k => $v) { if (empty($v) && $k !== 'registerCompany') { $formRegister->e['register_' . $k] = 'Vide !'; } } // verification adresse email if (empty($formRegister->e['register_registerEmail'])) { // verification du format mail $email = filter_var($formRegister->i['registerEmail'], FILTER_VALIDATE_EMAIL); if (empty($email)) { $formRegister->e['register_registerEmail'] = 'Format email invalid'; } // verification de l'existance de l'adresse email if (empty($formRegister->e['register_registerEmail'])) { $isEmail = $this->doorGets->dbQS($formRegister->i['registerEmail'], '_users_info', 'email'); $isEmailLogin = $this->doorGets->dbQS($formRegister->i['registerEmail'], '_users', 'login'); if (!empty($isEmail) || !empty($isEmailLogin)) { $formRegister->e['register_registerEmail'] = 'Email deja ulisise'; } } } // création du pseudo $pseudo = 'dg' . uniqid(); $hasMember = $formRegister->e['register_registerPassword'] && $formRegister->i['registerType'] === 'new-member'; // verification du mot de passe if (array_key_exists('register_registerPassword', $formRegister->e) && empty($hasMember)) { if (strlen($formRegister->i['registerPassword']) < 8) { $formRegister->e['register_registerPassword'] = '******'; } } if (empty($formRegister->e) && $countGroupes > 0) { if ($idGroupe) { $avatar = $this->doorGets->copyGravatar($formRegister->i['registerEmail']); $crypto = $this->doorGets->_cryptMe($formRegister->i['registerPassword']); $dataLogin['login'] = $formRegister->i['registerEmail']; $dataLogin['password'] = $crypto['password']; $dataLogin['salt'] = $crypto['salt']; $dataInfo['langue'] = $this->doorGets->myLanguage; $dataInfo['network'] = $idGroupe; $dataInfo['active'] = $hasVerfication ? '3' : '2'; // moderation mode $dataInfo['pseudo'] = $pseudo; $dataInfo['company'] = $formRegister->i['registerCompany']; $dataInfo['email'] = $formRegister->i['registerEmail']; $dataInfo['last_name'] = $formRegister->i['registerLastname']; $dataInfo['first_name'] = $formRegister->i['registerFirstname']; $dataInfo['tel_mobil'] = $formRegister->i['registerPhone']; $dataInfo['notification_newsletter'] = array_key_exists('registerNewsletter', $formRegister->i) ? 1 : 0; $dataInfo['country'] = $formRegister->i['registerCountry']; $dataInfo['city'] = $formRegister->i['registerCity']; $dataInfo['zipcode'] = $formRegister->i['registerZipcode']; $dataInfo['adresse'] = $formRegister->i['registerAddress']; $dataInfo['date_creation'] = time(); $dataInfo['avatar'] = $avatar; $dataInfo['id_user'] = $this->doorGets->dbQI($dataLogin, '_users'); $this->doorGets->dbQI($dataInfo, '_users_info'); // create activation code if ($hasVerfication) { $dataCode['type'] = 'subscribe'; $dataCode['id_user'] = $dataInfo['id_user']; $dataCode['code'] = $this->doorGets->_genRandomKey(45); $dataCode['date_creation'] = time(); $this->doorGets->dbQI($dataCode, '_users_activation'); $this->doorGets->createFolderUser($dataInfo['pseudo'], $dataInfo['id_user']); $lgUser = ''; if (count($this->doorGets->allLanguagesWebsite) > 1) { $lgUser = $this->doorGets->myLanguage . '/'; } $urlToSend = URL_USER . $lgUser . '?controller=authentification&action=activation&code=' . $dataCode['code']; // send mail with code confirmation new SendMailAuth($dataInfo['email'], 'subscribe', $urlToSend, $this->doorGets); } else { // Connect user $_token = md5(uniqid(mt_rand(), true)); $_SESSION['doorgets_user']['id'] = $dataInfo['id_user']; $_SESSION['doorgets_user']['groupe'] = $dataInfo['network']; $_SESSION['doorgets_user']['login'] = $dataLogin['login']; $_SESSION['doorgets_user']['password'] = $dataLogin['password']; $_SESSION['doorgets_user']['langue'] = $dataInfo['langue']; $_SESSION['doorgets_user']['token'] = $_token; $this->doorGets->createFolderUser($dataInfo['pseudo'], $dataInfo['id_user']); $this->doorGets->dbQU($dataInfo['id_user'], array('token' => $_token), '_users'); FlashInfo::set($this->doorGets->__("Connexion réussie")); header('Location:' . $_SERVER['REQUEST_URI']); exit; } $formRegister->isSended = true; } } } $formCodepromo =& $this->doorGets->Form['codepromo']; if (!empty($formCodepromo->i)) { echo '<pre>'; echo $this->doorGets->varDumpArray($formCodepromo->i); exit; } // Address $formAddress =& $this->doorGets->Form['address']; if (!empty($formAddress->i)) { $this->cart->setShippingMethod($formAddress->i['methodShipping']); // echo '<pre>'; // echo $this->doorGets->varDumpArray($formAddress->i); // exit(); $ignore = array('shippingCompany', 'billingCompany', 'shippingPhone', 'billingPhone', 'message'); //$_SESSION = array(); // vdump($_SESSION); // exit(); // vérification champ vide foreach ($formAddress->i as $k => $v) { if (empty($v) && !in_array($k, $ignore)) { $formAddress->e['address_' . $k] = 'ok'; } } if (empty($formAddress->e)) { $time = time(); $timeHuman = ucfirst(strftime("%A %d %B %Y %H:%M", $time)); $this->order['reference'] = 'DG' . $this->user['id'] . uniqid(); $this->order['shipping_lastname'] = $formAddress->i['shippingLastname']; $this->order['shipping_firstname'] = $formAddress->i['shippingFirstname']; $this->order['shipping_company'] = $formAddress->i['shippingCompany']; $this->order['shipping_address'] = $formAddress->i['shippingAddress']; $this->order['shipping_zipcode'] = $formAddress->i['shippingZipcode']; $this->order['shipping_city'] = $formAddress->i['shippingCity']; $this->order['shipping_country'] = $formAddress->i['shippingCountry']; $this->order['shipping_phone'] = $formAddress->i['shippingPhone']; $this->order['billing_lastname'] = $formAddress->i['billingLastname']; $this->order['billing_firstname'] = $formAddress->i['billingFirstname']; $this->order['billing_company'] = $formAddress->i['billingCompany']; $this->order['billing_address'] = $formAddress->i['billingAddress']; $this->order['billing_zipcode'] = $formAddress->i['billingZipcode']; $this->order['billing_city'] = $formAddress->i['billingCity']; $this->order['billing_country'] = $formAddress->i['billingCountry']; $this->order['billing_phone'] = $formAddress->i['billingPhone']; $this->methodBilling = $formAddress->i['methodBilling']; $this->methodShipping = $formAddress->i['methodShipping']; $this->order['type'] = Constant::$orderType['checkout']; $this->order['status'] = $this->status; $this->order['langue'] = $this->langue; $this->order['vat'] = 20; $this->order['amount'] = $this->cart->getTotalAmountPromoVAT(); $this->order['amount_real'] = $this->cart->getTotalAmountVAT(); $this->order['amount_billing'] = $this->cart->getTotalBillingAmount(); $this->order['amount_profit'] = $this->cart->getTotalProfitAmount(); $this->order['amount_vat'] = $this->cart->getTotalVATAmount(); $this->order['amount_with_shipping'] = $this->cart->getTotalAmountPromoShippingVAT(); $this->order['count'] = $this->cart->getCount(); $this->order['currency'] = $this->currency; $this->order['shipping_amount'] = $this->cart->shippingAmount; $this->order['method_billing'] = $this->methodBilling; $this->order['method_shipping'] = $this->methodShipping; $this->order['date_creation'] = $time; $this->order['date_creation_human'] = $timeHuman; $this->order['date_modification'] = $time; $this->order['date_modification_human'] = $timeHuman; $this->order['products'] = base64_encode(serialize($this->products)); $this->order['message'] = $formAddress->i['message']; $orderEntity = new OrderEntity($this->order, $this->doorGets); $orderEntity->save(false); $_SESSION['cart_info']['orderId'] = $this->order['id'] = $orderEntity->getId(); $paymentUrl = './?payment&lg=' . $this->langue; if ($this->methodBilling === 'paypal') { $paypalService = new PaypalService($this->doorGets, $this->cart); $paymentUrl = $paypalService->getUrl(); } header('Location:' . $paymentUrl); exit; } } }
public function doAction() { $out = ''; $lgTraduction = $this->doorGets->getLangueTradution(true); switch ($this->Action) { case 'oauth': if (!empty($this->doorGets->Form->i)) { $this->doorGets->checkMode(); if (!array_key_exists('oauth_google_active', $this->doorGets->Form->i)) { $this->doorGets->Form->i['oauth_google_active'] = 0; } if (!array_key_exists('oauth_facebook_active', $this->doorGets->Form->i)) { $this->doorGets->Form->i['oauth_facebook_active'] = 0; } $dDefault['oauth_google_id'] = $this->doorGets->Form->i['oauth_google_id']; $dDefault['oauth_google_secret'] = $this->doorGets->Form->i['oauth_google_secret']; $dDefault['oauth_google_active'] = $this->doorGets->Form->i['oauth_google_active']; $dDefault['oauth_facebook_id'] = $this->doorGets->Form->i['oauth_facebook_id']; $dDefault['oauth_facebook_secret'] = $this->doorGets->Form->i['oauth_facebook_secret']; $dDefault['oauth_facebook_active'] = $this->doorGets->Form->i['oauth_facebook_active']; $this->doorGets->dbQU(1, $dDefault, '_website'); FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); header("Location:" . $_SERVER['REQUEST_URI']); exit; } break; case 'smtp': if (!empty($this->doorGets->Form->i)) { $this->doorGets->checkMode(); if (!array_key_exists('smtp_mandrill_active', $this->doorGets->Form->i)) { $this->doorGets->Form->i['smtp_mandrill_active'] = 0; } if (!array_key_exists('smtp_mandrill_ssl', $this->doorGets->Form->i)) { $this->doorGets->Form->i['smtp_mandrill_ssl'] = 0; } $dDefault['smtp_mandrill_active'] = $this->doorGets->Form->i['smtp_mandrill_active']; $dDefault['smtp_mandrill_ssl'] = $this->doorGets->Form->i['smtp_mandrill_ssl']; $dDefault['smtp_mandrill_host'] = $this->doorGets->Form->i['smtp_mandrill_host']; $dDefault['smtp_mandrill_port'] = $this->doorGets->Form->i['smtp_mandrill_port']; $dDefault['smtp_mandrill_username'] = $this->doorGets->Form->i['smtp_mandrill_username']; $dDefault['smtp_mandrill_password'] = $this->doorGets->Form->i['smtp_mandrill_password']; $this->doorGets->dbQU(1, $dDefault, '_website'); FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); header("Location:" . $_SERVER['REQUEST_URI']); exit; } break; // case 'stripe': // if (!empty($this->doorGets->Form->i) ) { // $this->doorGets->checkMode(); // if (!array_key_exists('stripe_active',$this->doorGets->Form->i)) { // $this->doorGets->Form->i['stripe_active'] = 0; // } // $dDefault['stripe_active'] = $this->doorGets->Form->i['stripe_active']; // $dDefault['stripe_secret_key'] = $this->doorGets->Form->i['stripe_secret_key']; // $dDefault['stripe_publishable_key'] = $this->doorGets->Form->i['stripe_publishable_key']; // $this->doorGets->dbQU(1,$dDefault,'_website'); // FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); // header("Location:".$_SERVER['REQUEST_URI']); exit(); // } // break; // case 'paypal': // if (!empty($this->doorGets->Form->i) ) { // $this->doorGets->checkMode(); // if (!array_key_exists('paypal_active',$this->doorGets->Form->i)) { // $this->doorGets->Form->i['paypal_active'] = 0; // } // if (!array_key_exists('paypal_demo',$this->doorGets->Form->i)) { // $this->doorGets->Form->i['paypal_demo'] = 0; // } // $dDefault['paypal_demo'] = $this->doorGets->Form->i['paypal_demo']; // $dDefault['paypal_active'] = $this->doorGets->Form->i['paypal_active']; // $dDefault['paypal_user'] = $this->doorGets->Form->i['paypal_user']; // $dDefault['paypal_password'] = $this->doorGets->Form->i['paypal_password']; // $dDefault['paypal_signature'] = $this->doorGets->Form->i['paypal_signature']; // $dDefault['paypal_returnurl'] = $this->doorGets->Form->i['paypal_returnurl']; // $dDefault['paypal_cancelurl'] = $this->doorGets->Form->i['paypal_cancelurl']; // $this->doorGets->dbQU(1,$dDefault,'_website'); // FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); // header("Location:".$_SERVER['REQUEST_URI']); exit(); // } // break; // case 'transfer': // if (!empty($this->doorGets->Form->i) ) { // $this->doorGets->checkMode(); // if (!array_key_exists('transfer_active',$this->doorGets->Form->i)) { // $this->doorGets->Form->i['transfer_active'] = 0; // } // $dDefault['transfer_active'] = $this->doorGets->Form->i['transfer_active']; // $dDefault['transfer_tinymce'] = $this->doorGets->Form->i['transfer_tinymce']; // $this->doorGets->dbQU(1,$dDefault,'_website'); // FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); // header("Location:".$_SERVER['REQUEST_URI']); exit(); // } // break; // case 'check': // if (!empty($this->doorGets->Form->i) ) { // $this->doorGets->checkMode(); // if (!array_key_exists('check_active',$this->doorGets->Form->i)) { // $this->doorGets->Form->i['check_active'] = 0; // } // $dDefault['check_active'] = $this->doorGets->Form->i['check_active']; // $dDefault['check_tinymce'] = $this->doorGets->Form->i['check_tinymce']; // $this->doorGets->dbQU(1,$dDefault,'_website'); // FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); // header("Location:".$_SERVER['REQUEST_URI']); exit(); // } // break; // case 'cash': // if (!empty($this->doorGets->Form->i) ) { // $this->doorGets->checkMode(); // if (!array_key_exists('cash_active',$this->doorGets->Form->i)) { // $this->doorGets->Form->i['cash_active'] = 0; // } // $dDefault['cash_active'] = $this->doorGets->Form->i['cash_active']; // $dDefault['cash_tinymce'] = $this->doorGets->Form->i['cash_tinymce']; // $this->doorGets->dbQU(1,$dDefault,'_website'); // FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); // header("Location:".$_SERVER['REQUEST_URI']); exit(); // } // break; // case 'stripe': // if (!empty($this->doorGets->Form->i) ) { // $this->doorGets->checkMode(); // if (!array_key_exists('stripe_active',$this->doorGets->Form->i)) { // $this->doorGets->Form->i['stripe_active'] = 0; // } // $dDefault['stripe_active'] = $this->doorGets->Form->i['stripe_active']; // $dDefault['stripe_secret_key'] = $this->doorGets->Form->i['stripe_secret_key']; // $dDefault['stripe_publishable_key'] = $this->doorGets->Form->i['stripe_publishable_key']; // $this->doorGets->dbQU(1,$dDefault,'_website'); // FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); // header("Location:".$_SERVER['REQUEST_URI']); exit(); // } // break; // case 'paypal': // if (!empty($this->doorGets->Form->i) ) { // $this->doorGets->checkMode(); // if (!array_key_exists('paypal_active',$this->doorGets->Form->i)) { // $this->doorGets->Form->i['paypal_active'] = 0; // } // if (!array_key_exists('paypal_demo',$this->doorGets->Form->i)) { // $this->doorGets->Form->i['paypal_demo'] = 0; // } // $dDefault['paypal_demo'] = $this->doorGets->Form->i['paypal_demo']; // $dDefault['paypal_active'] = $this->doorGets->Form->i['paypal_active']; // $dDefault['paypal_user'] = $this->doorGets->Form->i['paypal_user']; // $dDefault['paypal_password'] = $this->doorGets->Form->i['paypal_password']; // $dDefault['paypal_signature'] = $this->doorGets->Form->i['paypal_signature']; // $dDefault['paypal_returnurl'] = $this->doorGets->Form->i['paypal_returnurl']; // $dDefault['paypal_cancelurl'] = $this->doorGets->Form->i['paypal_cancelurl']; // $this->doorGets->dbQU(1,$dDefault,'_website'); // FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); // header("Location:".$_SERVER['REQUEST_URI']); exit(); // } // break; // case 'transfer': // if (!empty($this->doorGets->Form->i) ) { // $this->doorGets->checkMode(); // if (!array_key_exists('transfer_active',$this->doorGets->Form->i)) { // $this->doorGets->Form->i['transfer_active'] = 0; // } // $dDefault['transfer_active'] = $this->doorGets->Form->i['transfer_active']; // $dDefault['transfer_tinymce'] = $this->doorGets->Form->i['transfer_tinymce']; // $this->doorGets->dbQU(1,$dDefault,'_website'); // FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); // header("Location:".$_SERVER['REQUEST_URI']); exit(); // } // break; // case 'check': // if (!empty($this->doorGets->Form->i) ) { // $this->doorGets->checkMode(); // if (!array_key_exists('check_active',$this->doorGets->Form->i)) { // $this->doorGets->Form->i['check_active'] = 0; // } // $dDefault['check_active'] = $this->doorGets->Form->i['check_active']; // $dDefault['check_tinymce'] = $this->doorGets->Form->i['check_tinymce']; // $this->doorGets->dbQU(1,$dDefault,'_website'); // FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); // header("Location:".$_SERVER['REQUEST_URI']); exit(); // } // break; // case 'cash': // if (!empty($this->doorGets->Form->i) ) { // $this->doorGets->checkMode(); // if (!array_key_exists('cash_active',$this->doorGets->Form->i)) { // $this->doorGets->Form->i['cash_active'] = 0; // } // $dDefault['cash_active'] = $this->doorGets->Form->i['cash_active']; // $dDefault['cash_tinymce'] = $this->doorGets->Form->i['cash_tinymce']; // $this->doorGets->dbQU(1,$dDefault,'_website'); // FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); // header("Location:".$_SERVER['REQUEST_URI']); exit(); // } // break; case 'saas': if (!empty($this->doorGets->Form->i)) { $this->doorGets->checkMode(); // vérification champ vide foreach ($this->doorGets->Form->i as $k => $v) { if (empty($v) && $k !== 'saas_name') { $this->doorGets->Form->e['configuration_saas_' . $k] = 'ok'; } } $dDefault = array('saas_host' => $this->doorGets->Form->i['saas_host'], 'saas_user' => $this->doorGets->Form->i['saas_user'], 'saas_password' => $this->doorGets->Form->i['saas_password'], 'saas_archive' => $this->doorGets->Form->i['saas_archive'], 'saas_position' => $this->doorGets->Form->i['saas_position']); if (empty($this->doorGets->Form->e)) { $this->doorGets->dbQU(1, $dDefault, '_website'); FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); header("Location:" . $_SERVER['REQUEST_URI']); exit; } FlashInfo::set($this->doorGets->__("Veuillez remplir correctement le formulaire"), "error"); } break; case 'siteweb': if (!empty($this->doorGets->Form->i)) { $this->doorGets->checkMode(); $excludedFields = array('statut', 'statut_ip', 'statut_tinymce', 'id_facebook', 'id_disqus', 'id_disqus', 'signature_tinymce', 'cgu_tinymce', 'privacy_tinymce', 'terms_tinymce'); // vérification champ vide foreach ($this->doorGets->Form->i as $k => $v) { if (empty($v) && !in_array($k, $excludedFields)) { $this->doorGets->Form->e['configuration_siteweb_' . $k] = 'ok'; } } if (empty($this->doorGets->Form->e)) { $dDefault['statut'] = $this->doorGets->Form->i['statut']; $dDefault['statut_ip'] = $this->doorGets->Form->i['statut_ip']; $dDefault['id_facebook'] = $this->doorGets->Form->i['id_facebook']; $dDefault['id_disqus'] = $this->doorGets->Form->i['id_disqus']; $dDefaultTraduction = array('title' => $this->doorGets->Form->i['title'], 'slogan' => $this->doorGets->Form->i['slogan'], 'description' => $this->doorGets->Form->i['description'], 'copyright' => $this->doorGets->Form->i['copyright'], 'year' => $this->doorGets->Form->i['year'], 'keywords' => $this->doorGets->Form->i['keywords'], 'statut_tinymce' => $this->doorGets->Form->i['statut_tinymce'], 'signature_tinymce' => $this->doorGets->Form->i['signature_tinymce'], 'cgu_tinymce' => $this->doorGets->Form->i['cgu_tinymce'], 'terms_tinymce' => $this->doorGets->Form->i['terms_tinymce'], 'privacy_tinymce' => $this->doorGets->Form->i['privacy_tinymce']); // $dDefaultTraduction['store_vat'] = (float) $this->doorGets->Form->i['store_vat']; // $dDefaultTraduction['shipping_free_info'] = $this->doorGets->Form->i['shipping_free_info']; // $dDefaultTraduction['shipping_free_active'] = $this->doorGets->Form->i['shipping_free_active']; // $dDefaultTraduction['shipping_slow_info'] = $this->doorGets->Form->i['shipping_slow_info']; // $dDefaultTraduction['shipping_slow_amount'] = $this->doorGets->Form->i['shipping_slow_amount']; // $dDefaultTraduction['shipping_slow_active'] = $this->doorGets->Form->i['shipping_slow_active']; // $dDefaultTraduction['shipping_fast_info'] = $this->doorGets->Form->i['shipping_fast_info']; // $dDefaultTraduction['shipping_fast_amount'] = $this->doorGets->Form->i['shipping_fast_amount']; // $dDefaultTraduction['shipping_fast_active'] = $this->doorGets->Form->i['shipping_fast_active']; $this->doorGets->dbQU(1, $dDefault, '_website'); $this->doorGets->dbQU($lgTraduction, $dDefaultTraduction, '_website_traduction', 'langue'); //$this->doorGets->clearDBCache(); FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); header("Location:" . $_SERVER['REQUEST_URI']); exit; } FlashInfo::set($this->doorGets->__("Veuillez remplir correctement le formulaire"), "error"); } break; case 'langue': if (!empty($this->doorGets->Form->i)) { $this->doorGets->checkMode(); $timeZone = $this->doorGets->getArrayForms('times_zone'); $timeZoneNow = $this->doorGets->configWeb['horaire']; $arrLangueUp = array(); if (!SAAS_ENV || SAAS_ENV && SAAS_CONFIG_LANGUE) { foreach ($this->doorGets->getAllLanguages() as $k => $v) { if (array_key_exists('lg_groupe_' . $k, $this->doorGets->Form->i)) { $arrLangueUp[$k] = $v; } } } $groupeLangue = serialize($arrLangueUp); $isTimeZone = $timeZoneNow; if (array_key_exists($this->doorGets->Form->i['horaire'], $timeZone)) { $isTimeZone = $this->doorGets->Form->i['horaire']; } $isLangue = $this->doorGets->configWeb['langue']; if (array_key_exists($this->doorGets->Form->i['lg'], $this->doorGets->getAllLanguages())) { $isLangue = $this->doorGets->Form->i['lg']; } $isLangueFront = $this->doorGets->configWeb['langue_front']; if (array_key_exists($this->doorGets->Form->i['lg_front'], $this->doorGets->getAllLanguages())) { $isLangueFront = $this->doorGets->Form->i['lg_front']; } $data['horaire'] = $isTimeZone; $data['langue'] = $isLangue; $data['langue_front'] = $isLangueFront; $data['langue_groupe'] = $groupeLangue; if (empty($this->doorGets->Form->e)) { //$this->doorGets->clearDBCache(); $this->doorGets->dbQU(1, $data, '_website'); FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); header("Location:" . $_SERVER['REQUEST_URI']); exit; } FlashInfo::set($this->doorGets->__("Veuillez remplir correctement le formulaire"), "error"); } break; case 'media': // Update logo image, png image only. if (isset($_FILES['configuration_media_logo_img_logo'])) { $this->doorGets->checkMode(); if ($_FILES['configuration_media_logo_img_logo']['type'] === 'image/png') { list($fichier_larg, $fichier_haut, $fichier_type) = getimagesize($_FILES['configuration_media_logo_img_logo']['tmp_name']); $newFileName = BASE_IMG . 'logo.png'; @copy($_FILES['configuration_media_logo_img_logo']['tmp_name'], $newFileName); FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); header("Location:" . $_SERVER['REQUEST_URI']); exit; } } // Update logo image, png image only. if (isset($_FILES['configuration_media_logo_backoffice_img_logo'])) { $this->doorGets->checkMode(); if ($_FILES['configuration_media_logo_backoffice_img_logo']['type'] === 'image/png') { list($fichier_larg, $fichier_haut, $fichier_type) = getimagesize($_FILES['configuration_media_logo_backoffice_img_logo']['tmp_name']); $newFileName = BASE_IMG . 'logo_backoffice.png'; @copy($_FILES['configuration_media_logo_backoffice_img_logo']['tmp_name'], $newFileName); FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); header("Location:" . $_SERVER['REQUEST_URI']); exit; } else { FlashInfo::set($this->doorGets->__("Veuillez remplir correctement le formulaire"), 'error'); } } // Update logo auth image, png image only. if (isset($_FILES['configuration_media_logo_authentification_img_logo'])) { $this->doorGets->checkMode(); if ($_FILES['configuration_media_logo_authentification_img_logo']['type'] === 'image/png') { list($fichier_larg, $fichier_haut, $fichier_type) = getimagesize($_FILES['configuration_media_logo_authentification_img_logo']['tmp_name']); $newFileName = BASE_IMG . 'logo_auth.png'; @copy($_FILES['configuration_media_logo_authentification_img_logo']['tmp_name'], $newFileName); FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); header("Location:" . $_SERVER['REQUEST_URI']); exit; } else { FlashInfo::set($this->doorGets->__("Veuillez remplir correctement le formulaire"), 'error'); } } // Update logo auth image, png image only. if (isset($_FILES['configuration_media_logo_mail_img_logo'])) { $this->doorGets->checkMode(); if ($_FILES['configuration_media_logo_mail_img_logo']['type'] === 'image/png') { list($fichier_larg, $fichier_haut, $fichier_type) = getimagesize($_FILES['configuration_media_logo_mail_img_logo']['tmp_name']); $newFileName = BASE_IMG . 'logo_mail.png'; @copy($_FILES['configuration_media_logo_mail_img_logo']['tmp_name'], $newFileName); FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); header("Location:" . $_SERVER['REQUEST_URI']); exit; } else { FlashInfo::set($this->doorGets->__("Veuillez remplir correctement le formulaire"), 'error'); } } // Update icone image, *.ico image only. if (isset($_FILES['configuration_media_logo_icone_logo'])) { $this->doorGets->checkMode(); if ($_FILES['configuration_media_logo_icone_logo']['type'] === 'image/x-icon' || $_FILES['configuration_media_logo_icone_logo']['type'] === 'image/vnd.microsoft.icon') { list($fichier_larg, $fichier_haut, $fichier_type) = getimagesize($_FILES['configuration_media_logo_icone_logo']['tmp_name']); $newFileName = BASE . 'favicon.ico'; copy($_FILES['configuration_media_logo_icone_logo']['tmp_name'], $newFileName); FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); header("Location:" . $_SERVER['REQUEST_URI']); exit; } else { FlashInfo::set($this->doorGets->__("Veuillez remplir correctement le formulaire"), 'error'); } } break; case 'params': if (!empty($this->doorGets->Form->i) && empty($this->doorGets->Form->e)) { $this->doorGets->checkMode(); $iForm = $this->doorGets->Form->i; if (!filter_var($iForm['url'], FILTER_VALIDATE_URL)) { FlashInfo::set($this->doorGets->__("L'url n'est pas valide"), "error"); $this->doorGets->Form->e['configuration_params_url'] = 'ok'; } $protocol = in_array($iForm['protocol'], array('http://', 'https://')) ? $iForm['protocol'] : 'http://'; if (empty($this->doorGets->Form->e)) { $val_url = strtolower($iForm['url']); $val_url = str_replace('http://', '', $val_url); $val_url = str_replace('https://', '', $val_url); $val_cache = 'false'; if ($iForm['cache'] == 1) { $val_cache = 'true'; } $saasEnv = SAAS_ENV ? 'true' : 'false'; $activeDemo = ACTIVE_DEMO ? 'true' : 'false'; $iOut = ''; $iOut .= "<?php" . PHP_EOL; $iOut .= "define('SAAS_ENV'," . $saasEnv . ");" . PHP_EOL; $iOut .= "define('ACTIVE_CACHE'," . $val_cache . ");" . PHP_EOL; $iOut .= "define('ACTIVE_DEMO'," . $activeDemo . ");" . PHP_EOL; $iOut .= "define('KEY_SECRET','" . KEY_SECRET . "');" . PHP_EOL; $iOut .= "define('KEY_DOORGETS','" . KEY_DOORGETS . "');" . PHP_EOL; $iOut .= "define('APP',BASE.'doorgets/app/');" . PHP_EOL; $iOut .= "define('CORE',BASE.'doorgets/core/');" . PHP_EOL; $iOut .= "define('LIB',BASE.'doorgets/lib/');" . PHP_EOL; $iOut .= "define('CONFIG',BASE.'config/');" . PHP_EOL; $iOut .= "define('TEMPLATE',BASE.'doorgets/template/');" . PHP_EOL; $iOut .= "define('ROUTER',BASE.'doorgets/routers/');" . PHP_EOL; $iOut .= "define('CONFIGURATION',BASE.'config/');" . PHP_EOL; $iOut .= "define('THEME',BASE.'themes/');" . PHP_EOL; $iOut .= "define('LANGUE',BASE.'doorgets/locale/');" . PHP_EOL; $iOut .= "define('LANGUE_DEFAULT_FILE',BASE.'doorgets/locale/temp.lg.php');" . PHP_EOL; $iOut .= "define('CONTROLLERS',BASE.'doorgets/app/controllers/');" . PHP_EOL; $iOut .= "define('REQUESTS',BASE.'doorgets/app/requests/');" . PHP_EOL; $iOut .= "define('VIEWS',BASE.'doorgets/app/views/');" . PHP_EOL; $iOut .= "define('MODULES',BASE.'doorgets/app/modules/');" . PHP_EOL; $iOut .= "define('BASE_DATA',BASE.'data/');" . PHP_EOL; $iOut .= "define('BASE_IMG',BASE.'skin/img/');" . PHP_EOL; $iOut .= "define('BASE_CSS',BASE.'skin/css/');" . PHP_EOL; $iOut .= "define('BASE_JS',BASE.'skin/js/');" . PHP_EOL; $iOut .= "define('CACHE_DB',BASE.'cache/database/');" . PHP_EOL; $iOut .= "define('CACHE_TEMPLATE',BASE.'cache/template/');" . PHP_EOL; $iOut .= "define('CACHE_THEME',BASE.'cache/themes/');" . PHP_EOL; $iOut .= "define('PROTOCOL','" . $protocol . "');" . PHP_EOL; $iOut .= "define('URL',PROTOCOL.'" . $val_url . "');" . PHP_EOL; $iOut .= "define('URL_ADMIN',URL.'');" . PHP_EOL; $iOut .= "define('URL_USER',URL.'dg-user/');" . PHP_EOL; $iOut .= "define('SQL_HOST','" . SQL_HOST . "');" . PHP_EOL; $iOut .= "define('SQL_LOGIN','" . SQL_LOGIN . "');" . PHP_EOL; $iOut .= "define('SQL_PWD','" . SQL_PWD . "');" . PHP_EOL; $iOut .= "define('SQL_DB','" . SQL_DB . "');" . PHP_EOL; $iOut .= "define('SQL_VERSION','" . SQL_VERSION . "');" . PHP_EOL; $iOut .= "require_once CONFIGURATION.'includes.php';" . PHP_EOL; $confFile = CONFIGURATION . 'config.php'; if (is_file($confFile)) { file_put_contents($confFile, $iOut); } FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); //$this->doorGets->clearDBCache(); header("Location:" . $_SERVER['REQUEST_URI']); exit; } } break; case 'modules': if (!empty($this->doorGets->Form->i) && empty($this->doorGets->Form->e)) { $this->doorGets->checkMode(); $iForm = $this->doorGets->Form->i; $data['m_sitemap'] = 0; $data['m_comment'] = 0; $data['m_comment_facebook'] = 0; $data['m_comment_disqus'] = 0; $data['m_sharethis'] = 0; $data['m_newsletter'] = 0; $data['m_rss'] = 0; if (array_key_exists('sitemap', $iForm)) { $data['m_sitemap'] = 1; } if (array_key_exists('newsletter', $iForm)) { $data['m_newsletter'] = 1; } if (array_key_exists('rss', $iForm)) { $data['m_rss'] = 1; } if (array_key_exists('comment', $iForm)) { $data['m_comment'] = 1; } if (array_key_exists('comment_facebook', $iForm)) { $data['m_comment_facebook'] = 1; } if (array_key_exists('comment_disqus', $iForm)) { $data['m_comment_disqus'] = 1; } if (array_key_exists('sharethis', $iForm)) { $data['m_sharethis'] = 1; } FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); $this->doorGets->dbQU(1, $data, '_website'); //$this->doorGets->clearDBCache(); header("Location:" . $_SERVER['REQUEST_URI']); exit; } break; case 'adresse': $allAddress = $this->doorGets->configWeb['addresses']; $iAddress = count($allAddress); if ($iAddress > 0) { $iAddress--; for ($i = 0; $i < 3; $i++) { if (!empty($this->doorGets->Form['remove_' . $i]->i)) { unset($allAddress[$i]); sort($allAddress); $allAddress = serialize($allAddress); $dataUp = array('addresses' => $allAddress); FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); $this->doorGets->dbQU(1, $dataUp, '_website'); //$this->doorGets->clearDBCache(); header("Location:" . $_SERVER['REQUEST_URI']); exit; } if (!empty($this->doorGets->Form[$i]->i)) { $this->doorGets->checkMode(); $required = array('title', 'country', 'city', 'zipcode', 'address'); foreach ($this->doorGets->Form[$i]->i as $k => $v) { $this->doorGets->Form[$i]->i[$k] = filter_input(INPUT_POST, 'configuration_adresse_' . $i . '_' . $k, FILTER_SANITIZE_STRING); if (empty($v) && in_array($k, $required)) { $this->doorGets->Form[$i]->e['configuration_adresse_' . $i . '_' . $k] = 'ok'; } } if (empty($this->doorGets->Form[$i]->e)) { $data = $this->doorGets->Form[$i]->i; $dataToSave = array('id_address' => $data['id_address'], 'title' => $data['title'], 'country' => $data['country'], 'region' => $data['region'], 'city' => $data['city'], 'zipcode' => $data['zipcode'], 'address' => $data['address'], 'phone' => $data['phone'], 'email' => $data['email'], 'url' => $data['address'] . ', ' . $data['zipcode'] . ', ' . $data['city'] . ', ' . $data['region'] . ', ' . $data['country']); $allAddress[$i] = $dataToSave; $allAddress = serialize($allAddress); $dataUp = array('addresses' => $allAddress); FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); $this->doorGets->dbQU(1, $dataUp, '_website'); //$this->doorGets->clearDBCache(); header("Location:" . $_SERVER['REQUEST_URI']); exit; } FlashInfo::set($this->doorGets->__("Veuillez saisir correctement votre adresse e-mail"), "error"); } } } if (!empty($this->doorGets->Form['new']->i)) { $this->doorGets->checkMode(); $required = array('title', 'country', 'city', 'zipcode', 'address'); foreach ($this->doorGets->Form['new']->i as $k => $v) { $this->doorGets->Form['new']->i[$k] = filter_input(INPUT_POST, 'configuration_adresse_' . $k, FILTER_SANITIZE_STRING); if (empty($v) && in_array($k, $required)) { $this->doorGets->Form['new']->e['configuration_adresse_' . $k] = 'ok'; } } if (empty($this->doorGets->Form['new']->e)) { $data = $this->doorGets->Form['new']->i; $dataToSave = array('id_address' => $data['id_address'], 'title' => $data['title'], 'country' => $data['country'], 'region' => $data['region'], 'city' => $data['city'], 'zipcode' => $data['zipcode'], 'address' => $data['address'], 'phone' => $data['phone'], 'email' => $data['email'], 'url' => $data['address'] . ', ' . $data['zipcode'] . ', ' . $data['city'] . ', ' . $data['region'] . ', ' . $data['country']); if (is_array($this->doorGets->configWeb['addresses'])) { $allAddress = $this->doorGets->configWeb['addresses']; array_push($allAddress, $dataToSave); } else { $allAddress = array($dataToSave); } $allAddress = serialize($allAddress); $dataUp = array('addresses' => $allAddress); FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); $this->doorGets->dbQU(1, $dataUp, '_website'); //$this->doorGets->clearDBCache(); header("Location:" . $_SERVER['REQUEST_URI']); exit; } FlashInfo::set($this->doorGets->__("Veuillez saisir correctement votre adresse e-mail"), "error"); } break; case 'email': if (!empty($this->doorGets->Form->i)) { $this->doorGets->checkMode(); foreach ($this->doorGets->Form->i as $k => $v) { $this->doorGets->Form->i[$k] = filter_input(INPUT_POST, 'configuration_email_' . $k, FILTER_SANITIZE_STRING); } $emailsToSave = ''; $emails = $this->doorGets->_toArray($this->doorGets->Form->i['email'], ',', ''); if (!empty($emails)) { foreach ($emails as $key => $email) { $isEmail = filter_var($email, FILTER_VALIDATE_EMAIL); if (empty($isEmail)) { unset($emails[$key]); } } } if (!empty($emails)) { $emailsToSave = $this->doorGets->_toArrayInv($emails, ',', ''); } else { $this->doorGets->Form->e['configuration_adresse_email'] = 'ok'; } if (empty($this->doorGets->Form->e)) { $this->doorGets->Form->i['email'] = $emailsToSave; FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); $this->doorGets->dbQU(1, $this->doorGets->Form->i, '_website', 'id'); //$this->doorGets->clearDBCache(); header("Location:" . $_SERVER['REQUEST_URI']); exit; } FlashInfo::set($this->doorGets->__("Veuillez saisir correctement votre adresse e-mail"), "error"); } break; case 'network': if (!empty($this->doorGets->Form->i)) { $this->doorGets->checkMode(); foreach ($this->doorGets->Form->i as $k => $v) { $this->doorGets->Form->i[$k] = filter_input(INPUT_POST, 'configuration_network_' . $k, FILTER_SANITIZE_STRING); } FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); $this->doorGets->dbQU(1, $this->doorGets->Form->i, '_website', 'id'); //$this->doorGets->clearDBCache(); header("Location:" . $_SERVER['REQUEST_URI']); exit; } break; case 'cache': if (!empty($this->doorGets->Form->i)) { $this->doorGets->checkMode(); FlashInfo::set($this->doorGets->__("Les caches sont vides")); $this->clearAllCache(); header("Location:" . $_SERVER['REQUEST_URI']); exit; } break; case 'analytics': if (!empty($this->doorGets->Form->i)) { $this->doorGets->checkMode(); foreach ($this->doorGets->Form->i as $k => $v) { $this->doorGets->Form->i[$k] = filter_input(INPUT_POST, 'configuration_analytics_' . $k, FILTER_SANITIZE_STRING); } FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); $this->doorGets->dbQU(1, $this->doorGets->Form->i, '_website', 'id'); //$this->doorGets->clearDBCache(); header("Location:" . $_SERVER['REQUEST_URI']); exit; } break; case 'sitemap': $fileSitemap = BASE . 'sitemap.xml'; $urlSitemap = URL . 'sitemap.xml'; if (!empty($this->doorGets->Form->i) && empty($this->doorGets->Form->e)) { $this->doorGets->checkMode(); new GenSitemapXml(); FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); //$this->doorGets->clearDBCache(); header("Location:" . $_SERVER['REQUEST_URI']); exit; } break; case 'backups': $params = $this->doorGets->Params(); $form = $this->doorGets->Form; if (array_key_exists('do', $params['GET'])) { $file = ''; $actionBackups = $params['GET']['do']; if (array_key_exists('file', $params['GET'])) { $file = $params['GET']['file']; } switch ($actionBackups) { case 'create': if (!empty($form['backups_create']->i) && empty($form['backups_create']->e)) { $this->doorGets->checkMode(); if (empty($form['backups_create']->i['title'])) { $this->doorGets->Form['backups_create']->e['backups_create_title'] = "ok"; } if (empty($this->doorGets->Form['backups_create']->e)) { $dataInfo = array('title' => $form['backups_create']->i['title'], 'date' => time()); $backupExportToZip = new doorgetsBackupsIO($this->doorGets, $dataInfo); $backupExportToZip->genExport(); FlashInfo::set($this->doorGets->__("Une nouvelle sauvegarde est disponible")); header("Location:./?controller=configuration&action=backups"); exit; } FlashInfo::set($this->doorGets->__("Veuillez remplir correctement le formulaire"), 'error'); } break; case 'install': if (!empty($file)) { if (!empty($form['backups_install']->i) && empty($form['backups_install']->e)) { $this->doorGets->checkMode(); $backupExportToZip = new doorgetsBackupsIO($this->doorGets); $backupExportToZip->doImport($file); } } break; case 'delete': if (!empty($file)) { if (!empty($form['backups_delete']->i) && empty($form['backups_delete']->e)) { $this->doorGets->checkMode(); $fileToDelete = BASE . 'io/' . $file; $jsonFileToDelete = str_replace('.zip', '.json', $fileToDelete); if (is_file($fileToDelete) && $jsonFileToDelete) { unlink($fileToDelete); unlink($jsonFileToDelete); } FlashInfo::set($this->doorGets->__("La sauvegarde a bien été supprimée")); header("Location:./?controller=configuration&action=backups"); exit; } } break; } } break; case 'updater': $checkNow = $this->doorGets->_ckeckVersion(); extract($checkNow); if ($isForDownload) { if (!empty($this->doorGets->Form->i) && empty($this->doorGets->Form->e)) { $this->doorGets->checkMode(); $version = $this->doorGets->Form->i['version']; $destination = BASE . "update/doorgets_update_" . $version . ".zip"; try { if (function_exists('curl_version')) { $ch = curl_init(); $source = "http://www.doorgets.com/checkversion/update/doorgets_update_" . $version . ".zip"; curl_setopt($ch, CURLOPT_URL, $source); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $data = curl_exec($ch); curl_close($ch); $file = fopen($destination, "w+"); fputs($file, $data); fclose($file); } } catch (Exception $e) { } FlashInfo::set($this->doorGets->__("Le téléchargement est terminé")); //$this->doorGets->clearDBCache(); header("Location:" . $_SERVER['REQUEST_URI']); exit; } } else { if (!empty($this->doorGets->Form->i) && empty($this->doorGets->Form->e)) { $this->doorGets->checkMode(); $version = $this->doorGets->Form->i['version']; $destination = BASE . "update/doorgets_update_" . $version . ".zip"; $zipDoorgets = new ZipArchive(); $res = $zipDoorgets->open($destination); if ($res === TRUE) { $zipDoorgets->extractTo(BASE); } $zipDoorgets->close(); @unlink($destination); $data['version_doorgets'] = "{$dgVersion}"; $data['statut_version'] = 0; $this->doorGets->dbQU(1, $data, '_website'); $doorGetsFileCode = BASE . 'doorgets.php'; if (is_file($doorGetsFileCode)) { include $doorGetsFileCode; @unlink($doorGetsFileCode); } FlashInfo::set($this->doorGets->__("L'installation de la mise à jour est terminé")); //$this->doorGets->clearDBCache(); header("Location:" . $_SERVER['REQUEST_URI']); exit; } } break; case 'setup': $params = $this->doorGets->Params(); $form = $this->doorGets->Form; if (array_key_exists('do', $params['GET'])) { $file = ''; $actionInstaller = $params['GET']['do']; if (array_key_exists('file', $params['GET'])) { $file = $params['GET']['file']; } switch ($actionInstaller) { case 'create': if (!empty($form['installer_create']->i) && empty($form['installer_create']->e)) { $this->doorGets->checkMode(); if (empty($form['installer_create']->i['title'])) { $this->doorGets->Form['installer_create']->e['installer_create_title'] = "ok"; } if (empty($this->doorGets->Form['installer_create']->e)) { $dataInfo = array('title' => $form['installer_create']->i['title'], 'date' => time()); $backupExportToZip = new doorgetsInstallerIO($this->doorGets, $dataInfo); $backupExportToZip->genExport(); FlashInfo::set($this->doorGets->__("Un installer est disponible")); header("Location:./?controller=configuration&action=setup"); exit; } FlashInfo::set($this->doorGets->__("Veuillez remplir correctement le formulaire"), 'error'); } break; case 'delete': if (!empty($file)) { if (!empty($form['installer_delete']->i) && empty($form['installer_delete']->e)) { $this->doorGets->checkMode(); $fileToDelete = BASE . 'installer/' . $file; $jsonFileToDelete = str_replace('.zip', '.json', $fileToDelete); if (is_file($fileToDelete) && $jsonFileToDelete) { unlink($fileToDelete); unlink($jsonFileToDelete); } FlashInfo::set($this->doorGets->__("Un installer a bien été supprimé")); header("Location:./?controller=configuration&action=setup"); exit; } } break; } } break; } return $out; }
public function doAction() { $out = ''; $User = $this->doorGets->user; $lgActuel = $this->doorGets->getLangueTradution(); $allLanguages = $this->doorGets->getAllLanguages(); $isVersionActive = false; $version_id = 0; // Check if is content modo in_array('emailnotification', $User['liste_module_interne']) ? $is_modo = true : ($is_modo = false); $is_modules_modo = true; // 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); $this->isContent = $isContent; } } } } switch ($this->Action) { case 'index': break; case 'add': if (!empty($this->doorGets->Form->i) && empty($this->doorGets->Form->e) && $is_modules_modo) { $this->doorGets->checkMode(); if (empty($this->doorGets->Form->i['subject'])) { FlashInfo::set($this->doorGets->__("Veuillez saisir un titre"), "error"); $this->doorGets->Form->e['emailnotification_add_subject'] = 'ok'; } if (empty($this->doorGets->Form->i['message_tinymce'])) { FlashInfo::set($this->doorGets->__("Veuillez saisir un message"), "error"); $this->doorGets->Form->e['emailnotification_add_message_tinymce'] = 'ok'; } $uri = $this->doorGets->Form->i['uri']; $isValidUri = $this->doorGets->isValidUri($uri, '_dg_email_notification'); if (!$isValidUri) { $this->doorGets->Form->e[$this->doorGets->controllerNameNow() . '_add_uri'] = 'ok'; } if (empty($this->doorGets->Form->e)) { $data['uri'] = $this->doorGets->Form->i['uri']; $data['id_user'] = $User['id']; $data['id_groupe'] = $User['groupe']; $data['date_creation'] = time(); $idContent = $this->doorGets->dbQI($data, $this->doorGets->Table); foreach ($this->doorGets->getAllLanguages() as $k => $v) { $dataTraduction['title'] = $this->doorGets->Form->i['title']; $dataTraduction['subject'] = $this->doorGets->Form->i['subject']; $dataTraduction['message_tinymce'] = $this->doorGets->Form->i['message_tinymce']; $dataTraduction['langue'] = $k; $dataTraduction['id_content'] = $idContent; $dataTraduction['date_modification'] = time(); $idsTraduction[$k] = $this->doorGets->dbQI($dataTraduction, $this->doorGets->Table . '_traduction'); } $dataModification['groupe_traduction'] = serialize($idsTraduction); $this->doorGets->dbQU($idContent, $dataModification, $this->doorGets->Table); FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); header('Location:./?controller=emailnotification&action=edit&id=' . $idContent . '&lg=' . $lgActuel); exit; } } break; case 'edit': $error = false; if (!empty($this->doorGets->Form->i)) { $this->doorGets->checkMode(); if (empty($this->doorGets->Form->i['subject'])) { FlashInfo::set($this->doorGets->__("Veuillez saisir un titre"), "error"); $this->doorGets->Form->e['emailnotification_edit_subject'] = 'ok'; } if (empty($this->doorGets->Form->i['message_tinymce'])) { FlashInfo::set($this->doorGets->__("Veuillez saisir un message"), "error"); $this->doorGets->Form->e['emailnotification_edit_message_tinymce'] = 'ok'; } $uri = $this->doorGets->Form->i['uri']; $isValidUri = $this->doorGets->isValidUri($uri, '_dg_email_notification', $isContent); if (!$isValidUri) { $this->doorGets->Form->e[$this->doorGets->controllerNameNow() . '_edit_uri'] = 'ok'; } if (empty($this->doorGets->Form->e)) { $data['uri'] = $uri; $this->doorGets->dbQU($isContent['id_content'], $data, $this->doorGets->Table); $dataTraduction['title'] = $this->doorGets->Form->i['title']; $dataTraduction['subject'] = $this->doorGets->Form->i['subject']; $dataTraduction['message_tinymce'] = $this->doorGets->Form->i['message_tinymce']; $dataTraduction['date_modification'] = time(); $dataVersion = $dataTraduction; $this->saveLastContentVersion($isContent['id_content'], $dataVersion); $this->doorGets->dbQU($isContent['id'], $dataTraduction, $this->doorGets->Table . '_traduction'); FlashInfo::set($this->doorGets->__("Vos informations ont bien été mises à jour")); header('Location:./?controller=emailnotification&action=edit&id=' . $isContent['id_content'] . '&lg=' . $lgActuel); exit; } FlashInfo::set($this->doorGets->__("Veuillez remplir correctement le formulaire"), "error"); } break; case 'delete': if (!empty($this->doorGets->Form->i) && $is_modules_modo) { $this->doorGets->checkMode(); if (empty($this->doorGets->Form->e)) { $this->doorGets->dbQD($isContent['id_content'], $this->doorGets->Table); FlashInfo::set($this->doorGets->__("La notifiction a été corréctement supprimer")); header('Location:./?controller=emailnotification'); exit; } } break; } }
public function __construct(&$doorGets) { parent::__construct($doorGets); $User = $doorGets->user; $params = $doorGets->Params(); $lgActuel = $doorGets->getLangueTradution(); $redirectUrlModule = './?controller=modules&lg=' . $lgActuel; $moduleInfos = $doorGets->moduleInfos($doorGets->Uri, $lgActuel); $redirectUrl = './?controller=module' . $moduleInfos['type'] . '&uri=' . $doorGets->Uri . '&lg=' . $lgActuel; if (empty($doorGets->user)) { header('Location:./?controller=authentification&error-login=true&back=' . urlencode($_SERVER['REQUEST_URI'])); exit; } // If isn't valid uri do rediction to modules controller if (!array_key_exists('uri', $params['GET']) || empty($params['GET']['uri']) || empty($doorGets->Uri)) { FlashInfo::set($doorGets->l("L'URI n'existe pas"), "error"); header('Location:' . $redirectUrlModule . '###'); exit; } if ('module' . $moduleInfos['type'] !== $doorGets->controllerNameNow()) { FlashInfo::set($doorGets->l("Erreur"), "error"); header('Location:' . $redirectUrl . '#' . $moduleInfos['type'] . '-' . $doorGets->controllerNameNow()); exit; } if (!in_array($moduleInfos['id'], $this->doorGets->user['liste_module']) && !in_array($moduleInfos['id'], $this->doorGets->user['liste_widget'])) { FlashInfo::set($doorGets->l("Vous n'avez pas les droits pour afficher ce module"), "error"); header('Location:./'); exit; } // check for category id if (array_key_exists('categorie', $params['GET'])) { $idCategorie = $params['GET']['categorie']; $doorGets->loadCategories($doorGets->Uri); $allCategories = $doorGets->categorieSimple; unset($allCategories[0]); if (!is_numeric($idCategorie)) { $idCategorie = '-!-'; } if (!is_numeric($idCategorie) || !array_key_exists($idCategorie, $allCategories)) { FlashInfo::set($doorGets->l("La catégorie '{$idCategorie}' n'existe pas"), "error"); header('Location:' . $redirectUrl); exit; } } // get Content for edit / delete if (array_key_exists('id', $params['GET'])) { $id = $params['GET']['id']; $isContent = $doorGets->dbQS($id, $doorGets->Table); if (!is_numeric($id)) { $id = '-!-'; } if (empty($isContent)) { FlashInfo::set($doorGets->l("Le contenu n'existe pas"), "error"); header('Location:' . $redirectUrl); exit; } } }