Zeile 322 | Zeile 322 |
---|
/** * Turn a unix timestamp in to a "friendly" date/time format for the user. *
|
/** * Turn a unix timestamp in to a "friendly" date/time format for the user. *
|
* @param string $format A date format according to PHP's date structure.
| * @param string $format A date format (either relative, normal or PHP's date() structure).
|
* @param int $stamp The unix timestamp the date should be generated for. * @param int|string $offset The offset in hours that should be applied to times. (timezones) Or an empty string to determine that automatically * @param int $ty Whether or not to use today/yesterday formatting.
| * @param int $stamp The unix timestamp the date should be generated for. * @param int|string $offset The offset in hours that should be applied to times. (timezones) Or an empty string to determine that automatically * @param int $ty Whether or not to use today/yesterday formatting.
|
Zeile 380 | Zeile 380 |
---|
}
$todaysdate = $yesterdaysdate = '';
|
}
$todaysdate = $yesterdaysdate = '';
|
if($ty && ($format == $mybb->settings['dateformat'] || $format == 'relative'))
| if($ty && ($format == $mybb->settings['dateformat'] || $format == 'relative' || $format == 'normal'))
|
{ $_stamp = TIME_NOW; if($adodb == true)
| { $_stamp = TIME_NOW; if($adodb == true)
|
Zeile 470 | Zeile 470 |
---|
{ if($todaysdate == $date) {
|
{ if($todaysdate == $date) {
|
$date = $lang->sprintf($lang->today, $real_date);
| $date = $lang->sprintf($lang->today_rel, $real_date);
|
} else if($yesterdaysdate == $date) {
|
} else if($yesterdaysdate == $date) {
|
$date = $lang->sprintf($lang->yesterday, $real_date);
| $date = $lang->sprintf($lang->yesterday_rel, $real_date);
|
} }
| } }
|
Zeile 487 | Zeile 487 |
---|
{ $date .= gmdate($mybb->settings['timeformat'], $stamp + ($offset * 3600)); }
|
{ $date .= gmdate($mybb->settings['timeformat'], $stamp + ($offset * 3600)); }
|
| } } elseif($format == 'normal') { // Normal format both date and time if($ty != 2) { if($todaysdate == $date) { $date = $lang->today; } else if($yesterdaysdate == $date) { $date = $lang->yesterday; } }
$date .= $mybb->settings['datetimesep']; if($adodb == true) { $date .= adodb_date($mybb->settings['timeformat'], $stamp + ($offset * 3600)); } else { $date .= gmdate($mybb->settings['timeformat'], $stamp + ($offset * 3600));
|
} } else
| } } else
|
Zeile 495 | Zeile 520 |
---|
{ if($todaysdate == $date) {
|
{ if($todaysdate == $date) {
|
$date = $lang->sprintf($lang->today, $real_date);
| $date = $lang->today;
|
} else if($yesterdaysdate == $date) {
|
} else if($yesterdaysdate == $date) {
|
$date = $lang->sprintf($lang->yesterday, $real_date);
| $date = $lang->yesterday;
|
} } else
| } } else
|
Zeile 1193 | Zeile 1218 |
---|
if($uid != $mybb->user['uid']) { // We've already cached permissions for this user, return them.
|
if($uid != $mybb->user['uid']) { // We've already cached permissions for this user, return them.
|
if($user_cache[$uid]['permissions'])
| if(!empty($user_cache[$uid]['permissions']))
|
{ return $user_cache[$uid]['permissions']; }
// This user was not already cached, fetch their user information.
|
{ return $user_cache[$uid]['permissions']; }
// This user was not already cached, fetch their user information.
|
if(!$user_cache[$uid])
| if(empty($user_cache[$uid]))
|
{ $user_cache[$uid] = get_user($uid); }
| { $user_cache[$uid] = get_user($uid); }
|
Zeile 2507 | Zeile 2532 |
---|
if((int)$changes[$counter] != 0) { $update_query[$counter] = $forum[$counter] + $changes[$counter];
|
if((int)$changes[$counter] != 0) { $update_query[$counter] = $forum[$counter] + $changes[$counter];
|
} } else { $update_query[$counter] = $changes[$counter]; }
// Less than 0? That's bad if(isset($update_query[$counter]) && $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; } }
| $update_query[$counter] = 0; } }
|
Zeile 2563 | Zeile 2588 |
---|
{ $new_stats['numposts'] = "+{$posts_diff}"; }
|
{ $new_stats['numposts'] = "+{$posts_diff}"; }
|
else { $new_stats['numposts'] = "{$posts_diff}"; }
| else { $new_stats['numposts'] = "{$posts_diff}"; }
|
}
if(array_key_exists('unapprovedposts', $update_query))
| }
if(array_key_exists('unapprovedposts', $update_query))
|
Zeile 2579 | Zeile 2604 |
---|
else { $new_stats['numunapprovedposts'] = "{$unapprovedposts_diff}";
|
else { $new_stats['numunapprovedposts'] = "{$unapprovedposts_diff}";
|
} }
| } }
|
if(array_key_exists('deletedposts', $update_query)) { $deletedposts_diff = $update_query['deletedposts'] - $forum['deletedposts']; if($deletedposts_diff > -1)
|
if(array_key_exists('deletedposts', $update_query)) { $deletedposts_diff = $update_query['deletedposts'] - $forum['deletedposts']; if($deletedposts_diff > -1)
|
{
| {
|
$new_stats['numdeletedposts'] = "+{$deletedposts_diff}";
|
$new_stats['numdeletedposts'] = "+{$deletedposts_diff}";
|
}
| }
|
else { $new_stats['numdeletedposts'] = "{$deletedposts_diff}";
| else { $new_stats['numdeletedposts'] = "{$deletedposts_diff}";
|
Zeile 2596 | Zeile 2621 |
---|
}
if(array_key_exists('deletedthreads', $update_query))
|
}
if(array_key_exists('deletedthreads', $update_query))
|
{
| {
|
$deletedthreads_diff = $update_query['deletedthreads'] - $forum['deletedthreads']; if($deletedthreads_diff > -1) {
| $deletedthreads_diff = $update_query['deletedthreads'] - $forum['deletedthreads']; if($deletedthreads_diff > -1) {
|
Zeile 2642 | Zeile 2667 |
---|
);
$db->update_query("forums", $updated_forum, "fid='{$fid}'");
|
);
$db->update_query("forums", $updated_forum, "fid='{$fid}'");
|
}
| }
|
/** * Updates the thread counters with a specific value (or addition/subtraction of the previous value) *
| /** * Updates the thread counters with a specific value (or addition/subtraction of the previous value) *
|
Zeile 2896 | Zeile 2921 |
---|
}
foreach($forum_cache as $fid => $forum)
|
}
foreach($forum_cache as $fid => $forum)
|
{
| {
|
if($forum['active'] != 0) { $jumpfcache[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum; } }
|
if($forum['active'] != 0) { $jumpfcache[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum; } }
|
}
| }
|
if(!is_array($permissioncache)) {
| if(!is_array($permissioncache)) {
|
Zeile 2912 | Zeile 2937 |
---|
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)
|
{
| {
|
foreach($main as $forum) { $perms = $permissioncache[$forum['fid']];
| foreach($main as $forum) { $perms = $permissioncache[$forum['fid']];
|
Zeile 2959 | Zeile 2984 |
---|
$forum_link = "'".str_replace('{fid}', "'+option", FORUM_URL); } }
|
$forum_link = "'".str_replace('{fid}', "'+option", FORUM_URL); } }
|
|
|
eval("\$forumjump = \"".$templates->get("forumjump_".$template)."\";"); }
| eval("\$forumjump = \"".$templates->get("forumjump_".$template)."\";"); }
|
Zeile 2975 | Zeile 3000 |
---|
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 2991 | Zeile 3016 |
---|
// Complex strings have always at least 3 characters, even if $length < 3 if($complex == true)
|
// Complex strings have always at least 3 characters, even if $length < 3 if($complex == true)
|
{
| {
|
// At least one number $str[] = $set[my_rand(0, 9)];
| // At least one number $str[] = $set[my_rand(0, 9)];
|
Zeile 3022 | Zeile 3047 |
---|
* @param int $usergroup The usergroup for the user * @param int $displaygroup The display group for the user * @return string The formatted 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;
| function format_name($username, $usergroup, $displaygroup=0) { global $groupscache, $cache;
|
Zeile 3070 | Zeile 3095 |
---|
}
if(my_strpos($avatar, '://') !== false && !$mybb->settings['allowremoteavatars'])
|
}
if(my_strpos($avatar, '://') !== false && !$mybb->settings['allowremoteavatars'])
|
{
| {
|
// Remote avatar, but remote avatars are disallowed. $avatar = null;
|
// Remote avatar, but remote avatars are disallowed. $avatar = null;
|
}
| }
|
if(!$avatar) {
| if(!$avatar) {
|
Zeile 3085 | Zeile 3110 |
---|
$avatar = str_replace('{theme}', $theme['imgdir'], $mybb->settings['useravatar']); $dimensions = $mybb->settings['useravatardims'];
|
$avatar = str_replace('{theme}', $theme['imgdir'], $mybb->settings['useravatar']); $dimensions = $mybb->settings['useravatardims'];
|
}
| }
|
if(!$max_dimensions)
|
if(!$max_dimensions)
|
{
| {
|
$max_dimensions = $mybb->settings['maxavatardims'];
|
$max_dimensions = $mybb->settings['maxavatardims'];
|
}
| }
|
// An empty key wouldn't work so we need to add a fall back $key = $dimensions;
| // An empty key wouldn't work so we need to add a fall back $key = $dimensions;
|
Zeile 3102 | Zeile 3127 |
---|
if(empty($key2)) { $key2 = 'default';
|
if(empty($key2)) { $key2 = 'default';
|
}
| }
|
if(isset($avatars[$avatar][$key][$key2])) { return $avatars[$avatar][$key][$key2]; }
|
if(isset($avatars[$avatar][$key][$key2])) { return $avatars[$avatar][$key][$key2]; }
|
$avatar_width_height = '';
| $avatar_width_height = '';
|
if($dimensions) { $dimensions = explode("|", $dimensions);
| if($dimensions) { $dimensions = explode("|", $dimensions);
|
Zeile 3118 | Zeile 3143 |
---|
if($dimensions[0] && $dimensions[1]) { list($max_width, $max_height) = explode('x', $max_dimensions);
|
if($dimensions[0] && $dimensions[1]) { list($max_width, $max_height) = explode('x', $max_dimensions);
|
|
|
if(!empty($max_dimensions) && ($dimensions[0] > $max_width || $dimensions[1] > $max_height)) { require_once MYBB_ROOT."inc/functions_image.php";
| if(!empty($max_dimensions) && ($dimensions[0] > $max_width || $dimensions[1] > $max_height)) { require_once MYBB_ROOT."inc/functions_image.php";
|
Zeile 3149 | Zeile 3174 |
---|
* @return string The MyCode inserter */ function build_mycode_inserter($bind="message", $smilies = true)
|
* @return string The MyCode inserter */ function build_mycode_inserter($bind="message", $smilies = true)
|
{
| {
|
global $db, $mybb, $theme, $templates, $lang, $plugins, $smiliecache, $cache;
if($mybb->settings['bbcodeinserter'] != 0)
| global $db, $mybb, $theme, $templates, $lang, $plugins, $smiliecache, $cache;
if($mybb->settings['bbcodeinserter'] != 0)
|
Zeile 3401 | Zeile 3426 |
---|
{ $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 3513 | Zeile 3538 |
---|
$prefix_cache = $cache->read("threadprefixes");
if(!is_array($prefix_cache))
|
$prefix_cache = $cache->read("threadprefixes");
if(!is_array($prefix_cache))
|
{
| {
|
// No cache $prefix_cache = $cache->read("threadprefixes", true);
|
// No cache $prefix_cache = $cache->read("threadprefixes", true);
|
|
|
if(!is_array($prefix_cache)) { return array(); }
|
if(!is_array($prefix_cache)) { return array(); }
|
}
| }
|
$prefixes_cache = array(); foreach($prefix_cache as $prefix) { $prefixes_cache[$prefix['pid']] = $prefix;
|
$prefixes_cache = array(); foreach($prefix_cache as $prefix) { $prefixes_cache[$prefix['pid']] = $prefix;
|
}
| }
|
if($pid != 0 && is_array($prefixes_cache[$pid])) { return $prefixes_cache[$pid];
| if($pid != 0 && is_array($prefixes_cache[$pid])) { return $prefixes_cache[$pid];
|
Zeile 3781 | Zeile 3806 |
---|
{ $fid = (int)$data['fid']; unset($data['fid']);
|
{ $fid = (int)$data['fid']; unset($data['fid']);
|
}
| }
|
$tid = 0; if(isset($data['tid']))
|
$tid = 0; if(isset($data['tid']))
|
{
| {
|
$tid = (int)$data['tid']; unset($data['tid']);
|
$tid = (int)$data['tid']; unset($data['tid']);
|
}
| }
|
$pid = 0; if(isset($data['pid'])) { $pid = (int)$data['pid']; unset($data['pid']);
|
$pid = 0; if(isset($data['pid'])) { $pid = (int)$data['pid']; unset($data['pid']);
|
| }
$tids = array(); if(isset($data['tids'])) { $tids = (array)$data['tids']; unset($data['tids']);
|
}
// Any remaining extra data - we my_serialize and insert in to its own column
| }
// Any remaining extra data - we my_serialize and insert in to its own column
|
Zeile 3813 | Zeile 3845 |
---|
"data" => $db->escape_string($data), "ipaddress" => $db->escape_binary($session->packedip) );
|
"data" => $db->escape_string($data), "ipaddress" => $db->escape_binary($session->packedip) );
|
$db->insert_query("moderatorlog", $sql_array); }
| if($tids) { $multiple_sql_array = array();
foreach($tids as $tid) { $sql_array['tid'] = (int)$tid; $multiple_sql_array[] = $sql_array; }
$db->insert_query_multiple("moderatorlog", $multiple_sql_array); } else { $db->insert_query("moderatorlog", $sql_array); } }
|
/** * Get the formatted reputation for a user.
| /** * Get the formatted reputation for a user.
|
Zeile 3846 | Zeile 3894 |
---|
if($uid != 0) { eval("\$display_reputation = \"".$templates->get("postbit_reputation_formatted_link")."\";");
|
if($uid != 0) { eval("\$display_reputation = \"".$templates->get("postbit_reputation_formatted_link")."\";");
|
}
| }
|
else { eval("\$display_reputation = \"".$templates->get("postbit_reputation_formatted")."\";");
| else { eval("\$display_reputation = \"".$templates->get("postbit_reputation_formatted")."\";");
|
Zeile 3862 | Zeile 3910 |
---|
* @return string Formatted warning level */ function get_colored_warning_level($level)
|
* @return string Formatted warning level */ function get_colored_warning_level($level)
|
{
| {
|
global $templates;
$warning_class = '';
| global $templates;
$warning_class = '';
|
Zeile 3909 | Zeile 3957 |
---|
elseif(isset($_SERVER['HTTP_X_REAL_IP'])) { $addresses = explode(',', strtolower($_SERVER['HTTP_X_REAL_IP']));
|
elseif(isset($_SERVER['HTTP_X_REAL_IP'])) { $addresses = explode(',', strtolower($_SERVER['HTTP_X_REAL_IP']));
|
}
| }
|
if(is_array($addresses)) {
| if(is_array($addresses)) {
|
Zeile 4288 | Zeile 4336 |
---|
/** * Build the forum breadcrumb nagiation (the navigation to a specific forum including all parent forums)
|
/** * Build the forum breadcrumb nagiation (the navigation to a specific forum including all parent forums)
|
*
| *
|
* @param int $fid The forum ID to build the navigation for * @param array $multipage The multipage drop down array of information * @return int Returns 1 in every case. Kept for compatibility
| * @param int $fid The forum ID to build the navigation for * @param array $multipage The multipage drop down array of information * @return int Returns 1 in every case. Kept for compatibility
|
Zeile 4534 | Zeile 4582 |
---|
echo "<table style=\"background-color: #666;\" width=\"95%\" cellpadding=\"4\" cellspacing=\"1\" align=\"center\">\n"; echo "<tr>\n"; echo "<td style=\"background-color: #ccc;\"><strong>Templates Used (Loaded for this Page) - ".count($templates->cache)." Total</strong></td>\n";
|
echo "<table style=\"background-color: #666;\" width=\"95%\" cellpadding=\"4\" cellspacing=\"1\" align=\"center\">\n"; echo "<tr>\n"; echo "<td style=\"background-color: #ccc;\"><strong>Templates Used (Loaded for this Page) - ".count($templates->cache)." Total</strong></td>\n";
|
echo "</tr>\n"; echo "<tr>\n"; echo "<td style=\"background: #fff;\">".implode(", ", array_keys($templates->cache))."</td>\n"; echo "</tr>\n"; echo "</table>\n"; echo "<br />\n"; }
| echo "</tr>\n"; echo "<tr>\n"; echo "<td style=\"background: #fff;\">".implode(", ", array_keys($templates->cache))."</td>\n"; echo "</tr>\n"; echo "</table>\n"; echo "<br />\n"; }
|
if(count($templates->uncached_templates) > 0) { echo "<table style=\"background-color: #666;\" width=\"95%\" cellpadding=\"4\" cellspacing=\"1\" align=\"center\">\n";
| if(count($templates->uncached_templates) > 0) { echo "<table style=\"background-color: #666;\" width=\"95%\" cellpadding=\"4\" cellspacing=\"1\" align=\"center\">\n";
|
Zeile 4689 | Zeile 4737 |
---|
$stamp %= $msecs; $seconds = $stamp;
|
$stamp %= $msecs; $seconds = $stamp;
|
if($years == 1)
| // Prevent gross over accuracy ($options parameter will override these) if($years > 0)
|
{
|
{
|
$nicetime['years'] = "1".$lang_year;
| $options = array_merge(array( 'days' => false, 'hours' => false, 'minutes' => false, 'seconds' => false ), $options);
|
}
|
}
|
else if($years > 1)
| elseif($months > 0)
|
{
|
{
|
$nicetime['years'] = $years.$lang_years;
| $options = array_merge(array( 'hours' => false, 'minutes' => false, 'seconds' => false ), $options);
|
}
|
}
|
if($months == 1) { $nicetime['months'] = "1".$lang_month;
| elseif($weeks > 0) { $options = array_merge(array( 'minutes' => false, 'seconds' => false ), $options); } elseif($days > 0) { $options = array_merge(array( 'seconds' => false ), $options); }
if(!isset($options['years']) || $options['years'] !== false) { if($years == 1) { $nicetime['years'] = "1".$lang_year; } else if($years > 1) { $nicetime['years'] = $years.$lang_years; } }
if(!isset($options['months']) || $options['months'] !== false) { if($months == 1) { $nicetime['months'] = "1".$lang_month; } else if($months > 1) { $nicetime['months'] = $months.$lang_months; }
|
}
|
}
|
else if($months > 1)
| if(!isset($options['weeks']) || $options['weeks'] !== false)
|
{
|
{
|
$nicetime['months'] = $months.$lang_months;
| if($weeks == 1) { $nicetime['weeks'] = "1".$lang_week; } else if($weeks > 1) { $nicetime['weeks'] = $weeks.$lang_weeks; }
|
}
|
}
|
if($weeks == 1) { $nicetime['weeks'] = "1".$lang_week; } else if($weeks > 1) { $nicetime['weeks'] = $weeks.$lang_weeks; }
if($days == 1)
| if(!isset($options['days']) || $options['days'] !== false)
|
{
|
{
|
$nicetime['days'] = "1".$lang_day; } else if($days > 1) { $nicetime['days'] = $days.$lang_days;
| if($days == 1) { $nicetime['days'] = "1".$lang_day; } else if($days > 1) { $nicetime['days'] = $days.$lang_days; }
|
}
if(!isset($options['hours']) || $options['hours'] !== false)
| }
if(!isset($options['hours']) || $options['hours'] !== false)
|
Zeile 5683 | Zeile 5775 |
---|
function unhtmlentities($string) { // Replace numeric entities
|
function unhtmlentities($string) { // Replace numeric entities
|
$string = preg_replace_callback('~&#x([0-9a-f]+);~i', create_function('$matches', 'return unichr(hexdec($matches[1]));'), $string); $string = preg_replace_callback('~&#([0-9]+);~', create_function('$matches', 'return unichr($matches[1]);'), $string);
| $string = preg_replace_callback('~&#x([0-9a-f]+);~i', 'unichr_callback1', $string); $string = preg_replace_callback('~&#([0-9]+);~', 'unichr_callback2', $string);
|
// Replace literal entities $trans_tbl = get_html_translation_table(HTML_ENTITIES);
| // Replace literal entities $trans_tbl = get_html_translation_table(HTML_ENTITIES);
|
Zeile 5724 | Zeile 5816 |
---|
{ return false; }
|
{ return false; }
|
| }
/** * Returns any ascii to it's character (utf-8 safe). * * @param array $matches Matches. * @return string|bool The characterized ascii. False on failure */ function unichr_callback1($matches) { return unichr(hexdec($matches[1])); }
/** * Returns any ascii to it's character (utf-8 safe). * * @param array $matches Matches. * @return string|bool The characterized ascii. False on failure */ function unichr_callback2($matches) { return unichr($matches[1]);
|
}
/**
| }
/**
|
Zeile 5738 | Zeile 5852 |
---|
$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;
|
}
/**
| }
/**
|
* Get the event date. * * @param array $event The event data array.
| * Get the event date. * * @param array $event The event data array.
|
Zeile 5753 | Zeile 5867 |
---|
$event_date = explode("-", $event['date']); $event_date = gmmktime(0, 0, 0, $event_date[1], $event_date[0], $event_date[2]); $event_date = my_date($mybb->settings['dateformat'], $event_date);
|
$event_date = explode("-", $event['date']); $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; }
| return $event_date; }
|
Zeile 5766 | Zeile 5880 |
---|
function get_profile_link($uid=0) { $link = str_replace("{uid}", $uid, PROFILE_URL);
|
function get_profile_link($uid=0) { $link = str_replace("{uid}", $uid, PROFILE_URL);
|
return htmlspecialchars_uni($link); }
| return htmlspecialchars_uni($link); }
|
/** * Get the announcement link.
| /** * Get the announcement link.
|
Zeile 5779 | Zeile 5893 |
---|
{ $link = str_replace("{aid}", $aid, ANNOUNCEMENT_URL); return htmlspecialchars_uni($link);
|
{ $link = str_replace("{aid}", $aid, ANNOUNCEMENT_URL); return htmlspecialchars_uni($link);
|
}
| }
|
/** * Build the profile link. *
| /** * Build the profile link. *
|
Zeile 5797 | Zeile 5911 |
---|
if(!$username && $uid == 0) { // Return Guest phrase for no UID, no guest nickname
|
if(!$username && $uid == 0) { // Return Guest phrase for no UID, no guest nickname
|
return $lang->guest;
| return htmlspecialchars_uni($lang->guest);
|
} elseif($uid == 0) {
| } elseif($uid == 0) {
|
Zeile 5808 | Zeile 5922 |
---|
{ // Build the profile link for the registered user if(!empty($target))
|
{ // Build the profile link for the registered user if(!empty($target))
|
{
| {
|
$target = " target=\"{$target}\""; }
| $target = " target=\"{$target}\""; }
|
Zeile 5833 | Zeile 5947 |
---|
if($page > 0) { $link = str_replace("{fid}", $fid, FORUM_URL_PAGED);
|
if($page > 0) { $link = str_replace("{fid}", $fid, FORUM_URL_PAGED);
|
$link = str_replace("{page}", $page, $link); return htmlspecialchars_uni($link); }
| $link = str_replace("{page}", $page, $link); return htmlspecialchars_uni($link); }
|
else { $link = str_replace("{fid}", $fid, FORUM_URL);
| else { $link = str_replace("{fid}", $fid, FORUM_URL);
|
Zeile 5902 | Zeile 6016 |
---|
else { $link = str_replace("{pid}", $pid, POST_URL);
|
else { $link = str_replace("{pid}", $pid, POST_URL);
|
return htmlspecialchars_uni($link);
| return htmlspecialchars_uni($link);
|
} }
| } }
|
Zeile 5942 | Zeile 6056 |
---|
$link = str_replace("{month}", $month, CALENDAR_URL_MONTH); $link = str_replace("{year}", $year, $link); $link = str_replace("{calendar}", $calendar, $link);
|
$link = str_replace("{month}", $month, CALENDAR_URL_MONTH); $link = str_replace("{year}", $year, $link); $link = str_replace("{calendar}", $calendar, $link);
|
return htmlspecialchars_uni($link);
| return htmlspecialchars_uni($link);
|
} /* Not implemented else if($year > 0)
| } /* Not implemented else if($year > 0)
|
Zeile 6156 | Zeile 6270 |
---|
if(isset($post_cache[$pid])) { return $post_cache[$pid];
|
if(isset($post_cache[$pid])) { return $post_cache[$pid];
|
}
| }
|
else { $query = $db->simple_select("posts", "*", "pid = '{$pid}'");
| else { $query = $db->simple_select("posts", "*", "pid = '{$pid}'");
|
Zeile 6355 | Zeile 6469 |
---|
{ global $db, $mybb;
|
{ global $db, $mybb;
|
if(!file_exists(MYBB_ROOT."inc/settings.php")) { $mode = "x"; } else { $mode = "w"; }
$options = array( "order_by" => "title", "order_dir" => "ASC" ); $query = $db->simple_select("settings", "value, name", "", $options);
$settings = null;
| $query = $db->simple_select("settings", "value, name", "", array( 'order_by' => 'title', 'order_dir' => 'ASC', ));
$settings = '';
|
while($setting = $db->fetch_array($query)) { $mybb->settings[$setting['name']] = $setting['value']; $setting['value'] = addcslashes($setting['value'], '\\"$'); $settings .= "\$settings['{$setting['name']}'] = \"{$setting['value']}\";\n";
|
while($setting = $db->fetch_array($query)) { $mybb->settings[$setting['name']] = $setting['value']; $setting['value'] = addcslashes($setting['value'], '\\"$'); $settings .= "\$settings['{$setting['name']}'] = \"{$setting['value']}\";\n";
|
}
$settings = "<"."?php\n/*********************************\ \n DO NOT EDIT THIS FILE, PLEASE USE\n THE SETTINGS EDITOR\n\*********************************/\n\n$settings\n"; $file = @fopen(MYBB_ROOT."inc/settings.php", $mode); @fwrite($file, $settings); @fclose($file);
| }
$settings = "<"."?php\n/*********************************\ \n DO NOT EDIT THIS FILE, PLEASE USE\n THE SETTINGS EDITOR\n\*********************************/\n\n$settings\n";
file_put_contents(MYBB_ROOT.'inc/settings.php', $settings, LOCK_EX);
|
$GLOBALS['settings'] = &$mybb->settings; }
| $GLOBALS['settings'] = &$mybb->settings; }
|
Zeile 6395 | Zeile 6498 |
---|
function build_highlight_array($terms) { global $mybb;
|
function build_highlight_array($terms) { global $mybb;
|
|
|
if($mybb->settings['minsearchword'] < 1) { $mybb->settings['minsearchword'] = 3;
| if($mybb->settings['minsearchword'] < 1) { $mybb->settings['minsearchword'] = 3;
|
Zeile 6435 | Zeile 6538 |
---|
{ $split_words = preg_split("#\s{1,}#", $phrase, -1); if(!is_array($split_words))
|
{ $split_words = preg_split("#\s{1,}#", $phrase, -1); if(!is_array($split_words))
|
{
| {
|
continue; } foreach($split_words as $word)
| continue; } foreach($split_words as $word)
|
Zeile 6476 | Zeile 6579 |
---|
// Sort the word array by length. Largest terms go first and work their way down to the smallest term. // This resolves problems like "test tes" where "tes" will be highlighted first, then "test" can't be highlighted because of the changed html
|
// Sort the word array by length. Largest terms go first and work their way down to the smallest term. // This resolves problems like "test tes" where "tes" will be highlighted first, then "test" can't be highlighted because of the changed html
|
usort($words, create_function('$a,$b', 'return strlen($b) - strlen($a);'));
| usort($words, 'build_highlight_array_sort');
|
// Loop through our words to build the PREG compatible strings foreach($words as $word)
| // Loop through our words to build the PREG compatible strings foreach($words as $word)
|
Zeile 6489 | Zeile 6592 |
---|
if($word == "" || $word == "or" || $word == "not" || $word == "and") { continue;
|
if($word == "" || $word == "or" || $word == "not" || $word == "and") { continue;
|
}
| }
|
// Now make PREG compatible $find = "#(?!<.*?)(".preg_quote($word, "#").")(?![^<>]*?>)#ui"; $replacement = "<span class=\"highlight\" style=\"padding-left: 0px; padding-right: 0px;\">$1</span>"; $highlight_cache[$find] = $replacement; }
|
// Now make PREG compatible $find = "#(?!<.*?)(".preg_quote($word, "#").")(?![^<>]*?>)#ui"; $replacement = "<span class=\"highlight\" style=\"padding-left: 0px; padding-right: 0px;\">$1</span>"; $highlight_cache[$find] = $replacement; }
|
|
|
return $highlight_cache;
|
return $highlight_cache;
|
| }
/** * Sort the word array by length. Largest terms go first and work their way down to the smallest term. * * @param string $a First word. * @param string $b Second word. * @return integer Result of comparison function. */ function build_highlight_array_sort($a, $b) { return strlen($b) - strlen($a);
|
}
/** * Converts a decimal reference of a character to its UTF-8 equivalent * (Code by Anne van Kesteren, http://annevankesteren.nl/2005/05/character-references)
|
}
/** * Converts a decimal reference of a character to its UTF-8 equivalent * (Code by Anne van Kesteren, http://annevankesteren.nl/2005/05/character-references)
|
*
| *
|
* @param int $src Decimal value of a character reference * @return string|bool */
| * @param int $src Decimal value of a character reference * @return string|bool */
|
Zeile 6516 | Zeile 6631 |
---|
return false; } elseif($src <= 0x007f)
|
return false; } elseif($src <= 0x007f)
|
{
| {
|
$dest .= chr($src); } elseif($src <= 0x07ff)
| $dest .= chr($src); } elseif($src <= 0x07ff)
|
Zeile 6570 | Zeile 6685 |
---|
} return true; }
|
} return true; }
|
}
| }
|
// Still here - good username return false; }
| // Still here - good username return false; }
|
Zeile 6596 | Zeile 6711 |
---|
}
if(is_array($banned_cache) && !empty($banned_cache))
|
}
if(is_array($banned_cache) && !empty($banned_cache))
|
{
| {
|
foreach($banned_cache as $banned_email) { // Make regular expression * match
| foreach($banned_cache as $banned_email) { // Make regular expression * match
|
Zeile 8618 | Zeile 8733 |
---|
/** * Strip html tags from string, also removes <script> and <style> contents.
|
/** * Strip html tags from string, also removes <script> and <style> contents.
|
*
| *
|
* @param string $string String to stripe * @param string $allowable_tags Allowed html tags
|
* @param string $string String to stripe * @param string $allowable_tags Allowed html tags
|
*
| *
|
* @return string Striped string */ function my_strip_tags($string, $allowable_tags = '')
| * @return string Striped string */ function my_strip_tags($string, $allowable_tags = '')
|