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

PHP is_allowed函数代码示例

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

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



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

示例1: getComments

 public function getComments($options = array(), $record_id = null, $record_type = null)
 {
     $request = Zend_Controller_Front::getInstance()->getRequest();
     $params = $request->getParams();
     if (!$record_id) {
         $record_id = $this->_getRecordId($params);
     }
     if (!$record_type) {
         $record_type = $this->_getRecordType($params);
     }
     $db = get_db();
     $commentTable = $db->getTable('Comment');
     $searchParams = array('record_type' => $record_type, 'record_id' => $record_id);
     if (isset($options['approved'])) {
         $searchParams['approved'] = $options['approved'];
     }
     if (!is_allowed('Commenting_Comment', 'update-approved')) {
         $searchParams['flagged'] = 0;
         $searchParams['is_spam'] = 0;
     }
     $select = $commentTable->getSelectForFindBy($searchParams);
     if (isset($options['order'])) {
         $select->order("ORDER BY added " . $options['order']);
     }
     return $commentTable->fetchObjects($select);
 }
开发者ID:regan008,项目名称:WearingGayHistory-Plugins,代码行数:26,代码来源:GetComments.php


示例2: getRepresentation

 public function getRepresentation(Omeka_Record_AbstractRecord $comment)
 {
     $user = current_user();
     if ($user->role == 'admin' || $user->role == 'super') {
         $allowAll = true;
     } else {
         $allowAll = false;
     }
     $representation = array('id' => $comment->id, 'url' => self::getResourceUrl("/comments/{$comment->id}"), 'record_id' => $comment->record_id, 'record_type' => $comment->record_type, 'path' => $comment->path, 'added' => self::getDate($comment->added), 'body' => $comment->body, 'author_name' => $comment->author_name, 'author_url' => $comment->author_url, 'approved' => (bool) $comment->approved);
     if ($allowAll) {
         $representation['ip'] = $comment->ip;
         $representation['user_agent'] = $comment->user_agent;
         $representation['flagged'] = $comment->flagged;
         $representation['is_spam'] = $comment->is_spam;
     }
     if ($comment->parent_comment_id) {
         $representation['parent_comment'] = array('id' => $comment->parent_comment_id, 'resource' => 'comments', 'url' => self::getResourceUrl("/comments/{$comment->parent_comment_id}"));
     } else {
         $representation['parent_comment'] = null;
     }
     $typeResource = Inflector::tableize($comment->record_type);
     $representation['record_url'] = array('id' => $comment->record_id, 'resource' => $typeResource, 'url' => self::getResourceUrl("/{$typeResource}/{$comment->record_id}"));
     if ($comment->user_id) {
         $representation['user'] = array('id' => $comment->user_id, 'url' => self::getResourceUrl("/users/{$comment->user_id}"));
     } else {
         $representation['user'] = null;
     }
     if ($user && is_allowed('Commenting_Comment', 'update-approved')) {
         $representation['author_email'] = $comment->author_email;
     }
     return $representation;
 }
开发者ID:regan008,项目名称:WearingGayHistory-Plugins,代码行数:32,代码来源:Comment.php


示例3: filterAdminNavigationMain

 function filterAdminNavigationMain($nav)
 {
     if (is_allowed('ConditionalElements_Index', 'index')) {
         $nav[] = array('label' => __('Conditional Elements'), 'uri' => url('conditional-elements'));
     }
     return $nav;
 }
开发者ID:GerZah,项目名称:plugin-ConditionalElements,代码行数:7,代码来源:ConditionalElementsPlugin.php


