Vergleich inc/functions.php - 1.6.4 - 1.6.8

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * $Id: functions.php 5490 2011-07-12 13:39:55Z Tomm $

 * $Id: functions.php 5819 2012-04-27 15:39:09Z Tomm $

 */

/**

 */

/**

Zeile 92Zeile 92
	echo $contents;

$plugins->run_hooks("post_output_page");

	echo $contents;

$plugins->run_hooks("post_output_page");


// If the use shutdown functionality is turned off, run any shutdown related items now.
if($mybb->settings['useshutdownfunc'] == 0 && $mybb->use_shutdown != true)
{
run_shutdown();
}

 
}

/**

}

/**

Zeile 246Zeile 240

// Fetch emails for this page view - and send them
$query = $db->simple_select("mailqueue", "*", "", array("order_by" => "mid", "order_dir" => "asc", "limit_start" => 0, "limit" => $count));


// Fetch emails for this page view - and send them
$query = $db->simple_select("mailqueue", "*", "", array("order_by" => "mid", "order_dir" => "asc", "limit_start" => 0, "limit" => $count));


$plugins->run_hooks_by_ref("send_mail_queue_mail", $query);

 

while($email = $db->fetch_array($query))
{
// Delete the message from the queue
$db->delete_query("mailqueue", "mid='{$email['mid']}'");



while($email = $db->fetch_array($query))
{
// Delete the message from the queue
$db->delete_query("mailqueue", "mid='{$email['mid']}'");


			my_mail($email['mailto'], $email['subject'], $email['message'], $email['mailfrom'], "", $email['headers']);




			if($db->affected_rows() == 1)
{
my_mail($email['mailto'], $email['subject'], $email['message'], $email['mailfrom'], "", $email['headers']);
}

		}
// Update the mailqueue cache and remove the lock
$cache->update_mailqueue(TIME_NOW, 0);

		}
// Update the mailqueue cache and remove the lock
$cache->update_mailqueue(TIME_NOW, 0);

	}

	}


$plugins->run_hooks("send_mail_queue_end");
}


$plugins->run_hooks("send_mail_queue_end");
}

Zeile 395Zeile 390

if(is_object($plugins))
{


if(is_object($plugins))
{

		$plugins->run_hooks_by_ref("my_date", $date);

		$date = $plugins->run_hooks("my_date", $date);

	}

return $date;

	}

return $date;

Zeile 421Zeile 416
	
// Does our object not exist? Create it
if(!is_object($mail))

	
// Does our object not exist? Create it
if(!is_object($mail))

	{

	{

		require_once MYBB_ROOT."inc/class_mailhandler.php";

if($mybb->settings['mail_handler'] == 'smtp')

		require_once MYBB_ROOT."inc/class_mailhandler.php";

if($mybb->settings['mail_handler'] == 'smtp')

Zeile 451Zeile 446
		if($mybb->settings['mail_parameters'] != '')
{
$mail->additional_parameters = $mybb->settings['mail_parameters'];

		if($mybb->settings['mail_parameters'] != '')
{
$mail->additional_parameters = $mybb->settings['mail_parameters'];

		}

		}

	}

// Build and send

	}

// Build and send

Zeile 461Zeile 456

/**
* Generates a unique code for POST requests to prevent XSS/CSRF attacks


/**
* Generates a unique code for POST requests to prevent XSS/CSRF attacks

 *

 *

 * @return string The generated code
*/
function generate_post_check()

 * @return string The generated code
*/
function generate_post_check()

Zeile 502Zeile 497
			else
{
error($lang->invalid_post_code);

			else
{
error($lang->invalid_post_code);

			}
}

			}
}

	}
else
{

	}
else
{

Zeile 534Zeile 529
	{
cache_forums();
return $forum_cache[$fid]['parentlist'];

	{
cache_forums();
return $forum_cache[$fid]['parentlist'];

	}

	}

}

