本文整理汇总了PHP中has_no_forum函数的典型用法代码示例。如果您正苦于以下问题:PHP has_no_forum函数的具体用法?PHP has_no_forum怎么用?PHP has_no_forum使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了has_no_forum函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* 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: get_blocks
/**
* 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: run
/**
* 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: run
/**
* 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: run
/**
* 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: run
/**
* 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();
}
示例7: get_default
/**
* 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: show_poll
//.........这里部分代码省略.........
* @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¶m=' . 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: render_tab
/**
* 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: run
/**
* 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: render_tab
/**
* 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);
}
示例12: get_default
/**
* 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: run
/**
* 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) {
//.........这里部分代码省略.........
示例14: get_default
/**
* 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: run
/**
* 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;
}