• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP exists_auth_plugin函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中exists_auth_plugin函数的典型用法代码示例。如果您正苦于以下问题:PHP exists_auth_plugin函数的具体用法?PHP exists_auth_plugin怎么用?PHP exists_auth_plugin使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: execute

 public function execute()
 {
     global $CFG;
     $action = $this->arguments[0];
     $pluginname = $this->arguments[1];
     // Does the authentication module exist?
     if (!exists_auth_plugin($pluginname)) {
         print_error('pluginnotinstalled', 'auth', '', $pluginname);
     }
     // Get enabled plugins.
     $authsenabled = get_enabled_auth_plugins(true);
     if (empty($CFG->auth)) {
         $authsenabled = array();
     } else {
         $authsenabled = explode(',', $CFG->auth);
     }
     switch ($action) {
         case 'disable':
             $key = array_search($pluginname, $authsenabled);
             if ($key !== false) {
                 unset($authsenabled[$key]);
                 set_config('auth', implode(',', $authsenabled));
             }
             break;
         case 'down':
             $key = array_search($pluginname, $authsenabled);
             if ($key !== false && $key < count($authsenabled) - 1) {
                 $fsave = $authsenabled[$key];
                 $authsenabled[$key] = $authsenabled[$key + 1];
                 $authsenabled[$key + 1] = $fsave;
                 set_config('auth', implode(',', $authsenabled));
             }
         case 'enable':
             if (!in_array($pluginname, $authsenabled)) {
                 $authsenabled[] = $pluginname;
                 $authsenabled = array_unique($authsenabled);
                 set_config('auth', implode(',', $authsenabled));
             }
             break;
         case 'up':
             $key = array_search($pluginname, $authsenabled);
             if ($key !== false && $key >= 1) {
                 $fsave = $authsenabled[$key];
                 $authsenabled[$key] = $authsenabled[$key - 1];
                 $authsenabled[$key - 1] = $fsave;
                 set_config('auth', implode(',', $authsenabled));
             }
             break;
     }
     echo "Auth modules enabled: " . implode(',', $authsenabled) . "\n";
 }
开发者ID:dariogs,项目名称:moosh,代码行数:51,代码来源:AuthManage.php


示例2: require_login

require_once $CFG->libdir . '/tablelib.php';
require_login();
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
$returnurl = "{$CFG->wwwroot}/{$CFG->admin}/settings.php?section=manageauths";
$action = optional_param('action', '', PARAM_ACTION);
$auth = optional_param('auth', '', PARAM_SAFEDIR);
// get currently installed and enabled auth plugins
$authsavailable = get_list_of_plugins('auth');
get_enabled_auth_plugins(true);
// fix the list of enabled auths
if (empty($CFG->auth)) {
    $authsenabled = array();
} else {
    $authsenabled = explode(',', $CFG->auth);
}
if (!empty($auth) and !exists_auth_plugin($auth)) {
    print_error('pluginnotinstalled', 'auth', $url, $auth);
}
////////////////////////////////////////////////////////////////////////////////
// process actions
if (!confirm_sesskey()) {
    redirect($returnurl);
}
switch ($action) {
    case 'disable':
        // remove from enabled list
        $key = array_search($auth, $authsenabled);
        if ($key !== false) {
            unset($authsenabled[$key]);
            set_config('auth', implode(',', $authsenabled));
        }
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:31,代码来源:auth.php


示例3: get_enabled_auth_plugins

/**
 * Returns array of active auth plugins.
 *
 * @param bool $fix fix $CFG->auth if needed
 * @return array
 */
function get_enabled_auth_plugins($fix = false)
{
    global $CFG;
    $default = array('manual', 'nologin');
    if (empty($CFG->auth)) {
        $auths = array();
    } else {
        $auths = explode(',', $CFG->auth);
    }
    if ($fix) {
        $auths = array_unique($auths);
        foreach ($auths as $k => $authname) {
            if (!exists_auth_plugin($authname) or in_array($authname, $default)) {
                unset($auths[$k]);
            }
        }
        $newconfig = implode(',', $auths);
        if (!isset($CFG->auth) or $newconfig != $CFG->auth) {
            set_config('auth', $newconfig);
        }
    }
    return array_merge($default, $auths);
}
开发者ID:lucaboesch,项目名称:moodle,代码行数:29,代码来源:moodlelib.php


示例4: action

 function action($action)
 {
     global $CFG;
     get_enabled_auth_plugins(true);
     // fix the list of enabled auths
     if (empty($CFG->auth)) {
         $authsenabled = array();
     } else {
         $authsenabled = explode(',', $CFG->auth);
     }
     if (!exists_auth_plugin($this->plugin)) {
         return get_string('pluginnotinstalled', 'auth', $this->plugin);
     }
     switch ($action) {
         case 'enable':
             // add to enabled list
             if (!in_array($this->plugin, $authsenabled)) {
                 $authsenabled[] = $this->plugin;
                 $authsenabled = array_unique($authsenabled);
                 set_config('auth', implode(',', $authsenabled));
             }
             break;
         case 'disable':
             // Remove from enabled list.
             $key = array_search($this->plugin, $authsenabled);
             if ($key !== false) {
                 unset($authsenabled[$key]);
                 set_config('auth', implode(',', $authsenabled));
             }
             if ($this->plugin == $CFG->registerauth) {
                 set_config('registerauth', '');
             }
             break;
     }
     \core\session\manager::gc();
     // remove stale sessions
     return 0;
 }
开发者ID:OctaveBabel,项目名称:moodle-itop,代码行数:38,代码来源:pluginscontrolslib.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP exitZP函数代码示例发布时间:2022-05-15
下一篇:
PHP exists函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap