Exemple #1
0
 function Track_topic($idtopic, $tracking_type = 0)
 {
     $config = ForumConfig::load();
     list($mail, $pm, $track) = array(0, 0, 0);
     if ($tracking_type == 0) {
         //Suivi par email.
         $track = '1';
     } elseif ($tracking_type == 1) {
         //Suivi par email.
         $mail = '1';
     } elseif ($tracking_type == 2) {
         //Suivi par email.
         $pm = '1';
     }
     $exist = PersistenceContext::get_querier()->count(PREFIX . 'forum_track', 'WHERE user_id = :user_id AND idtopic = :idtopic', array('user_id' => AppContext::get_current_user()->get_id(), 'idtopic' => $idtopic));
     if ($exist == 0) {
         PersistenceContext::get_querier()->insert(PREFIX . "forum_track", array('idtopic' => $idtopic, 'user_id' => AppContext::get_current_user()->get_id(), 'track' => $track, 'pm' => $pm, 'mail' => $mail));
     } elseif ($tracking_type == 0) {
         PersistenceContext::get_querier()->update(PREFIX . "forum_track", array('track' => 1), 'WHERE idtopic = :idtopic AND user_id = :user_id', array('idtopic' => $idtopic, 'user_id' => AppContext::get_current_user()->get_id()));
     } elseif ($tracking_type == 1) {
         PersistenceContext::get_querier()->update(PREFIX . "forum_track", array('mail' => 1), 'WHERE idtopic = :idtopic AND user_id = :user_id', array('idtopic' => $idtopic, 'user_id' => AppContext::get_current_user()->get_id()));
     } elseif ($tracking_type == 2) {
         PersistenceContext::get_querier()->update(PREFIX . "forum_track", array('pm' => 1), 'WHERE idtopic = :idtopic AND user_id = :user_id', array('idtopic' => $idtopic, 'user_id' => AppContext::get_current_user()->get_id()));
     }
     //Limite de sujets suivis?
     if (!ForumAuthorizationsService::check_authorizations()->unlimited_topics_tracking()) {
         //Récupère l'id du topic le plus vieux autorisé par la limite de sujet suivis.
         $tracked_topics_number = PersistenceContext::get_querier()->select_single_row_query("SELECT COUNT(*) as number\n\t\t\tFROM " . PREFIX . "forum_track\n\t\t\tWHERE user_id = :user_id\n\t\t\tORDER BY id DESC\n\t\t\tLIMIT " . $config->get_max_topic_number_in_favorite(), array('user_id' => AppContext::get_current_user()->get_id()));
         //Suppression des sujets suivis dépassant le nbr maximum autorisé.
         PersistenceContext::get_querier()->delete(PREFIX . 'forum_track', 'WHERE user_id=:id  AND id < :number', array('id' => AppContext::get_current_user()->get_id(), 'number' => $tracked_topics_number['number']));
     }
 }
