/**
  * Constructor.
  *
  */
 public function __construct($okt)
 {
     $this->okt = $okt;
     $this->okt->page->meta_description = util::getSiteMetaDesc();
     $this->okt->page->meta_keywords = util::getSiteMetaKeywords();
     $this->defineRedirectUrl();
 }
 /**
  * Affichage d'un élément.
  *
  */
 public function galleriesItem($aMatches)
 {
     # récupération de l'élément en fonction du slug
     if (!empty($aMatches[0])) {
         $slug = $aMatches[0];
     } else {
         $this->serve404();
     }
     # récupération de l'élément
     $rsItem = $this->okt->galleries->items->getItems(array('slug' => $slug, 'active' => 1, 'language' => $this->okt->user->language));
     if ($rsItem->isEmpty()) {
         $this->serve404();
     }
     # module actuel
     $this->okt->page->module = 'galleries';
     $this->okt->page->action = 'item';
     //$rsItem->image = $rsItem->getImagesInfo();
     if ($this->okt->galleries->config->enable_rte == '' && $rsItem->legend != '') {
         $rsItem->legend = util::nlToP($rsItem->legend);
     }
     # title tag
     $this->okt->page->addTitleTag($this->okt->galleries->getTitle());
     if ($rsItem->title_tag == '') {
         $rsItem->title_tag = $rsItem->title;
     }
     $this->okt->page->addTitleTag($rsItem->title_tag);
     # meta description
     if ($rsItem->meta_description != '') {
         $this->okt->page->meta_description = $rsItem->meta_description;
     } else {
         if ($this->okt->galleries->config->meta_description[$this->okt->user->language] != '') {
             $this->okt->page->meta_description = $this->okt->galleries->config->meta_description[$this->okt->user->language];
         } else {
             $this->okt->page->meta_description = util::getSiteMetaDesc();
         }
     }
     # meta keywords
     if ($rsItem->meta_keywords != '') {
         $this->okt->page->meta_keywords = $rsItem->meta_keywords;
     } else {
         if ($this->okt->galleries->config->meta_keywords[$this->okt->user->language] != '') {
             $this->okt->page->meta_keywords = $this->okt->galleries->config->meta_keywords[$this->okt->user->language];
         } else {
             $this->okt->page->meta_keywords = util::getSiteMetaKeywords();
         }
     }
     # fil d'ariane
     if (!$this->isDefaultRoute(__CLASS__, __FUNCTION__, $slug)) {
         $this->okt->page->breadcrumb->add($this->okt->galleries->getName(), $this->okt->galleries->config->url);
         $rsPath = $this->okt->galleries->tree->getPath($rsItem->gallery_id, true, $this->okt->user->language);
         while ($rsPath->fetch()) {
             $this->okt->page->addTitleTag($rsPath->title);
             $this->okt->page->breadcrumb->add($rsPath->title, galleriesHelpers::getGalleryUrl($rsPath->slug));
         }
         $this->okt->page->breadcrumb->add($rsItem->title, $rsItem->getItemUrl());
     }
     # titre de la page
     $this->okt->page->setTitle($rsItem->title);
     # titre SEO de la page
     $this->okt->page->setTitleSeo(!empty($rsItem->title_seo) ? $rsItem->title_seo : $rsItem->title);
     # affichage du template
     echo $this->okt->tpl->render('galleries/item/' . $this->okt->galleries->config->templates['item']['default'] . '/template', array('rsItem' => $rsItem));
 }
