getData(['config', 'i18n', 'langAdmin']) . '/lex_core.php'); // Création du brouillon s'il n'existe pas if( !isset($_SESSION['draftPage'])){ $_SESSION['draftPage'] = []; $_SESSION['draftPage']['textarea'] = ""; $_SESSION['draftPage']['text'] = ""; } // Traitement des boutons pagination $commentNumPage = 'commentNumPage'. $this->getUrl(0); if($this->isPost() && isset($_POST['commentPageFormNext' ])){ $_SESSION[$commentNumPage] = $_SESSION[$commentNumPage] + 1; } if($this->isPost() && isset($_POST['commentPageFormPrev' ])){ $_SESSION[$commentNumPage] = $_SESSION[$commentNumPage] - 1; } // Traitement de l'envoi du formualire if($this->isPost() && isset($_POST['commentPageFormSubmit']) ) { // $notice concerne la détection d'erreurs $notice = ''; $code = null !== $this->getInput('codeCaptcha') ? $this->getInput('codeCaptcha') : ''; // Captcha demandée if( $this->getData(['config', 'social', 'comment', 'captcha']) ){ // option de détection de robot en premier cochée et $_SESSION['humanBot']==='human' if( $_SESSION['humanBot']==='human' && $this->getData(['config', 'connect', 'captchaBot'])=== true ) { // Présence des 5 cookies et checkbox cochée ? $detectBot ='bot'; if ( isset ($_COOKIE['evtO']) && isset ($_COOKIE['evtV']) && isset ($_COOKIE['evtH']) && isset ($_COOKIE['evtS']) && isset ($_COOKIE['evtA']) && $this->getInput('commentPageFormHumanCheck', helper::FILTER_BOOLEAN) === true ) { // Calcul des intervals de temps $time2 = $_COOKIE['evtH'] - $_COOKIE['evtO']; // temps entre click checkbox et ouverture de la page $time3 = $_COOKIE['evtV'] - $_COOKIE['evtH']; // temps entre validation formulaire et click checkbox $time4 = $_COOKIE['evtS'] - $_COOKIE['evtA']; // temps passé sur la checkbox if( $time2 >= 1000 && $time3 >=300 && $time4 >=300 ) $detectBot = 'human'; } // Bot présumé if( $detectBot === 'bot') $_SESSION['humanBot']='bot'; } // $_SESSION['humanBot']==='bot' ou option 'Pas de Captcha pour un humain' non validée elseif( md5($code) !== $_SESSION['captcha'] ) { $notice = $text['core']['showComment'][1]; } } // Lecture des inputs $valueText = $this->getInput('commentPageFormInput[0]', helper::FILTER_STRING_SHORT, true); $valueTextarea = $this->getInput('commentPageFormInput[1]', helper::FILTER_STRING_LONG_NOSTRIP, true); // Mise à jour du brouillon $_SESSION['draftPage']['text'] = $valueText; $_SESSION['draftPage']['textarea'] = $valueTextarea; // Préparation du contenu des données ($data) et du mail $data = []; $content = ''; $file_name = ''; // Mail if( $valueText !== '') $content .= '' . $text['core']['showComment'][9] . ' : ' . $valueText . '
'; if( $valueTextarea !== '') $content .= '' . $text['core']['showComment'][10] . ' : ' . $valueTextarea . '
'; // Données $data[$text['core']['showComment'][9]] = $valueText; $data[$text['core']['showComment'][10]] = $valueTextarea; // Bot présumé, la page sera actualisée avec l'affichage du captcha complet if( $detectBot === 'bot') $notice = $text['core']['showComment'][1]; // Si absence d'erreur $sent = true; if( $notice === ''){ // Crée les données, l'indice des messages est la date unix $id = time(); $this->setData(['comment', $this->getUrl(0), 'data', $id , $data]); // Ajout de la date en clair pour les données dans le json if( $this->getData(['config', 'i18n', 'langAdmin']) === 'en' ){ $dateMessage = date('m/d/Y H:i', $id); } else { $dateMessage = date('d/m/Y H:i', $id); } $this->setData(['comment', $this->getUrl(0), 'data', $id , 'Date' , $dateMessage ]); // Liste des utilisateurs $userIdsFirstnames = helper::arrayCollumn($this->getData(['user']), 'firstname'); ksort($userIdsFirstnames); $listUsers [] = ''; foreach($userIdsFirstnames as $userId => $userFirstname) { $listUsers [] = $userId; } // Emission du mail // Rechercher l'adresse en fonction du mail $singleuser = $this->getData(['user', $listUsers[$this->getData(['config', 'social', 'comment', 'user'])], 'mail']); $singlemail = $this->getData(['config', 'social', 'comment', 'mail']); $group = $this->getData(['config', 'social', 'comment', 'group']); // Verification si le mail peut être envoyé if( self::$inputNotices === [] && ( $group > 0 || $singleuser !== '' || $singlemail !== '' ) ) { // Utilisateurs dans le groupe $to = []; if ($group > 0){ foreach($this->getData(['user']) as $userId => $user) { if($user['group'] >= $group) { $to[] = $user['mail']; } } } // Utilisateur désigné if (!empty($singleuser)) { $to[] = $singleuser; } // Mail désigné if (!empty($singlemail)) { $to[] = $singlemail; } if($to) { // Sujet du mail $subject = $this->getData(['config', 'social', 'comment', 'subject']); if($subject === '') { $subject = $text['core']['showComment'][2]; } // Envoi le mail $sent = $this->sendMail( $to, $subject, $text['core']['showComment'][3] . $this->getData(['page', $this->getUrl(0), 'title']) . ' :

