当前位置: 首页>>代码示例>>PHP>>正文


PHP Permissions::has方法代码示例

本文整理汇总了PHP中Permissions::has方法的典型用法代码示例。如果您正苦于以下问题:PHP Permissions::has方法的具体用法?PHP Permissions::has怎么用?PHP Permissions::has使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Permissions的用法示例。


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

示例1: action_main

 /**
  * Parses the $_FILES superglobal for uploaded files. An event is triggered for each file. Handlers
  * can then decide whether to keep the uploaded file. The action result is filled with the properties
  * of the $_FILES superglobal storing the corresponding result - whether the respective file was
  * removed or has been accepted.
  */
 protected function action_main($skipPermsCheck = false)
 {
     if (!$skipPermsCheck and !Permissions::has('sys_upload')) {
         return $this->redirectForbidden();
     }
     $lang = i18n::load('diamondmvc');
     $result = array();
     $success = true;
     if (!empty($_FILES)) {
         foreach ($_FILES as $prop => $file) {
             // Skip this file if not desired.
             if (!empty($this->filters) and !in_array($prop, $this->filters)) {
                 continue;
             }
             // Attempt to save the file.
             if (!$this->handleUpload($prop, $file)) {
                 $this->addMessage(str_replace('%name%', $file['name'], $lang->get('ERROR_TITLE', 'ControllerUpload')), $lang->get('ERROR_MESSAGE', 'ControllerUpload'), 'error');
                 $result[$prop] = false;
                 $success = false;
             } else {
                 $result[$prop] = true;
             }
         }
     }
     $this->result = array('success' => $success, 'details' => $result);
 }
开发者ID:Zyr93,项目名称:DiamondMVC,代码行数:32,代码来源:upload.php

示例2: action_plugins

 protected function action_plugins()
 {
     if (!Permissions::has('sys_access') or !Permissions::has('sys_plugins_view')) {
         return $this->redirectForbidden();
     }
 }
开发者ID:Zyr93,项目名称:DiamondMVC,代码行数:6,代码来源:system.php

示例3: action_mkdir

 protected function action_mkdir($base = '', $id = '')
 {
     if (!Permissions::has('sys_fs_create')) {
         return $this->redirectForbidden();
     }
     if (!func_num_args()) {
         if (!isset($_REQUEST['base']) or !isset($_REQUEST['id'])) {
             $this->result = array('success' => false, 'msg' => 'Missing arguments');
             return false;
         } else {
             $base = $_REQUEST['base'];
             $id = $_REQUEST['id'];
         }
     }
     $path = $this->buildPath($base, $id);
     if (file_exists($path)) {
         $this->result = array('success' => false, 'msg' => 'A file with this name already exists!');
         return false;
     }
     if (!mkdir($path)) {
         $this->result = array('success' => false, 'msg' => 'I could not create your directory!');
         return false;
     }
     $this->result = array('success' => true);
     return true;
 }
开发者ID:Zyr93,项目名称:DiamondMVC,代码行数:26,代码来源:filebrowser.php


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