/**

}

/**

Zeile 561Zeile 556
	{
$builtlist .= "$sep$column='$val'";
$sep = " $joiner ";

	{
$builtlist .= "$sep$column='$val'";
$sep = " $joiner ";

	}

$builtlist .= ")";


	}

$builtlist .= ")";


	return $builtlist;
}


	return $builtlist;
}


Zeile 584Zeile 579
	}

if(!$forum_cache)

	}

if(!$forum_cache)

	{

	{

		$forum_cache = $cache->read("forums");
if(!$forum_cache)
{

		$forum_cache = $cache->read("forums");
if(!$forum_cache)
{

Zeile 593Zeile 588
		}
}
return $forum_cache;

		}
}
return $forum_cache;

}

/**

}

/**

 * Generate an array of all child and descendant forums for a specific forum.
*
* @param int The forum ID

 * Generate an array of all child and descendant forums for a specific forum.
*
* @param int The forum ID

Zeile 615Zeile 610
			{
$forums_by_parent[$forum['pid']][$forum['fid']] = $forum;
}

			{
$forums_by_parent[$forum['pid']][$forum['fid']] = $forum;
}

		}

		}

	}
if(!is_array($forums_by_parent[$fid]))
{

	}
if(!is_array($forums_by_parent[$fid]))
{

Zeile 644Zeile 639
{
global $header, $footer, $theme, $headerinclude, $db, $templates, $lang, $mybb, $plugins;


{
global $header, $footer, $theme, $headerinclude, $db, $templates, $lang, $mybb, $plugins;


	$plugins->run_hooks_by_ref("error", $error);

	$error = $plugins->run_hooks("error", $error);

	if(!$error)

	if(!$error)

	{

	{

		$error = $lang->unknown_error;
}


		$error = $lang->unknown_error;
}


Zeile 666Zeile 661

$timenow = my_date($mybb->settings['dateformat'], TIME_NOW) . " " . my_date($mybb->settings['timeformat'], TIME_NOW);
reset_breadcrumb();


$timenow = my_date($mybb->settings['dateformat'], TIME_NOW) . " " . my_date($mybb->settings['timeformat'], TIME_NOW);
reset_breadcrumb();

	add_breadcrumb($lang->error);

	add_breadcrumb($lang->error);


eval("\$errorpage = \"".$templates->get("error")."\";");
output_page($errorpage);


eval("\$errorpage = \"".$templates->get("error")."\";");
output_page($errorpage);

Zeile 696Zeile 691
	}

// AJAX error message?

	}

// AJAX error message?

	if($mybb->input['ajax'])
{

	if($mybb->input['ajax'])
{

		$error = implode("\n\n", $errors);
// Send our headers.
@header("Content-type: text/html; charset={$lang->settings['charset']}");

		$error = implode("\n\n", $errors);
// Send our headers.
@header("Content-type: text/html; charset={$lang->settings['charset']}");

Zeile 748Zeile 743
	}
else
{

	}
else
{

 
		// Redirect to where the user came from
$redirect_url = $_SERVER['PHP_SELF'];
if($_SERVER['QUERY_STRING'])
{
$redirect_url .= '?'.$_SERVER['QUERY_STRING'];
}

$redirect_url = htmlspecialchars_uni($redirect_url);

switch($mybb->settings['username_method'])
{
case 0:
$lang_username = $lang->username;
break;
case 1:
$lang_username = $lang->username1;
break;
case 2:
$lang_username = $lang->username2;
break;
default:
$lang_username = $lang->username;
break;
}

		eval("\$errorpage = \"".$templates->get("error_nopermission")."\";");
}


		eval("\$errorpage = \"".$templates->get("error_nopermission")."\";");
}


Zeile 766Zeile 785

$redirect_args = array('url' => &$url, 'message' => &$message, 'title' => &$title);



$redirect_args = array('url' => &$url, 'message' => &$message, 'title' => &$title);


	$plugins->run_hooks_by_ref("redirect", $redirect_args);

	$plugins->run_hooks("redirect", $redirect_args);


if($mybb->input['ajax'])
{


if($mybb->input['ajax'])
{

Zeile 814Zeile 833

run_shutdown();



run_shutdown();


		if(my_substr($url, 0, 7) !== 'http://')

		if(my_substr($url, 0, 7) !== 'http://' && my_substr($url, 0, 8) !== 'https://' && my_substr($url, 0, 1) !== '/')

		{
header("Location: {$mybb->settings['bburl']}/{$url}");
}

		{
header("Location: {$mybb->settings['bburl']}/{$url}");
}

Zeile 1700Zeile 1719
		return false;
}


		return false;
}


	$cookie = unserialize($mybb->cookies['mybb'][$name]);

	$cookie = my_unserialize($mybb->cookies['mybb'][$name]);


if(is_array($cookie) && isset($cookie[$id]))
{


if(is_array($cookie) && isset($cookie[$id]))
{

Zeile 1719Zeile 1738
 * @param int The cookie content id.
* @param string The value to set the cookie to.
*/

 * @param int The cookie content id.
* @param string The value to set the cookie to.
*/

function my_set_array_cookie($name, $id, $value)

function my_set_array_cookie($name, $id, $value, $expires="")

{
global $mybb;

$cookie = $mybb->cookies['mybb'];

{
global $mybb;

$cookie = $mybb->cookies['mybb'];

	$newcookie = unserialize($cookie[$name]);

if(!is_array($newcookie))
{
// Burnt / malformed cookie - reset
$newcookie = array();
}

	$newcookie = my_unserialize($cookie[$name]);








$newcookie[$id] = $value;
$newcookie = serialize($newcookie);


$newcookie[$id] = $value;
$newcookie = serialize($newcookie);

	my_setcookie("mybb[$name]", addslashes($newcookie));


	my_setcookie("mybb[$name]", addslashes($newcookie), $expires);


	// Make sure our current viarables are up-to-date as well
$mybb->cookies['mybb'][$name] = $newcookie;
}

	// Make sure our current viarables are up-to-date as well
$mybb->cookies['mybb'][$name] = $newcookie;
}

 

/**
* Verifies that data passed is an array
*
* @param array Data to unserialize
* @return array Unserialized data array
*/
function my_unserialize($data)
{
$array = unserialize($data);

if(!is_array($array))
{
$array = array();
}

return $array;
}


/**
* Returns the serverload of the system.


/**
* Returns the serverload of the system.

Zeile 1836Zeile 1867
			else
{
$new_stats[$counter] = $changes[$counter];

			else
{
$new_stats[$counter] = $changes[$counter];

			}

			}

			// Less than 0? That's bad
if($new_stats[$counter] < 0)
{
$new_stats[$counter] = 0;
}
}

			// Less than 0? That's bad
if($new_stats[$counter] < 0)
{
$new_stats[$counter] = 0;
}
}

	}

	}


// Fetch latest user if the user count is changing
if(array_key_exists('numusers', $changes))


// Fetch latest user if the user count is changing
if(array_key_exists('numusers', $changes))

Zeile 1876Zeile 1907
		"numposts" => $stats['numposts']
);
$db->replace_query("stats", $todays_stats, "dateline");

		"numposts" => $stats['numposts']
);
$db->replace_query("stats", $todays_stats, "dateline");





	$cache->update("stats", $stats, "dateline");
}


	$cache->update("stats", $stats, "dateline");
}


Zeile 1889Zeile 1920
function update_forum_counters($fid, $changes=array())
{
global $db, $cache;

function update_forum_counters($fid, $changes=array())
{
global $db, $cache;





	$update_query = array();

$counters = array('threads','unapprovedthreads','posts','unapprovedposts');

	$update_query = array();

$counters = array('threads','unapprovedthreads','posts','unapprovedposts');

Zeile 1901Zeile 1932
	foreach($counters as $counter)
{
if(array_key_exists($counter, $changes))

	foreach($counters as $counter)
{
if(array_key_exists($counter, $changes))

		{

		{

			// Adding or subtracting from previous value?
if(substr($changes[$counter], 0, 1) == "+" || substr($changes[$counter], 0, 1) == "-")

			// Adding or subtracting from previous value?
if(substr($changes[$counter], 0, 1) == "+" || substr($changes[$counter], 0, 1) == "-")

			{

			{

				$update_query[$counter] = $forum[$counter] + $changes[$counter];

				$update_query[$counter] = $forum[$counter] + $changes[$counter];

			}
else
{

			}
else
{

				$update_query[$counter] = $changes[$counter];
}

// Less than 0? That's bad
if(!$update_query[$counter])

				$update_query[$counter] = $changes[$counter];
}

// Less than 0? That's bad
if(!$update_query[$counter])

			{

			{

				$update_query[$counter] = 0;
}
}

				$update_query[$counter] = 0;
}
}

Zeile 1940Zeile 1971
			else
{
$new_stats['numthreads'] = "{$threads_diff}";

			else
{
$new_stats['numthreads'] = "{$threads_diff}";

			}
}


			}
}


		if(array_key_exists('unapprovedthreads', $update_query))
{
$unapprovedthreads_diff = $update_query['unapprovedthreads'] - $forum['unapprovedthreads'];

		if(array_key_exists('unapprovedthreads', $update_query))
{
$unapprovedthreads_diff = $update_query['unapprovedthreads'] - $forum['unapprovedthreads'];

Zeile 2048Zeile 2079
				$update_query[$counter] = $thread[$counter] + $changes[$counter];
}
else

				$update_query[$counter] = $thread[$counter] + $changes[$counter];
}
else

			{

			{

				$update_query[$counter] = $changes[$counter];
}


				$update_query[$counter] = $changes[$counter];
}


Zeile 2064Zeile 2095

// Only update if we're actually doing something
if(count($update_query) > 0)


// Only update if we're actually doing something
if(count($update_query) > 0)

	{

	{

		$db->update_query("threads", $update_query, "tid='".intval($tid)."'");
}


		$db->update_query("threads", $update_query, "tid='".intval($tid)."'");
}


Zeile 2072Zeile 2103

update_thread_data($tid);
}


update_thread_data($tid);
}





/**
* Update the first post and lastpost data for a specific thread
*

/**
* Update the first post and lastpost data for a specific thread
*

Zeile 2081Zeile 2112
function update_thread_data($tid)
{
global $db;

function update_thread_data($tid)
{
global $db;

 

$thread = get_thread($tid);

// If this is a moved thread marker, don't update it - we need it to stay as it is
if(strpos($thread['closed'], 'moved|') !== false)
{
return false;
}


	$query = $db->query("
SELECT u.uid, u.username, p.username AS postusername, p.dateline
FROM ".TABLE_PREFIX."posts p

	$query = $db->query("
SELECT u.uid, u.username, p.username AS postusername, p.dateline
FROM ".TABLE_PREFIX."posts p

Zeile 2153Zeile 2193

/**
* Deletes a thread from the database


/**
* Deletes a thread from the database

 *
* @param int The thread ID

 *
* @param int The thread ID

 */
