Zeile 343 | Zeile 343 |
---|
{ if(isset($mybb->user['uid']) && $mybb->user['uid'] != 0 && array_key_exists("timezone", $mybb->user)) {
|
{ if(isset($mybb->user['uid']) && $mybb->user['uid'] != 0 && array_key_exists("timezone", $mybb->user)) {
|
$offset = $mybb->user['timezone'];
| $offset = (float)$mybb->user['timezone'];
|
$dstcorrection = $mybb->user['dst']; } elseif(defined("IN_ADMINCP")) {
|
$dstcorrection = $mybb->user['dst']; } elseif(defined("IN_ADMINCP")) {
|
$offset = $mybbadmin['timezone'];
| $offset = (float)$mybbadmin['timezone'];
|
$dstcorrection = $mybbadmin['dst']; } else {
|
$dstcorrection = $mybbadmin['dst']; } else {
|
$offset = $mybb->settings['timezoneoffset'];
| $offset = (float)$mybb->settings['timezoneoffset'];
|
$dstcorrection = $mybb->settings['dstcorrection']; }
| $dstcorrection = $mybb->settings['dstcorrection']; }
|
Zeile 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 1817 | Zeile 1831 |
---|
}
if($expires == -1)
|
}
if($expires == -1)
|
{
| {
|
$expires = 0; } elseif($expires == "" || $expires == null)
| $expires = 0; } elseif($expires == "" || $expires == null)
|
Zeile 1839 | Zeile 1853 |
---|
if($expires > 0) { $cookie .= "; expires=".@gmdate('D, d-M-Y H:i:s \\G\\M\\T', $expires);
|
if($expires > 0) { $cookie .= "; expires=".@gmdate('D, d-M-Y H:i:s \\G\\M\\T', $expires);
|
}
| }
|
if(!empty($mybb->settings['cookiepath'])) {
| if(!empty($mybb->settings['cookiepath'])) {
|
Zeile 1854 | Zeile 1868 |
---|
if($httponly == true) { $cookie .= "; HttpOnly";
|
if($httponly == true) { $cookie .= "; HttpOnly";
|
| }
if($mybb->settings['cookiesecureflag']) { $cookie .= "; Secure";
|
}
$mybb->cookies[$name] = $value;
| }
$mybb->cookies[$name] = $value;
|
Zeile 2012 | Zeile 2031 |
---|
{ $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 2041 |
---|
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 2052 |
---|
$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 2083 |
---|
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 2140 |
---|
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 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'); }
| 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 2184 |
---|
{ 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 2212 |
---|
{ $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 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; }
|
Zeile 2244 | Zeile 2263 |
---|
{ // 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 2301 |
---|
{ 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 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 2342 | Zeile 2361 |
---|
'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 2374 |
---|
$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 2425 |
---|
{ $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 2478 |
---|
// 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 2543 |
---|
}
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 2585 |
---|
{ $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 2821 |
---|
* 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 2994 |
---|
{ $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 3019 |
---|
}
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 3044 |
---|
* @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(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 3213 | Zeile 3243 |
---|
$emoticon = ""; $emoticons_enabled = "false"; if($smilies)
|
$emoticon = ""; $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))
|
{
| {
|
$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 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'])
|
{
| {
|
$dropdownsmilies .= '"'.$find.'": "'.$image.'",'; ++$i;
|
$dropdownsmilies .= '"'.$find.'": "'.$image.'",'; ++$i;
|
}
| }
|
else { $moresmilies .= '"'.$find.'": "'.$image.'",';
|
else { $moresmilies .= '"'.$find.'": "'.$image.'",';
|
}
| }
|
for($j = 1; $j < $finds_count; ++$j) { $find = str_replace(array('\\', '"'), array('\\\\', '\"'), htmlspecialchars_uni($finds[$j]));
| for($j = 1; $j < $finds_count; ++$j) { $find = str_replace(array('\\', '"'), array('\\\\', '\"'), htmlspecialchars_uni($finds[$j]));
|
Zeile 3291 | Zeile 3321 |
---|
}
if($mybb->settings['allowfontmycode'] == 1)
|
}
if($mybb->settings['allowfontmycode'] == 1)
|
{
| {
|
$font = "font,";
|
$font = "font,";
|
}
| }
|
if($mybb->settings['allowsizemycode'] == 1)
|
if($mybb->settings['allowsizemycode'] == 1)
|
{
| {
|
$size = "size,"; }
if($mybb->settings['allowcolormycode'] == 1) { $color = "color,";
|
$size = "size,"; }
if($mybb->settings['allowcolormycode'] == 1) { $color = "color,";
|
}
| }
|
if($mybb->settings['allowfontmycode'] == 1 || $mybb->settings['allowsizemycode'] == 1 || $mybb->settings['allowcolormycode'] == 1)
|
if($mybb->settings['allowfontmycode'] == 1 || $mybb->settings['allowsizemycode'] == 1 || $mybb->settings['allowcolormycode'] == 1)
|
{
| {
|
$removeformat = "removeformat|";
|
$removeformat = "removeformat|";
|
}
| }
|
if($mybb->settings['allowemailmycode'] == 1) { $email = "email,";
|
if($mybb->settings['allowemailmycode'] == 1) { $email = "email,";
|
}
| }
|
if($mybb->settings['allowlinkmycode'] == 1) { $link = "link,unlink";
| if($mybb->settings['allowlinkmycode'] == 1) { $link = "link,unlink";
|
Zeile 3336 | Zeile 3366 |
---|
}
eval("\$codeinsert = \"".$templates->get("codebuttons")."\";");
|
}
eval("\$codeinsert = \"".$templates->get("codebuttons")."\";");
|
}
| }
|
}
return $codeinsert;
| }
return $codeinsert;
|
Zeile 3357 | Zeile 3387 |
---|
{ $smilie_cache = $cache->read("smilies"); $smiliecount = count($smilie_cache);
|
{ $smilie_cache = $cache->read("smilies"); $smiliecount = count($smilie_cache);
|
}
| }
|
if(!$smiliecache) { if(!is_array($smilie_cache))
| if(!$smiliecache) { if(!is_array($smilie_cache))
|
Zeile 3369 | Zeile 3399 |
---|
{ $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;
|
}
| }
|
}
|
}
|
|
|
unset($smilie);
if(is_array($smiliecache))
| unset($smilie);
if(is_array($smiliecache))
|
Zeile 3380 | Zeile 3410 |
---|
$getmore = ''; if($mybb->settings['smilieinsertertot'] >= $smiliecount)
|
$getmore = ''; if($mybb->settings['smilieinsertertot'] >= $smiliecount)
|
{
| {
|
$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;
|
$counter = 0; $i = 0;
|
|
|
$extra_class = ''; foreach($smiliecache as $smilie) { if($i < $mybb->settings['smilieinsertertot'] && $smilie['showclickable'] != 0) {
|
$extra_class = ''; foreach($smiliecache as $smilie) { if($i < $mybb->settings['smilieinsertertot'] && $smilie['showclickable'] != 0) {
|
if($counter == 0) { $smilies .= "<tr>\n"; }
| |
$smilie['image'] = str_replace("{theme}", $theme['imgdir'], $smilie['image']); $smilie['image'] = htmlspecialchars_uni($mybb->get_asset_url($smilie['image'])); $smilie['name'] = htmlspecialchars_uni($smilie['name']);
|
$smilie['image'] = str_replace("{theme}", $theme['imgdir'], $smilie['image']); $smilie['image'] = htmlspecialchars_uni($mybb->get_asset_url($smilie['image'])); $smilie['name'] = htmlspecialchars_uni($smilie['name']);
|
|
|
// Only show the first text to replace in the box $temp = explode("\n", $smilie['find']); // assign to temporary variable for php 5.3 compatibility $smilie['find'] = $temp[0];
| // Only show the first text to replace in the box $temp = explode("\n", $smilie['find']); // assign to temporary variable for php 5.3 compatibility $smilie['find'] = $temp[0];
|
Zeile 3416 | Zeile 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 3431 | 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 3511 | Zeile 3537 |
---|
* @return string The thread prefix selection menu */ function build_prefix_select($fid, $selected_pid=0, $multiple=0, $previous_pid=0)
|
* @return string The thread prefix selection menu */ 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;
|
if($fid != 'all') { $fid = (int)$fid;
| if($fid != 'all') { $fid = (int)$fid;
|
Zeile 3644 | Zeile 3670 |
---|
$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 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 4136 | Zeile 4162 |
---|
$unviewable[] = $forum['fid']; } }
|
$unviewable[] = $forum['fid']; } }
|
|
|
$unviewableforums = implode(',', $unviewable);
|
$unviewableforums = implode(',', $unviewable);
|
|
|
return $unviewableforums; }
| return $unviewableforums; }
|
Zeile 4885 | Zeile 4911 |
---|
{ $location = htmlspecialchars_uni($_ENV['PATH_INFO']); }
|
{ $location = htmlspecialchars_uni($_ENV['PATH_INFO']); }
|
|
|
if($quick)
|
if($quick)
|
{
| {
|
return $location; }
|
return $location; }
|
|
|
if($fields == true) { global $mybb;
| if($fields == true) { global $mybb;
|
Zeile 4898 | Zeile 4924 |
---|
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 4911 | 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); } else { if(isset($_SERVER['QUERY_STRING']))
|
return array('location' => $location, 'form_html' => $form_html, 'form_method' => $mybb->request_method); } else { if(isset($_SERVER['QUERY_STRING']))
|
{
| {
|
$location .= "?".htmlspecialchars_uni($_SERVER['QUERY_STRING']);
|
$location .= "?".htmlspecialchars_uni($_SERVER['QUERY_STRING']);
|
}
| }
|
else if(isset($_ENV['QUERY_STRING'])) { $location .= "?".htmlspecialchars_uni($_ENV['QUERY_STRING']);
|
else if(isset($_ENV['QUERY_STRING'])) { $location .= "?".htmlspecialchars_uni($_ENV['QUERY_STRING']);
|
}
| }
|
if((isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == "POST") || (isset($_ENV['REQUEST_METHOD']) && $_ENV['REQUEST_METHOD'] == "POST")) { $post_array = array('action', 'fid', 'pid', 'tid', 'uid', 'eid');
| if((isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == "POST") || (isset($_ENV['REQUEST_METHOD']) && $_ENV['REQUEST_METHOD'] == "POST")) { $post_array = array('action', 'fid', 'pid', 'tid', 'uid', 'eid');
|
Zeile 4954 | Zeile 4980 |
---|
}
return $location;
|
}
return $location;
|
}
| }
|
}
/**
| }
/**
|
Zeile 4982 | Zeile 5008 |
---|
if(!isset($lang->use_default)) { $lang->use_default = $lang->lang_select_default;
|
if(!isset($lang->use_default)) { $lang->use_default = $lang->lang_select_default;
|
} }
| } }
|
if(!is_array($tcache))
|
if(!is_array($tcache))
|
{
| {
|
$query = $db->simple_select('themes', 'tid, name, pid, allowedgroups', "pid!='0'");
|
$query = $db->simple_select('themes', 'tid, name, pid, allowedgroups', "pid!='0'");
|
|
|
while($theme = $db->fetch_array($query)) { $tcache[$theme['pid']][$theme['tid']] = $theme;
| while($theme = $db->fetch_array($query)) { $tcache[$theme['pid']][$theme['tid']] = $theme;
|
Zeile 4997 | 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 5701 | 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 5717 | 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 6171 | Zeile 6191 |
---|
} } }
|
} } }
|
|
|
$inactiveforums = implode(",", $inactive);
return $inactiveforums;
| $inactiveforums = implode(",", $inactive);
return $inactiveforums;
|
Zeile 6676 | 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 6754 | Zeile 6776 |
---|
*/ 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 6769 | Zeile 6832 |
---|
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;
|
|
|
$request_header = $max_redirects != 0 && !$can_followlocation;
$ch = curl_init();
| $request_header = $max_redirects != 0 && !$can_followlocation;
$ch = curl_init();
|
Zeile 6778 | Zeile 6841 |
---|
curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
|
curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
|
|
|
if($max_redirects != 0 && $can_followlocation) { curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
| if($max_redirects != 0 && $can_followlocation) { curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
|
Zeile 6822 | Zeile 6885 |
---|
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']}"; }
| { 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 = '';
|
$scheme = '';
|
if($url['scheme'] == 'https') {
| 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) {
|
Zeile 6861 | Zeile 6919 |
---|
$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"; }
| else { $headers[] = "GET {$url_components['path']} HTTP/1.0"; }
|
|
|
$headers[] = "Host: {$url['host']}";
| $headers[] = "Host: {$url_components['host']}";
|
$headers[] = "Connection: Close"; $headers[] = '';
if(!empty($post_body))
|
$headers[] = "Connection: Close"; $headers[] = '';
if(!empty($post_body))
|
{
| {
|
$headers[] = $post_body; } else
| $headers[] = $post_body; } else
|
Zeile 6893 | Zeile 6951 |
---|
$data = null;
while(!feof($fp))
|
$data = null;
while(!feof($fp))
|
{
| {
|
$data .= fgets($fp, 12800); } fclose($fp);
| $data .= fgets($fp, 12800); } fclose($fp);
|
Zeile 6968 | 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 7582 | Zeile 7640 |
---|
global $mybb, $checksums, $bad_verify_files;
// We don't need to check these types of files
|
global $mybb, $checksums, $bad_verify_files;
// We don't need to check these types of files
|
$ignore = array(".", "..", ".svn", "config.php", "settings.php", "Thumb.db", "config.default.php", "lock", "htaccess.txt", "logo.gif", "logo.png");
| $ignore = array(".", "..", ".svn", "config.php", "settings.php", "Thumb.db", "config.default.php", "lock", "htaccess.txt", "htaccess-nginx.txt", "logo.gif", "logo.png");
|
$ignore_ext = array("attach");
if(substr($path, -1, 1) == "/")
| $ignore_ext = array("attach");
if(substr($path, -1, 1) == "/")
|
Zeile 8412 | Zeile 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; }
/** * Strip html tags from string, also removes <script> and <style> contents. * * @param string $string String to stripe * @param string $allowable_tags Allowed html tags * * @return string Striped string */ function my_strip_tags($string, $allowable_tags = '') { $pattern = array( '@(<)style[^(>)]*?(>).*?(<)/style(>)@siu', '@(<)script[^(>)]*?.*?(<)/script(>)@siu', '@<style[^>]*?>.*?</style>@siu', '@<script[^>]*?.*?</script>@siu', ); $string = preg_replace($pattern, '', $string); return strip_tags($string, $allowable_tags);
|
}
| }
|