示例#1
0
 /**
  * Standard modular run function for award hooks. Renders a content box for an award/randomisation.
  *
  * @param  array		The database row for the content
  * @param  ID_TEXT	The zone to display in
  * @return tempcode	Results
  */
 function run($row, $zone)
 {
     $url = build_url(array('page' => 'news', 'type' => 'view', 'id' => $row['id']), $zone);
     $title = get_translated_tempcode($row['title']);
     $title_plain = get_translated_text($row['title']);
     $news_cat_rows = $GLOBALS['SITE_DB']->query_select('news_categories', array('nc_title', 'nc_img'), array('id' => $row['news_category']), '', 1);
     if (!array_key_exists(0, $news_cat_rows)) {
         warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
     }
     $news_cat_row = $news_cat_rows[0];
     $category = get_translated_text($news_cat_row['nc_title']);
     $img = find_theme_image($news_cat_row['nc_img']);
     if ($row['news_image'] != '') {
         $img = $row['news_image'];
         if (url_is_local($img)) {
             $img = get_base_url() . '/' . $img;
         }
     }
     $news = get_translated_tempcode($row['news']);
     if ($news->is_empty()) {
         $news = get_translated_tempcode($row['news_article']);
         $truncate = true;
     } else {
         $truncate = false;
     }
     $author_url = addon_installed('authors') ? build_url(array('page' => 'authors', 'type' => 'misc', 'id' => $row['author']), get_module_zone('authors')) : new ocp_tempcode();
     $author = $row['author'];
     require_css('news');
     $seo_bits = seo_meta_get_for('news', strval($row['id']));
     $map = array('_GUID' => 'jd89f893jlkj9832gr3uyg2u', 'TAGS' => get_loaded_tags('news', explode(',', $seo_bits[0])), 'TRUNCATE' => $truncate, 'AUTHOR' => $author, 'BLOG' => false, 'AUTHOR_URL' => $author_url, 'CATEGORY' => $category, 'IMG' => $img, 'NEWS' => $news, 'ID' => strval($row['id']), 'SUBMITTER' => strval($row['submitter']), 'DATE' => get_timezoned_date($row['date_and_time']), 'DATE_RAW' => strval($row['date_and_time']), 'FULL_URL' => $url, 'NEWS_TITLE' => $title, 'NEWS_TITLE_PLAIN' => $title_plain);
     if (get_option('is_on_comments') == '1' && !has_no_forum() && $row['allow_comments'] >= 1) {
         $map['COMMENT_COUNT'] = '1';
     }
     return put_in_standard_box(do_template('NEWS_PIECE_SUMMARY', $map));
 }
示例#2
0
 /**
  * Standard modular run function for blocks in the setup wizard.
  *
  * @return array		Map of block names, to display types.
  */
 function get_blocks()
 {
     if (!addon_installed('forum_blocks')) {
         return array();
     }
     if (!has_no_forum()) {
         return array(array('main_forum_news' => array('NO', 'NO'), 'main_forum_topics' => array('YES', 'NO')), array('side_forum_news' => array('PANEL_NONE', 'PANEL_NONE'), 'side_users_online' => array('PANEL_LEFT', 'PANEL_RIGHT')));
     }
     return array(array(), array());
 }
示例#3
0
 /**
  * Standard modular run function.
  *
  * @return array		An array of tuples: The task row to show, the number of seconds until it is due (or NULL if not on a timer), the number of things to sort out (or NULL if not on a queue), The name of the config option that controls the schedule (or NULL if no option).
  */
 function run()
 {
     // Forum moderation
     if (!has_no_forum()) {
         $status = do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM_STATUS_NA');
         if (get_forum_type() == 'ocf') {
             $url = build_url(array('page' => 'vforums', 'type' => 'unread'), get_module_zone('vforums'));
         } else {
             $url = make_string_tempcode(get_forum_base_url());
         }
         $tpl = do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM', array('_GUID' => 'a2cdfc2ea5db2d8c13a4d9eafa9b644b', 'URL' => '', 'STATUS' => $status, 'TASK' => urlise_lang(do_lang('NAG_FORUMS'), $url), 'INFO' => ''));
         return array(array($tpl, NULL, NULL, NULL));
     }
     return array();
 }
示例#4
0
 /**
  * Standard modular run function.
  *
  * @return tempcode	The result of execution.
  */
 function run()
 {
     if (get_forum_type() != 'none') {
         $bits = new ocp_tempcode();
         if (get_option('forum_show_stats_count_members', true) == '1') {
             $bits->attach(do_template('BLOCK_SIDE_STATS_SUBLINE', array('_GUID' => 'a2dbcdec813d5a5edbb416bf087b4a97', 'KEY' => do_lang_tempcode('COUNT_MEMBERS'), 'VALUE' => integer_format($GLOBALS['FORUM_DRIVER']->get_members()))));
         }
         if (get_forum_type() == 'ocf') {
             if (get_option('forum_show_stats_count_members_new_today', true) == '1') {
                 $bits->attach(do_template('BLOCK_SIDE_STATS_SUBLINE', array('_GUID' => 'fd2e149f6921836e3c2ea1039644e2e7', 'KEY' => do_lang_tempcode('MEMBERS_NEW_TODAY'), 'VALUE' => integer_format($GLOBALS['FORUM_DB']->query_value_null_ok_full('SELECT COUNT(*) FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_members WHERE m_join_time>' . strval(time() - 60 * 60 * 24))))));
             }
             if (get_option('forum_show_stats_count_members_new_this_week', true) == '1') {
                 $bits->attach(do_template('BLOCK_SIDE_STATS_SUBLINE', array('_GUID' => '10128b288dec4a578517de75cc9e404d', 'KEY' => do_lang_tempcode('MEMBERS_NEW_THIS_WEEK'), 'VALUE' => integer_format($GLOBALS['FORUM_DB']->query_value_null_ok_full('SELECT COUNT(*) FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_members WHERE m_join_time>' . strval(time() - 60 * 60 * 24 * 7))))));
             }
             if (get_option('forum_show_stats_count_members_new_this_month', true) == '1') {
                 $bits->attach(do_template('BLOCK_SIDE_STATS_SUBLINE', array('_GUID' => 'b2dbcdec813d5a5edbb416bf087b4a97', 'KEY' => do_lang_tempcode('MEMBERS_NEW_THIS_MONTH'), 'VALUE' => integer_format($GLOBALS['FORUM_DB']->query_value_null_ok_full('SELECT COUNT(*) FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_members WHERE m_join_time>' . strval(time() - 60 * 60 * 24 * 31))))));
             }
             if (get_option('forum_show_stats_count_members_active_today', true) == '1') {
                 $bits->attach(do_template('BLOCK_SIDE_STATS_SUBLINE', array('_GUID' => 'cc9760b2ed9e985e96b53c91c511e84e', 'KEY' => do_lang_tempcode('MEMBERS_ACTIVE_TODAY'), 'VALUE' => integer_format($GLOBALS['FORUM_DB']->query_value_null_ok_full('SELECT COUNT(*) FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_members WHERE m_last_visit_time>' . strval(time() - 60 * 60 * 24))))));
             }
             if (get_option('forum_show_stats_count_members_active_this_week', true) == '1') {
                 $bits->attach(do_template('BLOCK_SIDE_STATS_SUBLINE', array('_GUID' => 'dc9760b2ed9e985e96b53c91c511e84e', 'KEY' => do_lang_tempcode('MEMBERS_ACTIVE_THIS_WEEK'), 'VALUE' => integer_format($GLOBALS['FORUM_DB']->query_value_null_ok_full('SELECT COUNT(*) FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_members WHERE m_last_visit_time>' . strval(time() - 60 * 60 * 24 * 7))))));
             }
             if (get_option('forum_show_stats_count_members_active_this_month', true) == '1') {
                 $bits->attach(do_template('BLOCK_SIDE_STATS_SUBLINE', array('_GUID' => 'ec9760b2ed9e985e96b53c91c511e84e', 'KEY' => do_lang_tempcode('MEMBERS_ACTIVE_THIS_MONTH'), 'VALUE' => integer_format($GLOBALS['FORUM_DB']->query_value_null_ok_full('SELECT COUNT(*) FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_members WHERE m_last_visit_time>' . strval(time() - 60 * 60 * 24 * 31))))));
             }
         }
         if (!has_no_forum()) {
             if (get_option('forum_show_stats_count_topics', true) == '1') {
                 $bits->attach(do_template('BLOCK_SIDE_STATS_SUBLINE', array('_GUID' => '2e0fe7ccbb15052743c94aab6a3654bc', 'KEY' => do_lang_tempcode('COUNT_TOPICS'), 'VALUE' => integer_format($GLOBALS['FORUM_DRIVER']->get_topics()))));
             }
             if (get_option('forum_show_stats_count_posts', true) == '1') {
                 $bits->attach(do_template('BLOCK_SIDE_STATS_SUBLINE', array('_GUID' => 'de7e97b855cfbc4d60d069ca3f652b17', 'KEY' => do_lang_tempcode('COUNT_POSTS'), 'VALUE' => integer_format($GLOBALS['FORUM_DRIVER']->get_num_forum_posts()))));
             }
             if (get_option('forum_show_stats_count_posts_today', true) == '1') {
                 $bits->attach(do_template('BLOCK_SIDE_STATS_SUBLINE', array('_GUID' => '8649eee4a70ce0383c5534da43e2b58c', 'KEY' => do_lang_tempcode('COUNT_POSTSTODAY'), 'VALUE' => integer_format($GLOBALS['FORUM_DRIVER']->get_num_new_forum_posts()))));
             }
         }
         if ($bits->is_empty()) {
             return new ocp_tempcode();
         }
         $forums = do_template('BLOCK_SIDE_STATS_SECTION', array('_GUID' => '52cd616760efe17adcec4b97e1305301', 'SECTION' => do_lang_tempcode('FORUM_SLASH_COMMUNITY'), 'CONTENT' => $bits));
     } else {
         $forums = new ocp_tempcode();
     }
     return $forums;
 }
示例#5
0
 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     if (has_no_forum()) {
         return new ocp_tempcode();
     }
     $limit = array_key_exists('param', $map) ? intval($map['param']) : 6;
     $forum_name = array_key_exists('forum', $map) ? $map['forum'] : do_lang('NEWS');
     $date_key = array_key_exists('date_key', $map) ? $map['date_key'] : 'lasttime';
     $forum_ids = array();
     $forum_names = explode(',', $forum_name);
     foreach ($forum_names as $forum_name) {
         $forum_name = trim($forum_name);
         $forum_id = is_numeric($forum_name) ? intval($forum_name) : $GLOBALS['FORUM_DRIVER']->forum_id_from_name($forum_name);
         if ($forum_name == '<announce>') {
             $forum_id = NULL;
             $forum_ids[$forum_id] = $forum_name;
         } else {
             $forum_id = is_numeric($forum_name) ? intval($forum_name) : $GLOBALS['FORUM_DRIVER']->forum_id_from_name($forum_name);
         }
         if (!is_null($forum_id)) {
             $forum_ids[$forum_id] = $forum_name;
         }
     }
     if (!has_no_forum()) {
         $max_rows = 0;
         $topics = $GLOBALS['FORUM_DRIVER']->show_forum_topics($forum_ids, $limit, 0, $max_rows, '', false, $date_key);
         $out = new ocp_tempcode();
         $_postdetailss = array();
         if (!is_null($topics)) {
             global $M_SORT_KEY;
             $M_SORT_KEY = $date_key;
             usort($topics, 'multi_sort');
             $topics = array_reverse($topics, false);
             foreach ($topics as $topic) {
                 $topic_url = $GLOBALS['FORUM_DRIVER']->topic_url($topic['id'], $forum_name);
                 $title = $topic['title'];
                 $date = get_timezoned_date($topic[$date_key], false);
                 //				$username=$topic['lastusername'];
                 $_postdetailss[] = array('DATE' => $date, 'FULL_URL' => $topic_url, 'NEWS_TITLE' => escape_html($title));
             }
         }
         return do_template('BLOCK_BOTTOM_NEWS', array('_GUID' => '04d5390309dcba1f17391e9928da0d56', 'POSTS' => $_postdetailss));
     } else {
         return new ocp_tempcode();
     }
 }
示例#6
0
 /**
  * Standard modular run function.
  *
  * @return tempcode	The result of execution.
  */
 function run()
 {
     if (has_no_forum()) {
         warn_exit(do_lang_tempcode('NO_FORUM_INSTALLED'));
     }
     $GLOBALS['HELPER_PANEL_PIC'] = 'pagepics/messaging';
     $GLOBALS['HELPER_PANEL_TUTORIAL'] = 'tut_support_desk';
     require_lang('messaging');
     $type = get_param('type', 'misc');
     if ($type == 'misc') {
         return $this->choose_message();
     }
     if ($type == 'view') {
         return $this->view_message();
     }
     if ($type == 'take') {
         return $this->take_responsibility();
     }
     return new ocp_tempcode();
 }
 /**
  * Gets the default value for the config option.
  *
  * @return ?string		The default value (NULL: option is disabled)
  */
 function get_default()
 {
     return has_no_forum() ? NULL : do_lang('COMMENT_FORUM_NAME', '', '', '', get_site_default_lang());
 }
示例#8
0
/**
 * Show an actual poll block.
 *
 * @param  boolean			Whether to show results (if we've already voted, this'll be overrided)
 * @param  array				The poll row
 * @param  ID_TEXT			The zone our poll module is in
 * @return tempcode			The block
 */
