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)
| } }
if(!is_array($forum_cache)) { $forum_cache = cache_forums();
if(!$forum_cache)
|
{ return false; }
| { return false; }
|
Zeile 1660 | Zeile 1662 |
---|
}
$perms[$action] = max($perm[$action], $perms[$action]);
|
}
$perms[$action] = max($perm[$action], $perms[$action]);
|
} } }
| } } }
|
$modpermscache[$fid][$uid] = $perms;
| $modpermscache[$fid][$uid] = $perms;
|
Zeile 1676 | Zeile 1678 |
---|
* @param string $action The action tyring to be performed. (blank assumes any action at all) * @param int $uid The user ID (0 assumes current user) * @return bool Returns true if the user has permission, false if they do not
|
* @param string $action The action tyring to be performed. (blank assumes any action at all) * @param int $uid The user ID (0 assumes current user) * @return bool Returns true if the user has permission, false if they do not
|
*/
| */
|
function is_moderator($fid=0, $action="", $uid=0) { global $mybb, $cache;
|
function is_moderator($fid=0, $action="", $uid=0) { global $mybb, $cache;
|
if($uid == 0) {
| if($uid == 0) {
|
$uid = $mybb->user['uid'];
|
$uid = $mybb->user['uid'];
|
}
| }
|
if($uid == 0) { return false;
|
if($uid == 0) { return false;
|
}
| }
|
$user_perms = user_permissions($uid); if($user_perms['issupermod'] == 1) {
| $user_perms = user_permissions($uid); if($user_perms['issupermod'] == 1) {
|
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 1734 | Zeile 1741 |
---|
if(!$action && $modperms) { return true;
|
if(!$action && $modperms) { return true;
|
}
| }
|
else { if(isset($modperms[$action]) && $modperms[$action] == 1)
|
else { if(isset($modperms[$action]) && $modperms[$action] == 1)
|
{
| {
|
return true; } else
| return true; } else
|
Zeile 1747 | Zeile 1754 |
---|
} } }
|
} } }
|
}
| }
|
}
/**
| }
/**
|
Zeile 1774 | Zeile 1781 |
---|
$posticons[$posticon['name']] = $posticon; } krsort($posticons);
|
$posticons[$posticon['name']] = $posticon; } krsort($posticons);
|
|
|
foreach($posticons as $dbicon) { $dbicon['path'] = str_replace("{theme}", $theme['imgdir'], $dbicon['path']);
| foreach($posticons as $dbicon) { $dbicon['path'] = str_replace("{theme}", $theme['imgdir'], $dbicon['path']);
|
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 1844 | Zeile 1858 |
---|
if(!empty($mybb->settings['cookiepath'])) { $cookie .= "; path={$mybb->settings['cookiepath']}";
|
if(!empty($mybb->settings['cookiepath'])) { $cookie .= "; path={$mybb->settings['cookiepath']}";
|
}
| }
|
if(!empty($mybb->settings['cookiedomain'])) { $cookie .= "; domain={$mybb->settings['cookiedomain']}";
|
if(!empty($mybb->settings['cookiedomain'])) { $cookie .= "; domain={$mybb->settings['cookiedomain']}";
|
}
| }
|
if($httponly == true) { $cookie .= "; HttpOnly";
|
if($httponly == true) { $cookie .= "; HttpOnly";
|
| }
if($mybb->settings['cookiesecureflag']) { $cookie .= "; Secure";
|
}
$mybb->cookies[$name] = $value;
|
}
$mybb->cookies[$name] = $value;
|
|
|
header($cookie, false); }
| header($cookie, false); }
|
Zeile 1884 | Zeile 1903 |
---|
* @return array|boolean The cookie id's content array or false when non-existent. */ function my_get_array_cookie($name, $id)
|
* @return array|boolean The cookie id's content array or false when non-existent. */ function my_get_array_cookie($name, $id)
|
{
| {
|
global $mybb;
if(!isset($mybb->cookies['mybb'][$name]))
| global $mybb;
if(!isset($mybb->cookies['mybb'][$name]))
|
Zeile 2101 | Zeile 2120 |
---|
$list = &$data; $expected[] = $expectedLength; $state = 2;
|
$list = &$data; $expected[] = $expectedLength; $state = 2;
|
break;
| break;
|
} if($type != '}') {
| } if($type != '}') {
|
Zeile 2133 | Zeile 2152 |
---|
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)) {
| 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); }
|
mb_internal_encoding($mbIntEnc); }
|
|
|
return $out; }
| return $out; }
|
Zeile 2154 | Zeile 2173 |
---|
* 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
| * * @param mixed $value * @return string
|
* @throw Exception if $value is malformed or contains unsupported types (e.g., resources, objects) */ function _safe_serialize( $value ) { if(is_null($value))
|
* @throw Exception if $value is malformed or contains unsupported types (e.g., resources, objects) */ function _safe_serialize( $value ) { if(is_null($value))
|
{
| {
|
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 2212 |
---|
{ $out .= _safe_serialize($k) . _safe_serialize($v); }
|
{ $out .= _safe_serialize($k) . _safe_serialize($v); }
|
|
|
return 'a:'.count($value).':{'.$out.'}'; }
| return 'a:'.count($value).':{'.$out.'}'; }
|
Zeile 2216 | Zeile 2235 |
---|
$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; }
|
|
|
/** * Returns the serverload of the system. *
| /** * Returns the serverload of the system. *
|
Zeile 2234 | Zeile 2253 |
---|
function get_server_load() { global $mybb, $lang;
|
function get_server_load() { global $mybb, $lang;
|
$serverload = array();
| $serverload = array();
|
// DIRECTORY_SEPARATOR checks if running windows if(DIRECTORY_SEPARATOR != '\\')
| // DIRECTORY_SEPARATOR checks if running windows if(DIRECTORY_SEPARATOR != '\\')
|
Zeile 2260 | Zeile 2279 |
---|
// Suhosin likes to throw a warning if exec is disabled then die - weird if($func_blacklist = @ini_get('suhosin.executor.func.blacklist'))
|
// Suhosin likes to throw a warning if exec is disabled then die - weird if($func_blacklist = @ini_get('suhosin.executor.func.blacklist'))
|
{ if(strpos(",".$func_blacklist.",", 'exec') !== false) { return $lang->unknown; }
| { if(strpos(",".$func_blacklist.",", 'exec') !== false) { return $lang->unknown; }
|
} // PHP disabled functions? if($func_blacklist = @ini_get('disable_functions'))
| } // PHP disabled functions? if($func_blacklist = @ini_get('disable_functions'))
|
Zeile 2273 | Zeile 2292 |
---|
{ return $lang->unknown; }
|
{ return $lang->unknown; }
|
}
| }
|
$load = @exec("uptime"); $load = explode("load average: ", $load); $serverload = explode(",", $load[1]);
| $load = @exec("uptime"); $load = explode("load average: ", $load); $serverload = explode(",", $load[1]);
|
Zeile 2287 | Zeile 2306 |
---|
else { return $lang->unknown;
|
else { return $lang->unknown;
|
}
$returnload = trim($serverload[0]);
| }
$returnload = trim($serverload[0]);
|
return $returnload; }
| return $returnload; }
|
Zeile 2300 | Zeile 2319 |
---|
* @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 2346 |
---|
{ // 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 2341 | Zeile 2360 |
---|
'numdeletedthreads' => '+0', 'inserted' => false // Reset after changes are inserted into cache );
|
'numdeletedthreads' => '+0', 'inserted' => false // Reset after changes are inserted into cache );
|
$stats = $stats_changes; }
| $stats = $stats_changes; }
|
if($force) // Force writing to cache? {
| if($force) // Force writing to cache? {
|
Zeile 2355 | Zeile 2374 |
---|
$changes = $stats_changes; } else
|
$changes = $stats_changes; } else
|
{
| {
|
$stats = $stats_changes; }
| $stats = $stats_changes; }
|
Zeile 2382 | Zeile 2401 |
---|
{ $new_stats[$counter] = "+{$new_stats[$counter]}"; }
|
{ $new_stats[$counter] = "+{$new_stats[$counter]}"; }
|
}
| }
|
// Less than 0? That's bad elseif($new_stats[$counter] < 0) {
| // Less than 0? That's bad elseif($new_stats[$counter] < 0) {
|
Zeile 2414 | Zeile 2433 |
---|
$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(!empty($new_stats))
|
Zeile 2432 | Zeile 2451 |
---|
// Update stats row for today in the database $todays_stats = array( "dateline" => mktime(0, 0, 0, date("m"), date("j"), date("Y")),
|
// Update stats row for today in the database $todays_stats = array( "dateline" => mktime(0, 0, 0, date("m"), date("j"), date("Y")),
|
"numusers" => $stats['numusers'], "numthreads" => $stats['numthreads'], "numposts" => $stats['numposts']
| "numusers" => (int)$stats['numusers'], "numthreads" => (int)$stats['numthreads'], "numposts" => (int)$stats['numposts']
|
); $db->replace_query("stats", $todays_stats, "dateline");
$cache->update("stats", $stats, "dateline"); $stats_changes['inserted'] = true;
|
); $db->replace_query("stats", $todays_stats, "dateline");
$cache->update("stats", $stats, "dateline"); $stats_changes['inserted'] = true;
|
}
| }
|
/** * Updates the forum counters with a specific value (or addition/subtraction of the previous value)
| /** * Updates the forum counters with a specific value (or addition/subtraction of the previous value)
|
Zeile 2644 | Zeile 2663 |
---|
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 2874 | Zeile 2893 |
---|
if(!is_array($permissioncache)) { $permissioncache = forum_permissions();
|
if(!is_array($permissioncache)) { $permissioncache = forum_permissions();
|
}
| }
|
if(isset($jumpfcache[$pid]) && is_array($jumpfcache[$pid])) { foreach($jumpfcache[$pid] as $main)
| if(isset($jumpfcache[$pid]) && is_array($jumpfcache[$pid])) { foreach($jumpfcache[$pid] as $main)
|
Zeile 2889 | Zeile 2908 |
---|
$optionselected = "";
if($selitem == $forum['fid'])
|
$optionselected = "";
if($selitem == $forum['fid'])
|
{
| {
|
$optionselected = 'selected="selected"'; }
| $optionselected = 'selected="selected"'; }
|
Zeile 2916 | Zeile 2935 |
---|
else { $template = "advanced";
|
else { $template = "advanced";
|
|
|
if(strpos(FORUM_URL, '.html') !== false)
|
if(strpos(FORUM_URL, '.html') !== false)
|
{
| {
|
$forum_link = "'".str_replace('{fid}', "'+option+'", FORUM_URL)."'";
|
$forum_link = "'".str_replace('{fid}', "'+option+'", FORUM_URL)."'";
|
}
| }
|
else { $forum_link = "'".str_replace('{fid}', "'+option", FORUM_URL); } }
|
else { $forum_link = "'".str_replace('{fid}', "'+option", FORUM_URL); } }
|
|
|
eval("\$forumjump = \"".$templates->get("forumjump_".$template)."\";");
|
eval("\$forumjump = \"".$templates->get("forumjump_".$template)."\";");
|
}
| }
|
return $forumjump; }
| return $forumjump; }
|
Zeile 2942 | Zeile 2961 |
---|
function get_extension($file) { return my_strtolower(my_substr(strrchr($file, "."), 1));
|
function get_extension($file) { return my_strtolower(my_substr(strrchr($file, "."), 1));
|
}
| }
|
/** * Generates a random string. *
| /** * Generates a random string. *
|
Zeile 2969 | Zeile 2988 |
---|
$str[] = $set[my_rand(36, 61)];
$length -= 3;
|
$str[] = $set[my_rand(36, 61)];
$length -= 3;
|
}
| }
|
for($i = 0; $i < $length; ++$i) { $str[] = $set[my_rand(0, 61)]; }
|
for($i = 0; $i < $length; ++$i) { $str[] = $set[my_rand(0, 61)]; }
|
|
|
// Make sure they're in random order and convert them to a string shuffle($str);
|
// Make sure they're in random order and convert them to a string shuffle($str);
|
|
|
return implode($str); }
/** * Formats a username based on their display group
|
return implode($str); }
/** * Formats a username based on their display group
|
*
| *
|
* @param string $username The username * @param int $usergroup The usergroup for the user * @param int $displaygroup The display group for the user * @return string The formatted username */ function format_name($username, $usergroup, $displaygroup=0)
|
* @param string $username The username * @param int $usergroup The usergroup for the user * @param int $displaygroup The display group for the user * @return string The formatted username */ function format_name($username, $usergroup, $displaygroup=0)
|
{
| {
|
global $groupscache, $cache;
|
global $groupscache, $cache;
|
|
|
if(!is_array($groupscache)) { $groupscache = $cache->read("usergroups");
|
if(!is_array($groupscache)) { $groupscache = $cache->read("usergroups");
|
}
| }
|
if($displaygroup != 0) { $usergroup = $displaygroup;
| if($displaygroup != 0) { $usergroup = $displaygroup;
|
Zeile 3011 | Zeile 3030 |
---|
if($userin == 0) { $format = "{username}";
|
if($userin == 0) { $format = "{username}";
|
}
| }
|
$format = stripslashes($format);
| $format = stripslashes($format);
|
Zeile 3028 | Zeile 3047 |
---|
*/ function format_avatar($avatar, $dimensions = '', $max_dimensions = '') {
|
*/ function format_avatar($avatar, $dimensions = '', $max_dimensions = '') {
|
global $mybb;
| global $mybb, $theme;
|
static $avatars;
if(!isset($avatars))
|
static $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 3244 |
---|
$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 3230 | Zeile 3254 |
---|
{ $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);
if(is_array($smiliecache)) { reset($smiliecache);
|
unset($smilie);
if(is_array($smiliecache)) { reset($smiliecache);
|
|
|
$dropdownsmilies = $moresmilies = $hiddensmilies = ""; $i = 0;
| $dropdownsmilies = $moresmilies = $hiddensmilies = ""; $i = 0;
|
Zeile 3246 | Zeile 3276 |
---|
{ $finds = explode("\n", $smilie['find']); $finds_count = count($finds);
|
{ $finds = explode("\n", $smilie['find']); $finds_count = count($finds);
|
|
|
// Only show the first text to replace in the box $smilie['find'] = $finds[0];
| // Only show the first text to replace in the box $smilie['find'] = $finds[0];
|
Zeile 3256 | Zeile 3286 |
---|
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 3280 | Zeile 3310 |
---|
$basic1 = $basic2 = $align = $font = $size = $color = $removeformat = $email = $link = $list = $code = $sourcemode = "";
if($mybb->settings['allowbasicmycode'] == 1)
|
$basic1 = $basic2 = $align = $font = $size = $color = $removeformat = $email = $link = $list = $code = $sourcemode = "";
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|";
|
$align = "left,center,right,justify|";
|
}
| }
|
if($mybb->settings['allowfontmycode'] == 1) { $font = "font,";
|
if($mybb->settings['allowfontmycode'] == 1) { $font = "font,";
|
}
| }
|
if($mybb->settings['allowsizemycode'] == 1) {
| if($mybb->settings['allowsizemycode'] == 1) {
|
Zeile 3318 | Zeile 3348 |
---|
if($mybb->settings['allowlinkmycode'] == 1) { $link = "link,unlink";
|
if($mybb->settings['allowlinkmycode'] == 1) { $link = "link,unlink";
|
}
| }
|
if($mybb->settings['allowlistmycode'] == 1) {
| if($mybb->settings['allowlistmycode'] == 1) {
|
Zeile 3367 | Zeile 3397 |
---|
} foreach($smilie_cache as $smilie) {
|
} foreach($smilie_cache as $smilie) {
|
if($smilie['showclickable'] != 0) { $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;
|
} }
| } }
|
Zeile 3385 | Zeile 3412 |
---|
if($mybb->settings['smilieinsertertot'] >= $smiliecount) { $mybb->settings['smilieinsertertot'] = $smiliecount;
|
if($mybb->settings['smilieinsertertot'] >= $smiliecount) { $mybb->settings['smilieinsertertot'] = $smiliecount;
|
}
| }
|
else if($mybb->settings['smilieinsertertot'] < $smiliecount) { $smiliecount = $mybb->settings['smilieinsertertot']; eval("\$getmore = \"".$templates->get("smilieinsert_getmore")."\";"); }
|
else if($mybb->settings['smilieinsertertot'] < $smiliecount) { $smiliecount = $mybb->settings['smilieinsertertot']; eval("\$getmore = \"".$templates->get("smilieinsert_getmore")."\";"); }
|
$smilies = "";
| $smilies = '';
|
$counter = 0; $i = 0;
$extra_class = ''; foreach($smiliecache as $smilie) {
|
$counter = 0; $i = 0;
$extra_class = ''; foreach($smiliecache as $smilie) {
|
if($i < $mybb->settings['smilieinsertertot'])
| 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 3419 | Zeile 3441 |
---|
$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 3434 | Zeile 3457 |
---|
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 3445 | Zeile 3468 |
---|
} } else
|
} } else
|
{
| {
|
$clickablesmilies = ""; }
| $clickablesmilies = ""; }
|
Zeile 3495 | Zeile 3518 |
---|
if($pid != 0 && is_array($prefixes_cache[$pid])) { return $prefixes_cache[$pid];
|
if($pid != 0 && is_array($prefixes_cache[$pid])) { return $prefixes_cache[$pid];
|
}
| }
|
else if(!empty($prefixes_cache)) { return $prefixes_cache;
| else if(!empty($prefixes_cache)) { return $prefixes_cache;
|
Zeile 3505 | Zeile 3528 |
---|
}
/**
|
}
/**
|
* Build the thread prefix selection menu
| * Build the thread prefix selection menu for the current user
|
* * @param int|string $fid The forum ID (integer ID or string all) * @param int|string $selected_pid The selected prefix ID (integer ID or string any) * @param int $multiple Allow multiple prefix selection
|
* * @param int|string $fid The forum ID (integer ID or string all) * @param int|string $selected_pid The selected prefix ID (integer ID or string any) * @param int $multiple Allow multiple prefix selection
|
| * @param int $previous_pid The previously selected prefix ID
|
* @return string The thread prefix selection menu */
|
* @return string The thread prefix selection menu */
|
function build_prefix_select($fid, $selected_pid=0, $multiple=0)
| function build_prefix_select($fid, $selected_pid=0, $multiple=0, $previous_pid=0)
|
{ global $cache, $db, $lang, $mybb, $templates;
| { global $cache, $db, $lang, $mybb, $templates;
|
Zeile 3524 | Zeile 3548 |
---|
$prefix_cache = build_prefixes(0); if(empty($prefix_cache)) {
|
$prefix_cache = build_prefixes(0); if(empty($prefix_cache)) {
|
return false; // We've got no prefixes to show }
$groups = array($mybb->user['usergroup']); if($mybb->user['additionalgroups']) { $exp = explode(",", $mybb->user['additionalgroups']);
foreach($exp as $group) { $groups[] = $group; }
| // We've got no prefixes to show return '';
|
}
// Go through each of our prefixes and decide which ones we can use
| }
// Go through each of our prefixes and decide which ones we can use
|
Zeile 3546 | Zeile 3560 |
---|
{ // 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)) {
| if(!in_array($fid, $forums) && $prefix['pid'] != $previous_pid) {
|
// This prefix is not in our forum list continue; } }
|
// This prefix is not in our forum list continue; } }
|
if($prefix['groups'] != "-1") { $prefix_groups = explode(",", $prefix['groups']);
foreach($groups as $group) { if(in_array($group, $prefix_groups) && !isset($prefixes[$prefix['pid']])) { // Our group can use this prefix! $prefixes[$prefix['pid']] = $prefix; } } } else
| if(is_member($prefix['groups']) || $prefix['pid'] == $previous_pid)
|
{
|
{
|
// This prefix is for anybody to use...
| // The current user can use this prefix
|
$prefixes[$prefix['pid']] = $prefix; } }
if(empty($prefixes)) {
|
$prefixes[$prefix['pid']] = $prefix; } }
if(empty($prefixes)) {
|
return false;
| return '';
|
}
|
}
|
|
|
$prefixselect = $prefixselect_prefix = '';
if($multiple == 1)
| $prefixselect = $prefixselect_prefix = '';
if($multiple == 1)
|
Zeile 3587 | Zeile 3588 |
---|
if($selected_pid == 'any') { $any_selected = " selected=\"selected\"";
|
if($selected_pid == 'any') { $any_selected = " selected=\"selected\"";
|
}
| }
|
}
$default_selected = "";
| }
$default_selected = "";
|
Zeile 3621 | Zeile 3622 |
---|
}
/**
|
}
/**
|
* Build the thread prefix selection menu for a forum
| * Build the thread prefix selection menu for a forum without group permission checks
|
* * @param int $fid The forum ID (integer ID) * @param int $selected_pid The selected prefix ID (integer ID)
|
* * @param int $fid The forum ID (integer ID) * @param int $selected_pid The selected prefix ID (integer ID)
|
| * @return string The thread prefix selection menu
|
*/ function build_forum_prefix_select($fid, $selected_pid=0) {
| */ function build_forum_prefix_select($fid, $selected_pid=0) {
|
Zeile 3635 | Zeile 3637 |
---|
$prefix_cache = build_prefixes(0); if(empty($prefix_cache)) {
|
$prefix_cache = build_prefixes(0); if(empty($prefix_cache)) {
|
return false; // We've got no prefixes to show
| // We've got no prefixes to show return '';
|
}
// Go through each of our prefixes and decide which ones we can use
| }
// Go through each of our prefixes and decide which ones we can use
|
Zeile 3646 | Zeile 3649 |
---|
{ // 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)) { // This forum can use this prefix!
| if(in_array($fid, $forums)) { // This forum can use this prefix!
|
Zeile 3657 | Zeile 3660 |
---|
{ // This prefix is for anybody to use... $prefixes[$prefix['pid']] = $prefix;
|
{ // This prefix is for anybody to use... $prefixes[$prefix['pid']] = $prefix;
|
} }
| } }
|
if(empty($prefixes)) {
|
if(empty($prefixes)) {
|
return false;
| return '';
|
}
|
}
|
|
|
$default_selected = array(); $selected_pid = (int)$selected_pid;
|
$default_selected = array(); $selected_pid = (int)$selected_pid;
|
|
|
if($selected_pid == 0)
|
if($selected_pid == 0)
|
{
| {
|
$default_selected['all'] = ' selected="selected"';
|
$default_selected['all'] = ' selected="selected"';
|
}
| }
|
else if($selected_pid == -1)
|
else if($selected_pid == -1)
|
{
| {
|
$default_selected['none'] = ' selected="selected"'; } else if($selected_pid == -2) { $default_selected['any'] = ' selected="selected"';
|
$default_selected['none'] = ' selected="selected"'; } else if($selected_pid == -2) { $default_selected['any'] = ' selected="selected"';
|
}
| }
|
foreach($prefixes as $prefix) {
| foreach($prefixes as $prefix) {
|
Zeile 3723 | Zeile 3726 |
---|
if(my_strpos(" ".$httpaccept_encoding, "gzip")) { $encoding = "gzip";
|
if(my_strpos(" ".$httpaccept_encoding, "gzip")) { $encoding = "gzip";
|
}
| }
|
if(isset($encoding)) { header("Content-Encoding: $encoding");
| if(isset($encoding)) { header("Content-Encoding: $encoding");
|
Zeile 3747 | Zeile 3750 |
---|
}
return $contents;
|
}
return $contents;
|
}
/**
| }
/**
|
* Log the actions of a moderator. * * @param array $data The data of the moderator's action.
| * Log the actions of a moderator. * * @param array $data The data of the moderator's action.
|
Zeile 3823 | Zeile 3826 |
---|
{ $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 4159 | Zeile 4162 |
---|
$unviewable[] = $forum['fid']; } }
|
$unviewable[] = $forum['fid']; } }
|
|
|
$unviewableforums = implode(',', $unviewable);
|
$unviewableforums = implode(',', $unviewable);
|
|
|
return $unviewableforums; }
| return $unviewableforums; }
|
Zeile 4837 | Zeile 4840 |
---|
{ global $db, $mybb, $cache;
|
{ global $db, $mybb, $cache;
|
if($uid == $mybb->user['uid']) { $user = $mybb->user; } else { $user = get_user($uid); }
| $user = get_user($uid);
|
$groupslist = $comma = ''; $usergroups = $user['additionalgroups'].",";
| $groupslist = $comma = ''; $usergroups = $user['additionalgroups'].",";
|
Zeile 4915 | Zeile 4911 |
---|
{ $location = htmlspecialchars_uni($_ENV['PATH_INFO']); }
|
{ $location = htmlspecialchars_uni($_ENV['PATH_INFO']); }
|
|
|
if($quick)
|
if($quick)
|
{
| {
|
return $location; }
if($fields == true) { global $mybb;
|
return $location; }
if($fields == true) { global $mybb;
|
|
|
if(!is_array($ignore)) { $ignore = array($ignore); }
|
if(!is_array($ignore)) { $ignore = array($ignore); }
|
|
|
$form_html = ''; if(!empty($mybb->input)) {
| $form_html = ''; if(!empty($mybb->input)) {
|
Zeile 4941 | Zeile 4937 |
---|
}
$form_html .= "<input type=\"hidden\" name=\"".htmlspecialchars_uni($name)."\" value=\"".htmlspecialchars_uni($value)."\" />\n";
|
}
$form_html .= "<input type=\"hidden\" name=\"".htmlspecialchars_uni($name)."\" value=\"".htmlspecialchars_uni($value)."\" />\n";
|
}
| }
|
}
return array('location' => $location, 'form_html' => $form_html, 'form_method' => $mybb->request_method);
| }
return array('location' => $location, 'form_html' => $form_html, 'form_method' => $mybb->request_method);
|
Zeile 4966 | Zeile 4962 |
---|
if(isset($_POST[$var])) { $addloc[] = urlencode($var).'='.urlencode($_POST[$var]);
|
if(isset($_POST[$var])) { $addloc[] = urlencode($var).'='.urlencode($_POST[$var]);
|
}
| }
|
}
if(isset($addloc) && is_array($addloc))
| }
if(isset($addloc) && is_array($addloc))
|
Zeile 4974 | Zeile 4970 |
---|
if(strpos($location, "?") === false) { $location .= "?";
|
if(strpos($location, "?") === false) { $location .= "?";
|
}
| }
|
else { $location .= "&";
|
else { $location .= "&";
|
}
| }
|
$location .= implode("&", $addloc); } }
| $location .= implode("&", $addloc); } }
|
Zeile 5027 | Zeile 5023 |
---|
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 5046 | Zeile 5035 |
---|
}
if($theme['pid'] != 0)
|
}
if($theme['pid'] != 0)
|
{
| {
|
$theme['name'] = htmlspecialchars_uni($theme['name']); eval("\$themeselect_option .= \"".$templates->get("usercp_themeselector_option")."\";"); ++$num_themes;
| $theme['name'] = htmlspecialchars_uni($theme['name']); eval("\$themeselect_option .= \"".$templates->get("usercp_themeselector_option")."\";"); ++$num_themes;
|
Zeile 5339 | Zeile 5328 |
---|
$lang->thursday, $lang->friday, $lang->saturday
|
$lang->thursday, $lang->friday, $lang->saturday
|
);
| );
|
$bmonth = array( $lang->month_1,
| $bmonth = array( $lang->month_1,
|
Zeile 5412 | Zeile 5401 |
---|
}
return str_replace($find, $replace, $display);
|
}
return str_replace($find, $replace, $display);
|
}
| }
|
/** * Returns the age of a user with specified birthday.
| /** * Returns the age of a user with specified birthday.
|
Zeile 5424 | Zeile 5413 |
---|
{ $bday = explode("-", $birthday); if(!$bday[2])
|
{ $bday = explode("-", $birthday); if(!$bday[2])
|
{
| {
|
return;
|
return;
|
}
list($day, $month, $year) = explode("-", my_date("j-n-Y", TIME_NOW, 0, 0));
| }
list($day, $month, $year) = explode("-", my_date("j-n-Y", TIME_NOW, 0, 0));
|
$age = $year-$bday[2];
| $age = $year-$bday[2];
|
Zeile 5437 | Zeile 5426 |
---|
--$age; } return $age;
|
--$age; } return $age;
|
}
| }
|
/** * Updates the first posts in a thread.
| /** * Updates the first posts in a thread.
|
Zeile 5461 | Zeile 5450 |
---|
if(empty($firstpost['username'])) { $firstpost['username'] = $firstpost['postusername'];
|
if(empty($firstpost['username'])) { $firstpost['username'] = $firstpost['postusername'];
|
}
| }
|
$firstpost['username'] = $db->escape_string($firstpost['username']);
|
$firstpost['username'] = $db->escape_string($firstpost['username']);
|
|
|
$update_array = array( 'firstpost' => (int)$firstpost['pid'], 'username' => $firstpost['username'], 'uid' => (int)$firstpost['uid'], 'dateline' => (int)$firstpost['dateline']
|
$update_array = array( 'firstpost' => (int)$firstpost['pid'], 'username' => $firstpost['username'], 'uid' => (int)$firstpost['uid'], 'dateline' => (int)$firstpost['dateline']
|
); $db->update_query("threads", $update_array, "tid='{$tid}'"); }
/**
| ); $db->update_query("threads", $update_array, "tid='{$tid}'"); }
/**
|
* Updates the last posts in a thread. * * @param int $tid The thread id for which to update the last post id.
| * Updates the last posts in a thread. * * @param int $tid The thread id for which to update the last post id.
|
Zeile 5535 | Zeile 5524 |
---|
global $lang;
$string = preg_replace("#&\#([0-9]+);#", "-", $string);
|
global $lang;
$string = preg_replace("#&\#([0-9]+);#", "-", $string);
|
|
|
if(strtolower($lang->settings['charset']) == "utf-8") { // Get rid of any excess RTL and LTR override for they are the workings of the devil $string = str_replace(dec_to_utf8(8238), "", $string); $string = str_replace(dec_to_utf8(8237), "", $string);
|
if(strtolower($lang->settings['charset']) == "utf-8") { // Get rid of any excess RTL and LTR override for they are the workings of the devil $string = str_replace(dec_to_utf8(8238), "", $string); $string = str_replace(dec_to_utf8(8237), "", $string);
|
|
|
// Remove dodgy whitespaces $string = str_replace(chr(0xCA), "", $string); } $string = trim($string);
if(function_exists("mb_strlen"))
|
// Remove dodgy whitespaces $string = str_replace(chr(0xCA), "", $string); } $string = trim($string);
if(function_exists("mb_strlen"))
|
{
| {
|
$string_length = mb_strlen($string); } else
| $string_length = mb_strlen($string); } else
|
Zeile 5583 | Zeile 5572 |
---|
else { $cut_string = mb_substr($string, $start);
|
else { $cut_string = mb_substr($string, $start);
|
} }
| } }
|
else { if($length != null)
|
else { if($length != null)
|
{
| {
|
$cut_string = substr($string, $start, $length);
|
$cut_string = substr($string, $start, $length);
|
}
| }
|
else { $cut_string = substr($string, $start); }
|
else { $cut_string = substr($string, $start); }
|
}
| }
|
if($handle_entities) { $cut_string = htmlspecialchars_uni($cut_string);
| if($handle_entities) { $cut_string = htmlspecialchars_uni($cut_string);
|
Zeile 5620 | Zeile 5609 |
---|
{ $string = strtolower($string); }
|
{ $string = strtolower($string); }
|
|
|
return $string; }
| return $string; }
|
Zeile 5633 | Zeile 5622 |
---|
* @return int|bool false on needle not found, integer position if found */ function my_strpos($haystack, $needle, $offset=0)
|
* @return int|bool false on needle not found, integer position if found */ function my_strpos($haystack, $needle, $offset=0)
|
{
| {
|
if($needle == '') { return false;
| if($needle == '') { return false;
|
Zeile 5731 | Zeile 5720 |
---|
*/ 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 5747 | Zeile 5737 |
---|
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 5774 | Zeile 5764 |
---|
function get_announcement_link($aid=0) { $link = str_replace("{aid}", $aid, ANNOUNCEMENT_URL);
|
function get_announcement_link($aid=0) { $link = str_replace("{aid}", $aid, ANNOUNCEMENT_URL);
|
return htmlspecialchars_uni($link); }
| return htmlspecialchars_uni($link); }
|
/** * Build the profile link. *
| /** * Build the profile link. *
|
Zeile 5916 | Zeile 5906 |
---|
/** * Build the link to a specified date on the calendar
|
/** * Build the link to a specified date on the calendar
|
* * @param int $calendar The ID of the calendar
| * * @param int $calendar The ID of the calendar
|
* @param int $year The year * @param int $month The month * @param int $day The day (optional)
| * @param int $year The year * @param int $month The month * @param int $day The day (optional)
|
Zeile 5926 | Zeile 5916 |
---|
function get_calendar_link($calendar, $year=0, $month=0, $day=0) { if($day > 0)
|
function get_calendar_link($calendar, $year=0, $month=0, $day=0) { if($day > 0)
|
{
| {
|
$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);
|
Zeile 5953 | Zeile 5943 |
---|
/** * Build the link to a specified week on the calendar
|
/** * Build the link to a specified week on the calendar
|
*
| *
|
* @param int $calendar The ID of the calendar * @param int $week The week * @return string The URL of the calendar
| * @param int $calendar The ID of the calendar * @param int $week The week * @return string The URL of the calendar
|
Zeile 5987 | Zeile 5977 |
---|
return $mybb->user; } elseif(isset($user_cache[$uid]))
|
return $mybb->user; } elseif(isset($user_cache[$uid]))
|
{ return $user_cache[$uid];
| { return $user_cache[$uid];
|
} elseif($uid > 0) {
| } elseif($uid > 0) {
|
Zeile 6024 | Zeile 6014 |
---|
case 'mysqli': $field = 'username'; $efield = 'email';
|
case 'mysqli': $field = 'username'; $efield = 'email';
|
break;
| break;
|
default: $field = 'LOWER(username)'; $efield = 'LOWER(email)';
| default: $field = 'LOWER(username)'; $efield = 'LOWER(email)';
|
Zeile 6042 | Zeile 6032 |
---|
default: $sqlwhere = "{$field}='{$username}'"; break;
|
default: $sqlwhere = "{$field}='{$username}'"; break;
|
}
| }
|
$fields = array('uid'); if(isset($options['fields']))
| $fields = array('uid'); if(isset($options['fields']))
|
Zeile 6058 | Zeile 6048 |
---|
}
return $db->fetch_array($query);
|
}
return $db->fetch_array($query);
|
}
| }
|
/** * Get the forum of a specific forum id. *
| /** * Get the forum of a specific forum id. *
|
Zeile 6201 | Zeile 6191 |
---|
} } }
|
} } }
|
|
|
$inactiveforums = implode(",", $inactive);
return $inactiveforums;
| $inactiveforums = implode(",", $inactive);
return $inactiveforums;
|
Zeile 6706 | Zeile 6696 |
---|
"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 6779 | Zeile 6771 |
---|
* * @param string $url The URL of the remote file * @param array $post_data The array of post data
|
* * @param string $url The URL of the remote file * @param array $post_data The array of post data
|
| * @param int $max_redirects Number of maximum redirects
|
* @return string|bool The remote file contents. False on failure */
|
* @return string|bool The remote file contents. False on failure */
|
function fetch_remote_file($url, $post_data=array())
| function fetch_remote_file($url, $post_data=array(), $max_redirects=20)
|
{
|
{
|
| 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 6791 | Zeile 6827 |
---|
$post_body .= '&'.urlencode($key).'='.urlencode($val); } $post_body = ltrim($post_body, '&');
|
$post_body .= '&'.urlencode($key).'='.urlencode($val); } $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;
|
$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url);
|
$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url);
|
curl_setopt($ch, CURLOPT_HEADER, 0);
| curl_setopt($ch, CURLOPT_HEADER, $request_header);
|
curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
| curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
if($max_redirects != 0 && $can_followlocation) { curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_MAXREDIRS, $max_redirects); }
|
if(!empty($post_body)) { curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_body); }
|
if(!empty($post_body)) { curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_body); }
|
$data = curl_exec($ch);
| $response = curl_exec($ch);
if($request_header) { $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE); $header = substr($response, 0, $header_size); $body = substr($response, $header_size);
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); } } else { $data = $body; } } else { $data = $response; }
|
curl_close($ch); return $data; } else if(function_exists("fsockopen")) {
|
curl_close($ch); return $data; } else if(function_exists("fsockopen")) {
|
$url = @parse_url($url); if(!$url['host']) { return false; } if(!$url['port']) { $url['port'] = 80; } if(!$url['path']) { $url['path'] = "/"; } if($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)
|
@stream_set_timeout($fp, 10); if(!$fp)
|
{
| {
|
return false;
|
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 { $headers[] = "GET {$url['path']} HTTP/1.0"; }
$headers[] = "Host: {$url['host']}";
| else { $headers[] = "GET {$url_components['path']} HTTP/1.0"; }
$headers[] = "Host: {$url_components['host']}";
|
$headers[] = "Connection: Close"; $headers[] = '';
if(!empty($post_body)) { $headers[] = $post_body;
|
$headers[] = "Connection: Close"; $headers[] = '';
if(!empty($post_body)) { $headers[] = $post_body;
|
}
| }
|
else { // 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
| else { // 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
|
Zeile 6875 | Zeile 6944 |
---|
$headers = implode("\r\n", $headers); if(!@fwrite($fp, $headers))
|
$headers = implode("\r\n", $headers); if(!@fwrite($fp, $headers))
|
{
| {
|
return false;
|
return false;
|
}
| }
$data = null;
|
while(!feof($fp)) { $data .= fgets($fp, 12800); } fclose($fp);
|
while(!feof($fp)) { $data .= fgets($fp, 12800); } fclose($fp);
|
|
|
$data = explode("\r\n\r\n", $data, 2);
|
$data = explode("\r\n\r\n", $data, 2);
|
return $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 '))) { preg_match('/Location:(.*?)(?:\n|$)/', $header, $matches);
if($matches) { $data = fetch_remote_file(trim(array_pop($matches)), $post_data, --$max_redirects); } } else { $data = $body; }
return $data;
|
} else if(empty($post_data)) { return @implode("", @file($url));
|
} else if(empty($post_data)) { return @implode("", @file($url));
|
} else {
| } else {
|
return false; } }
/** * Checks if a particular user is a super administrator.
|
return false; } }
/** * Checks if a particular user is a super administrator.
|
*
| *
|
* @param int $uid The user ID to check against the list of super admins * @return boolean True if a super admin, false if not */ function is_super_admin($uid) { static $super_admins;
|
* @param int $uid The user ID to check against the list of super admins * @return boolean True if a super admin, false if not */ function is_super_admin($uid) { static $super_admins;
|
|
|
if(!isset($super_admins)) { global $mybb;
| if(!isset($super_admins)) { global $mybb;
|
Zeile 6934 | Zeile 7026 |
---|
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 7246 | Zeile 7338 |
---|
}
return $count;
|
}
return $count;
|
}
| }
|
/** * DEPRECATED! Please use IPv6 compatible my_inet_pton! * Fix for PHP's ip2long to guarantee a 32-bit signed integer value is produced (this is aimed
| /** * DEPRECATED! Please use IPv6 compatible my_inet_pton! * Fix for PHP's ip2long to guarantee a 32-bit signed integer value is produced (this is aimed
|
Zeile 7274 | Zeile 7366 |
---|
if($ip_long >= 2147483648) // Won't occur on 32-bit PHP { $ip_long -= 4294967296;
|
if($ip_long >= 2147483648) // Won't occur on 32-bit PHP { $ip_long -= 4294967296;
|
}
| }
|
return $ip_long; }
| return $ip_long; }
|
Zeile 7294 | Zeile 7386 |
---|
{ // We have a 64-bit system $long += 4294967296;
|
{ // We have a 64-bit system $long += 4294967296;
|
}
| }
|
return long2ip($long); }
| return long2ip($long); }
|
Zeile 7320 | Zeile 7412 |
---|
* @license LGPL - http://www.gnu.org/licenses/lgpl.html * @copyright 2004-2007 Aidan Lister <aidan@php.net>, Arpad Ray <arpad@php.net> * @link http://php.net/inet_pton
|
* @license LGPL - http://www.gnu.org/licenses/lgpl.html * @copyright 2004-2007 Aidan Lister <aidan@php.net>, Arpad Ray <arpad@php.net> * @link http://php.net/inet_pton
|
* @author Arpad Ray <arpad@php.net> * @version $Revision: 269597 $
| * @author Arpad Ray <arpad@php.net> * @version $Revision: 269597 $
|
*/ $r = ip2long($ip); if($r !== false && $r != -1)
| */ $r = ip2long($ip); if($r !== false && $r != -1)
|
Zeile 7331 | Zeile 7423 |
---|
$delim_count = substr_count($ip, ':'); if($delim_count < 1 || $delim_count > 7)
|
$delim_count = substr_count($ip, ':'); if($delim_count < 1 || $delim_count > 7)
|
{
| {
|
return false; }
| return false; }
|
Zeile 7348 | Zeile 7440 |
---|
$r = call_user_func_array('pack', $r);
return $r;
|
$r = call_user_func_array('pack', $r);
return $r;
|
} }
| } }
|
/** * Converts a packed internet address to a human readable representation
| /** * Converts a packed internet address to a human readable representation
|
Zeile 7395 | Zeile 7487 |
---|
/** * Fetch an binary formatted range for searching IPv4 and IPv6 IP addresses.
|
/** * Fetch an binary formatted range for searching IPv4 and IPv6 IP addresses.
|
*
| *
|
* @param string $ipaddress The IP address to convert to a range * @return string|array|bool If a full IP address is provided, the in_addr representation, otherwise an array of the upper & lower extremities of the IP. False on failure */
| * @param string $ipaddress The IP address to convert to a range * @return string|array|bool If a full IP address is provided, the in_addr representation, otherwise an array of the upper & lower extremities of the IP. False on failure */
|
Zeile 7613 | Zeile 7705 |
---|
if($count == 0) { if(!empty($checksums))
|
if($count == 0) { if(!empty($checksums))
|
{
| {
|
foreach($checksums as $file_path => $hashes) { if(in_array(basename($file_path), $ignore))
| foreach($checksums as $file_path => $hashes) { if(in_array(basename($file_path), $ignore))
|
Zeile 7627 | Zeile 7719 |
---|
// uh oh if($count == 0)
|
// uh oh if($count == 0)
|
{
| {
|
return $bad_verify_files; } }
| return $bad_verify_files; } }
|
Zeile 7647 | Zeile 7739 |
---|
else { return "+$int";
|
else { return "+$int";
|
} }
/** * Returns a securely generated seed for PHP's RNG (Random Number Generator) * * @param int $count Length of the seed bytes (8 is default. Provides good cryptographic variance) * @return int An integer equivalent of a secure hexadecimal seed */ function secure_seed_rng($count=8) { $output = ''; // DIRECTORY_SEPARATOR checks if running windows if(DIRECTORY_SEPARATOR != '\\') { // Unix/Linux // Use OpenSSL when available if(function_exists('openssl_random_pseudo_bytes')) { $output = openssl_random_pseudo_bytes($count); } // Try mcrypt elseif(function_exists('mcrypt_create_iv'))
| } }
/** * Returns a securely generated seed * * @return string A secure binary seed */ function secure_binary_seed_rng($bytes) { $output = null;
if(version_compare(PHP_VERSION, '7.0', '>=')) { try
|
{
|
{
|
$output = mcrypt_create_iv($count, MCRYPT_DEV_URANDOM);
| $output = random_bytes($bytes); } catch (Exception $e) {
|
}
|
}
|
// Try /dev/urandom elseif(@is_readable('/dev/urandom') && ($handle = @fopen('/dev/urandom', 'rb')))
| }
if(strlen($output) < $bytes) { if(@is_readable('/dev/urandom') && ($handle = @fopen('/dev/urandom', 'rb')))
|
{
|
{
|
$output = @fread($handle, $count);
| $output = @fread($handle, $bytes);
|
@fclose($handle);
|
@fclose($handle);
|
} } else { // Windows // Use OpenSSL when available // PHP <5.3.4 had a bug which makes that function unusable on Windows if(function_exists('openssl_random_pseudo_bytes') && version_compare(PHP_VERSION, '5.3.4', '>='))
| } } else { return $output; }
if(strlen($output) < $bytes) { if(function_exists('mcrypt_create_iv')) { if (DIRECTORY_SEPARATOR == '/') { $source = MCRYPT_DEV_URANDOM; } else { $source = MCRYPT_RAND; }
$output = @mcrypt_create_iv($bytes, $source); } } else { return $output; }
if(strlen($output) < $bytes) { if(function_exists('openssl_random_pseudo_bytes'))
|
{
|
{
|
$output = openssl_random_pseudo_bytes($count);
| // PHP <5.3.4 had a bug which makes that function unusable on Windows if ((DIRECTORY_SEPARATOR == '/') || version_compare(PHP_VERSION, '5.3.4', '>=')) { $output = openssl_random_pseudo_bytes($bytes, $crypto_strong); if ($crypto_strong == false) { $output = null; } }
|
}
|
}
|
// Try mcrypt elseif(function_exists('mcrypt_create_iv')) { $output = mcrypt_create_iv($count, MCRYPT_RAND); } // Try Windows CAPICOM before using our own generator elseif(class_exists('COM'))
| } else { return $output; }
if(strlen($output) < $bytes) { if(class_exists('COM'))
|
{ try { $CAPI_Util = new COM('CAPICOM.Utilities.1'); if(is_callable(array($CAPI_Util, 'GetRandom'))) {
|
{ try { $CAPI_Util = new COM('CAPICOM.Utilities.1'); if(is_callable(array($CAPI_Util, 'GetRandom'))) {
|
$output = $CAPI_Util->GetRandom($count, 0);
| $output = $CAPI_Util->GetRandom($bytes, 0);
|
} } catch (Exception $e) { } } }
|
} } catch (Exception $e) { } } }
|
// Didn't work? Do we still not have enough bytes? Use our own (less secure) rng generator if(strlen($output) < $count) { $output = '';
| else { return $output; }
if(strlen($output) < $bytes) {
|
// Close to what PHP basically uses internally to seed, but not quite. $unique_state = microtime().@getmypid();
|
// Close to what PHP basically uses internally to seed, but not quite. $unique_state = microtime().@getmypid();
|
for($i = 0; $i < $count; $i += 16)
| $rounds = ceil($bytes / 16);
for($i = 0; $i < $rounds; $i++)
|
{ $unique_state = md5(microtime().$unique_state);
|
{ $unique_state = md5(microtime().$unique_state);
|
$output .= pack('H*', md5($unique_state));
| $output .= md5($unique_state);
|
}
|
}
|
}
| |
|
|
// /dev/urandom and openssl will always be twice as long as $count. base64_encode will roughly take up 33% more space but crc32 will put it to 32 characters $output = hexdec(substr(dechex(crc32(base64_encode($output))), 0, $count));
return $output; }
| $output = substr($output, 0, ($bytes * 2));
$output = pack('H*', $output);
return $output; } else { return $output; } }
|
/**
|
/**
|
* Wrapper function for mt_rand. Automatically seeds using a secure seed once.
| * Returns a securely generated seed integer
|
*
|
*
|
* @param int $min Optional lowest value to be returned (default: 0) * @param int $max Optional highest value to be returned (default: mt_getrandmax()) * @param boolean $force_seed True forces it to reseed the RNG first
| |
* @return int An integer equivalent of a secure hexadecimal seed */
|
* @return int An integer equivalent of a secure hexadecimal seed */
|
function my_rand($min=null, $max=null, $force_seed=false)
| function secure_seed_rng()
|
{
|
{
|
static $seeded = false; static $obfuscator = 0;
if($seeded == false || $force_seed == true)
| $bytes = PHP_INT_SIZE;
do
|
{
|
{
|
mt_srand(secure_seed_rng()); $seeded = true;
$obfuscator = abs((int) secure_seed_rng());
// Ensure that $obfuscator is <= mt_getrandmax() for 64 bit systems. if($obfuscator > mt_getrandmax()) { $obfuscator -= mt_getrandmax(); } }
if($min !== null && $max !== null) { $distance = $max - $min; if($distance > 0)
| $output = secure_binary_seed_rng($bytes);
// convert binary data to a decimal number if ($bytes == 4)
|
{
|
{
|
return $min + (int)((float)($distance + 1) * (float)(mt_rand() ^ $obfuscator) / (mt_getrandmax() + 1));
| $elements = unpack('i', $output); $output = abs($elements[1]);
|
} else {
|
} else {
|
return mt_rand($min, $max);
| $elements = unpack('N2', $output); $output = abs($elements[1] << 32 | $elements[2]); }
} while($output > PHP_INT_MAX);
return $output; }
/** * Generates a cryptographically secure random number. * * @param int $min Optional lowest value to be returned (default: 0) * @param int $max Optional highest value to be returned (default: PHP_INT_MAX) */ function my_rand($min=0, $max=PHP_INT_MAX) { // backward compatibility if($min === null || $max === null || $max < $min) { $min = 0; $max = PHP_INT_MAX; }
if(version_compare(PHP_VERSION, '7.0', '>=')) { try { $result = random_int($min, $max); } catch (Exception $e) { }
if(isset($result)) { return $result;
|
} }
|
} }
|
else { $val = mt_rand() ^ $obfuscator; return $val; }
| $seed = secure_seed_rng();
$distance = $max - $min; return $min + floor($distance * ($seed / PHP_INT_MAX) );
|
}
/**
| }
/**
|
Zeile 7853 | Zeile 8002 |
---|
{ // Check to see if we have matched a first character in our utf-8 array $offset = match_sequence($string, $hex_chrs);
|
{ // Check to see if we have matched a first character in our utf-8 array $offset = match_sequence($string, $hex_chrs);
|
if(!$offset) {
| if(!$offset) {
|
// If not, then we must have a "good" character and we don't need to do anymore processing break; }
| // If not, then we must have a "good" character and we don't need to do anymore processing break; }
|
Zeile 7881 | Zeile 8030 |
---|
if($charlist) { $string = trim($string, $charlist);
|
if($charlist) { $string = trim($string, $charlist);
|
}
| }
|
else { $string = trim($string);
| else { $string = trim($string);
|
Zeile 7920 | Zeile 8069 |
---|
}
return 0;
|
}
return 0;
|
}
| }
|
/** * Obtain the version of GD installed.
| /** * Obtain the version of GD installed.
|
Zeile 7986 | Zeile 8135 |
---|
{ $string .= '?'; continue;
|
{ $string .= '?'; continue;
|
} else { return false; }
| } else { return false; }
|
} elseif($c > 239) {
| } elseif($c > 239) {
|
Zeile 8058 | Zeile 8207 |
---|
if($allow_mb4) { return $input;
|
if($allow_mb4) { return $input;
|
}
| }
|
else { return preg_replace("#[^\\x00-\\x7F][\\x80-\\xBF]{3,}#", '?', $input);
| else { return preg_replace("#[^\\x00-\\x7F][\\x80-\\xBF]{3,}#", '?', $input);
|
Zeile 8095 | Zeile 8244 |
---|
}
if(!is_array($pm))
|
}
if(!is_array($pm))
|
{ return false; }
| { return false; }
|
if(isset($pm['language'])) { if($pm['language'] != $mybb->user['language'] && $lang->language_exists($pm['language']))
| if(isset($pm['language'])) { if($pm['language'] != $mybb->user['language'] && $lang->language_exists($pm['language']))
|
Zeile 8108 | Zeile 8257 |
---|
$lang->load($pm['language_file']);
$revert = true;
|
$lang->load($pm['language_file']);
$revert = true;
|
}
| }
|
foreach(array('subject', 'message') as $key) {
|
foreach(array('subject', 'message') as $key) {
|
$lang_string = $pm[$key];
| |
if(is_array($pm[$key])) {
|
if(is_array($pm[$key])) {
|
| $lang_string = $lang->{$pm[$key][0]};
|
$num_args = count($pm[$key]);
for($i = 1; $i < $num_args; $i++) {
|
$num_args = count($pm[$key]);
for($i = 1; $i < $num_args; $i++) {
|
$lang->{$pm[$key][0]} = str_replace('{'.$i.'}', $pm[$key][$i], $lang->{$pm[$key][0]});
| $lang_string = str_replace('{'.$i.'}', $pm[$key][$i], $lang_string);
|
}
|
}
|
$lang_string = $pm[$key][0];
| |
}
|
}
|
$pm[$key] = $lang->{$lang_string}; }
| else { $lang_string = $lang->{$pm[$key]}; }
$pm[$key] = $lang_string; }
|
if(isset($revert)) { // Revert language
| if(isset($revert)) { // Revert language
|
Zeile 8137 | Zeile 8288 |
---|
}
if(!$pm['subject'] ||!$pm['message'] || !$pm['touid'] || (!$pm['receivepms'] && !$admin_override))
|
}
if(!$pm['subject'] ||!$pm['message'] || !$pm['touid'] || (!$pm['receivepms'] && !$admin_override))
|
{
| {
|
return false; }
|
return false; }
|
$lang->load('messages');
| |
require_once MYBB_ROOT."inc/datahandlers/pm.php";
| require_once MYBB_ROOT."inc/datahandlers/pm.php";
|
Zeile 8207 | Zeile 8356 |
---|
if($pmhandler->validate_pm()) { $pmhandler->insert_pm();
|
if($pmhandler->validate_pm()) { $pmhandler->insert_pm();
|
return true; }
return false; }
| return true; }
return false; }
|
/** * Log a user spam block from StopForumSpam (or other spam service providers...) *
| /** * Log a user spam block from StopForumSpam (or other spam service providers...) *
|
Zeile 8251 | Zeile 8400 |
---|
/** * Copy a file to the CDN.
|
/** * Copy a file to the CDN.
|
* * @param string $file_path The path to the file to upload to the CDN. *
| * * @param string $file_path The path to the file to upload to the CDN. *
|
* @param string $uploaded_path The path the file was uploaded to, reference parameter for when this may be needed. * * @return bool Whether the file was copied successfully.
| * @param string $uploaded_path The path the file was uploaded to, reference parameter for when this may be needed. * * @return bool Whether the file was copied successfully.
|
Zeile 8321 | Zeile 8470 |
---|
}
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;
|
}
| }
|