示例4: getRepresentation

 /**
  * Get the REST representation of an item.
  * 
  * @param Item $record
  * @return array
  */
 public function getRepresentation(Omeka_Record_AbstractRecord $record)
 {
     $representation = array('id' => $record->id, 'url' => self::getResourceUrl("/items/{$record->id}"), 'public' => (bool) $record->public, 'featured' => (bool) $record->featured, 'added' => self::getDate($record->added), 'modified' => self::getDate($record->modified));
     if ($record->item_type_id) {
         $representation['item_type'] = array('id' => $record->item_type_id, 'url' => self::getResourceUrl("/item_types/{$record->item_type_id}"), 'name' => $record->Type->name, 'resource' => 'item_types');
     } else {
         $representation['item_type'] = null;
     }
     if ($record->collection_id) {
         //check that user has access to the collection
         $collection = $record->getCollection();
         if (is_allowed($collection, 'show')) {
             $representation['collection'] = array('id' => $record->collection_id, 'url' => self::getResourceUrl("/collections/{$record->collection_id}"), 'resource' => 'collections');
         } else {
             $representation['collection'] = null;
         }
     } else {
         $representation['collection'] = null;
     }
     if ($record->owner_id) {
         $representation['owner'] = array('id' => $record->owner_id, 'url' => self::getResourceUrl("/users/{$record->owner_id}"), 'resource' => 'users');
     } else {
         $representation['owner'] = null;
     }
     $representation['files'] = array('count' => $record->getTable('File')->count(array('item_id' => $record->id)), 'url' => self::getResourceUrl("/files?item={$record->id}"), 'resource' => 'files');
     $representation['tags'] = $this->getTagRepresentations($record);
     $representation['element_texts'] = $this->getElementTextRepresentations($record);
     return $representation;
 }
开发者ID:lchen01,项目名称:STEdwards,代码行数:35,代码来源:Item.php


示例5: filterAdminNavigationMain

 /**
  * Add the Simple Vocab navigation link.
  */
 public function filterAdminNavigationMain($nav)
 {
     if (is_allowed('SimpleVocab_Index', 'index')) {
         $nav[] = array('label' => __('Simple Vocab'), 'uri' => url('simple-vocab'));
     }
     return $nav;
 }
开发者ID:sgbalogh,项目名称:peddler_clone5,代码行数:10,代码来源:SimpleVocabPlugin.php


示例6: indexAction

 /**
  * Display Solr results.
  */
 public function indexAction()
 {
     // Get pagination settings.
     $limit = get_option('per_page_public');
     $page = $this->_request->page ? $this->_request->page : 1;
     $start = ($page - 1) * $limit;
     // determine whether to display private items or not
     // items will only be displayed if:
     // solr_search_display_private_items has been enabled in the Solr Search admin panel
     // user is logged in
     // user_role has sufficient permissions
     $user = current_user();
     if (get_option('solr_search_display_private_items') && $user && is_allowed('Items', 'showNotPublic')) {
         // limit to public items
         $limitToPublicItems = false;
     } else {
         $limitToPublicItems = true;
     }
     // Execute the query.
     $results = $this->_search($start, $limit, $limitToPublicItems);
     // Set the pagination.
     Zend_Registry::set('pagination', array('page' => $page, 'total_results' => $results->response->numFound, 'per_page' => $limit));
     // Push results to the view.
     $this->view->results = $results;
 }
开发者ID:fitnycdigitalinitiatives,项目名称:SolrSearch,代码行数:28,代码来源:ResultsController.php


示例7: filterAdminNavigationMain

 /**
  * reassignfiles admin navigation filter
  */
 public function filterAdminNavigationMain($nav)
 {
     if (is_allowed('ReassignFiles_Index', 'index')) {
         $nav[] = array('label' => __('Reassign Files'), 'uri' => url('reassign-files'));
     }
     return $nav;
 }
开发者ID:GerZah,项目名称:plugin-ReassignFiles,代码行数:10,代码来源:ReassignFilesPlugin.php


