當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Current_User::secured方法代碼示例

本文整理匯總了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;
     }
 }
開發者ID:HaldunA,項目名稱:phpwebsite,代碼行數:31,代碼來源:Image_Manager.php

示例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;
 }
開發者ID:HaldunA,項目名稱:phpwebsite,代碼行數:49,代碼來源:Multimedia_Manager.php

示例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;
     }
 }
開發者ID:HaldunA,項目名稱:phpwebsite,代碼行數:65,代碼來源:Document_Manager.php

示例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;
//.........這裏部分代碼省略.........
開發者ID:HaldunA,項目名稱:phpwebsite,代碼行數:101,代碼來源:Action.php


注:本文中的Current_User::secured方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。