Skip to content

Commit

Permalink
Fix language preference block / language cookie reading.
Browse files Browse the repository at this point in the history
The preference block must have been broken by a jquery update, and the cookie reading by a Kohana update.
  • Loading branch information
andyst committed Jan 29, 2010
1 parent b8fb891 commit 5c52751
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion modules/gallery/helpers/locales.php
Expand Up @@ -238,7 +238,9 @@ static function set_request_locale() {
}

static function cookie_locale() {
$cookie_data = Input::instance()->cookie("g_locale");
// Can't use Input framework for client side cookies since
// they're not signed.
$cookie_data = isset($_COOKIE["g_locale"]) ? $_COOKIE["g_locale"] : null;
$locale = null;
if ($cookie_data) {
if (preg_match("/^([a-z]{2,3}(?:_[A-Z]{2})?)$/", trim($cookie_data), $matches)) {
Expand Down
2 changes: 1 addition & 1 deletion modules/gallery/views/user_languages_block.html.php
@@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<?= form::dropdown("g-select-session-locale", $installed_locales, $selected) ?>
<script type="text/javascript">
$("#g-select-session-locale").change(function() {
$("select[name=g-select-session-locale]").change(function() {
var old_locale_preference = <?= html::js_string($selected) ?>;
var locale = $(this).val();
if (old_locale_preference == locale) {
Expand Down

0 comments on commit 5c52751

Please sign in to comment.