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 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($groupscache[$gid])) { $level_permissions = array();
// 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; } } }
| if(empty($fpermcache[$fid])) // This forum has no custom or inherited permissions so lets just return the group permissions { $current_permissions = $groupperms; } else { foreach($groups as $gid) { // If this forum has custom or inherited permissions for the currently looped group. if(!empty($fpermcache[$fid][$gid])) { $level_permissions = $fpermcache[$fid][$gid]; } // 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];
|
}
|
}
|
| // No permission is available for the currently looped group, probably we have bad data here.
|
else {
|
else {
|
$level_permissions = $fpermcache[$fid][$gid]; }
// If we STILL don't have forum permissions we use the usergroup itself if(empty($level_permissions)) { $level_permissions = $groupscache[$gid];
| continue;
|
}
foreach($level_permissions as $permission => $access)
| }
foreach($level_permissions as $permission => $access)
|
Zeile 1738 | Zeile 1738 |
---|
}
if($level_permissions["canpostreplys"] && empty($level_permissions["canonlyreplyownthreads"]))
|
}
if($level_permissions["canpostreplys"] && empty($level_permissions["canonlyreplyownthreads"]))
|
{
| {
|
$only_reply_own_threads = 0; } }
|
$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) { $current_permissions["canonlyviewownthreads"] = 0; }
| if($only_view_own_threads == 0 || !isset($current_permissions["canonlyviewownthreads"])) { $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 1778 | Zeile 1779 |
---|
if($check_parents && isset($forum['parentlist'])) { if(!is_array($forum_cache))
|
if($check_parents && isset($forum['parentlist'])) { if(!is_array($forum_cache))
|
{
| {
|
$forum_cache = cache_forums(); if(!$forum_cache) {
| $forum_cache = cache_forums(); if(!$forum_cache) {
|
Zeile 1803 | Zeile 1804 |
---|
my_hash_equals( md5($mybb->user['uid'].$forum['password']), $mybb->cookies['forumpass'][$forum['fid']]
|
my_hash_equals( md5($mybb->user['uid'].$forum['password']), $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 1835 | Zeile 1836 |
---|
{ $parents = explode(',', $forum_cache[$fid]['parentlist']); rsort($parents);
|
{ $parents = explode(',', $forum_cache[$fid]['parentlist']); rsort($parents);
|
}
| }
|
if(!empty($parents)) { foreach($parents as $parent_id) { if($parent_id == $fid || $parent_id == $pid)
|
if(!empty($parents)) { foreach($parents as $parent_id) { if($parent_id == $fid || $parent_id == $pid)
|
{
| {
|
continue;
|
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);
|
} }
| } }
|
}
if($forum_cache[$fid]['password'] !== '')
| }
if($forum_cache[$fid]['password'] !== '')
|
Zeile 1877 | Zeile 1878 |
---|
{ $showform = false; }
|
{ $showform = false; }
|
}
| }
|
} else {
| } else {
|
Zeile 1919 | Zeile 1920 |
---|
static $modpermscache;
if($uid < 1)
|
static $modpermscache;
if($uid < 1)
|
{
| {
|
$uid = $mybb->user['uid']; }
| $uid = $mybb->user['uid']; }
|
Zeile 1947 | Zeile 1948 |
---|
if(!empty($user['additionalgroups'])) { $extra_groups = explode(",", $user['additionalgroups']);
|
if(!empty($user['additionalgroups'])) { $extra_groups = explode(",", $user['additionalgroups']);
|
|
|
foreach($extra_groups as $extra_group) { $groups[] = $extra_group;
| foreach($extra_groups as $extra_group) { $groups[] = $extra_group;
|
Zeile 1968 | 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) { if(strpos($action, "can") === false) { continue; }
if(!isset($perms[$action]))
| foreach($perm as $action => $value) { if(strpos($action, "can") === false) { continue; }
if(!isset($perms[$action]))
|
{ $perms[$action] = $value; }
| { $perms[$action] = $value; }
|
Zeile 1984 | Zeile 1985 |
---|
{ // 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 { $perms[$action] = max($perm[$action], $perms[$action]); } }
| } else { $perms[$action] = max($perm[$action], $perms[$action]); } }
|
}
foreach($groups as $group)
| }
foreach($groups as $group)
|
Zeile 2030 | Zeile 2031 |
---|
* * @param int $fid The forum ID (0 assumes global) * @param string $action The action tyring to be performed. (blank assumes any action at all)
|
* * @param int $fid The forum ID (0 assumes global) * @param string $action The action tyring to be performed. (blank assumes any action at all)
|
* @param int $uid The user ID (0 assumes current user)
| * @param int $uid The user ID (0 assumes current user)
|
* @return bool Returns true if the user has permission, false if they do not */ function is_moderator($fid=0, $action="", $uid=0) { global $mybb, $cache, $plugins;
|
* @return bool Returns true if the user has permission, false if they do not */ function is_moderator($fid=0, $action="", $uid=0) { global $mybb, $cache, $plugins;
|
if($uid == 0) { $uid = $mybb->user['uid']; }
if($uid == 0) {
| if($uid == 0) { $uid = $mybb->user['uid']; }
if($uid == 0) {
|
return false; }
| return false; }
|
Zeile 2068 | 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 true;
| return false; } return true;
|
Zeile 2098 | Zeile 2099 |
---|
return true; } }
|
return true; } }
|
}
| }
|
} return false; }
| } return false; }
|
Zeile 2139 | Zeile 2140 |
---|
if($uid == 0) { $uid = $mybb->user['uid'];
|
if($uid == 0) { $uid = $mybb->user['uid'];
|
}
if($uid == 0) {
| }
if($uid == 0) {
|
return array(); }
| return array(); }
|
Zeile 2226 | Zeile 2227 |
---|
}
if(!empty($iconlist))
|
}
if(!empty($iconlist))
|
{
| {
|
eval("\$posticons = \"".$templates->get("posticons")."\";"); } else
| eval("\$posticons = \"".$templates->get("posticons")."\";"); } else
|
Zeile 2253 | Zeile 2254 |
---|
if(!$mybb->settings['cookiepath']) { $mybb->settings['cookiepath'] = "/";
|
if(!$mybb->settings['cookiepath']) { $mybb->settings['cookiepath'] = "/";
|
}
| }
|
if($expires == -1) { $expires = 0;
| if($expires == -1) { $expires = 0;
|
Zeile 2346 | 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 2372 | 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 2382 | 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 2401 | 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 2441 | 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 2460 | 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 2476 | 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 2521 | 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 2543 | 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 2580 | 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 2591 | 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 2599 | Zeile 2611 |
---|
}
return $out;
|
}
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 */ function native_unserialize($str) { if(version_compare(PHP_VERSION, '7.0.0', '>=')) { return unserialize($str, array('allowed_classes' => false)); } else { return unserialize($str); }
|
}
/**
| }
/**
|
Zeile 3224 | 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) == "+-") { $changes[$counter] = substr($changes[$counter], 1); } // Adding or subtracting from previous value? if(substr($changes[$counter], 0, 1) == "+" || substr($changes[$counter], 0, 1) == "-")
| if(array_key_exists($counter, $changes))
|
{
|
{
|
if((int)$changes[$counter] != 0)
| if(substr($changes[$counter], 0, 2) == "+-")
|
{
|
{
|
$update_query[$counter] = $user[$counter] + $changes[$counter];
| $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];
|
}
|
}
|
} 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;
| // Less than 0? That's bad if(isset($update_query[$counter]) && $update_query[$counter] < 0) { $update_query[$counter] = 0; }
|
} } }
| } } }
|
Zeile 3258 | Zeile 3292 |
---|
// 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)
|
{
| {
|
$db->update_query("users", $update_query, "uid='{$uid}'"); } }
| $db->update_query("users", $update_query, "uid='{$uid}'"); } }
|
Zeile 3267 | Zeile 3301 |
---|
* Deletes a thread from the database * * @param int $tid The thread ID
|
* Deletes a thread from the database * * @param int $tid The thread ID
|
* @return bool
| * @return bool
|
*/ function delete_thread($tid)
|
*/ function delete_thread($tid)
|
{ global $moderation;
if(!is_object($moderation)) { require_once MYBB_ROOT."inc/class_moderation.php"; $moderation = new Moderation;
| { global $moderation;
if(!is_object($moderation)) { require_once MYBB_ROOT."inc/class_moderation.php"; $moderation = new Moderation;
|
}
return $moderation->delete_thread($tid);
| }
return $moderation->delete_thread($tid);
|
Zeile 3299 | Zeile 3333 |
---|
}
return $moderation->delete_post($pid);
|
}
return $moderation->delete_post($pid);
|
}
/**
| }
/**
|
* Builds a forum jump menu * * @param int $pid The parent forum to start with
| * Builds a forum jump menu * * @param int $pid The parent forum to start with
|
Zeile 3332 | Zeile 3366 |
---|
if($forum['active'] != 0) { $jumpfcache[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum;
|
if($forum['active'] != 0) { $jumpfcache[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum;
|
}
| }
|
}
|
}
|
}
| }
|
if(!is_array($permissioncache)) { $permissioncache = forum_permissions(); }
|
if(!is_array($permissioncache)) { $permissioncache = forum_permissions(); }
|
|
|
if(isset($jumpfcache[$pid]) && is_array($jumpfcache[$pid])) { foreach($jumpfcache[$pid] as $main)
| if(isset($jumpfcache[$pid]) && is_array($jumpfcache[$pid])) { foreach($jumpfcache[$pid] as $main)
|
Zeile 3356 | Zeile 3390 |
---|
if($selitem == $forum['fid']) { $optionselected = 'selected="selected"';
|
if($selitem == $forum['fid']) { $optionselected = 'selected="selected"';
|
}
| }
|
$forum['name'] = htmlspecialchars_uni(strip_tags($forum['name']));
|
$forum['name'] = htmlspecialchars_uni(strip_tags($forum['name']));
|
|
|
eval("\$forumjumpbits .= \"".$templates->get("forumjump_bit")."\";");
if($forum_cache[$forum['fid']]) { $newdepth = $depth."--"; $forumjumpbits .= build_forum_jump($forum['fid'], $selitem, 0, $newdepth, $showextras, $showall);
|
eval("\$forumjumpbits .= \"".$templates->get("forumjump_bit")."\";");
if($forum_cache[$forum['fid']]) { $newdepth = $depth."--"; $forumjumpbits .= build_forum_jump($forum['fid'], $selitem, 0, $newdepth, $showextras, $showall);
|
} } } } }
| } } } } }
|
if($addselect) {
| if($addselect) {
|
Zeile 3396 | Zeile 3430 |
---|
}
return $forumjump;
|
}
return $forumjump;
|
}
| }
|
/** * Returns the extension of a file.
| /** * Returns the extension of a file.
|
Zeile 3405 | Zeile 3439 |
---|
* @return string The extension of the file. */ function get_extension($file)
|
* @return string The extension of the file. */ function get_extension($file)
|
{
| {
|
return my_strtolower(my_substr(strrchr($file, "."), 1)); }
| return my_strtolower(my_substr(strrchr($file, "."), 1)); }
|
Zeile 3439 | Zeile 3473 |
---|
for($i = 0; $i < $length; ++$i) { $str[] = $set[my_rand(0, 61)];
|
for($i = 0; $i < $length; ++$i) { $str[] = $set[my_rand(0, 61)];
|
}
| }
|
// Make sure they're in random order and convert them to a string shuffle($str);
| // Make sure they're in random order and convert them to a string shuffle($str);
|
Zeile 3576 | Zeile 3610 |
---|
else { $avatar_width_height = "width=\"{$dimensions[0]}\" height=\"{$dimensions[1]}\"";
|
else { $avatar_width_height = "width=\"{$dimensions[0]}\" height=\"{$dimensions[1]}\"";
|
}
| }
|
} }
| } }
|
Zeile 3783 | Zeile 3817 |
---|
}
if($mybb->settings['allowfontmycode'] == 1)
|
}
if($mybb->settings['allowfontmycode'] == 1)
|
{
| {
|
$font = "font,"; }
| $font = "font,"; }
|
Zeile 3872 | 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 6948 | 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 true;
|
}
return false;
| }
return false;
|
Zeile 6976 | Zeile 7010 |
---|
$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";
|
}
$settings = "<"."?php\n/*********************************\ \n DO NOT EDIT THIS FILE, PLEASE USE\n THE SETTINGS EDITOR\n\*********************************/\n\n$settings\n";
| }
$settings = "<"."?php\n/*********************************\ \n DO NOT EDIT THIS FILE, PLEASE USE\n THE SETTINGS EDITOR\n\*********************************/\n\n$settings\n";
|
file_put_contents(MYBB_ROOT.'inc/settings.php', $settings, LOCK_EX);
| file_put_contents(MYBB_ROOT.'inc/settings.php', $settings, LOCK_EX);
|
Zeile 6994 | Zeile 7028 |
---|
function build_highlight_array($terms) { global $mybb;
|
function build_highlight_array($terms) { global $mybb;
|
|
|
if($mybb->settings['minsearchword'] < 1) { $mybb->settings['minsearchword'] = 3;
| if($mybb->settings['minsearchword'] < 1) { $mybb->settings['minsearchword'] = 3;
|
Zeile 7014 | 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); if($phrase != "")
|
foreach($terms as $phrase) { $phrase = htmlspecialchars_uni($phrase); if($phrase != "")
|
{
| {
|
if($inquote) { $words[] = trim($phrase);
| if($inquote) { $words[] = trim($phrase);
|
Zeile 7066 | Zeile 7100 |
---|
$words[] = trim($word); } }
|
$words[] = trim($word); } }
|
}
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 7091 | Zeile 7122 |
---|
}
// 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 9019 | 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 9043 | 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 9065 | 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)) {
|