protected function main()
 {
     if (!is_logged_in()) {
         header('Location: mobile.html');
     }
     $this->set_tpl('mobile/categories/list_news.html');
     $this->load_lang_file('news');
     // On compte le nbr de news en rédaction
     inc_lib('news/count_news');
     $nombre_news = count_news('n_etat = 1');
     // Pagination
     $page = (!empty($_GET['page']) and is_numeric($_GET['page']) and $_GET['page'] > 0) ? (int) $_GET['page'] : 1;
     $nombreDePages = ceil($nombre_news / Nw::$pref['nb_news_redac']);
     // On vérifie bien que la page existe
     if ($nombreDePages > 0 && $page > $nombreDePages) {
         redir(Nw::$lang['common']['pg_not_exist'], false, './mobile.html');
     }
     // On recherche toutes les news en rédaction
     inc_lib('news/get_list_news');
     $list_dn_news = get_list_news('n_etat = 1', 'n_date DESC', $page, Nw::$pref['nb_news_redac']);
     // On affiche toutes les news en rédaction
     foreach ($list_dn_news as $donnees_news) {
         Nw::$tpl->setBlock('news', array('ID' => $donnees_news['n_id'], 'CAT_ID' => $donnees_news['c_id'], 'CAT_TITRE' => $donnees_news['c_nom'], 'IMAGE_ID' => $donnees_news['i_id'], 'IMAGE_NOM' => $donnees_news['i_nom'], 'TITRE' => $donnees_news['n_titre'], 'RESUME' => $donnees_news['n_resume'], 'REWRITE' => rewrite($donnees_news['n_titre']), 'AUTEUR' => $donnees_news['u_pseudo'], 'AUTEUR_ID' => $donnees_news['u_id'], 'AUTEUR_ALIAS' => $donnees_news['u_alias'], 'AUTEUR_AVATAR' => $donnees_news['u_avatar'], 'DATE' => date_sql($donnees_news['date_news'], $donnees_news['heures_date_news'], $donnees_news['jours_date_news']), 'NBR_COMS' => sprintf(Nw::$lang['news']['nbr_comments_news'], $donnees_news['n_nbr_coms'], $donnees_news['n_nbr_coms'] > 1 ? Nw::$lang['news']['add_s_comments'] : ''), 'VOTES' => $donnees_news['n_nb_votes'], 'VOTES_NEG' => $donnees_news['n_nb_votes_neg'], 'HAS_VOTED' => is_logged_in() ? $donnees_news['v_id_membre'] : 0));
     }
     Nw::$tpl->set(array('LIST_PG' => list_pg($nombreDePages, $page, 'mobile-2%s.html'), 'NB_NEWS' => $nombre_news, 'TITLE' => Nw::$lang['news']['en_attente_title'], 'TITLE_REWRITE' => 'news_en_attente', 'INC_HEAD' => empty($_SERVER['HTTP_AJAX'])));
 }
Ejemplo n.º 2
0
 protected function main()
 {
     $this->set_tpl('mobile/news/une.html');
     $this->load_lang_file('news');
     // On compte le nbr de news publiées
     inc_lib('news/count_news');
     $nombre_news = count_news('n_etat = 3');
     $ids_all_news = array();
     // Pagination
     $page = !empty($_GET['page']) ? (int) $_GET['page'] : 1;
     $nombreDePages = ceil($nombre_news / Nw::$pref['nb_news_homepage']);
     // On vérifie que la page existe bien
     if ($nombreDePages > 0 && $page > $nombreDePages) {
         redir(Nw::$lang['common']['pg_not_exist'], false, './');
     }
     // On recherche toutes les news publiées
     inc_lib('news/get_list_news');
     $list_dn_news = get_list_news('n_etat = 3', 'n_date DESC', $page, Nw::$pref['nb_news_homepage']);
     $cours_news = 0;
     foreach ($list_dn_news as $donnees_news) {
         Nw::$tpl->setBlock('news', array('ID' => $donnees_news['n_id'], 'CAT_ID' => $donnees_news['c_id'], 'CAT_TITRE' => $donnees_news['c_nom'], 'CAT_REWRITE' => rewrite($donnees_news['c_nom']), 'IMAGE_ID' => $donnees_news['i_id'], 'IMAGE_NOM' => $donnees_news['i_nom'], 'TITRE' => $donnees_news['n_titre'], 'RESUME' => $donnees_news['n_resume'], 'REWRITE' => rewrite($donnees_news['n_titre']), 'AUTEUR' => $donnees_news['u_pseudo'], 'AUTEUR_ID' => $donnees_news['u_id'], 'AUTEUR_ALIAS' => $donnees_news['u_alias'], 'AUTEUR_AVATAR' => $donnees_news['u_avatar'], 'DATE' => date_sql($donnees_news['date_news'], $donnees_news['heures_date_news'], $donnees_news['jours_date_news']), 'NBR_VOTES' => $donnees_news['n_nb_votes'], 'NBR_COMS' => sprintf(Nw::$lang['news']['nbr_comments_news'], $donnees_news['n_nbr_coms'], $donnees_news['n_nbr_coms'] > 1 ? Nw::$lang['news']['add_s_comments'] : '')));
         ++$cours_news;
     }
     Nw::$tpl->set(array('LIST_PG' => list_pg($nombreDePages, $page, 'mobile-2%s.html'), 'NB_NEWS' => $cours_news, 'INC_HEAD' => empty($_SERVER['HTTP_AJAX'])));
 }
