Vergleich inc/functions.php - 1.2.0 - 1.2.1

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * Website: http://www.mybboard.com
* License: http://www.mybboard.com/eula.html
*

 * Website: http://www.mybboard.com
* License: http://www.mybboard.com/eula.html
*

 * $Id: functions.php 2191 2006-09-03 12:11:04Z chris $

 * $Id: functions.php 2277 2006-09-27 10:26:56Z chris $

 */

/**

 */

/**

Zeile 79Zeile 79
	$plugins->run_hooks("post_output_page");

// If the use shutdown functionality is turned off, run any shutdown related items now.

	$plugins->run_hooks("post_output_page");

// If the use shutdown functionality is turned off, run any shutdown related items now.

	if($mybb->settings['useshutdownfunc'] == "no" && $mybb->use_shutdown == true)

	if(($mybb->settings['useshutdownfunc'] == "no" || phpversion() >= '5.0.5') && $mybb->use_shutdown != true) 

	{
run_shutdown();
}

	{
run_shutdown();
}

Zeile 106Zeile 106
 */
function run_shutdown()
{

 */
function run_shutdown()
{

	global $db, $cache, $shutdown_functions;






	global $db, $cache, $shutdown_functions, $done_shutdown;

if($done_shutdown == true)
{
return;
}


// We have some shutdown queries needing to be run
if(is_array($db->shutdown_queries))


// We have some shutdown queries needing to be run
if(is_array($db->shutdown_queries))

Zeile 115Zeile 120
		foreach($db->shutdown_queries as $query)
{
$db->query($query);

		foreach($db->shutdown_queries as $query)
{
$db->query($query);

		}
}

		}
}


// Run any shutdown functions if we have them
if(is_array($shutdown_functions))


// Run any shutdown functions if we have them
if(is_array($shutdown_functions))

Zeile 126Zeile 131
			$function();
}
}

			$function();
}
}

 
	$done_shutdown = true;

}

