refreshTime = DEFAULT_REFRESH_TIME;
}
function __destruct() {
}
function menu(){}
function printView($cleared = false, $dataType = "html") {
global $db, $OGPLangPre;
if ( is_object($db) && array_key_exists( "OGPDatabase", class_parents($db) ) ) {
$panel_settings = $db->getSettings();
}
// Our global CSS goes first so that themes can override
$this->header_code = '' . "\n";
if(function_exists("getThemePath")){
$path = getThemePath();
}else{
$path = 'themes/Revolution/';
}
$page = file_get_contents($path.'layout.html');
@$top = file_get_contents($path.'top.html');
@$bottom = file_get_contents($path.'bottom.html');
@$topbody = file_get_contents($path.'topbody.html');
@$botbody = file_get_contents($path.'botbody.html');
if ( isset($panel_settings['logo_link']) &&
!empty($panel_settings['logo_link']))
$this->logo = $panel_settings['logo_link'];
if ( isset($panel_settings['bg_wrapper']) &&
!empty($panel_settings['bg_wrapper']))
$this->bg_wrapper = $panel_settings['bg_wrapper'];
if ( isset($panel_settings['time_zone']) &&
!empty($panel_settings['time_zone']))
{
$this->time_zone = $panel_settings['time_zone'];
ini_set('date.timezone', $panel_settings['time_zone']);
}
if ( isset($panel_settings['panel_name']) &&
!empty($panel_settings['panel_name']))
$this->title = $panel_settings['panel_name'];
if ( isset($panel_settings['header_code']) &&
!empty($panel_settings['header_code']))
$this->header_code .= $panel_settings['header_code']."\n";
$module_name = isset($_GET['m']) ? get_lang($_GET['m']) : "";
$page_name = isset($_GET['p']) ? get_lang($_GET['p']) : "";
$title = $page_name == "" ? $module_name : "$module_name - $page_name";
$title = str_replace("_", " ", $title);
$this->title = $title == "" ? $this->title : $this->title . " [$title]";
// Dump defined constants to json (for language javascript)
$jsonStrConsts = getOGPLangConstantsJSON();
if($jsonStrConsts !== false){
$this->header_code .= '' . "\n";
}
// Include jQuery, jQuery UI, and our global CSS file in the header code
$stylesheet = '' . "\n";
$javascript = '' . "\n" .
'' . "\n";
// Include magnific popup
$javascript .= '' . "\n";
$stylesheet .= '' . "\n";
// Include tablesorter, table collapse, and quick search
$javascript .= '' . "\n" .
'' . "\n" .
'' . "\n";
// Include our global JS
$javascript .= '' . "\n";
// Set some useful variables
$javascript .= '' . "\n";
// Include global JS for modules
if(is_object($db) && array_key_exists("OGPDatabase", class_parents($db))){
foreach($db->getInstalledModules() as $m)
{
$global_js_file = 'js/' . MODULES . "{$m['folder']}_global.js";
if(is_readable($path . $global_js_file)) // Priority to the theme's js
$javascript .= "\n";
elseif(is_readable($global_js_file))
$javascript .= "\n";
}
}
// Include CSS and JS for the current module page
if(isset($_GET['m']) and !empty($_GET['m']))
{
$subpage = (isset($_GET['p']) and !empty($_GET['p']))?$_GET['p']:$_GET['m'];
$fc = array(
$path . MODULES . "{$_GET['m']}/{$subpage}.css",
$path . MODULES . "{$_GET['m']}/{$_GET['m']}.css",
MODULES . "{$_GET['m']}/{$subpage}.css",
MODULES . "{$_GET['m']}/{$_GET['m']}.css"
);
foreach ((array)$fc as $file_check){
if(is_readable($file_check)){
$stylesheet .= "\n";
break;
}
}
$fc = array(
$path . MODULES . "{$_GET['m']}/{$subpage}.js",
$path . MODULES . "{$_GET['m']}/{$_GET['m']}.js"
);
foreach ((array)$fc as $file_check){
if(is_readable($file_check)){
$javascript .= "\n";
break;
}
}
}
$this->header_code .= $stylesheet.$javascript;
$buffer = ob_get_contents();
ob_end_clean();
if ( !empty($this->refreshUrl) )
{
if ( $panel_settings['page_auto_refresh'] == "1" )
{
$topbody .= "
";
$this->meta .= "";
}
else
{
$topbody .= "";
}
}
$footer = "";
if ( is_object($db) && array_key_exists( "OGPDatabase", class_parents($db) ) ) {
$footer .= "";
}
else
{
$footer .= "";
}
// Add our magnific popup holder to the page (hidden element):
$footer .= '';
// GSP version descriptor (reads version.json written by the update system)
$gsp_vfile = dirname(__FILE__) . '/../version.json';
if (file_exists($gsp_vfile)) {
$gsp_vdata = json_decode(file_get_contents($gsp_vfile), true);
if (is_array($gsp_vdata)) {
$_vtype = $gsp_vdata['installed_type'] ?? 'unknown';
$_vsource = $gsp_vdata['installed_source'] ?? '';
$_vcommit = $gsp_vdata['installed_commit'] ?? '';
if ($_vtype === 'cutting-edge') $type_label = 'Cutting Edge';
elseif ($_vtype === 'development') $type_label = 'Development';
elseif ($_vtype === 'release') $type_label = 'Release';
else $type_label = 'Unknown';
$_vdesc = 'GSP Panel: ' . $type_label;
if ($_vsource) $_vdesc .= ' - ' . htmlspecialchars($_vsource);
if ($_vcommit) $_vdesc .= ' - commit ' . htmlspecialchars(substr($_vcommit, 0, 7));
} else {
$_vdesc = 'GSP Panel: Unknown Version';
}
} else {
$_vdesc = 'GSP Panel: Unknown Version';
}
$footer .= '';
if (!isset($_GET['action']))
{
$filename = 'install.php';
if ( !empty($_SESSION['users_theme']) ) $theme = $_SESSION['users_theme'];
else $theme = $panel_settings['theme'];
// Attempt to automatically delete the install file only if an admin user has already been created and exists
if(is_object($db)){
$admins = $db->getAdmins();
if (is_readable($filename) && is_array($admins) && !empty($admins)) {
unlink($filename);
}
}
if (is_readable($filename))
{
if (is_readable($filename) AND $theme == "Modern")
{
$top = "".get_lang('remove_install')."
".$top;
}
else
{
$topbody = "".get_lang('remove_install')."
".$topbody;
}
}
}
if ( isset($panel_settings['maintenance_mode']) && $panel_settings['maintenance_mode'] == "1" )
{
if ( !empty($_SESSION['users_theme']) ) $theme = $_SESSION['users_theme'];
else $theme = $panel_settings['theme'];
if (@$_SESSION['users_group'] == "admin" AND $theme == "Modern")
{
$top = "".get_lang('maintenance_mode_on')."!
".$top;
}
elseif (@$_SESSION['users_group'] == "admin")
{
$topbody = "".get_lang('maintenance_mode_on')."!
".$topbody;
}
}
if($cleared){
$page = $buffer;
}
else
{
$page = str_replace("%meta%",$this->meta,$page);
$top = str_replace("%logo%",$this->logo,$top);
$topbody = str_replace("%bg_wrapper%",$this->bg_wrapper,$topbody);
if ( !empty($_SESSION['users_theme']) )
$theme = $_SESSION['users_theme'];
else
$theme = @$panel_settings['theme'];
$page = str_replace("%bg_wrapper%",$this->bg_wrapper,$page);
$page = str_replace("%title%",$this->title,$page);
$page = str_replace("%header_code%",$this->header_code,$page);
$page = str_replace("%charset%",$this->charset,$page);
$page = str_replace("%body%",$buffer,$page);
$page = str_replace("%top%",(string)$top,$page);
$page = str_replace("%topbody%",(string)$topbody,$page);
$page = str_replace("%botbody%",(string)$botbody,$page);
$page = str_replace("%bottom%",(string)$bottom,$page);
$page = str_replace("%footer%",(string)($footer ?? ''),$page);
$page = str_replace("%notifications%",(string)($notifications ?? ''),$page);
}
// Set the content-type header as this is needed by older browsers
if($dataType == "html"){
header("Content-type: text/html; charset=" . $this->charset);
}else if($dataType == "json"){
header("Content-type: application/json; charset=" . $this->charset);
}
// Print everything for the template.
print $page;
}
function refresh($url,$time = "")
{
if ( !empty($time) || $time === 0 )
$this->refreshTime = $time;
$this->refreshUrl = $url;
}
function setTitle($title)
{
$this->title = $title;
}
function setCharset($charset)
{
$this->charset = $charset;
ini_set('default_charset', $charset);
}
function setTimeZone($time_zone)
{
$time_zone = (!isset($time_zone) or $time_zone == "") ? "America/Chicago" : $time_zone;
$this->time_zone = $time_zone;
ini_set('date.timezone', $time_zone);
$_SESSION['time_zone'] = $time_zone;
}
}
?>