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


PHP Sentinel::getCurrentUsername方法代码示例

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


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

示例1: switch

| Actions
|--------------------------------------------------------------------------
|
*/
switch (@$_POST['action']) {
    /*
    |--------------------------------------------------------------------------
    | Change password
    |--------------------------------------------------------------------------
    |
    */
    case 'change_password':
        $password1 = $_POST['password1'];
        $password2 = $_POST['password2'];
        $password3 = $_POST['password3'];
        $username = Sentinel::getCurrentUsername();
        $errors = array();
        $fields = array();
        $doit = true;
        if (!Sentinel::isValidPassword($username, $password1)) {
            $errors[] = __('Current password is not valid');
            $fields[] = 'password1';
            $doit = false;
        }
        if (mb_strlen($password2) < 6) {
            $errors[] = __('Password must contain at least 6 chars');
            $fields[] = 'password2';
            $doit = false;
        }
        if ($password2 !== $password3) {
            $errors[] = __('Password confirmation is not the same');
开发者ID:expressive-analytics,项目名称:docker-dt-standard.php,代码行数:31,代码来源:users.pml.php

示例2: config_load

/**
 * Load config file
 *
 * @param   string   $path                         the configuration file path
 * @param   boolean  $load_user_configuration_dir  do we have to parse all user configuration files ? No for upgrade for example...
 *
 * @return  array    [ badges , files ]
 */
function config_load($load_user_configuration_dir = true)
{
    $badges = false;
    $files = false;
    // Read config file
    $config = get_config_file();
    if (is_null($config)) {
        return array($badges, $files);
    }
    // Get badges
    $badges = $config['badges'];
    // Set user constant
    foreach ($config['globals'] as $cst => $val) {
        if ($cst == strtoupper($cst)) {
            @define($cst, $val);
        }
    }
    // Set unset constants
    load_default_constants();
    // Set time limit
    @set_time_limit(MAX_SEARCH_LOG_TIME + 2);
    // Append files from the USER_CONFIGURATION_DIR
    if ($load_user_configuration_dir === true) {
        if (is_dir(PML_CONFIG_BASE . DIRECTORY_SEPARATOR . USER_CONFIGURATION_DIR)) {
            $dir = PML_CONFIG_BASE . DIRECTORY_SEPARATOR . USER_CONFIGURATION_DIR;
            $userfiles = new RegexIterator(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir, RecursiveDirectoryIterator::SKIP_DOTS), RecursiveIteratorIterator::SELF_FIRST, RecursiveIteratorIterator::CATCH_GET_CHILD), '/^.+\\.(json|php)$/i', RecursiveRegexIterator::GET_MATCH);
            foreach ($userfiles as $userfile) {
                $filepath = realpath($userfile[0]);
                $c = get_config_file($filepath);
                if (!is_null($c)) {
                    foreach ($c as $k => $v) {
                        $fileid = get_slug(str_replace(PML_CONFIG_BASE, '', $filepath) . '/' . $k);
                        $config['files'][$fileid] = $v;
                        $config['files'][$fileid]['included_from'] = $filepath;
                    }
                }
            }
        }
    }
    // Oups, there is no file... abort
    if (!isset($config['files'])) {
        return array($badges, $files);
    }
    // Try to generate the files tree if there are globs...
    $files_tmp = $config['files'];
    $files = array();
    foreach ($files_tmp as $fileid => $file) {
        $path = $file['path'];
        $count = max(1, @(int) $file['count']);
        $gpaths = glob($path, GLOB_MARK | GLOB_NOCHECK);
        if (count($gpaths) == 0) {
        } else {
            if (count($gpaths) == 1) {
                $files[$fileid] = $file;
                $files[$fileid]['path'] = $gpaths[0];
            } else {
                $new_paths = array();
                $i = 1;
                foreach ($gpaths as $path) {
                    $new_paths[$path] = filemtime($path);
                }
                // The most recent file will be the first
                arsort($new_paths, SORT_NUMERIC);
                // The first file id is the ID of the configuration file then others files are suffixed with _2, _3, etc...
                foreach ($new_paths as $path => $lastmodified) {
                    $ext = $i > 1 ? '_' . $i : '';
                    $files[$fileid . $ext] = $file;
                    $files[$fileid . $ext]['oid'] = $fileid;
                    $files[$fileid . $ext]['odisplay'] = $files[$fileid . $ext]['display'];
                    $files[$fileid . $ext]['path'] = $path;
                    $files[$fileid . $ext]['display'] .= ' > ' . basename($path);
                    if ($i >= $count) {
                        break;
                    }
                    $i++;
                }
            }
        }
    }
    // Remove forbidden files
    if (Sentinel::isAuthSet()) {
        // authentication is enabled on this instance
        $username = Sentinel::getCurrentUsername();
        $final = array();
        // Anonymous access only
        if (is_null($username)) {
            foreach ($files as $fileid => $file) {
                $a = $fileid;
                // glob file
                if (isset($files[$fileid]['oid'])) {
                    $a = $files[$fileid]['oid'];
                }
//.........这里部分代码省略.........
开发者ID:expressive-analytics,项目名称:docker-dt-standard.php,代码行数:101,代码来源:global.inc.php

示例3: __

 if (upgrade_is_composer()) {
     $upgrade['alert'] .= __('Simply <code>composer update</code> in the installation directory');
     $upgrade['alert'] .= '<br/>';
     $upgrade['alert'] .= '<br/><pre id="composercontent">cd ' . escapeshellarg(realpath(PML_BASE . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR)) . '; composer update</pre>';
     $upgrade['alert'] .= '<div id="changelog" class="panel-collapse collapse"><br/><div class="panel-body panel panel-default">' . $html . '</div></div>';
     $upgrade['alert'] .= '<div class="row">';
     $upgrade['alert'] .= '<div class="col-xs-6 text-left">';
     $upgrade['alert'] .= '<button id="composercopy" class="btn btn-xs btn-primary clipboard"><span class="glyphicon glyphicon-cloud-download"></span>&nbsp;' . __("Copy to clipboard") . '</button>';
     $upgrade['alert'] .= '</div>';
     $upgrade['alert'] .= '<div class="col-xs-6 text-right">';
     $upgrade['alert'] .= '<button id="upgradestop" data-version="' . $upgrade['to'] . '" class="btn btn-xs btn-default"><span class="glyphicon glyphicon-ok"></span>&nbsp;' . __("Skip this upgrade") . '</button>';
     $upgrade['alert'] .= '</div>';
     $upgrade['alert'] .= '</div>';
     $upgrade['alert'] .= '<script>clipboard_enable("#composercopy","#composercontent" , "right" , "' . __('Command copied!') . '");</script>';
 } else {
     if (AUTO_UPGRADE === false || Sentinel::isAuthSet() && !Sentinel::isAdmin(Sentinel::getCurrentUsername())) {
         $upgrade['alert'] .= sprintf(__('Simply <code>git pull</code> in your directory or follow instructions %shere%s'), '<a href="' . UPGRADE_MANUALLY_URL . '" target="doc" class="alert-link">', '</a>');
         $upgrade['alert'] .= '<br/>';
         $upgrade['alert'] .= '<br/><pre id="gitcontent">cd ' . PML_BASE . '; git pull</pre>';
         $upgrade['alert'] .= '<div id="changelog" class="panel-collapse collapse"><br/><div class="panel-body panel panel-default">' . $html . '</div></div>';
         $upgrade['alert'] .= '<div class="row">';
         $upgrade['alert'] .= '<div class="col-xs-6 text-left">';
         $upgrade['alert'] .= '<button id="gitcopy" class="btn btn-xs btn-primary clipboard"><span class="glyphicon glyphicon-cloud-download"></span>&nbsp;' . __("Copy to clipboard") . '</button>';
         $upgrade['alert'] .= '</div>';
         $upgrade['alert'] .= '<div class="col-xs-6 text-right">';
         $upgrade['alert'] .= '<button id="upgradestop" data-version="' . $upgrade['to'] . '" class="btn btn-xs btn-default"><span class="glyphicon glyphicon-ok"></span>&nbsp;' . __("Skip this upgrade") . '</button>';
         $upgrade['alert'] .= '</div>';
         $upgrade['alert'] .= '</div>';
         $upgrade['alert'] .= '<script>clipboard_enable("#gitcopy","#gitcontent" , "right" , "' . __('Command copied!') . '");</script>';
     } else {
         if (upgrade_is_git()) {
开发者ID:abhijith444,项目名称:enroll,代码行数:31,代码来源:upgrade.pml.php

示例4: get_config_file_path

    } else {
        echo 'configuration file does not exist';
    }
    ?>
</pre></div></div></div><div class="panel panel-default"><div class="panel-heading"><h4 class="panel-title"><a data-toggle="collapse" data-parent="#accordion2" href="#collapseTwo2">Stats <code><?php 
    echo get_config_file_path();
    ?>
</code></a></h4></div><div id="collapseTwo2" class="panel-collapse collapse"><div class="panel-body"><pre><?php 
    if (file_exists(get_config_file_path())) {
        var_export(@stat(get_config_file_path()));
    } else {
        echo 'configuration file does not exist';
    }
    ?>
</pre></div></div></div><div class="panel panel-default"><div class="panel-heading"><h4 class="panel-title"><a data-toggle="collapse" data-parent="#accordion2" href="#collapseFive2"><?php 
    $current_user = Sentinel::getCurrentUsername();
    if (is_null($current_user)) {
        _e('Generated files with includes (no user logged in or no auth)');
    } else {
        echo sprintf(__('Generated files with includes for user %s'), '<code>' . $current_user . '</code>');
    }
    ?>
</a></h4></div><div id="collapseFive2" class="panel-collapse collapse"><div class="panel-body"><pre><?php 
    list($badges, $files) = config_load();
    if (version_compare(PHP_VERSION, '5.4.0') >= 0) {
        echo json_encode($files, JSON_PRETTY_PRINT);
    } else {
        echo json_indent(json_encode($logs));
    }
    ?>
</pre></div></div></div><div class="panel panel-default"><div class="panel-heading"><h4 class="panel-title"><a data-toggle="collapse" data-parent="#accordion2" href="#collapseFour2"><?php 
开发者ID:abhijith444,项目名称:enroll,代码行数:31,代码来源:test.php


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