function show_poll($results, $myrow, $zone)
{
    $ip = get_ip_address();
    if (!may_vote_in_poll($myrow)) {
        $results = true;
    }
    // Count our total votes
    $num_options = $myrow['num_options'];
    $totalvotes = 0;
    for ($i = 1; $i <= $num_options; $i++) {
        if (!array_key_exists('votes' . strval($i), $myrow)) {
            $myrow['votes' . strval($i)] = 0;
        }
        $totalvotes += $myrow['votes' . strval($i)];
    }
    // Sort by results
    $orderings = array();
    for ($i = 1; $i <= $num_options; $i++) {
        $orderings[$i] = $myrow['votes' . strval($i)];
    }
    if ($results) {
        asort($orderings);
    }
    if (running_script('poll')) {
        $keep = symbol_tempcode('KEEP');
        $vote_url = find_script('poll') . '?poll_id=' . strval($myrow['id']) . '&show_poll_results_' . strval($myrow['id']) . '=1&param=' . urlencode(strval($myrow['id'])) . '&zone=' . urlencode(get_param('zone', get_module_zone('polls'))) . $keep->evaluate();
        if (get_param_integer('in_panel', 0) == 1) {
            $vote_url .= '&in_panel=1';
        }
        if (get_param_integer('interlock', 0) == 1) {
            $vote_url .= '&interlock=1';
        }
        $result_url = $results ? '' : $vote_url;
    } else {
        $poll_results = 'show_poll_results_' . strval($myrow['id']);
        $vote_url = get_self_url(false, true, array('poll_id' => $myrow['id'], $poll_results => 1, 'utheme' => NULL));
        $result_url = $results ? '' : get_self_url(false, true, array($poll_results => 1, 'utheme' => NULL));
    }
    if (get_param('utheme', '') != '') {
        if (is_object($result_url)) {
            if (!$result_url->is_empty()) {
                $result_url->attach('&utheme=' . get_param('utheme'));
            }
        } else {
            if ($result_url != '') {
                $result_url .= '&utheme=' . get_param('utheme');
            }
        }
        if (is_object($vote_url)) {
            if (!$vote_url->is_empty()) {
                $vote_url->attach('&utheme=' . get_param('utheme'));
            }
        } else {
            if ($vote_url != '') {
                $vote_url .= '&utheme=' . get_param('utheme');
            }
        }
    }
    // Our questions templated
    $tpl = new ocp_tempcode();
    for ($i = 1; $i <= $num_options; $i++) {
        $answer = get_translated_tempcode($myrow['option' . strval($i)]);
        $answer_plain = get_translated_text($myrow['option' . strval($i)]);
        if (!$results) {
            $tpl->attach(do_template('POLL_ANSWER', array('_GUID' => 'bc9c2e818f2e7031075d8d7b01d79cd5', 'PID' => strval($myrow['id']), 'I' => strval($i), 'CAST' => strval($i), 'VOTE_URL' => $vote_url, 'ANSWER' => $answer, 'ANSWER_PLAIN' => $answer_plain)));
        } else {
            $votes = $myrow['votes' . strval($i)];
            if (!is_numeric($votes)) {
                $votes = 0;
            }
            if ($totalvotes != 0) {
                $width = intval(round(70.0 * floatval($votes) / floatval($totalvotes)));
            } else {
                $width = 0;
            }
            $tpl->attach(do_template('POLL_ANSWER_RESULT', array('_GUID' => '887ea0ed090c48305eb84500865e5178', 'PID' => strval($myrow['id']), 'I' => strval($i), 'VOTE_URL' => $vote_url, 'ANSWER' => $answer, 'ANSWER_PLAIN' => $answer_plain, 'WIDTH' => strval($width), 'VOTES' => integer_format($votes))));
        }
    }
    if (has_actual_page_access(NULL, 'cms_polls', NULL, NULL) && has_submit_permission('mid', get_member(), get_ip_address(), 'cms_polls')) {
        $submit_url = build_url(array('page' => 'cms_polls', 'type' => 'ad', 'redirect' => running_script('index') ? get_self_url(true, true, array()) : NULL), get_module_zone('cms_polls'));
    } else {
        $submit_url = new ocp_tempcode();
    }
    // Do our final template
    $question = get_translated_tempcode($myrow['question']);
    $question_plain = get_translated_text($myrow['question']);
    $archive_url = build_url(array('page' => 'polls', 'type' => 'misc'), $zone);
    $full_url = new ocp_tempcode();
    if (get_page_name() != 'polls' || get_param('type', '') != 'view') {
        $full_url = build_url(array('page' => 'polls', 'type' => 'view', 'id' => $myrow['id']), $zone);
    }
    $map2 = array('_GUID' => '4c6b026f7ed96f0b5b8408eb5e5affb5', 'VOTE_URL' => $vote_url, 'SUBMITTER' => strval($myrow['submitter']), 'PID' => strval($myrow['id']), 'FULL_URL' => $full_url, 'CONTENT' => $tpl, 'QUESTION' => $question, 'QUESTION_PLAIN' => $question_plain, 'SUBMIT_URL' => $submit_url, 'ARCHIVE_URL' => $archive_url, 'RESULT_URL' => $result_url, 'ZONE' => $zone);
    if (get_option('is_on_comments') == '1' && !has_no_forum() && $myrow['allow_comments'] >= 1) {
        $map2['COMMENT_COUNT'] = '1';
    }
    return do_template('POLL', $map2);
}
示例#9
0
 /**
  * Standard modular render function for profile tab hooks.
  *
  * @param  MEMBER			The ID of the member who is being viewed
  * @param  MEMBER			The ID of the member who is doing the viewing
  * @param  boolean		Whether to leave the tab contents NULL, if tis hook supports it, so that AJAX can load it later
  * @return array			A triple: The tab title, the tab contents, the suggested tab order
  */
 function render_tab($member_id_of, $member_id_viewing, $leave_to_ajax_if_possible = false)
 {
     require_lang('news');
     $title = do_lang_tempcode('BLOG');
     $order = 50;
     if ($leave_to_ajax_if_possible) {
         return array($title, NULL, $order);
     }
     require_css('news');
     $max_rows = 0;
     $max = get_param_integer('blogs_max', 5);
     $start = get_param_integer('blogs_start', 0);
     // Show recent blog posts
     $recent_blog_posts = new ocp_tempcode();
     $rss_url = new ocp_tempcode();
     $news_cat = $GLOBALS['SITE_DB']->query_select('news_categories', array('*'), array('nc_owner' => $member_id_of), '', 1);
     if (array_key_exists(0, $news_cat) && has_category_access($member_id_viewing, 'news', strval($news_cat[0]['id']))) {
         $rss_url = make_string_tempcode(find_script('backend') . '?type=rss2&mode=news&filter=' . strval($news_cat[0]['id']));
         // How many results? (not 100% accurate, if a news item is in a primary cat and same secondary cat)
         $max_rows += $GLOBALS['SITE_DB']->query_value('news', 'COUNT(*)', array('news_category' => $news_cat[0]['id']));
         $max_rows += $GLOBALS['SITE_DB']->query_value('news n LEFT JOIN ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'news_category_entries c ON n.id=c.news_entry', 'COUNT(*)', array('news_category' => $news_cat[0]['id']));
         // Fetch and sort
         $news1 = $GLOBALS['SITE_DB']->query_select('news', array('*'), array('news_category' => $news_cat[0]['id']), 'ORDER BY date_and_time DESC', $max + $start);
         $news2 = $GLOBALS['SITE_DB']->query_select('news n LEFT JOIN ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'news_category_entries c ON n.id=c.news_entry', array('n.*'), array('news_category' => $news_cat[0]['id']), 'ORDER BY date_and_time DESC', $max + $start);
         $news = array();
         foreach ($news1 as $row) {
             $news[$row['id']] = $row;
         }
         foreach ($news2 as $row) {
             $news[$row['id']] = $row;
         }
         unset($news1);
         unset($news2);
         global $M_SORT_KEY;
         $M_SORT_KEY = 'date_and_time';
         usort($news, 'multi_sort');
         $news = array_reverse($news);
         // Output
         $done = 0;
         foreach ($news as $i => $myrow) {
             if ($i < $start) {
                 continue;
             }
             if ($done == $max) {
                 break;
             }
             $news_id = $myrow['id'];
             $news_date = get_timezoned_date($myrow['date_and_time']);
             $author_url = '';
             $author = $myrow['author'];
             $news_title = get_translated_tempcode($myrow['title']);
             $news_summary = get_translated_tempcode($myrow['news']);
             if ($news_summary->is_empty()) {
                 $news_summary = get_translated_tempcode($myrow['news_article']);
                 $truncate = true;
             } else {
                 $truncate = false;
             }
             $news_full_url = build_url(array('page' => 'news', 'type' => 'view', 'id' => $news_id, 'filter' => $news_cat[0]['id'], 'blog' => 1), get_module_zone('news'));
             $news_img = find_theme_image($news_cat[0]['nc_img']);
             if (is_null($news_img)) {
                 $news_img = '';
             }
             if ($myrow['news_image'] != '') {
                 $news_img = $myrow['news_image'];
                 if (url_is_local($news_img)) {
                     $news_img = get_custom_base_url() . '/' . $news_img;
                 }
             }
             $news_category = get_translated_text($news_cat[0]['nc_title']);
             $seo_bits = seo_meta_get_for('news', strval($news_id));
             $map2 = array('TAGS' => get_loaded_tags('news', explode(',', $seo_bits[0])), 'TRUNCATE' => $truncate, 'BLOG' => false, 'ID' => strval($news_id), 'SUBMITTER' => strval($myrow['submitter']), 'CATEGORY' => $news_category, 'IMG' => $news_img, 'DATE' => $news_date, 'DATE_RAW' => strval($myrow['date_and_time']), 'NEWS_TITLE' => $news_title, 'AUTHOR' => $author, 'AUTHOR_URL' => $author_url, 'NEWS' => $news_summary, 'FULL_URL' => $news_full_url);
             if (get_option('is_on_comments') == '1' && !has_no_forum() && $myrow['allow_comments'] >= 1) {
                 $map2['COMMENT_COUNT'] = '1';
             }
             $recent_blog_posts->attach(do_template('NEWS_PIECE_SUMMARY', $map2));
             $done++;
         }
     }
     // Add link
     if ($member_id_of == $member_id_viewing) {
         $add_blog_post_url = build_url(array('page' => 'cms_blogs', 'type' => 'ad'), get_module_zone('cms_blogs'));
     } else {
         $add_blog_post_url = new ocp_tempcode();
     }
     // Pagination
     require_code('templates_results_browser');
     $results_browser = results_browser(do_lang_tempcode('BLOGS_POSTS'), NULL, $start, 'blogs_start', $max, 'blogs_max', $max_rows, NULL, 'view', true, false, 7, NULL, 'tab__blog');
     // Wrap it all up
     $content = do_template('OCF_MEMBER_PROFILE_BLOG', array('RESULTS_BROWSER' => $results_browser, 'RSS_URL' => $rss_url, 'ADD_BLOG_POST_URL' => $add_blog_post_url, 'MEMBER_ID' => strval($member_id_of), 'RECENT_BLOG_POSTS' => $recent_blog_posts));
     return array($title, $content, $order);
 }
示例#10
0
 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     require_code('feedback');
     require_javascript('javascript_validation');
     $is_occle_talking = ocp_srv('HTTP_USER_AGENT') == 'ocPortal' && ocp_srv('HTTP_HOST') == 'ocportal.com';
     $self_url = get_self_url();
     $self_title = get_page_name();
     $type = 'block_main_feedback';
     $id = array_key_exists('param', $map) ? $map['param'] : '';
     $out = new ocp_tempcode();
     if (post_param_integer('_comment_form_post', 0) == 1) {
         if (!has_no_forum()) {
             $hidden = actualise_post_comment(true, $type, $id, $self_url, $self_title, array_key_exists('forum', $map) ? $map['forum'] : NULL, $is_occle_talking || get_option('captcha_on_feedback') == '0', 1, false, true, true);
             if (array_key_exists('title', $_POST)) {
                 $redirect = get_param('redirect', NULL);
                 if (!is_null($redirect)) {
                     $redirect_screen = redirect_screen(get_page_title('_FEEDBACK'), $redirect, do_lang_tempcode('FEEDBACK_THANKYOU'));
                     @ob_end_clean();
                     $echo = globalise($redirect_screen, NULL, '', true);
                     $echo->evaluate_echo();
                     exit;
                 } else {
                     attach_message(do_lang_tempcode('SUCCESS'), 'inform');
                 }
             }
         } else {
             $post = post_param('post', '');
             $title = post_param('title', '');
             if ($post != '') {
                 require_code('notifications');
                 dispatch_notification('new_feedback', $type, do_lang('NEW_FEEDBACK_SUBJECT', $title, NULL, NULL, get_site_default_lang()), do_lang('NEW_FEEDBACK_MESSAGE', $post, NULL, NULL, get_site_default_lang()));
                 $email_from = trim(post_param('email', $GLOBALS['FORUM_DRIVER']->get_member_email_address(get_member())));
                 if ($email_from != '') {
                     require_code('mail');
                     mail_wrap(do_lang('YOUR_MESSAGE_WAS_SENT_SUBJECT', $title), do_lang('YOUR_MESSAGE_WAS_SENT_BODY', $post), array($email_from), NULL, '', '', 3, NULL, false, get_member());
                 }
             }
         }
     }
     // Comment posts
     $forum = get_option('comments_forum_name');
     $count = 0;
     $_comments = $GLOBALS['FORUM_DRIVER']->get_forum_topic_posts($GLOBALS['FORUM_DRIVER']->find_topic_id_for_topic_identifier($forum, $type . '_' . $id), $count);
     if ($_comments !== -1) {
         $em = $GLOBALS['FORUM_DRIVER']->get_emoticon_chooser();
         require_javascript('javascript_editing');
         $comcode_help = build_url(array('page' => 'userguide_comcode'), get_comcode_zone('userguide_comcode', false));
         require_javascript('javascript_validation');
         $comment_url = get_self_url();
         if (addon_installed('captcha')) {
             require_code('captcha');
             $use_captcha = !$is_occle_talking && get_option('captcha_on_feedback') == '1' && use_captcha();
             if ($use_captcha) {
                 generate_captcha();
             }
         } else {
             $use_captcha = false;
         }
         $comment_details = do_template('COMMENTS_POSTING_FORM', array('_GUID' => '4ca32620f3eb68d9cc820b18265792d7', 'JOIN_BITS' => '', 'FIRST_POST_URL' => '', 'FIRST_POST' => '', 'USE_CAPTCHA' => $use_captcha, 'POST_WARNING' => get_param('post_warning', ''), 'COMMENT_TEXT' => '', 'GET_EMAIL' => false, 'EMAIL_OPTIONAL' => true, 'GET_TITLE' => true, 'EM' => $em, 'DISPLAY' => 'block', 'COMMENT_URL' => $comment_url, 'TITLE' => do_lang_tempcode('FEEDBACK')));
     } else {
         $comment_details = new ocp_tempcode();
     }
     $out->attach($comment_details);
     return $out;
 }
示例#11
0
 /**
  * Standard modular render function for profile tab hooks.
  *
  * @param  MEMBER			The ID of the member who is being viewed
  * @param  MEMBER			The ID of the member who is doing the viewing
  * @param  boolean		Whether to leave the tab contents NULL, if tis hook supports it, so that AJAX can load it later
  * @return array			A triple: The tab title, the tab contents, the suggested tab order
  */
 function render_tab($member_id_of, $member_id_viewing, $leave_to_ajax_if_possible = false)
 {
     $title = do_lang_tempcode('FORUM_POSTS');
     $order = 20;
     if ($leave_to_ajax_if_possible) {
         return array($title, NULL, $order);
     }
     require_code('ocf_topics');
     require_code('ocf_general');
     require_lang('ocf');
     $topics = new ocp_tempcode();
     if (!has_no_forum()) {
         require_code('ocf_forumview');
         global $NON_CANONICAL_PARAMS;
         $NON_CANONICAL_PARAMS[] = 'post_start';
         $NON_CANONICAL_PARAMS[] = 'post_max';
         // Last 15 topics that member contributed to
         $n = get_param_integer('post_max', 10);
         $start = get_param_integer('post_start', 0);
         $forum1 = NULL;
         //$GLOBALS['FORUM_DRIVER']->forum_id_from_name(get_option('comments_forum_name'));
         $tf = get_option('ticket_forum_name', true);
         if (!is_null($tf)) {
             $forum2 = $GLOBALS['FORUM_DRIVER']->forum_id_from_name($tf);
         } else {
             $forum2 = NULL;
         }
         $where_more = '';
         if (!is_null($forum1)) {
             $where_more .= ' AND p_cache_forum_id<>' . strval((int) $forum1);
         }
         if (!is_null($forum2)) {
             $where_more .= ' AND p_cache_forum_id<>' . strval((int) $forum2);
         }
         $rows = $GLOBALS['FORUM_DB']->query('SELECT DISTINCT p_topic_id FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_posts WHERE p_poster=' . strval((int) $member_id_of) . $where_more . ' ORDER BY p_time DESC', $n, $start);
         if (count($rows) != 0) {
             $max_rows = $GLOBALS['FORUM_DB']->query_value_null_ok_full('SELECT COUNT(DISTINCT p_topic_id) FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_posts WHERE p_poster=' . strval((int) $member_id_of) . $where_more);
             $where = '';
             foreach ($rows as $row) {
                 if ($where != '') {
                     $where .= ' OR ';
                 }
                 $where .= 't.id=' . strval((int) $row['p_topic_id']);
             }
             $topic_rows = $GLOBALS['FORUM_DB']->query('SELECT t.*,lan.text_parsed AS _trans_post,l_time FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_topics t LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_read_logs l ON (t.id=l.l_topic_id AND l.l_member_id=' . strval((int) get_member()) . ') LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'translate lan ON t.t_cache_first_post=lan.id WHERE ' . $where);
             $topic_rows_map = array();
             foreach ($topic_rows as $topic_row) {
                 if (has_category_access(get_member(), 'forums', strval($topic_row['t_forum_id']))) {
                     $topic_rows_map[$topic_row['id']] = $topic_row;
                 }
             }
             $hot_topic_definition = intval(get_option('hot_topic_definition'));
             foreach ($rows as $row) {
                 if (array_key_exists($row['p_topic_id'], $topic_rows_map)) {
                     $topics->attach(ocf_render_topic(ocf_get_topic_array($topic_rows_map[$row['p_topic_id']], get_member(), $hot_topic_definition, true), false));
                 }
             }
             if (!$topics->is_empty()) {
                 $forum_name = do_lang_tempcode('TOPICS_PARTICIPATED_IN', integer_format($start + 1) . '-' . integer_format($start + $n));
                 $marker = '';
                 $tree = new ocp_tempcode();
                 require_code('templates_results_browser');
                 $results_browser = results_browser(do_lang_tempcode('FORUM_TOPICS'), NULL, $start, 'post_start', $n, 'post_max', $max_rows, NULL, 'view', true, false, 7, NULL, 'tab__posts');
                 $topics = do_template('OCF_FORUM_TOPIC_WRAPPER', array('_GUID' => '8723270b128b4eea47ab3c756b342e14', 'ORDER' => '', 'MAX' => '15', 'MAY_CHANGE_MAX' => false, 'TREE' => $tree, 'ACTION_URL' => get_self_url(), 'BUTTONS' => '', 'STARTER_TITLE' => '', 'MARKER' => $marker, 'FORUM_NAME' => $forum_name, 'TOPICS' => $topics, 'RESULTS_BROWSER' => $results_browser, 'MODERATOR_ACTIONS' => ''));
             }
         }
     }
     $content = do_template('OCF_MEMBER_PROFILE_POSTS', array('MEMBER_ID' => strval($member_id_of), 'TOPICS' => $topics));
     return array($title, $content, $order);
 }
 /**
  * Gets the default value for the config option.
  *
  * @return ?string		The default value (NULL: option is disabled)
  */
 function get_default()
 {
     return has_no_forum() || get_forum_type() != 'ocf' ? NULL : '0';
 }
示例#13
0
 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     unset($map);
     require_css('side_blocks');
     $member = get_member();
     $forum = get_forum_type();
     $content = new ocp_tempcode();
     $links = new ocp_tempcode();
     if (!is_guest()) {
         // Admins can jump user
         $has_su = get_option('ocp_show_su') == '1' && has_specific_permission(get_member(), 'assume_any_member');
         $staff_actions = new ocp_tempcode();
         $username = $GLOBALS['FORUM_DRIVER']->get_username(get_member());
         if ($forum != 'none') {
             if (!has_no_forum() && get_option('forum_show_personal_stats_posts') == '1') {
                 // Post count
                 $content->attach(do_template('BLOCK_SIDE_PERSONAL_STATS_LINE', array('_GUID' => '371dfee46e8c40b1b109e0350055f8cc', 'KEY' => do_lang_tempcode('COUNT_POSTSCOUNT'), 'VALUE' => integer_format($GLOBALS['FORUM_DRIVER']->get_post_count($member)))));
             }
             if (!has_no_forum() && get_option('forum_show_personal_stats_topics') == '1') {
                 // Topic count
                 $content->attach(do_template('BLOCK_SIDE_PERSONAL_STATS_LINE', array('KEY' => do_lang_tempcode('COUNT_TOPICSCOUNT'), 'VALUE' => integer_format($GLOBALS['FORUM_DRIVER']->get_topic_count($member)))));
             }
             // Member profile view link
             if (get_option('ocf_show_profile_link') == '1') {
                 $url = $GLOBALS['FORUM_DRIVER']->member_profile_url($member, true, true);
                 $links->attach(do_template('BLOCK_SIDE_PERSONAL_STATS_LINK', array('_GUID' => '2c8648c953c802a9de41c3adeef0e97f', 'NAME' => do_lang_tempcode('MY_PROFILE'), 'URL' => $url, 'REL' => 'me')));
             }
         }
         // Point count and point profile link
         if (addon_installed('points')) {
             require_lang('points');
             require_code('points');
             if (get_option('points_show_personal_stats_points_left') == '1') {
                 $content->attach(do_template('BLOCK_SIDE_PERSONAL_STATS_LINE', array('_GUID' => '6241e58e30457576735f3a2618fd7fff', 'KEY' => do_lang_tempcode('COUNT_POINTS_LEFT'), 'VALUE' => integer_format(available_points($member)))));
             }
             if (get_option('points_show_personal_stats_points_used') == '1') {
                 $content->attach(do_template('BLOCK_SIDE_PERSONAL_STATS_LINE', array('_GUID' => '6241e58edfdsf735f3a2618fd7fff', 'KEY' => do_lang_tempcode('COUNT_POINTS_USED'), 'VALUE' => integer_format(points_used($member)))));
             }
             if (get_option('points_show_personal_stats_total_points') == '1') {
                 $content->attach(do_template('BLOCK_SIDE_PERSONAL_STATS_LINE', array('_GUID' => '3e6183abf9054574c0cd292d25a4fe5c', 'KEY' => do_lang_tempcode('COUNT_POINTS_EVER'), 'VALUE' => integer_format(total_points($member)))));
             }
             if (get_option('points_show_personal_stats_gift_points_left') == '1') {
                 $content->attach(do_template('BLOCK_SIDE_PERSONAL_STATS_LINE', array('_GUID' => '6241e5ssd45ddsdsdsa2618fd7fff', 'KEY' => do_lang_tempcode('COUNT_GIFT_POINTS_LEFT'), 'VALUE' => integer_format(get_gift_points_to_give($member)))));
             }
             if (get_option('points_show_personal_stats_gift_points_used') == '1') {
                 $content->attach(do_template('BLOCK_SIDE_PERSONAL_STATS_LINE', array('_GUID' => '6241eddsd4sdddssdsa2618fd7fff', 'KEY' => do_lang_tempcode('COUNT_GIFT_POINTS_USED'), 'VALUE' => integer_format(get_gift_points_used($member)))));
             }
         }
         if (get_option('ocp_show_personal_usergroup') == '1') {
             $group_id = $GLOBALS['FORUM_DRIVER']->pname_group($GLOBALS['FORUM_DRIVER']->pget_row($username));
             $usergroups = $GLOBALS['FORUM_DRIVER']->get_usergroup_list();
             if (array_key_exists($group_id, $usergroups)) {
                 if (get_forum_type() == 'ocf') {
                     $group_url = build_url(array('page' => 'groups', 'type' => 'view', 'id' => $group_id), get_module_zone('groups'));
                     $hyperlink = hyperlink($group_url, $usergroups[$group_id], false, true);
                     $content->attach(do_template('BLOCK_SIDE_PERSONAL_STATS_LINE_COMPLEX', array('_GUID' => 'sas41eddsd4sdddssdsa2618fd7fff', 'KEY' => do_lang_tempcode('GROUP'), 'VALUE' => $hyperlink)));
                 } else {
                     $content->attach(do_template('BLOCK_SIDE_PERSONAL_STATS_LINE', array('_GUID' => '65180134fbc4cf7e227011463d466677', 'KEY' => do_lang_tempcode('GROUP'), 'VALUE' => $usergroups[$group_id])));
                 }
             }
         }
         if (get_option('ocp_show_personal_last_visit') == '1') {
             $row = $GLOBALS['FORUM_DRIVER']->pget_row($username);
             if (get_forum_type() == 'ocf') {
                 $last_visit = intval(ocp_admirecookie('last_visit', strval($GLOBALS['FORUM_DRIVER']->pnamelast_visit($row))));
             } else {
                 $last_visit = $GLOBALS['FORUM_DRIVER']->pnamelast_visit($row);
             }
             $_last_visit = get_timezoned_date($last_visit, false);
             $content->attach(do_template('BLOCK_SIDE_PERSONAL_STATS_LINE', array('_GUID' => 'sas41eddsdsdsdsdsa2618fd7fff', 'KEY' => do_lang_tempcode('LAST_HERE'), 'RAW_KEY' => strval($last_visit), 'VALUE' => $_last_visit)));
         }
         $avatar_url = '';
         if (!has_no_forum()) {
             if (get_option('ocp_show_avatar') === '1') {
                 $avatar_url = $GLOBALS['FORUM_DRIVER']->get_member_avatar_url($member);
             }
         }
         // Subscription links
         if (get_forum_type() == 'ocf' && addon_installed('ecommerce') && get_option('ocp_show_personal_sub_links') == '1' && !has_zone_access(get_member(), 'adminzone') && has_actual_page_access(get_member(), 'purchase')) {
             $usergroup_subs = $GLOBALS['FORUM_DB']->query_select('f_usergroup_subs', array('id', 's_title', 's_group_id', 's_cost'), array('s_enabled' => 1));
             $in_one = false;
             $members_groups = $GLOBALS['FORUM_DRIVER']->get_members_groups($member);
             foreach ($usergroup_subs as $i => $sub) {
                 $usergroup_subs[$i]['s_cost'] = floatval($sub['s_cost']);
                 if (in_array($sub['s_group_id'], $members_groups)) {
                     $in_one = true;
                     break;
                 }
             }
             if (!$in_one) {
                 global $M_SORT_KEY;
                 $M_SORT_KEY = 's_cost';
                 usort($usergroup_subs, 'multi_sort');
                 foreach ($usergroup_subs as $sub) {
                     $url = build_url(array('page' => 'purchase', 'type' => 'message', 'product' => 'USERGROUP' . strval($sub['id'])), get_module_zone('purchase'));
                     $links->attach(do_template('BLOCK_SIDE_PERSONAL_STATS_LINK', array('NAME' => do_lang_tempcode('UPGRADE_TO', escape_html(get_translated_text($sub['s_title']))), 'URL' => $url)));
                 }
             }
         }
         // Admin Zone link
         if (get_option('ocp_show_personal_adminzone_link') == '1' && has_zone_access(get_member(), 'adminzone')) {
             $url = build_url(array('page' => ''), 'adminzone');
             $links->attach(do_template('BLOCK_SIDE_PERSONAL_STATS_LINK', array('_GUID' => 'ae243058f780f9528016f7854763a5fa', 'ACCESSKEY' => 'I', 'NAME' => do_lang_tempcode('ADMIN_ZONE'), 'URL' => $url)));
         }
         // Conceded mode link
         if ($GLOBALS['SESSION_CONFIRMED'] == 1 && get_option('ocp_show_conceded_mode_link') == '1') {
             $url = build_url(array('page' => 'login', 'type' => 'concede', 'redirect' => get_page_name() == 'login' ? NULL : SELF_REDIRECT), get_module_zone('login'));
             $links->attach(do_template('BLOCK_SIDE_PERSONAL_STATS_LINK_2', array('_GUID' => '81fa81cfd3130e42996bf72b0e03d8aa', 'POST' => true, 'NAME' => do_lang_tempcode('CONCEDED_MODE'), 'DESCRIPTION' => do_lang_tempcode('DESCRIPTION_CONCEDED_MODE'), 'URL' => $url)));
         }
         // Becomes-invisible link
         if (get_option('is_on_invisibility') == '1') {
             $visible = array_key_exists(get_session_id(), $GLOBALS['SESSION_CACHE']) && $GLOBALS['SESSION_CACHE'][get_session_id()]['session_invisible'] == 0;
             $url = build_url(array('page' => 'login', 'type' => 'invisible', 'redirect' => get_page_name() == 'login' ? NULL : SELF_REDIRECT), get_module_zone('login'));
             $links->attach(do_template('BLOCK_SIDE_PERSONAL_STATS_LINK_2', array('NAME' => do_lang_tempcode($visible ? 'INVISIBLE' : 'BE_VISIBLE'), 'DESCRIPTION' => '', 'URL' => $url)));
         }
         // Logout link
         $url = build_url(array('page' => 'login', 'type' => 'logout'), get_module_zone('login'));
         if (!is_httpauth_login()) {
             $links->attach(do_template('BLOCK_SIDE_PERSONAL_STATS_LOGOUT', array('_GUID' => 'd1caacba272a7ee3bf5b2a758e4e54ee', 'NAME' => do_lang_tempcode('LOGOUT'), 'URL' => $url)));
         }
         return do_template('BLOCK_SIDE_PERSONAL_STATS', array('_GUID' => '99f9bc3387102daaeeedf99843b0502e', 'AVATAR_URL' => $avatar_url, 'LINKS' => $links, 'HAS_SU' => $has_su, 'CONTENT' => $content, 'USERNAME' => $username, 'STAFF_ACTIONS' => $staff_actions));
     } else {
         $title = do_lang_tempcode('NOT_LOGGED_IN');
         if (get_page_name() != 'join' && get_page_name() != 'login') {
             if (count($_POST) > 0) {
                 $_this_url = build_url(array('page' => ''), '', array('keep_session' => 1, 'redirect' => 1));
             } else {
                 $_this_url = build_url(array('page' => '_SELF'), '_SELF', array('keep_session' => 1, 'redirect' => 1), true);
             }
         } else {
             $_this_url = build_url(array('page' => ''), '', array('keep_session' => 1, 'redirect' => 1));
         }
         $this_url = $_this_url->evaluate();
         $login_url = build_url(array('page' => 'login', 'type' => 'login', 'redirect' => $this_url), get_module_zone('login'));
         $full_link = build_url(array('page' => 'login', 'type' => 'misc', 'redirect' => $this_url), get_module_zone('login'));
         $join_url = get_forum_type() != 'none' ? $GLOBALS['FORUM_DRIVER']->join_url() : '';
         return do_template('BLOCK_SIDE_PERSONAL_STATS_NO', array('_GUID' => '32aade68b98dfd191f0f84c6648f7dde', 'TITLE' => $title, 'FULL_LINK' => $full_link, 'JOIN_LINK' => $join_url, 'LOGIN_URL' => $login_url));
     }
 }
示例#14
0
 /**
  * Gets the default value for the config option.
  *
  * @return ?string		The default value (NULL: option is disabled)
  */
 function get_default()
 {
     return has_no_forum() ? NULL : static_evaluate_tempcode(do_template('COMMENTS_DEFAULT_TEXT'));
 }
示例#15
0
 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     require_lang('messaging');
     require_code('feedback');
     $type = array_key_exists('param', $map) ? $map['param'] : do_lang('GENERAL');
     $id = uniqid('', true);
     $_self_url = build_url(array('page' => 'admin_messaging', 'type' => 'view', 'id' => $id, 'message_type' => $type), get_module_zone('admin_messaging'));
     $self_url = $_self_url->evaluate();
     $self_title = post_param('title', do_lang('CONTACT_US_MESSAGING'));
     $post = post_param('post', '');
     $title = post_param('title', '');
     $box_title = array_key_exists('title', $map) ? $map['title'] : do_lang('CONTACT_US');
     if (post_param_integer('_comment_form_post', 0) == 1 && $post != '') {
         $message = new ocp_tempcode();
         /*Used to be written out here*/
         attach_message(do_lang_tempcode('MESSAGE_SENT'), 'inform');
         // Check CAPTCHA
         if (addon_installed('captcha') && get_option('captcha_on_feedback') == '1') {
             require_code('captcha');
             enforce_captcha();
         }
         // Handle notifications
         require_code('notifications');
         $notification_subject = do_lang('CONTACT_US_NOTIFICATION_SUBJECT', $title, NULL, NULL, get_site_default_lang());
         $notification_message = do_lang('CONTACT_US_NOTIFICATION_MESSAGE', comcode_escape(get_site_name()), comcode_escape($GLOBALS['FORUM_DRIVER']->get_username(get_member())), array($post, comcode_escape($type)), get_site_default_lang());
         dispatch_notification('messaging', $type . '_' . $id, $notification_subject, $notification_message, NULL, NULL, 3, true);
         // Send standard confirmation email to current user
         $email_from = trim(post_param('email', $GLOBALS['FORUM_DRIVER']->get_member_email_address(get_member())));
         if ($email_from != '') {
             require_code('mail');
             mail_wrap(do_lang('YOUR_MESSAGE_WAS_SENT_SUBJECT', $title), do_lang('YOUR_MESSAGE_WAS_SENT_BODY', $post), array($email_from), NULL, '', '', 3, NULL, false, get_member());
         }
         decache('main_staff_checklist');
     } else {
         $message = new ocp_tempcode();
     }
     if (!has_no_forum()) {
         // Comment posts
         $forum = get_option('messaging_forum_name');
         $count = 0;
         $_comments = $GLOBALS['FORUM_DRIVER']->get_forum_topic_posts($GLOBALS['FORUM_DRIVER']->find_topic_id_for_topic_identifier($forum, $type . '_' . $id), $count);
         if ($_comments !== -1) {
             $em = $GLOBALS['FORUM_DRIVER']->get_emoticon_chooser();
             require_javascript('javascript_editing');
             $comcode_help = build_url(array('page' => 'userguide_comcode'), get_comcode_zone('userguide_comcode', false));
             require_javascript('javascript_validation');
             $comment_url = get_self_url();
             $email_optional = array_key_exists('email_optional', $map) ? intval($map['email_optional']) == 1 : true;
             if (addon_installed('captcha')) {
                 require_code('captcha');
                 $use_captcha = get_option('captcha_on_feedback') == '1' && use_captcha();
                 if ($use_captcha) {
                     generate_captcha();
                 }
             } else {
                 $use_captcha = false;
             }
             $comment_details = do_template('COMMENTS_POSTING_FORM', array('JOIN_BITS' => '', 'FIRST_POST_URL' => '', 'FIRST_POST' => '', 'USE_CAPTCHA' => $use_captcha, 'EMAIL_OPTIONAL' => $email_optional, 'POST_WARNING' => '', 'COMMENT_TEXT' => '', 'GET_EMAIL' => true, 'GET_TITLE' => true, 'EM' => $em, 'DISPLAY' => 'block', 'COMMENT_URL' => $comment_url, 'TITLE' => $box_title));
             $notifications_enabled = NULL;
             $notification_change_url = NULL;
             if (has_actual_page_access(get_member(), 'admin_messaging')) {
                 require_code('notifications');
                 $notifications_enabled = notifications_enabled('messaging', 'type', get_member());
             }
             $out = do_template('BLOCK_MAIN_CONTACT_US', array('_GUID' => 'fd269dce5ff984ee558e9052fa0150b0', 'COMMENT_DETAILS' => $comment_details, 'MESSAGE' => $message, 'NOTIFICATIONS_ENABLED' => $notifications_enabled, 'TYPE' => $type));
         } else {
             $out = new ocp_tempcode();
         }
     } else {
         $out = new ocp_tempcode();
     }
     return $out;
 }
