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


PHP Access::postShortcutList方法代码示例

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


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

示例1: main

 public static function main()
 {
     $title = $content = NULL;
     $message = Access::getMessage();
     if (!Current_User::allow('access')) {
         Current_User::disallow();
         exit;
     }
     $panel = Access::cpanel();
     if (isset($_REQUEST['command'])) {
         $command = $_REQUEST['command'];
     } else {
         $command = $panel->getCurrentTab();
     }
     // If the command is empty, that means no tabs were set
     // In this case, an admin with full rights needs to log in
     if (empty($command)) {
         $title = dgettext('access', 'Sorry');
         $content = dgettext('access', 'Access needs a higher administrator\'s attention before you may use it.');
     } else {
         switch ($command) {
             case 'post_admin':
                 Access::saveAdmin();
                 Access::sendMessage(dgettext('access', 'Settings saved.'), 'admin');
                 break;
             case 'restore_default':
                 $source = PHPWS_SOURCE_DIR . 'core/inc/htaccess';
                 $dest = PHPWS_HOME_DIR . '.htaccess';
                 if (copy($source, $dest)) {
                     Access::sendMessage(dgettext('access', 'Default .htaccess file restored.'), 'update');
                 } else {
                     Access::sendMessage(dgettext('access', 'Unable to restore default .htaccess file.'), 'update');
                 }
                 break;
             case 'post_deny_allow':
                 $result = Access::postDenyAllow();
                 if ($result == false) {
                     Access::sendMessage(dgettext('access', 'IP address was not formatted correctly or not allowed.'), 'deny_allow');
                 } elseif (PHPWS_Error::isError($result)) {
                     PHPWS_Error::log($result);
                     Access::sendMessage(dgettext('access', 'An error occurred.') . ' ' . dgettext('access', 'Please check your logs.'), 'deny_allow');
                 }
                 Access::sendMessage(NULL, 'deny_allow');
                 break;
             case 'delete_allow_deny':
                 PHPWS_Core::initModClass('access', 'Allow_Deny.php');
                 $allow_deny = new Access_Allow_Deny($_GET['ad_id']);
                 $allow_deny->delete();
                 Access::sendMessage(dgettext('access', 'IP address deleted.'), 'deny_allow');
                 break;
             case 'deny_allow':
                 PHPWS_Core::initModClass('access', 'Forms.php');
                 $title = dgettext('access', 'Denys and Allows');
                 $content = Access_Forms::denyAllowForm();
                 break;
             case 'delete_shortcut':
                 PHPWS_Core::initModClass('access', 'Shortcut.php');
                 $shortcut = new Access_Shortcut($_REQUEST['shortcut_id']);
                 if (empty($shortcut->_error) && $shortcut->id) {
                     $result = $shortcut->delete();
                     if (PHPWS_Error::isError($result)) {
                         Access::sendMessage(dgettext('access', 'An error occurred when deleting your shortcut.'), 'shortcuts');
                     }
                 }
                 Access::sendMessage(dgettext('access', 'Shortcut deleted'), 'shortcuts');
                 break;
             case 'shortcuts':
                 PHPWS_Core::initModClass('access', 'Forms.php');
                 $title = dgettext('access', 'Shortcuts');
                 $content = Access_Forms::shortcuts();
                 break;
             case 'post_shortcut_list':
                 $message = NULL;
                 $result = Access::postShortcutList();
                 if (PHPWS_Error::isError($result)) {
                     $message = dgettext('access', 'An error occurred.') . ' ' . dgettext('access', 'Please check your logs.');
                 }
                 Access::sendMessage($message, 'shortcuts');
                 break;
             case 'edit_shortcut':
                 PHPWS_Core::initModClass('access', 'Forms.php');
                 echo Access_Forms::shortcut_menu();
                 exit;
                 break;
             case 'post_shortcut':
                 PHPWS_Core::initModClass('access', 'Shortcut.php');
                 $sch_id = filter_input(INPUT_POST, 'sch_id', FILTER_SANITIZE_NUMBER_INT);
                 if ($sch_id) {
                     $shortcut = new Access_Shortcut($sch_id);
                 } else {
                     $shortcut = new Access_Shortcut();
                 }
                 try {
                     $shortcut->postShortcut();
                     $shortcut->save();
                     $json['keyword'] = $shortcut->keyword;
                     $json['error'] = 0;
                 } catch (\Exception $e) {
                     $json['message'] = $e->getMessage();
                     $json['error'] = 1;
//.........这里部分代码省略.........
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:101,代码来源:Access.php


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