function delete_thread($tid)
{

 */
function delete_thread($tid)
{

Zeile 2283Zeile 2323
		else
{
$template = "advanced";

		else
{
$template = "advanced";

 

if(strpos(FORUM_URL, '.html') !== false)
{
$forum_link = "'".str_replace('{fid}', "'+this.options[this.selectedIndex].value+'", FORUM_URL)."'";
}
else
{
$forum_link = "'".str_replace('{fid}', "'+this.options[this.selectedIndex].value", FORUM_URL);
}

		}

eval("\$forumjump = \"".$templates->get("forumjump_".$template)."\";");

		}

eval("\$forumjump = \"".$templates->get("forumjump_".$template)."\";");

Zeile 2394Zeile 2443
			"editor_enter_image",
"editor_enter_video_url",
"editor_video_dailymotion",

			"editor_enter_image",
"editor_enter_video_url",
"editor_video_dailymotion",

			"editor_video_googlevideo",

 
			"editor_video_metacafe",
"editor_video_myspacetv",
"editor_video_vimeo",

			"editor_video_metacafe",
"editor_video_myspacetv",
"editor_video_vimeo",

Zeile 2413Zeile 2461
		);
$editor_language = "var editor_language = {\n";


		);
$editor_language = "var editor_language = {\n";


		$plugins->run_hooks_by_ref("mycode_add_codebuttons", $editor_lang_strings);

		$editor_lang_strings = $plugins->run_hooks("mycode_add_codebuttons", $editor_lang_strings);


foreach($editor_lang_strings as $key => $lang_string)
{


foreach($editor_lang_strings as $key => $lang_string)
{

Zeile 2564Zeile 2612

$prefix_cache = $cache->read("threadprefixes");



$prefix_cache = $cache->read("threadprefixes");


	if($prefix_cache === false)

	if(!is_array($prefix_cache))

	{

	{

		return false;







		// No cache
$prefix_cache = $cache->read("threadprefixes", true);

if(!is_array($prefix_cache))
{
return array();
}

	}

$prefixes_cache = array();

	}

$prefixes_cache = array();

Zeile 2925Zeile 2979

if($plugins)
{


if($plugins)
{

        $plugins->run_hooks("get_ip", array("ip" => &$ip));


    	$ip_array = array("ip" => &$ip); // Used for backwards compatibility on this hook with the updated run_hooks() function.
$plugins->run_hooks("get_ip", $ip_array);

    }

return $ip;

    }

return $ip;

} 

}


/**
* Fetch the friendly size (GB, MB, KB, B) for a specified file size.


/**
* Fetch the friendly size (GB, MB, KB, B) for a specified file size.

Zeile 2993Zeile 3048
	else
{
$size = my_number_format($size)." ".$lang->size_bytes;

	else
{
$size = my_number_format($size)." ".$lang->size_bytes;

	}

	}


return $size;
}


return $size;
}

Zeile 3026Zeile 3081
			}
}
elseif(defined("IN_PORTAL"))

			}
}
elseif(defined("IN_PORTAL"))

		{

		{

			global $change_dir;
$icon = $change_dir."/".str_replace("{theme}", $theme['imgdir'], $attachtypes[$ext]['icon']);
}

			global $change_dir;
$icon = $change_dir."/".str_replace("{theme}", $theme['imgdir'], $attachtypes[$ext]['icon']);
}

Zeile 3089Zeile 3144
		else
{
$perms = $mybb->usergroup;

		else
{
$perms = $mybb->usergroup;

		}


		}


		$pwverified = 1;

if($forum['password'] != "")

		$pwverified = 1;

if($forum['password'] != "")

Zeile 3187Zeile 3242
						$sep = $multipage_dropdown.$sep;
}
}

						$sep = $multipage_dropdown.$sep;
}
}

				






// Replace page 1 URLs
$navbit['url'] = str_replace("-page-1.html", ".html", $navbit['url']);
$navbit['url'] = preg_replace("/&amp;page=1$/", "", $navbit['url']);


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

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

Zeile 4203Zeile 4262
		31,
30,
31

		31,
30,
31

	);
}


	);
}


/**
* Formats a birthday appropriately
*

/**
* Formats a birthday appropriately
*

Zeile 4462Zeile 4521
function my_strpos($haystack, $needle, $offset=0)
{
if($needle == '')

function my_strpos($haystack, $needle, $offset=0)
{
if($needle == '')

	{

	{

		return false;
}


		return false;
}


Zeile 4571Zeile 4630
 */