示例#16
0
 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     require_lang('news');
     require_lang('ocf');
     require_css('news');
     $days = array_key_exists('param', $map) ? intval($map['param']) : 14;
     $multiplier = array_key_exists('multiplier', $map) ? floatval($map['multiplier']) : 0.5;
     $fallback_full = array_key_exists('fallback_full', $map) ? intval($map['fallback_full']) : 3;
     $fallback_archive = array_key_exists('fallback_archive', $map) ? intval($map['fallback_archive']) : 6;
     $zone = array_key_exists('zone', $map) ? $map['zone'] : get_module_zone('news');
     $historic = array_key_exists('historic', $map) ? $map['historic'] : '';
     $filter_and = array_key_exists('filter_and', $map) ? $map['filter_and'] : '';
     $blogs = array_key_exists('blogs', $map) ? intval($map['blogs']) : -1;
     $member_based = array_key_exists('member_based', $map) && $map['member_based'] == '1';
     global $NEWS_CATS;
     if (!isset($NEWS_CATS)) {
         $NEWS_CATS = $GLOBALS['SITE_DB']->query_select('news_categories', array('*'), array('nc_owner' => NULL));
         $NEWS_CATS = list_to_map('id', $NEWS_CATS);
     }
     $days_full = floatval($days) * $multiplier;
     $days_outline = floatval($days) - $days_full;
     // News Query
     require_code('ocfiltering');
     $filter = array_key_exists('filter', $map) ? $map['filter'] : get_param('news_filter', '*');
     $filters_1 = ocfilter_to_sqlfragment($filter, 'p.news_category', 'news_categories', NULL, 'p.news_category', 'id');
     // Note that the parameters are fiddled here so that category-set and record-set are the same, yet SQL is returned to deal in an entirely different record-set (entries' record-set)
     $filters_2 = ocfilter_to_sqlfragment($filter, 'd.news_entry_category', 'news_categories', NULL, 'd.news_category', 'id');
     // Note that the parameters are fiddled here so that category-set and record-set are the same, yet SQL is returned to deal in an entirely different record-set (entries' record-set)
     $q_filter = '(' . $filters_1 . ' OR ' . $filters_2 . ')';
     if ($blogs === 0) {
         if ($q_filter != '') {
             $q_filter .= ' AND ';
         }
         $q_filter .= 'nc_owner IS NULL';
     } elseif ($blogs === 1) {
         if ($q_filter != '') {
             $q_filter .= ' AND ';
         }
         $q_filter .= '(nc_owner IS NOT NULL)';
     }
     if ($blogs != -1) {
         $join = ' LEFT JOIN ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'news_categories c ON c.id=p.news_category';
     } else {
         $join = '';
     }
     if ($filter_and != '') {
         $filters_and_1 = ocfilter_to_sqlfragment($filter_and, 'p.news_category', 'news_categories', NULL, 'p.news_category', 'id');
         // Note that the parameters are fiddled here so that category-set and record-set are the same, yet SQL is returned to deal in an entirely different record-set (entries' record-set)
         $filters_and_2 = ocfilter_to_sqlfragment($filter_and, 'd.news_entry_category', 'news_categories', NULL, 'd.news_category', 'id');
         // Note that the parameters are fiddled here so that category-set and record-set are the same, yet SQL is returned to deal in an entirely different record-set (entries' record-set)
         $q_filter .= ' AND (' . $filters_and_1 . ' OR ' . $filters_and_2 . ')';
     }
     if ($historic == '') {
         $rows = $days_full == 0.0 ? array() : $GLOBALS['SITE_DB']->query('SELECT *,p.id AS p_id FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'news p LEFT JOIN ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'news_category_entries d ON d.news_entry=p.id' . $join . ' WHERE ' . $q_filter . ' AND validated=1 AND date_and_time>=' . strval(time() - 60 * 60 * 24 * intval($days_full)) . (can_arbitrary_groupby() ? ' GROUP BY p.id' : '') . ' ORDER BY p.date_and_time DESC', 300);
         if (!array_key_exists(0, $rows)) {
             $rows = $GLOBALS['SITE_DB']->query('SELECT *,p.id AS p_id FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'news p LEFT JOIN ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'news_category_entries d ON p.id=d.news_entry' . $join . ' WHERE ' . $q_filter . ' AND validated=1' . (can_arbitrary_groupby() ? ' GROUP BY p.id' : '') . ' ORDER BY p.date_and_time DESC', $fallback_full);
             $rows2 = $GLOBALS['SITE_DB']->query('SELECT *,p.id AS p_id FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'news p LEFT JOIN ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'news_category_entries d ON p.id=d.news_entry' . $join . ' WHERE ' . $q_filter . ' AND validated=1' . (can_arbitrary_groupby() ? ' GROUP BY p.id' : '') . ' ORDER BY p.date_and_time DESC', $fallback_archive, $fallback_full);
         } else {
             $rows2 = $GLOBALS['SITE_DB']->query('SELECT *,p.id AS p_id FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'news p LEFT JOIN ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'news_category_entries d ON p.id=d.news_entry' . $join . ' WHERE ' . $q_filter . ' AND validated=1 AND date_and_time>=' . strval(time() - 60 * 60 * 24 * intval($days_full + $days_outline)) . ' AND date_and_time<' . strval(time() - 60 * 60 * 24 * intval($days_full)) . (can_arbitrary_groupby() ? ' GROUP BY p.id' : '') . ' ORDER BY p.date_and_time DESC', 300);
         }
     } else {
         if (function_exists('set_time_limit')) {
             @set_time_limit(0);
         }
         $start = 0;
         do {
             $_rows = $GLOBALS['SITE_DB']->query('SELECT *,p.id AS p_id FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'news p LEFT JOIN ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'news_category_entries d ON p.id=d.news_entry' . $join . ' WHERE ' . $q_filter . ' AND validated=1' . (can_arbitrary_groupby() ? ' GROUP BY p.id' : '') . ' ORDER BY p.date_and_time DESC', 200, $start);
             $rows = array();
             $rows2 = array();
             foreach ($_rows as $row) {
                 $ok = false;
                 switch ($historic) {
                     case 'month':
                         if (date('m', utctime_to_usertime($row['date_and_time'])) == date('m', utctime_to_usertime()) && date('Y', utctime_to_usertime($row['date_and_time'])) != date('Y', utctime_to_usertime())) {
                             $ok = true;
                         }
                         break;
                     case 'week':
                         if (date('W', utctime_to_usertime($row['date_and_time'])) == date('W', utctime_to_usertime()) && date('Y', utctime_to_usertime($row['date_and_time'])) != date('Y', utctime_to_usertime())) {
                             $ok = true;
                         }
                         break;
                     case 'day':
                         if (date('d', utctime_to_usertime($row['date_and_time'])) == date('d', utctime_to_usertime()) && date('m', utctime_to_usertime($row['date_and_time'])) == date('m', utctime_to_usertime()) && date('Y', utctime_to_usertime($row['date_and_time'])) != date('Y', utctime_to_usertime())) {
                             $ok = true;
                         }
                         break;
                 }
                 if ($ok) {
                     if (count($rows) < $fallback_full) {
                         $rows[] = $row;
                     } elseif (count($rows2) < $fallback_archive) {
                         $rows2[] = $row;
                     } else {
                         break 2;
                     }
                 }
             }
             $start += 200;
         } while (count($_rows) == 200);
         unset($_rows);
     }
     $rows = remove_duplicate_rows($rows, 'p_id');
     $i = 0;
     $news_text = new ocp_tempcode();
     while (array_key_exists($i, $rows)) {
         $myrow = $rows[$i];
         //		$categories=$GLOBALS['SITE_DB']->query_select('news_category_entries',array('news_entry_category'),array('news_entry'=>$myrow['p_id']));
         if (has_category_access(get_member(), 'news', strval($myrow['news_category']))) {
             $id = $myrow['p_id'];
             $date = get_timezoned_date($myrow['date_and_time']);
             $author_url = addon_installed('authors') && !$member_based ? build_url(array('page' => 'authors', 'type' => 'misc', 'id' => $myrow['author']), get_module_zone('authors')) : new ocp_tempcode();
             $author = $myrow['author'];
             $news_title = get_translated_tempcode($myrow['title']);
             if (array_key_exists('show_in_full', $map) && $map['show_in_full'] == '1') {
                 $news = get_translated_tempcode($myrow['news_article']);
                 $truncate = false;
                 if ($news->is_empty()) {
                     $news = get_translated_tempcode($myrow['news']);
                 }
             } else {
                 $news = get_translated_tempcode($myrow['news']);
                 if ($news->is_empty()) {
                     $news = get_translated_tempcode($myrow['news_article']);
                     $truncate = true;
                 } else {
                     $truncate = false;
                 }
             }
             $tmp = array('page' => 'news', 'type' => 'view', 'id' => $id);
             if ($filter != '*') {
                 $tmp['filter'] = $filter;
             }
             if ($filter_and != '*' && $filter_and != '') {
                 $tmp['filter_and'] = $filter_and;
             }
             if ($blogs != -1) {
                 $tmp['blog'] = $blogs;
             }
             $full_url = build_url($tmp, $zone);
             if (!array_key_exists($myrow['news_category'], $NEWS_CATS)) {
                 $_news_cats = $GLOBALS['SITE_DB']->query_select('news_categories', array('*'), array('id' => $myrow['news_category']), '', 1);
                 if (array_key_exists(0, $_news_cats)) {
                     $NEWS_CATS[$myrow['news_category']] = $_news_cats[0];
                 }
             }
             if (!array_key_exists($myrow['news_category'], $NEWS_CATS) || !array_key_exists('nc_title', $NEWS_CATS[$myrow['news_category']])) {
                 $myrow['news_category'] = db_get_first_id();
             }
             $img = find_theme_image($NEWS_CATS[$myrow['news_category']]['nc_img']);
             if (is_null($img)) {
                 $img = '';
             }
             if ($myrow['news_image'] != '') {
                 $img = $myrow['news_image'];
                 if (url_is_local($img)) {
                     $img = get_custom_base_url() . '/' . $img;
                 }
             }
             $category = get_translated_text($NEWS_CATS[$myrow['news_category']]['nc_title']);
             $seo_bits = seo_meta_get_for('news', strval($id));
             $map2 = array('TAGS' => get_loaded_tags('news', explode(',', $seo_bits[0])), 'ID' => strval($id), 'TRUNCATE' => $truncate, 'BLOG' => $blogs === 1, 'SUBMITTER' => strval($myrow['submitter']), 'CATEGORY' => $category, 'IMG' => $img, 'DATE' => $date, 'DATE_RAW' => strval($myrow['date_and_time']), 'NEWS_TITLE' => $news_title, 'AUTHOR' => $author, 'AUTHOR_URL' => $author_url, 'NEWS' => $news, 'FULL_URL' => $full_url);
             if (get_option('is_on_comments') == '1' && !has_no_forum() && $myrow['allow_comments'] >= 1) {
                 $map2['COMMENT_COUNT'] = '1';
             }
             $news_text->attach(do_template('NEWS_PIECE_SUMMARY', $map2));
         }
         $i++;
     }
     $j = 0;
     $news_text2 = new ocp_tempcode();
     while (array_key_exists($j, $rows2)) {
         $myrow = $rows2[$j];
         //		$categories=$GLOBALS['SITE_DB']->query_select('news_category_entries',array('news_entry_category'),array('news_entry'=>$myrow['id']));
         if (has_category_access(get_member(), 'news', strval($myrow['news_category']))) {
             $date = get_timezoned_date($myrow['date_and_time']);
             $tmp = array('page' => 'news', 'type' => 'view', 'id' => $myrow['p_id']);
             if ($filter != '*') {
                 $tmp['filter'] = $filter;
             }
             if ($filter_and != '*' && $filter_and != '') {
                 $tmp['filter_and'] = $filter_and;
             }
             if ($blogs != -1) {
                 $tmp['blog'] = $blogs;
             }
             $url = build_url($tmp, $zone);
             $title = get_translated_tempcode($myrow['title']);
             $title_plain = get_translated_text($myrow['title']);
             $seo_bits = seo_meta_get_for('news', strval($myrow['p_id']));
             $map2 = array('_GUID' => 'd81bda3a0912a1e708af6bb1f503b296', 'TAGS' => get_loaded_tags('news', explode(',', $seo_bits[0])), 'BLOG' => $blogs === 1, 'ID' => strval($myrow['p_id']), 'SUBMITTER' => strval($myrow['submitter']), 'DATE' => $date, 'DATE_RAW' => strval($myrow['date_and_time']), 'URL' => $url, 'TITLE_PLAIN' => $title_plain, 'TITLE' => $title);
             if (get_option('is_on_comments') == '1' && !has_no_forum() && $myrow['allow_comments'] >= 1) {
                 $map2['COMMENT_COUNT'] = '1';
             }
             $news_text2->attach(do_template('NEWS_BRIEF', $map2));
         }
         $j++;
     }
     $tmp = array('page' => 'news', 'type' => 'misc');
     if ($filter != '*') {
         $tmp[is_numeric($filter) ? 'id' : 'filter'] = $filter;
     }
     if ($filter_and != '*' && $filter_and != '') {
         $tmp['filter_and'] = $filter_and;
     }
     if ($blogs != -1) {
         $tmp['blog'] = $blogs;
     }
     $archive_url = build_url($tmp, $zone);
     $_is_on_rss = get_option('is_rss_advertised', true);
     $is_on_rss = is_null($_is_on_rss) ? 0 : intval($_is_on_rss);
     // Set to zero if we don't want to show RSS links
     $submit_url = new ocp_tempcode();
     if (($blogs !== 1 || has_specific_permission(get_member(), 'have_personal_category', 'cms_news')) && has_actual_page_access(NULL, $blogs === 1 ? 'cms_blogs' : 'cms_news', NULL, NULL) && has_submit_permission('high', get_member(), get_ip_address(), $blogs === 1 ? 'cms_blogs' : 'cms_news')) {
         $map2 = array('page' => $blogs === 1 ? 'cms_blogs' : 'cms_news', 'type' => 'ad', 'redirect' => SELF_REDIRECT);
         if (is_numeric($filter)) {
             $map2['cat'] = $filter;
             // select news cat by default, if we are only showing one news cat in this block
         } elseif ($filter != '*') {
             $pos_a = strpos($filter, ',');
             $pos_b = strpos($filter, '-');
             if ($pos_a !== false) {
                 $first_cat = substr($filter, 0, $pos_a);
             } elseif ($pos_b !== false) {
                 $first_cat = substr($filter, 0, $pos_b);
             } else {
                 $first_cat = '';
             }
             if (is_numeric($first_cat)) {
                 $map2['cat'] = $first_cat;
             }
         }
         $submit_url = build_url($map2, get_module_zone($blogs === 1 ? 'cms_blogs' : 'cms_news'));
     }
     $_title = do_lang_tempcode($blogs == 1 ? 'BLOGS_POSTS' : 'NEWS');
     if (array_key_exists('title', $map) && $map['title'] != '') {
         $_title = protect_from_escaping(escape_html($map['title']));
     }
     if ($i == 0 && $j == 0) {
         return do_template('BLOCK_NO_ENTRIES', array('_GUID' => '9d7065af4dd4026ffb34243fd931f99d', 'HIGH' => false, 'TITLE' => $_title, 'MESSAGE' => do_lang_tempcode($blogs == 1 ? 'BLOG_NO_NEWS' : 'NO_NEWS'), 'ADD_NAME' => do_lang_tempcode($blogs == 1 ? 'ADD_NEWS_BLOG' : 'ADD_NEWS'), 'SUBMIT_URL' => $submit_url));
     }
     $atom_url = new ocp_tempcode();
     $rss_url = new ocp_tempcode();
     if ($is_on_rss == 1) {
         $atom_url = make_string_tempcode(find_script('backend') . '?type=atom&mode=news&filter=' . $filter);
         $atom_url->attach(symbol_tempcode('KEEP'));
         $rss_url = make_string_tempcode(find_script('backend') . '?type=rss2&mode=news&filter=' . $filter);
         $rss_url->attach(symbol_tempcode('KEEP'));
     }
     return do_template('BLOCK_MAIN_NEWS', array('_GUID' => '01f5fbd2b0c7c8f249023ecb4254366e', 'BLOG' => $blogs === 1, 'TITLE' => $_title, 'CONTENT' => $news_text, 'BRIEF' => $news_text2, 'FILTER' => $filter, 'ARCHIVE_URL' => $archive_url, 'SUBMIT_URL' => $submit_url, 'RSS_URL' => $rss_url, 'ATOM_URL' => $atom_url));
 }
示例#17
0
 /**
  * The UI to view an author.
  *
  * @return tempcode		The UI
  */
 function show_author()
 {
     $author = get_param('id', NULL);
     if (is_null($author)) {
         if (is_guest()) {
             global $EXTRA_HEAD;
             $EXTRA_HEAD->attach('<meta name="robots" content="noindex" />');
             // XHTMLXHTML
             warn_exit(do_lang_tempcode('USER_NO_EXIST'));
         }
         $author = $GLOBALS['FORUM_DRIVER']->get_username(get_member());
     }
     if (is_null($author) || $author == '') {
         warn_exit(do_lang_tempcode('INTERNAL_ERROR'));
     }
     // Really don't want to have to search on this
     if (addon_installed('awards')) {
         require_code('awards');
         $awards = find_awards_for('author', $author);
     } else {
         $awards = array();
     }
     $title = get_page_title('_AUTHOR', true, array(escape_html($author)), NULL, $awards);
     seo_meta_load_for('authors', $author);
     $rows = $GLOBALS['SITE_DB']->query_select('authors', array('url', 'description', 'skills'), array('author' => $author), '', 1);
     if (!array_key_exists(0, $rows)) {
         if (has_actual_page_access(get_member(), 'cms_authors') && has_edit_author_permission(get_member(), $author)) {
             $GLOBALS['HTTP_STATUS_CODE'] = '404';
             if (!headers_sent()) {
                 if (!browser_matches('ie') && strpos(ocp_srv('SERVER_SOFTWARE'), 'IIS') === false) {
                     header('HTTP/1.0 404 Not Found');
                 }
             }
             $_author_add_url = build_url(array('page' => 'cms_authors', 'type' => '_ad', 'author' => $author), get_module_zone('cms_authors'));
             $author_add_url = $_author_add_url->evaluate();
             $message = do_lang_tempcode('NO_SUCH_AUTHOR_CONFIGURE_ONE', escape_html($author), escape_html($author_add_url));
             attach_message($message, 'inform');
         } else {
             $message = do_lang_tempcode('NO_SUCH_AUTHOR', escape_html($author));
         }
         $details = array('author' => $author, 'url' => '', 'forum_handle' => $GLOBALS['FORUM_DRIVER']->get_member_from_username($author), 'description' => NULL, 'skills' => NULL);
         //return inform_screen($title,$message);
     } else {
         $details = $rows[0];
     }
     // Links associated with the mapping between the author and a forum member
     $handle = get_author_id_from_name($author);
     if (!is_null($handle)) {
         $forum_details = do_template('AUTHOR_SCREEN_POTENTIAL_ACTION_ENTRY', array('ACTION' => hyperlink($GLOBALS['FORUM_DRIVER']->member_profile_url($handle, true, true), do_lang_tempcode('AUTHOR_PROFILE'), false, false, '', NULL, NULL, 'me')));
         if (addon_installed('points')) {
             $give_points_url = build_url(array('page' => 'points', 'type' => 'member', 'id' => $handle), get_module_zone('points'));
             $point_details = do_template('AUTHOR_SCREEN_POTENTIAL_ACTION_ENTRY', array('ACTION' => hyperlink($give_points_url, do_lang_tempcode('AUTHOR_POINTS'))));
         } else {
             $point_details = new ocp_tempcode();
         }
     } else {
         $forum_details = new ocp_tempcode();
         $point_details = new ocp_tempcode();
     }
     // Homepage
     $url = $details['url'];
     if (strlen($url) > 0) {
         $url_details = do_template('AUTHOR_SCREEN_POTENTIAL_ACTION_ENTRY', array('ACTION' => hyperlink($url, do_lang_tempcode('AUTHOR_HOMEPAGE'), false, false, '', NULL, NULL, 'me')));
     } else {
         $url_details = new ocp_tempcode();
     }
     // (Self?) description
     $description = is_null($details['description']) ? new ocp_tempcode() : get_translated_tempcode($details['description']);
     // Skills
     $skills = is_null($details['skills']) ? new ocp_tempcode() : get_translated_tempcode($details['skills']);
     // Edit link, for staff
     if (has_edit_author_permission(get_member(), $author)) {
         $edit_author_url = build_url(array('page' => 'cms_authors', 'type' => '_ad', 'author' => $author), get_module_zone('cms_authors'));
         $staff_details = do_template('AUTHOR_SCREEN_POTENTIAL_ACTION_ENTRY', array('ACTION' => hyperlink($edit_author_url, do_lang_tempcode('DEFINE_AUTHOR'), false)));
     } else {
         $staff_details = new ocp_tempcode();
     }
     // Search link
     if (addon_installed('search')) {
         $search_url = build_url(array('page' => 'search', 'author' => $author), get_module_zone('search'));
         $search_details = do_template('AUTHOR_SCREEN_POTENTIAL_ACTION_ENTRY', array('ACTION' => hyperlink($search_url, do_lang_tempcode('SEARCH'), false)));
     } else {
         $search_details = new ocp_tempcode();
     }
     // Downloads
     $downloads_released = new ocp_tempcode();
     if (addon_installed('downloads')) {
         require_code('downloads');
         require_lang('downloads');
         $count = $GLOBALS['SITE_DB']->query_value('download_downloads', 'COUNT(*)', array('author' => $author, 'validated' => 1));
         if ($count > 50) {
             $downloads_released = paragraph(do_lang_tempcode('TOO_MANY_TO_CHOOSE_FROM'));
         } else {
             $rows = $GLOBALS['SITE_DB']->query_select('download_downloads', array('*'), array('author' => $author, 'validated' => 1));
             require_code('downloads');
             foreach ($rows as $i => $myrow) {
                 if ($i != 0) {
                     $downloads_released->attach(do_template('BLOCK_SEPARATOR', array('_GUID' => 'ea789367b15bsddsdsdsc586e6e6536')));
                 }
                 if (has_category_access(get_member(), 'downloads', strval($myrow['category_id']))) {
                     $downloads_released->attach(get_download_html($myrow));
                 }
             }
         }
     }
     // News
     $news_released = new ocp_tempcode();
     if (addon_installed('news')) {
         require_lang('news');
         $count = $GLOBALS['SITE_DB']->query_value('news', 'COUNT(*)', array('author' => $author, 'validated' => 1));
         if ($count > 50) {
             $news_released = paragraph(do_lang_tempcode('TOO_MANY_TO_CHOOSE_FROM'));
         } else {
             $rows = $GLOBALS['SITE_DB']->query_select('news', array('*'), array('author' => $author, 'validated' => 1));
             foreach ($rows as $i => $row) {
                 if (has_category_access(get_member(), 'news', strval($row['news_category']))) {
                     $url = build_url(array('page' => 'news', 'type' => 'view', 'id' => $row['id']), get_module_zone('news'));
                     $_title = get_translated_tempcode($row['title']);
                     $title_plain = get_translated_text($row['title']);
                     $seo_bits = seo_meta_get_for('news', strval($row['id']));
                     $map = array('ID' => strval($row['id']), 'TAGS' => get_loaded_tags('news', explode(',', $seo_bits[0])), 'SUBMITTER' => strval($row['submitter']), 'DATE' => get_timezoned_date($row['date_and_time']), 'DATE_RAW' => strval($row['date_and_time']), 'URL' => $url, 'TITLE_PLAIN' => $title_plain, 'TITLE' => $_title);
                     if (get_option('is_on_comments') == '1' && !has_no_forum() && $row['allow_comments'] >= 1) {
                         $map['COMMENT_COUNT'] = '1';
                     }
                     $tpl = do_template('NEWS_BRIEF', $map);
                     $news_released->attach($tpl);
                 }
             }
         }
     }
     // Edit link
     $edit_url = new ocp_tempcode();
     if (has_edit_author_permission(get_member(), $author)) {
         $edit_url = build_url(array('page' => 'cms_authors', 'type' => '_ad', 'id' => $author), 'cms');
     }
     return do_template('AUTHOR_SCREEN', array('_GUID' => 'ea789367b15bc90fc28d1c586e6e6536', 'TAGS' => get_loaded_tags(), 'TITLE' => $title, 'EDIT_URL' => $edit_url, 'AUTHOR' => $author, 'NEWS_RELEASED' => $news_released, 'DOWNLOADS_RELEASED' => $downloads_released, 'STAFF_DETAILS' => $staff_details, 'POINT_DETAILS' => $point_details, 'SEARCH_DETAILS' => $search_details, 'URL_DETAILS' => $url_details, 'FORUM_DETAILS' => $forum_details, 'SKILLS' => $skills, 'DESCRIPTION' => $description));
 }
示例#18
0
 /**
  * Gets the default value for the config option.
  *
  * @return ?string		The default value (NULL: option is disabled)
  */
 function get_default()
 {
     return has_no_forum() || get_forum_type() == 'ocf' && !addon_installed('ocf_member_avatars') ? NULL : '0';
 }