示例8: __construct

 public function __construct()
 {
     parent::__construct();
     $this->load->helper(array('jbimages', 'language'));
     // is_allowed is a helper function which is supposed to return False if upload operation is forbidden
     // [See jbimages/is_alllowed.php]
     if (is_allowed() === FALSE) {
         exit;
     }
     // User configured settings
     $this->config->load('uploader_settings', TRUE);
     $this->load->library('encrypt');
     $this->load->model('comm_model', 'comm');
     $this->load->helper('directory');
     $this->username = $this->input->cookie('username', TRUE);
     $this->password = $this->input->cookie('password', TRUE);
     $hash_1 = $this->input->cookie('hash_1', TRUE);
     $hash_2 = $this->input->cookie('hash_2', TRUE);
     $this->username = $this->encrypt->decode($this->username, $hash_1);
     $this->password = $this->encrypt->decode($this->password, $hash_2);
     if (!$this->username || !$this->password) {
         header("Location:" . site_url("reg_login/login_in"));
         die;
     } elseif (!($rs = $this->comm->find("member", array("username" => $this->username, "password" => $this->password)))) {
         header("Location:" . site_url("reg_login/login_in"));
         die;
     }
     $this->userid = $rs['userid'];
 }
开发者ID:804485808,项目名称:local_motors,代码行数:29,代码来源:uploader2.php


示例9: getCenterPiece

function getCenterPiece(&$centerpiece, &$centerpiecelinks)
{
    $user =& atkGetUser();
    $theme =& atkinstance("atk.ui.atktheme");
    // Set the dispatchfile for this menu based on the theme setting, or to the default if not set.
    // This makes sure that all calls to dispatch_url will generate a url for the main frame and not
    // within the menu itself.
    $dispatcher = $theme->getAttribute('dispatcher', atkconfig("dispatcher", "index.php"));
    // do not use atkSelf here!
    $c =& atkinstance("atk.atkcontroller");
    $c->setPhpFile($dispatcher);
    if ($theme->getAttribute('useframes', true)) {
        $target = 'target="main"';
    } else {
        $target = "";
    }
    //$centerpiece = $centerpiecelinks['pim'] = href(dispatch_url("dashboard.mainboard", "start"), atktext("pim"), SESSION_NEW, false,$target);
    // change location link - if location_name is null there is only one location!
    if ($user['location_id'] !== null) {
        $current_location = atktext('current_location') . ': ' . $user['location_name'];
        $atktarget = "index.php?atknodetype=locations.location&atkaction=change&atklevel=0&atkprevlevel=0&atkselect=[atkprimkey]";
        $params = array("atkfilter" => $filter, "atktarget" => $atktarget);
        $centerpiece = $centerpiecelinks['change_location'] = href(dispatch_url("locations.location", "select", $params), $current_location, SESSION_NEW, false, $target);
    }
    // if user settings is allowed put link to it
    if (is_allowed("loginmanager.settings", "edit") && substr($user['name'], 0, 4) != 'demo') {
        $centerpiece .= '     ';
        $centerpiece .= $centerpiecelinks['userprefs'] = href(dispatch_url("loginmanager.settings", "edit"), atktext("userprefs"), SESSION_NEW, false, $target);
    }
}
开发者ID:rezaul101,项目名称:erp32,代码行数:30,代码来源:tools.php


示例10: filterAdminNavigationMain

 public function filterAdminNavigationMain($nav)
 {
     if (is_allowed('OmekaApiImport_Index', 'index')) {
         $nav[] = array('label' => __('Omeka Api Import'), 'uri' => url('omeka-api-import/index/index'));
     }
     return $nav;
 }
开发者ID:Daniel-KM,项目名称:OmekaApiImport,代码行数:7,代码来源:OmekaApiImportPlugin.php


