本文整理汇总了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);
}
示例2: action_plugins
protected function action_plugins()
{
if (!Permissions::has('sys_access') or !Permissions::has('sys_plugins_view')) {
return $this->redirectForbidden();
}
}
示例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;
}