本文整理汇总了PHP中check_permission函数的典型用法代码示例。如果您正苦于以下问题:PHP check_permission函数的具体用法?PHP check_permission怎么用?PHP check_permission使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了check_permission函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updatecontentobj
function updatecontentobj(&$contentobj, $preview = false, $params = null)
{
if ($params == null) {
$params = $_POST;
}
$userid = get_userid();
$adminaccess = check_ownership($userid, $contentobj->Id()) || check_permission($userid, 'Modify Any Page');
#Fill contentobj with parameters
$contentobj->FillParams($params);
if ($preview) {
$error = $contentobj->ValidateData();
}
if (isset($params["ownerid"])) {
$contentobj->SetOwner($params["ownerid"]);
}
$contentobj->SetLastModifiedBy($userid);
// #Fill Additional Editors (kind of kludgy)
// if (isset($params["additional_editors"]))
// {
// $addtarray = array();
// foreach ($params["additional_editors"] as $addt_user_id)
// {
// $addtarray[] = $addt_user_id;
// }
// $contentobj->SetAdditionalEditors($addtarray);
// }
// else if ($adminaccess)
// {
// $contentobj->SetAdditionalEditors(array());
// }
}
示例2: TabNames
function TabNames()
{
$res = array(lang('main'));
if (check_permission(get_userid(), 'Manage All Content')) {
$res[] = lang('options');
}
return $res;
}
示例3: __construct
function __construct()
{
parent::__construct();
$this->page = "AssignProject";
if (check_permission("UserManagement", "n")) {
$this->goFailPage();
}
}
示例4: __construct
function __construct()
{
parent::__construct();
$this->page = "RoleManagement";
if (check_permission($this->page, "n")) {
$this->goFailPage();
}
}
示例5: __construct
function __construct()
{
parent::__construct();
$this->page = "QuestionManagement";
if (check_permission($this->page, "n")) {
$this->goFailPage();
}
if ($this->isSelectedProject() == FALSE) {
redirect("PreviewSurvey");
}
}
示例6: _init
private static function _init()
{
$AC =& ac_utils::get_module('AdvancedContent');
self::$_tabs = array('main' => array('tab_id' => 'main', 'tab_name' => lang('main'), 'block_tabs' => array(), 'block_groups' => array(), 'content_blocks' => array()));
if (check_permission(get_userid(), 'Manage All Content')) {
self::$_tabs['options'] = array('tab_id' => 'options', 'tab_name' => lang('options'), 'block_tabs' => array(), 'block_groups' => array(), 'content_blocks' => array());
}
if (check_permission(get_userid(), 'Manage AdvancedContent Options') && $AC->GetPreference('use_advanced_pageoptions', 0)) {
self::$_tabs['AdvancedContent'] = array('tab_id' => 'AdvancedContent', 'tab_name' => $AC->lang('advancedcontent_tabname'), 'block_tabs' => array(), 'block_groups' => array(), 'content_blocks' => array());
}
self::$_init = true;
}
示例7: get_delete_list
function get_delete_list($sel_nodes, &$parent, &$final_result, $depth = 0)
{
// get the list of items we should delete
$userid = get_userid();
if (!check_permission($userid, 'Remove Pages')) {
return FALSE;
}
global $mypages;
$status = TRUE;
foreach ($sel_nodes as $node) {
if (check_ownership($userid, $node->getTag()) || quick_check_authorship($node->getTag(), $mypages)) {
$content = $node->GetContent(false, false, true);
if (!is_object($content)) {
continue;
}
$children =& $node->getChildren(false, true);
$child_status = array();
if (isset($children) && count($children)) {
// we have children.. but we may not have access to
// any or all of them.
$tmp = array();
$child_status = get_delete_list($children, $node, $tmp, $depth + 1);
if ($child_status === FALSE || count($tmp) == 0) {
// there are children, but for one reason or another
// we can't delete em. which means we can't delete this
// parent either, or any of its parents.
$status = FALSE;
} else {
if (!isset($final_result[$content->Id()])) {
$final_result[$content->Id()] = $content;
}
}
if (count($tmp)) {
// there are children se can delete.
foreach ($tmp as $content_id => $one) {
if (!isset($final_result[$content_id])) {
$final_result[$content_id] = $one;
}
}
}
} else {
// no children
if (!isset($final_result[$content->Id()])) {
$final_result[$content->Id()] = $content;
}
}
} else {
$status = FALSE;
}
}
return $status;
}
示例8: __construct
function __construct()
{
parent::__construct();
$this->load->helper('admin/admin_menu');
$this->template->set_theme('admin');
$perm = check_permission();
if ($perm === FALSE) {
$this->session->set_flashdata('redirect', $this->uri->uri_string());
redirect('user/login');
} elseif ($perm === NULL) {
show_error('Yetkiniz yok.');
}
}
示例9: check_permission
function check_permission($dir)
{
$d = opendir($dir);
while ($file = readdir($d)) {
if ($file == '.' || $file == '..') {
continue;
}
$file = $dir . '/' . $file;
if (!is_readable($file) || !is_writeable($file) || is_dir($file) && (!is_executable($file) || check_permission($file))) {
return TRUE;
}
}
return FALSE;
}
示例10: __construct
public function __construct()
{
$this->ci = get_instance();
$this->ci->load->library('asset');
$this->ci->load->helper('template');
if (get_option('debug') == 1 && check_permission('dummy')) {
$this->ci->output->enable_profiler(TRUE);
$this->debug = TRUE;
error_reporting(E_ALL);
}
if (get_option('theme')) {
$this->theme = get_option('theme');
}
}
示例11: smarty_cms_function_edit
function smarty_cms_function_edit($params, &$smarty)
{
global $gCms;
if (!check_permission(get_userid(false), 'Modify Any Page') && !quick_check_authorship($gCms->variables['content_id'], author_pages(get_userid(false)))) {
return;
}
$urlext = '?' . CMS_SECURE_PARAM_NAME . '=' . $_SESSION[CMS_USER_KEY];
$text = isset($params['text']) ? $params['text'] : 'Edit This Page';
if (isset($params["showbutton"])) {
return '<a href="' . $gCms->config['root_url'] . '/' . $gCms->config['admin_dir'] . '/editcontent.php' . $urlext . '&content_id=' . $gCms->variables['content_id'] . '"><img src="' . $gCms->config['root_url'] . '/images/cms/editbutton.png" alt="' . $text . '"/></a>';
} else {
return '<a href="' . $gCms->config['root_url'] . '/' . $gCms->config['admin_dir'] . '/editcontent.php' . $urlext . '&content_id=' . $gCms->variables['content_id'] . '">' . $text . '</a>';
}
/*
global $gCms;
$userid = get_userid(false);
if(!$userid) return;
$access = check_permission($userid, 'Modify Any Page');
if (!$access) return;
$text = 'Edit This Page';
if (!empty($params['text']))
{
$text = $params['text'];
}
//will this work if using htaccess? (Yes! -Wishy)
if (isset($params["showbutton"]))
{
return '<a href="'.$gCms->config['root_url'].'/'.$gCms->config['admin_dir'].'/editcontent.php?content_id='.$gCms->variables['content_id'].'"><img src="'.$gCms->config['root_url'].'/images/cms/editbutton.png" alt="'.$text.'"/></a>';
}
else
{
return '<a href="'.$gCms->config['root_url'].'/'.$gCms->config['admin_dir'].'/editcontent.php?content_id='.$gCms->variables['content_id'].'">'.$text.'</a>';
}
*/
}
示例12: fetchPrefabTemplates
function fetchPrefabTemplates()
{
global $AVE_Template;
if (check_permission('template_new')) {
$verzname = BASE_DIR . '/inc/data/prefabs/templates';
$dht = opendir($verzname);
$sel_theme = '';
while (gettype($theme = readdir($dht)) != @boolean) {
if (is_file($verzname . '/' . $theme) && $theme != '.' && $theme != '..') {
$sel_theme .= '<option value="' . $theme . '">' . strtoupper(substr($theme, 0, -4)) . '</option>';
$theme = '';
}
}
$AVE_Template->assign('sel_theme', $sel_theme);
if (!empty($_REQUEST['theme_pref'])) {
ob_start();
@readfile(BASE_DIR . '/inc/data/prefabs/templates/' . $_REQUEST['theme_pref']);
$prefab = ob_get_contents();
ob_end_clean();
$AVE_Template->assign('prefab', $prefab);
}
}
}
示例13: base_url
if ($this->session->userdata('id') == 1 or check_permission('staff_list')) {
?>
<li>
<a href="<?php
echo base_url();
?>
staff/index" class="waves-effect waves-button">
<span class="menu-icon fa fa-users fa-flip-horizontal"></span>
<p>Staff</p>
</a>
</li>
<?php
}
?>
<?php
if ($this->session->userdata('id') == 1 or check_permission('log_menu')) {
?>
<li>
<a href="<?php
echo base_url();
?>
kpitb_panel/logs" class="waves-effect waves-button">
<span class="menu-icon fa fa-lock fa-flip-horizontal"></span>
<p>Logs</p>
</a>
</li>
<?php
}
?>
</ul>
示例14: catch
$contentobj->FillParams($_POST);
}
} catch (CmsEditContentException $e) {
$error = $e->getMessage();
}
}
if (!$access) {
echo "<div class=\"pageerrorcontainer pageoverflow\"><p class=\"pageerror\">" . lang('noaccessto', array(lang('addcontent'))) . "</p></div>";
} else {
$tabnames = $contentobj->TabNames();
// Get a list of content_types and build the dropdown to select one
$typesdropdown = '<select name="content_type" onchange="document.Edit_Content.submit()" class="standard">';
$cur_content_type = '';
$content_types = $contentops->ListContentTypes(false, true);
foreach ($content_types as $onetype => $onetypename) {
if ($onetype == 'errorpage' && !check_permission($userid, 'Manage All Content')) {
continue;
}
$typesdropdown .= '<option value="' . $onetype . '"';
if ($onetype == $content_type) {
$typesdropdown .= ' selected="selected" ';
$cur_content_type = $onetype;
}
$typesdropdown .= ">" . $onetypename . "</option>";
}
$typesdropdown .= "</select>";
cms_utils::set_app_data('editing_content', $contentobj);
if (empty($error) && $contentobj->GetError()) {
$error = $contentobj->GetError();
}
if (FALSE == empty($error)) {
示例15:
<?php
global $current_section;
$current_section = 'inventory';
require_once '../../init.php';
// Required files
require_once MAD_PATH . '/www/cp/auth.php';
require_once MAD_PATH . '/functions/adminredirect.php';
require_once MAD_PATH . '/www/cp/restricted.php';
require_once MAD_PATH . '/www/cp/admin_functions.php';
require_once MAD_PATH . '/www/cp/templates/header.tpl.php';
if (!check_permission('inventory', $user_detail['user_id'])) {
exit;
}
if (check_permission_simple('modify_publications', $user_detail['user_id'])) {
if (isset($_GET['delete']) && $_GET['delete'] == 1 && is_numeric($_GET['id'])) {
delete_publication($_GET['id']);
}
}
?>
<div id="content">
<div id="contentHeader">
<h1>Inventory</h1>
</div>
<!-- #contentHeader -->
<div class="container">
<div class="grid-24">