本文整理匯總了PHP中UserStatus::setAll方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserStatus::setAll方法的具體用法?PHP UserStatus::setAll怎麽用?PHP UserStatus::setAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UserStatus
的用法示例。
在下文中一共展示了UserStatus::setAll方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: wfUpdateUserStatus
function wfUpdateUserStatus($username, $gender, $province, $city, $birthday, $status)
{
global $wgUser;
$city = trim($city);
$status = trim($status);
$out = ResponseGenerator::getJson(ResponseGenerator::ERROR_UNKNOWN);
// This feature is only available for logged-in users.
if (!$wgUser->isLoggedIn()) {
$out = ResponseGenerator::getJson(ResponseGenerator::ERROR_NOT_LOGGED_IN);
return $out;
}
// No need to allow blocked users to access this page, they could abuse it, y'know.
if ($wgUser->isBlocked()) {
$out = ResponseGenerator::getJson(ResponseGenerator::ERROR_BLOCKED);
return $out;
}
// Database operations require write mode
if (wfReadOnly()) {
$out = ResponseGenerator::getJson(ResponseGenerator::ERROR_READ_ONLY);
return $out;
}
// Are we even allowed to do this?
if (!$wgUser->isAllowed('edit')) {
$out = ResponseGenerator::getJson(ResponseGenerator::ERROR_NOT_ALLOWED);
return $out;
}
if ($username === $wgUser->getName()) {
$us = new UserStatus($wgUser);
if ($us->setAll($gender, $province, $city, $birthday, $status)) {
$out = ResponseGenerator::getJson(ResponseGenerator::SUCCESS);
}
}
return $out;
}