All pastes #239410 Raw Edit

Something

public text v1 · immutable
·published 2006-11-05 10:02 UTC
rendered paste body
##############################################################
## MOD Title: Index Online Location
## MOD Author: eviL3 < evil@phpbbmodders.org > (Igor Wiedler) http://phpbbmodders.org
## MOD Description: This MOD will show each users current location in the viewonline section of the index.
## MOD Version: 0.2.1
##
## Installation Level: Easy
## Installation Time: 3 Minutes
## Files To Edit:
##            includes/page_header.php
##
## Included Files: (n/a)
## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2
##############################################################
## For security purposes, please check: http://www.phpbb.com/mods/
## for the latest version of this MOD. Although MODs are checked
## before being allowed in the MODs Database there is no guarantee
## that there are no security problems within the MOD. No support
## will be given for MODs not found within the MODs Database which
## can be found at http://www.phpbb.com/mods/
##############################################################
## Author Notes:
## This MOD was requested by kber at phpBBModders.org
##
##############################################################
## MOD History:
##
##   2006-10-14 - Version 0.1.0
##      - First release
##
##   2006-10-20 - Version 0.2.0
##      - Fixed a typo
##      - Fixed forum locations
##
##   2006-11-05 - Version 0.2.1
##      - Fixed parse error
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################

#
#-----[ OPEN ]------------------------------------------
#
includes/page_header.php

#
#-----[ FIND ]------------------------------------------
#
if (defined('SHOW_ONLINE'))
{

#
#-----[ AFTER, ADD ]------------------------------------------
#
	// Index Online Location
	$online_is_auth_ary = array();
	$online_is_auth_ary = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata);

	$sql = "SELECT forum_name, forum_id
		FROM " . FORUMS_TABLE;
	if ( $result = $db->sql_query($sql) )
	{
		while( $row = $db->sql_fetchrow($result) )
		{
			$online_forum_data[$row['forum_id']] = $row['forum_name'];
		}
	}
	else
	{
		message_die(GENERAL_ERROR, 'Could not obtain user/online forums information', '', __LINE__, __FILE__, $sql);
	}
	// Index Online Location

#
#-----[ FIND ]------------------------------------------
#
	$sql = "SELECT u.username, u.user_id,

#
#-----[ IN-LINE FIND ]------------------------------------------
#
, s.session_ip

#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, s.session_page

#
#-----[ FIND ]------------------------------------------
#
				if ( $row['user_allow_viewonline'] || $userdata['user_level'] == ADMIN )

#
#-----[ BEFORE, ADD ]------------------------------------------
#
				// Index Online Location
				if ( $row['session_page'] < 1 || !$online_is_auth_ary[$row['session_page']]['auth_view'] )
				{
					switch( $row['session_page'] )
					{
						case PAGE_INDEX:
							$location = $lang['Forum_index'];
						break;
						
						case PAGE_POSTING:
							$location = $lang['Posting_message'];
						break;
						
						case PAGE_PROFILE:
							$location = $lang['Viewing_profile'];
						break;
						
						case PAGE_VIEWONLINE:
							$location = $lang['Viewing_online'];
						break;
						
						case PAGE_VIEWMEMBERS:
							$location = $lang['Viewing_member_list'];
						break;
						
						case PAGE_PRIVMSGS:
							$location = $lang['Viewing_priv_msgs'];
						break;
						
						case PAGE_FAQ:
							$location = $lang['Viewing_FAQ'];
						break;
						
						default:
							$location = $lang['Forum_index'];
					}
				}
				else
				{
					$location = $online_forum_data[$row['session_page']];
				}

				if ( $location )
				{
					$location = " <i>($location)</i>";
					$user_online_link = $user_online_link . $location;
				}
				// Index Online Location

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM