mirror of
https://github.com/Findus23/plugin-LanguageToogle.git
synced 2024-09-10 05:13:46 +02:00
30 lines
982 B
PHP
30 lines
982 B
PHP
<?php
|
|
/**
|
|
* Piwik - free/libre analytics platform
|
|
*
|
|
* @link http://piwik.org
|
|
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
|
*/
|
|
|
|
namespace Piwik\Plugins\LanguageToogle;
|
|
|
|
use Piwik\Common;
|
|
use Piwik\Piwik;
|
|
use Piwik\Plugins\LanguagesManager\API as APILanguagesManager;
|
|
use Piwik\Plugins\LanguagesManager\LanguagesManager;
|
|
use Piwik\Version;
|
|
|
|
class Controller extends \Piwik\Plugin\Controller
|
|
{
|
|
public function index() {
|
|
Piwik::checkUserHasSuperUserAccess();
|
|
$lang = Common::getRequestVar("lang");
|
|
$returnModule = Common::getRequestVar("returnModule");
|
|
$returnAction = Common::getRequestVar("returnAction");
|
|
LanguagesManager::setLanguageForSession($lang);
|
|
if (Version::VERSION == '4.7.1' || Version::VERSION == '4.7.0') {
|
|
APILanguagesManager::getInstance()->setLanguageForUser(Piwik::getCurrentUserLogin(), $lang);
|
|
}
|
|
$this->redirectToIndex($returnModule, $returnAction);
|
|
}
|
|
}
|