Ejemplo n.º 3
0
 protected function main()
 {
     $this->set_title(Nw::$site_slogan);
     $this->set_tpl('news/homepage.html');
     $this->add_css('code.css');
     $this->set_filAriane(Nw::$site_slogan);
     $this->add_wid_in_content('homepage');
     // On compte le nbr de news publiées
     inc_lib('news/count_news');
     $nombre_news = count_news('n_etat = 3');
     $ids_all_news = array();
     // Pagination
     $page = isset($_GET['page']) ? intval($_GET['page']) : 1;
     $nombreDePages = ceil($nombre_news / Nw::$pref['nb_news_homepage']);
     // On vérifie que la page existe bien
     if ($nombreDePages > 0 && $page > $nombreDePages) {
         redir(Nw::$lang['common']['pg_not_exist'], false, './');
     }
     // On recherche toutes les news publiées
     inc_lib('news/get_list_news');
     inc_lib('news/can_edit_news');
     $list_dn_news = get_list_news('n_etat = 3', 'n_date DESC', $page, Nw::$pref['nb_news_homepage']);
     $cours_news = 0;
     $cours_news2 = 0;
     foreach ($list_dn_news as $donnees_news) {
         $ids_all_news[] = $donnees_news['n_id'];
         Nw::$tpl->setBlock('news', array('ID' => $donnees_news['n_id'], 'COURS' => $cours_news % 2, 'COURS2' => $cours_news2 % 2, 'CAT_ID' => $donnees_news['c_id'], 'CAT_TITRE' => $donnees_news['c_nom'], 'CAT_REWRITE' => $donnees_news['c_rewrite'], 'IMAGE_ID' => $donnees_news['i_id'], 'IMAGE_NOM' => $donnees_news['i_nom'], 'TITRE' => $donnees_news['n_titre'], 'RESUME' => $donnees_news['n_resume'], 'REWRITE' => rewrite($donnees_news['n_titre']), 'AUTEUR' => $donnees_news['u_pseudo'], 'AUTEUR_ID' => $donnees_news['u_id'], 'AUTEUR_ALIAS' => $donnees_news['u_alias'], 'AUTEUR_AVATAR' => $donnees_news['u_avatar'], 'DATE' => date_sql($donnees_news['date_news'], $donnees_news['heures_date_news'], $donnees_news['jours_date_news']), 'HAS_VOTED' => is_logged_in() ? $donnees_news['v_id_membre'] : 0, 'NBR_VOTES' => $donnees_news['n_nb_votes'], 'NBR_COMS' => sprintf(Nw::$lang['news']['nbr_comments_news'], $donnees_news['n_nbr_coms'], $donnees_news['n_nbr_coms'] > 1 ? Nw::$lang['news']['add_s_comments'] : ''), 'MORE_NEWS' => isset($donnees_news['first_tag']) ? sprintf(Nw::$lang['news']['more_news_sujet'], urlencode($donnees_news['first_tag']), ucfirst($donnees_news['first_tag'])) : '', 'DRT_EDIT' => is_logged_in() ? can_edit_news($donnees_news['n_id_auteur'], $donnees_news['n_etat']) : false, 'DRT_DELETE' => is_logged_in() && ($donnees_news['n_id_auteur'] == Nw::$dn_mbr['u_id'] && Nw::$droits['can_delete_mynews'] || Nw::$droits['can_delete_news']) ? true : false));
         if ($donnees_news['i_id'] != 0) {
             ++$cours_news;
         }
         ++$cours_news2;
     }
     $news_related = array();
     if (count($ids_all_news) > 0) {
         inc_lib('news/get_list_news_related');
         $news_related = get_list_news_related($ids_all_news);
     }
     /**
      *   Actus populaires
      **/
     inc_lib('news/get_list_top_actu');
     $hot_actu = get_list_top_actu(4);
     foreach ($hot_actu as $donnees) {
         Nw::$tpl->setBlock('top', array('ID' => $donnees['n_id'], 'TITRE' => $donnees['n_titre'], 'CAT_REWRITE' => $donnees['c_rewrite'], 'REWRITE' => rewrite($donnees['n_titre']), 'DATE' => date_sql($donnees['date_news'], $donnees['heures_date_news'], $donnees['jours_date_news']), 'AUTEUR_ID' => $donnees['n_id_auteur'], 'NBR_VOTES' => $donnees['n_nb_votes'], 'HAS_VOTED' => is_logged_in() ? $donnees['v_id_membre'] : 0, 'NBR_COMS' => sprintf(Nw::$lang['news']['nbr_comments_news'], $donnees['n_nbr_coms'], $donnees['n_nbr_coms'] > 1 ? Nw::$lang['news']['add_s_comments'] : ''), 'IMAGE_ID' => $donnees['i_id'], 'IMAGE_NOM' => $donnees['i_nom']));
     }
     /**
      *   Nuage de tags
      **/
     inc_lib('news/nuage_tags');
     $tags_a_afficher = 30;
     $nuage_tags = nuage_tags($tags_a_afficher);
     foreach ($nuage_tags as $donnees_tags) {
         Nw::$tpl->setBlock('nuage', array('INT' => $donnees_tags['t_tag'], 'REWRITE' => urlencode($donnees_tags['t_tag']), 'SIZE' => $donnees_tags['size'], 'COLOR' => $donnees_tags['c_couleur']));
     }
     Nw::$tpl->set(array('LIST_PG' => list_pg($nombreDePages, $page, 'news%s.html'), 'RELATED' => $news_related, 'FIRST_VISIT' => (bool) (!is_logged_in() && !isset($_COOKIE['nw_fv']))));
 }
Ejemplo n.º 4
0
 protected function main()
 {
     inc_lib('news/get_info_cat');
     $donnees_cat_news = get_info_cat($_GET['ct'], 'rewrite');
     if (count($donnees_cat_news) == 0 || empty($donnees_cat_news) || empty($_GET['ct'])) {
         header('Location: ./');
     }
     $this->set_title($donnees_cat_news['c_nom']);
     $this->set_tpl('news/cat_news.html');
     $this->add_css('code.css');
     $this->base_enabled(true);
     $this->add_wid_in_content('view_cat.' . $donnees_cat_news['c_id']);
     // On compte le nbr de news publiées
     inc_lib('news/count_news');
     $nombre_news = count_news('n_etat = 3 AND n_id_cat = ' . $donnees_cat_news['c_id']);
     // Pagination
     $page = isset($_GET['page']) ? intval($_GET['page']) : 1;
     $nombreDePages = ceil($nombre_news / Nw::$pref['nb_news_homepage']);
     // On vérifie bien que la page existe
     if ($nombreDePages > 0 && $page > $nombreDePages) {
         redir(Nw::$lang['common']['pg_not_exist'], false, './');
     }
     // On recherche toutes les news en rédaction
     inc_lib('news/get_list_news');
     inc_lib('news/can_edit_news');
     $list_dn_news = get_list_news('n_etat = 3 AND n_id_cat = ' . $donnees_cat_news['c_id'], 'n_date DESC', $page, Nw::$pref['nb_news_homepage']);
     $cours_news = 0;
     $cours_news2 = 0;
     foreach ($list_dn_news as $donnees_news) {
         Nw::$tpl->setBlock('news', array('ID' => $donnees_news['n_id'], 'COURS' => $cours_news % 2, 'COURS2' => $cours_news2 % 2, 'CAT_ID' => $donnees_news['c_id'], 'CAT_TITRE' => $donnees_news['c_nom'], 'CAT_REWRITE' => $donnees_news['c_rewrite'], 'IMAGE_ID' => $donnees_news['i_id'], 'IMAGE_NOM' => $donnees_news['i_nom'], 'TITRE' => $donnees_news['n_titre'], 'RESUME' => $donnees_news['n_resume'], 'REWRITE' => rewrite($donnees_news['n_titre']), 'AUTEUR' => $donnees_news['u_pseudo'], 'AUTEUR_ID' => $donnees_news['u_id'], 'AUTEUR_ALIAS' => $donnees_news['u_alias'], 'AUTEUR_AVATAR' => $donnees_news['u_avatar'], 'DATE' => date_sql($donnees_news['date_news'], $donnees_news['heures_date_news'], $donnees_news['jours_date_news']), 'HAS_VOTED' => is_logged_in() ? $donnees_news['v_id_membre'] : 0, 'NBR_VOTES' => $donnees_news['n_nb_votes'], 'NBR_COMS' => sprintf(Nw::$lang['news']['nbr_comments_news'], $donnees_news['n_nbr_coms'], $donnees_news['n_nbr_coms'] > 1 ? Nw::$lang['news']['add_s_comments'] : ''), 'DRT_EDIT' => is_logged_in() ? can_edit_news($donnees_news['n_id_auteur'], $donnees_news['n_etat']) : false, 'DRT_DELETE' => is_logged_in() && ($donnees_news['n_id_auteur'] == Nw::$dn_mbr['u_id'] && Nw::$droits['can_delete_mynews'] || Nw::$droits['can_delete_news']) ? true : false));
         if ($donnees_news['i_id'] != 0) {
             ++$cours_news;
         }
         ++$cours_news2;
     }
     /**
      *   Nuage de tags
      **/
     inc_lib('news/nuage_tags');
     $tags_a_afficher = 30;
     $list_tags_metas = array();
     $nuage_tags = nuage_tags($tags_a_afficher, $donnees_cat_news['c_id']);
     foreach ($nuage_tags as $donnees_tags) {
         $list_tags_metas[] = $donnees_tags['t_tag'];
         Nw::$tpl->setBlock('nuage', array('INT' => $donnees_tags['t_tag'], 'REWRITE' => urlencode($donnees_tags['t_tag']), 'SIZE' => $donnees_tags['size'], 'COLOR' => $donnees_tags['c_couleur']));
     }
     $this->set_filAriane(array(Nw::$lang['news']['news_section'] => array('news-70.html'), $donnees_cat_news['c_nom'] => array($donnees_cat_news['c_rewrite'] . '/')));
     $this->metas(array('desc' => $donnees_cat_news['c_desc'], 'tags' => implode(', ', $list_tags_metas)));
     Nw::$tpl->set(array('LIST_PG' => list_pg($nombreDePages, $page, $donnees_cat_news['c_rewrite'] . '/%s', ''), 'TITRE' => $donnees_cat_news['c_nom']));
 }
Ejemplo n.º 5
0
 protected function main()
 {
     $this->set_tpl('mobile/news/homepage.html');
     $this->load_lang_file('users');
     $this->load_lang_file('news');
     $this->load_lang_file('search');
     // Recherche
     if (!empty($_POST['search']) && strlen(trim($_POST['search'])) > 1) {
         header('Location: mobile-1.html?s=' . urlencode($_POST['search']));
     }
     // 3 dernières news
     inc_lib('news/get_list_news');
     $list_dn_news = get_list_news('n_etat = 3', 'n_date DESC', 1, 3);
     foreach ($list_dn_news as $donnees_news) {
         Nw::$tpl->setBlock('news', array('ID' => $donnees_news['n_id'], 'IMAGE_ID' => $donnees_news['i_id'], 'IMAGE_NOM' => $donnees_news['i_nom'], 'TITRE' => $donnees_news['n_titre'], 'RESUME' => $donnees_news['n_resume'], 'REWRITE' => rewrite($donnees_news['n_titre']), 'DATE' => date_sql($donnees_news['date_news'], $donnees_news['heures_date_news'], $donnees_news['jours_date_news'])));
     }
     Nw::$tpl->set(array('INC_HEAD' => isset($_GET['head']) ? false : true));
 }
Ejemplo n.º 6
0
 protected function main()
 {
     // Seuls les membres peuvent créer des brouillons
     if (!is_logged_in()) {
         redir(Nw::$lang['common']['need_login'], false, 'users-10.html');
     }
     $this->set_title(Nw::$lang['news']['en_attente_title']);
     $this->set_tpl('news/attente.html');
     $this->add_css('code.css');
     $this->add_js('news.attente.js');
     $this->add_wid_in_content('attente');
     // Fil ariane
     $this->set_filAriane(array(Nw::$lang['news']['news_section'] => array('news-70.html'), Nw::$lang['news']['en_attente_title'] => array('')));
     // On compte le nbr de news en rédaction
     inc_lib('news/count_news');
     $nombre_news = count_news('n_etat = 2');
     if ($nombre_news > 0) {
         inc_lib('news/get_list_tags_news');
         inc_lib('news/get_list_flags_news');
         $list_tags = array();
         $list_flags = array();
         $array_favoris = array();
         $donnees_tags = get_list_tags_news(2);
         $donnees_flags = get_list_flags_news(2);
         foreach ($donnees_flags as $all_flags) {
             if ($all_flags['f_type'] == 1) {
                 $array_favoris[] = $all_flags['f_id_news'];
             }
             $list_flags[$all_flags['f_id_news']][] = '<li class="netat"><a href="news-5.html?flag=' . $all_flags['f_type'] . '&amp;status=1">' . $all_flags['txt_lang'] . '</a></li>';
         }
         foreach ($donnees_tags as $all_tags) {
             $list_tags[$all_tags['t_id_news']][] = '<li class="ntag"><a href="search.html?s=' . $all_tags['rewrite'] . '">' . $all_tags['t_tag'] . '</a></li>';
         }
     }
     // Pagination
     $page = isset($_GET['page']) ? intval($_GET['page']) : 1;
     $nombreDePages = ceil($nombre_news / Nw::$pref['nb_news_redac']);
     // On vérifie bien que la page existe
     if ($nombreDePages > 0 && $page > $nombreDePages) {
         redir(Nw::$lang['common']['pg_not_exist'], false, 'news-70.html');
     }
     // On recherche toutes les news en rédaction
     inc_lib('news/get_list_news');
     inc_lib('news/can_edit_news');
     $list_dn_news = get_list_news('n_etat = 2', 'n_date DESC', $page, Nw::$pref['nb_news_redac']);
     $nbr_news = 0;
     // On affiche toutes les news en rédaction
     foreach ($list_dn_news as $donnees_news) {
         $flags_html = '';
         // Cette news a des flags? (Je rédige, etc.)
         if (isset($list_flags[$donnees_news['n_id']]) && count($list_flags[$donnees_news['n_id']]) > 0) {
             $flags_html = implode(' ', $list_flags[$donnees_news['n_id']]);
         }
         if (isset($list_tags[$donnees_news['n_id']])) {
             $tags_news = array_slice($list_tags[$donnees_news['n_id']], 0, 5);
         } else {
             $tags_news = array();
         }
         // Il y a au moins un tag
         if (count($tags_news) > 0) {
             $tags_html = implode(' ', $tags_news);
         } else {
             $tags_html = '<li class="ntag"><span>' . Nw::$lang['news']['none_tag'] . '</span></li>';
         }
         Nw::$tpl->setBlock('news', array('ID' => $donnees_news['n_id'], 'CAT_ID' => $donnees_news['c_id'], 'CAT_TITRE' => $donnees_news['c_nom'], 'CAT_REWRITE' => $donnees_news['c_rewrite'], 'IMAGE_ID' => $donnees_news['i_id'], 'IMAGE_NOM' => $donnees_news['i_nom'], 'TITRE' => $donnees_news['n_titre'], 'RESUME' => $donnees_news['n_resume'], 'REWRITE' => rewrite($donnees_news['n_titre']), 'AUTEUR' => $donnees_news['u_pseudo'], 'AUTEUR_ID' => $donnees_news['u_id'], 'AUTEUR_ALIAS' => $donnees_news['u_alias'], 'AUTEUR_AVATAR' => $donnees_news['u_avatar'], 'DATE' => date_sql($donnees_news['date_news'], $donnees_news['heures_date_news'], $donnees_news['jours_date_news']), 'NBR_COMS' => sprintf(Nw::$lang['news']['nbr_comments_news'], $donnees_news['n_nbr_coms'], $donnees_news['n_nbr_coms'] > 1 ? Nw::$lang['news']['add_s_comments'] : ''), 'NBR_VERSIONS' => $donnees_news['n_nb_versions'] > 1 ? '<a href="news-16-' . $donnees_news['n_id'] . '.html">' . sprintf(Nw::$lang['news']['nbr_versions_news'], $donnees_news['n_nb_versions']) . '</a>' : Nw::$lang['news']['none_versions'], 'COLOR' => $nbr_news % 2, 'VOTES' => $donnees_news['n_nb_votes'], 'VOTES_NEG' => $donnees_news['n_nb_votes_neg'], 'HAS_VOTED' => is_logged_in() ? $donnees_news['v_id_membre'] : 0, 'TAGS' => $tags_html, 'FLAGS' => $flags_html, 'FLAGS_FAV' => (bool) in_array($donnees_news['n_id'], $array_favoris), 'EDIT' => can_edit_news($donnees_news['n_id_auteur'], $donnees_news['n_etat']), 'DELETE' => $donnees_news['n_id_auteur'] == Nw::$dn_mbr['u_id'] && Nw::$droits['can_delete_mynews'] || Nw::$droits['can_delete_news'] ? true : false));
         ++$nbr_news;
     }
     /**
      *   Bientot en ligne 
      **/
     $nb_promus = 0;
     inc_lib('news/get_list_news_light');
     $nbr_votes_promus = round(Nw::$pref['nb_votes_valid_news'] / 2);
     $presque_promus = get_list_news_light('n_etat = 2 AND n_nb_votes >= ' . $nbr_votes_promus, 'n_nb_votes DESC, n_date DESC', 1, 7);
     foreach ($presque_promus as $donnees_news) {
         Nw::$tpl->setBlock('pp', array('ID' => $donnees_news['n_id'], 'TITRE' => $donnees_news['n_titre'], 'REWRITE' => rewrite($donnees_news['n_titre']), 'CAT_REWRITE' => $donnees_news['c_rewrite'], 'AUTEUR' => $donnees_news['u_pseudo'], 'AUTEUR_ID' => $donnees_news['u_id'], 'AUTEUR_ALIAS' => $donnees_news['u_alias'], 'AUTEUR_AVATAR' => $donnees_news['u_avatar'], 'DATE' => date_sql($donnees_news['date_news'], $donnees_news['heures_date_news'], $donnees_news['jours_date_news']), 'HAS_VOTED' => is_logged_in() ? $donnees_news['v_id_membre'] : 0, 'NBR_VOTES' => $donnees_news['n_nb_votes'], 'NBR_COMS' => sprintf(Nw::$lang['news']['nbr_comments_news'], $donnees_news['n_nbr_coms'], $donnees_news['n_nbr_coms'] > 1 ? Nw::$lang['news']['add_s_comments'] : ''), 'NBR_VERSIONS' => $donnees_news['n_nb_versions'] > 1 ? '<a href="news-16-' . $donnees_news['n_id'] . '.html">' . sprintf(Nw::$lang['news']['nbr_versions_news'], $donnees_news['n_nb_versions']) . '</a>' : Nw::$lang['news']['none_versions']));
         ++$nb_promus;
     }
     /**
      *   Derniers commentaires
      **/
     inc_lib('bbcode/clearer');
     inc_lib('news/get_list_last_cmt');
     $last_comments = get_list_last_cmt(0, 'com.c_date DESC', 1, 5);
     foreach ($last_comments as $donnees_cmt) {
         $content_cmt = CoupeChar(clearer($donnees_cmt['c_texte'], 0), '...', 150);
         Nw::$tpl->setBlock('lc', array('ID' => $donnees_cmt['n_id'], 'ID_COMMENT' => $donnees_cmt['c_id'], 'TITRE' => $donnees_cmt['n_titre'], 'REWRITE' => rewrite($donnees_cmt['n_titre']), 'CAT_REWRITE' => $donnees_cmt['c_rewrite'], 'AUTEUR' => $donnees_cmt['u_pseudo'], 'AUTEUR_ID' => $donnees_cmt['u_id'], 'AUTEUR_ALIAS' => $donnees_cmt['u_alias'], 'AUTEUR_AVATAR' => $donnees_cmt['u_avatar'], 'DATE' => date_sql($donnees_cmt['date'], $donnees_cmt['heures_date'], $donnees_cmt['jours_date']), 'EXTRAIT' => $content_cmt));
     }
     /**
      *   Top voters
      **/
     inc_lib('news/get_list_top_voters');
     $top_voters = get_list_top_voters(5);
     foreach ($top_voters as $donnees) {
         $text_int_votes = $donnees['s_nb_votes'] > 1 ? Nw::$lang['news']['text_nbr_votes'] : Nw::$lang['news']['text_nbr_vote'];
         Nw::$tpl->setBlock('tv', array('NBR_VOTES' => sprintf($text_int_votes, $donnees['s_nb_votes']), 'AUTEUR' => $donnees['u_pseudo'], 'AUTEUR_ID' => $donnees['u_id'], 'AUTEUR_ALIAS' => $donnees['u_alias'], 'AUTEUR_AVATAR' => $donnees['u_avatar']));
     }
     Nw::$tpl->set(array('LIST_PG' => list_pg($nombreDePages, $page, 'news-80%s.html'), 'NB_VOT_VALID' => Nw::$pref['nb_votes_valid_news'], 'NB_PROMUS' => $nb_promus));
 }
Ejemplo n.º 7
0
 protected function main()
 {
     $this->set_title(Nw::$lang['news']['suivis_news']);
     $this->set_tpl('news/suivis.html');
     $this->add_css('code.css');
     $this->add_wid_in_content('suivis');
     // Fil ariane
     $this->set_filAriane(array(Nw::$lang['news']['news_section'] => array('news-70.html'), Nw::$lang['news']['suivis_news'] => array('')));
     // Paramètres
     $get_params = array();
     $param_order = 0;
     $array_sort = array(0 => 'n_date DESC', 1 => 'n_nb_versions DESC', 2 => 'n_nbr_coms DESC', 3 => 'n_nb_votes DESC');
     $flag = isset($_GET['flag']) ? $_GET['flag'] : 2;
     $status = isset($_GET['status']) ? $_GET['status'] : 3;
     $sort = isset($_GET['sort']) ? $_GET['sort'] : 0;
     $cat = isset($_GET['cat']) ? $_GET['cat'] : 0;
     // Option Type
     if (is_logged_in() && $flag != 0) {
         if (isset($_GET['flag']) && in_array($_GET['flag'], array(0, 1, 2, 3))) {
             $get_params[] = 'f_type = ' . intval($_GET['flag']);
         } else {
             $get_params[] = 'f_type = 2';
         }
     }
     // Option Etat
     if (is_logged_in() && isset($_GET['status']) && in_array($_GET['status'], array(0, 1, 2, 3))) {
         if ($_GET['status'] == 0 && is_logged_in() && Nw::$droits['can_edit_news_online'] or $_GET['status'] != 0) {
             $get_params[] = 'n_etat = ' . intval($_GET['status']);
         }
     } else {
         $get_params[] = 'n_etat = 3';
     }
     // Option Sort
     if (isset($_GET['sort']) && in_array($_GET['sort'], array(0, 1, 2, 3))) {
         $param_order = $_GET['sort'];
     }
     // Option Catégorie
     if (is_logged_in() && !empty($_GET['cat']) && is_numeric($_GET['cat'])) {
         $get_params[] = 'n_id_cat = ' . intval($_GET['cat']);
     }
     // Pagination
     inc_lib('news/count_news');
     $nombre_news = count_news(implode(' AND ', $get_params));
     $page = isset($_GET['page']) ? intval($_GET['page']) : 1;
     $nombreDePages = ceil($nombre_news / Nw::$pref['nb_news_homepage']);
     // On vérifie bien que la page existe
     if ($nombreDePages > 0 && $page > $nombreDePages) {
         redir(Nw::$lang['common']['pg_not_exist'], false, './');
     }
     // On recherche toutes les news en rédaction
     inc_lib('news/get_list_news');
     $list_dn_news = get_list_news(implode(' AND ', $get_params), $array_sort[$param_order], $page, Nw::$pref['nb_news_homepage']);
     $cours_news = 0;
     $cours_news2 = 0;
     inc_lib('news/can_edit_news');
     foreach ($list_dn_news as $donnees_news) {
         Nw::$tpl->setBlock('news', array('ID' => $donnees_news['n_id'], 'COURS' => $cours_news % 2, 'COURS2' => $cours_news2 % 2, 'CAT_ID' => $donnees_news['c_id'], 'CAT_TITRE' => $donnees_news['c_nom'], 'CAT_REWRITE' => $donnees_news['c_rewrite'], 'IMAGE_ID' => $donnees_news['i_id'], 'IMAGE_NOM' => $donnees_news['i_nom'], 'TITRE' => $donnees_news['n_titre'], 'RESUME' => $donnees_news['n_resume'], 'REWRITE' => rewrite($donnees_news['n_titre']), 'AUTEUR' => $donnees_news['u_pseudo'], 'AUTEUR_ID' => $donnees_news['u_id'], 'AUTEUR_ALIAS' => $donnees_news['u_alias'], 'AUTEUR_AVATAR' => $donnees_news['u_avatar'], 'ETAT' => $donnees_news['n_etat'], 'DATE' => date_sql($donnees_news['date_news'], $donnees_news['heures_date_news'], $donnees_news['jours_date_news']), 'HAS_VOTED' => $donnees_news['v_id_membre'], 'NBR_VOTES' => $donnees_news['n_nb_votes'], 'NBR_COMS' => sprintf(Nw::$lang['news']['nbr_comments_news'], $donnees_news['n_nbr_coms'], $donnees_news['n_nbr_coms'] > 1 ? Nw::$lang['news']['add_s_comments'] : ''), 'DRT_EDIT' => is_logged_in() ? can_edit_news($donnees_news['n_id_auteur'], $donnees_news['n_etat']) : false, 'DRT_DELETE' => is_logged_in() && ($donnees_news['n_id_auteur'] == Nw::$dn_mbr['u_id'] && Nw::$droits['can_delete_mynews'] || Nw::$droits['can_delete_news']) ? true : false));
         if ($donnees_news['i_id'] != 0) {
             ++$cours_news;
         }
         ++$cours_news2;
     }
     inc_lib('news/count_flags_news');
     Nw::$tpl->set(array('NB_FLAGS' => is_logged_in() ? count_flags_news(Nw::$dn_mbr['u_id']) : '', 'LIST_PG' => list_pg($nombreDePages, $page, 'news-5%s.html?flag=' . $flag . '&status=' . $status . '&sort=' . $sort . '&cat=' . $cat), 'FLAG' => $flag, 'STATUS' => $status, 'SORT' => $sort, 'CAT' => $cat));
 }