/**

}

/**

Zeile 136Zeile 142
function send_mail_queue($count=10)
{
global $db, $cache, $plugins;

function send_mail_queue($count=10)
{
global $db, $cache, $plugins;





	$plugins->run_hooks("send_mail_queue_start");

// Check to see if the mail queue has messages needing to be sent

	$plugins->run_hooks("send_mail_queue_start");

// Check to see if the mail queue has messages needing to be sent

Zeile 145Zeile 151
	{
// Lock the queue so no other messages can be sent whilst these are (for popular boards)
$cache->updatemailqueue(0, time());

	{
// Lock the queue so no other messages can be sent whilst these are (for popular boards)
$cache->updatemailqueue(0, time());





		// Fetch emails for this page view - and send them
$query = $db->simple_select(TABLE_PREFIX."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(TABLE_PREFIX."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))
{

		while($email = $db->fetch_array($query))
{

			$plugins->run_hooks("send_mail_queue_mail");


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


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


Zeile 223Zeile 230
	}

if(!$offset && $offset != '0')

	}

if(!$offset && $offset != '0')

	{

	{

		if($mybb->user['uid'] != 0 && array_key_exists("timezone", $mybb->user))
{
$offset = $mybb->user['timezone'];

		if($mybb->user['uid'] != 0 && array_key_exists("timezone", $mybb->user))
{
$offset = $mybb->user['timezone'];

Zeile 269Zeile 276
		}
}


		}
}


	$plugins->run_hooks("my_date");

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


return $date;
}


return $date;
}

Zeile 300Zeile 307
	$headers .= "From: {$from}\n";
$headers .= "Return-Path: {$mybb->settings['adminemail']}\n";
if($_SERVER['SERVER_NAME'])

	$headers .= "From: {$from}\n";
$headers .= "Return-Path: {$mybb->settings['adminemail']}\n";
if($_SERVER['SERVER_NAME'])

	{

	{

		$http_host = $_SERVER['SERVER_NAME'];
}
else if($_SERVER['HTTP_HOST'])

		$http_host = $_SERVER['SERVER_NAME'];
}
else if($_SERVER['HTTP_HOST'])

Zeile 416Zeile 423
function error($error="", $title="")
{
global $header, $footer, $theme, $headerinclude, $db, $templates, $lang, $mybb;

function error($error="", $title="")
{
global $header, $footer, $theme, $headerinclude, $db, $templates, $lang, $mybb;





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

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

	}
if(!$title)

	}
if(!$title)

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

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

Zeile 444Zeile 451
{
global $theme, $mybb, $db, $lang, $templates;
if(!$title)

{
global $theme, $mybb, $db, $lang, $templates;
if(!$title)

	{

	{

		$title = $lang->please_correct_errors;
}
if(!is_array($errors))

		$title = $lang->please_correct_errors;
}
if(!is_array($errors))

Zeile 454Zeile 461
	foreach($errors as $error)
{
$errorlist .= "<li>".$error."</li>\n";

	foreach($errors as $error)
{
$errorlist .= "<li>".$error."</li>\n";

	}

	}

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

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

Zeile 498Zeile 505
{
global $header, $footer, $mybb, $theme, $headerinclude, $templates, $lang, $plugins;


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


 
	$loadpmpopup = false;

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

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

Zeile 511Zeile 519
	if($mybb->settings['redirects'] == "on" && $mybb->user['showredirect'] != "no")
{
$url = str_replace("&amp;", "&", $url);

	if($mybb->settings['redirects'] == "on" && $mybb->user['showredirect'] != "no")
{
$url = str_replace("&amp;", "&", $url);

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

		$url = htmlspecialchars($url);

		eval("\$redirectpage = \"".$templates->get("redirect")."\";");
output_page($redirectpage);
}

		eval("\$redirectpage = \"".$templates->get("redirect")."\";");
output_page($redirectpage);
}

Zeile 569Zeile 577
		elseif($page == $pages-3)
{
$to = $page+3;

		elseif($page == $pages-3)
{
$to = $page+3;

		}

		}

		else
{
$to = $page+4;

		else
{
$to = $page+4;

Zeile 584Zeile 592
		eval("\$end = \"".$templates->get("multipage_end")."\";");
eval("\$multipage = \"".$templates->get("multipage")."\";");
return $multipage;

		eval("\$end = \"".$templates->get("multipage_end")."\";");
eval("\$multipage = \"".$templates->get("multipage")."\";");
return $multipage;

	}

	}

}

/**

}

/**

Zeile 599Zeile 607

// If no user id is specified, assume it is the current user
if($uid == 0)


// If no user id is specified, assume it is the current user
if($uid == 0)

	{

	{

		$uid = $mybb->user['uid'];
}


		$uid = $mybb->user['uid'];
}


Zeile 608Zeile 616
	{
// We've already cached permissions for this user, return them.
if($user_cache[$uid]['permissions'])

	{
// We've already cached permissions for this user, return them.
if($user_cache[$uid]['permissions'])

		{

		{

			return $user_cache[$uid]['permissions'];
}


			return $user_cache[$uid]['permissions'];
}


Zeile 642Zeile 650
function usergroup_permissions($gid=0)
{
global $cache, $groupscache, $grouppermignore, $groupzerogreater;

function usergroup_permissions($gid=0)
{
global $cache, $groupscache, $grouppermignore, $groupzerogreater;


if(!is_array($groupscache))
{
$groupscache = $cache->read("usergroups");
}


if(!is_array($groupscache))
{
$groupscache = $cache->read("usergroups");
}

	$groups = explode(",", $gid);
if(count($groups) == 1)
{

	$groups = explode(",", $gid);
if(count($groups) == 1)
{

Zeile 723Zeile 731
function forum_permissions($fid=0, $uid=0, $gid=0)
{
global $db, $cache, $groupscache, $forum_cache, $fpermcache, $mybb, $usercache, $fpermissionscache;

function forum_permissions($fid=0, $uid=0, $gid=0)
{
global $db, $cache, $groupscache, $forum_cache, $fpermcache, $mybb, $usercache, $fpermissionscache;


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


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

	}
if(!$gid || $gid == 0) // If no group, we need to fetch it
{
if($uid != $mybb->user['uid'])
{
if($usercache[$uid])

	}
if(!$gid || $gid == 0) // If no group, we need to fetch it
{
if($uid != $mybb->user['uid'])
{
if($usercache[$uid])

			{

			{

				$query = $db->query("SELECT * FROM ".TABLE_PREFIX."users WHERE uid='$uid'");
$usercache[$uid] = $db->fetch_array($query);
}

				$query = $db->query("SELECT * FROM ".TABLE_PREFIX."users WHERE uid='$uid'");
$usercache[$uid] = $db->fetch_array($query);
}

Zeile 752Zeile 760
	}
if(!is_array($forum_cache))
{

	}
if(!is_array($forum_cache))
{

		cache_forums();





		$forum_cache = cache_forums();
if(!$forum_cache)
{
return false;
}

	}
if(!is_array($fpermcache))
{

	}
if(!is_array($fpermcache))
{

Zeile 789Zeile 801
	{
return $groupperms;
}

	{
return $groupperms;
}

	// The fix here for better working inheritance was provided by tinywizard - http://windizupdate.com/
// Many thanks.
foreach($fpermfields as $perm)
{
$forumpermissions[$perm] = "no";
}


 
	foreach($groups as $gid)
{
if($gid && $groupscache[$gid])

	foreach($groups as $gid)
{
if($gid && $groupscache[$gid])

		{
$p = is_array($fpermcache[$fid][$gid]) ? $fpermcache[$fid][$gid] : $groupperms;
if($p == NULL)
{
foreach($forumpermissions as $k => $v)
{
$forumpermissions[$k] = 'yes'; // no inherited group, assume one has access
}

		{
if(!is_array($fpermcache[$fid][$gid]))
{
continue;





			}

			}

			else

			foreach($fpermcache[$fid][$gid] as $perm => $access)

			{

			{

				foreach($p as $perm => $access)

				if($perm == "fid" || $perm == "gid" || $perm == "pid")

				{

				{

					if(isset($forumpermissions[$perm]) && $access == 'yes')
{
$forumpermissions[$perm] = $access;
}



					continue;
}
$permission = $forumpermissions[$perm];
if((is_numeric($access) && $access > $permission) || ($access == "yes" && $permission == "no") || !$permission)
{
$forumpermissions[$perm] = $access;

				}
}
}

				}
}
}

 
	}
if(!isset($forumpermissions))
{
$forumpermissions = $groupperms;

	}
return $forumpermissions;
}

	}
return $forumpermissions;
}

Zeile 840Zeile 847
		{
if($password == $mybb->input['pwverify'])
{

		{
if($password == $mybb->input['pwverify'])
{

				my_setcookie("forumpass[$fid]", md5($mybb->user['uid'].$mybb->input['pwverify']));

				my_setcookie("forumpass[$fid]", md5($mybb->user['uid'].$mybb->input['pwverify']), null, true);

				$showform = 0;
}
else
{
eval("\$pwnote = \"".$templates->get("forumdisplay_password_wrongpass")."\";");

				$showform = 0;
}
else
{
eval("\$pwnote = \"".$templates->get("forumdisplay_password_wrongpass")."\";");

				$showform = 1;
}
}

				$showform = 1;
}
}

		else
{
if(!$_COOKIE['forumpass'][$fid] || ($_COOKIE['forumpass'][$fid] && md5($mybb->user['uid'].$password) != $_COOKIE['forumpass'][$fid]))

		else
{
if(!$_COOKIE['forumpass'][$fid] || ($_COOKIE['forumpass'][$fid] && md5($mybb->user['uid'].$password) != $_COOKIE['forumpass'][$fid]))

Zeile 924Zeile 931
function is_moderator($fid="0", $action="", $uid="0")
{
global $mybb, $db;

function is_moderator($fid="0", $action="", $uid="0")
{
global $mybb, $db;





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

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

Zeile 1013Zeile 1020
	return $posticons;
}


	return $posticons;
}


/**
* MyBB setcookie() wrapper.
*
* @param string The cookie identifier.
* @param string The cookie value.
* @param int The timestamp of the expiry date.
*/
function my_setcookie($name, $value="", $expires="")

function my_setcookie($name, $value="", $expires="", $httponly=false)








{
global $mybb, $sent_header;

{
global $mybb, $sent_header;

	
if($sent_header)

	if($sent_header || headers_sent())


	{
return false;
}

	{
return false;
}

Zeile 1032Zeile 1031
	if(!$mybb->settings['cookiepath'])
{
$mybb->settings['cookiepath'] = "/";

	if(!$mybb->settings['cookiepath'])
{
$mybb->settings['cookiepath'] = "/";

	}

	}

	if($expires == -1)
{
$expires = 0;

	if($expires == -1)
{
$expires = 0;

	}
else
{

	}
else if($expires == "" || $expires == null)
{

		if($mybb->user['remember'] == "no")

		if($mybb->user['remember'] == "no")

		{

		{

			$expires = 0;

			$expires = 0;

		}
else
{
$expires = time() + (60*60*24*365); // Make the cookie expire in a years time
}
}
if($mybb->settings['cookiedomain'])
{
setcookie($name, $value, $expires, $mybb->settings['cookiepath'], $mybb->settings['cookiedomain']);
}
else
{
setcookie($name, $value, $expires, $mybb->settings['cookiepath']);
}




















		}
else
{
$expires = time() + (60*60*24*365); // Make the cookie expire in a years time
}
}
else
{
$expires = time() + intval($expires);
}

$mybb->settings['cookiepath'] = str_replace(array("\n","\r"), "", $mybb->settings['cookiepath']);
$mybb->settings['cookiedomain'] = str_replace(array("\n","\r"), "", $mybb->settings['cookiedomain']);

// Versions of PHP prior to 5.2 do not support HttpOnly cookies and IE is buggy when specifying a blank domain so set the cookie manually
$cookie = "Set-Cookie: {$name}=".urlencode($value);
if($expires > 0)
{
$cookie .= "; expires=".gmdate('D, d-M-Y H:i:s \\G\\M\\T', $expires);
}
if(!empty($mybb->settings['cookiepath']))
{
$cookie .= "; path={$mybb->settings['cookiepath']}";
}
if(!empty($mybb->settings['cookiedomain']))
{
$cookie .= "; domain={$mybb->settings['cookiedomain']}";
}
if($httponly == true)
{
$cookie .= "; HttpOnly";
}
header($cookie, false);

}

/**
* Unset a cookie set by MyBB.

}

/**
* Unset a cookie set by MyBB.

 *

 *

 * @param string The cookie identifier.
*/
function my_unsetcookie($name)

 * @param string The cookie identifier.
*/
function my_unsetcookie($name)

Zeile 1068Zeile 1086
	global $mybb, $sent_header;

if($sent_header)

	global $mybb, $sent_header;

if($sent_header)

	{
return false;
}


	{
return false;
}


	$expires = time()-3600;

	$expires = time()-3600;

	if(!$mybb->settings['cookiepath'])
{
$mybb->settings['cookiepath'] = "/";
}

 




	if($mybb->settings['cookiedomain'])
{
@setcookie($name, "", $expires, $mybb->settings['cookiepath'], $mybb->settings['cookiedomain']);
}
else
{
@setcookie($name, "", $expires, $mybb->settings['cookiepath']);
}

	my_setcookie($name, "", $expires);








}