示例#19
0
 /**
  * Standard modular run function.
  *
  * @return tempcode	The result of execution.
  */
 function run()
 {
     if (has_no_forum()) {
         warn_exit(do_lang_tempcode('NO_FORUM_INSTALLED'));
     }
     $GLOBALS['FEED_URL'] = find_script('backend') . '?mode=tickets&filter=';
     require_lang('tickets');
     require_javascript('javascript_validation');
     require_css('tickets');
     require_code('tickets');
     require_code('tickets2');
     $type = get_param('type', 'misc');
     if ($type == 'ticket') {
         return $this->do_ticket();
     }
     if ($type == 'post') {
         return $this->do_update_ticket();
     }
     if ($type == 'misc') {
         return $this->do_choose_ticket();
     }
     if ($type == 'toggle_ticket_closed') {
         return $this->toggle_ticket_closed();
     }
     return new ocp_tempcode();
 }
示例#20
0
 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     if (has_no_forum()) {
         return new ocp_tempcode();
     }
     require_css('news');
     // Read in variables
     $forum_name = array_key_exists('param', $map) ? $map['param'] : 'General chat';
     $limit = array_key_exists('limit', $map) ? intval($map['limit']) : 6;
     $hot = array_key_exists('hot', $map) ? intval($map['hot']) : 0;
     $date_key = array_key_exists('date_key', $map) ? $map['date_key'] : 'lasttime';
     if ($date_key != 'lasttime' && $date_key != 'firsttime') {
         $date_key = 'firsttime';
     }
     $username_key = array_key_exists('username_key', $map) ? $map['username_key'] : 'firstusername';
     if ($username_key != 'lastusername' && $username_key != 'firstusername') {
         $username_key = 'firstusername';
     }
     $memberid_key = $username_key == 'firstusername' ? 'firstmemberid' : 'lastmemberid';
     // Work out exactly what forums we're reading
     $forum_ids = array();
     if (get_forum_type() == 'ocf' && (strpos($forum_name, ',') !== false || strpos($forum_name, '*') !== false || preg_match('#\\d[-\\*\\+]#', $forum_name) != 0 || is_numeric($forum_name))) {
         require_code('ocfiltering');
         $forum_names = ocfilter_to_idlist_using_db($forum_name, 'id', 'f_forums', 'f_forums', 'f_parent_forum', 'f_parent_forum', 'id', true, true, $GLOBALS['FORUM_DB']);
     } else {
         $forum_names = explode(',', $forum_name);
     }
     foreach ($forum_names as $forum_name) {
         if (!is_string($forum_name)) {
             $forum_name = strval($forum_name);
         }
         $forum_name = trim($forum_name);
         if ($forum_name == '<announce>') {
             $forum_id = NULL;
         } else {
             $forum_id = is_numeric($forum_name) ? intval($forum_name) : $GLOBALS['FORUM_DRIVER']->forum_id_from_name($forum_name);
         }
         if (get_forum_type() == 'ocf' && array_key_exists('check', $map) && $map['check'] == '1') {
             if (!has_category_access(get_member(), 'forums', strval($forum_id))) {
                 continue;
             }
         }
         if (!is_null($forum_id)) {
             $forum_ids[$forum_id] = $forum_name;
         }
     }
     // Block title
     $forum_name = array_key_exists('param', $map) ? $map['param'] : 'General chat';
     if (is_numeric($forum_name) && get_forum_type() == 'ocf') {
         $forum_name = $GLOBALS['FORUM_DB']->query_value_null_ok('f_forums', 'f_name', array('id' => intval($forum_name)));
         if (is_null($forum_name)) {
             return paragraph(do_lang_tempcode('MISSING_RESOURCE'));
         }
     }
     $_title = do_lang_tempcode('ACTIVE_TOPICS_IN', escape_html($forum_name));
     if (array_key_exists('title', $map) && $map['title'] != '') {
         $_title = protect_from_escaping(escape_html($map['title']));
     }
     // Add topic link
     if (count($forum_names) == 1 && get_forum_type() == 'ocf' && !is_null($forum_id)) {
         $submit_url = build_url(array('page' => 'topics', 'type' => 'new_topic', 'id' => $forum_id), get_module_zone('topics'));
         $add_name = do_lang_tempcode('ADD_TOPIC');
     } else {
         $submit_url = new ocp_tempcode();
         $add_name = new ocp_tempcode();
     }
     // Show all topics
     if (get_forum_type() == 'ocf') {
         $forum_names_map = collapse_2d_complexity('id', 'f_name', $GLOBALS['FORUM_DB']->query('SELECT id,f_name FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_forums WHERE f_cache_num_posts>0'));
     } else {
         $forum_names_map = NULL;
     }
     if (!has_no_forum()) {
         $max_rows = 0;
         $topics = $GLOBALS['FORUM_DRIVER']->show_forum_topics($forum_ids, $limit, 0, $max_rows, '', true, $date_key, $hot == 1);
         $out = new ocp_tempcode();
         if (!is_null($topics)) {
             global $M_SORT_KEY;
             $M_SORT_KEY = $date_key;
             usort($topics, 'multi_sort');
             $topics = array_reverse($topics, false);
             if (count($topics) < $limit && $hot == 1) {
                 $more_topics = $GLOBALS['FORUM_DRIVER']->show_forum_topics($forum_ids, $limit, 0, $max_rows, '', true, $date_key);
                 if (is_null($more_topics)) {
                     $more_topics = array();
                 }
                 $topics = array_merge($topics, $more_topics);
             }
             $done = 0;
             $seen = array();
             foreach ($topics as $topic) {
                 if (array_key_exists($topic['id'], $seen)) {
                     continue;
                 }
                 $seen[$topic['id']] = 1;
                 $topic_url = $GLOBALS['FORUM_DRIVER']->topic_url($topic['id'], $forum_name);
                 $topic_url_unread = mixed();
                 if (get_forum_type() == 'ocf') {
                     $topic_url_unread = build_url(array('page' => 'topicview', 'id' => $topic['id'], 'type' => 'first_unread'), get_module_zone('topicview'), NULL, false, false, false, 'first_unread');
                 }
                 $title = escape_html($topic['title']);
                 $date = get_timezoned_date($topic[$date_key]);
                 $username = $topic[$username_key];
                 $member_id = array_key_exists($memberid_key, $topic) ? $topic[$memberid_key] : NULL;
                 if (!is_null($forum_names_map) && !array_key_exists($topic['forum_id'], $forum_names_map)) {
                     continue;
                 }
                 // Maybe Private Topic, slipped in via reference to a missing forum
                 $forum_name = is_null($forum_names_map) ? NULL : $forum_names_map[$topic['forum_id']];
                 $out->attach(do_template('BLOCK_MAIN_FORUM_TOPICS_TOPIC', array('_GUID' => 'ae4e351b3fa5422bf8ecdfb7e49076d1', 'POST' => $topic['firstpost'], 'FORUM_ID' => is_null($forum_names_map) ? NULL : strval($topic['forum_id']), 'FORUM_NAME' => $forum_name, 'TOPIC_LINK' => $topic_url, 'TOPIC_LINK_UNREAD' => $topic_url_unread, 'TITLE' => $title, 'DATE' => $date, 'DATE_RAW' => strval($topic[$date_key]), 'USERNAME' => $username, 'MEMBER_ID' => is_null($member_id) ? '' : strval($member_id), 'NUM_POSTS' => integer_format($topic['num']))));
                 $done++;
                 if ($done == $limit) {
                     break;
                 }
             }
         }
         if ($out->is_empty()) {
             return do_template('BLOCK_NO_ENTRIES', array('_GUID' => 'c76ab018a0746c2875c6cf69c92a01fb', 'HIGH' => false, 'FORUM_NAME' => array_key_exists('param', $map) ? $map['param'] : 'General chat', 'TITLE' => $_title, 'MESSAGE' => do_lang_tempcode($hot == 1 ? 'NO_TOPICS_HOT' : 'NO_TOPICS'), 'ADD_NAME' => $add_name, 'SUBMIT_URL' => $submit_url));
         }
         return do_template('BLOCK_MAIN_FORUM_TOPICS', array('_GUID' => '368b80c49a335ad035b00510681d5008', 'TITLE' => $_title, 'CONTENT' => $out, 'FORUM_NAME' => array_key_exists('param', $map) ? $map['param'] : 'General chat', 'SUBMIT_URL' => $submit_url));
     } else {
         return new ocp_tempcode();
     }
 }
示例#21
0
 /**
  * Gets the default value for the config option.
  *
  * @return ?string		The default value (NULL: option is disabled)
  */
 function get_default()
 {
     return has_no_forum() ? NULL : do_lang('DEFAULT_FORUM_TITLE', '', '', '', get_site_default_lang());
 }
示例#22
0
 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     if (has_no_forum()) {
         return new ocp_tempcode();
     }
     require_css('news');
     require_lang('news');
     require_css('side_blocks');
     $limit = array_key_exists('param', $map) ? intval($map['param']) : 6;
     $forum_name = array_key_exists('forum', $map) ? $map['forum'] : do_lang('NEWS');
     $date_key = array_key_exists('date_key', $map) ? $map['date_key'] : 'lasttime';
     $archive_url = NULL;
     $submit_url = new ocp_tempcode();
     $forum_ids = array();
     if (get_forum_type() == 'ocf' && (strpos($forum_name, ',') !== false || preg_match('#\\d[-\\*\\+]#', $forum_name) != 0 || is_numeric($forum_name))) {
         require_code('ocfiltering');
         $forum_names = array_map('strval', ocfilter_to_idlist_using_db($forum_name, 'id', 'f_forums', 'f_forums', 'f_parent_forum', 'f_parent_forum', 'id', true, true, $GLOBALS['FORUM_DB']));
     } else {
         $forum_names = explode(',', $forum_name);
     }
     foreach ($forum_names as $forum_name) {
         $forum_name = trim($forum_name);
         if ($forum_name == '<announce>') {
             $forum_id = NULL;
         } else {
             $forum_id = is_numeric($forum_name) ? intval($forum_name) : $GLOBALS['FORUM_DRIVER']->forum_id_from_name($forum_name);
         }
         if (!is_null($forum_id)) {
             $forum_ids[$forum_id] = $forum_name;
         }
         if (!is_null($forum_id)) {
             $forum_ids[$forum_id] = $forum_name;
             if (is_null($archive_url)) {
                 $archive_url = $GLOBALS['FORUM_DRIVER']->forum_url($forum_id);
                 // First forum will count as archive
                 if (get_forum_type() == 'ocf') {
                     $submit_url = build_url(array('page' => 'topics', 'type' => 'new_topic', 'id' => $forum_id), get_module_zone('topics'));
                 }
             }
         }
     }
     $_title = do_lang_tempcode('NEWS');
     if (array_key_exists('title', $map) && $map['title'] != '') {
         $_title = protect_from_escaping(escape_html($map['title']));
     }
     if (get_forum_type() != 'none') {
         $max_rows = 0;
         $topics = $GLOBALS['FORUM_DRIVER']->show_forum_topics($forum_ids, $limit, 0, $max_rows, '', false, $date_key);
         $out = new ocp_tempcode();
         if (!is_null($topics)) {
             global $M_SORT_KEY;
             $M_SORT_KEY = $date_key;
             usort($topics, 'multi_sort');
             $topics = array_reverse($topics, false);
             foreach ($topics as $topic) {
                 $topic_url = $GLOBALS['FORUM_DRIVER']->topic_url($topic['id'], $forum_name);
                 $title = $topic['title'];
                 $date = get_timezoned_date($topic[$date_key], false);
                 //				$username=$topic['lastusername'];
                 $out->attach(do_template('BLOCK_SIDE_FORUM_NEWS_SUMMARY', array('_GUID' => '4b7f4ce27cf683710fc9958e9606291c', 'REPLIES' => strval($topic['num']), 'FIRSTTIME' => strval($topic['firsttime']), 'LASTTIME' => strval($topic['lasttime']), 'CLOSED' => strval($topic['closed']), 'FIRSTUSERNAME' => $topic['firstusername'], 'LASTUSERNAME' => $topic['lastusername'], 'FIRSTMEMBERID' => strval($topic['firstmemberid']), 'LASTMEMBERID' => strval($topic['lastmemberid']), '_DATE' => strval($topic[$date_key]), 'DATE' => $date, 'FULL_URL' => $topic_url, 'NEWS_TITLE' => escape_html($title))));
             }
         }
         return do_template('BLOCK_SIDE_FORUM_NEWS', array('_GUID' => '174fa5ce0d35d9b49dca6347c66494a5', 'FORUM_NAME' => array_key_exists('forum', $map) ? $map['forum'] : do_lang('NEWS'), 'TITLE' => $_title, 'CONTENT' => $out, 'SUBMIT_URL' => $submit_url, 'ARCHIVE_URL' => is_null($archive_url) ? '' : $archive_url));
     } else {
         return new ocp_tempcode();
     }
 }
示例#23
0
/**
 * Get a map of the fields for the given entry.
 *
 * @param  array			A database row of the entry we are working with
 * @param  ?array			A database row of the catalogue we are working with (NULL: read it in here)
 * @param  ID_TEXT		The view type we're doing
 * @set    PAGE SEARCH CATEGORY
 * @param  ID_TEXT		The template set we are rendering this category using
 * @param  ?AUTO_LINK	The virtual root for display of this category (NULL: none)
 * @param  ?array			The database rows for the fields for this catalogue (NULL: find them)
 * @param  ?array			A list of fields that we are limiting ourselves to (NULL: get ALL fields)
 * @param  boolean		Whether to grab the feedback details
 * @param  boolean		Whether to grab the tree details
 * @param  ?integer		Field index to order by (NULL: none)
 * @return array			A map of information relating to the entry. The map contains 'FIELDS' (tempcode for all accumulated fields), 'FIELD_x' (for each field x applying to the entry), STAFF_DETAILS, COMMENT_DETAILS, RATING_DETAILS, VIEW_URL, TREE (tempcode category tree to this entry)
 */
function get_catalogue_entry_map($entry, $catalogue, $view_type, $tpl_set, $root = NULL, $fields = NULL, $only_fields = NULL, $feedback_details = false, $tree_details = false, $order_by = NULL)
{
    $id = $entry['id'];
    if (is_null($catalogue)) {
        $catalogue_rows = $GLOBALS['SITE_DB']->query_select('catalogues', array('*'), array('c_name' => $entry['c_name']), '', 1);
        if (!array_key_exists(0, $catalogue_rows)) {
            warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
        }
        $catalogue = $catalogue_rows[0];
    }
    // Views
    if (get_db_type() != 'xml') {
        $entry['ce_views']++;
    }
    $catalogue_name = $catalogue['c_name'];
    $fields = get_catalogue_entry_field_values($catalogue_name, $entry, $only_fields, $fields, false, $view_type);
    $map = array();
    $map['FIELDS'] = new ocp_tempcode();
    $map['FIELDS_TABLE'] = new ocp_tempcode();
    $map['fields'] = $fields;
    $fields_1d = array();
    $fields_2d = array();
    $all_visible = true;
    require_code('fields');
    foreach ($fields as $i => $field) {
        if (!array_key_exists('effective_value', $field)) {
            $all_visible = false;
            continue;
        }
        $ev = $field['effective_value'];
        $dereference_ev = is_object($field['effective_value']) ? $field['effective_value']->evaluate() : $field['effective_value'];
        $use_ev = $dereference_ev;
        $ob = get_fields_hook($field['cf_type']);
        $use_ev = $ob->render_field_value($field, $ev, $i, $only_fields);
        if ($i == 0 && $catalogue['c_display_type'] == 1) {
            //$use_ev=hyperlink(build_url(array('page'=>'catalogues','type'=>'entry','id'=>$id,'root'=>$root),get_module_zone('catalogues')),$ev,false,!is_object($ev));
            $use_ev = $ev;
        }
        //Set image thumbnail in to the map array
        if ($field['cf_type'] == 'picture') {
            if (!is_null($ev) && $dereference_ev != '') {
                require_code('images');
                $map['FIELD_' . strval($i) . '_THUMB'] = do_image_thumb($dereference_ev, $i == 0 ? '' : (is_object($map['FIELD_0']) ? $map['FIELD_0']->evaluate() : $map['FIELD_0']), false, false, 100, 100);
            } else {
                $map['FIELD_' . strval($i) . '_THUMB'] = new ocp_tempcode();
            }
            $map['_FIELD_' . strval($field['id']) . '_THUMB'] = $map['FIELD_' . strval($i) . '_THUMB'];
        }
        $map['FIELD_' . strval($i)] = $use_ev;
        $map['_FIELD_' . strval($field['id'])] = $use_ev;
        $map['FIELD_' . strval($i) . '_PLAIN'] = $ev;
        $map['_FIELD_' . strval($field['id']) . '_PLAIN'] = $ev;
        if (array_key_exists('effective_value_pure', $field)) {
            $map['FIELD_' . strval($i) . '_PURE'] = $field['effective_value_pure'];
            $map['_FIELD_' . strval($field['id']) . '_PURE'] = $field['effective_value_pure'];
        }
        $field_name = get_translated_text($field['cf_name']);
        $map['FIELDNAME_' . strval($i)] = $field_name;
        $fields_2d[] = array('NAME' => $field_name, 'VALUE' => $use_ev);
        $field_type = $field['cf_type'];
        $map['FIELDTYPE_' . strval($i)] = $field_type;
        if ($view_type == 'PAGE' || $field['cf_put_in_category'] == 1 && $view_type == 'CATEGORY' || $field['cf_put_in_search'] == 1 && $view_type == 'SEARCH') {
            $use_ev_enhanced = $use_ev;
            /*if (($view_type!='PAGE') && ($i==0) && (($field['cf_type']=='short_trans') || ($field['cf_type']=='short_text')))
            		{
            			foreach ($fields as $field_temp)
            			{
            				if ((array_key_exists('effective_value',$field_temp)) && ($field_temp['cf_type']=='url') && (!((($field_temp['cf_put_in_category']==1) && ($view_type=='CATEGORY')) || (($field_temp['cf_put_in_search']==1) && ($view_type=='SEARCH')))) && ($field_temp['cf_visible']==1))
            				{
            					if ($field_temp['effective_value']!='')
            					{
            						$use_ev_enhanced=hyperlink($field_temp['effective_value'],$use_ev,true);
            						break;
            					}
            				}
            			}
            		}*/
            if ($field['cf_visible'] == 1 || $i == 0) {
                $_field = do_template('CATALOGUE_' . $tpl_set . '_ENTRY_FIELD', array('ENTRYID' => strval($id), 'CATALOGUE' => $catalogue_name, 'TYPE' => $field['cf_type'], 'FIELD' => $field_name, 'FIELDID' => strval($i), '_FIELDID' => strval($field['id']), 'FIELDTYPE' => $field_type, 'VALUE_PLAIN' => $ev, 'VALUE' => $use_ev_enhanced), NULL, false, 'CATALOGUE_DEFAULT_ENTRY_FIELD');
                if (!is_string($ev) || $ev != '') {
                    $map['FIELDS']->attach($_field);
                }
                $_field = do_template('CATALOGUE_' . $tpl_set . '_TAB_FIELD', array('ENTRYID' => strval($id), 'CATALOGUE' => $catalogue_name, 'TYPE' => $field['cf_type'], 'FIELD' => $field_name, 'FIELDID' => strval($i), '_FIELDID' => strval($field['id']), 'FIELDTYPE' => $field_type, 'VALUE_PLAIN' => $ev, 'VALUE' => $use_ev_enhanced), NULL, false, 'CATALOGUE_DEFAULT_TAB_FIELD');
                $map['FIELDS_TABLE']->attach($_field);
            }
        } else {
            $all_visible = false;
        }
        $fields_1d[] = $field;
        if (!($field['cf_visible'] == 1 || $i == 0 || $order_by === $i)) {
            $all_visible = false;
        }
    }
    $map['FIELDS_1D'] = $fields_1d;
    $map['FIELDS_2D'] = $fields_2d;
    // Admin functions
    if (has_actual_page_access(NULL, 'cms_catalogues', NULL, NULL) && has_edit_permission('mid', get_member(), $entry['ce_submitter'], 'cms_catalogues', array('catalogues_catalogue', $catalogue_name, 'catalogues_category', $entry['cc_id']))) {
        $map['EDIT_URL'] = build_url(array('page' => 'cms_catalogues', 'type' => '_edit_entry', 'catalogue_name' => $catalogue_name, 'id' => $id), get_module_zone('cms_catalogues'));
    } else {
        $map['EDIT_URL'] = '';
    }
    $map['SUBMITTER'] = strval($entry['ce_submitter']);
    $map['VIEWS'] = strval($entry['ce_views']);
    $map['ADD_DATE_RAW'] = strval($entry['ce_add_date']);
    $map['EDIT_DATE_RAW'] = is_null($entry['ce_edit_date']) ? '' : strval($entry['ce_edit_date']);
    $map['ADD_DATE'] = get_timezoned_date($entry['ce_add_date']);
    $map['EDIT_DATE'] = get_timezoned_date($entry['ce_edit_date']);
    $map['ID'] = strval($id);
    if (get_option('is_on_comments') == '1' && !has_no_forum() && $entry['allow_comments'] >= 1) {
        $map['COMMENT_COUNT'] = '1';
    }
    // Feedback
    //Set basic rating display of item to the map array
    require_code('feedback');
    $c_value = array_key_exists('FIELD_0_PLAIN_PURE', $map) ? $map['FIELD_0_PLAIN_PURE'] : $map['FIELD_0_PLAIN'];
    if (is_object($c_value)) {
        $c_value = $c_value->evaluate();
    }
    $self_url = build_url(array('page' => 'catalogues', 'type' => 'entry', 'id' => $id), get_module_zone('catalogues'), NULL, false, false, true);
    if ($feedback_details || $only_fields !== array(0)) {
        $map['RATING'] = $entry['allow_rating'] == 1 ? display_rating($self_url, $c_value, 'catalogues__' . $catalogue_name, strval($id), 'RATING_INLINE_STATIC', $entry['ce_submitter']) : new ocp_tempcode();
    }
    if ($feedback_details) {
        list($map['RATING_DETAILS'], $map['COMMENT_DETAILS'], $map['TRACKBACK_DETAILS']) = embed_feedback_systems('catalogues__' . $catalogue_name, strval($id), $entry['allow_rating'], $entry['allow_comments'], $entry['allow_trackbacks'], $entry['ce_validated'], $entry['ce_submitter'], $self_url, $c_value, get_value('comment_forum__catalogues__' . $catalogue_name));
    }
    if (get_option('is_on_comments') == '1' && $entry['allow_comments'] >= 1 || get_option('is_on_rating') == '1' && $entry['allow_rating'] == 1 || get_option('is_on_trackbacks') == '1' && $entry['allow_trackbacks'] == 1 || !$all_visible) {
        $map['VIEW_URL'] = $tpl_set == 'WML' ? make_string_tempcode('wap.php?page=catalogues&type=entry&id=' . strval($id)) : build_url(array('page' => 'catalogues', 'type' => 'entry', 'id' => $id, 'root' => $root == -1 ? NULL : $root), get_module_zone('catalogues'));
    } else {
        $map['VIEW_URL'] = '';
    }
    if ($tree_details) {
        $map['TREE'] = '';
        if ($catalogue['c_is_tree'] == 1 && is_null($only_fields)) {
            $tree = catalogue_category_breadcrumbs($entry['cc_id'], $root, false);
            $map['TREE'] = $tree;
        }
    }
    $map['CATALOGUE'] = $catalogue_name;
    $map['CAT'] = strval($entry['cc_id']);
    return $map;
}
示例#24
0
 /**
  * Gets the default value for the config option.
  *
  * @return ?string		The default value (NULL: option is disabled)
  */
 function get_default()
 {
     return has_no_forum() || !addon_installed('ocf_reported_posts') ? NULL : do_lang('REPORTED_POSTS_FORUM');
 }
 /**
  * Gets the default value for the config option.
  *
  * @return ?string		The default value (NULL: option is disabled)
  */
 function get_default()
 {
     return has_no_forum() ? NULL : strval(db_get_first_id());
 }
示例#26
0
/**
 * Evaluate a conventional tempcode variable, handling escaping
 *
 * @param  LANGUAGE_NAME	The language to evaluate this symbol in (some symbols refer to language elements)
 * @param  array				Array of escaping operations
 * @param  integer			The type of symbol this is (TC_SYMBOL, TC_LANGUAGE_REFERENCE)
 * @set    0 2
 * @param  ID_TEXT			The name of the symbol
 * @param  array				Parameters to the symbol. For all but directive it is an array of strings. For directives it is an array of Tempcode objects. Actually there may be template-style parameters in here, as an influence of singular_bind and these may be Tempcode, but we ignore them.
 * @return mixed				The result. Either tempcode, or a string.
 */
