Zeile 598 | Zeile 598 |
---|
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 865 | Zeile 865 |
---|
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 966 | Zeile 966 |
---|
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))
|
{ header("Location: {$mybb->settings['bburl']}/{$url}"); }
| { header("Location: {$mybb->settings['bburl']}/{$url}"); }
|
Zeile 1209 | Zeile 1209 |
---|
* 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 1224 |
---|
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; }
foreach($groupscache[$gid] as $perm => $access) { if(!in_array($perm, $grouppermignore))
|
continue; }
foreach($groupscache[$gid] as $perm => $access) { if(!in_array($perm, $grouppermignore))
|
{
| {
|
if(isset($usergroup[$perm])) { $permbit = $usergroup[$perm];
| if(isset($usergroup[$perm])) { $permbit = $usergroup[$perm];
|
Zeile 1265 | Zeile 1267 |
---|
}
return $usergroup;
|
}
return $usergroup;
|
}
| }
|
/** * Fetch the display group properties for a specific display group
| /** * Fetch the display group properties for a specific display group
|
Zeile 1329 | Zeile 1331 |
---|
}
$groupperms = $mybb->usergroup;
|
}
$groupperms = $mybb->usergroup;
|
} }
if(!is_array($forum_cache)) { $forum_cache = cache_forums();
if(!$forum_cache) { return false; }
| } }
if(!is_array($forum_cache)) { $forum_cache = cache_forums();
if(!$forum_cache) { return false; }
|
}
if(!is_array($fpermcache))
| }
if(!is_array($fpermcache))
|
Zeile 1367 | Zeile 1369 |
---|
return $cached_forum_permissions[$gid]; } }
|
return $cached_forum_permissions[$gid]; } }
|
|
|
/** * Fetches the permissions for a specific forum/group applying the inheritance scheme. * Called by forum_permissions()
| /** * Fetches the permissions for a specific forum/group applying the inheritance scheme. * Called by forum_permissions()
|
Zeile 1423 | Zeile 1425 |
---|
}
foreach($level_permissions as $permission => $access)
|
}
foreach($level_permissions as $permission => $access)
|
{
| {
|
if(empty($current_permissions[$permission]) || $access >= $current_permissions[$permission] || ($access == "yes" && $current_permissions[$permission] == "no")) { $current_permissions[$permission] = $access;
| if(empty($current_permissions[$permission]) || $access >= $current_permissions[$permission] || ($access == "yes" && $current_permissions[$permission] == "no")) { $current_permissions[$permission] = $access;
|
Zeile 1450 | Zeile 1452 |
---|
// Figure out if we can reply more than our own threads if($only_reply_own_threads == 0)
|
// Figure out if we can reply more than our own threads if($only_reply_own_threads == 0)
|
{
| {
|
$current_permissions["canonlyreplyownthreads"] = 0; }
| $current_permissions["canonlyreplyownthreads"] = 0; }
|
Zeile 1519 | Zeile 1521 |
---|
else { eval("\$pwnote = \"".$templates->get("forumdisplay_password_wrongpass")."\";");
|
else { eval("\$pwnote = \"".$templates->get("forumdisplay_password_wrongpass")."\";");
|
$showform = true; }
| $showform = true; }
|
} else {
| } else {
|
Zeile 1562 | Zeile 1564 |
---|
/** * Return the permissions for a moderator in a specific forum
|
/** * Return the permissions for a moderator in a specific forum
|
*
| *
|
* @param int $fid The forum ID * @param int $uid The user ID to fetch permissions for (0 assumes current logged in user) * @param string $parentslist The parent list for the forum (if blank, will be fetched)
| * @param int $fid The forum ID * @param int $uid The user ID to fetch permissions for (0 assumes current logged in user) * @param string $parentslist The parent list for the forum (if blank, will be fetched)
|
Zeile 1714 | Zeile 1716 |
---|
{ 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 1794 | Zeile 1801 |
---|
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 2012 | Zeile 2026 |
---|
{ $expectedLength = (int)$matches[1]; $str = $matches[2];
|
{ $expectedLength = (int)$matches[1]; $str = $matches[2];
|
}
| }
|
else
|
else
|
{
| {
|
// object or unknown/malformed type return false; }
| // object or unknown/malformed type return false; }
|
Zeile 2022 | Zeile 2036 |
---|
switch($state) { case 3: // in array, expecting value or another array
|
switch($state) { case 3: // in array, expecting value or another array
|
if($type == 'a') { if(count($stack) >= MAX_SERIALIZED_ARRAY_DEPTH) {
| if($type == 'a') { if(count($stack) >= MAX_SERIALIZED_ARRAY_DEPTH) {
|
// array nesting exceeds MAX_SERIALIZED_ARRAY_DEPTH return false; }
| // array nesting exceeds MAX_SERIALIZED_ARRAY_DEPTH return false; }
|
Zeile 2033 | Zeile 2047 |
---|
$stack[] = &$list; $list[$key] = array(); $list = &$list[$key];
|
$stack[] = &$list; $list[$key] = array(); $list = &$list[$key];
|
$expected[] = $expectedLength; $state = 2; break; } if($type != '}') { $list[$key] = $value;
| $expected[] = $expectedLength; $state = 2; break; } if($type != '}') { $list[$key] = $value;
|
$state = 2; break; }
| $state = 2; break; }
|
Zeile 2064 | Zeile 2078 |
---|
array_pop($expected); if(count($expected) == 0) { $state = 1;
|
array_pop($expected); if(count($expected) == 0) { $state = 1;
|
} break; }
| } break; }
|
if($type == 'i' || $type == 's') { if(count($list) >= MAX_SERIALIZED_ARRAY_LENGTH)
| if($type == 'i' || $type == 's') { if(count($list) >= MAX_SERIALIZED_ARRAY_LENGTH)
|
Zeile 2121 | Zeile 2135 |
---|
return false; } return $data;
|
return false; } return $data;
|
}
/**
| }
/**
|
* Credits go to https://github.com/piwik * Wrapper for _safe_unserialize() that handles exceptions and multibyte encoding issue *
| * Credits go to https://github.com/piwik * Wrapper for _safe_unserialize() that handles exceptions and multibyte encoding issue *
|
Zeile 2133 | Zeile 2147 |
---|
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'); }
| 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);
|
$out = _safe_unserialize($str);
|
|
|
if(isset($mbIntEnc)) { mb_internal_encoding($mbIntEnc); }
|
if(isset($mbIntEnc)) { mb_internal_encoding($mbIntEnc); }
|
|
|
return $out; }
| return $out; }
|
Zeile 2165 | Zeile 2179 |
---|
{ return 'N;'; }
|
{ return 'N;'; }
|
if(is_bool($value)) { return 'b:'.(int)$value.';'; }
| if(is_bool($value)) { return 'b:'.(int)$value.';'; }
|
if(is_int($value))
|
if(is_int($value))
|
{
| {
|
return 'i:'.$value.';';
|
return 'i:'.$value.';';
|
}
| }
|
if(is_float($value)) { return 'd:'.str_replace(',', '.', $value).';'; }
|
if(is_float($value)) { return 'd:'.str_replace(',', '.', $value).';'; }
|
|
|
if(is_string($value)) { return 's:'.strlen($value).':"'.$value.'";';
|
if(is_string($value)) { return 's:'.strlen($value).':"'.$value.'";';
|
}
| }
|
if(is_array($value)) { $out = '';
| if(is_array($value)) { $out = '';
|
Zeile 2193 | Zeile 2207 |
---|
{ $out .= _safe_serialize($k) . _safe_serialize($v); }
|
{ $out .= _safe_serialize($k) . _safe_serialize($v); }
|
|
|
return 'a:'.count($value).':{'.$out.'}'; }
// safe_serialize cannot my_serialize resources or objects return false;
|
return 'a:'.count($value).':{'.$out.'}'; }
// safe_serialize cannot my_serialize resources or objects return false;
|
}
| }
|
/** * Credits go to https://github.com/piwik * Wrapper for _safe_serialize() that handles exceptions and multibyte encoding issue
| /** * Credits go to https://github.com/piwik * Wrapper for _safe_serialize() that handles exceptions and multibyte encoding issue
|
Zeile 2216 | Zeile 2230 |
---|
$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 2244 | Zeile 2258 |
---|
{ // sys_getloadavg() will return an array with [0] being load within the last minute. $serverload = sys_getloadavg();
|
{ // sys_getloadavg() will return an array with [0] being load within the last minute. $serverload = sys_getloadavg();
|
$serverload[0] = round($serverload[0], 4);
| $serverload[0] = round($serverload[0], 4);
|
} else if(@file_exists("/proc/loadavg") && $load = @file_get_contents("/proc/loadavg")) {
| } else if(@file_exists("/proc/loadavg") && $load = @file_get_contents("/proc/loadavg")) {
|
Zeile 2282 | Zeile 2296 |
---|
{ return $lang->unknown; }
|
{ return $lang->unknown; }
|
} } else { return $lang->unknown;
| } } else { return $lang->unknown;
|
}
|
}
|
$returnload = trim($serverload[0]);
| $returnload = trim($serverload[0]);
|
return $returnload; }
| return $returnload; }
|
Zeile 2300 | Zeile 2314 |
---|
* @return int The amount of memory allocated to the script. */ function get_memory_usage()
|
* @return int The amount of memory allocated to the script. */ function get_memory_usage()
|
{
| {
|
if(function_exists('memory_get_peak_usage')) { return memory_get_peak_usage(true);
| if(function_exists('memory_get_peak_usage')) { return memory_get_peak_usage(true);
|
Zeile 2327 | Zeile 2341 |
---|
{ // Update stats after all changes are done add_shutdown('update_stats', array(array(), true));
|
{ // Update stats after all changes are done add_shutdown('update_stats', array(array(), true));
|
}
| }
|
if(empty($stats_changes) || $stats_changes['inserted']) { $stats_changes = array(
| if(empty($stats_changes) || $stats_changes['inserted']) { $stats_changes = array(
|
Zeile 2342 | Zeile 2356 |
---|
'inserted' => false // Reset after changes are inserted into cache ); $stats = $stats_changes;
|
'inserted' => false // Reset after changes are inserted into cache ); $stats = $stats_changes;
|
}
| }
|
if($force) // Force writing to cache? {
| if($force) // Force writing to cache? {
|
Zeile 2355 | Zeile 2369 |
---|
$changes = $stats_changes; } else
|
$changes = $stats_changes; } else
|
{
| {
|
$stats = $stats_changes; }
$new_stats = array(); $counters = array('numthreads', 'numunapprovedthreads', 'numposts', 'numunapprovedposts', 'numusers', 'numdeletedposts', 'numdeletedthreads');
|
$stats = $stats_changes; }
$new_stats = array(); $counters = array('numthreads', 'numunapprovedthreads', 'numposts', 'numunapprovedposts', 'numusers', 'numdeletedposts', 'numdeletedthreads');
|
foreach($counters as $counter) { if(array_key_exists($counter, $changes)) { if(substr($changes[$counter], 0, 2) == "+-") { $changes[$counter] = substr($changes[$counter], 1);
| 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) == "-")
| } // Adding or subtracting from previous value? if(substr($changes[$counter], 0, 1) == "+" || substr($changes[$counter], 0, 1) == "-")
|
Zeile 2406 | Zeile 2420 |
---|
{ $stats_changes = array_merge($stats, $new_stats); // Overwrite changed values return;
|
{ $stats_changes = array_merge($stats, $new_stats); // Overwrite changed values return;
|
}
| }
|
// Fetch latest user if the user count is changing if(array_key_exists('numusers', $changes))
|
// 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'];
|
$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(is_array($stats))
|
}
if(!empty($new_stats)) { if(is_array($stats))
|
{
| {
|
$stats = array_merge($stats, $new_stats); // Overwrite changed values } else
| $stats = array_merge($stats, $new_stats); // Overwrite changed values } else
|
Zeile 2459 | Zeile 2473 |
---|
// Fetch above counters for this forum $query = $db->simple_select("forums", implode(",", $counters), "fid='{$fid}'"); $forum = $db->fetch_array($query);
|
// Fetch above counters for this forum $query = $db->simple_select("forums", implode(",", $counters), "fid='{$fid}'"); $forum = $db->fetch_array($query);
|
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?
| 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) == "-") { if((int)$changes[$counter] != 0)
| if(substr($changes[$counter], 0, 1) == "+" || substr($changes[$counter], 0, 1) == "-") { if((int)$changes[$counter] != 0)
|
Zeile 2524 | Zeile 2538 |
---|
}
if(array_key_exists('posts', $update_query))
|
}
if(array_key_exists('posts', $update_query))
|
{
| {
|
$posts_diff = $update_query['posts'] - $forum['posts']; if($posts_diff > -1) {
| $posts_diff = $update_query['posts'] - $forum['posts']; if($posts_diff > -1) {
|
Zeile 2566 | Zeile 2580 |
---|
{ $deletedthreads_diff = $update_query['deletedthreads'] - $forum['deletedthreads']; if($deletedthreads_diff > -1)
|
{ $deletedthreads_diff = $update_query['deletedthreads'] - $forum['deletedthreads']; if($deletedthreads_diff > -1)
|
{
| {
|
$new_stats['numdeletedthreads'] = "+{$deletedthreads_diff}";
|
$new_stats['numdeletedthreads'] = "+{$deletedthreads_diff}";
|
}
| }
|
else { $new_stats['numdeletedthreads'] = "{$deletedthreads_diff}"; }
|
else { $new_stats['numdeletedthreads'] = "{$deletedthreads_diff}"; }
|
}
| }
|
if(!empty($new_stats)) { update_stats($new_stats);
|
if(!empty($new_stats)) { update_stats($new_stats);
|
} }
| } }
|
/** * Update the last post information for a specific forum
| /** * Update the last post information for a specific forum
|
Zeile 2802 | Zeile 2816 |
---|
* Deletes a thread from the database * * @param int $tid The thread ID
|
* Deletes a thread from the database * * @param int $tid The thread ID
|
* @return bool
| * @return bool
|
*/ function delete_thread($tid) {
| */ function delete_thread($tid) {
|
Zeile 2975 | Zeile 2989 |
---|
{ $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 3000 | Zeile 3014 |
---|
}
if($displaygroup != 0)
|
}
if($displaygroup != 0)
|
{
| {
|
$usergroup = $displaygroup; }
$ugroup = $groupscache[$usergroup]; $format = $ugroup['namestyle']; $userin = substr_count($format, "{username}");
|
$usergroup = $displaygroup; }
$ugroup = $groupscache[$usergroup]; $format = $ugroup['namestyle']; $userin = substr_count($format, "{username}");
|
|
|
if($userin == 0) { $format = "{username}";
| if($userin == 0) { $format = "{username}";
|
Zeile 3025 | Zeile 3039 |
---|
* @param string $dimensions Dimensions of the avatar, width x height (e.g. 44|44) * @param string $max_dimensions The maximum dimensions of the formatted avatar * @return array Information for the formatted avatar
|
* @param string $dimensions Dimensions of the avatar, width x height (e.g. 44|44) * @param string $max_dimensions The maximum dimensions of the formatted avatar * @return array Information for the formatted avatar
|
*/
| */
|
function format_avatar($avatar, $dimensions = '', $max_dimensions = '') {
|
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(!$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 3233 |
---|
$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(!$smiliecache)
|
{
| {
|
if(!isset($smilie_cache) || !is_array($smilie_cache))
|
if(!isset($smilie_cache) || !is_array($smilie_cache))
|
{
| {
|
$smilie_cache = $cache->read("smilies");
|
$smilie_cache = $cache->read("smilies");
|
}
| }
|
foreach($smilie_cache as $smilie) { $smilie['image'] = str_replace("{theme}", $theme['imgdir'], $smilie['image']); $smiliecache[$smilie['sid']] = $smilie; } }
|
foreach($smilie_cache as $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 3275 |
---|
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']) {
|
Zeile 3389 | Zeile 3408 |
---|
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 3417 |
---|
{ 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];
|
|
|
$find = str_replace(array('\\', "'"), array('\\\\', "\'"), htmlspecialchars_uni($smilie['find']));
|
$find = str_replace(array('\\', "'"), array('\\\\', "\'"), htmlspecialchars_uni($smilie['find']));
|
|
|
$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 3446 |
---|
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")."\";");
|
}
| }
|
else { $clickablesmilies = ""; } } else
|
else { $clickablesmilies = ""; } } else
|
{
| {
|
$clickablesmilies = ""; }
| $clickablesmilies = ""; }
|
Zeile 3461 | Zeile 3476 |
---|
static $prefixes_cache;
if(is_array($prefixes_cache))
|
static $prefixes_cache;
if(is_array($prefixes_cache))
|
{
| {
|
if($pid > 0 && is_array($prefixes_cache[$pid])) { return $prefixes_cache[$pid]; }
|
if($pid > 0 && is_array($prefixes_cache[$pid])) { return $prefixes_cache[$pid]; }
|
|
|
return $prefixes_cache;
|
return $prefixes_cache;
|
}
$prefix_cache = $cache->read("threadprefixes");
| }
$prefix_cache = $cache->read("threadprefixes");
|
if(!is_array($prefix_cache)) { // No cache $prefix_cache = $cache->read("threadprefixes", true);
|
if(!is_array($prefix_cache)) { // No cache $prefix_cache = $cache->read("threadprefixes", true);
|
|
|
if(!is_array($prefix_cache)) { return array();
|
if(!is_array($prefix_cache)) { return array();
|
} }
| } }
|
$prefixes_cache = array(); foreach($prefix_cache as $prefix) {
| $prefixes_cache = array(); foreach($prefix_cache as $prefix) {
|
Zeile 3521 | Zeile 3536 |
---|
$prefix_cache = build_prefixes(0); if(empty($prefix_cache))
|
$prefix_cache = build_prefixes(0); if(empty($prefix_cache))
|
{
| {
|
// We've got no prefixes to show return ''; }
|
// We've got no prefixes to show return ''; }
|
|
|
// Go through each of our prefixes and decide which ones we can use $prefixes = array(); foreach($prefix_cache as $prefix)
| // Go through each of our prefixes and decide which ones we can use $prefixes = array(); foreach($prefix_cache as $prefix)
|
Zeile 3534 | Zeile 3549 |
---|
{ // Decide whether this prefix can be used in our forum $forums = explode(",", $prefix['forums']);
|
{ // Decide whether this prefix can be used in our forum $forums = explode(",", $prefix['forums']);
|
|
|
if(!in_array($fid, $forums) && $prefix['pid'] != $previous_pid) { // This prefix is not in our forum list continue; }
|
if(!in_array($fid, $forums) && $prefix['pid'] != $previous_pid) { // This prefix is not in our forum list continue; }
|
}
| }
|
if(is_member($prefix['groups']) || $prefix['pid'] == $previous_pid) { // The current user can use this prefix $prefixes[$prefix['pid']] = $prefix;
|
if(is_member($prefix['groups']) || $prefix['pid'] == $previous_pid) { // The current user can use this prefix $prefixes[$prefix['pid']] = $prefix;
|
} }
| } }
|
if(empty($prefixes))
|
if(empty($prefixes))
|
{
| {
|
return ''; }
| return ''; }
|
Zeile 3562 | Zeile 3577 |
---|
if($selected_pid == 'any') { $any_selected = " selected=\"selected\"";
|
if($selected_pid == 'any') { $any_selected = " selected=\"selected\"";
|
}
| }
|
}
$default_selected = "";
| }
$default_selected = "";
|
Zeile 3590 | Zeile 3605 |
---|
else { eval("\$prefixselect = \"".$templates->get("post_prefixselect_single")."\";");
|
else { eval("\$prefixselect = \"".$templates->get("post_prefixselect_single")."\";");
|
}
return $prefixselect; }
| }
return $prefixselect; }
|
/** * Build the thread prefix selection menu for a forum without group permission checks *
| /** * Build the thread prefix selection menu for a forum without group permission checks *
|
Zeile 3607 | Zeile 3622 |
---|
global $cache, $db, $lang, $mybb, $templates;
$fid = (int)$fid;
|
global $cache, $db, $lang, $mybb, $templates;
$fid = (int)$fid;
|
|
|
$prefix_cache = build_prefixes(0); if(empty($prefix_cache)) { // We've got no prefixes to show
|
$prefix_cache = build_prefixes(0); if(empty($prefix_cache)) { // We've got no prefixes to show
|
return ''; }
| return ''; }
|
// Go through each of our prefixes and decide which ones we can use $prefixes = array();
| // Go through each of our prefixes and decide which ones we can use $prefixes = array();
|
Zeile 3644 | Zeile 3659 |
---|
$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 3815 |
---|
{ $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 3930 | Zeile 3945 |
---|
} // 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)
| $size = my_number_format(round(($size / 1152921504606846976), 2))." ".$lang->size_eb; } // Petabyte (1024 Terabytes)
|
Zeile 4136 | Zeile 4151 |
---|
$unviewable[] = $forum['fid']; } }
|
$unviewable[] = $forum['fid']; } }
|
|
|
$unviewableforums = implode(',', $unviewable);
|
$unviewableforums = implode(',', $unviewable);
|
|
|
return $unviewableforums; }
| return $unviewableforums; }
|
Zeile 4155 | Zeile 4170 |
---|
// -2 idea provided by Matt Light (http://www.mephex.com) $format = str_replace("Y", $year, $format); $format = str_replace("y", my_substr($year, -2), $format);
|
// -2 idea provided by Matt Light (http://www.mephex.com) $format = str_replace("Y", $year, $format); $format = str_replace("y", my_substr($year, -2), $format);
|
|
|
return $format; }
| return $format; }
|
Zeile 4167 | Zeile 4182 |
---|
function build_breadcrumb() { global $nav, $navbits, $templates, $theme, $lang, $mybb;
|
function build_breadcrumb() { global $nav, $navbits, $templates, $theme, $lang, $mybb;
|
eval("\$navsep = \"".$templates->get("nav_sep")."\";");
| eval("\$navsep = \"".$templates->get("nav_sep")."\";");
|
$i = 0; $activesep = '';
| $i = 0; $activesep = '';
|
Zeile 4183 | Zeile 4198 |
---|
if(isset($navbits[$key+2])) { $sep = $navsep;
|
if(isset($navbits[$key+2])) { $sep = $navsep;
|
}
| }
|
else { $sep = "";
| else { $sep = "";
|
Zeile 4196 | Zeile 4211 |
---|
if(!$mybb->settings['threadsperpage'] || (int)$mybb->settings['threadsperpage'] < 1) { $mybb->settings['threadsperpage'] = 20;
|
if(!$mybb->settings['threadsperpage'] || (int)$mybb->settings['threadsperpage'] < 1) { $mybb->settings['threadsperpage'] = 20;
|
}
| }
|
$multipage = multipage($navbit['multipage']['num_threads'], $mybb->settings['threadsperpage'], $navbit['multipage']['current_page'], $navbit['multipage']['url'], true); if($multipage) {
| $multipage = multipage($navbit['multipage']['num_threads'], $mybb->settings['threadsperpage'], $navbit['multipage']['current_page'], $navbit['multipage']['url'], true); if($multipage) {
|
Zeile 4267 | Zeile 4282 |
---|
foreach($forum_cache as $key => $val) { $pforumcache[$val['fid']][$val['pid']] = $val;
|
foreach($forum_cache as $key => $val) { $pforumcache[$val['fid']][$val['pid']] = $val;
|
}
| }
|
}
if(is_array($pforumcache[$fid]))
| }
if(is_array($pforumcache[$fid]))
|
Zeile 4601 | Zeile 4616 |
---|
$msecs = 60;
if(isset($options['short']))
|
$msecs = 60;
if(isset($options['short']))
|
{
| {
|
$lang_year = $lang->year_short; $lang_years = $lang->years_short; $lang_month = $lang->month_short;
| $lang_year = $lang->year_short; $lang_years = $lang->years_short; $lang_month = $lang->month_short;
|
Zeile 4656 | Zeile 4671 |
---|
else if($years > 1) { $nicetime['years'] = $years.$lang_years;
|
else if($years > 1) { $nicetime['years'] = $years.$lang_years;
|
}
| }
|
if($months == 1) { $nicetime['months'] = "1".$lang_month;
| if($months == 1) { $nicetime['months'] = "1".$lang_month;
|
Zeile 4712 | Zeile 4727 |
---|
if(!isset($options['seconds']) || $options['seconds'] !== false) { if($seconds == 1)
|
if(!isset($options['seconds']) || $options['seconds'] !== false) { 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 4740 | Zeile 4755 |
---|
if($alttrow == "trow1" && !$reset) { $trow = "trow2";
|
if($alttrow == "trow1" && !$reset) { $trow = "trow2";
|
}
| }
|
else { $trow = "trow1";
| else { $trow = "trow1";
|
Zeile 4753 | Zeile 4768 |
---|
/** * Add a user to a specific additional user group.
|
/** * Add a user to a specific additional user group.
|
* * @param int $uid The user ID
| * * @param int $uid The user ID
|
* @param int $joingroup The user group ID to join * @return bool */
| * @param int $joingroup The user group ID to join * @return bool */
|
Zeile 4823 | Zeile 4838 |
---|
$groups = explode(",", $user['additionalgroups']);
if(is_array($groups))
|
$groups = explode(",", $user['additionalgroups']);
if(is_array($groups))
|
{
| {
|
foreach($groups as $gid) { if(trim($gid) != "" && $leavegroup != $gid && empty($donegroup[$gid]))
| foreach($groups as $gid) { if(trim($gid) != "" && $leavegroup != $gid && empty($donegroup[$gid]))
|
Zeile 4866 | Zeile 4881 |
---|
}
if(!empty($_SERVER['SCRIPT_NAME']))
|
}
if(!empty($_SERVER['SCRIPT_NAME']))
|
{
| {
|
$location = htmlspecialchars_uni($_SERVER['SCRIPT_NAME']);
|
$location = htmlspecialchars_uni($_SERVER['SCRIPT_NAME']);
|
}
| }
|
elseif(!empty($_SERVER['PHP_SELF']))
|
elseif(!empty($_SERVER['PHP_SELF']))
|
{
| {
|
$location = htmlspecialchars_uni($_SERVER['PHP_SELF']); } elseif(!empty($_ENV['PHP_SELF']))
| $location = htmlspecialchars_uni($_SERVER['PHP_SELF']); } elseif(!empty($_ENV['PHP_SELF']))
|
Zeile 4878 | Zeile 4893 |
---|
$location = htmlspecialchars_uni($_ENV['PHP_SELF']); } elseif(!empty($_SERVER['PATH_INFO']))
|
$location = htmlspecialchars_uni($_ENV['PHP_SELF']); } elseif(!empty($_SERVER['PATH_INFO']))
|
{
| {
|
$location = htmlspecialchars_uni($_SERVER['PATH_INFO']);
|
$location = htmlspecialchars_uni($_SERVER['PATH_INFO']);
|
}
| }
|
else { $location = htmlspecialchars_uni($_ENV['PATH_INFO']); }
|
else { $location = htmlspecialchars_uni($_ENV['PATH_INFO']); }
|
|
|
if($quick)
|
if($quick)
|
{ return $location;
| { return $location;
|
}
if($fields == true) { global $mybb;
|
}
if($fields == true) { global $mybb;
|
|
|
if(!is_array($ignore)) { $ignore = array($ignore);
| if(!is_array($ignore)) { $ignore = array($ignore);
|
Zeile 4908 | Zeile 4923 |
---|
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 4997 | Zeile 5012 |
---|
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 5701 | Zeile 5709 |
---|
*/ 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 5726 |
---|
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 6171 | Zeile 6180 |
---|
} } }
|
} } }
|
|
|
$inactiveforums = implode(",", $inactive);
return $inactiveforums;
| $inactiveforums = implode(",", $inactive);
return $inactiveforums;
|
Zeile 6280 | Zeile 6289 |
---|
function validate_email_format($email) { if(strpos($email, ' ') !== false)
|
function validate_email_format($email) { if(strpos($email, ' ') !== false)
|
{ return false; }
| { return false; }
|
// Valid local characters for email addresses: http://www.remote.org/jochen/mail/info/chars.html return preg_match("/^[a-zA-Z0-9&*+\-_.{}~^\?=\/]+@[a-zA-Z0-9-]+\.([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]{2,}$/si", $email); }
| // Valid local characters for email addresses: http://www.remote.org/jochen/mail/info/chars.html return preg_match("/^[a-zA-Z0-9&*+\-_.{}~^\?=\/]+@[a-zA-Z0-9-]+\.([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]{2,}$/si", $email); }
|
Zeile 6392 | Zeile 6401 |
---|
{ $phrase = htmlspecialchars_uni($phrase); if($phrase != "")
|
{ $phrase = htmlspecialchars_uni($phrase); if($phrase != "")
|
{
| {
|
if($inquote) { $words[] = trim($phrase);
| if($inquote) { $words[] = trim($phrase);
|
Zeile 6412 | Zeile 6421 |
---|
} $words[] = trim($word); }
|
} $words[] = trim($word); }
|
} }
| } }
|
$inquote = !$inquote; } }
| $inquote = !$inquote; } }
|
Zeile 6433 | Zeile 6442 |
---|
$words[] = trim($word); } }
|
$words[] = trim($word); } }
|
}
| }
|
if(!is_array($words)) { return false;
| if(!is_array($words)) { return false;
|
Zeile 6448 | Zeile 6457 |
---|
foreach($words as $word) { $word = trim($word);
|
foreach($words as $word) { $word = trim($word);
|
|
|
$word = my_strtolower($word);
// Special boolean operators should be stripped
| $word = my_strtolower($word);
// Special boolean operators should be stripped
|
Zeile 6613 | Zeile 6622 |
---|
$ip_range = fetch_ip_range($banned_ip['filter']); if(is_array($ip_range))
|
$ip_range = fetch_ip_range($banned_ip['filter']); if(is_array($ip_range))
|
{
| {
|
if(strcmp($ip_range[0], $ip_address) <= 0 && strcmp($ip_range[1], $ip_address) >= 0) { $banned = true;
| if(strcmp($ip_range[0], $ip_address) <= 0 && strcmp($ip_range[1], $ip_address) >= 0) { $banned = true;
|
Zeile 6676 | Zeile 6685 |
---|
"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 6765 |
---|
*/ 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;
$url_components = @parse_url($url);
if( !$url_components || empty($url_components['host']) || (!empty($url_components['scheme']) && !in_array($url_components['scheme'], array('http', 'https'))) || (!empty($url_components['port']) && !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; }
if(!empty($config['disallowed_remote_addresses'])) { $addresses = gethostbynamel($url_components['host']); if($addresses) { foreach($config['disallowed_remote_addresses'] as $disallowed_address) { $ip_range = fetch_ip_range($disallowed_address); foreach($addresses as $address) { $packed_address = my_inet_pton($address);
if(is_array($ip_range)) { if(strcmp($ip_range[0], $packed_address) <= 0 && strcmp($ip_range[1], $packed_address) >= 0) { return false; } } elseif($address == $disallowed_address) { return false; } } } } }
|
$post_body = ''; if(!empty($post_data))
| $post_body = ''; if(!empty($post_data))
|
Zeile 6765 | Zeile 6817 |
---|
} $post_body = ltrim($post_body, '&'); }
|
} $post_body = ltrim($post_body, '&'); }
|
|
|
if(function_exists("curl_init")) { $can_followlocation = @ini_get('open_basedir') === '' && !$mybb->safemode;
| if(function_exists("curl_init")) { $can_followlocation = @ini_get('open_basedir') === '' && !$mybb->safemode;
|
Zeile 6783 | Zeile 6835 |
---|
{ curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_MAXREDIRS, $max_redirects);
|
{ curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_MAXREDIRS, $max_redirects);
|
}
| }
|
if(!empty($post_body)) {
| if(!empty($post_body)) {
|
Zeile 6792 | Zeile 6844 |
---|
}
$response = curl_exec($ch);
|
}
$response = curl_exec($ch);
|
|
|
if($request_header) { $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
| if($request_header) { $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
|
Zeile 6802 | Zeile 6854 |
---|
if(in_array(curl_getinfo($ch, CURLINFO_HTTP_CODE), array(301, 302))) { preg_match('/Location:(.*?)(?:\n|$)/', $header, $matches);
|
if(in_array(curl_getinfo($ch, CURLINFO_HTTP_CODE), array(301, 302))) { 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); }
|
}
| }
|
else { $data = $body; }
|
else { $data = $body; }
|
}
| }
|
else { $data = $response;
| else { $data = $response;
|
Zeile 6822 | Zeile 6874 |
---|
return $data; } else if(function_exists("fsockopen"))
|
return $data; } 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']}"; }
$scheme = '';
if($url['scheme'] == 'https') {
| { if(!isset($url_components['port'])) { $url_components['port'] = 80; } if(!isset($url_components['path'])) { $url_components['path'] = "/"; } if(isset($url_components['query'])) { $url_components['path'] .= "?{$url_components['query']}"; }
$scheme = '';
if($url_components['scheme'] == 'https') {
|
$scheme = 'ssl://';
|
$scheme = 'ssl://';
|
if($url['port'] == 80)
| if($url_components['port'] == 80)
|
{
|
{
|
$url['port'] = 443;
| $url_components['port'] = 443;
|
}
|
}
|
}
$fp = @fsockopen($scheme.$url['host'], $url['port'], $error_no, $error, 10);
| }
$fp = @fsockopen($scheme.$url_components['host'], $url_components['port'], $error_no, $error, 10);
|
@stream_set_timeout($fp, 10); if(!$fp) { return false;
|
@stream_set_timeout($fp, 10); if(!$fp) { return false;
|
}
| }
|
$headers = array(); if(!empty($post_body)) {
|
$headers = array(); if(!empty($post_body)) {
|
$headers[] = "POST {$url['path']} HTTP/1.0";
| $headers[] = "POST {$url_components['path']} HTTP/1.0";
|
$headers[] = "Content-Length: ".strlen($post_body); $headers[] = "Content-Type: application/x-www-form-urlencoded";
|
$headers[] = "Content-Length: ".strlen($post_body); $headers[] = "Content-Type: application/x-www-form-urlencoded";
|
}
| }
|
else {
|
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 6882 | Zeile 6929 |
---|
{ // If we have no post body, we need to add an empty element to make sure we've got \r\n\r\n before the (non-existent) body starts $headers[] = '';
|
{ // If we have no post body, we need to add an empty element to make sure we've got \r\n\r\n before the (non-existent) body starts $headers[] = '';
|
}
| }
|
$headers = implode("\r\n", $headers); if(!@fwrite($fp, $headers)) {
| $headers = implode("\r\n", $headers); if(!@fwrite($fp, $headers)) {
|
Zeile 6897 | Zeile 6944 |
---|
$data .= fgets($fp, 12800); } fclose($fp);
|
$data .= fgets($fp, 12800); } fclose($fp);
|
|
|
$data = explode("\r\n\r\n", $data, 2);
$header = $data[0];
| $data = explode("\r\n\r\n", $data, 2);
$header = $data[0];
|
Zeile 6907 | Zeile 6954 |
---|
if($max_redirects != 0 && (strstr($status_line, ' 301 ') || strstr($status_line, ' 302 '))) { preg_match('/Location:(.*?)(?:\n|$)/', $header, $matches);
|
if($max_redirects != 0 && (strstr($status_line, ' 301 ') || strstr($status_line, ' 302 '))) { 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); }
|
}
| }
|
else { $data = $body;
| else { $data = $body;
|
Zeile 6923 | Zeile 6970 |
---|
else if(empty($post_data)) { return @implode("", @file($url));
|
else if(empty($post_data)) { return @implode("", @file($url));
|
} else {
| } else {
|
return false; } }
| return false; } }
|
Zeile 6941 | Zeile 6988 |
---|
static $super_admins;
if(!isset($super_admins))
|
static $super_admins;
if(!isset($super_admins))
|
{
| {
|
global $mybb; $super_admins = str_replace(" ", "", $mybb->config['super_admins']); }
| global $mybb; $super_admins = str_replace(" ", "", $mybb->config['super_admins']); }
|
Zeile 6968 | Zeile 7015 |
---|
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 8412 | Zeile 8459 |
---|
}
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. * * @return bool Whether this is a valid url. */ function my_validate_url($url, $relative_path=false) { if($relative_path && my_substr($url, 0, 1) == '/' || preg_match('_^(?:(?: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', $url)) { return true; }
return false;
|
}
| }
|