/**

}

/**

Zeile 1105Zeile 1112
	if(isset($cookie[$id]))
{
return $cookie[$id];

	if(isset($cookie[$id]))
{
return $cookie[$id];

	}
else

	}
else

	{
return 0;
}

	{
return 0;
}

Zeile 1182Zeile 1189
		WHERE fid='{$fid}' AND visible='1' AND closed NOT LIKE 'moved|%'
ORDER BY lastpost DESC
LIMIT 0, 1

		WHERE fid='{$fid}' AND visible='1' AND closed NOT LIKE 'moved|%'
ORDER BY lastpost DESC
LIMIT 0, 1

	");
$lastpost = $db->fetch_array($query);

	");
$lastpost = $db->fetch_array($query);


// Fetch the number of threads and replies in this forum (Approved only)


// Fetch the number of threads and replies in this forum (Approved only)

	$query = $db->query("

	$query = $db->query("

		SELECT COUNT(*) AS threads, SUM(replies) AS replies
FROM ".TABLE_PREFIX."threads
WHERE fid='$fid' AND visible='1' AND closed NOT LIKE 'moved|%'

		SELECT COUNT(*) AS threads, SUM(replies) AS replies
FROM ".TABLE_PREFIX."threads
WHERE fid='$fid' AND visible='1' AND closed NOT LIKE 'moved|%'

Zeile 1221Zeile 1228
	);

$db->update_query(TABLE_PREFIX."forums", $update_count, "fid='{$fid}'");

	);

$db->update_query(TABLE_PREFIX."forums", $update_count, "fid='{$fid}'");

}


}


/**
* Update the thread counters for a specific thread
*

/**
* Update the thread counters for a specific thread
*

Zeile 1261Zeile 1268
	");
$firstpost = $db->fetch_array($query);
if(!$firstpost['username'])

	");
$firstpost = $db->fetch_array($query);
if(!$firstpost['username'])

	{

	{

		$firstpost['username'] = $firstpost['postusername'];
}
if(!$lastpost['username'])

		$firstpost['username'] = $firstpost['postusername'];
}
if(!$lastpost['username'])

	{

	{

		$lastpost['username'] = $lastpost['postusername'];
}


		$lastpost['username'] = $lastpost['postusername'];
}


Zeile 1283Zeile 1290
		SELECT COUNT(*) AS totunposts
FROM ".TABLE_PREFIX."posts
WHERE tid='$tid' AND visible='0'

		SELECT COUNT(*) AS totunposts
FROM ".TABLE_PREFIX."posts
WHERE tid='$tid' AND visible='0'

	");

	");

	$nounposts = $db->fetch_field($query, "totunposts");

// Update the attachment count for this thread

	$nounposts = $db->fetch_field($query, "totunposts");

// Update the attachment count for this thread

Zeile 1297Zeile 1304

/**
* Updates the number of attachments for a specific thread


/**
* Updates the number of attachments for a specific thread

 *
* @param int The thread ID
*/

 *
