Merging Scribus and Nighthawk branches
authorDan
Sun, 02 Sep 2007 11:00:57 -0400
changeset 5 e3d7322305bf
parent 4 eb9ed4c366d0
child 6 5e1f1e916419
Merging Scribus and Nighthawk branches
plugins/PunBB.php
punbb/delete.php
punbb/include/common.php
punbb/include/functions.php
punbb/index.php
punbb/profile.php
punbb/viewforum.php
--- a/plugins/PunBB.php	Sun Sep 02 10:56:36 2007 -0400
+++ b/plugins/PunBB.php	Sun Sep 02 11:00:57 2007 -0400
@@ -36,9 +36,9 @@
 $plugins->attachHook('session_started', '
     $pid = RenderMan::strToPageId($paths->get_pageid_from_url());
 
-    if ( getConfig("punbb_installed") == "yes" && getConfig("punbb_version") == PUNANO_VERSION && preg_match("#^Forum(/.*)?$#", $pid[0]) && $pid[1] == "Special" )
+    if ( getConfig("punbb_installed") == "yes" && getConfig("punbb_version") == PUNANO_VERSION && $pid[0] == "Forum" && $pid[1] == "Special" )
     {
-      require( ENANO_ROOT . "/punbb/include/common.php" );
+      require( "punbb/include/common.php" );
     }
     ');
 
@@ -204,7 +204,7 @@
 function punano_upgrade()
 {
   global $db, $session, $paths, $template, $plugins; // Common objects
-  die('Punano upgrade was requested but this isn\'t implemented yet.');
+  
 }
 
 function punano_main()
@@ -261,8 +261,7 @@
 
   if ( $session->auth_level < $need_level )
   {
-    $need_level = ( $session->user_level > $need_level ) ? $session->user_level : $need_level;
-    redirect( makeUrlNS('Special', 'Login/' . $paths->fullpage, 'level=' . $need_level, false), 'Permission denied', 'You need to have permission level ' . $session->userlevel_to_string($need_level) . ' to use the PunBB administration console.', 2);
+    redirect( makeUrlNS('Special', 'Login/' . $paths->fullpage, 'level=' . $session->user_level, false), 'Permission denied', 'You need to have permission level ' . $session->userlevel_to_string($need_level) . ' to use the PunBB administration console.', 2);
   }
   
   // Don't worry. This is sanitized.
--- a/punbb/delete.php	Sun Sep 02 10:56:36 2007 -0400
+++ b/punbb/delete.php	Sun Sep 02 11:00:57 2007 -0400
@@ -70,7 +70,7 @@
 if (isset($_POST['delete']))
 {
 	if ($is_admmod)
-		confirm_referrer('delete.php');
+		confirm_referrer('delete');
 
 	require PUN_ROOT.'include/search_idx.php';
 
--- a/punbb/include/common.php	Sun Sep 02 10:56:36 2007 -0400
+++ b/punbb/include/common.php	Sun Sep 02 11:00:57 2007 -0400
@@ -23,11 +23,11 @@
 ************************************************************************/
 
 // Enable DEBUG mode by removing // from the following line
-// define('PUN_DEBUG', 1);
+//define('PUN_DEBUG', 1);
 
 // This displays all executed queries in the page footer.
 // DO NOT enable this in a production environment!
-// define('PUN_SHOW_QUERIES', 1);
+//define('PUN_SHOW_QUERIES', 1);
 
 if (!defined('PUN_ROOT'))
 	exit('The constant PUN_ROOT must be defined and point to a valid PunBB installation root directory.');
@@ -47,14 +47,13 @@
 
 // Record the start time (will be used to calculate the generation time for the page)
 
-function pun_microtime()
+function get_microtime()
 {
   list($usec, $sec) = explode(' ', microtime());
   return ((float)$usec + (float)$sec);
 }
 
-$GLOBALS['pun_start'] = pun_microtime();
-$pun_start =& $GLOBALS['pun_start'];
+$pun_start = get_microtime();
 
 // Make sure PHP reports all errors except E_NOTICE. PunBB supports E_ALL, but a lot of scripts it may interact with, do not.
 error_reporting(E_ALL);
--- a/punbb/include/functions.php	Sun Sep 02 10:56:36 2007 -0400
+++ b/punbb/include/functions.php	Sun Sep 02 11:00:57 2007 -0400
@@ -241,19 +241,19 @@
   global $db, $session, $paths, $template, $plugins; // Common objects
 
 	// Index and Userlist should always be displayed
-	$links[] = '<li id="navindex"><a href="' . makeUrlNS('Special', 'Forum/Index') . '">'.$lang_common['Index'].'</a>';
-	$links[] = '<li id="navuserlist"><a href="' . makeUrlNS('Special', 'Forum/Userlist') . '">'.$lang_common['User list'].'</a>';
+	$links[] = '<li id="navindex"><a href="index.php">'.$lang_common['Index'].'</a>';
+	$links[] = '<li id="navuserlist"><a href="userlist.php">'.$lang_common['User list'].'</a>';
 
 	if ($pun_config['o_rules'] == '1')
-		$links[] = '<li id="navrules"><a href="' . makeUrlNS('Special', 'Forum/Misc', 'action=rules', true) . '">'.$lang_common['Rules'].'</a>';
+		$links[] = '<li id="navrules"><a href="misc.php?action=rules">'.$lang_common['Rules'].'</a>';
 
 	if ( !$session->user_logged_in )
 	{
 		if ($pun_user['g_search'] == '1')
-			$links[] = '<li id="navsearch"><a href="' . makeUrlNS('Special', 'Forum/Search') . '">'.$lang_common['Search'].'</a>';
+			$links[] = '<li id="navsearch"><a href="search.php">'.$lang_common['Search'].'</a>';
 
-		$links[] = '<li id="navregister"><a href="' . makeUrlNS('Special', 'Forum/Register') . '">'.$lang_common['Register'].'</a>';
-		// $links[] = '<li id="navlogin"><a href="' . makeUrlNS('Special', 'Forum/login') . '">'.$lang_common['Login'].'</a>';
+		$links[] = '<li id="navregister"><a href="register.php">'.$lang_common['Register'].'</a>';
+		// $links[] = '<li id="navlogin"><a href="login.php">'.$lang_common['Login'].'</a>';
 
 		$info = $lang_common['Not logged in'];
 	}
@@ -262,16 +262,16 @@
 		if ($pun_user['g_id'] < USER_LEVEL_ADMIN)
 		{
 			if ($pun_user['g_search'] == '1')
-				$links[] = '<li id="navsearch"><a href="' . makeUrlNS('Special', 'Forum/Search') . '">'.$lang_common['Search'].'</a>';
+				$links[] = '<li id="navsearch"><a href="search.php">'.$lang_common['Search'].'</a>';
 
-			$links[] = '<li id="navprofile"><a href="' . makeUrlNS('Special', 'Forum/Profile', 'id='.$pun_user['id'], true) . '">'.$lang_common['Profile'].'</a>';
+			$links[] = '<li id="navprofile"><a href="profile.php?id='.$pun_user['id'].'">'.$lang_common['Profile'].'</a>';
 			// $links[] = '<li id="navlogout"><a href="login.php?action=out&amp;id='.$pun_user['id'].'">'.$lang_common['Logout'].'</a>';
 		}
 		else
 		{
-			$links[] = '<li id="navsearch"><a href="' . makeUrlNS('Special', 'Forum/Search') . '">'.$lang_common['Search'].'</a>';
-			$links[] = '<li id="navprofile"><a href="' . makeUrlNS('Special', 'Forum/Profile', 'id='.$pun_user['id'], true) . '">'.$lang_common['Profile'].'</a>';
-			$links[] = '<li id="navadmin"><a href="' . makeUrlNS('Special', 'Forum/Admin_Index') . '">'.$lang_common['Admin'].'</a>';
+			$links[] = '<li id="navsearch"><a href="search.php">'.$lang_common['Search'].'</a>';
+			$links[] = '<li id="navprofile"><a href="profile.php?id='.$pun_user['id'].'">'.$lang_common['Profile'].'</a>';
+			$links[] = '<li id="navadmin"><a href="admin_index.php">'.$lang_common['Admin'].'</a>';
 			// $links[] = '<li id="navlogout"><a href="login.php?action=out&amp;id='.$pun_user['id'].'">'.$lang_common['Logout'].'</a>';
 		}
 	}
@@ -305,13 +305,13 @@
 		<div class="box">
 			<div class="inbox">
 				<ul>
-					<li<?php if ($page == 'essentials') echo ' class="isactive"'; ?>><a href="<?php echo makeUrlNS('Special', 'Forum/Profile', 'section=essentials&id=' . $id, true); ?>"><?php echo $lang_profile['Section essentials'] ?></a></li>
-					<li<?php if ($page == 'personal') echo ' class="isactive"'; ?>><a href="<?php echo makeUrlNS('Special', 'Forum/Profile', 'section=personal&id=' . $id, true); ?>"><?php echo $lang_profile['Section personal'] ?></a></li>
-					<li<?php if ($page == 'messaging') echo ' class="isactive"'; ?>><a href="<?php echo makeUrlNS('Special', 'Forum/Profile', 'section=messaging&id=' . $id, true); ?>"><?php echo $lang_profile['Section messaging'] ?></a></li>
-					<li<?php if ($page == 'personality') echo ' class="isactive"'; ?>><a href="<?php echo makeUrlNS('Special', 'Forum/Profile', 'section=personality&id=' . $id, true); ?>"><?php echo $lang_profile['Section personality'] ?></a></li>
-					<li<?php if ($page == 'display') echo ' class="isactive"'; ?>><a href="<?php echo makeUrlNS('Special', 'Forum/Profile', 'section=display&id=' . $id, true); ?>"><?php echo $lang_profile['Section display'] ?></a></li>
-					<li<?php if ($page == 'privacy') echo ' class="isactive"'; ?>><a href="<?php echo makeUrlNS('Special', 'Forum/Profile', 'section=privacy&id=' . $id, true); ?>"><?php echo $lang_profile['Section privacy'] ?></a></li>
-<?php if ($pun_user['g_id'] == PUN_ADMIN || ($pun_user['g_id'] == PUN_MOD && $pun_config['p_mod_ban_users'] == '1')): ?>					<li<?php if ($page == 'admin') echo ' class="isactive"'; ?>><a href="<?php echo makeUrlNS('Special', 'Forum/Profile', 'section=admin&id=' . $id, true); ?>"><?php echo $lang_profile['Section admin'] ?></a></li>
+					<li<?php if ($page == 'essentials') echo ' class="isactive"'; ?>><a href="profile.php?section=essentials&amp;id=<?php echo $id ?>"><?php echo $lang_profile['Section essentials'] ?></a></li>
+					<li<?php if ($page == 'personal') echo ' class="isactive"'; ?>><a href="profile.php?section=personal&amp;id=<?php echo $id ?>"><?php echo $lang_profile['Section personal'] ?></a></li>
+					<li<?php if ($page == 'messaging') echo ' class="isactive"'; ?>><a href="profile.php?section=messaging&amp;id=<?php echo $id ?>"><?php echo $lang_profile['Section messaging'] ?></a></li>
+					<li<?php if ($page == 'personality') echo ' class="isactive"'; ?>><a href="profile.php?section=personality&amp;id=<?php echo $id ?>"><?php echo $lang_profile['Section personality'] ?></a></li>
+					<li<?php if ($page == 'display') echo ' class="isactive"'; ?>><a href="profile.php?section=display&amp;id=<?php echo $id ?>"><?php echo $lang_profile['Section display'] ?></a></li>
+					<li<?php if ($page == 'privacy') echo ' class="isactive"'; ?>><a href="profile.php?section=privacy&amp;id=<?php echo $id ?>"><?php echo $lang_profile['Section privacy'] ?></a></li>
+<?php if ($pun_user['g_id'] == PUN_ADMIN || ($pun_user['g_id'] == PUN_MOD && $pun_config['p_mod_ban_users'] == '1')): ?>					<li<?php if ($page == 'admin') echo ' class="isactive"'; ?>><a href="profile.php?section=admin&amp;id=<?php echo $id ?>"><?php echo $lang_profile['Section admin'] ?></a></li>
 <?php endif; ?>				</ul>
 			</div>
 		</div>
@@ -644,7 +644,7 @@
 {
 	global $pun_config, $lang_common;
   
-  // This doesn't seem to work with Enano...
+  // Not gonna worry about this for Enano, because Enano handles Pun's security
   return true;
   
   $script = preg_replace('/\.php$/i', '', $script);
--- a/punbb/index.php	Sun Sep 02 10:56:36 2007 -0400
+++ b/punbb/index.php	Sun Sep 02 11:00:57 2007 -0400
@@ -97,7 +97,7 @@
 	}
 	else
 	{
-		$forum_field = '<h3><a href="' . makeUrlNS('Special', 'Forum/ViewForum', 'id='.$cur_forum['fid'], true) . '">'.pun_htmlspecialchars($cur_forum['forum_name']).'</a></h3>';
+		$forum_field = '<h3><a href="'.makeUrlNS('Special', 'Forum/ViewForum', 'id='.$cur_forum['fid'], true).'">'.pun_htmlspecialchars($cur_forum['forum_name']).'</a></h3>';
 		$num_topics = $cur_forum['num_topics'];
 		$num_posts = $cur_forum['num_posts'];
 	}
@@ -108,7 +108,7 @@
 
 	// If there is a last_post/last_poster.
 	if ($cur_forum['last_post'] != '')
-		$last_post = '<a href="' . makeUrlNS('Special', 'Forum/ViewTopic', 'pid='.$cur_forum['last_post_id'], true) . '#p'.$cur_forum['last_post_id'].'">'.format_time($cur_forum['last_post']).'</a> <span class="byuser">'.$lang_common['by'].' '.pun_htmlspecialchars($cur_forum['last_poster']).'</span>';
+		$last_post = '<a href="viewtopic.php?pid='.$cur_forum['last_post_id'].'#p'.$cur_forum['last_post_id'].'">'.format_time($cur_forum['last_post']).'</a> <span class="byuser">'.$lang_common['by'].' '.pun_htmlspecialchars($cur_forum['last_poster']).'</span>';
 	else
 		$last_post = '&nbsp;';
 
--- a/punbb/profile.php	Sun Sep 02 10:56:36 2007 -0400
+++ b/punbb/profile.php	Sun Sep 02 11:00:57 2007 -0400
@@ -52,6 +52,9 @@
 
 if ($action == 'change_pass')
 {
+  // Can't do this, Enano's already got it
+  message($lang_common['No permission'] . ' This is because this function is disabled in the Enano port, and Enano handles sessions and user management for PunBB.');
+  
 	if (isset($_GET['key']))
 	{
 		// If the user is already logged in we shouldn't be here :)
@@ -1109,8 +1112,8 @@
 						<div class="infldset">
 							<input type="hidden" name="form_sent" value="1" />
 							<?php echo $username_field ?>
-<?php if ($pun_user['id'] == $id || $pun_user['g_id'] == USER_LEVEL_ADMIN || ($user['g_id'] > PUN_MOD && $pun_config['p_mod_change_passwords'] == '1')): ?><p><a href="profile.php?action=change_pass&amp;id=<?php echo $id ?>"><?php echo $lang_profile['Change pass'] ?></a></p>
-<?php endif; ?>					</div>
+<?php /* if ($pun_user['id'] == $id || $pun_user['g_id'] == USER_LEVEL_ADMIN || ($user['g_id'] > PUN_MOD && $pun_config['p_mod_change_passwords'] == '1')): ?><p><a href="profile.php?action=change_pass&amp;id=<?php echo $id ?>"><?php echo $lang_profile['Change pass'] ?></a></p>
+<?php endif;  */?>					</div>
 					</fieldset>
 				</div>
 				<div class="inform">
--- a/punbb/viewforum.php	Sun Sep 02 10:56:36 2007 -0400
+++ b/punbb/viewforum.php	Sun Sep 02 11:00:57 2007 -0400
@@ -76,7 +76,7 @@
 $start_from = $pun_user['disp_topics'] * ($p - 1);
 
 // Generate paging links
-$paging_links = $lang_common['Pages'].': '.pun_paginate($num_pages, $p, 'viewforum.php?id='.$id);
+$paging_links = $lang_common['Pages'].': '.pun_paginate($num_pages, $p, makeUrlNS('Special', 'Forum/ViewForum', 'id=' . $id));
 
 
 $page_title = pun_htmlspecialchars($pun_config['o_board_title'].' / '.$cur_forum['forum_name']);
@@ -148,7 +148,7 @@
 		$icon_type = 'icon';
 
 		if ($cur_topic['moved_to'] == null)
-			$last_post = '<a href="viewtopic.php?pid='.$cur_topic['last_post_id'].'#p'.$cur_topic['last_post_id'].'">'.format_time($cur_topic['last_post']).'</a> <span class="byuser">'.$lang_common['by'].'&nbsp;'.pun_htmlspecialchars($cur_topic['last_poster']).'</span>';
+			$last_post = '<a href="'.makeUrlNS('Special', 'Forum/ViewTopic', 'pid='.$cur_topic['last_post_id'], true).'#p'.$cur_topic['last_post_id'].'">'.format_time($cur_topic['last_post']).'</a> <span class="byuser">'.$lang_common['by'].'&nbsp;'.pun_htmlspecialchars($cur_topic['last_poster']).'</span>';
 		else
 			$last_post = '&nbsp;';
 
@@ -156,12 +156,12 @@
 			$cur_topic['subject'] = censor_words($cur_topic['subject']);
 
 		if ($cur_topic['moved_to'] != 0)
-			$subject = $lang_forum['Moved'].': <a href="viewtopic.php?id='.$cur_topic['moved_to'].'">'.pun_htmlspecialchars($cur_topic['subject']).'</a> <span class="byuser">'.$lang_common['by'].'&nbsp;'.pun_htmlspecialchars($cur_topic['poster']).'</span>';
+			$subject = $lang_forum['Moved'].': <a href="'.makeUrlNS('Special', 'Forum/ViewTopic', 'id='.$cur_topic['moved_to'], true).'">'.pun_htmlspecialchars($cur_topic['subject']).'</a> <span class="byuser">'.$lang_common['by'].'&nbsp;'.pun_htmlspecialchars($cur_topic['poster']).'</span>';
 		else if ($cur_topic['closed'] == '0')
-			$subject = '<a href="viewtopic.php?id='.$cur_topic['id'].'">'.pun_htmlspecialchars($cur_topic['subject']).'</a> <span class="byuser">'.$lang_common['by'].'&nbsp;'.pun_htmlspecialchars($cur_topic['poster']).'</span>';
+			$subject = '<a href="'.makeUrlNS('Special', 'Forum/ViewTopic', 'id='.$cur_topic['id'], true).'">'.pun_htmlspecialchars($cur_topic['subject']).'</a> <span class="byuser">'.$lang_common['by'].'&nbsp;'.pun_htmlspecialchars($cur_topic['poster']).'</span>';
 		else
 		{
-			$subject = '<a href="viewtopic.php?id='.$cur_topic['id'].'">'.pun_htmlspecialchars($cur_topic['subject']).'</a> <span class="byuser">'.$lang_common['by'].'&nbsp;'.pun_htmlspecialchars($cur_topic['poster']).'</span>';
+			$subject = '<a href="'.makeUrlNS('Special', 'Forum/ViewTopic', 'id='.$cur_topic['id'], true).'">'.pun_htmlspecialchars($cur_topic['subject']).'</a> <span class="byuser">'.$lang_common['by'].'&nbsp;'.pun_htmlspecialchars($cur_topic['poster']).'</span>';
 			$icon_text = $lang_common['Closed icon'];
 			$item_status = 'iclosed';
 		}