本文整理汇总了PHP中Current_User::secured方法的典型用法代码示例。如果您正苦于以下问题:PHP Current_User::secured方法的具体用法?PHP Current_User::secured怎么用?PHP Current_User::secured使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Current_User
的用法示例。
在下文中一共展示了Current_User::secured方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: admin
public function admin()
{
switch ($_REQUEST['iop']) {
case 'delete_image':
if (!$this->folder->id || !Current_User::secured('filecabinet', 'edit_folders', $this->folder->id, 'folder')) {
Current_User::disallow();
}
$this->loadImage(filter_input(INPUT_GET, 'file_id', FILTER_VALIDATE_INT));
$this->image->delete();
PHPWS_Core::goBack();
break;
case 'post_image_upload':
if (!$this->folder->id || !Current_User::authorized('filecabinet', 'edit_folders', $this->folder->id, 'folder')) {
Current_User::disallow();
}
if (!$this->postImageUpload()) {
\Cabinet::setMessage('Failed to upload image. Check directory permissions.');
}
Layout::nakedDisplay();
//\PHPWS_Core::goBack();
break;
case 'upload_image_form':
if (!$this->folder->id || !Current_User::secured('filecabinet', 'edit_folders', $this->folder->id, 'folder')) {
Current_User::disallow();
}
$this->loadImage(filter_input(INPUT_GET, 'file_id', FILTER_VALIDATE_INT));
$this->edit();
echo Layout::wrap($this->content, 'Image Upload', true);
exit;
}
}
示例2: admin
public function admin()
{
switch ($_REQUEST['mop']) {
case 'delete_multimedia':
if (!$this->folder->id || !Current_User::authorized('filecabinet', 'edit_folders', $this->folder->id, 'folder')) {
Current_User::disallow();
}
$this->loadMultimedia(filter_input(INPUT_GET, 'file_id', FILTER_VALIDATE_INT));
$this->multimedia->delete();
PHPWS_Core::goBack();
break;
case 'post_multimedia_upload':
if (!$this->folder->id || !Current_User::authorized('filecabinet', 'edit_folders', $this->folder->id, 'folder')) {
Current_User::disallow();
}
$this->postMultimediaUpload();
\PHPWS_Core::goBack();
break;
case 'upload_multimedia_form':
if (!Current_User::secured('filecabinet', 'edit_folders', $this->multimedia->folder_id, 'folder')) {
Current_User::disallow();
}
$this->loadMultimedia(filter_input(INPUT_GET, 'file_id', FILTER_VALIDATE_INT));
if (!$this->multimedia->id) {
$this->multimedia->folder_id = filter_input(INPUT_GET, 'folder_id', FILTER_VALIDATE_INT);
}
$this->edit();
echo json_encode(array('title' => $this->title, 'content' => $this->content));
exit;
case 'edit_rtmp':
if (!Current_User::secured('filecabinet', 'edit_folders', $this->multimedia->folder_id, 'folder')) {
Current_User::disallow();
}
$this->loadMultimedia(filter_input(INPUT_GET, 'file_id', FILTER_VALIDATE_INT));
$this->editRTMP();
echo json_encode(array('title' => $this->title, 'content' => $this->content));
exit;
case 'post_rtmp':
if (!Current_User::authorized('filecabinet', 'edit_folders', $this->multimedia->folder_id, 'folder')) {
Current_User::disallow();
}
if (!$this->postRTMP()) {
$this->editRTMP();
}
\PHPWS_Core::goBack();
break;
}
return $this->content;
}
示例3: admin
public function admin()
{
switch ($_REQUEST['dop']) {
case 'delete_document':
if (!$this->folder->id || !Current_User::secured('filecabinet', 'edit_folders', $this->folder->id, 'folder')) {
Current_User::disallow();
}
$this->document->delete();
PHPWS_Core::returnToBookmark();
break;
case 'post_document_upload':
if (!$this->folder->id || !Current_User::authorized('filecabinet', 'edit_folders', $this->folder->id, 'folder')) {
Current_User::disallow();
}
$this->postDocumentUpload();
javascript('close_refresh');
Layout::nakedDisplay();
//\PHPWS_Core::goBack();
break;
case 'upload_document_form':
if (!$this->folder->id || !Current_User::secured('filecabinet', 'edit_folders', $this->folder->id, 'folder')) {
Current_User::disallow();
}
$this->loadDocument(filter_input(INPUT_GET, 'file_id', FILTER_VALIDATE_INT));
$this->edit();
echo Layout::wrap($this->content, 'Document Upload', true);
exit;
case 'add_access':
if (!Current_User::authorized('filecabinet')) {
Current_User::disallow();
}
$keyword = null;
$this->loadDocument();
// document exists, try making a shortcut
if ($this->document->id) {
PHPWS_Core::initModClass('access', 'Shortcut.php');
$shortcut = new Access_Shortcut();
if (isset($_GET['keyword'])) {
$keyword = $_GET['keyword'];
}
if (empty($keyword)) {
$keyword = $this->document->title;
}
$result = $shortcut->setKeyword($keyword);
$new_keyword = $shortcut->keyword;
// if setKeyword returns a false or error, we have them pick a different name
if (!$result || PHPWS_Error::isError($result)) {
$message = dgettext('filecabinet', 'Access shortcut name already in use. Please enter another.');
$success = false;
} else {
$shortcut->setUrl('filecabinet', $this->document->getViewLink());
$shortcut->save();
$success = true;
$message = '<p>' . dgettext('filecabinet', 'Access shortcut successful!') . '</p>';
$message .= '<a href="' . PHPWS_Core::getHomeHttp() . $shortcut->keyword . '">' . PHPWS_Core::getHomeHttp() . $shortcut->keyword . '</a>';
}
} else {
$message = dgettext('filecabinet', 'File not found');
// not really a success but prevents a repost prompt
$success = true;
}
echo json_encode(array('success' => $success, 'message' => $message, 'keyword' => $new_keyword));
exit;
}
}
示例4: adminAction
public static function adminAction()
{
PHPWS_Core::initModClass('users', 'Group.php');
$title = $message = $content = null;
if (!Current_User::allow('users')) {
PHPWS_User::disallow(dgettext('users', 'Tried to perform an admin function in Users.'));
return;
}
$message = User_Action::getMessage();
$panel = User_Action::cpanel();
$panel->enableSecure();
if (isset($_REQUEST['command'])) {
$command = $_REQUEST['command'];
} else {
$command = $panel->getCurrentTab();
}
if (isset($_REQUEST['user_id'])) {
$user = new PHPWS_User((int) $_REQUEST['user_id']);
} else {
$user = new PHPWS_User();
}
if (isset($_REQUEST['group_id'])) {
$group = new PHPWS_Group((int) $_REQUEST['group_id']);
} else {
$group = new PHPWS_Group();
}
switch ($command) {
/** Form cases * */
/** User Forms * */
case 'new_user':
if (PHPWS_Settings::get('users', 'allow_new_users') || Current_User::isDeity()) {
$panel->setCurrentTab('new_user');
$title = dgettext('users', 'Create User');
$content = User_Form::userForm($user);
} else {
Current_User::disallow();
}
break;
case 'search_members':
self::searchMembers();
exit;
break;
case 'manage_users':
$title = dgettext('users', 'Manage Users');
$content = User_Form::manageUsers();
break;
case 'editUser':
$title = dgettext('users', 'Edit User');
$user = new PHPWS_User($_REQUEST['user_id']);
$content = User_Form::userForm($user);
break;
case 'deleteUser':
if (!Current_User::secured('users', 'delete_users')) {
Current_User::disallow();
return;
}
$user->kill();
PHPWS_Core::goBack();
break;
case 'deify_user':
if (!Current_User::authorized('users') || !Current_User::isDeity()) {
Current_User::disallow();
return;
}
$user->deity = 1;
$user->save();
PHPWS_Core::goBack();
break;
case 'mortalize_user':
if (!Current_User::authorized('users') || !Current_User::isDeity()) {
Current_User::disallow();
return;
}
$user->deity = 0;
$user->save();
PHPWS_Core::goBack();
break;
case 'authorization':
case 'postAuthorization':
case 'dropAuthScript':
if (!Current_User::isDeity()) {
Current_User::disallow();
}
if ($command == 'dropAuthScript' && isset($_REQUEST['script_id'])) {
User_Action::dropAuthorization($_REQUEST['script_id']);
} elseif ($command == 'postAuthorization') {
User_Action::postAuthorization();
$message = dgettext('users', 'Authorization updated.');
}
$title = dgettext('users', 'Authorization');
$content = User_Form::authorizationSetup();
break;
case 'editScript':
$title = dgettext('users', 'Edit Authorization Script');
// no reason to edit scripts yet
break;
case 'setUserPermissions':
if (!Current_User::authorized('users', 'edit_permissions')) {
PHPWS_User::disallow();
return;
//.........这里部分代码省略.........