* @param int The thread ID
*/

function update_thread_attachment_count($tid)
{
global $db;

function update_thread_attachment_count($tid)
{
global $db;

Zeile 1314Zeile 1321
		SET attachmentcount='{$attachment_count}'
WHERE tid='$tid'
");

		SET attachmentcount='{$attachment_count}'
WHERE tid='$tid'
");

}

}


/**
* 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 1338Zeile 1345
 * @param int The thread ID
*/
function delete_post($pid, $tid="")

 * @param int The thread ID
*/
function delete_post($pid, $tid="")

{

{

	global $moderation;
if(!is_object($moderation))
{

	global $moderation;
if(!is_object($moderation))
{

Zeile 1347Zeile 1354
	}
return $moderation->delete_post($pid);
}

	}
return $moderation->delete_post($pid);
}





/**
* Builds a forum jump menu
*

/**
* Builds a forum jump menu
*

Zeile 1366Zeile 1373

$pid = intval($pid);
if($permissions)


$pid = intval($pid);
if($permissions)

	{

	{

		$permissions = $mybb->usergroup;
}
if(!is_array($jumpfcache))

		$permissions = $mybb->usergroup;
}
if(!is_array($jumpfcache))

Zeile 1376Zeile 1383
			cache_forums();
}
foreach($forum_cache as $fid => $forum)

			cache_forums();
}
foreach($forum_cache as $fid => $forum)

		{

		{

			if($forum['active'] != "no")
{
$jumpfcache[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum;

			if($forum['active'] != "no")
{
$jumpfcache[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum;

Zeile 1761Zeile 1768
function get_reputation($reputation, $uid=0)
{
global $theme;

function get_reputation($reputation, $uid=0)
{
global $theme;



	

	if($uid != 0)
{
$display_reputation = "<a href=\"reputation.php?uid={$uid}\">";

	if($uid != 0)
{
$display_reputation = "<a href=\"reputation.php?uid={$uid}\">";

Zeile 1847Zeile 1854
	elseif($size == 0)
{
$size = "0 ".$lang->size_bytes;

	elseif($size == 0)
{
$size = "0 ".$lang->size_bytes;

	}
else

	}
else

	{
$size = $size . " " . $lang->size_bytes;
}

	{
$size = $size . " " . $lang->size_bytes;
}

Zeile 1877Zeile 1884
	else
{
return "<img src=\"images/attachtypes/unknown.gif\" border=\"0\" alt=\".$ext File\" />";

	else
{
return "<img src=\"images/attachtypes/unknown.gif\" border=\"0\" alt=\".$ext File\" />";

	}

	}

}

/**

}

/**

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

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

}

}


/**
* Build the forum breadcrumb nagiation (the navigation to a specific forum including all parent forums)


/**
* Build the forum breadcrumb nagiation (the navigation to a specific forum including all parent forums)

Zeile 2035Zeile 2042
					// Set up link to forum in breadcrumb.
if($pforumcache[$fid][$forumnav['pid']]['type'] == 'f' || $pforumcache[$fid][$forumnav['pid']]['type'] == 'c')
{

					// Set up link to forum in breadcrumb.
if($pforumcache[$fid][$forumnav['pid']]['type'] == 'f' || $pforumcache[$fid][$forumnav['pid']]['type'] == 'c')
{

						$navbits[$navsize]['url'] = "{$base_url}/forum-".$forumnav['fid'].".html";

						$navbits[$navsize]['url'] = "{$base_url}forum-".$forumnav['fid'].".html";

					}
else
{

					}
else
{

Zeile 2073Zeile 2080
 * @return string The URL
*/
function build_archive_link($type, $id="")

 * @return string The URL
