本文整理汇总了PHP中Acl::clearAcl方法的典型用法代码示例。如果您正苦于以下问题:PHP Acl::clearAcl方法的具体用法?PHP Acl::clearAcl怎么用?PHP Acl::clearAcl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Acl
的用法示例。
在下文中一共展示了Acl::clearAcl方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: logout
function logout()
{
fireEvent("Logout");
Acl::clearAcl();
Transaction::clear();
session_destroy();
}
示例2: authenticate
function authenticate($blogid, $loginid, $password, $blogapi = false)
{
$session = array();
Acl::clearAcl();
$pool = DBModel::getInstance();
$blogApiPassword = Setting::getBlogSettingGlobal("blogApiPassword", "");
$pool->reset("Users");
if (strlen($password) == 32 && preg_match('/[0-9a-f]{32}/i', $password)) {
// Traditional md5 Raw login. ( with/without auth token)
$userid = User::getUserIdByEmail($loginid);
if (!empty($userid) && !is_null($userid)) {
$pool->reset('UserSettings');
$pool->setQualifier('userid', 'equals', intval($userid));
$pool->setQualifier('name', 'equals', 'AuthToken', true);
$authtoken = $query->getCell('value');
$pool->reset("Users");
if (!empty($authtoken) && $authtoken === $password) {
// If user requested auth token, use it to confirm.
$session['userid'] = $userid;
} else {
// login with md5 hash
$pool->setQualifier("password", "eq", md5($password), true);
}
} else {
return false;
}
} else {
if ($blogapi && !empty($blogApiPassword)) {
// BlogAPI login
$pool->setQualifierSet(array("password", "eq", md5($password), true), "OR", array($password, "eq", $blogApiPassword, true));
} else {
// Normal login
$pool->setQualifier("password", "eq", md5($password), true);
}
}
if (empty($session)) {
$pool->setQualifier("loginid", "eq", $loginid, true);
$session = $pool->getRow("userid, loginid");
}
if (empty($session)) {
/* You should compare return value with '=== false' which checks with variable types*/
return false;
}
$userid = $session['userid'];
Acl::authorize('textcube', $userid);
$pool->reset("Users");
$pool->setAttribute("lastlogin", Timestamp::getUNIXtime());
$pool->setQualifier("loginid", "eq", $loginid, true);
$pool->update();
// POD::execute("DELETE FROM {$database['prefix']}UserSettings WHERE userid = '$userid' AND name = 'AuthToken' LIMIT 1");
return $userid;
}
示例3: authenticate
function authenticate($blogid, $loginid, $password, $blogapi = false)
{
global $database;
$session = array();
Acl::clearAcl();
$loginid = POD::escapeString($loginid);
$blogApiPassword = Setting::getBlogSettingGlobal("blogApiPassword", "");
if (strlen($password) == 32 && preg_match('/[0-9a-f]{32}/i', $password)) {
// Raw login. ( with/without auth token)
$userid = User::getUserIdByEmail($loginid);
if (!empty($userid) && !is_null($userid)) {
$query = DBModel::getInstance();
$query->reset('UserSettings');
$query->setQualifier('userid', 'equals', intval($userid));
$query->setQualifier('name', 'equals', 'AuthToken', true);
$authtoken = $query->getCell('value');
if (!empty($authtoken) && $authtoken === $password) {
// If user requested auth token, use it to confirm.
$session['userid'] = $userid;
} else {
// login with md5 hash
$secret = 'password = \'' . md5($password) . '\'';
}
} else {
return false;
}
} else {
if ($blogapi && !empty($blogApiPassword)) {
// BlogAPI login
$password = POD::escapeString($password);
$secret = '(password = \'' . md5($password) . '\' OR \'' . $password . '\' = \'' . $blogApiPassword . '\')';
} else {
// Normal login
$secret = 'password = \'' . md5($password) . '\'';
}
}
if (empty($session)) {
$session = POD::queryRow("SELECT userid, loginid, name FROM {$database['prefix']}Users WHERE loginid = '{$loginid}' AND {$secret}");
}
if (empty($session)) {
/* You should compare return value with '=== false' which checks with variable types*/
return false;
}
$userid = $session['userid'];
Acl::authorize('textcube', $userid);
POD::execute("UPDATE {$database['prefix']}Users SET lastlogin = " . Timestamp::getUNIXtime() . " WHERE loginid = '{$loginid}'");
// POD::execute("DELETE FROM {$database['prefix']}UserSettings WHERE userid = '$userid' AND name = 'AuthToken' LIMIT 1");
return $userid;
}