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


PHP Sentinel::setAdmin方法代码示例

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


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

示例1: __

     }
 }
 if ($type === 'edit' && !empty($password) || $type === 'add') {
     if (mb_strlen($password) < 6) {
         $errors['password'] = __('Password must contain at least 6 chars');
     }
     if ($password !== $password2) {
         $errors['password2'] = __('Password confirmation is not the same');
     }
 }
 if (count($errors) === 0) {
     if (empty($password)) {
         $password = null;
     }
     if ($roles === 'admin') {
         Sentinel::setAdmin($username, $password);
         if ($type === 'add') {
             Sentinel::log('addadmin ' . $username, $current_user);
         }
     } else {
         $logs = array();
         foreach ($logfiles as $fileid => $access) {
             if (substr($fileid, 0, 2) === 'f-') {
                 if ((int) $access === 1) {
                     $logs[substr($fileid, 2)] = array('r' => true);
                 }
             } else {
                 if (substr($fileid, 0, 2) === 't-') {
                     if ((int) $access === 1) {
                         $tags[substr($fileid, 2)] = array('r' => true);
                     }
开发者ID:expressive-analytics,项目名称:docker-dt-standard.php,代码行数:31,代码来源:users.pml.php

示例2:

     break;
     /*
     |--------------------------------------------------------------------------
     | Auth 3. Save data
     |--------------------------------------------------------------------------
     |
     */
 /*
 |--------------------------------------------------------------------------
 | Auth 3. Save data
 |--------------------------------------------------------------------------
 |
 */
 case 'authsave':
     if (mb_strlen($_POST['u']) > 0 && mb_strlen($_POST['p']) >= 6) {
         Sentinel::setAdmin($_POST['u'], $_POST['p']);
         $return['notice'] = Sentinel::save();
     }
     break;
     /*
     |--------------------------------------------------------------------------
     | Logs 1. Check if $config_file already exists
     |--------------------------------------------------------------------------
     |
     */
 /*
 |--------------------------------------------------------------------------
 | Logs 1. Check if $config_file already exists
 |--------------------------------------------------------------------------
 |
 */
开发者ID:abhijith444,项目名称:enroll,代码行数:31,代码来源:configure.php

示例3: sprintf

    ?>
</div></div></div></div></div></div><div class="tab-pane" id="authactivation"><?php 
    $return = '';
    if (@$_POST['action'] === 'authactivation') {
        Sentinel::init();
        Sentinel::create();
        if (Sentinel::userExists($_POST['username'])) {
            $return = '<br/><div class="alert alert-danger" role="alert">' . sprintf(__('User %s already exists!'), '<code>' . $_POST['username'] . '</code>') . '</div>';
        } else {
            if ($_POST['password'] !== $_POST['password2']) {
                $return = '<br/><div class="alert alert-danger" role="alert">' . __('Password confirmation is not the same') . '</div>';
            } else {
                if (mb_strlen($_POST['password']) < 6) {
                    $return = '<br/><div class="alert alert-danger" role="alert">' . __('Password must contain at least 6 chars') . '</div>';
                } else {
                    Sentinel::setAdmin($_POST['username'], $_POST['password']);
                    Sentinel::save();
                    $return = '<br/><div class="alert alert-success" role="alert">' . __('Authentication has been enabled and admin account has been created!') . '</div>';
                }
            }
        }
    }
    if (Sentinel::isAuthSet()) {
        echo $return;
        ?>
<br><div class="alert alert-info" role="alert"><?php 
        _e('Authentication is currently enabled');
        ?>
</div><br><div class="row"><div class="col-xs-12"><div class="alert alert-danger"><?php 
        _e('Please remove this file on your server to disable authentication');
        ?>
开发者ID:abhijith444,项目名称:enroll,代码行数:31,代码来源:test.php


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