Testing phpBB Countdown

Use the BBCode Testarea to test our BBCodes
All testing must be done here
There is no support here! Only Read Access!
cisco007
BBCoder VI
BBCoder VI
Posts: 1015
Joined: 16 Mar 2010, 18:14
Location: Don't really know!

Re: Testing phpBB Countdown

Post by cisco007 »

try neuropass's solution above, if it don't work, i don't know what else to tell you, maybe Stoker knows!
User avatar
Stoker
Site Admin
Site Admin
Posts: 3536
Joined: 12 May 2008, 23:26
BBCodes: 239
Favourite BBCode: Anipro
Favourite MOD: PrettyPhoto
Location: Denmark
Contact:

Re: Testing phpBB Countdown

Post by Stoker »

About red X and images.
Right click the image and find out where it should be located.
Upload it to its right location if its not there.

For the moment I am using neuros solution.
Board rules! No PM support
User avatar
Stitch
BBCoder II
BBCoder II
Posts: 28
Joined: 06 Mar 2010, 06:08

Re: Testing phpBB Countdown

Post by Stitch »

Ok I am using Neuropass's fix but here is what i am getting when I view the properties of the red X

Code: Select all

http://www.northerncountrymorels.com/messageboard/images/user_agent/browser/.png
Here is my code:
/

Code: Select all

*
	Returns relative path to icon
*/
function ua_get_filename($name, $folder)
{
	if (substr($name, 0, 7) == 'Nieznan')
      return '/images/spacer.gif';

	$name = strtolower($name);
	$name = str_replace(' ', '', $name); // remove spaces
	$name = preg_replace('/[^a-z0-9_]/', '', $name); // remove special characters
	return 'images/user_agent/'.$folder.'/'.$name.'.png';
}
Image
User avatar
Stoker
Site Admin
Site Admin
Posts: 3536
Joined: 12 May 2008, 23:26
BBCodes: 239
Favourite BBCode: Anipro
Favourite MOD: PrettyPhoto
Location: Denmark
Contact:

Re: Testing phpBB Countdown

Post by Stoker »

This is my file:

Code: Select all

<?php

/*
	Returns relative path to icon
*/
function ua_get_filename($name, $folder)
{
	if (substr($name, 0, 7) == 'Nieznan')
		return './images/user_agent/unknown.png';

	$name = strtolower($name);
	$name = str_replace(' ', '', $name); // remove spaces
	$name = preg_replace('/[^a-z0-9_]/', '', $name); // remove special characters
	return 'images/user_agent/'.$folder.'/'.$name.'.png';
}

/*
	Returns first found element in $useragent from $items array
*/
function ua_search_for_item($items, $useragent)
{
	$result = '';
	
	foreach ($items as $item)
	{
		if (strpos($useragent, strtolower($item)) !== false)
		{
			$result = $item;
			break;
		}
	}
	return $result;
}

/*
	Main function detecting browser and system
*/
function get_useragent_names($useragent)
{
	if (!$useragent)
	{
		$result = array(
			'system'			=> '',
			'browser'			=> '',
			'browser_version'	=> ''
		);
		return $result;
	}

	$useragent = strtolower($useragent);
	
	// Browser detection
	$browsers = array('AWeb', 'Camino', 'Epiphany', 'Galeon', 'HotJava', 'iCab', 'MSIE', 'Chrome', 'Safari', 'Konqueror', 'Flock', 'Iceweasel', 'SeaMonkey', 'Firefox', 'Firebird', 'Netscape', 'Mozilla', 'Opera', 'Maxthon', 'PhaseOut', 'SlimBrowser');
	
	$browser = ua_search_for_item($browsers, $useragent);

	$browser_version = '';
	if ($browser != '')
	{
		if ($browser == 'Opera' && strpos($useragent, 'version') !== false)
			$browser_version = substr($useragent, strpos($useragent, 'version') + 8);
		else
			$browser_version = substr($useragent, strpos($useragent, strtolower($browser)) + strlen($browser) + 1);
		
		if (preg_match('/([0-9\.]*)/', $browser_version, $matches))
			$browser_version = $matches[1];
	}

	// Detect IE version
	if ($browser == 'MSIE')
	{
		$browser = 'Internet Explorer';
		if ($browser_version != '')
		{
			$ver = substr($browser_version, 0, 1);
			
			if ($ver >= 6)
			{
				$browser .= ' '. $ver;
				$browser_version = '';
			}
		}
	}
	
	// System detection
	$systems = array('Amiga', 'BeOS', 'FreeBSD', 'HP-UX', 'Linux', 'NetBSD', 'OS/2', 'SunOS', 'Symbian', 'Unix', 'Windows', 'Sun', 'Macintosh', 'Mac');
	
	$system = ua_search_for_item($systems, $useragent);
	
	if ($system == 'Linux')
	{
		$systems = array('CentOS', 'Debian', 'Fedora', 'Freespire', 'Gentoo', 'Katonix', 'KateOS', 'Knoppix', 'Kubuntu', 'Linspire', 'Mandriva', 'Mandrake', 'RedHat', 'Slackware', 'Slax', 'Suse', 'Xubuntu', 'Ubuntu', 'Xandros', 'Arch', 'Ark');

		$system = ua_search_for_item($systems, $useragent);
		if ($system == '')
			$system = 'Linux';
		
		if ($system == 'Mandrake')
			$system = 'Mandriva';
	}
	elseif ($system == 'Windows')
	{
		$version = substr($useragent, strpos($useragent, 'windows nt ') + 11);
		if (substr($version, 0, 3) == 5.1)
			$system = 'Windows XP';
		elseif (substr($version, 0, 1) == 6)
		{
			if (substr($version, 0, 3) == 6.0)
				$system = 'Windows Vista';
			else
				$system = 'Windows 7';
		}
	}
	elseif ($system == 'Mac')
		$system = 'Macintosh';

	if (!$system)
		$system = 'Nieznany';
	if (!$browser)
		$browser = 'Nieznana';

	$result = array(
		'system'			=> $system,
		'browser'			=> $browser,
		'browser_version'	=> $browser_version
	);

	return $result;
}

/*
	Displays icons
*/
function get_useragent_icons($useragent)
{
	$agent = get_useragent_names($useragent);

	$result = '<img src="'.ua_get_filename($agent['system'], 'os').'" style="cursor: pointer" title="'.htmlspecialchars($agent['system']).'" alt="'.htmlspecialchars($agent['system']).'" />&nbsp;';
	$result .= '<img src="'.ua_get_filename($agent['browser'], 'browser').'" style="cursor: pointer" title="'.htmlspecialchars($agent['browser'].' '.$agent['browser_version']).'" alt="'.htmlspecialchars($agent['browser']).'" />';

	$description = addslashes($useragent) . '\n\nSystem:\t\t' . addslashes($agent['system']);
	$description .= '\nBrowser:\t\t' . addslashes($agent['browser'].' '.$agent['browser_version']);

	return '<span class="user-agent" onclick="alert(\'' . htmlspecialchars($description) . '\')">' . $result . '</span>';
}

?>
Board rules! No PM support
User avatar
Stitch
BBCoder II
BBCoder II
Posts: 28
Joined: 06 Mar 2010, 06:08

Re: Testing phpBB Countdown

Post by Stitch »

Ok I got my own fix and it is very simple. All I did was open up "Spacer.gif" and saved it as "nieznany.png"

All the code fixes above didn't work for me for whatever reason.
Image
Locked