Zeile 581 | Zeile 581 |
---|
{ require_once MYBB_ROOT . "inc/mailhandlers/php.php"; $my_mailhandler_builtin = new PhpMail();
|
{ require_once MYBB_ROOT . "inc/mailhandlers/php.php"; $my_mailhandler_builtin = new PhpMail();
|
if(!empty($mybb->settings['mail_parameters']))
| if(!empty($mybb->config['mail_parameters']))
|
{
|
{
|
$my_mailhandler_builtin->additional_parameters = $mybb->settings['mail_parameters'];
| $my_mailhandler_builtin->additional_parameters = $mybb->config['mail_parameters'];
|
} } }
|
} } }
|
$plugins->run_hooks('my_mailhandler_builtin_after_init', $my_mailhandler_builtin);
| if(isset($plugins) && is_object($plugins)) { $plugins->run_hooks('my_mailhandler_builtin_after_init', $my_mailhandler_builtin); }
|
return $my_mailhandler_builtin; }
|
return $my_mailhandler_builtin; }
|
|
|
// If our mail handler doesn't exist, create it. if(!is_object($my_mailhandler)) { require_once MYBB_ROOT . "inc/class_mailhandler.php";
|
// If our mail handler doesn't exist, create it. if(!is_object($my_mailhandler)) { require_once MYBB_ROOT . "inc/class_mailhandler.php";
|
$plugins->run_hooks('my_mailhandler_init', $my_mailhandler);
| if(isset($plugins) && is_object($plugins)) { $plugins->run_hooks('my_mailhandler_init', $my_mailhandler); }
|
// If no plugin has ever created the mail handler, resort to use the built-in one. if(!is_object($my_mailhandler) || !($my_mailhandler instanceof MailHandler))
| // If no plugin has ever created the mail handler, resort to use the built-in one. if(!is_object($my_mailhandler) || !($my_mailhandler instanceof MailHandler))
|
Zeile 663 | Zeile 669 |
---|
'is_mail_sent' => &$is_mail_sent, 'continue_process' => &$continue_process, );
|
'is_mail_sent' => &$is_mail_sent, 'continue_process' => &$continue_process, );
|
$plugins->run_hooks('my_mail_pre_build_message', $my_mail_parameters);
| if(isset($plugins) && is_object($plugins)) { $plugins->run_hooks('my_mail_pre_build_message', $my_mail_parameters); }
|
// Build the mail message. $mail->build_message($to, $subject, $message, $from, $charset, $headers, $format, $message_text, $return_email);
|
// Build the mail message. $mail->build_message($to, $subject, $message, $from, $charset, $headers, $format, $message_text, $return_email);
|
$plugins->run_hooks('my_mail_pre_send', $my_mail_parameters);
| if(isset($plugins) && is_object($plugins)) { $plugins->run_hooks('my_mail_pre_send', $my_mail_parameters); }
|
// Check if the hooked plugins still suggest to send the mail. if($continue_process)
|
// Check if the hooked plugins still suggest to send the mail. if($continue_process)
|
{
| {
|
$is_mail_sent = $mail->send();
|
$is_mail_sent = $mail->send();
|
}
| }
|
|
|
$plugins->run_hooks('my_mail_post_send', $my_mail_parameters);
| if(isset($plugins) && is_object($plugins)) { $plugins->run_hooks('my_mail_post_send', $my_mail_parameters); }
|
return $is_mail_sent; }
| return $is_mail_sent; }
|
Zeile 856 | Zeile 871 |
---|
{ $forum_cache = cache_forums(); foreach($forum_cache as $forum)
|
{ $forum_cache = cache_forums(); foreach($forum_cache as $forum)
|
{
| {
|
if($forum['active'] != 0) { $forums_by_parent[$forum['pid']][$forum['fid']] = $forum;
| if($forum['active'] != 0) { $forums_by_parent[$forum['pid']][$forum['fid']] = $forum;
|
Zeile 1248 | Zeile 1263 |
---|
// When the second parameter is set to 1, fetch_page_url thinks it's the first page and removes it from the URL as it's unnecessary $jump_url = fetch_page_url($url, 1); eval("\$jumptopage = \"".$templates->get("multipage_jump_page")."\";");
|
// When the second parameter is set to 1, fetch_page_url thinks it's the first page and removes it from the URL as it's unnecessary $jump_url = fetch_page_url($url, 1); eval("\$jumptopage = \"".$templates->get("multipage_jump_page")."\";");
|
}
$multipage_pages = $lang->sprintf($lang->multipage_pages, $pages);
| }
$multipage_pages = $lang->sprintf($lang->multipage_pages, $pages);
|
if($breadcrumb == true) { eval("\$multipage = \"".$templates->get("multipage_breadcrumb")."\";");
| if($breadcrumb == true) { eval("\$multipage = \"".$templates->get("multipage_breadcrumb")."\";");
|
Zeile 1643 | Zeile 1658 |
---|
if(!is_array($fpermcache)) { $fpermcache = $cache->read("forumpermissions");
|
if(!is_array($fpermcache)) { $fpermcache = $cache->read("forumpermissions");
|
}
if($fid) // Fetch the permissions for a single forum
| }
if($fid) // Fetch the permissions for a single forum
|
{ if(empty($cached_forum_permissions_permissions[$gid][$fid]))
|
{ if(empty($cached_forum_permissions_permissions[$gid][$fid]))
|
{
| {
|
$cached_forum_permissions_permissions[$gid][$fid] = fetch_forum_permissions($fid, $gid, $groupperms); } return $cached_forum_permissions_permissions[$gid][$fid];
| $cached_forum_permissions_permissions[$gid][$fid] = fetch_forum_permissions($fid, $gid, $groupperms); } return $cached_forum_permissions_permissions[$gid][$fid];
|
Zeile 1658 | Zeile 1673 |
---|
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 1680 | Zeile 1695 |
---|
global $groupscache, $forum_cache, $fpermcache, $mybb, $fpermfields;
$groups = explode(",", $gid);
|
global $groupscache, $forum_cache, $fpermcache, $mybb, $fpermfields;
$groups = explode(",", $gid);
|
if(empty($fpermcache[$fid])) // This forum has no custom or inherited permissions so lets just return the group permissions { return $groupperms; }
| |
$current_permissions = array(); $only_view_own_threads = 1; $only_reply_own_threads = 1;
|
$current_permissions = array(); $only_view_own_threads = 1; $only_reply_own_threads = 1;
|
foreach($groups as $gid)
| if(empty($fpermcache[$fid])) // This forum has no custom or inherited permissions so lets just return the group permissions { $current_permissions = $groupperms; } else
|
{
|
{
|
if(!empty($groupscache[$gid]))
| foreach($groups as $gid)
|
{
|
{
|
// If our permissions arn't inherited we need to figure them out if(empty($fpermcache[$fid][$gid])) { $parents = explode(',', $forum_cache[$fid]['parentlist']); rsort($parents); if(!empty($parents)) { foreach($parents as $parent_id) { if(!empty($fpermcache[$parent_id][$gid])) { $level_permissions = $fpermcache[$parent_id][$gid]; break; } } } } else {
| // If this forum has custom or inherited permissions for the currently looped group. if(!empty($fpermcache[$fid][$gid])) {
|
$level_permissions = $fpermcache[$fid][$gid]; }
|
$level_permissions = $fpermcache[$fid][$gid]; }
|
// If we STILL don't have forum permissions we use the usergroup itself if(empty($level_permissions))
| // Or, use the group permission instead, if available. Some forum permissions not existing here will be added back later. else if(!empty($groupscache[$gid]))
|
{ $level_permissions = $groupscache[$gid];
|
{ $level_permissions = $groupscache[$gid];
|
| } // No permission is available for the currently looped group, probably we have bad data here. else { continue;
|
}
foreach($level_permissions as $permission => $access)
| }
foreach($level_permissions as $permission => $access)
|
Zeile 1738 | Zeile 1740 |
---|
if($level_permissions["canpostreplys"] && empty($level_permissions["canonlyreplyownthreads"])) { $only_reply_own_threads = 0;
|
if($level_permissions["canpostreplys"] && empty($level_permissions["canonlyreplyownthreads"])) { $only_reply_own_threads = 0;
|
}
| } }
if(count($current_permissions) == 0) { $current_permissions = $groupperms;
|
}
|
}
|
}
| }
|
// Figure out if we can view more than our own threads
|
// Figure out if we can view more than our own threads
|
if($only_view_own_threads == 0) {
| if($only_view_own_threads == 0 || !isset($current_permissions["canonlyviewownthreads"])) {
|
$current_permissions["canonlyviewownthreads"] = 0;
|
$current_permissions["canonlyviewownthreads"] = 0;
|
}
| }
|
// Figure out if we can reply more than our own threads
|
// Figure out if we can reply more than our own threads
|
if($only_reply_own_threads == 0) {
| if($only_reply_own_threads == 0 || !isset($current_permissions["canonlyreplyownthreads"])) {
|
$current_permissions["canonlyreplyownthreads"] = 0;
|
$current_permissions["canonlyreplyownthreads"] = 0;
|
}
| }
|
|
|
if(count($current_permissions) == 0) { $current_permissions = $groupperms; }
| |
return $current_permissions; }
| return $current_permissions; }
|
Zeile 1790 | Zeile 1793 |
---|
foreach($parents as $parent_id) { if($parent_id != $forum['fid'] && !forum_password_validated($forum_cache[$parent_id], true))
|
foreach($parents as $parent_id) { if($parent_id != $forum['fid'] && !forum_password_validated($forum_cache[$parent_id], true))
|
{ return false;
| { return false;
|
} } }
| } } }
|
Zeile 1803 | Zeile 1806 |
---|
$mybb->cookies['forumpass'][$forum['fid']] ) );
|
$mybb->cookies['forumpass'][$forum['fid']] ) );
|
}
/**
| }
/**
|
* Check the password given on a certain forum for validity * * @param int $fid The forum ID
| * Check the password given on a certain forum for validity * * @param int $fid The forum ID
|
Zeile 1837 | Zeile 1840 |
---|
if(!empty($parents)) { foreach($parents as $parent_id)
|
if(!empty($parents)) { foreach($parents as $parent_id)
|
{
| {
|
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 1853 | Zeile 1856 |
---|
if($forum_cache[$fid]['password'] !== '') { if(isset($mybb->input['pwverify']) && $pid == 0)
|
if($forum_cache[$fid]['password'] !== '') { if(isset($mybb->input['pwverify']) && $pid == 0)
|
{
| {
|
if(my_hash_equals($forum_cache[$fid]['password'], $mybb->get_input('pwverify'))) { my_setcookie("forumpass[$fid]", md5($mybb->user['uid'].$mybb->get_input('pwverify')), null, true);
| if(my_hash_equals($forum_cache[$fid]['password'], $mybb->get_input('pwverify'))) { my_setcookie("forumpass[$fid]", md5($mybb->user['uid'].$mybb->get_input('pwverify')), null, true);
|
Zeile 1885 | Zeile 1888 |
---|
if($return) { return $showform;
|
if($return) { return $showform;
|
}
| }
|
if($showform) {
| if($showform) {
|
Zeile 1917 | Zeile 1920 |
---|
static $modpermscache;
if($uid < 1)
|
static $modpermscache;
if($uid < 1)
|
{ $uid = $mybb->user['uid']; }
if($uid == 0) { return false;
| { $uid = $mybb->user['uid']; }
if($uid == 0) { return false;
|
}
if(isset($modpermscache[$fid][$uid]))
| }
if(isset($modpermscache[$fid][$uid]))
|
Zeile 1973 | Zeile 1976 |
---|
continue; }
|
continue; }
|
| if(!isset($perms[$action])) { $perms[$action] = $value; }
|
// Figure out the user permissions
|
// Figure out the user permissions
|
if($value == 0)
| else if($value == 0)
|
{ // The user doesn't have permission to set this action $perms[$action] = 0;
| { // The user doesn't have permission to set this action $perms[$action] = 0;
|
Zeile 2002 | Zeile 2009 |
---|
continue; }
|
continue; }
|
$perms[$action] = max($perm[$action], $perms[$action]);
| if(!isset($perms[$action])) { $perms[$action] = $value; } else { $perms[$action] = max($perm[$action], $perms[$action]); }
|
} }
|
} }
|
}
$modpermscache[$fid][$uid] = $perms;
| }
$modpermscache[$fid][$uid] = $perms;
|
return $perms; }
| return $perms; }
|
Zeile 2023 | Zeile 2037 |
---|
function is_moderator($fid=0, $action="", $uid=0) { global $mybb, $cache, $plugins;
|
function is_moderator($fid=0, $action="", $uid=0) { global $mybb, $cache, $plugins;
|
if($uid == 0)
| if($uid == 0)
|
{ $uid = $mybb->user['uid']; }
| { $uid = $mybb->user['uid']; }
|
Zeile 2055 | Zeile 2069 |
---|
{ $forumpermissions = forum_permissions($fid); if(!empty($forumpermissions['canview']) && !empty($forumpermissions['canviewthreads']) && empty($forumpermissions['canonlyviewownthreads']))
|
{ $forumpermissions = forum_permissions($fid); if(!empty($forumpermissions['canview']) && !empty($forumpermissions['canviewthreads']) && empty($forumpermissions['canonlyviewownthreads']))
|
{ return true;
| { return true;
|
} return false; }
| } return false; }
|
Zeile 2106 | Zeile 2120 |
---|
else { return false;
|
else { return false;
|
}
| }
|
} } }
| } } }
|
Zeile 2122 | Zeile 2136 |
---|
function get_moderated_fids($uid=0) { global $mybb, $cache;
|
function get_moderated_fids($uid=0) { global $mybb, $cache;
|
if($uid == 0)
| if($uid == 0)
|
{ $uid = $mybb->user['uid'];
|
{ $uid = $mybb->user['uid'];
|
}
| }
|
if($uid == 0)
|
if($uid == 0)
|
{
| {
|
return array();
|
return array();
|
}
$user_perms = user_permissions($uid);
| }
$user_perms = user_permissions($uid);
|
if($user_perms['issupermod'] == 1) { return false;
|
if($user_perms['issupermod'] == 1) { return false;
|
}
| }
|
$fids = array();
$modcache = $cache->read('moderators');
| $fids = array();
$modcache = $cache->read('moderators');
|
Zeile 2188 | Zeile 2202 |
---|
$posticons_cache = (array)$cache->read("posticons"); $posticons = array(); foreach($posticons_cache as $posticon)
|
$posticons_cache = (array)$cache->read("posticons"); $posticons = array(); foreach($posticons_cache as $posticon)
|
{
| {
|
$posticons[$posticon['name']] = $posticon; } krsort($posticons);
| $posticons[$posticon['name']] = $posticon; } krsort($posticons);
|
Zeile 2219 | Zeile 2233 |
---|
else { $posticons = '';
|
else { $posticons = '';
|
}
| }
|
return $posticons; }
| return $posticons; }
|
Zeile 2253 | Zeile 2267 |
---|
else { $expires = TIME_NOW + (int)$expires;
|
else { $expires = TIME_NOW + (int)$expires;
|
}
| }
|
$mybb->settings['cookiepath'] = str_replace(array("\n","\r"), "", $mybb->settings['cookiepath']); $mybb->settings['cookiedomain'] = str_replace(array("\n","\r"), "", $mybb->settings['cookiedomain']);
| $mybb->settings['cookiepath'] = str_replace(array("\n","\r"), "", $mybb->settings['cookiepath']); $mybb->settings['cookiedomain'] = str_replace(array("\n","\r"), "", $mybb->settings['cookiedomain']);
|
Zeile 2300 | Zeile 2314 |
---|
$mybb->cookies[$name] = $value;
header($cookie, false);
|
$mybb->cookies[$name] = $value;
header($cookie, false);
|
}
/**
| }
/**
|
* Unset a cookie set by MyBB.
|
* Unset a cookie set by MyBB.
|
*
| *
|
* @param string $name The cookie identifier. */ function my_unsetcookie($name) { global $mybb;
|
* @param string $name The cookie identifier. */ function my_unsetcookie($name) { global $mybb;
|
|
|
$expires = -3600; my_setcookie($name, "", $expires);
| $expires = -3600; my_setcookie($name, "", $expires);
|
Zeile 2319 | Zeile 2333 |
---|
/** * Get the contents from a serialised cookie array.
|
/** * Get the contents from a serialised cookie array.
|
* * @param string $name The cookie identifier.
| * * @param string $name The cookie identifier.
|
* @param int $id The cookie content id. * @return array|boolean The cookie id's content array or false when non-existent. */ function my_get_array_cookie($name, $id) { global $mybb;
|
* @param int $id The cookie content id. * @return array|boolean The cookie id's content array or false when non-existent. */ function my_get_array_cookie($name, $id) { global $mybb;
|
|
|
if(!isset($mybb->cookies['mybb'][$name]))
|
if(!isset($mybb->cookies['mybb'][$name]))
|
{
| {
|
return false; }
|
return false; }
|
$cookie = my_unserialize($mybb->cookies['mybb'][$name]);
| $cookie = my_unserialize($mybb->cookies['mybb'][$name], false);
|
if(is_array($cookie) && isset($cookie[$id])) { return $cookie[$id];
|
if(is_array($cookie) && isset($cookie[$id])) { return $cookie[$id];
|
}
| }
|
else { return 0;
| else { return 0;
|
Zeile 2354 | Zeile 2368 |
---|
* @param int|string $expires The timestamp of the expiry date. */ function my_set_array_cookie($name, $id, $value, $expires="")
|
* @param int|string $expires The timestamp of the expiry date. */ function my_set_array_cookie($name, $id, $value, $expires="")
|
{
| {
|
global $mybb;
|
global $mybb;
|
|
|
if(isset($mybb->cookies['mybb'][$name])) {
|
if(isset($mybb->cookies['mybb'][$name])) {
|
$newcookie = my_unserialize($mybb->cookies['mybb'][$name]); } else {
| $newcookie = my_unserialize($mybb->cookies['mybb'][$name], false); } else {
|
$newcookie = array();
|
$newcookie = array();
|
}
| }
|
$newcookie[$id] = $value; $newcookie = my_serialize($newcookie); my_setcookie("mybb[$name]", addslashes($newcookie), $expires);
|
$newcookie[$id] = $value; $newcookie = my_serialize($newcookie); my_setcookie("mybb[$name]", addslashes($newcookie), $expires);
|
| if(isset($mybb->cookies['mybb']) && !is_array($mybb->cookies['mybb'])) { $mybb->cookies['mybb'] = array(); }
|
// Make sure our current viarables are up-to-date as well $mybb->cookies['mybb'][$name] = $newcookie;
| // Make sure our current viarables are up-to-date as well $mybb->cookies['mybb'][$name] = $newcookie;
|
Zeile 2388 | Zeile 2407 |
---|
* - does not unserialize objects * * @param string $str
|
* - does not unserialize objects * * @param string $str
|
| * @param bool $unlimited Whether to apply limits defined in MAX_SERIALIZED_* constants
|
* @return mixed * @throw Exception if $str is malformed or contains unsupported types (e.g., resources, objects) */
|
* @return mixed * @throw Exception if $str is malformed or contains unsupported types (e.g., resources, objects) */
|
function _safe_unserialize($str)
| function _safe_unserialize($str, $unlimited = true)
|
{
|
{
|
if(strlen($str) > MAX_SERIALIZED_INPUT_LENGTH)
| if(!$unlimited && strlen($str) > MAX_SERIALIZED_INPUT_LENGTH)
|
{ // input exceeds MAX_SERIALIZED_INPUT_LENGTH return false;
| { // input exceeds MAX_SERIALIZED_INPUT_LENGTH return false;
|
Zeile 2423 | Zeile 2443 |
---|
$str = substr($str, 1); } else if($type == 'N' && $str[1] == ';')
|
$str = substr($str, 1); } else if($type == 'N' && $str[1] == ';')
|
{
| {
|
$value = null; $str = substr($str, 2); }
| $value = null; $str = substr($str, 2); }
|
Zeile 2447 | Zeile 2467 |
---|
$value = substr($matches[2], 0, (int)$matches[1]); $str = 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)
| else if( $type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches) && ($unlimited || $matches[1] < MAX_SERIALIZED_ARRAY_LENGTH) )
|
{ $expectedLength = (int)$matches[1]; $str = $matches[2];
| { $expectedLength = (int)$matches[1]; $str = $matches[2];
|
Zeile 2456 | Zeile 2480 |
---|
{ // object or unknown/malformed type return false;
|
{ // object or unknown/malformed type return false;
|
}
| }
|
switch($state) { case 3: // in array, expecting value or another array if($type == 'a') {
|
switch($state) { case 3: // in array, expecting value or another array if($type == 'a') {
|
if(count($stack) >= MAX_SERIALIZED_ARRAY_DEPTH)
| if(!$unlimited && count($stack) >= MAX_SERIALIZED_ARRAY_DEPTH)
|
{ // array nesting exceeds MAX_SERIALIZED_ARRAY_DEPTH return false;
| { // array nesting exceeds MAX_SERIALIZED_ARRAY_DEPTH return false;
|
Zeile 2472 | Zeile 2496 |
---|
$stack[] = &$list; $list[$key] = array(); $list = &$list[$key];
|
$stack[] = &$list; $list[$key] = array(); $list = &$list[$key];
|
$expected[] = $expectedLength; $state = 2; break;
| $expected[] = $expectedLength; $state = 2; break;
|
} if($type != '}') {
| } if($type != '}') {
|
Zeile 2482 | Zeile 2506 |
---|
$state = 2; break; }
|
$state = 2; break; }
|
|
|
// missing array value return false;
| // missing array value return false;
|
Zeile 2490 | Zeile 2514 |
---|
if($type == '}') { if(count($list) < end($expected))
|
if($type == '}') { if(count($list) < end($expected))
|
{
| {
|
// array size less than expected return false;
|
// array size less than expected return false;
|
}
| }
|
unset($list); $list = &$stack[count($stack)-1];
| unset($list); $list = &$stack[count($stack)-1];
|
Zeile 2507 | Zeile 2531 |
---|
break; } if($type == 'i' || $type == 's')
|
break; } if($type == 'i' || $type == 's')
|
{ if(count($list) >= MAX_SERIALIZED_ARRAY_LENGTH)
| { if(!$unlimited && count($list) >= MAX_SERIALIZED_ARRAY_LENGTH)
|
{ // array size exceeds MAX_SERIALIZED_ARRAY_LENGTH return false;
| { // array size exceeds MAX_SERIALIZED_ARRAY_LENGTH return false;
|
Zeile 2530 | Zeile 2554 |
---|
case 0: // expecting array or value if($type == 'a') {
|
case 0: // expecting array or value if($type == 'a') {
|
if(count($stack) >= MAX_SERIALIZED_ARRAY_DEPTH)
| if(!$unlimited && count($stack) >= MAX_SERIALIZED_ARRAY_DEPTH)
|
{ // array nesting exceeds MAX_SERIALIZED_ARRAY_DEPTH return false;
| { // array nesting exceeds MAX_SERIALIZED_ARRAY_DEPTH return false;
|
Zeile 2558 | Zeile 2582 |
---|
{ // trailing data in input return false;
|
{ // trailing data in input return false;
|
}
| }
|
return $data; }
/**
|
return $data; }
/**
|
* Credits go to https://github.com/piwik * Wrapper for _safe_unserialize() that handles exceptions and multibyte encoding issue
| * Credits go to https://github.com/piwik * Wrapper for _safe_unserialize() that handles exceptions and multibyte encoding issue * * @param string $str * @param bool $unlimited * @return mixed */ function my_unserialize($str, $unlimited = true) { // 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, $unlimited);
if(isset($mbIntEnc)) { mb_internal_encoding($mbIntEnc); }
return $out; }
/** * Unserializes data using PHP's `unserialize()`, and its safety options if possible. * This function should only be used for values from trusted sources.
|
* * @param string $str * @return mixed */
|
* * @param string $str * @return mixed */
|
function my_unserialize($str)
| function native_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))
| if(version_compare(PHP_VERSION, '7.0.0', '>=')) { return unserialize($str, array('allowed_classes' => false)); } else
|
{
|
{
|
$mbIntEnc = mb_internal_encoding(); mb_internal_encoding('ASCII');
| return unserialize($str);
|
}
|
}
|
$out = _safe_unserialize($str);
if(isset($mbIntEnc)) { mb_internal_encoding($mbIntEnc); }
return $out;
| |
}
/**
| }
/**
|
Zeile 2593 | Zeile 2637 |
---|
* Safe serialize() replacement * - output a strict subset of PHP's native serialized representation * - does not my_serialize objects
|
* 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)
| * @param mixed $value * @return string * @throw Exception if $value is malformed or contains unsupported types (e.g., resources, objects)
|
Zeile 2608 | Zeile 2652 |
---|
if(is_bool($value)) { return 'b:'.(int)$value.';';
|
if(is_bool($value)) { return 'b:'.(int)$value.';';
|
}
| }
|
if(is_int($value))
|
if(is_int($value))
|
{
| {
|
return 'i:'.$value.';';
|
return 'i:'.$value.';';
|
}
| }
|
if(is_float($value)) { return 'd:'.str_replace(',', '.', $value).';';
|
if(is_float($value)) { return 'd:'.str_replace(',', '.', $value).';';
|
}
| }
|
if(is_string($value)) { return 's:'.strlen($value).':"'.$value.'";';
|
if(is_string($value)) { return 's:'.strlen($value).':"'.$value.'";';
|
}
| }
|
if(is_array($value)) { $out = '';
| if(is_array($value)) { $out = '';
|
Zeile 2632 | Zeile 2676 |
---|
{ $out .= _safe_serialize($k) . _safe_serialize($v); }
|
{ $out .= _safe_serialize($k) . _safe_serialize($v); }
|
|
|
return 'a:'.count($value).':{'.$out.'}'; }
// safe_serialize cannot my_serialize resources or objects return false;
|
return 'a:'.count($value).':{'.$out.'}'; }
// safe_serialize cannot my_serialize resources or objects return false;
|
}
/**
| }
/**
|
* Credits go to https://github.com/piwik * Wrapper for _safe_serialize() that handles exceptions and multibyte encoding issue *
| * Credits go to https://github.com/piwik * Wrapper for _safe_serialize() that handles exceptions and multibyte encoding issue *
|
Zeile 2699 | Zeile 2743 |
---|
// 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) { return $lang->unknown; } }
| { if(strpos(",".$func_blacklist.",", 'exec') !== false) { return $lang->unknown; } }
|
// PHP disabled functions? if($func_blacklist = @ini_get('disable_functions')) {
| // PHP disabled functions? if($func_blacklist = @ini_get('disable_functions')) {
|
Zeile 2712 | Zeile 2756 |
---|
{ return $lang->unknown; }
|
{ return $lang->unknown; }
|
}
| }
|
$load = @exec("uptime"); $load = explode("load average: ", $load);
| $load = @exec("uptime"); $load = explode("load average: ", $load);
|
Zeile 2720 | Zeile 2764 |
---|
if(!is_array($serverload)) { return $lang->unknown;
|
if(!is_array($serverload)) { return $lang->unknown;
|
} } } else {
| } } } else {
|
return $lang->unknown; }
| return $lang->unknown; }
|
Zeile 2981 | Zeile 3025 |
---|
if($unapprovedposts_diff > -1) { $new_stats['numunapprovedposts'] = "+{$unapprovedposts_diff}";
|
if($unapprovedposts_diff > -1) { $new_stats['numunapprovedposts'] = "+{$unapprovedposts_diff}";
|
} else {
| } else {
|
$new_stats['numunapprovedposts'] = "{$unapprovedposts_diff}"; } }
| $new_stats['numunapprovedposts'] = "{$unapprovedposts_diff}"; } }
|
Zeile 2994 | Zeile 3038 |
---|
if($deletedposts_diff > -1) { $new_stats['numdeletedposts'] = "+{$deletedposts_diff}";
|
if($deletedposts_diff > -1) { $new_stats['numdeletedposts'] = "+{$deletedposts_diff}";
|
} else
| } else
|
{ $new_stats['numdeletedposts'] = "{$deletedposts_diff}"; }
| { $new_stats['numdeletedposts'] = "{$deletedposts_diff}"; }
|
Zeile 3009 | Zeile 3053 |
---|
$new_stats['numdeletedthreads'] = "+{$deletedthreads_diff}"; } else
|
$new_stats['numdeletedthreads'] = "+{$deletedthreads_diff}"; } else
|
{
| {
|
$new_stats['numdeletedthreads'] = "{$deletedthreads_diff}"; }
|
$new_stats['numdeletedthreads'] = "{$deletedthreads_diff}"; }
|
}
| }
|
if(!empty($new_stats)) { update_stats($new_stats);
| if(!empty($new_stats)) { update_stats($new_stats);
|
Zeile 3024 | Zeile 3068 |
---|
* Update the last post information for a specific forum * * @param int $fid The forum ID
|
* Update the last post information for a specific forum * * @param int $fid The forum ID
|
*/
| */
|
function update_forum_lastpost($fid) { global $db;
| function update_forum_lastpost($fid) { global $db;
|
Zeile 3081 | Zeile 3125 |
---|
// Fetch above counters for this thread $query = $db->simple_select("threads", implode(",", $counters), "tid='{$tid}'"); $thread = $db->fetch_array($query);
|
// Fetch above counters for this thread $query = $db->simple_select("threads", implode(",", $counters), "tid='{$tid}'"); $thread = $db->fetch_array($query);
|
|
|
foreach($counters as $counter) { if(array_key_exists($counter, $changes)) { if(substr($changes[$counter], 0, 2) == "+-")
|
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) == "-")
|
$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) { $update_query[$counter] = $thread[$counter] + $changes[$counter];
|
if((int)$changes[$counter] != 0) { $update_query[$counter] = $thread[$counter] + $changes[$counter];
|
} } else { $update_query[$counter] = $changes[$counter]; }
// Less than 0? That's bad if(isset($update_query[$counter]) && $update_query[$counter] < 0) { $update_query[$counter] = 0; } } }
$db->free_result($query);
| } } else { $update_query[$counter] = $changes[$counter]; }
// Less than 0? That's bad if(isset($update_query[$counter]) && $update_query[$counter] < 0) { $update_query[$counter] = 0; } } }
$db->free_result($query);
|
// 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 3126 | Zeile 3170 |
---|
* @param int $tid The thread ID */ function update_thread_data($tid)
|
* @param int $tid The thread ID */ function update_thread_data($tid)
|
{ global $db;
$thread = get_thread($tid);
| { global $db;
$thread = get_thread($tid);
|
// If this is a moved thread marker, don't update it - we need it to stay as it is if(strpos($thread['closed'], 'moved|') !== false)
| // If this is a moved thread marker, don't update it - we need it to stay as it is if(strpos($thread['closed'], 'moved|') !== false)
|
Zeile 3162 | Zeile 3206 |
---|
$db->free_result($query);
if(empty($firstpost['username']))
|
$db->free_result($query);
if(empty($firstpost['username']))
|
{
| {
|
$firstpost['username'] = $firstpost['postusername']; }
| $firstpost['username'] = $firstpost['postusername']; }
|
Zeile 3211 | Zeile 3255 |
---|
// Fetch above counters for this user $query = $db->simple_select("users", implode(",", $counters), "uid='{$uid}'"); $user = $db->fetch_array($query);
|
// Fetch above counters for this user $query = $db->simple_select("users", implode(",", $counters), "uid='{$uid}'"); $user = $db->fetch_array($query);
|
foreach($counters as $counter)
| if($user)
|
{
|
{
|
if(array_key_exists($counter, $changes))
| foreach($counters as $counter)
|
{
|
{
|
if(substr($changes[$counter], 0, 2) == "+-")
| if(array_key_exists($counter, $changes))
|
{
|
{
|
$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(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) { $update_query[$counter] = $user[$counter] + $changes[$counter]; } } else { $update_query[$counter] = $changes[$counter]; }
// Less than 0? That's bad if(isset($update_query[$counter]) && $update_query[$counter] < 0)
|
{
|
{
|
$update_query[$counter] = $user[$counter] + $changes[$counter];
| $update_query[$counter] = 0;
|
}
|
}
|
} else { $update_query[$counter] = $changes[$counter]; }
// Less than 0? That's bad if(isset($update_query[$counter]) && $update_query[$counter] < 0) { $update_query[$counter] = 0;
| |
} }
|
} }
|
}
$db->free_result($query);
| }
$db->free_result($query);
|
// 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 3252 | Zeile 3299 |
---|
/** * Deletes a thread from the database
|
/** * Deletes a thread from the database
|
*
| *
|
* @param int $tid The thread ID * @return bool */ function delete_thread($tid) { global $moderation;
|
* @param int $tid The thread ID * @return bool */ function delete_thread($tid) { 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 *
| /** * Deletes a post from the database *
|
Zeile 3283 | Zeile 3330 |
---|
{ require_once MYBB_ROOT."inc/class_moderation.php"; $moderation = new Moderation;
|
{ require_once MYBB_ROOT."inc/class_moderation.php"; $moderation = new Moderation;
|
}
| }
|
return $moderation->delete_post($pid); }
| return $moderation->delete_post($pid); }
|
Zeile 3317 | Zeile 3364 |
---|
foreach($forum_cache as $fid => $forum) { if($forum['active'] != 0)
|
foreach($forum_cache as $fid => $forum) { if($forum['active'] != 0)
|
{
| {
|
$jumpfcache[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum; } }
|
$jumpfcache[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum; } }
|
}
| }
|
if(!is_array($permissioncache)) {
| if(!is_array($permissioncache)) {
|
Zeile 3333 | Zeile 3380 |
---|
foreach($jumpfcache[$pid] as $main) { foreach($main as $forum)
|
foreach($jumpfcache[$pid] as $main) { foreach($main as $forum)
|
{
| {
|
$perms = $permissioncache[$forum['fid']];
if($forum['fid'] != "0" && ($perms['canview'] != 0 || $mybb->settings['hideprivateforums'] == 0) && $forum['linkto'] == '' && ($forum['showinjump'] != 0 || $showall == true))
| $perms = $permissioncache[$forum['fid']];
if($forum['fid'] != "0" && ($perms['canview'] != 0 || $mybb->settings['hideprivateforums'] == 0) && $forum['linkto'] == '' && ($forum['showinjump'] != 0 || $showall == true))
|
Zeile 3383 | Zeile 3430 |
---|
}
return $forumjump;
|
}
return $forumjump;
|
}
| }
|
/** * Returns the extension of a file.
| /** * Returns the extension of a file.
|
Zeile 3432 | Zeile 3479 |
---|
shuffle($str);
return implode($str);
|
shuffle($str);
return implode($str);
|
}
| }
|
/** * Formats a username based on their display group
| /** * Formats a username based on their display group
|
Zeile 3481 | Zeile 3528 |
---|
$format = $parameters['format'];
$formattednames[$username] = str_replace("{username}", $username, $format);
|
$format = $parameters['format'];
$formattednames[$username] = str_replace("{username}", $username, $format);
|
}
| }
|
return $formattednames[$username]; }
| return $formattednames[$username]; }
|
Zeile 3514 | Zeile 3561 |
---|
{ // Default avatar if(defined('IN_ADMINCP'))
|
{ // Default avatar if(defined('IN_ADMINCP'))
|
{
| {
|
$theme['imgdir'] = '../images'; }
| $theme['imgdir'] = '../images'; }
|
Zeile 3777 | Zeile 3824 |
---|
if($mybb->settings['allowsizemycode'] == 1) { $size = "size,";
|
if($mybb->settings['allowsizemycode'] == 1) { $size = "size,";
|
}
| }
|
if($mybb->settings['allowcolormycode'] == 1) {
| if($mybb->settings['allowcolormycode'] == 1) {
|
Zeile 3859 | Zeile 3906 |
---|
$query = $db->simple_select("threadsubscriptions", "tid, notification", "tid='".(int)$tid."' AND uid='".$mybb->user['uid']."'", array('limit' => 1)); $subscription = $db->fetch_array($query);
|
$query = $db->simple_select("threadsubscriptions", "tid, notification", "tid='".(int)$tid."' AND uid='".$mybb->user['uid']."'", array('limit' => 1)); $subscription = $db->fetch_array($query);
|
if(!empty($subscription) && $subscription['tid'])
| if($subscription)
|
{ $subscription_method = (int)$subscription['notification'] + 1; }
| { $subscription_method = (int)$subscription['notification'] + 1; }
|
Zeile 6026 | Zeile 6073 |
---|
LIMIT 1" ); $lastpost = $db->fetch_array($query);
|
LIMIT 1" ); $lastpost = $db->fetch_array($query);
|
| if(!$lastpost) { return false; }
|
if(empty($lastpost['username'])) {
| if(empty($lastpost['username'])) {
|
Zeile 6702 | Zeile 6754 |
---|
if(isset($thread_cache[$tid]) && !$recache) { return $thread_cache[$tid];
|
if(isset($thread_cache[$tid]) && !$recache) { return $thread_cache[$tid];
|
} else
| } else
|
{ $query = $db->simple_select("threads", "*", "tid = '{$tid}'"); $thread = $db->fetch_array($query);
| { $query = $db->simple_select("threads", "*", "tid = '{$tid}'"); $thread = $db->fetch_array($query);
|
Zeile 6771 | Zeile 6823 |
---|
}
$inactive = array();
|
}
$inactive = array();
|
|
|
foreach($forum_cache as $fid => $forum) { if($forum['active'] == 0)
| foreach($forum_cache as $fid => $forum) { if($forum['active'] == 0)
|
Zeile 6784 | Zeile 6836 |
---|
$inactive[] = $fid1; } }
|
$inactive[] = $fid1; } }
|
} }
| } }
|
$inactiveforums = implode(",", $inactive);
| $inactiveforums = implode(",", $inactive);
|
Zeile 6813 | Zeile 6865 |
---|
$attempts = $db->fetch_array($query);
if($attempts['loginattempts'] <= 0)
|
$attempts = $db->fetch_array($query);
if($attempts['loginattempts'] <= 0)
|
{ return 0; } }
| { return 0; } }
|
// This user has a cookie lockout, show waiting time elseif(!empty($mybb->cookies['lockoutexpiry']) && $mybb->cookies['lockoutexpiry'] > $now) {
| // This user has a cookie lockout, show waiting time elseif(!empty($mybb->cookies['lockoutexpiry']) && $mybb->cookies['lockoutexpiry'] > $now) {
|
Zeile 6826 | Zeile 6878 |
---|
$hoursleft = floor($secsleft / 3600); $minsleft = floor(($secsleft / 60) % 60); $secsleft = floor($secsleft % 60);
|
$hoursleft = floor($secsleft / 3600); $minsleft = floor(($secsleft / 60) % 60); $secsleft = floor($secsleft % 60);
|
|
|
error($lang->sprintf($lang->failed_login_wait, $hoursleft, $minsleft, $secsleft)); }
return false;
|
error($lang->sprintf($lang->failed_login_wait, $hoursleft, $minsleft, $secsleft)); }
return false;
|
}
| }
|
if($mybb->settings['failedlogincount'] > 0 && isset($attempts['loginattempts']) && $attempts['loginattempts'] >= $mybb->settings['failedlogincount']) {
| if($mybb->settings['failedlogincount'] > 0 && isset($attempts['loginattempts']) && $attempts['loginattempts'] >= $mybb->settings['failedlogincount']) {
|
Zeile 6930 | Zeile 6982 |
---|
$query = $db->simple_select("users", "COUNT(email) as emails", "email = '".$db->escape_string($email)."'{$uid_string}");
if($db->fetch_field($query, "emails") > 0)
|
$query = $db->simple_select("users", "COUNT(email) as emails", "email = '".$db->escape_string($email)."'{$uid_string}");
if($db->fetch_field($query, "emails") > 0)
|
{ return true; }
return false; }
| { return true; }
return false; }
|
/** * Rebuilds settings.php *
| /** * Rebuilds settings.php *
|
Zeile 6985 | Zeile 7037 |
---|
if(is_array($terms)) { $terms = implode(' ', $terms);
|
if(is_array($terms)) { $terms = implode(' ', $terms);
|
}
| }
|
// Strip out any characters that shouldn't be included $bad_characters = array( "(",
| // Strip out any characters that shouldn't be included $bad_characters = array( "(",
|
Zeile 6996 | Zeile 7048 |
---|
"~" ); $terms = str_replace($bad_characters, '', $terms);
|
"~" ); $terms = str_replace($bad_characters, '', $terms);
|
| $words = array();
|
// Check if this is a "series of words" - should be treated as an EXACT match if(my_strpos($terms, "\"") !== false) { $inquote = false; $terms = explode("\"", $terms);
|
// Check if this is a "series of words" - should be treated as an EXACT match if(my_strpos($terms, "\"") !== false) { $inquote = false; $terms = explode("\"", $terms);
|
$words = array();
| |
foreach($terms as $phrase) { $phrase = htmlspecialchars_uni($phrase);
| foreach($terms as $phrase) { $phrase = htmlspecialchars_uni($phrase);
|
Zeile 7049 | Zeile 7101 |
---|
} } }
|
} } }
|
if(!is_array($words)) { return false; }
|
|
// Sort the word array by length. Largest terms go first and work their way down to the smallest term. // This resolves problems like "test tes" where "tes" will be highlighted first, then "test" can't be highlighted because of the changed html usort($words, 'build_highlight_array_sort');
|
// Sort the word array by length. Largest terms go first and work their way down to the smallest term. // This resolves problems like "test tes" where "tes" will be highlighted first, then "test" can't be highlighted because of the changed html usort($words, 'build_highlight_array_sort');
|
| $highlight_cache = array();
|
// Loop through our words to build the PREG compatible strings foreach($words as $word) {
| // Loop through our words to build the PREG compatible strings foreach($words as $word) {
|
Zeile 7068 | Zeile 7117 |
---|
// Special boolean operators should be stripped if($word == "" || $word == "or" || $word == "not" || $word == "and")
|
// Special boolean operators should be stripped if($word == "" || $word == "or" || $word == "not" || $word == "and")
|
{ continue; }
| { continue; }
|
// Now make PREG compatible
|
// Now make PREG compatible
|
$find = "#(?!<.*?)(".preg_quote($word, "#").")(?![^<>]*?>)#ui"; $replacement = "<span class=\"highlight\" style=\"padding-left: 0px; padding-right: 0px;\">$1</span>";
| $find = "/(?<!&|&#)\b([[:alnum:]]*)(".preg_quote($word, "/").")(?![^<>]*?>)/ui"; $replacement = "$1<span class=\"highlight\" style=\"padding-left: 0px; padding-right: 0px;\">$2</span>";
|
$highlight_cache[$find] = $replacement; }
|
$highlight_cache[$find] = $replacement; }
|
|
|
return $highlight_cache; }
| return $highlight_cache; }
|
Zeile 7089 | Zeile 7138 |
---|
* @return integer Result of comparison function. */ function build_highlight_array_sort($a, $b)
|
* @return integer Result of comparison function. */ function build_highlight_array_sort($a, $b)
|
{
| {
|
return strlen($b) - strlen($a); }
| return strlen($b) - strlen($a); }
|
Zeile 7105 | Zeile 7154 |
---|
$dest = '';
if($src < 0)
|
$dest = '';
if($src < 0)
|
{
| {
|
return false; } elseif($src <= 0x007f)
| return false; } elseif($src <= 0x007f)
|
Zeile 7122 | Zeile 7171 |
---|
$dest .= chr(0xe0 | ($src >> 12)); $dest .= chr(0x80 | (($src >> 6) & 0x003f)); $dest .= chr(0x80 | ($src & 0x003f));
|
$dest .= chr(0xe0 | ($src >> 12)); $dest .= chr(0x80 | (($src >> 6) & 0x003f)); $dest .= chr(0x80 | ($src & 0x003f));
|
}
| }
|
elseif($src <= 0x10ffff) { $dest .= chr(0xf0 | ($src >> 18)); $dest .= chr(0x80 | (($src >> 12) & 0x3f)); $dest .= chr(0x80 | (($src >> 6) & 0x3f)); $dest .= chr(0x80 | ($src & 0x3f));
|
elseif($src <= 0x10ffff) { $dest .= chr(0xf0 | ($src >> 18)); $dest .= chr(0x80 | (($src >> 12) & 0x3f)); $dest .= chr(0x80 | (($src >> 6) & 0x3f)); $dest .= chr(0x80 | ($src & 0x3f));
|
}
| }
|
else { // Out of range return false; }
|
else { // Out of range return false; }
|
|
|
return $dest;
|
return $dest;
|
}
| }
|
/** * Checks if a username has been disallowed for registration/use. *
| /** * Checks if a username has been disallowed for registration/use. *
|
Zeile 7155 | Zeile 7204 |
---|
// Make regular expression * match $banned_username['filter'] = str_replace('\*', '(.*)', preg_quote($banned_username['filter'], '#')); if(preg_match("#(^|\b){$banned_username['filter']}($|\b)#i", $username))
|
// Make regular expression * match $banned_username['filter'] = str_replace('\*', '(.*)', preg_quote($banned_username['filter'], '#')); if(preg_match("#(^|\b){$banned_username['filter']}($|\b)#i", $username))
|
{
| {
|
// Updating last use if($update_lastuse == true) {
| // Updating last use if($update_lastuse == true) {
|
Zeile 7203 | Zeile 7252 |
---|
$db->update_query("banfilters", array("lastuse" => TIME_NOW), "fid='{$banned_email['fid']}'"); } return true;
|
$db->update_query("banfilters", array("lastuse" => TIME_NOW), "fid='{$banned_email['fid']}'"); } return true;
|
} }
| } }
|
}
// Still here - good email
| }
// Still here - good email
|
Zeile 7466 | Zeile 7515 |
---|
{ $curlopt[CURLOPT_SSL_VERIFYPEER] = 1; $curlopt[CURLOPT_CAINFO] = $ca_bundle_path;
|
{ $curlopt[CURLOPT_SSL_VERIFYPEER] = 1; $curlopt[CURLOPT_CAINFO] = $ca_bundle_path;
|
} else
| } else
|
{ $curlopt[CURLOPT_SSL_VERIFYPEER] = 0; }
| { $curlopt[CURLOPT_SSL_VERIFYPEER] = 0; }
|
Zeile 7730 | Zeile 7779 |
---|
* Checks if a user is a member of a particular group * Originates from frostschutz's PluginLibrary * github.com/frostschutz
|
* Checks if a user is a member of a particular group * Originates from frostschutz's PluginLibrary * github.com/frostschutz
|
*
| *
|
* @param array|int|string A selection of groups (as array or comma seperated) to check or -1 for any group * @param bool|array|int False assumes the current user. Otherwise an user array or an id can be passed * @return array Array of groups specified in the first param to which the user belongs
| * @param array|int|string A selection of groups (as array or comma seperated) to check or -1 for any group * @param bool|array|int False assumes the current user. Otherwise an user array or an id can be passed * @return array Array of groups specified in the first param to which the user belongs
|
Zeile 7991 | Zeile 8040 |
---|
$result = chmod($file, octdec($mode)); umask($old_umask); return $result;
|
$result = chmod($file, octdec($mode)); umask($old_umask); return $result;
|
}
/**
| }
/**
|
* Custom rmdir function to loop through an entire directory and delete all files/folders within * * @param string $path The path to the directory
| * Custom rmdir function to loop through an entire directory and delete all files/folders within * * @param string $path The path to the directory
|
Zeile 8010 | Zeile 8059 |
---|
}
if(@is_dir($path) && !@is_link($path))
|
}
if(@is_dir($path) && !@is_link($path))
|
{
| {
|
if($dh = @opendir($path)) { while(($file = @readdir($dh)) !== false)
| if($dh = @opendir($path)) { while(($file = @readdir($dh)) !== false)
|
Zeile 8076 | Zeile 8125 |
---|
}
if($ip_long >= 2147483648) // Won't occur on 32-bit PHP
|
}
if($ip_long >= 2147483648) // Won't occur on 32-bit PHP
|
{
| {
|
$ip_long -= 4294967296; }
| $ip_long -= 4294967296; }
|
Zeile 8092 | Zeile 8141 |
---|
* @return string IP in IPv4 format */ function my_long2ip($long)
|
* @return string IP in IPv4 format */ function my_long2ip($long)
|
{
| {
|
// On 64-bit machines is_int will return true. On 32-bit it will return false if($long < 0 && is_int(2147483648)) {
| // On 64-bit machines is_int will return true. On 32-bit it will return false if($long < 0 && is_int(2147483648)) {
|
Zeile 8124 | Zeile 8173 |
---|
* @license LGPL - http://www.gnu.org/licenses/lgpl.html * @copyright 2004-2007 Aidan Lister <aidan@php.net>, Arpad Ray <arpad@php.net> * @link http://php.net/inet_pton
|
* @license LGPL - http://www.gnu.org/licenses/lgpl.html * @copyright 2004-2007 Aidan Lister <aidan@php.net>, Arpad Ray <arpad@php.net> * @link http://php.net/inet_pton
|
* @author Arpad Ray <arpad@php.net> * @version $Revision: 269597 $
| * @author Arpad Ray <arpad@php.net> * @version $Revision: 269597 $
|
*/ $r = ip2long($ip); if($r !== false && $r != -1) { return pack('N', $r);
|
*/ $r = ip2long($ip); if($r !== false && $r != -1) { return pack('N', $r);
|
}
| }
|
$delim_count = substr_count($ip, ':'); if($delim_count < 1 || $delim_count > 7) {
| $delim_count = substr_count($ip, ':'); if($delim_count < 1 || $delim_count > 7) {
|
Zeile 8142 | Zeile 8191 |
---|
$r = explode(':', $ip); $rcount = count($r); if(($doub = array_search('', $r, 1)) !== false)
|
$r = explode(':', $ip); $rcount = count($r); if(($doub = array_search('', $r, 1)) !== false)
|
{
| {
|
$length = (!$doub || $doub == $rcount - 1 ? 2 : 1); array_splice($r, $doub, $length, array_fill(0, 8 + $length - $rcount, 0)); }
| $length = (!$doub || $doub == $rcount - 1 ? 2 : 1); array_splice($r, $doub, $length, array_fill(0, 8 + $length - $rcount, 0)); }
|
Zeile 8207 | Zeile 8256 |
---|
{ // Wildcard if(strpos($ipaddress, '*') !== false)
|
{ // Wildcard if(strpos($ipaddress, '*') !== false)
|
{
| {
|
if(strpos($ipaddress, ':') !== false) { // IPv6
| if(strpos($ipaddress, ':') !== false) { // IPv6
|
Zeile 8255 | Zeile 8304 |
---|
{ // Invalid IP address return false;
|
{ // Invalid IP address return false;
|
} }
| } }
|
/** * Taken from: https://github.com/NewEraCracker/php_work/blob/master/ipRangeCalculate.php
| /** * Taken from: https://github.com/NewEraCracker/php_work/blob/master/ipRangeCalculate.php
|
Zeile 8516 | Zeile 8565 |
---|
if ($crypto_strong == false) { $output = null;
|
if ($crypto_strong == false) { $output = null;
|
} } } }
| } } } }
|
else { return $output;
| else { return $output;
|
Zeile 8548 | Zeile 8597 |
---|
if(strlen($output) < $bytes) { // Close to what PHP basically uses internally to seed, but not quite.
|
if(strlen($output) < $bytes) { // Close to what PHP basically uses internally to seed, but not quite.
|
$unique_state = microtime().@getmypid();
| $unique_state = microtime().@getmypid();
|
$rounds = ceil($bytes / 16);
| $rounds = ceil($bytes / 16);
|
Zeile 8565 | Zeile 8614 |
---|
return $output; } else
|
return $output; } else
|
{
| {
|
return $output; } }
| return $output; } }
|
Zeile 8578 | Zeile 8627 |
---|
function secure_seed_rng() { $bytes = PHP_INT_SIZE;
|
function secure_seed_rng() { $bytes = PHP_INT_SIZE;
|
|
|
do
|
do
|
{
| {
|
$output = secure_binary_seed_rng($bytes);
|
$output = secure_binary_seed_rng($bytes);
|
|
|
// convert binary data to a decimal number if ($bytes == 4)
|
// convert binary data to a decimal number if ($bytes == 4)
|
{
| {
|
$elements = unpack('i', $output); $output = abs($elements[1]); }
| $elements = unpack('i', $output); $output = abs($elements[1]); }
|
Zeile 8594 | Zeile 8643 |
---|
{ $elements = unpack('N2', $output); $output = abs($elements[1] << 32 | $elements[2]);
|
{ $elements = unpack('N2', $output); $output = abs($elements[1] << 32 | $elements[2]);
|
}
} while($output > PHP_INT_MAX);
| }
} while($output > PHP_INT_MAX);
|
return $output; }
| return $output; }
|
Zeile 8614 | Zeile 8663 |
---|
{ $min = 0; $max = PHP_INT_MAX;
|
{ $min = 0; $max = PHP_INT_MAX;
|
}
| }
|
if(version_compare(PHP_VERSION, '7.0', '>=')) {
| if(version_compare(PHP_VERSION, '7.0', '>=')) {
|
Zeile 8647 | Zeile 8696 |
---|
function trim_blank_chrs($string, $charlist="") { $hex_chrs = array(
|
function trim_blank_chrs($string, $charlist="") { $hex_chrs = array(
|
0x09 => 1, // \x{0009} 0x0A => 1, // \x{000A} 0x0B => 1, // \x{000B} 0x0D => 1, // \x{000D} 0x20 => 1, // \x{0020}
| 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}
| 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}
|
Zeile 8714 | Zeile 8763 |
---|
{ // Check to see if we have matched a first character in our utf-8 array $offset = match_sequence($string, $hex_chrs);
|
{ // Check to see if we have matched a first character in our utf-8 array $offset = match_sequence($string, $hex_chrs);
|
if(!$offset) { // If not, then we must have a "good" character and we don't need to do anymore processing break;
| if(!$offset) { // If not, then we must have a "good" character and we don't need to do anymore processing break;
|
} $string = substr($string, $offset); }
| } $string = substr($string, $offset); }
|
Zeile 8766 | Zeile 8815 |
---|
if($string === "") { return 0;
|
if($string === "") { return 0;
|
}
| }
|
$ord = ord($string[$i]); if(array_key_exists($ord, $array))
| $ord = ord($string[$i]); if(array_key_exists($ord, $array))
|
Zeile 8782 | Zeile 8831 |
---|
}
return 0;
|
}
return 0;
|
}
| }
|
/** * Obtain the version of GD installed.
| /** * Obtain the version of GD installed.
|
Zeile 9001 | Zeile 9050 |
---|
} }
|
} }
|
if(!$pm['subject'] ||!$pm['message'] || !$pm['touid'] || (!$pm['receivepms'] && !$admin_override))
| if(empty($pm['subject']) || empty($pm['message']) || empty($pm['touid']) || (empty($pm['receivepms']) && !$admin_override))
|
{ return false; }
| { return false; }
|
Zeile 9025 | Zeile 9074 |
---|
}
$recipients_bcc = array();
|
}
$recipients_bcc = array();
|
| // Workaround for eliminating PHP warnings in PHP 8. Ref: https://github.com/mybb/mybb/issues/4630#issuecomment-1369144163 if(isset($pm['sender']['uid']) && $pm['sender']['uid'] === -1 && $fromid === -1) { $sender = array( "uid" => 0, "username" => '' ); }
|
// Determine user ID if((int)$fromid == 0)
|
// Determine user ID if((int)$fromid == 0)
|
{
| {
|
$fromid = (int)$mybb->user['uid']; } elseif((int)$fromid < 0)
| $fromid = (int)$mybb->user['uid']; } elseif((int)$fromid < 0)
|
Zeile 9047 | Zeile 9105 |
---|
"do" => '', "pmid" => '' );
|
"do" => '', "pmid" => '' );
|
| // (continued) Workaround for eliminating PHP warnings in PHP 8. Ref: https://github.com/mybb/mybb/issues/4630#issuecomment-1369144163 if(isset($sender)) { $pm['sender'] = $sender; }
|
if(isset($session)) {
| if(isset($session)) {
|