示例11: render

 /**
  * Render html for the save panel buttons
  * 
  * @param string $content
  * @return string
  */
 public function render($content)
 {
     $noAttribs = $this->getOption('noAttribs');
     $record = $this->getRecord();
     $content = $this->getOption('content');
     $this->removeOption('content');
     $this->removeOption('noAttribs');
     $this->removeOption('openOnly');
     $this->removeOption('closeOnly');
     $this->removeOption('record');
     $attribs = null;
     if (!$noAttribs) {
         $attribs = $this->getOptions();
     }
     $html = "<input id='save-changes' class='submit big green button' type='submit' value='" . __('Save Changes') . "' name='submit' />";
     if ($record) {
         if ($this->hasPublicPage() && $record->exists()) {
             set_theme_base_url('public');
             $publicPageUrl = record_url($record, 'show');
             revert_theme_base_url();
             $html .= "<a href='{$publicPageUrl}' class='big blue button' target='_blank'>" . __('View Public Page') . "</a>";
         }
         if (is_allowed($record, 'delete')) {
             $recordDeleteConfirm = record_url($record, 'delete-confirm');
             $html .= "<a href='{$recordDeleteConfirm}' class='big red button delete-confirm'>" . __('Delete') . "</a>";
         }
     }
     //used by SavePanelHook to locate where to insert hook content
     $html .= "<div id='button-field-line'></div>";
     return $html;
 }
开发者ID:lchen01,项目名称:STEdwards,代码行数:37,代码来源:SavePanelAction.php


示例12: jsonCustomDataBeforeActions

 public function jsonCustomDataBeforeActions($aObject, $actionUrlParameters, $parameters)
 {
     $actions = '';
     $actions .= is_allowed($this->resource, 'create') ? '<a class="btn btn-xs bs-tooltip" href="' . route('create' . ucfirst($this->routeSuffix), ['offset' => $this->request->input('start'), 'id' => $aObject['id_044']]) . '" data-original-title="' . trans('comunik::pulsar.duplicate_campaign') . '"><i class="fa fa-files-o"></i></a>' : null;
     $actions .= is_allowed($this->resource, 'access') ? '<a class="btn btn-xs bs-tooltip" href="' . route('preview' . ucfirst($this->routeSuffix), [Crypt::encrypt($aObject['id_044'])]) . '" data-original-title="' . trans('comunik::pulsar.preview_campaign') . '" target="_blank"><i class="fa fa-eye"></i></a>' : null;
     $actions .= is_allowed($this->resource, 'access') ? '<a class="btn btn-xs bs-tooltip" href="' . route('sendTest' . ucfirst($this->routeSuffix), [$aObject['id_044'], $this->request->input('start')]) . '" data-original-title="' . trans('comunik::pulsar.send_test_email') . '"><i class="fa fa-share"></i></a>' : null;
     return $actions;
 }
开发者ID:syscover,项目名称:comunik,代码行数:8,代码来源:EmailCampaignsController.php


示例13: checkIdentity

function checkIdentity()
{
    $userId = $_POST['userId'];
    $targetId = $_POST['targetId'];
    if (!is_allowed($userId, $targetId)) {
        echo 'notAllowed';
        die;
    }
}
开发者ID:Thibault92,项目名称:Care4oldServer,代码行数:9,代码来源:Common.php


示例14: __construct

 public function __construct()
 {
     parent::__construct();
     $this->load->helper(array('jbimages', 'language'));
     if (is_allowed() === FALSE) {
         exit;
     }
     $this->config->load('uploader_settings', TRUE);
 }
开发者ID:pulipulichen,项目名称:ocs,代码行数:9,代码来源:editor.php


示例15: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     // check permission user, all parameters ['resource', 'action'] are passed in route.php file
     $action = $request->route()->getAction();
     if (isset($action['resource'])) {
         if (!is_allowed($action['resource'], $action['action'])) {
             return view('pulsar::errors.default', ['error' => 403, 'message' => trans('pulsar::pulsar.message_error_403')]);
         }
     }
     return $next($request);
 }
开发者ID:syscover,项目名称:pulsar,代码行数:18,代码来源:Permission.php


