public function content() { global $dbh, $postvar, $getvar, $instance; $version_info = main::latest_version(); $current_version = $version_info['THT']; $new_version_download = $version_info['THT_DL']; $running_version = $dbh->config('version'); $install_check = $this->checkDir(INC . "../install/"); $conf_check = $this->checkPerms(INC . "/conf.inc.php"); if ($current_version == $running_version) { $updatemsg = "<span style='color:green'>Up-To-Date</span>"; $upgrademsg = ""; } else { $updatemsg = "<span style='color:red'>Upgrade Avaliable</span>"; $upgrademsg = "<div class='warn'><img src='../themes/icons/error.png' alt='' /> There is a new version ({$current_version}) avaliable! <a href = '" . $new_version_download . "' target = '_blank'>Please download it here</a> and upgrade!</div>"; } unset($current_version); unset($running_version); $stats['VERSION'] = $dbh->config('version'); $stats['THEME'] = $dbh->config('theme'); $stats['CENABLED'] = main::cleaninteger($dbh->config('cenabled')); $stats['SVID'] = main::cleaninteger($dbh->config('show_version_id')); $stats['SENABLED'] = main::cleaninteger($dbh->config('senabled')); $stats['DEFAULT'] = $dbh->config('default_page'); $stats['EMETHOD'] = $dbh->config('emailmethod'); $stats['SIGNENABLE'] = main::cleaninteger($dbh->config('general')); $stats['MULTI'] = main::cleaninteger($dbh->config('multiple')); $stats['UPDATE'] = $updatemsg; $stats['UPG_BOX'] = $upgrademsg; $stats_box = style::replaceVar('tpl/admin/home/stats.tpl', $stats); $content = '<strong>Welcome to your Admin Dashboard!</strong><br />Welcome to the dashboard of your Admin Control Panel. In this area you can do the tasks that you need to complete such as manage servers, create packages, manage users.<br /> Here, you can also change the look and feel of your THT Installation. If you require any help, be sure to ask at the <a href="http://thehostingtool.com/forum" title="THT Community is the official stop for THT Support, THT Modules, Developer Center and more! Visit our growing community now!" class="tooltip">THT Community</a><br /><br />' . $stats_box . '<br />' . $install_check . $conf_check . '</div></div>'; echo $content; if ($_POST) { $dbh->update("admin_notes", array("notes" => $postvar['admin_notes']), array("id", "=", "1")); main::errors("Settings Updated!"); main::done(); } $notes_data = $dbh->select("admin_notes", array("id", "=", "1")); $notepad_array['NOTEPAD'] = $notes_data['notes']; $content_notepad = style::replaceVar('tpl/admin/home/notepad.tpl', $notepad_array); echo '<br />'; echo main::table('Admin Notepad', $content_notepad, 'auto', 'auto'); $news = main::sub("<strong>Add the THT RSS Feed!</strong>", '<a href="http://thehostingtool.com/forum/syndication.php?fid=2" target="_blank" class="tooltip" title="Add the THT RSS Feed!"><img src="<URL>themes/icons/feed.png" /></a>'); $rss_feed = @file_get_contents("http://thehostingtool.com/forum/syndication.php?fid=2&limit=3"); if ($rss_feed !== false) { $xml = new SimpleXMLElement($rss_feed); foreach ($xml->channel->item as $item) { $newsitem_array['title'] = $item->title; $newsitem_array['author'] = "THT"; $newsitem_array['link'] = $item->link; $newsitem_array['TIME'] = main::convertdate("n/d/Y", strtotime($item->pubDate)); $newsitem_array['SUMMARY'] = $item->description; $news .= style::replaceVar('tpl/admin/home/news-item.tpl', $newsitem_array); } } echo "<br />"; echo main::table('THT News & Updates', $news); }
} $order_form_array['TOS'] = $dbh->config("tos"); $order_form_array['TZADJUST'] = main::tzlist($tz_default); $order_form_array['COUNTRIES'] = main::countries(1, $postvar['country']); //1 = Make it a drop down instead of pulling an array. The second part makes it set it's default. $ptype = type::packagetype($getvar['package']); $order_form_array['TYPESPECIFIC'] = type::orderForm($ptype); if ($getvar['domsub'] == "dom") { $order_form_array['DOMORSUB'] = style::replaceVar("tpl/order/domain.tpl", $domain_array); } else { $pack = $getvar['package']; $server_type = type::packageserver($pack); $serverfile = server::createServer($server_type); $can_create_subs = $serverfile->subdomains; if ($can_create_subs == false) { $maincontent = main::table("Subdomain Error", "Sorry, but the server for this package doesn't allow subdomains to be used without a unique domain present on the account. If you'd like to\n use a domain, please go back and select the domain option."); } else { $subdomains_query = $dbh->select("subdomains", array("server", "=", $server_type), array("subdomain", "ASC"), 0, 1); while ($subdomains_data = $dbh->fetch_array($subdomains_query)) { $subdomains[] = array($subdomains_data['domain'], $subdomains_data['domain']); } if ($postvar['csub2']) { $subtld = $postvar['csub2']; } else { $subtld = $subdomains[0]['domain']; } $subdomain_array['SUBDOMTLDLIST'] = main::dropdown("csub2", $subdomains, $subtld); $order_form_array['DOMORSUB'] = style::replaceVar("tpl/order/subdomain.tpl", $subdomain_array); } } }
function acp() { global $dbh, $postvar, $getvar, $instance; ob_start(); if ($_SESSION['clogged'] || $_SESSION['cuser']) { session_destroy(); main::redirect("?page=home"); } if (!$getvar['page']) { $getvar['page'] = "home"; } $page = $dbh->select("acpnav", array("link", "=", $getvar['page'])); // "Hack" to get the credits and tickets page looking nicer switch ($getvar["page"]) { case "credits": $header = "Credits"; break; default: if ($page['visual'] == "Tickets" && $getvar['mode'] == 'ticketsall') { $header = "All Tickets"; } else { $header = $page['visual']; } break; } $link = "pages/" . $getvar['page'] . ".php"; $staff_data = $dbh->select("staff", array("id", "=", $_SESSION['user'])); $user_perms = $staff_data['perms']; if (substr_count($user_perms, "paid") == '1') { $nopaid = '1'; } if (substr_count($user_perms, "p2h") == '1') { $nop2h = '1'; } if (!file_exists($link)) { $html = "<strong>THT Fatal Error:</strong> That page doesn't exist."; } elseif (!main::checkPerms($page['id']) && !$nopaid && !$nop2h && $user_perms) { $html = "You don't have access to this page."; } elseif ($getvar['page'] == "type" && $getvar['type'] == "paid" && $nopaid) { $html = "You don't have access to this page."; } elseif ($getvar['page'] == "type" && $getvar['type'] == "p2h" && $nop2h) { $html = "You don't have access to this page."; } else { include $link; $content = new page(); // Main Side Bar HTML $nav = "Sidebar Menu"; $sub = $dbh->select("acpnav", 0, array("id", "ASC")); while ($row = $dbh->fetch_array($sub)) { if (main::checkPerms($row['id'])) { $sidebarlink_array['IMGURL'] = $row['icon']; $sidebarlink_array['LINK'] = "?page=" . $row['link']; $sidebarlink_array['VISUAL'] = $row['visual']; $sidebar_array['LINKS'] .= style::replaceVar("tpl/sidebar-link.tpl", $sidebarlink_array); } } // Types Navbar /* * When Working on the navbar, to make a spacer use this: * $sidebar_array['LINKS'] .= style::replaceVar("tpl/spacer.tpl"); */ foreach ($instance->packtypes as $key => $value) { if ($key == "paid" && $nopaid != "1" || $key == "p2h" && $nop2h != "1" || $key != "paid" && $key != "p2h") { if ($instance->packtypes[$key]->acpNav) { foreach ($instance->packtypes[$key]->acpNav as $key2 => $value) { $sidebarlink_array['IMGURL'] = $value[2]; $sidebarlink_array['LINK'] = "?page=type&type=" . $key . "&sub=" . $value[1]; $sidebarlink_array['VISUAL'] = $value[0]; $sidebar_array['LINKS'] .= style::replaceVar("tpl/sidebar-link.tpl", $sidebarlink_array); if ($getvar['page'] == "type" && $getvar['type'] == $key && $getvar['sub'] == $value[1]) { define("SUB", $value[3]); $header = $value[3]; $getvar['myheader'] = $value[3]; } } } } } $sidebarlink_array['IMGURL'] = "information.png"; $sidebarlink_array['LINK'] = "?page=credits"; $sidebarlink_array['VISUAL'] = "Credits"; $sidebar_array['LINKS'] .= style::replaceVar("tpl/sidebar-link.tpl", $sidebarlink_array); $sidebarlink_array['IMGURL'] = "delete.png"; $sidebarlink_array['LINK'] = "?page=logout"; $sidebarlink_array['VISUAL'] = "Logout"; $sidebar_array['LINKS'] .= style::replaceVar("tpl/sidebar-link.tpl", $sidebarlink_array); $sidebar = style::replaceVar("tpl/sidebar.tpl", $sidebar_array); //Page Sidebar if ($content->navtitle) { $subnav = $content->navtitle; foreach ($content->navlist as $key => $value) { $sub_sidebarlink_array['IMGURL'] = $value[1]; $sub_sidebarlink_array['LINK'] = "?page=" . $getvar['page'] . "&sub=" . $value[2]; $sub_sidebarlink_array['VISUAL'] = $value[0]; $sub_sidebar_array['LINKS'] .= style::replaceVar("tpl/sidebar-link.tpl", $sub_sidebarlink_array); } $subsidebar = style::replaceVar("tpl/sidebar.tpl", $sub_sidebar_array); } if ($getvar['sub'] && $getvar['page'] != "type") { foreach ($content->navlist as $key => $value) { if ($value[2] == $getvar['sub']) { if (!$value[0]) { define("SUB", $getvar['page']); $header = $getvar['page']; } else { define("SUB", $value[0]); $header = $value[0]; } } } } if ($getvar['sub'] == "delete" && isset($getvar['do']) && !$_POST && !$getvar['confirm']) { foreach ($postvar as $key => $value) { $warning_array['HIDDEN'] .= '<input name="' . $key . '" type="hidden" value="' . $value . '" />'; } $warning_array['HIDDEN'] .= " "; $html = style::replaceVar("tpl/warning.tpl", $warning_array); } elseif ($getvar['sub'] == "delete" && isset($getvar['do']) && $_POST && !$getvar['confirm']) { if ($postvar['yes']) { foreach ($getvar as $key => $value) { if ($i) { $i = "&"; } else { $i = "?"; } $url .= $i . $key . "=" . $value; } $url .= "&confirm=1"; main::redirect($url); } elseif ($postvar['no']) { main::done(); } } else { if (isset($getvar['sub'])) { ob_start(); $content->content(); $html = ob_get_contents(); // Retrieve the HTML ob_clean(); // Flush the HTML } elseif ($content->navlist) { $html .= $content->description(); // First, we gotta get the page description. $html .= "<br /><br />"; // Break it up // Now we should prepend some stuff here $subsidebar2 .= "<strong>Page Submenu</strong><div class='break'></div>"; $subsidebar2 .= $subsidebar; // Done, now output it in a sub() table $html .= main::sub($subsidebar2, NULL); // Initial implementation, add the SubSidebar(var) into the description, basically append it } else { ob_start(); $content->content(); $html = ob_get_contents(); // Retrieve the HTML ob_clean(); // Flush the HTML } } } $staffuser = $dbh->staff($_SESSION['user']); define("SUB", $header); define("INFO", '<b>Welcome back, ' . strip_tags($staffuser['name']) . '</b><br />' . SUB); echo '<div id="left">'; echo main::table($nav, $sidebar); if ($content->navtitle) { echo "<br />"; echo main::table($subnav, $subsidebar); } echo '</div>'; echo '<div id="right">'; echo main::table($header, $html); echo '</div>'; $html_buff = ob_get_contents(); ob_clean(); return $html_buff; }
$content->content(); $html = ob_get_contents(); ob_clean(); } elseif ($content->navlist) { $html = $content->description(); } else { ob_start(); $content->content(); $html = ob_get_contents(); ob_clean(); } } } } echo '<div>'; echo main::table($header, $html); echo '</div>'; if ($_SESSION['user']) { $showuser = $dbh->staff($_SESSION['user']); $showuser = $showuser['user']; $showuser = "******" . $showuser; } elseif ($_SESSION['cuser']) { $showuser = $dbh->client($_SESSION['cuser']); $showuser = $showuser['user']; $showuser = "******" . $showuser; } else { $showuser = "******"; } define("SUB", $header); define("INFO", '<b>Welcome ' . $showuser . '</b><br />' . SUB); $html_buff = ob_get_contents();
function client() { global $dbh, $postvar, $getvar, $instance; ob_start(); // Stop the output buffer if (!$getvar['page']) { $getvar['page'] = "home"; } $page = $dbh->select("clientnav", array("link", "=", $getvar['page']), array("id", "ASC")); $header = $page['visual']; $link = "pages/" . $getvar['page'] . ".php"; if (!file_exists($link)) { $html = "That page doesn't exist."; } else { if (preg_match("/[\\.*]/", $getvar['page']) == 0) { include $link; $content = new page(); // Main Side Bar HTML $nav = "Sidebar"; if (!$dbh->config("delacc")) { $clientnav_query = $dbh->select("clientnav", array("link", "!=", "delete"), array("id", "ASC"), 0, 1); } else { $clientnav_query = $dbh->select("clientnav", 0, array("id", "ASC"), 0, 1); } while ($clientnav_data = $dbh->fetch_array($clientnav_query)) { $sidebar_link_array['IMGURL'] = $clientnav_data['icon']; $sidebar_link_array['LINK'] = "?page=" . $clientnav_data['link']; $sidebar_link_array['VISUAL'] = $clientnav_data['visual']; $sidebar_array['LINKS'] .= style::replaceVar("tpl/sidebar-link.tpl", $sidebar_link_array); } // Types Navbar $client = $dbh->client($_SESSION['cuser']); $packtype = $instance->packtypes[type::packagetype($client['pid'])]; if ($packtype->clientNav) { foreach ($packtype->clientNav as $key2 => $value) { $sidebar_link_array['IMGURL'] = $value[2]; $sidebar_link_array['LINK'] = "?page=type&type=" . type::packagetype($client['pid']) . "&sub=" . $value[1]; $sidebar_link_array['VISUAL'] = $value[0]; $sidebar_array['LINKS'] .= style::replaceVar("tpl/sidebar-link.tpl", $sidebar_link_array); if ($getvar['page'] == "type" && $getvar['type'] == type::packagetype($client['pid']) && $getvar['sub'] == $value[1]) { define("SUB", $value[3]); $header = $value[3]; $getvar['myheader'] = $value[3]; } } } $sidebar_link_array['IMGURL'] = "delete.png"; $sidebar_link_array['LINK'] = "?page=logout"; $sidebar_link_array['VISUAL'] = "Logout"; $sidebar_array['LINKS'] .= style::replaceVar("tpl/sidebar-link.tpl", $sidebar_link_array); $sidebar = style::replaceVar("tpl/sidebar.tpl", $sidebar_array); //Page Sidebar if ($content->navtitle) { $subnav = $content->navtitle; foreach ($content->navlist as $key => $value) { $sidebar_link_array['IMGURL'] = $value[1]; $sidebar_link_array['LINK'] = "?page=" . $getvar['page'] . "&sub=" . $value[2]; $sidebar_link_array['VISUAL'] = $value[0]; $sub_sidebar_array['LINKS'] .= style::replaceVar("tpl/sidebar-link.tpl", $sidebar_link_array); } $subsidebar = style::replaceVar("tpl/sidebar.tpl", $sub_sidebar_array); } if ($getvar['sub'] == "delete" && isset($getvar['do']) && !$_POST && !$getvar['confirm']) { foreach ($postvar as $key => $value) { $warning_array['HIDDEN'] .= '<input name="' . $key . '" type="hidden" value="' . $value . '" />'; } $warning_array['HIDDEN'] .= " "; $html = style::replaceVar("tpl/warning.tpl", $warning_array); } elseif ($getvar['sub'] == "delete" && isset($getvar['do']) && $_POST && !$getvar['confirm']) { if ($postvar['yes']) { foreach ($getvar as $key => $value) { if ($i) { $i = "&"; } else { $i = "?"; } $url .= $i . $key . "=" . $value; } $url .= "&confirm=1"; main::redirect($url); } elseif ($postvar['no']) { main::done(); } } else { if (isset($getvar['sub'])) { ob_start(); $content->content(); $html = ob_get_contents(); // Retrieve the HTML ob_clean(); // Flush the HTML } elseif ($content->navlist) { if ($content->description()) { $html = $content->description() . "<br><br>"; } $html .= "Select a sub-page from the sidebar."; } else { ob_start(); $content->content(); $html = ob_get_contents(); // Retrieve the HTML ob_clean(); // Flush the HTML } } } } if ($getvar['sub'] && $getvar['page'] != "type") { foreach ($content->navlist as $key => $value) { if ($value[2] == $getvar['sub']) { define("SUB", $value[0]); $header = $value[0]; } } } $staffuser = $dbh->client($_SESSION['cuser']); define("SUB", $header); define("INFO", '<b>Welcome back, ' . $staffuser['user'] . '</b><br />' . SUB); echo '<div id="left">'; echo main::table($nav, $sidebar); if ($content->navtitle) { echo "<br />"; echo main::table($subnav, $subsidebar); } echo '</div>'; echo '<div id="right">'; echo main::table($header, $html); echo '</div>'; $html_buff = ob_get_contents(); ob_clean(); return $html_buff; }