-
- public function updateTheme()
- {
- # no data
- if (empty($_POST['theme'])) {
- }
-
- # we are not going to change it to the current theme...
- if ($_POST['theme'] == $this->getTheme()) {
- $this->messages->add('w', _('still using the "' . $this->getTheme() . '" theme!'));
- Tools::redirect('?view=config');
- }
-
- $themes = $this->getInstalledThemes();
- $actualTheme = false;
-
- foreach (array_keys($themes) as $theme) {
- if ($theme == $_POST['theme']) {
- $actualTheme = true;
- break;
- }
- }
-
- if (! $actualTheme) {
- $this->messages->add('e', _('that theme does not seem to be installed'));
- Tools::redirect('?view=config');
- }
-
- $this->store->updateUserConfig($this->user->getId(), 'theme', $_POST['theme']);
- $this->messages->add('s', _('you have changed your theme preferences'));
-
- $currentConfig = $_SESSION['poche_user']->config;
- $currentConfig['theme'] = $_POST['theme'];
-
- $_SESSION['poche_user']->setConfig($currentConfig);
-
- $this->emptyCache();
-
- Tools::redirect('?view=config');
- }
-
- public function updateLanguage()
- {
- # no data
- if (empty($_POST['language'])) {
- }
-
- # we are not going to change it to the current language...
- if ($_POST['language'] == $this->getLanguage()) {
- $this->messages->add('w', _('still using the "' . $this->getLanguage() . '" language!'));
- Tools::redirect('?view=config');
- }
-
- $languages = $this->getInstalledLanguages();
- $actualLanguage = false;
-
- foreach ($languages as $language) {
- if ($language['value'] == $_POST['language']) {
- $actualLanguage = true;
- break;
- }
- }
-
- if (! $actualLanguage) {
- $this->messages->add('e', _('that language does not seem to be installed'));
- Tools::redirect('?view=config');
- }
-
- $this->store->updateUserConfig($this->user->getId(), 'language', $_POST['language']);
- $this->messages->add('s', _('you have changed your language preferences'));
-
- $currentConfig = $_SESSION['poche_user']->config;
- $currentConfig['language'] = $_POST['language'];
-
- $_SESSION['poche_user']->setConfig($currentConfig);
-
- $this->emptyCache();
-
- Tools::redirect('?view=config');
- }