Jump to content


- - - - -

coreExtensions.php


  • Please log in to reply
5 replies to this topic

#1 pg300

pg300

    Coder

  • Members
  • PipPipPipPipPip
  • 163 posts
  • IPB Version:v3.1.x

Posted 18 August 2010 - 01:51 AM

Hey eveyrone. So I made a coreExtensions.php file for publicSesssions and ip. I followed what it said here:
http://community.inv...ensionsphp-r357

Now while i am in developer mode the online list is updated according to my publicSessions class in my app. But when I installed it to my main forum this is not the case.

Also the IPs even in developer mode are are not showing up in the ACP ip tools section.

Please help.

#2 pg300

pg300

    Coder

  • Members
  • PipPipPipPipPip
  • 163 posts
  • IPB Version:v3.1.x

Posted 20 August 2010 - 12:25 PM

Sorry for the bump.
But is there anything that I could probably be doing wrong?
Something that isn't mentioned on that page? :(

#3 Martin

Martin

    But but, it's not only only!

  • Management
  • PipPipPipPipPipPipPipPipPipPip
  • 7,081 posts
  • Location:Hammerfest, Norway
  • Real Name:Martin Aronsen
  • IPB Version:v3.2.x
Contributor

Posted 20 August 2010 - 10:10 PM

Your code isn't mentioned. Difficult to say anything, really, without that.

#4 pg300

pg300

    Coder

  • Members
  • PipPipPipPipPip
  • 163 posts
  • IPB Version:v3.1.x

Posted 22 August 2010 - 09:07 AM

Oh so sorry. Here's my code:

<?php



if(! defined('IN_IPB'))

{

	print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";

	exit();

}



class publicSessions__avatarlog

{

	public function getSessionVariables()

	{

		//-----------------------------------------

		// INIT

		//-----------------------------------------

		

		$array = array('location_1_type'=> '',
						'location_1_id'	 => 0,
						'location_2_type'	 => '',
						);


			switch(ipsRegistry::$request['module'])
			{
				case 'avatarlog':
					switch(ipsRegistry::$request['code'])
					{
						case 'fullinfo':
							$avname = ipsRegistry::DB()->buildAndFetch(array(
																	'select'	=> 'name',
																	'from'		=> 'cdx_avatarlog_avatars',
																	'where'		=> "ID = ".ipsRegistry::$request['view']
																)	);
							$array['location_1_type']	= $avname['name'].' Guide';
							$array['location_2_type']		= 'app=avatarlog&module=avatarlog&code=fullinfo&view='.ipsRegistry::$request['view'];
							break;
							
						case 'myavatars':
							$array['location_1_type']	= 'Managing Personal Collection';
							$array['location_2_type']	= 'app=avatarlog&module=avatarlog&code=myavatars';//ipsRegistry::$request['do'];
							break;
						
						case 'search':
							$array['location_1_type']	= 'Searching Avatars';
							$array['location_2_type']	= 'app=avatarlog&module=avatarlog&code=search';
							break;
							
						case 'category':
							$cat = ipsRegistry::$request['view'];
							if (!$cat)	{
								$cat = 'Game';
							} else	{
								$cat = ucwords($cat);
							}
							$array['location_1_type']	= 'Viewing Category - '.$cat;
							$array['location_2_type']	= 'app=avatarlog&module=avatarlog&code=category&view='.strtolower($cat);
							break;
						case 'new':
							$array['location_1_type']	= 'New Avatars';
							$array['location_2_type']	= 'app=avatarlog&module=avatarlog&code=new';
							break;
						default:
					}
					break;
					
				case 'statistics':
					switch(ipsRegistry::$request['view'])
					{
						case 'avatar':
							$array['location_1_type']	= 'Global Avatar Stats';
							$array['location_2_type']		= 'app=avatarlog&module=statistics&view=avatar';
							break;
						default:
							$array['location_1_type']	= 'Personal Stats';
							$array['location_2_type']	= 'app=avatarlog&module=statistics';
					}
					break;
					
				case 'community':
					switch(ipsRegistry::$request['code'])
					{
						case 'compare':
							$array['location_1_type']	= 'Community - Comparing User Profiles';
							$array['location_2_type']		= 'app=avatarlog&module=community'.ipsRegistry::$request['view'];
							break;
							
						case 'profile':
							$array['location_1_type']	= 'Community - User Profile';
							$array['location_2_type']	= 'app=avatarlog&module=community';//ipsRegistry::$request['do'];
							break;
						default:
							$array['location_1_type']	= 'Community';
							$array['location_2_type']	= 'app=avatarlog&module=community';
					}
					break;
					
				default:
					$array['location_1_type']	= ipsRegistry::$request['module'];
					$array['location_1_id']		= '0';//ipsRegistry::$request['do'];
				
			}

		return $array;

	}

	public function parseOnlineEntries($rows)

	{
		foreach($rows as $k=>$v)	{
			if($rows[$k]['current_appcomponent'] == 'avatarlog')	{
				$rows[$k]['where_line']		= 'AvatarLog';
				if ($rows[$k]['location_1_type'])	{
					$rows[$k]['where_line'] .= ':';
					$rows[$k]['where_line_more']	= $rows[$k]['location_1_type'];
					if ($rows[$k]['location_2_type'])	{
						$rows[$k]['where_link']		= $rows[$k]['location_2_type'];
					}
				}
			}
		}

		return $rows;

	}

}




class avatarlog_findIpAddress
{

		protected $registry;
		
		public function __construct( ipsRegistry $registry )
		{
				$this->registry = $registry;
		}
		
		public function getTables()
		{
				return array( 'cdx_avatarslogg'   => array( 'mid', 'ip', 'date' )   );
		}
}


#5 Martin

Martin

    But but, it's not only only!

  • Management
  • PipPipPipPipPipPipPipPipPipPip
  • 7,081 posts
  • Location:Hammerfest, Norway
  • Real Name:Martin Aronsen
  • IPB Version:v3.2.x
Contributor

Posted 22 August 2010 - 10:27 AM

public function parseOnlineEntries($rows)
{
	if ( !is_array( $rows ) OR ! count( $rows ) )
	{
		return $rows;
	}
	
	foreach( $rows as $v )
	{
			if( $v['current_appcomponent'] == 'avatarlog' )	
			{
					$row['where_line']		 = 'AvatarLog';
					
					if ( $v['location_1_type'] )
					{
							$row['where_line'] .= ':';
							$row['where_line_more']	= $v['location_1_type'];
							
							if ( $row['location_2_type'] )
							{
									$row['where_link']		 = $v['location_2_type'];
							}
					}
					
					$rows[ $v['id'] ] = $v;
			}
	}

	return $rows;

}


#6 pg300

pg300

    Coder

  • Members
  • PipPipPipPipPip
  • 163 posts
  • IPB Version:v3.1.x

Posted 29 August 2010 - 12:00 PM

Oh wow that simple? Ok thanks so much mate!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users