Vergleich inc/functions.php - 1.8.17 - 1.8.21

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 18Zeile 18
	global $db, $lang, $theme, $templates, $plugins, $mybb;
global $debug, $templatecache, $templatelist, $maintimer, $globaltime, $parsetime;


	global $db, $lang, $theme, $templates, $plugins, $mybb;
global $debug, $templatecache, $templatelist, $maintimer, $globaltime, $parsetime;


 
	$contents = $plugins->run_hooks("pre_parse_page", $contents);

	$contents = parse_page($contents);
$totaltime = format_time_duration($maintimer->stop());
$contents = $plugins->run_hooks("pre_output_page", $contents);

	$contents = parse_page($contents);
$totaltime = format_time_duration($maintimer->stop());
$contents = $plugins->run_hooks("pre_output_page", $contents);

Zeile 623Zeile 624
	// Guests get a special string
else
{

	// Guests get a special string
else
{

		return md5($session->useragent.$mybb->config['database']['username'].$mybb->settings['internal']['encryption_key']);

		return md5($session->sid.$mybb->config['database']['username'].$mybb->settings['internal']['encryption_key']);

	}
}


	}
}


Zeile 868Zeile 869

foreach($errors as $error)
{


foreach($errors as $error)
{

		$errorlist .= "<li>".$error."</li>\n";

		eval("\$errorlist .= \"".$templates->get("error_inline_item")."\";");

	}

eval("\$errors = \"".$templates->get("error_inline")."\";");

	}

eval("\$errors = \"".$templates->get("error_inline")."\";");

Zeile 2041Zeile 2042
		return false;
}


		return false;
}


	$stack = array();
$expected = array();

	$stack = $list = $expected = array();



/*
* states:


/*
* states:

Zeile 3173Zeile 3173

if($dimensions)
{


if($dimensions)
{

		$dimensions = explode("|", $dimensions);

		$dimensions = preg_split('/[|x]/', $dimensions);


if($dimensions[0] && $dimensions[1])
{


if($dimensions[0] && $dimensions[1])
{

			list($max_width, $max_height) = explode('x', $max_dimensions);

			list($max_width, $max_height) = preg_split('/[|x]/', $max_dimensions);


if(!empty($max_dimensions) && ($dimensions[0] > $max_width || $dimensions[1] > $max_height))
{


if(!empty($max_dimensions) && ($dimensions[0] > $max_width || $dimensions[1] > $max_height))
{

Zeile 3274Zeile 3274
			"editor_invalidyoutube" => "Invalid YouTube video",
"editor_dailymotion" => "Dailymotion",
"editor_metacafe" => "MetaCafe",

			"editor_invalidyoutube" => "Invalid YouTube video",
"editor_dailymotion" => "Dailymotion",
"editor_metacafe" => "MetaCafe",

			"editor_veoh" => "Veoh",

			"editor_mixer" => "Mixer",

			"editor_vimeo" => "Vimeo",
"editor_youtube" => "Youtube",
"editor_facebook" => "Facebook",

			"editor_vimeo" => "Vimeo",
"editor_youtube" => "Youtube",
"editor_facebook" => "Facebook",

Zeile 3444Zeile 3444
	}

return $codeinsert;

	}

return $codeinsert;

 
}

/**
* @param int $tid
* @param array $postoptions The options carried with form submit
*
* @return string Predefined / updated subscription method of the thread for the user
*/
function get_subscription_method($tid = 0, $postoptions = array())
{
global $mybb;

$subscription_methods = array('', 'none', 'email', 'pm'); // Define methods
$subscription_method = (int)$mybb->user['subscriptionmethod']; // Set user default

// If no user default method available then reset method
if(!$subscription_method)
{
$subscription_method = 0;
}

// Return user default if no thread id available, in case
if(!(int)$tid || (int)$tid <= 0)
{
return $subscription_methods[$subscription_method];
}

// If method not predefined set using data from database
if(isset($postoptions['subscriptionmethod']))
{
$method = trim($postoptions['subscriptionmethod']);
return (in_array($method, $subscription_methods)) ? $method : $subscription_methods[0];
}
else
{
global $db;

$query = $db->simple_select("threadsubscriptions", "tid, notification", "tid='".(int)$tid."' AND uid='".$mybb->user['uid']."'", array('limit' => 1));
$subscription = $db->fetch_array($query);

if($subscription['tid'])
{
$subscription_method = (int)$subscription['notification'] + 1;
}
}

return $subscription_methods[$subscription_method];

}