function ecv($lang, $escaped, $type, $name, $param)
{
    global $TEMPCODE_SETGET, $CYCLES, $PREPROCESSABLE_SYMBOLS, $DISPLAYED_TITLE;
    //echo '<!--'.$name.'-->'."\n";
    if ($type == TC_SYMBOL) {
        $escaped_codes = $name . ($escaped == array() ? '' : serialize($escaped));
        $cacheable = $param == array() && !isset($GLOBALS['NON_CACHEABLE_SYMBOLS'][$name]);
        if ($cacheable) {
            global $SYMBOL_CACHE;
            if (isset($SYMBOL_CACHE[$escaped_codes])) {
                return $SYMBOL_CACHE[$escaped_codes];
            }
        }
        $value = '';
        if ($GLOBALS['XSS_DETECT']) {
            ocp_mark_as_escaped($value);
        }
        $temp_array = array();
        if (isset($PREPROCESSABLE_SYMBOLS[$name]) && $name != 'PAGE_LINK') {
            handle_symbol_preprocessing(array($escaped, $type, $name, $param), $temp_array);
        }
        // Late preprocessing. Should not be needed in case of full screen output (as this was properly preprocessed), but is in other cases
        switch ($name) {
            case 'PAGE_LINK':
                if (isset($param[0])) {
                    list($zone, $map, $hash) = page_link_decode(is_object($param[0]) ? $param[0]->evaluate() : $param[0]);
                    $skip = NULL;
                    if (isset($param[4])) {
                        $skip = array_flip(explode('|', $param[4]));
                    }
                    $avoid_remap = isset($param[1]) && $param[1] == '1';
                    $skip_keep = isset($param[2]) && $param[2] == '1';
                    $keep_all = isset($param[3]) && $param[3] == '1';
                    foreach ($map as $key => $val) {
                        if (is_object($val)) {
                            $map[$key] = $val->evaluate();
                        }
                    }
                    $value = _build_url($map, $zone, $skip, $keep_all, $avoid_remap, $skip_keep, $hash);
                } else {
                    $value = get_zone_name() . ':' . get_page_name();
                    foreach ($_GET as $key => $val) {
                        if ($key == 'page') {
                            continue;
                        }
                        if (is_array($val)) {
                            continue;
                        }
                        if (substr($key, 0, 5) == 'keep_' && !skippable_keep($key, $val)) {
                            continue;
                        }
                        $value .= ':' . $key . '=' . $val;
                    }
                }
                break;
            case 'SET':
                if (isset($param[1])) {
                    if (isset($param[1]) && is_object($param[1])) {
                        $TEMPCODE_SETGET[$param[0]] = $param[1];
                    } else {
                        $param_copy = $param;
                        unset($param_copy[0]);
                        $TEMPCODE_SETGET[$param[0]] = implode(',', $param_copy);
                    }
                }
                break;
            case 'GET':
                if (isset($param[0])) {
                    if (isset($TEMPCODE_SETGET[$param[0]])) {
                        if (is_object($TEMPCODE_SETGET[$param[0]])) {
                            $TEMPCODE_SETGET[$param[0]] = $TEMPCODE_SETGET[$param[0]]->evaluate();
                        }
                        $value = $TEMPCODE_SETGET[$param[0]];
                    }
                }
                break;
            case 'EQ':
                if (isset($param[1])) {
                    $first = array_shift($param);
                    $count = 0;
                    foreach ($param as $test) {
                        if ($first == $test) {
                            $count++;
                            break;
                        }
                    }
                    $value = $count != 0 ? '1' : '0';
                }
                break;
            case 'NEQ':
                if (isset($param[1])) {
                    $first = array_shift($param);
                    $count = 0;
                    foreach ($param as $test) {
                        if ($first == $test) {
                            $count++;
                        }
                    }
                    $value = $count == 0 ? '1' : '0';
                }
                break;
            case 'NOT':
                if (isset($param[0])) {
                    $value = $param[0] == '1' || $param[0] == '1' ? '0' : '1';
                }
                break;
            case 'OR':
                $count = 0;
                foreach ($param as $test) {
                    if ($test == '1' || $test == '1') {
                        $count++;
                    }
                }
                $value = $count > 0 ? '1' : '0';
                break;
            case 'AND':
                $count = 0;
                foreach ($param as $test) {
                    if ($test == '1' || $test == '1') {
                        $count++;
                    }
                }
                $value = $count == count($param) ? '1' : '0';
                break;
            case 'HAS_ACTUAL_PAGE_ACCESS':
                if (isset($param[0])) {
                    $value = has_actual_page_access($param !== NULL && isset($param[2]) ? intval($param[2]) : get_member(), $param[0], isset($param[1]) ? $param[1] : NULL) ? '1' : '0';
                }
                break;
            case '?':
                if (isset($param[1])) {
                    $value = $param[0] == '1' || $param[0] == '1' ? $param[1] : (isset($param[2]) ? $param[2] : $value);
                }
                break;
            case 'IMG':
                if (isset($param[0]) && isset($GLOBALS['SITE_DB']) && function_exists('find_theme_image') && $GLOBALS['IN_MINIKERNEL_VERSION'] == 0) {
                    $value = find_theme_image($param[0], isset($param[3]) && $param[3] == '1', false, array_key_exists(2, $param) && $param[2] != '' ? $param[2] : NULL, NULL, isset($param[1]) && $param[1] == '1' ? $GLOBALS['FORUM_DB'] : $GLOBALS['SITE_DB']);
                }
                break;
            case '':
                break;
            case 'META_DATA':
                if (isset($param[0])) {
                    global $META_DATA;
                    if (isset($param[1])) {
                        $matches = array();
                        if ($param[0] == 'image' && preg_match('#^' . preg_quote(find_script('attachment'), '#') . '\\?id=(\\d+)#', $param[1], $matches) != 0) {
                            require_code('attachments');
                            if (!has_attachment_access($GLOBALS['FORUM_DRIVER']->get_guest_id(), intval($matches[1]))) {
                                break;
                            }
                        }
                        $META_DATA[$param[0]] = $param[1];
                    } else {
                        $value = isset($META_DATA[$param[0]]) ? strip_comcode($META_DATA[$param[0]]) : '';
                        if ($value === NULL) {
                            $value = '';
                        }
                    }
                }
                break;
            case 'SPECIAL_CLICK_TO_EDIT':
                $_value = do_lang_tempcode('SPECIAL_CLICK_TO_EDIT');
                $value = $_value->evaluate();
                break;
            case 'KEEP':
                // What needs preserving in the URL
                $value = keep_symbol($param);
                break;
            case 'BROWSER':
                if (isset($param[1])) {
                    $q = false;
                    foreach (explode('|', $param[0]) as $browser) {
                        $q = browser_matches($browser);
                        if ($q) {
                            break;
                        }
                    }
                    $value = $q ? $param[1] : (isset($param[2]) ? $param[2] : '');
                    if ($GLOBALS['XSS_DETECT']) {
                        ocp_mark_as_escaped($value);
                    }
                }
                break;
            case 'JAVASCRIPT_INCLUDE':
                if (isset($param[0])) {
                    require_javascript($param[0]);
                    /*// Has to do this inline, as you're not allowed to reference scripts outside head
                    		if (!array_key_exists($param[0],$GLOBALS['JAVASCRIPTS']))
                    		{
                    			$GLOBALS['JAVASCRIPTS'][$param[0]]=1;
                    			$file=javascript_enforce($param[0]);
                    			$_value=do_template('JAVASCRIPT_NEED_INLINE',array('_GUID'=>'d6c907e26c5a8dd8c65f1d36a1a674a9','CODE'=>file_get_contents($file,FILE_TEXT)));
                    			$value=$_value->evaluate();
                    		}*/
                }
                break;
            case 'FACILITATE_AJAX_BLOCK_CALL':
                if (isset($param[0])) {
                    require_javascript('javascript_ajax');
                    require_code('blocks');
                    $_block_constraints = block_params_to_block_signature(block_params_str_to_arr($param[0]));
                    if (array_key_exists(1, $param)) {
                        $_block_constraints = array_merge($_block_constraints, block_params_str_to_arr($param[1]));
                        ksort($_block_constraints);
                    }
                    $block_constraints = block_params_arr_to_str($_block_constraints);
                    // Store permissions
                    $_auth_key = $GLOBALS['SITE_DB']->query_select('temp_block_permissions', array('id', 'p_time'), array('p_session_id' => get_session_id(), 'p_block_constraints' => $block_constraints), '', 1);
                    if (!array_key_exists(0, $_auth_key)) {
                        $auth_key = $GLOBALS['SITE_DB']->query_insert('temp_block_permissions', array('p_session_id' => get_session_id(), 'p_block_constraints' => $block_constraints, 'p_time' => time()), true);
                    } else {
                        $auth_key = $_auth_key[0]['id'];
                        if (time() - $_auth_key[0]['p_time'] > 100) {
                            $GLOBALS['SITE_DB']->query_update('temp_block_permissions', array('p_time' => time()), array('p_session_id' => get_session_id(), 'p_block_constraints' => $block_constraints), '', 1);
                        }
                    }
                    $keep = symbol_tempcode('KEEP');
                    $value = find_script('snippet') . '?snippet=block&auth_key=' . urlencode(strval($auth_key)) . '&block_map=' . urlencode($param[0]) . $keep->evaluate();
                }
                break;
            case 'LANG':
                $value = user_lang();
                break;
            case '_GET':
                if (isset($param[0])) {
                    $value = get_param($param[0], isset($param[1]) ? $param[1] : '', true);
                }
                break;
            case 'QUERY_STRING':
                $value = ocp_srv('QUERY_STRING');
                break;
            case 'USER_AGENT':
                $value = ocp_srv('HTTP_USER_AGENT');
                break;
            case 'STRIP_TAGS':
                if (isset($param[0])) {
                    if (isset($param[1]) && $param[1] == '1') {
                        $value = strip_tags(str_replace('))', ')', str_replace('((', '(', str_replace('<em>', '(', str_replace('</em>', ')', $param[0])))));
                    } else {
                        $value = strip_tags($param[0], array_key_exists(2, $param) ? $param[2] : '');
                    }
                    if (isset($param[1]) && $param[1] == '1') {
                        $value = @html_entity_decode($value, ENT_QUOTES, get_charset());
                    }
                }
                break;
            case 'CONFIG_OPTION':
                if (isset($param[0])) {
                    if (!isset($GLOBALS['OPTIONS'])) {
                        $value = '0';
                    } else {
                        $value = get_option($param[0], true);
                        if ($value === NULL) {
                            $value = '';
                        }
                    }
                }
                break;
            case 'TRUNCATE_LEFT':
                // Truncate the left length of a string. 0: text to truncate, 1: the truncate length, 2: whether to use a tooltip mouse-over if it is truncated, 3: whether it is encoded as HTML (0=no [default, plain-text], 1=yes)
                $value = symbol_truncator($param, 'left');
                break;
            case 'TRUNCATE_RIGHT':
                $value = symbol_truncator($param, 'right');
                break;
            case 'TRUNCATE_SPREAD':
                $value = symbol_truncator($param, 'spread');
                break;
            case 'TRUNCATE_EXPAND':
                $value = symbol_truncator($param, 'expand');
                break;
            case 'THEME':
                if (isset($GLOBALS['FORUM_DRIVER'])) {
                    $value = $GLOBALS['FORUM_DRIVER']->get_theme();
                } else {
                    $value = 'default';
                }
                break;
            case 'REVERSE':
                if (isset($param[0])) {
                    $value = implode(',', array_reverse(explode(',', $param[0])));
                }
                break;
            case 'COMMA_LIST_GET':
                if (isset($param[1])) {
                    require_code('blocks');
                    $values = block_params_str_to_arr($param[0]);
                    $value = isset($values[$param[1]]) ? $values[$param[1]] : '';
                }
                break;
            case 'COMMA_LIST_SET':
                if (isset($param[2])) {
                    require_code('blocks');
                    $values = block_params_str_to_arr($param[0]);
                    $values[$param[1]] = $param[2];
                    $value = block_params_arr_to_str($values);
                }
                break;
            case 'IS_EMPTY':
                if (isset($param[0])) {
                    $value = $param[0] == '' ? '1' : '0';
                }
                break;
            case 'IS_NON_EMPTY':
                if (isset($param[0])) {
                    $value = $param[0] != '' ? '1' : '0';
                }
                break;
            case 'CUSTOM_BASE_URL':
                $value = get_custom_base_url(isset($param[0]) && $param[0] != '' ? $param[0] == '1' : NULL);
                if (isset($param[1]) && $param[1] == '1') {
                    $value = cdn_filter($value);
                }
                break;
            case 'LOAD_PANEL':
                foreach ($param as $i => $p) {
                    if (is_object($p)) {
                        $param[$i] = $p->evaluate();
                    }
                }
                global $LOADED_PANELS;
                if (strpos($param[0], ':') !== false) {
                    $param = array_reverse(explode(':', $param[0], 2));
                }
                if (substr($param[0], 0, 6) == 'panel_') {
                    $param[0] = substr($param[0], 6);
                }
                $sr = serialize($param);
                $value = array_key_exists($sr, $LOADED_PANELS) ? $LOADED_PANELS[$sr] : '';
                break;
            case 'HAS_JS':
            case 'JS_ON':
                if (isset($param[1])) {
                    $value = has_js() ? $param[0] : $param[1];
                } else {
                    $value = has_js() ? '1' : '0';
                }
                break;
            case 'BASE_URL_NOHTTP':
                $value = preg_replace('#^https?://[^/]+#', '', get_base_url());
                if (substr($value, 0, 2) == '//') {
                    $value = substr($value, 1);
                }
                if (!$GLOBALS['DEBUG_MODE']) {
                    break;
                }
                // Debug mode changes base domain so we need to actually use it in full (fine, we don't have HTTPS in debug mode). Bubble on...
            // Debug mode changes base domain so we need to actually use it in full (fine, we don't have HTTPS in debug mode). Bubble on...
            case 'CUSTOM_BASE_URL_NOHTTP':
                $value = preg_replace('#^https?://[^/]+/#', '/', get_custom_base_url());
                if (substr($value, 0, 2) == '//') {
                    $value = substr($value, 1);
                }
                if (!$GLOBALS['DEBUG_MODE']) {
                    break;
                }
                // Debug mode changes base domain so we need to actually use it in full (fine, we don't have HTTPS in debug mode). Bubble on...
            // Debug mode changes base domain so we need to actually use it in full (fine, we don't have HTTPS in debug mode). Bubble on...
            case 'BASE_URL':
                $value = get_base_url(isset($param[0]) ? $param[0] == '1' : NULL);
                break;
            case 'ZONE':
                $value = get_zone_name();
                break;
            case 'PAGE':
                $value = get_page_name();
                break;
            case 'SITE_NAME':
                $value = get_site_name();
                break;
            case 'HEADER_TEXT':
                global $ZONE;
                $value = $ZONE['zone_header_text_trans'];
                break;
            case 'PANEL_WIDTH':
                if (isset($TEMPCODE_SETGET['PANEL_WIDTH']) && $TEMPCODE_SETGET['PANEL_WIDTH'] != '') {
                    $value = $TEMPCODE_SETGET['PANEL_WIDTH'];
                } else {
                    $value = get_option('panel_width', true);
                    if ($value === NULL) {
                        $value = '13.3em';
                    }
                }
                break;
            case 'PANEL_WIDTH_SPACED':
                if (isset($TEMPCODE_SETGET['PANEL_WIDTH_SPACED']) && $TEMPCODE_SETGET['PANEL_WIDTH_SPACED'] != '') {
                    $value = $TEMPCODE_SETGET['PANEL_WIDTH_SPACED'];
                } else {
                    $value = get_option('panel_width_spaced', true);
                    if (is_null($value)) {
                        $value = '14.3em';
                    }
                }
                break;
            case 'TRIM':
                if (isset($param[0])) {
                    $value = preg_replace(array('#^\\s+#', '#^(<br\\s*/?' . '>\\s*)+#', '#^(&nbsp;)+#', '#\\s+$#', '#(<br\\s*/?' . '>\\s*)+$#', '#(&nbsp;)+$#'), array('', '', '', '', '', ''), $param[0]);
                }
                break;
            case 'CPF_VALUE':
                if (isset($param[0])) {
                    if (is_numeric($param[0])) {
                        require_code('ocf_members');
                        $fields = ocf_get_custom_fields_member(isset($param[1]) ? intval($param[1]) : get_member());
                        if (array_key_exists(intval($param[0]), $fields)) {
                            $_value = $fields[intval($param[0])];
                        }
                    } elseif (substr($param[0], 0, 2) == 'm_' && strpos(strtolower($param[0]), 'hash') === false && strpos(strtolower($param[0]), 'salt') === false) {
                        $_value = $GLOBALS['FORUM_DRIVER']->get_member_row_field(isset($param[1]) ? intval($param[1]) : get_member(), $param[0]);
                    } else {
                        $_value = get_ocp_cpf($param[0], isset($param[1]) ? intval($param[1]) : NULL);
                    }
                    if (!is_string($_value)) {
                        $value = is_null($_value) ? '' : strval($_value);
                    } else {
                        $value = $_value;
                    }
                }
                break;
            case 'BANNER':
                if (addon_installed('banners')) {
                    global $SITE_INFO;
                    $is_on_banners = get_option('is_on_banners') == '1' && (!has_specific_permission(get_member(), 'banner_free') || $GLOBALS['FORUM_DRIVER']->is_super_admin(get_member()) && get_option('admin_banners') == '1' || !is_null($GLOBALS['CURRENT_SHARE_USER']));
                    if (array_key_exists('throttle_bandwidth_registered', $SITE_INFO)) {
                        $views_till_now = intval(get_value('page_views'));
                        $bandwidth_allowed = $SITE_INFO['throttle_bandwidth_registered'];
                        $total_bandwidth = intval(get_value('download_bandwidth'));
                        if ($bandwidth_allowed * 1024 * 1024 >= $total_bandwidth) {
                            $is_on_banners = false;
                        }
                    }
                    if ($is_on_banners && !is_page_https(get_zone_name(), get_page_name())) {
                        require_code('banners');
                        $b_type = isset($param[0]) ? $param[0] : '';
                        $internal_only = isset($param[1]) ? intval($param[1]) : ($b_type == '' ? 0 : 1);
                        if (isset($GLOBALS['NON_CACHEABLE_SYMBOLS']['SET_RAND'])) {
                            $_value = banners_script(true, '', '', $b_type, $internal_only, '');
                            $value = $_value->evaluate();
                        } else {
                            $value = 'Banner goes here';
                        }
                    }
                }
                break;
            case 'AVATAR':
                $value = $GLOBALS['FORUM_DRIVER']->get_member_avatar_url(isset($param[0]) ? intval($param[0]) : get_member());
                if (url_is_local($value) && $value != '') {
                    $value = get_custom_base_url() . '/' . $value;
                }
                break;
            case 'IS_GUEST':
                if (isset($param[0])) {
                    $value = is_guest(intval($param[0])) ? '1' : '0';
                } else {
                    $value = is_guest() ? '1' : '0';
                }
                break;
            case 'MEMBER':
                $value = strval(get_member());
                break;
            case 'USER':
                if (!isset($param[0])) {
                    $value = strval(get_member());
                } else {
                    $member_id = $GLOBALS['FORUM_DRIVER']->get_member_from_username($param[0]);
                    $value = is_null($member_id) ? '' : strval($member_id);
                }
                break;
            case 'CSS_INCLUDE':
                if (isset($param[0])) {
                    require_css($param[0]);
                    /*// Has to do this inline, as you're not allowed to reference sheets outside head
                    		if (!array_key_exists($param[0],$GLOBALS['CSSS']))
                    		{
                    			$GLOBALS['CSSS'][$param[0]]=1;
                    			$file=css_enforce($param[0]);
                    			$_value=do_template('CSS_NEED_INLINE',array('_GUID'=>'9de994d2f6d47a622d49347feb7ebe96','CSS'=>str_replace('../../../../',get_base_url().'/',file_get_contents($file,FILE_TEXT))));
                    			$value=$_value->evaluate();
                    		}*/
                }
                break;
            case 'USER_OVERIDE':
                $value = get_param('id', '');
                if (!is_numeric($value) || $value == '') {
                    $value = strval(get_member());
                }
                break;
            case 'IS_HTTPAUTH_LOGIN':
                $value = is_httpauth_login() ? '1' : '0';
                break;
            case 'MEMBER_PROFILE_LINK':
                $value = $GLOBALS['FORUM_DRIVER']->member_profile_url(!is_null($param) && isset($param[0]) ? intval($param[0]) : get_member(), false, true);
                if (is_null($value)) {
                    $value = '';
                }
                break;
            case 'USERNAME':
                $value = $GLOBALS['FORUM_DRIVER']->get_username(!is_null($param) && isset($param[0]) ? intval($param[0]) : get_member());
                if (is_null($value)) {
                    $value = do_lang('UNKNOWN');
                }
                break;
            case 'CYCLE':
                if (isset($param[0])) {
                    if (!isset($CYCLES[$param[0]])) {
                        $CYCLES[$param[0]] = 0;
                    }
                    if (!isset($param[1])) {
                        $value = strval($CYCLES[$param[0]]);
                    } else {
                        if (count($param) == 2) {
                            $param = array_merge(array($param[0]), explode(',', $param[1]));
                        }
                        ++$CYCLES[$param[0]];
                        if (!array_key_exists($CYCLES[$param[0]], $param)) {
                            $CYCLES[$param[0]] = 1;
                        }
                        $value = $param[$CYCLES[$param[0]]];
                    }
                }
                break;
            case 'THUMBNAIL':
                require_code('images');
                $value = _symbol_thumbnail($param);
                break;
            case 'IMAGE_WIDTH':
                require_code('images');
                list($value, ) = _symbol_image_dims($param);
                break;
            case 'IMAGE_HEIGHT':
                require_code('images');
                list(, $value) = _symbol_image_dims($param);
                break;
            case 'IS_IN_GROUP':
                if (isset($param[0])) {
                    if (in_array($param[count($param) - 1], array('', 'primary', 'secondary'))) {
                        $last_param = $param[count($param) - 1];
                        unset($param[count($param) - 1]);
                    } else {
                        $last_param = '';
                    }
                    $member_id = get_member();
                    $new_param = '';
                    $param_2 = array();
                    foreach ($param as $group) {
                        if (substr($group, 0, 1) == '!' && is_numeric(substr($group, 1))) {
                            $member_id = intval(substr($group, 1));
                        } else {
                            $param_2 = array_merge($param_2, explode(',', $group));
                        }
                    }
                    foreach ($param_2 as $group) {
                        if ($new_param != '') {
                            $new_param .= ',';
                        }
                        $new_param .= $group;
                    }
                    if ($last_param == 'primary') {
                        $member_row = $GLOBALS['FORUM_DRIVER']->get_member_row($member_id);
                        $real_group_list = array($GLOBALS['FORUM_DRIVER']->pname_group($member_row));
                    } elseif ($last_param == 'secondary') {
                        $real_group_list = $GLOBALS['FORUM_DRIVER']->get_members_groups($member_id);
                        $member_row = $GLOBALS['FORUM_DRIVER']->get_member_row($member_id);
                        $real_group_list = array_diff($real_group_list, array($GLOBALS['FORUM_DRIVER']->pname_group($member_row)));
                    } else {
                        $real_group_list = $GLOBALS['FORUM_DRIVER']->get_members_groups($member_id);
                    }
                    require_code('ocfiltering');
                    $value = count(array_intersect(ocfilter_to_idlist_using_memory($new_param, $GLOBALS['FORUM_DRIVER']->get_usergroup_list()), $real_group_list)) != 0 ? '1' : '0';
                }
                break;
            case 'IS_STAFF':
                if (isset($GLOBALS['FORUM_DRIVER'])) {
                    $value = $GLOBALS['FORUM_DRIVER']->is_staff(!is_null($param) && isset($param[0]) ? intval($param[0]) : get_member()) ? '1' : '0';
                } else {
                    $value = '0';
                }
                break;
            case 'IS_SUPER_ADMIN':
                if (isset($GLOBALS['FORUM_DRIVER'])) {
                    $value = $GLOBALS['FORUM_DRIVER']->is_super_admin(!is_null($param) && isset($param[0]) ? intval($param[0]) : get_member()) ? '1' : '0';
                } else {
                    $value = '0';
                }
                break;
            case 'PHOTO':
                if (isset($param[0])) {
                    $value = $GLOBALS['FORUM_DRIVER']->get_member_photo_url(intval($param[0]));
                    if (url_is_local($value) && $value != '') {
                        $value = get_custom_base_url() . '/' . $value;
                    }
                }
                break;
            case 'OCF_RANK_IMAGE':
                if (addon_installed('ocf_forum')) {
                    require_code('ocf_groups');
                    $rank_images = new ocp_tempcode();
                    $member_id = isset($param[0]) ? intval($param[0]) : get_member();
                    $posters_groups = $GLOBALS['FORUM_DRIVER']->get_members_groups($member_id, true);
                    foreach ($posters_groups as $group) {
                        $rank_image = ocf_get_group_property($group, 'rank_image');
                        $group_leader = ocf_get_group_property($group, 'group_leader');
                        $group_name = ocf_get_group_name($group);
                        $rank_image_pri_only = ocf_get_group_property($group, 'rank_image_pri_only');
                        if ($rank_image != '' && ($rank_image_pri_only == 0 || $group == $GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id, 'm_primary_group'))) {
                            $rank_images->attach(do_template('OCF_RANK_IMAGE', array('USERNAME' => $GLOBALS['FORUM_DRIVER']->get_username($member_id), 'GROUP_NAME' => $group_name, 'IMG' => $rank_image, 'IS_LEADER' => $group_leader == $member_id)));
                        }
                    }
                    $value = $rank_images->evaluate();
                }
                break;
            case 'TOTAL_POINTS':
                if (addon_installed('points')) {
                    require_code('points');
                    $value = strval(total_points(isset($param[0]) ? intval($param[0]) : get_member()));
                }
                break;
            case 'POINTS_USED':
                if (addon_installed('points')) {
                    require_code('points');
                    $value = strval(points_used(isset($param[0]) ? intval($param[0]) : get_member()));
                }
                break;
            case 'AVAILABLE_POINTS':
                if (addon_installed('points')) {
                    require_code('points');
                    $value = strval(available_points(isset($param[0]) ? intval($param[0]) : get_member()));
                }
                break;
            case 'URL_FOR_GET_FORM':
                if (isset($param[0])) {
                    $url_bits = parse_url($param[0]);
                    if (array_key_exists('scheme', $url_bits)) {
                        $value = $url_bits['scheme'] . '://' . (array_key_exists('host', $url_bits) ? $url_bits['host'] : 'localhost');
                        if (array_key_exists('port', $url_bits) && $url_bits['port'] != 80) {
                            $value .= ':' . strval($url_bits['port']);
                        }
                    }
                    if (array_key_exists('path', $url_bits)) {
                        $value .= $url_bits['path'];
                    }
                }
                break;
            case 'HIDDENS_FOR_GET_FORM':
                $_value = new ocp_tempcode();
                $url_bits = parse_url($param[0]);
                if (array_key_exists('query', $url_bits) && $url_bits['query'] != '') {
                    foreach (explode('&', $url_bits['query']) as $exp) {
                        $parts = explode('=', $exp, 2);
                        if (count($parts) == 2) {
                            if (!in_array($parts[0], $param)) {
                                $_value->attach(form_input_hidden($parts[0], urldecode($parts[1])));
                            }
                        }
                    }
                }
                $value = $_value->evaluate();
                break;
            case 'NOTIFICATIONS_ENABLED':
                $value = '';
                if (array_key_exists(0, $param)) {
                    require_code('notifications');
                    $value = notifications_enabled(array_key_exists(1, $param) ? $param[1] : get_page_name(), $param[0]) ? '1' : '0';
                }
                break;
            case 'DOCUMENT_HELP':
                global $DOCUMENT_HELP, $HELPER_PANEL_TUTORIAL;
                $value = $DOCUMENT_HELP;
                if ($value == '' && $HELPER_PANEL_TUTORIAL != '') {
                    $value = brand_base_url() . '/docs' . strval(ocp_version()) . '/pg/' . $HELPER_PANEL_TUTORIAL;
                }
                break;
            case 'HTTP_STATUS_CODE':
                global $HTTP_STATUS_CODE;
                $value = $HTTP_STATUS_CODE;
                break;
            case 'TEMPCODE':
                if (isset($param[0])) {
                    require_code('tempcode_compiler');
                    $_value = template_to_tempcode($param[0]);
                    $value = $_value->evaluate();
                }
                break;
            case 'COMCODE':
                if (isset($param[0])) {
                    $_value = comcode_to_tempcode($param[0], NULL, true);
                    $value = $_value->evaluate();
                }
                break;
            case 'FLAGRANT':
                $_value = get_flagrant();
                $value = $_value->evaluate();
                break;
            case 'IMG_WIDTH':
            case 'IMG_HEIGHT':
                if (isset($param[0]) && isset($GLOBALS['SITE_DB']) && function_exists('find_theme_image') && $GLOBALS['IN_MINIKERNEL_VERSION'] == 0) {
                    global $THEME_IMG_DIMS_CACHE;
                    if (!isset($THEME_IMG_DIMS_CACHE)) {
                        $THEME_IMG_DIMS_CACHE = function_exists('persistant_cache_get') ? persistant_cache_get('THEME_IMG_DIMS') : array();
                    }
                    if (isset($THEME_IMG_DIMS_CACHE[$param[0]])) {
                        list($width, $height) = $THEME_IMG_DIMS_CACHE[$param[0]];
                        $value = $name == 'IMG_WIDTH' ? $width : $height;
                    } else {
                        if (strpos($param[0], '://') === false) {
                            $img_url = find_theme_image($param[0], false, false, array_key_exists(2, $param) ? $param[2] : NULL, NULL, isset($param[1]) && $param[1] == '1' ? $GLOBALS['FORUM_DB'] : $GLOBALS['SITE_DB']);
                        } else {
                            $img_url = $param[0];
                        }
                        require_code('images');
                        list($width, $height) = _symbol_image_dims(array($img_url));
                        $value = $name == 'IMG_WIDTH' ? $width : $height;
                        $THEME_IMG_DIMS_CACHE[$param[0]] = array($width, $height);
                        if (function_exists('persistant_cache_set')) {
                            persistant_cache_set('THEME_IMG_DIMS', $THEME_IMG_DIMS_CACHE);
                        }
                    }
                }
                break;
            case 'CLEAN_FILE_SIZE':
                if (isset($param[0])) {
                    $bytes = is_numeric($param[0]) ? intval($param[0]) : NULL;
                    require_code('files');
                    $value = clean_file_size($bytes);
                }
                break;
            case 'TIME_PERIOD':
                if (isset($param[0])) {
                    $value = display_time_period(intval($param[0]));
                }
                break;
            case 'MAKE_RELATIVE_DATE':
                if (isset($param[0])) {
                    if (get_option('use_contextual_dates') == '0' && (!array_key_exists(1, $param) || $param[1] != '1')) {
                        $value = get_timezoned_date(intval($param[0]));
                    } else {
                        $value = display_time_period(time() - intval($param[0]));
                    }
                }
                break;
            case 'TIMEZONE':
                $value = make_nice_timezone_name(get_site_timezone());
                break;
            case 'LOAD_PAGE':
                foreach ($param as $i => $p) {
                    if (is_object($p)) {
                        $param[$i] = $p->evaluate();
                    }
                }
                global $LOADED_PAGES;
                if (strpos($param[0], ':') !== false) {
                    $param = array_reverse(explode(':', $param[0], 2));
                }
                $_value = $LOADED_PAGES[serialize($param)];
                $value = $_value->evaluate();
                break;
            case 'RUNNING_SCRIPT':
                if (isset($param[0])) {
                    $value = running_script($param[0]) ? '1' : '0';
                }
                break;
            case 'MATCH_KEY_MATCH':
                $value = '0';
                foreach ($param as $match_key) {
                    if ($match_key == '1' || $match_key == '0' || $match_key == '') {
                        continue;
                    }
                    if (match_key_match($match_key, isset($param[1]) && $match_key == '1')) {
                        $value = '1';
                    }
                }
                break;
            case 'VERSION':
                $value = strval(ocp_version());
                break;
            case 'PREVIEW_VALIDATION':
                $value = get_option('is_on_preview_validation') == '1' ? '1' : '0';
                break;
            case 'BLOCK':
                if (isset($GLOBALS['NON_CACHEABLE_SYMBOLS']['SET_RAND'])) {
                    foreach ($param as $i => $p) {
                        if (is_object($p)) {
                            $param[$i] = $p->evaluate();
                        }
                    }
                    if (count($param) == 1 && strpos($param[0], ',') !== false) {
                        $param = preg_split('#((?<!\\\\)|(?<=\\\\\\\\)|(?<=^)),#', $param[0]);
                        foreach ($param as $key => $val) {
                            $param[$key] = str_replace('\\,', ',', $val);
                        }
                    }
                    global $LOADED_BLOCKS;
                    if (isset($LOADED_BLOCKS[serialize($param)])) {
                        // Will always be set
                        $value = $LOADED_BLOCKS[serialize($param)]->evaluate();
                    }
                }
                break;
            case 'CURRENCY':
                if (addon_installed('ecommerce')) {
                    if (isset($param[0])) {
                        require_code('currency');
                        $value = currency_convert(floatval(str_replace(',', '', $param[0])), isset($param[1]) && $param[1] != '' ? $param[1] : get_option('currency'), isset($param[2]) && $param[2] != '' ? $param[2] : NULL, isset($param[3]) && $param[3] == '1');
                        if (is_null($value)) {
                            $value = do_lang('INTERNAL_ERROR');
                        }
                    } else {
                        $value = get_option('currency');
                    }
                }
                break;
            case 'CURRENCY_SYMBOL':
                if (addon_installed('ecommerce')) {
                    require_code('ecommerce');
                    $value = ecommerce_get_currency_symbol();
                }
                break;
            case 'GEOLOCATE':
                $value = geolocate_ip(isset($param[0]) ? $param[0] : NULL);
                break;
            case 'NO_SAFE_MODE':
                $value = str_replace(array('on', 'true', 'yes'), array('1', '1', '1'), strtolower(ini_get('safe_mode'))) == '1' ? '0' : '1';
                break;
            case 'FORCE_PREVIEWS':
                if (get_option('forced_preview_option') == '1') {
                    if (get_forum_type() == 'ocf') {
                        if (is_guest() && get_option('default_preview_guests') == '0') {
                            $value = '0';
                        } else {
                            $value = $GLOBALS['FORUM_DRIVER']->get_member_row_field(get_member(), 'm_preview_posts') == 1 ? '1' : '0';
                        }
                    } else {
                        $value = get_option('default_preview_guests') == '0' ? '0' : '1';
                    }
                } else {
                    $value = '0';
                }
                break;
            case 'PREVIEW_URL':
                $value = find_script('preview');
                $value .= '?page=' . get_page_name();
                $value .= '&type=' . get_param('type', '', true);
                break;
            case 'ADDON_INSTALLED':
                if (isset($param[0]) && !running_script('install')) {
                    $value = addon_installed($param[0]) ? '1' : '0';
                }
                break;
            case 'VALUE_OPTION':
                if (isset($param[0])) {
                    $value = function_exists('get_value') ? get_value($param[0]) : '';
                    if (is_null($value)) {
                        $value = function_exists('get_long_value') ? get_long_value($param[0]) : '';
                        if (is_null($value)) {
                            $value = isset($param[1]) ? $param[1] : '';
                            if ($param[0] == 'textmate' && (ocp_srv('HTTP_HOST') == 'localhost' && strpos(ocp_srv('HTTP_USER_AGENT'), 'Macintosh') !== false)) {
                                $value = '1';
                            }
                        }
                    }
                }
                break;
            case 'KEEP_INDEX':
                // What needs preserving in the URL
                $value = 'index.php';
                if (count($_GET) > 0) {
                    foreach ($_GET as $key => $val) {
                        if (is_array($val)) {
                            continue;
                        }
                        if (get_magic_quotes_gpc()) {
                            $val = stripslashes($val);
                        }
                        if (substr($key, 0, 5) == 'keep_' && !skippable_keep($key, $val) && strpos($key, '_expand_') === false) {
                            $value .= ($value == 'index.php' ? '?' : '&') . urlencode($key) . '=' . ocp_url_encode($val);
                        }
                    }
                }
                break;
            case 'HIDE_HELP_PANEL':
                $value = array_key_exists('hide_help_panel', $_COOKIE) && $_COOKIE['hide_help_panel'] == '1' ? '1' : '0';
                break;
            case 'URLISE_LANG':
                if (isset($param[1])) {
                    $_value = urlise_lang($param[0], $param[1], isset($param[2]) ? $param[2] : '', isset($param[3]) ? $param[3] == '1' : false);
                    $value = $_value->evaluate();
                }
                break;
            case 'FIND_SCRIPT_NOHTTP':
                if (isset($param[0]) && function_exists('find_script')) {
                    $value = preg_replace('#^https?://[^/]+#', '', find_script($param[0], false, isset($param[1]) ? intval($param[1]) : 0));
                }
                if (!$GLOBALS['DEBUG_MODE']) {
                    break;
                }
                // Debug mode changes base domain so we need to actually use it in full (fine, we don't have HTTPS in debug mode). Bubble on...
            // Debug mode changes base domain so we need to actually use it in full (fine, we don't have HTTPS in debug mode). Bubble on...
            case 'FIND_SCRIPT':
                if (isset($param[0]) && function_exists('find_script')) {
                    $value = find_script($param[0], false, isset($param[1]) ? intval($param[1]) : 0);
                }
                break;
            case 'MOBILE':
                $value = is_mobile(NULL, array_key_exists(0, $param) ? $param[0] == '1' : false) ? '1' : '0';
                break;
            case 'VALID_FILE_TYPES':
                $value = get_option('valid_types');
                $types = array_flip(explode(',', $value));
                $value = '';
                ksort($types);
                foreach (array_flip($types) as $val) {
                    $value .= $val . ',';
                }
                $value = substr($value, 0, strlen($value) - 1);
                break;
            case 'BROWSER_UA':
                $browser = get_browser_string();
                $value = $browser;
                break;
            case 'OS':
                $os = get_os_string();
                if (is_null($os)) {
                    $os = '';
                }
                $value = $os;
                break;
            case 'ANCHOR':
                if (isset($param[0])) {
                    $_value = do_template('ANCHOR', array('_GUID' => '8795c70c9dd7c6217bb765264ac24092', 'NAME' => $param[0]));
                    $value = $_value->evaluate();
                }
                break;
            case 'CSS_TEMPCODE':
                $_value = css_tempcode();
                $value = $_value->evaluate();
                break;
            case 'JS_TEMPCODE':
                $_value = javascript_tempcode(isset($param[0]) ? $param[0] : NULL);
                $value = $_value->evaluate();
                break;
            case 'PAD_LEFT':
                if (array_key_exists(1, $param)) {
                    $value = str_pad($param[0], intval($param[1]), array_key_exists(2, $param) ? $param[2] : '', STR_PAD_LEFT);
                }
                break;
            case 'PAD_RIGHT':
                if (array_key_exists(1, $param)) {
                    $value = str_pad($param[0], intval($param[1]), array_key_exists(2, $param) ? $param[2] : '', STR_PAD_RIGHT);
                }
                break;
            case 'PAGE_TITLE':
                $value = is_null($DISPLAYED_TITLE) ? '' : $DISPLAYED_TITLE->evaluate();
                break;
            case 'SET_TITLE':
                if (array_key_exists(0, $param)) {
                    get_page_title($param[0], false);
                }
                break;
            case 'EXTRA_HEAD':
                $_value = $GLOBALS['EXTRA_HEAD'];
                if ($_value === NULL) {
                    $_value = new ocp_tempcode();
                }
                $value = $_value->evaluate();
                break;
            case 'EXTRA_FOOT':
                if ($GLOBALS['EXTRA_FOOT'] === NULL) {
                    $GLOBALS['EXTRA_FOOT'] = new ocp_tempcode();
                }
                $_value = $GLOBALS['EXTRA_FOOT'];
                if (array_key_exists(0, $param)) {
                    $GLOBALS['EXTRA_FOOT']->attach($param[0]);
                } else {
                    $value = $_value->evaluate();
                }
                break;
            case 'RAND':
                if (isset($GLOBALS['NON_CACHEABLE_SYMBOLS']['RAND'])) {
                    $GLOBALS['NO_EVAL_CACHE'] = true;
                    $value = strval(mt_rand(0, 32000));
                } else {
                    $value = '4';
                }
                break;
            case 'SET_RAND':
                if (isset($param[0])) {
                    if (isset($GLOBALS['NON_CACHEABLE_SYMBOLS']['SET_RAND'])) {
                        $GLOBALS['NO_EVAL_CACHE'] = true;
                        $value = $param[mt_rand(0, count($param) - 1)];
                    } else {
                        $value = $param[0];
                    }
                }
                break;
            case 'COPYRIGHT':
                $value = str_replace('$CURRENT_YEAR', date('Y'), get_option('copyright'));
                break;
            case 'KEYWORDS_SPACED':
                $value = str_replace(',', ' ', get_option('keywords'));
                break;
            case 'STAFF_ADDRESS_PURE':
                $value = get_option('staff_address');
                break;
            case 'STAFF_ADDRESS':
                require_code('obfuscate');
                $value = obfuscate_email_address(get_option('staff_address'));
                break;
            case 'DOMAIN':
                $value = get_domain();
                break;
            case 'BRAND_NAME':
                $value = function_exists('get_value') ? get_value('rebrand_name') : NULL;
                if (is_null($value)) {
                    $value = 'ocPortal';
                }
                break;
            case 'BRAND_BASE_URL':
                $value = brand_base_url();
                break;
            case 'SHOW_DOCS':
                $value = get_option('show_docs') === '0' ? '0' : '1';
                break;
            case 'MEMBER_EMAIL':
                $value = $GLOBALS['FORUM_DRIVER']->get_member_email_address(isset($param[0]) ? intval($param[0]) : get_member());
                break;
            case 'OCF_MEMBER_HTML':
                if (get_forum_type() == 'ocf') {
                    require_code('ocf_members');
                    require_code('ocf_members2');
                    $_value = ocf_show_member_box(isset($param[0]) ? intval($param[0]) : get_member());
                    $value = $_value->evaluate();
                }
                break;
            case 'HAS_SPECIFIC_PERMISSION':
                if (isset($param[0])) {
                    $value = has_specific_permission(!is_null($param) && isset($param[1]) ? intval($param[1]) : get_member(), $param[0]) ? '1' : '0';
                }
                break;
            case 'HAS_ZONE_ACCESS':
                if (isset($param[0])) {
                    $value = has_zone_access(!is_null($param) && isset($param[1]) ? intval($param[1]) : get_member(), $param[0]) ? '1' : '0';
                }
                break;
            case 'HAS_PAGE_ACCESS':
                if (isset($param[0]) && isset($param[1])) {
                    $value = has_page_access(!is_null($param) && isset($param[2]) ? intval($param[2]) : get_member(), $param[0], $param[1], !is_null($param) && isset($param[3]) ? $param[3] == '1' : false) ? '1' : '0';
                }
                break;
            case 'HAS_CATEGORY_ACCESS':
                if (isset($param[0])) {
                    $value = has_category_access(!is_null($param) && isset($param[2]) ? intval($param[2]) : get_member(), $param[0], $param[1]) ? '1' : '0';
                }
                break;
            case 'HAS_ATTACHMENT_ACCESS':
                if (isset($param[0])) {
                    require_code('attachments');
                    $value = has_attachment_access(!is_null($param) && isset($param[1]) ? intval($param[1]) : get_member(), $param[0]) ? '1' : '0';
                }
                break;
            case 'HAS_SUBMIT_PERMISSION':
                if (isset($param[0]) && (strtolower($param[0]) == 'low' || strtolower($param[0]) == 'mid' || strtolower($param[0]) == 'high')) {
                    $value = has_submit_permission(strtolower($param[0]), !is_null($param) && isset($param[1]) ? intval($param[1]) : get_member(), !is_null($param) && isset($param[2]) ? $param[2] : get_ip_address(), !is_null($param) && isset($param[3]) ? $param[3] : get_page_name()) ? '1' : '0';
                }
                break;
            case 'HAS_DELETE_PERMISSION':
                if (isset($param[0]) && (strtolower($param[0]) == 'low' || strtolower($param[0]) == 'mid' || strtolower($param[0]) == 'high') && isset($param[1])) {
                    $value = has_delete_permission(strtolower($param[0]), !is_null($param) && isset($param[2]) ? intval($param[2]) : get_member(), intval($param[1]), !is_null($param) && isset($param[3]) ? $param[3] : get_page_name()) ? '1' : '0';
                }
                break;
            case 'HAS_EDIT_PERMISSION':
                if (isset($param[0]) && (strtolower($param[0]) == 'low' || strtolower($param[0]) == 'mid' || strtolower($param[0]) == 'high') && isset($param[1])) {
                    $value = has_edit_permission(strtolower($param[0]), !is_null($param) && isset($param[2]) ? intval($param[2]) : get_member(), intval($param[1]), !is_null($param) && isset($param[3]) ? $param[3] : get_page_name()) ? '1' : '0';
                }
                break;
            case 'ENTITY_DECODE':
                if (isset($param[0])) {
                    $value = @html_entity_decode($param[0], ENT_QUOTES, get_charset());
                }
                break;
            case 'RESET_CYCLE':
                if (isset($param[0])) {
                    $CYCLES[$param[0]] = 0;
                }
                break;
            case 'SITE_SCOPE':
                $value = get_option('site_scope');
                break;
            case 'LAST_VISIT_TIME':
                if (get_forum_type() == 'ocf') {
                    $member_info = ocf_read_in_member_profile(get_member(), true);
                    $value = strval($member_info['last_visit_time']);
                }
                break;
            case 'NUM_NEW_TOPICS':
                if (get_forum_type() == 'ocf') {
                    $member_info = ocf_read_in_member_profile(get_member(), true);
                    $_new_topics = $GLOBALS['FORUM_DB']->query('SELECT COUNT(*) AS mycnt FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_topics WHERE NOT t_forum_id IS NULL AND t_cache_first_time>' . strval((int) $member_info['last_visit_time']));
                    $new_topics = $_new_topics[0]['mycnt'];
                    $value = strval($new_topics);
                }
                break;
            case 'NUM_NEW_POSTS':
                if (get_forum_type() == 'ocf') {
                    $member_info = ocf_read_in_member_profile(get_member(), true);
                    $_new_posts = $GLOBALS['FORUM_DB']->query('SELECT COUNT(*) AS mycnt FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_posts WHERE NOT p_cache_forum_id IS NULL AND p_time>' . strval((int) $member_info['last_visit_time']));
                    $new_posts = $_new_posts[0]['mycnt'];
                    $value = strval($new_posts);
                }
                break;
            case 'HAS_FORUM':
                $value = has_no_forum() ? '0' : '1';
                break;
            case 'OCF':
                $value = get_forum_type() == 'ocf' ? '1' : '0';
                break;
            case 'BOARD_PREFIX':
                $value = get_forum_base_url();
                break;
            case 'DATE_AND_TIME':
                $use_contextual_dates = isset($param[0]) && $param[0] == '1';
                $verbose = isset($param[1]) && $param[1] == '1';
                $server_time = isset($param[2]) && $param[2] == '1';
                $time = isset($param[3]) ? intval($param[3]) : time();
                $value = get_timezoned_date($time, true, $verbose, $server_time, !$use_contextual_dates);
                break;
            case 'DATE':
                $use_contextual_dates = isset($param[0]) && $param[0] == '1';
                $verbose = isset($param[1]) && $param[1] == '1';
                $server_time = isset($param[2]) && $param[2] == '1';
                $time = isset($param[3]) ? intval($param[3]) : time();
                $value = get_timezoned_date($time, false, $verbose, $server_time, !$use_contextual_dates);
                break;
            case 'TIME':
                $time = isset($param[0]) ? intval($param[0]) : time();
                $value = get_timezoned_time($time);
                break;
            case 'SECONDS_PERIOD':
                if (array_key_exists(0, $param)) {
                    $value = display_seconds_period(intval($param[0]));
                }
                break;
            case 'FROM_TIMESTAMP':
                if (isset($param[0])) {
                    $timestamp = isset($param[1]) ? intval($param[1]) : time();
                    if (!array_key_exists(2, $param) || $param[2] == '1') {
                        $timestamp = utctime_to_usertime($timestamp);
                    }
                    $value = locale_filter(my_strftime($param[0], $timestamp));
                    if ($value == $param[0]) {
                        // If no conversion happened then the syntax must have been for 'date' not 'strftime'
                        $value = date($param[0], $timestamp);
                    }
                } else {
                    $timestamp = time();
                    $value = strval($timestamp);
                }
                break;
            case 'TO_TIMESTAMP':
                if (isset($param[0])) {
                    $value = strval(strtotime($param[0]));
                    if (array_key_exists(1, $param) && $param[1] == '1') {
                        $value = strval(usertime_to_utctime(intval($value)));
                    }
                    // '1' means date was in user-time so needs converting to a UTC timestamp
                } else {
                    $value = strval(time());
                }
                break;
            case 'SESSION_HASHED':
                $value = md5(strval(get_session_id()));
                break;
            case 'SESSION':
                $value = strval(get_session_id());
                break;
            case 'IN_ARRAY':
                if (isset($param[1])) {
                    $array = array_slice($param, 1);
                    $value = in_array($param[0], $array) ? '1' : '0';
                }
                break;
            case 'MULT':
                if (isset($param[1])) {
                    $value = float_to_raw_string(floatval($param[0]) * floatval($param[1]), 2, true);
                }
                break;
            case 'ROUND':
                if (isset($param[0])) {
                    $amount = isset($param[1]) ? intval($param[1]) : 0;
                    if ($amount > 0) {
                        $value = float_format(floatval($param[0]), $amount);
                    } else {
                        $value = strval(intval(round(floatval($param[0]), $amount)));
                    }
                }
                break;
            case 'DEV_MODE':
                $value = $GLOBALS['DEBUG_MODE'] ? '1' : '0';
                break;
            case 'BROWSER_MATCHES':
                if (isset($param[0])) {
                    $q = false;
                    foreach (explode('|', $param[0]) as $browser) {
                        $q = browser_matches($browser);
                        if ($q) {
                            break;
                        }
                    }
                    $value = $q ? '1' : '0';
                }
                break;
            case 'ISSET':
                if (isset($param[0])) {
                    $value = isset($TEMPCODE_SETGET[$param[0]]) ? '1' : '0';
                }
                break;
            case 'INIT':
                if (isset($param[1])) {
                    if (!isset($TEMPCODE_SETGET[$param[0]])) {
                        $TEMPCODE_SETGET[$param[0]] = $param[1];
                    }
                }
                break;
            case 'INC':
                if (isset($param[0])) {
                    if (!isset($TEMPCODE_SETGET[$param[0]])) {
                        $TEMPCODE_SETGET[$param[0]] = '0';
                    }
                    $TEMPCODE_SETGET[$param[0]] = strval(intval($TEMPCODE_SETGET[$param[0]]) + 1);
                }
                break;
            case 'DEC':
                if (isset($param[0])) {
                    if (!isset($TEMPCODE_SETGET[$param[0]])) {
                        $TEMPCODE_SETGET[$param[0]] = '0';
                    }
                    $TEMPCODE_SETGET[$param[0]] = strval(intval($TEMPCODE_SETGET[$param[0]]) - 1);
                }
                break;
            case 'PREG_MATCH':
                if (isset($param[1])) {
                    $value = preg_match('#' . str_replace('#', '\\#', $param[0]) . '#' . (isset($param[2]) ? str_replace('e', '', $param[2]) : ''), $param[1]) != 0 ? '1' : '0';
                }
                break;
            case 'PREG_REPLACE':
                if (isset($param[2])) {
                    $value = preg_replace('#' . str_replace('#', '\\#', $param[0]) . '#' . (isset($param[3]) ? str_replace('e', '', $param[3]) : ''), $param[1], $param[2]);
                }
                break;
            case 'MAX':
                if (isset($param[0])) {
                    $value = strval(max(intval($param[0]), intval($param[1])));
                }
                break;
            case 'MIN':
                if (isset($param[0])) {
                    $value = strval(min(intval($param[0]), intval($param[1])));
                }
                break;
            case 'MOD':
                if (isset($param[0])) {
                    $value = strval(max(intval($param[0]), -intval($param[0])));
                }
                break;
            case 'REM':
                if (isset($param[1])) {
                    $value = strval(intval($param[0]) % intval($param[1]));
                }
                break;
            case 'DIV_FLOAT':
                if (isset($param[1])) {
                    $value = float_to_raw_string(floatval($param[0]) / floatval($param[1]), 2, true);
                }
                break;
            case 'DIV':
                if (isset($param[1])) {
                    $value = strval(intval(floor(floatval($param[0]) / floatval($param[1]))));
                }
                break;
            case 'SUBTRACT':
                if (isset($param[1])) {
                    $value = float_to_raw_string(floatval(str_replace(',', '', $param[0])) - floatval(str_replace(',', '', $param[1])), 2, true);
                }
                break;
            case 'ADD':
                if (isset($param[1])) {
                    $value = float_to_raw_string(floatval(str_replace(',', '', $param[0])) + floatval(str_replace(',', '', $param[1])), 2, true);
                }
                break;
            case 'WCASE':
                if (isset($param[0])) {
                    $value = ucwords($param[0]);
                }
                break;
            case 'LCASE':
                if (isset($param[0])) {
                    $value = ocp_mb_strtolower($param[0]);
                }
                break;
            case 'UCASE':
                if (isset($param[0])) {
                    $value = ocp_mb_strtoupper($param[0]);
                }
                break;
            case '_POST':
                if (isset($param[0])) {
                    $value = post_param($param[0], isset($param[1]) ? $param[1] : '');
                }
                break;
            case 'REPLACE':
                if (isset($param[2])) {
                    $value = str_replace($param[0], $param[1], $param[2]);
                    if ($GLOBALS['XSS_DETECT'] && ocp_is_escaped($param[0])) {
                        ocp_mark_as_escaped($value);
                    }
                }
                break;
            case 'AT':
                if (isset($param[1])) {
                    $value = ocp_mb_substr($param[0], intval($param[1]), 1);
                }
                break;
            case 'STRPOS':
                if (isset($param[1])) {
                    $t_value = strpos($param[0], $param[1]);
                    $value = $t_value === false ? '0' : strval($t_value);
                }
                break;
            case 'IN_STR':
                if (isset($param[1])) {
                    if ($param[1] == '') {
                        $value = '0';
                    } else {
                        $value = '0';
                        foreach ($param as $i => $check) {
                            if (is_integer($i) && $i != 0 && $check != '') {
                                if (strpos($param[0], $check) !== false) {
                                    $value = '1';
                                    break;
                                }
                            }
                        }
                    }
                }
                break;
            case 'SUBSTR_COUNT':
                if (isset($param[1])) {
                    $value = strval(substr_count($param[0], $param[1]));
                }
                break;
            case 'SUBSTR':
                if (isset($param[1])) {
                    $value = ocp_mb_substr($param[0], intval($param[1]), isset($param[2]) ? intval($param[2]) : strlen($param[0]));
                }
                break;
            case 'LENGTH':
                if (isset($param[0])) {
                    $value = strval(ocp_mb_strlen($param[0]));
                }
                break;
            case 'WORDWRAP':
                if (isset($param[1])) {
                    $cut = isset($param[3]) && $param[3] == '1';
                    $value = wordwrap($param[0], intval($param[1]), isset($param[2]) ? $param[2] : '<br />', $cut);
                    if ($GLOBALS['XSS_DETECT'] && ocp_is_escaped($param[0])) {
                        ocp_mark_as_escaped($value);
                    }
                }
                break;
            case 'ALTERNATOR_TRUNCATED':
                // Alternate values according to whether some given text WOULD have been truncated. 0: text to check against, 1: the truncate length, 2:IF would not be do this, 3: if it would be do this, 4: whether given text is encoded as HTML (0=no [default, plain-text], 1=yes)
                if (isset($param[3])) {
                    $amount = intval($param[1]);
                    $is_html = isset($param[4]) && $param[4] == '1';
                    if (strlen($is_html ? strip_tags($param[0]) : $param[0]) > $amount) {
                        $value = $param[3];
                    } else {
                        $value = $param[2];
                    }
                }
                break;
            case 'ESCAPE':
                if (isset($param[0])) {
                    $d_escaping = array(isset($param[1]) ? constant($param[1]) : ENTITY_ESCAPED);
                    if (is_string($param[0])) {
                        apply_tempcode_escaping($d_escaping, $param[0]);
                    }
                    $value = $param[0];
                }
                break;
            case 'COOKIE_PATH':
                $value = function_exists('get_cookie_path') ? get_cookie_path() : '/';
                break;
            case 'COOKIE_DOMAIN':
                $s_value = function_exists('get_cookie_domain') ? get_cookie_domain() : '';
                $value = is_null($s_value) ? '' : $s_value;
                break;
            case 'IS_A_COOKIE_LOGIN':
                global $IS_A_COOKIE_LOGIN;
                $value = $IS_A_COOKIE_LOGIN && ini_get('suhosin.cookie.max_name_length') !== '64' ? '1' : '0';
                break;
            case 'GROUP_ID':
                if (isset($param[0])) {
                    $groups = $GLOBALS['FORUM_DRIVER']->get_members_groups(isset($param[1]) ? intval($param[1]) : get_member());
                    $value = array_key_exists(intval($param[0]), $groups) ? strval($groups[intval($param[0])]) : '';
                }
                break;
            case 'GROUP_NAME':
                if (isset($param[0])) {
                    $groups = $GLOBALS['FORUM_DRIVER']->get_members_groups(isset($param[1]) ? intval($param[1]) : get_member());
                    if (array_key_exists(intval($param[0]), $groups)) {
                        $all_usergroups = $GLOBALS['FORUM_DRIVER']->get_usergroup_list();
                        $value = $all_usergroups[$groups[intval($param[0])]];
                    }
                    if ($GLOBALS['XSS_DETECT'] && ocp_is_escaped($param[0])) {
                        ocp_mark_as_escaped($value);
                    }
                }
                break;
            case 'NEGATE':
                if (isset($param[0])) {
                    $value = strval(-intval($param[0]));
                }
                break;
            case 'XOR':
                $count = 0;
                foreach ($param as $test) {
                    if ($test == '1' || $test == '1') {
                        $count++;
                    }
                }
                $value = $count == 1 ? '1' : '0';
                break;
            case 'NOR':
                $count = 0;
                foreach ($param as $test) {
                    if ($test == '1' || $test == '1') {
                        $count++;
                    }
                }
                $value = $count > 0 ? '0' : '1';
                break;
            case 'NAND':
                $count = 0;
                foreach ($param as $test) {
                    if ($test == '1' || $test == '1') {
                        $count++;
                    }
                }
                $value = $count == count($param) ? '0' : '1';
                break;
            case 'LT':
                if (isset($param[1])) {
                    $value = intval($param[0]) < intval($param[1]) ? '1' : '0';
                }
                break;
            case 'GT':
                if (isset($param[1])) {
                    $value = intval($param[0]) > intval($param[1]) ? '1' : '0';
                }
                break;
            case 'COPPA_ON':
                $value = get_option('is_on_coppa') == '1' ? '1' : '0';
                break;
            case 'OBFUSCATE':
                if (isset($param[0])) {
                    require_code('obfuscate');
                    $value = obfuscate_entities($param[0]);
                }
                break;
            case 'FIX_ID':
                if (isset($param[0])) {
                    $value = fix_id($param[0]);
                    if ($GLOBALS['XSS_DETECT']) {
                        ocp_mark_as_escaped($value);
                    }
                }
                break;
            case 'MAILTO':
                require_code('obfuscate');
                $value = mailto_obfuscated();
                break;
            case 'INLINE_STATS':
                $value = get_option('show_inline_stats') == '1' ? '1' : '0';
                break;
            case 'ATTACHMENT_DOWNLOADS':
                if (isset($param[0])) {
                    $db = $GLOBALS['SITE_DB'];
                    if (isset($param[1]) && $param[1] == '1') {
                        $db = $GLOBALS['FORUM_DB'];
                    }
                    $_value = $db->query_value_null_ok('attachments', 'a_num_downloads', array('id' => intval($param[0])));
                    $value = is_null($_value) ? '?' : strval($_value);
                }
                break;
            case 'CSS_DIMENSION_REDUCE':
                if (isset($param[1])) {
                    $value = $param[0];
                    if (substr($value, -2) == 'px') {
                        $b = $param[1];
                        $value = strval(intval(substr($value, 0, -2)) - intval($b)) . 'px';
                    }
                    if ($value == '') {
                        $value = '0px';
                    }
                }
                break;
            case 'COMMENT_COUNT':
                if (isset($param[1])) {
                    if (get_option('is_on_comments') == '1') {
                        $count = 0;
                        $_comments = $GLOBALS['FORUM_DRIVER']->get_forum_topic_posts($GLOBALS['FORUM_DRIVER']->find_topic_id_for_topic_identifier(get_option('comments_forum_name'), $param[0] . '_' . $param[1]), $count, 0, 0, false);
                        $_value = do_lang_tempcode('_COMMENTS', integer_format(0));
                        if (is_array($_comments)) {
                            $_value = do_lang_tempcode('_COMMENTS', escape_html(integer_format($count)));
                        }
                        $value = $_value->evaluate();
                    } else {
                        $value = do_lang('VIEW');
                    }
                }
                break;
            case 'CAN_SPELLCHECK':
                $value = function_exists('pspell_check') ? '1' : '0';
                break;
            case 'AWARD_ID':
                if (array_key_exists(0, $param)) {
                    $value = $GLOBALS['SITE_DB']->query_value_null_ok('award_archive', 'content_id', array('a_type_id' => intval($param[0])), 'ORDER BY date_and_time DESC');
                    if (is_null($value)) {
                        $value = '';
                    }
                }
                break;
            case 'SELF_PAGE_LINK':
                $value = '';
                if (running_script('index') || running_script('iframe')) {
                    $value = get_zone_name() . ':' . get_page_name();
                    foreach ($_GET as $key => $val) {
                        if ($key == 'page') {
                            continue;
                        }
                        if (is_array($val)) {
                            continue;
                        }
                        if (substr($key, 0, 5) == 'keep_') {
                            continue;
                        }
                        $value .= ':' . $key . '=' . $val;
                    }
                }
                break;
            case 'SET_TUTORIAL_LINK':
                $value = '';
                if (array_key_exists(1, $param) && $param[1] != '' && $param[1][0] != '#') {
                    set_tutorial_link($param[0], $param[1]);
                }
                break;
            case 'DISPLAY_CONCEPT':
                $value = '';
                if (array_key_exists(0, $param)) {
                    $key = $param[0];
                    $page_link = get_tutorial_link('concept___' . preg_replace('#[^\\w_]#', '_', $key));
                    if (is_null($page_link)) {
                        $temp_tpl = make_string_tempcode($key);
                    } else {
                        list($zone, $attributes, $hash) = page_link_decode($page_link);
                        $_url = build_url($attributes, $zone, NULL, false, false, false, $hash);
                        $temp_tpl = do_template('COMCODE_CONCEPT', array('_GUID' => 'ee0cd05f87329923f05145180004d8a8', 'TEXT' => $key, 'URL' => $_url));
                    }
                    $value = $temp_tpl->evaluate();
                }
                break;
            case 'SELF_URL':
                $extra_params = NULL;
                if (isset($param[3])) {
                    $extra_params = array();
                    $i = 3;
                    while (isset($param[$i])) {
                        $bits = explode('=', $param[$i], 2);
                        if ($bits[1] == '<null>') {
                            $bits[1] = NULL;
                        }
                        $extra_params[$bits[0]] = $bits[1];
                        $i++;
                    }
                }
                $value = get_self_url(true, isset($param[0]) && $param[0] == '1', $extra_params, isset($param[1]) && $param[1] == '1', isset($param[2]) && $param[2] == '1');
                break;
            case 'SHIFT_DECODE':
                if (isset($param[0])) {
                    global $SHIFT_VARIABLES;
                    $key = $param[0];
                    $value = isset($SHIFT_VARIABLES[$key]) ? $SHIFT_VARIABLES[$key]->evaluate() : '';
                }
                break;
            case 'NUMBER_FORMAT':
                if (isset($param[0])) {
                    $value = integer_format(intval($param[0]));
                }
                break;
            case 'FLOAT_FORMAT':
                if (isset($param[0])) {
                    $value = float_format(floatval($param[0]));
                }
                break;
            case 'CURRENTLY_INVISIBLE':
                $value = is_invisible() ? '1' : '0';
                break;
            case 'IS_FRIEND':
                if (isset($param[0])) {
                    $test = $GLOBALS['SITE_DB']->query_value_null_ok('chat_buddies', 'member_likes', array('member_likes' => isset($param[1]) ? intval($param[1]) : get_member(), 'member_liked' => intval($param[0])));
                    $value = is_null($test) ? '0' : '1';
                }
                break;
            case 'SSW':
                $value = get_option('ssw') == '1' ? '1' : '0';
                break;
            case 'RATING':
                if (isset($param[1])) {
                    require_code('feedback');
                    $rating = get_rating_simple_array(array_key_exists(3, $param) ? $param[3] : get_self_url(true), array_key_exists(4, $param) ? $param[4] : (is_null($DISPLAYED_TITLE) ? '' : $DISPLAYED_TITLE->evaluate()), $param[0], $param[1], array_key_exists(5, $param) ? $param[5] : 'RATING_FORM', array_key_exists(2, $param) ? $param[2] : NULL);
                    if ($rating !== NULL) {
                        if (!array_key_exists(2, $param) || $param[2] == '0') {
                            $value = isset($rating['ALL_RATING_CRITERIA'][0]['RATING']) ? $rating['ALL_RATING_CRITERIA'][0]['RATING'] : '';
                        } else {
                            $value = do_template('RATING_INLINE_STATIC', $rating);
                        }
                        if (is_object($value)) {
                            $value = $value->evaluate();
                        }
                    }
                }
                break;
            case 'VIEWS':
                if (isset($param[2])) {
                    $id_field = 'id';
                    // Not allowed for security reasons
                    if (preg_match('#^\\w*views\\w*$#', $param[1]) != 0) {
                        $test = $GLOBALS['SITE_DB']->query_value_null_ok($param[0], $param[1], array($id_field => $param[2]));
                        if (!is_null($test)) {
                            $value = integer_format($test);
                        }
                    }
                }
                break;
            default:
                global $EXTRA_SYMBOLS;
                if (is_null($EXTRA_SYMBOLS)) {
                    $EXTRA_SYMBOLS = array();
                    $hooks = find_all_hooks('systems', 'symbols');
                    foreach (array_keys($hooks) as $hook) {
                        $EXTRA_SYMBOLS[$hook] = array();
                    }
                }
                if (array_key_exists($name, $EXTRA_SYMBOLS)) {
                    if (!array_key_exists('ob', $EXTRA_SYMBOLS[$name])) {
                        require_code('hooks/systems/symbols/' . filter_naughty_harsh($name));
                        $EXTRA_SYMBOLS[$name]['ob'] = object_factory('Hook_symbol_' . filter_naughty_harsh($name));
                    }
                    $value = $EXTRA_SYMBOLS[$name]['ob']->run($param);
                    break;
                }
                if (defined($name)) {
                    $value = @strval(constant($name));
                    break;
                }
                $value = '';
                require_code('site');
                attach_message(do_lang_tempcode('MISSING_SYMBOL', escape_html($name)), 'warn');
        }
        if ($escaped != array()) {
            if (is_object($value)) {
                $value = $value->evaluate();
            }
            apply_tempcode_escaping($escaped, $value);
        }
        if ($cacheable) {
            $SYMBOL_CACHE[$escaped_codes] = $value;
        }
        return $value;
    }
    // Is it a directive?
    if ($type == TC_DIRECTIVE) {
        $value = '';
        if ($GLOBALS['XSS_DETECT']) {
            ocp_mark_as_escaped($value);
        }
        // In our param we should have a map of bubbled template parameters (under 'vars') and our numbered directive parameters
        if ($param === NULL) {
            $param = array();
        }
        // Closure-based Tempcode parser may send in strings, so we need to adapt...
        foreach ($param as $key => $val) {
            if (is_string($val)) {
                $param[$key] = make_string_tempcode($val);
            }
        }
        if (!isset($param['vars'])) {
            $param['vars'] = array();
        }
        switch ($name) {
            case 'SHIFT_ENCODE':
                break;
            case 'PARAM_INFO':
                $_value = do_template('PARAM_INFO', array('MAP' => $param['vars']));
                $value = $_value->evaluate();
                break;
            case 'CSS_INHERIT':
                // e.g. {+START,CSS_INHERIT,global,default,#886aa9}{+END}
                if (isset($param[0])) {
                    require_code('css_and_js');
                    $css_file = $param[0]->evaluate();
                    $theme = isset($param[1]) ? $param[1]->evaluate() : 'default';
                    $seed = isset($param[2]) ? $param[2]->evaluate() : NULL;
                    if ($seed == '') {
                        $seed = NULL;
                    }
                    $dark = isset($param[3]) ? $param[3]->evaluate() == '1' : false;
                    $algorithm = isset($param[4]) ? $param[4]->evaluate() : 'equations';
                    $value = css_inherit($css_file, $theme, $GLOBALS['FORUM_DRIVER']->get_theme(), $seed, $dark, $algorithm);
                }
                break;
            case 'FRACTIONAL_EDITABLE':
                foreach (array_keys($param) as $key) {
                    if (!is_numeric($key)) {
                        unset($param[$key]);
                    }
                }
                if (isset($param[3])) {
                    $edit_text = $param[0]->evaluate();
                    $edit_param_name = $param[1]->evaluate();
                    $edit_pagelink = $param[2]->evaluate();
                    $supports_comcode = (isset($param[4]) ? $param[3]->evaluate() : '0') == '1';
                    list($zone, $attributes, ) = page_link_decode($edit_pagelink);
                    if ($zone == '_SEARCH') {
                        $zone = get_module_zone($attributes['page']);
                    }
                    if (has_actual_page_access(get_member(), $attributes['page'], $zone) && has_zone_access(get_member(), 'adminzone')) {
                        $keep = symbol_tempcode('KEEP');
                        $url = find_script('fractional_edit') . '?edit_param_name=' . urlencode($edit_param_name) . '&supports_comcode=' . ($supports_comcode ? '1' : '0') . '&zone=' . urlencode($zone) . $keep->evaluate();
                        foreach ($attributes as $key => $val) {
                            $url .= '&' . $key . '=' . urlencode($val);
                        }
                        $_value = $param[count($param) - 1];
                        $_value = do_template('FRACTIONAL_EDIT', array('_GUID' => '075ac126c427d28b309004bc67b32b08', 'VALUE' => $_value, 'URL' => $url, 'EDIT_TEXT' => $edit_text, 'EDIT_PARAM_NAME' => $edit_param_name));
                        $value = $_value->evaluate();
                    } else {
                        $value = $param[count($param) - 1]->evaluate();
                    }
                }
                break;
            case 'SET':
                if (isset($param[1])) {
                    $var = $param[0]->evaluate();
                    $set_val = '';
                    $i = 1;
                    while (isset($param[$i])) {
                        if ($i != 1) {
                            $set_val .= ',';
                        }
                        $set_val .= $param[1]->evaluate();
                        $i++;
                    }
                    $TEMPCODE_SETGET[$var] = $set_val;
                }
                break;
            case 'IN_ARRAY':
                if (isset($param[1])) {
                    $key = $param[1]->evaluate();
                    $array = array_key_exists($key, $param['vars']) ? $param['vars'][$key] : array();
                    $value = in_array($param[0]->evaluate(), $array) ? '1' : '0';
                }
                break;
            case 'NOT_IN_ARRAY':
                if (isset($param[1])) {
                    $key = $param[1]->evaluate();
                    $array = array_key_exists($key, $param['vars']) ? $param['vars'][$key] : array();
                    $value = in_array($param[0]->evaluate(), $array) ? '0' : '1';
                }
                break;
            case 'IF_IN_ARRAY':
                if (isset($param[2])) {
                    $key = $param[1]->evaluate();
                    $array = array_key_exists($key, $param['vars']) ? $param['vars'][$key] : array();
                    $value = in_array($param[0]->evaluate(), $array) ? $param[2]->evaluate() : '';
                }
                break;
            case 'IF_NOT_IN_ARRAY':
                if (isset($param[2])) {
                    $key = $param[1]->evaluate();
                    $array = array_key_exists($key, $param['vars']) ? $param['vars'][$key] : array();
                    $value = in_array($param[0]->evaluate(), $array) ? '' : $param[2]->evaluate();
                }
                break;
            case 'IMPLODE':
                if (isset($param[1])) {
                    $key = $param[1]->evaluate();
                    $array = array_key_exists($key, $param['vars']) ? $param['vars'][$key] : array();
                    if (isset($param[2]) && $param[2]->evaluate() == '1') {
                        $delim = $param[0]->evaluate();
                        foreach ($array as $key => $val) {
                            if ($value != '') {
                                $value .= $delim;
                            }
                            $value .= (is_integer($key) ? integer_format($key) : $key) . ' = ' . $val;
                        }
                    } else {
                        $value = implode($param[0]->evaluate(), $array);
                    }
                }
                break;
            case 'COUNT':
                if (isset($param[0])) {
                    $key = $param[0]->evaluate();
                    $array = array_key_exists($key, $param['vars']) ? $param['vars'][$key] : array();
                    $value = strval(count($array));
                }
                break;
            case 'BOX':
                unset($param['vars']);
                $title = isset($param[1]) ? $param[0]->evaluate() : '';
                $dimensions = isset($param[2]) ? $param[1]->evaluate() : '100%';
                if ($dimensions == '') {
                    $dimensions = '100%';
                }
                $box_type = isset($param[3]) ? $param[2]->evaluate() : 'classic';
                $options = isset($param[4]) ? $param[3]->evaluate() : '';
                $meta = isset($param[5]) ? $param[4]->evaluate() : '';
                $links = isset($param[6]) ? $param[5]->evaluate() : '';
                $expand = isset($param[7]) ? $param[6]->evaluate() == '1' : false;
                $toplink = isset($param[8]) ? $param[7]->evaluate() : '';
                $tmp = put_in_standard_box(array_pop($param), $title, $dimensions, $box_type, $options, $meta, $links, $expand, $toplink);
                $value = $tmp->evaluate();
                break;
            case 'IF_NON_EMPTY':
                if (isset($param[1])) {
                    if (!$param[0]->is_really_empty()) {
                        $value = $param[1]->evaluate();
                    }
                }
                break;
            case 'IF_PASSED':
                if (isset($param[1])) {
                    $t = $param[0]->evaluate();
                    if (isset($param['vars'][$t])) {
                        $value = $param[1]->evaluate();
                    }
                }
                break;
            case 'IF_NON_PASSED':
                if (isset($param[1])) {
                    $t = $param[0]->evaluate();
                    if (!isset($param['vars'][$t])) {
                        $value = $param[1]->evaluate();
                    }
                }
                break;
            case 'IF_EMPTY':
                if (isset($param[1])) {
                    if ($param[0]->is_really_empty()) {
                        $value = $param[1]->evaluate();
                    }
                }
                break;
            case 'IF_ARRAY_EMPTY':
                if (isset($param[0])) {
                    $looking_at = $param[0]->evaluate();
                    if (array_key_exists($looking_at, $param['vars'])) {
                        if (count($param['vars'][$looking_at]) == 0) {
                            $value = $param[1]->evaluate();
                        }
                    }
                }
                break;
            case 'IF_ARRAY_NON_EMPTY':
                if (isset($param[0])) {
                    $looking_at = $param[0]->evaluate();
                    if (array_key_exists($looking_at, $param['vars'])) {
                        if (count($param['vars'][$looking_at]) != 0) {
                            $value = $param[1]->evaluate();
                        }
                    }
                }
                break;
            case 'OF':
                if (isset($param[1])) {
                    $key = $param[0]->evaluate();
                    $x = $param[1]->evaluate();
                    $array = array_key_exists($key, $param['vars']) ? $param['vars'][$key] : array();
                    $x2 = is_numeric($x) ? intval($x) : $x;
                    if (is_integer($x2)) {
                        if ($x2 < 0) {
                            $x2 = count($array) - 1;
                        } elseif ($x2 >= count($array)) {
                            $x2 -= count($array);
                        }
                    }
                    $value = array_key_exists($x2, $array) ? $array[$x2] : '';
                    if (is_object($value)) {
                        $value = $value->evaluate();
                    }
                }
                break;
            case 'INCLUDE':
                if (isset($param[1])) {
                    $tpl_params = $param['vars'];
                    $explode = explode(chr(10), $param[1]->evaluate());
                    foreach ($explode as $val) {
                        $bits = explode('=', $val, 2);
                        if (count($bits) == 2) {
                            $tpl_params[ltrim($bits[0])] = $bits[1];
                        }
                    }
                    $td = isset($param[3]) ? $param[2]->evaluate() : '';
                    if ($td == '') {
                        $td = 'templates';
                    }
                    $ex = isset($param[2]) ? $param[1]->evaluate() : '';
                    if ($ex == '') {
                        $ex = '.tpl';
                    }
                    $_value = do_template($param[0]->evaluate(), $tpl_params, NULL, false, NULL, $ex, $td);
                    $value = $_value->evaluate();
                }
                break;
            case 'WHILE':
                if (isset($param[1])) {
                    $_p = $param[0]->evaluate();
                    if ($_p == '1' || $_p == '1') {
                        $value = '';
                        $value .= $param[1]->evaluate();
                        $value .= ecv($lang, $escaped, $type, $name, $param);
                    }
                }
                break;
            case 'IF':
                if (isset($param[1])) {
                    $_p = $param[0]->evaluate();
                    if ($_p == '1' || $_p == '1') {
                        $value = $param[1]->evaluate();
                    }
                }
                break;
            case 'LOOP':
                if (isset($param[0])) {
                    if (!array_key_exists($param[0]->evaluate(), $param['vars'])) {
                        require_code('site');
                        attach_message(do_lang_tempcode('MISSING_TEMPLATE_PARAMETER', $param[0]->evaluate(), '???'), 'warn');
                        return '';
                    }
                    $array_key = $param[0]->evaluate();
                    if (is_numeric($array_key) || strpos($array_key, ',') !== false) {
                        $array = explode(',', $array_key);
                    } else {
                        $array = array_key_exists($array_key, $param['vars']) ? $param['vars'][$array_key] : array();
                        if (!is_array($array)) {
                            $array = array();
                        }
                    }
                    $value = '';
                    if (array_key_exists(1 + 1, $param)) {
                        $columns = $param[1]->evaluate();
                        $row_starter = array_key_exists(2 + 1, $param) ? $param[2]->evaluate() : '<tr>';
                        $row_terminator = array_key_exists(3 + 1, $param) ? $param[3]->evaluate() : '</tr>';
                        $value .= $row_starter;
                        // Sorting
                        if (array_key_exists(4 + 1, $param)) {
                            $sort_key = $param[4]->evaluate();
                            $rev = array_key_exists(5 + 1, $param) && $param[5]->evaluate() == 'DESC';
                            if ($sort_key != '') {
                                global $M_SORT_KEY;
                                $M_SORT_KEY = $sort_key;
                                uasort($array, 'multi_sort');
                            }
                            if ($rev) {
                                $array = array_reverse($array);
                            }
                        }
                    }
                    $last = count($param) - 2;
                    $col = 0;
                    $first = true;
                    foreach ($array as $go_key => $go) {
                        if (!is_array($go)) {
                            $go = array('_loop_key' => make_string_tempcode(is_integer($go_key) ? strval($go_key) : $go_key), '_loop_var' => make_string_tempcode($go));
                        }
                        // In case it's not a list of maps, but just a list
                        if (isset($param[2]) && $col % $columns == 0 && $col != 0) {
                            $value .= $row_starter;
                        }
                        $ps = $go + $param['vars'] + array('_loop_key' => make_string_tempcode(is_integer($go_key) ? strval($go_key) : $go_key), '_i' => strval($col), '_first' => $first, '_last' => $col == count($array) - 1);
                        $bound = $param[$last]->bind($ps, '');
                        $value .= $bound->evaluate();
                        ++$col;
                        if (isset($param[3]) && $col % $columns == 0) {
                            $value .= $row_terminator;
                        }
                        $first = false;
                    }
                    if (isset($param[2]) && $col % $columns != 0) {
                        $value .= $row_terminator;
                    }
                }
                break;
            default:
                require_code('site');
                attach_message(do_lang_tempcode('UNKNOWN_DIRECTIVE', escape_html($name)), 'warn');
        }
        if ($escaped != array()) {
            apply_tempcode_escaping($escaped, $value);
        }
        return $value;
    }
    // By elimination, it's language
    $a = isset($param[0]) ? is_object($param[0]) ? $param[0]->evaluate() : $param[0] : NULL;
    $b = isset($param[1]) ? is_object($param[1]) ? $param[1]->evaluate() : $param[1] : NULL;
    $c = isset($param[2]) ? array_splice($param, 2) : NULL;
    if ($c !== NULL) {
        foreach ($c as $i => $cc) {
            if (is_object($cc)) {
                $c[$i] = $cc->evaluate();
            }
        }
    }
    static $dle = false;
    if (!$dle) {
        $dle = function_exists('do_lang');
    }
    $ret = $dle ? do_lang($name, $a, $b, $c, $lang, false) : escape_html($name . ':' . (!is_null($a) ? $a : '') . ',' . (!is_null($b) ? $b : ''));
    if ($ret === NULL) {
        if ($type != TC_PARAMETER) {
            require_code('site');
            attach_message(do_lang_tempcode('MISSING_LANG_ENTRY', escape_html($name)), 'warn');
        }
        $value = '';
        if ($GLOBALS['XSS_DETECT']) {
            ocp_mark_as_escaped($value);
        }
        return $value;
    }
    if ($escaped != array() && $escaped != array(ENTITY_ESCAPED)) {
        apply_tempcode_escaping(array_diff($escaped, array(ENTITY_ESCAPED)), $ret);
    }
    // Escape but without ENTITY_ESCAPED because we don't do that on lang strings
    return $ret;
}
 /**
  * Gets the default value for the config option.
  *
  * @return ?string		The default value (NULL: option is disabled)
  */
 function get_default()
 {
     return get_forum_type() == 'ocf' && !has_no_forum() && addon_installed('stats_block') ? '0' : NULL;
 }
