本文整理汇总了PHP中access_denied函数的典型用法代码示例。如果您正苦于以下问题:PHP access_denied函数的具体用法?PHP access_denied怎么用?PHP access_denied使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了access_denied函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_page_warning_details
/**
* A page is not validated, so show a warning.
*
* @param ID_TEXT The zone the page is being loaded from
* @param ID_TEXT The codename of the page
* @param tempcode The edit URL (blank if no edit access)
* @return tempcode The warning
*/
function get_page_warning_details($zone, $codename, $edit_url)
{
$warning_details = new ocp_tempcode();
if (!has_specific_permission(get_member(), 'jump_to_unvalidated')) {
access_denied('SPECIFIC_PERMISSION', 'jump_to_unvalidated');
}
$uv_warning = do_lang_tempcode(get_param_integer('redirected', 0) == 1 ? 'UNVALIDATED_TEXT_NON_DIRECT' : 'UNVALIDATED_TEXT');
// Wear sun cream
if (!$edit_url->is_empty()) {
$menu_links = $GLOBALS['SITE_DB']->query('SELECT DISTINCT i_menu FROM ' . get_table_prefix() . 'menu_items WHERE ' . db_string_equal_to('i_url', $zone . ':' . $codename) . ' OR ' . db_string_equal_to('i_url', '_SEARCH:' . $codename));
if (count($menu_links) != 0) {
$menu_items_linking = new ocp_tempcode();
foreach ($menu_links as $menu_link) {
if (!$menu_items_linking->is_empty()) {
$menu_items_linking->attach(do_lang_tempcode('LIST_SEP'));
}
$menu_edit_url = build_url(array('page' => 'admin_menus', 'type' => 'edit', 'id' => $menu_link['i_menu']), get_module_zone('admin_menus'));
$menu_items_linking->attach(hyperlink($menu_edit_url, $menu_link['i_menu'], false, true));
}
$uv_warning = do_lang_tempcode('UNVALIDATED_TEXT_STAFF', $menu_items_linking);
}
}
$warning_details->attach(do_template('WARNING_TABLE', array('WARNING' => $uv_warning)));
return $warning_details;
}
示例2: run
/**
* Standard modular run function.
*
* @return tempcode The result of execution.
*/
function run()
{
if (get_forum_type() != 'ocf') {
warn_exit(do_lang_tempcode('NO_OCF'));
} else {
ocf_require_all_forum_stuff();
}
require_code('ocf_forumview');
if (is_guest()) {
access_denied('NOT_AS_GUEST');
}
require_css('ocf');
$type = get_param('type', 'misc');
if ($type == 'misc') {
list($title, $content) = $this->new_posts();
} elseif ($type == 'unread') {
list($title, $content) = $this->unread_topics();
} elseif ($type == 'recently_read') {
list($title, $content) = $this->recently_read();
} else {
$title = new ocp_tempcode();
$content = new ocp_tempcode();
}
$ret = ocf_wrapper($title, do_template('OCF_VFORUM', array('_GUID' => '8dca548982d65500ab1800ceec2ddc61', 'CONTENT' => $content)));
return $ret;
}
示例3: run
/**
* Standard modular run function.
*
* @return tempcode The result of execution.
*/
function run()
{
require_lang('bookmarks');
require_code('bookmarks');
require_css('bookmarks');
if (is_guest()) {
access_denied('NOT_AS_GUEST');
}
// Decide what we're doing
$type = get_param('type', 'misc');
if ($type == 'misc') {
return $this->manage_bookmarks();
}
if ($type == '_manage') {
return $this->_manage_bookmarks();
}
if ($type == '_edit') {
return $this->_edit_bookmark();
}
if ($type == 'ad') {
return $this->ad();
}
if ($type == '_ad') {
return $this->_ad();
}
return new ocp_tempcode();
}
示例4: ocf_make_poll
/**
* Add a forum poll.
*
* @param AUTO_LINK The ID of the topic to add the poll to.
* @param SHORT_TEXT The question.
* @param BINARY Whether the result tallies are kept private until the poll is made non-private.
* @param BINARY Whether the poll is open for voting.
* @param integer The minimum number of selections that may be made.
* @param integer The maximum number of selections that may be made.
* @param BINARY Whether members must have a post in the topic before they made vote.
* @param array A list of pairs of the potential voteable answers and the number of votes.
* @param boolean Whether to check there are permissions to make the poll.
* @return AUTO_LINK The ID of the newly created forum poll.
*/
function ocf_make_poll($topic_id, $question, $is_private, $is_open, $minimum_selections, $maximum_selections, $requires_reply, $answers, $check_permissions = true)
{
require_code('ocf_polls');
if ($check_permissions && !ocf_may_attach_poll($topic_id)) {
access_denied('I_ERROR');
}
$poll_id = $GLOBALS['FORUM_DB']->query_insert('f_polls', array('po_question' => $question, 'po_cache_total_votes' => 0, 'po_is_private' => $is_private, 'po_is_open' => $is_open, 'po_minimum_selections' => $minimum_selections, 'po_maximum_selections' => $maximum_selections, 'po_requires_reply' => $requires_reply), true);
foreach ($answers as $answer) {
if (is_array($answer)) {
list($answer, $num_votes) = $answer;
} else {
$num_votes = 0;
}
$GLOBALS['FORUM_DB']->query_insert('f_poll_answers', array('pa_poll_id' => $poll_id, 'pa_answer' => $answer, 'pa_cache_num_votes' => $num_votes));
}
$map = array('t_poll_id' => $poll_id);
// Now make the topic validated if this is attaching immediately
if (get_param_integer('re_validate', 0) == 1) {
$forum_id = $GLOBALS['FORUM_DB']->query_value('f_topics', 't_forum_id', array('id' => $topic_id));
if (is_null($forum_id) || has_specific_permission(get_member(), 'bypass_validation_midrange_content', 'topics', array('forums', $forum_id))) {
$map['t_validated'] = 1;
}
}
$GLOBALS['FORUM_DB']->query_update('f_topics', $map, array('id' => $topic_id), '', 1);
return $poll_id;
}
示例5: __construct
/**
* Constructor method
*
* @access public
* @return void
*/
public function __construct()
{
parent::__construct();
// Load the required classes
$this->load->model('group_m');
$this->lang->load('groups');
is_sadmin() or access_denied();
}
示例6: check_restrictions
/**
* Is the category accessible to the connected user ?
* If the user is not authorized to see this category, script exits
*
* @param int $category_id
*/
function check_restrictions($category_id)
{
global $user;
// $filter['visible_categories'] and $filter['visible_images']
// are not used because it's not necessary (filter <> restriction)
if (in_array($category_id, explode(',', $user['forbidden_categories']))) {
access_denied();
}
}
示例7: post_only_user
function post_only_user($level)
{
if (Request::$method != 'POST') {
return;
}
if (User::is("<{$level}")) {
access_denied();
}
}
示例8: run
/**
* Standard modular run function.
*
* @param array A map of parameters.
* @return tempcode The result of execution.
*/
function run($map)
{
if (!array_key_exists('param', $map)) {
return new ocp_tempcode();
}
if (!has_zone_access(get_member(), $map['param'])) {
access_denied('ZONE_ACCESS', $map['param']);
}
return new ocp_tempcode();
}
示例9: gb_index
function gb_index()
{
global $template, $page, $conf;
if (isset($page['section']) and $page['section'] == 'guestbook') {
if (is_a_guest() && !$conf['guestbook']['guest_can_view']) {
access_denied();
}
include GUESTBOOK_PATH . '/include/guestbook.inc.php';
}
}
示例10: 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('EDIT_EM');
require_lang('ocf');
require_css('ocf');
$order = 200;
if ($leave_to_ajax_if_possible && strtoupper(ocp_srv('REQUEST_METHOD')) != 'POST') {
return array($title, NULL, $order);
}
$tabs = array();
$hooks = find_all_hooks('systems', 'profiles_tabs_edit');
if (isset($hooks['settings'])) {
$hooks = array('settings' => $hooks['settings']) + $hooks;
}
foreach (array_keys($hooks) as $hook) {
require_code('hooks/systems/profiles_tabs_edit/' . $hook);
$ob = object_factory('Hook_Profiles_Tabs_Edit_' . $hook);
if ($ob->is_active($member_id_of, $member_id_viewing)) {
$tabs[] = $ob->render_tab($member_id_of, $member_id_viewing, $leave_to_ajax_if_possible);
}
}
if ($leave_to_ajax_if_possible) {
return array($title, NULL, $order);
}
global $M_SORT_KEY;
$M_SORT_KEY = 4;
usort($tabs, 'multi_sort');
$javascript = '';
$hidden = new ocp_tempcode();
// Session ID check, if saving
if (count($_POST) != 0 && count($tabs) != 0) {
global $SESSION_CONFIRMED;
if ($SESSION_CONFIRMED == 0) {
access_denied('SESSION', '', true);
}
}
$_tabs = array();
$first = true;
foreach ($tabs as $i => $tab) {
if (is_null($tab)) {
continue;
}
$javascript .= $tab[3];
if (isset($tab[5])) {
$hidden->attach($tab[5]);
}
$_tabs[] = array('TAB_TITLE' => $tab[0], 'TAB_FIELDS' => $tab[1], 'TAB_TEXT' => $tab[2], 'TAB_FIRST' => $first, 'TAB_LAST' => !array_key_exists($i + 1, $tabs));
$first = false;
}
$url = build_url(array('page' => '_SELF'), '_SELF', NULL, true, false, false);
$content = do_template('OCF_MEMBER_PROFILE_EDIT', array('JAVASCRIPT' => $javascript, 'HIDDEN' => $hidden, 'URL' => $url, 'SUBMIT_NAME' => do_lang_tempcode('SAVE'), 'AUTOCOMPLETE' => false, 'SKIP_VALIDATION' => true, 'TABS' => $_tabs));
return array($title, $content, $order);
}
示例11: ocf_make_topic
/**
* Add a topic.
*
* @param ?AUTO_LINK The ID of the forum the topic will be in (NULL: Private Topic).
* @param SHORT_TEXT Description of the topic.
* @param SHORT_TEXT The theme image code of the emoticon for the topic.
* @param ?BINARY Whether the topic is validated (NULL: detect whether it should be).
* @param BINARY Whether the topic is open.
* @param BINARY Whether the topic is pinned.
* @param BINARY Whether the topic is sunk.
* @param BINARY Whether the topic is cascading.
* @param ?MEMBER If it is a Private Topic, who is it 'from' (NULL: not a Private Topic).
* @param ?MEMBER If it is a Private Topic, who is it 'to' (NULL: not a Private Topic).
* @param boolean Whether to check the poster has permissions for the given topic settings.
* @param integer The number of times the topic has been viewed.
* @param ?AUTO_LINK Force an ID (NULL: don't force an ID)
* @param SHORT_TEXT Link related to the topic (e.g. link to view a ticket).
* @return AUTO_LINK The ID of the newly created topic.
*/
function ocf_make_topic($forum_id, $description = '', $emoticon = '', $validated = NULL, $open = 1, $pinned = 0, $sunk = 0, $cascading = 0, $pt_from = NULL, $pt_to = NULL, $check_perms = true, $num_views = 0, $id = NULL, $description_link = '')
{
if (is_null($pinned)) {
$pinned = 0;
}
if (is_null($sunk)) {
$sunk = 0;
}
if (is_null($description)) {
$description = '';
}
if (is_null($num_views)) {
$num_views = 0;
}
if ($check_perms) {
require_code('ocf_topics');
if (!ocf_may_post_topic($forum_id, get_member())) {
access_denied('I_ERROR');
}
if (!is_null($pt_to)) {
decache('side_ocf_personal_topics', array($pt_to));
decache('_new_pp', array($pt_to));
}
if (!is_null($forum_id)) {
require_code('ocf_posts_action');
ocf_decache_ocp_blocks($forum_id);
}
require_code('ocf_forums');
if (!ocf_may_moderate_forum($forum_id)) {
$pinned = 0;
$sunk = 0;
$open = 1;
$cascading = 0;
}
}
if (is_null($validated) || $check_perms && $validated == 1) {
if (!is_null($forum_id) && !has_specific_permission(get_member(), 'bypass_validation_midrange_content', 'topics', array('forums', $forum_id))) {
$validated = 0;
} else {
$validated = 1;
}
}
if (!addon_installed('unvalidated')) {
$validated = 1;
}
$map = array('t_pinned' => $pinned, 't_sunk' => $sunk, 't_cascading' => $cascading, 't_forum_id' => $forum_id, 't_pt_from' => $pt_from, 't_pt_to' => $pt_to, 't_description' => substr($description, 0, 255), 't_description_link' => substr($description_link, 0, 255), 't_emoticon' => $emoticon, 't_num_views' => $num_views, 't_validated' => $validated, 't_is_open' => $open, 't_poll_id' => NULL, 't_cache_first_post_id' => NULL, 't_cache_first_post' => NULL, 't_cache_first_time' => NULL, 't_cache_first_title' => '', 't_cache_first_username' => '', 't_cache_first_member_id' => NULL, 't_cache_last_post_id' => NULL, 't_cache_last_time' => NULL, 't_cache_last_title' => '', 't_cache_last_username' => '', 't_cache_last_member_id' => NULL, 't_cache_num_posts' => 0, 't_pt_from_category' => '', 't_pt_to_category' => '');
if (!is_null($id)) {
$map['id'] = $id;
}
return $GLOBALS['FORUM_DB']->query_insert('f_topics', $map, true);
}
示例12: ocf_delete_poll
/**
* Delete a forum poll.
*
* @param AUTO_LINK The ID of the poll we're deleting.
* @param LONG_TEXT The reason for deleting the poll.
* @return AUTO_LINK The ID of the topic the poll is on.
*/
function ocf_delete_poll($poll_id, $reason)
{
require_code('ocf_polls');
$topic_info = $GLOBALS['FORUM_DB']->query_select('f_topics', array('*'), array('t_poll_id' => $poll_id), '', 1);
if (!ocf_may_delete_poll_by($topic_info[0]['t_forum_id'], $topic_info[0]['t_cache_first_member_id'])) {
access_denied('I_ERROR');
}
$topic_id = $topic_info[0]['id'];
$name = $GLOBALS['FORUM_DB']->query_value('f_polls', 'po_question', array('id' => $poll_id));
$GLOBALS['FORUM_DB']->query_delete('f_polls', array('id' => $poll_id), '', 1);
$GLOBALS['FORUM_DB']->query_delete('f_poll_answers', array('pa_poll_id' => $poll_id));
$GLOBALS['FORUM_DB']->query_delete('f_poll_votes', array('pv_poll_id' => $poll_id));
$GLOBALS['FORUM_DB']->query_update('f_topics', array('t_poll_id' => NULL), array('t_poll_id' => $poll_id), '', 1);
require_code('ocf_general_action2');
ocf_mod_log_it('DELETE_TOPIC_POLL', strval($poll_id), $name, $reason);
return $topic_id;
}
示例13: run
/**
* Standard modular run function.
*
* @return tempcode The result of execution.
*/
function run()
{
require_lang('ecommerce');
require_code('ecommerce');
require_css('ecommerce');
// Kill switch
if (ecommerce_test_mode() && !$GLOBALS['IS_ACTUALLY_ADMIN'] && !has_specific_permission(get_member(), 'access_ecommerce_in_test_mode')) {
warn_exit(do_lang_tempcode('PURCHASE_DISABLED'));
}
if (is_guest()) {
access_denied('NOT_AS_GUEST');
}
$type = get_param('type', 'misc');
if ($type == 'misc') {
return $this->my();
}
if ($type == 'pay') {
return $this->pay();
}
return new ocp_tempcode();
}
示例14: run_start
/**
* Standard aed_module run_start.
*
* @param ID_TEXT The type of module execution
* @return tempcode The output of the run
*/
function run_start($type)
{
$GLOBALS['HELPER_PANEL_PIC'] = 'pagepics/news';
$GLOBALS['HELPER_PANEL_TUTORIAL'] = 'tut_news';
$this->posting_form_title = do_lang_tempcode('BLOG_NEWS_ARTICLE');
if (is_guest()) {
access_denied('NOT_AS_GUEST');
}
require_css('news');
require_lang('news');
// Decide what to do
if ($type == 'misc') {
return $this->misc();
}
if ($type == 'import_wordpress') {
return $this->import_wordpress();
}
if ($type == '_import_wordpress') {
return $this->_import_wordpress();
}
return new ocp_tempcode();
}
示例15: run_start
/**
* Standard aed_module run_start.
*
* @param ID_TEXT The type of module execution
* @return tempcode The output of the run
*/
function run_start($type)
{
require_lang('ocf_warnings');
if (get_forum_type() != 'ocf') {
warn_exit(do_lang_tempcode('NO_OCF'));
} else {
ocf_require_all_forum_stuff();
}
require_code('ocf_moderation_action');
require_code('ocf_moderation_action2');
if (!ocf_may_warn_members()) {
access_denied('SPECIFIC_PERMISSION', 'warn_members');
}
if ($type == 'history') {
return $this->history();
}
if ($type == 'undo_charge') {
return $this->undo_charge();
}
if ($type == 'undo_probation') {
return $this->undo_probation();
}
if ($type == 'undo_banned_ip') {
return $this->undo_banned_ip();
}
if ($type == 'undo_banned_member') {
return $this->undo_banned_member();
}
if ($type == 'undo_silence_from_topic') {
return $this->undo_silence_from_topic();
}
if ($type == 'undo_silence_from_forum') {
return $this->undo_silence_from_forum();
}
return new ocp_tempcode();
}