Vergleich inc/functions.php - 1.6.4 - 1.6.5

  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 5639 2011-10-26 09:16:47Z Tomm $

 */

/**

 */

/**

Zeile 246Zeile 246

// 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);

Zeile 395Zeile 396

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 644Zeile 645
{
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)
{
$error = $lang->unknown_error;

	if(!$error)
{
$error = $lang->unknown_error;

Zeile 745Zeile 746
	{
$lang->error_nopermission_user_username = $lang->sprintf($lang->error_nopermission_user_username, $mybb->user['username']);
eval("\$errorpage = \"".$templates->get("error_nopermission_loggedin")."\";");

	{
$lang->error_nopermission_user_username = $lang->sprintf($lang->error_nopermission_user_username, $mybb->user['username']);
eval("\$errorpage = \"".$templates->get("error_nopermission_loggedin")."\";");

	}
else
{











	}
else
{
// Redirect to where the user came from
if($_SERVER['HTTP_REFERER'])
{
$redirect_url = htmlentities($_SERVER['HTTP_REFERER']);
}
else
{
$redirect_url = '';
}


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


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


Zeile 766Zeile 777

$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 783Zeile 794
		echo 'window.location = "'.addslashes($url).'";'."\n";
echo "</script>\n";
exit;

		echo 'window.location = "'.addslashes($url).'";'."\n";
echo "</script>\n";
exit;

	}


	}


	if(!$message)
{
$message = $lang->redirect;
}

	if(!$message)
{
$message = $lang->redirect;
}





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

if(!$title)

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

if(!$title)

	{

	{

		$title = $mybb->settings['bbname'];
}


		$title = $mybb->settings['bbname'];
}


Zeile 814Zeile 825

run_shutdown();



run_shutdown();


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

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

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

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

		}

		}

		else
{
header("Location: {$url}");
}
}

		else
{
header("Location: {$url}");
}
}





	exit;

	exit;

}


}


/**
* Generate a listing of page - pagination
*

/**
* Generate a listing of page - pagination
*

Zeile 847Zeile 858
	
$url = str_replace("&amp;", "&", $url);
$url = htmlspecialchars_uni($url);

	
$url = str_replace("&amp;", "&", $url);
$url = htmlspecialchars_uni($url);





	$pages = ceil($count / $perpage);

if($page > 1)

	$pages = ceil($count / $perpage);

if($page > 1)

Zeile 910Zeile 921
			else
{
eval("\$mppage .= \"".$templates->get("multipage_page_current")."\";");

			else
{
eval("\$mppage .= \"".$templates->get("multipage_page_current")."\";");

			}
}
else
{
eval("\$mppage .= \"".$templates->get("multipage_page")."\";");
}
}


			}
}
else
{
eval("\$mppage .= \"".$templates->get("multipage_page")."\";");
}
}


	if($to < $pages)
{
if($to+1 == $pages)

	if($to < $pages)
{
if($to+1 == $pages)

Zeile 1719Zeile 1730
 * @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;


{
global $mybb;


Zeile 1734Zeile 1745

$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;

Zeile 2248Zeile 2259
					{
$optionselected = "selected=\"selected\"";
$selecteddone = 1;

					{
$optionselected = "selected=\"selected\"";
$selecteddone = 1;

					}


					}


					$forum['name'] = htmlspecialchars_uni(strip_tags($forum['name']));

eval("\$forumjumpbits .= \"".$templates->get("forumjump_bit")."\";");

					$forum['name'] = htmlspecialchars_uni(strip_tags($forum['name']));

eval("\$forumjumpbits .= \"".$templates->get("forumjump_bit")."\";");

Zeile 2274Zeile 2285
			}

$jumpsel[$selitem] = 'selected="selected"';

			}

$jumpsel[$selitem] = 'selected="selected"';

		}

		}


if($showextras == 0)
{
$template = "special";


if($showextras == 0)
{
$template = "special";

		}

		}

		else
{
$template = "advanced";
}

		else
{
$template = "advanced";
}





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

return $forumjump;

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

return $forumjump;

}

}


/**
* Returns the extension of a file.


/**
* Returns the extension of a file.

Zeile 2394Zeile 2405
			"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 2423
		);
$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 2487Zeile 2497
			if($mybb->settings['smilieinsertertot'] >= $smiliecount)
{
$mybb->settings['smilieinsertertot'] = $smiliecount;

			if($mybb->settings['smilieinsertertot'] >= $smiliecount)
{
$mybb->settings['smilieinsertertot'] = $smiliecount;

			}

			}

			else if($mybb->settings['smilieinsertertot'] < $smiliecount)
{
$smiliecount = $mybb->settings['smilieinsertertot'];

			else if($mybb->settings['smilieinsertertot'] < $smiliecount)
{
$smiliecount = $mybb->settings['smilieinsertertot'];

Zeile 2564Zeile 2574

$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 2941

if($plugins)
{


if($plugins)
{

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

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

    }

return $ip;

    }

return $ip;

Zeile 3187Zeile 3203
						$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 4571Zeile 4591
 */
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);

Zeile 5174Zeile 5196
	{
$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 5187Zeile 5214

// Check if this is a "series of words" - should be treated as an EXACT match
if(my_strpos($terms, "\"") !== false)


// Check if this is a "series of words" - should be treated as an EXACT match
if(my_strpos($terms, "\"") !== false)

	{

	{

		$inquote = false;
$terms = explode("\"", $terms);
foreach($terms as $phrase)

		$inquote = false;
$terms = explode("\"", $terms);
foreach($terms as $phrase)

Zeile 5224Zeile 5251
	{
$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(is_array($split_words))





		{

		{

			if(!$word || strlen($word) < $mybb->settings['minsearchword'])

			foreach($split_words as $word)

			{

			{

				continue;





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

			}

			}

			$words[] = trim($word);
}


		}



	}

if(!is_array($words))
{
return false;

	}

if(!is_array($words))
{
return false;

	}

	}

	
// Sort the word array by length. Largest terms go first and work their way down to the smallest term.
// This resolves problems like "test tes" where "tes" will be highlighted first, then "test" can't be highlighted because of the changed html

	
// Sort the word array by length. Largest terms go first and work their way down to the smallest term.
// This resolves problems like "test tes" where "tes" will be highlighted first, then "test" can't be highlighted because of the changed html

Zeile 5260Zeile 5285
		{
continue;
}

		{
continue;
}





		// Now make PREG compatible
$find = "#(?!<.*?)(".preg_quote($word, "#").")(?![^<>]*?>)#i";
$replacement = "<span class=\"highlight\" style=\"padding-left: 0px; padding-right: 0px;\">$1</span>";
$highlight_cache[$find] = $replacement;
}

		// Now make PREG compatible
$find = "#(?!<.*?)(".preg_quote($word, "#").")(?![^<>]*?>)#i";
$replacement = "<span class=\"highlight\" style=\"padding-left: 0px; padding-right: 0px;\">$1</span>";
$highlight_cache[$find] = $replacement;
}





	return $highlight_cache;
}


	return $highlight_cache;
}


Zeile 5279Zeile 5304
function dec_to_utf8($src)
{
$dest = '';

function dec_to_utf8($src)
{
$dest = '';





	if($src < 0)
{
return false;

	if($src < 0)
{
return false;

Zeile 5379Zeile 5404
		}
}
// Still here - good email

		}
}
// Still here - good email

	return false;
}

	return false;
}


/**
* Checks if a specific IP address has been banned.


/**
* Checks if a specific IP address has been banned.

Zeile 5430Zeile 5455
 * @param boolean True to generate a "short" list with just timezone and current time
*/
function build_timezone_select($name, $selected=0, $short=false)

 * @param boolean True to generate a "short" list with just timezone and current time
*/
function build_timezone_select($name, $selected=0, $short=false)

{

{

	global $mybb, $lang;

$timezones = array(

	global $mybb, $lang;

$timezones = array(

Zeile 5530Zeile 5555
		curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

		curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

		if(!empty($post_body))
{

		if(!empty($post_body))
{

			curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_body);
}

			curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_body);
}

Zeile 5543Zeile 5568
	{
$url = @parse_url($url);
if(!$url['host'])

	{
$url = @parse_url($url);
if(!$url['host'])

		{
return false;

		{
return false;

		}
if(!$url['port'])
{

		}
if(!$url['port'])
{

Zeile 5563Zeile 5588
		if(!$fp)
{
return false;

		if(!$fp)
{
return false;

		}

		}

		$headers = array();
if(!empty($post_body))
{

		$headers = array();
if(!empty($post_body))
{

Zeile 5574Zeile 5599
		else
{
$headers[] = "GET {$url['path']} HTTP/1.0";

		else
{
$headers[] = "GET {$url['path']} HTTP/1.0";

		}


		}


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

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

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

		$headers[] = '';

		
if(!empty($post_body))

		
if(!empty($post_body))

		{

		{

			$headers[] = $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 5800
		"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 6215
		0x0A => 1,
0x0D => 1,
0x0B => 1,

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

 
		0xAD => 1,
0xC2 => array(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 6241
		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}