/**

}

/**

Zeile 4337Zeile 4384
				eval("\$nav .= \"".$templates->get("nav_bit")."\";");
}
}

				eval("\$nav .= \"".$templates->get("nav_bit")."\";");
}
}

 
		$navsize = count($navbits);
$navbit = $navbits[$navsize-1];

	}

	}


$activesep = '';
$navsize = count($navbits);
$navbit = $navbits[$navsize-1];

 

if($nav)
{


if($nav)
{

Zeile 4356Zeile 4401

/**
* Add a breadcrumb menu item to the list.


/**
* Add a breadcrumb menu item to the list.

 *

 *

 * @param string $name The name of the item to add
* @param string $url The URL of the item to add
*/
function add_breadcrumb($name, $url="")
{
global $navbits;

 * @param string $name The name of the item to add
* @param string $url The URL of the item to add
*/
function add_breadcrumb($name, $url="")
{
global $navbits;





	$navsize = count($navbits);
$navbits[$navsize]['name'] = $name;
$navbits[$navsize]['url'] = $url;

	$navsize = count($navbits);
$navbits[$navsize]['name'] = $name;
$navbits[$navsize]['url'] = $url;

Zeile 4398Zeile 4443
		foreach($pforumcache[$fid] as $key => $forumnav)
{
if($fid == $forumnav['fid'])

		foreach($pforumcache[$fid] as $key => $forumnav)
{
if($fid == $forumnav['fid'])

			{

			{

				if(!empty($pforumcache[$forumnav['pid']]))
{
build_forum_breadcrumb($forumnav['pid']);

				if(!empty($pforumcache[$forumnav['pid']]))
{
build_forum_breadcrumb($forumnav['pid']);

Zeile 4454Zeile 4499

unset($GLOBALS['navbits']);
$GLOBALS['navbits'] = $newnav;


unset($GLOBALS['navbits']);
$GLOBALS['navbits'] = $newnav;

}

}


/**
* Builds a URL to an archive mode page


/**
* Builds a URL to an archive mode page

Zeile 4474Zeile 4519
		$base_url = $mybb->settings['bburl']."/archive/index.php/";
}
else

		$base_url = $mybb->settings['bburl']."/archive/index.php/";
}
else

	{

	{

		$base_url = $mybb->settings['bburl']."/archive/index.php?";
}


		$base_url = $mybb->settings['bburl']."/archive/index.php?";
}


Zeile 4495Zeile 4540

return $url;
}


return $url;
}





/**
* Prints a debug information page
*/
function debug_page()
{
global $db, $debug, $templates, $templatelist, $mybb, $maintimer, $globaltime, $ptimer, $parsetime, $lang, $cache;

/**
* Prints a debug information page
*/
function debug_page()
{
global $db, $debug, $templates, $templatelist, $mybb, $maintimer, $globaltime, $ptimer, $parsetime, $lang, $cache;





	$totaltime = format_time_duration($maintimer->totaltime);
$phptime = $maintimer->totaltime - $db->query_time;
$query_time = $db->query_time;
$globaltime = format_time_duration($globaltime);

	$totaltime = format_time_duration($maintimer->totaltime);
$phptime = $maintimer->totaltime - $db->query_time;
$query_time = $db->query_time;
$globaltime = format_time_duration($globaltime);





	$percentphp = number_format((($phptime/$maintimer->totaltime)*100), 2);
$percentsql = number_format((($query_time/$maintimer->totaltime)*100), 2);

	$percentphp = number_format((($phptime/$maintimer->totaltime)*100), 2);
$percentsql = number_format((($query_time/$maintimer->totaltime)*100), 2);





	$phptime = format_time_duration($maintimer->totaltime - $db->query_time);
$query_time = format_time_duration($db->query_time);


	$phptime = format_time_duration($maintimer->totaltime - $db->query_time);
$query_time = format_time_duration($db->query_time);


Zeile 4523Zeile 4568
	if($mybb->settings['gzipoutput'] != 0)
{
$gzipen = "Enabled";

	if($mybb->settings['gzipoutput'] != 0)
{
$gzipen = "Enabled";

	}

	}

	else
{
$gzipen = "Disabled";

	else
{
$gzipen = "Disabled";

Zeile 4566Zeile 4611
	echo "<td bgcolor=\"#fefefe\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">$phpversion</span></td>\n";
echo "<td bgcolor=\"#efefef\" width=\"25%\"><b><span style=\"font-family: tahoma; font-size: 12px;\">Server Load:</span></b></td>\n";
echo "<td bgcolor=\"#fefefe\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">$serverload</span></td>\n";

	echo "<td bgcolor=\"#fefefe\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">$phpversion</span></td>\n";
echo "<td bgcolor=\"#efefef\" width=\"25%\"><b><span style=\"font-family: tahoma; font-size: 12px;\">Server Load:</span></b></td>\n";
echo "<td bgcolor=\"#fefefe\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">$serverload</span></td>\n";

	echo "</tr>\n";

	echo "</tr>\n";

	echo "<tr>\n";
echo "<td bgcolor=\"#efefef\" width=\"25%\"><b><span style=\"font-family: tahoma; font-size: 12px;\">GZip Encoding Status:</span></b></td>\n";
echo "<td bgcolor=\"#fefefe\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">$gzipen</span></td>\n";
echo "<td bgcolor=\"#efefef\" width=\"25%\"><b><span style=\"font-family: tahoma; font-size: 12px;\">No. Templates Used:</span></b></td>\n";
echo "<td bgcolor=\"#fefefe\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">".count($templates->cache)." (".(int)count(explode(",", $templatelist))." Cached / ".(int)count($templates->uncached_templates)." Manually Loaded)</span></td>\n";

	echo "<tr>\n";
echo "<td bgcolor=\"#efefef\" width=\"25%\"><b><span style=\"font-family: tahoma; font-size: 12px;\">GZip Encoding Status:</span></b></td>\n";
echo "<td bgcolor=\"#fefefe\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">$gzipen</span></td>\n";
echo "<td bgcolor=\"#efefef\" width=\"25%\"><b><span style=\"font-family: tahoma; font-size: 12px;\">No. Templates Used:</span></b></td>\n";
echo "<td bgcolor=\"#fefefe\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">".count($templates->cache)." (".(int)count(explode(",", $templatelist))." Cached / ".(int)count($templates->uncached_templates)." Manually Loaded)</span></td>\n";

	echo "</tr>\n";

	echo "</tr>\n";


$memory_usage = get_memory_usage();
if(!$memory_usage)
{
$memory_usage = $lang->unknown;


$memory_usage = get_memory_usage();
if(!$memory_usage)
{
$memory_usage = $lang->unknown;

	}

	}

	else
{
$memory_usage = get_friendly_size($memory_usage)." ({$memory_usage} bytes)";

	else
{
$memory_usage = get_friendly_size($memory_usage)." ({$memory_usage} bytes)";

Zeile 4589Zeile 4634
	echo "<td bgcolor=\"#FEFEFE\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">{$memory_usage}</span></td>\n";
echo "<td bgcolor=\"#EFEFEF\" width=\"25%\"><b><span style=\"font-family: tahoma; font-size: 12px;\">Memory Limit:</span></b></td>\n";
echo "<td bgcolor=\"#FEFEFE\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">{$memory_limit}</span></td>\n";

	echo "<td bgcolor=\"#FEFEFE\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">{$memory_usage}</span></td>\n";
echo "<td bgcolor=\"#EFEFEF\" width=\"25%\"><b><span style=\"font-family: tahoma; font-size: 12px;\">Memory Limit:</span></b></td>\n";
echo "<td bgcolor=\"#FEFEFE\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">{$memory_limit}</span></td>\n";

	echo "</tr>\n";

echo "</table>\n";

	echo "</tr>\n";

echo "</table>\n";


echo "<h2>Database Connections (".count($db->connections)." Total) </h2>\n";
echo "<table style=\"background-color: #666;\" width=\"95%\" cellpadding=\"4\" cellspacing=\"1\" align=\"center\">\n";


echo "<h2>Database Connections (".count($db->connections)." Total) </h2>\n";
echo "<table style=\"background-color: #666;\" width=\"95%\" cellpadding=\"4\" cellspacing=\"1\" align=\"center\">\n";

Zeile 4617Zeile 4662
		echo "<table style=\"background-color: #666;\" width=\"95%\" cellpadding=\"4\" cellspacing=\"1\" align=\"center\">\n";
echo "<tr>\n";
echo "<td style=\"background-color: #ccc;\"><strong>Templates Used (Loaded for this Page) - ".count($templates->cache)." Total</strong></td>\n";

		echo "<table style=\"background-color: #666;\" width=\"95%\" cellpadding=\"4\" cellspacing=\"1\" align=\"center\">\n";
echo "<tr>\n";
echo "<td style=\"background-color: #ccc;\"><strong>Templates Used (Loaded for this Page) - ".count($templates->cache)." Total</strong></td>\n";

		echo "</tr>\n";
echo "<tr>\n";
echo "<td style=\"background: #fff;\">".implode(", ", array_keys($templates->cache))."</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<br />\n";

		echo "</tr>\n";
echo "<tr>\n";
echo "<td style=\"background: #fff;\">".implode(", ", array_keys($templates->cache))."</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<br />\n";

	}

if(count($templates->uncached_templates) > 0)

	}

if(count($templates->uncached_templates) > 0)

Zeile 4791Zeile 4836
		), $options);
}
elseif($weeks > 0)

		), $options);
}
elseif($weeks > 0)

	{

	{

		$options = array_merge(array(
'minutes' => false,
'seconds' => false

		$options = array_merge(array(
'minutes' => false,
'seconds' => false

Zeile 6386Zeile 6431
	}
// This user has a cookie lockout, show waiting time
elseif($mybb->cookies['lockoutexpiry'] && $mybb->cookies['lockoutexpiry'] > $now)

	}
// This user has a cookie lockout, show waiting time
elseif($mybb->cookies['lockoutexpiry'] && $mybb->cookies['lockoutexpiry'] > $now)

	{	

	{

		if($fatal)
{
$secsleft = (int)($mybb->cookies['lockoutexpiry'] - $now);

		if($fatal)
{
$secsleft = (int)($mybb->cookies['lockoutexpiry'] - $now);

Zeile 6395Zeile 6440
			$secsleft = floor($secsleft % 60);

error($lang->sprintf($lang->failed_login_wait, $hoursleft, $minsleft, $secsleft));

			$secsleft = floor($secsleft % 60);

error($lang->sprintf($lang->failed_login_wait, $hoursleft, $minsleft, $secsleft));

		}


		}


		return false;
}


		return false;
}


Zeile 6406Zeile 6451
		if($attempts['loginlockoutexpiry'] == 0)
{
$attempts['loginlockoutexpiry'] = $now + ((int)$mybb->settings['failedlogintime'] * 60);

		if($attempts['loginlockoutexpiry'] == 0)
{
$attempts['loginlockoutexpiry'] = $now + ((int)$mybb->settings['failedlogintime'] * 60);





			// Add a cookie lockout. This is used to prevent access to the login page immediately.
// A deep lockout is issued if he tries to login into a locked out account
my_setcookie('lockoutexpiry', $attempts['loginlockoutexpiry']);

			// Add a cookie lockout. This is used to prevent access to the login page immediately.
// A deep lockout is issued if he tries to login into a locked out account
my_setcookie('lockoutexpiry', $attempts['loginlockoutexpiry']);

Zeile 6421Zeile 6466
			$failedtime = $attempts['loginlockoutexpiry'];
}
else

			$failedtime = $attempts['loginlockoutexpiry'];
}
else

		{

		{

			$failedtime = $mybb->cookies['lockoutexpiry'];
}

// Are we still locked out?
if($attempts['loginlockoutexpiry'] > $now)

			$failedtime = $mybb->cookies['lockoutexpiry'];
}

// Are we still locked out?
if($attempts['loginlockoutexpiry'] > $now)

		{	

		{

			if($fatal)
{
$secsleft = (int)($attempts['loginlockoutexpiry'] - $now);

			if($fatal)
{
$secsleft = (int)($attempts['loginlockoutexpiry'] - $now);

Zeile 7480Zeile 7525
		"0-6-0" => "6 {$lang->months}",
"0-0-1" => "1 {$lang->year}",
"0-0-2" => "2 {$lang->years}"

		"0-6-0" => "6 {$lang->months}",
"0-0-1" => "1 {$lang->year}",
"0-0-2" => "2 {$lang->years}"

	);

	);


$ban_times = $plugins->run_hooks("functions_fetch_ban_times", $ban_times);



$ban_times = $plugins->run_hooks("functions_fetch_ban_times", $ban_times);


Zeile 7563Zeile 7608
	global $orig_dir;

if(!isset($orig_dir))

	global $orig_dir;

if(!isset($orig_dir))

	{

	{

		$orig_dir = $path;
}


		$orig_dir = $path;
}


Zeile 7583Zeile 7628

// Are we done? Don't delete the main folder too and return true
if($path == $orig_dir)


// Are we done? Don't delete the main folder too and return true
if($path == $orig_dir)

		{

		{

			return true;
}


			return true;
}


Zeile 7599Zeile 7644
 * @param array $array The array of forums
* @return integer The number of sub forums
*/

 * @param array $array The array of forums
* @return integer The number of sub forums
*/

function subforums_count($array)

function subforums_count($array=array())

{
$count = 0;
foreach($array as $array2)
{
$count += count($array2);

{
$count = 0;
foreach($array as $array2)
{
$count += count($array2);

	}

	}


return $count;
}


return $count;
}

Zeile 7626Zeile 7671
	if(!$ip_long)
{
$ip_long = sprintf("%u", ip2long($ip));

	if(!$ip_long)
{
$ip_long = sprintf("%u", ip2long($ip));





		if(!$ip_long)
{
return 0;
}

		if(!$ip_long)
{
return 0;
}

	}

	}


if($ip_long >= 2147483648) // Won't occur on 32-bit PHP
{
$ip_long -= 4294967296;
}


if($ip_long >= 2147483648) // Won't occur on 32-bit PHP
{
$ip_long -= 4294967296;
}





	return $ip_long;
}


	return $ip_long;
}


Zeile 7648Zeile 7693
 * @deprecated
* @param integer $long The IP to convert (will accept 64-bit IPs as well)
* @return string IP in IPv4 format

 * @deprecated
* @param integer $long The IP to convert (will accept 64-bit IPs as well)
* @return string IP in IPv4 format

 */

 */

function my_long2ip($long)
{
// On 64-bit machines is_int will return true. On 32-bit it will return false

function my_long2ip($long)
{
// On 64-bit machines is_int will return true. On 32-bit it will return false

Zeile 7982Zeile 8027
					continue;
}
$bad_verify_files[] = array("status" => "missing", "path" => $file_path);

					continue;
}
$bad_verify_files[] = array("status" => "missing", "path" => $file_path);

			}
}
}

			}
}
}


// uh oh
if($count == 0)


// uh oh
if($count == 0)

Zeile 8152Zeile 8197
		{
$elements = unpack('N2', $output);
$output = abs($elements[1] << 32 | $elements[2]);

		{
$elements = unpack('N2', $output);
$output = abs($elements[1] << 32 | $elements[2]);

		}


		}


	} while($output > PHP_INT_MAX);

return $output;

	} while($output > PHP_INT_MAX);

