Zeile 224 | Zeile 224 |
---|
// Loop through and run them all foreach($shutdown_queries as $query) {
|
// Loop through and run them all foreach($shutdown_queries as $query) {
|
$db->query($query);
| $db->write_query($query);
|
} }
| } }
|
Zeile 610 | Zeile 610 |
---|
}
/**
|
}
/**
|
* Generates a unique code for POST requests to prevent XSS/CSRF attacks
| * Generates a code for POST requests to prevent XSS/CSRF attacks. * Unique for each user or guest session and rotated every 6 hours.
|
*
|
*
|
| * @param int $rotation_shift Adjustment of the rotation number to generate a past/future code
|
* @return string The generated code */
|
* @return string The generated code */
|
function generate_post_check()
| function generate_post_check($rotation_shift=0)
|
{ global $mybb, $session;
|
{ global $mybb, $session;
|
| $rotation_interval = 6 * 3600; $rotation = floor(TIME_NOW / $rotation_interval) + $rotation_shift;
$seed = $rotation;
|
if($mybb->user['uid'])
|
if($mybb->user['uid'])
|
{ return md5($mybb->user['loginkey'].$mybb->user['salt'].$mybb->user['regdate']);
| { $seed .= $mybb->user['loginkey'].$mybb->user['salt'].$mybb->user['regdate'];
|
}
|
}
|
// Guests get a special string
| |
else {
|
else {
|
return md5($session->sid.$mybb->config['database']['username'].$mybb->settings['internal']['encryption_key']);
| $seed .= $session->sid;
|
}
|
}
|
| $seed .= $mybb->settings['internal']['encryption_key'];
return md5($seed);
|
}
/**
|
}
/**
|
* Verifies a POST check code is valid, if not shows an error (silently returns false on silent parameter)
| * Verifies a POST check code is valid (i.e. generated using a rotation number from the past 24 hours)
|
* * @param string $code The incoming POST check code
|
* * @param string $code The incoming POST check code
|
* @param boolean $silent Silent mode or not (silent mode will not show the error to the user but returns false) * @return bool
| * @param boolean $silent Don't show an error to the user * @return bool|void Result boolean if $silent is true, otherwise shows an error to the user
|
*/ function verify_post_check($code, $silent=false) { global $lang;
|
*/ function verify_post_check($code, $silent=false) { global $lang;
|
if(generate_post_check() !== $code)
| if( generate_post_check() !== $code && generate_post_check(-1) !== $code && generate_post_check(-2) !== $code && generate_post_check(-3) !== $code )
|
{ if($silent == true) {
| { if($silent == true) {
|
Zeile 776 | Zeile 792 |
---|
foreach($forums_by_parent[$fid] as $forum) {
|
foreach($forums_by_parent[$fid] as $forum) {
|
$forums[] = $forum['fid'];
| $forums[] = (int)$forum['fid'];
|
$children = get_child_list($forum['fid']); if(is_array($children)) {
| $children = get_child_list($forum['fid']); if(is_array($children)) {
|
Zeile 875 | Zeile 891 |
---|
eval("\$errors = \"".$templates->get("error_inline")."\";");
return $errors;
|
eval("\$errors = \"".$templates->get("error_inline")."\";");
return $errors;
|
}
| }
|
/** * Presents the user with a "no permission" page
| /** * Presents the user with a "no permission" page
|
Zeile 1031 | Zeile 1047 |
---|
*/ function multipage($count, $perpage, $page, $url, $breadcrumb=false) {
|
*/ function multipage($count, $perpage, $page, $url, $breadcrumb=false) {
|
global $theme, $templates, $lang, $mybb;
| global $theme, $templates, $lang, $mybb, $plugins;
|
if($count <= $perpage) { return ''; }
|
if($count <= $perpage) { return ''; }
|
| $args = array( 'count' => &$count, 'perpage' => &$perpage, 'page' => &$page, 'url' => &$url, 'breadcrumb' => &$breadcrumb, ); $plugins->run_hooks('multipage', $args);
|
$page = (int)$page;
| $page = (int)$page;
|
Zeile 1379 | Zeile 1404 |
---|
}
$groupperms = $mybb->usergroup;
|
}
$groupperms = $mybb->usergroup;
|
} }
| } }
|
if(!is_array($forum_cache)) {
| if(!is_array($forum_cache)) {
|
Zeile 1509 | Zeile 1534 |
---|
$current_permissions = $groupperms; } return $current_permissions;
|
$current_permissions = $groupperms; } return $current_permissions;
|
| }
/** * Check whether password for given forum was validated for the current user * * @param array $forum The forum data * @param bool $ignore_empty Whether to treat forum password configured as an empty string as validated * @param bool $check_parents Whether to check parent forums using `parentlist` * @return bool */ function forum_password_validated($forum, $ignore_empty=false, $check_parents=false) { global $mybb, $forum_cache;
if($check_parents && isset($forum['parentlist'])) { if(!is_array($forum_cache)) { $forum_cache = cache_forums(); if(!$forum_cache) { return false; } }
$parents = explode(',', $forum['parentlist']); rsort($parents);
foreach($parents as $parent_id) { if($parent_id != $forum['fid'] && !forum_password_validated($forum_cache[$parent_id], true)) { return false; } } }
return ($ignore_empty && $forum['password'] === '') || ( isset($mybb->cookies['forumpass'][$forum['fid']]) && my_hash_equals( md5($mybb->user['uid'].$forum['password']), $mybb->cookies['forumpass'][$forum['fid']] ) );
|
}
/**
| }
/**
|
Zeile 1549 | Zeile 1618 |
---|
continue; }
|
continue; }
|
if($forum_cache[$parent_id]['password'] != "")
| if($forum_cache[$parent_id]['password'] !== "")
|
{ check_forum_password($parent_id, $fid); } } }
|
{ check_forum_password($parent_id, $fid); } } }
|
if(!empty($forum_cache[$fid]['password']))
| if($forum_cache[$fid]['password'] !== '')
|
{
|
{
|
$password = $forum_cache[$fid]['password'];
| |
if(isset($mybb->input['pwverify']) && $pid == 0)
|
if(isset($mybb->input['pwverify']) && $pid == 0)
|
{ if($password === $mybb->get_input('pwverify')) {
| { 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
|
else
|
{
| {
|
eval("\$pwnote = \"".$templates->get("forumdisplay_password_wrongpass")."\";"); $showform = true;
|
eval("\$pwnote = \"".$templates->get("forumdisplay_password_wrongpass")."\";"); $showform = true;
|
} } else { if(!$mybb->cookies['forumpass'][$fid] || ($mybb->cookies['forumpass'][$fid] && md5($mybb->user['uid'].$password) !== $mybb->cookies['forumpass'][$fid])) { $showform = true; }
| } } else { if(!forum_password_validated($forum_cache[$fid])) { $showform = true; }
|
else { $showform = false; } }
|
else { $showform = false; } }
|
}
| }
|
else
|
else
|
{
| {
|
$showform = false; }
if($return) { return $showform;
|
$showform = false; }
if($return) { return $showform;
|
}
| }
|
if($showform) {
| if($showform) {
|
Zeile 1607 | Zeile 1675 |
---|
output_page($pwform); } exit;
|
output_page($pwform); } exit;
|
}
| }
|
}
/**
| }
/**
|
Zeile 1622 | Zeile 1690 |
---|
{ global $mybb, $cache, $db; static $modpermscache;
|
{ global $mybb, $cache, $db; static $modpermscache;
|
|
|
if($uid < 1)
|
if($uid < 1)
|
{
| {
|
$uid = $mybb->user['uid'];
|
$uid = $mybb->user['uid'];
|
}
| }
|
if($uid == 0)
|
if($uid == 0)
|
{
| {
|
return false; }
|
return false; }
|
if(isset($modpermscache[$fid][$uid])) { return $modpermscache[$fid][$uid]; }
| if(isset($modpermscache[$fid][$uid])) { return $modpermscache[$fid][$uid]; }
|
if(!$parentslist) { $parentslist = explode(',', get_parent_list($fid));
| if(!$parentslist) { $parentslist = explode(',', get_parent_list($fid));
|
Zeile 1684 | Zeile 1752 |
---|
if($value == 0) { // The user doesn't have permission to set this action
|
if($value == 0) { // The user doesn't have permission to set this action
|
$perms[$action] = 0; }
| $perms[$action] = 0; }
|
else { $perms[$action] = max($perm[$action], $perms[$action]);
| else { $perms[$action] = max($perm[$action], $perms[$action]);
|
Zeile 1699 | Zeile 1767 |
---|
{ // There are no permissions set for this group continue;
|
{ // There are no permissions set for this group continue;
|
}
| }
|
$perm = $forum['usergroups'][$group]; foreach($perm as $action => $value) {
| $perm = $forum['usergroups'][$group]; foreach($perm as $action => $value) {
|
Zeile 1730 | Zeile 1798 |
---|
function is_moderator($fid=0, $action="", $uid=0) { global $mybb, $cache;
|
function is_moderator($fid=0, $action="", $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) {
|
Zeile 1748 | Zeile 1816 |
---|
{ $forumpermissions = forum_permissions($fid); if($forumpermissions['canview'] && $forumpermissions['canviewthreads'] && !$forumpermissions['canonlyviewownthreads'])
|
{ $forumpermissions = forum_permissions($fid); if($forumpermissions['canview'] && $forumpermissions['canviewthreads'] && !$forumpermissions['canonlyviewownthreads'])
|
{
| {
|
return true; } return false;
| return true; } return false;
|
Zeile 1763 | Zeile 1831 |
---|
if(!empty($modcache)) { foreach($modcache as $modusers)
|
if(!empty($modcache)) { foreach($modcache as $modusers)
|
{
| {
|
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']);
foreach($groups as $group)
| $groups = explode(',', $user_perms['all_usergroups']);
foreach($groups as $group)
|
Zeile 1778 | Zeile 1846 |
---|
return true; } }
|
return true; } }
|
}
| }
|
} return false; } else
|
} return false; } else
|
{
| {
|
$modperms = get_moderator_permissions($fid, $uid);
if(!$action && $modperms)
| $modperms = get_moderator_permissions($fid, $uid);
if(!$action && $modperms)
|
Zeile 1793 | Zeile 1861 |
---|
else { if(isset($modperms[$action]) && $modperms[$action] == 1)
|
else { if(isset($modperms[$action]) && $modperms[$action] == 1)
|
{
| {
|
return true; } else
| return true; } else
|
Zeile 1803 | Zeile 1871 |
---|
} } }
|
} } }
|
| }
/** * Get an array of fids that the forum moderator has access to. * Do not use for administraotrs or global moderators as they moderate any forum and the function will return false. * * @param int $uid The user ID (0 assumes current user) * @return array|bool an array of the fids the user has moderator access to or bool if called incorrectly. */ function get_moderated_fids($uid=0) { global $mybb, $cache;
if($uid == 0) { $uid = $mybb->user['uid']; }
if($uid == 0) { return array(); }
$user_perms = user_permissions($uid);
if($user_perms['issupermod'] == 1) { return false; }
$fids = array();
$modcache = $cache->read('moderators'); if(!empty($modcache)) { $groups = explode(',', $user_perms['all_usergroups']);
foreach($modcache as $fid => $forum) { if(isset($forum['users'][$uid]) && $forum['users'][$uid]['mid']) { $fids[] = $fid; continue; }
foreach($groups as $group) { if(trim($group) != '' && isset($forum['usergroups'][$group])) { $fids[] = $fid; } } } }
return $fids;
|
}
/**
| }
/**
|
Zeile 2141 | Zeile 2265 |
---|
array_pop($expected); if(count($expected) == 0) { $state = 1;
|
array_pop($expected); if(count($expected) == 0) { $state = 1;
|
}
| }
|
break; } if($type == 'i' || $type == 's')
| break; } if($type == 'i' || $type == 's')
|
Zeile 2173 | Zeile 2297 |
---|
// array nesting exceeds MAX_SERIALIZED_ARRAY_DEPTH return false; }
|
// array nesting exceeds MAX_SERIALIZED_ARRAY_DEPTH return false; }
|
|
|
$data = array(); $list = &$data; $expected[] = $expectedLength;
| $data = array(); $list = &$data; $expected[] = $expectedLength;
|
Zeile 2251 | Zeile 2375 |
---|
if(is_int($value)) { return 'i:'.$value.';';
|
if(is_int($value)) { return 'i:'.$value.';';
|
}
| }
|
if(is_float($value))
|
if(is_float($value))
|
{
| {
|
return 'd:'.str_replace(',', '.', $value).';';
|
return 'd:'.str_replace(',', '.', $value).';';
|
}
| }
|
if(is_string($value)) {
| if(is_string($value)) {
|
Zeile 2267 | Zeile 2391 |
---|
{ $out = ''; foreach($value as $k => $v)
|
{ $out = ''; foreach($value as $k => $v)
|
{
| {
|
$out .= _safe_serialize($k) . _safe_serialize($v); }
| $out .= _safe_serialize($k) . _safe_serialize($v); }
|
Zeile 2645 | Zeile 2769 |
---|
if($deletedthreads_diff > -1) { $new_stats['numdeletedthreads'] = "+{$deletedthreads_diff}";
|
if($deletedthreads_diff > -1) { $new_stats['numdeletedthreads'] = "+{$deletedthreads_diff}";
|
}
| }
|
else { $new_stats['numdeletedthreads'] = "{$deletedthreads_diff}";
| else { $new_stats['numdeletedthreads'] = "{$deletedthreads_diff}";
|
Zeile 4265 | Zeile 4389 |
---|
$permissioncache = forum_permissions(); }
|
$permissioncache = forum_permissions(); }
|
$password_forums = $unviewable = array();
| $unviewable = array();
|
foreach($forum_cache as $fid => $forum) { if($permissioncache[$forum['fid']])
| foreach($forum_cache as $fid => $forum) { if($permissioncache[$forum['fid']])
|
Zeile 4279 | Zeile 4403 |
---|
$pwverified = 1;
|
$pwverified = 1;
|
if($forum['password'] != "")
| if(!forum_password_validated($forum, true))
|
{
|
{
|
if($mybb->cookies['forumpass'][$forum['fid']] !== md5($mybb->user['uid'].$forum['password'])) { $pwverified = 0; }
$password_forums[$forum['fid']] = $forum['password'];
| $pwverified = 0;
|
} else {
| } else {
|
Zeile 4294 | Zeile 4414 |
---|
$parents = explode(",", $forum['parentlist']); foreach($parents as $parent) {
|
$parents = explode(",", $forum['parentlist']); foreach($parents as $parent) {
|
if(isset($password_forums[$parent]) && $mybb->cookies['forumpass'][$parent] !== md5($mybb->user['uid'].$password_forums[$parent]))
| if(!forum_password_validated($forum_cache[$parent], true))
|
{ $pwverified = 0;
|
{ $pwverified = 0;
|
| break;
|
} } }
| } } }
|
Zeile 4426 | Zeile 4547 |
---|
global $pforumcache, $currentitem, $forum_cache, $navbits, $lang, $base_url, $archiveurl;
if(!$pforumcache)
|
global $pforumcache, $currentitem, $forum_cache, $navbits, $lang, $base_url, $archiveurl;
if(!$pforumcache)
|
{
| {
|
if(!is_array($forum_cache)) { cache_forums();
| if(!is_array($forum_cache)) { cache_forums();
|
Zeile 4662 | Zeile 4783 |
---|
echo "<table style=\"background-color: #666;\" width=\"95%\" cellpadding=\"4\" cellspacing=\"1\" align=\"center\">\n"; echo "<tr>\n"; echo "<td style=\"background-color: #ccc;\"><strong>Templates Used (Loaded for this Page) - ".count($templates->cache)." Total</strong></td>\n";
|
echo "<table style=\"background-color: #666;\" width=\"95%\" cellpadding=\"4\" cellspacing=\"1\" align=\"center\">\n"; echo "<tr>\n"; echo "<td style=\"background-color: #ccc;\"><strong>Templates Used (Loaded for this Page) - ".count($templates->cache)." Total</strong></td>\n";
|
echo "</tr>\n"; echo "<tr>\n"; echo "<td style=\"background: #fff;\">".implode(", ", array_keys($templates->cache))."</td>\n"; echo "</tr>\n"; echo "</table>\n";
| echo "</tr>\n"; echo "<tr>\n"; echo "<td style=\"background: #fff;\">".implode(", ", array_keys($templates->cache))."</td>\n"; echo "</tr>\n"; echo "</table>\n";
|
echo "<br />\n"; }
| echo "<br />\n"; }
|
Zeile 4696 | Zeile 4817 |
---|
if($mybb->settings['nocacheheaders'] == 1) {
|
if($mybb->settings['nocacheheaders'] == 1) {
|
header("Expires: Sat, 1 Jan 2000 01:00:00 GMT"); header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); header("Cache-Control: no-cache, must-revalidate"); header("Pragma: no-cache");
| header("Cache-Control: no-cache, private");
|
} }
| } }
|
Zeile 4922 | Zeile 5040 |
---|
}
if(!isset($options['seconds']) || $options['seconds'] !== false)
|
}
if(!isset($options['seconds']) || $options['seconds'] !== false)
|
{
| {
|
if($seconds == 1)
|
if($seconds == 1)
|
{
| {
|
$nicetime['seconds'] = "1".$lang_second;
|
$nicetime['seconds'] = "1".$lang_second;
|
}
| }
|
else if($seconds > 1) { $nicetime['seconds'] = $seconds.$lang_seconds; }
|
else if($seconds > 1) { $nicetime['seconds'] = $seconds.$lang_seconds; }
|
}
| }
|
if(is_array($nicetime)) { return implode(", ", $nicetime);
|
if(is_array($nicetime)) { return implode(", ", $nicetime);
|
} }
| } }
|
/** * Select an alternating row colour based on the previous call to this function
| /** * Select an alternating row colour based on the previous call to this function
|
Zeile 4952 | Zeile 5070 |
---|
if($alttrow == "trow1" && !$reset) { $trow = "trow2";
|
if($alttrow == "trow1" && !$reset) { $trow = "trow2";
|
}
| }
|
else { $trow = "trow1";
| else { $trow = "trow1";
|
Zeile 4982 | Zeile 5100 |
---|
{ $query = $db->simple_select("users", "additionalgroups, usergroup", "uid='".(int)$uid."'"); $user = $db->fetch_array($query);
|
{ $query = $db->simple_select("users", "additionalgroups, usergroup", "uid='".(int)$uid."'"); $user = $db->fetch_array($query);
|
}
| }
|
// Build the new list of additional groups for this user and make sure they're in the right format
|
// Build the new list of additional groups for this user and make sure they're in the right format
|
$usergroups = ""; $usergroups = $user['additionalgroups'].",".$joingroup; $groupslist = ""; $groups = explode(",", $usergroups);
| $groups = array_map( 'intval', explode(',', $user['additionalgroups']) );
if(!in_array((int)$joingroup, $groups)) { $groups[] = (int)$joingroup; $groups = array_diff($groups, array($user['usergroup'])); $groups = array_unique($groups);
|
|
|
if(is_array($groups)) { $comma = ''; foreach($groups as $gid) { if(trim($gid) != "" && $gid != $user['usergroup'] && !isset($donegroup[$gid])) { $groupslist .= $comma.$gid; $comma = ","; $donegroup[$gid] = 1; } } }
| $groupslist = implode(',', $groups);
|
|
|
// What's the point in updating if they're the same? if($groupslist != $user['additionalgroups']) {
| |
$db->update_query("users", array('additionalgroups' => $groupslist), "uid='".(int)$uid."'"); return true; } else { return false;
|
$db->update_query("users", array('additionalgroups' => $groupslist), "uid='".(int)$uid."'"); return true; } else { return false;
|
} }
| } }
|
/** * Remove a user from a specific additional user group *
| /** * Remove a user from a specific additional user group *
|
Zeile 5025 | Zeile 5134 |
---|
function leave_usergroup($uid, $leavegroup) { global $db, $mybb, $cache;
|
function leave_usergroup($uid, $leavegroup) { global $db, $mybb, $cache;
|
|
|
$user = get_user($uid);
|
$user = get_user($uid);
|
$groupslist = $comma = ''; $usergroups = $user['additionalgroups'].","; $donegroup = array();
| if($user['usergroup'] == $leavegroup) { return false; }
$groups = array_map( 'intval', explode(',', $user['additionalgroups']) ); $groups = array_diff($groups, array($leavegroup)); $groups = array_unique($groups);
|
|
|
$groups = explode(",", $user['additionalgroups']);
if(is_array($groups)) { foreach($groups as $gid) { if(trim($gid) != "" && $leavegroup != $gid && empty($donegroup[$gid])) { $groupslist .= $comma.$gid; $comma = ","; $donegroup[$gid] = 1; } } }
| $groupslist = implode(',', $groups);
|
$dispupdate = ""; if($leavegroup == $user['displaygroup'])
| $dispupdate = ""; if($leavegroup == $user['displaygroup'])
|
Zeile 5066 | Zeile 5170 |
---|
* Get the current location taking in to account different web serves and systems * * @param boolean $fields True to return as "hidden" fields
|
* Get the current location taking in to account different web serves and systems * * @param boolean $fields True to return as "hidden" fields
|
* @param array $ignore Array of fields to ignore if first argument is true
| * @param array $ignore Array of fields to ignore for returning "hidden" fields or URL being accessed
|
* @param boolean $quick True to skip all inputs and return only the file path part of the URL
|
* @param boolean $quick True to skip all inputs and return only the file path part of the URL
|
* @return string The current URL being accessed
| * @return string|array The current URL being accessed or form data if $fields is true
|
*/ function get_current_location($fields=false, $ignore=array(), $quick=false) {
|
*/ function get_current_location($fields=false, $ignore=array(), $quick=false) {
|
| global $mybb;
|
if(defined("MYBB_LOCATION"))
|
if(defined("MYBB_LOCATION"))
|
{
| {
|
return MYBB_LOCATION; }
| return MYBB_LOCATION; }
|
Zeile 5092 | Zeile 5198 |
---|
elseif(!empty($_SERVER['PATH_INFO'])) { $location = htmlspecialchars_uni($_SERVER['PATH_INFO']);
|
elseif(!empty($_SERVER['PATH_INFO'])) { $location = htmlspecialchars_uni($_SERVER['PATH_INFO']);
|
} else
| } else
|
{ $location = htmlspecialchars_uni($_ENV['PATH_INFO']); }
| { $location = htmlspecialchars_uni($_ENV['PATH_INFO']); }
|
Zeile 5101 | Zeile 5207 |
---|
if($quick) { return $location;
|
if($quick) { return $location;
|
}
| }
if(!is_array($ignore)) { $ignore = array($ignore); }
|
if($fields == true) {
|
if($fields == true) {
|
global $mybb;
if(!is_array($ignore)) { $ignore = array($ignore); }
| |
$form_html = ''; if(!empty($mybb->input))
|
$form_html = ''; if(!empty($mybb->input))
|
{
| {
|
foreach($mybb->input as $name => $value) { if(in_array($name, $ignore) || is_array($name) || is_array($value))
| foreach($mybb->input as $name => $value) { if(in_array($name, $ignore) || is_array($name) || is_array($value))
|
Zeile 5123 | Zeile 5228 |
---|
}
$form_html .= "<input type=\"hidden\" name=\"".htmlspecialchars_uni($name)."\" value=\"".htmlspecialchars_uni($value)."\" />\n";
|
}
$form_html .= "<input type=\"hidden\" name=\"".htmlspecialchars_uni($name)."\" value=\"".htmlspecialchars_uni($value)."\" />\n";
|
} }
| } }
|
return array('location' => $location, 'form_html' => $form_html, 'form_method' => $mybb->request_method); } else {
|
return array('location' => $location, 'form_html' => $form_html, 'form_method' => $mybb->request_method); } else {
|
| $parameters = array();
|
if(isset($_SERVER['QUERY_STRING'])) {
|
if(isset($_SERVER['QUERY_STRING'])) {
|
$location .= "?".htmlspecialchars_uni($_SERVER['QUERY_STRING']);
| $current_query_string = $_SERVER['QUERY_STRING'];
|
} else if(isset($_ENV['QUERY_STRING'])) {
|
} else if(isset($_ENV['QUERY_STRING'])) {
|
$location .= "?".htmlspecialchars_uni($_ENV['QUERY_STRING']);
| $current_query_string = $_ENV['QUERY_STRING']; } else { $current_query_string = ''; }
parse_str($current_query_string, $current_parameters);
foreach($current_parameters as $name => $value) { if(!in_array($name, $ignore)) { $parameters[$name] = $value; }
|
}
|
}
|
if((isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == "POST") || (isset($_ENV['REQUEST_METHOD']) && $_ENV['REQUEST_METHOD'] == "POST"))
| if($mybb->request_method === 'post')
|
{ $post_array = array('action', 'fid', 'pid', 'tid', 'uid', 'eid');
foreach($post_array as $var) {
|
{ $post_array = array('action', 'fid', 'pid', 'tid', 'uid', 'eid');
foreach($post_array as $var) {
|
if(isset($_POST[$var]))
| if(isset($_POST[$var]) && !in_array($var, $ignore))
|
{
|
{
|
$addloc[] = urlencode($var).'='.urlencode($_POST[$var]);
| $parameters[$var] = $_POST[$var];
|
} }
|
} }
|
| }
|
|
|
if(isset($addloc) && is_array($addloc)) { if(strpos($location, "?") === false) { $location .= "?"; } else { $location .= "&"; } $location .= implode("&", $addloc); }
| if(!empty($parameters)) { $location .= '?'.http_build_query($parameters, '', '&');
|
}
return $location;
| }
return $location;
|
Zeile 5337 | Zeile 5449 |
---|
else { $decimals = 0;
|
else { $decimals = 0;
|
}
| }
|
return number_format((double)$number, $decimals, $mybb->settings['decpoint'], $mybb->settings['thousandssep']); }
| return number_format((double)$number, $decimals, $mybb->settings['decpoint'], $mybb->settings['thousandssep']); }
|
Zeile 5383 | Zeile 5495 |
---|
{ $from_charset = $lang->settings['charset']; $to_charset = "UTF-8";
|
{ $from_charset = $lang->settings['charset']; $to_charset = "UTF-8";
|
} else {
| } else {
|
$from_charset = "UTF-8"; $to_charset = $lang->settings['charset']; }
| $from_charset = "UTF-8"; $to_charset = $lang->settings['charset']; }
|
Zeile 5463 | Zeile 5575 |
---|
} } }
|
} } }
|
}
| }
|
}
/**
| }
/**
|
Zeile 5715 | Zeile 5827 |
---|
// Get rid of any excess RTL and LTR override for they are the workings of the devil $string = str_replace(dec_to_utf8(8238), "", $string); $string = str_replace(dec_to_utf8(8237), "", $string);
|
// Get rid of any excess RTL and LTR override for they are the workings of the devil $string = str_replace(dec_to_utf8(8238), "", $string); $string = str_replace(dec_to_utf8(8237), "", $string);
|
|
|
// Remove dodgy whitespaces $string = str_replace(chr(0xCA), "", $string);
|
// Remove dodgy whitespaces $string = str_replace(chr(0xCA), "", $string);
|
}
| }
|
$string = trim($string);
if(function_exists("mb_strlen")) { $string_length = mb_strlen($string);
|
$string = trim($string);
if(function_exists("mb_strlen")) { $string_length = mb_strlen($string);
|
} else
| } else
|
{ $string_length = strlen($string); }
|
{ $string_length = strlen($string); }
|
|
|
return $string_length; }
/** * Cuts a string at a specified point, mb strings accounted for
|
return $string_length; }
/** * Cuts a string at a specified point, mb strings accounted for
|
*
| *
|
* @param string $string The string to cut. * @param int $start Where to cut * @param int $length (optional) How much to cut
| * @param string $string The string to cut. * @param int $start Where to cut * @param int $length (optional) How much to cut
|
Zeile 5743 | Zeile 5855 |
---|
* @return string The cut part of the string. */ function my_substr($string, $start, $length=null, $handle_entities = false)
|
* @return string The cut part of the string. */ function my_substr($string, $start, $length=null, $handle_entities = false)
|
{ if($handle_entities) {
| { if($handle_entities) {
|
$string = unhtmlentities($string); } if(function_exists("mb_substr"))
| $string = unhtmlentities($string); } if(function_exists("mb_substr"))
|
Zeile 5753 | Zeile 5865 |
---|
if($length != null) { $cut_string = mb_substr($string, $start, $length);
|
if($length != null) { $cut_string = mb_substr($string, $start, $length);
|
} else {
| } else {
|
$cut_string = mb_substr($string, $start); } }
| $cut_string = mb_substr($string, $start); } }
|
Zeile 5785 | Zeile 5897 |
---|
* @return string The lowered string. */ function my_strtolower($string)
|
* @return string The lowered string. */ function my_strtolower($string)
|
{
| {
|
if(function_exists("mb_strtolower"))
|
if(function_exists("mb_strtolower"))
|
{
| {
|
$string = mb_strtolower($string);
|
$string = mb_strtolower($string);
|
}
| } else { $string = strtolower($string); }
return $string; }
/** * Finds a needle in a haystack and returns it position, mb strings accounted for, case insensitive * * @param string $haystack String to look in (haystack) * @param string $needle What to look for (needle) * @param int $offset (optional) How much to offset * @return int|bool false on needle not found, integer position if found */ function my_stripos($haystack, $needle, $offset=0) { if($needle == '') { return false; }
if(function_exists("mb_stripos")) { $position = mb_stripos($haystack, $needle, $offset); }
|
else {
|
else {
|
$string = strtolower($string);
| $position = stripos($haystack, $needle, $offset);
|
}
|
}
|
return $string;
| return $position;
|
}
/**
| }
/**
|
Zeile 6269 | Zeile 6408 |
---|
global $cache; static $forum_cache;
|
global $cache; static $forum_cache;
|
if(!isset($forum_cache) || is_array($forum_cache))
| if(!isset($forum_cache) || !is_array($forum_cache))
|
{ $forum_cache = $cache->read("forums"); }
| { $forum_cache = $cache->read("forums"); }
|
Zeile 7175 | Zeile 7314 |
---|
'ssl' => array( 'verify_peer' => false, 'verify_peer_name' => false,
|
'ssl' => array( 'verify_peer' => false, 'verify_peer_name' => false,
|
| 'peer_name' => $url_components['host'],
|
), )); }
| ), )); }
|
Zeile 8740 | Zeile 8880 |
---|
if(file_exists($file_path)) {
|
if(file_exists($file_path)) {
|
| if(is_object($plugins)) { $hook_args = array( 'file_path' => &$file_path, 'real_file_path' => &$real_file_path, 'file_name' => &$file_name, 'file_dir_path' => &$file_dir_path ); $plugins->run_hooks('copy_file_to_cdn_start', $hook_args); }
|
if($mybb->settings['usecdn'] && !empty($mybb->settings['cdnpath'])) { $cdn_path = rtrim($mybb->settings['cdnpath'], '/\\');
| if($mybb->settings['usecdn'] && !empty($mybb->settings['cdnpath'])) { $cdn_path = rtrim($mybb->settings['cdnpath'], '/\\');
|