Zeile 343 | Zeile 343 |
---|
{ if(isset($mybb->user['uid']) && $mybb->user['uid'] != 0 && array_key_exists("timezone", $mybb->user)) {
|
{ if(isset($mybb->user['uid']) && $mybb->user['uid'] != 0 && array_key_exists("timezone", $mybb->user)) {
|
$offset = $mybb->user['timezone'];
| $offset = (float)$mybb->user['timezone'];
|
$dstcorrection = $mybb->user['dst']; } elseif(defined("IN_ADMINCP")) {
|
$dstcorrection = $mybb->user['dst']; } elseif(defined("IN_ADMINCP")) {
|
$offset = $mybbadmin['timezone'];
| $offset = (float)$mybbadmin['timezone'];
|
$dstcorrection = $mybbadmin['dst']; } else {
|
$dstcorrection = $mybbadmin['dst']; } else {
|
$offset = $mybb->settings['timezoneoffset'];
| $offset = (float)$mybb->settings['timezoneoffset'];
|
$dstcorrection = $mybb->settings['dstcorrection']; }
| $dstcorrection = $mybb->settings['dstcorrection']; }
|
Zeile 400 | Zeile 400 |
---|
if($format == 'relative') { // Relative formats both date and time
|
if($format == 'relative') { // Relative formats both date and time
|
| $real_date = $real_time = ''; if($adodb == true) { $real_date = adodb_date($mybb->settings['dateformat'], $stamp + ($offset * 3600)); $real_time = $mybb->settings['datetimesep']; $real_time .= adodb_date($mybb->settings['timeformat'], $stamp + ($offset * 3600)); } else { $real_date = gmdate($mybb->settings['dateformat'], $stamp + ($offset * 3600)); $real_time = $mybb->settings['datetimesep']; $real_time .= gmdate($mybb->settings['timeformat'], $stamp + ($offset * 3600)); }
|
if($ty != 2 && abs(TIME_NOW - $stamp) < 3600) { $diff = TIME_NOW - $stamp; $relative = array('prefix' => '', 'minute' => 0, 'plural' => $lang->rel_minutes_plural, 'suffix' => $lang->rel_ago);
|
if($ty != 2 && abs(TIME_NOW - $stamp) < 3600) { $diff = TIME_NOW - $stamp; $relative = array('prefix' => '', 'minute' => 0, 'plural' => $lang->rel_minutes_plural, 'suffix' => $lang->rel_ago);
|
if($diff < 0) { $diff = abs($diff); $relative['suffix'] = ''; $relative['prefix'] = $lang->rel_in; }
$relative['minute'] = floor($diff / 60);
if($relative['minute'] <= 1)
| if($diff < 0) { $diff = abs($diff); $relative['suffix'] = ''; $relative['prefix'] = $lang->rel_in; }
$relative['minute'] = floor($diff / 60);
if($relative['minute'] <= 1)
|
{ $relative['minute'] = 1; $relative['plural'] = $lang->rel_minutes_single;
| { $relative['minute'] = 1; $relative['plural'] = $lang->rel_minutes_single;
|
Zeile 423 | Zeile 437 |
---|
if($diff <= 60) { // Less than a minute
|
if($diff <= 60) { // Less than a minute
|
$relative['prefix'] = $lang->rel_less_than; }
$date = $lang->sprintf($lang->rel_time, $relative['prefix'], $relative['minute'], $relative['plural'], $relative['suffix']);
| $relative['prefix'] = $lang->rel_less_than; }
$date = $lang->sprintf($lang->rel_time, $relative['prefix'], $relative['minute'], $relative['plural'], $relative['suffix'], $real_date, $real_time);
|
} elseif($ty != 2 && abs(TIME_NOW - $stamp) < 43200) {
| } elseif($ty != 2 && abs(TIME_NOW - $stamp) < 43200) {
|
Zeile 438 | Zeile 452 |
---|
$diff = abs($diff); $relative['suffix'] = ''; $relative['prefix'] = $lang->rel_in;
|
$diff = abs($diff); $relative['suffix'] = ''; $relative['prefix'] = $lang->rel_in;
|
}
| }
|
$relative['hour'] = floor($diff / 3600);
if($relative['hour'] <= 1)
| $relative['hour'] = floor($diff / 3600);
if($relative['hour'] <= 1)
|
Zeile 448 | Zeile 462 |
---|
$relative['plural'] = $lang->rel_hours_single; }
|
$relative['plural'] = $lang->rel_hours_single; }
|
$date = $lang->sprintf($lang->rel_time, $relative['prefix'], $relative['hour'], $relative['plural'], $relative['suffix']);
| $date = $lang->sprintf($lang->rel_time, $relative['prefix'], $relative['hour'], $relative['plural'], $relative['suffix'], $real_date, $real_time);
|
} else {
| } else {
|
Zeile 456 | Zeile 470 |
---|
{ if($todaysdate == $date) {
|
{ if($todaysdate == $date) {
|
$date = $lang->today;
| $date = $lang->sprintf($lang->today, $real_date);
|
} else if($yesterdaysdate == $date) {
|
} else if($yesterdaysdate == $date) {
|
$date = $lang->yesterday;
| $date = $lang->sprintf($lang->yesterday, $real_date);
|
} }
| } }
|
Zeile 480 | Zeile 494 |
---|
if($ty && $format == $mybb->settings['dateformat']) { if($todaysdate == $date)
|
if($ty && $format == $mybb->settings['dateformat']) { if($todaysdate == $date)
|
{ $date = $lang->today;
| { $date = $lang->sprintf($lang->today, $real_date);
|
} else if($yesterdaysdate == $date) {
|
} else if($yesterdaysdate == $date) {
|
$date = $lang->yesterday;
| $date = $lang->sprintf($lang->yesterday, $real_date);
|
} } else
| } } else
|
Zeile 507 | Zeile 521 |
---|
}
return $date;
|
}
return $date;
|
}
| }
|
/** * Sends an email using PHP's mail function, formatting it appropriately.
| /** * Sends an email using PHP's mail function, formatting it appropriately.
|
Zeile 543 | Zeile 557 |
---|
{ require_once MYBB_ROOT."inc/mailhandlers/php.php"; $mail = new PhpMail();
|
{ require_once MYBB_ROOT."inc/mailhandlers/php.php"; $mail = new PhpMail();
|
} }
| } }
|
// Using SMTP based mail if($mybb->settings['mail_handler'] == 'smtp')
| // Using SMTP based mail if($mybb->settings['mail_handler'] == 'smtp')
|
Zeile 556 | Zeile 570 |
---|
}
// Using PHP based mail()
|
}
// Using PHP based mail()
|
else {
| else {
|
if($mybb->settings['mail_parameters'] != '') { $mail->additional_parameters = $mybb->settings['mail_parameters'];
| if($mybb->settings['mail_parameters'] != '') { $mail->additional_parameters = $mybb->settings['mail_parameters'];
|
Zeile 598 | Zeile 612 |
---|
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)
|
{ if($silent == true) {
| { if($silent == true) {
|
Zeile 609 | Zeile 623 |
---|
if(defined("IN_ADMINCP")) { return false;
|
if(defined("IN_ADMINCP")) { return false;
|
} else
| } else
|
{ error($lang->invalid_post_code); }
| { error($lang->invalid_post_code); }
|
Zeile 636 | Zeile 650 |
---|
if($forumarraycache[$fid]) { return $forumarraycache[$fid]['parentlist'];
|
if($forumarraycache[$fid]) { return $forumarraycache[$fid]['parentlist'];
|
}
| }
|
elseif($forum_cache[$fid]) { return $forum_cache[$fid]['parentlist'];
| elseif($forum_cache[$fid]) { return $forum_cache[$fid]['parentlist'];
|
Zeile 672 | Zeile 686 |
---|
{ $builtlist .= "$sep$column='$val'"; $sep = " $joiner ";
|
{ $builtlist .= "$sep$column='$val'"; $sep = " $joiner ";
|
}
$builtlist .= ")";
| }
$builtlist .= ")";
|
return $builtlist; }
| return $builtlist; }
|
Zeile 712 | Zeile 726 |
---|
* * @param int $fid The forum ID * @return Array of descendants
|
* * @param int $fid The forum ID * @return Array of descendants
|
*/
| */
|
function get_child_list($fid) { static $forums_by_parent;
| function get_child_list($fid) { static $forums_by_parent;
|
Zeile 865 | Zeile 879 |
---|
if($mybb->user['uid']) {
|
if($mybb->user['uid']) {
|
$lang->error_nopermission_user_username = $lang->sprintf($lang->error_nopermission_user_username, $mybb->user['username']);
| $lang->error_nopermission_user_username = $lang->sprintf($lang->error_nopermission_user_username, htmlspecialchars_uni($mybb->user['username']));
|
eval("\$errorpage = \"".$templates->get("error_nopermission_loggedin")."\";"); } else
| eval("\$errorpage = \"".$templates->get("error_nopermission_loggedin")."\";"); } else
|
Zeile 917 | Zeile 931 |
---|
$plugins->run_hooks("redirect", $redirect_args);
if($mybb->get_input('ajax', MyBB::INPUT_INT))
|
$plugins->run_hooks("redirect", $redirect_args);
if($mybb->get_input('ajax', MyBB::INPUT_INT))
|
{
| {
|
// Send our headers. //@header("Content-type: text/html; charset={$lang->settings['charset']}"); $data = "<script type=\"text/javascript\">\n";
| // Send our headers. //@header("Content-type: text/html; charset={$lang->settings['charset']}"); $data = "<script type=\"text/javascript\">\n";
|
Zeile 966 | Zeile 980 |
---|
run_shutdown();
|
run_shutdown();
|
if(my_substr($url, 0, 7) !== 'http://' && my_substr($url, 0, 8) !== 'https://' && my_substr($url, 0, 1) !== '/')
| if(!my_validate_url($url, true, true))
|
{ header("Location: {$mybb->settings['bburl']}/{$url}"); }
| { header("Location: {$mybb->settings['bburl']}/{$url}"); }
|
Zeile 1122 | Zeile 1136 |
---|
* @param string $url The URL being passed * @param int $page The page number * @return string
|
* @param string $url The URL being passed * @param int $page The page number * @return string
|
*/
| */
|
function fetch_page_url($url, $page) { if($page <= 1)
| function fetch_page_url($url, $page) { if($page <= 1)
|
Zeile 1147 | Zeile 1161 |
---|
else { $url .= "&";
|
else { $url .= "&";
|
}
| }
|
$url .= "page=$page";
|
$url .= "page=$page";
|
}
| }
|
else { $url = str_replace("{page}", $page, $url); }
|
else { $url = str_replace("{page}", $page, $url); }
|
|
|
return $url; }
/** * Fetch the permissions for a specific user
|
return $url; }
/** * Fetch the permissions for a specific user
|
*
| *
|
* @param int $uid The user ID * @return array Array of user permissions for the specified user */
| * @param int $uid The user ID * @return array Array of user permissions for the specified user */
|
Zeile 1173 | Zeile 1187 |
---|
if($uid == 0) { $uid = $mybb->user['uid'];
|
if($uid == 0) { $uid = $mybb->user['uid'];
|
}
| }
|
// User id does not match current user, fetch permissions if($uid != $mybb->user['uid'])
| // User id does not match current user, fetch permissions if($uid != $mybb->user['uid'])
|
Zeile 1209 | Zeile 1223 |
---|
* Fetch the usergroup permissions for a specific group or series of groups combined * * @param int|string $gid A list of groups (Can be a single integer, or a list of groups separated by a comma)
|
* Fetch the usergroup permissions for a specific group or series of groups combined * * @param int|string $gid A list of groups (Can be a single integer, or a list of groups separated by a comma)
|
* @return array Array of permissions generated for the groups
| * @return array Array of permissions generated for the groups, containing also a list of comma-separated checked groups under 'all_usergroups' index
|
*/ function usergroup_permissions($gid=0) {
| */ function usergroup_permissions($gid=0) {
|
Zeile 1224 | Zeile 1238 |
---|
if(count($groups) == 1) {
|
if(count($groups) == 1) {
|
| $groupscache[$gid]['all_usergroups'] = $gid;
|
return $groupscache[$gid]; }
|
return $groupscache[$gid]; }
|
|
|
$usergroup = array();
|
$usergroup = array();
|
| $usergroup['all_usergroups'] = $gid;
|
foreach($groups as $gid) {
|
foreach($groups as $gid) {
|
if(trim($gid) == "" || !$groupscache[$gid])
| if(trim($gid) == "" || empty($groupscache[$gid]))
|
{ continue; }
| { continue; }
|
Zeile 1714 | Zeile 1730 |
---|
{ foreach($modcache as $modusers) {
|
{ foreach($modcache as $modusers) {
|
if(isset($modusers['users'][$uid]) && $modusers['users'][$uid]['mid'])
| if(isset($modusers['users'][$uid]) && $modusers['users'][$uid]['mid'] && (!$action || !empty($modusers['users'][$uid][$action])))
|
{ return true; }
|
{ return true; }
|
elseif(isset($user_perms['gid']) && isset($modusers['usergroups'][$user_perms['gid']]))
| $groups = explode(',', $user_perms['all_usergroups']);
foreach($groups as $group)
|
{
|
{
|
// Moderating usergroup return true;
| if(trim($group) != '' && isset($modusers['usergroups'][$group]) && (!$action || !empty($modusers['usergroups'][$group][$action]))) { return true; }
|
} } }
| } } }
|
Zeile 1738 | Zeile 1759 |
---|
else { if(isset($modperms[$action]) && $modperms[$action] == 1)
|
else { if(isset($modperms[$action]) && $modperms[$action] == 1)
|
{
| {
|
return true;
|
return true;
|
}
| }
|
else { return false; } }
|
else { return false; } }
|
} }
| } }
|
}
/**
| }
/**
|
Zeile 1794 | Zeile 1815 |
---|
eval("\$iconlist .= \"".$templates->get("posticons_icon")."\";"); }
|
eval("\$iconlist .= \"".$templates->get("posticons_icon")."\";"); }
|
eval("\$posticons = \"".$templates->get("posticons")."\";");
| if(!empty($iconlist)) { eval("\$posticons = \"".$templates->get("posticons")."\";"); } else { $posticons = ''; }
|
return $posticons; }
| return $posticons; }
|
Zeile 1854 | Zeile 1882 |
---|
if($httponly == true) { $cookie .= "; HttpOnly";
|
if($httponly == true) { $cookie .= "; HttpOnly";
|
| }
if($mybb->settings['cookiesecureflag']) { $cookie .= "; Secure";
|
}
$mybb->cookies[$name] = $value;
header($cookie, false);
|
}
$mybb->cookies[$name] = $value;
header($cookie, false);
|
}
| }
|
/** * Unset a cookie set by MyBB.
|
/** * Unset a cookie set by MyBB.
|
* * @param string $name The cookie identifier.
| * * @param string $name The cookie identifier.
|
*/ function my_unsetcookie($name)
|
*/ function my_unsetcookie($name)
|
{ global $mybb;
| { global $mybb;
|
$expires = -3600; my_setcookie($name, "", $expires);
| $expires = -3600; my_setcookie($name, "", $expires);
|
Zeile 1888 | Zeile 1921 |
---|
global $mybb;
if(!isset($mybb->cookies['mybb'][$name]))
|
global $mybb;
if(!isset($mybb->cookies['mybb'][$name]))
|
{ return false; }
| { return false; }
|
$cookie = my_unserialize($mybb->cookies['mybb'][$name]);
| $cookie = my_unserialize($mybb->cookies['mybb'][$name]);
|
Zeile 2059 | Zeile 2092 |
---|
unset($list); $list = &$stack[count($stack)-1]; array_pop($stack);
|
unset($list); $list = &$stack[count($stack)-1]; array_pop($stack);
|
|
|
// go to terminal state if we're at the end of the root array array_pop($expected); if(count($expected) == 0) {
| // go to terminal state if we're at the end of the root array array_pop($expected); if(count($expected) == 0) {
|
Zeile 2068 | Zeile 2101 |
---|
break; } if($type == 'i' || $type == 's')
|
break; } if($type == 'i' || $type == 's')
|
{
| {
|
if(count($list) >= MAX_SERIALIZED_ARRAY_LENGTH)
|
if(count($list) >= MAX_SERIALIZED_ARRAY_LENGTH)
|
{
| {
|
// array size exceeds MAX_SERIALIZED_ARRAY_LENGTH
|
// array size exceeds MAX_SERIALIZED_ARRAY_LENGTH
|
return false;
| return false;
|
} if(count($list) >= end($expected)) { // array size exceeds expected length
|
} if(count($list) >= end($expected)) { // array size exceeds expected length
|
return false;
| return false;
|
}
|
}
|
|
|
$key = $value; $state = 3; break; }
// illegal array index type
|
$key = $value; $state = 3; break; }
// illegal array index type
|
return false;
| return false;
|
case 0: // expecting array or value if($type == 'a')
| case 0: // expecting array or value if($type == 'a')
|
Zeile 2113 | Zeile 2146 |
---|
// not in array return false; }
|
// not in array return false; }
|
}
| }
|
if(!empty($str)) { // trailing data in input
| if(!empty($str)) { // trailing data in input
|
Zeile 2133 | Zeile 2166 |
---|
function my_unserialize($str) { // Ensure we use the byte count for strings even when strlen() is overloaded by mb_strlen()
|
function my_unserialize($str) { // Ensure we use the byte count for strings even when strlen() is overloaded by mb_strlen()
|
if(function_exists('mb_internal_encoding') && (((int)ini_get('mbstring.func_overload')) & 2)) { $mbIntEnc = mb_internal_encoding(); mb_internal_encoding('ASCII'); }
$out = _safe_unserialize($str);
if(isset($mbIntEnc)) { mb_internal_encoding($mbIntEnc); }
| if(function_exists('mb_internal_encoding') && (((int)ini_get('mbstring.func_overload')) & 2)) { $mbIntEnc = mb_internal_encoding(); mb_internal_encoding('ASCII'); }
$out = _safe_unserialize($str);
if(isset($mbIntEnc)) { mb_internal_encoding($mbIntEnc); }
|
return $out; }
| return $out; }
|
Zeile 2154 | Zeile 2187 |
---|
* Safe serialize() replacement * - output a strict subset of PHP's native serialized representation * - does not my_serialize objects
|
* Safe serialize() replacement * - output a strict subset of PHP's native serialized representation * - does not my_serialize objects
|
*
| *
|
* @param mixed $value * @return string * @throw Exception if $value is malformed or contains unsupported types (e.g., resources, objects)
| * @param mixed $value * @return string * @throw Exception if $value is malformed or contains unsupported types (e.g., resources, objects)
|
Zeile 2165 | Zeile 2198 |
---|
{ return 'N;'; }
|
{ return 'N;'; }
|
|
|
if(is_bool($value)) { return 'b:'.(int)$value.';'; }
|
if(is_bool($value)) { return 'b:'.(int)$value.';'; }
|
|
|
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)) { return 's:'.strlen($value).':"'.$value.'";';
|
if(is_string($value)) { return 's:'.strlen($value).':"'.$value.'";';
|
}
| }
|
if(is_array($value)) { $out = '';
| if(is_array($value)) { $out = '';
|
Zeile 2193 | Zeile 2226 |
---|
{ $out .= _safe_serialize($k) . _safe_serialize($v); }
|
{ $out .= _safe_serialize($k) . _safe_serialize($v); }
|
|
|
return 'a:'.count($value).':{'.$out.'}';
|
return 'a:'.count($value).':{'.$out.'}';
|
}
| }
|
// safe_serialize cannot my_serialize resources or objects return false;
| // safe_serialize cannot my_serialize resources or objects return false;
|
Zeile 2212 | Zeile 2245 |
---|
{ // 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))
|
{
| {
|
$mbIntEnc = mb_internal_encoding(); mb_internal_encoding('ASCII');
|
$mbIntEnc = mb_internal_encoding(); mb_internal_encoding('ASCII');
|
}
| }
|
$out = _safe_serialize($value); if(isset($mbIntEnc)) { mb_internal_encoding($mbIntEnc); }
|
$out = _safe_serialize($value); if(isset($mbIntEnc)) { mb_internal_encoding($mbIntEnc); }
|
|
|
return $out; }
| return $out; }
|
Zeile 2405 | Zeile 2438 |
---|
if(!$force) { $stats_changes = array_merge($stats, $new_stats); // Overwrite changed values
|
if(!$force) { $stats_changes = array_merge($stats, $new_stats); // Overwrite changed values
|
return; }
| return; }
|
// Fetch latest user if the user count is changing if(array_key_exists('numusers', $changes)) { $query = $db->simple_select("users", "uid, username", "", array('order_by' => 'regdate', 'order_dir' => 'DESC', 'limit' => 1)); $lastmember = $db->fetch_array($query); $new_stats['lastuid'] = $lastmember['uid'];
|
// Fetch latest user if the user count is changing if(array_key_exists('numusers', $changes)) { $query = $db->simple_select("users", "uid, username", "", array('order_by' => 'regdate', 'order_dir' => 'DESC', 'limit' => 1)); $lastmember = $db->fetch_array($query); $new_stats['lastuid'] = $lastmember['uid'];
|
$new_stats['lastusername'] = $lastmember['username'];
| $new_stats['lastusername'] = $lastmember['username'] = htmlspecialchars_uni($lastmember['username']);
|
}
if(!empty($new_stats))
| }
if(!empty($new_stats))
|
Zeile 2467 | Zeile 2500 |
---|
if(substr($changes[$counter], 0, 2) == "+-") { $changes[$counter] = substr($changes[$counter], 1);
|
if(substr($changes[$counter], 0, 2) == "+-") { $changes[$counter] = substr($changes[$counter], 1);
|
}
| }
|
// Adding or subtracting from previous value? if(substr($changes[$counter], 0, 1) == "+" || substr($changes[$counter], 0, 1) == "-") {
| // Adding or subtracting from previous value? if(substr($changes[$counter], 0, 1) == "+" || substr($changes[$counter], 0, 1) == "-") {
|
Zeile 2498 | Zeile 2531 |
---|
// Guess we should update the statistics too? $new_stats = array(); if(array_key_exists('threads', $update_query))
|
// Guess we should update the statistics too? $new_stats = array(); if(array_key_exists('threads', $update_query))
|
{
| {
|
$threads_diff = $update_query['threads'] - $forum['threads']; if($threads_diff > -1) {
| $threads_diff = $update_query['threads'] - $forum['threads']; if($threads_diff > -1) {
|
Zeile 2530 | Zeile 2563 |
---|
{ $new_stats['numposts'] = "+{$posts_diff}"; }
|
{ $new_stats['numposts'] = "+{$posts_diff}"; }
|
else { $new_stats['numposts'] = "{$posts_diff}"; }
| else { $new_stats['numposts'] = "{$posts_diff}"; }
|
}
if(array_key_exists('unapprovedposts', $update_query)) { $unapprovedposts_diff = $update_query['unapprovedposts'] - $forum['unapprovedposts']; if($unapprovedposts_diff > -1)
|
}
if(array_key_exists('unapprovedposts', $update_query)) { $unapprovedposts_diff = $update_query['unapprovedposts'] - $forum['unapprovedposts']; if($unapprovedposts_diff > -1)
|
{
| {
|
$new_stats['numunapprovedposts'] = "+{$unapprovedposts_diff}";
|
$new_stats['numunapprovedposts'] = "+{$unapprovedposts_diff}";
|
} else {
| } else {
|
$new_stats['numunapprovedposts'] = "{$unapprovedposts_diff}"; } }
| $new_stats['numunapprovedposts'] = "{$unapprovedposts_diff}"; } }
|
Zeile 2572 | Zeile 2605 |
---|
else { $new_stats['numdeletedthreads'] = "{$deletedthreads_diff}";
|
else { $new_stats['numdeletedthreads'] = "{$deletedthreads_diff}";
|
}
| }
|
}
if(!empty($new_stats))
| }
if(!empty($new_stats))
|
Zeile 2629 | Zeile 2662 |
---|
// Fetch above counters for this thread $query = $db->simple_select("threads", implode(",", $counters), "tid='{$tid}'"); $thread = $db->fetch_array($query);
|
// Fetch above counters for this thread $query = $db->simple_select("threads", implode(",", $counters), "tid='{$tid}'"); $thread = $db->fetch_array($query);
|
|
|
foreach($counters as $counter) { if(array_key_exists($counter, $changes)) { if(substr($changes[$counter], 0, 2) == "+-")
|
foreach($counters as $counter) { if(array_key_exists($counter, $changes)) { if(substr($changes[$counter], 0, 2) == "+-")
|
{
| {
|
$changes[$counter] = substr($changes[$counter], 1); } // Adding or subtracting from previous value? if(substr($changes[$counter], 0, 1) == "+" || substr($changes[$counter], 0, 1) == "-")
|
$changes[$counter] = substr($changes[$counter], 1); } // Adding or subtracting from previous value? if(substr($changes[$counter], 0, 1) == "+" || substr($changes[$counter], 0, 1) == "-")
|
{
| {
|
if((int)$changes[$counter] != 0) { $update_query[$counter] = $thread[$counter] + $changes[$counter];
|
if((int)$changes[$counter] != 0) { $update_query[$counter] = $thread[$counter] + $changes[$counter];
|
} } else { $update_query[$counter] = $changes[$counter]; }
// Less than 0? That's bad if(isset($update_query[$counter]) && $update_query[$counter] < 0) { $update_query[$counter] = 0; } } }
| } } else { $update_query[$counter] = $changes[$counter]; }
// Less than 0? That's bad if(isset($update_query[$counter]) && $update_query[$counter] < 0) { $update_query[$counter] = 0; } } }
|
$db->free_result($query);
// Only update if we're actually doing something
| $db->free_result($query);
// Only update if we're actually doing something
|
Zeile 2672 | Zeile 2705 |
---|
* Update the first post and lastpost data for a specific thread * * @param int $tid The thread ID
|
* Update the first post and lastpost data for a specific thread * * @param int $tid The thread ID
|
*/
| */
|
function update_thread_data($tid) { global $db;
|
function update_thread_data($tid) { global $db;
|
$thread = get_thread($tid);
| $thread = get_thread($tid);
|
// If this is a moved thread marker, don't update it - we need it to stay as it is if(strpos($thread['closed'], 'moved|') !== false) {
| // If this is a moved thread marker, don't update it - we need it to stay as it is if(strpos($thread['closed'], 'moved|') !== false) {
|
Zeile 2687 | Zeile 2720 |
---|
$query = $db->query(" SELECT u.uid, u.username, p.username AS postusername, p.dateline
|
$query = $db->query(" SELECT u.uid, u.username, p.username AS postusername, p.dateline
|
FROM ".TABLE_PREFIX."posts p
| FROM ".TABLE_PREFIX."posts p
|
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid) WHERE p.tid='$tid' AND p.visible='1' ORDER BY p.dateline DESC
| LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid) WHERE p.tid='$tid' AND p.visible='1' ORDER BY p.dateline DESC
|
Zeile 2717 | Zeile 2750 |
---|
if(empty($lastpost['username'])) { $lastpost['username'] = $lastpost['postusername'];
|
if(empty($lastpost['username'])) { $lastpost['username'] = $lastpost['postusername'];
|
}
| }
|
if(empty($lastpost['dateline'])) { $lastpost['username'] = $firstpost['username'];
| if(empty($lastpost['dateline'])) { $lastpost['username'] = $firstpost['username'];
|
Zeile 2774 | Zeile 2807 |
---|
if((int)$changes[$counter] != 0) { $update_query[$counter] = $user[$counter] + $changes[$counter];
|
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)
| // Less than 0? That's bad if(isset($update_query[$counter]) && $update_query[$counter] < 0)
|
Zeile 2795 | Zeile 2828 |
---|
if(count($update_query) > 0) { $db->update_query("users", $update_query, "uid='{$uid}'");
|
if(count($update_query) > 0) { $db->update_query("users", $update_query, "uid='{$uid}'");
|
}
| }
|
}
|
}
|
|
|
/** * Deletes a thread from the database *
| /** * Deletes a thread from the database *
|
Zeile 2805 | Zeile 2838 |
---|
* @return bool */ function delete_thread($tid)
|
* @return bool */ function delete_thread($tid)
|
{ global $moderation;
if(!is_object($moderation)) { require_once MYBB_ROOT."inc/class_moderation.php";
| { global $moderation;
if(!is_object($moderation)) { require_once MYBB_ROOT."inc/class_moderation.php";
|
$moderation = new Moderation; }
| $moderation = new Moderation; }
|
Zeile 2826 | Zeile 2859 |
---|
function delete_post($pid) { global $moderation;
|
function delete_post($pid) { global $moderation;
|
|
|
if(!is_object($moderation)) { require_once MYBB_ROOT."inc/class_moderation.php";
| if(!is_object($moderation)) { require_once MYBB_ROOT."inc/class_moderation.php";
|
Zeile 2872 | Zeile 2905 |
---|
}
if(!is_array($permissioncache))
|
}
if(!is_array($permissioncache))
|
{
| {
|
$permissioncache = forum_permissions(); }
| $permissioncache = forum_permissions(); }
|
Zeile 2901 | Zeile 2934 |
---|
{ $newdepth = $depth."--"; $forumjumpbits .= build_forum_jump($forum['fid'], $selitem, 0, $newdepth, $showextras, $showall);
|
{ $newdepth = $depth."--"; $forumjumpbits .= build_forum_jump($forum['fid'], $selitem, 0, $newdepth, $showextras, $showall);
|
} } }
| } } }
|
} }
| } }
|
Zeile 2950 | Zeile 2983 |
---|
* @param int $length The length of the string to generate. * @param bool $complex Whether to return complex string. Defaults to false * @return string The random string.
|
* @param int $length The length of the string to generate. * @param bool $complex Whether to return complex string. Defaults to false * @return string The random string.
|
*/
| */
|
function random_str($length=8, $complex=false) { $set = array_merge(range(0, 9), range('A', 'Z'), range('a', 'z'));
| function random_str($length=8, $complex=false) { $set = array_merge(range(0, 9), range('A', 'Z'), range('a', 'z'));
|
Zeile 2975 | Zeile 3008 |
---|
{ $str[] = $set[my_rand(0, 61)]; }
|
{ $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);
|
|
|
return implode($str);
|
return implode($str);
|
}
/**
| }
/**
|
* Formats a username based on their display group * * @param string $username The username
| * Formats a username based on their display group * * @param string $username The username
|
Zeile 2997 | Zeile 3030 |
---|
if(!is_array($groupscache)) { $groupscache = $cache->read("usergroups");
|
if(!is_array($groupscache)) { $groupscache = $cache->read("usergroups");
|
}
| }
|
if($displaygroup != 0) {
| if($displaygroup != 0) {
|
Zeile 3027 | Zeile 3060 |
---|
* @return array Information for the formatted avatar */ function format_avatar($avatar, $dimensions = '', $max_dimensions = '')
|
* @return array Information for the formatted avatar */ function format_avatar($avatar, $dimensions = '', $max_dimensions = '')
|
{ global $mybb;
| { global $mybb, $theme;
|
static $avatars;
|
static $avatars;
|
|
|
if(!isset($avatars))
|
if(!isset($avatars))
|
{
| {
|
$avatars = array();
|
$avatars = array();
|
| }
if(my_strpos($avatar, '://') !== false && !$mybb->settings['allowremoteavatars']) { // Remote avatar, but remote avatars are disallowed. $avatar = null;
|
}
if(!$avatar) { // Default avatar
|
}
if(!$avatar) { // Default avatar
|
$avatar = $mybb->settings['useravatar'];
| if(defined('IN_ADMINCP')) { $theme['imgdir'] = '../images'; }
$avatar = str_replace('{theme}', $theme['imgdir'], $mybb->settings['useravatar']);
|
$dimensions = $mybb->settings['useravatardims']; }
| $dimensions = $mybb->settings['useravatardims']; }
|
Zeile 3214 | Zeile 3258 |
---|
$emoticons_enabled = "false"; if($smilies) {
|
$emoticons_enabled = "false"; if($smilies) {
|
if($mybb->settings['smilieinserter'] && $mybb->settings['smilieinsertercols'] && $mybb->settings['smilieinsertertot']) { $emoticon = ",emoticon"; } $emoticons_enabled = "true";
| |
if(!$smiliecache) { if(!isset($smilie_cache) || !is_array($smilie_cache))
| if(!$smiliecache) { if(!isset($smilie_cache) || !is_array($smilie_cache))
|
Zeile 3227 | Zeile 3265 |
---|
$smilie_cache = $cache->read("smilies"); } foreach($smilie_cache as $smilie)
|
$smilie_cache = $cache->read("smilies"); } foreach($smilie_cache as $smilie)
|
{
| {
|
$smilie['image'] = str_replace("{theme}", $theme['imgdir'], $smilie['image']); $smiliecache[$smilie['sid']] = $smilie;
|
$smilie['image'] = str_replace("{theme}", $theme['imgdir'], $smilie['image']); $smiliecache[$smilie['sid']] = $smilie;
|
}
| } }
if($mybb->settings['smilieinserter'] && $mybb->settings['smilieinsertercols'] && $mybb->settings['smilieinsertertot'] && !empty($smiliecache)) { $emoticon = ",emoticon";
|
}
|
}
|
| $emoticons_enabled = "true";
|
unset($smilie);
| unset($smilie);
|
Zeile 3256 | Zeile 3300 |
---|
if(!$mybb->settings['smilieinserter'] || !$mybb->settings['smilieinsertercols'] || !$mybb->settings['smilieinsertertot'] || !$smilie['showclickable']) {
|
if(!$mybb->settings['smilieinserter'] || !$mybb->settings['smilieinsertercols'] || !$mybb->settings['smilieinsertertot'] || !$smilie['showclickable']) {
|
$hiddensmilies .= '"'.$find.'": "'.$image.'",';
| $hiddensmilies .= '"'.$find.'": "'.$image.'",';
|
} elseif($i < $mybb->settings['smilieinsertertot'])
|
} elseif($i < $mybb->settings['smilieinsertertot'])
|
{
| {
|
$dropdownsmilies .= '"'.$find.'": "'.$image.'",'; ++$i;
|
$dropdownsmilies .= '"'.$find.'": "'.$image.'",'; ++$i;
|
}
| }
|
else { $moresmilies .= '"'.$find.'": "'.$image.'",';
|
else { $moresmilies .= '"'.$find.'": "'.$image.'",';
|
}
| }
|
for($j = 1; $j < $finds_count; ++$j) { $find = str_replace(array('\\', '"'), array('\\\\', '\"'), htmlspecialchars_uni($finds[$j]));
| for($j = 1; $j < $finds_count; ++$j) { $find = str_replace(array('\\', '"'), array('\\\\', '\"'), htmlspecialchars_uni($finds[$j]));
|
Zeile 3275 | Zeile 3319 |
---|
} } }
|
} } }
|
}
$basic1 = $basic2 = $align = $font = $size = $color = $removeformat = $email = $link = $list = $code = $sourcemode = "";
| }
$basic1 = $basic2 = $align = $font = $size = $color = $removeformat = $email = $link = $list = $code = $sourcemode = "";
|
if($mybb->settings['allowbasicmycode'] == 1)
|
if($mybb->settings['allowbasicmycode'] == 1)
|
{
| {
|
$basic1 = "bold,italic,underline,strike|"; $basic2 = "horizontalrule,";
|
$basic1 = "bold,italic,underline,strike|"; $basic2 = "horizontalrule,";
|
}
| }
|
if($mybb->settings['allowalignmycode'] == 1)
|
if($mybb->settings['allowalignmycode'] == 1)
|
{
| {
|
$align = "left,center,right,justify|"; }
if($mybb->settings['allowfontmycode'] == 1) { $font = "font,";
|
$align = "left,center,right,justify|"; }
if($mybb->settings['allowfontmycode'] == 1) { $font = "font,";
|
}
| }
|
if($mybb->settings['allowsizemycode'] == 1)
|
if($mybb->settings['allowsizemycode'] == 1)
|
{
| {
|
$size = "size,";
|
$size = "size,";
|
}
| }
|
if($mybb->settings['allowcolormycode'] == 1) {
| if($mybb->settings['allowcolormycode'] == 1) {
|
Zeile 3308 | Zeile 3352 |
---|
if($mybb->settings['allowfontmycode'] == 1 || $mybb->settings['allowsizemycode'] == 1 || $mybb->settings['allowcolormycode'] == 1) { $removeformat = "removeformat|";
|
if($mybb->settings['allowfontmycode'] == 1 || $mybb->settings['allowsizemycode'] == 1 || $mybb->settings['allowcolormycode'] == 1) { $removeformat = "removeformat|";
|
}
| }
|
if($mybb->settings['allowemailmycode'] == 1) { $email = "email,";
| if($mybb->settings['allowemailmycode'] == 1) { $email = "email,";
|
Zeile 3371 | Zeile 3415 |
---|
$smiliecache[$smilie['sid']] = $smilie; } }
|
$smiliecache[$smilie['sid']] = $smilie; } }
|
|
|
unset($smilie);
if(is_array($smiliecache))
| unset($smilie);
if(is_array($smiliecache))
|
Zeile 3389 | Zeile 3433 |
---|
eval("\$getmore = \"".$templates->get("smilieinsert_getmore")."\";"); }
|
eval("\$getmore = \"".$templates->get("smilieinsert_getmore")."\";"); }
|
$smilies = "";
| $smilies = '';
|
$counter = 0; $i = 0;
| $counter = 0; $i = 0;
|
Zeile 3398 | Zeile 3442 |
---|
{ if($i < $mybb->settings['smilieinsertertot'] && $smilie['showclickable'] != 0) {
|
{ if($i < $mybb->settings['smilieinsertertot'] && $smilie['showclickable'] != 0) {
|
if($counter == 0) { $smilies .= "<tr>\n"; }
| |
$smilie['image'] = str_replace("{theme}", $theme['imgdir'], $smilie['image']); $smilie['image'] = htmlspecialchars_uni($mybb->get_asset_url($smilie['image'])); $smilie['name'] = htmlspecialchars_uni($smilie['name']);
|
$smilie['image'] = str_replace("{theme}", $theme['imgdir'], $smilie['image']); $smilie['image'] = htmlspecialchars_uni($mybb->get_asset_url($smilie['image'])); $smilie['name'] = htmlspecialchars_uni($smilie['name']);
|
|
|
// Only show the first text to replace in the box $temp = explode("\n", $smilie['find']); // assign to temporary variable for php 5.3 compatibility $smilie['find'] = $temp[0];
| // Only show the first text to replace in the box $temp = explode("\n", $smilie['find']); // assign to temporary variable for php 5.3 compatibility $smilie['find'] = $temp[0];
|
Zeile 3416 | Zeile 3455 |
---|
$onclick = " onclick=\"MyBBEditor.insertText(' $find ');\""; $extra_class = ' smilie_pointer'; eval('$smilie = "'.$templates->get('smilie', 1, 0).'";');
|
$onclick = " onclick=\"MyBBEditor.insertText(' $find ');\""; $extra_class = ' smilie_pointer'; eval('$smilie = "'.$templates->get('smilie', 1, 0).'";');
|
eval("\$smilies .= \"".$templates->get("smilieinsert_smilie")."\";");
| eval("\$smilie_icons .= \"".$templates->get("smilieinsert_smilie")."\";");
|
++$i; ++$counter;
if($counter == $mybb->settings['smilieinsertercols']) { $counter = 0;
|
++$i; ++$counter;
if($counter == $mybb->settings['smilieinsertercols']) { $counter = 0;
|
$smilies .= "</tr>\n";
| eval("\$smilies .= \"".$templates->get("smilieinsert_row")."\";"); $smilie_icons = '';
|
} } }
| } } }
|
Zeile 3431 | Zeile 3471 |
---|
if($counter != 0) { $colspan = $mybb->settings['smilieinsertercols'] - $counter;
|
if($counter != 0) { $colspan = $mybb->settings['smilieinsertercols'] - $counter;
|
$smilies .= "<td colspan=\"{$colspan}\"> </td>\n</tr>\n";
| eval("\$smilies .= \"".$templates->get("smilieinsert_row_empty")."\";");
|
}
eval("\$clickablesmilies = \"".$templates->get("smilieinsert")."\";");
| }
eval("\$clickablesmilies = \"".$templates->get("smilieinsert")."\";");
|
Zeile 3644 | Zeile 3684 |
---|
$default_selected = array(); $selected_pid = (int)$selected_pid;
|
$default_selected = array(); $selected_pid = (int)$selected_pid;
|
|
|
if($selected_pid == 0) { $default_selected['all'] = ' selected="selected"';
| if($selected_pid == 0) { $default_selected['all'] = ' selected="selected"';
|
Zeile 3800 | Zeile 3840 |
---|
{ $reputation_class = "reputation_neutral"; }
|
{ $reputation_class = "reputation_neutral"; }
|
|
|
$reputation = my_number_format($reputation);
if($uid != 0)
| $reputation = my_number_format($reputation);
if($uid != 0)
|
Zeile 3891 | Zeile 3931 |
---|
if(isset($_SERVER['HTTP_CLIENT_IP'])) { $ip = strtolower($_SERVER['HTTP_CLIENT_IP']);
|
if(isset($_SERVER['HTTP_CLIENT_IP'])) { $ip = strtolower($_SERVER['HTTP_CLIENT_IP']);
|
} }
| } }
|
if($plugins) { $ip_array = array("ip" => &$ip); // Used for backwards compatibility on this hook with the updated run_hooks() function. $plugins->run_hooks("get_ip", $ip_array);
|
if($plugins) { $ip_array = array("ip" => &$ip); // Used for backwards compatibility on this hook with the updated run_hooks() function. $plugins->run_hooks("get_ip", $ip_array);
|
}
| }
|
return $ip; }
| return $ip; }
|
Zeile 3914 | Zeile 3954 |
---|
global $lang;
if(!is_numeric($size))
|
global $lang;
if(!is_numeric($size))
|
{
| {
|
return $lang->na; }
| return $lang->na; }
|
Zeile 3922 | Zeile 3962 |
---|
if($size >= 1208925819614629174706176) { $size = my_number_format(round(($size / 1208925819614629174706176), 2))." ".$lang->size_yb;
|
if($size >= 1208925819614629174706176) { $size = my_number_format(round(($size / 1208925819614629174706176), 2))." ".$lang->size_yb;
|
}
| }
|
// Zetabyte (1024 Exabytes) elseif($size >= 1180591620717411303424) {
| // Zetabyte (1024 Exabytes) elseif($size >= 1180591620717411303424) {
|
Zeile 3930 | Zeile 3970 |
---|
} // Exabyte (1024 Petabytes) elseif($size >= 1152921504606846976)
|
} // Exabyte (1024 Petabytes) elseif($size >= 1152921504606846976)
|
{
| {
|
$size = my_number_format(round(($size / 1152921504606846976), 2))." ".$lang->size_eb; } // Petabyte (1024 Terabytes) elseif($size >= 1125899906842624) { $size = my_number_format(round(($size / 1125899906842624), 2))." ".$lang->size_pb;
|
$size = my_number_format(round(($size / 1152921504606846976), 2))." ".$lang->size_eb; } // Petabyte (1024 Terabytes) elseif($size >= 1125899906842624) { $size = my_number_format(round(($size / 1125899906842624), 2))." ".$lang->size_pb;
|
}
| }
|
// Terabyte (1024 Gigabytes) elseif($size >= 1099511627776) {
| // Terabyte (1024 Gigabytes) elseif($size >= 1099511627776) {
|
Zeile 3945 | Zeile 3985 |
---|
} // Gigabyte (1024 Megabytes) elseif($size >= 1073741824)
|
} // Gigabyte (1024 Megabytes) elseif($size >= 1073741824)
|
{
| {
|
$size = my_number_format(round(($size / 1073741824), 2))." ".$lang->size_gb; } // Megabyte (1024 Kilobytes) elseif($size >= 1048576) { $size = my_number_format(round(($size / 1048576), 2))." ".$lang->size_mb;
|
$size = my_number_format(round(($size / 1073741824), 2))." ".$lang->size_gb; } // Megabyte (1024 Kilobytes) elseif($size >= 1048576) { $size = my_number_format(round(($size / 1048576), 2))." ".$lang->size_mb;
|
}
| }
|
// Kilobyte (1024 bytes) elseif($size >= 1024) {
| // Kilobyte (1024 bytes) elseif($size >= 1024) {
|
Zeile 3968 | Zeile 4008 |
---|
}
return $size;
|
}
return $size;
|
}
| }
|
/** * Format a decimal number in to microseconds, milliseconds, or seconds.
| /** * Format a decimal number in to microseconds, milliseconds, or seconds.
|
Zeile 3983 | Zeile 4023 |
---|
if(!is_numeric($time)) { return $lang->na;
|
if(!is_numeric($time)) { return $lang->na;
|
}
| }
|
if(round(1000000 * $time, 2) < 1000) {
| if(round(1000000 * $time, 2) < 1000) {
|
Zeile 4014 | Zeile 4054 |
---|
if(!$attachtypes) { $attachtypes = $cache->read("attachtypes");
|
if(!$attachtypes) { $attachtypes = $cache->read("attachtypes");
|
}
| }
|
$ext = my_strtolower($ext);
| $ext = my_strtolower($ext);
|
Zeile 4136 | Zeile 4176 |
---|
$unviewable[] = $forum['fid']; } }
|
$unviewable[] = $forum['fid']; } }
|
|
|
$unviewableforums = implode(',', $unviewable);
|
$unviewableforums = implode(',', $unviewable);
|
|
|
return $unviewableforums; }
| return $unviewableforums; }
|
Zeile 4885 | Zeile 4925 |
---|
{ $location = htmlspecialchars_uni($_ENV['PATH_INFO']); }
|
{ $location = htmlspecialchars_uni($_ENV['PATH_INFO']); }
|
|
|
if($quick) { return $location;
| if($quick) { return $location;
|
Zeile 4908 | Zeile 4948 |
---|
if(in_array($name, $ignore) || is_array($name) || is_array($value)) { continue;
|
if(in_array($name, $ignore) || is_array($name) || is_array($value)) { continue;
|
}
| }
|
$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"; } }
|
Zeile 4932 | Zeile 4972 |
---|
$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])) { $addloc[] = urlencode($var).'='.urlencode($_POST[$var]);
| if(isset($_POST[$var])) { $addloc[] = urlencode($var).'='.urlencode($_POST[$var]);
|
Zeile 4948 | Zeile 4988 |
---|
else { $location .= "&";
|
else { $location .= "&";
|
}
| }
|
$location .= implode("&", $addloc); } }
return $location;
|
$location .= implode("&", $addloc); } }
return $location;
|
}
| }
|
}
/**
| }
/**
|
Zeile 4972 | Zeile 5012 |
---|
function build_theme_select($name, $selected=-1, $tid=0, $depth="", $usergroup_override=false, $footer=false, $count_override=false) { global $db, $themeselect, $tcache, $lang, $mybb, $limit, $templates, $num_themes, $themeselect_option;
|
function build_theme_select($name, $selected=-1, $tid=0, $depth="", $usergroup_override=false, $footer=false, $count_override=false) { global $db, $themeselect, $tcache, $lang, $mybb, $limit, $templates, $num_themes, $themeselect_option;
|
|
|
if($tid == 0) { $tid = 1; $num_themes = 0; $themeselect_option = '';
|
if($tid == 0) { $tid = 1; $num_themes = 0; $themeselect_option = '';
|
|
|
if(!isset($lang->use_default)) { $lang->use_default = $lang->lang_select_default;
|
if(!isset($lang->use_default)) { $lang->use_default = $lang->lang_select_default;
|
} }
| } }
|
if(!is_array($tcache)) { $query = $db->simple_select('themes', 'tid, name, pid, allowedgroups', "pid!='0'");
while($theme = $db->fetch_array($query))
|
if(!is_array($tcache)) { $query = $db->simple_select('themes', 'tid, name, pid, allowedgroups', "pid!='0'");
while($theme = $db->fetch_array($query))
|
{
| {
|
$tcache[$theme['pid']][$theme['tid']] = $theme;
|
$tcache[$theme['pid']][$theme['tid']] = $theme;
|
}
| }
|
}
|
}
|
|
|
if(is_array($tcache[$tid])) {
|
if(is_array($tcache[$tid])) {
|
// Figure out what groups this user is in if(isset($mybb->user['additionalgroups'])) { $in_groups = explode(",", $mybb->user['additionalgroups']); } $in_groups[] = $mybb->user['usergroup'];
| |
foreach($tcache[$tid] as $theme) { $sel = "";
| foreach($tcache[$tid] as $theme) { $sel = "";
|
Zeile 5080 | Zeile 5113 |
---|
{ $s_theme = $theme; break 2;
|
{ $s_theme = $theme; break 2;
|
} } }
| } } }
|
return $s_theme; }
| return $s_theme; }
|
Zeile 5107 | Zeile 5140 |
---|
* * @param int $number The number to format. * @return int The formatted number.
|
* * @param int $number The number to format. * @return int The formatted number.
|
*/
| */
|
function my_number_format($number) { global $mybb;
| function my_number_format($number) { global $mybb;
|
Zeile 5115 | Zeile 5148 |
---|
if($number == "-") { return $number;
|
if($number == "-") { return $number;
|
}
| }
|
if(is_int($number)) {
| if(is_int($number)) {
|
Zeile 5146 | Zeile 5179 |
---|
* @return string The converted string */ function convert_through_utf8($str, $to=true)
|
* @return string The converted string */ function convert_through_utf8($str, $to=true)
|
{ global $lang;
| { global $lang;
|
static $charset; static $use_mb; static $use_iconv;
| static $charset; static $use_mb; static $use_iconv;
|
Zeile 5277 | Zeile 5310 |
---|
31, 30, 31,
|
31, 30, 31,
|
31, 30, 31,
| 31, 30, 31,
|
30, 31 );
| 30, 31 );
|
Zeile 5403 | Zeile 5436 |
---|
$age = $year-$bday[2];
if(($month == $bday[1] && $day < $bday[0]) || $month < $bday[1])
|
$age = $year-$bday[2];
if(($month == $bday[1] && $day < $bday[0]) || $month < $bday[1])
|
{
| {
|
--$age; } return $age;
| --$age; } return $age;
|
Zeile 5433 | Zeile 5466 |
---|
$firstpost['username'] = $firstpost['postusername']; } $firstpost['username'] = $db->escape_string($firstpost['username']);
|
$firstpost['username'] = $firstpost['postusername']; } $firstpost['username'] = $db->escape_string($firstpost['username']);
|
$update_array = array(
| $update_array = array(
|
'firstpost' => (int)$firstpost['pid'], 'username' => $firstpost['username'], 'uid' => (int)$firstpost['uid'],
| 'firstpost' => (int)$firstpost['pid'], 'username' => $firstpost['username'], 'uid' => (int)$firstpost['uid'],
|
Zeile 5465 | Zeile 5498 |
---|
if(empty($lastpost['username'])) { $lastpost['username'] = $lastpost['postusername'];
|
if(empty($lastpost['username'])) { $lastpost['username'] = $lastpost['postusername'];
|
}
| }
|
if(empty($lastpost['dateline'])) {
| if(empty($lastpost['dateline'])) {
|
Zeile 5527 | Zeile 5560 |
---|
}
return $string_length;
|
}
return $string_length;
|
}
| }
|
/** * Cuts a string at a specified point, mb strings accounted for
| /** * Cuts a string at a specified point, mb strings accounted for
|
Zeile 5701 | Zeile 5734 |
---|
*/ function get_event_poster($event) {
|
*/ function get_event_poster($event) {
|
| $event['username'] = htmlspecialchars_uni($event['username']);
|
$event['username'] = format_name($event['username'], $event['usergroup'], $event['displaygroup']); $event_poster = build_profile_link($event['username'], $event['author']); return $event_poster;
| $event['username'] = format_name($event['username'], $event['usergroup'], $event['displaygroup']); $event_poster = build_profile_link($event['username'], $event['author']); return $event_poster;
|
Zeile 5717 | Zeile 5751 |
---|
global $mybb;
$event_date = explode("-", $event['date']);
|
global $mybb;
$event_date = explode("-", $event['date']);
|
$event_date = mktime(0, 0, 0, $event_date[1], $event_date[0], $event_date[2]);
| $event_date = gmmktime(0, 0, 0, $event_date[1], $event_date[0], $event_date[2]);
|
$event_date = my_date($mybb->settings['dateformat'], $event_date);
return $event_date;
| $event_date = my_date($mybb->settings['dateformat'], $event_date);
return $event_date;
|
Zeile 5776 | Zeile 5810 |
---|
if(!empty($target)) { $target = " target=\"{$target}\"";
|
if(!empty($target)) { $target = " target=\"{$target}\"";
|
}
| }
|
if(!empty($onclick)) {
| if(!empty($onclick)) {
|
Zeile 5805 | Zeile 5839 |
---|
else { $link = str_replace("{fid}", $fid, FORUM_URL);
|
else { $link = str_replace("{fid}", $fid, FORUM_URL);
|
return htmlspecialchars_uni($link); } }
| return htmlspecialchars_uni($link); } }
|
/** * Build the thread link.
| /** * Build the thread link.
|
Zeile 5820 | Zeile 5854 |
---|
function get_thread_link($tid, $page=0, $action='') { if($page > 1)
|
function get_thread_link($tid, $page=0, $action='') { if($page > 1)
|
{ if($action) { $link = THREAD_URL_ACTION;
| { if($action) { $link = THREAD_URL_ACTION;
|
$link = str_replace("{action}", $action, $link); } else
| $link = str_replace("{action}", $action, $link); } else
|
Zeile 5900 | Zeile 5934 |
---|
$link = str_replace("{month}", $month, CALENDAR_URL_DAY); $link = str_replace("{year}", $year, $link); $link = str_replace("{day}", $day, $link);
|
$link = str_replace("{month}", $month, CALENDAR_URL_DAY); $link = str_replace("{year}", $year, $link); $link = str_replace("{day}", $day, $link);
|
$link = str_replace("{calendar}", $calendar, $link);
| $link = str_replace("{calendar}", $calendar, $link);
|
return htmlspecialchars_uni($link); } else if($month > 0)
| return htmlspecialchars_uni($link); } else if($month > 0)
|
Zeile 6171 | Zeile 6205 |
---|
} } }
|
} } }
|
|
|
$inactiveforums = implode(",", $inactive);
return $inactiveforums;
| $inactiveforums = implode(",", $inactive);
return $inactiveforums;
|
Zeile 6197 | Zeile 6231 |
---|
// Find better solution to prevent clearing cookies $loginattempts = 0; $failedlogin = 0;
|
// Find better solution to prevent clearing cookies $loginattempts = 0; $failedlogin = 0;
|
|
|
if(!empty($mybb->cookies['loginattempts'])) { $loginattempts = $mybb->cookies['loginattempts'];
| if(!empty($mybb->cookies['loginattempts'])) { $loginattempts = $mybb->cookies['loginattempts'];
|
Zeile 6222 | Zeile 6256 |
---|
else { $failedtime = $mybb->cookies['failedlogin'];
|
else { $failedtime = $mybb->cookies['failedlogin'];
|
}
| }
|
$secondsleft = $mybb->settings['failedlogintime'] * 60 + $failedtime - $now; $hoursleft = floor($secondsleft / 3600); $minsleft = floor(($secondsleft / 60) % 60);
| $secondsleft = $mybb->settings['failedlogintime'] * 60 + $failedtime - $now; $hoursleft = floor($secondsleft / 3600); $minsleft = floor(($secondsleft / 60) % 60);
|
Zeile 6233 | Zeile 6267 |
---|
if(empty($failedlogin)) { my_setcookie('failedlogin', $now);
|
if(empty($failedlogin)) { my_setcookie('failedlogin', $now);
|
if($fatal) { error($lang->sprintf($lang->failed_login_wait, $hoursleft, $minsleft, $secsleft));
| if($fatal) { error($lang->sprintf($lang->failed_login_wait, $hoursleft, $minsleft, $secsleft));
|
}
return false;
| }
return false;
|
Zeile 6273 | Zeile 6307 |
---|
/** * Validates the format of an email address.
|
/** * Validates the format of an email address.
|
*
| *
|
* @param string $email The string to check. * @return boolean True when valid, false when invalid. */
| * @param string $email The string to check. * @return boolean True when valid, false when invalid. */
|
Zeile 6289 | Zeile 6323 |
---|
/** * Checks to see if the email is already in use by another
|
/** * Checks to see if the email is already in use by another
|
*
| *
|
* @param string $email The email to check. * @param int $uid User ID of the user (updating only) * @return boolean True when in use, false when not.
| * @param string $email The email to check. * @param int $uid User ID of the user (updating only) * @return boolean True when in use, false when not.
|
Zeile 6304 | Zeile 6338 |
---|
$uid_string = " AND uid != '".(int)$uid."'"; } $query = $db->simple_select("users", "COUNT(email) as emails", "email = '".$db->escape_string($email)."'{$uid_string}");
|
$uid_string = " AND uid != '".(int)$uid."'"; } $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;
| if($db->fetch_field($query, "emails") > 0) { return true;
|
Zeile 6320 | Zeile 6354 |
---|
function rebuild_settings() { global $db, $mybb;
|
function rebuild_settings() { global $db, $mybb;
|
|
|
if(!file_exists(MYBB_ROOT."inc/settings.php"))
|
if(!file_exists(MYBB_ROOT."inc/settings.php"))
|
{
| {
|
$mode = "x";
|
$mode = "x";
|
}
| }
|
else { $mode = "w";
| else { $mode = "w";
|
Zeile 6335 | Zeile 6369 |
---|
"order_dir" => "ASC" ); $query = $db->simple_select("settings", "value, name", "", $options);
|
"order_dir" => "ASC" ); $query = $db->simple_select("settings", "value, name", "", $options);
|
|
|
$settings = null; while($setting = $db->fetch_array($query)) {
| $settings = null; while($setting = $db->fetch_array($query)) {
|
Zeile 6365 | Zeile 6399 |
---|
if($mybb->settings['minsearchword'] < 1) { $mybb->settings['minsearchword'] = 3;
|
if($mybb->settings['minsearchword'] < 1) { $mybb->settings['minsearchword'] = 3;
|
}
| }
|
if(is_array($terms)) { $terms = implode(' ', $terms);
| if(is_array($terms)) { $terms = implode(' ', $terms);
|
Zeile 6396 | Zeile 6430 |
---|
if($inquote) { $words[] = trim($phrase);
|
if($inquote) { $words[] = trim($phrase);
|
}
| }
|
else { $split_words = preg_split("#\s{1,}#", $phrase, -1);
| else { $split_words = preg_split("#\s{1,}#", $phrase, -1);
|
Zeile 6412 | Zeile 6446 |
---|
} $words[] = trim($word); }
|
} $words[] = trim($word); }
|
} }
| } }
|
$inquote = !$inquote; } }
| $inquote = !$inquote; } }
|
Zeile 6438 | Zeile 6472 |
---|
if(!is_array($words)) { return false;
|
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, create_function('$a,$b', 'return strlen($b) - strlen($a);'));
| // 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, create_function('$a,$b', 'return strlen($b) - strlen($a);'));
|
Zeile 6456 | Zeile 6490 |
---|
{ continue; }
|
{ continue; }
|
|
|
// Now make PREG compatible $find = "#(?!<.*?)(".preg_quote($word, "#").")(?![^<>]*?>)#ui"; $replacement = "<span class=\"highlight\" style=\"padding-left: 0px; padding-right: 0px;\">$1</span>";
| // Now make PREG compatible $find = "#(?!<.*?)(".preg_quote($word, "#").")(?![^<>]*?>)#ui"; $replacement = "<span class=\"highlight\" style=\"padding-left: 0px; padding-right: 0px;\">$1</span>";
|
Zeile 6464 | Zeile 6498 |
---|
}
return $highlight_cache;
|
}
return $highlight_cache;
|
}
| }
|
/** * Converts a decimal reference of a character to its UTF-8 equivalent
| /** * Converts a decimal reference of a character to its UTF-8 equivalent
|
Zeile 6478 | Zeile 6512 |
---|
$dest = '';
if($src < 0)
|
$dest = '';
if($src < 0)
|
{ return false;
| { return false;
|
} elseif($src <= 0x007f) {
| } elseif($src <= 0x007f) {
|
Zeile 6495 | Zeile 6529 |
---|
$dest .= chr(0xe0 | ($src >> 12)); $dest .= chr(0x80 | (($src >> 6) & 0x003f)); $dest .= chr(0x80 | ($src & 0x003f));
|
$dest .= chr(0xe0 | ($src >> 12)); $dest .= chr(0x80 | (($src >> 6) & 0x003f)); $dest .= chr(0x80 | ($src & 0x003f));
|
}
| }
|
elseif($src <= 0x10ffff) { $dest .= chr(0xf0 | ($src >> 18));
| elseif($src <= 0x10ffff) { $dest .= chr(0xf0 | ($src >> 18));
|
Zeile 6528 | Zeile 6562 |
---|
// Make regular expression * match $banned_username['filter'] = str_replace('\*', '(.*)', preg_quote($banned_username['filter'], '#')); if(preg_match("#(^|\b){$banned_username['filter']}($|\b)#i", $username))
|
// Make regular expression * match $banned_username['filter'] = str_replace('\*', '(.*)', preg_quote($banned_username['filter'], '#')); if(preg_match("#(^|\b){$banned_username['filter']}($|\b)#i", $username))
|
{ // Updating last use if($update_lastuse == true) {
| { // Updating last use if($update_lastuse == true) {
|
$db->update_query("banfilters", array("lastuse" => TIME_NOW), "fid='{$banned_username['fid']}'"); } return true; } } // Still here - good username
|
$db->update_query("banfilters", array("lastuse" => TIME_NOW), "fid='{$banned_username['fid']}'"); } return true; } } // Still here - good username
|
return false; }
| return false; }
|
/** * Check if a specific email address has been banned. *
| /** * Check if a specific email address has been banned. *
|
Zeile 6597 | Zeile 6631 |
---|
$banned_ips = $cache->read("bannedips"); if(!is_array($banned_ips))
|
$banned_ips = $cache->read("bannedips"); if(!is_array($banned_ips))
|
{ return false; }
| { return false; }
|
$ip_address = my_inet_pton($ip_address); foreach($banned_ips as $banned_ip)
| $ip_address = my_inet_pton($ip_address); foreach($banned_ips as $banned_ip)
|
Zeile 6676 | Zeile 6710 |
---|
"6.5" => $lang->timezone_gmt_650, "7" => $lang->timezone_gmt_700, "8" => $lang->timezone_gmt_800,
|
"6.5" => $lang->timezone_gmt_650, "7" => $lang->timezone_gmt_700, "8" => $lang->timezone_gmt_800,
|
| "8.5" => $lang->timezone_gmt_850, "8.75" => $lang->timezone_gmt_875,
|
"9" => $lang->timezone_gmt_900, "9.5" => $lang->timezone_gmt_950, "10" => $lang->timezone_gmt_1000,
| "9" => $lang->timezone_gmt_900, "9.5" => $lang->timezone_gmt_950, "10" => $lang->timezone_gmt_1000,
|
Zeile 6754 | Zeile 6790 |
---|
*/ function fetch_remote_file($url, $post_data=array(), $max_redirects=20) {
|
*/ function fetch_remote_file($url, $post_data=array(), $max_redirects=20) {
|
global $mybb;
| global $mybb, $config;
if(!my_validate_url($url, true)) { return false; }
$url_components = @parse_url($url);
if(!isset($url_components['scheme'])) { $url_components['scheme'] = 'https'; } if(!isset($url_components['port'])) { $url_components['port'] = $url_components['scheme'] == 'https' ? 443 : 80; }
if( !$url_components || empty($url_components['host']) || (!empty($url_components['scheme']) && !in_array($url_components['scheme'], array('http', 'https'))) || (!in_array($url_components['port'], array(80, 8080, 443))) || (!empty($config['disallowed_remote_hosts']) && in_array($url_components['host'], $config['disallowed_remote_hosts'])) ) { return false; }
$addresses = get_ip_by_hostname($url_components['host']); $destination_address = $addresses[0];
if(!empty($config['disallowed_remote_addresses'])) { foreach($config['disallowed_remote_addresses'] as $disallowed_address) { $ip_range = fetch_ip_range($disallowed_address);
$packed_address = my_inet_pton($destination_address);
if(is_array($ip_range)) { if(strcmp($ip_range[0], $packed_address) <= 0 && strcmp($ip_range[1], $packed_address) >= 0) { return false; } } elseif($destination_address == $disallowed_address) { return false; } } }
|
$post_body = ''; if(!empty($post_data))
| $post_body = ''; if(!empty($post_data))
|
Zeile 6765 | Zeile 6853 |
---|
} $post_body = ltrim($post_body, '&'); }
|
} $post_body = ltrim($post_body, '&'); }
|
|
|
if(function_exists("curl_init")) {
|
if(function_exists("curl_init")) {
|
$can_followlocation = @ini_get('open_basedir') === '' && !$mybb->safemode;
$request_header = $max_redirects != 0 && !$can_followlocation;
| $fetch_header = $max_redirects > 0;
|
$ch = curl_init();
|
$ch = curl_init();
|
curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, $request_header); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
if($max_redirects != 0 && $can_followlocation)
| $curlopt = array( CURLOPT_URL => $url, CURLOPT_HEADER => $fetch_header, CURLOPT_TIMEOUT => 10, CURLOPT_RETURNTRANSFER => 1, CURLOPT_FOLLOWLOCATION => 0, );
if($ca_bundle_path = get_ca_bundle_path()) { $curlopt[CURLOPT_SSL_VERIFYPEER] = 1; $curlopt[CURLOPT_CAINFO] = $ca_bundle_path; } else { $curlopt[CURLOPT_SSL_VERIFYPEER] = 0; }
$curl_version_info = curl_version(); $curl_version = $curl_version_info['version'];
if(version_compare(PHP_VERSION, '7.0.7', '>=') && version_compare($curl_version, '7.49', '>=')) { // CURLOPT_CONNECT_TO $curlopt[10243] = array( $url_components['host'].':'.$url_components['port'].':'.$destination_address ); } elseif(version_compare(PHP_VERSION, '5.5', '>=') && version_compare($curl_version, '7.21.3', '>='))
|
{
|
{
|
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_MAXREDIRS, $max_redirects);
| // CURLOPT_RESOLVE $curlopt[10203] = array( $url_components['host'].':'.$url_components['port'].':'.$destination_address );
|
}
if(!empty($post_body)) {
|
}
if(!empty($post_body)) {
|
curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_body);
| $curlopt[CURLOPT_POST] = 1; $curlopt[CURLOPT_POSTFIELDS] = $post_body;
|
}
|
}
|
| curl_setopt_array($ch, $curlopt);
|
$response = curl_exec($ch);
|
$response = curl_exec($ch);
|
if($request_header)
| if($fetch_header)
|
{ $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE); $header = substr($response, 0, $header_size);
| { $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE); $header = substr($response, 0, $header_size);
|
Zeile 6811 | Zeile 6924 |
---|
else { $data = $body;
|
else { $data = $body;
|
} } else {
| } } else {
|
$data = $response; }
| $data = $response; }
|
Zeile 6823 | Zeile 6936 |
---|
} else if(function_exists("fsockopen")) {
|
} else if(function_exists("fsockopen")) {
|
$url = @parse_url($url); if(!$url['host']) { return false; } if(!isset($url['port'])) { $url['port'] = 80; } if(!isset($url['path'])) { $url['path'] = "/"; } if(isset($url['query'])) { $url['path'] .= "?{$url['query']}"; }
| if(!isset($url_components['path'])) { $url_components['path'] = "/"; } if(isset($url_components['query'])) { $url_components['path'] .= "?{$url_components['query']}"; }
|
$scheme = '';
|
$scheme = '';
|
if($url['scheme'] == 'https')
| if($url_components['scheme'] == 'https') { $scheme = 'ssl://'; if($url_components['port'] == 80) { $url_components['port'] = 443; } }
if(function_exists('stream_context_create'))
|
{
|
{
|
$scheme = 'ssl://'; if($url['port'] == 80)
| if($url_components['scheme'] == 'https' && $ca_bundle_path = get_ca_bundle_path())
|
{
|
{
|
$url['port'] = 443;
| $context = stream_context_create(array( 'ssl' => array( 'verify_peer' => true, 'verify_peer_name' => true, 'peer_name' => $url_components['host'], 'cafile' => $ca_bundle_path, ), )); } else { $context = stream_context_create(array( 'ssl' => array( 'verify_peer' => false, 'verify_peer_name' => false, ), ));
|
}
|
}
|
}
$fp = @fsockopen($scheme.$url['host'], $url['port'], $error_no, $error, 10);
| $fp = @stream_socket_client($scheme.$destination_address.':'.(int)$url_components['port'], $error_no, $error, 10, STREAM_CLIENT_CONNECT, $context); } else { $fp = @fsockopen($scheme.$url_components['host'], (int)$url_components['port'], $error_no, $error, 10); }
|
@stream_set_timeout($fp, 10); if(!$fp) { return false; } $headers = array();
|
@stream_set_timeout($fp, 10); if(!$fp) { return false; } $headers = array();
|
if(!empty($post_body)) { $headers[] = "POST {$url['path']} HTTP/1.0";
| if(!empty($post_body)) { $headers[] = "POST {$url_components['path']} HTTP/1.0";
|
$headers[] = "Content-Length: ".strlen($post_body); $headers[] = "Content-Type: application/x-www-form-urlencoded"; } else {
|
$headers[] = "Content-Length: ".strlen($post_body); $headers[] = "Content-Type: application/x-www-form-urlencoded"; } else {
|
$headers[] = "GET {$url['path']} HTTP/1.0";
| $headers[] = "GET {$url_components['path']} HTTP/1.0";
|
}
|
}
|
$headers[] = "Host: {$url['host']}";
| $headers[] = "Host: {$url_components['host']}";
|
$headers[] = "Connection: Close"; $headers[] = '';
| $headers[] = "Connection: Close"; $headers[] = '';
|
Zeile 6888 | Zeile 7021 |
---|
if(!@fwrite($fp, $headers)) { return false;
|
if(!@fwrite($fp, $headers)) { return false;
|
}
| }
|
$data = null;
while(!feof($fp))
| $data = null;
while(!feof($fp))
|
Zeile 6898 | Zeile 7031 |
---|
} fclose($fp);
|
} fclose($fp);
|
$data = explode("\r\n\r\n", $data, 2);
| $data = explode("\r\n\r\n", $data, 2);
|
$header = $data[0]; $status_line = current(explode("\n\n", $header, 1)); $body = $data[1];
|
$header = $data[0]; $status_line = current(explode("\n\n", $header, 1)); $body = $data[1];
|
if($max_redirects != 0 && (strstr($status_line, ' 301 ') || strstr($status_line, ' 302 ')))
| if($max_redirects > 0 && (strstr($status_line, ' 301 ') || strstr($status_line, ' 302 ')))
|
{ preg_match('/Location:(.*?)(?:\n|$)/', $header, $matches);
|
{ preg_match('/Location:(.*?)(?:\n|$)/', $header, $matches);
|
|
|
if($matches) { $data = fetch_remote_file(trim(array_pop($matches)), $post_data, --$max_redirects);
| if($matches) { $data = fetch_remote_file(trim(array_pop($matches)), $post_data, --$max_redirects);
|
Zeile 6915 | Zeile 7048 |
---|
} else {
|
} else {
|
$data = $body;
| $data = $body; }
return $data; } else { return false; } }
/** * Resolves a hostname into a set of IP addresses. * * @param string $hostname The hostname to be resolved * @return array|bool The resulting IP addresses. False on failure */ function get_ip_by_hostname($hostname) { $addresses = @gethostbynamel($hostname);
if(!$addresses) { $result_set = @dns_get_record($hostname, DNS_A | DNS_AAAA);
if($result_set) { $addresses = array_column($result_set, 'ip'); } else { return false;
|
}
|
}
|
return $data; } else if(empty($post_data)) { return @implode("", @file($url)); } else { return false;
| |
}
|
}
|
| return $addresses; }
/** * Returns the location of the CA bundle defined in the PHP configuration. * * @return string|bool The location of the CA bundle, false if not set */ function get_ca_bundle_path() { if($path = ini_get('openssl.cafile')) { return $path; } if($path = ini_get('curl.cainfo')) { return $path; }
return false;
|
}
/**
| }
/**
|
Zeile 6968 | Zeile 7143 |
---|
function is_member($groups, $user = false) { global $mybb;
|
function is_member($groups, $user = false) { global $mybb;
|
|
|
if(empty($groups)) { return array();
| if(empty($groups)) { return array();
|
Zeile 7582 | Zeile 7757 |
---|
global $mybb, $checksums, $bad_verify_files;
// We don't need to check these types of files
|
global $mybb, $checksums, $bad_verify_files;
// We don't need to check these types of files
|
$ignore = array(".", "..", ".svn", "config.php", "settings.php", "Thumb.db", "config.default.php", "lock", "htaccess.txt", "logo.gif", "logo.png");
| $ignore = array(".", "..", ".svn", "config.php", "settings.php", "Thumb.db", "config.default.php", "lock", "htaccess.txt", "htaccess-nginx.txt", "logo.gif", "logo.png");
|
$ignore_ext = array("attach");
if(substr($path, -1, 1) == "/")
| $ignore_ext = array("attach");
if(substr($path, -1, 1) == "/")
|
Zeile 8412 | Zeile 8587 |
---|
}
return $success;
|
}
return $success;
|
| }
/** * Validate an url * * @param string $url The url to validate. * @param bool $relative_path Whether or not the url could be a relative path. * @param bool $allow_local Whether or not the url could be pointing to local networks. * * @return bool Whether this is a valid url. */ function my_validate_url($url, $relative_path=false, $allow_local=false) { if($allow_local) { $regex = '_^(?:(?:https?|ftp)://)(?:\S+(?::\S*)?@)?(?:(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:localhost|(?:(?:[a-z\x{00a1}-\x{ffff}0-9]-*)*[a-z\x{00a1}-\x{ffff}0-9]+)(?:\.(?:[a-z\x{00a1}-\x{ffff}0-9]-*)*[a-z\x{00a1}-\x{ffff}0-9]+)*(?:\.(?:[a-z\x{00a1}-\x{ffff}]{2,}))\.?))(?::\d{2,5})?(?:[/?#]\S*)?$_iuS'; } else { $regex = '_^(?:(?:https?|ftp)://)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\x{00a1}-\x{ffff}0-9]-*)*[a-z\x{00a1}-\x{ffff}0-9]+)(?:\.(?:[a-z\x{00a1}-\x{ffff}0-9]-*)*[a-z\x{00a1}-\x{ffff}0-9]+)*(?:\.(?:[a-z\x{00a1}-\x{ffff}]{2,}))\.?)(?::\d{2,5})?(?:[/?#]\S*)?$_iuS'; }
if($relative_path && my_substr($url, 0, 1) == '/' || preg_match($regex, $url)) { return true; } return false; }
/** * Strip html tags from string, also removes <script> and <style> contents. * * @param string $string String to stripe * @param string $allowable_tags Allowed html tags * * @return string Striped string */ function my_strip_tags($string, $allowable_tags = '') { $pattern = array( '@(<)style[^(>)]*?(>).*?(<)/style(>)@siu', '@(<)script[^(>)]*?.*?(<)/script(>)@siu', '@<style[^>]*?>.*?</style>@siu', '@<script[^>]*?.*?</script>@siu', ); $string = preg_replace($pattern, '', $string); return strip_tags($string, $allowable_tags); }
/** * Escapes a RFC 4180-compliant CSV string. * Based on https://github.com/Automattic/camptix/blob/f80725094440bf09861383b8f11e96c177c45789/camptix.php#L2867 * * @param string $string The string to be escaped * @param boolean $escape_active_content Whether or not to escape active content trigger characters * @return string The escaped string */ function my_escape_csv($string, $escape_active_content=true) { if($escape_active_content) { $active_content_triggers = array('=', '+', '-', '@'); $delimiters = array(',', ';', ':', '|', '^', "\n", "\t", " ");
$first_character = mb_substr($string, 0, 1);
if( in_array($first_character, $active_content_triggers, true) || in_array($first_character, $delimiters, true) ) { $string = "'".$string; }
foreach($delimiters as $delimiter) { foreach($active_content_triggers as $trigger) { $string = str_replace($delimiter.$trigger, $delimiter."'".$trigger, $string); } } }
$string = str_replace('"', '""', $string);
return $string;
|
}
| }
|