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']))); }
protected function main() { if (!is_logged_in() && !check_auth('view_histo_all_news')) { header('Location: ./'); } $this->set_title(Nw::$lang['news']['historiques_news']); $this->set_tpl('news/log_admin.html'); $this->add_css('code.css'); $this->set_filAriane(array(Nw::$lang['news']['news_section'] => array('news-70.html'), Nw::$lang['news']['historiques_news'] => array(''))); $get_param = ''; $param_tpl = ''; if (!empty($_GET['t'])) { $get_param = 'l_titre LIKE "%' . insertBD(urldecode($_GET['t'])) . '%" OR l_texte LIKE "%' . insertBD(urldecode($_GET['t'])) . '%"'; $param_tpl = htmlspecialchars($_GET['t']); } inc_lib('news/count_news_logs'); $nombre_logs = count_news_logs($get_param); // Pagination $page = isset($_GET['page']) ? intval($_GET['page']) : 1; $nombreDePages = ceil($nombre_logs / Nw::$pref['nb_logs_admin']); // On vérifie que la page existe bien if ($nombreDePages > 0 && $page > $nombreDePages) { redir(Nw::$lang['common']['pg_not_exist'], false, 'news-21.html?t=' . $param_tpl); } /** * Affichage du logo **/ inc_lib('news/get_news_logs'); $donnees_logs = get_news_logs($get_param, 'l_date DESC', $page, Nw::$pref['nb_logs_admin']); foreach ($donnees_logs as $donnees) { Nw::$tpl->setBlock('log', array('ACTION' => $donnees['l_action'], 'ACTION_LOG' => isset(Nw::$lang['news']['log_news_' . $donnees['l_action']]) ? Nw::$lang['news']['log_news_' . $donnees['l_action']] : '', 'TEXTE' => nl2br($donnees['l_texte']), 'DATE' => date_sql($donnees['date'], $donnees['heures_date'], $donnees['jours_date']), 'AUTEUR' => $donnees['u_pseudo'], 'AUTEUR_ID' => $donnees['u_id'], 'AUTEUR_AVATAR' => $donnees['u_avatar'], 'AUTEUR_ALIAS' => $donnees['u_alias'], 'NEWS_ID' => $donnees['l_id_news'], 'NEWS_TITRE' => $donnees['n_titre'], 'TITRE_ACTU' => $donnees['l_titre'], 'IP' => long2ip($donnees['l_ip']))); } Nw::$tpl->set(array('TITRE' => urldecode($param_tpl), 'LIST_PG' => list_pg($nombreDePages, $page, 'news-21%s.html?t=' . $param_tpl))); }
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']))); }
protected function main() { // Si le paramètre ID manque if (empty($_GET['id'])) { header('Location: ./'); } inc_lib('users/mbr_exists'); if (mbr_exists($_GET['id']) == false) { redir(Nw::$lang['users']['mbr_dont_exist'], false, 'users.html'); } inc_lib('users/get_info_mbr'); $donnees_profile = get_info_mbr($_GET['id']); $this->load_lang_file('users'); $this->load_lang_file('news'); $this->add_wid_in_content('view_profile.' . $donnees_profile['u_id']); $this->set_tpl('profile/list_comments.html'); $this->set_title(sprintf(Nw::$lang['profile']['profile_title'], $donnees_profile['u_pseudo'])); $this->add_css('code.css'); $this->add_js('profil.js'); $this->set_filAriane(array(Nw::$lang['users']['members_section'] => array('users.html'), $donnees_profile['u_pseudo'] => array('./profile/' . $donnees_profile['u_alias'] . '/'), Nw::$lang['profile']['title_cmts_author'] => array(''))); $params_contrib = array(); $params_contrib[] = 'c_id_membre = ' . intval($_GET['id']); if (!is_logged_in()) { $params_contrib[] = 'n_etat = 3'; } inc_lib('profile/count_comments_mbr'); $nombre_cmts = count_comments_mbr(implode(' AND ', $params_contrib)); // Pagination $page = isset($_GET['page']) ? intval($_GET['page']) : 1; $nombreDePages = ceil($nombre_cmts / Nw::$pref['ppl_nb_comments']); // On vérifie bien que la page existe if ($nombreDePages > 0 && $page > $nombreDePages) { redir(Nw::$lang['common']['pg_not_exist'], false, './'); } inc_lib('profile/get_comments_mbr'); $com_cours = 0; $list_cmts = get_comments_mbr(implode(' AND ', $params_contrib), 'c_date DESC', $page, Nw::$pref['ppl_nb_comments']); foreach ($list_cmts as $donnees_cmts) { ++$com_cours; $droit_edit = false; $droit_delete = false; if (is_logged_in()) { $droit_edit = (bool) (Nw::$droits['can_edit_my_comments'] && $donnees_cmts['u_id'] == Nw::$dn_mbr['u_id']) || Nw::$droits['can_edit_all_comments']; $droit_delete = (bool) (Nw::$droits['can_del_my_comments'] && $donnees_cmts['u_id'] == Nw::$dn_mbr['u_id']) || Nw::$droits['can_del_all_comments']; } $date_cmt = date_sql($donnees_cmts['date'], $donnees_cmts['heures_date'], $donnees_cmts['jours_date']); $masque_motif = ''; if ($donnees_cmts['c_masque']) { $date_cmt = sprintf(Nw::$lang['news']['del_cmt_with_reason'], strtolower(date_sql($donnees_cmts['date'], $donnees_cmts['heures_date'], $donnees_cmts['jours_date']))); if (!empty($donnees_cmts['c_masque_raison'])) { $masque_motif = ' (' . sprintf(Nw::$lang['news']['motif_delete_cmt'], $donnees_cmts['c_masque_raison']) . ')'; } } Nw::$tpl->setBlock('cmt', array('ID' => $donnees_cmts['c_id'], 'ID_NEWS' => $donnees_cmts['c_id_news'], 'REWRITE' => rewrite($donnees_cmts['n_titre']), 'CAT_REWRITE' => $donnees_cmts['c_rewrite'], 'NUM' => ($page - 1) * Nw::$pref['nb_cmts_page'] + $com_cours, 'DATE' => $date_cmt, 'AVATAR' => $donnees_cmts['u_avatar'], 'LANG_AVATAR' => sprintf(Nw::$lang['news']['lang_avatar'], $donnees_cmts['u_pseudo']), 'AUTEUR' => $donnees_cmts['u_pseudo'], 'AUTEUR_ID' => $donnees_cmts['u_id'], 'AUTEUR_ALIAS' => $donnees_cmts['u_alias'], 'TEXTE' => $donnees_cmts['c_texte'], 'PLUSSOIE' => $donnees_cmts['c_plussoie'], 'GRP_TITRE' => $donnees_cmts['g_titre'], 'GRP_ICON' => $donnees_cmts['g_icone'], 'IP' => long2ip($donnees_cmts['c_ip']), 'MASQUE' => $donnees_cmts['c_masque'], 'MASQUE_MOTIF' => $masque_motif, 'EDIT' => $droit_edit, 'DELETE' => $droit_delete)); } Nw::$tpl->set(array('NOMBRE_CMTS' => $nombre_cmts, 'LIST_PG' => list_pg($nombreDePages, $page, 'profile-135-' . $_GET['id'] . '%s.html'))); inc_lib('profile/assign_required_vars_profile'); assign_required_vars_profile($donnees_profile); }
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'])))); }
protected function main() { if (empty($_GET['s']) or strlen(trim($_GET['s'])) < 2) { header('Location: ./'); } $title_recherche = htmlspecialchars($_GET['s']); $this->set_title(sprintf(Nw::$lang['search']['titre_recherche'], $title_recherche)); $this->set_tpl('search/results.html'); $this->load_lang_file('news'); // Fil ariane $this->set_filAriane(array(Nw::$lang['search']['fa_recherche'] => './', $title_recherche => '')); $etat_news_afficher = is_logged_in() ? 0 : 3; // On compte le nbr de news publiées inc_lib('search/count_search_results'); $nombre_news = count_search_results($_GET['s'], $etat_news_afficher); // 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('search/search_news_bytag'); inc_lib('news/can_edit_news'); $list_dn_news = search_news_bytag($_GET['s'], $etat_news_afficher, $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'], '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)); ++$cours_news2; } // Historique des recherches if ($nombre_news > 0) { inc_lib('search/add_search_log'); inc_lib('admin/gen_cachefile_top_search'); add_search_log(urldecode($_GET['s']), $cours_news2); inc_lib('admin/gen_cachefile_top_search'); gen_cachefile_top_search(); } /** * 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'])); } inc_lib('search/get_tags_search'); Nw::$tpl->set(array('LIST_PG' => list_pg($nombreDePages, $page, 'search%s.html?s=' . $_GET['s']), 'SEARCH' => $title_recherche, 'SUGGEST' => get_tags_search($_GET['s'], 0, $etat_news_afficher, 1))); }
protected function main() { // Si le paramètre ID manque if (empty($_GET['id'])) { header('Location: ./'); } inc_lib('users/mbr_exists'); if (mbr_exists($_GET['id']) == false) { redir(Nw::$lang['users']['mbr_dont_exist'], false, 'users.html'); } inc_lib('users/get_info_mbr'); $donnees_profile = get_info_mbr($_GET['id']); $this->load_lang_file('users'); $this->load_lang_file('news'); $this->add_wid_in_content('view_profile.' . $donnees_profile['u_id']); $this->set_tpl('profile/list_contribs.html'); $this->set_title(sprintf(Nw::$lang['profile']['profile_title'], $donnees_profile['u_pseudo'])); $this->add_css('code.css'); $this->add_js('profil.js'); $this->set_filAriane(array(Nw::$lang['users']['members_section'] => array('users.html'), $donnees_profile['u_pseudo'] => array('./profile/' . $donnees_profile['u_alias'] . '/'), Nw::$lang['profile']['title_news_contrib'] => array())); $params_contrib = array(); $params_contrib[] = 'v_id_membre = ' . intval($_GET['id']); if (!is_logged_in()) { $params_contrib[] = 'n_etat = 3'; } inc_lib('profile/count_news_contrib'); $nombre_contrib = count_news_contrib(implode(' AND ', $params_contrib)); // Pagination $page = isset($_GET['page']) ? intval($_GET['page']) : 1; $nombreDePages = ceil($nombre_contrib / Nw::$pref['ppl_nb_contribs']); // On vérifie bien que la page existe if ($nombreDePages > 0 && $page > $nombreDePages) { redir(Nw::$lang['common']['pg_not_exist'], false, './'); } inc_lib('profile/get_news_contrib'); $cours_news = 0; $contrib_cours = ''; $count_section = 0; $list_contrib = get_news_contrib(implode(' AND ', $params_contrib), 'v_date DESC, n_date DESC', $page, Nw::$pref['ppl_nb_contribs']); foreach ($list_contrib as $donnees_contrib) { Nw::$tpl->setBlock('contrib', array('ID' => $donnees_contrib['v_id'], 'ID_NEWS' => $donnees_contrib['v_id_news'], 'MOTIF' => $donnees_contrib['v_raison'], 'NB_MOTS' => sprintf(Nw::$lang['news']['nbr_caract'], $donnees_contrib['v_nb_mots']), 'DIFF_MOTS' => $donnees_contrib['v_diff_mots'], 'IP' => long2ip($donnees_contrib['v_ip']), 'COURS' => $cours_news % 2, 'DATE' => date_sql($donnees_contrib['date'], $donnees_contrib['heures_date'], $donnees_contrib['jours_date']))); ++$cours_news; if ($contrib_cours != $donnees_contrib['v_id_news']) { Nw::$tpl->setBlock('contrib.news', array('ID' => $donnees_contrib['n_id'], 'TITRE' => $donnees_contrib['n_titre'], 'REWRITE' => rewrite($donnees_contrib['n_titre']), 'CAT_REWRITE' => $donnees_contrib['c_rewrite'], 'ETAT' => $donnees_contrib['n_etat'], 'ETAT_LANG' => Nw::$lang['news']['etat_news_' . $donnees_contrib['n_etat']], 'ETAT_ACT' => $donnees_contrib['n_etat'] == 1 ? 70 : 80, 'IMAGE_ID' => $donnees_contrib['i_id'], 'IMAGE_NOM' => $donnees_contrib['i_nom'], 'END' => $count_section > 0 ? '</div></div>' : '')); $contrib_cours = $donnees_contrib['v_id_news']; ++$count_section; } } Nw::$tpl->set(array('END_DIV' => $count_section > 0 ? '</div></div>' : '', 'NOMBRE_CONTRIB' => $nombre_contrib, 'LIST_PG' => list_pg($nombreDePages, $page, 'profile-130-' . $_GET['id'] . '%s.html'))); inc_lib('profile/assign_required_vars_profile'); assign_required_vars_profile($donnees_profile); }
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'])); }
protected function main() { // Si le paramètre ID manque if (empty($_GET['id'])) { header('Location: ./'); } inc_lib('users/mbr_exists'); if (mbr_exists($_GET['id']) == false) { redir(Nw::$lang['users']['mbr_dont_exist'], false, 'users.html'); } inc_lib('users/get_info_mbr'); $donnees_profile = get_info_mbr($_GET['id']); $this->load_lang_file('users'); $this->load_lang_file('news'); $this->add_wid_in_content('view_profile.' . $donnees_profile['u_id']); $this->set_tpl('profile/list_news.html'); $this->set_title(sprintf(Nw::$lang['profile']['profile_title'], $donnees_profile['u_pseudo'])); $this->add_css('code.css'); $this->add_js('profil.js'); $this->base_enabled(true); $this->set_filAriane(array(Nw::$lang['users']['members_section'] => array('users.html'), $donnees_profile['u_pseudo'] => array('./profile/' . $donnees_profile['u_alias'] . '/'), Nw::$lang['profile']['title_news_author'] => array())); $params_news = array(); $params_news[] = 'n_id_auteur = ' . intval($donnees_profile['u_id']); if (!is_logged_in()) { $params_news[] = 'n_etat = 3'; } inc_lib('profile/count_news_author'); $nombre_news = count_news_author(implode(' AND ', $params_news)); // Pagination $page = isset($_GET['page']) ? intval($_GET['page']) : 1; $nombreDePages = ceil($nombre_news / Nw::$pref['ppl_nb_news']); // On vérifie bien que la page existe if ($nombreDePages > 0 && $page > $nombreDePages) { redir(Nw::$lang['common']['pg_not_exist'], false, './'); } inc_lib('profile/get_news_author'); $cours_news = 0; $list_news = get_news_author(implode(' AND ', $params_news), 'n_date DESC', $page, Nw::$pref['ppl_nb_news']); foreach ($list_news as $donnees_news) { ++$cours_news; Nw::$tpl->setBlock('news', array('ID' => $donnees_news['n_id'], 'TITRE' => $donnees_news['n_titre'], 'CAT_REWRITE' => $donnees_news['c_rewrite'], 'REWRITE' => rewrite($donnees_news['n_titre']), 'RESUME' => $donnees_news['n_resume'], 'ETAT' => $donnees_news['n_etat'], 'ETAT_LANG' => Nw::$lang['news']['etat_news_' . $donnees_news['n_etat']], 'ETAT_ACT' => $donnees_news['n_etat'] == 1 ? 70 : 80, 'NBR_VOTES' => $donnees_news['n_nb_votes'], 'HAS_VOTED' => is_logged_in() ? $donnees_news['v_id_membre'] : 0, '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'] : ''), 'DATE' => date_sql($donnees_news['date_news'], $donnees_news['heures_date_news'], $donnees_news['jours_date_news']), 'IMAGE_ID' => $donnees_news['i_id'], 'IMAGE_NOM' => $donnees_news['i_nom'], 'COURS' => $cours_news % 2)); } Nw::$tpl->set(array('NOMBRE_NEWS' => $nombre_news, 'LIST_PG' => list_pg($nombreDePages, $page, 'profile/%s.html'))); inc_lib('profile/assign_required_vars_profile'); assign_required_vars_profile($donnees_profile); }
protected function main() { // Si le paramètre ID manque if (empty($_GET['id']) || !is_numeric($_GET['id'])) { header('Location: news-70.html'); } inc_lib('news/news_exists'); if (news_exists($_GET['id']) == false) { redir(Nw::$lang['news']['news_not_exist'], false, 'news-70.html'); } inc_lib('news/get_info_news'); $donnees_news = get_info_news($_GET['id'], $id_version_load); $this->set_tpl('mobile/news/view_coms.html'); $this->load_lang_file('news'); /** * Liste des commentaires **/ if ($donnees_news['n_nbr_coms'] > 0) { // Pagination $page = isset($_GET['page']) ? intval($_GET['page']) : 1; $nombreDePages = ceil($donnees_news['n_nbr_coms'] / Nw::$pref['nb_cmts_page']); // On vérifie bien que la page existe if ($nombreDePages > 0 && $page > $nombreDePages) { redir(Nw::$lang['common']['pg_not_exist'], false, $donnees_news['c_rewrite'] . '/' . rewrite($donnees_news['n_titre']) . '-' . $_GET['id'] . '/'); } // L'utilisateur demande un commentaire particulier, on le redirige sur la bonne page if (!empty($_GET['id2']) && is_numeric($_GET['id2'])) { inc_lib('news/count_cmt_before_idc'); $nbr_cmts_before = count_cmt_before_idc($_GET['id'], $_GET['id2']); $page = ceil($nbr_cmts_before / Nw::$pref['nb_cmts_page']); } inc_lib('news/get_list_cmt_news'); $list_cmts = get_list_cmt_news($_GET['id'], 'c_date ASC', $page, Nw::$pref['nb_cmts_page']); $com_cours = 0; // Affichage de tous les commentaires de la page foreach ($list_cmts as $donnees_cmts) { ++$com_cours; $date_cmt = date_sql($donnees_cmts['date'], $donnees_cmts['heures_date'], $donnees_cmts['jours_date']); Nw::$tpl->setBlock('cmt', array('ID' => $donnees_cmts['c_id'], 'NUM' => ($page - 1) * Nw::$pref['nb_cmts_page'] + $com_cours, 'DATE' => $date_cmt, 'AVATAR' => $donnees_cmts['u_avatar'], 'LANG_AVATAR' => sprintf(Nw::$lang['news']['lang_avatar'], $donnees_cmts['u_pseudo']), 'AUTEUR' => $donnees_cmts['u_pseudo'], 'AUTEUR_ID' => $donnees_cmts['u_id'], 'AUTEUR_ALIAS' => $donnees_cmts['u_alias'], 'TEXTE' => $donnees_cmts['c_texte'])); } } Nw::$tpl->set(array('ID' => $_GET['id'], 'ETAT' => $donnees_news['n_etat'], 'TITRE' => $donnees_news['n_titre'], 'TITRE_REWRITE' => rewrite($donnees_news['n_titre']), 'LIST_PG' => $donnees_news['n_nbr_coms'] > 0 ? list_pg($nombreDePages, $page, 'news-10-' . $_GET['id'] . '%s.html#c') : '')); Nw::$tpl->set('INC_HEAD', empty($_SERVER['HTTP_AJAX'])); }
protected function main() { if (empty($_GET['s']) or strlen(trim($_GET['s'])) < 2) { header('Location: ./'); } $title_recherche = htmlspecialchars($_GET['s']); $this->load_lang_file('search'); $this->load_lang_file('news'); $this->set_tpl('mobile/search/results.html'); $etat_news_afficher = is_logged_in() ? 0 : 3; // On compte le nbr de news publiées inc_lib('search/count_search_results'); $nombre_news = count_search_results($_GET['s'], $etat_news_afficher); // Pagination $page = !empty($_GET['page']) ? (int) $_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('search/search_news_bytag'); inc_lib('news/can_edit_news'); $list_dn_news = search_news_bytag($_GET['s'], $etat_news_afficher, $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'], 'TITRE' => $donnees_news['n_titre'], 'RESUME' => $donnees_news['n_resume'], 'REWRITE' => rewrite($donnees_news['n_titre']), 'IMAGE_ID' => $donnees_news['i_id'], 'IMAGE_NOM' => $donnees_news['i_nom'], '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'] : ''))); ++$cours_news; } // Historique des recherches if ($nombre_news > 0) { inc_lib('search/add_search_log'); inc_lib('admin/gen_cachefile_top_search'); add_search_log(urldecode($_GET['s']), $cours_news); gen_cachefile_top_search(); } inc_lib('search/get_tags_search'); Nw::$tpl->set(array('LIST_PG' => list_pg($nombreDePages, $page, 'mobile-1%s.html?s=' . $_GET['s']), 'SEARCH' => $title_recherche, 'NB_NEWS' => $cours_news, 'SUGGEST' => get_tags_search($_GET['s'], 0, $etat_news_afficher, 1), 'INC_HEAD' => empty($_SERVER['HTTP_AJAX']))); }
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'] . '&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)); }
protected function main() { // Si le paramètre ID manque if (empty($_GET['id']) || !is_numeric($_GET['id'])) { header('Location: news-70.html'); } //exit('<pre>'.print_r($_GET, true).'</pre>'); $id_version_load = 0; $txt_other_vrs = ''; $droit_edit_news = false; $droit_delete_news = false; $author_has_news = false; inc_lib('news/news_exists'); if (news_exists($_GET['id']) == false) { redir(Nw::$lang['news']['news_not_exist'], false, 'news-70.html'); } inc_lib('news/vrs_exists'); if (!empty($_GET['vrs']) && is_numeric($_GET['vrs']) && vrs_exists($_GET['id'], $_GET['vrs']) == true) { inc_lib('news/get_info_vrs'); $id_version_load = $_GET['vrs']; $donnees_vrs = get_info_vrs($_GET['vrs']); $txt_other_vrs = sprintf(Nw::$lang['news']['view_news_vrs_archived'], $donnees_vrs['v_number']); } inc_lib('news/get_info_news'); $donnees_news = get_info_news($_GET['id'], $id_version_load); $rewrite_news = rewrite($donnees_news['n_titre']); // Ancien permalien des news qui redirige vers le nouveau (nw.com/news-10-1-ma-news.html -> nw.com/politique/ma-news-1/) if (strpos($_SERVER['REQUEST_URI'], 'news-10-' . $_GET['id']) !== false) { header('Status: 301 Moved Permanently', false, 301); header('Location: ' . Nw::$site_url . $donnees_news['c_rewrite'] . '/' . $rewrite_news . '-' . $_GET['id'] . '/'); exit; } // Ce membre a le droit d'éditer la news ? if ($donnees_news['n_etat'] != 3 && !is_logged_in()) { redir(Nw::$lang['news']['not_view_news_perm'], false, Nw::$site_url); } $this->set_title($donnees_news['n_titre'] . ' | ' . $donnees_news['c_nom']); $this->set_tpl('news/view.html'); $this->add_css('code.css'); $this->add_css('forms.css'); $this->base_enabled(true); $this->add_wid_in_content('view_news.' . $_GET['id']); if ($donnees_news['n_etat'] == 2) { $this->add_js('news.attente.js'); } // Fil ariane $this->set_filAriane(array(Nw::$lang['news']['news_section'] => array('news-70.html'), $donnees_news['c_nom'] => array($donnees_news['c_rewrite'] . '/'), $donnees_news['n_titre'] => array($donnees_news['c_rewrite'] . '/' . $rewrite_news . '-' . $_GET['id'] . '/'), Nw::$lang['news']['view_fil_ariane'] => array(''))); /** * Liste des contributeurs **/ inc_lib('news/get_list_contrib'); $list_contribs = get_list_contrib($_GET['id'], $donnees_news['n_id_auteur'], 'v_mineure = 0'); foreach ($list_contribs as $donnees_contribs) { Nw::$tpl->setBlock('ctb', array('MEMBRE_ID' => $donnees_contribs['u_id'], 'MEMBRE_PSEUDO' => $donnees_contribs['u_pseudo'], 'MEMBRE_ALIAS' => $donnees_contribs['u_alias'], 'MEMBRE_AVATAR' => $donnees_contribs['u_avatar'], 'VERSIONS' => sprintf(Nw::$lang['news']['nbr_contrib'], $donnees_contribs['nb_version'], $donnees_contribs['nb_version'] > 1 ? Nw::$lang['news']['add_s_versions'] : ''))); } /** * News de l'auteur **/ inc_lib('news/get_list_news_byauthor'); $news_author = get_list_news_byauthor($donnees_news['n_id_auteur'], array(), 3); foreach ($news_author as $donnees_author) { $author_has_news = true; Nw::$tpl->setBlock('nauthor', array('ID' => $donnees_author['n_id'], 'TITRE' => $donnees_author['n_titre'], 'CAT_REWRITE' => $donnees_author['c_rewrite'], 'REWRITE' => rewrite($donnees_author['n_titre']))); } if ($donnees_news['n_etat'] == 2) { inc_lib('news/get_list_votes_news'); $recents_votes = get_list_votes_news('v_id_news = ' . intval($_GET['id']), 'v_date DESC', 1, 20); foreach ($recents_votes as $donnees_vote) { Nw::$tpl->setBlock('rvotes', array('DATE' => date_sql($donnees_vote['date'], $donnees_vote['heures_date'], $donnees_vote['jours_date']), 'AUTEUR' => $donnees_vote['u_pseudo'], 'AUTEUR_ID' => $donnees_vote['u_id'], 'AUTEUR_ALIAS' => $donnees_vote['u_alias'], 'TYPE' => $donnees_vote['v_type'])); } } /** * Liste des commentaires **/ if ($donnees_news['n_nbr_coms'] > 0) { // Pagination $page = isset($_GET['page']) ? intval($_GET['page']) : 1; $nombreDePages = ceil($donnees_news['n_nbr_coms'] / Nw::$pref['nb_cmts_page']); // On vérifie bien que la page existe if ($nombreDePages > 0 && $page > $nombreDePages) { redir(Nw::$lang['common']['pg_not_exist'], false, $donnees_news['c_rewrite'] . '/' . rewrite($donnees_news['n_titre']) . '-' . $_GET['id'] . '/'); } // L'utilisateur demande un commentaire particulier, on le redirige sur la bonne page if (!empty($_GET['id2']) && is_numeric($_GET['id2'])) { inc_lib('news/count_cmt_before_idc'); $nbr_cmts_before = count_cmt_before_idc($_GET['id'], $_GET['id2']); $page = ceil($nbr_cmts_before / Nw::$pref['nb_cmts_page']); } inc_lib('news/get_list_cmt_news'); $list_cmts = get_list_cmt_news($_GET['id'], 'c_date ASC', $page, Nw::$pref['nb_cmts_page']); $com_cours = 0; // Affichage de tous les commentaires de la page foreach ($list_cmts as $donnees_cmts) { ++$com_cours; $droit_edit = false; $droit_delete = false; if (is_logged_in()) { $droit_edit = (bool) (Nw::$droits['can_edit_my_comments'] && $donnees_cmts['u_id'] == Nw::$dn_mbr['u_id']) || Nw::$droits['can_edit_all_comments']; $droit_delete = (bool) (Nw::$droits['can_del_my_comments'] && $donnees_cmts['u_id'] == Nw::$dn_mbr['u_id']) || Nw::$droits['can_del_all_comments']; } $date_cmt = date_sql($donnees_cmts['date'], $donnees_cmts['heures_date'], $donnees_cmts['jours_date']); $masque_motif = ''; if ($donnees_cmts['c_masque']) { $date_cmt = sprintf(Nw::$lang['news']['del_cmt_with_reason'], strtolower(date_sql($donnees_cmts['date'], $donnees_cmts['heures_date'], $donnees_cmts['jours_date']))); if (!empty($donnees_cmts['c_masque_raison'])) { $masque_motif = ' (' . sprintf(Nw::$lang['news']['motif_delete_cmt'], $donnees_cmts['c_masque_raison']) . ')'; } } Nw::$tpl->setBlock('cmt', array('ID' => $donnees_cmts['c_id'], 'NUM' => ($page - 1) * Nw::$pref['nb_cmts_page'] + $com_cours, 'DATE' => $date_cmt, 'AVATAR' => $donnees_cmts['u_avatar'], 'LANG_AVATAR' => sprintf(Nw::$lang['news']['lang_avatar'], $donnees_cmts['u_pseudo']), 'AUTEUR' => $donnees_cmts['u_pseudo'], 'AUTEUR_ID' => $donnees_cmts['u_id'], 'AUTEUR_ALIAS' => $donnees_cmts['u_alias'], 'TEXTE' => $donnees_cmts['c_texte'], 'PLUSSOIE' => $donnees_cmts['c_plussoie'], 'GRP_TITRE' => $donnees_cmts['g_titre'], 'GRP_ICON' => $donnees_cmts['g_icone'], 'IP' => long2ip($donnees_cmts['c_ip']), 'MASQUE' => $donnees_cmts['c_masque'], 'MASQUE_MOTIF' => $masque_motif, 'EDIT' => $droit_edit, 'DELETE' => $droit_delete)); } } if ($donnees_news['n_nb_src'] > 0) { inc_lib('news/get_list_src'); $donnees_src = get_list_src($_GET['id']); foreach ($donnees_src as $donnees) { Nw::$tpl->setBlock('src', array('LINK' => $donnees['src_url'], 'MEDIA' => $donnees['src_media'])); } } if (is_logged_in()) { if ($donnees_news['n_id_auteur'] == Nw::$dn_mbr['u_id'] && Nw::$droits['can_delete_mynews'] || Nw::$droits['can_delete_news']) { $droit_delete_news = true; } inc_lib('news/can_edit_news'); $droit_edit_news = can_edit_news($donnees_news['n_id_auteur'], $donnees_news['n_etat']); } // Tags de la news inc_lib('news/get_list_tags_news'); $list_tags_metas = array(); $list_dn_tags = get_list_tags_news($donnees_news['n_etat'] != 3 ? 0 : 3, $_GET['id']); foreach ($list_dn_tags as $donnees_tags) { $list_tags_metas[] = $donnees_tags['t_tag']; } inc_lib('news/get_list_news_related'); inc_lib('news/get_list_flags_news'); inc_lib('news/has_voted_news'); inc_lib('bbcode/parse'); Nw::$tpl->set(array('ID' => $_GET['id'], 'ETAT' => $donnees_news['n_etat'], 'CAT_ID' => $donnees_news['c_id'], 'CAT_TITRE' => $donnees_news['c_nom'], 'CAT_REWRITE' => $donnees_news['c_rewrite'], 'REWRITE' => $rewrite_news, 'AUTEUR' => $donnees_news['u_pseudo'], 'AUTEUR_ID' => $donnees_news['u_id'], 'AUTEUR_BIO' => CoupeChar($donnees_news['u_bio'], '...', 300), 'AUTEUR_ALIAS' => $donnees_news['u_alias'], 'AUTEUR_AVATAR' => $donnees_news['u_avatar'], 'AUTEUR_HASN' => $author_has_news, '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'] : ''), 'COMS' => $donnees_news['n_nbr_coms'], 'NB_VOT_VALID' => Nw::$pref['nb_votes_valid_news'], 'VOTES' => $donnees_news['n_nb_votes'], 'VOTES_NEG' => $donnees_news['n_nb_votes_neg'], 'VERSIONS' => $donnees_news['n_nb_versions'], 'IMAGE_ID' => $donnees_news['i_id'], 'IMAGE_NOM' => $donnees_news['i_nom'], 'NB_SRC' => $donnees_news['n_nb_src'], 'TITRE' => $donnees_news['n_titre'], 'CONTENU' => parse_widgets($donnees_news['v_texte']), 'VRS_LOAD' => $id_version_load, 'TXT_OTHER_VRS' => $txt_other_vrs, 'DRT_EDIT' => $droit_edit_news, 'DRT_DELETE' => $droit_delete_news, 'RELATED' => get_list_news_related($_GET['id'], 5, $donnees_news['n_etat']), 'TAGS' => $list_dn_tags, 'FLAGS' => is_logged_in() ? get_list_flags_news($donnees_news['n_etat'], $_GET['id']) : array(), 'FLAGS_FAV' => is_logged_in() ? $donnees_news['f_type'] : 0, 'HAS_VOTED' => is_logged_in() ? $donnees_news['v_id_membre'] : 0, 'LINK_NB_CONTRIB' => sprintf(Nw::$lang['news']['edit_nb_contrib'], $donnees_news['n_nb_versions']), 'NB_VERSIONS' => sprintf($donnees_news['n_nb_versions'] > 1 ? Nw::$lang['news']['nb_versions'] : Nw::$lang['news']['nb_version'], $donnees_news['n_nb_versions']), 'LIST_PG' => $donnees_news['n_nbr_coms'] > 0 ? list_pg($nombreDePages, $page, $donnees_news['c_rewrite'] . '/' . $rewrite_news . '-' . $_GET['id'] . '/%s', '') : '', 'DRT_COMMENT' => is_logged_in() ? Nw::$droits['can_post_comment'] : false)); $this->metas(array('desc' => $donnees_news['n_resume'], 'tags' => implode(', ', $list_tags_metas))); // Màj du nombre de visualisations inc_lib('news/update_pg_vues'); update_pg_vues($_GET['id']); }
protected function main() { $this->set_title(Nw::$lang['users']['list_members']); $this->set_tpl('membres/list_membres.html'); // Fil ariane $this->set_filAriane(array(Nw::$lang['users']['members_section'] => array('users.html'), Nw::$lang['users']['list_members'] => array(''))); $order_by = 'u_pseudo'; $asc_desc = 'ASC'; $list_criteres = array(); $corres_id_champs = array(0 => 'u_date_register', 1 => 'u_last_visit', 2 => 'u_pseudo', 3 => 's_nb_news'); // Recherche dans les membres if (isset($_POST['searchm'])) { header('Location: users.html?pseudo=' . htmlspecialchars($_POST['pseudo']) . '&group=' . intval($_POST['groupe']) . '&local=' . htmlspecialchars($_POST['local']) . '&order=' . intval($_POST['order']) . '&ad=' . htmlspecialchars($_POST['asc_desc'])); } if (!empty($_GET['pseudo'])) { $list_criteres[] = 'u_pseudo LIKE "%' . insertBD(trim($_GET['pseudo'])) . '%"'; } if (!empty($_GET['group'])) { $list_criteres[] = 'u_group = ' . intval($_GET['group']); } if (!empty($_GET['local'])) { $list_criteres[] = 'u_localisation LIKE "%' . insertBD(trim($_GET['local'])) . '%"'; } if (isset($_GET['order']) && isset($corres_id_champs[$_GET['order']])) { $order_by = $corres_id_champs[$_GET['order']]; } if (isset($_GET['ad']) && ($_GET['ad'] == 'asc' || $_GET['ad'] == 'desc')) { $asc_desc = strtoupper($_GET['ad']); } $sql_implode_arg = count($list_criteres) > 0 ? ' AND ' . implode(' AND ', $list_criteres) : ''; inc_lib('bbcode/clearer'); // On compte le nbr total de membres inc_lib('users/count_all_mbr'); $nombre_membres = count_all_mbr('u_active = 1' . $sql_implode_arg); // Pagination $page = isset($_GET['page']) ? intval($_GET['page']) : 1; $nombreDePages = ceil($nombre_membres / 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, 'users.html'); } // On recherche toutes les news en rédaction inc_lib('users/get_list_mbr'); $list_membres = get_list_mbr('u_active = 1' . $sql_implode_arg, $order_by . ' ' . $asc_desc, $page, Nw::$pref['nb_news_homepage']); foreach ($list_membres as $donnees) { Nw::$tpl->setBlock('users', array('ID' => $donnees['u_id'], 'PSEUDO' => $donnees['u_pseudo'], 'ALIAS' => $donnees['u_alias'], 'AVATAR' => $donnees['u_avatar'], 'DATE_REGISTER' => date_sql($donnees['date_register'], $donnees['heures_date_register'], $donnees['jours_date_register']), 'DATE_LVISIT' => date_sql($donnees['last_visit'], $donnees['heures_last_visit'], $donnees['jours_last_visit']), 'BIO' => !empty($donnees['u_bio']) ? CoupeChar(clearer($donnees['u_bio']), '...', 200) : '', 'LOCAL' => $donnees['u_localisation'], 'GROUPE_TITRE' => $donnees['g_titre'], 'GROUPE_ICONE' => $donnees['g_icone'], 'TXT_NEWS' => sprintf(Nw::$lang['users']['nombre_actu'] . ($donnees['s_nb_news'] > 1 ? 's' : ''), $donnees['s_nb_news']), 'TXT_CONTRIB' => sprintf(Nw::$lang['users']['nombre_contrib'] . ($donnees['s_nb_contrib'] > 1 ? 's' : ''), $donnees['s_nb_contrib']), 'TXT_COMS' => sprintf(Nw::$lang['users']['nombre_com'] . ($donnees['s_nb_coms'] > 1 ? 's' : ''), $donnees['s_nb_coms']), 'NBR_NEWS' => $donnees['s_nb_news'], 'NBR_CONTRIB' => $donnees['s_nb_contrib'], 'NBR_COMS' => $donnees['s_nb_coms'])); } /** * Liste des groupes **/ inc_lib('admin/get_list_grp'); $groupes = get_list_grp(); foreach ($groupes as $donnees) { Nw::$tpl->setBlock('groups', array('ID' => $donnees['g_id'], 'NOM' => $donnees['g_nom'])); } /** * Derniers inscrits **/ inc_lib('users/get_last_registered'); $last_register = get_last_registered(5); foreach ($last_register as $donnees) { Nw::$tpl->setBlock('lr', array('ID' => $donnees['u_id'], 'PSEUDO' => $donnees['u_pseudo'], 'AVATAR' => $donnees['u_avatar'], 'ALIAS' => $donnees['u_alias'], 'DATE_REGISTER' => date_sql($donnees['date_register'], $donnees['heures_date_register'], $donnees['jours_date_register']))); } $par_pseudo = isset($_GET['pseudo']) ? htmlspecialchars($_GET['pseudo']) : ''; $par_group = isset($_GET['group']) ? intval($_GET['group']) : ''; $par_local = isset($_GET['local']) ? htmlspecialchars($_GET['local']) : ''; $par_order = isset($_GET['order']) ? intval($_GET['order']) : ''; $par_asc = isset($_GET['ad']) ? htmlspecialchars($_GET['ad']) : ''; Nw::$tpl->set(array('LIST_PG' => list_pg($nombreDePages, $page, 'users%s.html?pseudo=' . $par_pseudo . '&group=' . $par_group . '&local=' . $par_local . '&order=' . $par_order . '&ad=' . $par_asc), 'PSEUDO' => $par_pseudo, 'GROUP' => $par_group, 'LOCAL' => $par_local, 'ORDER' => $par_order, 'ASC' => $par_asc)); }
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)); }
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'] . '&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'))); }