[aur-dev] [PATCH v5 2/3] Update cookie for language setting when editing user information

Mark Weiman mark.weiman at markzz.com
Fri Jan 13 21:59:24 UTC 2017


Currently, when a user edits their language setting from the edit user form,
the changes aren't reflected until the user either lets the original cookie
expire, deletes the cookie manually, or changes the language a second time via
the dropdown menu on the top of the page. This patch makes the language cookie
get updated when it is changed from the edit user form.

Signed-off-by: Mark Weiman <mark.weiman at markzz.com>
---
 web/lib/acctfuncs.inc.php | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/web/lib/acctfuncs.inc.php b/web/lib/acctfuncs.inc.php
index 684a861..104cdd4 100644
--- a/web/lib/acctfuncs.inc.php
+++ b/web/lib/acctfuncs.inc.php
@@ -372,6 +372,13 @@ function process_account_form($TYPE,$A,$U="",$T="",$S="",$E="",$H="",$P="",$C=""
 			setcookie("AURTZ", $TZ, $cookie_time, "/");
 		}
 
+		if (isset($_COOKIE["AURLANG"]) && ($_COOKIE["AURLANG"] != $L)) {
+			/* set new cookie for language */
+			$timeout = intval(config_get("options", "persistent_cookie_timeout"));
+			$cookie_time = time() + $timeout;
+			setcookie("AURLANG", $L, $cookie_time, "/");
+		}
+
 		if ($result === false || $ssh_key_result === false) {
 			$message = __("No changes were made to the account, %s%s%s.",
 					"<strong>", htmlspecialchars($U,ENT_QUOTES), "</strong>");
-- 
2.11.0


More information about the aur-dev mailing list