punbb/header.php
changeset 2 a8a21e1c7afa
parent 0 f9ffdbd96607
child 3 c0c445d4a13e
--- a/punbb/header.php	Wed Jul 11 21:28:39 2007 -0400
+++ b/punbb/header.php	Thu Jul 12 01:04:01 2007 -0400
@@ -22,25 +22,77 @@
 
 ************************************************************************/
 
+// Import the Enano API
+global $db, $session, $paths, $template, $plugins; // Common objects
 
 // Make sure no one attempts to run this script "directly"
 if (!defined('PUN'))
 	exit;
 
+$template->tpl_strings['PAGE_NAME'] = $page_title;
+$template->add_header('<pun_head>');
+
+// Special case - many Enano themes have indented paragraphs
+$template->add_header('<style type="text/css">
+    div.pun p {
+      margin-left: 0;
+    }
+    div.pun a[href ^="http://"] {
+      background-image: none;
+      padding-right: 0;
+    }
+    div.inbox li {
+      list-style-type: none !important;
+    }
+    div.pun h2 {
+      border-bottom-width: 0;
+    }
+  </style>');
+
 // Send no-cache headers
 header('Expires: Thu, 21 Jul 1977 07:30:00 GMT');	// When yours truly first set eyes on this world! :)
 header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
 header('Cache-Control: post-check=0, pre-check=0', false);
 header('Pragma: no-cache');		// For HTTP/1.0 compability
 
-
 // Load the template
 if (defined('PUN_ADMIN_CONSOLE'))
+{
 	$tpl_main = file_get_contents(PUN_ROOT.'include/template/admin.tpl');
+}
 else if (defined('PUN_HELP'))
+{
 	$tpl_main = file_get_contents(PUN_ROOT.'include/template/help.tpl');
+}
 else
-	$tpl_main = file_get_contents(PUN_ROOT.'include/template/main.tpl');
+{
+	// $tpl_main = file_get_contents(PUN_ROOT.'include/template/main.tpl');
+  $inner = '<div id="punwrap">
+<div id="pun<pun_page>" class="pun">
+
+<div id="brdheader" class="block">
+	<div class="box">
+		<div id="brdtitle" class="inbox">
+			<pun_title>
+			<pun_desc>
+		</div>
+		<pun_navlinks>
+		<pun_status>
+	</div>
+</div>
+
+<pun_announcement>
+
+<pun_main>
+
+<pun_footer>
+
+</div>
+</div>';
+
+  $tpl_main = $template->getHeader() . $inner . $template->getFooter();
+
+}
 
 
 // START SUBST - <pun_include "*">
@@ -57,7 +109,6 @@
 }
 // END SUBST - <pun_include "*">
 
-
 // START SUBST - <pun_content_direction>
 $tpl_main = str_replace('<pun_content_direction>', $lang_common['lang_direction'], $tpl_main);
 // END SUBST - <pun_content_direction>
@@ -67,7 +118,6 @@
 $tpl_main = str_replace('<pun_char_encoding>', $lang_common['lang_encoding'], $tpl_main);
 // END SUBST - <pun_char_encoding>
 
-
 // START SUBST - <pun_head>
 ob_start();
 
@@ -76,8 +126,7 @@
 	echo '<meta name="ROBOTS" content="NOINDEX, FOLLOW" />'."\n";
 
 ?>
-<title><?php echo $page_title ?></title>
-<link rel="stylesheet" type="text/css" href="style/<?php echo $pun_user['style'].'.css' ?>" />
+<link rel="stylesheet" type="text/css" href="<?php echo scriptPath; ?>/punbb/style/<?php echo $pun_user['style'].'.css' ?>" />
 <?php
 
 if (defined('PUN_ADMIN_CONSOLE'))
@@ -147,7 +196,7 @@
 
 // START SUBST - <pun_page>
 $tpl_main = str_replace('<pun_page>', htmlspecialchars(basename($_SERVER['PHP_SELF'], '.php')), $tpl_main);
-// END SUBST - <pun_title>
+// END SUBST - <pun_page>
 
 
 // START SUBST - <pun_title>
@@ -172,11 +221,11 @@
 {
 	$tpl_temp = '<div id="brdwelcome" class="inbox">'."\n\t\t\t".'<ul class="conl">'."\n\t\t\t\t".'<li>'.$lang_common['Logged in as'].' <strong>'.pun_htmlspecialchars($pun_user['username']).'</strong></li>'."\n\t\t\t\t".'<li>'.$lang_common['Last visit'].': '.format_time($pun_user['last_visit']).'</li>';
 
-	if ($pun_user['g_id'] < PUN_GUEST)
+	if ($pun_user['g_id'] >= USER_LEVEL_MEMBER)
 	{
-		$result_header = $db->query('SELECT COUNT(id) FROM '.$db->prefix.'reports WHERE zapped IS NULL') or error('Unable to fetch reports info', __FILE__, __LINE__, $db->error());
+		$result_header = $pun_db->query('SELECT COUNT(id) FROM '.$pun_db->prefix.'reports WHERE zapped IS NULL') or error('Unable to fetch reports info', __FILE__, __LINE__, $pun_db->error());
 
-		if ($db->result($result_header))
+		if ($pun_db->result($result_header))
 			$tpl_temp .= "\n\t\t\t\t".'<li class="reportlink"><strong><a href="admin_reports.php">There are new reports</a></strong></li>';
 
 		if ($pun_config['o_maintenance'] == '1')
@@ -192,7 +241,6 @@
 $tpl_main = str_replace('<pun_status>', $tpl_temp, $tpl_main);
 // END SUBST - <pun_status>
 
-
 // START SUBST - <pun_announcement>
 if ($pun_config['o_announcement'] == '1')
 {
@@ -217,7 +265,6 @@
 	$tpl_main = str_replace('<pun_announcement>', '', $tpl_main);
 // END SUBST - <pun_announcement>
 
-
 // START SUBST - <pun_main>
 ob_start();