diff --git a/e107_handlers/theme_handler.php b/e107_handlers/theme_handler.php index 6a4ef8f85..fb9ecd188 100644 --- a/e107_handlers/theme_handler.php +++ b/e107_handlers/theme_handler.php @@ -1,4 +1,4 @@ -frm = new e_form(); //enable inner tabindex counter + + $this->fl = e107::getFile(); - $this->fl = e107::getFile(); - - - if (isset($_POST['upload'])) + + if(isset($_POST['upload'])) { - $this -> themeUpload(); + $this->themeUpload(); } - - $this->themeArray = (defined('E107_INSTALL')) ? $this -> getThemes('xml') : $this -> getThemes(); - - // print_a($this -> themeArray); - - foreach($_POST as $key => $post) + + $this->themeArray = (defined('E107_INSTALL')) ? $this->getThemes('xml') : $this->getThemes(); + + // print_a($this -> themeArray); + + foreach ($_POST as $key=>$post) { - if(strstr($key,"preview")) + if(strstr($key, "preview")) { - // $this -> id = str_replace("preview_", "", $key); - $this -> id = key($post); - $this -> themePreview(); + // $this -> id = str_replace("preview_", "", $key); + $this->id = key($post); + $this->themePreview(); } - if(strstr($key,"selectmain")) + if(strstr($key, "selectmain")) { - // $this -> id = str_replace("selectmain_", "", $key); - $this -> id = key($post); - $this -> setTheme(); + // $this -> id = str_replace("selectmain_", "", $key); + $this->id = key($post); + $this->setTheme(); } - - if(strstr($key,"selectadmin")) + + if(strstr($key, "selectadmin")) { - $this -> id = key($post); - $this -> setAdminTheme(); - $this -> refreshPage('admin'); + $this->id = key($post); + $this->setAdminTheme(); + $this->refreshPage('admin'); } } - + if(isset($_POST['submit_adminstyle'])) { - $this -> id = $_POST['curTheme']; - if($this -> setAdminStyle()) + $this->id = $_POST['curTheme']; + if($this->setAdminStyle()) { eMessage::getInstance()->add(TPVLAN_43, E_MESSAGE_SUCCESS); } e107::getConfig()->save(true); } - + if(isset($_POST['submit_style'])) { - $this -> id = $_POST['curTheme']; + $this->id = $_POST['curTheme']; + + $this->SetCustomPages($_POST['custompages']); + $this->setStyle(); + + e107::getConfig()->save(true); - $this -> SetCustomPages($_POST['custompages']); - $this -> setStyle(); - - e107::getConfig()->save(true); - } - + if(isset($_POST['installplugin'])) { $key = key($_POST['installplugin']); - + include_lan(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_plugin.php"); - require_once(e_HANDLER."plugin_class.php"); - + require_once (e_HANDLER."plugin_class.php"); + $eplug = new e107plugin; - $message = $eplug->install_plugin($key); - $emessage->add($message, E_MESSAGE_SUCCESS); + $message = $eplug->install_plugin($key); + $emessage->add($message, E_MESSAGE_SUCCESS); } - + if(isset($_POST['setMenuPreset'])) { - $key = key($_POST['setMenuPreset']); - include_lan(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_menus.php"); - require_once(e_HANDLER."menumanager_class.php"); + $key = key($_POST['setMenuPreset']); + include_lan(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_menus.php"); + require_once (e_HANDLER."menumanager_class.php"); $men = new e_menuManager(); $men->curLayout = $key; - $men->dbLayout = ($men->curLayout !=$pref['sitetheme_deflayout']) ? $men->curLayout : ""; //menu_layout is left blank when it's default. - + $men->dbLayout = ($men->curLayout != $pref['sitetheme_deflayout']) ? $men->curLayout : ""; //menu_layout is left blank when it's default. + if($areas = $men->menuSetPreset()) { - foreach($areas as $val) + foreach ($areas as $val) { - $ar[$val['menu_location']][] = $val['menu_name']; + $ar[$val['menu_location']][] = $val['menu_name']; } - foreach($ar as $k=>$v) + foreach ($ar as $k=>$v) { - $message .= MENLAN_14." ".$k." : ".implode(", ",$v)."
"; + $message .= MENLAN_14." ".$k." : ".implode(", ", $v)."
"; } - + $emessage->add(MENLAN_43." : ".$key."
".$message, E_MESSAGE_SUCCESS); } - + } - - } + } - function getThemes($mode=FALSE) + + function getThemes($mode = FALSE) { $themeArray = array(); - + $tloop = 1; $handle = opendir(e_THEME); - - while (false !== ($file = readdir($handle))) + + while(false !== ($file = readdir($handle))) { if(($mode == 'xml') && !is_readable(e_THEME.$file."/theme.xml")) { continue; } - if ($file != "." && $file != ".." && $file != "CVS" && $file != "templates" && is_dir(e_THEME.$file) && is_readable(e_THEME.$file."/theme.php") ) - { + if($file != "." && $file != ".." && $file != "CVS" && $file != "templates" && is_dir(e_THEME.$file) && is_readable(e_THEME.$file."/theme.php")) + { if($mode == "id") { $themeArray[$tloop] = $file; @@ -183,277 +186,292 @@ class themeHandler{ $themeArray[$file]['id'] = $tloop; } $tloop++; - } + } } - closedir($handle); - - /* - - echo "
";
-       print_r($themeArray);
-   	 echo "
";*/ + closedir($handle); + + /* + echo "
";
+		 print_r($themeArray);
+		 echo "
";*/ + return $themeArray; } - - - function getThemeInfo($file) + + function getThemeInfo($file) { - $STYLESHEET = FALSE; + $STYLESHEET = FALSE; + + $reject = array('$.', + '$..', + '/', + 'CVS', + 'thumbs.db', + '*._$', + 'index', + 'null*', + 'e_*'); + $handle2 = $this->fl->get_files(e_THEME.$file."/", ".php|.css|.xml|preview.jpg|preview.png", $reject, 1); + foreach ($handle2 as $fln) + { + $file2 = str_replace(e_THEME.$file."/", "", $fln['path']).$fln['fname']; + + $themeArray[$file]['files'][] = $file2; + if(strstr($file2, "preview.")) + { + $themeArray[$file]['preview'] = e_THEME.$file."/".$file2; + } - $reject = array('$.','$..','/','CVS','thumbs.db','*._$', 'index', 'null*','e_*'); - $handle2 = $this->fl->get_files(e_THEME.$file."/", ".php|.css|.xml|preview.jpg|preview.png",$reject,1); - foreach($handle2 as $fln) - { - $file2 = str_replace(e_THEME.$file."/","",$fln['path']).$fln['fname']; + + // ---------------- get information string for css file - $themeArray[$file]['files'][] = $file2; - if(strstr($file2, "preview.")) - { - $themeArray[$file]['preview'] = e_THEME.$file."/".$file2; - } - - - // ---------------- get information string for css file - - - if(strstr($file2, "css") && !strstr($file2, "menu.css") && strpos($file2, "e_") !== 0) - { - - if($fp=fopen(e_THEME.$file."/".$file2, "r")) - { - $cssContents = fread ($fp, filesize(e_THEME.$file."/".$file2)); - fclose($fp); - $nonadmin = preg_match('/\* Non-Admin(.*?)\*\//', $cssContents) ? true : false; - preg_match('/\* info:(.*?)\*\//', $cssContents, $match); - $match[1]=varset($match[1],''); - $themeArray[$file]['css'][] = array("name" => $file2, "info" => $match[1], "nonadmin" => $nonadmin); - if($STYLESHEET) - { - $themeArray[$file]['multipleStylesheets'] = TRUE; - } - else - { - $STYLESHEET = TRUE; - } - } - } - - - - - - } // end while.. - - - // echo "
"; - // closedir($handle2); - - // Load Theme information and merge with existing array. theme.xml (0.8 themes) is given priority over theme.php (0.7). - if(in_array("theme.xml",$themeArray[$file]['files']) ) + + if(strstr($file2, "css") && !strstr($file2, "menu.css") && strpos($file2, "e_") !== 0) + { + + if($fp = fopen(e_THEME.$file."/".$file2, "r")) + { + // FIXME: use info from theme.xml alternateStyleSheet instead + $cssContents = fread($fp, filesize(e_THEME.$file."/".$file2)); + fclose($fp); + $nonadmin = preg_match('/\* Non-Admin(.*?)\*\//', $cssContents) ? true : false; + preg_match('/\* info:(.*?)\*\//', $cssContents, $match); + $match[1] = varset($match[1], ''); + $themeArray[$file]['css'][] = array("name"=>$file2, + "info"=>$match[1], + "nonadmin"=>$nonadmin); + if($STYLESHEET) { - $themeArray[$file] = array_merge($themeArray[$file], $this->parse_theme_xml($file)); - } - elseif(in_array("theme.php",$themeArray[$file]['files'])) + $themeArray[$file]['multipleStylesheets'] = TRUE; + } + else { - $themeArray[$file] = array_merge($themeArray[$file], $this->parse_theme_php($file)); - } + $STYLESHEET = TRUE; + } + } + } + + } // end while.. + + // echo "
"; + // closedir($handle2); + + // Load Theme information and merge with existing array. theme.xml (0.8 themes) is given priority over theme.php (0.7). + if(in_array("theme.xml", $themeArray[$file]['files'])) + { + $themeArray[$file] = array_merge($themeArray[$file], $this->parse_theme_xml($file)); + } + elseif(in_array("theme.php", $themeArray[$file]['files'])) + { + $themeArray[$file] = array_merge($themeArray[$file], $this->parse_theme_php($file)); + } + + return $themeArray[$file]; - return $themeArray[$file]; - - + } - + /** * Validate and return the name of the category * @param object $categoryfromXML - * @return + * @return */ - function getThemeCategory($categoryfromXML='') + function getThemeCategory($categoryfromXML = '') { if(!$categoryfromXML) { - return 'generic'; + return 'generic'; } - $tmp = explode(",",$categoryfromXML); + $tmp = explode(",", $categoryfromXML); $category = array(); - foreach($tmp as $cat) + foreach ($tmp as $cat) { $cat = trim($cat); - if(in_array($cat,$this->allowedCategories)) + if(in_array($cat, $this->allowedCategories)) { $category[] = $cat; } else { - $category[] = 'generic'; + $category[] = 'generic'; } } - - return implode(', ',$category); + + return implode(', ', $category); } - - - + function themeUpload() { - if (!$_POST['ac'] == md5(ADMINPWCHANGE)) { + if(!$_POST['ac'] == md5(ADMINPWCHANGE)) + { exit; } - global $ns, $emessage; + global $ns,$emessage; extract($_FILES); if(!is_writable(e_THEME)) { - // $ns->tablerender(TPVLAN_16, TPVLAN_20); - $emessage->add(TPVLAN_20, E_MESSAGE_INFO); + // $ns->tablerender(TPVLAN_16, TPVLAN_20); + $emessage->add(TPVLAN_20, E_MESSAGE_INFO); return FALSE; } else { - require_once(e_HANDLER."upload_handler.php"); + require_once (e_HANDLER."upload_handler.php"); $fileName = $file_userfile['name'][0]; $fileSize = $file_userfile['size'][0]; $fileType = $file_userfile['type'][0]; - - if(strstr($file_userfile['type'][0], "gzip")) { + + if(strstr($file_userfile['type'][0], "gzip")) + { $fileType = "tar"; - } else if (strstr($file_userfile['type'][0], "zip")) { + } + else + if(strstr($file_userfile['type'][0], "zip")) + { $fileType = "zip"; - } else { + } + else + { $emessage->add(TPVLAN_17, E_MESSAGE_ERROR); - // $ns->tablerender(TPVLAN_16, TPVLAN_17); - // require_once("footer.php"); + // $ns->tablerender(TPVLAN_16, TPVLAN_17); + // require_once("footer.php"); return FALSE; } - - if ($fileSize) { - + + if($fileSize) + { + $uploaded = file_upload(e_THEME); - + $archiveName = $uploaded[0]['name']; - - if($fileType == "zip") { - require_once(e_HANDLER."pclzip.lib.php"); + + if($fileType == "zip") + { + require_once (e_HANDLER."pclzip.lib.php"); $archive = new PclZip(e_THEME.$archiveName); - $unarc = ($fileList = $archive -> extract(PCLZIP_OPT_PATH, e_THEME, PCLZIP_OPT_SET_CHMOD, 0666)); - } else { - require_once(e_HANDLER."pcltar.lib.php"); + $unarc = ($fileList = $archive->extract(PCLZIP_OPT_PATH, e_THEME, PCLZIP_OPT_SET_CHMOD, 0666)); + } + else + { + require_once (e_HANDLER."pcltar.lib.php"); $unarc = ($fileList = PclTarExtract($archiveName, e_THEME)); } - + if(!$unarc) { if($fileType == "zip") { - $error = TPVLAN_46." '".$archive -> errorName(TRUE)."'"; + $error = TPVLAN_46." '".$archive->errorName(TRUE)."'"; } else { $error = TPVLAN_47.PclErrorString().", ".TPVLAN_48.intval(PclErrorCode()); } - + $emessage->add(TPVLAN_18." ".$archiveName." ".$error, E_MESSAGE_ERROR); - // $ns->tablerender(TPVLAN_16, TPVLAN_18." ".$archiveName." ".$error); + // $ns->tablerender(TPVLAN_16, TPVLAN_18." ".$archiveName." ".$error); return FALSE; } - + $folderName = substr($fileList[0]['stored_filename'], 0, (strpos($fileList[0]['stored_filename'], "/"))); $emessage->add(TPVLAN_19, E_MESSAGE_SUCCESS); - + if(varset($_POST['setUploadTheme'])) { $themeArray = $this->getThemes(); $this->id = $themeArray[$folderName]['id']; - $this->setTheme(); - + $this->setTheme(); + } - - // $ns->tablerender(TPVLAN_16, "
".TPVLAN_19."
"); - + + // $ns->tablerender(TPVLAN_16, "
".TPVLAN_19."
"); + @unlink(e_THEME.$archiveName); } } } - - function showThemes($mode='main') + + function showThemes($mode = 'main') { - global $ns, $pref, $emessage; - + global $ns,$pref,$emessage; + echo "
\n"; - - if($mode == "main" || !$mode) // Show Main Configuration + + if($mode == "main" || !$mode) // Show Main Configuration { - foreach($this -> themeArray as $key => $theme) + foreach ($this->themeArray as $key=>$theme) { if($key == $pref['sitetheme']) { - $text = $this -> renderTheme(1, $theme); + $text = $this->renderTheme(1, $theme); } } - - $ns->tablerender(TPVLAN_26." :: ".TPVLAN_33, $emessage->render(). $text); - } - - if($mode == "admin") // Show Admin Configuration + + $ns->tablerender(TPVLAN_26." :: ".TPVLAN_33, $emessage->render().$text); + } + + if($mode == "admin") // Show Admin Configuration { - - foreach($this -> themeArray as $key => $theme) + + foreach ($this->themeArray as $key=>$theme) { if($key == $pref['admintheme']) { - $text = $this -> renderTheme(2, $theme); + $text = $this->renderTheme(2, $theme); } } - $ns->tablerender(TPVLAN_26." :: ".TPVLAN_34, $emessage->render(). $text); - } - - - if($mode == "upload") // Show Upload Form - { - $this -> renderUploadForm(); + $ns->tablerender(TPVLAN_26." :: ".TPVLAN_34, $emessage->render().$text); } + + if($mode == "upload") // Show Upload Form + { + $this->renderUploadForm(); + } - if($mode == "choose") // Show All Themes + + if($mode == "choose") // Show All Themes { $text = ""; - foreach($this -> themeArray as $key => $theme) + foreach ($this->themeArray as $key=>$theme) { - $text .= $this -> renderTheme(FALSE, $theme); + $text .= $this->renderTheme(FALSE, $theme); } - $text .= "
 
