Example #1
0
 /**
  * Regenerate themes list.
  *
  * @deprecated since 1.4.0 use Util::regenerate instead
  *
  * @return boolean
  */
 public function regenerate()
 {
     return Util::regenerate();
 }
Example #2
0
 /**
  * @Route("/view/{startnum}/{startlet}", requirements={"startnum" = "\d+", "startlet" = "[a-zA-Z]|\*"})
  * @Method("GET")
  *
  * view all themes
  *
  * @param Request $request
  * @param integer $startnum item number to start the pager from
  * @param string $startlet starting letter for the alpha pager
  *
  * @return Response symfony response object
  *
  * @throws AccessDeniedException Thrown if the user doesn't have edit permissions to the module
  */
 public function viewAction(Request $request, $startnum = 1, $startlet = null)
 {
     // Security check
     if (!SecurityUtil::checkPermission('ZikulaThemeModule::', '::', ACCESS_EDIT)) {
         throw new AccessDeniedException();
     }
     if (isset($this->container['multisites.enabled']) && $this->container['multisites.enabled'] == 1) {
         // only the main site can regenerate the themes list
         if ($this->container['multisites.mainsiteurl'] == $request->query->get('sitedns', null)) {
             //return true but any action has been made
             Util::regenerate();
         }
     } else {
         Util::regenerate();
     }
     // we need this value multiple times, so we keep it
     $itemsperpage = $this->getVar('itemsperpage');
     // call the API to get a list of all themes in the themes dir
     $allthemes = ThemeUtil::getAllThemes(ThemeUtil::FILTER_ALL, ThemeUtil::STATE_ALL);
     // filter by letter if required
     if (isset($startlet) && !empty($startlet)) {
         $allthemes = $this->_filterbyletter($allthemes, $startlet);
     }
     $themes = array_slice($allthemes, $startnum - 1, $itemsperpage);
     $this->view->assign('themes', $themes);
     // assign default theme
     $this->view->assign('currenttheme', System::getVar('Default_Theme'));
     // assign the values for the pager plugin
     $this->view->assign('pager', array('numitems' => sizeof($allthemes), 'itemsperpage' => $itemsperpage));
     return new Response($this->view->fetch('Admin/view.tpl'));
 }
Example #3
0
 private function regenerateThemes()
 {
     // regenerate the themes list
     return ThemeUtil::regenerate();
 }
Example #4
0
 private function finalizeParameters()
 {
     \ModUtil::initCoreVars(true);
     // initialize the modvars array (includes ZConfig (System) vars)
     $params = $this->decodeParameters($this->yamlManager->getParameters());
     \System::setVar('language_i18n', $params['locale']);
     // Set the System Identifier as a unique string.
     \System::setVar('system_identifier', str_replace('.', '', uniqid(rand(1000000000, 9999999999.0), true)));
     // add admin email as site email
     \System::setVar('adminmail', $params['email']);
     // regenerate the theme list
     \Zikula\Module\ThemeModule\Util::regenerate();
     // add remaining parameters and remove unneeded ones
     unset($params['username'], $params['password'], $params['email'], $params['dbtabletype']);
     $params['datadir'] = !empty($params['datadir']) ? $params['datadir'] : 'userdir';
     $params['secret'] = \RandomUtil::getRandomString(50);
     $params['url_secret'] = \RandomUtil::getRandomString(10);
     // Configure the Request Context
     // see http://symfony.com/doc/current/cookbook/console/sending_emails.html#configuring-the-request-context-globally
     $params['router.request_context.host'] = isset($params['router.request_context.host']) ? $params['router.request_context.host'] : $this->container->get('request')->getHost();
     $params['router.request_context.scheme'] = isset($params['router.request_context.scheme']) ? $params['router.request_context.scheme'] : 'http';
     $params['router.request_context.base_url'] = isset($params['router.request_context.base_url']) ? $params['router.request_context.base_url'] : $this->container->get('request')->getBasePath();
     $this->yamlManager->setParameters($params);
     // clear the cache
     $this->container->get('zikula.cache_clearer')->clear('symfony.config');
     return true;
 }