Exemple #2
0
             }
         } else {
             //On boucle pour vérifier toutes les réponses du sondage.
             $nbr_answer = count($array_votes);
             for ($i = 0; $i < $nbr_answer; $i++) {
                 if (retrieve(POST, 'forumpoll' . $i, false)) {
                     $array_votes[$i]++;
                 }
             }
         }
         PersistenceContext::get_querier()->update(PREFIX . 'forum_poll', array('voter_id' => implode('|', ${$voter_id}), 'votes' => implode('|', $array_votes)), 'WHERE idtopic=:id', array('id' => $idt_get));
     }
     AppContext::get_response()->redirect('/forum/topic' . url('.php?id=' . $idt_get . '&pt=' . $page_get, '-' . $idt_get . '-' . $page_get . $rewrited_title . '.php', '&'));
 } elseif (!empty($lock_get)) {
     //Si l'utilisateur a le droit de déplacer le topic, ou le verrouiller.
     if (ForumAuthorizationsService::check_authorizations($topic['idcat'])->moderation()) {
         if ($lock_get === 'true') {
             //Instanciation de la class du forum.
             $Forumfct = new Forum();
             $Forumfct->Lock_topic($idt_get);
             AppContext::get_response()->redirect('/forum/topic' . url('.php?id=' . $idt_get, '-' . $idt_get . $rewrited_title . '.php', '&'));
         } elseif ($lock_get === 'false') {
             //Instanciation de la class du forum.
             $Forumfct = new Forum();
             $Forumfct->Unlock_topic($idt_get);
             AppContext::get_response()->redirect('/forum/topic' . url('.php?id=' . $idt_get, '-' . $idt_get . $rewrited_title . '.php', '&'));
         }
     } else {
         $error_controller = PHPBoostErrors::unexisting_page();
         DispatchManager::redirect($error_controller);
     }
    $Forumfct = new Forum();
    $Forumfct->Track_topic($track_mail, FORUM_EMAIL_TRACKING);
    //Ajout du sujet aux sujets suivis.
    echo 1;
} elseif (!empty($untrack_mail) && AppContext::get_current_user()->check_level(User::MEMBER_LEVEL)) {
    //Instanciation de la class du forum.
    $Forumfct = new Forum();
    $Forumfct->Untrack_topic($untrack_mail, FORUM_EMAIL_TRACKING);
    //Retrait du sujet aux sujets suivis.
    echo 2;
} elseif (!empty($msg_d)) {
    AppContext::get_session()->csrf_get_protect();
    //Protection csrf
    //Vérification de l'appartenance du sujet au membres, ou modo.
    $topic = PersistenceContext::get_querier()->select_single_row_query('SELECT idcat, user_id, display_msg FROM ' . PREFIX . 'forum_topics WHERE id=:id', array('id' => $msg_d));
    if (!empty($topic['user_id']) && AppContext::get_current_user()->get_id() == $topic['user_id'] || ForumAuthorizationsService::check_authorizations($topic['idcat'])->moderation()) {
        PersistenceContext::get_querier()->inject("UPDATE " . PREFIX . "forum_topics SET display_msg = 1 - display_msg WHERE id = :id", array('id' => $msg_d));
        echo $topic['display_msg'] ? 2 : 1;
    }
} elseif (retrieve(GET, 'warning_moderation_panel', false) || retrieve(GET, 'punish_moderation_panel', false)) {
    $login = TextHelper::strprotect(utf8_decode(AppContext::get_request()->get_postvalue('login', '')));
    $login = str_replace('*', '%', $login);
    if (!empty($login)) {
        $i = 0;
        $result = PersistenceContext::get_querier()->select("SELECT user_id, display_name, level, groups FROM " . DB_TABLE_MEMBER . " WHERE display_name LIKE '" . $login . "%'");
        while ($row = $result->fetch()) {
            $group_color = User::get_group_color($row['groups'], $row['level']);
            if (retrieve(GET, 'warning_moderation_panel', false)) {
                echo '<a href="moderation_forum.php?action=warning&amp;id=' . $row['user_id'] . '" class="' . UserService::get_level_class($row['level']) . '"' . (!empty($group_color) ? ' style="color:' . $group_color . '"' : '') . '>' . $row['display_name'] . '</a><br />';
            } elseif (retrieve(GET, 'punish_moderation_panel', false)) {
                echo '<a href="moderation_forum.php?action=punish&amp;id=' . $row['user_id'] . '" class="' . UserService::get_level_class($row['level']) . '"' . (!empty($group_color) ? ' style="color:' . $group_color . '"' : '') . '>' . $row['display_name'] . '</a><br />';
Exemple #4
0
     $error_controller = PHPBoostErrors::unexisting_page();
     DispatchManager::redirect($error_controller);
 }
 //Affichage de l'arborescence des catégories.
 $i = 0;
 $forum_cats = '';
 foreach ($Bread_crumb->get_links() as $key => $array) {
     if ($i == 2) {
         $forum_cats .= '<a href="' . $array[1] . '">' . $array[0] . '</a>';
     } elseif ($i > 2) {
         $forum_cats .= ' &raquo; <a href="' . $array[1] . '">' . $array[0] . '</a>';
     }
     $i++;
 }
 //Si l'utilisateur a les droits d'édition.
 $check_group_edit_auth = ForumAuthorizationsService::check_authorizations($id_get)->moderation();
 $vars_tpl = array('C_PAGINATION' => $pagination->has_several_pages(), 'FORUM_NAME' => $config->get_forum_name(), 'PAGINATION' => $pagination->display(), 'IDCAT' => $id_get, 'C_MASS_MODO_CHECK' => false, 'C_POST_NEW_SUBJECT' => $check_group_write_auth, 'U_MSG_SET_VIEW' => '<a class="small" href="' . PATH_TO_ROOT . '/forum/action' . url('.php?read=1&amp;f=' . $id_get, '') . '" title="' . $LANG['mark_as_read'] . '" onclick="javascript:return Confirm_read_topics();">' . $LANG['mark_as_read'] . '</a>', 'U_CHANGE_CAT' => 'forum' . url('.php?id=' . $id_get, '-' . $id_get . '+' . $category->get_rewrited_name() . '.php'), 'U_ONCHANGE' => url(".php?id=' + this.options[this.selectedIndex].value + '", "forum-' + this.options[this.selectedIndex].value + '.php"), 'U_ONCHANGE_CAT' => url("index.php?id=' + this.options[this.selectedIndex].value + '", "cat-' + this.options[this.selectedIndex].value + '.php"), 'U_FORUM_CAT' => $forum_cats, 'U_POST_NEW_SUBJECT' => 'post' . url('.php?new=topic&amp;id=' . $id_get, ''), 'L_FORUM_INDEX' => $LANG['forum_index'], 'L_SUBFORUMS' => $LANG['sub_forums'], 'L_DISPLAY_UNREAD_MSG' => $LANG['show_not_reads'], 'L_FORUM' => $LANG['forum'], 'L_AUTHOR' => $LANG['author'], 'L_TOPIC' => $LANG['topic_s'], 'L_ANSWERS' => $LANG['replies'], 'L_MESSAGE' => $LANG['message_s'], 'L_POLL' => $LANG['poll'], 'L_VIEW' => $LANG['views'], 'L_LAST_MESSAGE' => $LANG['last_messages'], 'L_POST_NEW_SUBJECT' => $LANG['post_new_subject'], 'L_FOR_SELECTION' => $LANG['for_selection'], 'L_CHANGE_STATUT_TO' => sprintf($LANG['change_status_to'], $config->get_message_before_topic_title()), 'L_CHANGE_STATUT_TO_DEFAULT' => $LANG['change_status_to_default'], 'L_MOVE_TO' => $LANG['move_to'], 'L_DELETE' => LangLoader::get_message('delete', 'common'), 'L_LOCK' => $LANG['forum_lock'], 'L_UNLOCK' => $LANG['forum_unlock'], 'L_GO' => $LANG['go']);
 $nbr_topics_display = 0;
 $result = PersistenceContext::get_querier()->select("SELECT m1.display_name AS login, m1.level AS user_level, m1.groups AS user_groups, m2.display_name AS last_login, m2.level AS last_user_level, m2.groups AS last_user_groups, t.id, t.title, t.subtitle, t.user_id, t.nbr_msg, t.nbr_views, t.last_user_id , t.last_msg_id, t.last_timestamp, t.type, t.status, t.display_msg, v.last_view_id, p.question, tr.id AS idtrack\n\tFROM " . PREFIX . "forum_topics t\n\tLEFT JOIN " . PREFIX . "forum_view v ON v.user_id = :user_id AND v.idtopic = t.id\n\tLEFT JOIN " . DB_TABLE_MEMBER . " m1 ON m1.user_id = t.user_id\n\tLEFT JOIN " . DB_TABLE_MEMBER . " m2 ON m2.user_id = t.last_user_id\n\tLEFT JOIN " . PREFIX . "forum_poll p ON p.idtopic = t.id\n\tLEFT JOIN " . PREFIX . "forum_track tr ON tr.idtopic = t.id AND tr.user_id = :user_id\n\tWHERE t.idcat = :idcat\n\tORDER BY t.type DESC , t.last_timestamp DESC\n\tLIMIT :number_items_per_page OFFSET :display_from", array('user_id' => AppContext::get_current_user()->get_id(), 'idcat' => $id_get, 'number_items_per_page' => $pagination->get_number_items_per_page(), 'display_from' => $pagination->get_display_from()));
 while ($row = $result->fetch()) {
     //On définit un array pour l'appellation correspondant au type de champ
     $type = array('2' => $LANG['forum_announce'] . ':', '1' => $LANG['forum_postit'] . ':', '0' => '');
     //Vérifications des topics Lu/non Lus.
     $img_announce = 'fa-announce';
     $new_msg = false;
     $blink = false;
     if (!$is_guest) {
         if ($row['last_view_id'] != $row['last_msg_id'] && $row['last_timestamp'] >= $max_time_msg) {
             $img_announce = $img_announce . '-new';
             //Image affiché aux visiteurs.
             $new_msg = true;
Exemple #5
0
//Récupération du message quoté.
$contents = '';
if (!empty($quote_get)) {
    try {
        $quote_msg = PersistenceContext::get_querier()->select_single_row(PREFIX . 'forum_msg', array('user_id', 'contents'), 'WHERE id=:id', array('id' => $quote_get));
    } catch (RowNotFoundException $e) {
        $error_controller = PHPBoostErrors::unexisting_element();
        DispatchManager::redirect($error_controller);
    }
    $pseudo = PersistenceContext::get_querier()->get_column_value(DB_TABLE_MEMBER, 'display_name', 'WHERE user_id=:id', array('id' => $quote_msg['user_id']));
    $contents = '[quote=' . $pseudo . ']' . stripslashes(FormatingHelper::unparse($quote_msg['contents'])) . '[/quote]';
}
//Formulaire de réponse, non présent si verrouillé.
if ($topic['status'] == '0' && !$check_group_edit_auth) {
    $tpl->put_all(array('C_ERROR_AUTH_WRITE' => true, 'L_ERROR_AUTH_WRITE' => $LANG['e_topic_lock_forum']));
} elseif (!ForumAuthorizationsService::check_authorizations($topic['idcat'])->write()) {
    $tpl->put_all(array('C_ERROR_AUTH_WRITE' => true, 'L_ERROR_AUTH_WRITE' => $LANG['e_cat_write']));
} else {
    $img_track_display = $track ? 'fa-msg-not-track' : 'fa-msg-track';
    $img_track_pm_display = $track_pm ? 'fa-pm-not-track' : 'fa-pm-track';
    $img_track_mail_display = $track_mail ? 'fa-mail-not-track' : 'fa-mail-track';
    $editor = AppContext::get_content_formatting_service()->get_default_editor();
    $editor->set_identifier('contents');
    $vars_tpl = array_merge($vars_tpl, array('C_AUTH_POST' => true, 'CONTENTS' => $contents, 'KERNEL_EDITOR' => $editor->display(), 'ICON_TRACK' => '<i class="fa ' . $img_track_display . '"></i>', 'ICON_SUSCRIBE_PM' => '<i class="fa ' . $img_track_pm_display . '"></i>', 'ICON_SUSCRIBE' => '<i class="fa ' . $img_track_mail_display . '"></i>', 'U_FORUM_ACTION_POST' => url('.php?idt=' . $id_get . '&amp;id=' . $topic['idcat'] . '&amp;new=n_msg&amp;token=' . AppContext::get_session()->get_token())));
    //Affichage du lien pour changer le display_msg du topic et autorisation d'édition du statut.
    if ($config->is_message_before_topic_title_displayed() && ($check_group_edit_auth || AppContext::get_current_user()->get_id() == $topic['user_id'])) {
        $img_msg_display = $topic['display_msg'] ? 'fa-msg-not-display' : 'fa-msg-display';
        $tpl_bottom->put_all(array('C_DISPLAY_MSG' => true, 'ICON_DISPLAY_MSG' => $config->is_message_before_topic_title_icon_displayed() ? '<i class="fa ' . $img_msg_display . '"></i>' : '', 'L_DISPLAY_MSG' => $config->get_message_before_topic_title(), 'L_EXPLAIN_DISPLAY_MSG_DEFAULT' => $topic['display_msg'] ? $config->get_message_when_topic_is_solved() : $config->get_message_when_topic_is_unsolved(), 'L_EXPLAIN_DISPLAY_MSG' => $config->get_message_when_topic_is_unsolved(), 'L_EXPLAIN_DISPLAY_MSG_BIS' => $config->get_message_when_topic_is_solved(), 'U_ACTION_MSG_DISPLAY' => url('.php?msg_d=1&amp;id=' . $id_get . '&amp;token=' . AppContext::get_session()->get_token())));
    }
}
$tpl->put_all($vars_tpl);
    private function build_view()
    {
        global $LANG, $config, $nbr_msg_not_read, $tpl_top, $tpl_bottom;
        $id_get = retrieve(GET, 'id', 0);
        try {
            $this->category = ForumService::get_categories_manager()->get_categories_cache()->get_category($id_get);
        } catch (CategoryNotFoundException $e) {
        }
        require_once PATH_TO_ROOT . '/forum/forum_begin.php';
        require_once PATH_TO_ROOT . '/forum/forum_tools.php';
        $this->view = new FileTemplate('forum/forum_index.tpl');
        //Affichage des sous-catégories de la catégorie.
        $display_cat = !empty($id_get);
        //Vérification des autorisations.
        $authorized_categories = ForumService::get_authorized_categories($id_get);
        //Calcul du temps de péremption, ou de dernière vue des messages par à rapport à la configuration.
        $max_time_msg = forum_limit_time_msg();
        $is_guest = AppContext::get_current_user()->get_id() == -1;
        $total_topic = 0;
        $total_msg = 0;
        $i = 0;
        //On liste les catégories et sous-catégories.
        $result = PersistenceContext::get_querier()->select('SELECT @id_cat:= c.id, c.id AS cid, c.id_parent, c.name, c.rewrited_name, c.description as subname, c.url, c.last_topic_id, t.id AS tid, t.idcat, t.title, t.last_timestamp, t.last_user_id, t.last_msg_id, t.nbr_msg AS t_nbr_msg, t.display_msg, t.status, m.user_id, m.display_name as login, m.level as user_level, m.groups, v.last_view_id,
		(SELECT COUNT(*) FROM ' . ForumSetup::$forum_topics_table . '
			WHERE idcat IN (
				@id_cat,
				(SELECT GROUP_CONCAT(id SEPARATOR \',\') FROM ' . ForumSetup::$forum_cats_table . ' WHERE id_parent = @id_cat), 
				(SELECT GROUP_CONCAT(childs.id SEPARATOR \',\') FROM ' . ForumSetup::$forum_cats_table . ' parents
				INNER JOIN ' . ForumSetup::$forum_cats_table . ' childs ON parents.id = childs.id_parent
				WHERE parents.id_parent = @id_cat)
			)
		) AS nbr_topic,
		(SELECT COUNT(*) FROM ' . ForumSetup::$forum_message_table . '
			WHERE idtopic IN (
				(SELECT GROUP_CONCAT(id SEPARATOR \',\') FROM ' . ForumSetup::$forum_topics_table . ' WHERE idcat = @id_cat), 
				(SELECT GROUP_CONCAT(t.id SEPARATOR \',\') FROM ' . ForumSetup::$forum_topics_table . ' t LEFT JOIN ' . ForumSetup::$forum_cats_table . ' c ON t.idcat = c.id WHERE id_parent = @id_cat)
			)
		) AS nbr_msg
		FROM ' . ForumSetup::$forum_cats_table . ' c
		LEFT JOIN ' . ForumSetup::$forum_topics_table . ' t ON t.id = c.last_topic_id
		LEFT JOIN ' . ForumSetup::$forum_view_table . ' v ON v.user_id = :user_id AND v.idtopic = t.id
		LEFT JOIN ' . DB_TABLE_MEMBER . ' m ON m.user_id = t.last_user_id
		WHERE ' . ($display_cat ? 'c.id_parent = :id_cat AND ' : '') . 'c.id IN :authorized_categories
		ORDER BY c.id, c.id_parent, c.c_order', array('id_cat' => $id_get, 'user_id' => AppContext::get_current_user()->get_id(), 'authorized_categories' => $authorized_categories));
        $categories = array();
        while ($row = $result->fetch()) {
            $categories[] = $row;
        }
        $result->dispose();
        $display_sub_cats = false;
        $is_sub_forum = array();
        foreach ($categories as $row) {
            $this->view->assign_block_vars('forums_list', array());
            if ($row['id_parent'] == Category::ROOT_CATEGORY && $i > 0 && $display_sub_cats) {
                $this->view->assign_block_vars('forums_list.endcats', array());
            }
            $i++;
            if ($row['id_parent'] == Category::ROOT_CATEGORY) {
                $this->view->assign_block_vars('forums_list.cats', array('IDCAT' => $row['cid'], 'NAME' => $row['name'], 'U_FORUM_VARS' => ForumUrlBuilder::display_category($row['cid'], $row['rewrited_name'])->rel()));
                $display_sub_cats = true;
            } else {
                if (in_array($row['id_parent'], $is_sub_forum)) {
                    $is_sub_forum[] = $row['cid'];
                }
                if (($display_sub_cats || !empty($id_get)) && !in_array($row['cid'], $is_sub_forum)) {
                    if ($display_cat) {
                        $this->view->assign_block_vars('forums_list.cats', array('IDCAT' => $this->category->get_id(), 'NAME' => $this->category->get_name(), 'U_FORUM_VARS' => PATH_TO_ROOT . '/forum/' . url('index.php?id=' . $this->category->get_id(), 'cat-' . $this->category->get_id() . '+' . $this->category->get_rewrited_name() . '.php')));
                        $display_cat = false;
                    }
                    $subforums = '';
                    $this->view->put_all(array('C_FORUM_ROOT_CAT' => false, 'C_FORUM_CHILD_CAT' => true, 'C_END_S_CATS' => false));
                    $children = ForumService::get_categories_manager()->get_categories_cache()->get_childrens($row['cid']);
                    if ($children) {
                        foreach ($children as $id => $child) {
                            if ($child->get_id_parent() == $row['cid'] && ForumAuthorizationsService::check_authorizations($child->get_id())->read()) {
                                $is_sub_forum[] = $child->get_id();
                                $link = $child->get_url() ? '<a href="' . $child->get_url() . '" class="small">' : '<a href="forum' . url('.php?id=' . $child->get_id(), '-' . $child->get_id() . '+' . $child->get_rewrited_name() . '.php') . '" class="small">';
                                $subforums .= !empty($subforums) ? ', ' . $link . $child->get_name() . '</a>' : $link . $child->get_name() . '</a>';
                            }
                        }
                        $subforums = '<strong>' . $LANG['subforum_s'] . '</strong>: ' . $subforums;
                    }
                    if (!empty($row['last_topic_id'])) {
                        //Si le dernier message lu est présent on redirige vers lui, sinon on redirige vers le dernier posté.
                        if (!empty($row['last_view_id'])) {
                            $last_msg_id = $row['last_view_id'];
                            $last_page = 'idm=' . $row['last_view_id'] . '&amp;';
                            $last_page_rewrite = '-0-' . $row['last_view_id'];
                        } else {
                            $last_msg_id = $row['last_msg_id'];
                            $last_page = ceil($row['t_nbr_msg'] / $config->get_number_messages_per_page());
                            $last_page_rewrite = $last_page > 1 ? '-' . $last_page : '';
                            $last_page = $last_page > 1 ? 'pt=' . $last_page . '&amp;' : '';
                        }
                        $last_topic_title = ($config->is_message_before_topic_title_displayed() && $row['display_msg'] ? $config->get_message_before_topic_title() : '') . ' ' . $row['title'];
                        $last_topic_title = stripslashes(strlen(TextHelper::html_entity_decode($last_topic_title)) > 20 ? TextHelper::substr_html($last_topic_title, 0, 20) . '...' : $last_topic_title);
                        $row['login'] = !empty($row['login']) ? $row['login'] : $LANG['guest'];
                        $group_color = User::get_group_color($row['groups'], $row['user_level']);
                        $last = '<a href="' . PATH_TO_ROOT . '/forum/topic' . url('.php?id=' . $row['tid'], '-' . $row['tid'] . '+' . Url::encode_rewrite($row['title']) . '.php') . '" class="small">' . $last_topic_title . '</a><br />
						<a href="' . PATH_TO_ROOT . '/forum/topic' . url('.php?' . $last_page . 'id=' . $row['tid'], '-' . $row['tid'] . $last_page_rewrite . '+' . Url::encode_rewrite($row['title']) . '.php') . '#m' . $last_msg_id . '"><i class="fa fa-hand-o-right"></i></a> ' . $LANG['on'] . ' ' . Date::to_format($row['last_timestamp'], Date::FORMAT_DAY_MONTH_YEAR_HOUR_MINUTE) . '<br />' . $LANG['by'] . ' ' . ($row['last_user_id'] != '-1' ? '<a href="' . UserUrlBuilder::profile($row['last_user_id'])->rel() . '" class="small ' . UserService::get_level_class($row['user_level']) . '"' . (!empty($group_color) ? ' style="color:' . $group_color . '"' : '') . '>' . $row['login'] . '</a>' : '<em>' . $LANG['guest'] . '</em>');
                    } else {
                        $row['last_timestamp'] = '';
                        $last = '<br />' . $LANG['no_message'] . '<br /><br />';
                    }
                    //Vérifications des topics Lu/non Lus.
                    $img_announce = 'fa-announce';
                    $blink = false;
                    if (!$is_guest) {
                        if ($row['last_view_id'] != $row['last_msg_id'] && $row['last_timestamp'] >= $max_time_msg) {
                            $img_announce = $img_announce . '-new';
                            //Image affiché aux visiteurs.
                            $blink = true;
                        }
                    }
                    $img_announce .= $row['status'] == '0' ? '-lock' : '';
                    $total_topic += $row['nbr_topic'];
                    $total_msg += $row['nbr_msg'];
                    $this->view->assign_block_vars('forums_list.subcats', array('C_BLINK' => $blink, 'IMG_ANNOUNCE' => $img_announce, 'NAME' => $row['name'], 'DESC' => FormatingHelper::second_parse($row['subname']), 'SUBFORUMS' => !empty($subforums) && !empty($row['subname']) ? '<br />' . $subforums : $subforums, 'NBR_TOPIC' => $row['nbr_topic'], 'NBR_MSG' => $row['nbr_msg'], 'U_FORUM_URL' => $row['url'], 'U_FORUM_VARS' => ForumUrlBuilder::display_forum($row['cid'], $row['rewrited_name'])->rel(), 'U_LAST_TOPIC' => $last));
                }
            }
        }
        if ($i > 0) {
            $this->view->assign_block_vars('forums_list', array());
            $this->view->assign_block_vars('forums_list.endcats', array());
        }
        $site_path = GeneralConfig::get_default_site_path();
        if (GeneralConfig::load()->get_module_home_page() == 'forum') {
            list($users_list, $total_admin, $total_modo, $total_member, $total_visit, $total_online) = forum_list_user_online("AND s.location_script = '" . $site_path . "/forum/' OR s.location_script = '" . $site_path . "/forum/index.php' OR s.location_script = '" . $site_path . "/index.php' OR s.location_script = '" . $site_path . "/'");
        } else {
            $where = "AND s.location_script LIKE '%" . $site_path . "/forum/%'";
            if (!empty($id_get)) {
                $where = "AND s.location_script LIKE '%" . $site_path . url('/forum/index.php?id=' . $id_get, '/forum/cat-' . $id_get . ($this->category !== false && $id_get != Category::ROOT_CATEGORY ? '+' . $this->category->get_rewrited_name() : '') . '.php') . "'";
            }
            list($users_list, $total_admin, $total_modo, $total_member, $total_visit, $total_online) = forum_list_user_online($where);
        }
        //Liste des catégories.
        $search_category_children_options = new SearchCategoryChildrensOptions();
        $search_category_children_options->add_authorizations_bits(Category::READ_AUTHORIZATIONS);
        $categories_tree = ForumService::get_categories_manager()->get_select_categories_form_field('cats', '', $id_get, $search_category_children_options);
        $method = new ReflectionMethod('AbstractFormFieldChoice', 'get_options');
        $method->setAccessible(true);
        $categories_tree_options = $method->invoke($categories_tree);
        $cat_list = '';
        foreach ($categories_tree_options as $option) {
            if ($option->get_raw_value()) {
                $cat = ForumService::get_categories_manager()->get_categories_cache()->get_category($option->get_raw_value());
                if (!$cat->get_url()) {
                    $cat_list .= $option->display()->render();
                }
            }
        }
        $vars_tpl = array('FORUM_NAME' => $config->get_forum_name(), 'NBR_MSG' => $total_msg, 'NBR_TOPIC' => $total_topic, 'C_USER_CONNECTED' => AppContext::get_current_user()->check_level(User::MEMBER_LEVEL), 'TOTAL_ONLINE' => $total_online, 'USERS_ONLINE' => $total_online - $total_visit == 0 ? '<em>' . $LANG['no_member_online'] . '</em>' : $users_list, 'ADMIN' => $total_admin, 'MODO' => $total_modo, 'MEMBER' => $total_member, 'GUEST' => $total_visit, 'SELECT_CAT' => !empty($id_get) ? $cat_list : '', 'C_TOTAL_POST' => true, 'U_ONCHANGE' => PATH_TO_ROOT . "/forum/" . url("index.php?id=' + this.options[this.selectedIndex].value + '", "forum-' + this.options[this.selectedIndex].value + '.php"), 'U_ONCHANGE_CAT' => PATH_TO_ROOT . "/forum/" . url("/index.php?id=' + this.options[this.selectedIndex].value + '", "cat-' + this.options[this.selectedIndex].value + '.php"), 'L_FORUM_INDEX' => $LANG['forum_index'], 'L_FORUM' => $LANG['forum'], 'L_TOPIC' => $total_topic > 1 ? $LANG['topic_s'] : $LANG['topic'], 'L_MESSAGE' => $total_msg > 1 ? $LANG['message_s'] : $LANG['message'], 'L_LAST_MESSAGE' => $LANG['last_message'], 'L_STATS' => $LANG['stats'], 'L_DISPLAY_UNREAD_MSG' => $LANG['show_not_reads'], 'L_MARK_AS_READ' => $LANG['mark_as_read'], 'L_TOTAL_POST' => $LANG['nbr_message'], 'L_DISTRIBUTED' => strtolower($LANG['distributed']), 'L_AND' => $LANG['and'], 'L_USER' => $total_online > 1 ? $LANG['user_s'] : $LANG['user'], 'L_ADMIN' => $total_admin > 1 ? $LANG['admin_s'] : $LANG['admin'], 'L_MODO' => $total_modo > 1 ? $LANG['modo_s'] : $LANG['modo'], 'L_MEMBER' => $total_member > 1 ? $LANG['member_s'] : $LANG['member'], 'L_GUEST' => $total_visit > 1 ? $LANG['guest_s'] : $LANG['guest'], 'L_AND' => $LANG['and'], 'L_ONLINE' => strtolower($LANG['online']));
        $this->view->put_all($vars_tpl);
        $tpl_top->put_all($vars_tpl);
        $tpl_bottom->put_all($vars_tpl);
        $this->view->put('forum_top', $tpl_top);
        $this->view->put('forum_bottom', $tpl_bottom);
        return $this->view;
    }