示例#3
0
 /**
  * Affichage d'un article d'actualités.
  *
  */
 public function newsItem($aMatches)
 {
     # module actuel
     $this->okt->page->module = 'news';
     $this->okt->page->action = 'item';
     # récupération de la page en fonction du slug
     if (!empty($aMatches[0])) {
         $sPostSlug = $aMatches[0];
     } else {
         $this->serve404();
     }
     # récupération de l'article
     $rsPost = $this->okt->news->getPost($sPostSlug, 1);
     if ($rsPost->isEmpty()) {
         $this->serve404();
     }
     # is default route ?
     $bIsDefaultRoute = $this->isDefaultRoute(__CLASS__, __FUNCTION__, $sPostSlug);
     # permission de lecture ?
     if (!$this->okt->news->isPublicAccessible() || !$rsPost->isReadable()) {
         if ($this->okt->user->is_guest) {
             http::redirect(html::escapeHTML(usersHelpers::getLoginUrl($rsPost->url)));
         } else {
             $this->serve404();
         }
     }
     # meta description
     if ($rsPost->meta_description != '') {
         $this->okt->page->meta_description = $rsPost->meta_description;
     } else {
         if ($this->okt->news->config->meta_description[$this->okt->user->language] != '') {
             $this->okt->page->meta_description = $this->okt->news->config->meta_description[$this->okt->user->language];
         } else {
             $this->okt->page->meta_description = util::getSiteMetaDesc();
         }
     }
     # meta keywords
     if ($rsPost->meta_keywords != '') {
         $this->okt->page->meta_keywords = $rsPost->meta_keywords;
     } else {
         if ($this->okt->news->config->meta_keywords[$this->okt->user->language] != '') {
             $this->okt->page->meta_keywords = $this->okt->news->config->meta_keywords[$this->okt->user->language];
         } else {
             $this->okt->page->meta_keywords = util::getSiteMetaKeywords();
         }
     }
     # title tag du module
     $this->okt->page->addTitleTag($this->okt->news->getTitle());
     # début du fil d'ariane
     if (!$bIsDefaultRoute) {
         $this->okt->page->breadcrumb->add($this->okt->news->getName(), $this->okt->news->config->url);
     }
     # si les rubriques sont activées
     if ($this->okt->news->config->categories['enable'] && $rsPost->category_id) {
         # title tag de la rubrique
         $this->okt->page->addTitleTag($rsPost->category_title);
         # ajout de la hiérarchie des rubriques au fil d'ariane
         if (!$bIsDefaultRoute) {
             $rsPath = $this->okt->news->categories->getPath($rsPost->category_id, true, $this->okt->user->language);
             while ($rsPath->fetch()) {
                 $this->okt->page->breadcrumb->add($rsPath->title, newsHelpers::getCategoryUrl($rsPath->slug));
             }
             unset($rsPath);
         }
     }
     # title tag de la page
     $this->okt->page->addTitleTag($rsPost->title_tag == '' ? $rsPost->title : $rsPost->title_tag);
     # titre de la page
     $this->okt->page->setTitle($rsPost->title);
     # titre SEO de la page
     $this->okt->page->setTitleSeo($rsPost->title_seo);
     # fil d'ariane de la page
     if (!$bIsDefaultRoute) {
         $this->okt->page->breadcrumb->add($rsPost->title, $rsPost->url);
     }
     # affichage du template
     echo $this->okt->tpl->render($this->okt->news->getItemTplPath($rsPost->tpl, $rsPost->category_items_tpl), array('rsPost' => $rsPost));
 }
