Example #1
0
 public function getContent()
 {
     $out = $q = $qN = '';
     $Website = $this->Website;
     $user = $Website->isUser ? $Website->_User : array();
     $_name = $Website->isUser ? ucfirst($user['first_name']) . ' ' . ucfirst($user['last_name']) : '';
     $_phone = $Website->isUser ? $user['tel_fix'] : '';
     if ($Website->isUser && !empty($_phone) && !empty($user['tel_mobil'])) {
         $_phone .= '/' . $user['tel_mobil'];
     }
     $_email = $Website->isUser ? $user['login'] : '';
     $tplModulePage = Template::getWebsiteUserView('contact/contact', $Website->getTheme());
     ob_start();
     if (is_file($tplModulePage)) {
         include $tplModulePage;
     }
     $out = ob_get_clean();
     return $out;
 }
Example #2
0
 public function getContent()
 {
     $out = $q = $qN = '';
     $uriToShow = array();
     $Website = $this->Website;
     $Module = $Website->getModule();
     $moduleInfo = $Website->getActiveModules();
     $type = array('blog', 'news', 'image', 'video', 'sharedlinks');
     foreach ($moduleInfo as $module) {
         if (in_array($module['type'], $type) && in_array($module['all']['id'], $Website->profile['liste_module'])) {
             $uriToShow[$module['all']['id']] = $module['all'];
         }
     }
     $tplModulePage = Template::getWebsiteUserView('index/home', $Website->getTheme());
     ob_start();
     if (is_file($tplModulePage)) {
         include $tplModulePage;
     }
     $out = ob_get_clean();
     return $out;
 }
