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 905 | Zeile 920 |
---|
// Send our headers. @header("Content-type: application/json; charset={$lang->settings['charset']}"); echo json_encode(array("errors" => array($error)));
|
// Send our headers. @header("Content-type: application/json; charset={$lang->settings['charset']}"); echo json_encode(array("errors" => array($error)));
|
exit; }
| exit; }
|
if(!$title) { $title = $mybb->settings['bbname']; }
|
if(!$title) { $title = $mybb->settings['bbname']; }
|
|
|
$timenow = my_date('relative', TIME_NOW); reset_breadcrumb(); add_breadcrumb($lang->error);
|
$timenow = my_date('relative', TIME_NOW); reset_breadcrumb(); add_breadcrumb($lang->error);
|
|
|
eval("\$errorpage = \"".$templates->get("error")."\";"); output_page($errorpage);
exit;
|
eval("\$errorpage = \"".$templates->get("error")."\";"); output_page($errorpage);
exit;
|
}
| }
|
/** * Produce an error message for displaying inline on a page *
| /** * Produce an error message for displaying inline on a page *
|
Zeile 938 | Zeile 953 |
---|
if(!$title) { $title = $lang->please_correct_errors;
|
if(!$title) { $title = $lang->please_correct_errors;
|
}
| }
|
if(!is_array($errors)) { $errors = array($errors);
| if(!is_array($errors)) { $errors = array($errors);
|
Zeile 988 | Zeile 1003 |
---|
"nopermission" => '1', "location1" => 0, "location2" => 0
|
"nopermission" => '1', "location1" => 0, "location2" => 0
|
);
| );
|
$db->update_query("sessions", $noperm_array, "sid='{$session->sid}'");
| $db->update_query("sessions", $noperm_array, "sid='{$session->sid}'");
|
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 1515 | Zeile 1530 |
---|
{ $usergroup[$perm] = $access; }
|
{ $usergroup[$perm] = $access; }
|
}
| }
|
}
// No switch controls this permission, or permission needs an update.
| }
// No switch controls this permission, or permission needs an update.
|
Zeile 1578 | Zeile 1593 |
---|
if(!is_array($groupscache)) { $groupscache = $cache->read("usergroups");
|
if(!is_array($groupscache)) { $groupscache = $cache->read("usergroups");
|
}
| }
|
$displaygroup = array(); $group = $groupscache[$gid];
| $displaygroup = array(); $group = $groupscache[$gid];
|
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])) { $cached_forum_permissions_permissions[$gid][$fid] = fetch_forum_permissions($fid, $gid, $groupperms);
| if(empty($cached_forum_permissions_permissions[$gid][$fid])) { $cached_forum_permissions_permissions[$gid][$fid] = fetch_forum_permissions($fid, $gid, $groupperms);
|
Zeile 1654 | Zeile 1669 |
---|
return $cached_forum_permissions_permissions[$gid][$fid]; } else
|
return $cached_forum_permissions_permissions[$gid][$fid]; } else
|
{
| {
|
if(empty($cached_forum_permissions[$gid])) { foreach($forum_cache as $forum)
| if(empty($cached_forum_permissions[$gid])) { foreach($forum_cache as $forum)
|
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) { if(empty($current_permissions[$permission]) || $access >= $current_permissions[$permission] || ($access == "yes" && $current_permissions[$permission] == "no"))
| foreach($level_permissions as $permission => $access) { if(empty($current_permissions[$permission]) || $access >= $current_permissions[$permission] || ($access == "yes" && $current_permissions[$permission] == "no"))
|
Zeile 1731 | Zeile 1733 |
---|
}
if($level_permissions["canview"] && empty($level_permissions["canonlyviewownthreads"]))
|
}
if($level_permissions["canview"] && empty($level_permissions["canonlyviewownthreads"]))
|
{
| {
|
$only_view_own_threads = 0;
|
$only_view_own_threads = 0;
|
}
| }
|
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 1855 | Zeile 1858 |
---|
if(isset($mybb->input['pwverify']) && $pid == 0) { if(my_hash_equals($forum_cache[$fid]['password'], $mybb->get_input('pwverify')))
|
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); $showform = false;
|
my_setcookie("forumpass[$fid]", md5($mybb->user['uid'].$mybb->get_input('pwverify')), null, true); $showform = false;
|
}
| }
|
else { eval("\$pwnote = \"".$templates->get("forumdisplay_password_wrongpass")."\";");
|
else { eval("\$pwnote = \"".$templates->get("forumdisplay_password_wrongpass")."\";");
|
$showform = true; } } else {
| $showform = true; } } else {
|
if(!forum_password_validated($forum_cache[$fid]))
|
if(!forum_password_validated($forum_cache[$fid]))
|
{
| {
|
$showform = true; } else
| $showform = true; } else
|
Zeile 1878 | Zeile 1881 |
---|
} } else
|
} } else
|
{
| {
|
$showform = false;
|
$showform = false;
|
}
| }
|
if($return)
|
if($return)
|
{
| {
|
return $showform; }
if($showform) { if($pid)
|
return $showform; }
if($showform) { if($pid)
|
{
| {
|
header("Location: ".$mybb->settings['bburl']."/".get_forum_link($fid)); } else
| header("Location: ".$mybb->settings['bburl']."/".get_forum_link($fid)); } else
|
Zeile 1924 | Zeile 1927 |
---|
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 1949 | Zeile 1952 |
---|
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) { if(empty($forum) || !is_array($forum) || !in_array($forumid, $parentslist))
|
foreach($mod_cache as $forumid => $forum) { if(empty($forum) || !is_array($forum) || !in_array($forumid, $parentslist))
|
{
| {
|
// No perms or we're not after this forum continue; }
| // No perms or we're not after this forum continue; }
|
Zeile 1966 | Zeile 1969 |
---|
if(!empty($forum['users'][$uid])) { $perm = $forum['users'][$uid];
|
if(!empty($forum['users'][$uid])) { $perm = $forum['users'][$uid];
|
foreach($perm as $action => $value)
| foreach($perm as $action => $value)
|
{ if(strpos($action, "can") === false)
|
{ if(strpos($action, "can") === false)
|
{
| {
|
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;
|
} else
| } else
|
{ $perms[$action] = max($perm[$action], $perms[$action]); }
| { $perms[$action] = max($perm[$action], $perms[$action]); }
|
Zeile 1991 | Zeile 1998 |
---|
if(empty($forum['usergroups'][$group]) || !is_array($forum['usergroups'][$group])) { // There are no permissions set for this group
|
if(empty($forum['usergroups'][$group]) || !is_array($forum['usergroups'][$group])) { // There are no permissions set for this group
|
continue;
| continue;
|
}
|
}
|
|
|
$perm = $forum['usergroups'][$group]; foreach($perm as $action => $value) { if(strpos($action, "can") === false)
|
$perm = $forum['usergroups'][$group]; foreach($perm as $action => $value) { if(strpos($action, "can") === false)
|
{
| {
|
continue;
|
continue;
|
}
| }
|
|
|
$perms[$action] = max($perm[$action], $perms[$action]);
| if(!isset($perms[$action])) { $perms[$action] = $value; } else { $perms[$action] = max($perm[$action], $perms[$action]); }
|
} } }
| } } }
|
Zeile 2027 | Zeile 2041 |
---|
if($uid == 0) { $uid = $mybb->user['uid'];
|
if($uid == 0) { $uid = $mybb->user['uid'];
|
}
| }
|
if($uid == 0) { return false;
| if($uid == 0) { return false;
|
Zeile 2052 | Zeile 2066 |
---|
if(!empty($user_perms['issupermod']) && $user_perms['issupermod'] == 1) { if($fid)
|
if(!empty($user_perms['issupermod']) && $user_perms['issupermod'] == 1) { if($fid)
|
{
| {
|
$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'])) {
|
Zeile 2065 | Zeile 2079 |
---|
else { if(!$fid)
|
else { if(!$fid)
|
{
| {
|
$modcache = $cache->read('moderators'); if(!empty($modcache)) {
| $modcache = $cache->read('moderators'); if(!empty($modcache)) {
|
Zeile 2074 | Zeile 2088 |
---|
if(isset($modusers['users'][$uid]) && $modusers['users'][$uid]['mid'] && (!$action || !empty($modusers['users'][$uid][$action]))) { return true;
|
if(isset($modusers['users'][$uid]) && $modusers['users'][$uid]['mid'] && (!$action || !empty($modusers['users'][$uid][$action]))) { return true;
|
}
$groups = explode(',', $user_perms['all_usergroups']);
| }
$groups = explode(',', $user_perms['all_usergroups']);
|
foreach($groups as $group) { if(trim($group) != '' && isset($modusers['usergroups'][$group]) && (!$action || !empty($modusers['usergroups'][$group][$action])))
| foreach($groups as $group) { if(trim($group) != '' && isset($modusers['usergroups'][$group]) && (!$action || !empty($modusers['usergroups'][$group][$action])))
|
Zeile 2126 | Zeile 2140 |
---|
if($uid == 0) { $uid = $mybb->user['uid'];
|
if($uid == 0) { $uid = $mybb->user['uid'];
|
}
| }
|
if($uid == 0) {
| if($uid == 0) {
|
Zeile 2150 | Zeile 2164 |
---|
foreach($modcache as $fid => $forum) { if(isset($forum['users'][$uid]) && $forum['users'][$uid]['mid'])
|
foreach($modcache as $fid => $forum) { if(isset($forum['users'][$uid]) && $forum['users'][$uid]['mid'])
|
{
| {
|
$fids[] = $fid; continue; }
| $fids[] = $fid; continue; }
|
Zeile 2162 | Zeile 2176 |
---|
$fids[] = $fid; } }
|
$fids[] = $fid; } }
|
} }
| } }
|
return $fids; }
| return $fids; }
|
Zeile 2210 | Zeile 2224 |
---|
}
eval("\$iconlist .= \"".$templates->get("posticons_icon")."\";");
|
}
eval("\$iconlist .= \"".$templates->get("posticons_icon")."\";");
|
}
| }
|
if(!empty($iconlist))
|
if(!empty($iconlist))
|
{
| {
|
eval("\$posticons = \"".$templates->get("posticons")."\";"); } else
| eval("\$posticons = \"".$templates->get("posticons")."\";"); } else
|
Zeile 2223 | Zeile 2237 |
---|
return $posticons; }
|
return $posticons; }
|
|
|
/** * MyBB setcookie() wrapper. *
| /** * MyBB setcookie() wrapper. *
|
Zeile 2247 | Zeile 2261 |
---|
$expires = 0; } elseif($expires == "" || $expires == null)
|
$expires = 0; } elseif($expires == "" || $expires == null)
|
{
| {
|
$expires = TIME_NOW + (60*60*24*365); // Make the cookie expire in a years time } else
| $expires = TIME_NOW + (60*60*24*365); // Make the cookie expire in a years time } else
|
Zeile 2333 | Zeile 2347 |
---|
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])) {
| if(is_array($cookie) && isset($cookie[$id])) {
|
Zeile 2359 | Zeile 2373 |
---|
if(isset($mybb->cookies['mybb'][$name])) {
|
if(isset($mybb->cookies['mybb'][$name])) {
|
$newcookie = my_unserialize($mybb->cookies['mybb'][$name]);
| $newcookie = my_unserialize($mybb->cookies['mybb'][$name], false);
|
} else {
| } else {
|
Zeile 2369 | Zeile 2383 |
---|
$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; }
if(empty($str) || !is_string($str))
|
{ // input exceeds MAX_SERIALIZED_INPUT_LENGTH return false; }
if(empty($str) || !is_string($str))
|
{
| {
|
return false; }
| return false; }
|
Zeile 2428 | Zeile 2448 |
---|
$str = substr($str, 2); } else if($type == 'b' && preg_match('/^b:([01]);/', $str, $matches))
|
$str = substr($str, 2); } else if($type == 'b' && preg_match('/^b:([01]);/', $str, $matches))
|
{
| {
|
$value = $matches[1] == '1' ? true : false; $str = substr($str, 4); }
| $value = $matches[1] == '1' ? true : false; $str = substr($str, 4); }
|
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 2463 | Zeile 2487 |
---|
case 3: // in array, expecting value or another array if($type == 'a') {
|
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 2508 | Zeile 2532 |
---|
} if($type == 'i' || $type == 's') {
|
} 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 2567 | Zeile 2591 |
---|
* Wrapper for _safe_unserialize() that handles exceptions and multibyte encoding issue * * @param string $str
|
* Wrapper for _safe_unserialize() that handles exceptions and multibyte encoding issue * * @param string $str
|
| * @param bool $unlimited
|
* @return mixed */
|
* @return mixed */
|
function my_unserialize($str)
| 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))
| { // 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))
|
Zeile 2578 | Zeile 2603 |
---|
mb_internal_encoding('ASCII'); }
|
mb_internal_encoding('ASCII'); }
|
$out = _safe_unserialize($str);
| $out = _safe_unserialize($str, $unlimited);
|
if(isset($mbIntEnc)) {
| if(isset($mbIntEnc)) {
|
Zeile 3777 | Zeile 3802 |
---|
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 6026 | Zeile 6051 |
---|
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 6732 |
---|
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 6801 |
---|
}
$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 6814 |
---|
$inactive[] = $fid1; } }
|
$inactive[] = $fid1; } }
|
} }
| } }
|
$inactiveforums = implode(",", $inactive);
| $inactiveforums = implode(",", $inactive);
|
Zeile 6813 | Zeile 6843 |
---|
$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 6856 |
---|
$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 6960 |
---|
$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 * */ function rebuild_settings() { global $db, $mybb;
|
* Rebuilds settings.php * */ function rebuild_settings() { global $db, $mybb;
|
|
|
$query = $db->simple_select("settings", "value, name", "", array( 'order_by' => 'title', 'order_dir' => 'ASC',
| $query = $db->simple_select("settings", "value, name", "", array( 'order_by' => 'title', 'order_dir' => 'ASC',
|
Zeile 6954 | Zeile 6984 |
---|
while($setting = $db->fetch_array($query)) { $mybb->settings[$setting['name']] = $setting['value'];
|
while($setting = $db->fetch_array($query)) { $mybb->settings[$setting['name']] = $setting['value'];
|
|
|
$setting['name'] = addcslashes($setting['name'], "\\'"); $setting['value'] = addcslashes($setting['value'], '\\"$'); $settings .= "\$settings['{$setting['name']}'] = \"{$setting['value']}\";\n";
| $setting['name'] = addcslashes($setting['name'], "\\'"); $setting['value'] = addcslashes($setting['value'], '\\"$'); $settings .= "\$settings['{$setting['name']}'] = \"{$setting['value']}\";\n";
|
Zeile 7068 | Zeile 7098 |
---|
// 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; }
|
Zeile 7137 | Zeile 7167 |
---|
}
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 7187 | Zeile 7217 |
---|
$cache->update_bannedemails(); $banned_cache = $cache->read("bannedemails"); }
|
$cache->update_bannedemails(); $banned_cache = $cache->read("bannedemails"); }
|
|
|
if(is_array($banned_cache) && !empty($banned_cache)) { foreach($banned_cache as $banned_email)
| if(is_array($banned_cache) && !empty($banned_cache)) { foreach($banned_cache as $banned_email)
|
Zeile 7203 | Zeile 7233 |
---|
$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;
|
}
| }
|
} }
| } }
|
Zeile 7466 | Zeile 7496 |
---|
{ $curlopt[CURLOPT_SSL_VERIFYPEER] = 1; $curlopt[CURLOPT_CAINFO] = $ca_bundle_path;
|
{ $curlopt[CURLOPT_SSL_VERIFYPEER] = 1; $curlopt[CURLOPT_CAINFO] = $ca_bundle_path;
|
}
| }
|
else { $curlopt[CURLOPT_SSL_VERIFYPEER] = 0;
| else { $curlopt[CURLOPT_SSL_VERIFYPEER] = 0;
|
Zeile 7861 | Zeile 7891 |
---|
}
if(strpos($ip, ".*") === false)
|
}
if(strpos($ip, ".*") === false)
|
{
| {
|
$ip = str_replace("*", "", $ip); if(count($ip_bits) == 4) {
| $ip = str_replace("*", "", $ip); if(count($ip_bits) == 4) {
|
Zeile 7891 | Zeile 7921 |
---|
$sep = "."; } return array(ip2long($ip_string1), ip2long($ip_string2));
|
$sep = "."; } return array(ip2long($ip_string1), ip2long($ip_string2));
|
} }
| } }
|
/** * Fetch a list of ban times for a user account. *
| /** * Fetch a list of ban times for a user account. *
|
Zeile 7925 | Zeile 7955 |
---|
);
$ban_times = $plugins->run_hooks("functions_fetch_ban_times", $ban_times);
|
);
$ban_times = $plugins->run_hooks("functions_fetch_ban_times", $ban_times);
|
|
|
$ban_times['---'] = $lang->permanent; return $ban_times; }
| $ban_times['---'] = $lang->permanent; return $ban_times; }
|
Zeile 7942 | Zeile 7972 |
---|
if($stamp == 0) { $stamp = TIME_NOW;
|
if($stamp == 0) { $stamp = TIME_NOW;
|
}
| }
|
$d = explode('-', $date); $nowdate = date("H-j-n-Y", $stamp); $n = explode('-', $nowdate);
| $d = explode('-', $date); $nowdate = date("H-j-n-Y", $stamp); $n = explode('-', $nowdate);
|
Zeile 7958 | Zeile 7988 |
---|
* @return bool */ function expire_warnings()
|
* @return bool */ function expire_warnings()
|
{
| {
|
global $warningshandler;
if(!is_object($warningshandler))
| global $warningshandler;
if(!is_object($warningshandler))
|
Zeile 7991 | Zeile 8021 |
---|
$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 *
| /** * Custom rmdir function to loop through an entire directory and delete all files/folders within *
|
Zeile 8025 | Zeile 8055 |
---|
// Are we done? Don't delete the main folder too and return true if($path == $orig_dir)
|
// Are we done? Don't delete the main folder too and return true if($path == $orig_dir)
|
{
| {
|
return true; }
|
return true; }
|
|
|
return @rmdir($path); }
| return @rmdir($path); }
|
Zeile 8042 | Zeile 8072 |
---|
* @return integer The number of sub forums */ function subforums_count($array=array())
|
* @return integer The number of sub forums */ function subforums_count($array=array())
|
{
| {
|
$count = 0; foreach($array as $array2) { $count += count($array2); }
|
$count = 0; foreach($array as $array2) { $count += count($array2); }
|
|
|
return $count; }
| return $count; }
|
Zeile 8056 | Zeile 8086 |
---|
* DEPRECATED! Please use IPv6 compatible my_inet_pton! * Fix for PHP's ip2long to guarantee a 32-bit signed integer value is produced (this is aimed * at 64-bit versions of PHP)
|
* DEPRECATED! Please use IPv6 compatible my_inet_pton! * Fix for PHP's ip2long to guarantee a 32-bit signed integer value is produced (this is aimed * at 64-bit versions of PHP)
|
* * @deprecated * @param string $ip The IP to convert
| * * @deprecated * @param string $ip The IP to convert
|
* @return integer IP in 32-bit signed format */ function my_ip2long($ip)
| * @return integer IP in 32-bit signed format */ function my_ip2long($ip)
|
Zeile 8124 | Zeile 8154 |
---|
* @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>
| * @author Arpad Ray <arpad@php.net>
|
* @version $Revision: 269597 $ */ $r = ip2long($ip);
| * @version $Revision: 269597 $ */ $r = ip2long($ip);
|
Zeile 8255 | Zeile 8285 |
---|
{ // 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 8546 |
---|
if ($crypto_strong == false) { $output = null;
|
if ($crypto_strong == false) { $output = null;
|
} } } }
| } } } }
|
else { return $output;
| else { return $output;
|
Zeile 8548 | Zeile 8578 |
---|
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 8595 |
---|
return $output; } else
|
return $output; } else
|
{
| {
|
return $output; } }
| return $output; } }
|
Zeile 8578 | Zeile 8608 |
---|
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 8624 |
---|
{ $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 8644 |
---|
{ $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 8677 |
---|
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 8744 |
---|
{ // 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 8796 |
---|
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 8812 |
---|
}
return 0;
|
}
return 0;
|
}
| }
|
/** * Obtain the version of GD installed.
| /** * Obtain the version of GD installed.
|
Zeile 9001 | Zeile 9031 |
---|
} }
|
} }
|
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 9055 |
---|
}
$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 9086 |
---|
"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)) {
|