function get_event_date($event)
{

 */
function get_event_date($event)
{

 
	global $mybb;


	$event_date = explode("-", $event['date']);
$event_date = mktime(0, 0, 0, $event_date[1], $event_date[0], $event_date[2]);
$event_date = my_date($mybb->settings['dateformat'], $event_date);

	$event_date = explode("-", $event['date']);
$event_date = mktime(0, 0, 0, $event_date[1], $event_date[0], $event_date[2]);
$event_date = my_date($mybb->settings['dateformat'], $event_date);





	return $event_date;

	return $event_date;

}

/**

}

/**

 * Get the profile link.
*
* @param int The user id of the profile.

 * Get the profile link.
*
* @param int The user id of the profile.

Zeile 4601Zeile 4662
	$link = str_replace("{aid}", $aid, ANNOUNCEMENT_URL);
return htmlspecialchars_uni($link);
}

	$link = str_replace("{aid}", $aid, ANNOUNCEMENT_URL);
return htmlspecialchars_uni($link);
}





/**
* Build the profile link.
*

/**
* Build the profile link.
*

Zeile 4631Zeile 4692
		if(!empty($target))
{
$target = " target=\"{$target}\"";

		if(!empty($target))
{
$target = " target=\"{$target}\"";

		}


		}


		if(!empty($onclick))
{
$onclick = " onclick=\"{$onclick}\"";

		if(!empty($onclick))
{
$onclick = " onclick=\"{$onclick}\"";

Zeile 4654Zeile 4715
	if($page > 0)
{
$link = str_replace("{fid}", $fid, FORUM_URL_PAGED);

	if($page > 0)
{
$link = str_replace("{fid}", $fid, FORUM_URL_PAGED);

		$link = str_replace("{page}", $page, $link);

		$link = str_replace("{page}", $page, $link);

		return htmlspecialchars_uni($link);
}
else

		return htmlspecialchars_uni($link);
}
else

Zeile 4675Zeile 4736
function get_thread_link($tid, $page=0, $action='')
{
if($page > 1)

function get_thread_link($tid, $page=0, $action='')
{
if($page > 1)

	{

	{

		if($action)
{
$link = THREAD_URL_ACTION;

		if($action)
{
$link = THREAD_URL_ACTION;

Zeile 4717Zeile 4778
	{
$link = str_replace("{tid}", $tid, THREAD_URL_POST);
$link = str_replace("{pid}", $pid, $link);

	{
$link = str_replace("{tid}", $tid, THREAD_URL_POST);
$link = str_replace("{pid}", $pid, $link);

		return htmlspecialchars_uni($link);
}

		return htmlspecialchars_uni($link);
}

	else
{
$link = str_replace("{pid}", $pid, POST_URL);

	else
{
$link = str_replace("{pid}", $pid, POST_URL);

Zeile 4740Zeile 4801

/**
* Build the link to a specified date on the calendar


/**
* Build the link to a specified date on the calendar

 *

 *

 * @param int The ID of the calendar
* @param int The year
* @param int The month

 * @param int The ID of the calendar
* @param int The year
* @param int The month

Zeile 4750Zeile 4811
function get_calendar_link($calendar, $year=0, $month=0, $day=0)
{
if($day > 0)

function get_calendar_link($calendar, $year=0, $month=0, $day=0)
{
if($day > 0)

	{

	{

		$link = str_replace("{month}", $month, CALENDAR_URL_DAY);

		$link = str_replace("{month}", $month, CALENDAR_URL_DAY);

		$link = str_replace("{year}", $year, $link);

		$link = str_replace("{year}", $year, $link);

		$link = str_replace("{day}", $day, $link);
$link = str_replace("{calendar}", $calendar, $link);
return htmlspecialchars_uni($link);

		$link = str_replace("{day}", $day, $link);
$link = str_replace("{calendar}", $calendar, $link);
return htmlspecialchars_uni($link);

Zeile 4761Zeile 4822
	{
$link = str_replace("{month}", $month, CALENDAR_URL_MONTH);
$link = str_replace("{year}", $year, $link);

	{
$link = str_replace("{month}", $month, CALENDAR_URL_MONTH);
$link = str_replace("{year}", $year, $link);

		$link = str_replace("{calendar}", $calendar, $link);

		$link = str_replace("{calendar}", $calendar, $link);

		return htmlspecialchars_uni($link);
}
else if($year > 0)

		return htmlspecialchars_uni($link);
}
else if($year > 0)

Zeile 4803Zeile 4864
 * @return array The users data
*/
function get_user($uid)

 * @return array The users data
*/
function get_user($uid)

{

{

	global $mybb, $db;
static $user_cache;

	global $mybb, $db;
static $user_cache;





	$uid = intval($uid);

if($uid == $mybb->user['uid'])

	$uid = intval($uid);

if($uid == $mybb->user['uid'])

Zeile 4814Zeile 4875
		return $mybb->user;
}
elseif(isset($user_cache[$uid]))

		return $mybb->user;
}
elseif(isset($user_cache[$uid]))

	{
return $user_cache[$uid];
}

	{
return $user_cache[$uid];
}

	else
{
$query = $db->simple_select("users", "*", "uid='{$uid}'");
$user_cache[$uid] = $db->fetch_array($query);

	else
{
$query = $db->simple_select("users", "*", "uid='{$uid}'");
$user_cache[$uid] = $db->fetch_array($query);





		return $user_cache[$uid];

		return $user_cache[$uid];

	}
}


	}
}