示例#28
0
 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     if (has_no_forum()) {
         return new ocp_tempcode();
     }
     require_lang('news');
     require_css('news');
     require_code('xhtml');
     $num_topics = array_key_exists('param', $map) ? intval($map['param']) : 14;
     $forum_name = array_key_exists('forum', $map) ? $map['forum'] : do_lang('NEWS');
     $num_topics = intval($num_topics);
     $date_key = array_key_exists('date_key', $map) ? $map['date_key'] : 'lasttime';
     $rows = array();
     $archive_url = NULL;
     $submit_url = new ocp_tempcode();
     $forum_ids = array();
     if (get_forum_type() == 'ocf' && (strpos($forum_name, ',') !== false || preg_match('#\\d[-\\*\\+]#', $forum_name) != 0 || is_numeric($forum_name))) {
         require_code('ocfiltering');
         $forum_names = ocfilter_to_idlist_using_db($forum_name, 'id', 'f_forums', 'f_forums', 'f_parent_forum', 'f_parent_forum', 'id', true, true, $GLOBALS['FORUM_DB']);
     } else {
         $forum_names = explode(',', $forum_name);
     }
     foreach ($forum_names as $forum_name) {
         $forum_name = is_integer($forum_name) ? strval($forum_name) : trim($forum_name);
         if ($forum_name == '<announce>') {
             $forum_id = NULL;
         } else {
             $forum_id = is_numeric($forum_name) ? intval($forum_name) : $GLOBALS['FORUM_DRIVER']->forum_id_from_name($forum_name);
         }
         if (!is_null($forum_id)) {
             $forum_ids[$forum_id] = $forum_name;
             if (is_null($archive_url)) {
                 $archive_url = $GLOBALS['FORUM_DRIVER']->forum_url($forum_id);
                 // First forum will count as archive
                 if (get_forum_type() == 'ocf') {
                     $submit_url = build_url(array('page' => 'topics', 'type' => 'new_topic', 'id' => $forum_id), get_module_zone('topics'));
                 }
             }
         }
     }
     //		if ((method_exists($GLOBALS['FORUM_DRIVER'],'supports_multi_show_forum_topics')) && ($GLOBALS['FORUM_DRIVER']->supports_multi_show_forum_topics()) && (count($forum_ids)!=0))
     //		{
     $max_rows = 0;
     $rows = $GLOBALS['FORUM_DRIVER']->show_forum_topics($forum_ids, $num_topics, 0, $max_rows, '', true, $date_key);
     if (is_null($rows)) {
         $rows = array();
     }
     /*		} else
     		{
     			foreach ($forum_ids as $forum_id=>$forum_name)
     			{
     				$max_rows=0;
     				$t=$GLOBALS['FORUM_DRIVER']->show_forum_topics($forum_name,$num_topics,0,$max_rows,'',true);
     				if (!is_null($t)) $rows=array_merge($rows,$t);
     			}
     		}*/
     global $M_SORT_KEY;
     $M_SORT_KEY = $date_key;
     usort($rows, 'multi_sort');
     $rows = array_reverse($rows, false);
     $_title = do_lang_tempcode('NEWS');
     if (array_key_exists('title', $map) && $map['title'] != '') {
         $_title = protect_from_escaping(escape_html($map['title']));
     }
     $i = 0;
     $news_text = new ocp_tempcode();
     while (array_key_exists($i, $rows)) {
         $myrow = $rows[$i];
         $id = $myrow['id'];
         $date = get_timezoned_date($myrow[$date_key]);
         $author_url = array_key_exists('member_based', $map) && $map['member_based'] == '1' || !addon_installed('authors') ? new ocp_tempcode() : build_url(array('page' => 'authors', 'type' => 'misc', 'author' => $myrow['firstusername']), get_module_zone('authors'));
         $author = $myrow['firstusername'];
         $news_title = escape_html($myrow['title']);
         $news = is_object($myrow['firstpost']) ? $myrow['firstpost'] : make_string_tempcode(xhtmlise_html($myrow['firstpost']));
         if (is_null($news)) {
             $news = '';
         }
         $full_url = $GLOBALS['FORUM_DRIVER']->topic_url($id, '');
         $news_text->attach(do_template('NEWS_PIECE_SUMMARY', array('_GUID' => '2edf18daf5510495fd588cad062aec4e', 'TRUNCATE' => false, 'BLOG' => false, 'FIRSTTIME' => strval($myrow['firsttime']), 'LASTTIME' => strval($myrow['lasttime']), 'CLOSED' => strval($myrow['closed']), 'FIRSTUSERNAME' => $myrow['firstusername'], 'LASTUSERNAME' => $myrow['lastusername'], 'FIRSTMEMBERID' => strval($myrow['firstmemberid']), 'LASTMEMBERID' => strval($myrow['lastmemberid']), 'ID' => strval($id), 'FULL_URL' => $full_url, 'SUBMITTER' => strval($myrow['firstmemberid']), 'DATE' => $date, 'DATE_RAW' => strval($myrow[$date_key]), 'NEWS_TITLE' => $news_title, 'CATEGORY' => '', 'IMG' => '', 'AUTHOR' => $author, 'AUTHOR_URL' => $author_url, 'NEWS' => $news)));
         $i++;
         if ($i == $num_topics) {
             break;
         }
     }
     if ($news_text->is_empty()) {
         return do_template('BLOCK_NO_ENTRIES', array('_GUID' => 'f55c90205b4c80162494fc5e2b565ce6', 'HIGH' => false, 'TITLE' => $_title, 'MESSAGE' => do_lang_tempcode('NO_NEWS'), 'ADD_NAME' => do_lang_tempcode('ADD_TOPIC'), 'SUBMIT_URL' => $submit_url));
     }
     if (is_null($forum_id)) {
         $archive_url = '';
     }
     return do_template('BLOCK_MAIN_FORUM_NEWS', array('_GUID' => '36b05da9aed5a2056bdb266e2ce4be9f', 'TITLE' => $_title, 'FORUM_NAME' => array_key_exists('forum', $map) ? $map['forum'] : do_lang('NEWS'), 'CONTENT' => $news_text, 'BRIEF' => new ocp_tempcode(), 'ARCHIVE_URL' => $archive_url, 'SUBMIT_URL' => $submit_url, 'RSS_URL' => '', 'ATOM_URL' => ''));
 }