Example #3
0
 public function getContent()
 {
     $out = $q = $qN = '';
     $Website = $this->Website;
     $Profile = $Website->profile;
     $User = $Website->_User;
     $hasMe = $Website->isMyProfile($User, $Profile);
     $Module = $Website->getModule();
     $moduleInfo = $Website->getActiveModules();
     $templateDefault = 'modules/image/image_listing';
     $templateDefaultContent = 'modules/image/image_content';
     if (array_key_exists($Module, $moduleInfo)) {
         if (!empty($moduleInfo[$Module]['all']['template_index'])) {
             $templateDefault = $moduleInfo[$Module]['all']['template_index'];
             $templateDefault = str_replace('.tpl.php', '', $templateDefault);
         }
         if (!empty($moduleInfo[$Module]['all']['template_content'])) {
             $templateDefaultContent = $moduleInfo[$Module]['all']['template_content'];
             $templateDefaultContent = str_replace('.tpl.php', '', $templateDefaultContent);
         }
     }
     $nameTable = '_m_' . $Website->getRealUri($Website->getModule());
     $categories = $Website->loadCategories($Website->getModule());
     $categoriesIds = $Website->categoriesIds;
     $_imgTime = URL . 'themes/' . $Website->getTheme() . '/img/icone_time.png';
     $_imgTag = URL . 'themes/' . $Website->getTheme() . '/img/icone_tag.png';
     $_imgCalendar = URL . 'themes/' . $Website->getTheme() . '/img/icone_calendar.png';
     $_imgComment = URL . 'themes/' . $Website->getTheme() . '/img/icone_comment.png';
     if ($Website->getPosition() === 'root' || $Website->getPosition() === 'category') {
         $Params = $Website->getParams();
         $ModuleInfos = $Website->moduleInfos($Website->getModule());
         $par = $ModuleInfos['groupe_by'];
         if (array_key_exists('q', $Params['GET']) && !empty($Params['GET']['q'])) {
             $q = mb_strtolower($Params['GET']['q'], 'UTF-8');
         }
         if (!empty($q)) {
             $qN = '&q=' . $q;
         }
         $outFilterAND = $sqlGroupe = $getCategory = '';
         $outGroupe = 'all';
         $valFilter = 'date';
         $outFilterORDER = ' ' . $nameTable . '.date_creation DESC ';
         $outSqlGroupe = " WHERE " . $nameTable . ".active = 2 AND ";
         if ($hasMe) {
             $outSqlGroupe = " WHERE ";
         }
         $outSqlGroupe .= $nameTable . ".id_user = '******'id'] . "'";
         $outSqlGroupe .= " AND " . $nameTable . "_traduction.id_content = " . $nameTable . ".id\n            AND " . $nameTable . "_traduction.langue = '" . $Website->myLanguage() . "'\n            ORDER BY " . $nameTable . ".date_creation DESC ";
         $outRub = $Website->getModule();
         $categoryLabel = '';
         if (array_key_exists('doorgets', $Params['GET'])) {
             $getCategory = $Params['GET']['doorgets'];
             $isCategorie = $Website->dbQS($getCategory, '_categories_traduction', 'uri');
             if (!empty($isCategorie)) {
                 $outGroupe = $getCategory;
                 $outSqlGroupe = " WHERE " . $nameTable . ".active = 2 AND ";
                 if ($hasMe) {
                     $outSqlGroupe = " WHERE ";
                 }
                 $outSqlGroupe .= " " . $nameTable . ".id_user = '******'id'] . "'";
                 $outSqlGroupe .= " AND " . $nameTable . "_traduction.id_content = " . $nameTable . ".id\n                    AND " . $nameTable . ".categorie LIKE '%" . $isCategorie['id_cat'] . ",%'\n                    AND " . $nameTable . "_traduction.langue = '" . $Website->myLanguage() . "'\n                    ORDER BY " . $nameTable . ".date_creation DESC ";
                 $outRub = 'doorgets=' . $getCategory;
                 if (array_key_exists($getCategory, $categories)) {
                     $categoryLabel = $categories[$getCategory];
                 }
                 $parentCategories = $Website->getBreadcrumb($Website->getModule(), $isCategorie['id_cat']);
                 sort($parentCategories);
             }
         }
         if (!empty($q)) {
             $outSqlGroupe = " WHERE " . $nameTable . ".active = 2 AND ";
             if ($hasMe) {
                 $outSqlGroupe = " WHERE ";
             }
             $outSqlGroupe .= $nameTable . "_traduction.id_content = " . $nameTable . ".id\n                AND " . $nameTable . "_traduction.langue = '" . $Website->myLanguage() . "'  ";
         }
         $champsliste[] = $nameTable . '_traduction.titre';
         $champsliste[] = $nameTable . '_traduction.description';
         $champsliste[] = $nameTable . '_traduction.uri';
         $champsliste[] = $nameTable . '_traduction.article_tinymce';
         $champsliste[] = $nameTable . '_traduction.meta_titre';
         $champsliste[] = $nameTable . '_traduction.meta_description';
         $champsliste[] = $nameTable . '_traduction.meta_keys';
         if (!empty($q) && !empty($champsliste)) {
             $sqlGroupe .= " AND (";
             foreach ($champsliste as $v) {
                 $sqlGroupe .= " " . $v . " LIKE '%" . $q . "%' OR";
             }
             $sqlGroupe = substr($sqlGroupe, 0, -2);
             $sqlGroupe .= ") ";
         }
         $outSqlGroupe = $outSqlGroupe . $sqlGroupe;
         $isContents = $Website->dbQ('SELECT COUNT(*) as counter FROM ' . $nameTable . ', ' . $nameTable . '_traduction ' . $outSqlGroupe);
         $totalContents = (int) $isContents[0]['counter'];
         $urlPage = $Website->getBaseUrl() . "?{$outRub}{$qN}&p=";
         $p = 1;
         $ini = 0;
         $per = $par;
         if (array_key_exists('p', $Params['GET']) && is_numeric($Params['GET']['p']) && $Params['GET']['p'] <= ceil($totalContents / $per)) {
             $p = $Params['GET']['p'];
             $ini = $p * $per - $per;
         }
         $sqlLimit = " {$outSqlGroupe}   LIMIT " . $ini . "," . $per;
         $getPagination = '';
         if ($totalContents > $per) {
             $getPagination = Pagination::pagePublic($totalContents, $p, $per, $urlPage);
         }
         $all = $Website->dbQ('SELECT * FROM ' . $nameTable . ', ' . $nameTable . '_traduction ' . $sqlLimit);
         $cAll = count($all);
         $finalPer = $ini + $per;
         if ($finalPer > $totalContents) {
             $finalPer = $totalContents;
         }
         $out = '';
         $contents = array();
         $iMaxDescription = 500;
         if (!empty($all)) {
             foreach ($all as $k => $data) {
                 $contents[$k]['active'] = $data['active'];
                 $contents[$k]['uri'] = $data['uri'];
                 $contents[$k]['title'] = $data['titre'];
                 $contents[$k]['image'] = $data['image'];
                 $contents[$k]['description'] = $data['description'];
                 $contents[$k]['article'] = html_entity_decode($data['article_tinymce']);
                 $lenArticle = strlen($contents[$k]['article']);
                 if ($lenArticle > $iMaxDescription - 1) {
                     $contents[$k]['article'] = substr(strip_tags($contents[$k]['article']), 0, $iMaxDescription) . '...';
                 }
                 $contents[$k]['order'] = $data['ordre'];
                 $contents[$k]['categories'] = $data['categorie'];
                 $contents[$k]['date'] = GetDate::in($data['date_creation'], 2, $Website->myLanguage);
             }
         }
         $groupeBy = $par;
         if (!empty($contents)) {
             $ini = $ini + 1;
         }
         $labelModuleGroup = $Website->getActiveModules();
         $labelModule = $labelModuleGroup[$Website->getModule()]['all']['nom'];
         $urlAfterAction = urlencode($Website->getCurrentUrl());
         $urlAdd = URL_USER . $Website->_lgUrl . '?controller=moduleimage&uri=' . $Website->getModule() . '&action=add&back=' . $urlAfterAction;
         $tplModuleNewsListing = Template::getWebsiteUserView($templateDefault, $Website->getTheme());
         ob_start();
         if (is_file($tplModuleNewsListing)) {
             include $tplModuleNewsListing;
         }
         $out .= ob_get_clean();
     } else {
         $linksToCategories = '';
         $isContent = $Website->dbQS($Website->getUri(), $nameTable . '_traduction', 'uri');
         if (!empty($isContent)) {
             $isContentActive = $Website->dbQS($isContent['id_content'], $nameTable, 'id', " AND active = 2 LIMIT 1");
             $isContentActiveVersion = $Website->dbQS($isContent['id_content'], $nameTable . '_version', 'id_content', " AND active = 2 AND langue = '" . $Website->myLanguage . "' LIMIT 1");
             if (!empty($isContentActive)) {
                 $isContent['article'] = htmlspecialchars_decode(html_entity_decode($isContent['article_tinymce']));
                 $isContent['article'] = $Website->_convertMethod($isContent['article']);
                 $isContent['title'] = $isContent['titre'];
                 unset($isContent['titre']);
                 unset($isContent['article_tinymce']);
                 unset($isContent['id']);
                 unset($isContent['meta_titre']);
                 unset($isContent['meta_description']);
                 unset($isContent['meta_keys']);
                 unset($isContent['langue']);
                 $isContent['active'] = $isContentActive['active'];
                 $isContent['author_badge'] = $isContentActive['author_badge'];
                 $isContent['id_user'] = $isContentActive['id_user'];
                 $isContent['id_groupe'] = $isContentActive['id_groupe'];
                 $isContent['comments'] = $isContentActive['comments'];
                 $isContent['sharethis'] = $isContentActive['partage'];
                 $isContent['facebook'] = $isContentActive['facebook'];
                 $isContent['disqus'] = $isContentActive['disqus'];
                 $isContent['image_gallery'] = $Website->_toArray($isContent['image_gallery'], ';');
                 $isContent['date_creation'] = GetDate::in($isContent['date_modification'], 2, $Website->myLanguage);
                 $aCategories = $Website->_toArray($isContentActive['categorie']);
                 if (!empty($aCategories)) {
                     foreach ($aCategories as $id_category) {
                         if (array_key_exists($id_category, $categoriesIds)) {
                             $linksToCategories .= '<a href="' . BASE_URL . '?doorgets=' . $categoriesIds[$id_category] . '">' . $Website->categorieSimple[$id_category] . '</a>';
                         }
                     }
                 }
             } elseif (empty($isContentActive) && !empty($isContentActiveVersion)) {
                 $isContentActive = $Website->dbQS($isContent['id_content'], $nameTable);
                 if (!empty($isContentActive)) {
                     $isContent['article'] = htmlspecialchars_decode(html_entity_decode($isContentActiveVersion['article_tinymce']));
                     $isContent['article'] = $Website->_convertMethod($isContent['article']);
                     $isContent['title'] = $isContentActiveVersion['titre'];
                     unset($isContent['titre']);
                     unset($isContent['article_tinymce']);
                     unset($isContent['id']);
                     unset($isContent['meta_titre']);
                     unset($isContent['meta_description']);
                     unset($isContent['meta_keys']);
                     unset($isContent['langue']);
                     $isContent['active'] = $isContentActive['active'];
                     $isContent['author_badge'] = $isContentActive['author_badge'];
                     $isContent['id_user'] = $isContentActive['id_user'];
                     $isContent['id_groupe'] = $isContentActive['id_groupe'];
                     $isContent['comments'] = $isContentActive['comments'];
                     $isContent['sharethis'] = $isContentActive['partage'];
                     $isContent['facebook'] = $isContentActive['facebook'];
                     $isContent['disqus'] = $isContentActive['disqus'];
                     $isContent['image_gallery'] = $Website->_toArray($isContent['image_gallery'], ';');
                     $isContent['date_creation'] = GetDate::in($isContent['date_modification'], 2, $Website->myLanguage);
                     $aCategories = $Website->_toArray($isContentActive['categorie']);
                     if (!empty($aCategories)) {
                         foreach ($aCategories as $id_category) {
                             if (array_key_exists($id_category, $categoriesIds)) {
                                 $linksToCategories .= '<a href="' . BASE_URL . '?doorgets=' . $categoriesIds[$id_category] . '">' . $Website->categorieSimple[$id_category] . '</a>';
                             }
                         }
                     }
                 }
             }
         }
         $nexContent = $Website->getUrlNextContent();
         $prevContent = $Website->getUrlPreviousContent();
         $cComment = $Website->getCountComment($Website->getModule(), $isContent['uri']);
         $urlAfterAction = $Website->getBaseUrl() . '?' . $Website->getModule() . '=' . urlencode($isContent['uri']);
         $urlGoToComments = $urlAfterAction . '#comments';
         $urlEdition = URL_USER . $Website->_lgUrl . '?controller=moduleimage&uri=' . $Website->getModule() . '&action=edit&id=' . $isContent['id_content'] . '&lg=' . $Website->getLangueTradution() . '&back=' . $urlAfterAction;
         $urlDelete = URL_USER . $Website->_lgUrl . '?controller=moduleimage&uri=' . $Website->getModule() . '&action=delete&id=' . $isContent['id_content'] . '&lg=' . $Website->getLangueTradution();
         $urlAdd = URL_USER . $Website->_lgUrl . '?controller=moduleimage&uri=' . $Website->getModule() . '&action=add&back=' . $urlAfterAction;
         $labelModuleGroup = $Website->getActiveModules();
         $labelModule = $labelModuleGroup[$Website->getModule()]['all']['nom'];
         $this->userPrivilege['modo'] = $Website->isUser && (in_array($labelModuleGroup[$Website->getModule()]['all']['id'], $Website->_User['liste_module']) && in_array($isContent['id_groupe'], $Website->_User['liste_enfant']) && in_array($isContent['id_groupe'], $Website->_User['liste_enfant_modo'])) ? true : false;
         $this->userPrivilege['edit'] = $Website->isUser && (in_array($labelModuleGroup[$Website->getModule()]['all']['id'], $Website->_User['liste_module']) && $isContent['id_user'] === $Website->_User['id'] && $this->userPrivilege['edit'] || $this->userPrivilege['modo']) ? true : false;
         $this->userPrivilege['delete'] = $Website->isUser && (in_array($labelModuleGroup[$Website->getModule()]['all']['id'], $Website->_User['liste_module']) && $isContent['id_user'] === $Website->_User['id'] && $this->userPrivilege['delete'] || $this->userPrivilege['modo']) ? true : false;
         extract($isContent);
         $tplModuleNewsContent = Template::getWebsiteUserView($templateDefaultContent, $Website->getTheme());
         ob_start();
         if (is_file($tplModuleNewsContent)) {
             include $tplModuleNewsContent;
         }
         $out .= ob_get_clean();
     }
     return $out;
 }
Example #4
0
 public function getLastModuleContents($module, $count = 3, $catId = '')
 {
     $out = '';
     $iMaxDescription = 500;
     $nameTable = $this->getRealUri('_m_' . $module);
     $nameTableTrad = $nameTable . '_traduction';
     //echo $module;
     $isModule = $this->dbQS($module, '_modules', 'uri');
     $valActive = array("blog", "news", "video", "image", "sharedlinks");
     if (empty($isModule)) {
         return '# Error Class doorgetsWebisteUser  line ' . __LINE__;
     }
     if (!in_array($isModule['type'], $valActive)) {
         return '# Error Class doorgetsWebisteUser [' . $isModule['type'] . '] line ' . __LINE__;
     }
     $catSql = '';
     if (!empty($catId) && is_numeric($catId)) {
         $catSql = " AND categorie LIKE '%" . $catId . ",%'";
     }
     if (!empty($isModule)) {
         $Contents = $this->dbQ("SELECT * FROM {$nameTable} WHERE active = 2 {$catSql} AND id_user = "******" ORDER BY id DESC LIMIT {$count}");
         if (!empty($Contents)) {
             switch ($isModule['type']) {
                 case 'news':
                     foreach ($Contents as $k => $content) {
                         $lgTrad = unserialize($content['groupe_traduction']);
                         $Contents[$k]['groupe_traduction'] = $lgTrad;
                         $idLg = $Contents[$k]['groupe_traduction'][$this->myLanguage()];
                         $isContent = $this->dbQS($idLg, $nameTableTrad);
                         $Contents[$k]['content_traduction'] = $isContent;
                         $Contents[$k]['date'] = GetDate::in($Contents[$k]['date_creation'], 2, $this->myLanguage);
                         $Contents[$k]['article'] = html_entity_decode($Contents[$k]['content_traduction']['article_tinymce']);
                         $lenArticle = strlen($Contents[$k]['article']);
                         if ($lenArticle > $iMaxDescription - 1) {
                             $Contents[$k]['article'] = substr(strip_tags($Contents[$k]['article']), 0, $iMaxDescription) . '...';
                         }
                     }
                     $tplNews = Template::getWebsiteUserView('modules/news/news_last_contents', $this->getTheme());
                     ob_start();
                     if (is_file($tplNews)) {
                         include $tplNews;
                     }
                     $out = ob_get_clean();
                     break;
                 case 'sharedlinks':
                     foreach ($Contents as $k => $content) {
                         $lgTrad = unserialize($content['groupe_traduction']);
                         $Contents[$k]['groupe_traduction'] = $lgTrad;
                         $idLg = $Contents[$k]['groupe_traduction'][$this->myLanguage()];
                         $isContent = $this->dbQS($idLg, $nameTableTrad);
                         $Contents[$k]['content_traduction'] = $isContent;
                         $Contents[$k]['date'] = GetDate::in($Contents[$k]['date_creation'], 2, $this->myLanguage);
                         $Contents[$k]['article'] = $Contents[$k]['content_traduction']['url'];
                         $lenArticle = strlen($Contents[$k]['article']);
                         if ($lenArticle > $iMaxDescription - 1) {
                             $Contents[$k]['article'] = substr(strip_tags($Contents[$k]['article']), 0, $iMaxDescription) . '...';
                         }
                     }
                     $tplSharedlinks = Template::getWebsiteUserView('modules/sharedlinks/sharedlinks_last_contents', $this->getTheme());
                     ob_start();
                     if (is_file($tplSharedlinks)) {
                         include $tplSharedlinks;
                     }
                     $out = ob_get_clean();
                     break;
                 case 'blog':
                     foreach ($Contents as $k => $content) {
                         $lgTrad = unserialize($content['groupe_traduction']);
                         $Contents[$k]['groupe_traduction'] = $lgTrad;
                         $idLg = $Contents[$k]['groupe_traduction'][$this->myLanguage()];
                         $isContent = $this->dbQS($idLg, $nameTableTrad);
                         $Contents[$k]['content_traduction'] = $isContent;
                         $Contents[$k]['image'] = $isContent['image'];
                         $Contents[$k]['date'] = GetDate::in($Contents[$k]['date_creation'], 2, $this->myLanguage);
                         $Contents[$k]['article'] = html_entity_decode($Contents[$k]['content_traduction']['article_tinymce']);
                         $lenArticle = strlen($Contents[$k]['article']);
                         if ($lenArticle > $iMaxDescription - 1) {
                             $Contents[$k]['article'] = substr(strip_tags($Contents[$k]['article']), 0, $iMaxDescription) . '...';
                         }
                     }
                     $tplNews = Template::getWebsiteUserView('modules/blog/blog_last_contents', $this->getTheme());
                     ob_start();
                     if (is_file($tplNews)) {
                         include $tplNews;
                     }
                     $out = ob_get_clean();
                     break;
                 case 'video':
                     foreach ($Contents as $k => $content) {
                         $lgTrad = unserialize($content['groupe_traduction']);
                         $Contents[$k]['groupe_traduction'] = $lgTrad;
                         $idLg = $Contents[$k]['groupe_traduction'][$this->myLanguage()];
                         $isContent = $this->dbQS($idLg, $nameTableTrad);
                         $Contents[$k]['content_traduction'] = $isContent;
                         $Contents[$k]['date'] = GetDate::in($Contents[$k]['date_creation'], 2, $this->myLanguage);
                     }
                     $tplVideo = Template::getWebsiteUserView('modules/video/video_last_contents', $this->getTheme());
                     ob_start();
                     if (is_file($tplVideo)) {
                         include $tplVideo;
                     }
                     $out = ob_get_clean();
                     break;
                 case 'image':
                     foreach ($Contents as $k => $content) {
                         $lgTrad = unserialize($content['groupe_traduction']);
                         $Contents[$k]['groupe_traduction'] = $lgTrad;
                         $idLg = $Contents[$k]['groupe_traduction'][$this->myLanguage()];
                         $isContent = $this->dbQS($idLg, $nameTableTrad);
                         $Contents[$k]['content_traduction'] = $isContent;
                         $Contents[$k]['date'] = GetDate::in($Contents[$k]['date_creation'], 2, $this->myLanguage);
                     }
                     $tplImage = Template::getWebsiteUserView('modules/image/image_last_contents', $this->getTheme());
                     ob_start();
                     if (is_file($tplImage)) {
                         include $tplImage;
                     }
                     $out = ob_get_clean();
                     break;
             }
         }
     }
     return $out;
 }
