public function executeFilter(HttpRequestInterface $request, HttpResponseInterface $response) { // themeswitching must is enabled in configuration if ($this->config['themeswitch_via_url'] == 1) { return; } // check for "?theme=mytheme" URL parameter if (false === $request->issetParameter('theme', 'GET')) { return; } $theme = ''; $theme = $request->getParameterFromGet('theme'); /** * Inputfilter for $_GET['theme']. Allowed Chars are: az, 0-9, underscore. * */ if (false === $this->input->check($theme, 'is_abc|is_int|is_custom', '_')) { throw new InvalidArgumentException('Please provide a proper theme name.'); } $themedir = ''; $themedir = ROOT_THEMES_FRONTEND . $theme . DIRECTORY_SEPARATOR; // theme exists, set it as session-user-theme if (is_dir($themedir) and is_file($themedir . 'theme_info.xml')) { $_SESSION['user']['frontend_theme'] = $theme; } unset($theme, $themedir); }
public function executeFilter(HttpRequestInterface $request, HttpResponseInterface $response) { // theme switching must be enabled in configuration if ($this->config['theme_via_get'] === 0) { return; } // check for "?theme=mytheme" URL parameter if (false === $request->issetParameter('theme', 'GET')) { return; } // get parameter $theme = ''; $theme = $request->getParameterFromGet('theme'); // Inputfilter for $_GET['theme']. Allowed Chars are: az, 0-9, underscore. if (false === $this->input->check($theme, 'is_abc|is_int|is_custom', '_')) { throw new \InvalidArgumentException('Please provide a proper theme name.'); } // compose theme dir $themedir = ''; $themedir = APPLICATION_PATH . 'themes/frontend/' . $theme . DIRECTORY_SEPARATOR; // if theme exists, set it as frontend theme to the session if (is_dir($themedir) and is_file($themedir . 'theme_info.xml')) { $_SESSION['user']['frontend_theme'] = $theme; } unset($theme, $themedir); }