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


PHP GO::infolog方法代码示例

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


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

示例1: authenticate

 public function authenticate($username, $password)
 {
     if (empty(\GO::config()->ldap_peopledn)) {
         \GO::debug('LDAPAUTH: Aborting because the following required value is not set: $config["ldap_peopledn"]');
         return true;
     }
     $record = \GO\Ldapauth\Model\Person::findByUsername($username);
     if (!$record) {
         \GO::debug("LDAPAUTH: No LDAP entry found for " . $username);
         //return true here because this should not block normal authentication
         return true;
     }
     //$authenticated = $ldapConn->bind($record->getDn(), $password);
     if (!$record->authenticate($password)) {
         $str = "LOGIN FAILED for user: \"" . $username . "\" from IP: ";
         if (isset($_SERVER['REMOTE_ADDR'])) {
             $str .= $_SERVER['REMOTE_ADDR'];
         } else {
             $str .= 'unknown';
         }
         \GO::infolog($str);
         return false;
     }
     \GO::debug("LDAPAUTH: LDAP authentication SUCCESS for " . $username);
     if (!empty(GO::config()->ldap_create_mailbox_domains)) {
         if (!GO::modules()->serverclient) {
             throw new Exception("The serverclient module must be installed and configured when using \$config['GO::config()->ldap_create_mailbox_domains']. See https://www.group-office.com/wiki/Mailserver#Optionally_install_the_serverclient");
         }
         $_POST['serverclient_domains'] = GO::config()->ldap_create_mailbox_domains;
     } else {
         GO::debug("LDAPAUTH: Found LDAP entry found for " . $username);
         //			GO::debug($record->getAttributes());
     }
     $user = $this->syncUserWithLdapRecord($record, $password);
     if (!$user) {
         return false;
     }
     try {
         $this->_checkEmailAccounts($user, $password);
     } catch (Exception $e) {
         //				GO::debug("LDAPAUTH: Failed to create or update e-mail account!\n\n".(string) $e);
         trigger_error("LDAPAUTH: Failed to create or update e-mail account for user " . $user->username . "\n\n" . $e->getMessage());
     }
 }
开发者ID:ajaboa,项目名称:crmpuan,代码行数:44,代码来源:Authenticator.php

示例2: actionSwitch

 protected function actionSwitch($params)
 {
     //
     //		if(!\GO::user()->isAdmin())
     //			throw new \Exception("This feature is for admins only!");
     $oldUsername = \GO::user()->username;
     $debug = !empty(\GO::session()->values['debug']);
     $user = \GO\Base\Model\User::model()->findByPk($params['user_id']);
     \GO::session()->values = array();
     //clear session
     \GO::session()->setCurrentUser($user->id);
     //\GO::session()->setCompatibilitySessionVars();
     if ($debug) {
         \GO::session()->values['debug'] = $debug;
     }
     \GO::infolog("ADMIN logged-in as user: \"" . $user->username . "\" from IP: " . $_SERVER['REMOTE_ADDR']);
     if (\GO::modules()->isInstalled('log')) {
         \GO\Log\Model\Log::create('switchuser', "'" . $oldUsername . "' logged in as '" . $user->username . "'");
     }
     $this->redirect();
 }
开发者ID:ajaboa,项目名称:crmpuan,代码行数:21,代码来源:LoginController.php

示例3: login

 /**
  * Logs a user in.
  * 
  * @param string $username
  * @param string $password
  * @return Model\User or false on failure.
  */
 public function login($username, $password, $countLogin = true)
 {
     if (!$this->fireEvent('beforelogin', array($username, $password, $countLogin))) {
         return false;
     }
     $user = Model\User::model()->findSingleByAttribute('username', $username);
     $success = true;
     if (!$user) {
         \GO::debug("LOGIN: User " . $username . " not found");
         $success = false;
     } elseif (!$user->enabled) {
         \GO::debug("LOGIN: User " . $username . " is disabled");
         $success = false;
     } elseif (!$user->checkPassword($password)) {
         \GO::debug("LOGIN: Incorrect password for " . $username);
         $success = false;
     }
     $str = "LOGIN ";
     $str .= $success ? "SUCCESS" : "FAILED";
     $str .= " for user: \"" . $username . "\" from IP: ";
     if (isset($_SERVER['REMOTE_ADDR'])) {
         $str .= $_SERVER['REMOTE_ADDR'];
     } else {
         $str .= 'unknown';
     }
     \GO::infolog($str);
     \GO::debug($str);
     if (!$success) {
         return false;
     } else {
         $this->_user = $user;
         $this->setCurrentUser($user->id);
         if ($countLogin) {
             $user->lastlogin = time();
             $user->logins++;
             $user->save(true);
             $this->clearUserTempFiles();
         }
         $this->fireEvent('login', array($username, $password, $user, $countLogin));
         //A PHP variable named “session.use_only_cookies” controls the behaviour
         //of session_start(). When this variable is enabled (true) then session_start() on-
         //ly uses the cookies of a request for retrieving the session ID. If this variable is disa-
         //bled, then GET or POST requests can contain the session ID and can be used for
         //session fixation. This PHP variable was added in PHP 4.3.0 but is enabled by default
         //only since PHP 5.3.0. Environments with previous PHP versions, as well as non-
         //default PHP configurations are vulnerable to the session fixation attack described in
         //this finding if further measures are not taken.
         //In addition to only accepting session IDs in the form of cookies, the application
         //should force the re-generation of session IDs upon successful user authentication.
         //This way, an attacker would not be able to create a session ID that will be reused by
         //the application to identify a valid authenticated session. This is possible in PHP by
         //using the session_regenerate_id() function.
         if (PHP_SAPI != 'cli' && !defined('GO_NO_SESSION')) {
             session_regenerate_id();
         }
         if ($countLogin) {
             $this->_log(\GO\Log\Model\Log::ACTION_LOGIN);
         }
         \GO::session()->values['countLogin'] = $countLogin;
         return $user;
     }
 }
开发者ID:ajaboa,项目名称:crmpuan,代码行数:69,代码来源:Session.php

示例4: unset

}
//check if GO is installed
if (empty($_REQUEST['r']) && PHP_SAPI != 'cli') {
    if (\GO::user() && isset($_SESSION['GO_SESSION']['after_login_url'])) {
        $url = \GO::session()->values['after_login_url'];
        unset(\GO::session()->values['after_login_url']);
        header('Location: ' . $url);
        exit;
    }
    $installed = true;
    if (!\GO::config()->get_config_file() || empty(\GO::config()->db_user)) {
        $installed = false;
    } else {
        $stmt = \GO::getDbConnection()->query("SHOW TABLES");
        if (!$stmt->rowCount()) {
            $installed = false;
        }
    }
    if (!$installed) {
        header('Location: ' . \GO::config()->host . 'install/');
        exit;
    }
    //check for database upgrades
    $mtime = \GO::config()->get_setting('upgrade_mtime');
    if ($mtime != \GO::config()->mtime) {
        \GO::infolog("Running system update");
        header('Location: ' . \GO::url('maintenance/upgrade'));
        exit;
    }
}
\GO::router()->runController();
开发者ID:ajaboa,项目名称:crmpuan,代码行数:31,代码来源:index.php


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