Example #5
0
 public function getHtmlLanguages()
 {
     $base_url = URL . 't/';
     $languages = $this->allLanguagesWebsite;
     $languagesMenu = array();
     if (count($languages) > 1) {
         foreach ($languages as $uri_language => $label) {
             if ($this->type !== 'page') {
                 $languagesMenu[$uri_language]['url'] = $base_url . $uri_language . '/?' . $this->module;
                 $languagesMenu[$uri_language]['label'] = $label;
                 if ($this->position === 'content') {
                     $tableTaduction = '_m_' . $this->getRealUri($this->module) . '_traduction';
                     $idContent = $this->content['id_content'];
                     $isContent = $this->dbQS($idContent, $tableTaduction, 'id_content', "AND langue = '" . $uri_language . "' LIMIT 1");
                     if (!empty($isContent)) {
                         $isContent = $this->dbQS($isContent['id'], $tableTaduction);
                         $languagesMenu[$uri_language]['url'] = $base_url . $uri_language . '/?' . $this->module . '=' . $isContent['uri'];
                         $languagesMenu[$uri_language]['label'] = $label;
                     }
                 } elseif ($this->position === 'category') {
                     $idCat = $this->category['id_cat'];
                     $isCategory = $this->dbQS($idCat, '_categories_traduction', 'id_cat', "AND langue = '" . $uri_language . "' LIMIT 1");
                     if (!empty($isCategory)) {
                         $isCategory = $this->dbQS($isCategory['id'], '_categories_traduction');
                         $languagesMenu[$uri_language]['url'] = $base_url . $uri_language . '/?doorgets=' . $isCategory['uri'];
                         $languagesMenu[$uri_language]['label'] = $label;
                     }
                 }
             } else {
                 $languagesMenu[$uri_language]['url'] = $base_url . $uri_language . '/?' . $this->module;
                 $languagesMenu[$uri_language]['label'] = $label;
             }
         }
     }
     $tplTanguages = Template::getWebsiteUserView('widgets/languages', $this->getTheme());
     ob_start();
     if (is_file($tplTanguages)) {
         include $tplTanguages;
     }
     $out = ob_get_clean();
     return $out;
 }