frm = new e_form();
$this->fl = e107::getFile();
if(isset($_POST['upload']))
{
$this->themeUpload();
}
$this->themeArray = (defined('E107_INSTALL')) ? $this->getThemes('xml') : $this->getThemes();
// print_a($this -> themeArray);
foreach ($_POST as $key=>$post)
{
if(strstr($key, "preview"))
{
// $this -> id = str_replace("preview_", "", $key);
$this->id = key($post);
$this->themePreview();
}
if(strstr($key, "selectmain"))
{
// $this -> id = str_replace("selectmain_", "", $key);
$this->id = key($post);
$this->setTheme();
}
if(strstr($key, "selectadmin"))
{
$this->id = key($post);
$this->setAdminTheme();
$this->refreshPage('admin');
}
}
if(isset($_POST['submit_adminstyle']))
{
$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->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");
$eplug = new e107plugin;
$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");
$men = new e_menuManager();
$men->curLayout = $key;
//menu_layout is left blank when it's default.
$men->dbLayout = ($men->curLayout != $pref['sitetheme_deflayout']) ? $men->curLayout : "";
if($areas = $men->menuSetPreset())
{
foreach ($areas as $val)
{
$ar[$val['menu_location']][] = $val['menu_name'];
}
foreach ($ar as $k=>$v)
{
$message .= MENLAN_14." ".$k." : ".implode(", ", $v)."
";
}
$emessage->add(MENLAN_43." : ".$key."
".$message, E_MESSAGE_SUCCESS);
}
}
}
function getThemes($mode = FALSE)
{
$themeArray = array();
$tloop = 1;
$handle = opendir(e_THEME);
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($mode == "id")
{
$themeArray[$tloop] = $file;
}
else
{
$themeArray[$file] = $this->getThemeInfo($file);
$themeArray[$file]['id'] = $tloop;
}
$tloop++;
}
}
closedir($handle);
/*
echo "
".$newpreview."
".$theme['name']." ".$theme['version']."
\n\n\n".$main_icon.$admin_icon.$info_icon.$preview_icon."\n\n
";
//FIXME e-hideme doesn't work when JS is turned off.
// This popup information should be loaded with ajax.
// $text .= "
\n".$this->renderThemeInfo($theme)."
\n";
$text .= "
";
return $text;
}
$this->id = $theme['path'];
// load customn theme configuration fields.
$this->loadThemeConfig();
$text = "
";
if($this->themeConfigObj && call_user_func(array(&$this->themeConfigObj, 'help')))
{
$text .= "
";
}
$text .= "
".$this->renderThemeHelp()."
\n";
return $text;
}
function renderPlugins($pluginOpts)
{
global $frm,$sql;
// if there is 1 entry, then it's not the same array.
$tmp = (varset($pluginOpts['plugin'][1])) ? $pluginOpts['plugin'] : $pluginOpts;
$text = "";
foreach ($tmp as $p)
{
$plug = trim($p['@attributes']['name']);
if(plugInstalled($plug))
{
$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);
$name = "installplugin[".$row['plugin_id']."]";
$text .= $this->frm->admin_button($name, ADLAN_121." ".$plug."", 'delete');
}
else
{
$text .= (varset($p['@attributes']['url']) && ($p['@attributes']['url'] != 'core')) ? "".TPVLAN_1.".