本文整理匯總了PHP中Token::search方法的典型用法代碼示例。如果您正苦於以下問題:PHP Token::search方法的具體用法?PHP Token::search怎麽用?PHP Token::search使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Token
的用法示例。
在下文中一共展示了Token::search方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: purge
public static function purge()
{
$whereClause = 'action_count=0 OR (action_count=-1 AND expiration<:time)';
$params = array(array('id' => ':time', 'value' => time()));
$tokens = Token::search($whereClause, $params);
foreach ($tokens as $token) {
$token->delete();
}
}
示例2: checkRights
public static function checkRights($page, $action, $token)
{
loadClass('status');
loadClass('token');
loadClass('action');
loadClass('right');
loadClass('customer');
if (is_null($action)) {
Functions::setResponse(400);
}
$pagename = str_replace('.php', '', basename($page));
$actionName = $pagename . '-' . $action;
$whereClause = 'name=:name';
$params = array(array('id' => ':name', 'value' => $actionName));
$result = Action::search($whereClause, $params);
if (!count($result)) {
echo 'Please update actions and rights!';
Functions::setResponse(500);
}
$action = $result[0];
define('LOGGED_OUT_STATUS', 'standard');
$loggedOut = false;
if (is_null($token) || strtolower($token) == 'none') {
$loggedOut = true;
} else {
$whereClause = 'value=:value';
$params = array(array('id' => ':value', 'value' => $token));
$result = Token::search($whereClause, $params);
if (!count($result)) {
Functions::setResponse(498);
} else {
$token = $result[0];
$customer = new Customer($token->get('customerId'));
$status = new Status($customer->get('statusId'));
}
}
if ($loggedOut) {
$whereClause = 'name=:name';
$params = array(array('id' => ':name', 'value' => LOGGED_OUT_STATUS));
$result = Status::search($whereClause, $params);
if (!count($result)) {
Functions::setResponse(500);
}
$status = $result[0];
}
$whereClause = 'action_id=:action_id AND status_id=:status_id';
$params = array(array('id' => ':action_id', 'value' => $action->get('id')), array('id' => ':status_id', 'value' => $status->get('id')));
$result = Right::search($whereClause, $params);
if (!count($result)) {
Functions::setResponse(401);
}
if ($result[0]->get('right') == 'deny') {
Functions::setResponse(401);
}
}
示例3: logoutUser
function logoutUser()
{
$data = Functions::getJSONData();
$tokenValue = Functions::elt($data, 'tokenValue');
if (is_null($tokenValue)) {
Functions::setResponse(400);
}
$whereClause = 'value=:tokenValue';
$params = array(array('id' => ':tokenValue', 'value' => $tokenValue));
$results = Token::search($whereClause, $params);
if (!count($results)) {
return true;
}
foreach ($results as $result) {
$result->delete();
}
return true;
}