• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP has_category_access函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中has_category_access函数的典型用法代码示例。如果您正苦于以下问题:PHP has_category_access函数的具体用法?PHP has_category_access怎么用?PHP has_category_access使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了has_category_access函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: 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'));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:71,代码来源:news.php


示例2: run

 /**
  * Standard modular run function for attachment hooks. They see if permission to an attachment of an ID relating to this content is present for the current member.
  *
  * @param  ID_TEXT		The ID
  * @param  object			The database connection to check on
  * @return boolean		Whether there is permission
  */
 function run($id, $connection)
 {
     if ($connection->connection_write != $GLOBALS['SITE_DB']->connection_write) {
         return false;
     }
     return has_category_access(get_member(), 'seedy_page', strval($id));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:14,代码来源:cedi_page.php


示例3: rules_script

/**
 * Pop-up some rules.
 */
function rules_script()
{
    $id = get_param_integer('id', NULL);
    if (is_null($id)) {
        require_code('site');
        $output = request_page('rules', true);
        $title = do_lang_tempcode('RULES');
    } else {
        if (!has_category_access(get_member(), 'forums', strval($id))) {
            warn_exit(do_lang_tempcode('ACCESS_DENIED'));
        }
        $forum_rows = $GLOBALS['FORUM_DB']->query_select('f_forums', array('*'), array('id' => $id), '', 1);
        if (!array_key_exists(0, $forum_rows)) {
            warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
        }
        $forum_row = $forum_rows[0];
        require_lang('ocf');
        $question = get_translated_tempcode($forum_row['f_intro_question'], $GLOBALS['FORUM_DB']);
        $answer = $forum_row['f_intro_answer'];
        $output = do_template('OCF_FORUM_INTRO_QUESTION_POPUP', array('_GUID' => '6f2dc12b616219ff982654b73ef979b2', 'QUESTION' => $question, 'ANSWER' => $answer));
        $title = $answer == '' ? do_lang_tempcode('FORUM_RULES') : do_lang_tempcode('INTRO_QUESTION');
    }
    $tpl = do_template('POPUP_HTML_WRAP', array('_GUID' => '26c4dbc7a4737310f089583f1048cb13', 'TITLE' => $title, 'TARGET' => '_top', 'CONTENT' => $output));
    $tpl->evaluate_echo();
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:28,代码来源:ocf_popups.php


示例4: run

 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     require_lang('news');
     $categories = $GLOBALS['SITE_DB']->query_select('news_categories', array('*'), array('nc_owner' => NULL));
     $content = new ocp_tempcode();
     $categories2 = array();
     foreach ($categories as $category) {
         if (has_category_access(get_member(), 'news', strval($category['id']))) {
             $join = ' LEFT JOIN ' . get_table_prefix() . 'news_category_entries d ON d.news_entry=p.id';
             $count = $GLOBALS['SITE_DB']->query_value_null_ok_full('SELECT COUNT(*) FROM ' . get_table_prefix() . 'news p' . $join . ' WHERE validated=1 AND (news_entry_category=' . strval($category['id']) . ' OR news_category=' . strval($category['id']) . ') ORDER BY date_and_time DESC');
             if ($count > 0) {
                 $category['_nc_title'] = get_translated_text($category['nc_title']);
                 $categories2[] = $category;
             }
         }
     }
     if (count($categories2) == 0) {
         global $M_SORT_KEY;
         $M_SORT_KEY = '_nc_title';
         usort($categories2, 'multi_sort');
         foreach ($categories as $category) {
             if (has_category_access(get_member(), 'news', strval($category['id']))) {
                 $categories2[] = $category;
             }
         }
     }
     foreach ($categories2 as $category) {
         $url = build_url(array('page' => 'news', 'type' => 'misc', 'id' => $category['id']), get_module_zone('news'));
         $name = $category['_nc_title'];
         $content->attach(do_template('BLOCK_SIDE_NEWS_CATEGORIES_CATEGORY', array('_GUID' => 'fee49cac370ec00fc59d2e9c66b6255a', 'URL' => $url, 'NAME' => $name, 'COUNT' => integer_format($count))));
     }
     return do_template('BLOCK_SIDE_NEWS_CATEGORIES', array('_GUID' => 'b47a0047247096373e5aa626348c4ebb', 'CONTENT' => $content, 'PRE' => '', 'POST' => ''));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:39,代码来源:side_news_categories.php


示例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 (!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'));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:43,代码来源:cedi.php


示例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('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'));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:69,代码来源:tickets.php


示例7: run

 /**
  * Standard modular run function for attachment hooks. They see if permission to an attachment of an ID relating to this content is present for the current member.
  *
  * @param  ID_TEXT		The ID
  * @param  object			The database connection to check on
  * @return boolean		Whether there is permission
  */
 function run($id, $connection)
 {
     $info = $connection->query_select('catalogue_entries', array('c_name', 'cc_id'), array('id' => intval($id)), '', 1);
     if (!array_key_exists(0, $info)) {
         return false;
     }
     if (!has_category_access(get_member(), 'catalogues_catalogue', $info[0]['c_name'])) {
         return false;
     }
     return get_value('disable_cat_cat_perms') === '1' || has_category_access(get_member(), 'catalogues_category', strval($info[0]['cc_id']));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:18,代码来源:catalogue_entry.php


示例8: run

 /**
  * Standard modular run function for attachment hooks. They see if permission to an attachment of an ID relating to this content is present for the current member.
  *
  * @param  ID_TEXT		The ID
  * @param  object			The database connection to check on
  * @return boolean		Whether there is permission
  */
 function run($id, $connection)
 {
     if ($connection->connection_write != $GLOBALS['SITE_DB']->connection_write) {
         return false;
     }
     $cat_id = $GLOBALS['SITE_DB']->query_value_null_ok('seedy_posts', 'page_id', array('id' => intval($id)));
     if (is_null($cat_id)) {
         return false;
     }
     return has_category_access(get_member(), 'seedy_page', strval($cat_id));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:18,代码来源:cedi_post.php


示例9: create_category_tree

 /**
  * Standard function to create the standardised category tree
  *
  * @param  ID_TEXT		Notification code
  * @param  ?ID_TEXT		The ID of where we're looking under (NULL: N/A)
  * @return array 			Tree structure
  */
 function create_category_tree($notification_code, $id)
 {
     $pagelinks = array();
     $types = $GLOBALS['SITE_DB']->query_select('calendar_types', array('id', 't_title'));
     foreach ($types as $type) {
         if (has_category_access(get_member(), 'calendar', strval($type['id'])) && $type['id'] != db_get_first_id()) {
             $pagelinks[] = array('id' => $type['id'], 'title' => get_translated_text($type['t_title']));
         }
     }
     global $M_SORT_KEY;
     $M_SORT_KEY = 'title';
     usort($pagelinks, 'multi_sort');
     return $pagelinks;
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:21,代码来源:calendar_event.php


示例10: 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('ocf_forum')) {
         return NULL;
     }
     if (get_forum_type() != 'ocf') {
         return NULL;
     }
     if (!has_actual_page_access(get_member(), 'forumview')) {
         return NULL;
     }
     $filters = ocfilter_to_sqlfragment($_filters, 'p_topic_id', 'f_forums', 'f_parent_forum', 'p_cache_forum_id', 'id', true, true, $GLOBALS['FORUM_DB']);
     $cutoff = max($cutoff, time() - 60 * 60 * 24 * 60);
     if (!is_guest()) {
         $filters .= ' AND (p_poster<>' . strval(get_member()) . ')';
     }
     $rows = $GLOBALS['FORUM_DB']->query('SELECT * FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_posts WHERE p_time>' . strval($cutoff) . (!has_specific_permission(get_member(), 'see_unvalidated') ? ' AND p_validated=1 ' : '') . ' AND ' . $filters . ' ORDER BY p_time DESC,id DESC', $max);
     $categories = list_to_map('id', $GLOBALS['FORUM_DB']->query('SELECT id,t_cache_first_title,t_pt_from,t_pt_to FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_topics WHERE t_cache_last_time>' . strval((int) $cutoff)));
     $content = new ocp_tempcode();
     foreach ($rows as $row) {
         if (!array_key_exists($row['p_topic_id'], $categories)) {
             continue;
         }
         $category = $categories[$row['p_topic_id']]['t_cache_first_title'];
         if ((!is_null($row['p_cache_forum_id']) || $categories[$row['p_topic_id']]['t_pt_from'] == get_member() || $categories[$row['p_topic_id']]['t_pt_to'] == get_member()) && (is_null($row['p_intended_solely_for']) || $row['p_intended_solely_for'] == get_member()) && has_category_access(get_member(), 'forums', strval($row['p_cache_forum_id']))) {
             $id = strval($row['id']);
             $author = $row['p_poster_name_if_guest'];
             $news_date = date($date_string, $row['p_time']);
             $edit_date = is_null($row['p_last_edit_time']) ? '' : date($date_string, $row['p_last_edit_time']);
             if ($edit_date == $news_date) {
                 $edit_date = '';
             }
             $news_title = xmlentities($row['p_title']);
             $_summary = get_translated_tempcode($row['p_post'], $GLOBALS['FORUM_DB']);
             $summary = xmlentities($_summary->evaluate());
             $news = '';
             $category_raw = strval($row['p_topic_id']);
             $view_url = build_url(array('page' => 'topicview', 'type' => 'findpost', 'id' => $row['id']), get_module_zone('forumview'), NULL, false, false, true);
             if ($prefix == 'RSS_') {
                 $if_comments = do_template('RSS_ENTRY_COMMENTS', array('_GUID' => 'ed06bc8f174a5427e1789820666fdd81', 'COMMENT_URL' => $view_url, 'ID' => strval($row['p_topic_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)));
         }
     }
     require_lang('ocf');
     return array($content, do_lang('FORUM_TOPICS'));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:60,代码来源:ocf_topicview.php


示例11: run

 /**
  * Standard modular run function for attachment hooks. They see if permission to an attachment of an ID relating to this content is present for the current member.
  *
  * @param  ID_TEXT		The ID
  * @param  object			The database connection to check on
  * @return boolean		Whether there is permission
  */
 function run($id, $connection)
 {
     $info = $connection->query_select('calendar_events', array('e_submitter', 'e_is_public', 'e_type'), array('id' => intval($id)), '', 1);
     if (!array_key_exists(0, $info)) {
         return false;
     }
     if (!has_category_access(get_member(), 'calendar', strval($info[0]['e_type']))) {
         return false;
     }
     if ($info[0]['e_is_public'] == 1) {
         return true;
     }
     if ($info[0]['e_submitter'] == get_member()) {
         return true;
     }
     return false;
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:24,代码来源:calendar.php


示例12: run

 /**
  * Standard modular run function for attachment hooks. They see if permission to an attachment of an ID relating to this content is present for the current member.
  *
  * @param  ID_TEXT		The ID
  * @param  object			The database connection to check on
  * @return boolean		Whether there is permission
  */
 function run($id, $connection)
 {
     if (get_forum_type() != 'ocf') {
         return false;
     }
     // Shouldn't be here, but maybe it's left over somehow
     require_code('ocf_forums');
     require_code('ocf_topics');
     $info = $GLOBALS['FORUM_DB']->query_select('f_posts', array('p_cache_forum_id', 'p_intended_solely_for', 'p_poster', 'p_topic_id'), array('id' => intval($id)), '', 1);
     if (!array_key_exists(0, $info)) {
         return false;
     }
     $forum_id = $info[0]['p_cache_forum_id'];
     $poster = $info[0]['p_poster'];
     $forum_id_parent = is_null($forum_id) ? NULL : $GLOBALS['FORUM_DB']->query_value('f_forums', 'f_parent_forum', array('id' => $forum_id));
     $forum_id_parent_parent = is_null($forum_id_parent) ? NULL : $GLOBALS['FORUM_DB']->query_value('f_forums', 'f_parent_forum', array('id' => $forum_id_parent));
     $intended_solely_for = $info[0]['p_intended_solely_for'];
     if (!is_null($intended_solely_for) && $poster != get_member() && $intended_solely_for != get_member()) {
         return false;
     }
     if (is_null($forum_id)) {
         $topic_info = $GLOBALS['FORUM_DB']->query_select('f_topics', array('t_pt_to', 't_pt_from'), array('id' => $info[0]['p_topic_id']), '', 1);
         return $topic_info[0]['t_pt_to'] == get_member() || $topic_info[0]['t_pt_from'] == get_member() || ocf_has_special_pt_access($info[0]['p_topic_id']);
     }
     if (addon_installed('tickets')) {
         $tf = get_option('ticket_forum_name', true);
         if (!is_null($tf)) {
             $forum2 = $GLOBALS['FORUM_DRIVER']->forum_id_from_name($tf);
         } else {
             $forum2 = NULL;
         }
         if ($forum2 === $forum_id || $forum2 === $forum_id_parent || $forum2 === $forum_id_parent_parent) {
             $title = $GLOBALS['FORUM_DB']->query_value('f_topics', 't_cache_first_title', array('id' => $info[0]['p_topic_id']));
             if (substr($title, 0, strlen(strval(get_member())) + 1) == strval(get_member()) . '_') {
                 return true;
             }
             require_lang('tickets');
             $description = $GLOBALS['FORUM_DB']->query_value('f_topics', 't_description', array('id' => $info[0]['p_topic_id']));
             if (substr($description, 0, strlen(do_lang('SUPPORT_TICKET') . ': #' . strval(get_member())) + 1) == do_lang('SUPPORT_TICKET') . ': #' . strval(get_member()) . '_') {
                 return true;
             }
         }
     }
     return has_category_access(get_member(), 'forums', strval($forum_id));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:52,代码来源:ocf_post.php


示例13: 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 (get_forum_type() != 'ocf') {
         return NULL;
     }
     if (!has_actual_page_access(get_member(), 'forumview')) {
         return NULL;
     }
     if (is_guest()) {
         return NULL;
     }
     $condition = 'l_time<t_cache_last_time OR (l_time IS NULL AND t_cache_last_time>' . strval(time() - 60 * 60 * 24 * intval(get_option('post_history_days'))) . ')';
     $query = ' FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_topics top LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_read_logs l ON (top.id=l.l_topic_id AND l.l_member_id=' . strval((int) get_member()) . ') LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'translate t ON ' . db_string_equal_to('language', user_lang()) . ' AND top.t_cache_first_post=t.id WHERE (' . $condition . ') AND t_forum_id IS NOT NULL ' . (!has_specific_permission(get_member(), 'see_unvalidated') ? ' AND t_validated=1 ' : '') . ' ORDER BY t_cache_last_time DESC';
     $rows = $GLOBALS['FORUM_DB']->query('SELECT *,top.id AS t_id ' . $query, $max);
     $categories = 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'));
     $content = new ocp_tempcode();
     foreach ($rows as $row) {
         if ((!is_null($row['t_forum_id']) || $row['t_pt_to'] == get_member()) && has_category_access(get_member(), 'forums', strval($row['t_forum_id']))) {
             $id = strval($row['id']);
             $author = $row['t_cache_first_username'];
             $news_date = date($date_string, $row['t_cache_first_time']);
             $edit_date = date($date_string, $row['t_cache_last_time']);
             if ($edit_date == $news_date) {
                 $edit_date = '';
             }
             $news_title = xmlentities($row['t_cache_first_title']);
             $_summary = get_translated_tempcode($row['t_cache_first_post'], $GLOBALS['FORUM_DB']);
             $summary = xmlentities($_summary->evaluate());
             $news = '';
             $category = array_key_exists($row['t_forum_id'], $categories) ? $categories[$row['t_forum_id']] : do_lang('NA');
             $category_raw = strval($row['t_forum_id']);
             $view_url = build_url(array('page' => 'topicview', 'id' => $row['t_id']), get_module_zone('topicview'));
             if ($prefix == 'RSS_') {
                 $if_comments = do_template('RSS_ENTRY_COMMENTS', array('COMMENT_URL' => $view_url, 'ID' => strval($row['t_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)));
         }
     }
     require_lang('ocf');
     return array($content, do_lang('TOPICS_UNREAD'));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:54,代码来源:ocf_unread_topics.php


示例14: 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('ocf_forum')) {
         return NULL;
     }
     if (get_forum_type() != 'ocf') {
         return NULL;
     }
     if (!has_actual_page_access(get_member(), 'forumview')) {
         return NULL;
     }
     $filters = ocfilter_to_sqlfragment($_filters, 't_forum_id', 'f_forums', 'f_parent_forum', 't_forum_id', 'id', true, true, $GLOBALS['FORUM_DB']);
     // 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['FORUM_DB']->query('SELECT * FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_topics WHERE t_cache_last_time>' . strval($cutoff) . (!has_specific_permission(get_member(), 'see_unvalidated') ? ' AND t_validated=1 ' : '') . ' AND ' . $filters . ' ORDER BY t_cache_last_time DESC', $max);
     $categories = 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'));
     $content = new ocp_tempcode();
     foreach ($rows as $row) {
         if ((!is_null($row['t_forum_id']) || $row['t_pt_to'] == get_member()) && has_category_access(get_member(), 'forums', strval($row['t_forum_id']))) {
             $id = strval($row['id']);
             $author = $row['t_cache_first_username'];
             $news_date = date($date_string, $row['t_cache_first_time']);
             $edit_date = date($date_string, $row['t_cache_last_time']);
             if ($edit_date == $news_date) {
                 $edit_date = '';
             }
             $news_title = xmlentities($row['t_cache_first_title']);
             $_summary = get_translated_tempcode($row['t_cache_first_post'], $GLOBALS['FORUM_DB']);
             $summary = xmlentities($_summary->evaluate());
             $news = '';
             $category = array_key_exists($row['t_forum_id'], $categories) ? $categories[$row['t_forum_id']] : do_lang('NA');
             $category_raw = strval($row['t_forum_id']);
             $view_url = build_url(array('page' => 'topicview', 'id' => $row['id']), get_module_zone('forumview'), NULL, false, false, true);
             if ($prefix == 'RSS_') {
                 $if_comments = do_template('RSS_ENTRY_COMMENTS', array('_GUID' => 'f5dd7ba612b989bba5e2d496da5bf161', '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)));
         }
     }
     require_lang('ocf');
     return array($content, do_lang('SECTION_FORUMS'));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:54,代码来源:ocf_forumview.php


示例15: 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 (get_forum_type() == 'ocf') {
         // Member's joining (f_members table)
         if (has_actual_page_access(get_member(), 'members')) {
             $rows = $GLOBALS['FORUM_DB']->query('SELECT m_ip_address,id AS member_id,m_join_time AS timestamp FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_members WHERE m_join_time BETWEEN ' . strval($from) . ' AND ' . strval($to));
             foreach ($rows as $row) {
                 $timestamp = $row['timestamp'];
                 $member_id = $row['member_id'];
                 if (is_guest($member_id)) {
                     continue;
                 }
                 $drops[] = rain_get_special_icons($row['m_ip_address'], $timestamp) + array('TYPE' => 'join', 'FROM_MEMBER_ID' => strval($member_id), 'TO_MEMBER_ID' => NULL, 'TITLE' => do_lang('JOINED') . ': ' . $GLOBALS['FORUM_DRIVER']->get_username($member_id), 'IMAGE' => $GLOBALS['FORUM_DRIVER']->get_member_avatar_url($member_id), 'TIMESTAMP' => strval($timestamp), 'RELATIVE_TIMESTAMP' => strval($timestamp - $from), 'TICKER_TEXT' => NULL, 'URL' => $GLOBALS['FORUM_DRIVER']->member_profile_url($member_id, false, true), 'IS_POSITIVE' => true, 'IS_NEGATIVE' => false, 'FROM_ID' => 'member_' . strval($member_id), 'TO_ID' => NULL, 'GROUP_ID' => NULL);
             }
         }
         // Forum posts (f_posts table)
         if (has_actual_page_access(get_member(), 'topicview') && addon_installed('ocf_forum')) {
             $rows = $GLOBALS['FORUM_DB']->query('SELECT p_intended_solely_for,id,p_poster AS member_id,p_time AS timestamp,p_cache_forum_id,p_post,p_title,p_ip_address FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_posts WHERE p_time BETWEEN ' . strval($from) . ' AND ' . strval($to));
             foreach ($rows as $row) {
                 if (is_null($row['p_cache_forum_id'])) {
                     continue;
                 }
                 if (!is_null($row['p_intended_solely_for'])) {
                     continue;
                 }
                 if (!has_category_access(get_member(), 'forums', strval($row['p_cache_forum_id']))) {
                     continue;
                 }
                 $timestamp = $row['timestamp'];
                 $member_id = $row['member_id'];
                 $ticker_text = strip_comcode(get_translated_text($row['p_post'], $GLOBALS['FORUM_DB']));
                 $drops[] = rain_get_special_icons($row['p_ip_address'], $timestamp, NULL, $ticker_text) + array('TYPE' => 'post', 'FROM_MEMBER_ID' => strval($member_id), 'TO_MEMBER_ID' => NULL, 'TITLE' => $row['p_title'] == '' ? rain_truncate_for_title(strip_comcode(get_translated_text($row['p_post'], $GLOBALS['FORUM_DB']))) : $row['p_title'], 'IMAGE' => is_guest($member_id) ? rain_get_country_image($row['p_ip_address']) : $GLOBALS['FORUM_DRIVER']->get_member_avatar_url($member_id), 'TIMESTAMP' => strval($timestamp), 'RELATIVE_TIMESTAMP' => strval($timestamp - $from), 'TICKER_TEXT' => $ticker_text, 'URL' => $GLOBALS['FORUM_DRIVER']->post_url($row['id'], $row['p_cache_forum_id']), 'IS_POSITIVE' => false, 'IS_NEGATIVE' => false, 'FROM_ID' => 'member_' . strval($member_id), 'TO_ID' => NULL, 'GROUP_ID' => 'post_' . strval($row['id']));
             }
         }
     }
     return $drops;
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:45,代码来源:ocf.php


示例16: run

 /**
  * Standard modular run function for newsletter hooks.
  *
  * @param  TIME				The time that the entries found must be newer than
  * @param  LANGUAGE_NAME	The language the entries found must be in
  * @param  string				Category filter to apply
  * @return array				Tuple of result details
  */
 function run($cutoff_time, $lang, $filter)
 {
     $new = new ocp_tempcode();
     if (get_forum_type() != 'ocf') {
         return array();
     }
     require_code('ocfiltering');
     $or_list = ocfilter_to_sqlfragment($filter, 't_forum_id');
     $rows = $GLOBALS['FORUM_DB']->query('SELECT * FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_topics WHERE t_cache_last_time>' . strval($cutoff_time) . ' AND t_validated=1 AND t_pt_to IS NULL AND t_pt_from IS NULL AND (' . $or_list . ') ORDER BY t_cache_last_time DESC', 300);
     if (count($rows) == 300) {
         return array();
     }
     foreach ($rows as $row) {
         if (has_category_access($GLOBALS['FORUM_DRIVER']->get_guest_id(), 'forums', strval($row['t_forum_id']))) {
             $_url = build_url(array('page' => 'topicview', 'type' => 'misc', 'id' => $row['id']), get_module_zone('topicview'), NULL, false, false, true);
             $url = $_url->evaluate();
             $name = $row['t_cache_first_title'];
             $member_id = is_guest($row['t_cache_first_member_id']) ? NULL : strval($row['t_cache_first_member_id']);
             $new->attach(do_template('NEWSLETTER_NEW_RESOURCE_FCOMCODE', array('_GUID' => '14a328f973ac44eb54aa9b31e5a4ae34', 'MEMBER_ID' => $member_id, 'URL' => $url, 'NAME' => $name)));
         }
     }
     return array($new, do_lang('SECTION_FORUMS', '', '', '', $lang));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:31,代码来源:ocf_forumview.php


示例17: render_catalogue_entry_screen

/**
 * Display a catalogue entry
 *
 * @param  AUTO_LINK		Entry ID
 * @param  boolean		Whether to skip rendering a title
 * @return tempcode		Tempcode interface to display an entry
 */
function render_catalogue_entry_screen($id, $no_title = false)
{
    require_code('feedback');
    if (addon_installed('ecommerce')) {
        require_code('ecommerce');
    }
    require_code('images');
    require_css('catalogues');
    require_lang('catalogues');
    $entries = $GLOBALS['SITE_DB']->query_select('catalogue_entries', array('*'), array('id' => $id), '', 1);
    if (!array_key_exists(0, $entries)) {
        return warn_screen(get_page_title('CATALOGUES'), do_lang_tempcode('MISSING_RESOURCE'));
    }
    $entry = $entries[0];
    $categories = $GLOBALS['SITE_DB']->query_select('catalogue_categories', array('*'), array('id' => $entry['cc_id']), '', 1);
    if (!array_key_exists(0, $categories)) {
        warn_exit(do_lang_tempcode('CAT_NOT_FOUND', strval($entry['cc_id'])));
    }
    $category = $categories[0];
    $GLOBALS['FEED_URL'] = find_script('backend') . '?mode=catalogues&filter=' . strval($entry['cc_id']);
    $catalogue_name = $category['c_name'];
    $catalogues = $GLOBALS['SITE_DB']->query_select('catalogues', array('*'), array('c_name' => $catalogue_name), '', 1);
    if (!array_key_exists(0, $catalogues)) {
        warn_exit(do_lang_tempcode('CATALOGUE_NOT_FOUND', $catalogue_name));
    }
    $catalogue = $catalogues[0];
    // Permission for here?
    if (!has_category_access(get_member(), 'catalogues_catalogue', $catalogue_name)) {
        access_denied('CATALOGUE_ACCESS');
    }
    if (get_value('disable_cat_cat_perms') !== '1' && !has_category_access(get_member(), 'catalogues_category', strval($entry['cc_id']))) {
        access_denied('CATEGORY_ACCESS');
    }
    $ecommerce = is_ecommerce_catalogue($catalogue_name);
    if ($ecommerce) {
        $tpl_set = 'products';
    } else {
        $tpl_set = $catalogue_name;
    }
    $root = get_param_integer('root', NULL);
    $map = get_catalogue_entry_map($entry, $catalogue, 'PAGE', $tpl_set, $root, NULL, NULL, true, true);
    if (get_db_type() != 'xml') {
        $entry['ce_views']++;
        $GLOBALS['SITE_DB']->query_update('catalogue_entries', array('ce_views' => $entry['ce_views']), array('id' => $id), '', 1, NULL, false, true);
    }
    // Validation
    if ($entry['ce_validated'] == 0) {
        if (!has_specific_permission(get_member(), 'jump_to_unvalidated')) {
            access_denied('SPECIFIC_PERMISSION', 'jump_to_unvalidated');
        }
        $map['WARNINGS'] = do_template('WARNING_TABLE', array('_GUID' => 'bf604859a572ca53e969bec3d91f9cfb', 'WARNING' => do_lang_tempcode(get_param_integer('redirected', 0) == 1 ? 'UNVALIDATED_TEXT_NON_DIRECT' : 'UNVALIDATED_TEXT')));
    } else {
        $map['WARNINGS'] = '';
    }
    //Finding any hook exists for this product--------------------
    if (addon_installed('ecommerce')) {
        $object = find_product(strval($id));
        if (is_object($object) && method_exists($object, 'get_custom_product_map_fields')) {
            $object->get_custom_product_map_fields($id, $map);
        }
    }
    //------------------------------------------------------------
    $map['ENTRY'] = do_template('CATALOGUE_' . $tpl_set . '_ENTRY', $map, NULL, false, 'CATALOGUE_DEFAULT_ENTRY');
    $map['ADD_DATE'] = get_timezoned_date($entry['ce_add_date']);
    $map['ADD_DATE_RAW'] = strval($entry['ce_add_date']);
 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP has_children函数代码示例发布时间:2022-05-15
下一篇:
PHP has_category函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap