Zeile 1644 | Zeile 1644 |
---|
$groupperms = $mybb->usergroup; } }
|
$groupperms = $mybb->usergroup; } }
|
| else { $groupperms = usergroup_permissions($gid); }
|
if(!is_array($forum_cache)) {
| if(!is_array($forum_cache)) {
|
Zeile 1694 | Zeile 1698 |
---|
{ global $groupscache, $forum_cache, $fpermcache, $mybb, $fpermfields;
|
{ global $groupscache, $forum_cache, $fpermcache, $mybb, $fpermfields;
|
$groups = explode(",", $gid);
| if(isset($gid)) { $groups = explode(",", $gid); } else { $groups = array(); }
|
$current_permissions = array(); $only_view_own_threads = 1;
| $current_permissions = array(); $only_view_own_threads = 1;
|
Zeile 2727 | Zeile 2738 |
---|
{ // sys_getloadavg() will return an array with [0] being load within the last minute. $serverload = sys_getloadavg();
|
{ // sys_getloadavg() will return an array with [0] being load within the last minute. $serverload = sys_getloadavg();
|
$serverload[0] = round($serverload[0], 4);
| if(!is_array($serverload)) { return $lang->unknown; }
$serverload[0] = round($serverload[0], 4);
|
} else if(@file_exists("/proc/loadavg") && $load = @file_get_contents("/proc/loadavg")) { $serverload = explode(" ", $load); $serverload[0] = round($serverload[0], 4);
|
} else if(@file_exists("/proc/loadavg") && $load = @file_get_contents("/proc/loadavg")) { $serverload = explode(" ", $load); $serverload[0] = round($serverload[0], 4);
|
}
| }
|
if(!is_numeric($serverload[0])) { if($mybb->safemode)
|
if(!is_numeric($serverload[0])) { if($mybb->safemode)
|
{ return $lang->unknown; }
| { return $lang->unknown; }
|
// Suhosin likes to throw a warning if exec is disabled then die - weird if($func_blacklist = @ini_get('suhosin.executor.func.blacklist'))
|
// Suhosin likes to throw a warning if exec is disabled then die - weird if($func_blacklist = @ini_get('suhosin.executor.func.blacklist'))
|
{ if(strpos(",".$func_blacklist.",", 'exec') !== false) {
| { if(strpos(",".$func_blacklist.",", 'exec') !== false) {
|
return $lang->unknown; } } // PHP disabled functions? if($func_blacklist = @ini_get('disable_functions'))
|
return $lang->unknown; } } // PHP disabled functions? if($func_blacklist = @ini_get('disable_functions'))
|
{
| {
|
if(strpos(",".$func_blacklist.",", 'exec') !== false) { return $lang->unknown; }
|
if(strpos(",".$func_blacklist.",", 'exec') !== false) { return $lang->unknown; }
|
}
| }
|
$load = @exec("uptime"); $load = explode("load average: ", $load); $serverload = explode(",", $load[1]);
| $load = @exec("uptime"); $load = explode("load average: ", $load); $serverload = explode(",", $load[1]);
|
Zeile 2775 | Zeile 2792 |
---|
$returnload = trim($serverload[0]);
return $returnload;
|
$returnload = trim($serverload[0]);
return $returnload;
|
}
| }
|
/** * Returns the amount of memory allocated to the script.
| /** * Returns the amount of memory allocated to the script.
|
Zeile 2823 | Zeile 2840 |
---|
'numdeletedposts' => '+0', 'numdeletedthreads' => '+0', 'inserted' => false // Reset after changes are inserted into cache
|
'numdeletedposts' => '+0', 'numdeletedthreads' => '+0', 'inserted' => false // Reset after changes are inserted into cache
|
); $stats = $stats_changes;
| ); $stats = $stats_changes;
|
}
if($force) // Force writing to cache?
|
}
if($force) // Force writing to cache?
|
{
| {
|
if(!empty($changes)) { // Calculate before writing to cache
| if(!empty($changes)) { // Calculate before writing to cache
|
Zeile 2871 | Zeile 2888 |
---|
{ $new_stats[$counter] = 0; }
|
{ $new_stats[$counter] = 0; }
|
} } else
| } } else
|
{ $new_stats[$counter] = $changes[$counter]; // Less than 0? That's bad
| { $new_stats[$counter] = $changes[$counter]; // Less than 0? That's bad
|
Zeile 2969 | Zeile 2986 |
---|
{ $update_query[$counter] = 0; }
|
{ $update_query[$counter] = 0; }
|
} }
| } }
|
// Only update if we're actually doing something if(count($update_query) > 0) {
| // Only update if we're actually doing something if(count($update_query) > 0) {
|
Zeile 2984 | Zeile 3001 |
---|
{ $threads_diff = $update_query['threads'] - $forum['threads']; if($threads_diff > -1)
|
{ $threads_diff = $update_query['threads'] - $forum['threads']; if($threads_diff > -1)
|
{
| {
|
$new_stats['numthreads'] = "+{$threads_diff}"; } else { $new_stats['numthreads'] = "{$threads_diff}";
|
$new_stats['numthreads'] = "+{$threads_diff}"; } else { $new_stats['numthreads'] = "{$threads_diff}";
|
}
| }
|
}
if(array_key_exists('unapprovedthreads', $update_query))
| }
if(array_key_exists('unapprovedthreads', $update_query))
|
Zeile 3020 | Zeile 3037 |
---|
}
if(array_key_exists('unapprovedposts', $update_query))
|
}
if(array_key_exists('unapprovedposts', $update_query))
|
{
| {
|
$unapprovedposts_diff = $update_query['unapprovedposts'] - $forum['unapprovedposts']; if($unapprovedposts_diff > -1) {
| $unapprovedposts_diff = $update_query['unapprovedposts'] - $forum['unapprovedposts']; if($unapprovedposts_diff > -1) {
|
Zeile 3114 | Zeile 3131 |
---|
* @param array $changes Array of items being updated (replies, unapprovedposts, deletedposts, attachmentcount) and their value (ex, 1, +1, -1) */ function update_thread_counters($tid, $changes=array())
|
* @param array $changes Array of items being updated (replies, unapprovedposts, deletedposts, attachmentcount) and their value (ex, 1, +1, -1) */ function update_thread_counters($tid, $changes=array())
|
{ global $db;
$update_query = array();
| { global $db;
$update_query = array();
|
$tid = (int)$tid;
$counters = array('replies', 'unapprovedposts', 'attachmentcount', 'deletedposts', 'attachmentcount');
| $tid = (int)$tid;
$counters = array('replies', 'unapprovedposts', 'attachmentcount', 'deletedposts', 'attachmentcount');
|
Zeile 3246 | Zeile 3263 |
---|
function update_user_counters($uid, $changes=array()) { global $db;
|
function update_user_counters($uid, $changes=array()) { global $db;
|
|
|
$update_query = array();
$counters = array('postnum', 'threadnum');
| $update_query = array();
$counters = array('postnum', 'threadnum');
|
Zeile 3289 | Zeile 3306 |
---|
}
$db->free_result($query);
|
}
$db->free_result($query);
|
|
|
// Only update if we're actually doing something if(count($update_query) > 0) { $db->update_query("users", $update_query, "uid='{$uid}'"); } }
|
// Only update if we're actually doing something if(count($update_query) > 0) { $db->update_query("users", $update_query, "uid='{$uid}'"); } }
|
|
|
/** * Deletes a thread from the database *
| /** * Deletes a thread from the database *
|
Zeile 3304 | Zeile 3321 |
---|
* @return bool */ function delete_thread($tid)
|
* @return bool */ 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 3439 | Zeile 3456 |
---|
* @return string The extension of the file. */ function get_extension($file)
|
* @return string The extension of the file. */ function get_extension($file)
|
{
| {
|
return my_strtolower(my_substr(strrchr($file, "."), 1)); }
| return my_strtolower(my_substr(strrchr($file, "."), 1)); }
|
Zeile 3567 | Zeile 3584 |
---|
$avatar = str_replace('{theme}', $theme['imgdir'], $mybb->settings['useravatar']); $dimensions = $mybb->settings['useravatardims'];
|
$avatar = str_replace('{theme}', $theme['imgdir'], $mybb->settings['useravatar']); $dimensions = $mybb->settings['useravatardims'];
|
}
| }
|
if(!$max_dimensions) { $max_dimensions = $mybb->settings['maxavatardims'];
| if(!$max_dimensions) { $max_dimensions = $mybb->settings['maxavatardims'];
|
Zeile 3584 | Zeile 3601 |
---|
if(empty($key2)) { $key2 = 'default';
|
if(empty($key2)) { $key2 = 'default';
|
}
| }
|
if(isset($avatars[$avatar][$key][$key2])) { return $avatars[$avatar][$key][$key2];
|
if(isset($avatars[$avatar][$key][$key2])) { return $avatars[$avatar][$key][$key2];
|
}
$avatar_width_height = '';
| }
$avatar_width_height = '';
|
if($dimensions) { $dimensions = preg_split('/[|x]/', $dimensions);
| if($dimensions) { $dimensions = preg_split('/[|x]/', $dimensions);
|
Zeile 3600 | Zeile 3617 |
---|
if($dimensions[0] && $dimensions[1]) { list($max_width, $max_height) = preg_split('/[|x]/', $max_dimensions);
|
if($dimensions[0] && $dimensions[1]) { list($max_width, $max_height) = preg_split('/[|x]/', $max_dimensions);
|
|
|
if(!empty($max_dimensions) && ($dimensions[0] > $max_width || $dimensions[1] > $max_height)) { require_once MYBB_ROOT."inc/functions_image.php";
| if(!empty($max_dimensions) && ($dimensions[0] > $max_width || $dimensions[1] > $max_height)) { require_once MYBB_ROOT."inc/functions_image.php";
|
Zeile 3624 | Zeile 3641 |
---|
/** * Build the javascript based MyCode inserter.
|
/** * Build the javascript based MyCode inserter.
|
*
| *
|
* @param string $bind The ID of the textarea to bind to. Defaults to "message". * @param bool $smilies Whether to include smilies. Defaults to true. *
| * @param string $bind The ID of the textarea to bind to. Defaults to "message". * @param bool $smilies Whether to include smilies. Defaults to true. *
|
Zeile 3633 | Zeile 3650 |
---|
function build_mycode_inserter($bind="message", $smilies = true) { global $db, $mybb, $theme, $templates, $lang, $plugins, $smiliecache, $cache;
|
function build_mycode_inserter($bind="message", $smilies = true) { global $db, $mybb, $theme, $templates, $lang, $plugins, $smiliecache, $cache;
|
| $codeinsert = '';
|
if($mybb->settings['bbcodeinserter'] != 0) {
| if($mybb->settings['bbcodeinserter'] != 0) {
|
Zeile 4589 | Zeile 4608 |
---|
else { $time = round($time, 3)." seconds";
|
else { $time = round($time, 3)." seconds";
|
}
| }
|
return $time; }
| return $time; }
|
Zeile 4956 | Zeile 4975 |
---|
break; default: $url = $mybb->settings['bburl']."/archive/index.php";
|
break; default: $url = $mybb->settings['bburl']."/archive/index.php";
|
}
| }
|
return $url; }
| return $url; }
|
Zeile 5325 | Zeile 5344 |
---|
else if($hours > 1) { $nicetime['hours'] = $hours.$lang_hours;
|
else if($hours > 1) { $nicetime['hours'] = $hours.$lang_hours;
|
} }
| } }
|
if(!isset($options['minutes']) || $options['minutes'] !== false) { if($minutes == 1)
|
if(!isset($options['minutes']) || $options['minutes'] !== false) { if($minutes == 1)
|
{
| {
|
$nicetime['minutes'] = "1".$lang_minute; } else if($minutes > 1) { $nicetime['minutes'] = $minutes.$lang_minutes;
|
$nicetime['minutes'] = "1".$lang_minute; } else if($minutes > 1) { $nicetime['minutes'] = $minutes.$lang_minutes;
|
} }
| } }
|
if(!isset($options['seconds']) || $options['seconds'] !== false) {
| if(!isset($options['seconds']) || $options['seconds'] !== false) {
|
Zeile 5360 | Zeile 5379 |
---|
/** * Select an alternating row colour based on the previous call to this function
|
/** * Select an alternating row colour based on the previous call to this function
|
*
| *
|
* @param int $reset 1 to reset the row to trow1. * @return string trow1 or trow2 depending on the previous call */
| * @param int $reset 1 to reset the row to trow1. * @return string trow1 or trow2 depending on the previous call */
|
Zeile 5371 | Zeile 5390 |
---|
if($alttrow == "trow1" && !$reset) { $trow = "trow2";
|
if($alttrow == "trow1" && !$reset) { $trow = "trow2";
|
}
| }
|
else { $trow = "trow1";
| else { $trow = "trow1";
|
Zeile 5416 | Zeile 5435 |
---|
$groups = array_unique($groups);
$groupslist = implode(',', $groups);
|
$groups = array_unique($groups);
$groupslist = implode(',', $groups);
|
|
|
$db->update_query("users", array('additionalgroups' => $groupslist), "uid='".(int)$uid."'"); return true; }
| $db->update_query("users", array('additionalgroups' => $groupslist), "uid='".(int)$uid."'"); return true; }
|
Zeile 5449 | Zeile 5468 |
---|
); $groups = array_diff($groups, array($leavegroup)); $groups = array_unique($groups);
|
); $groups = array_diff($groups, array($leavegroup)); $groups = array_unique($groups);
|
|
|
$groupslist = implode(',', $groups);
$dispupdate = "";
| $groupslist = implode(',', $groups);
$dispupdate = "";
|
Zeile 5482 | Zeile 5501 |
---|
if(defined("MYBB_LOCATION")) { return MYBB_LOCATION;
|
if(defined("MYBB_LOCATION")) { return MYBB_LOCATION;
|
}
| }
|
if(!empty($_SERVER['SCRIPT_NAME'])) { $location = htmlspecialchars_uni($_SERVER['SCRIPT_NAME']);
| if(!empty($_SERVER['SCRIPT_NAME'])) { $location = htmlspecialchars_uni($_SERVER['SCRIPT_NAME']);
|
Zeile 5506 | Zeile 5525 |
---|
}
if($quick)
|
}
if($quick)
|
{ return $location; }
| { return $location; }
|
if(!is_array($ignore)) {
| if(!is_array($ignore)) {
|
Zeile 5736 | Zeile 5755 |
---|
} else {
|
} else {
|
$parts = explode('.', $number);
| if(isset($number)) { $parts = explode('.', $number); } else { $parts = array(); }
|
if(isset($parts[1])) {
| if(isset($parts[1])) {
|
Zeile 6061 | Zeile 6087 |
---|
* @param int $tid The thread id for which to update the last post id. */ function update_last_post($tid)
|
* @param int $tid The thread id for which to update the last post id. */ function update_last_post($tid)
|
{ global $db;
| { global $db;
|
$query = $db->query(" SELECT u.uid, u.username, p.username AS postusername, p.dateline FROM ".TABLE_PREFIX."posts p
| $query = $db->query(" SELECT u.uid, u.username, p.username AS postusername, p.dateline FROM ".TABLE_PREFIX."posts p
|
Zeile 6075 | Zeile 6101 |
---|
$lastpost = $db->fetch_array($query);
if(!$lastpost)
|
$lastpost = $db->fetch_array($query);
if(!$lastpost)
|
{
| {
|
return false; }
| return false; }
|
Zeile 6109 | Zeile 6135 |
---|
'lastposteruid' => (int)$lastpost['uid'] ); $db->update_query("threads", $update_array, "tid='{$tid}'");
|
'lastposteruid' => (int)$lastpost['uid'] ); $db->update_query("threads", $update_array, "tid='{$tid}'");
|
}
| }
|
/** * Checks for the length of a string, mb strings accounted for
| /** * Checks for the length of a string, mb strings accounted for
|
Zeile 6123 | Zeile 6149 |
---|
$string = preg_replace("#&\#([0-9]+);#", "-", $string);
|
$string = preg_replace("#&\#([0-9]+);#", "-", $string);
|
if(strtolower($lang->settings['charset']) == "utf-8")
| if(isset($lang->settings['charset']) && 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);
| { // 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);
|
Zeile 6133 | Zeile 6159 |
---|
$string = str_replace(chr(0xCA), "", $string); } $string = trim($string);
|
$string = str_replace(chr(0xCA), "", $string); } $string = trim($string);
|
|
|
if(function_exists("mb_strlen")) { $string_length = mb_strlen($string);
| if(function_exists("mb_strlen")) { $string_length = mb_strlen($string);
|
Zeile 6156 | Zeile 6182 |
---|
* @return string The cut part of the string. */ function my_substr($string, $start, $length=null, $handle_entities = false)
|
* @return string The cut part of the string. */ function my_substr($string, $start, $length=null, $handle_entities = false)
|
{
| {
|
if($handle_entities) { $string = unhtmlentities($string);
| if($handle_entities) { $string = unhtmlentities($string);
|
Zeile 6330 | Zeile 6356 |
---|
return chr(0xF0 | $c >> 18) . chr(0x80 | $c >> 12 & 0x3F) . chr(0x80 | $c >> 6 & 0x3F) . chr(0x80 | $c & 0x3F);
|
return chr(0xF0 | $c >> 18) . chr(0x80 | $c >> 12 & 0x3F) . chr(0x80 | $c >> 6 & 0x3F) . chr(0x80 | $c & 0x3F);
|
} else { return false; } }
/** * Returns any ascii to it's character (utf-8 safe). * * @param array $matches Matches.
| } else { return false; } }
/** * Returns any ascii to it's character (utf-8 safe). * * @param array $matches Matches.
|
* @return string|bool The characterized ascii. False on failure */ function unichr_callback1($matches)
| * @return string|bool The characterized ascii. False on failure */ function unichr_callback1($matches)
|
Zeile 6616 | Zeile 6642 |
---|
{ global $mybb, $db; static $user_cache;
|
{ global $mybb, $db; static $user_cache;
|
|
|
$uid = (int)$uid;
if(!empty($mybb->user) && $uid == $mybb->user['uid']) { return $mybb->user;
|
$uid = (int)$uid;
if(!empty($mybb->user) && $uid == $mybb->user['uid']) { return $mybb->user;
|
}
| }
|
elseif(isset($user_cache[$uid])) { return $user_cache[$uid]; } elseif($uid > 0)
|
elseif(isset($user_cache[$uid])) { return $user_cache[$uid]; } elseif($uid > 0)
|
{
| {
|
$query = $db->simple_select("users", "*", "uid = '{$uid}'"); $user_cache[$uid] = $db->fetch_array($query);
|
$query = $db->simple_select("users", "*", "uid = '{$uid}'"); $user_cache[$uid] = $db->fetch_array($query);
|
|
|
return $user_cache[$uid]; } return array();
| return $user_cache[$uid]; } return array();
|
Zeile 6639 | Zeile 6665 |
---|
/** * Get the user data of an user username.
|
/** * Get the user data of an user username.
|
*
| *
|
* @param string $username The user username of the user. * @param array $options * @return array The users data
| * @param string $username The user username of the user. * @param array $options * @return array The users data
|
Zeile 6647 | Zeile 6673 |
---|
function get_user_by_username($username, $options=array()) { global $mybb, $db;
|
function get_user_by_username($username, $options=array()) { global $mybb, $db;
|
|
|
$username = $db->escape_string(my_strtolower($username));
if(!isset($options['username_method']))
|
$username = $db->escape_string(my_strtolower($username));
if(!isset($options['username_method']))
|
{
| {
|
$options['username_method'] = 0; }
| $options['username_method'] = 0; }
|
Zeile 6661 | Zeile 6687 |
---|
case 'mysqli': $field = 'username'; $efield = 'email';
|
case 'mysqli': $field = 'username'; $efield = 'email';
|
break; default:
| break; default:
|
$field = 'LOWER(username)'; $efield = 'LOWER(email)'; break;
| $field = 'LOWER(username)'; $efield = 'LOWER(email)'; break;
|
Zeile 6685 | Zeile 6711 |
---|
if(isset($options['fields'])) { $fields = array_merge((array)$options['fields'], $fields);
|
if(isset($options['fields'])) { $fields = array_merge((array)$options['fields'], $fields);
|
}
| }
|
$query = $db->simple_select('users', implode(',', array_unique($fields)), $sqlwhere, array('limit' => 1));
| $query = $db->simple_select('users', implode(',', array_unique($fields)), $sqlwhere, array('limit' => 1));
|
Zeile 6708 | Zeile 6734 |
---|
{ global $cache; static $forum_cache;
|
{ global $cache; static $forum_cache;
|
|
|
if(!isset($forum_cache) || !is_array($forum_cache)) { $forum_cache = $cache->read("forums");
| if(!isset($forum_cache) || !is_array($forum_cache)) { $forum_cache = $cache->read("forums");
|
Zeile 6764 | Zeile 6790 |
---|
{ $thread_cache[$tid] = $thread; return $thread;
|
{ $thread_cache[$tid] = $thread; return $thread;
|
}
| }
|
else { $thread_cache[$tid] = false;
| else { $thread_cache[$tid] = false;
|
Zeile 6787 | Zeile 6813 |
---|
$pid = (int)$pid;
if(isset($post_cache[$pid]))
|
$pid = (int)$pid;
if(isset($post_cache[$pid]))
|
{
| {
|
return $post_cache[$pid]; } else
| return $post_cache[$pid]; } else
|
Zeile 6799 | Zeile 6825 |
---|
{ $post_cache[$pid] = $post; return $post;
|
{ $post_cache[$pid] = $post; return $post;
|
} else
| } else
|
{ $post_cache[$pid] = false; return false;
| { $post_cache[$pid] = false; return false;
|
Zeile 6984 | Zeile 7010 |
---|
if($db->fetch_field($query, "emails") > 0) { return true;
|
if($db->fetch_field($query, "emails") > 0) { return true;
|
}
| }
|
return false; }
| return false; }
|
Zeile 7257 | Zeile 7283 |
---|
}
// Still here - good email
|
}
// Still here - good email
|
return false; }
/**
| return false; }
/**
|
* Checks if a specific IP address has been banned. * * @param string $ip_address The IP address.
| * Checks if a specific IP address has been banned. * * @param string $ip_address The IP address.
|
Zeile 7537 | Zeile 7563 |
---|
$curlopt[10203] = array( $url_components['host'].':'.$url_components['port'].':'.$destination_address );
|
$curlopt[10203] = array( $url_components['host'].':'.$url_components['port'].':'.$destination_address );
|
| }
if(defined('CURLOPT_DISALLOW_USERNAME_IN_URL')) { $curlopt[CURLOPT_DISALLOW_USERNAME_IN_URL] = true;
|
}
if(!empty($post_body))
| }
if(!empty($post_body))
|