示例#4
0
文件: item.php 项目: jewelhuq/okatea
}
unset($rsPath);
if ($rsItem->title_tag == '') {
    $rsItem->title_tag = $rsItem->title;
}
$okt->page->addTitleTag($rsItem->title_tag);
$okt->page->breadcrumb->add($rsItem->title, $rsItem->getItemUrl());
$rsItem->image = $rsItem->getImagesInfo();
if ($okt->galleries->config->enable_rte == '' && $rsItem->legend != '') {
    $rsItem->legend = util::nlToP($rsItem->legend);
}
# meta description
if ($rsItem->meta_description != '') {
    $okt->page->meta_description = $rsItem->meta_description;
} else {
    if ($okt->galleries->config->meta_description != '') {
        $okt->page->meta_description = $okt->galleries->config->meta_description;
    } else {
        $okt->page->meta_description = util::getSiteMetaDesc();
    }
}
# meta keywords
if ($rsItem->meta_keywords != '') {
    $okt->page->meta_keywords = $rsItem->meta_keywords;
} else {
    if ($okt->galleries->config->meta_keywords != '') {
        $okt->page->meta_keywords = $okt->galleries->config->meta_keywords;
    } else {
        $okt->page->meta_keywords = util::getSiteMetaKeywords();
    }
}
 /**
  * Affichage d'un évènement
  *
  */
 public function diaryEvent($aMatches)
 {
     # récupération de l'élément en fonction du slug
     if (!empty($aMatches[0])) {
         $slug = $aMatches[0];
     } else {
         $this->serve404();
     }
     # récupération de l'évènement
     $rsEvent = $this->okt->diary->getEvents(array('slug' => $slug, 'visibility' => 1));
     if ($rsEvent->isEmpty()) {
         $this->serve404();
     }
     # module actuel
     $this->okt->page->module = 'diary';
     $this->okt->page->action = 'event';
     # meta description
     if ($rsEvent->meta_description != '') {
         $this->okt->page->meta_description = $rsEvent->meta_description;
     } else {
         if ($this->okt->diary->config->meta_description[$this->okt->user->language] != '') {
             $this->okt->page->meta_description = $this->okt->diary->config->meta_description[$this->okt->user->language];
         } else {
             $this->okt->page->meta_description = util::getSiteMetaDesc();
         }
     }
     # meta keywords
     if ($rsEvent->meta_keywords != '') {
         $this->okt->page->meta_keywords = $rsEvent->meta_keywords;
     } else {
         if ($this->okt->diary->config->meta_keywords[$this->okt->user->language] != '') {
             $this->okt->page->meta_keywords = $this->okt->diary->config->meta_keywords[$this->okt->user->language];
         } else {
             $this->okt->page->meta_keywords = util::getSiteMetaKeywords();
         }
     }
     # description
     if (!$this->okt->diary->config->enable_rte) {
         $rsEvent->description = util::nlToP($rsEvent->description);
     }
     # récupération des images
     $rsEvent->images = $rsEvent->getImagesInfo();
     # récupération des fichiers
     $rsEvent->files = $rsEvent->getFilesInfo();
     # title tag du module
     $this->okt->page->addTitleTag($this->okt->diary->getTitle());
     # fil d'ariane
     if (!$this->isDefaultRoute(__CLASS__, __FUNCTION__, $slug)) {
         $this->okt->page->breadcrumb->add($this->okt->diary->getName(), $this->okt->diary->config->url);
         $this->okt->page->breadcrumb->add($rsEvent->title, $rsEvent->getEventUrl());
     }
     # title tag
     $this->okt->page->addTitleTag($rsEvent->title_tag != '' ? $rsEvent->title_tag : $rsEvent->title);
     # titre de la page
     $this->okt->page->setTitle($rsEvent->title);
     # titre SEO de la page
     $this->okt->page->setTitleSeo(!empty($rsEvent->title_seo) ? $rsEvent->title_seo : $rsEvent->title);
     # affichage du template
     echo $this->okt->tpl->render('diary_event_tpl', array('rsEvent' => $rsEvent));
 }
 /**
  * Affichage de la page du formulaire de demande de devis.
  *
  */
 public function estimateForm()
 {
     # module actuel
     $this->okt->page->module = 'estimate';
     $this->okt->page->action = 'form';
     # -- CORE TRIGGER : publicModuleEstimateControllerStart
     $this->okt->triggers->callTrigger('publicModuleEstimateControllerStart', $this->okt, $this->okt->estimate->config->captcha);
     # récupération des produits et des accessoires
     $rsProducts = $this->okt->estimate->products->getProducts();
     $aProductsSelect = array(' ' => null);
     $aProductsAccessories = array();
     while ($rsProducts->fetch()) {
         $aProductsSelect[html::escapeHTML($rsProducts->title)] = $rsProducts->id;
         if ($this->okt->estimate->config->enable_accessories) {
             $rsAccessories = $this->okt->estimate->accessories->getAccessories(array('product_id' => $rsProducts->id));
             if (!$rsAccessories->isEmpty()) {
                 $aProductsAccessories[$rsProducts->id] = array();
                 $aProductsAccessories[$rsProducts->id][0] = ' ';
                 while ($rsAccessories->fetch()) {
                     $aProductsAccessories[$rsProducts->id][$rsAccessories->id] = html::escapeHTML($rsAccessories->title);
                 }
             }
             unset($rsAccessories);
         }
     }
     # données de formulaire envoyées
     $this->aFormData = array('lastname' => '', 'firstname' => '', 'email' => '', 'phone' => '', 'start_date' => '', 'end_date' => '', 'products' => array(), 'product_quantity' => array(), 'accessories' => array(), 'accessory_quantity' => array(), 'comment' => '');
     # retour de la page de récapitulatif ?
     if (!empty($_SESSION['okt_mod_estimate_form_data'])) {
         $this->aFormData = $_SESSION['okt_mod_estimate_form_data'];
         unset($_SESSION['okt_mod_estimate_form_data']);
     } elseif (!empty($_POST['sended'])) {
         $this->aFormData = array('lastname' => !empty($_POST['p_lastname']) ? $_POST['p_lastname'] : '', 'firstname' => !empty($_POST['p_firstname']) ? $_POST['p_firstname'] : '', 'email' => !empty($_POST['p_email']) ? $_POST['p_email'] : '', 'phone' => !empty($_POST['p_phone']) ? $_POST['p_phone'] : '', 'start_date' => !empty($_POST['p_start_date']) ? $_POST['p_start_date'] : '', 'end_date' => !empty($_POST['p_end_date']) ? $_POST['p_end_date'] : '', 'products' => !empty($_POST['p_product']) && is_array($_POST['p_product']) ? $_POST['p_product'] : array(), 'product_quantity' => !empty($_POST['p_product_quantity']) && is_array($_POST['p_product_quantity']) ? $_POST['p_product_quantity'] : array(), 'accessories' => !empty($_POST['p_accessory']) && is_array($_POST['p_accessory']) ? $_POST['p_accessory'] : array(), 'accessory_quantity' => !empty($_POST['p_accessory_quantity']) && is_array($_POST['p_accessory_quantity']) ? $_POST['p_accessory_quantity'] : array(), 'comment' => !empty($_POST['p_comment']) ? $_POST['p_comment'] : '');
         # rebuild products and accessories arrays
         $aTempData = array('products' => array(), 'product_quantity' => array(), 'accessories' => array(), 'accessory_quantity' => array());
         $iTempProductCounter = 1;
         foreach ($this->aFormData['products'] as $iProductCounter => $iProductId) {
             if (!empty($iProductId) && !empty($this->aFormData['product_quantity'][$iProductCounter])) {
                 $aTempData['products'][$iTempProductCounter] = $iProductId;
                 $aTempData['product_quantity'][$iTempProductCounter] = $this->aFormData['product_quantity'][$iProductCounter];
                 if (!empty($this->aFormData['accessories'][$iProductCounter])) {
                     $iTempAccessoryCounter = 1;
                     foreach ($this->aFormData['accessories'][$iProductCounter] as $iAccessoryCounter => $iAccessoryId) {
                         if (!empty($iAccessoryId) && !empty($this->aFormData['accessory_quantity'][$iProductCounter][$iAccessoryCounter])) {
                             $aTempData['accessories'][$iTempProductCounter][$iTempAccessoryCounter] = $iAccessoryId;
                             $aTempData['accessory_quantity'][$iTempProductCounter][$iTempAccessoryCounter] = $this->aFormData['accessory_quantity'][$iProductCounter][$iAccessoryCounter];
                             $iTempAccessoryCounter++;
                         }
                     }
                 }
                 $iTempProductCounter++;
             }
         }
         $this->aFormData['products'] = $aTempData['products'];
         $this->aFormData['product_quantity'] = $aTempData['product_quantity'];
         $this->aFormData['accessories'] = $aTempData['accessories'];
         $this->aFormData['accessory_quantity'] = $aTempData['accessory_quantity'];
         if (empty($this->aFormData['lastname'])) {
             $this->okt->error->set(__('m_estimate_must_enter_lastname'));
         }
         if (empty($this->aFormData['firstname'])) {
             $this->okt->error->set(__('m_estimate_must_enter_firstname'));
         }
         if (empty($this->aFormData['email'])) {
             $this->okt->error->set(__('m_estimate_must_enter_email'));
         } elseif (!text::isEmail($this->aFormData['email'])) {
             $this->okt->error->set(__('m_estimate_must_enter_validate_email'));
         }
         if (empty($this->aFormData['start_date'])) {
             $this->okt->error->set(__('m_estimate_must_enter_start_date'));
         }
         if (empty($this->aFormData['products'])) {
             $this->okt->error->set(__('m_estimate_must_enter_at_least_one_product'));
         }
         # -- CORE TRIGGER : publicModuleEstimateControllerFormCheckValues
         $this->okt->triggers->callTrigger('publicModuleEstimateControllerFormCheckValues', $this->okt, $this->okt->estimate->config->captcha);
         if ($this->okt->error->isEmpty()) {
             $_SESSION['okt_mod_estimate_form_data'] = $this->aFormData;
             http::redirect($this->okt->page->getBaseUrl() . $this->okt->estimate->config->public_summary_url[$this->okt->user->language]);
         }
     }
     # pré-remplissage des données utilisateur si loggué
     if (!$this->okt->user->is_guest) {
         if (empty($this->aFormData['lastname'])) {
             $this->aFormData['lastname'] = $this->okt->user->lastname;
         }
         if (empty($this->aFormData['firstname'])) {
             $this->aFormData['firstname'] = $this->okt->user->firstname;
         }
         if (empty($this->aFormData['email'])) {
             $this->aFormData['email'] = $this->okt->user->email;
         }
     }
     # meta description
     if ($this->okt->estimate->config->meta_description[$this->okt->user->language] != '') {
         $this->okt->page->meta_description = $this->okt->estimate->config->meta_description[$this->okt->user->language];
     } else {
         $this->okt->page->meta_description = util::getSiteMetaDesc();
     }
     # meta keywords
     if ($this->okt->estimate->config->meta_keywords[$this->okt->user->language] != '') {
         $this->okt->page->meta_keywords = $this->okt->estimate->config->meta_keywords[$this->okt->user->language];
     } else {
         $this->okt->page->meta_keywords = util::getSiteMetaKeywords();
     }
     # title tag du module
     $this->okt->page->addTitleTag($this->okt->estimate->getTitle());
     # fil d'ariane
     if (!$this->isDefaultRoute(__CLASS__, __FUNCTION__)) {
         $this->okt->page->breadcrumb->add($this->okt->estimate->getName(), $this->okt->estimate->config->url);
     }
     # titre de la page
     $this->okt->page->setTitle($this->okt->estimate->getName());
     # titre SEO de la page
     $this->okt->page->setTitleSeo($this->okt->estimate->getNameSeo());
     # affichage du template
     echo $this->okt->tpl->render('estimate/form/' . $this->okt->estimate->config->templates['form']['default'] . '/template', array('aFormData' => $this->aFormData, 'rsProducts' => $rsProducts, 'aProductsSelect' => $aProductsSelect, 'aProductsAccessories' => $aProductsAccessories, 'iNumProducts' => $this->getFormNumProducts()));
 }
 /**
  * Affichage de la page du plan d'accès.
  *
  */
 public function contactMapPage()
 {
     # si la page n'est pas active -> 404
     if (!$this->okt->contact->config->google_map['enable']) {
         $this->serve404();
     }
     # module actuel
     $this->okt->page->module = 'contact';
     $this->okt->page->action = 'map';
     # meta description
     if ($this->okt->contact->config->meta_description_map[$this->okt->user->language] != '') {
         $this->okt->page->meta_description = $this->okt->contact->config->meta_description_map[$this->okt->user->language];
     } else {
         $this->okt->page->meta_description = util::getSiteMetaDesc();
     }
     # meta keywords
     if ($this->okt->contact->config->meta_keywords_map[$this->okt->user->language] != '') {
         $this->okt->page->meta_keywords = $this->okt->contact->config->meta_keywords_map[$this->okt->user->language];
     } else {
         $this->okt->page->meta_keywords = util::getSiteMetaKeywords();
     }
     # title tag de la page
     $sTitle = null;
     if (isset($this->okt->contact->config->title_map[$this->okt->user->language])) {
         $sTitle = $this->okt->contact->config->title_map[$this->okt->user->language];
     } elseif ($this->okt->contact->config->title_map[$this->okt->config->language]) {
         $sTitle = $this->okt->contact->config->title_map[$this->okt->config->language];
     }
     $this->okt->page->addTitleTag($sTitle);
     # titre de la page
     $sName = null;
     if (isset($this->okt->contact->config->name_map[$this->okt->user->language])) {
         $sName = $this->okt->contact->config->name_map[$this->okt->user->language];
     } elseif ($this->okt->contact->config->name_map[$this->okt->config->language]) {
         $sName = $this->okt->contact->config->name_map[$this->okt->config->language];
     }
     $this->okt->page->setTitle($sName);
     # titre SEO de la page
     $sNameSeo = null;
     if (isset($this->okt->contact->config->name_seo_map[$this->okt->user->language])) {
         $sNameSeo = $this->okt->contact->config->name_seo_map[$this->okt->user->language];
     } elseif ($this->okt->contact->config->name_seo_map[$this->okt->config->language]) {
         $sNameSeo = $this->okt->contact->config->name_seo_map[$this->okt->config->language];
     }
     $this->okt->page->setTitleSeo($sNameSeo);
     # fil d'ariane
     if (!$this->isDefaultRoute(__CLASS__, __FUNCTION__)) {
         $this->okt->page->breadcrumb->add($sName, $this->okt->contact->config->map_url);
     }
     # affichage du template
     echo $this->okt->tpl->render('contact/map/' . $this->okt->contact->config->templates['map']['default'] . '/template');
 }
 /**
  * Affichage d'un produit.
  *
  */
 public function catalogItem($aMatches)
 {
     # module actuel
     $this->okt->page->module = 'catalog';
     $this->okt->page->action = 'item';
     # Récupération du produit en fonction du slug
     if (!empty($aMatches[0])) {
         $slug = $aMatches[0];
     } else {
         $this->serve404();
     }
     $product = $this->okt->catalog->getProds(array('slug' => $slug, 'visibility' => 1));
     if ($product->isEmpty()) {
         $this->serve404();
     }
     # route par défaut ?
     $bIsDefaultRoute = $this->isDefaultRoute(__CLASS__, __FUNCTION__, $slug);
     # Formatage des données
     if ($product->title_tag == '') {
         $product->title_tag = $product->title;
     }
     $product->url = $product->getProductUrl();
     if (!$this->okt->catalog->config->rte_enable) {
         $product->content = util::nlToP($product->content);
     }
     $product->category_url = $product->getCategoryUrl();
     # meta description
     if ($product->meta_description != '') {
         $this->okt->page->meta_description = $product->meta_description;
     } else {
         if ($this->okt->catalog->config->meta_description != '') {
             $this->okt->page->meta_description = $this->okt->catalog->config->meta_description;
         } else {
             $this->okt->page->meta_description = util::getSiteMetaDesc();
         }
     }
     # meta keywords
     if ($product->meta_keywords != '') {
         $this->okt->page->meta_keywords = $product->meta_keywords;
     } else {
         if ($this->okt->catalog->config->meta_keywords != '') {
             $this->okt->page->meta_keywords = $this->okt->catalog->config->meta_keywords;
         } else {
             $this->okt->page->meta_keywords = util::getSiteMetaKeywords();
         }
     }
     # Récupération des images
     $product->images = $product->getImagesInfo();
     # Récupération des fichiers
     $product->files = $product->getFilesInfo();
     # Title tag du module
     $this->okt->page->addTitleTag($this->okt->catalog->getTitle());
     # Title tag de la catégorie
     $this->okt->page->addTitleTag($product->category_name);
     # Title tag du produit
     $this->okt->page->addTitleTag($product->title_tag);
     # titre de la page
     $this->okt->page->setTitle($product->title);
     # titre SEO de la page
     $this->okt->page->setTitleSeo($product->title);
     # fil d'ariane
     if (!$bIsDefaultRoute) {
         $this->okt->page->breadcrumb->add($this->okt->catalog->getName(), $this->okt->catalog->config->url);
         if ($this->okt->catalog->config->categories_enable && $product->category_id) {
             $rsPath = $this->okt->catalog->getPath($product->category_id, true);
             while ($rsPath->fetch()) {
                 $this->okt->page->breadcrumb->add($rsPath->name, $this->okt->page->getBaseUrl() . $this->okt->catalog->config->public_catalog_url . '/' . $rsPath->slug);
             }
             unset($rsPath);
         }
         $this->okt->page->breadcrumb->add($product->title, $product->url);
     }
     # affichage du template
     echo $this->okt->tpl->render('catalog_item_tpl', array('product' => $product));
 }