*/
function build_archive_link($type, $id="")

{

{

	global $mybb;

// If the server OS is not Windows and not Apache or the PHP is running as a CGI or we have defined ARCHIVE_QUERY_STRINGS, use query strings

	global $mybb;

// If the server OS is not Windows and not Apache or the PHP is running as a CGI or we have defined ARCHIVE_QUERY_STRINGS, use query strings

Zeile 2188Zeile 2195
		echo "<tr>\n";
echo "<td colspan=\"8\" 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 colspan=\"8\" 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 "<tr>\n";
echo "<td style=\"background: #fff;\">".implode(", ", array_keys($templates->cache))."</td>\n";
echo "</tr>\n";

		echo "</table>\n";
echo "<br />\n";
}

		echo "</table>\n";
echo "<br />\n";
}

Zeile 2200Zeile 2207
		echo "<table style=\"background-color: #666;\" width=\"95%\" cellpadding=\"4\" cellspacing=\"1\" align=\"center\">\n";
echo "<tr>\n";
echo "<td colspan=\"8\" style=\"background-color: #ccc;\"><strong>Templates Requiring Additional Calls (Not Cached at Startup) - ".count($templates->uncached_templates)." Total</strong></td>\n";

		echo "<table style=\"background-color: #666;\" width=\"95%\" cellpadding=\"4\" cellspacing=\"1\" align=\"center\">\n";
echo "<tr>\n";
echo "<td colspan=\"8\" style=\"background-color: #ccc;\"><strong>Templates Requiring Additional Calls (Not Cached at Startup) - ".count($templates->uncached_templates)." Total</strong></td>\n";

		echo "</tr>\n";

		echo "</tr>\n";

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

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

Zeile 2225Zeile 2232
		header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");

		header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");

	}
}


	}
}


