punbb/include/functions.php
changeset 5 e3d7322305bf
parent 4 eb9ed4c366d0
equal deleted inserted replaced
4:eb9ed4c366d0 5:e3d7322305bf
   239 {
   239 {
   240 	global $pun_config, $lang_common, $pun_user;
   240 	global $pun_config, $lang_common, $pun_user;
   241   global $db, $session, $paths, $template, $plugins; // Common objects
   241   global $db, $session, $paths, $template, $plugins; // Common objects
   242 
   242 
   243 	// Index and Userlist should always be displayed
   243 	// Index and Userlist should always be displayed
   244 	$links[] = '<li id="navindex"><a href="' . makeUrlNS('Special', 'Forum/Index') . '">'.$lang_common['Index'].'</a>';
   244 	$links[] = '<li id="navindex"><a href="index.php">'.$lang_common['Index'].'</a>';
   245 	$links[] = '<li id="navuserlist"><a href="' . makeUrlNS('Special', 'Forum/Userlist') . '">'.$lang_common['User list'].'</a>';
   245 	$links[] = '<li id="navuserlist"><a href="userlist.php">'.$lang_common['User list'].'</a>';
   246 
   246 
   247 	if ($pun_config['o_rules'] == '1')
   247 	if ($pun_config['o_rules'] == '1')
   248 		$links[] = '<li id="navrules"><a href="' . makeUrlNS('Special', 'Forum/Misc', 'action=rules', true) . '">'.$lang_common['Rules'].'</a>';
   248 		$links[] = '<li id="navrules"><a href="misc.php?action=rules">'.$lang_common['Rules'].'</a>';
   249 
   249 
   250 	if ( !$session->user_logged_in )
   250 	if ( !$session->user_logged_in )
   251 	{
   251 	{
   252 		if ($pun_user['g_search'] == '1')
   252 		if ($pun_user['g_search'] == '1')
   253 			$links[] = '<li id="navsearch"><a href="' . makeUrlNS('Special', 'Forum/Search') . '">'.$lang_common['Search'].'</a>';
   253 			$links[] = '<li id="navsearch"><a href="search.php">'.$lang_common['Search'].'</a>';
   254 
   254 
   255 		$links[] = '<li id="navregister"><a href="' . makeUrlNS('Special', 'Forum/Register') . '">'.$lang_common['Register'].'</a>';
   255 		$links[] = '<li id="navregister"><a href="register.php">'.$lang_common['Register'].'</a>';
   256 		// $links[] = '<li id="navlogin"><a href="' . makeUrlNS('Special', 'Forum/login') . '">'.$lang_common['Login'].'</a>';
   256 		// $links[] = '<li id="navlogin"><a href="login.php">'.$lang_common['Login'].'</a>';
   257 
   257 
   258 		$info = $lang_common['Not logged in'];
   258 		$info = $lang_common['Not logged in'];
   259 	}
   259 	}
   260 	else
   260 	else
   261 	{
   261 	{
   262 		if ($pun_user['g_id'] < USER_LEVEL_ADMIN)
   262 		if ($pun_user['g_id'] < USER_LEVEL_ADMIN)
   263 		{
   263 		{
   264 			if ($pun_user['g_search'] == '1')
   264 			if ($pun_user['g_search'] == '1')
   265 				$links[] = '<li id="navsearch"><a href="' . makeUrlNS('Special', 'Forum/Search') . '">'.$lang_common['Search'].'</a>';
   265 				$links[] = '<li id="navsearch"><a href="search.php">'.$lang_common['Search'].'</a>';
   266 
   266 
   267 			$links[] = '<li id="navprofile"><a href="' . makeUrlNS('Special', 'Forum/Profile', 'id='.$pun_user['id'], true) . '">'.$lang_common['Profile'].'</a>';
   267 			$links[] = '<li id="navprofile"><a href="profile.php?id='.$pun_user['id'].'">'.$lang_common['Profile'].'</a>';
   268 			// $links[] = '<li id="navlogout"><a href="login.php?action=out&amp;id='.$pun_user['id'].'">'.$lang_common['Logout'].'</a>';
   268 			// $links[] = '<li id="navlogout"><a href="login.php?action=out&amp;id='.$pun_user['id'].'">'.$lang_common['Logout'].'</a>';
   269 		}
   269 		}
   270 		else
   270 		else
   271 		{
   271 		{
   272 			$links[] = '<li id="navsearch"><a href="' . makeUrlNS('Special', 'Forum/Search') . '">'.$lang_common['Search'].'</a>';
   272 			$links[] = '<li id="navsearch"><a href="search.php">'.$lang_common['Search'].'</a>';
   273 			$links[] = '<li id="navprofile"><a href="' . makeUrlNS('Special', 'Forum/Profile', 'id='.$pun_user['id'], true) . '">'.$lang_common['Profile'].'</a>';
   273 			$links[] = '<li id="navprofile"><a href="profile.php?id='.$pun_user['id'].'">'.$lang_common['Profile'].'</a>';
   274 			$links[] = '<li id="navadmin"><a href="' . makeUrlNS('Special', 'Forum/Admin_Index') . '">'.$lang_common['Admin'].'</a>';
   274 			$links[] = '<li id="navadmin"><a href="admin_index.php">'.$lang_common['Admin'].'</a>';
   275 			// $links[] = '<li id="navlogout"><a href="login.php?action=out&amp;id='.$pun_user['id'].'">'.$lang_common['Logout'].'</a>';
   275 			// $links[] = '<li id="navlogout"><a href="login.php?action=out&amp;id='.$pun_user['id'].'">'.$lang_common['Logout'].'</a>';
   276 		}
   276 		}
   277 	}
   277 	}
   278 
   278 
   279 	// Are there any additional navlinks we should insert into the array before imploding it?
   279 	// Are there any additional navlinks we should insert into the array before imploding it?
   303 	<div class="blockmenu">
   303 	<div class="blockmenu">
   304 		<h2><span><?php echo $lang_profile['Profile menu'] ?></span></h2>
   304 		<h2><span><?php echo $lang_profile['Profile menu'] ?></span></h2>
   305 		<div class="box">
   305 		<div class="box">
   306 			<div class="inbox">
   306 			<div class="inbox">
   307 				<ul>
   307 				<ul>
   308 					<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>
   308 					<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>
   309 					<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>
   309 					<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>
   310 					<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>
   310 					<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>
   311 					<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>
   311 					<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>
   312 					<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>
   312 					<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>
   313 					<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>
   313 					<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>
   314 <?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>
   314 <?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>
   315 <?php endif; ?>				</ul>
   315 <?php endif; ?>				</ul>
   316 			</div>
   316 			</div>
   317 		</div>
   317 		</div>
   318 	</div>
   318 	</div>
   319 <?php
   319 <?php
   642 //
   642 //
   643 function confirm_referrer($script)
   643 function confirm_referrer($script)
   644 {
   644 {
   645 	global $pun_config, $lang_common;
   645 	global $pun_config, $lang_common;
   646   
   646   
   647   // This doesn't seem to work with Enano...
   647   // Not gonna worry about this for Enano, because Enano handles Pun's security
   648   return true;
   648   return true;
   649   
   649   
   650   $script = preg_replace('/\.php$/i', '', $script);
   650   $script = preg_replace('/\.php$/i', '', $script);
   651   
   651   
   652   if ( isset($_SERVER['HTTP_REFERER']) )
   652   if ( isset($_SERVER['HTTP_REFERER']) )