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


PHP Preferences::fileExists方法代码示例

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


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

示例1: authenticate_ovd_user

 private static function authenticate_ovd_user($login_, $password_)
 {
     if (Preferences::fileExists() === false) {
         Logger::info('api', 'Admin authentication: authenticate_ovd_user the system is not configured');
         return false;
     }
     if (Preferences::moduleIsEnabled('UserDB') === false) {
         Logger::info('api', 'Admin authentication: module UserDB is not enabled');
         return false;
     }
     $userDB = UserDB::getInstance();
     $user = $userDB->import($login_);
     if (!is_object($user)) {
         Logger::info('api', 'Admin authentication: authenticate_ovd_user authentication failed: user(login=' . $login_ . ') does not exist');
         return false;
     }
     $auth = $userDB->authenticate($user, $password_);
     if (!$auth) {
         Logger::info('api', 'Admin authentication: authentication failed for user(login=' . $login_ . '): wrong password');
         return false;
     }
     // the user exists, does he have right to log in the admin panel ?
     $policy = $user->getPolicy();
     if (!array_key_exists('canUseAdminPanel', $policy) or $policy['canUseAdminPanel'] !== true) {
         Logger::info('api', 'Admin authentication: failed to log in ' . $login_ . ' : access denied to admin panel');
         return false;
     }
     return true;
 }
开发者ID:bloveing,项目名称:openulteo,代码行数:29,代码来源:api.php

示例2: authenticate_ovd_user

function authenticate_ovd_user($login_, $password_)
{
    // it's not the login&password from the conf file in /etc
    // let's try to login a real user
    if (Preferences::fileExists() === false) {
        $_SESSION['admin_error'] = _('The system is not configured');
        Logger::info('main', 'admin/login.php::authenticate_ovd_user the system is not configured');
        return false;
    }
    if (Preferences::moduleIsEnabled('UserDB') === false) {
        $_SESSION['admin_error'] = _('The module UserDB is not enabled');
        Logger::info('main', 'admin/login.php::authenticate_ovd_user module UserDB is not enabled');
        return false;
    }
    $userDB = UserDB::getInstance();
    $user = $userDB->import($login_);
    if (!is_object($user)) {
        // the user does not exist
        $_SESSION['admin_error'] = _('There was an error with your authentication');
        Logger::info('main', 'admin/login.php::authenticate_ovd_user authentication failed: user(login=' . $login_ . ') does not exist');
        return false;
    }
    $auth = $userDB->authenticate($user, $password_);
    if (!$auth) {
        $_SESSION['admin_error'] = _('There was an error with your authentication');
        Logger::info('main', 'admin/login.php::authenticate_ovd_user authentication failed for user(login=' . $login_ . '): wrong password');
        return false;
    }
    // the user exists, does he have right to log in the admin panel ?
    $policy = $user->getPolicy();
    if (isset($policy['canUseAdminPanel']) && $policy['canUseAdminPanel'] == true) {
        return $user;
    }
    Logger::info('main', 'login.php failed to log in ' . $login_ . ' : access denied to admin panel');
    $_SESSION['admin_error'] = _('Unauthorized access');
    return false;
}
开发者ID:skdong,项目名称:nfs-ovd,代码行数:37,代码来源:login.php

示例3: dirname

 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; version 2
 * of the License.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 **/
require_once dirname(__FILE__) . '/../includes/core-minimal.inc.php';
if (Preferences::fileExists() === false) {
    exit(1);
}
//BEGIN Sessions expiration
$sessions = Abstract_Session::load_all();
foreach ($sessions as $session) {
    if (!Abstract_Session::exists($session->id)) {
        // avoid operation on an already deleted Session (parallel processing)
        continue;
    }
    if ($session->start_time != 0 && array_key_exists('timeout', $session->settings) && $session->settings['timeout'] > 0) {
        if ($session->start_time + $session->settings['timeout'] < time()) {
            Logger::info('main', '(minutely cron) Session \'' . $session->id . '\' has expired, ending...');
            $session->orderDeletion(true, Session::SESSION_END_STATUS_TIMEOUT);
        }
    }
开发者ID:bloveing,项目名称:openulteo,代码行数:31,代码来源:minutely.php


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