Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-9023

Changing language only works if cookies are off.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • None
    • 3.0.6
    • Other
    • None
    • PHP Environment: 5.2.10-2ubuntu6.4
      Database: MySQL 5.1.37

      On forums with two or more languages installed. If you register with the forums default language and then go to UCP and change to some other language the buttons will still be in the previous language (ex the new topic button).
      This bug will only show if you have cookies on. If you have sid in the URL everything works fine.

      Reproduce:
      Install a new forum with two or more languages.
      Make sure cookies works, ie no sid in the URL.
      Go to viewforum.php and look at the new topic button (check its language).
      Go to UCP and change your language.
      Go back to viewforum.php and look at the same button.
      The language has changed everywhere else except for buttons.

      The reason is that in style.php you only check for sid in GET data. So if cookies are used sid will be empty and the boards default language used for the style.

      My fix:
      Open style.php
      Find

      	$config = $cache->obtain_config();
      	$user = false;


      Add after

      	if (empty($sid))
      	{
      		// Get session_id from the cookie instead.
      		$cookie = $config['cookie_name'] . '_sid';
      		if (!empty($_COOKIE[$cookie]))
      		{
      			$sid = $_COOKIE[$cookie];
      			if (strspn($sid, 'abcdefABCDEF0123456789') !== strlen($sid))
      			{
      				$sid = '';
      			}
      		}
      	}

            ToonArmy Chris Smith
            tumba25 Jari Kanerva [X] (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: