Esempio n. 1
0
 function cms_block_forum_attach()
 {
     global $db, $cache, $config, $template, $images, $lang, $bbcode, $block_id, $cms_config_vars;
     if (!class_exists('class_topics')) {
         include IP_ROOT_PATH . 'includes/class_topics.' . PHP_EXT;
     }
     $class_topics = new class_topics();
     @(include_once IP_ROOT_PATH . ATTACH_MOD_PATH . 'displaying.' . PHP_EXT);
     $template->_tpldata['articles_fp.'] = array();
     $index_file = !empty($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : getenv('SCRIPT_NAME');
     $index_file = htmlspecialchars(urldecode($index_file));
     $template->set_filenames(array('forum_attach_block' => 'blocks/forum_attach_block.tpl'));
     $template->assign_vars(array('L_COMMENTS' => $lang['Comments'], 'L_VIEW_COMMENTS' => $lang['View_comments'], 'L_POST_COMMENT' => $lang['Post_your_comment'], 'L_POSTED' => $lang['Posted'], 'L_ANNOUNCEMENT' => $lang['Post_Announcement'], 'L_REPLIES' => $lang['Replies'], 'L_REPLY_NEWS' => $lang['News_Reply'], 'L_PRINT_NEWS' => $lang['News_Print'], 'L_EMAIL_NEWS' => $lang['News_Email'], 'MINIPOST_IMG' => $images['icon_minipost'], 'NEWS_REPLY_IMG' => $images['news_reply'], 'NEWS_PRINT_IMG' => $images['news_print'], 'NEWS_EMAIL_IMG' => $images['news_email'], 'IMG_CLOCK' => $images['news_clock']));
     // $only_auth_view must have the opposite value of $cms_config_vars['md_ignore_auth_view'][$block_id]
     // Suggested by JHL - To Be Verified!
     //$only_auth_view = (!empty($cms_config_vars['md_ignore_auth_view'][$block_id]) ? true : false);
     $only_auth_view = !empty($cms_config_vars['md_ignore_auth_view'][$block_id]) || $cms_config_vars['md_ignore_auth_view'][$block_id] == true ? false : true;
     if ($cms_config_vars['md_single_post_retrieve'][$block_id]) {
         $single_post_id = request_var('post_id', 0);
         if ($cms_config_vars['md_single_post_auto_id'][$block_id]) {
             $single_post_id = !empty($single_post_id) ? $single_post_id : $cms_config_vars['md_single_post_id'][$block_id];
         } else {
             $single_post_id = $cms_config_vars['md_single_post_id'][$block_id];
         }
         // Mighty Gorgon: edited by JHL, I still need to check the impacts of this amendment
         //$fetchposts = $class_topics->fetch_posts($single_post_id, 1, $cms_config_vars['md_single_post_length'][$block_id], false, false, true, $only_auth_view);
         $fetchposts = $class_topics->fetch_posts($single_post_id, 1, $cms_config_vars['md_single_post_length'][$block_id], false, 0, true, $only_auth_view);
     } else {
         $fetchposts = $class_topics->fetch_posts($cms_config_vars['md_posts_forum_id'][$block_id], $cms_config_vars['md_num_posts'][$block_id], $cms_config_vars['md_posts_length'][$block_id], $cms_config_vars['md_posts_show_portal'][$block_id], $cms_config_vars['md_posts_random'][$block_id], false, $only_auth_view);
     }
     for ($i = 0; $i < sizeof($fetchposts); $i++) {
         init_display_post_attachments($fetchposts[$i]['topic_attachment'], $fetchposts[$i], true, $block_id);
         $open_bracket = '';
         $close_bracket = '';
         $read_full = '';
         if ($fetchposts[$i]['striped'] == 1) {
             $open_bracket = '[ ';
             $close_bracket = ' ]';
             $read_full = $lang['Read_Full'];
         }
         // Convert and clean special chars!
         $topic_title = htmlspecialchars_clean($fetchposts[$i]['topic_title']);
         $template->assign_block_vars('articles_fp', array('TOPIC_ID' => $fetchposts[$i]['topic_id'], 'FORUM_ID' => $fetchposts[$i]['forum_id'], 'TITLE' => $topic_title, 'POSTER' => $fetchposts[$i]['username'], 'POSTER_CG' => colorize_username($fetchposts[$i]['user_id'], $fetchposts[$i]['username'], $fetchposts[$i]['user_color'], $fetchposts[$i]['user_active']), 'TIME' => $fetchposts[$i]['topic_time'], 'TEXT' => $fetchposts[$i]['post_text'], 'REPLIES' => $fetchposts[$i]['topic_replies'], 'U_VIEW_COMMENTS' => append_sid(CMS_PAGE_VIEWTOPIC . '?' . POST_FORUM_URL . '=' . $fetchposts[$i]['forum_id'] . '&amp;' . POST_TOPIC_URL . '=' . $fetchposts[$i]['topic_id'] . '&amp;' . POST_POST_URL . '=' . $fetchposts[$i]['post_id'] . '#p' . $fetchposts[$i]['post_id'], true), 'U_POST_COMMENT' => append_sid('posting.' . PHP_EXT . '?mode=reply&amp;' . POST_FORUM_URL . '=' . $fetchposts[$i]['forum_id'] . '&amp;' . POST_TOPIC_URL . '=' . $fetchposts[$i]['topic_id']), 'U_PRINT_TOPIC' => append_sid('printview.' . PHP_EXT . '?' . POST_FORUM_URL . '=' . $fetchposts[$i]['forum_id'] . '&amp;' . POST_TOPIC_URL . '=' . $fetchposts[$i]['topic_id'] . '&amp;start=0'), 'U_EMAIL_TOPIC' => append_sid('tellafriend.' . PHP_EXT . '?topic_title=' . urlencode(ip_utf8_decode($fetchposts[$i]['topic_title'])) . '&amp;topic_id=' . $fetchposts[$i]['topic_id']), 'U_READ_FULL' => append_sid($index_file . '?article=' . $i), 'L_READ_FULL' => $read_full, 'OPEN' => $open_bracket, 'CLOSE' => $close_bracket));
         display_attachments($fetchposts[$i]['post_id'], 'articles_fp');
     }
 }
Esempio n. 2
0
                $template->assign_block_vars("poll_option", array('POLL_OPTION_ID' => $vote_info[$i]['vote_option_id'], 'POLL_OPTION_CAPTION' => $vote_info[$i]['vote_option_text']));
            }
            $template->assign_vars(array('L_POLL' => $lang['Poll'], 'L_SUBMIT_VOTE' => $lang['Submit_vote'], 'L_VIEW_RESULTS' => $lang['View_results'], 'U_VIEW_RESULTS' => append_sid("viewtopic.{$phpEx}?" . POST_TOPIC_URL . "={$topic_id}&amp;postdays={$post_days}&amp;postorder={$post_order}&amp;vote=viewresult")));
            $s_hidden_fields = '<input type="hidden" name="topic_id" value="' . $topic_id . '" /><input type="hidden" name="mode" value="vote" />';
        }
        if (count($orig_word)) {
            $vote_title = preg_replace($orig_word, $replacement_word, $vote_title);
        }
        $s_hidden_fields .= '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" />';
        $template->assign_vars(array('POLL_QUESTION' => $vote_title, 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_POLL_ACTION' => append_sid("posting.{$phpEx}?mode=vote&amp;" . POST_TOPIC_URL . "={$topic_id}")));
        $template->assign_var_from_handle('POLL_DISPLAY', 'pollbox');
    }
}
/* -- mod : File Attachment Mod v2 Version 2.4.3 ---------------------------------------------------- */
if (!intval($attach_config['disable_mod'])) {
    init_display_post_attachments($forum_topic_data['topic_attachment']);
}
/* -- fin : File Attachment Mod v2 Version 2.4.3 ---------------------------------------------------- */
//
// Update the topic view counter
//
$sql = "UPDATE " . TOPICS_TABLE . "\n\tSET topic_views = topic_views + 1\n\tWHERE topic_id = {$topic_id}";
if (!$db->sql_query($sql)) {
    message_die(GENERAL_ERROR, "Could not update topic views.", '', __LINE__, __FILE__, $sql);
}
// Begin PNphpBB2 Module (Obtain forum level moderator status)
$forum_mods = forum_mod_status($forum_id);
// End PNphpBB2 Module (Obtain forum level moderator status)
//
// Okay, let's do the loop, yeah come on baby let's do the loop
// and it goes like this ...
Esempio n. 3
0
 /**
  * prepares a list of articles.
  *
  * @param integer (optional) the article id to the article to be displayed.
  *
  * @return void
  *
  * @access private
  */
 function prepareArticles($articles, $show_abstract = false, $show_attachments = true)
 {
     global $lang, $config, $images, $is_auth, $theme, $user, $block_id, $cms_config_var;
     if (isset($cms_config_var['md_news_length'])) {
         $news_trim = $cms_config_var['md_news_length'];
     } else {
         $news_trim = $this->config['news_item_trim'];
     }
     if (is_array($articles)) {
         if ($config['display_tags_box']) {
             @(include_once IP_ROOT_PATH . 'includes/class_topics_tags.' . PHP_EXT);
             $class_topics_tags = new class_topics_tags();
         }
         foreach ($articles as $article) {
             $trimmed = false;
             // Trim the post body if needed.
             if ($show_abstract && $news_trim > 0) {
                 $article['post_abstract'] = $this->trimText($article['post_text'], $news_trim, $trimmed);
                 $article['post_abstract'] = $this->parseMessage($article['post_abstract'] . ' ... ', $article['enable_bbcode'], $article['enable_html'], $article['enable_smilies'], $article['enable_autolinks_acronyms']);
             }
             $article['post_text'] = $this->parseMessage($article['post_text'], $article['enable_bbcode'], $article['enable_html'], $article['enable_smilies'], $article['enable_autolinks_acronyms']);
             if ($show_attachments == true) {
                 init_display_post_attachments($article['topic_attachment'], $article, false, $block_id);
             }
             $sql = '';
             $dateformat = $user->data['user_id'] == ANONYMOUS ? $config['default_dateformat'] : $user->data['user_dateformat'];
             $timezone = $user->data['user_id'] == ANONYMOUS ? $config['board_timezone'] : $user->data['user_timezone'];
             $this->setVariables(array('L_REPLIES' => $lang['Replies'], 'L_REPLY_NEWS' => $lang['News_Reply'], 'L_PRINT_NEWS' => $lang['News_Print'], 'L_EMAIL_NEWS' => $lang['News_Email'], 'MINIPOST_IMG' => $images['icon_minipost'], 'NEWS_REPLY_IMG' => $images['news_reply'], 'NEWS_PRINT_IMG' => $images['news_print'], 'NEWS_EMAIL_IMG' => $images['news_email']));
             //$index_file = CMS_PAGE_HOME;
             $index_file = !empty($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : getenv('SCRIPT_NAME');
             //$page_query = $_SERVER['QUERY_STRING'];
             //$page_query = (!empty($_SERVER['QUERY_STRING'])) ? explode('&', $_SERVER['QUERY_STRING']) : explode('&', getenv('QUERY_STRING'));
             if ($this->config['news_base_url'] != '') {
                 $index_file = $this->config['news_base_url'] . $index_file;
             }
             $index_file = htmlspecialchars(urldecode($index_file));
             $portal_page_id = request_var('page', 0);
             $portal_page_id = !empty($portal_page_id) ? 'page=' . $portal_page_id . '&amp;' : '';
             $ubid_link = request_var('ubid', 0);
             $ubid_link = !empty($ubid_link) ? 'ubid=' . $ubid_link . '&amp;' : '';
             $format = 'r';
             $gmepoch = $article['post_time'];
             $tz = $timezone;
             $news_dst_sec = get_dst($gmepoch, $tz);
             $news_date = @gmdate($format, $gmepoch + 3600 * $tz + $news_dst_sec);
             $topic_tags_links = '';
             $topic_tags_display = false;
             if ($config['display_tags_box']) {
                 $topic_id = $article['topic_id'];
                 $topic_tags_links = $class_topics_tags->build_tags_list(array($topic_id));
                 $topic_tags_display = !empty($topic_tags_links) ? true : false;
             }
             // Convert and clean special chars!
             $topic_title = htmlspecialchars_clean($article['topic_title']);
             $this->setBlockVariables('articles', array('L_TITLE' => $topic_title, 'ID' => $article['topic_id'], 'KEY' => !empty($article['article_key']) ? $article['article_key'] : '', 'DAY' => $this->getDay($article['topic_time']), 'MONTH' => $this->getMonth($article['topic_time']), 'YEAR' => $this->getYear($article['topic_time']), 'CATEGORY' => $article['news_category'], 'CAT_ID' => $article['news_id'], 'COUNT_VIEWS' => $article['topic_views'], 'CAT_IMG' => $article['news_image'] ? $this->root_path . $config['news_path'] . '/' . $article['news_image'] : '', 'POST_DATE' => create_date_ip($dateformat, $article['post_time'], $timezone, true), 'RFC_POST_DATE' => $news_date, 'L_POSTER' => colorize_username($article['user_id'], $article['username'], $article['user_color'], $article['user_active']), 'L_COMMENTS' => $article['topic_replies'], 'S_TOPIC_TAGS' => $topic_tags_display, 'TOPIC_TAGS' => $topic_tags_links, 'U_COMMENTS' => append_sid(CMS_PAGE_VIEWTOPIC . '?' . POST_FORUM_URL . '=' . $article['forum_id'] . '&amp;' . POST_TOPIC_URL . '=' . $article['topic_id']), 'U_COMMENT' => append_sid(CMS_PAGE_VIEWTOPIC . '?' . POST_FORUM_URL . '=' . $article['forum_id'] . '&amp;' . POST_TOPIC_URL . '=' . $article['topic_id']), 'U_VIEWS' => append_sid('topic_view_users.' . PHP_EXT . '?' . POST_TOPIC_URL . '=' . $article['topic_id']), 'U_POST_COMMENT' => append_sid('posting.' . PHP_EXT . '?mode=reply&amp;' . POST_FORUM_URL . '=' . $article['forum_id'] . '&amp;' . POST_TOPIC_URL . '=' . $article['topic_id']), 'U_PRINT_TOPIC' => append_sid('printview.' . PHP_EXT . '?' . POST_FORUM_URL . '=' . $article['forum_id'] . '&amp;' . POST_TOPIC_URL . '=' . $article['topic_id'] . '&amp;start=0'), 'U_EMAIL_TOPIC' => append_sid('tellafriend.' . PHP_EXT . '?topic_title=' . urlencode(ip_utf8_decode($article['topic_title'])) . '&amp;topic_id=' . $article['topic_id']), 'L_TITLE_HTML' => urlencode(ip_utf8_decode($article['topic_title'])), 'COUNT_COMMENTS' => $article['topic_replies'], 'BODY' => $show_abstract && $trimmed ? $article['post_abstract'] : $article['post_text'], 'READ_MORE_LINK' => $show_abstract && $trimmed ? '<a href="' . $index_file . '?' . $portal_page_id . $ubid_link . 'topic_id=' . $article['topic_id'] . '">' . $lang['Read_More'] . '</a>' : ''));
             if ($show_attachments) {
                 display_attachments($article['post_id'], 'articles');
             }
             $post_id = $article['post_id'];
         }
     }
     if (sizeof($articles) == 0) {
         $this->setBlockVariables('no_articles', array('L_NO_NEWS' => $lang['No_articles']));
     }
 }
Esempio n. 4
0
 function cms_block_kb()
 {
     global $db, $cache, $config, $template, $theme, $images, $table_prefix, $user, $lang, $block_id, $cms_config_vars;
     global $ip_cms;
     if (!class_exists('class_topics')) {
         include IP_ROOT_PATH . 'includes/class_topics.' . PHP_EXT;
     }
     $class_topics = new class_topics();
     @(include_once IP_ROOT_PATH . ATTACH_MOD_PATH . 'displaying.' . PHP_EXT);
     $template->_tpldata['kb_list.'] = array();
     $template->_tpldata['kb_article.'] = array();
     $template->_tpldata['cat_row.'] = array();
     $template->_tpldata['menu_row.'] = array();
     $template->set_filenames(array('kb_block' => 'blocks/kb_block.tpl'));
     $template->assign_vars(array('L_COMMENTS' => $lang['Comments'], 'L_VIEW_COMMENTS' => $lang['View_comments'], 'L_POST_COMMENT' => $lang['Post_your_comment'], 'L_POSTED' => $lang['Posted'], 'L_ANNOUNCEMENT' => $lang['Post_Announcement'], 'L_REPLIES' => $lang['Replies'], 'L_REPLY_ARTICLE' => $lang['Article_Reply'], 'L_PRINT_ARTICLE' => $lang['Article_Print'], 'L_EMAIL_ARTICLE' => $lang['Article_Email'], 'L_TOPIC' => $lang['Topic'], 'L_ARTICLES' => $lang['Articles'], 'L_TIME' => $lang['Articles_time'], 'L_OPTIONS' => $lang['Articles_options'], 'MINIPOST_IMG' => $images['icon_minipost'], 'ARTICLE_COMMENTS_IMG' => $images['vf_topic_nor'], 'ARTICLE_REPLY_IMG' => $images['news_reply'], 'ARTICLE_PRINT_IMG' => $images['news_print'], 'ARTICLE_EMAIL_IMG' => $images['news_email']));
     if (isset($_GET['kb']) && $_GET['kb'] == 'article') {
         $template->assign_block_vars('kb_article', array());
         $forum_id = request_var(POST_FORUM_URL, 0);
         // Mighty Gorgon: edited by JHL, I still need to check the impacts on the auth system
         //$fetchposts = $class_topics->fetch_posts($forum_id, 0, 0, false, false, false, false);
         $fetchposts = $class_topics->fetch_posts($forum_id, 0, 0);
         $id = isset($_GET[POST_TOPIC_URL]) ? intval($_GET[POST_TOPIC_URL]) : intval($_POST[POST_TOPIC_URL]);
         $i = 0;
         while ($fetchposts[$i]['topic_id'] != $id) {
             $i++;
         }
         init_display_post_attachments($fetchposts[$i]['topic_attachment'], $fetchposts[$i], true, $block_id);
         $template->assign_vars(array('TOPIC_ID' => $fetchposts[$i]['topic_id'], 'KB_TITLE' => $fetchposts[$i]['topic_title'], 'TOPIC_DESC' => $fetchposts[$i]['topic_desc'], 'POSTER' => $fetchposts[$i]['username'], 'POSTER_CG' => colorize_username($fetchposts[$i]['user_id'], $fetchposts[$i]['username'], $fetchposts[$i]['user_color'], $fetchposts[$i]['user_active']), 'TIME' => $fetchposts[$i]['topic_time'], 'TEXT' => $fetchposts[$i]['post_text'], 'REPLIES' => $fetchposts[$i]['topic_replies'], 'U_VIEW_COMMENTS' => append_sid(CMS_PAGE_VIEWTOPIC . '?' . POST_FORUM_URL . '=' . $forum_id . '&amp;' . POST_TOPIC_URL . '=' . $fetchposts[$i]['topic_id'], true), 'U_POST_COMMENT' => append_sid('posting.' . PHP_EXT . '?mode=reply&amp;' . POST_FORUM_URL . '=' . $forum_id . '&amp;' . POST_TOPIC_URL . '=' . $fetchposts[$i]['topic_id']), 'U_PRINT_TOPIC' => append_sid('printview.' . PHP_EXT . '?' . POST_FORUM_URL . '=' . $forum_id . '&amp;' . POST_TOPIC_URL . '=' . $fetchposts[$i]['topic_id'] . '&amp;start=0'), 'U_EMAIL_TOPIC' => append_sid('tellafriend.' . PHP_EXT . '?topic_title=' . urlencode(ip_utf8_decode($fetchposts[$i]['topic_title'])) . '&amp;topic_id=' . $fetchposts[$i]['topic_id'])));
         display_attachments($fetchposts[$i]['post_id'], 'articles_fp');
     } else {
         if (isset($_GET['kb']) && $_GET['kb'] == 'category') {
             $template->assign_block_vars('kb_list', array());
             $forum_id = request_var(POST_FORUM_URL, 0);
             // Mighty Gorgon: edited by JHL, I still need to check the impacts on the auth system
             //$fetchposts = $class_topics->fetch_posts($forum_id, 0, 0, false, false, false, false);
             $fetchposts = $class_topics->fetch_posts($forum_id, 0, 0);
             for ($i = 0; $i < sizeof($fetchposts); $i++) {
                 init_display_post_attachments($fetchposts[$i]['topic_attachment'], $fetchposts[$i], true, $block_id);
                 $template->assign_block_vars('kb_list.kb_articles', array('TOPIC_ID' => $fetchposts[$i]['topic_id'], 'TOPIC_TITLE' => $fetchposts[$i]['topic_title'], 'TOPIC_DESC' => $fetchposts[$i]['topic_desc'], 'POSTER' => $fetchposts[$i]['username'], 'POSTER_CG' => colorize_username($fetchposts[$i]['user_id'], $fetchposts[$i]['username'], $fetchposts[$i]['user_color'], $fetchposts[$i]['user_active']), 'TIME' => $fetchposts[$i]['topic_time'], 'REPLIES' => $fetchposts[$i]['topic_replies'], 'U_VIEW_ARTICLE' => append_sid($_SERVER['SCRIPT_NAME'] . '?kb=article&f=' . $forum_id . '&' . POST_TOPIC_URL . '=' . $fetchposts[$i]['topic_id'], true), 'U_VIEW_COMMENTS' => append_sid(CMS_PAGE_VIEWTOPIC . '?' . POST_FORUM_URL . '=' . $forum_id . '&amp;' . POST_TOPIC_URL . '=' . $fetchposts[$i]['topic_id'], true), 'U_POST_COMMENT' => append_sid('posting.' . PHP_EXT . '?mode=reply&amp;' . POST_FORUM_URL . '=' . $forum_id . '&amp;' . POST_TOPIC_URL . '=' . $fetchposts[$i]['topic_id']), 'U_PRINT_TOPIC' => append_sid('printview.' . PHP_EXT . '?' . POST_FORUM_URL . '=' . $forum_id . '&amp;' . POST_TOPIC_URL . '=' . $fetchposts[$i]['topic_id'] . '&amp;start=0'), 'U_EMAIL_TOPIC' => append_sid('tellafriend.' . PHP_EXT . '?topic_title=' . urlencode(ip_utf8_decode($fetchposts[$i]['topic_title'])) . '&amp;topic_id=' . $fetchposts[$i]['topic_id'])));
                 display_attachments($fetchposts[$i]['post_id'], 'articles_fp');
             }
             $template->assign_vars(array('KB_TITLE' => $lang['Kb_name']));
         } else {
             $template->assign_block_vars('cat_row', array());
             $sql = "SELECT * FROM " . CMS_NAV_MENU_TABLE . "\n\t\t\t\t\t\t\tWHERE menu_id = '" . intval($cms_config_vars['kb_cat_id'][$block_id]) . "'\n\t\t\t\t\t\t\tLIMIT 1";
             $result = $db->sql_query($sql, 0, 'cms_menu_', CMS_CACHE_FOLDER);
             //$row = $db->sql_fetchrow($result);
             while ($row = $db->sql_fetchrow($result)) {
                 break;
             }
             $db->sql_freeresult($result);
             if ($row['menu_name_lang'] != '' && isset($lang[$row['menu_name_lang']])) {
                 $main_menu_name = $lang[$row['menu_name_lang']];
             } else {
                 $main_menu_name = $row['menu_name'] != '' ? $row['menu_name'] : $lang['quick_links'];
             }
             $sql = "SELECT * FROM " . CMS_NAV_MENU_TABLE . "\n\t\t\t\t\t\t\tWHERE menu_parent_id = '" . intval($cms_config_vars['kb_cat_id'][$block_id]) . "'\n\t\t\t\t\t\t\tORDER BY cat_parent_id ASC, menu_order ASC";
             $result = $db->sql_query($sql, 0, 'cms_menu_', CMS_CACHE_FOLDER);
             $menu_cat = array();
             $cat_item = array();
             $menu_item = array();
             $auth_levels = $ip_cms->cms_auth_view();
             while ($menu_item = $db->sql_fetchrow($result)) {
                 if ($menu_item['cat_id'] > 0) {
                     $cat_item[$menu_item['cat_id']] = $menu_item;
                 }
                 if ($menu_item['cat_parent_id'] > 0) {
                     $menu_cat[$menu_item['cat_parent_id']][$menu_item['menu_item_id']] = $menu_item;
                 }
             }
             $db->sql_freeresult($result);
             foreach ($cat_item as $cat_item_data) {
                 if ($cat_item_data['menu_status'] == false) {
                     $cat_allowed = false;
                 } else {
                     $auth_level_req = $cat_item_data['auth_view'];
                     $cat_allowed = in_array($auth_level_req, $auth_levels) ? true : false;
                 }
                 if (!empty($cat_allowed)) {
                     //echo($cat_item_data['menu_name'] . '<br />');
                     $cat_id = $cat_item_data['cat_id'];
                     if ($cat_item_data['menu_name_lang'] != '' && isset($lang[$cat_item_data['menu_name_lang']])) {
                         $cat_name = $lang[$cat_item_data['menu_name_lang']];
                     } else {
                         $cat_name = $cat_item_data['menu_name'] != '' ? stripslashes($cat_item_data['menu_name']) : 'cat_item' . $cat_item_data['cat_id'];
                     }
                     $cat_icon = $cat_item_data['menu_icon'] != '' ? '<img src="' . $cat_item_data['menu_icon'] . '" alt="" title="' . $cat_name . '" style="vertical-align:middle;" />&nbsp;&nbsp;' : '<img src="' . $images['nav_menu_sep'] . '" alt="" title="" style="vertical-align:middle;" />&nbsp;&nbsp;';
                     //$cat_icon = (($cat_item_data['menu_icon'] != '') ? '<img src="' . $cat_item_data['menu_icon'] . '" alt="" title="' . $cat_name . '" style="vertical-align:middle;" />&nbsp;&nbsp;' : '&nbsp;');
                     if ($cat_item_data['menu_link'] != '') {
                         $cat_link = append_sid($cat_item_data['menu_link']);
                         if ($cat_item_data['menu_link_external'] == true) {
                             $cat_link .= '" target="_blank';
                         }
                     }
                     $template->assign_block_vars('cat_row', array('CAT_ID' => $cat_item_data['cat_id'], 'CAT_ITEM' => $cat_name, 'CAT_ICON' => $cat_icon));
                     foreach ($menu_cat[$cat_id] as $menu_cat_item_data) {
                         if ($menu_cat_item_data['menu_status'] == false) {
                             $menu_allowed = false;
                         } else {
                             $auth_level_req = $menu_cat_item_data['auth_view'];
                             $menu_allowed = in_array($auth_level_req, $auth_levels) ? true : false;
                         }
                         if (!empty($menu_allowed)) {
                             //echo($menu_cat_item_data['menu_name'] . '<br />');
                             if ($menu_cat_item_data['menu_name_lang'] != '' && isset($lang[$menu_cat_item_data['menu_name_lang']])) {
                                 $menu_name = $lang[$menu_cat_item_data['menu_name_lang']];
                             } else {
                                 $menu_name = $menu_cat_item_data['menu_name'] != '' ? stripslashes($menu_cat_item_data['menu_name']) : 'cat_item' . $menu_cat_item_data['cat_id'];
                             }
                             if ($menu_cat_item_data['menu_link_external'] == true) {
                                 $menu_link .= '" target="_blank';
                                 $menu_link = $menu_cat_item_data['menu_link'];
                             } else {
                                 $menu_link = append_sid($menu_cat_item_data['menu_link']);
                             }
                             $menu_icon = $menu_cat_item_data['menu_icon'] != '' ? '<img src="' . $menu_cat_item_data['menu_icon'] . '" alt="" title="' . $menu_name . '" style="vertical-align:middle;" />' : '<img src="' . $images['nav_menu_sep'] . '" alt="" title="" style="vertical-align:middle;" />';
                             $menu_desc = $menu_cat_item_data['menu_desc'];
                             $template->assign_block_vars('cat_row.menu_row', array('MENU_ITEM' => $menu_name, 'MENU_LINK' => $menu_link, 'MENU_ICON' => $menu_icon, 'MENU_DESC' => $menu_desc));
                         }
                     }
                 }
             }
             $template->assign_vars(array('KB_TITLE' => $lang['Kb_name']));
         }
     }
 }
Esempio n. 5
0
 function cms_block_forum_articles()
 {
     global $db, $cache, $config, $template, $images, $lang, $bbcode, $block_id, $cms_config_vars, $meta_content, $breadcrumbs;
     if (!class_exists('class_topics')) {
         include IP_ROOT_PATH . 'includes/class_topics.' . PHP_EXT;
     }
     $class_topics = new class_topics();
     @(include_once IP_ROOT_PATH . ATTACH_MOD_PATH . 'displaying.' . PHP_EXT);
     $template->_tpldata['articles_fa.'] = array();
     $index_file = !empty($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : getenv('SCRIPT_NAME');
     $index_file = htmlspecialchars(urldecode($index_file));
     while (substr($index_file, 0, 1) == '/') {
         $index_file = substr($index_file, 1);
     }
     if ($index_file == 'index.' . PHP_EXT) {
         $prefix = '?page=' . request_var('page', 0) . '&';
     } else {
         $prefix = '?';
     }
     $meta_content['page_title_clean'] = empty($meta_content['page_title_clean']) ? strip_tags($meta_content['page_title']) : $meta_content['page_title_clean'];
     $template->set_filenames(array('forum_articles_block' => 'blocks/forum_articles_block.tpl'));
     $title = empty($cms_config_vars['md_posts_title'][$block_id]) ? $meta_content['page_title_clean'] : htmlspecialchars_clean($cms_config_vars['md_posts_title'][$block_id]);
     $template->assign_vars(array('L_TITLE' => $title, 'L_POSTED' => $lang['Posted'], 'L_ANNOUNCEMENT' => $lang['Post_Announcement'], 'L_PRINT_NEWS' => $lang['News_Print'], 'L_EMAIL_NEWS' => $lang['News_Email'], 'NEWS_PRINT_IMG' => $images['news_print'], 'NEWS_EMAIL_IMG' => $images['news_email']));
     // $only_auth_view must have the opposite value of $cms_config_vars['md_ignore_auth_view'][$block_id]
     $only_auth_view = !empty($cms_config_vars['md_ignore_auth_view'][$block_id]) || $cms_config_vars['md_ignore_auth_view'][$block_id] == true ? false : true;
     $single_post_id = request_var('post_id', 0);
     if (!empty($single_post_id)) {
         $fetchposts = $class_topics->fetch_posts($single_post_id, 1, 0, false, 0, true, $only_auth_view);
         for ($i = 0; $i < sizeof($fetchposts); $i++) {
             init_display_post_attachments($fetchposts[$i]['topic_attachment'], $fetchposts[$i], true, $block_id);
             $topic_title = htmlspecialchars_clean($fetchposts[$i]['topic_title']);
             $topic_link = $index_file . $prefix . 'post_id=' . $single_post_id;
             $template->assign_block_vars('articles_fa', array('TOPIC_ID' => $fetchposts[$i]['topic_id'], 'FORUM_ID' => $fetchposts[$i]['forum_id'], 'TITLE' => $topic_title, 'POSTER' => $fetchposts[$i]['username'], 'POSTER_CG' => colorize_username($fetchposts[$i]['user_id'], $fetchposts[$i]['username'], $fetchposts[$i]['user_color'], $fetchposts[$i]['user_active']), 'TIME' => $fetchposts[$i]['topic_time'], 'VIEWS' => $fetchposts[$i]['topic_views'], 'TEXT' => $fetchposts[$i]['post_text'], 'U_PRINT_TOPIC' => append_sid('printview.' . PHP_EXT . '?' . POST_FORUM_URL . '=' . $fetchposts[$i]['forum_id'] . '&amp;' . POST_TOPIC_URL . '=' . $fetchposts[$i]['topic_id'] . '&amp;is_article=1'), 'U_EMAIL_TOPIC' => append_sid('tellafriend.' . PHP_EXT . '?topic_title=' . urlencode(ip_utf8_decode($fetchposts[$i]['topic_title'])) . '&amp;topic_url=' . urlencode(ip_utf8_decode($topic_link)))));
             display_attachments($fetchposts[$i]['post_id'], 'articles');
         }
         if ($cms_config_vars['md_posts_breadcrumbs'][$block_id]) {
             $meta_content['page_title_clean'] = empty($meta_content['page_title_clean']) ? strip_tags($meta_content['page_title']) : $meta_content['page_title_clean'];
             $breadcrumbs['address'] = '';
             if ($meta_content['page_title_clean'] != $config['sitename']) {
                 $index_url = $index_file;
                 if ($index_file == 'index.' . PHP_EXT) {
                     $index_url .= '?page=' . request_var('page', 0);
                 }
                 $breadcrumbs['address'] .= $lang['Nav_Separator'] . '<a href="' . append_sid($index_url) . '">' . $meta_content['page_title_clean'] . '</a>';
             }
             $breadcrumbs['address'] .= $lang['Nav_Separator'] . '<a href="#" class="nav-current">' . $topic_title . '</a>';
         }
     } else {
         $fetchposts = $class_topics->fetch_posts($cms_config_vars['md_posts_forum_id'][$block_id], $cms_config_vars['md_num_posts'][$block_id], -1, $cms_config_vars['md_posts_show_portal'][$block_id], $cms_config_vars['md_posts_random'][$block_id], false, $only_auth_view);
         for ($i = 0; $i < sizeof($fetchposts); $i++) {
             // Convert and clean special chars!
             $topic_title = htmlspecialchars_clean($fetchposts[$i]['topic_title']);
             $template->assign_block_vars('articles_fa', array('TOPIC_ID' => $fetchposts[$i]['topic_id'], 'FORUM_ID' => $fetchposts[$i]['forum_id'], 'TITLE' => $topic_title, 'POSTER' => $fetchposts[$i]['username'], 'POSTER_CG' => colorize_username($fetchposts[$i]['user_id'], $fetchposts[$i]['username'], $fetchposts[$i]['user_color'], $fetchposts[$i]['user_active']), 'TIME' => $fetchposts[$i]['topic_time'], 'VIEWS' => $fetchposts[$i]['topic_views'], 'U_VIEW_TOPIC' => append_sid($index_file . $prefix . 'post_id=' . $fetchposts[$i]['topic_first_post_id'])));
         }
         $template->assign_vars(array('IS_LIST' => true, 'L_TOPICS' => $lang['Topics'], 'L_AUTHOR' => $lang['Author'], 'L_VIEWS' => $lang['Views']));
         if ($cms_config_vars['md_posts_breadcrumbs'][$block_id]) {
             $breadcrumbs['address'] = '';
             if ($meta_content['page_title_clean'] != $config['sitename']) {
                 $breadcrumbs['address'] .= $lang['Nav_Separator'] . '<a href="#" class="nav-current">' . $meta_content['page_title_clean'] . '</a>';
             }
         }
     }
 }