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 1329 | Zeile 1329 |
---|
/** * Check the password given on a certain forum for validity *
|
/** * Check the password given on a certain forum for validity *
|
* @param int The forum ID * @param boolean The Parent ID
| * @param int $fid The forum ID * @param int $pid The Parent ID * @param bool $return * @return bool
|
*/
|
*/
|
function check_forum_password($fid, $pid=0)
| function check_forum_password($fid, $pid=0, $return=false)
|
{ global $mybb, $header, $footer, $headerinclude, $theme, $templates, $lang, $forum_cache;
|
{ global $mybb, $header, $footer, $headerinclude, $theme, $templates, $lang, $forum_cache;
|
|
|
$showform = true;
if(!is_array($forum_cache)) { $forum_cache = cache_forums(); if(!$forum_cache)
|
$showform = true;
if(!is_array($forum_cache)) { $forum_cache = cache_forums(); if(!$forum_cache)
|
{
| {
|
return false; } }
| return false; } }
|
Zeile 1360 | Zeile 1362 |
---|
}
if($forum_cache[$parent_id]['password'] != "")
|
}
if($forum_cache[$parent_id]['password'] != "")
|
{
| {
|
check_forum_password($parent_id, $fid); } }
| check_forum_password($parent_id, $fid); } }
|
Zeile 1397 | Zeile 1399 |
---|
else { $showform = false;
|
else { $showform = false;
|
| }
if($return) { return $showform;
|
}
if($showform)
| }
if($showform)
|
Zeile 1466 | Zeile 1473 |
---|
$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 1478 | Zeile 1485 |
---|
if(is_array($forum['users'][$uid])) { $perm = $forum['users'][$uid];
|
if(is_array($forum['users'][$uid])) { $perm = $forum['users'][$uid];
|
foreach($perm as $action => $value) { if(strpos($action, "can") === false) {
| foreach($perm as $action => $value) { if(strpos($action, "can") === false) {
|
continue; }
| continue; }
|
Zeile 1549 | Zeile 1556 |
---|
$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 1577 |
---|
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;
| { return true;
|
} elseif(isset($modusers['usergroups'][$user_perms['gid']])) { // Moderating usergroup return true;
|
} elseif(isset($modusers['usergroups'][$user_perms['gid']])) { // Moderating usergroup return true;
|
} } }
| } } }
|
return false; } else
| return false; } else
|
Zeile 1763 | Zeile 1779 |
---|
* @param string The value to set the cookie to. */ function my_set_array_cookie($name, $id, $value, $expires="")
|
* @param string The value to set the cookie to. */ function my_set_array_cookie($name, $id, $value, $expires="")
|
{
| {
|
global $mybb;
$cookie = $mybb->cookies['mybb'];
| global $mybb;
$cookie = $mybb->cookies['mybb'];
|
Zeile 1785 | Zeile 1801 |
---|
*/ 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 1955 | Zeile 1977 |
---|
/** * Updates the forum counters with a specific value (or addition/subtraction of the previous value)
|
/** * Updates the forum counters with a specific value (or addition/subtraction of the previous value)
|
* * @param int The forum ID
| * * @param int The forum ID
|
* @param array Array of items being updated (threads, posts, unapprovedthreads, unapprovedposts) and their value (ex, 1, +1, -1) */ function update_forum_counters($fid, $changes=array())
| * @param array Array of items being updated (threads, posts, unapprovedthreads, unapprovedposts) and their value (ex, 1, +1, -1) */ function update_forum_counters($fid, $changes=array())
|
Zeile 2149 | Zeile 2171 |
---|
/** * Update the first post and lastpost data for a specific thread
|
/** * Update the first post and lastpost data for a specific thread
|
*
| *
|
* @param int The thread ID */ function update_thread_data($tid)
| * @param int The thread ID */ function update_thread_data($tid)
|
Zeile 2160 | Zeile 2182 |
---|
// If this is a moved thread marker, don't update it - we need it to stay as it is if(strpos($thread['closed'], 'moved|') !== false)
|
// If this is a moved thread marker, don't update it - we need it to stay as it is if(strpos($thread['closed'], 'moved|') !== false)
|
{
| {
|
return false; }
| return false; }
|
Zeile 2171 | Zeile 2193 |
---|
WHERE p.tid='$tid' AND p.visible='1' ORDER BY p.dateline DESC LIMIT 1"
|
WHERE p.tid='$tid' AND p.visible='1' ORDER BY p.dateline DESC LIMIT 1"
|
);
| );
|
$lastpost = $db->fetch_array($query);
$db->free_result($query);
| $lastpost = $db->fetch_array($query);
$db->free_result($query);
|
Zeile 2194 | Zeile 2216 |
---|
}
if(!$lastpost['username'])
|
}
if(!$lastpost['username'])
|
{
| {
|
$lastpost['username'] = $lastpost['postusername']; }
| $lastpost['username'] = $lastpost['postusername']; }
|
Zeile 2217 | Zeile 2239 |
---|
'lastposteruid' => intval($lastpost['uid']), ); $db->update_query("threads", $update_array, "tid='{$tid}'");
|
'lastposteruid' => intval($lastpost['uid']), ); $db->update_query("threads", $update_array, "tid='{$tid}'");
|
|
|
unset($firstpost, $lastpost, $update_array);
|
unset($firstpost, $lastpost, $update_array);
|
}
| }
|
function update_forum_count($fid)
|
function update_forum_count($fid)
|
{
| {
|
die("Deprecated function call: update_forum_count"); } function update_thread_count($tid) { die("Deprecated function call: update_thread_count");
|
die("Deprecated function call: update_forum_count"); } function update_thread_count($tid) { die("Deprecated function call: update_thread_count");
|
}
| }
|
function update_thread_attachment_count($tid)
|
function update_thread_attachment_count($tid)
|
{
| {
|
die("Deprecated function call: update_thread_attachment_count"); }
|
die("Deprecated function call: update_thread_attachment_count"); }
|
|
|
/** * Deletes a thread from the database * * @param int The thread ID */ function delete_thread($tid)
|
/** * Deletes a thread from the database * * @param int The thread ID */ function delete_thread($tid)
|
{ global $moderation;
if(!is_object($moderation)) { require_once MYBB_ROOT."inc/class_moderation.php"; $moderation = new Moderation; }
| { global $moderation;
if(!is_object($moderation)) { require_once MYBB_ROOT."inc/class_moderation.php"; $moderation = new Moderation; }
|
return $moderation->delete_thread($tid); }
| return $moderation->delete_thread($tid); }
|
Zeile 2258 | Zeile 2280 |
---|
* @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 2293 | Zeile 2315 |
---|
if($permissions) { $permissions = $mybb->usergroup;
|
if($permissions) { $permissions = $mybb->usergroup;
|
}
| }
|
if(!is_array($jumpfcache)) { if(!is_array($forum_cache))
| if(!is_array($jumpfcache)) { if(!is_array($forum_cache))
|
Zeile 2342 | Zeile 2364 |
---|
{ $newdepth = $depth."--"; $forumjumpbits .= build_forum_jump($forum['fid'], $selitem, 0, $newdepth, $showextras, $showall);
|
{ $newdepth = $depth."--"; $forumjumpbits .= build_forum_jump($forum['fid'], $selitem, 0, $newdepth, $showextras, $showall);
|
}
| }
|
} } }
| } } }
|
Zeile 2632 | Zeile 2654 |
---|
}
return $clickablesmilies;
|
}
return $clickablesmilies;
|
}
| }
|
/** * Builds thread prefixes and returns a selected prefix (or all)
| /** * Builds thread prefixes and returns a selected prefix (or all)
|
Zeile 2761 | Zeile 2783 |
---|
}
$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 2782 | Zeile 2805 |
---|
$default_selected = ""; if((intval($selected_pid) == 0) && $selected_pid != 'any')
|
$default_selected = ""; if((intval($selected_pid) == 0) && $selected_pid != 'any')
|
{
| {
|
$default_selected = " selected=\"selected\""; }
| $default_selected = " selected=\"selected\""; }
|
Zeile 2820 | Zeile 2843 |
---|
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, "gzip"))
|
if(my_strpos(" ".$httpaccept_encoding, "x-gzip")) { $encoding = "x-gzip"; }
if(my_strpos(" ".$httpaccept_encoding, "gzip"))
|
{
| {
|
$encoding = "gzip"; }
|
$encoding = "gzip"; }
|
|
|
if(isset($encoding)) { header("Content-Encoding: $encoding");
| if(isset($encoding)) { header("Content-Encoding: $encoding");
|
Zeile 2839 | Zeile 2862 |
---|
if(function_exists("gzencode")) { $contents = gzencode($contents, $level);
|
if(function_exists("gzencode")) { $contents = gzencode($contents, $level);
|
}
| }
|
else { $size = strlen($contents);
| else { $size = strlen($contents);
|
Zeile 2851 | Zeile 2874 |
---|
$contents = $gzdata; } }
|
$contents = $gzdata; } }
|
}
| }
|
return $contents; }
| return $contents; }
|
Zeile 2863 | Zeile 2886 |
---|
* @param string The message to enter for the action the moderator performed. */ function log_moderator_action($data, $action="")
|
* @param string The message to enter for the action the moderator performed. */ function log_moderator_action($data, $action="")
|
{
| {
|
global $mybb, $db, $session;
// If the fid or tid is not set, set it at 0 so MySQL doesn't choke on it. if($data['fid'] == '')
|
global $mybb, $db, $session;
// If the fid or tid is not set, set it at 0 so MySQL doesn't choke on it. if($data['fid'] == '')
|
{
| {
|
$fid = 0;
|
$fid = 0;
|
}
| }
|
else { $fid = $data['fid']; unset($data['fid']);
|
else { $fid = $data['fid']; unset($data['fid']);
|
}
| }
|
if($data['tid'] == '') {
| if($data['tid'] == '') {
|
Zeile 2923 | Zeile 2946 |
---|
if($uid != 0) { $display_reputation = "<a href=\"reputation.php?uid={$uid}\">";
|
if($uid != 0) { $display_reputation = "<a href=\"reputation.php?uid={$uid}\">";
|
}
| }
|
$display_reputation .= "<strong class=\"";
if($reputation < 0)
| $display_reputation .= "<strong class=\"";
if($reputation < 0)
|
Zeile 2948 | Zeile 2971 |
---|
}
return $display_reputation;
|
}
return $display_reputation;
|
}
| }
|
/** * 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) *
|
Zeile 2961 | Zeile 2984 |
---|
if($level >= 80) { return "<span class=\"high_warning\">{$level}%</span>";
|
if($level >= 80) { return "<span class=\"high_warning\">{$level}%</span>";
|
}
| }
|
else if($level >= 50)
|
else if($level >= 50)
|
{
| {
|
return "<span class=\"moderate_warning\">{$level}%</span>"; } else if($level >= 25)
|
return "<span class=\"moderate_warning\">{$level}%</span>"; } else if($level >= 25)
|
{
| {
|
return "<span class=\"low_warning\">{$level}%</span>"; } else { return $level."%";
|
return "<span class=\"low_warning\">{$level}%</span>"; } else { return $level."%";
|
}
| }
|
}
/**
| }
/**
|
Zeile 2987 | Zeile 3010 |
---|
$ip = 0;
|
$ip = 0;
|
if(!preg_match("#^(10|172\.16|192\.168)\.#", $_SERVER['REMOTE_ADDR']))
| if(!preg_match("#^(10|172\.(1[6-9]|2[0-9]|3[0-1])|192\.168)\.#", $_SERVER['REMOTE_ADDR']))
|
{ $ip = $_SERVER['REMOTE_ADDR']; }
| { $ip = $_SERVER['REMOTE_ADDR']; }
|
Zeile 3007 | Zeile 3030 |
---|
{ 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;
|
Zeile 3022 | Zeile 3045 |
---|
{ $ip = $_SERVER['HTTP_CLIENT_IP']; }
|
{ $ip = $_SERVER['HTTP_CLIENT_IP']; }
|
}
| }
|
if($plugins) { $ip_array = array("ip" => &$ip); // Used for backwards compatibility on this hook with the updated run_hooks() function. $plugins->run_hooks("get_ip", $ip_array); }
|
if($plugins) { $ip_array = array("ip" => &$ip); // Used for backwards compatibility on this hook with the updated run_hooks() function. $plugins->run_hooks("get_ip", $ip_array); }
|
|
|
return $ip; }
/** * Fetch the friendly size (GB, MB, KB, B) for a specified file size.
|
return $ip; }
/** * Fetch the friendly size (GB, MB, KB, B) for a specified file size.
|
*
| *
|
* @param int The size in bytes * @return string The friendly file size */
| * @param int The size in bytes * @return string The friendly file size */
|
Zeile 3046 | Zeile 3069 |
---|
if(!is_numeric($size)) { return $lang->na;
|
if(!is_numeric($size)) { return $lang->na;
|
}
| }
|
// Yottabyte (1024 Zettabytes) if($size >= 1208925819614629174706176) {
| // Yottabyte (1024 Zettabytes) if($size >= 1208925819614629174706176) {
|
Zeile 3095 | Zeile 3118 |
---|
else { $size = my_number_format($size)." ".$lang->size_bytes;
|
else { $size = my_number_format($size)." ".$lang->size_bytes;
|
}
| }
|
return $size; }
| return $size; }
|
Zeile 3118 | Zeile 3141 |
---|
$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 3136 | Zeile 3159 |
---|
{ $icon = str_replace("{theme}", $theme['imgdir'], $attachtypes[$ext]['icon']); }
|
{ $icon = str_replace("{theme}", $theme['imgdir'], $attachtypes[$ext]['icon']); }
|
| $icon = htmlspecialchars_uni($icon);
|
return "<img src=\"{$icon}\" border=\"0\" alt=\".{$ext}\" />"; } else
|
return "<img src=\"{$icon}\" border=\"0\" alt=\".{$ext}\" />"; } else
|
{
| {
|
if(defined("IN_ADMINCP")) { $theme['imgdir'] = "../images";
| if(defined("IN_ADMINCP")) { $theme['imgdir'] = "../images";
|
Zeile 3147 | Zeile 3171 |
---|
else if(defined("IN_PORTAL")) { global $change_dir;
|
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 3219 | Zeile 3243 |
---|
$unviewableforums .= "'".$forum['fid']."'"; }
|
$unviewableforums .= "'".$forum['fid']."'"; }
|
}
| }
|
if(isset($unviewableforums)) {
| if(isset($unviewableforums)) {
|
Zeile 3278 | Zeile 3302 |
---|
$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 4664 | Zeile 4693 |
---|
* @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 5078 |
---|
* @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 5099 |
---|
{ $inactive[] = $fid1; }
|
{ $inactive[] = $fid1; }
|
} } }
| } } }
|
$inactiveforums = implode(",", $inactive);
return $inactiveforums;
| $inactiveforums = implode(",", $inactive);
return $inactiveforums;
|
Zeile 5120 | Zeile 5149 |
---|
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 5174 |
---|
// 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 5464 |
---|
// 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 5658 |
---|
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 5760 |
---|
*/ 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 6280 |
---|
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 6398 |
---|
}
/**
|
}
/**
|
* 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 6408 |
---|
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 6453 |
---|
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 6472 |
---|
// 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 6487 |
---|
$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) {
|