frm = new e_form(); //enable inner tabindex counter
require_once(e_HANDLER."file_class.php");
$this->fl = new e_file;
if (isset($_POST['upload']))
{
$this -> themeUpload();
}
$this -> themeArray = $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'];
$this -> setAdminStyle();
}
if(isset($_POST['submit_style']))
{
$this -> id = $_POST['curTheme'];
$this -> setStyle();
$this -> SetCustomPages($_POST['custompages']);
}
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;
$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)
{
$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 ($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
\n".$this->renderThemeInfo($theme)."
";
return $text;
}
$this->id = $theme['path'];
$this->loadThemeConfig(); // load customn theme configuration fieldss.
$text = "
";
if(call_user_method("help",$this->themeConfigObj))
{
$text .= "
";
}
$text .= "
".$this->renderThemeHelp()."
\n";
return $text;
}
function renderPlugins($pluginOptions)
{
global $frm,$sql;
$tmp = (varset($pluginOptions['plugin'][1])) ? $pluginOptions['plugin'] : $pluginOptions; // 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))
{
$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.".