"; + $text .= "
 
"; $ns->tablerender(TPVLAN_26." :: ".TPVLAN_39, $emessage->render().$text); } - + echo "
\n
\n"; } - - function renderUploadForm() + + function renderUploadForm() { - global $sql,$ns, $emessage; - - if(!is_writable(e_THEME)) { - $ns->tablerender(TPVLAN_16, TPVLAN_15); - $text = ""; - } - else - { - require_once(e_HANDLER.'upload_handler.php'); - $max_file_size = get_user_max_upload(); - - $text = " + global $sql,$ns,$emessage; + + if(!is_writable(e_THEME)) + { + $ns->tablerender(TPVLAN_16, TPVLAN_15); + $text = ""; + } + else + { + require_once (e_HANDLER.'upload_handler.php'); + $max_file_size = get_user_max_upload(); + + $text = "
@@ -476,215 +494,208 @@ class themeHandler{
"; - - $text .= $this->frm->admin_button('upload', TPVLAN_14, 'submit'); - - $text .= " + + $text .= $this->frm->admin_button('upload', TPVLAN_14, 'submit'); + + $text .= "
\n"; - } - - $ns->tablerender(TPVLAN_26." :: ".TPVLAN_38,$emessage->render(). $text); + } + + $ns->tablerender(TPVLAN_26." :: ".TPVLAN_38, $emessage->render().$text); } - - - - - - function renderThemeInfo($theme) + + function renderThemeInfo($theme) { - + // TO-DO : This SHOULD be loaded by ajax before release. - - global $pref; + + global $pref; $author = ($theme['email'] ? "".$theme['author']."" : $theme['author']); $website = ($theme['website'] ? "".$theme['website']."" : ""); $preview = "".($theme['preview'] ? "" : "").""; - - $text = "
".TPVLAN_7."
+ + $text = "
".TPVLAN_7."
"; - $text .= $author ? "" : ""; + $text .= $author ? "" : ""; $text .= $website ? "" : ""; $text .= $theme['date'] ? "" : ""; - $text .= " + $text .= ""; - - if($theme['layouts']) // New in 0.8 WORK IN PROGRESS ---- + + if($theme['layouts']) // New in 0.8 WORK IN PROGRESS ---- { - $itext .= " + $itext .= ""; } - - $text .= ""; - - $text .= $itext."
".TPVLAN_4.":".$author."
".TPVLAN_4.":".$author."
".TPVLAN_5.":".$website."
".TPVLAN_6.":".$theme['date']."
".TPVLAN_49.":
".TPVLAN_49.": XHTML "; - $text .= ($theme['xhtmlcompliant']) ? ADMIN_TRUE_ICON : ADMIN_FALSE_ICON; + $text .= ($theme['xhtmlcompliant']) ? ADMIN_TRUE_ICON : ADMIN_FALSE_ICON; $text .= "    CSS "; $text .= ($theme['csscompliant']) ? ADMIN_TRUE_ICON : ADMIN_FALSE_ICON; $text .= "
".TPVLAN_50.": "; - $itext .= ($mode == 1) ? "" : ""; - $itext .= " + $itext .= ($mode == 1) ? "" : ""; + $itext .= " \n"; - - foreach($theme['layouts'] as $key=>$val) - { - $itext .= " + + foreach ($theme['layouts'] as $key=>$val) + { + $itext .= " "; if($mode == 1) { if(!$pref['sitetheme_deflayout']) { - $pref['sitetheme_deflayout'] = ($val['@attributes']['default']=='true') ? $key : ""; - // echo "------------- NODEFAULT"; + $pref['sitetheme_deflayout'] = ($val['@attributes']['default'] == 'true') ? $key : ""; + // echo "------------- NODEFAULT"; } $itext .= " "; } - + $itext .= " + $itext .= ($val['menuPresets']) ? ADMIN_TRUE_ICON : " "; + $itext .= ""; } - + $itext .= "
DefaultDefaultTitle Requirements Menu Preset
- + "; $itext .= ($val['@attributes']['previewFull']) ? "" : ""; $itext .= $val['@attributes']['title']; $itext .= ($val['@attributes']['previewFull']) ? "" : ""; - $itext .= ($pref['sitetheme_deflayout'] == $key) ? " (default)" : ""; + $itext .= ($pref['sitetheme_deflayout'] == $key) ? " (default)" : ""; $itext .= " ".$val['@attributes']['plugins']."  "; - $itext .= ($val['menuPresets']) ? ADMIN_TRUE_ICON: " "; - $itext .= "
".TPVLAN_22.": "; - foreach($theme['css'] as $val) + + $text .= "
".TPVLAN_22.": "; + foreach ($theme['css'] as $val) { - $text .= $val['name']."
"; + $text .= $val['name']."
"; } $text .= "
"; - $text .= "
Close
"; - return $text; + + $text .= $itext.""; + $text .= "
Close
"; + return $text; } - - function loadThemeConfig() + + function loadThemeConfig() { $confile = e_THEME.$this->id."/".$this->id."_config.php"; - + if(($this->themeConfigObj === null) && is_readable($confile)) { - - include($confile); - $className = 'theme_'.$this->id; + + include ($confile); + $className = 'theme_'.$this->id; if(class_exists($className)) { $this->themeConfigObj = new $className(); } else { - $this->themeConfigObj = FALSE; + $this->themeConfigObj = FALSE; } - } - + } + } - - - function renderThemeConfig() // process custom theme configuration - TODO. + + function renderThemeConfig() // process custom theme configuration - TODO. { - global $frm; - - $this -> loadThemeConfig(); - - if($this->themeConfigObj) + global $frm; + + $this->loadThemeConfig(); + + if($this->themeConfigObj) + { + $var = call_user_func(array(&$this->themeConfigObj, 'config')); + foreach ($var as $val) { - $var = call_user_func(array(&$this->themeConfigObj, 'config')); - foreach($var as $val) - { - $text .= "".$val['caption'].":".$val['html'].""; - } - return $text; + $text .= "".$val['caption'].":".$val['html'].""; } - + return $text; + } + } - + function renderThemeHelp() { if($this->themeConfigObj) - { + { return call_user_func(array(&$this->themeConfigObj, 'help')); } } - - + function setThemeConfig() { - $this -> loadThemeConfig(); - if($this->themeConfigObj) - { + $this->loadThemeConfig(); + if($this->themeConfigObj) + { return call_user_func(array(&$this->themeConfigObj, 'process')); } } - - function renderTheme($mode=FALSE, $theme) + + function renderTheme($mode = FALSE, $theme) { - + /* - mode = 0 :: normal - mode = 1 :: selected site theme - mode = 2 :: selected admin theme - */ - - global $ns, $pref, $frm; - - + mode = 0 :: normal + mode = 1 :: selected site theme + mode = 2 :: selected admin theme + */ + + global $ns,$pref,$frm; + $author = ($theme['email'] ? "".$theme['author']."" : $theme['author']); $website = ($theme['website'] ? "".$theme['website']."" : ""); $preview = "".($theme['preview'] ? "" : "").""; - + $previewbutton = (!$mode ? " " : ""); + + $main_icon = ($pref['sitetheme'] != $theme['path']) ? "\n" : ADMIN_TRUE_ICON; + $info_icon = "\n"; + $preview_icon = "\n"; + $admin_icon = ($pref['admintheme'] != $theme['path']) ? "\n" : ADMIN_TRUE_ICON; + + $newpreview = "".($theme['preview'] ? "" : "").""; - $main_icon = ($pref['sitetheme'] != $theme['path']) ? "\n" : ADMIN_TRUE_ICON; - $info_icon = "\n"; - $preview_icon = "\n"; - $admin_icon = ($pref['admintheme'] != $theme['path']) ? "\n" : ADMIN_TRUE_ICON; - - $newpreview = "".($theme['preview'] ? "" : "").""; - - + if(!$mode) // Choose a Theme to Install. { // styles NEED to be put into style.css - + $borderStyle = (($pref['sitetheme'] == $theme['path']) || ($pref['admintheme'] == $theme['path'])) ? "border:1px solid black" : "border:1px dotted silver;background-color:#DDDDDD"; - $text = "
+ $text = "
".$newpreview."
".$theme['name']." ".$theme['version']."
\n\n\n".$main_icon.$admin_icon.$info_icon.$preview_icon."\n\n
\n".$this->renderThemeInfo($theme)."
"; - return $text; + return $text; } - - $this->id = $theme['path']; - - $this->loadThemeConfig(); // load customn theme configuration fieldss. - + + $this->id = $theme['path']; + + $this->loadThemeConfig(); // load customn theme configuration fieldss. + $text = "

".$theme['name']."

"; - - if($this->themeConfigObj && call_user_func(array(&$this->themeConfigObj, 'help'))) + + if($this->themeConfigObj && call_user_func(array(&$this->themeConfigObj, 'help'))) { $text .= " "; } - + $text .= "
@@ -706,41 +717,41 @@ class themeHandler{ "; - + $text .= ""; $text .= ""; $text .= ""; - + $text .= ""; $text .= ""; - $text .= " + $text .= ""; - - if($mode == 1) // site theme.. + + if($mode == 1) // site theme.. { - - $text .= " + + $text .= " + + if(varset($theme['plugins'])) + { + foreach ($theme['plugins'] as $key=>$val) + { + $text .= $this->renderPlugins($theme['plugins']); + $text .= " "; + } + } + + $text .= " "; - - $text .= " + + $text .= " "; } - - - if($mode==1) // New in 0.8 ---- site theme. + + if($mode == 1) // New in 0.8 ---- site theme. { - - $itext = " + + $itext = ""; + } + + $itext .= "
".$theme['version']." ".$newpreview."
".TPVLAN_4.":".$author."
".TPVLAN_5.":".$website."
".TPVLAN_6.":".$theme['date']."
".TPVLAN_7.":".$theme['info']."
".LAN_CATEGORY.":".$theme['category']."
".TPVLAN_49.":
".TPVLAN_49.": "; - $text .= ($theme['xhtmlcompliant']) ? "W3C XHTML ".$theme['xhtmlcompliant'] : "Not Specified"; + $text .= ($theme['xhtmlcompliant']) ? "W3C XHTML ".$theme['xhtmlcompliant'] : "Not Specified"; $text .= ($theme['csscompliant']) ? " & CSS ".$theme['csscompliant'] : ""; $text .= "
".TPVLAN_53." "; - - if(varset($theme['plugins'])) - { - foreach($theme['plugins'] as $key=>$val) - { - $text .= $this->renderPlugins($theme['plugins']); - $text .= " "; - } - } - - $text .= " 
".TPVLAN_30." @@ -750,12 +761,11 @@ class themeHandler{
".TPVLAN_50.": @@ -766,96 +776,97 @@ class themeHandler{ "; - $itext .= ($mode == 1) ? "" : ""; - $itext .= " + $itext .= ($mode == 1) ? "" : ""; + $itext .= " \n"; - - foreach($theme['layouts'] as $key=>$val) - { - $itext .= " + + foreach ($theme['layouts'] as $key=>$val) + { + $itext .= " "; - if($mode == 1) - { - if(!$pref['sitetheme_deflayout']) - { - $pref['sitetheme_deflayout'] = ($val['@attributes']['default']=='true') ? $key : ""; - } - $itext .= ""; - } + } + + $itext .= " + + $itext .= ""; - - $itext .= " + $itext .= ($pref['sitetheme_deflayout'] != $key) ? $custompage_diz."
\n" : TPVLAN_55; // Default + + $itext .= ""; + + $itext .= ""; - } - - $itext .= "
".TPVLAN_55."".TPVLAN_55."".TPVLAN_52." ".TPVLAN_56." ".TPVLAN_54."
\n"; - - $itext .= " - + if($mode == 1) + { + if(!$pref['sitetheme_deflayout']) + { + $pref['sitetheme_deflayout'] = ($val['@attributes']['default'] == 'true') ? $key : ""; + } + $itext .= "\n"; + + $itext .= " + "; + $itext .= ($val['@attributes']['previewFull']) ? "" : ""; + $itext .= $val['@attributes']['title']; + $itext .= ($val['@attributes']['previewFull']) ? "" : ""; + + $custompage_count = (isset($pref['sitetheme_custompages'][$key])) ? " [".count($pref['sitetheme_custompages'][$key])."]" : ""; + $custompage_diz = ""; + $count = 1; + if(isset($pref['sitetheme_custompages'][$key]) && count($pref['sitetheme_custompages'][$key]) > 0) + { + foreach ($pref['sitetheme_custompages'][$key] as $cp) + { + $custompage_diz .= "".trim($cp)." "; + if($count > 4) + { + $custompage_diz .= "..."; + break; + } + $count++; + } + } + else + { + $custompage_diz = "None "; + } - $itext .= ""; - $itext .= ($val['@attributes']['previewFull']) ? "" : ""; - $itext .= $val['@attributes']['title']; - $itext .= ($val['@attributes']['previewFull']) ? "" : ""; - - $custompage_count = (isset($pref['sitetheme_custompages'][$key])) ? " [".count($pref['sitetheme_custompages'][$key])."]" : ""; - $custompage_diz = ""; - $count = 1; - if(isset($pref['sitetheme_custompages'][$key]) && count($pref['sitetheme_custompages'][$key]) > 0) - { - foreach($pref['sitetheme_custompages'][$key] as $cp) - { - $custompage_diz .= "".trim($cp)." "; - if($count > 4) - { - $custompage_diz .= "..."; - break; - } - $count++; - } - } - else - { - $custompage_diz = "None "; - } - - - $itext .= " "; - $itext .= ($pref['sitetheme_deflayout'] != $key) ? $custompage_diz."
\n" : TPVLAN_55; // Default - - $itext .= "
"; - - $itext .= (varset($val['menuPresets'])) ? $this->frm->admin_button("setMenuPreset[".$key."]", "Use Preset") : ""; - $itext .= ""; + + $itext .= (varset($val['menuPresets'])) ? $this->frm->admin_button("setMenuPreset[".$key."]", "Use Preset") : ""; + $itext .= "
"; } - - // $itext .= !$mode ? "".TPVLAN_8.":".$previewbutton.$selectmainbutton.$selectadminbutton."" : ""; - + + // $itext .= !$mode ? "".TPVLAN_8.":".$previewbutton.$selectmainbutton.$selectadminbutton."" : ""; + if($mode == 2) { - + $astext = ""; $file = e107::getFile(); - - $adminstyles = $file -> get_files(e_ADMIN."includes"); - - $astext = "\n"; - + + $adminstyles = $file->get_files(e_ADMIN."includes"); + + $astext = "\n"; + $text .= " ".TPVLAN_41.": @@ -864,98 +875,92 @@ class themeHandler{ \n"; } - - - - - $text .= $itext; - + + $text .= $itext; + if(array_key_exists("multipleStylesheets", $theme) && $mode) { $text .= " - ".TPVLAN_22.": + ".TPVLAN_22.": + - \n"; + "; - - - foreach($theme['css'] as $css) + + foreach ($theme['css'] as $css) + { + $text2 = ""; + + if($mode == 1 && substr($css['name'], 0, 6) == "admin_") { - $text2 = ""; - - if($mode == 1 && substr($css['name'],0,6)=="admin_") + continue; + } + + if($mode == 2) + { + if(!$css['nonadmin']) { - continue; - } - - if($mode == 2) - { - if (!$css['nonadmin']) { - $text2 = " + $text2 = " \n"; - } } + } + + if($mode == 1) + { - if($mode == 1) - { - - - $text2 = " + + $text2 = " \n"; - } - - $text .= ($text2) ? "".$text2."" : ""; - } - - $text .= "
".TPVLAN_55." ".TPVLAN_52." ".TPVLAN_7."
".$css['name']." ".($css['info'] ? $css['info'] : ($css['name'] == "style.css" ? TPVLAN_23 : TPVLAN_24))." ".$css['name']." ".($css['info'] ? $css['info'] : ($css['name'] == "style.css" ? TPVLAN_23 : TPVLAN_24))."
"; + + $text .= ($text2) ? "".$text2."" : ""; + + } + + $text .= ""; } - - - - - - if($mode == 1) + + if($mode == 1) { - $text .= $this->renderThemeConfig(); - } - - $text .= " + $text .= $this->renderThemeConfig(); + } + + $text .= "
"; - - if($mode == 2) // admin - { - $mainid = "selectmain[".$theme['id']."]"; - $text .= $this->frm->admin_button('submit_adminstyle', TPVLAN_35, 'update'); - $text .= $this->frm->admin_button($mainid, TPVLAN_10, 'submit'); - - } - else // main - { - $adminid = "selectadmin[".$theme['id']."]"; - $text .= $this->frm->admin_button('submit_style', TPVLAN_35, 'update'); - $text .= $this->frm->admin_button($adminid, TPVLAN_32, 'submit'); - } - - $text .= ""; - - $text .= " + + if($mode == 2) // admin + { + $mainid = "selectmain[".$theme['id']."]"; + $text .= $this->frm->admin_button('submit_adminstyle', TPVLAN_35, 'update'); + $text .= $this->frm->admin_button($mainid, TPVLAN_10, 'submit'); + + } + else // main + { + $adminid = "selectadmin[".$theme['id']."]"; + $text .= $this->frm->admin_button('submit_style', TPVLAN_35, 'update'); + $text .= $this->frm->admin_button($adminid, TPVLAN_32, 'submit'); + } + + $text .= ""; + + $text .= "
@@ -967,59 +972,59 @@ class themeHandler{
\n"; - + return $text; } - - function renderPlugins($pluginOpts) + + function renderPlugins($pluginOpts) { global $frm,$sql; - - $tmp = (varset($pluginOpts['plugin'][1])) ? $pluginOpts['plugin'] : $pluginOpts; // if there is 1 entry, then it's not the same array. - $text = ""; - - foreach($tmp as $p) + + $tmp = (varset($pluginOpts['plugin'][1])) ? $pluginOpts['plugin'] : $pluginOpts; // if there is 1 entry, then it's not the same array. + $text = ""; + + foreach ($tmp as $p) { $plug = trim($p['@attributes']['name']); - - if(plugInstalled($plug)) + + if(plugInstalled($plug)) { - $text .= $plug." ".ADMIN_TRUE_ICON; + $text .= $plug." ".ADMIN_TRUE_ICON; } else { - // echo $plug; - if($sql -> db_Select("plugin", "plugin_id", " plugin_path = '".$plug."' LIMIT 1 ")) - { - $row = $sql -> db_Fetch(MYSQL_ASSOC); + // echo $plug; + if($sql->db_Select("plugin", "plugin_id", " plugin_path = '".$plug."' LIMIT 1 ")) + { + $row = $sql->db_Fetch(MYSQL_ASSOC); $name = "installplugin[".$row['plugin_id']."]"; - $text .= $this->frm->admin_button($name, ADLAN_121." ".$plug."",'delete'); + $text .= $this->frm->admin_button($name, ADLAN_121." ".$plug."", 'delete'); } else { - $text .= (varset($p['@attributes']['url']) && ($p['@attributes']['url']!='core')) ? "".$plug." " : "".$plug.""; + $text .= (varset($p['@attributes']['url']) && ($p['@attributes']['url'] != 'core')) ? "".$plug." " : "".$plug.""; $text .= ADMIN_FALSE_ICON; } - + } - $text .= "   "; + $text .= "   "; } - - return $text; + + return $text; } - - function refreshPage($page=e_QUERY) + + function refreshPage($page = e_QUERY ) { - header("Location: ".e_SELF."?".$page); - exit; - } - - function themePreview() - { - echo "\n"; + header("Location: ".e_SELF."?".$page); exit; } - + + function themePreview() + { + echo "\n"; + exit; + } + function showPreview() { include_lan(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_theme.php"); @@ -1028,156 +1033,157 @@ class themeHandler{ $ns->tablerender(TPVLAN_2, $text); } - + /** - * Set Theme as Main Theme. - * @param object $name [optional] name (folder) of the theme to set. - * @return + * Set Theme as Main Theme. + * @param object $name [optional] name (folder) of the theme to set. + * @return */ - function setTheme($name='') + function setTheme($name = '') { $core = e107::getConfig('core'); - $sql = e107::getDb(); + $sql = e107::getDb(); $emessage = eMessage::getInstance(); - $themeArray = $this -> getThemes("id"); - - $name = ($name) ? $name : $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']; + $themeArray = $this->getThemes("id"); - $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']); + $name = ($name) ? $name : $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 !='' "); - $sql -> db_Delete("menus", "menu_layout !='' "); - ecache::clear_sys(); - if($core->save()) + if($core->save()) { //TODO LANs - $emessage->add(TPVLAN_3." '".$name." v".$version."'", E_MESSAGE_SUCCESS); - $emessage->add("Default Layout: ".$deflayout,E_MESSAGE_SUCCESS); - $emessage->add("Custom Pages: ".$customPages,E_MESSAGE_SUCCESS); + $emessage->add(TPVLAN_3." '".$name." v".$version."'", E_MESSAGE_SUCCESS); + $emessage->add("Default Layout: ".$deflayout, E_MESSAGE_SUCCESS); + $emessage->add("Custom Pages: ".$customPages, E_MESSAGE_SUCCESS); - $this->theme_adminlog('01',$name.', style.css'); + $this->theme_adminlog('01', $name.', style.css'); return TRUE; } else { - $emessage->add(TPVLAN_3." '".$name."'", E_MESSAGE_ERROR); + $emessage->add(TPVLAN_3." '".$name."'", E_MESSAGE_ERROR); return FALSE; } } - + function findDefault($theme) { if(varset($_POST['layout_default'])) { - return $_POST['layout_default']; + return $_POST['layout_default']; } - - $l = $this->themeArray[$theme]; - + + $l = $this->themeArray[$theme]; + if(!$l) { - $l = $this->getThemeInfo($theme); + $l = $this->getThemeInfo($theme); } - + if($l['layouts']) { - foreach($l['layouts'] as $key=>$val) + foreach ($l['layouts'] as $key=>$val) { - if(isset($val['@attributes']['default']) && ($val['@attributes']['default'] == "true")) + if(isset($val['@attributes']['default']) && ($val['@attributes']['default'] == "true")) { - return $key; + return $key; } } } else { - return ""; + return ""; } } - + function setAdminTheme() { - global $pref, $e107cache, $ns, $emessage; - $themeArray = $this -> getThemes("id"); - $pref['admintheme'] = $themeArray[$this -> id]; + global $pref,$e107cache,$ns,$emessage; + $themeArray = $this->getThemes("id"); + $pref['admintheme'] = $themeArray[$this->id]; $pref['admincss'] = file_exists(e_THEME.$pref['admintheme'].'/admin_style.css') ? 'admin_style.css' : 'style.css'; $e107cache->clear_sys(); if(save_prefs()) { - $emessage->add(TPVLAN_40." '".$themeArray[$this -> id]."'", E_MESSAGE_SUCCESS); // Default Message - $this->theme_adminlog('02',$pref['admintheme'].', '.$pref['admincss']); + $emessage->add(TPVLAN_40." '".$themeArray[$this->id]."'", E_MESSAGE_SUCCESS); // Default Message + $this->theme_adminlog('02', $pref['admintheme'].', '.$pref['admincss']); } - - // $ns->tablerender("Admin Message", "
".TPVLAN_40." '".$themeArray[$this -> id]."'.

"); - // $this->showThemes('admin'); + + // $ns->tablerender("Admin Message", "
".TPVLAN_40." '".$themeArray[$this -> id]."'.

"); + // $this->showThemes('admin'); } - + function setStyle() { - global $pref, $e107cache, $ns, $sql, $emessage; + global $pref,$e107cache,$ns,$sql,$emessage; //TODO adminlog - e107::getConfig()->setPosted('themecss', $_POST['themecss']) - ->setPosted('image_preload', $_POST['image_preload']) - ->setPosted('sitetheme_deflayout', $_POST['layout_default']); - + e107::getConfig()->setPosted('themecss', $_POST['themecss'])->setPosted('image_preload', $_POST['image_preload'])->setPosted('sitetheme_deflayout', + $_POST['layout_default']); + $msg = $this->setThemeConfig(); if($msg) { - $emessage->add(TPVLAN_37, E_MESSAGE_SUCCESS); + $emessage->add(TPVLAN_37, E_MESSAGE_SUCCESS); if(is_array($msg)) - $emessage->add($msg[0], $msg[1]); + $emessage->add($msg[0], $msg[1]); } } - + function setAdminStyle() { - global $pref, $e107cache, $ns, $emessage; + global $pref,$e107cache,$ns,$emessage; /*$pref['admincss'] = $_POST['admincss']; - $pref['adminstyle'] = $_POST['adminstyle']; + $pref['adminstyle'] = $_POST['adminstyle']; + $e107cache->clear_sys(); + if(save_prefs()) + { + $emessage->add(TPVLAN_43, E_MESSAGE_SUCCESS); + $this->theme_adminlog('04',$pref['adminstyle'].', '.$pref['admincss']); + } + else + { + $emessage->add(TPVLAN_43, E_MESSAGE_ERROR); + }*/ - - $e107cache->clear_sys(); - if(save_prefs()) - { - $emessage->add(TPVLAN_43, E_MESSAGE_SUCCESS); - $this->theme_adminlog('04',$pref['adminstyle'].', '.$pref['admincss']); - } - else - { - $emessage->add(TPVLAN_43, E_MESSAGE_ERROR); - }*/ + //TODO adminlog - e107::getConfig()->setPosted('admincss', $_POST['admincss']) - ->setPosted('adminstyle', $_POST['adminstyle']); - + e107::getConfig()->setPosted('admincss', $_POST['admincss'])->setPosted('adminstyle', $_POST['adminstyle']); + return (e107::getConfig()->dataHasChangedFor('admincss') || e107::getConfig()->dataHasChangedFor('adminstyle')); } - - function SetCustomPages($array) + + function SetCustomPages($array) { - if(!is_array($array)){ return; } - + if(!is_array($array)) + { + return; + } + //global $pref; $key = key($array); //['sitetheme_custompages'] $array[$key] = trim(str_replace("\r\n", "\n", $array[$key])); $newprefs[$key] = array_filter(explode("\n", $array[$key])); $newprefs[$key] = array_unique($newprefs[$key]); - + if(e107::getPref('sitetheme_deflayout') == 'legacyCustom') { $newprefs['legacyCustom'] = array(); @@ -1186,146 +1192,152 @@ class themeHandler{ e107::getConfig()->set('sitetheme_custompages', e107::getParser()->toDB($newprefs)); } - + // Log event to admin log - function theme_adminlog($msg_num='00', $woffle='') + function theme_adminlog($msg_num = '00', $woffle = '') { if($this->noLog) { return; } - global $pref, $admin_log; + global $pref,$admin_log; // if (!varset($pref['admin_log_log']['admin_banlist'],0)) return; - $admin_log->log_event('THEME_'.$msg_num,$woffle,E_LOG_INFORMATIVE,''); + $admin_log->log_event('THEME_'.$msg_num, $woffle, E_LOG_INFORMATIVE, ''); } - + function parse_theme_php($path) { - $CUSTOMPAGES = ""; - - $fp=fopen(e_THEME.$path."/theme.php", "r"); - $themeContents = fread ($fp, filesize(e_THEME.$path."/theme.php")); + $CUSTOMPAGES = ""; + + $fp = fopen(e_THEME.$path."/theme.php", "r"); + $themeContents = fread($fp, filesize(e_THEME.$path."/theme.php")); fclose($fp); - + preg_match('/themename(\s*?=\s*?)("|\')(.*?)("|\');/si', $themeContents, $match); - $themeArray['name'] = varset($match[3],''); + $themeArray['name'] = varset($match[3], ''); preg_match('/themeversion(\s*?=\s*?)("|\')(.*?)("|\');/si', $themeContents, $match); - $themeArray['version'] = varset($match[3],''); + $themeArray['version'] = varset($match[3], ''); preg_match('/themeauthor(\s*?=\s*?)("|\')(.*?)("|\');/si', $themeContents, $match); - $themeArray['author'] = varset($match[3],''); + $themeArray['author'] = varset($match[3], ''); preg_match('/themeemail(\s*?=\s*?)("|\')(.*?)("|\');/si', $themeContents, $match); - $themeArray['email'] = varset($match[3],''); + $themeArray['email'] = varset($match[3], ''); preg_match('/themewebsite(\s*?=\s*?)("|\')(.*?)("|\');/si', $themeContents, $match); - $themeArray['website'] = varset($match[3],''); + $themeArray['website'] = varset($match[3], ''); preg_match('/themedate(\s*?=\s*?)("|\')(.*?)("|\');/si', $themeContents, $match); - $themeArray['date'] = varset($match[3],''); + $themeArray['date'] = varset($match[3], ''); preg_match('/themeinfo(\s*?=\s*?)("|\')(.*?)("|\');/si', $themeContents, $match); - $themeArray['info'] = varset($match[3],''); - preg_match('/xhtmlcompliant(\s*?=\s*?)(\S*?);/si', $themeContents, $match); + $themeArray['info'] = varset($match[3], ''); + preg_match('/xhtmlcompliant(\s*?=\s*?)(\S*?);/si', $themeContents, $match); $xhtml = strtolower($match[2]); $themeArray['xhtmlcompliant'] = ($xhtml == "true" ? "1.1" : false); - + preg_match('/csscompliant(\s*?=\s*?)(\S*?);/si', $themeContents, $match); $css = strtolower($match[2]); $themeArray['csscompliant'] = ($css == "true" ? "2.1" : false); - -/* preg_match('/CUSTOMPAGES(\s*?=\s*?)("|\')(.*?)("|\');/si', $themeContents, $match); - $themeArray['custompages'] = array_filter(explode(" ",$match[3]));*/ - - $themeContentsArray = explode("\n",$themeContents); - - if (!$themeArray['name']) + + /* preg_match('/CUSTOMPAGES(\s*?=\s*?)("|\')(.*?)("|\');/si', $themeContents, $match); + $themeArray['custompages'] = array_filter(explode(" ",$match[3]));*/ + + $themeContentsArray = explode("\n", $themeContents); + + if(!$themeArray['name']) { unset($themeArray); } - - $lays['legacyDefault']['@attributes'] = array('title'=>'Default','preview'=>'','previewFull'=>'','plugins'=>'', 'default'=>'true'); - - if(!file_exists(e_THEME.$path."theme.xml")) // load custompages from theme.php only when theme.xml doesn't exist. + + $lays['legacyDefault']['@attributes'] = array('title'=>'Default', + 'preview'=>'', + 'previewFull'=>'', + 'plugins'=>'', + 'default'=>'true'); + + if(!file_exists(e_THEME.$path."theme.xml")) // load custompages from theme.php only when theme.xml doesn't exist. { - foreach($themeContentsArray as $line) + foreach ($themeContentsArray as $line) { - if(strstr($line,"CUSTOMPAGES")) + if(strstr($line, "CUSTOMPAGES")) { - eval(str_replace("$","\$",$line)); + eval(str_replace("$", "\$", $line)); } } - if(is_array($CUSTOMPAGES)) + if(is_array($CUSTOMPAGES)) { - foreach($CUSTOMPAGES as $key=>$val) - { - $themeArray['custompages'][$key] = explode(" ",$val); - } + foreach ($CUSTOMPAGES as $key=>$val) + { + $themeArray['custompages'][$key] = explode(" ", $val); + } } elseif($CUSTOMPAGES) { - $themeArray['custompages']['legacyCustom'] = explode(" ",$CUSTOMPAGES); - $lays['legacyCustom']['@attributes'] = array('title'=>'Custom','preview'=>'','previewFull'=>'','plugins'=>''); + $themeArray['custompages']['legacyCustom'] = explode(" ", $CUSTOMPAGES); + $lays['legacyCustom']['@attributes'] = array('title'=>'Custom', + 'preview'=>'', + 'previewFull'=>'', + 'plugins'=>''); } } - + $themeArray['path'] = $path; $themeArray['layouts'] = $lays; - - return $themeArray; + + return $themeArray; } - - function parse_theme_xml($path) + + function parse_theme_xml($path) { global $tp; - // loadLanFiles($path, 'admin'); // Look for LAN files on default paths - require_once(e_HANDLER.'xml_class.php'); + // loadLanFiles($path, 'admin'); // Look for LAN files on default paths + require_once (e_HANDLER.'xml_class.php'); $xml = new xmlClass; $xml->setOptArrayTags('layout'); // layout should always be an array. - $xml->setOptStringTags('menuPresets,customPages'); + $xml->setOptStringTags('menuPresets,customPages'); $vars = $xml->loadXMLfile(e_THEME.$path.'/theme.xml', true, true); - - $vars['name'] = varset($vars['@attributes']['name']); - $vars['version'] = varset($vars['@attributes']['version']); - $vars['date'] = varset($vars['@attributes']['date']); - $vars['compatibility'] = varset($vars['@attributes']['compatibility']); - $vars['releaseUrl'] = varset($vars['@attributes']['releaseUrl']); - $vars['email'] = varset($vars['author']['@attributes']['email']); - $vars['website'] = varset($vars['author']['@attributes']['url']); - $vars['author'] = varset($vars['author']['@attributes']['name']); - $vars['info'] = varset($vars['description']); - $vars['category'] = $this->getThemeCategory(varset($vars['category'])); - $vars['xhtmlcompliant'] = varset($vars['compliance']['@attributes']['xhtml']); - $vars['csscompliant'] = varset($vars['compliance']['@attributes']['css']); - $vars['path'] = $path; + + $vars['name'] = varset($vars['@attributes']['name']); + $vars['version'] = varset($vars['@attributes']['version']); + $vars['date'] = varset($vars['@attributes']['date']); + $vars['compatibility'] = varset($vars['@attributes']['compatibility']); + $vars['releaseUrl'] = varset($vars['@attributes']['releaseUrl']); + $vars['email'] = varset($vars['author']['@attributes']['email']); + $vars['website'] = varset($vars['author']['@attributes']['url']); + $vars['author'] = varset($vars['author']['@attributes']['name']); + $vars['info'] = varset($vars['description']); + $vars['category'] = $this->getThemeCategory(varset($vars['category'])); + $vars['xhtmlcompliant'] = varset($vars['compliance']['@attributes']['xhtml']); + $vars['csscompliant'] = varset($vars['compliance']['@attributes']['css']); + $vars['path'] = $path; $vars['@attributes']['default'] = (varset($vars['@attributes']['default']) && strtolower($vars['@attributes']['default']) == 'true') ? 1 : 0; - - unset($vars['authorEmail'],$vars['authorUrl'],$vars['xhtmlCompliant'],$vars['cssCompliant'],$vars['description']); - + + unset($vars['authorEmail'], $vars['authorUrl'], $vars['xhtmlCompliant'], $vars['cssCompliant'], $vars['description']); + // Compile layout information into a more usable format. - - - $custom = array(); - - foreach($vars['layouts'] as $layout) + + $custom = array(); + + foreach ($vars['layouts'] as $layout) { - foreach($layout as $key=>$val) + foreach ($layout as $key=>$val) { $name = $val['@attributes']['name']; unset($val['@attributes']['name']); $lays[$name] = $val; if(isset($val['customPages'])) { - $custom[$name] = array_filter(explode(" ",$val['customPages'])); + $custom[$name] = array_filter(explode(" ", $val['customPages'])); } } - } - - $vars['layouts'] = $lays; - $vars['path'] = $path; + } + + $vars['layouts'] = $lays; + $vars['path'] = $path; $vars['custompages'] = $custom; - - return $vars; + + return $vars; } - + } interface e_theme_config @@ -1335,16 +1347,16 @@ interface e_theme_config * Catch and save theme configuration */ public function process(); - + /** * Theme configuration user interface - * Print out config fields + * Print out config fields */ public function config(); /** * Theme help tab - * Print out theme help content + * Print out theme help content */ public function help(); }