本文整理匯總了PHP中PermissionException函數的典型用法代碼示例。如果您正苦於以下問題:PHP PermissionException函數的具體用法?PHP PermissionException怎麽用?PHP PermissionException使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了PermissionException函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
public function __construct($Sender = '')
{
if (!CheckPermission('Conversations.Conversations.Add')) {
throw PermissionException();
}
$Session = Gdn::Session();
if (property_exists($Sender, 'Conversation')) {
$this->Conversation = $Sender->Conversation;
}
$this->Form = Gdn::Factory('Form', 'AddPeople');
// $this->Form->Action = $Sender->SelfUrl;
// If the form was posted back, check for people to add to the conversation
if ($this->Form->AuthenticatedPostBack()) {
$NewRecipientUserIDs = array();
$NewRecipients = explode(',', $this->Form->GetFormValue('AddPeople', ''));
$UserModel = Gdn::Factory("UserModel");
foreach ($NewRecipients as $Name) {
if (trim($Name) != '') {
$User = $UserModel->GetByUsername(trim($Name));
if (is_object($User)) {
$NewRecipientUserIDs[] = $User->UserID;
}
}
}
$Sender->ConversationModel->AddUserToConversation($this->Conversation->ConversationID, $NewRecipientUserIDs);
// if ($Sender->DeliveryType() == DELIVERY_TYPE_ALL)
// Redirect('/messages/'.$this->Conversation->ConversationID);
$Sender->InformMessage(T('Your changes were saved.'));
$Sender->RedirectUrl = Url('/messages/' . $this->Conversation->ConversationID);
}
$this->_ApplicationFolder = $Sender->Application;
$this->_ThemeFolder = $Sender->Theme;
}
示例2: Permission
public function Permission()
{
if ($this->DeliveryMethod() == DELIVERY_METHOD_XHTML) {
$this->Render();
} else {
$this->RenderException(PermissionException());
}
}
示例3: Index
/**
* This determines if the current user can react on this item with this action
*
* @param string $Type valid options are 'discussion', 'comment', and 'activity'
* @param int $ID
* @param int $ActionID
* @throws Gdn_UserException
*/
public function Index($Type, $ID, $ActionID)
{
$Type = strtolower($Type);
$Action = $this->ActionModel->GetByID($ActionID);
// Make sure the action exists and the user is allowed to react
if (!$Action) {
throw new Gdn_UserException(T('Yaga.Action.Invalid'));
}
if (!Gdn::Session()->CheckPermission($Action->Permission)) {
throw PermissionException();
}
switch ($Type) {
case 'discussion':
$Model = new DiscussionModel();
$AnchorID = '#Discussion_';
break;
case 'comment':
$Model = new CommentModel();
$AnchorID = '#Comment_';
break;
case 'activity':
$Model = new ActivityModel();
$AnchorID = '#Activity_';
break;
default:
throw new Gdn_UserException(T('Yaga.Action.InvalidTargetType'));
break;
}
$Item = $Model->GetID($ID);
if ($Item) {
$Anchor = $AnchorID . $ID . ' .ReactMenu';
} else {
throw new Gdn_UserException(T('Yaga.Action.InvalidTargetID'));
}
$UserID = Gdn::Session()->UserID;
switch ($Type) {
case 'comment':
case 'discussion':
$ItemOwnerID = $Item->InsertUserID;
break;
case 'activity':
$ItemOwnerID = $Item['RegardingUserID'];
break;
default:
throw new Gdn_UserException(T('Yaga.Action.InvalidTargetType'));
break;
}
if ($ItemOwnerID == $UserID) {
throw new Gdn_UserException(T('Yaga.Error.ReactToOwn'));
}
// It has passed through the gauntlet
$this->ReactionModel->Set($ID, $Type, $ItemOwnerID, $UserID, $ActionID);
$this->JsonTarget($Anchor, RenderReactionList($ID, $Type, FALSE), 'ReplaceWith');
// Don't render anything
$this->Render('Blank', 'Utility', 'Dashboard');
}
示例4: DiscussionController_AutoExpire_Create
public function DiscussionController_AutoExpire_Create($Sender, $Args)
{
$DiscussionID = intval($Args[0]);
$DiscussionModel = new DiscussionModel();
$Discussion = $DiscussionModel->GetID($DiscussionID);
if (!Gdn::Session()->CheckPermission('Vanilla.Discussions.Close', TRUE, 'Category', $Discussion->PermissionCategoryID)) {
throw PermissionException('Vanilla.Discussions.Close');
}
if (strtolower($Args[1]) == 'reset') {
Gdn::SQL()->Put('Discussion', array('AutoExpire' => 1, 'Closed' => 0, 'DateReOpened' => Gdn_Format::ToDateTime()), array('DiscussionID' => $DiscussionID));
} else {
$Expire = strtolower($Args[1]) == 'on' ? 1 : 0;
Gdn::SQL()->Put('Discussion', array('AutoExpire' => $Expire), array('DiscussionID' => $DiscussionID));
}
Redirect('discussion/' . $DiscussionID . '/' . Gdn_Format::Url($Discussion->Name));
}
示例5: Archives
public function Archives($Category, $Month, $Page = FALSE)
{
$Category = CategoryModel::Categories($Category);
if (!$Category) {
throw NotFoundException($Category);
}
if (!$Category['PermsDiscussionsView']) {
throw PermissionException();
}
$Timestamp = strtotime($Month);
if (!$Timestamp) {
throw new Gdn_UserException("{$Month} is not a valid date.");
}
$this->SetData('Category', $Category);
// Round the month to the first day.
$From = gmdate('Y-m-01', $Timestamp);
$To = gmdate('Y-m-01', strtotime('+1 month', strtotime($From)));
// Grab the discussions.
list($Offset, $Limit) = OffsetLimit($Page, C('Vanilla.Discussions.PerPage', 30));
$Where = array('CategoryID' => $Category['CategoryID'], 'Announce' => 'all', 'DateInserted >=' => $From, 'DateInserted <' => $To);
SaveToConfig('Vanilla.Discussions.SortField', 'd.DateInserted', FALSE);
$DiscussionModel = new DiscussionModel();
$Discussions = $DiscussionModel->GetWhere($Where, $Offset, $Limit);
$this->DiscussionData = $this->SetData('Discussions', $Discussions);
$this->SetData('_CurrentRecords', count($Discussions));
$this->SetData('_Limit', $Limit);
$Canonical = '/categories/archives/' . rawurlencode($Category['UrlCode']) . '/' . gmdate('Y-m', $Timestamp);
$Page = PageNumber($Offset, $Limit, TRUE, FALSE);
$this->CanonicalUrl(Url($Canonical . ($Page ? '?page=' . $Page : ''), TRUE));
PagerModule::Current()->Configure($Offset, $Limit, FALSE, $Canonical . '?page={Page}');
// PagerModule::Current()->Offset = $Offset;
// PagerModule::Current()->Url = '/categories/archives'.rawurlencode($Category['UrlCode']).'?page={Page}';
Gdn_Theme::Section(GetValue('CssClass', $Category));
Gdn_Theme::Section('DiscussionList');
$this->Title(htmlspecialchars(GetValue('Name', $Category, '')));
$this->Description(sprintf(T("Archives for %s"), gmdate('F Y', strtotime($From))), TRUE);
$this->AddJsFile('discussions.js');
$this->Head->AddTag('meta', array('name' => 'robots', 'content' => 'noindex'));
$this->ControllerName = 'DiscussionsController';
$this->CssClass = 'Discussions';
$this->Render();
}
示例6: userController_markTroll_create
/**
* Validates the current user's permissions & transientkey and then marks a user as a troll.
*
* @param UserController $sender
*/
public function userController_markTroll_create($sender, $userID, $troll = true)
{
$sender->permission('Garden.Moderation.Manage');
$trollUserID = $userID;
// Validate the transient key && permissions
// Make sure we are posting back.
if (!$sender->Request->isAuthenticatedPostBack()) {
throw PermissionException('Javascript');
}
$trolls = self::getTrolls();
// Toggle troll value in DB
if (in_array($trollUserID, $trolls)) {
Gdn::sql()->update('User', ['Troll' => 0], ['UserID' => $trollUserID])->put();
unset($trolls[array_search($trollUserID, $trolls)]);
} else {
Gdn::sql()->update('User', ['Troll' => 1], ['UserID' => $trollUserID])->put();
$trolls[] = $trollUserID;
}
self::setTrolls($trolls);
$sender->jsonTarget('', '', 'Refresh');
$sender->render('Blank', 'Utility', 'Dashboard');
}
示例7: ModerationController_MergeDiscussions_Create
/**
* Add a method to the ModerationController to handle merging discussions.
* @param Gdn_Controller $Sender
*/
public function ModerationController_MergeDiscussions_Create($Sender)
{
$Session = Gdn::Session();
$Sender->Form = new Gdn_Form();
$Sender->Title(T('Merge Discussions'));
$DiscussionModel = new DiscussionModel();
$CheckedDiscussions = Gdn::UserModel()->GetAttribute($Session->User->UserID, 'CheckedDiscussions', array());
if (!is_array($CheckedDiscussions)) {
$CheckedDiscussions = array();
}
$DiscussionIDs = $CheckedDiscussions;
$Sender->SetData('DiscussionIDs', $DiscussionIDs);
$CountCheckedDiscussions = count($DiscussionIDs);
$Sender->SetData('CountCheckedDiscussions', $CountCheckedDiscussions);
$Discussions = $DiscussionModel->SQL->WhereIn('DiscussionID', $DiscussionIDs)->Get('Discussion')->ResultArray();
$Sender->SetData('Discussions', $Discussions);
// Perform the merge
if ($Sender->Form->AuthenticatedPostBack()) {
// Create a new discussion record
$MergeDiscussion = FALSE;
$MergeDiscussionID = $Sender->Form->GetFormValue('MergeDiscussionID');
foreach ($Discussions as $Discussion) {
if ($Discussion['DiscussionID'] == $MergeDiscussionID) {
$MergeDiscussion = $Discussion;
break;
}
}
$RedirectLink = $Sender->Form->GetFormValue('RedirectLink');
if ($MergeDiscussion) {
$ErrorCount = 0;
// Verify that the user has permission to perform the merge.
$Category = CategoryModel::Categories($MergeDiscussion['CategoryID']);
if ($Category && !$Category['PermsDiscussionsEdit']) {
throw PermissionException('Vanilla.Discussions.Edit');
}
$DiscussionModel->DefineSchema();
$MaxNameLength = GetValue('Length', $DiscussionModel->Schema->GetField('Name'));
// Assign the comments to the new discussion record
$DiscussionModel->SQL->Update('Comment')->Set('DiscussionID', $MergeDiscussionID)->WhereIn('DiscussionID', $DiscussionIDs)->Put();
$CommentModel = new CommentModel();
foreach ($Discussions as $Discussion) {
if ($Discussion['DiscussionID'] == $MergeDiscussionID) {
continue;
}
// Create a comment out of the discussion.
$Comment = ArrayTranslate($Discussion, array('Body', 'Format', 'DateInserted', 'InsertUserID', 'InsertIPAddress', 'DateUpdated', 'UpdateUserID', 'UpdateIPAddress', 'Attributes', 'Spam', 'Likes', 'Abuse'));
$Comment['DiscussionID'] = $MergeDiscussionID;
$CommentModel->Validation->Results(TRUE);
$CommentID = $CommentModel->Save($Comment);
if ($CommentID) {
// Move any attachments (FileUpload plugin awareness)
if (class_exists('MediaModel')) {
$MediaModel = new MediaModel();
$MediaModel->Reassign($Discussion['DiscussionID'], 'discussion', $CommentID, 'comment');
}
if ($RedirectLink) {
// The discussion needs to be changed to a moved link.
$RedirectDiscussion = array('Name' => SliceString(sprintf(T('Merged: %s'), $Discussion['Name']), $MaxNameLength), 'Type' => 'redirect', 'Body' => FormatString(T('This discussion has been <a href="{url,html}">merged</a>.'), array('url' => DiscussionUrl($MergeDiscussion))), 'Format' => 'Html');
$DiscussionModel->SetField($Discussion['DiscussionID'], $RedirectDiscussion);
$CommentModel->UpdateCommentCount($Discussion['DiscussionID']);
$CommentModel->RemovePageCache($Discussion['DiscussionID']);
} else {
// Delete discussion that was merged.
$DiscussionModel->Delete($Discussion['DiscussionID']);
}
} else {
$Sender->InformMessage($CommentModel->Validation->ResultsText());
$ErrorCount++;
}
}
// Update counts on all affected discussions.
$CommentModel->UpdateCommentCount($MergeDiscussionID);
$CommentModel->RemovePageCache($MergeDiscussionID);
// Clear selections
Gdn::UserModel()->SaveAttribute($Session->UserID, 'CheckedDiscussions', FALSE);
ModerationController::InformCheckedDiscussions($Sender);
if ($ErrorCount == 0) {
$Sender->JsonTarget('', '', 'Refresh');
}
}
}
$Sender->Render('MergeDiscussions', '', 'plugins/SplitMerge');
}
示例8: SetHourOffset
public function SetHourOffset()
{
$Form = new Gdn_Form();
if ($Form->AuthenticatedPostBack()) {
if (!Gdn::Session()->IsValid()) {
throw PermissionException('Garden.SignIn.Allow');
}
$HourOffset = $Form->GetFormValue('HourOffset');
Gdn::UserModel()->SetField(Gdn::Session()->UserID, 'HourOffset', $HourOffset);
$this->SetData('Result', TRUE);
$this->SetData('HourOffset', $HourOffset);
$time = time();
$this->SetData('UTCDateTime', gmdate('r', $time));
$this->SetData('UserDateTime', gmdate('r', $time + $HourOffset * 3600));
} else {
throw ForbiddenException('GET');
}
$this->Render('Blank');
}
示例9: Update
/**
* Run a structure update on the database.
*
* @since 2.0.?
* @access public
*/
public function Update()
{
// Check for permission or flood control.
// These settings are loaded/saved to the database because we don't want the config file storing non/config information.
$Now = time();
$LastTime = Gdn::Get('Garden.Update.LastTimestamp', 0);
if ($LastTime + 60 * 60 * 24 > $Now) {
// Check for flood control.
$Count = Gdn::Get('Garden.Update.Count', 0) + 1;
if ($Count > 5) {
if (!Gdn::Session()->CheckPermission('Garden.Settings.Manage')) {
// We are only allowing an update of 5 times every 24 hours.
throw PermissionException();
}
}
} else {
$Count = 1;
}
Gdn::Set('Garden.Update.LastTimestamp', $Now);
Gdn::Set('Garden.Update.Count', $Count);
try {
// Run the structure.
$UpdateModel = new UpdateModel();
$UpdateModel->RunStructure();
$this->SetData('Success', TRUE);
} catch (Exception $Ex) {
$this->SetData('Success', FALSE);
}
if (Gdn::Session()->CheckPermission('Garden.Settings.Manage')) {
SaveToConfig('Garden.Version', APPLICATION_VERSION);
}
if ($Target = $this->Request->Get('Target')) {
Redirect($Target);
}
$this->MasterView = 'empty';
$this->CssClass = 'Home';
$this->Render();
}
示例10: discussionController_download_create
/**
*
*
* @param DiscussionController $Sender
*/
public function discussionController_download_create($Sender)
{
if (!$this->CanDownload) {
throw PermissionException("File could not be streamed: Access is denied");
}
list($MediaID) = $Sender->RequestArgs;
$Media = $this->mediaModel()->getID($MediaID);
if (!$Media) {
return;
}
$Filename = Gdn::request()->filename();
if (!$Filename || $Filename == 'default') {
$Filename = $Media->Name;
}
$DownloadPath = combinePaths(array(MediaModel::pathUploads(), val('Path', $Media)));
if (in_array(strtolower(pathinfo($Filename, PATHINFO_EXTENSION)), array('bmp', 'gif', 'jpg', 'jpeg', 'png'))) {
$ServeMode = 'inline';
} else {
$ServeMode = 'attachment';
}
$Served = false;
$this->EventArguments['DownloadPath'] = $DownloadPath;
$this->EventArguments['ServeMode'] = $ServeMode;
$this->EventArguments['Media'] = $Media;
$this->EventArguments['Served'] =& $Served;
$this->fireEvent('BeforeDownload');
if (!$Served) {
return Gdn_FileSystem::serveFile($DownloadPath, $Filename, $Media->Type, $ServeMode);
throw new Exception('File could not be streamed: missing file (' . $DownloadPath . ').');
}
exit;
}
示例11: Verify
public function Verify($UserID, $Verified)
{
$this->Permission('Garden.Moderation.Manage');
if (!$this->Request->IsAuthenticatedPostBack()) {
throw PermissionException('Javascript');
}
// First, set the field value.
Gdn::UserModel()->SetField($UserID, 'Verified', $Verified);
$User = Gdn::UserModel()->GetID($UserID);
if (!$User) {
throw NotFoundException('User');
}
// Send back the verified button.
require_once $this->FetchViewLocation('helper_functions', 'Profile', 'Dashboard');
$this->JsonTarget('.User-Verified', UserVerified($User), 'ReplaceWith');
$this->Render('Blank', 'Utility', 'Dashboard');
}
示例12: safeRedirect
/**
* Redirect, but only to a safe domain.
*
* @param string $Destination Where to redirect.
* @param int $StatusCode The status of the redirect. Defaults to 302.
*/
function safeRedirect($Destination = false, $StatusCode = null)
{
if (!$Destination) {
$Destination = Url('', true);
} else {
$Destination = Url($Destination, true);
}
$Domain = parse_url($Destination, PHP_URL_HOST);
if (in_array($Domain, TrustedDomains())) {
Redirect($Destination, $StatusCode);
} else {
throw PermissionException();
}
}
示例13: ModerationController_MergeDiscussions_Create
/**
* Add a method to the ModerationController to handle merging discussions.
* @param Gdn_Controller $Sender
*/
public function ModerationController_MergeDiscussions_Create($Sender)
{
$Session = Gdn::Session();
$Sender->Form = new Gdn_Form();
$Sender->Title(T('Merge Discussions'));
$DiscussionModel = new DiscussionModel();
$CheckedDiscussions = Gdn::UserModel()->GetAttribute($Session->User->UserID, 'CheckedDiscussions', array());
if (!is_array($CheckedDiscussions)) {
$CheckedDiscussions = array();
}
$DiscussionIDs = $CheckedDiscussions;
$Sender->SetData('DiscussionIDs', $DiscussionIDs);
$CountCheckedDiscussions = count($DiscussionIDs);
$Sender->SetData('CountCheckedDiscussions', $CountCheckedDiscussions);
$Discussions = $DiscussionModel->SQL->WhereIn('DiscussionID', $DiscussionIDs)->Get('Discussion')->ResultArray();
$Sender->SetData('Discussions', $Discussions);
// Perform the merge
if ($Sender->Form->AuthenticatedPostBack()) {
// Create a new discussion record
$MergeDiscussion = FALSE;
$MergeDiscussionID = $Sender->Form->GetFormValue('MergeDiscussionID');
foreach ($Discussions as $Discussion) {
if ($Discussion['DiscussionID'] == $MergeDiscussionID) {
$MergeDiscussion = $Discussion;
break;
}
}
if ($MergeDiscussion) {
$ErrorCount = 0;
// Verify that the user has permission to perform the merge.
$Category = CategoryModel::Categories($MergeDiscussion['CategoryID']);
if ($Category && !$Category['PermsDiscussionsEdit']) {
throw PermissionException('Vanilla.Discussions.Edit');
}
// Assign the comments to the new discussion record
$DiscussionModel->SQL->Update('Comment')->Set('DiscussionID', $MergeDiscussionID)->WhereIn('DiscussionID', $DiscussionIDs)->Put();
$CommentModel = new CommentModel();
foreach ($Discussions as $Discussion) {
if ($Discussion['DiscussionID'] == $MergeDiscussionID) {
continue;
}
// Create a comment out of the discussion.
$Comment = ArrayTranslate($Discussion, array('Body', 'Format', 'DateInserted', 'InsertUserID', 'InsertIPAddress', 'DateUpdated', 'UpdateUserID', 'UpdateIPAddress', 'Attributes', 'Spam', 'Likes', 'Abuse'));
$Comment['DiscussionID'] = $MergeDiscussionID;
$CommentModel->Validation->Results(TRUE);
$CommentID = $CommentModel->Save($Comment);
if ($CommentID) {
// Move any attachments (FileUpload plugin awareness)
if (class_exists('MediaModel')) {
$MediaModel = new MediaModel();
$MediaModel->Reassign($Discussion['DiscussionID'], 'discussion', $CommentID, 'comment');
}
// Delete discussion that was merged
$DiscussionModel->Delete($Discussion['DiscussionID']);
} else {
$Sender->InformMessage($CommentModel->Validation->ResultsText());
$ErrorCount++;
}
}
// Update counts on all affected discussions.
$CommentModel->UpdateCommentCount($MergeDiscussionID);
$CommentModel->RemovePageCache($MergeDiscussionID);
// Clear selections
Gdn::UserModel()->SaveAttribute($Session->UserID, 'CheckedDiscussions', FALSE);
ModerationController::InformCheckedDiscussions($Sender);
if ($ErrorCount == 0) {
$Sender->RedirectUrl = Url("/discussion/{$MergeDiscussionID}/" . Gdn_Format::Url($MergeDiscussion['Name']));
}
}
}
$Sender->Render('MergeDiscussions', '', 'plugins/SplitMerge');
}
示例14: GetUserInfo
/**
* Retrieve the user to be manipulated. Defaults to current user.
*
* @since 2.0.0
* @access public
* @param mixed $User Unique identifier, possibly username or ID.
* @param string $Username.
* @param int $UserID Unique ID.
* @param bool $CheckPermissions Whether or not to check user permissions.
* @return bool Always true.
*/
public function GetUserInfo($UserReference = '', $Username = '', $UserID = '', $CheckPermissions = FALSE)
{
if ($this->_UserInfoRetrieved) {
return;
}
if (!C('Garden.Profile.Public') && !Gdn::Session()->IsValid()) {
throw PermissionException();
}
// If a UserID was provided as a querystring parameter, use it over anything else:
if ($UserID) {
$UserReference = $UserID;
$Username = 'Unknown';
// Fill this with a value so the $UserReference is assumed to be an integer/userid.
}
$this->Roles = array();
if ($UserReference == '') {
if ($Username) {
$this->User = $this->UserModel->GetByUsername($Username);
} else {
$this->User = $this->UserModel->GetID(Gdn::Session()->UserID);
}
} elseif (is_numeric($UserReference) && $Username != '') {
$this->User = $this->UserModel->GetID($UserReference);
} else {
$this->User = $this->UserModel->GetByUsername($UserReference);
}
if ($this->User === FALSE) {
throw NotFoundException('User');
} else {
if ($this->User->Deleted == 1) {
Redirect('dashboard/home/deleted');
} else {
$this->RoleData = $this->UserModel->GetRoles($this->User->UserID);
if ($this->RoleData !== FALSE && $this->RoleData->NumRows(DATASET_TYPE_ARRAY) > 0) {
$this->Roles = ConsolidateArrayValuesByKey($this->RoleData->Result(), 'Name');
}
if (Gdn::Session()->CheckPermission('Garden.Settings.Manage') || Gdn::Session()->UserID == $this->User->UserID) {
$this->User->Transient = GetValueR('Attributes.TransientKey', $this->User);
}
// Hide personal info roles
if (!CheckPermission('Garden.PersonalInfo.View')) {
$this->Roles = array_filter($this->Roles, 'RoleModel::FilterPersonalInfo');
}
$this->SetData('Profile', $this->User);
$this->SetData('UserRoles', $this->Roles);
if ($CssClass = GetValue('_CssClass', $this->User)) {
$this->CssClass .= ' ' . $CssClass;
}
}
}
if ($CheckPermissions && Gdn::Session()->UserID != $this->User->UserID) {
$this->Permission(array('Garden.Users.Edit', 'Moderation.Profiles.Edit'), FALSE);
}
$this->AddSideMenu();
$this->_UserInfoRetrieved = TRUE;
return TRUE;
}
示例15: ProfileController_SetLocale_Create
/**
* Allow user to set their preferred locale via link-click.
*/
public function ProfileController_SetLocale_Create($Sender, $locale, $TK)
{
if (!Gdn::Session()->UserID) {
throw PermissionException('Garden.SignIn.Allow');
}
// Check intent.
if (!Gdn::Session()->ValidateTransientKey($TK)) {
Redirect($_SERVER['HTTP_REFERER']);
}
// If we got a valid locale, save their preference
if (isset($locale)) {
$locale = $this->ValidateLocale($locale);
if ($locale) {
$this->SetUserMeta(Gdn::Session()->UserID, 'Locale', $locale);
}
}
// Back from whence we came.
Redirect($_SERVER['HTTP_REFERER']);
}