Zeile 173 | Zeile 173 |
---|
if(isset($config)) {
|
if(isset($config)) {
|
| // Load DB interface require_once MYBB_ROOT."inc/db_base.php";
|
require_once MYBB_ROOT."inc/db_".$config['database']['type'].".php"; switch($config['database']['type']) {
| require_once MYBB_ROOT."inc/db_".$config['database']['type'].".php"; switch($config['database']['type']) {
|
Zeile 397 | Zeile 400 |
---|
if($format == 'relative') { // Relative formats both date and time
|
if($format == 'relative') { // Relative formats both date and time
|
if($ty != 2 && (TIME_NOW - $stamp) < 3600)
| if($ty != 2 && abs(TIME_NOW - $stamp) < 3600)
|
{ $diff = TIME_NOW - $stamp; $relative = array('prefix' => '', 'minute' => 0, 'plural' => $lang->rel_minutes_plural, 'suffix' => $lang->rel_ago);
| { $diff = TIME_NOW - $stamp; $relative = array('prefix' => '', 'minute' => 0, 'plural' => $lang->rel_minutes_plural, 'suffix' => $lang->rel_ago);
|
Zeile 425 | Zeile 428 |
---|
$date = $lang->sprintf($lang->rel_time, $relative['prefix'], $relative['minute'], $relative['plural'], $relative['suffix']); }
|
$date = $lang->sprintf($lang->rel_time, $relative['prefix'], $relative['minute'], $relative['plural'], $relative['suffix']); }
|
elseif($ty != 2 && (TIME_NOW - $stamp) >= 3600 && (TIME_NOW - $stamp) < 43200)
| elseif($ty != 2 && abs(TIME_NOW - $stamp) < 43200)
|
{ $diff = TIME_NOW - $stamp; $relative = array('prefix' => '', 'hour' => 0, 'plural' => $lang->rel_hours_plural, 'suffix' => $lang->rel_ago);
| { $diff = TIME_NOW - $stamp; $relative = array('prefix' => '', 'hour' => 0, 'plural' => $lang->rel_hours_plural, 'suffix' => $lang->rel_ago);
|
Zeile 756 | Zeile 759 |
---|
}
// AJAX error message?
|
}
// AJAX error message?
|
if($mybb->get_input('ajax', 1))
| if($mybb->get_input('ajax', MyBB::INPUT_INT))
|
{ // Send our headers. @header("Content-type: application/json; charset={$lang->settings['charset']}");
| { // Send our headers. @header("Content-type: application/json; charset={$lang->settings['charset']}");
|
Zeile 802 | Zeile 805 |
---|
}
// AJAX error message?
|
}
// AJAX error message?
|
if($mybb->get_input('ajax', 1))
| if($mybb->get_input('ajax', MyBB::INPUT_INT))
|
{ // Send our headers. @header("Content-type: application/json; charset={$lang->settings['charset']}");
| { // Send our headers. @header("Content-type: application/json; charset={$lang->settings['charset']}");
|
Zeile 848 | Zeile 851 |
---|
$db->update_query("sessions", $noperm_array, "sid='{$session->sid}'");
|
$db->update_query("sessions", $noperm_array, "sid='{$session->sid}'");
|
if($mybb->get_input('ajax', 1))
| if($mybb->get_input('ajax', MyBB::INPUT_INT))
|
{ // Send our headers. header("Content-type: application/json; charset={$lang->settings['charset']}");
| { // Send our headers. header("Content-type: application/json; charset={$lang->settings['charset']}");
|
Zeile 909 | Zeile 912 |
---|
$plugins->run_hooks("redirect", $redirect_args);
|
$plugins->run_hooks("redirect", $redirect_args);
|
if($mybb->get_input('ajax', 1))
| if($mybb->get_input('ajax', MyBB::INPUT_INT))
|
{ // Send our headers. //@header("Content-type: text/html; charset={$lang->settings['charset']}");
| { // Send our headers. //@header("Content-type: text/html; charset={$lang->settings['charset']}");
|
Zeile 1198 | Zeile 1201 |
---|
}
/**
|
}
/**
|
* Fetch the usergroup permissions for a specic group or series of groups combined
| * Fetch the usergroup permissions for a specific group or series of groups combined
|
* * @param mixed A list of groups (Can be a single integer, or a list of groups separated by a comma) * @return array Array of permissions generated for the groups
| * * @param mixed A list of groups (Can be a single integer, or a list of groups separated by a comma) * @return array Array of permissions generated for the groups
|
Zeile 1213 | Zeile 1216 |
---|
}
$groups = explode(",", $gid);
|
}
$groups = explode(",", $gid);
|
| |
if(count($groups) == 1)
|
if(count($groups) == 1)
|
{
| {
|
return $groupscache[$gid]; }
|
return $groupscache[$gid]; }
|
| $usergroup = array();
|
foreach($groups as $gid) { if(trim($gid) == "" || !$groupscache[$gid]) { continue;
|
foreach($groups as $gid) { if(trim($gid) == "" || !$groupscache[$gid]) { continue;
|
}
| }
|
foreach($groupscache[$gid] as $perm => $access) { if(!in_array($perm, $grouppermignore))
| foreach($groupscache[$gid] as $perm => $access) { if(!in_array($perm, $grouppermignore))
|
Zeile 1234 | Zeile 1238 |
---|
if(isset($usergroup[$perm])) { $permbit = $usergroup[$perm];
|
if(isset($usergroup[$perm])) { $permbit = $usergroup[$perm];
|
}
| }
|
else { $permbit = "";
|
else { $permbit = "";
|
}
| }
|
// 0 represents unlimited for numerical group permissions (i.e. private message limit) so take that into account. if(in_array($perm, $groupzerogreater) && ($access == 0 || $permbit === 0))
|
// 0 represents unlimited for numerical group permissions (i.e. private message limit) so take that into account. if(in_array($perm, $groupzerogreater) && ($access == 0 || $permbit === 0))
|
{
| {
|
$usergroup[$perm] = 0; continue; }
| $usergroup[$perm] = 0; continue; }
|
Zeile 1251 | Zeile 1255 |
---|
{ $usergroup[$perm] = $access; }
|
{ $usergroup[$perm] = $access; }
|
} }
| } }
|
}
|
}
|
|
|
return $usergroup; }
| return $usergroup; }
|
Zeile 1265 | Zeile 1269 |
---|
* @return array Array of display properties for the group */ function usergroup_displaygroup($gid)
|
* @return array Array of display properties for the group */ function usergroup_displaygroup($gid)
|
{
| {
|
global $cache, $groupscache, $displaygroupfields;
if(!is_array($groupscache))
| global $cache, $groupscache, $displaygroupfields;
if(!is_array($groupscache))
|
Zeile 1304 | Zeile 1308 |
---|
if(!$gid || $gid == 0) // If no group, we need to fetch it { if($uid != 0 && $uid != $mybb->user['uid'])
|
if(!$gid || $gid == 0) // If no group, we need to fetch it { if($uid != 0 && $uid != $mybb->user['uid'])
|
{
| {
|
$user = get_user($uid);
|
$user = get_user($uid);
|
|
|
$gid = $user['usergroup'].",".$user['additionalgroups']; $groupperms = usergroup_permissions($gid); } else { $gid = $mybb->user['usergroup'];
|
$gid = $user['usergroup'].",".$user['additionalgroups']; $groupperms = usergroup_permissions($gid); } else { $gid = $mybb->user['usergroup'];
|
|
|
if(isset($mybb->user['additionalgroups'])) { $gid .= ",".$mybb->user['additionalgroups'];
|
if(isset($mybb->user['additionalgroups'])) { $gid .= ",".$mybb->user['additionalgroups'];
|
}
| }
|
$groupperms = $mybb->usergroup; } }
| $groupperms = $mybb->usergroup; } }
|
Zeile 1351 | Zeile 1355 |
---|
if(empty($cached_forum_permissions[$gid])) { foreach($forum_cache as $forum)
|
if(empty($cached_forum_permissions[$gid])) { foreach($forum_cache as $forum)
|
{
| {
|
$cached_forum_permissions[$gid][$forum['fid']] = fetch_forum_permissions($forum['fid'], $gid, $groupperms); } }
| $cached_forum_permissions[$gid][$forum['fid']] = fetch_forum_permissions($forum['fid'], $gid, $groupperms); } }
|
Zeile 1381 | Zeile 1385 |
---|
$current_permissions = array(); $only_view_own_threads = 1;
|
$current_permissions = array(); $only_view_own_threads = 1;
|
| $only_reply_own_threads = 1;
|
foreach($groups as $gid) { if(!empty($groupscache[$gid])) {
|
foreach($groups as $gid) { if(!empty($groupscache[$gid])) {
|
| $level_permissions = $fpermcache[$fid][$gid];
|
// If our permissions arn't inherited we need to figure them out if(empty($fpermcache[$fid][$gid])) {
| // If our permissions arn't inherited we need to figure them out if(empty($fpermcache[$fid][$gid])) {
|
Zeile 1402 | Zeile 1409 |
---|
} } }
|
} } }
|
} else { $level_permissions = $fpermcache[$fid][$gid];
| |
}
// If we STILL don't have forum permissions we use the usergroup itself
| }
// If we STILL don't have forum permissions we use the usergroup itself
|
Zeile 1425 | Zeile 1428 |
---|
if($level_permissions["canview"] && empty($level_permissions["canonlyviewownthreads"])) { $only_view_own_threads = 0;
|
if($level_permissions["canview"] && empty($level_permissions["canonlyviewownthreads"])) { $only_view_own_threads = 0;
|
| }
if($level_permissions["canpostreplys"] && empty($level_permissions["canonlyreplyownthreads"])) { $only_reply_own_threads = 0;
|
} }
|
} }
|
}
| }
|
// Figure out if we can view more than our own threads if($only_view_own_threads == 0) { $current_permissions["canonlyviewownthreads"] = 0;
|
// Figure out if we can view more than our own threads if($only_view_own_threads == 0) { $current_permissions["canonlyviewownthreads"] = 0;
|
| }
// Figure out if we can reply more than our own threads if($only_reply_own_threads == 0) { $current_permissions["canonlyreplyownthreads"] = 0;
|
}
if(count($current_permissions) == 0) { $current_permissions = $groupperms;
|
}
if(count($current_permissions) == 0) { $current_permissions = $groupperms;
|
}
| }
|
return $current_permissions; }
| return $current_permissions; }
|
Zeile 1451 | Zeile 1465 |
---|
function check_forum_password($fid, $pid=0) { global $mybb, $header, $footer, $headerinclude, $theme, $templates, $lang, $forum_cache;
|
function check_forum_password($fid, $pid=0) { global $mybb, $header, $footer, $headerinclude, $theme, $templates, $lang, $forum_cache;
|
|
|
$showform = true;
if(!is_array($forum_cache))
| $showform = true;
if(!is_array($forum_cache))
|
Zeile 1476 | Zeile 1490 |
---|
if($parent_id == $fid || $parent_id == $pid) { continue;
|
if($parent_id == $fid || $parent_id == $pid) { continue;
|
}
| }
|
if($forum_cache[$parent_id]['password'] != "") { check_forum_password($parent_id, $fid);
| if($forum_cache[$parent_id]['password'] != "") { check_forum_password($parent_id, $fid);
|
Zeile 1489 | Zeile 1503 |
---|
{ $password = $forum_cache[$fid]['password']; if(isset($mybb->input['pwverify']) && $pid == 0)
|
{ $password = $forum_cache[$fid]['password']; if(isset($mybb->input['pwverify']) && $pid == 0)
|
{ if($password == $mybb->get_input('pwverify')) {
| { if($password === $mybb->get_input('pwverify')) {
|
my_setcookie("forumpass[$fid]", md5($mybb->user['uid'].$mybb->get_input('pwverify')), null, true); $showform = false;
|
my_setcookie("forumpass[$fid]", md5($mybb->user['uid'].$mybb->get_input('pwverify')), null, true); $showform = false;
|
}
| }
|
else
|
else
|
{
| {
|
eval("\$pwnote = \"".$templates->get("forumdisplay_password_wrongpass")."\";"); $showform = true; }
|
eval("\$pwnote = \"".$templates->get("forumdisplay_password_wrongpass")."\";"); $showform = true; }
|
} else { if(!$mybb->cookies['forumpass'][$fid] || ($mybb->cookies['forumpass'][$fid] && md5($mybb->user['uid'].$password) != $mybb->cookies['forumpass'][$fid])) { $showform = true; }
| } else { if(!$mybb->cookies['forumpass'][$fid] || ($mybb->cookies['forumpass'][$fid] && md5($mybb->user['uid'].$password) !== $mybb->cookies['forumpass'][$fid])) { $showform = true; }
|
else { $showform = false;
| else { $showform = false;
|
Zeile 1531 | Zeile 1545 |
---|
output_page($pwform); } exit;
|
output_page($pwform); } exit;
|
}
| }
|
}
/**
| }
/**
|
Zeile 1555 | Zeile 1569 |
---|
if($uid == 0) { return false;
|
if($uid == 0) { return false;
|
}
| }
|
if(isset($modpermscache[$fid][$uid])) { return $modpermscache[$fid][$uid];
| if(isset($modpermscache[$fid][$uid])) { return $modpermscache[$fid][$uid];
|
Zeile 1580 | Zeile 1594 |
---|
foreach($extra_groups as $extra_group) { $groups[] = $extra_group;
|
foreach($extra_groups as $extra_group) { $groups[] = $extra_group;
|
} }
$mod_cache = $cache->read("moderators");
| } }
$mod_cache = $cache->read("moderators");
|
foreach($mod_cache as $forumid => $forum) {
| foreach($mod_cache as $forumid => $forum) {
|
Zeile 1595 | Zeile 1609 |
---|
// User settings override usergroup settings if(is_array($forum['users'][$uid]))
|
// User settings override usergroup settings if(is_array($forum['users'][$uid]))
|
{
| {
|
$perm = $forum['users'][$uid]; foreach($perm as $action => $value) {
| $perm = $forum['users'][$uid]; foreach($perm as $action => $value) {
|
Zeile 1608 | Zeile 1622 |
---|
if($value == 0) { // The user doesn't have permission to set this action
|
if($value == 0) { // The user doesn't have permission to set this action
|
$perms[$action] = 0;
| $perms[$action] = 0;
|
} else {
| } else {
|
Zeile 1634 | Zeile 1648 |
---|
}
$perms[$action] = max($perm[$action], $perms[$action]);
|
}
$perms[$action] = max($perm[$action], $perms[$action]);
|
} } }
| } } }
|
$modpermscache[$fid][$uid] = $perms;
| $modpermscache[$fid][$uid] = $perms;
|
Zeile 1752 | Zeile 1766 |
---|
foreach($posticons as $dbicon) { $dbicon['path'] = str_replace("{theme}", $theme['imgdir'], $dbicon['path']);
|
foreach($posticons as $dbicon) { $dbicon['path'] = str_replace("{theme}", $theme['imgdir'], $dbicon['path']);
|
$dbicon['path'] = htmlspecialchars_uni($dbicon['path']);
| $dbicon['path'] = htmlspecialchars_uni($mybb->get_asset_url($dbicon['path']));
|
$dbicon['name'] = htmlspecialchars_uni($dbicon['name']);
if($icon == $dbicon['iid'])
| $dbicon['name'] = htmlspecialchars_uni($dbicon['name']);
if($icon == $dbicon['iid'])
|
Zeile 1901 | Zeile 1915 |
---|
}
$newcookie[$id] = $value;
|
}
$newcookie[$id] = $value;
|
$newcookie = serialize($newcookie);
| $newcookie = my_serialize($newcookie);
|
my_setcookie("mybb[$name]", addslashes($newcookie), $expires);
// Make sure our current viarables are up-to-date as well $mybb->cookies['mybb'][$name] = $newcookie; }
|
my_setcookie("mybb[$name]", addslashes($newcookie), $expires);
// Make sure our current viarables are up-to-date as well $mybb->cookies['mybb'][$name] = $newcookie; }
|
/** * Verifies that data passed is an array * * @param array Data to unserialize * @return array Unserialized data array */ function my_unserialize($data) { $array = unserialize($data);
if(!is_array($array)) { $array = array(); }
| /* * Arbitrary limits for _safe_unserialize() */ define('MAX_SERIALIZED_INPUT_LENGTH', 10240); define('MAX_SERIALIZED_ARRAY_LENGTH', 256); define('MAX_SERIALIZED_ARRAY_DEPTH', 5);
/** * Credits go to https://github.com/piwik * Safe unserialize() replacement * - accepts a strict subset of PHP's native my_serialized representation * - does not unserialize objects * * @param string $str * @return mixed * @throw Exception if $str is malformed or contains unsupported types (e.g., resources, objects) */ function _safe_unserialize($str) { if(strlen($str) > MAX_SERIALIZED_INPUT_LENGTH) { // input exceeds MAX_SERIALIZED_INPUT_LENGTH return false; }
if(empty($str) || !is_string($str)) { return false; }
$stack = array(); $expected = array();
/* * states: * 0 - initial state, expecting a single value or array * 1 - terminal state * 2 - in array, expecting end of array or a key * 3 - in array, expecting value or another array */ $state = 0; while($state != 1) { $type = isset($str[0]) ? $str[0] : '';
if($type == '}') { $str = substr($str, 1); } else if($type == 'N' && $str[1] == ';') { $value = null; $str = substr($str, 2); } else if($type == 'b' && preg_match('/^b:([01]);/', $str, $matches)) { $value = $matches[1] == '1' ? true : false; $str = substr($str, 4); } else if($type == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches)) { $value = (int)$matches[1]; $str = $matches[2]; } else if($type == 'd' && preg_match('/^d:(-?[0-9]+\.?[0-9]*(E[+-][0-9]+)?);(.*)/s', $str, $matches)) { $value = (float)$matches[1]; $str = $matches[3]; } else if($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int)$matches[1], 2) == '";') { $value = substr($matches[2], 0, (int)$matches[1]); $str = substr($matches[2], (int)$matches[1] + 2); } else if($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches) && $matches[1] < MAX_SERIALIZED_ARRAY_LENGTH) { $expectedLength = (int)$matches[1]; $str = $matches[2]; } else { // object or unknown/malformed type return false; }
switch($state) { case 3: // in array, expecting value or another array if($type == 'a') { if(count($stack) >= MAX_SERIALIZED_ARRAY_DEPTH) { // array nesting exceeds MAX_SERIALIZED_ARRAY_DEPTH return false; }
$stack[] = &$list; $list[$key] = array(); $list = &$list[$key]; $expected[] = $expectedLength; $state = 2; break; } if($type != '}') { $list[$key] = $value; $state = 2; break; }
// missing array value return false;
case 2: // in array, expecting end of array or a key if($type == '}') { if(count($list) < end($expected)) { // array size less than expected return false; }
unset($list); $list = &$stack[count($stack)-1]; array_pop($stack);
// go to terminal state if we're at the end of the root array array_pop($expected); if(count($expected) == 0) { $state = 1; } break; } if($type == 'i' || $type == 's') { if(count($list) >= MAX_SERIALIZED_ARRAY_LENGTH) { // array size exceeds MAX_SERIALIZED_ARRAY_LENGTH return false; } if(count($list) >= end($expected)) { // array size exceeds expected length return false; }
$key = $value; $state = 3; break; }
// illegal array index type return false;
case 0: // expecting array or value if($type == 'a') { if(count($stack) >= MAX_SERIALIZED_ARRAY_DEPTH) { // array nesting exceeds MAX_SERIALIZED_ARRAY_DEPTH return false; }
$data = array(); $list = &$data; $expected[] = $expectedLength; $state = 2; break; } if($type != '}') { $data = $value; $state = 1; break; }
// not in array return false; } }
if(!empty($str)) { // trailing data in input return false; } return $data; }
/** * Credits go to https://github.com/piwik * Wrapper for _safe_unserialize() that handles exceptions and multibyte encoding issue * * @param string $str * @return mixed */ function my_unserialize($str) { // Ensure we use the byte count for strings even when strlen() is overloaded by mb_strlen() if(function_exists('mb_internal_encoding') && (((int)ini_get('mbstring.func_overload')) & 2)) { $mbIntEnc = mb_internal_encoding(); mb_internal_encoding('ASCII'); }
$out = _safe_unserialize($str);
if(isset($mbIntEnc)) { mb_internal_encoding($mbIntEnc); } return $out; }
/** * Credits go to https://github.com/piwik * Safe serialize() replacement * - output a strict subset of PHP's native serialized representation * - does not my_serialize objects * * @param mixed $value * @return string * @throw Exception if $value is malformed or contains unsupported types (e.g., resources, objects) */ function _safe_serialize( $value ) { if(is_null($value)) { return 'N;'; } if(is_bool($value)) { return 'b:'.(int)$value.';'; } if(is_int($value)) { return 'i:'.$value.';'; } if(is_float($value)) { return 'd:'.str_replace(',', '.', $value).';'; } if(is_string($value)) { return 's:'.strlen($value).':"'.$value.'";'; } if(is_array($value)) { $out = ''; foreach($value as $k => $v) { $out .= _safe_serialize($k) . _safe_serialize($v); } return 'a:'.count($value).':{'.$out.'}'; }
// safe_serialize cannot my_serialize resources or objects return false; }
|
|
|
return $array;
| /** * Credits go to https://github.com/piwik * Wrapper for _safe_serialize() that handles exceptions and multibyte encoding issue * * @param mixed $value * @return string */ function my_serialize($value) { // ensure we use the byte count for strings even when strlen() is overloaded by mb_strlen() if(function_exists('mb_internal_encoding') && (((int)ini_get('mbstring.func_overload')) & 2)) { $mbIntEnc = mb_internal_encoding(); mb_internal_encoding('ASCII'); } $out = _safe_serialize($value); if(isset($mbIntEnc)) { mb_internal_encoding($mbIntEnc); } return $out;
|
}
/**
| }
/**
|
Zeile 1944 | Zeile 2232 |
---|
{ // 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);
| $serverload[0] = round($serverload[0], 4);
|
} else if(@file_exists("/proc/loadavg") && $load = @file_get_contents("/proc/loadavg")) {
| } else if(@file_exists("/proc/loadavg") && $load = @file_get_contents("/proc/loadavg")) {
|
Zeile 1960 | Zeile 2248 |
---|
// 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; }
| { return $lang->unknown; }
|
Zeile 1982 | Zeile 2270 |
---|
{ return $lang->unknown; }
|
{ return $lang->unknown; }
|
} } else {
| } } else {
|
return $lang->unknown; }
| return $lang->unknown; }
|
Zeile 2061 | Zeile 2349 |
---|
$new_stats = array(); $counters = array('numthreads', 'numunapprovedthreads', 'numposts', 'numunapprovedposts', 'numusers', 'numdeletedposts', 'numdeletedthreads');
|
$new_stats = array(); $counters = array('numthreads', 'numunapprovedthreads', 'numposts', 'numunapprovedposts', 'numusers', 'numdeletedposts', 'numdeletedthreads');
|
foreach($counters as $counter) { if(array_key_exists($counter, $changes)) { // Adding or subtracting from previous value? if(substr($changes[$counter], 0, 1) == "+" || substr($changes[$counter], 0, 1) == "-")
| foreach($counters as $counter) { if(array_key_exists($counter, $changes)) { if(substr($changes[$counter], 0, 2) == "+-") { $changes[$counter] = substr($changes[$counter], 1); } // Adding or subtracting from previous value? if(substr($changes[$counter], 0, 1) == "+" || substr($changes[$counter], 0, 1) == "-")
|
{ if((int)$changes[$counter] != 0) {
| { if((int)$changes[$counter] != 0) {
|
Zeile 2078 | Zeile 2370 |
---|
{ $new_stats[$counter] = "+{$new_stats[$counter]}"; }
|
{ $new_stats[$counter] = "+{$new_stats[$counter]}"; }
|
}
| }
|
// Less than 0? That's bad elseif($new_stats[$counter] < 0) {
| // Less than 0? That's bad elseif($new_stats[$counter] < 0) {
|
Zeile 2160 | Zeile 2452 |
---|
{ if(array_key_exists($counter, $changes)) {
|
{ if(array_key_exists($counter, $changes)) {
|
| if(substr($changes[$counter], 0, 2) == "+-") { $changes[$counter] = substr($changes[$counter], 1); }
|
// Adding or subtracting from previous value? if(substr($changes[$counter], 0, 1) == "+" || substr($changes[$counter], 0, 1) == "-") {
| // Adding or subtracting from previous value? if(substr($changes[$counter], 0, 1) == "+" || substr($changes[$counter], 0, 1) == "-") {
|
Zeile 2301 | Zeile 2597 |
---|
);
$db->update_query("forums", $updated_forum, "fid='{$fid}'");
|
);
$db->update_query("forums", $updated_forum, "fid='{$fid}'");
|
}
| }
|
/** * Updates the thread counters with a specific value (or addition/subtraction of the previous value)
| /** * Updates the thread counters with a specific value (or addition/subtraction of the previous value)
|
Zeile 2326 | Zeile 2622 |
---|
{ if(array_key_exists($counter, $changes)) {
|
{ if(array_key_exists($counter, $changes)) {
|
| if(substr($changes[$counter], 0, 2) == "+-") { $changes[$counter] = substr($changes[$counter], 1); }
|
// Adding or subtracting from previous value? if(substr($changes[$counter], 0, 1) == "+" || substr($changes[$counter], 0, 1) == "-") {
| // Adding or subtracting from previous value? if(substr($changes[$counter], 0, 1) == "+" || substr($changes[$counter], 0, 1) == "-") {
|
Zeile 2452 | Zeile 2752 |
---|
{ if(array_key_exists($counter, $changes)) {
|
{ if(array_key_exists($counter, $changes)) {
|
| if(substr($changes[$counter], 0, 2) == "+-") { $changes[$counter] = substr($changes[$counter], 1); }
|
// Adding or subtracting from previous value? if(substr($changes[$counter], 0, 1) == "+" || substr($changes[$counter], 0, 1) == "-") {
| // Adding or subtracting from previous value? if(substr($changes[$counter], 0, 1) == "+" || substr($changes[$counter], 0, 1) == "-") {
|
Zeile 2479 | Zeile 2783 |
---|
if(count($update_query) > 0) { $db->update_query("users", $update_query, "uid='{$uid}'");
|
if(count($update_query) > 0) { $db->update_query("users", $update_query, "uid='{$uid}'");
|
} }
| } }
|
/** * 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;
| { global $moderation;
|
if(!is_object($moderation)) { require_once MYBB_ROOT."inc/class_moderation.php"; $moderation = new 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);
|
}
/**
| }
/**
|
* Deletes a post from the database * * @param int The thread ID
| * Deletes a post from the database * * @param int The thread ID
|
Zeile 2510 | Zeile 2814 |
---|
global $moderation;
if(!is_object($moderation))
|
global $moderation;
if(!is_object($moderation))
|
{
| {
|
require_once MYBB_ROOT."inc/class_moderation.php"; $moderation = new Moderation; }
| require_once MYBB_ROOT."inc/class_moderation.php"; $moderation = new Moderation; }
|
Zeile 2527 | Zeile 2831 |
---|
* @param int The current depth of forums we're at * @param int Whether or not to show extra items such as User CP, Forum home * @param boolean Ignore the showinjump setting and show all forums (for moderation pages)
|
* @param int The current depth of forums we're at * @param int Whether or not to show extra items such as User CP, Forum home * @param boolean Ignore the showinjump setting and show all forums (for moderation pages)
|
* @param array Array of permissions
| * @param unknown_type deprecated
|
* @param string The name of the forum jump * @return string Forum jump items */ function build_forum_jump($pid="0", $selitem="", $addselect="1", $depth="", $showextras="1", $showall=false, $permissions="", $name="fid")
|
* @param string The name of the forum jump * @return string Forum jump items */ function build_forum_jump($pid="0", $selitem="", $addselect="1", $depth="", $showextras="1", $showall=false, $permissions="", $name="fid")
|
{ global $forum_cache, $jumpfcache, $permissioncache, $mybb, $selecteddone, $forumjump, $forumjumpbits, $gobutton, $theme, $templates, $lang;
$pid = (int)$pid; $jumpsel['default'] = '';
if($permissions) { $permissions = $mybb->usergroup; }
| { global $forum_cache, $jumpfcache, $permissioncache, $mybb, $forumjump, $forumjumpbits, $gobutton, $theme, $templates, $lang;
$pid = (int)$pid;
|
if(!is_array($jumpfcache)) {
| if(!is_array($jumpfcache)) {
|
Zeile 2577 | Zeile 2875 |
---|
$optionselected = "";
if($selitem == $forum['fid'])
|
$optionselected = "";
if($selitem == $forum['fid'])
|
{ $optionselected = "selected=\"selected\""; $selecteddone = 1; }
$forum['name'] = htmlspecialchars_uni(strip_tags($forum['name']));
| { $optionselected = 'selected="selected"'; }
$forum['name'] = htmlspecialchars_uni(strip_tags($forum['name']));
|
eval("\$forumjumpbits .= \"".$templates->get("forumjump_bit")."\";");
| eval("\$forumjumpbits .= \"".$templates->get("forumjump_bit")."\";");
|
Zeile 2598 | Zeile 2895 |
---|
if($addselect) {
|
if($addselect) {
|
if(!$selecteddone) { if(!$selitem) { $selitem = "default"; }
$jumpsel[$selitem] = 'selected="selected"'; }
| |
if($showextras == 0) { $template = "special";
| if($showextras == 0) { $template = "special";
|
Zeile 2618 | Zeile 2905 |
---|
if(strpos(FORUM_URL, '.html') !== false) {
|
if(strpos(FORUM_URL, '.html') !== false) {
|
$forum_link = "'".str_replace('{fid}', "'+this.options[this.selectedIndex].value+'", FORUM_URL)."'";
| $forum_link = "'".str_replace('{fid}', "'+option+'", FORUM_URL)."'";
|
} else {
|
} else {
|
$forum_link = "'".str_replace('{fid}', "'+this.options[this.selectedIndex].value", FORUM_URL);
| $forum_link = "'".str_replace('{fid}', "'+option", FORUM_URL);
|
} }
| } }
|
Zeile 2665 | Zeile 2952 |
---|
/** * Formats a username based on their display group
|
/** * Formats a username based on their display group
|
*
| *
|
* @param string The username * @param int The usergroup for the user (if not specified, will be fetched) * @param int The display group for the user (if not specified, will be fetched)
| * @param string The username * @param int The usergroup for the user (if not specified, will be fetched) * @param int The display group for the user (if not specified, will be fetched)
|
Zeile 2688 | Zeile 2975 |
---|
$ugroup = $groupscache[$usergroup]; $format = $ugroup['namestyle']; $userin = substr_count($format, "{username}");
|
$ugroup = $groupscache[$usergroup]; $format = $ugroup['namestyle']; $userin = substr_count($format, "{username}");
|
|
|
if($userin == 0) { $format = "{username}";
| if($userin == 0) { $format = "{username}";
|
Zeile 2711 | Zeile 2998 |
---|
{ global $mybb; static $avatars;
|
{ global $mybb; static $avatars;
|
|
|
if(!isset($avatars))
|
if(!isset($avatars))
|
{
| {
|
$avatars = array();
|
$avatars = array();
|
}
| }
|
if(!$avatar) { // Default avatar $avatar = $mybb->settings['useravatar']; $dimensions = $mybb->settings['useravatardims'];
|
if(!$avatar) { // Default avatar $avatar = $mybb->settings['useravatar']; $dimensions = $mybb->settings['useravatardims'];
|
}
if(isset($avatars[$avatar])) { return $avatars[$avatar]; }
| }
|
if(!$max_dimensions)
|
if(!$max_dimensions)
|
{
| {
|
$max_dimensions = $mybb->settings['maxavatardims']; }
|
$max_dimensions = $mybb->settings['maxavatardims']; }
|
| // An empty key wouldn't work so we need to add a fall back $key = $dimensions; if(empty($key)) { $key = 'default'; } $key2 = $max_dimensions; if(empty($key2)) { $key2 = 'default'; }
if(isset($avatars[$avatar][$key][$key2])) { return $avatars[$avatar][$key][$key2]; }
$avatar_width_height = '';
|
if($dimensions) {
| if($dimensions) {
|
Zeile 2742 | Zeile 3043 |
---|
{ list($max_width, $max_height) = explode('x', $max_dimensions);
|
{ list($max_width, $max_height) = explode('x', $max_dimensions);
|
if($dimensions[0] > $max_width || $dimensions[1] > $max_height)
| if(!empty($max_dimensions) && ($dimensions[0] > $max_width || $dimensions[1] > $max_height))
|
{ require_once MYBB_ROOT."inc/functions_image.php"; $scaled_dimensions = scale_image($dimensions[0], $dimensions[1], $max_width, $max_height);
| { require_once MYBB_ROOT."inc/functions_image.php"; $scaled_dimensions = scale_image($dimensions[0], $dimensions[1], $max_width, $max_height);
|
Zeile 2755 | Zeile 3056 |
---|
} }
|
} }
|
$avatars[$avatar] = array( 'image' => $mybb->get_asset_url($avatar),
| $avatars[$avatar][$key][$key2] = array( 'image' => htmlspecialchars_uni($mybb->get_asset_url($avatar)),
|
'width_height' => $avatar_width_height );
|
'width_height' => $avatar_width_height );
|
return $avatars[$avatar];
| return $avatars[$avatar][$key][$key2];
|
}
/**
|
}
/**
|
* 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.
|
* * @return string The MyCode inserter */
| * * @return string The MyCode inserter */
|
Zeile 2883 | Zeile 3187 |
---|
if(!$smiliecache) {
|
if(!$smiliecache) {
|
if(!is_array($smilie_cache))
| if(!isset($smilie_cache) || !is_array($smilie_cache))
|
{ $smilie_cache = $cache->read("smilies"); }
| { $smilie_cache = $cache->read("smilies"); }
|
Zeile 2914 | Zeile 3218 |
---|
// Only show the first text to replace in the box $smilie['find'] = $finds[0];
|
// Only show the first text to replace in the box $smilie['find'] = $finds[0];
|
$find = htmlspecialchars_uni($smilie['find']); $image = htmlspecialchars_uni($smilie['image']);
| $find = str_replace(array('\\', '"'), array('\\\\', '\"'), htmlspecialchars_uni($smilie['find'])); $image = htmlspecialchars_uni($mybb->get_asset_url($smilie['image'])); $image = str_replace(array('\\', '"'), array('\\\\', '\"'), $image);
|
if($i < $mybb->settings['smilieinsertertot']) { $dropdownsmilies .= '"'.$find.'": "'.$image.'",';
| if($i < $mybb->settings['smilieinsertertot']) { $dropdownsmilies .= '"'.$find.'": "'.$image.'",';
|
Zeile 2927 | Zeile 3233 |
---|
for($j = 1; $j < $finds_count; ++$j) {
|
for($j = 1; $j < $finds_count; ++$j) {
|
$find = htmlspecialchars_uni($finds[$j]);
| $find = str_replace(array('\\', '"'), array('\\\\', '\"'), htmlspecialchars_uni($finds[$j]));
|
$hiddensmilies .= '"'.$find.'": "'.$image.'",'; } ++$i;
| $hiddensmilies .= '"'.$find.'": "'.$image.'",'; } ++$i;
|
Zeile 2956 | Zeile 3262 |
---|
if($mybb->settings['allowsizemycode'] == 1) { $size = "size,";
|
if($mybb->settings['allowsizemycode'] == 1) { $size = "size,";
|
}
| }
|
if($mybb->settings['allowcolormycode'] == 1) { $color = "color,";
| if($mybb->settings['allowcolormycode'] == 1) { $color = "color,";
|
Zeile 2984 | Zeile 3290 |
---|
}
if($mybb->settings['allowcodemycode'] == 1)
|
}
if($mybb->settings['allowcodemycode'] == 1)
|
{
| {
|
$code = "code,php,"; }
| $code = "code,php,"; }
|
Zeile 3012 | Zeile 3318 |
---|
if($mybb->settings['smilieinserter'] != 0 && $mybb->settings['smilieinsertercols'] && $mybb->settings['smilieinsertertot']) { if(!$smiliecount)
|
if($mybb->settings['smilieinserter'] != 0 && $mybb->settings['smilieinsertercols'] && $mybb->settings['smilieinsertertot']) { if(!$smiliecount)
|
{
| {
|
$smilie_cache = $cache->read("smilies"); $smiliecount = count($smilie_cache); }
| $smilie_cache = $cache->read("smilies"); $smiliecount = count($smilie_cache); }
|
Zeile 3026 | Zeile 3332 |
---|
foreach($smilie_cache as $smilie) { if($smilie['showclickable'] != 0)
|
foreach($smilie_cache as $smilie) { if($smilie['showclickable'] != 0)
|
{ $smilie['image'] = str_replace("{theme}", $theme['imgdir'], $smilie['image']);
| { $smilie['image'] = str_replace("{theme}", $theme['imgdir'], $smilie['image']);
|
$smiliecache[$smilie['sid']] = $smilie; } } }
|
$smiliecache[$smilie['sid']] = $smilie; } } }
|
|
|
unset($smilie);
if(is_array($smiliecache))
| unset($smilie);
if(is_array($smiliecache))
|
Zeile 3063 | Zeile 3369 |
---|
{ $smilies .= "<tr>\n"; }
|
{ $smilies .= "<tr>\n"; }
|
| $smilie['image'] = str_replace("{theme}", $theme['imgdir'], $smilie['image']); $smilie['image'] = htmlspecialchars_uni($mybb->get_asset_url($smilie['image'])); $smilie['name'] = htmlspecialchars_uni($smilie['name']);
|
// Only show the first text to replace in the box $temp = explode("\n", $smilie['find']); // assign to temporary variable for php 5.3 compatibility $smilie['find'] = $temp[0];
|
// Only show the first text to replace in the box $temp = explode("\n", $smilie['find']); // assign to temporary variable for php 5.3 compatibility $smilie['find'] = $temp[0];
|
$find = htmlspecialchars_uni($smilie['find']);
| |
|
|
$onclick = ' onclick="MyBBEditor.insertText(\' '.$smilie['find'].' \');"';
| $find = str_replace(array('\\', "'"), array('\\\\', "\'"), htmlspecialchars_uni($smilie['find']));
$onclick = " onclick=\"MyBBEditor.insertText(' $find ');\"";
|
$extra_class = ' smilie_pointer'; eval('$smilie = "'.$templates->get('smilie', 1, 0).'";'); eval("\$smilies .= \"".$templates->get("smilieinsert_smilie")."\";");
| $extra_class = ' smilie_pointer'; eval('$smilie = "'.$templates->get('smilie', 1, 0).'";'); eval("\$smilies .= \"".$templates->get("smilieinsert_smilie")."\";");
|
Zeile 3263 | Zeile 3573 |
---|
}
if($multiple != 0)
|
}
if($multiple != 0)
|
{
| {
|
eval("\$prefixselect = \"".$templates->get("post_prefixselect_multiple")."\";"); } else
| eval("\$prefixselect = \"".$templates->get("post_prefixselect_multiple")."\";"); } else
|
Zeile 3297 | Zeile 3607 |
---|
foreach($prefix_cache as $prefix) { if($prefix['forums'] != "-1")
|
foreach($prefix_cache as $prefix) { if($prefix['forums'] != "-1")
|
{
| {
|
// Decide whether this prefix can be used in our forum $forums = explode(",", $prefix['forums']);
| // Decide whether this prefix can be used in our forum $forums = explode(",", $prefix['forums']);
|
Zeile 3319 | Zeile 3629 |
---|
return false; }
|
return false; }
|
$prefixselect = $prefixselect_prefix = '';
$default_selected = ''; if((int)$selected_pid == 0) { $default_selected = " selected=\"selected\"";
| $default_selected = array(); $selected_pid = (int)$selected_pid; if($selected_pid == 0) { $default_selected['all'] = ' selected="selected"'; } else if($selected_pid == -1) { $default_selected['none'] = ' selected="selected"'; } else if($selected_pid == -2) { $default_selected['any'] = ' selected="selected"';
|
}
foreach($prefixes as $prefix)
| }
foreach($prefixes as $prefix)
|
Zeile 3332 | Zeile 3650 |
---|
$selected = ''; if($prefix['pid'] == $selected_pid) {
|
$selected = ''; if($prefix['pid'] == $selected_pid) {
|
$selected = " selected=\"selected\"";
| $selected = ' selected="selected"';
|
}
$prefix['prefix'] = htmlspecialchars_uni($prefix['prefix']);
|
}
$prefix['prefix'] = htmlspecialchars_uni($prefix['prefix']);
|
eval("\$prefixselect_prefix .= \"".$templates->get("forumdisplay_threadlist_prefixes_prefix")."\";");
| eval('$prefixselect_prefix .= "'.$templates->get("forumdisplay_threadlist_prefixes_prefix").'";');
|
}
|
}
|
eval("\$prefixselect = \"".$templates->get("forumdisplay_threadlist_prefixes")."\";");
| eval('$prefixselect = "'.$templates->get("forumdisplay_threadlist_prefixes").'";');
|
return $prefixselect; }
| return $prefixselect; }
|
Zeile 3418 | Zeile 3736 |
---|
$tid = (int)$data['tid']; unset($data['tid']); }
|
$tid = (int)$data['tid']; unset($data['tid']); }
|
|
|
$pid = 0; if(isset($data['pid'])) { $pid = (int)$data['pid']; unset($data['pid']);
|
$pid = 0; if(isset($data['pid'])) { $pid = (int)$data['pid']; unset($data['pid']);
|
}
| }
|
|
|
// Any remaining extra data - we serialize and insert in to its own column
| // Any remaining extra data - we my_serialize and insert in to its own column
|
if(is_array($data)) {
|
if(is_array($data)) {
|
$data = serialize($data);
| $data = my_serialize($data);
|
}
$sql_array = array(
| }
$sql_array = array(
|
Zeile 3444 | Zeile 3762 |
---|
); $db->insert_query("moderatorlog", $sql_array); }
|
); $db->insert_query("moderatorlog", $sql_array); }
|
|
|
/** * Get the formatted reputation for a user. *
| /** * Get the formatted reputation for a user. *
|
Zeile 3462 | Zeile 3780 |
---|
$reputation_class = "reputation_negative"; } elseif($reputation > 0)
|
$reputation_class = "reputation_negative"; } elseif($reputation > 0)
|
{
| {
|
$reputation_class = "reputation_positive";
|
$reputation_class = "reputation_positive";
|
}
| }
|
else { $reputation_class = "reputation_neutral"; }
|
else { $reputation_class = "reputation_neutral"; }
|
| $reputation = my_number_format($reputation);
|
if($uid != 0) {
| if($uid != 0) {
|
Zeile 3523 | Zeile 3843 |
---|
{ global $mybb, $plugins;
|
{ global $mybb, $plugins;
|
$ip = $_SERVER['REMOTE_ADDR'];
| $ip = strtolower($_SERVER['REMOTE_ADDR']);
|
if($mybb->settings['ip_forwarded_check']) {
| if($mybb->settings['ip_forwarded_check']) {
|
Zeile 3531 | Zeile 3851 |
---|
if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
$addresses = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
| $addresses = explode(',', strtolower($_SERVER['HTTP_X_FORWARDED_FOR']));
|
} elseif(isset($_SERVER['HTTP_X_REAL_IP'])) {
|
} elseif(isset($_SERVER['HTTP_X_REAL_IP'])) {
|
$addresses = explode(',', $_SERVER['HTTP_X_REAL_IP']);
| $addresses = explode(',', strtolower($_SERVER['HTTP_X_REAL_IP']));
|
}
if(is_array($addresses))
| }
if(is_array($addresses))
|
Zeile 3557 | Zeile 3877 |
---|
{ if(isset($_SERVER['HTTP_CLIENT_IP'])) {
|
{ if(isset($_SERVER['HTTP_CLIENT_IP'])) {
|
$ip = $_SERVER['HTTP_CLIENT_IP'];
| $ip = strtolower($_SERVER['HTTP_CLIENT_IP']);
|
} }
| } }
|
Zeile 3624 | Zeile 3944 |
---|
elseif($size >= 1024) { $size = my_number_format(round(($size / 1024), 2))." ".$lang->size_kb;
|
elseif($size >= 1024) { $size = my_number_format(round(($size / 1024), 2))." ".$lang->size_kb;
|
}
| }
|
elseif($size == 0)
|
elseif($size == 0)
|
{
| {
|
$size = "0 ".$lang->size_bytes;
|
$size = "0 ".$lang->size_bytes;
|
}
| }
|
else { $size = my_number_format($size)." ".$lang->size_bytes;
| else { $size = my_number_format($size)." ".$lang->size_bytes;
|
Zeile 3639 | Zeile 3959 |
---|
/** * Format a decimal number in to microseconds, milliseconds, or seconds.
|
/** * Format a decimal number in to microseconds, milliseconds, or seconds.
|
*
| *
|
* @param int The time in microseconds * @return string The friendly time duration */
| * @param int The time in microseconds * @return string The friendly time duration */
|
Zeile 3666 | Zeile 3986 |
---|
}
return $time;
|
}
return $time;
|
}
/**
| }
/**
|
* Get the attachment icon for a specific file extension * * @param string The file extension
| * Get the attachment icon for a specific file extension * * @param string The file extension
|
Zeile 3676 | Zeile 3996 |
---|
*/ function get_attachment_icon($ext) {
|
*/ function get_attachment_icon($ext) {
|
global $cache, $attachtypes, $theme, $templates, $lang;
| global $cache, $attachtypes, $theme, $templates, $lang, $mybb;
|
if(!$attachtypes) { $attachtypes = $cache->read("attachtypes");
|
if(!$attachtypes) { $attachtypes = $cache->read("attachtypes");
|
}
$ext = my_strtolower($ext);
| }
$ext = my_strtolower($ext);
|
if($attachtypes[$ext]['icon']) {
|
if($attachtypes[$ext]['icon']) {
|
if(defined("IN_ADMINCP"))
| static $attach_icons_schemes = array(); if(!isset($attach_icons_schemes[$ext]))
|
{
|
{
|
$icon = str_replace("{theme}", "", $attachtypes[$ext]['icon']); if(my_substr($icon, 0, 1) != "/" && my_substr($icon, 0, 7) != "http://")
| $attach_icons_schemes[$ext] = parse_url($attachtypes[$ext]['icon']); if(!empty($attach_icons_schemes[$ext]['scheme']))
|
{
|
{
|
$icon = "../".$icon;
| $attach_icons_schemes[$ext] = $attachtypes[$ext]['icon']; } elseif(defined("IN_ADMINCP")) { $attach_icons_schemes[$ext] = str_replace("{theme}", "", $attachtypes[$ext]['icon']); if(my_substr($attach_icons_schemes[$ext], 0, 1) != "/") { $attach_icons_schemes[$ext] = "../".$attach_icons_schemes[$ext]; } } elseif(defined("IN_PORTAL")) { global $change_dir; $attach_icons_schemes[$ext] = $change_dir."/".str_replace("{theme}", $theme['imgdir'], $attachtypes[$ext]['icon']); $attach_icons_schemes[$ext] = $mybb->get_asset_url($attach_icons_schemes[$ext]); } else { $attach_icons_schemes[$ext] = str_replace("{theme}", $theme['imgdir'], $attachtypes[$ext]['icon']); $attach_icons_schemes[$ext] = $mybb->get_asset_url($attach_icons_schemes[$ext]);
|
} }
|
} }
|
elseif(defined("IN_PORTAL")) { global $change_dir; $icon = $change_dir."/".str_replace("{theme}", $theme['imgdir'], $attachtypes[$ext]['icon']); } else { $icon = str_replace("{theme}", $theme['imgdir'], $attachtypes[$ext]['icon']); }
| $icon = $attach_icons_schemes[$ext];
|
$name = htmlspecialchars_uni($attachtypes[$ext]['name']); }
| $name = htmlspecialchars_uni($attachtypes[$ext]['name']); }
|
Zeile 3720 | Zeile 4053 |
---|
}
$icon = "{$theme['imgdir']}/attachtypes/unknown.png";
|
}
$icon = "{$theme['imgdir']}/attachtypes/unknown.png";
|
|
|
$name = $lang->unknown; }
|
$name = $lang->unknown; }
|
| $icon = htmlspecialchars_uni($icon);
|
eval("\$attachment_icon = \"".$templates->get("attachment_icon")."\";"); return $attachment_icon; }
| eval("\$attachment_icon = \"".$templates->get("attachment_icon")."\";"); return $attachment_icon; }
|
Zeile 3735 | Zeile 4070 |
---|
*/ function get_unviewable_forums($only_readable_threads=false) {
|
*/ function get_unviewable_forums($only_readable_threads=false) {
|
global $forum_cache, $permissioncache, $mybb, $unviewable, $templates, $forumpass;
if(!isset($permissions)) { $permissions = $mybb->usergroup; }
| global $forum_cache, $permissioncache, $mybb;
|
if(!is_array($forum_cache))
|
if(!is_array($forum_cache))
|
{
| {
|
cache_forums();
|
cache_forums();
|
}
| }
|
if(!is_array($permissioncache)) { $permissioncache = forum_permissions();
|
if(!is_array($permissioncache)) { $permissioncache = forum_permissions();
|
}
$unviewableforums = ''; $password_forums = array();
| }
$password_forums = $unviewable = array();
|
foreach($forum_cache as $fid => $forum) { if($permissioncache[$forum['fid']])
|
foreach($forum_cache as $fid => $forum) { if($permissioncache[$forum['fid']])
|
{
| {
|
$perms = $permissioncache[$forum['fid']];
|
$perms = $permissioncache[$forum['fid']];
|
}
| }
|
else { $perms = $mybb->usergroup;
|
else { $perms = $mybb->usergroup;
|
}
$pwverified = 1;
| }
$pwverified = 1;
|
if($forum['password'] != "")
|
if($forum['password'] != "")
|
{ if($mybb->cookies['forumpass'][$forum['fid']] != md5($mybb->user['uid'].$forum['password']))
| { if($mybb->cookies['forumpass'][$forum['fid']] !== md5($mybb->user['uid'].$forum['password']))
|
{ $pwverified = 0; }
| { $pwverified = 0; }
|
Zeile 3781 | Zeile 4110 |
---|
// 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]))
| { if(isset($password_forums[$parent]) && $mybb->cookies['forumpass'][$parent] !== md5($mybb->user['uid'].$password_forums[$parent]))
|
{ $pwverified = 0; }
|
{ $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)) {
|
if($unviewableforums) { $unviewableforums .= ","; }
$unviewableforums .= "'".$forum['fid']."'";
| $unviewable[] = $forum['fid'];
|
}
|
}
|
}
if(isset($unviewableforums)) { return $unviewableforums; } }
| } $unviewableforums = implode(',', $unviewable); return $unviewableforums; }
|
/** * Fixes mktime for dates earlier than 1970
| /** * Fixes mktime for dates earlier than 1970
|
Zeile 3819 | Zeile 4142 |
---|
// -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; }
|
|
|
/** * Build the breadcrumb navigation trail from the specified items *
| /** * Build the breadcrumb navigation trail from the specified items *
|
Zeile 3831 | Zeile 4154 |
---|
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")."\";");
|
eval("\$navsep = \"".$templates->get("nav_sep")."\";");
|
|
|
$i = 0; $activesep = '';
| $i = 0; $activesep = '';
|
Zeile 3847 | Zeile 4170 |
---|
if(isset($navbits[$key+2])) { $sep = $navsep;
|
if(isset($navbits[$key+2])) { $sep = $navsep;
|
}
| }
|
else { $sep = "";
| else { $sep = "";
|
Zeile 3860 | Zeile 4183 |
---|
if(!$mybb->settings['threadsperpage'] || (int)$mybb->settings['threadsperpage'] < 1) { $mybb->settings['threadsperpage'] = 20;
|
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 3870 | Zeile 4193 |
---|
$sep = $multipage_dropdown.$sep; } }
|
$sep = $multipage_dropdown.$sep; } }
|
|
|
// Replace page 1 URLs $navbit['url'] = str_replace("-page-1.html", ".html", $navbit['url']); $navbit['url'] = preg_replace("/&page=1$/", "", $navbit['url']);
eval("\$nav .= \"".$templates->get("nav_bit")."\";");
|
// Replace page 1 URLs $navbit['url'] = str_replace("-page-1.html", ".html", $navbit['url']); $navbit['url'] = preg_replace("/&page=1$/", "", $navbit['url']);
eval("\$nav .= \"".$templates->get("nav_bit")."\";");
|
} }
| } }
|
}
$activesep = '';
| }
$activesep = '';
|
Zeile 3921 | Zeile 4244 |
---|
global $pforumcache, $currentitem, $forum_cache, $navbits, $lang, $base_url, $archiveurl;
if(!$pforumcache)
|
global $pforumcache, $currentitem, $forum_cache, $navbits, $lang, $base_url, $archiveurl;
if(!$pforumcache)
|
{
| {
|
if(!is_array($forum_cache)) { cache_forums();
| if(!is_array($forum_cache)) { cache_forums();
|
Zeile 3994 | Zeile 4317 |
---|
unset($GLOBALS['navbits']); $GLOBALS['navbits'] = $newnav;
|
unset($GLOBALS['navbits']); $GLOBALS['navbits'] = $newnav;
|
}
| }
|
/** * Builds a URL to an archive mode page
| /** * Builds a URL to an archive mode page
|
Zeile 4047 | Zeile 4370 |
---|
$phptime = $maintimer->totaltime - $db->query_time; $query_time = $db->query_time; $globaltime = format_time_duration($globaltime);
|
$phptime = $maintimer->totaltime - $db->query_time; $query_time = $db->query_time; $globaltime = format_time_duration($globaltime);
|
|
|
$percentphp = number_format((($phptime/$maintimer->totaltime)*100), 2); $percentsql = number_format((($query_time/$maintimer->totaltime)*100), 2);
| $percentphp = number_format((($phptime/$maintimer->totaltime)*100), 2); $percentsql = number_format((($query_time/$maintimer->totaltime)*100), 2);
|
Zeile 4100 | Zeile 4423 |
---|
echo "<td bgcolor=\"#fefefe\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">{$mybb->config['database']['type']}, xml</span></td>\n"; echo "<td bgcolor=\"#efefef\" width=\"25%\"><b><span style=\"font-family: tahoma; font-size: 12px;\">Global.php Processing Time:</span></b></td>\n"; echo "<td bgcolor=\"#fefefe\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">$globaltime</span></td>\n";
|
echo "<td bgcolor=\"#fefefe\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">{$mybb->config['database']['type']}, xml</span></td>\n"; echo "<td bgcolor=\"#efefef\" width=\"25%\"><b><span style=\"font-family: tahoma; font-size: 12px;\">Global.php Processing Time:</span></b></td>\n"; echo "<td bgcolor=\"#fefefe\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">$globaltime</span></td>\n";
|
echo "</tr>\n"; echo "<tr>\n";
| echo "</tr>\n"; echo "<tr>\n";
|
echo "<td bgcolor=\"#efefef\" width=\"25%\"><b><span style=\"font-family: tahoma; font-size: 12px;\">PHP Version:</span></b></td>\n"; echo "<td bgcolor=\"#fefefe\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">$phpversion</span></td>\n"; echo "<td bgcolor=\"#efefef\" width=\"25%\"><b><span style=\"font-family: tahoma; font-size: 12px;\">Server Load:</span></b></td>\n";
| echo "<td bgcolor=\"#efefef\" width=\"25%\"><b><span style=\"font-family: tahoma; font-size: 12px;\">PHP Version:</span></b></td>\n"; echo "<td bgcolor=\"#fefefe\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">$phpversion</span></td>\n"; echo "<td bgcolor=\"#efefef\" width=\"25%\"><b><span style=\"font-family: tahoma; font-size: 12px;\">Server Load:</span></b></td>\n";
|
Zeile 4153 | Zeile 4476 |
---|
echo "<h2>Template Statistics</h2>\n";
if(count($templates->cache) > 0)
|
echo "<h2>Template Statistics</h2>\n";
if(count($templates->cache) > 0)
|
{ echo "<table style=\"background-color: #666;\" width=\"95%\" cellpadding=\"4\" cellspacing=\"1\" align=\"center\">\n"; echo "<tr>\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 "<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";
|
Zeile 4180 | Zeile 4503 |
---|
echo "</body>"; echo "</html>"; exit;
|
echo "</body>"; echo "</html>"; exit;
|
}
/**
| }
/**
|
* Outputs the correct page headers. */ function send_page_headers()
| * Outputs the correct page headers. */ function send_page_headers()
|
Zeile 4209 | Zeile 4532 |
---|
global $db, $cache, $plugins;
switch($type)
|
global $db, $cache, $plugins;
switch($type)
|
{
| {
|
case "posts": if(is_array($id)) {
| case "posts": if(is_array($id)) {
|
Zeile 4423 | Zeile 4746 |
---|
function join_usergroup($uid, $joingroup) { global $db, $mybb;
|
function join_usergroup($uid, $joingroup) { global $db, $mybb;
|
if($uid == $mybb->user['uid'])
| if($uid == $mybb->user['uid'])
|
{ $user = $mybb->user; }
| { $user = $mybb->user; }
|
Zeile 4446 | Zeile 4769 |
---|
foreach($groups as $gid) { if(trim($gid) != "" && $gid != $user['usergroup'] && !isset($donegroup[$gid]))
|
foreach($groups as $gid) { if(trim($gid) != "" && $gid != $user['usergroup'] && !isset($donegroup[$gid]))
|
{ $groupslist .= $comma.$gid; $comma = ","; $donegroup[$gid] = 1;
| { $groupslist .= $comma.$gid; $comma = ","; $donegroup[$gid] = 1;
|
} } }
// What's the point in updating if they're the same? if($groupslist != $user['additionalgroups'])
|
} } }
// What's the point in updating if they're the same? if($groupslist != $user['additionalgroups'])
|
{
| {
|
$db->update_query("users", array('additionalgroups' => $groupslist), "uid='".(int)$uid."'"); return true; } else { return false;
|
$db->update_query("users", array('additionalgroups' => $groupslist), "uid='".(int)$uid."'"); return true; } else { return false;
|
}
| }
|
}
/**
| }
/**
|
Zeile 4502 | Zeile 4825 |
---|
$donegroup[$gid] = 1; } }
|
$donegroup[$gid] = 1; } }
|
}
| }
|
$dispupdate = ""; if($leavegroup == $user['displaygroup']) {
| $dispupdate = ""; if($leavegroup == $user['displaygroup']) {
|
Zeile 4524 | Zeile 4847 |
---|
* * @param boolean True to return as "hidden" fields * @param array Array of fields to ignore if first argument is true
|
* * @param boolean True to return as "hidden" fields * @param array Array of fields to ignore if first argument is true
|
| * @param boolean True to skip all inputs and return only the file path part of the URL
|
* @return string The current URL being accessed */
|
* @return string The current URL being accessed */
|
function get_current_location($fields=false, $ignore=array())
| function get_current_location($fields=false, $ignore=array(), $quick=false)
|
{ if(defined("MYBB_LOCATION")) { return MYBB_LOCATION; }
|
{ if(defined("MYBB_LOCATION")) { return MYBB_LOCATION; }
|
if(!empty($_SERVER['PATH_INFO'])) { $location = htmlspecialchars_uni($_SERVER['PATH_INFO']); } elseif(!empty($_ENV['PATH_INFO'])) { $location = htmlspecialchars_uni($_ENV['PATH_INFO']);
| if(!empty($_SERVER['SCRIPT_NAME'])) { $location = htmlspecialchars_uni($_SERVER['SCRIPT_NAME']); } elseif(!empty($_SERVER['PHP_SELF'])) { $location = htmlspecialchars_uni($_SERVER['PHP_SELF']);
|
} elseif(!empty($_ENV['PHP_SELF']))
|
} elseif(!empty($_ENV['PHP_SELF']))
|
{ $location = htmlspecialchars_uni($_ENV['PHP_SELF']);
| { $location = htmlspecialchars_uni($_ENV['PHP_SELF']); } elseif(!empty($_SERVER['PATH_INFO'])) { $location = htmlspecialchars_uni($_SERVER['PATH_INFO']);
|
} else
|
} else
|
{ $location = htmlspecialchars_uni($_SERVER['PHP_SELF']);
| { $location = htmlspecialchars_uni($_ENV['PATH_INFO']); } if($quick) { return $location;
|
}
if($fields == true) {
|
}
if($fields == true) {
|
global $mybb;
| global $mybb;
|
if(!is_array($ignore))
|
if(!is_array($ignore))
|
{
| {
|
$ignore = array($ignore); }
| $ignore = array($ignore); }
|
Zeile 4563 | Zeile 4896 |
---|
if(!empty($mybb->input)) { foreach($mybb->input as $name => $value)
|
if(!empty($mybb->input)) { foreach($mybb->input as $name => $value)
|
{
| {
|
if(in_array($name, $ignore) || is_array($name) || is_array($value)) { continue;
| if(in_array($name, $ignore) || is_array($name) || is_array($value)) { continue;
|
Zeile 4593 | Zeile 4926 |
---|
foreach($post_array as $var) { if(isset($_POST[$var]))
|
foreach($post_array as $var) { if(isset($_POST[$var]))
|
{
| {
|
$addloc[] = urlencode($var).'='.urlencode($_POST[$var]); } }
| $addloc[] = urlencode($var).'='.urlencode($_POST[$var]); } }
|
Zeile 4603 | Zeile 4936 |
---|
if(strpos($location, "?") === false) { $location .= "?";
|
if(strpos($location, "?") === false) { $location .= "?";
|
}
| }
|
else { $location .= "&"; } $location .= implode("&", $addloc); }
|
else { $location .= "&"; } $location .= implode("&", $addloc); }
|
}
if(strlen($location) > 150) { $location = substr($location, 0, 150);
| |
}
return $location;
| }
return $location;
|
Zeile 4854 | Zeile 5182 |
---|
}
/**
|
}
/**
|
* Replacement function for PHP's wordwrap(). This version does not break up HTML tags, URLs or unicode references. * * @param string The string to be word wrapped * @return string The word wraped string
| * DEPRECATED! Please use other alternatives.
|
*/ function my_wordwrap($message) {
|
*/ function my_wordwrap($message) {
|
global $mybb;
if($mybb->settings['wordwrap'] > 0) { $message = convert_through_utf8($message);
if(!($new_message = @preg_replace("#(((?>[^\s&/<>\"\\-\[\]])|(&\#[a-z0-9]{1,10};)){{$mybb->settings['wordwrap']}})#u", "$0​", $message))) { $new_message = preg_replace("#(((?>[^\s&/<>\"\\-\[\]])|(&\#[a-z0-9]{1,10};)){{$mybb->settings['wordwrap']}})#", "$0​", $message); }
$new_message = convert_through_utf8($new_message, false);
return $new_message; }
| |
return $message; }
| return $message; }
|
Zeile 5640 | Zeile 5949 |
---|
$options['username_method'] = 0; }
|
$options['username_method'] = 0; }
|
switch($options['username_method'])
| switch($db->type) { case 'mysql': case 'mysqli': $field = 'username'; $efield = 'email'; break; default: $field = 'LOWER(username)'; $efield = 'LOWER(email)'; break; }
switch($options['username_method'])
|
{ case 1:
|
{ case 1:
|
$sqlwhere = 'LOWER(email)=\''.$username.'\''; break; case 2: $sqlwhere = 'LOWER(username)=\''.$username.'\' OR LOWER(email)=\''.$username.'\'';
| $sqlwhere = "{$efield}='{$username}'"; break; case 2: $sqlwhere = "{$field}='{$username}' OR {$efield}='{$username}'";
|
break; default:
|
break; default:
|
$sqlwhere = 'LOWER(username)=\''.$username.'\'';
| $sqlwhere = "{$field}='{$username}'";
|
break; }
| break; }
|
Zeile 5659 | Zeile 5981 |
---|
$fields = array_merge((array)$options['fields'], $fields); }
|
$fields = array_merge((array)$options['fields'], $fields); }
|
$fields = array_flip($fields);
$query = $db->simple_select('users', implode(',', array_keys($fields)), $sqlwhere, array('limit' => 1));
| $query = $db->simple_select('users', implode(',', array_unique($fields)), $sqlwhere, array('limit' => 1));
|
if(isset($options['exists'])) {
| if(isset($options['exists'])) {
|
Zeile 5686 | Zeile 6006 |
---|
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");
|
}
| }
|
if(empty($forum_cache[$fid])) { return false;
|
if(empty($forum_cache[$fid])) { return false;
|
}
| }
|
if($active_override != 1) { $parents = explode(",", $forum_cache[$fid]['parentlist']);
| if($active_override != 1) { $parents = explode(",", $forum_cache[$fid]['parentlist']);
|
Zeile 5703 | Zeile 6023 |
---|
if($forum_cache[$parent]['active'] == 0) { return false;
|
if($forum_cache[$parent]['active'] == 0) { return false;
|
} } } }
| } } } }
|
return $forum_cache[$fid]; }
|
return $forum_cache[$fid]; }
|
|
|
/** * Get the thread of a thread id. *
| /** * Get the thread of a thread id. *
|
Zeile 5728 | Zeile 6048 |
---|
if(isset($thread_cache[$tid]) && !$recache) { return $thread_cache[$tid];
|
if(isset($thread_cache[$tid]) && !$recache) { return $thread_cache[$tid];
|
}
| }
|
else { $query = $db->simple_select("threads", "*", "tid = '{$tid}'");
| else { $query = $db->simple_select("threads", "*", "tid = '{$tid}'");
|
Zeile 5749 | Zeile 6069 |
---|
/** * Get the post of a post id.
|
/** * Get the post of a post id.
|
*
| *
|
* @param int The post id of the post. * @param boolean Whether or not to recache the post. * @param array An array of fields to gather from the database
| * @param int The post id of the post. * @param boolean Whether or not to recache the post. * @param array An array of fields to gather from the database
|
Zeile 5763 | Zeile 6083 |
---|
$pid = (int)$pid;
if(isset($post_cache[$pid]))
|
$pid = (int)$pid;
if(isset($post_cache[$pid]))
|
{
| {
|
return $post_cache[$pid]; } else { $query = $db->simple_select("posts", "*", "pid = '{$pid}'"); $post = $db->fetch_array($query);
|
return $post_cache[$pid]; } else { $query = $db->simple_select("posts", "*", "pid = '{$pid}'"); $post = $db->fetch_array($query);
|
|
|
if($post) { $post_cache[$pid] = $post;
| if($post) { $post_cache[$pid] = $post;
|
Zeile 5791 | Zeile 6111 |
---|
*/ function get_inactive_forums() {
|
*/ function get_inactive_forums() {
|
global $forum_cache, $cache, $inactiveforums;
| global $forum_cache, $cache;
|
if(!$forum_cache) { cache_forums();
| if(!$forum_cache) { cache_forums();
|
Zeile 5814 | Zeile 6134 |
---|
} } }
|
} } }
|
|
|
$inactiveforums = implode(",", $inactive);
return $inactiveforums;
| $inactiveforums = implode(",", $inactive);
return $inactiveforums;
|
Zeile 6255 | Zeile 6576 |
---|
$ip_range = fetch_ip_range($banned_ip['filter']); if(is_array($ip_range)) {
|
$ip_range = fetch_ip_range($banned_ip['filter']); if(is_array($ip_range)) {
|
if(strcmp($ip_range[0], $ip_address) >= 0 && strcmp($ip_range[1], $ip_address) <= 0)
| if(strcmp($ip_range[0], $ip_address) <= 0 && strcmp($ip_range[1], $ip_address) >= 0)
|
{ $banned = true; }
| { $banned = true; }
|
Zeile 6373 | Zeile 6694 |
---|
}
/**
|
}
/**
|
* Fetch the contents of a remote fle.
| * Fetch the contents of a remote file.
|
* * @param string The URL of the remote file * @param array The array of post data
| * * @param string The URL of the remote file * @param array The array of post data
|
Zeile 6398 | Zeile 6719 |
---|
curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
| curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
if(!empty($post_body)) { curl_setopt($ch, CURLOPT_POST, 1);
| if(!empty($post_body)) { curl_setopt($ch, CURLOPT_POST, 1);
|
Zeile 6426 | Zeile 6748 |
---|
{ $url['path'] .= "?{$url['query']}"; }
|
{ $url['path'] .= "?{$url['query']}"; }
|
$fp = @fsockopen($url['host'], $url['port'], $error_no, $error, 10);
| $scheme = '';
if($url['scheme'] == 'https') { $scheme = 'ssl://'; if($url['port'] == 80) { $url['port'] = 443; } }
$fp = @fsockopen($scheme.$url['host'], $url['port'], $error_no, $error, 10);
|
@stream_set_timeout($fp, 10); if(!$fp) {
| @stream_set_timeout($fp, 10); if(!$fp) {
|
Zeile 6438 | Zeile 6772 |
---|
$headers[] = "POST {$url['path']} HTTP/1.0"; $headers[] = "Content-Length: ".strlen($post_body); $headers[] = "Content-Type: application/x-www-form-urlencoded";
|
$headers[] = "POST {$url['path']} HTTP/1.0"; $headers[] = "Content-Length: ".strlen($post_body); $headers[] = "Content-Type: application/x-www-form-urlencoded";
|
} else {
| } else {
|
$headers[] = "GET {$url['path']} HTTP/1.0"; }
| $headers[] = "GET {$url['path']} HTTP/1.0"; }
|
Zeile 6474 | Zeile 6808 |
---|
else if(empty($post_data)) { return @implode("", @file($url));
|
else if(empty($post_data)) { return @implode("", @file($url));
|
} else { return false; } }
/**
| } else { return false; } }
/**
|
* Checks if a particular user is a super administrator. * * @param int The user ID to check against the list of super admins
| * Checks if a particular user is a super administrator. * * @param int The user ID to check against the list of super admins
|
Zeile 6495 | Zeile 6829 |
---|
{ global $mybb; $super_admins = str_replace(" ", "", $mybb->config['super_admins']);
|
{ global $mybb; $super_admins = str_replace(" ", "", $mybb->config['super_admins']);
|
}
| }
|
if(my_strpos(",{$super_admins},", ",{$uid},") === false) {
| if(my_strpos(",{$super_admins},", ",{$uid},") === false) {
|
Zeile 6512 | Zeile 6846 |
---|
* Originates from frostschutz's PluginLibrary * github.com/frostschutz *
|
* Originates from frostschutz's PluginLibrary * github.com/frostschutz *
|
* @param mixed A selection of groups to check
| * @param mixed A selection of groups to check or -1 for any group
|
* @param mixed User to check selection against
|
* @param mixed User to check selection against
|
* @return mixed Array of groups this user belongs to
| * @return array Array of groups specified in the first param to which the user belongs
|
*/ function is_member($groups, $user = false) { global $mybb;
|
*/ function is_member($groups, $user = false) { global $mybb;
|
| if(empty($groups)) { return array(); }
|
if($user == false) { $user = $mybb->user; } else if(!is_array($user))
|
if($user == false) { $user = $mybb->user; } else if(!is_array($user))
|
{
| {
|
// Assume it's a UID $user = get_user($user); }
|
// Assume it's a UID $user = get_user($user); }
|
|
|
$memberships = array_map('intval', explode(',', $user['additionalgroups'])); $memberships[] = $user['usergroup'];
if(!is_array($groups)) {
|
$memberships = array_map('intval', explode(',', $user['additionalgroups'])); $memberships[] = $user['usergroup'];
if(!is_array($groups)) {
|
if(is_string($groups)) { $groups = explode(',', $groups);
| if((int)$groups == -1) { return $memberships;
|
} else {
|
} else {
|
$groups = (array)$groups;
| if(is_string($groups)) { $groups = explode(',', $groups); } else { $groups = (array)$groups; }
|
} }
| } }
|
Zeile 6980 | Zeile 7326 |
---|
else { // IPv4
|
else { // IPv4
|
| $ip_bits = count(explode('.', $ipaddress)); if($ip_bits < 4) { // Support for 127.0.* $replacement = str_repeat('.*', 4-$ip_bits); $ipaddress = substr_replace($ipaddress, $replacement, strrpos($ipaddress, '*')+1, 0); }
|
$upper = str_replace('*', '255', $ipaddress); $lower = str_replace('*', '0', $ipaddress);
|
$upper = str_replace('*', '255', $ipaddress); $lower = str_replace('*', '0', $ipaddress);
|
}
| }
|
$upper = my_inet_pton($upper); $lower = my_inet_pton($lower); if($upper === false || $lower === false)
| $upper = my_inet_pton($upper); $lower = my_inet_pton($lower); if($upper === false || $lower === false)
|
Zeile 6990 | Zeile 7343 |
---|
return false; } return array($lower, $upper);
|
return false; } return array($lower, $upper);
|
}
| }
|
// CIDR notation elseif(strpos($ipaddress, '/') !== false) {
| // CIDR notation elseif(strpos($ipaddress, '/') !== false) {
|
Zeile 7002 | Zeile 7355 |
---|
{ // Invalid input return false;
|
{ // Invalid input return false;
|
}
| }
|
else { $ip_address = my_inet_pton($ip_address);
| else { $ip_address = my_inet_pton($ip_address);
|
Zeile 7077 | Zeile 7430 |
---|
{ static $time_start;
|
{ static $time_start;
|
$time = microtime(true);
| $time = microtime(true);
|
// Just starting timer, init and return if(!$time_start) {
| // Just starting timer, init and return if(!$time_start) {
|
Zeile 7128 | Zeile 7481 |
---|
{ // Loop through all the files/directories in this directory while(($file = @readdir($dh)) !== false)
|
{ // Loop through all the files/directories in this directory while(($file = @readdir($dh)) !== false)
|
{
| {
|
if(in_array($file, $ignore) || in_array(get_extension($file), $ignore_ext)) { continue;
| if(in_array($file, $ignore) || in_array(get_extension($file), $ignore_ext)) { continue;
|
Zeile 7153 | Zeile 7506 |
---|
while(!feof($handle)) { $contents .= fread($handle, 8192);
|
while(!feof($handle)) { $contents .= fread($handle, 8192);
|
}
| }
|
fclose($handle);
$md5 = md5($contents);
| fclose($handle);
$md5 = md5($contents);
|
Zeile 7177 | Zeile 7530 |
---|
foreach($checksums as $file_path => $hashes) { if(in_array(basename($file_path), $ignore))
|
foreach($checksums as $file_path => $hashes) { if(in_array(basename($file_path), $ignore))
|
{
| {
|
continue; } $bad_verify_files[] = array("status" => "missing", "path" => $file_path);
| continue; } $bad_verify_files[] = array("status" => "missing", "path" => $file_path);
|
Zeile 7189 | Zeile 7542 |
---|
if($count == 0) { return $bad_verify_files;
|
if($count == 0) { return $bad_verify_files;
|
} }
| } }
|
/** * Returns a signed value equal to an integer
| /** * Returns a signed value equal to an integer
|
Zeile 7225 | Zeile 7578 |
---|
// Unix/Linux // Use OpenSSL when available if(function_exists('openssl_random_pseudo_bytes'))
|
// Unix/Linux // Use OpenSSL when available if(function_exists('openssl_random_pseudo_bytes'))
|
{ $output = openssl_random_pseudo_bytes($count); }
| { $output = openssl_random_pseudo_bytes($count); }
|
// Try mcrypt elseif(function_exists('mcrypt_create_iv'))
|
// 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);
|
$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); } }
| @fclose($handle); } }
|
else { // Windows
| else { // Windows
|
Zeile 7276 | Zeile 7629 |
---|
// Close to what PHP basically uses internally to seed, but not quite. $unique_state = microtime().@getmypid();
|
// Close to what PHP basically uses internally to seed, but not quite. $unique_state = microtime().@getmypid();
|
|
|
for($i = 0; $i < $count; $i += 16) { $unique_state = md5(microtime().$unique_state);
| for($i = 0; $i < $count; $i += 16) { $unique_state = md5(microtime().$unique_state);
|
Zeile 7337 | Zeile 7690 |
---|
}
/**
|
}
/**
|
* 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 7347 | Zeile 7700 |
---|
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 7402 | Zeile 7745 |
---|
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 7421 | Zeile 7764 |
---|
// 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 7436 | Zeile 7779 |
---|
$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) {
|
Zeile 7514 | Zeile 7857 |
---|
{ $gd_info = gd_info(); preg_match('/\d/', $gd_info['GD Version'], $gd);
|
{ $gd_info = gd_info(); preg_match('/\d/', $gd_info['GD Version'], $gd);
|
$gd_version = $gd[0]; } else
| $gd_version = $gd[0]; } else
|
{ ob_start(); phpinfo(8);
| { ob_start(); phpinfo(8);
|
Zeile 7551 | Zeile 7894 |
---|
if($c > 128) { if($c > 247 || $c <= 191)
|
if($c > 128) { if($c > 247 || $c <= 191)
|
{ if($return) { $string .= '?';
| { if($return) { $string .= '?';
|
continue;
|
continue;
|
}
| }
|
else { return false;
| else { return false;
|
Zeile 7564 | Zeile 7907 |
---|
} elseif($c > 239) {
|
} elseif($c > 239) {
|
$bytes = 4; } elseif($c > 223) {
| $bytes = 4; } elseif($c > 223) {
|
$bytes = 3; } elseif($c > 191)
| $bytes = 3; } elseif($c > 191)
|
Zeile 7614 | Zeile 7957 |
---|
if($valid) { $string .= $multibytes;
|
if($valid) { $string .= $multibytes;
|
} }
| } }
|
else { $string .= $input[$i];
| else { $string .= $input[$i];
|
Zeile 7628 | Zeile 7971 |
---|
if($allow_mb4) { return $input;
|
if($allow_mb4) { return $input;
|
}
| }
|
else { return preg_replace("#[^\\x00-\\x7F][\\x80-\\xBF]{3,}#", '?', $input);
| else { return preg_replace("#[^\\x00-\\x7F][\\x80-\\xBF]{3,}#", '?', $input);
|
Zeile 7665 | Zeile 8008 |
---|
}
if(!is_array($pm))
|
}
if(!is_array($pm))
|
{
| {
|
return false; }
| return false; }
|
Zeile 7715 | Zeile 8058 |
---|
require_once MYBB_ROOT."inc/datahandlers/pm.php";
|
require_once MYBB_ROOT."inc/datahandlers/pm.php";
|
$pmhandler = new PMDataHandler();
| $pmhandler = new PMDataHandler();
|
$subject = $pm['subject']; $message = $pm['message']; $toid = $pm['touid'];
| $subject = $pm['subject']; $message = $pm['message']; $toid = $pm['touid'];
|
Zeile 7727 | Zeile 8070 |
---|
$recipients_to = $toid; } else
|
$recipients_to = $toid; } else
|
{
| {
|
$recipients_to = array($toid);
|
$recipients_to = array($toid);
|
}
| }
|
$recipients_bcc = array();
// Determine user ID
| $recipients_bcc = array();
// Determine user ID
|
Zeile 7739 | Zeile 8082 |
---|
$fromid = (int)$mybb->user['uid']; } elseif((int)$fromid < 0)
|
$fromid = (int)$mybb->user['uid']; } elseif((int)$fromid < 0)
|
{
| {
|
$fromid = 0; }
| $fromid = 0; }
|
Zeile 7788 | Zeile 8131 |
---|
* * @param string $username The username that the user was using. * @param string $email The email address the user was using.
|
* * @param string $username The username that the user was using. * @param string $email The email address the user was using.
|
* @param string $ip_address THe IP addres of the user.
| * @param string $ip_address The IP addres of the user.
|
* @param array $data An array of extra data to go with the block (eg: confidence rating). * @return bool Whether the action was logged successfully. */
| * @param array $data An array of extra data to go with the block (eg: confidence rating). * @return bool Whether the action was logged successfully. */
|
Zeile 7804 | Zeile 8147 |
---|
if(!$ip_address) { $ip_address = get_ip();
|
if(!$ip_address) { $ip_address = get_ip();
|
$session->packedip;
| |
}
$ip_address = my_inet_pton($ip_address);
| }
$ip_address = my_inet_pton($ip_address);
|
Zeile 7814 | Zeile 8156 |
---|
'email' => $db->escape_string($email), 'ipaddress' => $db->escape_binary($ip_address), 'dateline' => (int)TIME_NOW,
|
'email' => $db->escape_string($email), 'ipaddress' => $db->escape_binary($ip_address), 'dateline' => (int)TIME_NOW,
|
'data' => $db->escape_string(@serialize($data)),
| 'data' => $db->escape_string(@my_serialize($data)),
|
);
|
);
|
return (bool)$db->insert_array('spamlog', $insert_array);
| return (bool)$db->insert_query('spamlog', $insert_array); }
/** * Copy a file to the CDN. * * @param string $file_path The path to the file to upload to the CDN. * * @param string $uploaded_path The path the file was uploaded to, reference parameter for when this may be needed. * * @return bool Whether the file was copied successfully. */ function copy_file_to_cdn($file_path = '', &$uploaded_path = null) { global $mybb, $plugins;
$success = false;
$file_path = (string)$file_path;
$real_file_path = realpath($file_path);
$file_dir_path = dirname($real_file_path); $file_dir_path = str_replace(MYBB_ROOT, '', $file_dir_path); $file_dir_path = ltrim($file_dir_path, './\\');
$file_name = basename($real_file_path);
if(file_exists($file_path)) { if($mybb->settings['usecdn'] && !empty($mybb->settings['cdnpath'])) { $cdn_path = rtrim($mybb->settings['cdnpath'], '/\\');
if(substr($file_dir_path, 0, my_strlen(MYBB_ROOT)) == MYBB_ROOT) { $file_dir_path = str_replace(MYBB_ROOT, '', $file_dir_path); }
$cdn_upload_path = $cdn_path . DIRECTORY_SEPARATOR . $file_dir_path;
if(!($dir_exists = is_dir($cdn_upload_path))) { $dir_exists = @mkdir($cdn_upload_path, 0777, true); }
if($dir_exists) { if(($cdn_upload_path = realpath($cdn_upload_path)) !== false) { $success = @copy($file_path, $cdn_upload_path.DIRECTORY_SEPARATOR.$file_name);
if($success) { $uploaded_path = $cdn_upload_path; } } } }
if(is_object($plugins)) { $hook_args = array( 'file_path' => &$file_path, 'real_file_path' => &$real_file_path, 'file_name' => &$file_name, 'uploaded_path' => &$uploaded_path, 'success' => &$success, );
$plugins->run_hooks('copy_file_to_cdn_end', $hook_args); } }
return $success;
|
}
| }
|