本文整理汇总了PHP中has_actual_page_access函数的典型用法代码示例。如果您正苦于以下问题:PHP has_actual_page_access函数的具体用法?PHP has_actual_page_access怎么用?PHP has_actual_page_access使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了has_actual_page_access函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Standard modular run function for realtime-rain hooks.
*
* @param TIME Start of time range.
* @param TIME End of time range.
* @return array A list of template parameter sets for rendering a 'drop'.
*/
function run($from, $to)
{
$drops = array();
if (has_actual_page_access(get_member(), 'chat')) {
require_code('chat');
$rows = $GLOBALS['SITE_DB']->query('SELECT ip_address,the_message,user_id AS member_id,date_and_time AS timestamp,room_id FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'chat_messages WHERE system_message=0 AND date_and_time BETWEEN ' . strval($from) . ' AND ' . strval($to));
foreach ($rows as $row) {
if (!check_chatroom_access($row['room_id'], true)) {
continue;
}
$timestamp = $row['timestamp'];
$member_id = $row['member_id'];
$message = get_translated_text($row['the_message']);
if (strpos($message, '[private') !== false) {
continue;
}
$message = strip_comcode($message);
if ($message == '') {
continue;
}
$drops[] = rain_get_special_icons($row['ip_address'], $timestamp, NULL, $message) + array('TYPE' => 'chat', 'FROM_MEMBER_ID' => strval($member_id), 'TO_MEMBER_ID' => NULL, 'TITLE' => rain_truncate_for_title($message), 'IMAGE' => is_guest($member_id) ? rain_get_country_image($row['ip_address']) : $GLOBALS['FORUM_DRIVER']->get_member_avatar_url($member_id), 'TIMESTAMP' => strval($timestamp), 'RELATIVE_TIMESTAMP' => strval($timestamp - $from), 'TICKER_TEXT' => $message, 'URL' => build_url(array('page' => 'points', 'type' => 'member', 'id' => $member_id), '_SEARCH'), 'IS_POSITIVE' => false, 'IS_NEGATIVE' => false, 'FROM_ID' => 'member_' . strval($member_id), 'TO_ID' => NULL, 'GROUP_ID' => 'room_' . strval($row['room_id']));
}
}
return $drops;
}
示例2: run
/**
* Standard modular run function for RSS hooks.
*
* @param string A list of categories we accept from
* @param TIME Cutoff time, before which we do not show results from
* @param string Prefix that represents the template set we use
* @set RSS_ ATOM_
* @param string The standard format of date to use for the syndication type represented in the prefix
* @param integer The maximum number of entries to return, ordering by date
* @return ?array A pair: The main syndication section, and a title (NULL: error)
*/
function run($_filters, $cutoff, $prefix, $date_string, $max)
{
if (!addon_installed('cedi')) {
return NULL;
}
if (!has_actual_page_access(get_member(), 'cedi')) {
return NULL;
}
$filters = ocfilter_to_sqlfragment($_filters, 'id', 'seedy_children', 'parent_id', 'parent_id', 'child_id');
$content = new ocp_tempcode();
$rows = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'seedy_pages WHERE ' . $filters . ' AND add_date>' . strval((int) $cutoff) . ' ORDER BY add_date DESC', $max);
foreach ($rows as $row) {
$id = strval($row['id']);
if (!has_category_access(get_member(), 'seedy_page', strval($row['id']))) {
continue;
}
$author = '';
$news_date = date($date_string, $row['add_date']);
$edit_date = '';
$news_title = xmlentities(escape_html(get_translated_text($row['title'])));
$_summary = get_translated_tempcode($row['description']);
$summary = xmlentities($_summary->evaluate());
$news = '';
$category = '';
$category_raw = '';
$view_url = build_url(array('page' => 'cedi', 'type' => 'misc', 'id' => $row['id'] == db_get_first_id() ? NULL : $row['id']), get_module_zone('cedi'), NULL, false, false, true);
$if_comments = new ocp_tempcode();
$content->attach(do_template($prefix . 'ENTRY', array('VIEW_URL' => $view_url, 'SUMMARY' => $summary, 'EDIT_DATE' => $edit_date, 'IF_COMMENTS' => $if_comments, 'TITLE' => $news_title, 'CATEGORY_RAW' => $category_raw, 'CATEGORY' => $category, 'AUTHOR' => $author, 'ID' => $id, 'NEWS' => $news, 'DATE' => $news_date)));
}
require_lang('cedi');
return array($content, do_lang('CEDI_PAGES'));
}
示例3: run
/**
* Standard modular run function for RSS hooks.
*
* @param string A list of categories we accept from
* @param TIME Cutoff time, before which we do not show results from
* @param string Prefix that represents the template set we use
* @set RSS_ ATOM_
* @param string The standard format of date to use for the syndication type represented in the prefix
* @param integer The maximum number of entries to return, ordering by date
* @return ?array A pair: The main syndication section, and a title (NULL: error)
*/
function run($_filters, $cutoff, $prefix, $date_string, $max)
{
if (!addon_installed('news')) {
return NULL;
}
if (!has_actual_page_access(get_member(), 'news')) {
return NULL;
}
$filters_1 = ocfilter_to_sqlfragment($_filters, '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($_filters, '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)
$filters = '(' . $filters_1 . ' OR ' . $filters_2 . ')';
$rows = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'news p LEFT JOIN ' . get_table_prefix() . 'news_category_entries d ON d.news_entry=p.id WHERE date_and_time>' . strval($cutoff) . (!has_specific_permission(get_member(), 'see_unvalidated') ? ' AND validated=1 ' : '') . ' AND ' . $filters . (can_arbitrary_groupby() ? ' GROUP BY p.id' : '') . ' ORDER BY date_and_time DESC', $max);
$rows = remove_duplicate_rows($rows, 'id');
$_categories = $GLOBALS['SITE_DB']->query_select('news_categories', array('id', 'nc_title'), array('nc_owner' => NULL));
foreach ($_categories as $i => $_category) {
$_categories[$i]['text_original'] = get_translated_text($_category['nc_title']);
}
$categories = collapse_2d_complexity('id', 'text_original', $_categories);
$content = new ocp_tempcode();
foreach ($rows as $row) {
if (has_category_access(get_member(), 'news', strval($row['news_category']))) {
$id = strval($row['id']);
$author = $row['author'];
$news_date = date($date_string, $row['date_and_time']);
$edit_date = is_null($row['edit_date']) ? '' : date($date_string, $row['edit_date']);
$_title = get_translated_tempcode($row['title']);
$news_title = xmlentities($_title->evaluate());
$_summary = get_translated_tempcode($row['news']);
if ($_summary->is_empty()) {
$_summary = get_translated_tempcode($row['news_article']);
}
$summary = xmlentities($_summary->evaluate());
if (!is_null($row['news_article'])) {
$_news = get_translated_tempcode($row['news_article']);
if ($_news->is_empty()) {
$news = '';
} else {
$news = xmlentities($_news->evaluate());
}
} else {
$news = '';
}
if (!array_key_exists($row['news_category'], $categories)) {
$categories[$row['news_category']] = get_translated_text($GLOBALS['SITE_DB']->query_value('news_categories', 'nc_title', array('id' => $row['news_category'])));
}
$category = $categories[$row['news_category']];
$category_raw = strval($row['news_category']);
$view_url = build_url(array('page' => 'news', 'type' => 'view', 'id' => $row['id']), get_module_zone('news'), NULL, false, false, true);
if ($prefix == 'RSS_' && get_option('is_on_comments') == '1' && $row['allow_comments'] >= 1) {
$if_comments = do_template('RSS_ENTRY_COMMENTS', array('_GUID' => 'b4f25f5cf68304f8d402bb06851489d6', 'COMMENT_URL' => $view_url, 'ID' => strval($row['id'])));
} else {
$if_comments = new ocp_tempcode();
}
$content->attach(do_template($prefix . 'ENTRY', array('VIEW_URL' => $view_url, 'SUMMARY' => $summary, 'EDIT_DATE' => $edit_date, 'IF_COMMENTS' => $if_comments, 'TITLE' => $news_title, 'CATEGORY_RAW' => $category_raw, 'CATEGORY' => $category, 'AUTHOR' => $author, 'ID' => $id, 'NEWS' => $news, 'DATE' => $news_date)));
}
}
return array($content, do_lang('NEWS'));
}
示例4: run
/**
* Standard modular run function for ajax-tree hooks. Generates XML for a tree list, which is interpreted by Javascript and expanded on-demand (via new calls).
*
* @param ?ID_TEXT The ID to do under (NULL: root)
* @param array Options being passed through
* @param ?ID_TEXT The ID to select by default (NULL: none)
* @return string XML in the special category,entry format
*/
function run($id, $options, $default = NULL)
{
require_code('galleries');
$only_owned = array_key_exists('only_owned', $options) ? is_null($options['only_owned']) ? NULL : intval($options['only_owned']) : NULL;
$editable_filter = array_key_exists('editable_filter', $options) ? $options['editable_filter'] : false;
$tree = get_gallery_content_tree('images', $only_owned, $id, NULL, NULL, is_null($id) ? 0 : 1, false, $editable_filter);
if (!has_actual_page_access(NULL, 'galleries')) {
$tree = array();
}
$out = '';
foreach ($tree as $t) {
$_id = $t['id'];
if ($id === $_id) {
foreach ($t['entries'] as $eid => $etitle) {
if (is_object($etitle)) {
$etitle = @html_entity_decode(strip_tags($etitle->evaluate()), ENT_QUOTES, get_charset());
}
$out .= '<entry id="' . xmlentities(strval($eid)) . '" title="' . xmlentities($etitle) . '" selectable="true"></entry>';
}
continue;
}
$title = $t['title'];
$has_children = $t['child_count'] != 0 || $t['child_entry_count'] != 0;
$out .= '<category id="' . xmlentities($_id) . '" title="' . xmlentities($title) . '" has_children="' . ($has_children ? 'true' : 'false') . '" selectable="false"></category>';
}
// Mark parent cats for pre-expansion
if (!is_null($default) && $default != '') {
$cat = $GLOBALS['SITE_DB']->query_value_null_ok('images', 'cat', array('id' => intval($default)));
while (!is_null($cat) && $cat != '') {
$out .= '<expand>' . $cat . '</expand>';
$cat = $GLOBALS['SITE_DB']->query_value_null_ok('galleries', 'parent_id', array('name' => $cat));
}
}
return '<result>' . $out . '</result>';
}
示例5: run
/**
* Standard modular run function for RSS hooks.
*
* @param string A list of categories we accept from
* @param TIME Cutoff time, before which we do not show results from
* @param string Prefix that represents the template set we use
* @set RSS_ ATOM_
* @param string The standard format of date to use for the syndication type represented in the prefix
* @param integer The maximum number of entries to return, ordering by date
* @return ?array A pair: The main syndication section, and a title (NULL: error)
*/
function run($_filters, $cutoff, $prefix, $date_string, $max)
{
if (!has_actual_page_access(get_member(), 'members')) {
return NULL;
}
$rows = $GLOBALS['FORUM_DB']->query('SELECT * FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'f_members p WHERE m_join_time>' . strval($cutoff) . (!has_specific_permission(get_member(), 'see_unvalidated') ? ' AND m_validated=1 AND m_validated_email_confirm_code=\'\' ' : '') . ' ORDER BY m_join_time DESC', $max);
$categories = $GLOBALS['FORUM_DRIVER']->get_usergroup_list(true);
$content = new ocp_tempcode();
foreach ($rows as $row) {
$id = strval($row['id']);
$author = '';
$news_date = date($date_string, $row['m_join_time']);
$edit_date = '';
$news_title = xmlentities($row['m_username']);
$summary = '';
$news = '';
$category = array_key_exists($row['m_primary_group'], $categories) ? $categories[$row['m_primary_group']] : '';
$category_raw = strval($row['m_primary_group']);
$view_url = build_url(array('page' => 'members', 'type' => 'view', 'id' => $row['id']), get_module_zone('members'), NULL, false, false, true);
$if_comments = new ocp_tempcode();
$content->attach(do_template($prefix . 'ENTRY', array('VIEW_URL' => $view_url, 'SUMMARY' => $summary, 'EDIT_DATE' => $edit_date, 'IF_COMMENTS' => $if_comments, 'TITLE' => $news_title, 'CATEGORY_RAW' => $category_raw, 'CATEGORY' => $category, 'AUTHOR' => $author, 'ID' => $id, 'NEWS' => $news, 'DATE' => $news_date)));
}
require_lang('ocf');
return array($content, do_lang('MEMBERS'));
}
示例6: run
/**
* Standard modular run function for RSS hooks.
*
* @param string A list of categories we accept from
* @param TIME Cutoff time, before which we do not show results from
* @param string Prefix that represents the template set we use
* @set RSS_ ATOM_
* @param string The standard format of date to use for the syndication type represented in the prefix
* @param integer The maximum number of entries to return, ordering by date
* @return ?array A pair: The main syndication section, and a title (NULL: error)
*/
function run($_filters, $cutoff, $prefix, $date_string, $max)
{
if (!addon_installed('galleries')) {
return NULL;
}
if (!has_actual_page_access(get_member(), 'galleries')) {
return NULL;
}
$filters_1 = ocfilter_to_sqlfragment($_filters, 'name', 'galleries', 'parent_id', 'name', 'name', false, false);
// 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 = ocfilter_to_sqlfragment($_filters, 'cat', 'galleries', 'parent_id', 'cat', 'name', false, false);
// 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)
require_lang('galleries');
$content = new ocp_tempcode();
$_galleries = array();
if ($GLOBALS['SITE_DB']->query_value_null_ok_full('SELECT COUNT(*) FROM ' . get_table_prefix() . 'galleries WHERE ' . $filters_1) < 3000) {
$_galleries = $GLOBALS['SITE_DB']->query('SELECT fullname,name FROM ' . get_table_prefix() . 'galleries WHERE ' . $filters_1);
foreach ($_galleries as $i => $_gallery) {
$_galleries[$i]['text_original'] = get_translated_text($_gallery['fullname']);
}
}
$galleries = collapse_2d_complexity('name', 'text_original', $_galleries);
$rows1 = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'videos WHERE add_date>' . strval((int) $cutoff) . ' AND ' . $filters . (!has_specific_permission(get_member(), 'see_unvalidated') ? ' AND validated=1 ' : '') . ' ORDER BY add_date DESC', $max);
$rows2 = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'images WHERE add_date>' . strval((int) $cutoff) . ' AND ' . $filters . (!has_specific_permission(get_member(), 'see_unvalidated') ? ' AND validated=1 ' : '') . ' ORDER BY add_date DESC', $max);
$rows = array_merge($rows1, $rows2);
foreach ($rows as $row) {
$id = strval($row['id']);
$author = $GLOBALS['FORUM_DRIVER']->get_username($row['submitter']);
if (is_null($author)) {
$author = '';
}
$news_date = date($date_string, $row['add_date']);
$edit_date = is_null($row['edit_date']) ? '' : date($date_string, $row['edit_date']);
$news_title = xmlentities(do_lang('THIS_WITH_SIMPLE', array_key_exists('video_views', $row) ? do_lang('VIDEO') : do_lang('IMAGE'), strval($row['id'])));
$_summary = get_translated_tempcode($row['comments']);
$summary = xmlentities($_summary->evaluate());
$news = '';
if (!array_key_exists($row['cat'], $galleries)) {
$_fullname = $GLOBALS['SITE_DB']->query_value_null_ok('galleries', 'fullname', array('name' => $row['cat']));
if (is_null($_fullname)) {
continue;
}
$galleries[$row['cat']] = get_translated_text($_fullname);
}
$category = $galleries[$row['cat']];
$category_raw = $row['cat'];
$view_url = build_url(array('page' => 'galleries', 'type' => array_key_exists('video_views', $row) ? 'video' : 'image', 'id' => $row['id']), get_module_zone('galleries'), NULL, false, false, true);
if ($prefix == 'RSS_' && get_option('is_on_comments') == '1' && $row['allow_comments'] >= '1') {
$if_comments = do_template('RSS_ENTRY_COMMENTS', array('_GUID' => '65dc0cec8c75f565c58c95fa1667aa1e', 'COMMENT_URL' => $view_url, 'ID' => strval($row['id'])));
} else {
$if_comments = new ocp_tempcode();
}
require_code('images');
$enclosure_url = ensure_thumbnail($row['url'], $row['thumb_url'], 'galleries', array_key_exists('video_views', $row) ? 'videos' : 'images', $row['id']);
list($enclosure_length, $enclosure_type) = get_enclosure_details($row['url'], $enclosure_url);
$content->attach(do_template($prefix . 'ENTRY', array('ENCLOSURE_URL' => $enclosure_url, 'ENCLOSURE_LENGTH' => $enclosure_length, 'ENCLOSURE_TYPE' => $enclosure_type, 'VIEW_URL' => $view_url, 'SUMMARY' => $summary, 'EDIT_DATE' => $edit_date, 'IF_COMMENTS' => $if_comments, 'TITLE' => $news_title, 'CATEGORY_RAW' => $category_raw, 'CATEGORY' => $category, 'AUTHOR' => $author, 'ID' => $id, 'NEWS' => $news, 'DATE' => $news_date)));
}
require_lang('galleries');
return array($content, do_lang('GALLERIES'));
}
示例7: run
/**
* Standard modular run function for realtime-rain hooks.
*
* @param TIME Start of time range.
* @param TIME End of time range.
* @return array A list of template parameter sets for rendering a 'drop'.
*/
function run($from, $to)
{
$drops = array();
if (has_actual_page_access(get_member(), 'polls')) {
$rows = $GLOBALS['SITE_DB']->query('SELECT b.option1,b.option2,b.option3,b.option4,b.option5,b.option6,b.option7,b.option8,b.option9,b.option10,b.votes1,b.votes2,b.votes3,b.votes4,b.votes5,b.votes6,b.votes7,b.votes8,b.votes9,b.votes10,b.question,b.id,b.submitter AS member_id,a.date_and_time AS timestamp FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'poll a LEFT JOIN ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'poll b ON a.date_and_time>b.date_and_time WHERE NOT EXISTS(SELECT * FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'poll x WHERE x.id<>a.id AND x.id<>b.id AND x.date_and_time BETWEEN b.date_and_time AND a.date_and_time) AND b.date_and_time IS NOT NULL AND b.date_and_time BETWEEN ' . strval($from) . ' AND ' . strval($to));
foreach ($rows as $row) {
require_lang('polls');
$timestamp = $row['timestamp'];
$member_id = $row['member_id'];
$best = NULL;
$best_num = -1;
for ($i = 1; $i <= 10; $i++) {
if ($row['votes' . strval($i)] > $best_num) {
$best = $row['option' . strval($i)];
$best_num = $row['votes' . strval($i)];
}
}
if ($best_num == -1) {
continue;
}
$ticker_text = do_lang('VOTES_ARE_IN', strip_comcode(get_translated_text($row['question'])), strip_comcode(get_translated_text($best)));
$drops[] = rain_get_special_icons(NULL, $timestamp, NULL, $ticker_text) + array('TYPE' => 'polls', 'FROM_MEMBER_ID' => strval($member_id), 'TO_MEMBER_ID' => NULL, 'TITLE' => rain_truncate_for_title(get_translated_text($row['question'])), 'IMAGE' => find_theme_image('bigicons/polls'), 'TIMESTAMP' => strval($timestamp), 'RELATIVE_TIMESTAMP' => strval($timestamp - $from), 'TICKER_TEXT' => $ticker_text, 'URL' => build_url(array('page' => 'polls', 'type' => 'view', 'id' => $row[1]['id']), '_SEARCH'), 'IS_POSITIVE' => false, 'IS_NEGATIVE' => false, 'FROM_ID' => 'member_' . strval($member_id), 'TO_ID' => NULL, 'GROUP_ID' => 'poll_' . strval($row['id']));
}
}
return $drops;
}
示例8: run
/**
* Standard modular run function.
*
* @param array A map of parameters.
* @return tempcode The result of execution.
*/
function run($map)
{
require_code('catalogues');
require_lang('catalogues');
require_css('catalogues');
$number = array_key_exists('param', $map) ? intval($map['param']) : 10;
$catalogue = array_key_exists('catalogue', $map) ? $map['catalogue'] : 'faqs';
$zone = array_key_exists('zone', $map) ? $map['zone'] : get_module_zone('catalogues');
$root = array_key_exists('root', $map) && $map['root'] != '' ? intval($map['root']) : NULL;
$catalogues = $GLOBALS['SITE_DB']->query_select('catalogues', array('*'), array('c_name' => $catalogue), '', 1);
if (!array_key_exists(0, $catalogues)) {
return do_lang_tempcode('MISSING_RESOURCE', escape_html($catalogue));
}
$catalogue_row = $catalogues[0];
$entries = $GLOBALS['SITE_DB']->query_select('catalogue_entries', array('*'), array('c_name' => $catalogue, 'ce_validated' => 1), 'ORDER BY ce_add_date DESC', $number);
$tpl_set = $catalogue;
$display_type = array_key_exists('display_type', $map) ? intval($map['display_type']) : NULL;
list($content, , ) = get_catalogue_category_entry_buildup(db_get_first_id(), $catalogue, $catalogue_row, 'SEARCH', $tpl_set, $number, 0, NULL, $root, $display_type, false, $entries);
$catalogue_title = get_translated_text($catalogue_row['c_title']);
if ($content->is_empty()) {
if (has_actual_page_access(NULL, 'cms_catalogues', NULL, NULL) && has_submit_permission('mid', get_member(), get_ip_address(), 'cms_catalogues')) {
$submit_url = build_url(array('page' => 'cms_catalogues', 'type' => 'add_entry', 'catalogue_name' => $catalogue, 'redirect' => SELF_REDIRECT), get_module_zone('cms_catalogues'));
} else {
$submit_url = new ocp_tempcode();
}
return do_template('BLOCK_NO_ENTRIES', array('HIGH' => false, 'TITLE' => do_lang_tempcode('RECENT', escape_html(integer_format($number)), escape_html($catalogue_title)), 'MESSAGE' => do_lang_tempcode('NO_ENTRIES'), 'ADD_NAME' => do_lang_tempcode('CATALOGUE_GENERIC_ADD', escape_html($catalogue_title)), 'SUBMIT_URL' => $submit_url));
}
return do_template('BLOCK_MAIN_RECENT_CC_ENTRIES', array('_GUID' => 'a57fa1b83d1b6fe3acbceb2b618e6d7f', 'CATALOGUE_TITLE' => $catalogue_title, 'CATALOGUE' => $catalogue, 'CONTENT' => $content, 'NUMBER' => integer_format($number)));
}
示例9: run
/**
* Standard modular run function for ajax-tree hooks. Generates XML for a tree list, which is interpreted by Javascript and expanded on-demand (via new calls).
*
* @param ?ID_TEXT The ID to do under (NULL: root)
* @param array Options being passed through
* @param ?ID_TEXT The ID to select by default (NULL: none)
* @return string XML in the special category,entry format
*/
function run($id, $options, $default = NULL)
{
require_code('ocf_forums');
require_code('ocf_forums2');
$tree = ocf_get_topic_tree(is_null($id) ? NULL : intval($id), NULL, NULL, is_null($id) ? 0 : 1);
if (!has_actual_page_access(NULL, 'forumview')) {
$tree = array();
}
$out = '';
foreach ($tree as $t) {
$_id = $t['id'];
if ($id === strval($_id)) {
foreach ($t['entries'] as $eid => $etitle) {
$out .= '<entry id="' . xmlentities(strval($eid)) . '" title="' . xmlentities($etitle) . '" selectable="true"></entry>';
}
continue;
}
$title = $t['title'];
$has_children = $t['child_count'] != 0 || $t['child_entry_count'] != 0;
$out .= '<category id="' . xmlentities(strval($_id)) . '" title="' . xmlentities($title) . '" has_children="' . ($has_children ? 'true' : 'false') . '" selectable="false"></category>';
}
// Mark parent cats for pre-expansion
if (!is_null($default) && $default != '') {
$cat = $GLOBALS['FORUM_DB']->query_value_null_ok('f_topics', 't_forum_id', array('id' => intval($default)));
while (!is_null($cat)) {
$out .= '<expand>' . strval($cat) . '</expand>';
$cat = $GLOBALS['FORUM_DB']->query_value_null_ok('f_forums', 'f_parent_forum', array('id' => $cat));
}
}
return '<result>' . $out . '</result>';
}
示例10: run
/**
* Standard modular run function.
*
* @param array A map of parameters.
* @return tempcode The result of execution.
*/
function run($map)
{
unset($map);
$forum = get_forum_type();
$out = new ocp_tempcode();
if ($forum != 'none') {
// Standard welcome back vs into greeting
$member = get_member();
if (is_guest($member)) {
$redirect = get_self_url(true, true);
$login_url = build_url(array('page' => 'login', 'type' => 'misc', 'redirect' => $redirect), get_module_zone('login'));
$join_url = $GLOBALS['FORUM_DRIVER']->join_url();
$join_bits = do_template('JOIN_OR_LOGIN', array('LOGIN_URL' => $login_url, 'JOIN_URL' => $join_url));
$p = do_lang_tempcode('WELCOME', $join_bits);
$out->attach(paragraph($p, 'hhrt4dsgdsgd'));
} else {
$out->attach(paragraph(do_lang_tempcode('WELCOME_BACK', escape_html($GLOBALS['FORUM_DRIVER']->get_username($member))), 'gfgdf9gjd'));
}
}
$message = get_option('welcome_message');
if (has_actual_page_access(get_member(), 'admin_config')) {
if ($message != '') {
$message .= ' [[page="_SEARCH:admin_config:category:SITE#group_GENERAL"]' . do_lang('EDIT') . '[/page]]';
}
}
$out->attach(comcode_to_tempcode($message, NULL, true));
return $out;
}
示例11: run
/**
* Standard modular run function.
*
* @param array A map of parameters.
* @return tempcode The result of execution.
*/
function run($map)
{
require_code('downloads');
require_css('downloads');
require_lang('downloads');
require_code('ocfiltering');
$number = array_key_exists('param', $map) ? intval($map['param']) : 10;
$filter = array_key_exists('filter', $map) ? $map['filter'] : '*';
$zone = array_key_exists('zone', $map) ? $map['zone'] : get_module_zone('downloads');
$sql_filter = ocfilter_to_sqlfragment($filter, 'p.category_id', 'download_categories', 'parent_id', 'p.category_id', '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)
$rows = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . get_table_prefix() . 'download_downloads p WHERE validated=1 AND (' . $sql_filter . ') ORDER BY add_date DESC', $number);
$title = do_lang_tempcode('RECENT', make_string_tempcode(integer_format($number)), do_lang_tempcode('SECTION_DOWNLOADS'));
if (array_key_exists('title', $map) && $map['title'] != '') {
$title = protect_from_escaping(escape_html($map['title']));
}
$out = new ocp_tempcode();
foreach ($rows as $i => $row) {
if ($i != 0) {
$out->attach(do_template('BLOCK_SEPARATOR'));
}
$out->attach(get_download_html($row, true, true, $zone));
}
if ($out->is_empty()) {
if (has_actual_page_access(NULL, 'cms_downloads', NULL, NULL) && has_submit_permission('mid', get_member(), get_ip_address(), 'cms_downloads')) {
$submit_url = build_url(array('page' => 'cms_downloads', 'type' => 'ad', 'redirect' => SELF_REDIRECT), get_module_zone('cms_downloads'));
} else {
$submit_url = new ocp_tempcode();
}
return do_template('BLOCK_NO_ENTRIES', array('_GUID' => '74399763a51102bdd6e6d92c2c11354f', 'HIGH' => false, 'TITLE' => $title, 'MESSAGE' => do_lang_tempcode('NO_DOWNLOADS_YET'), 'ADD_NAME' => do_lang_tempcode('ADD_DOWNLOAD'), 'SUBMIT_URL' => $submit_url));
}
return do_template('BLOCK_MAIN_RECENT_DOWNLOADS', array('_GUID' => '257fa1b83d1b6fe3acbceb2b618e6d7f', 'TITLE' => $title, 'CONTENT' => $out, 'NUMBER' => integer_format($number)));
}
示例12: run
/**
* Standard modular run function.
*
* @param MEMBER The ID of the member we are getting link hooks for
* @return array List of tuples for results. Each tuple is: type,title,url
*/
function run($member_id)
{
if (!addon_installed('chat')) {
return array();
}
$modules = array();
if (has_actual_page_access(get_member(), 'chat', get_page_zone('chat'))) {
if (!is_guest() && $member_id != get_member()) {
require_lang('chat');
require_code('chat');
if (!$GLOBALS['FORUM_DRIVER']->is_staff($member_id)) {
if (!member_blocked($member_id)) {
$modules[] = array('contact', do_lang_tempcode('EXPLAINED_BLOCK_MEMBER'), build_url(array('page' => 'chat', 'type' => 'blocking_add', 'member_id' => $member_id, 'redirect' => get_self_url(true)), get_module_zone('chat')));
if (has_specific_permission(get_member(), 'start_im')) {
$modules[] = array('contact', do_lang_tempcode('START_IM'), build_url(array('page' => 'chat', 'type' => 'misc', 'enter_im' => $member_id), get_module_zone('chat')));
}
} else {
$modules[] = array('contact', do_lang_tempcode('EXPLAINED_UNBLOCK_MEMBER'), build_url(array('page' => 'chat', 'type' => 'blocking_remove', 'member_id' => $member_id, 'redirect' => get_self_url(true)), get_module_zone('chat')));
}
}
if (!member_befriended($member_id)) {
$modules[] = array('contact', do_lang_tempcode('MAKE_BUDDY'), build_url(array('page' => 'chat', 'type' => 'buddy_add', 'member_id' => $member_id, 'redirect' => get_self_url(true)), get_module_zone('chat')));
} else {
$modules[] = array('contact', do_lang_tempcode('DUMP_BUDDY'), build_url(array('page' => 'chat', 'type' => 'buddy_remove', 'member_id' => $member_id, 'redirect' => get_self_url(true)), get_module_zone('chat')));
}
}
}
return $modules;
}
示例13: booking_do_next
/**
* Get a do-next manager for bookings.
*
* @return tempcode Booking do-next manager.
*/
function booking_do_next()
{
require_lang('calendar');
require_code('templates_donext');
require_code('fields');
return do_next_manager(get_page_title('BOOKINGS'), comcode_lang_string('DOC_BOOKING'), array(has_specific_permission(get_member(), 'submit_cat_highrange_content', 'cms_booking') ? array('bookable', array('_SELF', array('type' => 'ad'), '_SELF'), do_lang('ADD_BOOKABLE')) : NULL, has_specific_permission(get_member(), 'edit_cat_highrange_content', 'cms_booking') ? array('bookable', array('_SELF', array('type' => 'ed'), '_SELF'), do_lang('EDIT_BOOKABLE')) : NULL, has_specific_permission(get_member(), 'submit_cat_highrange_content', 'cms_booking') ? array('supplement', array('_SELF', array('type' => 'av'), '_SELF'), do_lang('ADD_BOOKABLE_SUPPLEMENT')) : NULL, has_specific_permission(get_member(), 'edit_cat_highrange_content', 'cms_booking') ? array('supplement', array('_SELF', array('type' => 'ev'), '_SELF'), do_lang('EDIT_BOOKABLE_SUPPLEMENT')) : NULL, has_specific_permission(get_member(), 'submit_cat_highrange_content', 'cms_booking') ? array('blacked', array('_SELF', array('type' => 'ac'), '_SELF'), do_lang('ADD_BOOKABLE_BLACKED')) : NULL, has_specific_permission(get_member(), 'edit_cat_highrange_content', 'cms_booking') ? array('blacked', array('_SELF', array('type' => 'ec'), '_SELF'), do_lang('EDIT_BOOKABLE_BLACKED')) : NULL, has_specific_permission(get_member(), 'submit_highrange_content', 'cms_booking') ? array('booking', array('_SELF', array('type' => 'ab'), '_SELF'), do_lang('ADD_BOOKING')) : NULL, has_specific_permission(get_member(), 'edit_highrange_content', 'cms_booking') ? array('booking', array('_SELF', array('type' => 'eb'), '_SELF'), do_lang('EDIT_BOOKING')) : NULL, has_actual_page_access(get_member(), 'calendar') ? array('calendar', array('calendar', array('type' => 'misc', 'view' => 'month'), '_SEARCH'), do_lang('CALENDAR')) : NULL), do_lang('BOOKINGS'));
}
示例14: run
/**
* Standard modular run function for snippet hooks. Generates XHTML to insert into a page using AJAX.
*
* @return tempcode The snippet
*/
function run()
{
if (has_actual_page_access(get_member(), 'admin_themes')) {
require_code('tempcode_compiler');
return template_to_tempcode(post_param('css'));
}
return new ocp_tempcode();
}
示例15: run
/**
* Standard modular run function for RSS hooks.
*
* @param string A list of categories we accept from
* @param TIME Cutoff time, before which we do not show results from
* @param string Prefix that represents the template set we use
* @set RSS_ ATOM_
* @param string The standard format of date to use for the syndication type represented in the prefix
* @param integer The maximum number of entries to return, ordering by date
* @return ?array A pair: The main syndication section, and a title (NULL: error)
*/
function run($_filters, $cutoff, $prefix, $date_string, $max)
{
if (!addon_installed('tickets')) {
return NULL;
}
if (!has_actual_page_access(get_member(), 'tickets')) {
return NULL;
}
if (is_guest()) {
return NULL;
}
require_code('tickets');
require_code('tickets2');
$ticket_types = ocfilter_to_idlist_using_callback($_filters, '', NULL, NULL, NULL, NULL, false);
if (count($ticket_types) != 0) {
$rows = array();
foreach ($ticket_types as $ticket_type) {
if (!has_category_access(get_member(), 'tickets', get_translated_text($ticket_type))) {
continue;
}
$rows = array_merge($rows, get_tickets(get_member(), $ticket_type, false, false, true));
}
} else {
$rows = get_tickets(get_member(), NULL, false, false, true);
}
require_code('feedback');
$content = new ocp_tempcode();
foreach ($rows as $i => $row) {
if ($i == $max) {
break;
}
if ($row['lasttime'] < $cutoff) {
continue;
}
$ticket_id = extract_topic_identifier($row['description']);
$ticket_type = $GLOBALS['SITE_DB']->query_value_null_ok('tickets', 'ticket_type', array('ticket_id' => $ticket_id));
$author = $row['firstusername'];
$date = date($date_string, $row['firsttime']);
$edit_date = date($date_string, $row['lasttime']);
$title = xmlentities($row['firsttitle']);
$summary = xmlentities($row['firstpost']->evaluate());
$category = '';
$category_raw = '';
if (!is_null($ticket_type)) {
$category = get_translated_text($ticket_type);
$category_raw = strval($ticket_type);
}
$view_url = build_url(array('page' => 'tickets', 'type' => 'ticket', 'id' => $ticket_id), get_module_zone('tickets'), NULL, false, false, true);
if ($prefix == 'RSS_' && get_option('is_on_comments') == '1') {
$if_comments = do_template('RSS_ENTRY_COMMENTS', array('_GUID' => 'b4f25f5cf68304f8d402bb06851489d6', 'COMMENT_URL' => $view_url, 'ID' => strval($ticket_id)));
} else {
$if_comments = new ocp_tempcode();
}
$content->attach(do_template($prefix . 'ENTRY', array('VIEW_URL' => $view_url, 'SUMMARY' => $summary, 'EDIT_DATE' => $edit_date, 'IF_COMMENTS' => $if_comments, 'TITLE' => $title, 'CATEGORY_RAW' => $category_raw, 'CATEGORY' => $category, 'AUTHOR' => $author, 'ID' => $ticket_id, 'NEWS' => '', 'DATE' => $date)));
}
require_lang('tickets');
return array($content, do_lang('SUPPORT_TICKETS'));
}