/**
* Mark specific reported posts of a certain type as dealt with
*

/**
* Mark specific reported posts of a certain type as dealt with
*

Zeile 2305Zeile 2312
	$seconds = $stamp;

if($years == 1)

	$seconds = $stamp;

if($years == 1)

	{

	{

		$nicetime['years'] = "1 ".$lang->year;
}
elseif($years > 1)

		$nicetime['years'] = "1 ".$lang->year;
}
elseif($years > 1)

Zeile 2329Zeile 2336
	elseif($weeks > 1)
{
$nicetime['weeks'] = $weeks." ".$lang->weeks;

	elseif($weeks > 1)
{
$nicetime['weeks'] = $weeks." ".$lang->weeks;

	}

	}


if($days == 1)
{


if($days == 1)
{

Zeile 2338Zeile 2345
	elseif($days > 1)
{
$nicetime['days'] = $days." ".$lang->days;

	elseif($days > 1)
{
$nicetime['days'] = $days." ".$lang->days;

	}

	}


if($hours == 1)
{
$nicetime['hours'] = "1 ".$lang->hour;


if($hours == 1)
{
$nicetime['hours'] = "1 ".$lang->hour;

	}

	}

	elseif($hours > 1)
{
$nicetime['hours'] = $hours." ".$lang->hours;

	elseif($hours > 1)
{
$nicetime['hours'] = $hours." ".$lang->hours;

Zeile 2534Zeile 2541
		elseif(isset($_ENV['QUERY_STRING']))
{
$location = "?".$_ENV['QUERY_STRING'];

		elseif(isset($_ENV['QUERY_STRING']))
{
$location = "?".$_ENV['QUERY_STRING'];

		}
}

		}
}


if((isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == "POST") || (isset($_ENV['REQUEST_METHOD']) && $_ENV['REQUEST_METHOD'] == "POST"))
{


if((isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == "POST") || (isset($_ENV['REQUEST_METHOD']) && $_ENV['REQUEST_METHOD'] == "POST"))
{

Zeile 2568Zeile 2575
function build_theme_select($name, $selected="", $tid=0, $depth="", $usergroup_override=0)
{
global $db, $themeselect, $tcache, $lang, $mybb;

function build_theme_select($name, $selected="", $tid=0, $depth="", $usergroup_override=0)
{
global $db, $themeselect, $tcache, $lang, $mybb;



 
	if($tid == 0)
{
$themeselect = "<select name=\"$name\">";
$themeselect .= "<option value=\"0\">".$lang->use_default."</option>\n";
$themeselect .= "<option value=\"0\">-----------</option>\n";

	if($tid == 0)
{
$themeselect = "<select name=\"$name\">";
$themeselect .= "<option value=\"0\">".$lang->use_default."</option>\n";
$themeselect .= "<option value=\"0\">-----------</option>\n";

	}

	}

	if(!is_array($tcache))
{
$query = $db->query("
SELECT name, pid, tid, allowedgroups
FROM ".TABLE_PREFIX."themes

	if(!is_array($tcache))
{
$query = $db->query("
SELECT name, pid, tid, allowedgroups
FROM ".TABLE_PREFIX."themes

 
			WHERE pid != 0

			ORDER BY pid, name
");
while($theme = $db->fetch_array($query))

			ORDER BY pid, name
");
while($theme = $db->fetch_array($query))

		{
$tcache[$theme['pid']][$theme['tid']] = $theme;
}

		{
$tcache[$theme['pid']][] = $theme;
}

	}

	}

	if(is_array($tcache[$tid]))

	if(is_array($tcache))

	{
// Figure out what groups this user is in

	{
// Figure out what groups this user is in

		$in_groups = explode(",", $mybb->user['additionalgroups']);




		if($mybb->user['additionalgroups'])
{
$in_groups = explode(",", $mybb->user['additionalgroups']);
}

		$in_groups[] = $mybb->user['usergroup'];

		$in_groups[] = $mybb->user['usergroup'];


foreach($tcache[$tid] as $theme)


foreach($tcache as $misc)

		{

		{

			$sel = "";
// Make theme allowed groups into array
$is_allowed = false;
if($theme['allowedgroups'] != "all")

			foreach($misc as $theme)




			{

			{

				$allowed_groups = explode(",", $theme['allowedgroups']);
// See if groups user is in is allowed
foreach($allowed_groups as $agid)


				$sel = "";
// Make theme allowed groups into array
$is_allowed = false;
if($theme['allowedgroups'] != "all" && $theme['allowedgroups'] != "")

				{

				{

					if(in_array($agid, $in_groups))
























					$allowed_groups = explode(",", $theme['allowedgroups']);
// See if groups user is in is allowed
foreach($allowed_groups as $agid)
{
if(in_array($agid, $in_groups))
{
$is_allowed = true;
break;
}
}
}
// Show theme if allowed, or if override is on
if($is_allowed || $theme['allowedgroups'] == "all" || $usergroup_override == 1)
{
if($theme['tid'] == $selected)
{
$sel = " selected=\"selected\"";
}
if($theme['pid'] != 0)
{
$themeselect .= "<option value=\"".$theme['tid']."\"$sel>".$depth.$theme['name']."</option>";
$depthit = $depth."--";
}
if(array_key_exists($theme['tid'], $tcache))

					{

					{

						$is_allowed = true;
break;

						build_theme_select($name, $selected, $theme['tid'], $depthit, $usergroup_override);


					}

					}

				}
}
// Show theme if allowed, or if override is on
if($is_allowed || $theme['allowedgroups'] == "all" || $usergroup_override == 1)
{
if($theme['tid'] == $selected)
{
$sel = "selected=\"selected\"";
}
if($theme['pid'] != 0)
{
$themeselect .= "<option value=\"".$theme['tid']."\" $sel>".$depth.$theme['name']."</option>";
$depthit = $depth."--";
}
if(is_array($tcache[$theme['tid']]))
{
build_theme_select($name, $selected, $theme['tid'], $depthit, $usergroup_override);

 
				}
}
}

				}
}
}

Zeile 2636Zeile 2649
	}
return $themeselect;
}

	}
return $themeselect;
}

 



/**
* Custom function for htmlspecialchars which takes in to account unicode


/**
* Custom function for htmlspecialchars which takes in to account unicode