示例#29
0
 /**
  * Gets the default value for the config option.
  *
  * @return ?string		The default value (NULL: option is disabled)
  */
 function get_default()
 {
     return has_no_forum() ? NULL : '0';
 }
示例#30
0
 /**
  * The UI to view the news archive.
  *
  * @return tempcode		The UI
  */
 function news_archive()
 {
     $start = get_param_integer('start', 0);
     $max = get_param_integer('max', 20);
     $blog = get_param_integer('blog', NULL);
     require_code('ocfiltering');
     $filter = get_param('id', get_param('filter', '*'));
     $filters_1 = ocfilter_to_sqlfragment($filter, 'p.news_category', 'news_categories', NULL, 'p.news_category', 'id');
     // Note that the parameters are fiddled here so that category-set and record-set are the same, yet SQL is returned to deal in an entirely different record-set (entries' record-set)
     $filters_2 = ocfilter_to_sqlfragment($filter, 'd.news_entry_category', 'news_categories', NULL, 'd.news_category', 'id');
     // Note that the parameters are fiddled here so that category-set and record-set are the same, yet SQL is returned to deal in an entirely different record-set (entries' record-set)
     $q_filter = '(' . $filters_1 . ' OR ' . $filters_2 . ')';
     if ($blog === 1) {
         $title = get_page_title('BLOG_NEWS_ARCHIVE');
     } else {
         if (is_numeric($filter)) {
             $news_cat_title = $GLOBALS['SITE_DB']->query_select('news_categories', array('nc_title'), array('id' => intval($filter)), '', 1);
             if (array_key_exists(0, $news_cat_title)) {
                 $news_cat_title[0]['text_original'] = get_translated_text($news_cat_title[0]['nc_title']);
                 $title = get_page_title($news_cat_title[0]['text_original'], false);
             } else {
                 $title = get_page_title('NEWS_ARCHIVE');
             }
         } else {
             $title = get_page_title('NEWS_ARCHIVE');
         }
     }
     $filter_and = get_param('filter_and', '*');
     $filters_and_1 = ocfilter_to_sqlfragment($filter_and, 'p.news_category', 'news_categories', NULL, 'p.news_category', 'id');
     // Note that the parameters are fiddled here so that category-set and record-set are the same, yet SQL is returned to deal in an entirely different record-set (entries' record-set)
     $filters_and_2 = ocfilter_to_sqlfragment($filter_and, 'd.news_entry_category', 'news_categories', NULL, 'd.news_category', 'id');
     // Note that the parameters are fiddled here so that category-set and record-set are the same, yet SQL is returned to deal in an entirely different record-set (entries' record-set)
     $q_filter .= ' AND (' . $filters_and_1 . ' OR ' . $filters_and_2 . ')';
     $join = $q_filter == '' ? '' : ' LEFT JOIN ' . get_table_prefix() . 'news_category_entries d ON d.news_entry=p.id';
     if ($blog === 1) {
         $q_filter .= ' AND c.nc_owner IS NOT NULL';
         $join .= ' LEFT JOIN ' . get_table_prefix() . 'news_categories c ON c.id=p.news_category';
     } elseif ($blog === 0) {
         $q_filter .= ' AND c.nc_owner IS NULL AND c.id IS NOT NULL';
         $join .= ' LEFT JOIN ' . get_table_prefix() . 'news_categories c ON c.id=p.news_category';
     }
     $query = 'SELECT *,p.id AS p_id FROM ' . get_table_prefix() . 'news p' . $join . ' WHERE ' . $q_filter . (!has_specific_permission(get_member(), 'see_unvalidated') ? ' AND validated=1' : '') . (can_arbitrary_groupby() ? ' GROUP BY p.id' : '') . ' ORDER BY date_and_time DESC';
     $rows = $GLOBALS['SITE_DB']->query($query, $max, $start);
     $rows = remove_duplicate_rows($rows, 'p_id');
     $max_rows = count(remove_duplicate_rows($GLOBALS['SITE_DB']->query($query), 'p_id'));
     // Not doing COUNT(*) because of the "GROUP BY" which messes with the query counting
     $rcount = count($rows);
     $blogger = NULL;
     $content = new ocp_tempcode();
     $inline = get_param_integer('inline', 0) == 1;
     $truncate = true;
     $member_based = $blog === 1;
     global $NEWS_CATS;
     if (!isset($NEWS_CATS)) {
         $NEWS_CATS = $GLOBALS['SITE_DB']->query_select('news_categories', array('*'), array('nc_owner' => NULL));
         $NEWS_CATS = list_to_map('id', $NEWS_CATS);
     }
     foreach ($rows as $myrow) {
         if (has_category_access(get_member(), 'news', strval($myrow['news_category']))) {
             $date = get_timezoned_date($myrow['date_and_time']);
             $map = array('page' => '_SELF', 'type' => 'view', 'id' => $myrow['p_id']);
             if ($filter != '*') {
                 $map['filter'] = $filter;
             }
             if ($filter_and != '*' && $filter_and != '') {
                 $map['filter_and'] = $filter_and;
             }
             if (!is_null($blog)) {
                 $map['blog'] = $blog;
             }
             $url = build_url($map, '_SELF');
             $_title = get_translated_tempcode($myrow['title']);
             $_title_plain = get_translated_text($myrow['title']);
             $author_url = addon_installed('authors') && !$member_based ? build_url(array('page' => 'authors', 'type' => 'misc', 'id' => $myrow['author']), get_module_zone('authors')) : new ocp_tempcode();
             $author = $myrow['author'];
             if (!array_key_exists($myrow['news_category'], $NEWS_CATS)) {
                 $_news_cats = $GLOBALS['SITE_DB']->query_select('news_categories', array('*'), array('id' => $myrow['news_category']), '', 1);
                 if (array_key_exists(0, $_news_cats)) {
                     $NEWS_CATS[$myrow['news_category']] = $_news_cats[0];
                 }
             }
             if (array_key_exists($myrow['news_category'], $NEWS_CATS)) {
                 $category = get_translated_text($NEWS_CATS[$myrow['news_category']]['nc_title']);
                 $img = find_theme_image($NEWS_CATS[$myrow['news_category']]['nc_img']);
             } else {
                 $category = '';
                 $img = '';
             }
             if (is_null($img)) {
                 $img = '';
             }
             if ($myrow['news_image'] != '') {
                 $img = $myrow['news_image'];
                 if (url_is_local($img)) {
                     $img = get_custom_base_url() . '/' . $img;
                 }
             }
             $summary = get_translated_tempcode($myrow['news']);
             if ($summary->is_empty()) {
                 $summary = get_translated_tempcode($myrow['news_article']);
             }
             $seo_bits = seo_meta_get_for('news', strval($myrow['id']));
             $map = array('_GUID' => 'a29bbea4a703287793e2b3b190114ec3', 'TAGS' => get_option('show_content_tagging_inline') == '1' ? get_loaded_tags('news', explode(',', $seo_bits[0])) : NULL, 'CATEGORY' => $category, 'IMG' => $img, 'AUTHOR_URL' => $author_url, 'AUTHOR' => $author, 'TRUNCATE' => $truncate, 'BLOG' => $blog === 1, 'NEWS' => $summary, 'SUMMARY' => $summary, 'ID' => strval($myrow['p_id']), 'VIEWS' => strval($myrow['news_views']), 'SUBMITTER' => strval($myrow['submitter']), 'DATE' => $date, 'DATE_RAW' => strval($myrow['date_and_time']), 'EDIT_DATE_RAW' => is_null($myrow['edit_date']) ? '' : strval($myrow['edit_date']), 'FULL_URL' => $url, 'URL' => $url, 'TITLE_PLAIN' => $_title_plain, 'NEWS_TITLE' => $_title, 'TITLE' => $_title);
             if (get_option('is_on_comments') == '1' && !has_no_forum() && $myrow['allow_comments'] >= 1) {
                 $map['COMMENT_COUNT'] = '1';
             }
             $content->attach(do_template($inline ? 'NEWS_PIECE_SUMMARY' : 'NEWS_BRIEF', $map));
             if (array_key_exists('nc_owner', $myrow) && is_numeric($filter)) {
                 $blogger = $myrow['nc_owner'];
             }
         }
     }
     $page_num = intval(floor(floatval($start) / floatval($max))) + 1;
     $num_pages = intval(ceil(floatval($max_rows) / floatval($max)));
     $previous_url = $start == 0 ? new ocp_tempcode() : build_url(array('page' => '_SELF', 'type' => 'misc', 'blog' => $blog, 'start' => $start - $max == 0 ? NULL : $start - $max) + ($filter == '*' ? array() : array('filter' => $filter)) + (($filter_and == '*' ? array() : array('filter_and' => $filter_and)) + ($max == 20 ? array() : array('max' => $max))), '_SELF');
     $next_url = $rcount != $max ? new ocp_tempcode() : build_url(array('page' => '_SELF', 'type' => 'misc', 'blog' => $blog, 'start' => $start + $max) + ($filter == '*' ? array() : array('filter' => $filter)) + (($filter_and == '*' ? array() : array('filter_and' => $filter_and)) + ($max == 20 ? array() : array('max' => $max))), '_SELF');
     $browse = do_template('NEXT_BROWSER_BROWSE_NEXT', array('_GUID' => '264a8412dfd0b5bb80cd767702bdd600', 'NEXT_LINK' => $next_url, 'PREVIOUS_LINK' => $previous_url, 'PAGE_NUM' => integer_format($page_num), 'NUM_PAGES' => integer_format($num_pages)));
     if ($blog === 1) {
         $first_bc = array('_SELF:_SELF:blog_select', do_lang_tempcode('BLOGS'));
     } elseif ($blog === 0) {
         $first_bc = array('_SELF:_SELF:cat_select', do_lang_tempcode('JUST_NEWS_CATEGORIES'));
     } else {
         $first_bc = array('_SELF:_SELF:select', do_lang_tempcode('NEWS_CATEGORIES'));
     }
     breadcrumb_set_parents(array($first_bc));
     if (($blog !== 1 || has_specific_permission(get_member(), 'have_personal_category', 'cms_news')) && has_actual_page_access(NULL, $blog === 1 ? 'cms_blogs' : 'cms_news', NULL, NULL) && has_submit_permission('high', get_member(), get_ip_address(), 'cms_news')) {
         $map = array('page' => $blog === 1 ? 'cms_blogs' : 'cms_news', 'type' => 'ad');
         if (is_numeric($filter)) {
             $map['cat'] = $filter;
         }
         $submit_url = build_url($map, get_module_zone('cms_news'));
     } else {
         $submit_url = new ocp_tempcode();
     }
     return do_template('NEWS_ARCHIVE_SCREEN', array('_GUID' => '228918169ab1db445ee0c2d71f85983c', 'CAT' => is_numeric($filter) ? $filter : NULL, 'SUBMIT_URL' => $submit_url, 'BLOGGER' => is_null($blogger) ? NULL : strval($blogger), 'BLOG' => $blog === 1, 'TITLE' => $title, 'CONTENT' => $content, 'BROWSE' => $browse));
 }