";
- 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 = "
";
-
- if($this->themeConfigObj && call_user_func(array(&$this->themeConfigObj, 'help')))
+
+ if($this->themeConfigObj && call_user_func(array(&$this->themeConfigObj, 'help')))
{
$text .= "
";
}
-
+
$text .= "
";
}
-
- // $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.": |
+
|
";
+
+ $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();
}