' . $content ); } } // Redirection $redirect = helper::baseUrl() . $this->getUrl(0); if ( $this->getData(['module', $this->getUrl(0), 'config', 'pageId']) !== '') $redirect = helper::baseUrl() . $this->getData(['module', $this->getUrl(0), 'config', 'pageId']); // Effacement des données provisoires if( self::$inputNotices === [] ){ $_SESSION['draftPage'] = []; $_SESSION['draftPage']['textarea'] = ""; $_SESSION['draftPage']['text'] = ""; } else { $sent = false; } } else { $sent = false; } // Notifications if( $sent === true) { $_SESSION['DELTA_NOTIFICATION_SUCCESS']= $text['core']['showComment'][4]; $_SESSION['DELTA_NOTIFICATION_ERROR'] = ''; } else { $_SESSION['DELTA_NOTIFICATION_SUCCESS']= ''; $_SESSION['DELTA_NOTIFICATION_ERROR'] = $text['core']['showComment'][5]; } $this->showNotification(); } // Préparation de la liste paginée des commentaires // Initialisation de la pagination $nbPage =0; if ( !isset($_SESSION[$commentNumPage] )) $_SESSION[$commentNumPage] = 1; $dataPage = $this->getData(['comment', $this->getUrl(0), 'data']); if ( NULL !== $dataPage && is_array($dataPage) && $dataPage !== [] ) { $nbPage = round(count( $dataPage) / self::ITEMSPAGE, 0, PHP_ROUND_HALF_UP); if( $_SESSION[$commentNumPage] > $nbPage ) $_SESSION[$commentNumPage] = $nbPage; if( $_SESSION[$commentNumPage] <= 0 ) $_SESSION[$commentNumPage] = 1; $paramPage = $this->getUrl() .'/'. $_SESSION[$commentNumPage]; // Pagination $pagination = helper::pagination($dataPage, $paramPage, self::ITEMSPAGE); // Liste des pages $pagesComment = $pagination['pages']; // Inverse l'ordre du tableau $dataIds = array_reverse(array_keys($dataPage)); $dataPage = array_reverse($dataPage); // Données en fonction de la pagination et suppression des adresses e-mail for($i = $pagination['first']; $i < $pagination['last']; $i++) { $content = ''; foreach($dataPage[$i] as $input => $value) { if (!empty($value) && strpos($value, 'Д') === false) $content .= '
' . $input . '
:
' . $value . '
'; } $horizontalRule = ''; if( $i < $pagination['last'] - 1) : $horizontalRule = '
'; else : $horizontalRule = '
'; endif; $data[] = [ $content.$horizontalRule ]; } } // Partie affichage (View dans la structure classique) // Adaptation de la langue dans tinymce pour la rédaction d'un message en fonction de la langue de la page, originale ou en traduction rédigée $lang = $this->getData(['config', 'i18n', 'langBase']); if ( !empty($_COOKIE["DELTA_I18N_SITE"])) { if( $this->getInput('DELTA_I18N_SITE') !== 'base' ) $lang = $this->getInput('DELTA_I18N_SITE'); } $lang_page = $lang; switch ($lang) { case 'en' : $lang_page = 'en_GB'; break; case 'pt' : $lang_page = 'pt_PT'; break; case 'sv' : $lang_page = 'sv_SE'; break; case 'fr' : $lang_page = 'fr_FR'; break; } // Si la langue n'est pas supportée par Tinymce la langue d'administration est utilisée if( ! file_exists( 'core/vendor/tinymce/langs/'.$lang_page.'.js' )){ $lang_page = $lang_admin; } echo ''; // Vendor tinymce ?>
$text['core']['showComment'][0], 'ico' => 'pencil' ]); ?>
'; if($data): foreach( $data as $key1=>$value1){ if( is_array($value1)){ foreach( $value1 as $key2=>$value2){ echo $value2; } } } else: echo template::speech('
'.$text['core']['showComment'][6].'
' ); endif; echo ''; if($pagesComment && $nbPage > 1){ ?>
1) { ?>
'commentPageButtonPrevNext', 'value' => '', 'ico' =>'left' ]); ?>
'commentPageButtonPrevNext', 'value' => '', 'ico' =>'plus' ]); ?>