return $output;

Zeile 8404Zeile 8449
					{
$string .= '?';
continue;

					{
$string .= '?';
continue;

					}
else

					}
else

					{
return false;
}

					{
return false;
}

Zeile 8437Zeile 8482
				$valid = true;
$multibytes = $input[$i];
while($bytes > 1)

				$valid = true;
$multibytes = $input[$i];
while($bytes > 1)

				{

				{

					$i++;
$b = ord($input[$i]);
if($b < 128 || $b > 191)

					$i++;
$b = ord($input[$i]);
if($b < 128 || $b > 191)

Zeile 8447Zeile 8492
							$valid = false;
$string .= '?';
break;

							$valid = false;
$string .= '?';
break;

						}

						}

						else
{
return false;
}

						else
{
return false;
}

					}

					}

					else
{
$multibytes .= $input[$i];
}
$bytes--;

					else
{
$multibytes .= $input[$i];
}
$bytes--;

				}

				}

				if($valid)
{
$string .= $multibytes;
}

				if($valid)
{
$string .= $multibytes;
}

			}

			}

			else
{
$string .= $input[$i];
}

			else
{
$string .= $input[$i];
}

		}

		}

		$input = $string;
}
if($return)
{
if($allow_mb4)

		$input = $string;
}
if($return)
{
if($allow_mb4)

		{

		{

			return $input;
}
else
{

			return $input;
}
else
{

			return preg_replace("#[^\\x00-\\x7F][\\x80-\\xBF]{3,}#", '?', $input);

			return preg_replace("#[^\\x00-\\x7F][\\x80-\\xBF]{3,}#", '?', $input);

		}
}
else

		}
}
else