示例16: getSelect

 public function getSelect()
 {
     $select = parent::getSelect();
     $request = Zend_Controller_Front::getInstance()->getRequest();
     //only show approved comments to api without a proper key
     if ($request && $request->getControllerName() == 'api') {
         if (!is_allowed('Commenting_Comment', 'update-approved')) {
             $select->where('approved = ?', 1);
         }
     }
     return $select;
 }
开发者ID:regan008,项目名称:WearingGayHistory-Plugins,代码行数:12,代码来源:Comment.php


示例17: getCommentForm

 public function getCommentForm()
 {
     if (get_option('commenting_allow_public') == 1 || is_allowed('Commenting_Comment', 'add')) {
         require_once COMMENTING_PLUGIN_DIR . '/CommentForm.php';
         $commentSession = new Zend_Session_Namespace('commenting');
         $form = new Commenting_CommentForm();
         if ($commentSession->post) {
             $form->isValid(unserialize($commentSession->post));
         }
         unset($commentSession->post);
         return $form;
     }
 }
开发者ID:regan008,项目名称:WearingGayHistory-Plugins,代码行数:13,代码来源:GetCommentForm.php


示例18: isTaggingAllowed

 /**
  * Helper to determine if tagging is enabled on current page or not.
  */
 public function isTaggingAllowed()
 {
     static $isAllowed = null;
     if (is_null($isAllowed)) {
         $request = Zend_Controller_Front::getInstance()->getRequest();
         // TODO Set this in config form.
         // if (($request->getControllerName() == 'items' || $request->getControllerName() == 'files' )
         if ($request->getControllerName() == 'items' && $request->getActionName() == 'show' && (get_option('tagging_public_allow_tag') == 1 || is_allowed('Tagging_Tagging', 'add'))) {
             $isAllowed = true;
         } else {
             $isAllowed = false;
         }
     }
     return $isAllowed;
 }
开发者ID:KelvinSmithLibrary,项目名称:playhouse,代码行数:18,代码来源:IsTaggingAllowed.php


示例19: getContributor

 public function getContributor()
 {
     $owner = $this->Item->getOwner();
     //if the user has been deleted, make a fake user called "Deleted User"
     if (!$owner) {
         $owner = new User();
         $owner->name = '[' . __('Unknown User') . ']';
         return $owner;
     }
     $user = current_user();
     if ($user && $user->id == $owner->id) {
         return $owner;
     }
     //mimic an actual user, but anonymous if user doesn't have access
     if ($this->anonymous == 1 && !is_allowed('Contribution_Items', 'view-anonymous')) {
         $owner = new User();
         $owner->name = __('Anonymous');
     }
     return $owner;
 }
开发者ID:KelvinSmithLibrary,项目名称:playhouse,代码行数:20,代码来源:ContributionContributedItem.php


示例20: _checkAjax

 /**
  * Check AJAX requests.
  *
  * 400 Bad Request
  * 403 Forbidden
  * 500 Internal Server Error
  *
  * @param string $action
  */
 protected function _checkAjax($action)
 {
     // Only allow AJAX requests.
     $request = $this->getRequest();
     if (!$request->isXmlHttpRequest()) {
         $this->getResponse()->setHttpResponseCode(403);
         return false;
     }
     // Allow only valid calls.
     if ($request->getControllerName() != 'ajax' || $request->getActionName() != $action) {
         $this->getResponse()->setHttpResponseCode(400);
         return false;
     }
     // Allow only allowed users.
     if (!is_allowed('ArchiveFolder_Index', $action)) {
         $this->getResponse()->setHttpResponseCode(403);
         return false;
     }
     return true;
 }
开发者ID:Daniel-KM,项目名称:ArchiveFolder,代码行数:29,代码来源:AjaxController.php



注:本文中的is_allowed函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP is_allowed_http_origin函数代码示例发布时间:2022-05-15
下一篇:
PHP is_alias函数代码示例发布时间: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