Zeile 21 | Zeile 21 |
---|
$contents = parse_page($contents); $totaltime = $maintimer->stop();
|
$contents = parse_page($contents); $totaltime = $maintimer->stop();
|
| $contents = $plugins->run_hooks("pre_output_page", $contents);
|
if($mybb->usergroup['cancp'] == 1) {
| if($mybb->usergroup['cancp'] == 1) {
|
Zeile 83 | Zeile 84 |
---|
$other = "PHP version: $phpversion / Server Load: $serverload / GZip Compression: $gzipen"; $debugstuff = "Generated in $totaltime seconds ($percentphp% PHP / $percentsql% ".$database_server.")<br />SQL Queries: $db->query_count / Global Parsing Time: $globaltime$memory_usage<br />$other<br />[<a href=\"$debuglink\" target=\"_blank\">advanced details</a>]<br />"; $contents = str_replace("<debugstuff>", $debugstuff, $contents);
|
$other = "PHP version: $phpversion / Server Load: $serverload / GZip Compression: $gzipen"; $debugstuff = "Generated in $totaltime seconds ($percentphp% PHP / $percentsql% ".$database_server.")<br />SQL Queries: $db->query_count / Global Parsing Time: $globaltime$memory_usage<br />$other<br />[<a href=\"$debuglink\" target=\"_blank\">advanced details</a>]<br />"; $contents = str_replace("<debugstuff>", $debugstuff, $contents);
|
}
| }
|
if($mybb->debug_mode == true) {
| if($mybb->debug_mode == true) {
|
Zeile 92 | Zeile 93 |
---|
}
$contents = str_replace("<debugstuff>", "", $contents);
|
}
$contents = str_replace("<debugstuff>", "", $contents);
|
$contents = $plugins->run_hooks("pre_output_page", $contents);
| |
if($mybb->settings['gzipoutput'] == 1) {
| if($mybb->settings['gzipoutput'] == 1) {
|
Zeile 743 | Zeile 743 |
---|
"location2" => 0 );
|
"location2" => 0 );
|
$db->update_query("sessions", $noperm_array, "sid='{$session->sid}'", 1);
| $db->update_query("sessions", $noperm_array, "sid='{$session->sid}'");
|
if($mybb->input['ajax']) {
| if($mybb->input['ajax']) {
|
Zeile 1466 | Zeile 1466 |
---|
$mod_cache = $cache->read("moderators");
|
$mod_cache = $cache->read("moderators");
|
foreach($mod_cache as $fid => $forum)
| foreach($mod_cache as $forumid => $forum)
|
{
|
{
|
if(!is_array($forum) || !in_array($fid, $parentslist))
| if(!is_array($forum) || !in_array($forumid, $parentslist))
|
{ // No perms or we're not after this forum continue;
| { // No perms or we're not after this forum continue;
|
Zeile 1549 | Zeile 1549 |
---|
$user_perms = user_permissions($uid); if($user_perms['issupermod'] == 1) {
|
$user_perms = user_permissions($uid); if($user_perms['issupermod'] == 1) {
|
| if($fid) { $forumpermissions = forum_permissions($fid); if($forumpermissions['canview'] && $forumpermissions['canviewthreads'] && !$forumpermissions['canonlyviewownthreads']) { return true; } return false; }
|
return true; } else
| return true; } else
|
Zeile 1561 | Zeile 1570 |
---|
foreach($modcache as $modusers) { if(isset($modusers['users'][$uid]) && $modusers['users'][$uid]['mid'])
|
foreach($modcache as $modusers) { if(isset($modusers['users'][$uid]) && $modusers['users'][$uid]['mid'])
|
{
| {
|
return true; } elseif(isset($modusers['usergroups'][$user_perms['gid']])) { // Moderating usergroup return true;
|
return true; } elseif(isset($modusers['usergroups'][$user_perms['gid']])) { // Moderating usergroup return true;
|
} } }
| } } }
|
return false; } else { $modperms = get_moderator_permissions($fid, $uid);
|
return false; } else { $modperms = get_moderator_permissions($fid, $uid);
|
|
|
if(!$action && $modperms) { return true;
| if(!$action && $modperms) { return true;
|
Zeile 1592 | Zeile 1601 |
---|
return false; } }
|
return false; } }
|
} } }
| } } }
|
/** * Generate a list of the posticons. *
| /** * Generate a list of the posticons. *
|
Zeile 1648 | Zeile 1657 |
---|
eval("\$posticons = \"".$templates->get("posticons")."\";");
return $posticons;
|
eval("\$posticons = \"".$templates->get("posticons")."\";");
return $posticons;
|
}
| }
|
/** * MyBB setcookie() wrapper. *
| /** * MyBB setcookie() wrapper. *
|
Zeile 1670 | Zeile 1679 |
---|
if($expires == -1) { $expires = 0;
|
if($expires == -1) { $expires = 0;
|
}
| }
|
elseif($expires == "" || $expires == null)
|
elseif($expires == "" || $expires == null)
|
{
| {
|
$expires = TIME_NOW + (60*60*24*365); // Make the cookie expire in a years time
|
$expires = TIME_NOW + (60*60*24*365); // Make the cookie expire in a years time
|
} else {
| } else {
|
$expires = TIME_NOW + intval($expires); }
$mybb->settings['cookiepath'] = str_replace(array("\n","\r"), "", $mybb->settings['cookiepath']); $mybb->settings['cookiedomain'] = str_replace(array("\n","\r"), "", $mybb->settings['cookiedomain']); $mybb->settings['cookieprefix'] = str_replace(array("\n","\r", " "), "", $mybb->settings['cookieprefix']);
|
$expires = TIME_NOW + intval($expires); }
$mybb->settings['cookiepath'] = str_replace(array("\n","\r"), "", $mybb->settings['cookiepath']); $mybb->settings['cookiedomain'] = str_replace(array("\n","\r"), "", $mybb->settings['cookiedomain']); $mybb->settings['cookieprefix'] = str_replace(array("\n","\r", " "), "", $mybb->settings['cookieprefix']);
|
|
|
// 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: {$mybb->settings['cookieprefix']}{$name}=".urlencode($value);
if($expires > 0) { $cookie .= "; expires=".@gmdate('D, d-M-Y H:i:s \\G\\M\\T', $expires);
|
// 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: {$mybb->settings['cookieprefix']}{$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']))
|
if(!empty($mybb->settings['cookiepath']))
|
{
| {
|
$cookie .= "; path={$mybb->settings['cookiepath']}"; }
| $cookie .= "; path={$mybb->settings['cookiepath']}"; }
|
Zeile 1703 | Zeile 1712 |
---|
}
if($httponly == true)
|
}
if($httponly == true)
|
{
| {
|
$cookie .= "; HttpOnly"; }
|
$cookie .= "; HttpOnly"; }
|
|
|
$mybb->cookies[$name] = $value;
header($cookie, false);
|
$mybb->cookies[$name] = $value;
header($cookie, false);
|
}
/**
| }
/**
|
* Unset a cookie set by MyBB.
|
* Unset a cookie set by MyBB.
|
* * @param string The cookie identifier.
| * * @param string The cookie identifier.
|
*/ function my_unsetcookie($name) {
| */ function my_unsetcookie($name) {
|
Zeile 1729 | Zeile 1738 |
---|
/** * Get the contents from a serialised cookie array.
|
/** * Get the contents from a serialised cookie array.
|
* * @param string The cookie identifier.
| * * @param string The cookie identifier.
|
* @param int The cookie content id. * @return array|boolean The cookie id's content array or false when non-existent. */ function my_get_array_cookie($name, $id) { global $mybb;
|
* @param int The cookie content id. * @return array|boolean The cookie id's content array or false when non-existent. */ function my_get_array_cookie($name, $id) { global $mybb;
|
|
|
if(!isset($mybb->cookies['mybb'][$name])) { return false;
|
if(!isset($mybb->cookies['mybb'][$name])) { return false;
|
}
| }
|
$cookie = my_unserialize($mybb->cookies['mybb'][$name]);
| $cookie = my_unserialize($mybb->cookies['mybb'][$name]);
|
Zeile 1757 | Zeile 1766 |
---|
/** * Set a serialised cookie array.
|
/** * Set a serialised cookie array.
|
*
| *
|
* @param string The cookie identifier. * @param int The cookie content id. * @param string The value to set the cookie to.
|
* @param string The cookie identifier. * @param int The cookie content id. * @param string The value to set the cookie to.
|
*/
| */
|
function my_set_array_cookie($name, $id, $value, $expires="") { global $mybb;
$cookie = $mybb->cookies['mybb']; $newcookie = my_unserialize($cookie[$name]);
|
function my_set_array_cookie($name, $id, $value, $expires="") { global $mybb;
$cookie = $mybb->cookies['mybb']; $newcookie = my_unserialize($cookie[$name]);
|
|
|
$newcookie[$id] = $value; $newcookie = serialize($newcookie); my_setcookie("mybb[$name]", addslashes($newcookie), $expires);
| $newcookie[$id] = $value; $newcookie = serialize($newcookie); my_setcookie("mybb[$name]", addslashes($newcookie), $expires);
|
Zeile 1785 | Zeile 1794 |
---|
*/ function my_unserialize($data) {
|
*/ function my_unserialize($data) {
|
| // Do no unserialize objects if(substr($data, 0, 1) == 'O') { return array(); }
|
$array = unserialize($data);
if(!is_array($array))
| $array = unserialize($data);
if(!is_array($array))
|
Zeile 2761 | Zeile 2776 |
---|
}
$prefixselect = "";
|
}
$prefixselect = "";
|
$multipleselect = "";
| |
if($multiple != 0) {
|
if($multiple != 0) {
|
$multipleselect = " multiple=\"multiple\" size=\"5\"";
| $prefixselect = "<select name=\"threadprefix[]\" multiple=\"multiple\" size=\"5\">\n"; } else { $prefixselect = "<select name=\"threadprefix\">\n";
|
}
|
}
|
$prefixselect = "<select name=\"threadprefix\"{$multipleselect}>\n";
| |
if($multiple == 1) {
| if($multiple == 1) {
|
Zeile 2810 | Zeile 2826 |
---|
* @param string The string to encode * @param int The level (1-9) to encode at * @return string The encoded string
|
* @param string The string to encode * @param int The level (1-9) to encode at * @return string The encoded string
|
*/
| */
|
function gzip_encode($contents, $level=1) { if(function_exists("gzcompress") && function_exists("crc32") && !headers_sent() && !(ini_get('output_buffering') && my_strpos(' '.ini_get('output_handler'), 'ob_gzhandler'))) { $httpaccept_encoding = '';
|
function gzip_encode($contents, $level=1) { if(function_exists("gzcompress") && function_exists("crc32") && !headers_sent() && !(ini_get('output_buffering') && my_strpos(' '.ini_get('output_handler'), 'ob_gzhandler'))) { $httpaccept_encoding = '';
|
|
|
if(isset($_SERVER['HTTP_ACCEPT_ENCODING'])) { $httpaccept_encoding = $_SERVER['HTTP_ACCEPT_ENCODING'];
|
if(isset($_SERVER['HTTP_ACCEPT_ENCODING'])) { $httpaccept_encoding = $_SERVER['HTTP_ACCEPT_ENCODING'];
|
}
| }
|
if(my_strpos(" ".$httpaccept_encoding, "x-gzip")) { $encoding = "x-gzip";
| if(my_strpos(" ".$httpaccept_encoding, "x-gzip")) { $encoding = "x-gzip";
|
Zeile 2854 | Zeile 2870 |
---|
}
return $contents;
|
}
return $contents;
|
}
| }
|
/** * Log the actions of a moderator.
| /** * Log the actions of a moderator.
|
Zeile 2938 | Zeile 2954 |
---|
else { $display_reputation .= "reputation_neutral";
|
else { $display_reputation .= "reputation_neutral";
|
}
$display_reputation .= "\">{$reputation}</strong>";
| }
$display_reputation .= "\">{$reputation}</strong>";
|
if($uid != 0) { $display_reputation .= "</a>";
| if($uid != 0) { $display_reputation .= "</a>";
|
Zeile 2952 | Zeile 2968 |
---|
/** * Fetch a color coded version of a warning level (based on it's percentage)
|
/** * Fetch a color coded version of a warning level (based on it's percentage)
|
*
| *
|
* @param int The warning level (percentage of 100) * @return string Formatted warning level */
| * @param int The warning level (percentage of 100) * @return string Formatted warning level */
|
Zeile 2963 | Zeile 2979 |
---|
return "<span class=\"high_warning\">{$level}%</span>"; } else if($level >= 50)
|
return "<span class=\"high_warning\">{$level}%</span>"; } else if($level >= 50)
|
{
| {
|
return "<span class=\"moderate_warning\">{$level}%</span>"; } else if($level >= 25) { return "<span class=\"low_warning\">{$level}%</span>";
|
return "<span class=\"moderate_warning\">{$level}%</span>"; } else if($level >= 25) { return "<span class=\"low_warning\">{$level}%</span>";
|
}
| }
|
else { return $level."%";
| else { return $level."%";
|
Zeile 2985 | Zeile 3001 |
---|
{ global $mybb, $plugins;
|
{ global $mybb, $plugins;
|
$ip = 0;
if(!preg_match("#^(10|172\.16|192\.168)\.#", $_SERVER['REMOTE_ADDR']))
| $ip = 0;
if(!preg_match("#^(10|172\.(1[6-9]|2[0-9]|3[0-1])|192\.168)\.#", $_SERVER['REMOTE_ADDR']))
|
{ $ip = $_SERVER['REMOTE_ADDR']; }
if($mybb->settings['ip_forwarded_check'])
|
{ $ip = $_SERVER['REMOTE_ADDR']; }
if($mybb->settings['ip_forwarded_check'])
|
{
| {
|
if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { preg_match_all("#[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}#s", $_SERVER['HTTP_X_FORWARDED_FOR'], $addresses);
| if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { preg_match_all("#[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}#s", $_SERVER['HTTP_X_FORWARDED_FOR'], $addresses);
|
Zeile 3004 | Zeile 3020 |
---|
}
if(is_array($addresses[0]))
|
}
if(is_array($addresses[0]))
|
{
| {
|
foreach($addresses[0] as $key => $val) {
|
foreach($addresses[0] as $key => $val) {
|
if(!preg_match("#^(10|172\.16|192\.168)\.#", $val))
| if(!preg_match("#^(10|172\.(1[6-9]|2[0-9]|3[0-1])|192\.168)\.#", $val))
|
{ $ip = $val; break; } }
|
{ $ip = $val; break; } }
|
} }
| } }
|
if(!$ip) { if(isset($_SERVER['HTTP_CLIENT_IP']))
| if(!$ip) { if(isset($_SERVER['HTTP_CLIENT_IP']))
|
Zeile 3031 | Zeile 3047 |
---|
}
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 3042 | Zeile 3058 |
---|
function get_friendly_size($size) { global $lang;
|
function get_friendly_size($size) { global $lang;
|
|
|
if(!is_numeric($size)) { return $lang->na;
| if(!is_numeric($size)) { return $lang->na;
|
Zeile 3075 | Zeile 3091 |
---|
} // Gigabyte (1024 Megabytes) elseif($size >= 1073741824)
|
} // Gigabyte (1024 Megabytes) elseif($size >= 1073741824)
|
{
| {
|
$size = my_number_format(round(($size / 1073741824), 2))." ".$lang->size_gb; } // Megabyte (1024 Kilobytes)
| $size = my_number_format(round(($size / 1073741824), 2))." ".$lang->size_gb; } // Megabyte (1024 Kilobytes)
|
Zeile 3118 | Zeile 3134 |
---|
$ext = my_strtolower($ext);
if($attachtypes[$ext]['icon'])
|
$ext = my_strtolower($ext);
if($attachtypes[$ext]['icon'])
|
{
| {
|
if(defined("IN_ADMINCP"))
|
if(defined("IN_ADMINCP"))
|
{
| {
|
$icon = str_replace("{theme}", "", $attachtypes[$ext]['icon']); if(my_substr($icon, 0, 1) != "/" && my_substr($icon, 0, 7) != "http://") {
| $icon = str_replace("{theme}", "", $attachtypes[$ext]['icon']); if(my_substr($icon, 0, 1) != "/" && my_substr($icon, 0, 7) != "http://") {
|
Zeile 3128 | Zeile 3144 |
---|
} } elseif(defined("IN_PORTAL"))
|
} } elseif(defined("IN_PORTAL"))
|
{ global $change_dir;
| { global $change_dir;
|
$icon = $change_dir."/".str_replace("{theme}", $theme['imgdir'], $attachtypes[$ext]['icon']);
|
$icon = $change_dir."/".str_replace("{theme}", $theme['imgdir'], $attachtypes[$ext]['icon']);
|
}
| }
|
else { $icon = str_replace("{theme}", $theme['imgdir'], $attachtypes[$ext]['icon']); }
|
else { $icon = str_replace("{theme}", $theme['imgdir'], $attachtypes[$ext]['icon']); }
|
| $icon = htmlspecialchars_uni($icon);
|
return "<img src=\"{$icon}\" border=\"0\" alt=\".{$ext}\" />"; } else { if(defined("IN_ADMINCP"))
|
return "<img src=\"{$icon}\" border=\"0\" alt=\".{$ext}\" />"; } else { if(defined("IN_ADMINCP"))
|
{
| {
|
$theme['imgdir'] = "../images"; } else if(defined("IN_PORTAL")) { global $change_dir;
|
$theme['imgdir'] = "../images"; } else if(defined("IN_PORTAL")) { global $change_dir;
|
$theme['imgdir'] = "{$change_dir}/images";
| $theme['imgdir'] = htmlspecialchars_uni("{$change_dir}/images");
|
}
return "<img src=\"{$theme['imgdir']}/attachtypes/unknown.gif\" border=\"0\" alt=\".{$ext}\" />";
| }
return "<img src=\"{$theme['imgdir']}/attachtypes/unknown.gif\" border=\"0\" alt=\".{$ext}\" />";
|
Zeile 3178 | Zeile 3195 |
---|
foreach($forum_cache as $fid => $forum) { if($permissioncache[$forum['fid']])
|
foreach($forum_cache as $fid => $forum) { if($permissioncache[$forum['fid']])
|
{
| {
|
$perms = $permissioncache[$forum['fid']]; } else
| $perms = $permissioncache[$forum['fid']]; } else
|
Zeile 3202 | Zeile 3219 |
---|
// Check parents for passwords $parents = explode(",", $forum['parentlist']); foreach($parents as $parent)
|
// Check parents for passwords $parents = explode(",", $forum['parentlist']); foreach($parents as $parent)
|
{
| {
|
if(isset($password_forums[$parent]) && $mybb->cookies['forumpass'][$parent] != md5($mybb->user['uid'].$password_forums[$parent])) { $pwverified = 0; }
|
if(isset($password_forums[$parent]) && $mybb->cookies['forumpass'][$parent] != md5($mybb->user['uid'].$password_forums[$parent])) { $pwverified = 0; }
|
}
| }
|
}
if($perms['canview'] == 0 || $pwverified == 0 || ($only_readable_threads == true && $perms['canviewthreads'] == 0))
| }
if($perms['canview'] == 0 || $pwverified == 0 || ($only_readable_threads == true && $perms['canviewthreads'] == 0))
|
Zeile 3215 | Zeile 3232 |
---|
if($unviewableforums) { $unviewableforums .= ",";
|
if($unviewableforums) { $unviewableforums .= ",";
|
}
| }
|
$unviewableforums .= "'".$forum['fid']."'"; } }
| $unviewableforums .= "'".$forum['fid']."'"; } }
|
Zeile 3240 | Zeile 3257 |
---|
// -2 idea provided by Matt Light (http://www.mephex.com) $format = str_replace("Y", $year, $format); $format = str_replace("y", my_substr($year, -2), $format);
|
// -2 idea provided by Matt Light (http://www.mephex.com) $format = str_replace("Y", $year, $format); $format = str_replace("y", my_substr($year, -2), $format);
|
|
|
return $format; }
| return $format; }
|
Zeile 3252 | Zeile 3269 |
---|
function build_breadcrumb() { global $nav, $navbits, $templates, $theme, $lang, $mybb;
|
function build_breadcrumb() { global $nav, $navbits, $templates, $theme, $lang, $mybb;
|
|
|
eval("\$navsep = \"".$templates->get("nav_sep")."\";");
$i = 0;
| eval("\$navsep = \"".$templates->get("nav_sep")."\";");
$i = 0;
|
Zeile 3278 | Zeile 3295 |
---|
$multipage_dropdown = null; if(!empty($navbit['multipage'])) {
|
$multipage_dropdown = null; if(!empty($navbit['multipage'])) {
|
| if(!$mybb->settings['threadsperpage'] || (int)$mybb->settings['threadsperpage'] < 1) { $mybb->settings['threadsperpage'] = 20; }
|
$multipage = multipage($navbit['multipage']['num_threads'], $mybb->settings['threadsperpage'], $navbit['multipage']['current_page'], $navbit['multipage']['url'], true); if($multipage) {
| $multipage = multipage($navbit['multipage']['num_threads'], $mybb->settings['threadsperpage'], $navbit['multipage']['current_page'], $navbit['multipage']['url'], true); if($multipage) {
|
Zeile 3312 | Zeile 3334 |
---|
/** * Add a breadcrumb menu item to the list.
|
/** * Add a breadcrumb menu item to the list.
|
*
| *
|
* @param string The name of the item to add * @param string The URL of the item to add */
| * @param string The name of the item to add * @param string The URL of the item to add */
|
Zeile 3504 | Zeile 3526 |
---|
echo "<td bgcolor=\"#FEFEFE\" width=\"25%\"><font face=\"Tahoma\" size=\"2\">{$mybb->config['database']['type']}, xml</font></td>\n"; echo "<td bgcolor=\"#EFEFEF\" width=\"25%\"><b><font face=\"Tahoma\" size=\"2\">Global.php Processing Time:</font></b></td>\n"; echo "<td bgcolor=\"#FEFEFE\" width=\"25%\"><font face=\"Tahoma\" size=\"2\">$globaltime seconds</font></td>\n";
|
echo "<td bgcolor=\"#FEFEFE\" width=\"25%\"><font face=\"Tahoma\" size=\"2\">{$mybb->config['database']['type']}, xml</font></td>\n"; echo "<td bgcolor=\"#EFEFEF\" width=\"25%\"><b><font face=\"Tahoma\" size=\"2\">Global.php Processing Time:</font></b></td>\n"; echo "<td bgcolor=\"#FEFEFE\" width=\"25%\"><font face=\"Tahoma\" size=\"2\">$globaltime seconds</font></td>\n";
|
echo "</tr>\n"; echo "<tr>\n";
| echo "</tr>\n"; echo "<tr>\n";
|
echo "<td bgcolor=\"#EFEFEF\" width=\"25%\"><b><font face=\"Tahoma\" size=\"2\">PHP Version:</font></b></td>\n"; echo "<td bgcolor=\"#FEFEFE\" width=\"25%\"><font face=\"Tahoma\" size=\"2\">$phpversion</font></td>\n"; echo "<td bgcolor=\"#EFEFEF\" width=\"25%\"><b><font face=\"Tahoma\" size=\"2\">Server Load:</font></b></td>\n";
| echo "<td bgcolor=\"#EFEFEF\" width=\"25%\"><b><font face=\"Tahoma\" size=\"2\">PHP Version:</font></b></td>\n"; echo "<td bgcolor=\"#FEFEFE\" width=\"25%\"><font face=\"Tahoma\" size=\"2\">$phpversion</font></td>\n"; echo "<td bgcolor=\"#EFEFEF\" width=\"25%\"><b><font face=\"Tahoma\" size=\"2\">Server Load:</font></b></td>\n";
|
Zeile 3554 | Zeile 3576 |
---|
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 "<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";
|
Zeile 3577 | Zeile 3599 |
---|
echo "</body>"; echo "</html>"; exit;
|
echo "</body>"; echo "</html>"; exit;
|
}
| }
|
/** * Outputs the correct page headers. */
| /** * Outputs the correct page headers. */
|
Zeile 3602 | Zeile 3624 |
---|
* @param string The type of item the above IDs are for - post, posts, thread, threads, forum, all */ function mark_reports($id, $type="post")
|
* @param string The type of item the above IDs are for - post, posts, thread, threads, forum, all */ function mark_reports($id, $type="post")
|
{
| {
|
global $db, $cache, $plugins;
switch($type)
| global $db, $cache, $plugins;
switch($type)
|
Zeile 3891 | Zeile 3913 |
---|
if(is_array($groups)) { foreach($groups as $gid)
|
if(is_array($groups)) { foreach($groups as $gid)
|
{
| {
|
if(trim($gid) != "" && $leavegroup != $gid && !$donegroup[$gid]) { $groupslist .= $comma.$gid;
| if(trim($gid) != "" && $leavegroup != $gid && !$donegroup[$gid]) { $groupslist .= $comma.$gid;
|
Zeile 3928 | Zeile 3950 |
---|
if(defined("MYBB_LOCATION")) { return MYBB_LOCATION;
|
if(defined("MYBB_LOCATION")) { return MYBB_LOCATION;
|
}
| }
|
if(!empty($_SERVER['PATH_INFO'])) {
| if(!empty($_SERVER['PATH_INFO'])) {
|
Zeile 3952 | Zeile 3974 |
---|
global $mybb;
if(!is_array($ignore))
|
global $mybb;
if(!is_array($ignore))
|
{
| {
|
$ignore = array($ignore); }
| $ignore = array($ignore); }
|
Zeile 3988 | Zeile 4010 |
---|
$post_array = array('action', 'fid', 'pid', 'tid', 'uid', 'eid');
foreach($post_array as $var)
|
$post_array = array('action', 'fid', 'pid', 'tid', 'uid', 'eid');
foreach($post_array as $var)
|
{
| {
|
if(isset($_POST[$var])) { $addloc[] = urlencode($var).'='.urlencode($_POST[$var]);
| if(isset($_POST[$var])) { $addloc[] = urlencode($var).'='.urlencode($_POST[$var]);
|
Zeile 4047 | Zeile 4069 |
---|
while($theme = $db->fetch_array($query)) { $tcache[$theme['pid']][$theme['tid']] = $theme;
|
while($theme = $db->fetch_array($query)) { $tcache[$theme['pid']][$theme['tid']] = $theme;
|
}
| }
|
}
if(is_array($tcache[$tid]))
| }
if(is_array($tcache[$tid]))
|
Zeile 4084 | Zeile 4106 |
---|
if($theme['tid'] == $selected) { $sel = " selected=\"selected\"";
|
if($theme['tid'] == $selected) { $sel = " selected=\"selected\"";
|
}
| }
|
if($theme['pid'] != 0) { $themeselect .= "<option value=\"".$theme['tid']."\"$sel>".$depth.htmlspecialchars_uni($theme['name'])."</option>";
| if($theme['pid'] != 0) { $themeselect .= "<option value=\"".$theme['tid']."\"$sel>".$depth.htmlspecialchars_uni($theme['name'])."</option>";
|
Zeile 4278 | Zeile 4300 |
---|
if($i == $year && $l == $month && $m == $day) { return $h;
|
if($i == $year && $l == $month && $m == $day) { return $h;
|
}
| }
|
if($h == 0) {
| if($h == 0) {
|
Zeile 4471 | Zeile 4493 |
---|
$string = preg_replace("#&\#([0-9]+);#", "-", $string);
if(strtolower($lang->settings['charset']) == "utf-8")
|
$string = preg_replace("#&\#([0-9]+);#", "-", $string);
if(strtolower($lang->settings['charset']) == "utf-8")
|
{
| {
|
// Get rid of any excess RTL and LTR override for they are the workings of the devil $string = str_replace(dec_to_utf8(8238), "", $string); $string = str_replace(dec_to_utf8(8237), "", $string);
| // Get rid of any excess RTL and LTR override for they are the workings of the devil $string = str_replace(dec_to_utf8(8238), "", $string); $string = str_replace(dec_to_utf8(8237), "", $string);
|
Zeile 4664 | Zeile 4686 |
---|
* @return string The link to the event poster. */ function get_event_poster($event)
|
* @return string The link to the event poster. */ function get_event_poster($event)
|
{
| {
|
$event['username'] = format_name($event['username'], $event['usergroup'], $event['displaygroup']); $event_poster = build_profile_link($event['username'], $event['author']); return $event_poster;
| $event['username'] = format_name($event['username'], $event['usergroup'], $event['displaygroup']); $event_poster = build_profile_link($event['username'], $event['author']); return $event_poster;
|
Zeile 5049 | Zeile 5071 |
---|
* @return string The comma separated values of the inactivate forum. */ function get_inactive_forums()
|
* @return string The comma separated values of the inactivate forum. */ function get_inactive_forums()
|
{
| {
|
global $forum_cache, $cache, $inactiveforums;
|
global $forum_cache, $cache, $inactiveforums;
|
|
|
if(!$forum_cache)
|
if(!$forum_cache)
|
{
| {
|
cache_forums(); }
|
cache_forums(); }
|
|
|
$inactive = array();
foreach($forum_cache as $fid => $forum)
|
$inactive = array();
foreach($forum_cache as $fid => $forum)
|
{
| {
|
if($forum['active'] == 0) { $inactive[] = $fid;
| if($forum['active'] == 0) { $inactive[] = $fid;
|
Zeile 5070 | Zeile 5092 |
---|
{ $inactive[] = $fid1; }
|
{ $inactive[] = $fid1; }
|
} } }
| } } }
|
$inactiveforums = implode(",", $inactive);
return $inactiveforums;
| $inactiveforums = implode(",", $inactive);
return $inactiveforums;
|
Zeile 5120 | Zeile 5142 |
---|
if(empty($mybb->cookies['failedlogin'])) { $failedtime = $now;
|
if(empty($mybb->cookies['failedlogin'])) { $failedtime = $now;
|
}
| }
|
else { $failedtime = $mybb->cookies['failedlogin'];
| else { $failedtime = $mybb->cookies['failedlogin'];
|
Zeile 5145 | Zeile 5167 |
---|
// Work out if the user has waited long enough before letting them login again if($mybb->cookies['failedlogin'] < ($now - $mybb->settings['failedlogintime'] * 60))
|
// Work out if the user has waited long enough before letting them login again if($mybb->cookies['failedlogin'] < ($now - $mybb->settings['failedlogintime'] * 60))
|
{
| {
|
my_setcookie('loginattempts', 1); my_unsetcookie('failedlogin'); if($mybb->user['uid'] != 0)
| my_setcookie('loginattempts', 1); my_unsetcookie('failedlogin'); if($mybb->user['uid'] != 0)
|
Zeile 5435 | Zeile 5457 |
---|
// 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))
|
{ // Updating last use
| { // Updating last use
|
if($update_lastuse == true) { $db->update_query("banfilters", array("lastuse" => TIME_NOW), "fid='{$banned_username['fid']}'");
| if($update_lastuse == true) { $db->update_query("banfilters", array("lastuse" => TIME_NOW), "fid='{$banned_username['fid']}'");
|
Zeile 5629 | Zeile 5651 |
---|
foreach($post_data as $key => $val) { $post_body .= '&'.urlencode($key).'='.urlencode($val);
|
foreach($post_data as $key => $val) { $post_body .= '&'.urlencode($key).'='.urlencode($val);
|
}
| }
|
$post_body = ltrim($post_body, '&'); }
| $post_body = ltrim($post_body, '&'); }
|
Zeile 5731 | Zeile 5753 |
---|
*/ function is_super_admin($uid) {
|
*/ function is_super_admin($uid) {
|
global $mybb;
$mybb->config['super_admins'] = str_replace(" ", "", $mybb->config['super_admins']); if(my_strpos(",{$mybb->config['super_admins']},", ",{$uid},") === false) {
| static $super_admins;
if(!isset($super_admins)) { global $mybb; $super_admins = str_replace(" ", "", $mybb->config['super_admins']); }
if(my_strpos(",{$super_admins},", ",{$uid},") === false) {
|
return false;
|
return false;
|
}
| }
|
else
|
else
|
{
| {
|
return true; }
|
return true; }
|
| }
/** * Prevents super administrators being selected in a SELECT. * * @param boolean Prefix with an AND? * @param string The prefix to add to uid when used in a JOIN (e.g. SELECTing users u would mean using 'u' in this argument). * @return string An addition to the WHERE statement */ function not_super_admins($use_and = false, $uid_prefix = '') { static $super_admins;
if(!isset($super_admins)) { global $mybb, $db; $super_admins = $db->escape_string(str_replace(" ", "", $mybb->config['super_admins'])); }
if($super_admins) { $sql_where = ''; if($use_and) { $sql_where .= ' AND '; }
if($uid_prefix != '') { $sql_where .= $uid_prefix.'.'; }
$sql_where .= "uid NOT IN({$super_admins})";
return $sql_where; } return '';
|
}
/**
| }
/**
|
Zeile 6209 | Zeile 6273 |
---|
function secure_seed_rng($count=8) { $output = '';
|
function secure_seed_rng($count=8) { $output = '';
|
// Try the unix/linux method if(@is_readable('/dev/urandom') && ($handle = @fopen('/dev/urandom', 'rb')))
| // DIRECTORY_SEPARATOR checks if running windows if(DIRECTORY_SEPARATOR != '\\') { // Unix/Linux // Use OpenSSL when available if(function_exists('openssl_random_pseudo_bytes')) { $output = openssl_random_pseudo_bytes($count); } // Try mcrypt elseif(function_exists('mcrypt_create_iv')) { $output = mcrypt_create_iv($count, MCRYPT_DEV_URANDOM); } // Try /dev/urandom elseif(@is_readable('/dev/urandom') && ($handle = @fopen('/dev/urandom', 'rb'))) { $output = @fread($handle, $count); @fclose($handle); } } else
|
{
|
{
|
$output = @fread($handle, $count); @fclose($handle);
| // Windows // Use OpenSSL when available // PHP <5.3.4 had a bug which makes that function unusable on Windows if(function_exists('openssl_random_pseudo_bytes') && version_compare(PHP_VERSION, '5.3.4', '>=')) { $output = openssl_random_pseudo_bytes($count); } // Try mcrypt elseif(function_exists('mcrypt_create_iv')) { $output = mcrypt_create_iv($count, MCRYPT_RAND); } // Try Windows CAPICOM before using our own generator elseif(class_exists('COM')) { try { $CAPI_Util = new COM('CAPICOM.Utilities.1'); if(is_callable(array($CAPI_Util, 'GetRandom'))) { $output = $CAPI_Util->GetRandom($count, 0); } } catch (Exception $e) { } }
|
}
// Didn't work? Do we still not have enough bytes? Use our own (less secure) rng generator
| }
// Didn't work? Do we still not have enough bytes? Use our own (less secure) rng generator
|
Zeile 6285 | Zeile 6391 |
---|
}
/**
|
}
/**
|
* More robust version of PHP's trim() function. It includes a list of UTF-16 blank characters
| * More robust version of PHP's trim() function. It includes a list of UTF-8 blank characters
|
* from http://kb.mozillazine.org/Network.IDN.blacklist_chars * * @param string The string to trim from
| * from http://kb.mozillazine.org/Network.IDN.blacklist_chars * * @param string The string to trim from
|
Zeile 6295 | Zeile 6401 |
---|
function trim_blank_chrs($string, $charlist=false) { $hex_chrs = array(
|
function trim_blank_chrs($string, $charlist=false) { $hex_chrs = array(
|
0x20 => 1, 0x09 => 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} 0xA8 => 1, 0xA9 => 1, 0xAA => 1, 0xAB => 1, 0xAC => 1, 0xAD => 1, 0xAE => 1, 0xAF => 1), // \x{2028} to \x{202F} 0x81 => array(0x9F => 1)), // \x{205F}
| 0x09 => 1, // \x{0009} 0x0A => 1, // \x{000A} 0x0B => 1, // \x{000B} 0x0D => 1, // \x{000D} 0x20 => 1, // \x{0020} 0xC2 => array(0x81 => 1, 0x8D => 1, 0x90 => 1, 0x9D => 1, 0xA0 => 1, 0xAD => 1), // \x{0081}, \x{008D}, \x{0090}, \x{009D}, \x{00A0}, \x{00AD} 0xCC => array(0xB7 => 1, 0xB8 => 1), // \x{0337}, \x{0338} 0xE1 => array(0x85 => array(0x9F => 1, 0xA0 => 1), 0x9A => array(0x80 => 1), 0xA0 => array(0x8E => 1)), // \x{115F}, \x{1160}, \x{1680}, \x{180E} 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, 0x8C => 1, 0x8D => 1, 0x8E => 1, 0x8F => 1, // \x{2000} - \x{200F} 0xA8 => 1, 0xA9 => 1, 0xAA => 1, 0xAB => 1, 0xAC => 1, 0xAD => 1, 0xAE => 1, 0xAF => 1), // \x{2028} - \x{202F} 0x81 => array(0x9F => 1)), // \x{205F}
|
0xE3 => array(0x80 => array(0x80 => 1), // \x{3000}
|
0xE3 => array(0x80 => array(0x80 => 1), // \x{3000}
|
0x85 => array(0xA4 => 1)), // \x{3164}
| 0x85 => array(0xA4 => 1)), // \x{3164}
|
0xEF => array(0xBB => array(0xBF => 1), // \x{FEFF}
|
0xEF => array(0xBB => array(0xBF => 1), // \x{FEFF}
|
0xBE => array(0xA0 => 1), // \x{FFA0} 0xBF => array(0xB9 => 1, 0xBA => 1, 0xBB => 1)), // \x{FFF9} to \x{FFFB}
| 0xBE => array(0xA0 => 1), // \x{FFA0} 0xBF => array(0xB9 => 1, 0xBA => 1, 0xBB => 1)), // \x{FFF9} - \x{FFFB}
|
);
$hex_chrs_rev = array(
|
);
$hex_chrs_rev = array(
|
0x20 => 1, 0x09 => 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),
| 0x09 => 1, // \x{0009} 0x0A => 1, // \x{000A} 0x0B => 1, // \x{000B} 0x0D => 1, // \x{000D} 0x20 => 1, // \x{0020} 0x81 => array(0xC2 => 1, 0x80 => array(0xE2 => 1)), // \x{0081}, \x{2001} 0x8D => array(0xC2 => 1, 0x80 => array(0xE2 => 1)), // \x{008D}, \x{200D} 0x90 => array(0xC2 => 1), // \x{0090} 0x9D => array(0xC2 => 1), // \x{009D} 0xA0 => array(0xC2 => 1, 0x85 => array(0xE1 => 1), 0x81 => array(0xE2 => 1), 0xBE => array(0xEF => 1)), // \x{00A0}, \x{1160}, \x{2060}, \x{FFA0} 0xAD => array(0xC2 => 1, 0x80 => array(0xE2 => 1)), // \x{00AD}, \x{202D}
|
0xB8 => array(0xCC => 1), // \x{0338} 0xB7 => array(0xCC => 1), // \x{0337}
|
0xB8 => array(0xCC => 1), // \x{0338} 0xB7 => array(0xCC => 1), // \x{0337}
|
0xA0 => array(0x85 => array(0xE1 => 1)), // \x{1160} 0x9F => array(0x85 => array(0xE1 => 1), // \x{115F} 0x81 => array(0xE2 => 1)), // \x{205F} 0x80 => array(0x80 => array(0xE3 => 1, 0xE2 => 1)), // \x{3000}, \x{2000} 0x81 => array(0x80 => array(0xE2 => 1)), // \x{2001}
| 0x9F => array(0x85 => array(0xE1 => 1), 0x81 => array(0xE2 => 1)), // \x{115F}, \x{205F} 0x80 => array(0x9A => array(0xE1 => 1), 0x80 => array(0xE2 => 1, 0xE3 => 1)), // \x{1680}, \x{2000}, \x{3000} 0x8E => array(0xA0 => array(0xE1 => 1), 0x80 => array(0xE2 => 1)), // \x{180E}, \x{200E}
|
0x82 => array(0x80 => array(0xE2 => 1)), // \x{2002} 0x83 => array(0x80 => array(0xE2 => 1)), // \x{2003} 0x84 => array(0x80 => array(0xE2 => 1)), // \x{2004}
| 0x82 => array(0x80 => array(0xE2 => 1)), // \x{2002} 0x83 => array(0x80 => array(0xE2 => 1)), // \x{2003} 0x84 => array(0x80 => array(0xE2 => 1)), // \x{2004}
|
Zeile 6350 | Zeile 6446 |
---|
0x89 => array(0x80 => array(0xE2 => 1)), // \x{2009} 0x8A => array(0x80 => array(0xE2 => 1)), // \x{200A} 0x8B => array(0x80 => array(0xE2 => 1)), // \x{200B}
|
0x89 => array(0x80 => array(0xE2 => 1)), // \x{2009} 0x8A => array(0x80 => array(0xE2 => 1)), // \x{200A} 0x8B => array(0x80 => array(0xE2 => 1)), // \x{200B}
|
| 0x8C => array(0x80 => array(0xE2 => 1)), // \x{200C} 0x8F => array(0x80 => array(0xE2 => 1)), // \x{200F}
|
0xA8 => array(0x80 => array(0xE2 => 1)), // \x{2028} 0xA9 => array(0x80 => array(0xE2 => 1)), // \x{2029} 0xAA => array(0x80 => array(0xE2 => 1)), // \x{202A} 0xAB => array(0x80 => array(0xE2 => 1)), // \x{202B} 0xAC => array(0x80 => array(0xE2 => 1)), // \x{202C}
|
0xA8 => array(0x80 => array(0xE2 => 1)), // \x{2028} 0xA9 => array(0x80 => array(0xE2 => 1)), // \x{2029} 0xAA => array(0x80 => array(0xE2 => 1)), // \x{202A} 0xAB => array(0x80 => array(0xE2 => 1)), // \x{202B} 0xAC => array(0x80 => array(0xE2 => 1)), // \x{202C}
|
0xAD => array(0x80 => array(0xE2 => 1)), // \x{202D}
| |
0xAE => array(0x80 => array(0xE2 => 1)), // \x{202E} 0xAF => array(0x80 => array(0xE2 => 1)), // \x{202F} 0xA4 => array(0x85 => array(0xE3 => 1)), // \x{3164} 0xBF => array(0xBB => array(0xEF => 1)), // \x{FEFF}
|
0xAE => array(0x80 => array(0xE2 => 1)), // \x{202E} 0xAF => array(0x80 => array(0xE2 => 1)), // \x{202F} 0xA4 => array(0x85 => array(0xE3 => 1)), // \x{3164} 0xBF => array(0xBB => array(0xEF => 1)), // \x{FEFF}
|
0xA0 => array(0xBE => array(0xEF => 1)), // \x{FFA0}
| |
0xB9 => array(0xBF => array(0xEF => 1)), // \x{FFF9} 0xBA => array(0xBF => array(0xEF => 1)), // \x{FFFA} 0xBB => array(0xBF => array(0xEF => 1)), // \x{FFFB}
| 0xB9 => array(0xBF => array(0xEF => 1)), // \x{FFF9} 0xBA => array(0xBF => array(0xEF => 1)), // \x{FFFA} 0xBB => array(0xBF => array(0xEF => 1)), // \x{FFFB}
|
Zeile 6369 | Zeile 6465 |
---|
// Start from the beginning and work our way in do {
|
// Start from the beginning and work our way in do {
|
// Check to see if we have matched a first character in our utf-16 array
| // Check to see if we have matched a first character in our utf-8 array
|
$offset = match_sequence($string, $hex_chrs); if(!$offset) {
| $offset = match_sequence($string, $hex_chrs); if(!$offset) {
|
Zeile 6384 | Zeile 6480 |
---|
$string = strrev($string); do {
|
$string = strrev($string); do {
|
// Check to see if we have matched a first character in our utf-16 array
| // Check to see if we have matched a first character in our utf-8 array
|
$offset = match_sequence($string, $hex_chrs_rev); if(!$offset) {
| $offset = match_sequence($string, $hex_chrs_rev); if(!$offset) {
|