Exemple #1
0
 /**
  * Clear pref cache
  *
  * @param string $cache_name default to current alias
  * @param boolean $runtime clear runtime cache as well ($this->pref_cache)
  * @return e_pref
  */
 public function clearPrefCache($cache_name = '', $runtime = true)
 {
     if ($runtime) {
         $this->pref_cache = '';
     }
     ecache::clear_sys('Config_' . (!empty($cache_name) ? $cache_name : $this->alias));
     return $this;
 }
Exemple #2
0
 /**
  * Set Theme as Main Theme.
  *
  * @param string $name [optional] name (folder) of the theme to set.
  * @return boolean TRUE on success, FALSE otherwise
  */
 function setTheme($name = '')
 {
     $core = e107::getConfig('core');
     $sql = e107::getDb();
     $mes = e107::getMessage();
     $themeArray = $this->getThemes("id");
     $name = $name ? $name : vartrue($themeArray[$this->id]);
     $layout = $pref['sitetheme_layouts'] = is_array($this->themeArray[$name]['layouts']) ? $this->themeArray[$name]['layouts'] : array();
     $deflayout = $this->findDefault($name);
     $customPages = $this->themeArray[$name]['custompages'];
     $version = $this->themeArray[$name]['version'];
     $core->set('sitetheme', $name);
     $core->set('themecss', 'style.css');
     $core->set('sitetheme_layouts', $layout);
     $core->set('sitetheme_deflayout', $deflayout);
     $core->set('sitetheme_custompages', $customPages);
     $core->set('sitetheme_version', $version);
     $core->set('sitetheme_releaseUrl', $this->themeArray[$name]['releaseUrl']);
     $sql->db_Delete("menus", "menu_layout !='' ");
     ecache::clear_sys();
     if ($core->save()) {
         //TODO LANs
         $mes->add(TPVLAN_3 . " <b>'" . $name . " v" . $version . "'</b>", E_MESSAGE_SUCCESS);
         $mes->add("Default Layout: " . $deflayout, E_MESSAGE_SUCCESS);
         $mes->add("Custom Pages: " . implode(" ", $customPages), E_MESSAGE_SUCCESS);
         $this->theme_adminlog('01', $name . ', style.css');
         return TRUE;
     } else {
         $mes->add(TPVLAN_3 . " <b>'" . $name . "'</b>", E_MESSAGE_ERROR);
         return FALSE;
     }
 }