public function get_bookmarks($ext_mode = '', $forums = array())
    {
        define('POSTS_BOOKMARKS_TABLE', $this->table_prefix . 'posts_bookmarks');
        $start = $this->request->variable('start', 0);
        $sql = 'SELECT COUNT(post_id) as posts_count
			FROM ' . POSTS_BOOKMARKS_TABLE . '
			WHERE user_id = ' . $this->user->data['user_id'];
        $result = $this->db->sql_query($sql);
        $posts_count = (int) $this->db->sql_fetchfield('posts_count');
        $this->db->sql_freeresult($result);
        $sql_where = $sql_fields = '';
        if ($ext_mode != 'find') {
            $sql_where = 'LEFT JOIN ' . USERS_TABLE . ' u ON (p.poster_id = u.user_id)';
            $sql_fields = ', p.post_time, u.user_id, u.username, u.user_colour';
        }
        $pagination_url = append_sid("{$this->phpbb_root_path}postbookmark", "mode=find");
        $this->pagination->generate_template_pagination($pagination_url, 'pagination', 'start', $posts_count, $this->config['topics_per_page'], $start);
        $sql = 'SELECT b.post_id AS b_post_id, b.user_id, b.bookmark_time, b.bookmark_desc, p.post_id, p.forum_id, p.topic_id, p.poster_id, p.post_subject, t.topic_title ' . $sql_fields . '
			FROM ' . POSTS_BOOKMARKS_TABLE . ' b
			LEFT JOIN ' . POSTS_TABLE . ' p ON( b.post_id = p.post_id)
			LEFT JOIN ' . TOPICS_TABLE . ' t ON( t.topic_id = p.topic_id)
			' . $sql_where . '
			WHERE b.user_id = ' . $this->user->data['user_id'] . '
			ORDER BY b.bookmark_time ASC';
        $result = $this->db->sql_query_limit($sql, $this->config['topics_per_page'], $start);
        while ($row = $this->db->sql_fetchrow($result)) {
            $topic_author = $sql_where ? get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']) : '';
            $post_time = $sql_where ? $this->user->format_date($row['post_time']) : '';
            // Send vars to template
            $this->template->assign_block_vars('postrow', array('POST_ID' => $row['b_post_id'], 'POST_TIME' => $post_time, 'BOOKMARK_TIME' => $this->user->format_date($row['bookmark_time']), 'BOOKMARK_DESC' => $row['bookmark_desc'], 'TOPIC_AUTHOR' => $topic_author, 'POST_TITLE' => $row['post_subject'] ? $row['post_subject'] : $row['topic_title'], 'U_VIEW_POST' => append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", "p=" . $row['post_id'] . "#p" . $row['post_id'] . ""), 'S_DELETED_TOPIC' => !$row['topic_id'] ? true : false, 'S_DELETED_POST' => !$row['post_id'] ? true : false, 'U_POST_BOOKMARK' => '[url=' . generate_board_url() . '/viewtopic.' . $this->php_ext . '?p=' . $row['post_id'] . '#p' . $row['post_id'] . ']' . ($row['post_subject'] ? $row['post_subject'] : $row['topic_title']) . '[/url]'));
        }
        $this->db->sql_freeresult($result);
        $this->template->assign_vars(array('TOTAL_BOOKMARKS' => $this->user->lang('TOTAL_BOOKMARKS', (int) $posts_count), 'PAGE_NUMBER' => $this->pagination->on_page($posts_count, $this->config['topics_per_page'], $start)));
    }
Example #2
0
    public function page_header($event)
    {
        if ($this->auth->acl_get('u_did_you_know')) {
            $sql_layer = $this->db->get_sql_layer();
            switch ($sql_layer) {
                case 'postgres':
                    $random = 'RANDOM()';
                    break;
                case 'mssql':
                case 'mssql_odbc':
                    $random = 'NEWID()';
                    break;
                default:
                    $random = 'RAND()';
                    break;
            }
            $sql = 'SELECT word, bbcode_uid, bbcode_bitfield, bbcode_options
				FROM ' . $this->did_you_know . "\n\t\t\t\tWHERE lang_iso = '{$this->user->data['user_lang']}'\n\t\t\t\t\tOR lang_iso = 'default'\n\t\t\t\tORDER BY {$random}";
            $result = $this->db->sql_query_limit($sql, 1);
            $row = $this->db->sql_fetchrow($result);
            $this->db->sql_freeresult($result);
            $word = generate_text_for_display($row['word'], $row['bbcode_uid'], $row['bbcode_bitfield'], $row['bbcode_options']);
            $this->template->assign_vars(array('DID_YOU_KNOW' => str_replace(""", '"', $word), 'S_DIDYOUKNOW' => !empty($this->user->data['user_didyouknow']) ? true : false, 'U_DYK_HIDE' => $this->helper->route('dmzx_didyouknow_controller', array('mode' => 'hide'))));
        }
    }
Example #3
0
 /**
  * Likes controller for route /like_post/{like}
  *
  * @param  int   @post_id  The post to be edited.
  */
 public function like_post($post_id)
 {
     // If unknown user or bot, cannot like.
     if ($this->user->data['user_id'] == ANONYMOUS || $this->user->data['is_bot']) {
         return;
     }
     // Add language variables for response.
     $this->user->add_lang_ext('nuleaf/likes', 'likes');
     // Grab forum id for permission.
     $sql = 'SELECT forum_id
 FROM ' . POSTS_TABLE . '
 WHERE post_id = ' . $post_id;
     $result = $this->db->sql_query_limit($sql, 1);
     $forum_id = $this->db->sql_fetchrow($result)['forum_id'];
     $this->db->sql_freeresult($result);
     // Does the user have permission to like posts in this forum?
     if ($this->auth->acl_get('!f_like', $forum_id)) {
         $json_response = new json_response();
         $json_response->send(array('error' => $this->user->lang('LIKE_NOT_AUTHORIZED')));
         return;
     }
     if ($this->request->is_ajax()) {
         $liked = $this->likes_manager->is_liked($post_id);
         if ($liked) {
             // If post is already liked, unlike it.
             $likes_count = $this->likes_manager->unlike($post_id);
         } else {
             // Else like the post.
             $likes_count = $this->likes_manager->like($post_id);
         }
         // Since the post has now been liked/unliked, $liked is reversed.
         $json_response = new json_response();
         $json_response->send(array('likes_count' => $likes_count, 'liked' => !$liked, 'LIKE_POST' => $this->user->lang('LIKE_POST'), 'UNLIKE_POST' => $this->user->lang('UNLIKE_POST'), 'LIKE_BUTTON' => $this->user->lang('LIKE_BUTTON'), 'UNLIKE_BUTTON' => $this->user->lang('UNLIKE_BUTTON')));
     }
 }
Example #4
0
    public function handle_downloadlog()
    {
        if (!$this->auth->acl_get('a_')) {
            trigger_error('Access Denied');
        } else {
            $this->user->add_lang_ext('dmzx/downloadlog', 'common');
            $fileid = $this->request->variable('file', 0);
            $start = $this->request->variable('start', 0);
            // Pagination number from ACP
            $dll = $this->config['downloadlog_value'];
            // Generate pagination
            $sql = 'SELECT COUNT(downloadslog_id) AS total_downloadlogs
				FROM ' . $this->userdownloadslog_table . '
				WHERE user_id = user_id
				AND file_id = ' . $fileid;
            $result = $this->db->sql_query($sql);
            $total_downloadlogs = (int) $this->db->sql_fetchfield('total_downloadlogs');
            $sql = 'SELECT d.user_id, d.down_date, u.user_id, u.username, u.user_colour
				FROM ' . $this->userdownloadslog_table . ' d, ' . USERS_TABLE . ' u
				WHERE u.user_id = d.user_id
				AND file_id = ' . $fileid . '
				ORDER BY d.down_date DESC';
            $top_result = $this->db->sql_query_limit($sql, $dll, $start);
            while ($row = $this->db->sql_fetchrow($top_result)) {
                $this->template->assign_block_vars('downloaders', array('D_USERNAME' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), 'D_TIME' => $this->user->format_date($row['down_date'])));
            }
        }
        $pagination_url = $this->helper->route('dmzx_downloadlog_controller', array('file' => $fileid));
        //Start pagination
        $this->pagination->generate_template_pagination($pagination_url, 'pagination', 'start', $total_downloadlogs, $dll, $start);
        $this->template->assign_vars(array('DOWNLOADERS_USERS' => $total_downloadlogs == 1 ? $this->user->lang['DOWNLOADERS_COUNT'] : sprintf($this->user->lang['DOWNLOADERS_COUNTS'], $total_downloadlogs), 'DOWNLOADERS_VERSION' => $this->config['downloadlog_version']));
        page_header('Downloaders Log', false);
        $this->template->set_filenames(array('body' => 'DownloadLog.html'));
        page_footer();
    }
Example #5
0
    /**
     * Changes the regex replacement for second pass
     *
     * @param object $event
     * @return null
     * @access public
     */
    public function modify_replies($event)
    {
        if (!function_exists('get_username_string')) {
            include $this->root_path . 'includes/functions_content.' . $this->php_ext;
        }
        // 1. output each line with user + post-count
        // 2. output in "inline-popup" like in "mark posts read"
        $topic_row = $event['topic_row'];
        $topic_id = $topic_row['TOPIC_ID'];
        $sql = 'SELECT COUNT(p.post_id) AS posts, p.poster_id, u.username, u.user_colour
		FROM phpbb_posts p, phpbb_users u
		WHERE p.topic_id = ' . (int) $topic_id . '
		AND p.poster_id = u.user_id
		GROUP BY p.poster_id
		ORDER BY posts DESC';
        $result = $this->db->sql_query_limit($sql, 5);
        while ($row = $this->db->sql_fetchrow($result)) {
            var_dump($row);
            $post_count = $row['posts'];
            $display_username = get_username_string('full', $row['poster_id'], $row['username'], $row['user_colour']);
            echo $display_username . ' with ' . $post_count . 'posts<br />';
        }
        $this->db->sql_freeresult($result);
        $topic_row['REPLIES'] = '<a href="#t=' . $topic_id . '" class="whoposted">' . $topic_row['REPLIES'] . '</a>';
        $event['topic_row'] = $topic_row;
    }
Example #6
0
    /**
     * Delete a version of an article
     *
     * @param	int		$id	Id of the version to delete
     * @return	object
     */
    public function version($id)
    {
        if (!$this->auth->acl_get('m_wiki_delete')) {
            trigger_error('NOT_AUTHORISED');
        }
        $sql = 'SELECT article_approved, article_url
			FROM ' . $this->article_table . '
				WHERE article_id = ' . (int) $id;
        $result = $this->db->sql_query_limit($sql, 1);
        $row = $this->db->sql_fetchrow($result);
        $this->db->sql_freeresult($result);
        if ($row['article_approved'] != 0) {
            trigger_error($this->user->lang['NO_DELETE_ACTIVE_VERSION'] . '<br /><br /><a href="' . $this->helper->route('tas2580_wiki_article', array('article' => $row['article_url'])) . '">' . $this->user->lang['BACK_TO_ARTICLE'] . '</a>');
        }
        if (confirm_box(true)) {
            $sql = 'DELETE FROM ' . $this->article_table . '
				WHERE article_id = ' . (int) $id;
            $this->db->sql_query($sql);
            //return $helper->message('DELETE_VERSION_SUCCESS', array());
            trigger_error($this->user->lang['DELETE_VERSION_SUCCESS'] . '<br /><br /><a href="' . $this->helper->route('tas2580_wiki_article', array('article' => $row['article_url'])) . '">' . $this->user->lang['BACK_TO_ARTICLE'] . '</a>');
        } else {
            $s_hidden_fields = build_hidden_fields(array('id' => $id));
            confirm_box(false, $this->user->lang['CONFIRM_DELETE_VERSION'], $s_hidden_fields);
        }
        redirect($this->helper->route('tas2580_wiki_index', array('id' => $id)));
    }
Example #7
0
    /**
     * Get number of groups, displayed on the legend
     *
     * @return	int		value of the last item displayed
     */
    public function get_group_count()
    {
        $sql = 'SELECT group_legend
			FROM ' . GROUPS_TABLE . '
			ORDER BY group_legend DESC';
        $result = $this->db->sql_query_limit($sql, 1);
        $group_count = (int) $this->db->sql_fetchfield('group_legend');
        $this->db->sql_freeresult($result);
        return $group_count;
    }
    /**
     * Get module data from database
     *
     * @param int $module_id Module ID
     * @return array Module data array
     */
    public function get_module_data($module_id)
    {
        $sql = 'SELECT *
			FROM ' . PORTAL_MODULES_TABLE . '
			WHERE module_id = ' . (int) $module_id;
        $result = $this->db->sql_query_limit($sql, 1);
        $module_data = $this->db->sql_fetchrow($result);
        $this->db->sql_freeresult($result);
        return $module_data;
    }
Example #9
0
    /**
     * Get batch.
     *
     * @return array
     */
    protected function get_batch()
    {
        $sql = 'SELECT DISTINCT topic_id, post_user_id
			FROM ' . $this->posts_table . '
			WHERE post_approved = 1
				AND post_deleted = 0';
        $result = $this->db->sql_query_limit($sql, $this->limit, $this->start);
        $rows = $this->db->sql_fetchrowset($result);
        $this->db->sql_freeresult($result);
        return $rows;
    }
Example #10
0
    /**
     * {@inheritdoc}
     */
    public function get_template_side($module_id)
    {
        $sql = 'SELECT user_id, username, user_posts, user_colour
			FROM ' . USERS_TABLE . '
			WHERE user_type <> ' . USER_IGNORE . "\n\t\t\t\tAND user_posts <> 0\n\t\t\t\tAND username <> ''\n\t\t\tORDER BY user_posts DESC";
        $result = $this->db->sql_query_limit($sql, $this->config['board3_topposters_' . $module_id], 0, 600);
        while ($row = $this->db->sql_fetchrow($result)) {
            $this->template->assign_block_vars('topposters', array('S_SEARCH_ACTION' => append_sid("{$this->phpbb_root_path}search.{$this->php_ext}", 'author_id=' . $row['user_id'] . '&amp;sr=posts'), 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), 'POSTER_POSTS' => $row['user_posts']));
        }
        $this->db->sql_freeresult($result);
        return 'topposters_side.html';
    }
 /**
  * get members
  */
 public function get_list($get = array())
 {
     $this->settings = $get + array('query_type' => 'recent', 'date_range' => '', 'max_members' => 5);
     $sql = $this->get_sql_statement();
     $result = $this->db->sql_query_limit($sql, $this->settings['max_members']);
     $has_results = false;
     while ($row = $this->db->sql_fetchrow($result)) {
         $has_results = true;
         $this->ptemplate->assign_block_vars('member', call_user_func_array(array($this, $this->view_mode), array($row)));
     }
     $this->db->sql_freeresult($result);
     return $this->show_results($has_results);
 }
Example #12
0
    /**
     * Return correct object for specified mode
     *
     * @param string	$mode		The feeds mode.
     * @param int	$forum_id	Forum id specified by the script if forum feed provided.
     * @param int	$topic_id	Topic id specified by the script if topic feed provided.
     *
     * @return object	Returns correct feeds object for specified mode.
     */
    function get_feed($mode, $forum_id, $topic_id)
    {
        switch ($mode) {
            case 'forums':
                if (!$this->config['feed_overall_forums']) {
                    return false;
                }
                return $this->container->get('feed.forums');
                break;
            case 'topics':
            case 'topics_new':
                if (!$this->config['feed_topics_new']) {
                    return false;
                }
                return $this->container->get('feed.topics');
                break;
            case 'topics_active':
                if (!$this->config['feed_topics_active']) {
                    return false;
                }
                return $this->container->get('feed.topics_active');
                break;
            case 'news':
                // Get at least one news forum
                $sql = 'SELECT forum_id
					FROM ' . FORUMS_TABLE . '
					WHERE ' . $this->db->sql_bit_and('forum_options', FORUM_OPTION_FEED_NEWS, '<> 0');
                $result = $this->db->sql_query_limit($sql, 1, 0, 600);
                $s_feed_news = (int) $this->db->sql_fetchfield('forum_id');
                $this->db->sql_freeresult($result);
                if (!$s_feed_news) {
                    return false;
                }
                return $this->container->get('feed.news');
                break;
            default:
                if ($topic_id && $this->config['feed_topic']) {
                    return $this->container->get('feed.topic')->set_topic_id($topic_id);
                } else {
                    if ($forum_id && $this->config['feed_forum']) {
                        return $this->container->get('feed.forum')->set_forum_id($forum_id);
                    } else {
                        if ($this->config['feed_overall']) {
                            return $this->container->get('feed.overall');
                        }
                    }
                }
                return false;
                break;
        }
    }
Example #13
0
    /**
     * {@inheritdoc}
     */
    public function get_template_side($module_id)
    {
        $sql = 'SELECT user_id, username, user_regdate, user_colour
			FROM ' . USERS_TABLE . '
			WHERE user_type <> ' . USER_IGNORE . '
				AND user_inactive_time = 0
			ORDER BY user_regdate DESC';
        $result = $this->db->sql_query_limit($sql, $this->config['board3_max_last_member_' . $module_id], 0, 600);
        while (($row = $this->db->sql_fetchrow($result)) && $row['username']) {
            $this->template->assign_block_vars('latest_members', array('USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), 'JOINED' => $this->user->format_date($row['user_regdate'], $format = 'd M')));
        }
        $this->db->sql_freeresult($result);
        return 'latest_members_side.html';
    }
Example #14
0
    public function index_modify_page_title($event)
    {
        $this->user->add_lang_ext('dmzx/newestmembers', 'common');
        $sql = 'SELECT user_id, username, user_colour
			FROM ' . USERS_TABLE . '
			WHERE user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')
			ORDER BY user_id DESC';
        $result = $this->db->sql_query_limit($sql, 5);
        if ($result) {
            while ($row = $this->db->sql_fetchrow($result)) {
                $this->template->assign_block_vars('newestmembers', array('NEWESTMEMBERS' => sprintf($this->user->lang['NEWEST_MEMBERS'], get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']))));
            }
        }
        $this->db->sql_freeresult($result);
    }
Example #15
0
    public function get_last_post_data($data)
    {
        $forum_id = (int) $data['forum_id'];
        $topic_id = (int) $data['topic_id'];
        $user_id = (int) $this->user->data['user_id'];
        $sql_array = array('SELECT' => 'f.enable_indexing, f.forum_id, p.bbcode_bitfield, p.bbcode_uid, p.post_created,
				p.enable_bbcode,  p.enable_magic_url, p.enable_smilies, p.poster_id, p.post_attachment,
				p.post_edit_locked, p.post_id, p.post_subject, p.post_text, p.post_time, p.post_visibility, t.topic_attachment,
				t.topic_first_post_id, t.topic_id, t.topic_last_post_time', 'FROM' => array(FORUMS_TABLE => 'f', POSTS_TABLE => 'p', TOPICS_TABLE => 't'), 'WHERE' => "p.post_id = t.topic_last_post_id\n\t\t\t\tAND t.topic_posts_unapproved = 0\n\t\t\t\tAND t.topic_id = {$topic_id}\n\t\t\t\tAND (f.forum_id = t.forum_id \n\t\t\t\t\tOR f.forum_id = {$forum_id})");
        $sql = $this->db->sql_build_query('SELECT', $sql_array);
        $result = $this->db->sql_query_limit($sql, 1);
        $last_post_data = $this->db->sql_fetchrow($result);
        $this->db->sql_freeresult($result);
        return $last_post_data;
    }
Example #16
0
    /**
     * Get attachment id from legacy Ariel URL.
     *
     * @return int
     */
    protected function get_legacy_download_id()
    {
        // Mostly to make moving from Ariel easier
        $revision_id = $this->request->variable('revision', 0);
        $contrib_id = $this->request->variable('contrib', 0);
        $download_id = 0;
        if ($revision_id) {
            $sql = 'SELECT attachment_id
				FROM ' . TITANIA_REVISIONS_TABLE . "\n\t\t\t\tWHERE revision_id = {$revision_id}";
            $this->db->sql_query($sql);
            $download_id = (int) $this->db->sql_fetchfield('attachment_id');
            $this->db->sql_freeresult();
        } else {
            if ($contrib_id) {
                $sql = 'SELECT attachment_id
				FROM ' . TITANIA_REVISIONS_TABLE . '
				WHERE contrib_id = ' . $contrib_id . '
					AND revision_status = ' . TITANIA_REVISION_APPROVED . '
				ORDER BY revision_id DESC';
                $this->db->sql_query_limit($sql, 1);
                $download_id = (int) $this->db->sql_fetchfield('attachment_id');
                $this->db->sql_freeresult();
            }
        }
        return $download_id;
    }
    /**
     * Returns an array of message IDs that have been deleted from the message table
     */
    public function mchat_missing_ids($start_id, $end_id)
    {
        if ($this->config['mchat_edit_delete_limit']) {
            $sql_where = 'message_time < ' . (time() - $this->config['mchat_edit_delete_limit']);
            $cache_ttl = 0;
        } else {
            $sql_where = 'message_id < ' . (int) $start_id;
            $cache_ttl = 3600;
        }
        $sql = 'SELECT message_id
			FROM ' . $this->mchat_table . '
			WHERE ' . $sql_where . '
			ORDER BY message_id DESC';
        $result = $this->db->sql_query_limit($sql, 1, 0, $cache_ttl);
        $earliest_id = (int) $this->db->sql_fetchfield('message_id');
        $this->db->sql_freeresult($result);
        if (!$earliest_id) {
            $sql = 'SELECT MIN(message_id) as earliest_id
				FROM ' . $this->mchat_table;
            $result = $this->db->sql_query($sql, 3600);
            $earliest_id = $this->db->sql_fetchfield('earliest_id');
            $this->db->sql_freeresult($result);
        }
        if (!$earliest_id) {
            return range($start_id, $end_id);
        }
        $sql = 'SELECT (t1.message_id + 1) AS start, (
			SELECT MIN(t3.message_id) - 1
			FROM ' . $this->mchat_table . ' t3
			WHERE t3.message_id > t1.message_id
		) AS end
		FROM ' . $this->mchat_table . ' t1
		WHERE t1.message_id > ' . (int) $earliest_id . ' AND NOT EXISTS (
			SELECT t2.message_id
			FROM ' . $this->mchat_table . ' t2
			WHERE t2.message_id = t1.message_id + 1
		)';
        $result = $this->db->sql_query($sql);
        $rows = $this->db->sql_fetchrowset($result);
        $this->db->sql_freeresult($result);
        $missing_ids = array();
        if ($start_id < $earliest_id && !$this->config['mchat_edit_delete_limit']) {
            $missing_ids[] = range($start_id, $earliest_id - 1);
        }
        foreach ($rows as $row) {
            if ($row['end']) {
                $missing_ids[] = range($row['start'], $row['end']);
            } else {
                $latest_message = $row['start'] - 1;
                if ($end_id > $latest_message) {
                    $missing_ids[] = range($latest_message + 1, $end_id);
                }
            }
        }
        // Flatten
        if (!empty($missing_ids)) {
            $missing_ids = call_user_func_array('array_merge', $missing_ids);
        }
        return $missing_ids;
    }
    /**
     * Display popup comment
     *
     * @param	int		$link_id		The category ID
     * @param	int		$page			Page number taken from the URL
     * @param	string	$mode			add|edit
     * @return	\Symfony\Component\HttpFoundation\Response	A Symfony Response object
     * @throws	\phpbb\exception\http_exception
     */
    public function view($link_id, $page, $mode = 'new')
    {
        $this->_check_comments_enable($link_id);
        $comment_id = $this->request->variable('c', 0);
        $view = $this->request->variable('view', '');
        $start = ($page - 1) * $this->config['dir_comments_per_page'];
        $this->s_hidden_fields = array_merge($this->s_hidden_fields, array('page' => $page));
        $this->_populate_form($link_id, $mode);
        $sql = 'SELECT COUNT(comment_id) AS nb_comments
			FROM ' . DIR_COMMENT_TABLE . '
			WHERE comment_link_id = ' . (int) $link_id;
        $result = $this->db->sql_query($sql);
        $nb_comments = (int) $this->db->sql_fetchfield('nb_comments');
        $this->db->sql_freeresult($result);
        // Make sure $start is set to the last page if it exceeds the amount
        $start = $this->pagination->validate_start($start, $this->config['dir_comments_per_page'], $nb_comments);
        $sql_array = array('SELECT' => 'a.comment_id, a.comment_user_id, a. comment_user_ip, a.comment_date, a.comment_text, a.comment_uid, a.comment_bitfield, a.comment_flags, u.username, u.user_id, u.user_colour, z.foe', 'FROM' => array(DIR_COMMENT_TABLE => 'a'), 'LEFT_JOIN' => array(array('FROM' => array(USERS_TABLE => 'u'), 'ON' => 'a.comment_user_id = u.user_id'), array('FROM' => array(ZEBRA_TABLE => 'z'), 'ON' => 'z.user_id = ' . $this->user->data['user_id'] . ' AND z.zebra_id = a.comment_user_id')), 'WHERE' => 'a.comment_link_id = ' . (int) $link_id, 'ORDER_BY' => 'a.comment_date DESC');
        $sql = $this->db->sql_build_query('SELECT', $sql_array);
        $result = $this->db->sql_query_limit($sql, $this->config['dir_comments_per_page'], $start);
        $have_result = false;
        while ($comments = $this->db->sql_fetchrow($result)) {
            $have_result = true;
            $edit_allowed = $this->user->data['is_registered'] && ($this->auth->acl_get('m_edit_comment_dir') || $this->user->data['user_id'] == $comments['comment_user_id'] && $this->auth->acl_get('u_edit_comment_dir'));
            $delete_allowed = $this->user->data['is_registered'] && ($this->auth->acl_get('m_delete_comment_dir') || $this->user->data['user_id'] == $comments['comment_user_id'] && $this->auth->acl_get('u_delete_comment_dir'));
            $this->template->assign_block_vars('comment', array('MINI_POST_IMG' => $this->user->img('icon_post_target', 'POST'), 'S_USER' => get_username_string('full', $comments['comment_user_id'], $comments['username'], $comments['user_colour']), 'S_USER_IP' => $comments['comment_user_ip'], 'S_DATE' => $this->user->format_date($comments['comment_date']), 'S_COMMENT' => generate_text_for_display($comments['comment_text'], $comments['comment_uid'], $comments['comment_bitfield'], $comments['comment_flags']), 'S_ID' => $comments['comment_id'], 'U_EDIT' => $edit_allowed ? $this->helper->route('ernadoo_phpbbdirectory_comment_edit_controller', array('link_id' => (int) $link_id, 'comment_id' => (int) $comments['comment_id'])) : '', 'U_DELETE' => $delete_allowed ? $this->helper->route('ernadoo_phpbbdirectory_comment_delete_controller', array('link_id' => (int) $link_id, 'comment_id' => (int) $comments['comment_id'], '_referer' => $this->helper->get_current_url())) : '', 'S_IGNORE_POST' => $comments['foe'] && ($view != 'show' || $comment_id != $comments['comment_id']) ? true : false, 'L_IGNORE_POST' => $comments['foe'] ? $this->user->lang('POST_BY_FOE', get_username_string('full', $comments['comment_user_id'], $comments['username'], $comments['user_colour']), '<a href="' . $this->helper->url('directory/link/' . $link_id . '/comment' . ($page > 1 ? '/' . $page : '') . '?view=show#c' . (int) $comments['comment_id']) . '">', '</a>') : '', 'L_POST_DISPLAY' => $comments['foe'] ? $this->user->lang('POST_DISPLAY', '<a class="display_post" data-post-id="' . $comments['comment_id'] . '" href="' . $this->helper->url('directory/link/' . $link_id . '/comment' . ($page > 1 ? '/' . $page : '') . '?c=' . (int) $comments['comment_id'] . '&view=show#c' . (int) $comments['comment_id']) . '">', '</a>') : '', 'S_INFO' => $this->auth->acl_get('m_info')));
        }
        $base_url = array('routes' => 'ernadoo_phpbbdirectory_comment_view_controller', 'params' => array('link_id' => (int) $link_id));
        $this->pagination->generate_template_pagination($base_url, 'pagination', 'page', $nb_comments, $this->config['dir_comments_per_page'], $start);
        $this->template->assign_vars(array('TOTAL_COMMENTS' => $this->user->lang('DIR_NB_COMMS', (int) $nb_comments), 'S_HAVE_RESULT' => $have_result ? true : false));
        return $this->helper->render('comments.html', $this->user->lang['DIR_COMMENT_TITLE']);
    }
    public function newusers()
    {
        $howmany = $this->howmany();
        $sql_where = $this->ignore_users();
        $sql_and = !empty($sql_where) ? ' AND user_inactive_reason = 0' : ' WHERE user_inactive_reason = 0';
        // newest registered users
        if (($newest_users = $this->cache->get('_top_five_newest_users')) === false) {
            $newest_users = array();
            // grab most recent registered users
            $sql = 'SELECT user_id, username, user_colour, user_regdate
				FROM ' . USERS_TABLE . '
				' . $sql_where . '
				' . $sql_and . '
				ORDER BY user_regdate DESC';
            $result = $this->db->sql_query_limit($sql, $howmany);
            while ($row = $this->db->sql_fetchrow($result)) {
                $newest_users[$row['user_id']] = array('user_id' => $row['user_id'], 'username' => $row['username'], 'user_colour' => $row['user_colour'], 'user_regdate' => $row['user_regdate']);
            }
            $this->db->sql_freeresult($result);
            // cache this data for 5 minutes, this improves performance
            $this->cache->put('_top_five_newest_users', $newest_users, 300);
        }
        foreach ($newest_users as $row) {
            $username_string = $this->auth->acl_get('u_viewprofile') ? get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']) : get_username_string('no_profile', $row['user_id'], $row['username'], $row['user_colour']);
            $this->template->assign_block_vars('top_five_newest', array('REG_DATE' => $this->user->format_date($row['user_regdate']), 'USERNAME_FULL' => $username_string));
        }
    }
Example #20
0
    /**
     * Sync posts.
     *
     * @param string $mode
     * @param int|bool $start	For indexing
     * @param int|bool $limit	For indexing
     */
    public function posts($mode, $start = false, $limit = false)
    {
        switch ($mode) {
            case 'index':
                $data = array();
                $post = new \titania_post();
                $sql = 'SELECT p.*, t.topic_id, t.topic_type, t.topic_subject_clean, t.parent_id, q.queue_type, c.contrib_type
					FROM ' . $this->posts_table . ' p, ' . $this->topics_table . ' t
					LEFT JOIN ' . TITANIA_QUEUE_TABLE . ' q
						ON (t.parent_id = q.queue_id AND t.topic_type = ' . TITANIA_QUEUE . ')
					LEFT JOIN ' . $this->contribs_table . ' c
						ON (t.parent_id = c.contrib_id AND t.topic_type <> ' . TITANIA_QUEUE . ')
					WHERE t.topic_id = p.topic_id
					ORDER BY p.post_id ASC';
                if ($start === false || $limit === false) {
                    $result = $this->db->sql_query($sql);
                } else {
                    $result = $this->db->sql_query_limit($sql, (int) $limit, (int) $start);
                }
                while ($row = $this->db->sql_fetchrow($result)) {
                    $post->__set_array($row);
                    $post->topic->__set_array($row);
                    $data[] = array('object_type' => $post->post_type, 'object_id' => $post->post_id, 'parent_id' => $post->topic->parent_id, 'title' => $post->post_subject, 'text' => $post->post_text, 'text_uid' => $post->post_text_uid, 'text_bitfield' => $post->post_text_bitfield, 'text_options' => $post->post_text_options, 'author' => $post->post_user_id, 'date' => $post->post_time, 'url' => serialize($post->get_url_params()), 'approved' => $post->post_approved, 'access_level' => $post->post_access, 'parent_contrib_type' => (int) ($post->post_type == TITANIA_QUEUE) ? $row['queue_type'] : $row['contrib_type']);
                }
                $this->db->sql_freeresult($result);
                $this->search_manager->mass_index($data);
                break;
        }
    }
    /**
     * Synchronize queue topic url values.
     *
     * @return null
     */
    protected function sync_contrib_topics($start)
    {
        $i = 0;
        $limit = 250;
        $topic_type_where = $this->db->sql_in_set('topic_type', array(TITANIA_SUPPORT, TITANIA_QUEUE_DISCUSSION));
        $sql = 'SELECT contrib_id, contrib_type, contrib_name_clean
			FROM ' . $this->contribs_table;
        $result = $this->db->sql_query_limit($sql, $limit, $start);
        while ($row = $this->db->sql_fetchrow($result)) {
            $url = serialize(array('contrib_type' => $this->contrib_types->get($row['contrib_type'])->url, 'contrib' => $row['contrib_name_clean']));
            $where = 'parent_id = ' . (int) $row['contrib_id'] . '
				AND ' . $topic_type_where;
            $this->update_field($this->topics_table, 'topic', $url, $where);
            $i++;
        }
        $this->db->sql_freeresult();
        $sql = "SELECT topic_id, topic_url\n\t\t\tFROM {$this->topics_table}\n\t\t\tWHERE {$topic_type_where}";
        $result = $this->db->sql_query($sql);
        while ($row = $this->db->sql_fetchrow($result)) {
            $where = 'topic_id = ' . (int) $row['topic_id'];
            $this->update_field($this->posts_table, 'post', $row['topic_url'], $where);
        }
        $this->db->sql_freeresult($result);
        if ($i === $limit) {
            return $start + $limit;
        }
    }
    /**
     * Display the flags
     *
     * @return null
     * @access public
     */
    public function display_flags()
    {
        $start = $this->request->variable('start', 0);
        $pagination_url = $this->u_action;
        $this->user->add_lang_ext('rmcgirr83/nationalflags', 'common');
        $sql = 'SELECT f.*, COUNT(u.user_flag) as user_count
			FROM ' . $this->flags_table . ' f
				LEFT JOIN ' . USERS_TABLE . " u on f.flag_id = u.user_flag\n\t\t\tGROUP BY f.flag_id\n\t\t\tORDER BY f.flag_name ASC";
        $result = $this->db->sql_query_limit($sql, $this->config['topics_per_page'], $start);
        // for counting of all the flags
        // used for pagination
        $result2 = $this->db->sql_query($sql);
        $row2 = $this->db->sql_fetchrowset($result2);
        $total_count = (int) sizeof($row2);
        $this->db->sql_freeresult($result2);
        unset($row2);
        while ($row = $this->db->sql_fetchrow($result)) {
            $user_count = $this->user->lang('FLAG_USERS', (int) $row['user_count']);
            $this->template->assign_block_vars('flags', array('FLAG_NAME' => $row['flag_name'], 'FLAG_IMG' => $this->ext_path_web . 'flags/' . strtolower($row['flag_image']), 'FLAG_ID' => $row['flag_id'], 'USER_COUNT' => $user_count, 'U_FLAG' => $this->helper->route('rmcgirr83_nationalflags_getflags', array('flag_id' => $row['flag_id'])), 'U_EDIT' => $this->u_action . "&amp;flag_id={$row['flag_id']}&amp;action=edit", 'U_DELETE' => $this->u_action . "&amp;flag_id={$row['flag_id']}&amp;action=delete"));
        }
        $this->db->sql_freeresult($result);
        $start = $this->pagination->validate_start($start, $this->config['topics_per_page'], $total_count);
        $this->pagination->generate_template_pagination($pagination_url, 'pagination', 'start', $total_count, $this->config['topics_per_page'], $start);
        $this->template->assign_vars(array('TOTAL_FLAGS' => $total_count, 'S_FLAGS' => true));
    }
Example #23
0
File: page.php Project: R3gi/pages
    /**
     * Set route
     *
     * @param string $route Route text
     * @return page_interface $this object for chaining calls; load()->set()->save()
     * @access public
     * @throws \phpbb\pages\exception\unexpected_value
     */
    public function set_route($route)
    {
        // Enforce a string
        $route = (string) $route;
        // Route is a required field
        if ($route == '') {
            throw new \phpbb\pages\exception\unexpected_value(array('route', 'FIELD_MISSING'));
        }
        // Route should not contain any special characters
        if (!preg_match('/^[^!"#$%&*\'()+,.\\/\\\\:;<=>?@\\[\\]^`{|}~ ]*$/i', $route)) {
            throw new \phpbb\pages\exception\unexpected_value(array('route', 'ILLEGAL_CHARACTERS'));
        }
        // We limit the route length to 100 characters
        if (truncate_string($route, 100) != $route) {
            throw new \phpbb\pages\exception\unexpected_value(array('route', 'TOO_LONG'));
        }
        // Routes must be unique
        if (!$this->get_id() || $this->get_id() && $this->get_route() !== '' && $this->get_route() != $route) {
            $sql = 'SELECT 1
				FROM ' . $this->pages_table . "\n\t\t\t\tWHERE page_route = '" . $this->db->sql_escape($route) . "'\n\t\t\t\t\tAND page_id <> " . $this->get_id();
            $result = $this->db->sql_query_limit($sql, 1);
            $row = $this->db->sql_fetchrow($result);
            $this->db->sql_freeresult($result);
            if ($row) {
                throw new \phpbb\pages\exception\unexpected_value(array('route', 'NOT_UNIQUE'));
            }
        }
        // Set the route on our data array
        $this->data['page_route'] = $route;
        return $this;
    }
Example #24
0
    /**
     * @param mixed $mchat_prune_amount set from mchat config entry
     */
    function mchat_prune($mchat_prune_amount)
    {
        // Run query to get the total message rows...
        $sql = 'SELECT COUNT(message_id) AS total_messages FROM ' . $this->mchat_table;
        $result = $this->db->sql_query($sql);
        $mchat_total_messages = (int) $this->db->sql_fetchfield('total_messages');
        $this->db->sql_freeresult($result);
        // count is below prune amount?
        // do nothing
        $prune = true;
        if ($mchat_total_messages <= $mchat_prune_amount) {
            $prune = false;
        }
        if ($prune) {
            $result = $this->db->sql_query_limit('SELECT * FROM ' . $this->mchat_table . ' ORDER BY message_id ASC', 1);
            $row = $this->db->sql_fetchrow($result);
            $first_id = (int) $row['message_id'];
            $this->db->sql_freeresult($result);
            // compute the delete id
            $delete_id = $mchat_total_messages - $mchat_prune_amount + $first_id;
            // let's go delete them...if the message id is less than the delete id
            $sql = 'DELETE FROM ' . $this->mchat_table . '
			WHERE message_id < ' . (int) $delete_id;
            $this->db->sql_query($sql);
            $this->phpbb_log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_MCHAT_TABLE_PRUNED');
        }
        // free up some memory...variable(s) are no longer needed.
        unset($mchat_total_messages);
        // return to what we were doing
        return;
    }
 /**
  * Executes the given $sql and fetches the field $field_name
  *
  * @param string $sql
  *        	the sql query
  * @param string $field_name
  *        	the name of the field to fetch
  * @param int $limit
  *        	optional limit
  * @param int $start
  *        	otional start
  * @return the value of the field
  */
 public function get_field($sql, $field_name, $limit = 0, $start = 0)
 {
     $result = $limit > 0 ? $this->db->sql_query_limit($sql, $limit, $start) : $this->db->sql_query($sql);
     $re = $this->db->sql_fetchfield($field_name);
     $this->db->sql_freeresult($result);
     return $re;
 }
    /**
     * Get batch to process.
     *
     * @param bool $fetch_attach_data	Whether to fetch attachment data.
     * @return array
     */
    protected function get_batch($fetch_attach_data)
    {
        $types = $this->types->use_composer();
        if (empty($types)) {
            return array();
        }
        $attach_fields = $attach_table = $attach_where = '';
        if ($fetch_attach_data) {
            $attach_fields = ', a.attachment_directory, a.physical_filename';
            $attach_table = ", {$this->attachments_table} a";
            $attach_where = 'AND a.attachment_id = r.attachment_id';
        }
        $sql = 'SELECT c.contrib_id, c.contrib_name_clean, c.contrib_type, r.revision_id,
				r.attachment_id, r.revision_composer_json' . $attach_fields . '
			FROM ' . $this->contribs_table . ' c, ' . $this->revisions_table . ' r ' . $attach_table . '
			WHERE c.contrib_id = r.contrib_id ' . $attach_where . '
				AND c.contrib_status = ' . TITANIA_CONTRIB_APPROVED . '
				AND r.revision_status = ' . TITANIA_REVISION_APPROVED . '
				AND ' . $this->db->sql_in_set('c.contrib_type', $types) . '
			ORDER BY c.contrib_id ASC, r.revision_id ASC';
        $result = $this->db->sql_query_limit($sql, $this->limit, $this->start);
        $contribs = array();
        while ($row = $this->db->sql_fetchrow($result)) {
            $contrib_id = (int) $row['contrib_id'];
            if (!isset($contribs[$contrib_id])) {
                $contribs[$contrib_id] = array();
            }
            $contribs[$contrib_id][] = $row;
        }
        $this->db->sql_freeresult($result);
        return $contribs;
    }
Example #27
0
    /**
     * Set anchor
     *
     * @param string $anchor Anchor text
     * @return rule_interface $this object for chaining calls; load()->set()->save()
     * @access public
     * @throws \phpbb\boardrules\exception\unexpected_value
     */
    public function set_anchor($anchor)
    {
        // Enforce a string
        $anchor = (string) $anchor;
        // Anchor should not contain any special characters
        if ($anchor != '' && !preg_match('/^[^!"#$%&*\'()+,.\\/\\\\:;<=>?@\\[\\]^`{|}~ ]*$/i', $anchor)) {
            throw new \phpbb\boardrules\exception\unexpected_value(array('anchor', 'ILLEGAL_CHARACTERS'));
        }
        // We limit the anchor length to 255 characters
        if (truncate_string($anchor, 255) != $anchor) {
            throw new \phpbb\boardrules\exception\unexpected_value(array('anchor', 'TOO_LONG'));
        }
        // Make sure rule anchors are unique
        // Test if new page and anchor field has data or...
        //    if existing page and anchor field has new data not equal to existing anchor data
        if (!$this->get_id() && $anchor !== '' || $this->get_id() && $anchor !== '' && $this->get_anchor() !== $anchor) {
            $sql = 'SELECT 1
				FROM ' . $this->boardrules_table . "\n\t\t\t\tWHERE rule_anchor = '" . $this->db->sql_escape($anchor) . "'\n\t\t\t\t\tAND rule_id <> " . $this->get_id();
            $result = $this->db->sql_query_limit($sql, 1);
            $row = $this->db->sql_fetchrow($result);
            $this->db->sql_freeresult($result);
            if ($row) {
                throw new \phpbb\boardrules\exception\unexpected_value(array('anchor', 'NOT_UNIQUE'));
            }
        }
        // Set the anchor on our data array
        $this->data['rule_anchor'] = $anchor;
        return $this;
    }
 public function activedate_set($event)
 {
     $topic_data = $event['topic_data'];
     $first_post = intval($topic_data['topic_first_post_id']);
     if (0 == $event['active_date']) {
         // Reset
         $sql = 'SELECT event_id FROM ' . $this->cal_table . ' WHERE post_id = ' . $first_post;
         $result = $this->db->sql_query_limit($sql, 1);
         $event_id = $this->db->sql_fetchfield('event_id');
         $this->db->sql_freeresult($result);
         if (!$event_id) {
             // No event entered, simply skip
             return;
         }
         $sql = 'DELETE FROM ' . $this->cal_table . ' WHERE event_id = ' . $event_id;
         $this->db->sql_query($sql);
         $sql = 'DELETE FROM ' . $this->cal_event_table . ' WHERE id = ' . $event_id;
         $this->db->sql_query($sql);
         $sql = 'DELETE FROM ' . $this->cal_participants_table . ' WHERE post_id = ' . $first_post;
         $this->db->sql_query($sql);
     } else {
         // Copy Date & entries
         if ($this->hookup->topic_id != $event['topic_id']) {
             if ($this->hookup->topic_id != 0) {
                 $this->hookup = new hookup();
             }
             $this->hookup->load_hookup($event['topic_id']);
         }
         //TODO Fortsetzen
     }
 }
Example #29
0
    /**
     * prune function.
     *
     * @param string $value The value
     * @param string $key The key
     * @return string The formatted string of this item
     */
    public function prune_chat($value, $key)
    {
        if (!confirm_box(true)) {
            if ($this->u_action === 'prune_chat') {
                confirm_box(false, $this->user->lang['CONFIRM_PRUNE_AJAXCHAT'], build_hidden_fields(['i' => $this->id, 'mode' => $this->mode, 'action' => $this->u_action]));
            }
        } else {
            if (!$this->auth->acl_get('a_board')) {
                trigger_error($this->user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
            }
            if ($this->u_action === 'prune_chat') {
                $sql = 'SELECT message_id 
							FROM ' . CHAT_TABLE . ' 
							ORDER BY message_id DESC ';
                $result = $this->db->sql_query_limit($sql, $this->config['prune_keep_ajax_chat'], 1);
                $row = $this->db->sql_fetchrow($result);
                $this->db->sql_freeresult($result);
                $sql1 = 'DELETE FROM ' . CHAT_TABLE . '
						 WHERE `message_id` < ' . (int) $row['message_id'] . '';
                $this->db->sql_query($sql1);
                add_log('admin', 'PRUNE_LOG_AJAXCHAT');
                if ($this->request->is_ajax()) {
                    trigger_error($this->user->lang['PRUNE_CHAT_SUCESS']);
                }
            }
        }
        $this->id = str_replace("\\", "-", $this->id);
        return '<a href="' . append_sid('?i=' . $this->id . '&mode=' . $this->mode . '&action=prune_chat') . '" data-ajax="true"><input class="button2" type="submit" id="' . $key . '_enable" name="' . $key . '_enable" value="' . $this->user->lang['PRUNE_NOW'] . '" /></a>';
    }
Example #30
0
 /**
  * Display recents links added
  *
  * @return	null
  */
 public function recents()
 {
     if ($this->config['dir_recent_block']) {
         $limit_sql = $this->config['dir_recent_rows'] * $this->config['dir_recent_columns'];
         $exclude_array = explode(',', str_replace(' ', '', $this->config['dir_recent_exclude']));
         $sql_array = array('SELECT' => 'l.link_id, l.link_cat, l.link_url, l.link_user_id, l.link_comment, l. link_description, l.link_vote, l.link_note, l.link_view, l.link_time, l.link_name, l.link_thumb, u.user_id, u.username, u.user_colour, c.cat_name', 'FROM' => array(DIR_LINK_TABLE => 'l'), 'LEFT_JOIN' => array(array('FROM' => array(USERS_TABLE => 'u'), 'ON' => 'l.link_user_id = u.user_id'), array('FROM' => array(DIR_CAT_TABLE => 'c'), 'ON' => 'l.link_cat = c.cat_id')), 'WHERE' => $this->db->sql_in_set('l.link_cat', $exclude_array, true) . ' AND l.link_active = 1', 'ORDER_BY' => 'l.link_time DESC, l.link_id DESC');
         $sql = $this->db->sql_build_query('SELECT', $sql_array);
         $result = $this->db->sql_query_limit($sql, $limit_sql, 0);
         $num = 0;
         $rowset = array();
         while ($site = $this->db->sql_fetchrow($result)) {
             $rowset[$site['link_id']] = $site;
         }
         $this->db->sql_freeresult($result);
         if (sizeof($rowset)) {
             $this->template->assign_block_vars('block', array('S_COL_WIDTH' => 100 / $this->config['dir_recent_columns'] . '%'));
             foreach ($rowset as $row) {
                 if ($num % $this->config['dir_recent_columns'] == 0) {
                     $this->template->assign_block_vars('block.row', array());
                 }
                 $this->template->assign_block_vars('block.row.col', array('UC_THUMBNAIL' => '<a href="' . $row['link_url'] . '" onclick="window.open(\'' . $this->helper->route('ernadoo_phpbbdirectory_view_controller', array('link_id' => (int) $row['link_id'])) . '\'); return false;"><img src="' . $row['link_thumb'] . '" title="' . $row['link_name'] . '" alt="' . $row['link_name'] . '" /></a>', 'NAME' => $row['link_name'], 'USER' => get_username_string('full', $row['link_user_id'], $row['username'], $row['user_colour']), 'TIME' => $row['link_time'] ? $this->user->format_date($row['link_time']) : '', 'CAT' => $row['cat_name'], 'COUNT' => $row['link_view'], 'COMMENT' => $row['link_comment'], 'U_CAT' => $this->helper->route('ernadoo_phpbbdirectory_page_controller', array('cat_id' => (int) $row['link_cat'])), 'U_COMMENT' => $this->helper->route('ernadoo_phpbbdirectory_comment_view_controller', array('link_id' => (int) $row['link_id'])), 'L_DIR_SEARCH_NB_CLICKS' => $this->user->lang('DIR_SEARCH_NB_CLICKS', (int) $row['link_view']), 'L_DIR_SEARCH_NB_COMMS' => $this->user->lang('DIR_SEARCH_NB_COMMS', (int) $row['link_comment'])));
                 $num++;
             }
             while ($num % $this->config['dir_recent_columns'] != 0) {
                 $this->template->assign_block_vars('block.row.col2', array());
                 $num++;
             }
         }
     }
 }