/**
* Get the forum of a specific forum id.
*

/**
* Get the forum of a specific forum id.
*

Zeile 4846Zeile 4907
	if(!$forum_cache[$fid])
{
return false;

	if(!$forum_cache[$fid])
{
return false;

	}

	}


if($active_override != 1)
{


if($active_override != 1)
{

Zeile 4888Zeile 4949
		$thread = $db->fetch_array($query);

if($thread)

		$thread = $db->fetch_array($query);

if($thread)

		{

		{

			$thread_cache[$tid] = $thread;
return $thread;

			$thread_cache[$tid] = $thread;
return $thread;

		}

		}

		else
{
$thread_cache[$tid] = false;

		else
{
$thread_cache[$tid] = false;

			return false;
}
}
}


			return false;
}
}
}


/**
* Get the post of a post id.
*

/**
* Get the post of a post id.
*

Zeile 4910Zeile 4971
{
global $db;
static $post_cache;

{
global $db;
static $post_cache;





	if(isset($post_cache[$pid]))

	if(isset($post_cache[$pid]))

	{

	{

		return $post_cache[$pid];
}
else

		return $post_cache[$pid];
}
else

Zeile 4921Zeile 4982
		$post = $db->fetch_array($query);

if($post)

		$post = $db->fetch_array($query);

if($post)

		{

		{

			$post_cache[$pid] = $post;
return $post;

			$post_cache[$pid] = $post;
return $post;

		}

		}

		else
{
$post_cache[$pid] = false;
return false;

		else
{
$post_cache[$pid] = false;
return false;

		}
}
}

		}
}
}


/**
* Get inactivate forums.


/**
* Get inactivate forums.

Zeile 4964Zeile 5025
		}
}
$inactiveforums = implode(",", $inactive);

		}
}
$inactiveforums = implode(",", $inactive);





	return $inactiveforums;
}


	return $inactiveforums;
}


Zeile 4974Zeile 5035
 *
* @param bool (Optional) The function will stop execution if it finds an error with the login. Default is True
* @return bool Number of logins when success, false if failed.

 *
* @param bool (Optional) The function will stop execution if it finds an error with the login. Default is True
* @return bool Number of logins when success, false if failed.

 */

 */

