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;
| } } return false;
|
Zeile 2761 | Zeile 2770 |
---|
}
$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 2820 |
---|
* @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 2864 |
---|
}
return $contents;
|
}
return $contents;
|
}
| }
|
/** * Log the actions of a moderator.
| /** * Log the actions of a moderator.
|
Zeile 2938 | Zeile 2948 |
---|
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 2962 |
---|
/** * 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 2973 |
---|
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 2995 |
---|
{ 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 3014 |
---|
}
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 3041 |
---|
}
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 3052 |
---|
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 3085 |
---|
} // 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 3128 |
---|
$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 3131 | Zeile 3141 |
---|
{ 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']);
|
}
| }
|
else
|
else
|
{
| {
|
$icon = str_replace("{theme}", $theme['imgdir'], $attachtypes[$ext]['icon']); } return "<img src=\"{$icon}\" border=\"0\" alt=\".{$ext}\" />";
| $icon = str_replace("{theme}", $theme['imgdir'], $attachtypes[$ext]['icon']); } return "<img src=\"{$icon}\" border=\"0\" alt=\".{$ext}\" />";
|
Zeile 3143 | Zeile 3153 |
---|
if(defined("IN_ADMINCP")) { $theme['imgdir'] = "../images";
|
if(defined("IN_ADMINCP")) { $theme['imgdir'] = "../images";
|
}
| }
|
else if(defined("IN_PORTAL")) { global $change_dir;
| else if(defined("IN_PORTAL")) { global $change_dir;
|
Zeile 3167 | Zeile 3177 |
---|
if(!is_array($forum_cache)) { cache_forums();
|
if(!is_array($forum_cache)) { cache_forums();
|
}
| }
|
if(!is_array($permissioncache)) {
| if(!is_array($permissioncache)) {
|
Zeile 3191 | Zeile 3201 |
---|
if($forum['password'] != "") { if($mybb->cookies['forumpass'][$forum['fid']] != md5($mybb->user['uid'].$forum['password']))
|
if($forum['password'] != "") { if($mybb->cookies['forumpass'][$forum['fid']] != md5($mybb->user['uid'].$forum['password']))
|
{
| {
|
$pwverified = 0; }
| $pwverified = 0; }
|
Zeile 3215 | Zeile 3225 |
---|
if($unviewableforums) { $unviewableforums .= ",";
|
if($unviewableforums) { $unviewableforums .= ",";
|
}
| }
|
$unviewableforums .= "'".$forum['fid']."'"; }
| $unviewableforums .= "'".$forum['fid']."'"; }
|
Zeile 3240 | Zeile 3250 |
---|
// -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 3262 |
---|
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 3288 |
---|
$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 3327 |
---|
/** * 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 3323 | Zeile 3338 |
---|
$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 3345 | Zeile 3360 |
---|
foreach($forum_cache as $key => $val) { $pforumcache[$val['fid']][$val['pid']] = $val;
|
foreach($forum_cache as $key => $val) { $pforumcache[$val['fid']][$val['pid']] = $val;
|
} }
| } }
|
if(is_array($pforumcache[$fid])) { foreach($pforumcache[$fid] as $key => $forumnav)
| if(is_array($pforumcache[$fid])) { foreach($pforumcache[$fid] as $key => $forumnav)
|
Zeile 3357 | Zeile 3372 |
---|
if(!empty($pforumcache[$forumnav['pid']])) { build_forum_breadcrumb($forumnav['pid']);
|
if(!empty($pforumcache[$forumnav['pid']])) { build_forum_breadcrumb($forumnav['pid']);
|
}
| }
|
$navsize = count($navbits); // Convert & to & $navbits[$navsize]['name'] = preg_replace("#&(?!\#[0-9]+;)#si", "&", $forumnav['name']);
| $navsize = count($navbits); // Convert & to & $navbits[$navsize]['name'] = preg_replace("#&(?!\#[0-9]+;)#si", "&", $forumnav['name']);
|
Zeile 3406 | Zeile 3421 |
---|
unset($GLOBALS['navbits']); $GLOBALS['navbits'] = $newnav;
|
unset($GLOBALS['navbits']); $GLOBALS['navbits'] = $newnav;
|
}
/**
| }
/**
|
* Builds a URL to an archive mode page * * @param string The type of page (thread|announcement|forum)
| * Builds a URL to an archive mode page * * @param string The type of page (thread|announcement|forum)
|
Zeile 3469 | Zeile 3484 |
---|
if($mybb->settings['gzipoutput'] != 0) { $gzipen = "Enabled";
|
if($mybb->settings['gzipoutput'] != 0) { $gzipen = "Enabled";
|
}
| }
|
else { $gzipen = "Disabled";
| else { $gzipen = "Disabled";
|
Zeile 3492 | Zeile 3507 |
---|
echo "<td bgcolor=\"#FEFEFE\" width=\"25%\"><font face=\"Tahoma\" size=\"2\">$totaltime seconds</font></td>\n"; echo "<td bgcolor=\"#EFEFEF\" width=\"25%\"><b><font face=\"Tahoma\" size=\"2\">No. DB Queries:</font></b></td>\n"; echo "<td bgcolor=\"#FEFEFE\" width=\"25%\"><font face=\"Tahoma\" size=\"2\">$db->query_count</font></td>\n";
|
echo "<td bgcolor=\"#FEFEFE\" width=\"25%\"><font face=\"Tahoma\" size=\"2\">$totaltime seconds</font></td>\n"; echo "<td bgcolor=\"#EFEFEF\" width=\"25%\"><b><font face=\"Tahoma\" size=\"2\">No. DB Queries:</font></b></td>\n"; echo "<td bgcolor=\"#FEFEFE\" width=\"25%\"><font face=\"Tahoma\" size=\"2\">$db->query_count</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 Processing Time:</font></b></td>\n"; echo "<td bgcolor=\"#FEFEFE\" width=\"25%\"><font face=\"Tahoma\" size=\"2\">$phptime seconds ($percentphp%)</font></td>\n"; echo "<td bgcolor=\"#EFEFEF\" width=\"25%\"><b><font face=\"Tahoma\" size=\"2\">DB Processing Time:</font></b></td>\n";
| echo "<td bgcolor=\"#EFEFEF\" width=\"25%\"><b><font face=\"Tahoma\" size=\"2\">PHP Processing Time:</font></b></td>\n"; echo "<td bgcolor=\"#FEFEFE\" width=\"25%\"><font face=\"Tahoma\" size=\"2\">$phptime seconds ($percentphp%)</font></td>\n"; echo "<td bgcolor=\"#EFEFEF\" width=\"25%\"><b><font face=\"Tahoma\" size=\"2\">DB Processing Time:</font></b></td>\n";
|
Zeile 3504 | Zeile 3519 |
---|
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 3569 |
---|
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 3592 |
---|
echo "</body>"; echo "</html>"; exit;
|
echo "</body>"; echo "</html>"; exit;
|
}
| }
|
/** * Outputs the correct page headers. */
| /** * Outputs the correct page headers. */
|
Zeile 3602 | Zeile 3617 |
---|
* @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 3906 |
---|
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 5435 | Zeile 5450 |
---|
// 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 5644 |
---|
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 5746 |
---|
*/ 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 6266 |
---|
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
|