Ejemplo n.º 8
0
 protected function main()
 {
     if (!is_logged_in()) {
         redir(Nw::$lang['common']['need_login'], false, 'users-10.html');
     }
     $this->set_title(Nw::$lang['news']['en_redaction_title']);
     $this->set_tpl('news/redaction.html');
     $this->add_wid_in_content('redaction');
     // Fil ariane
     $this->set_filAriane(array(Nw::$lang['news']['news_section'] => array('news-70.html'), Nw::$lang['news']['en_redaction_title'] => array('')));
     // On compte le nbr de news en rédaction
     inc_lib('news/count_news');
     $nombre_news = count_news('n_etat = 1');
     // Pagination
     $page = isset($_GET['page']) ? intval($_GET['page']) : 1;
     $nombreDePages = ceil($nombre_news / Nw::$pref['nb_news_redac']);
     // On vérifie bien que la page existe
     if ($nombreDePages > 0 && $page > $nombreDePages) {
         redir(Nw::$lang['common']['pg_not_exist'], false, 'news-70.html');
     }
     // On recherche toutes les news en rédaction
     inc_lib('news/get_list_news');
     $list_dn_news = get_list_news('n_etat = 1', 'f_type DESC, n_last_mod DESC', $page, Nw::$pref['nb_news_redac']);
     $news_act = 'null';
     if ($nombre_news > 0) {
         inc_lib('news/get_list_tags_news');
         inc_lib('news/get_list_flags_news');
         $list_tags = array();
         $list_flags = array();
         $array_favoris = array();
         $donnees_tags = get_list_tags_news(1);
         $donnees_flags = get_list_flags_news(1);
         foreach ($donnees_flags as $all_flags) {
             if ($all_flags['f_type'] == 1) {
                 $array_favoris[] = $all_flags['f_id_news'];
             }
             $list_flags[$all_flags['f_id_news']][] = '<li class="netat"><a href="news-5.html?flag=' . $all_flags['f_type'] . '&amp;status=1">' . $all_flags['txt_lang'] . '</a></li>';
         }
         foreach ($donnees_tags as $all_tags) {
             $list_tags[$all_tags['t_id_news']][] = '<li class="ntag"><a href="search.html?s=' . $all_tags['rewrite'] . '">' . $all_tags['t_tag'] . '</a></li>';
         }
     }
     $nbr_news = 0;
     // On affiche toutes les news en rédaction
     inc_lib('news/can_edit_news');
     foreach ($list_dn_news as $donnees_news) {
         $flags_html = '';
         // Affichage du séparateur
         if ($donnees_news['f_type'] != $news_act) {
             $texte_title = '';
             //  Séparation des news
             if ($donnees_news['f_type'] == 0) {
                 $texte_title = '<div class="separation_news"></div>';
             }
             Nw::$tpl->setBlock('redaction', array('NAME' => $texte_title));
             $news_act = $donnees_news['f_type'];
         }
         // Cette news a des flags? (Je rédige, etc.)
         if (isset($list_flags[$donnees_news['n_id']]) && count($list_flags[$donnees_news['n_id']]) > 0) {
             $flags_html = implode(' ', $list_flags[$donnees_news['n_id']]);
         }
         if (isset($list_tags[$donnees_news['n_id']])) {
             $tags_news = array_slice($list_tags[$donnees_news['n_id']], 0, 5);
         } else {
             $tags_news = array();
         }
         // Il y a au moins un tag
         if (count($tags_news) > 0) {
             $tags_html = implode(' ', $tags_news);
         } else {
             $tags_html = '<li class="ntag"><span>' . Nw::$lang['news']['none_tag'] . '</span></li>';
         }
         Nw::$tpl->setBlock('redaction.news', array('ID' => $donnees_news['n_id'], 'CAT_ID' => $donnees_news['c_id'], 'CAT_TITRE' => $donnees_news['c_nom'], 'CAT_REWRITE' => $donnees_news['c_rewrite'], 'TITRE' => $donnees_news['n_titre'], 'RESUME' => $donnees_news['n_resume'], 'REWRITE' => rewrite($donnees_news['n_titre']), 'AUTEUR' => $donnees_news['u_pseudo'], 'AUTEUR_ID' => $donnees_news['u_id'], 'AUTEUR_ALIAS' => $donnees_news['u_alias'], 'AUTEUR_AVATAR' => $donnees_news['u_avatar'], 'DATE' => date_sql($donnees_news['date_news'], $donnees_news['heures_date_news'], $donnees_news['jours_date_news']), 'NBR_COMS' => sprintf(Nw::$lang['news']['nbr_comments_news'], $donnees_news['n_nbr_coms'], $donnees_news['n_nbr_coms'] > 1 ? Nw::$lang['news']['add_s_comments'] : ''), 'NBR_VERSIONS' => $donnees_news['n_nb_versions'] > 1 ? '<a href="news-16-' . $donnees_news['n_id'] . '.html">' . sprintf(Nw::$lang['news']['nbr_versions_news'], $donnees_news['n_nb_versions']) . '</a>' : Nw::$lang['news']['none_versions'], 'TAGS' => $tags_html, 'FLAGS' => $flags_html, 'COLOR' => $nbr_news % 2, 'FLAGS_FAV' => (bool) in_array($donnees_news['n_id'], $array_favoris), 'EDIT' => can_edit_news($donnees_news['n_id_auteur'], $donnees_news['n_etat']), 'DELETE' => $donnees_news['n_id_auteur'] == Nw::$dn_mbr['u_id'] && Nw::$droits['can_delete_mynews'] || Nw::$droits['can_delete_news'] ? true : false));
         ++$nbr_news;
     }
     /**
      *   Dernières news créées
      **/
     inc_lib('news/get_list_news');
     $last_news = get_list_news('n_etat = 1', 'n_date DESC', 1, 7);
     foreach ($last_news as $donnees_news) {
         Nw::$tpl->setBlock('ln', array('ID' => $donnees_news['n_id'], 'TITRE' => $donnees_news['n_titre'], 'CAT_REWRITE' => $donnees_news['c_rewrite'], 'REWRITE' => rewrite($donnees_news['n_titre']), 'NBR_COMS' => sprintf(Nw::$lang['news']['nbr_comments_news'], $donnees_news['n_nbr_coms'], $donnees_news['n_nbr_coms'] > 1 ? Nw::$lang['news']['add_s_comments'] : ''), 'NBR_VERSIONS' => $donnees_news['n_nb_versions'] > 1 ? '<a href="news-16-' . $donnees_news['n_id'] . '.html">' . sprintf(Nw::$lang['news']['nbr_versions_news'], $donnees_news['n_nb_versions']) . '</a>' : Nw::$lang['news']['none_versions']));
     }
     /**
      *   Dernière contribution
      **/
     inc_lib('news/get_list_vrs');
     $last_contrib = get_list_vrs(0, 7);
     foreach ($last_contrib as $donnees_contrib) {
         Nw::$tpl->setBlock('lc', array('ID' => $donnees_contrib['v_id'], 'ID_NEWS' => $donnees_contrib['v_id_news'], 'RAISON' => $donnees_contrib['v_raison'], 'AUTEUR' => $donnees_contrib['u_pseudo'], 'AUTEUR_ID' => $donnees_contrib['u_id'], 'AUTEUR_ALIAS' => $donnees_contrib['u_alias'], 'AUTEUR_AVATAR' => $donnees_contrib['u_avatar'], 'REWRITE' => rewrite($donnees_contrib['n_titre']), 'CAT_REWRITE' => $donnees_contrib['c_rewrite'], 'INT' => sprintf(Nw::$lang['news']['version_x'], $donnees_contrib['v_id']), 'DATE' => date_sql($donnees_contrib['date'], $donnees_contrib['heures_date'], $donnees_contrib['jours_date'])));
     }
     Nw::$tpl->set(array('LIST_PG' => list_pg($nombreDePages, $page, 'news-70%s.html')));
 }