function login_attempt_check($fatal = true)
{
global $mybb, $lang, $session, $db;

function login_attempt_check($fatal = true)
{
global $mybb, $lang, $session, $db;

Zeile 5144Zeile 5205
		"order_dir" => "ASC"
);
$query = $db->simple_select("settings", "value, name", "", $options);

		"order_dir" => "ASC"
);
$query = $db->simple_select("settings", "value, name", "", $options);





	while($setting = $db->fetch_array($query))
{
$mybb->settings[$setting['name']] = $setting['value'];

	while($setting = $db->fetch_array($query))
{
$mybb->settings[$setting['name']] = $setting['value'];

Zeile 5174Zeile 5235
	{
$mybb->settings['minsearchword'] = 3;
}

	{
$mybb->settings['minsearchword'] = 3;
}

 

if(is_array($terms))
{
$terms = implode(' ', $terms);
}


// Strip out any characters that shouldn't be included
$bad_characters = array(


// Strip out any characters that shouldn't be included
$bad_characters = array(

Zeile 5203Zeile 5269
				{
$split_words = preg_split("#\s{1,}#", $phrase, -1);
if(!is_array($split_words))

				{
$split_words = preg_split("#\s{1,}#", $phrase, -1);
if(!is_array($split_words))

					{

					{

						continue;
}
foreach($split_words as $word)

						continue;
}
foreach($split_words as $word)

Zeile 5224Zeile 5290
	{
$terms = htmlspecialchars_uni($terms);
$split_words = preg_split("#\s{1,}#", $terms, -1);

	{
$terms = htmlspecialchars_uni($terms);
$split_words = preg_split("#\s{1,}#", $terms, -1);

		if(!is_array($split_words))
{
continue;
}
foreach($split_words as $word)
{
if(!$word || strlen($word) < $mybb->settings['minsearchword'])
{
continue;

		if(is_array($split_words))
{
foreach($split_words as $word)
{
if(!$word || strlen($word) < $mybb->settings['minsearchword'])
{
continue;
}
$words[] = trim($word);

			}

			}

			$words[] = trim($word);

 
		}

		}



 
	}

if(!is_array($words))

	}

if(!is_array($words))

Zeile 5262Zeile 5326
		}

// Now make PREG compatible

		}

// Now make PREG compatible

		$find = "#(?!<.*?)(".preg_quote($word, "#").")(?![^<>]*?>)#i";

		$find = "#(?!<.*?)(".preg_quote($word, "#").")(?![^<>]*?>)#ui";

		$replacement = "<span class=\"highlight\" style=\"padding-left: 0px; padding-right: 0px;\">$1</span>";
$highlight_cache[$find] = $replacement;
}

		$replacement = "<span class=\"highlight\" style=\"padding-left: 0px; padding-right: 0px;\">$1</span>";
$highlight_cache[$find] = $replacement;
}

Zeile 5319Zeile 5383
 * Checks if a username has been disallowed for registration/use.
*
* @param string The username

 * Checks if a username has been disallowed for registration/use.
*
* @param string The username

 * @param boolean True if the 'last used' dateline should be updated if a match is found.
* @return boolean True if banned, false if not banned

 * @param boolean True if the 'last used' dateline should be updated if a match is found.
* @return boolean True if banned, false if not banned

 */
function is_banned_username($username, $update_lastuse=false)
{
global $db;
$query = $db->simple_select('banfilters', 'filter, fid', "type='2'");
while($banned_username = $db->fetch_array($query))

 */
function is_banned_username($username, $update_lastuse=false)
{
global $db;
$query = $db->simple_select('banfilters', 'filter, fid', "type='2'");
while($banned_username = $db->fetch_array($query))

	{

	{

		// Make regular expression * match
$banned_username['filter'] = str_replace('\*', '(.*)', preg_quote($banned_username['filter'], '#'));
if(preg_match("#(^|\b){$banned_username['filter']}($|\b)#i", $username))

		// Make regular expression * match
$banned_username['filter'] = str_replace('\*', '(.*)', preg_quote($banned_username['filter'], '#'));
if(preg_match("#(^|\b){$banned_username['filter']}($|\b)#i", $username))

Zeile 5357Zeile 5421

$banned_cache = $cache->read("bannedemails");



$banned_cache = $cache->read("bannedemails");


	if(!$banned_cache)

	if($banned_cache === false)

	{

	{

 
		// Failed to read cache, see if we can rebuild it

		$cache->update_bannedemails();
$banned_cache = $cache->read("bannedemails");
}


		$cache->update_bannedemails();
$banned_cache = $cache->read("bannedemails");
}


	foreach($banned_cache as $banned_email)

	if(is_array($banned_cache) && !empty($banned_cache))

	{

	{

		// Make regular expression * match
$banned_email['filter'] = str_replace('\*', '(.*)', preg_quote($banned_email['filter'], '#'));

if(preg_match("#{$banned_email['filter']}#i", $email))

		foreach($banned_cache as $banned_email)




		{

		{

			// Updating last use
if($update_lastuse == true)



			// Make regular expression * match
$banned_email['filter'] = str_replace('\*', '(.*)', preg_quote($banned_email['filter'], '#'));

if(preg_match("#{$banned_email['filter']}#i", $email))

			{

			{

				$db->update_query("banfilters", array("lastuse" => TIME_NOW), "fid='{$banned_email['fid']}'");






				// Updating last use
if($update_lastuse == true)
{
$db->update_query("banfilters", array("lastuse" => TIME_NOW), "fid='{$banned_email['fid']}'");
}
return true;

			}

			}

			return true;

 
		}
}

		}
}

 


	// Still here - good email
return false;
}

	// Still here - good email
return false;
}

Zeile 5408Zeile 5477
		
// Make regular expression * match
$banned_ip['filter'] = str_replace('\*', '(.*)', preg_quote($banned_ip['filter'], '#'));

		
// Make regular expression * match
$banned_ip['filter'] = str_replace('\*', '(.*)', preg_quote($banned_ip['filter'], '#'));

		if(preg_match("#{$banned_ip['filter']}#i", $ip_address))

		if(preg_match("#^{$banned_ip['filter']}$#i", $ip_address))

		{
// Updating last use
if($update_lastuse == true)

		{
// Updating last use
if($update_lastuse == true)

Zeile 5418Zeile 5487
			return true;
}
}

			return true;
}
}

 


	// Still here - good ip
return false;
}

	// Still here - good ip
return false;
}