Zeile 8489Zeile 8534
			return true;
}
else

			return true;
}
else

		{

		{

			return !preg_match("#[^\\x00-\\x7F][\\x80-\\xBF]{3,}#", $input);
}
}

			return !preg_match("#[^\\x00-\\x7F][\\x80-\\xBF]{3,}#", $input);
}
}

Zeile 8508Zeile 8553
	global $lang, $mybb, $db, $session;

if($mybb->settings['enablepms'] == 0)

	global $lang, $mybb, $db, $session;

if($mybb->settings['enablepms'] == 0)

	{
return false;
}

	{
return false;
}


if(!is_array($pm))
{


if(!is_array($pm))
{

Zeile 8531Zeile 8576
		foreach(array('subject', 'message') as $key)
{
if(is_array($pm[$key]))

		foreach(array('subject', 'message') as $key)
{
if(is_array($pm[$key]))

			{

			{

				$lang_string = $lang->{$pm[$key][0]};
$num_args = count($pm[$key]);


				$lang_string = $lang->{$pm[$key][0]};
$num_args = count($pm[$key]);


Zeile 8573Zeile 8618
	if(is_array($toid))
{
$recipients_to = $toid;

	if(is_array($toid))
{
$recipients_to = $toid;

	}

	}

	else
{
$recipients_to = array($toid);

	else
{
$recipients_to = array($toid);

Zeile 8825Zeile 8870
	$string = str_replace('"', '""', $string);

return $string;

	$string = str_replace('"', '""', $string);

return $string;

 
}

// Fallback function for 'array_column', PHP < 5.5.0 compatibility
if(!function_exists('array_column'))
{
function array_column($input, $column_key)
{
$values = array();
if(!is_array($input))
{
$input = array($input);
}
foreach($input as $val)
{
if(is_array($val) && isset($val[$column_key]))
{
$values[] = $val[$column_key];
}
elseif(is_object($val) && isset($val->$column_key))
{
$values[] = $val->$column_key;
}
}
return $values;
}
}

/**
* Performs a timing attack safe string comparison.
*
* @param string $known_string The first string to be compared.
* @param string $user_string The second, user-supplied string to be compared.
* @return bool Result of the comparison.
*/
function my_hash_equals($known_string, $user_string)
{
if(version_compare(PHP_VERSION, '5.6.0', '>='))
{
return hash_equals($known_string, $user_string);
}
else
{
$known_string_length = my_strlen($known_string);
$user_string_length = my_strlen($user_string);

if($user_string_length != $known_string_length)
{
return false;
}

$result = 0;

for($i = 0; $i < $known_string_length; $i++)
{
$result |= ord($known_string[$i]) ^ ord($user_string[$i]);
}

return $result === 0;
}
}

/**
* Retrieves all referrals for a specified user
*
* @param int uid
* @param int start position
* @param int total entries
* @param bool false (default) only return display info, true for all info
* @return array
*/
function get_user_referrals($uid, $start=0, $limit=0, $full=false)
{
global $db;

$referrals = $query_options = array();
$uid = (int) $uid;

if($uid === 0)
{
return $referrals;
}

if($start && $limit)
{
$query_options['limit_start'] = $start;
}

if($limit)
{
$query_options['limit'] = $limit;
}

$fields = 'uid, username, usergroup, displaygroup, regdate';
if($full === true)
{
$fields = '*';
}

$query = $db->simple_select('users', $fields, "referrer='{$uid}'", $query_options);

while($referral = $db->fetch_array($query))
{
$referrals[] = $referral;
}

return $referrals;

}

}