示例#9
0
 /**
  * Affichage d'une question.
  *
  */
 public function faqQuestion($aMatches)
 {
     # module actuel
     $this->okt->page->module = 'faq';
     $this->okt->page->action = 'question';
     # récupération de la question en fonction du slug
     if (!empty($aMatches[0])) {
         $slug = $aMatches[0];
     } else {
         $this->serve404();
     }
     $faqQuestion = $this->okt->faq->getQuestions(array('slug' => $slug, 'visibility' => 1));
     if ($faqQuestion->isEmpty()) {
         $this->serve404();
     }
     # formatage des données
     if ($faqQuestion->title_tag == '') {
         $faqQuestion->title_tag = $faqQuestion->title;
     }
     $faqQuestion->url = $faqQuestion->getQuestionUrl();
     if (!$this->okt->faq->config->enable_rte) {
         $faqQuestion->content = util::nlToP($faqQuestion->content);
     }
     # meta description
     if ($faqQuestion->metadescription != '') {
         $this->okt->page->meta_description = $faqQuestion->metadescription;
     } else {
         if ($this->okt->faq->config->meta_description[$this->okt->user->language] != '') {
             $this->okt->page->meta_description = $this->okt->faq->config->meta_description[$this->okt->user->language];
         } else {
             $this->okt->page->meta_description = util::getSiteMetaDesc();
         }
     }
     # meta keywords
     if ($faqQuestion->meta_keywords != '') {
         $this->okt->page->meta_keywords = $faqQuestion->meta_keywords;
     } else {
         if ($this->okt->faq->config->meta_keywords[$this->okt->user->language] != '') {
             $this->okt->page->meta_keywords = $this->okt->faq->config->meta_keywords[$this->okt->user->language];
         } else {
             $this->okt->page->meta_keywords = util::getSiteMetaKeywords();
         }
     }
     # récupération des images
     $faqQuestion->images = $faqQuestion->getImagesInfo();
     # récupération des fichiers
     $faqQuestion->files = $faqQuestion->getFilesInfo();
     # title tag du module
     $this->okt->page->addTitleTag($this->okt->faq->getTitle());
     # title tag du post
     $this->okt->page->addTitleTag($faqQuestion->title_tag != '' ? $faqQuestion->title_tag : $faqQuestion->title);
     # titre de la page
     $this->okt->page->setTitle($faqQuestion->title);
     # titre SEO de la page
     $this->okt->page->setTitleSeo(!empty($faqQuestion->title_seo) ? $faqQuestion->title_seo : $faqQuestion->title);
     # fil d'ariane du post
     if (!$this->isDefaultRoute(__CLASS__, __FUNCTION__, $slug)) {
         $this->okt->page->breadcrumb->add($this->okt->faq->getName(), $this->okt->faq->config->url);
         $this->okt->page->breadcrumb->add($faqQuestion->title, $faqQuestion->url);
     }
     # affichage du template
     echo $this->okt->tpl->render('faq_question_tpl', array('faqQuestion' => $faqQuestion, 'faqQuestionLocales' => $faqQuestionLocales));
 }
 /**
  * Affichage de la page guestbook.
  *
  */
 public function guestbookPage()
 {
     # module actuel
     $this->okt->page->module = 'guestbook';
     $this->okt->page->action = 'list';
     # -- CORE TRIGGER : publicModuleGuestbookControllerStart
     $this->okt->triggers->callTrigger('publicModuleGuestbookControllerStart', $this->okt, $this->okt->guestbook->config->captcha);
     $aSigData = array('language' => $this->okt->user->language, 'message' => '', 'nom' => '', 'email' => '', 'url' => 'http://', 'note' => 'nc');
     # formulaire envoyé
     if (!empty($_POST['sign'])) {
         $aSigData = array('language' => isset($_POST['language']) ? $_POST['language'] : $this->okt->user->language, 'message' => isset($_POST['msg']) ? $_POST['msg'] : null, 'nom' => isset($_POST['nom']) ? $_POST['nom'] : null, 'email' => isset($_POST['email']) ? $_POST['email'] : null, 'url' => isset($_POST['url']) ? $_POST['url'] : 'http://', 'note' => isset($_POST['note']) ? $_POST['note'] : null, 'ip' => http::realIP(), 'visible' => $this->okt->guestbook->config->validation ? 0 : 1);
         $aSigData = $this->okt->guestbook->handleUserData($aSigData);
         # -- CORE TRIGGER : publicModuleGuestbookControllerFormCheckValues
         $this->okt->triggers->callTrigger('publicModuleGuestbookControllerFormCheckValues', $this->okt, $this->okt->guestbook->config->captcha);
         if (!$this->okt->error->hasError()) {
             if ($this->okt->guestbook->addSig($aSigData)) {
                 if ($this->okt->guestbook->config->emails_list != '') {
                     $oMail = new oktMail($this->okt);
                     $oMail->setFrom();
                     $oMail->message->setSubject('Nouveau message sur le livre d’or de ' . util::getSiteTitle());
                     $mail_body = 'Bonjour,' . "\n\n" . 'Un utilisateur a laissé un nouveau message ' . 'sur le livre d’or de "' . util::getSiteTitle() . '".' . "\n\n";
                     if ($this->okt->guestbook->config->validation) {
                         $mail_body .= 'Ce nouveau message peut être validé ' . 'en vous rendant sur l’administration.' . "\n\n";
                     }
                     $mail_body .= 'Cordialement' . PHP_EOL . PHP_EOL . '--' . PHP_EOL . 'Email automatique,' . PHP_EOL . 'ne repondez pas à ce message';
                     $oMail->message->setBody($mail_body);
                     $dests = array_map('trim', explode(',', $this->okt->guestbook->config->emails_list));
                     $oMail->message->setTo($dests);
                     $oMail->send();
                 }
                 http::redirect($this->okt->guestbook->config->url . '?added=1');
             }
         }
     }
     # signatures à afficher
     $aGuestbookParams = array('is_not_spam' => true, 'is_visible' => true, 'language' => $this->okt->user->language);
     # initialisation de la pagination
     $iPage = !empty($_GET['page']) ? intval($_GET['page']) : 1;
     $oGuestbookPager = new publicPager($iPage, $this->okt->guestbook->getSig($aGuestbookParams, true), $this->okt->guestbook->config->nbparpage_public);
     $iNumPages = $oGuestbookPager->getNbPages();
     # récupération des signatures
     $aGuestbookParams['limit'] = ($iPage - 1) * $this->okt->guestbook->config->nbparpage_public . ',' . $this->okt->guestbook->config->nbparpage_public;
     $signaturesList = $this->okt->guestbook->getSig($aGuestbookParams);
     $aLanguages = array();
     foreach ($this->okt->languages->list as $aLanguage) {
         if (isset($this->okt->guestbook->config->public_url[$aLanguage['code']])) {
             $aLanguages[$aLanguage['title']] = $aLanguage['code'];
         }
     }
     # formatage des données
     $num_sig = 0;
     while ($signaturesList->fetch()) {
         $signaturesList->number = ++$num_sig;
         # note
         if ($this->okt->guestbook->config->chp_note) {
             if (!is_numeric($signaturesList->note)) {
                 $signaturesList->note = 'nc';
             } else {
                 $signaturesList->note = ceil($signaturesList->note) . '/20';
             }
         } else {
             $signaturesList->note = null;
         }
     }
     # meta description
     if ($this->okt->guestbook->config->meta_description[$this->okt->user->language] != '') {
         $this->okt->page->meta_description = $this->okt->guestbook->config->meta_description[$this->okt->user->language];
     } else {
         $this->okt->page->meta_description = util::getSiteMetaDesc();
     }
     # meta keywords
     if ($this->okt->guestbook->config->meta_keywords[$this->okt->user->language] != '') {
         $this->okt->page->meta_keywords = $this->okt->guestbook->config->meta_keywords[$this->okt->user->language];
     } else {
         $this->okt->page->meta_keywords = util::getSiteMetaKeywords();
     }
     # ajout du numéro de page au title
     if ($iPage > 1) {
         $this->okt->page->addTitleTag(sprintf(__('c_c_Page_%s'), $iPage));
     }
     # title tag
     $this->okt->page->addTitleTag($this->okt->guestbook->getTitle());
     # titre de la page
     $this->okt->page->setTitle($this->okt->guestbook->getName());
     # titre SEO de la page
     $this->okt->page->setTitleSeo($this->okt->guestbook->getNameSeo());
     # fil d'ariane de la page
     if (!$this->isDefaultRoute(__CLASS__, __FUNCTION__)) {
         $this->okt->page->breadcrumb->add($this->okt->guestbook->getName(), $this->okt->guestbook->config->url);
     }
     # raccourcis
     $signaturesList->numPages = $iNumPages;
     $signaturesList->pager = $oGuestbookPager;
     # affichage du template
     echo $this->okt->tpl->render('guestbook_tpl', array('aSigData' => $aSigData, 'signaturesList' => $signaturesList, 'aLanguages' => $aLanguages));
 }