Zeile 5578Zeile 5648
		
$headers[] = "Host: {$url['host']}";
$headers[] = "Connection: Close";

		
$headers[] = "Host: {$url['host']}";
$headers[] = "Connection: Close";

		$headers[] = "\r\n";

		$headers[] = '';

		
if(!empty($post_body))
{
$headers[] = $post_body;

		
if(!empty($post_body))
{
$headers[] = $post_body;

 
		}
else
{
// If we have no post body, we need to add an empty element to make sure we've got \r\n\r\n before the (non-existent) body starts
$headers[] = '';

		}

$headers = implode("\r\n", $headers);

		}

$headers = implode("\r\n", $headers);

Zeile 5770Zeile 5845
		"0-0-2" => "2 {$lang->years}"
);


		"0-0-2" => "2 {$lang->years}"
);


	$plugins->run_hooks_by_ref("functions_fetch_ban_times", $ban_times);

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


$ban_times['---'] = $lang->permanent;
return $ban_times;


$ban_times['---'] = $lang->permanent;
return $ban_times;

Zeile 6185Zeile 6260
		0x0A => 1,
0x0D => 1,
0x0B => 1,

		0x0A => 1,
0x0D => 1,
0x0B => 1,

 
		0xAD => 1,
0xA0 => 1,
0xAD => 1,
0xBF => 1,
0x81 => 1,
0x8D => 1,
0x90 => 1,
0x9D => 1,

		0xCC => array(0xB7 => 1, 0xB8 => 1), // \x{0337} or \x{0338}
0xE1 => array(0x85 => array(0x9F => 1, 0xA0 => 1)), // \x{115F} or \x{1160}
0xE2 => array(0x80 => array(0x80 => 1, 0x81 => 1, 0x82 => 1, 0x83 => 1, 0x84 => 1, 0x85 => 1, 0x86 => 1, 0x87 => 1, 0x88 => 1, 0x89 => 1, 0x8A => 1, 0x8B => 1, // \x{2000} to \x{200B}

		0xCC => array(0xB7 => 1, 0xB8 => 1), // \x{0337} or \x{0338}
0xE1 => array(0x85 => array(0x9F => 1, 0xA0 => 1)), // \x{115F} or \x{1160}
0xE2 => array(0x80 => array(0x80 => 1, 0x81 => 1, 0x82 => 1, 0x83 => 1, 0x84 => 1, 0x85 => 1, 0x86 => 1, 0x87 => 1, 0x88 => 1, 0x89 => 1, 0x8A => 1, 0x8B => 1, // \x{2000} to \x{200B}

Zeile 6203Zeile 6286
		0x0A => 1,
0x0D => 1,
0x0B => 1,

		0x0A => 1,
0x0D => 1,
0x0B => 1,

 
		0xA0 => array(0xC2 => 1),
0xAD => array(0xC2 => 1),
0xBF => array(0xC2 => 1),
0x81 => array(0xC2 => 1),
0x8D => array(0xC2 => 1),
0x90 => array(0xC2 => 1),
0x9D => array(0xC2 => 1),

		0xB8 => array(0xCC => 1), // \x{0338}
0xB7 => array(0xCC => 1), // \x{0337}
0xA0 => array(0x85 => array(0xE1 => 1)), // \x{1160}

		0xB8 => array(0xCC => 1), // \x{0338}
0xB7 => array(0xCC => 1), // \x{0337}
0xA0 => array(0x85 => array(0xE1 => 1)), // \x{1160}