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 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 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 400 | Zeile 400 |
---|
if($format == 'relative') { // Relative formats both date and time
|
if($format == 'relative') { // Relative formats both date and time
|
| $real_date = $real_time = ''; if($adodb == true) { $real_date = adodb_date($mybb->settings['dateformat'], $stamp + ($offset * 3600)); $real_time = $mybb->settings['datetimesep']; $real_time .= adodb_date($mybb->settings['timeformat'], $stamp + ($offset * 3600)); } else { $real_date = gmdate($mybb->settings['dateformat'], $stamp + ($offset * 3600)); $real_time = $mybb->settings['datetimesep']; $real_time .= gmdate($mybb->settings['timeformat'], $stamp + ($offset * 3600)); }
|
if($ty != 2 && abs(TIME_NOW - $stamp) < 3600) { $diff = TIME_NOW - $stamp; $relative = array('prefix' => '', 'minute' => 0, 'plural' => $lang->rel_minutes_plural, 'suffix' => $lang->rel_ago);
|
if($ty != 2 && abs(TIME_NOW - $stamp) < 3600) { $diff = TIME_NOW - $stamp; $relative = array('prefix' => '', 'minute' => 0, 'plural' => $lang->rel_minutes_plural, 'suffix' => $lang->rel_ago);
|
if($diff < 0) { $diff = abs($diff); $relative['suffix'] = '';
| if($diff < 0) { $diff = abs($diff); $relative['suffix'] = '';
|
$relative['prefix'] = $lang->rel_in; }
| $relative['prefix'] = $lang->rel_in; }
|
Zeile 423 | Zeile 437 |
---|
if($diff <= 60) { // Less than a minute
|
if($diff <= 60) { // Less than a minute
|
$relative['prefix'] = $lang->rel_less_than; }
$date = $lang->sprintf($lang->rel_time, $relative['prefix'], $relative['minute'], $relative['plural'], $relative['suffix']);
| $relative['prefix'] = $lang->rel_less_than; }
$date = $lang->sprintf($lang->rel_time, $relative['prefix'], $relative['minute'], $relative['plural'], $relative['suffix'], $real_date, $real_time);
|
} elseif($ty != 2 && abs(TIME_NOW - $stamp) < 43200) {
| } elseif($ty != 2 && abs(TIME_NOW - $stamp) < 43200) {
|
Zeile 448 | Zeile 462 |
---|
$relative['plural'] = $lang->rel_hours_single; }
|
$relative['plural'] = $lang->rel_hours_single; }
|
$date = $lang->sprintf($lang->rel_time, $relative['prefix'], $relative['hour'], $relative['plural'], $relative['suffix']);
| $date = $lang->sprintf($lang->rel_time, $relative['prefix'], $relative['hour'], $relative['plural'], $relative['suffix'], $real_date, $real_time);
|
} else { if($ty)
|
} else { if($ty)
|
{
| {
|
if($todaysdate == $date) {
|
if($todaysdate == $date) {
|
$date = $lang->today;
| $date = $lang->sprintf($lang->today_rel, $real_date);
|
} else if($yesterdaysdate == $date) {
|
} else if($yesterdaysdate == $date) {
|
$date = $lang->yesterday;
| $date = $lang->sprintf($lang->yesterday_rel, $real_date);
|
} }
| } }
|
Zeile 473 | 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 966 | Zeile 1005 |
---|
run_shutdown();
|
run_shutdown();
|
if(!my_validate_url($url, true))
| if(!my_validate_url($url, true, true))
|
{ header("Location: {$mybb->settings['bburl']}/{$url}"); }
| { header("Location: {$mybb->settings['bburl']}/{$url}"); }
|
Zeile 1179 | 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 1868 | Zeile 1907 |
---|
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 3048 | Zeile 3092 |
---|
if(!isset($avatars)) { $avatars = array();
|
if(!isset($avatars)) { $avatars = array();
|
| }
if(my_strpos($avatar, '://') !== false && !$mybb->settings['allowremoteavatars']) { // Remote avatar, but remote avatars are disallowed. $avatar = null;
|
}
if(!$avatar)
| }
if(!$avatar)
|
Zeile 3770 | Zeile 3820 |
---|
{ $pid = (int)$data['pid']; unset($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 if(is_array($data)) { $data = my_serialize($data);
|
}
// Any remaining extra data - we my_serialize and insert in to its own column if(is_array($data)) { $data = my_serialize($data);
|
}
| }
|
$sql_array = array( "uid" => (int)$mybb->user['uid'], "dateline" => TIME_NOW,
| $sql_array = array( "uid" => (int)$mybb->user['uid'], "dateline" => TIME_NOW,
|
Zeile 3788 | 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); }
|
}
/**
| }
/**
|
Zeile 4664 | 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 5658 | 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 5699 | 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 5713 | 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.
| /** * Get the event date.
|
Zeile 5724 | Zeile 5863 |
---|
function get_event_date($event) { global $mybb;
|
function get_event_date($event) { global $mybb;
|
|
|
$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);
|
Zeile 5770 | Zeile 5909 |
---|
global $mybb, $lang;
if(!$username && $uid == 0)
|
global $mybb, $lang;
if(!$username && $uid == 0)
|
{
| {
|
// Return Guest phrase for no UID, no guest nickname
|
// Return Guest phrase for no UID, no guest nickname
|
return $lang->guest; }
| return htmlspecialchars_uni($lang->guest); }
|
elseif($uid == 0) { // Return the guest's nickname if user is a guest but has a nickname
| elseif($uid == 0) { // Return the guest's nickname if user is a guest but has a nickname
|
Zeile 5783 | 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}\"";
|
}
| }
|
if(!empty($onclick)) { $onclick = " onclick=\"{$onclick}\""; }
return "<a href=\"{$mybb->settings['bburl']}/".get_profile_link($uid)."\"{$target}{$onclick}>{$username}</a>";
|
if(!empty($onclick)) { $onclick = " onclick=\"{$onclick}\""; }
return "<a href=\"{$mybb->settings['bburl']}/".get_profile_link($uid)."\"{$target}{$onclick}>{$username}</a>";
|
} }
| } }
|
/** * Build the forum link.
| /** * Build the forum link.
|
Zeile 6067 | Zeile 6206 |
---|
if(is_array($parents)) { foreach($parents as $parent)
|
if(is_array($parents)) { foreach($parents as $parent)
|
{
| {
|
if($forum_cache[$parent]['active'] == 0) { return false;
| if($forum_cache[$parent]['active'] == 0) { return false;
|
Zeile 6075 | Zeile 6214 |
---|
} } }
|
} } }
|
|
|
return $forum_cache[$fid];
|
return $forum_cache[$fid];
|
}
/**
| }
/**
|
* Get the thread of a thread id. * * @param int $tid The thread id of the thread.
| * Get the thread of a thread id. * * @param int $tid The thread id of the thread.
|
Zeile 6090 | Zeile 6229 |
---|
{ global $db; static $thread_cache;
|
{ global $db; static $thread_cache;
|
|
|
$tid = (int)$tid;
if(isset($thread_cache[$tid]) && !$recache)
| $tid = (int)$tid;
if(isset($thread_cache[$tid]) && !$recache)
|
Zeile 6110 | Zeile 6249 |
---|
else { $thread_cache[$tid] = false;
|
else { $thread_cache[$tid] = false;
|
return false; } } }
| return false; } } }
|
/** * Get the post of a post id.
| /** * Get the post of a post id.
|
Zeile 6136 | Zeile 6275 |
---|
{ $query = $db->simple_select("posts", "*", "pid = '{$pid}'"); $post = $db->fetch_array($query);
|
{ $query = $db->simple_select("posts", "*", "pid = '{$pid}'"); $post = $db->fetch_array($query);
|
|
|
if($post) { $post_cache[$pid] = $post;
| if($post) { $post_cache[$pid] = $post;
|
Zeile 6158 | Zeile 6297 |
---|
function get_inactive_forums() { global $forum_cache, $cache;
|
function get_inactive_forums() { global $forum_cache, $cache;
|
|
|
if(!$forum_cache) { cache_forums();
| if(!$forum_cache) { cache_forums();
|
Zeile 6177 | Zeile 6316 |
---|
{ $inactive[] = $fid1; }
|
{ $inactive[] = $fid1; }
|
} }
| } }
|
}
$inactiveforums = implode(",", $inactive);
| }
$inactiveforums = implode(",", $inactive);
|
Zeile 6199 | Zeile 6338 |
---|
if($mybb->settings['failedlogincount'] == 0) { return 1;
|
if($mybb->settings['failedlogincount'] == 0) { return 1;
|
}
| }
|
// Note: Number of logins is defaulted to 1, because using 0 seems to clear cookie data. Not really a problem as long as we account for 1 being default.
|
// Note: Number of logins is defaulted to 1, because using 0 seems to clear cookie data. Not really a problem as long as we account for 1 being default.
|
|
|
// Use cookie if possible, otherwise use session // Find better solution to prevent clearing cookies $loginattempts = 0;
| // Use cookie if possible, otherwise use session // Find better solution to prevent clearing cookies $loginattempts = 0;
|
Zeile 6210 | Zeile 6349 |
---|
if(!empty($mybb->cookies['loginattempts'])) { $loginattempts = $mybb->cookies['loginattempts'];
|
if(!empty($mybb->cookies['loginattempts'])) { $loginattempts = $mybb->cookies['loginattempts'];
|
}
| }
|
if(!empty($mybb->cookies['failedlogin'])) {
| if(!empty($mybb->cookies['failedlogin'])) {
|
Zeile 6231 | Zeile 6370 |
---|
else { $failedtime = $mybb->cookies['failedlogin'];
|
else { $failedtime = $mybb->cookies['failedlogin'];
|
}
| }
|
$secondsleft = $mybb->settings['failedlogintime'] * 60 + $failedtime - $now; $hoursleft = floor($secondsleft / 3600);
| $secondsleft = $mybb->settings['failedlogintime'] * 60 + $failedtime - $now; $hoursleft = floor($secondsleft / 3600);
|
Zeile 6242 | Zeile 6381 |
---|
if(empty($failedlogin)) { my_setcookie('failedlogin', $now);
|
if(empty($failedlogin)) { my_setcookie('failedlogin', $now);
|
if($fatal) { error($lang->sprintf($lang->failed_login_wait, $hoursleft, $minsleft, $secsleft)); }
return false; }
| if($fatal) { error($lang->sprintf($lang->failed_login_wait, $hoursleft, $minsleft, $secsleft)); }
return false; }
|
// Work out if the user has waited long enough before letting them login again if($mybb->cookies['failedlogin'] < ($now - $mybb->settings['failedlogintime'] * 60)) {
| // Work out if the user has waited long enough before letting them login again if($mybb->cookies['failedlogin'] < ($now - $mybb->settings['failedlogintime'] * 60)) {
|
Zeile 6271 | Zeile 6410 |
---|
{ error($lang->sprintf($lang->failed_login_wait, $hoursleft, $minsleft, $secsleft)); }
|
{ error($lang->sprintf($lang->failed_login_wait, $hoursleft, $minsleft, $secsleft)); }
|
|
|
return false; } }
| return false; } }
|
Zeile 6282 | Zeile 6421 |
---|
/** * Validates the format of an email address.
|
/** * Validates the format of an email address.
|
*
| *
|
* @param string $email The string to check. * @return boolean True when valid, false when invalid. */
| * @param string $email The string to check. * @return boolean True when valid, false when invalid. */
|
Zeile 6304 | Zeile 6443 |
---|
* @return boolean True when in use, false when not. */ function email_already_in_use($email, $uid=0)
|
* @return boolean True when in use, false when not. */ function email_already_in_use($email, $uid=0)
|
{
| {
|
global $db;
$uid_string = "";
| global $db;
$uid_string = "";
|
Zeile 6330 | 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);
| $query = $db->simple_select("settings", "value, name", "", array( 'order_by' => 'title', 'order_dir' => 'ASC', ));
|
|
|
$settings = null;
| $settings = '';
|
while($setting = $db->fetch_array($query)) { $mybb->settings[$setting['name']] = $setting['value'];
| while($setting = $db->fetch_array($query)) { $mybb->settings[$setting['name']] = $setting['value'];
|
Zeile 6354 | Zeile 6483 |
---|
}
$settings = "<"."?php\n/*********************************\ \n DO NOT EDIT THIS FILE, PLEASE USE\n THE SETTINGS EDITOR\n\*********************************/\n\n$settings\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);
| file_put_contents(MYBB_ROOT.'inc/settings.php', $settings, LOCK_EX);
|
$GLOBALS['settings'] = &$mybb->settings; }
| $GLOBALS['settings'] = &$mybb->settings; }
|
Zeile 6377 | Zeile 6505 |
---|
}
if(is_array($terms))
|
}
if(is_array($terms))
|
{
| {
|
$terms = implode(' ', $terms); }
| $terms = implode(' ', $terms); }
|
Zeile 6398 | Zeile 6526 |
---|
$terms = explode("\"", $terms); $words = array(); foreach($terms as $phrase)
|
$terms = explode("\"", $terms); $words = array(); foreach($terms as $phrase)
|
{
| {
|
$phrase = htmlspecialchars_uni($phrase); if($phrase != "") {
| $phrase = htmlspecialchars_uni($phrase); if($phrase != "") {
|
Zeile 6440 | Zeile 6568 |
---|
continue; } $words[] = trim($word);
|
continue; } $words[] = trim($word);
|
} } }
| } } }
|
if(!is_array($words)) { return false; }
|
if(!is_array($words)) { return false; }
|
|
|
// Sort the word array by length. Largest terms go first and work their way down to the smallest term. // This resolves problems like "test tes" where "tes" will be highlighted first, then "test" can't be highlighted because of the changed html
|
// 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 6459 | Zeile 6587 |
---|
$word = trim($word);
$word = my_strtolower($word);
|
$word = trim($word);
$word = my_strtolower($word);
|
|
|
// Special boolean operators should be stripped if($word == "" || $word == "or" || $word == "not" || $word == "and") { continue; }
|
// Special boolean operators should be stripped 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) *
|
Zeile 6491 | Zeile 6631 |
---|
return false; } elseif($src <= 0x007f)
|
return false; } elseif($src <= 0x007f)
|
{
| {
|
$dest .= chr($src);
|
$dest .= chr($src);
|
}
| }
|
elseif($src <= 0x07ff)
|
elseif($src <= 0x07ff)
|
{
| {
|
$dest .= chr(0xc0 | ($src >> 6));
|
$dest .= chr(0xc0 | ($src >> 6));
|
$dest .= chr(0x80 | ($src & 0x003f));
| $dest .= chr(0x80 | ($src & 0x003f));
|
} elseif($src <= 0xffff) {
| } elseif($src <= 0xffff) {
|
Zeile 6506 | Zeile 6646 |
---|
$dest .= chr(0x80 | ($src & 0x003f)); } elseif($src <= 0x10ffff)
|
$dest .= chr(0x80 | ($src & 0x003f)); } elseif($src <= 0x10ffff)
|
{
| {
|
$dest .= chr(0xf0 | ($src >> 18)); $dest .= chr(0x80 | (($src >> 12) & 0x3f)); $dest .= chr(0x80 | (($src >> 6) & 0x3f));
| $dest .= chr(0xf0 | ($src >> 18)); $dest .= chr(0x80 | (($src >> 12) & 0x3f)); $dest .= chr(0x80 | (($src >> 6) & 0x3f));
|
Zeile 6568 | Zeile 6708 |
---|
// Failed to read cache, see if we can rebuild it $cache->update_bannedemails(); $banned_cache = $cache->read("bannedemails");
|
// Failed to read cache, see if we can rebuild it $cache->update_bannedemails(); $banned_cache = $cache->read("bannedemails");
|
}
| }
|
if(is_array($banned_cache) && !empty($banned_cache)) { foreach($banned_cache as $banned_email)
| if(is_array($banned_cache) && !empty($banned_cache)) { foreach($banned_cache as $banned_email)
|
Zeile 6767 | Zeile 6907 |
---|
{ global $mybb, $config;
|
{ global $mybb, $config;
|
$url_components = @parse_url($url);
| if(!my_validate_url($url, true)) { return false; }
$url_components = @parse_url($url);
if(!isset($url_components['scheme'])) { $url_components['scheme'] = 'https'; } if(!isset($url_components['port'])) { $url_components['port'] = $url_components['scheme'] == 'https' ? 443 : 80; }
|
if( !$url_components || empty($url_components['host']) || (!empty($url_components['scheme']) && !in_array($url_components['scheme'], array('http', 'https'))) ||
|
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))) ||
| (!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; }
|
(!empty($config['disallowed_remote_hosts']) && in_array($url_components['host'], $config['disallowed_remote_hosts'])) ) { return false; }
|
| $addresses = get_ip_by_hostname($url_components['host']); $destination_address = $addresses[0];
|
if(!empty($config['disallowed_remote_addresses']))
|
if(!empty($config['disallowed_remote_addresses']))
|
{ $addresses = gethostbynamel($url_components['host']); if($addresses) { foreach($config['disallowed_remote_addresses'] as $disallowed_address)
| { foreach($config['disallowed_remote_addresses'] as $disallowed_address) { $ip_range = fetch_ip_range($disallowed_address);
$packed_address = my_inet_pton($destination_address);
if(is_array($ip_range))
|
{
|
{
|
$ip_range = fetch_ip_range($disallowed_address); foreach($addresses as $address)
| if(strcmp($ip_range[0], $packed_address) <= 0 && strcmp($ip_range[1], $packed_address) >= 0)
|
{
|
{
|
$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; }
| return false;
|
} }
|
} }
|
} }
| elseif($destination_address == $disallowed_address) { return false; } } }
|
$post_body = ''; if(!empty($post_data)) { foreach($post_data as $key => $val)
|
$post_body = ''; if(!empty($post_data)) { foreach($post_data as $key => $val)
|
{
| {
|
$post_body .= '&'.urlencode($key).'='.urlencode($val);
|
$post_body .= '&'.urlencode($key).'='.urlencode($val);
|
}
| }
|
$post_body = ltrim($post_body, '&'); }
|
$post_body = ltrim($post_body, '&'); }
|
|
|
if(function_exists("curl_init"))
|
if(function_exists("curl_init"))
|
{ $can_followlocation = @ini_get('open_basedir') === '' && !$mybb->safemode;
$request_header = $max_redirects != 0 && !$can_followlocation;
$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, $request_header); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
if($max_redirects != 0 && $can_followlocation) { 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); }
| { $fetch_header = $max_redirects > 0;
$ch = curl_init();
$curlopt = array( CURLOPT_URL => $url, CURLOPT_HEADER => $fetch_header, CURLOPT_TIMEOUT => 10, CURLOPT_RETURNTRANSFER => 1, CURLOPT_FOLLOWLOCATION => 0, );
if($ca_bundle_path = get_ca_bundle_path()) { $curlopt[CURLOPT_SSL_VERIFYPEER] = 1; $curlopt[CURLOPT_CAINFO] = $ca_bundle_path; } else { $curlopt[CURLOPT_SSL_VERIFYPEER] = 0; }
$curl_version_info = curl_version(); $curl_version = $curl_version_info['version'];
if(version_compare(PHP_VERSION, '7.0.7', '>=') && version_compare($curl_version, '7.49', '>=')) { // CURLOPT_CONNECT_TO $curlopt[10243] = array( $url_components['host'].':'.$url_components['port'].':'.$destination_address ); } elseif(version_compare(PHP_VERSION, '5.5', '>=') && version_compare($curl_version, '7.21.3', '>=')) { // CURLOPT_RESOLVE $curlopt[10203] = array( $url_components['host'].':'.$url_components['port'].':'.$destination_address ); }
if(!empty($post_body)) { $curlopt[CURLOPT_POST] = 1; $curlopt[CURLOPT_POSTFIELDS] = $post_body; }
curl_setopt_array($ch, $curlopt);
|
$response = curl_exec($ch);
|
$response = curl_exec($ch);
|
if($request_header)
| if($fetch_header)
|
{ $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE); $header = substr($response, 0, $header_size);
| { $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE); $header = substr($response, 0, $header_size);
|
Zeile 6875 | Zeile 7051 |
---|
} else if(function_exists("fsockopen")) {
|
} else if(function_exists("fsockopen")) {
|
if(!isset($url_components['port'])) { $url_components['port'] = 80; } if(!isset($url_components['path']))
| if(!isset($url_components['path']))
|
{ $url_components['path'] = "/"; } if(isset($url_components['query']))
|
{ $url_components['path'] = "/"; } if(isset($url_components['query']))
|
{
| {
|
$url_components['path'] .= "?{$url_components['query']}"; }
|
$url_components['path'] .= "?{$url_components['query']}"; }
|
|
|
$scheme = '';
if($url_components['scheme'] == 'https')
|
$scheme = '';
if($url_components['scheme'] == 'https')
|
{
| {
|
$scheme = 'ssl://'; if($url_components['port'] == 80)
|
$scheme = 'ssl://'; if($url_components['port'] == 80)
|
{
| {
|
$url_components['port'] = 443; } }
|
$url_components['port'] = 443; } }
|
$fp = @fsockopen($scheme.$url_components['host'], $url_components['port'], $error_no, $error, 10);
| if(function_exists('stream_context_create')) { if($url_components['scheme'] == 'https' && $ca_bundle_path = get_ca_bundle_path()) { $context = stream_context_create(array( 'ssl' => array( 'verify_peer' => true, 'verify_peer_name' => true, 'peer_name' => $url_components['host'], 'cafile' => $ca_bundle_path, ), )); } else { $context = stream_context_create(array( 'ssl' => array( 'verify_peer' => false, 'verify_peer_name' => false, ), )); }
$fp = @stream_socket_client($scheme.$destination_address.':'.(int)$url_components['port'], $error_no, $error, 10, STREAM_CLIENT_CONNECT, $context); } else { $fp = @fsockopen($scheme.$url_components['host'], (int)$url_components['port'], $error_no, $error, 10); }
|
@stream_set_timeout($fp, 10); if(!$fp) {
| @stream_set_timeout($fp, 10); if(!$fp) {
|
Zeile 6924 | Zeile 7125 |
---|
if(!empty($post_body)) { $headers[] = $post_body;
|
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 6951 | Zeile 7152 |
---|
$status_line = current(explode("\n\n", $header, 1)); $body = $data[1];
|
$status_line = current(explode("\n\n", $header, 1)); $body = $data[1];
|
if($max_redirects != 0 && (strstr($status_line, ' 301 ') || strstr($status_line, ' 302 ')))
| if($max_redirects > 0 && (strstr($status_line, ' 301 ') || strstr($status_line, ' 302 ')))
|
{ preg_match('/Location:(.*?)(?:\n|$)/', $header, $matches);
| { preg_match('/Location:(.*?)(?:\n|$)/', $header, $matches);
|
Zeile 6967 | Zeile 7168 |
---|
return $data; }
|
return $data; }
|
else if(empty($post_data)) { return @implode("", @file($url)); } else { return false; }
| else { return false; } }
/** * Resolves a hostname into a set of IP addresses. * * @param string $hostname The hostname to be resolved * @return array|bool The resulting IP addresses. False on failure */ function get_ip_by_hostname($hostname) { $addresses = @gethostbynamel($hostname);
if(!$addresses) { $result_set = @dns_get_record($hostname, DNS_A | DNS_AAAA);
if($result_set) { $addresses = array_column($result_set, 'ip'); } else { return false; } }
return $addresses; }
/** * Returns the location of the CA bundle defined in the PHP configuration. * * @return string|bool The location of the CA bundle, false if not set */ function get_ca_bundle_path() { if($path = ini_get('openssl.cafile')) { return $path; } if($path = ini_get('curl.cainfo')) { return $path; }
return false;
|
}
/**
| }
/**
|
Zeile 7469 | Zeile 7712 |
---|
array('::', '(int)"$1"?"$1":"0$1"'), $r); return $r;
|
array('::', '(int)"$1"?"$1":"0$1"'), $r); return $r;
|
} return false; } }
| } return false; } }
|
/** * Fetch an binary formatted range for searching IPv4 and IPv6 IP addresses. *
| /** * Fetch an binary formatted range for searching IPv4 and IPv6 IP addresses. *
|
Zeile 7489 | Zeile 7732 |
---|
{ // IPv6 $upper = str_replace('*', 'ffff', $ipaddress);
|
{ // IPv6 $upper = str_replace('*', 'ffff', $ipaddress);
|
$lower = str_replace('*', '0', $ipaddress);
| $lower = str_replace('*', '0', $ipaddress);
|
} else {
| } else {
|
Zeile 7520 | Zeile 7763 |
---|
$ip_range = (int)$ipaddress[1];
if(empty($ip_address) || empty($ip_range))
|
$ip_range = (int)$ipaddress[1];
if(empty($ip_address) || empty($ip_range))
|
{
| {
|
// Invalid input return false; }
| // Invalid input return false; }
|
Zeile 7598 | Zeile 7841 |
---|
{ static $time_start;
|
{ static $time_start;
|
$time = microtime(true);
| $time = microtime(true);
|
// Just starting timer, init and return if(!$time_start)
|
// Just starting timer, init and return if(!$time_start)
|
{
| {
|
$time_start = $time; return; }
| $time_start = $time; return; }
|
Zeile 7614 | Zeile 7857 |
---|
if($total < 0) $total = 0; $time_start = 0; return $total;
|
if($total < 0) $total = 0; $time_start = 0; return $total;
|
} }
| } }
|
/** * Processes a checksum list on MyBB files and returns a result set
| /** * Processes a checksum list on MyBB files and returns a result set
|
Zeile 7629 | Zeile 7872 |
---|
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");
|
$ignore_ext = array("attach");
|
|
|
if(substr($path, -1, 1) == "/") { $path = substr($path, 0, -1);
| if(substr($path, -1, 1) == "/") { $path = substr($path, 0, -1);
|
Zeile 7678 | Zeile 7921 |
---|
fclose($handle);
$md5 = md5($contents);
|
fclose($handle);
$md5 = md5($contents);
|
|
|
// Does it match any of our hashes (unix/windows new lines taken into consideration with the hashes) if(!in_array($md5, $checksums[$file_path])) {
| // Does it match any of our hashes (unix/windows new lines taken into consideration with the hashes) if(!in_array($md5, $checksums[$file_path])) {
|
Zeile 7724 | Zeile 7967 |
---|
if($int < 0) { return "$int";
|
if($int < 0) { return "$int";
|
}
| }
|
else { return "+$int";
| else { return "+$int";
|
Zeile 8224 | Zeile 8467 |
---|
* @return bool True if PM sent */ function send_pm($pm, $fromid = 0, $admin_override=false)
|
* @return bool True if PM sent */ function send_pm($pm, $fromid = 0, $admin_override=false)
|
{
| {
|
global $lang, $mybb, $db, $session;
if($mybb->settings['enablepms'] == 0)
| global $lang, $mybb, $db, $session;
if($mybb->settings['enablepms'] == 0)
|
Zeile 8254 | Zeile 8497 |
---|
{ $lang_string = $lang->{$pm[$key][0]}; $num_args = count($pm[$key]);
|
{ $lang_string = $lang->{$pm[$key][0]}; $num_args = count($pm[$key]);
|
|
|
for($i = 1; $i < $num_args; $i++) { $lang_string = str_replace('{'.$i.'}', $pm[$key][$i], $lang_string);
| for($i = 1; $i < $num_args; $i++) { $lang_string = str_replace('{'.$i.'}', $pm[$key][$i], $lang_string);
|
Zeile 8284 | Zeile 8527 |
---|
require_once MYBB_ROOT."inc/datahandlers/pm.php";
$pmhandler = new PMDataHandler();
|
require_once MYBB_ROOT."inc/datahandlers/pm.php";
$pmhandler = new PMDataHandler();
|
|
|
$subject = $pm['subject']; $message = $pm['message']; $toid = $pm['touid'];
|
$subject = $pm['subject']; $message = $pm['message']; $toid = $pm['touid'];
|
|
|
// Our recipients if(is_array($toid)) { $recipients_to = $toid;
|
// Our recipients if(is_array($toid)) { $recipients_to = $toid;
|
}
| }
|
else { $recipients_to = array($toid);
|
else { $recipients_to = array($toid);
|
}
$recipients_bcc = array();
| }
$recipients_bcc = array();
|
// Determine user ID if((int)$fromid == 0)
| // Determine user ID if((int)$fromid == 0)
|
Zeile 8345 | Zeile 8588 |
---|
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 8365 | Zeile 8608 |
---|
global $db, $session;
if(!is_array($data))
|
global $db, $session;
if(!is_array($data))
|
{
| {
|
$data = array($data); }
| $data = array($data); }
|
Zeile 8428 | Zeile 8671 |
---|
if(!($dir_exists = is_dir($cdn_upload_path))) { $dir_exists = @mkdir($cdn_upload_path, 0777, true);
|
if(!($dir_exists = is_dir($cdn_upload_path))) { $dir_exists = @mkdir($cdn_upload_path, 0777, true);
|
}
| }
|
if($dir_exists) { if(($cdn_upload_path = realpath($cdn_upload_path)) !== false)
| if($dir_exists) { if(($cdn_upload_path = realpath($cdn_upload_path)) !== false)
|
Zeile 8441 | Zeile 8684 |
---|
$uploaded_path = $cdn_upload_path; } }
|
$uploaded_path = $cdn_upload_path; } }
|
} }
| } }
|
if(is_object($plugins)) { $hook_args = array(
| if(is_object($plugins)) { $hook_args = array(
|
Zeile 8453 | Zeile 8696 |
---|
'uploaded_path' => &$uploaded_path, 'success' => &$success, );
|
'uploaded_path' => &$uploaded_path, 'success' => &$success, );
|
|
|
$plugins->run_hooks('copy_file_to_cdn_end', $hook_args); } }
return $success;
|
$plugins->run_hooks('copy_file_to_cdn_end', $hook_args); } }
return $success;
|
}
/**
| }
/**
|
* Validate an url
|
* Validate an url
|
*
| *
|
* @param string $url The url to validate. * @param bool $relative_path Whether or not the url could be a relative path.
|
* @param string $url The url to validate. * @param bool $relative_path Whether or not the url could be a relative path.
|
| * @param bool $allow_local Whether or not the url could be pointing to local networks.
|
* * @return bool Whether this is a valid url. */
|
* * @return bool Whether this is a valid url. */
|
function my_validate_url($url, $relative_path=false)
| function my_validate_url($url, $relative_path=false, $allow_local=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))
| if($allow_local) { $regex = '_^(?:(?:https?|ftp)://)(?:\S+(?::\S*)?@)?(?:(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:localhost|(?:(?:[a-z\x{00a1}-\x{ffff}0-9]-*)*[a-z\x{00a1}-\x{ffff}0-9]+)(?:\.(?:[a-z\x{00a1}-\x{ffff}0-9]-*)*[a-z\x{00a1}-\x{ffff}0-9]+)*(?:\.(?:[a-z\x{00a1}-\x{ffff}]{2,}))\.?))(?::\d{2,5})?(?:[/?#]\S*)?$_iuS'; } else { $regex = '_^(?:(?:https?|ftp)://)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\x{00a1}-\x{ffff}0-9]-*)*[a-z\x{00a1}-\x{ffff}0-9]+)(?:\.(?:[a-z\x{00a1}-\x{ffff}0-9]-*)*[a-z\x{00a1}-\x{ffff}0-9]+)*(?:\.(?:[a-z\x{00a1}-\x{ffff}]{2,}))\.?)(?::\d{2,5})?(?:[/?#]\S*)?$_iuS'; }
if($relative_path && my_substr($url, 0, 1) == '/' || preg_match($regex, $url)) { return true; } return false; }
/** * Strip html tags from string, also removes <script> and <style> contents. * * @param string $string String to stripe * @param string $allowable_tags Allowed html tags * * @return string Striped string */ function my_strip_tags($string, $allowable_tags = '') { $pattern = array( '@(<)style[^(>)]*?(>).*?(<)/style(>)@siu', '@(<)script[^(>)]*?.*?(<)/script(>)@siu', '@<style[^>]*?>.*?</style>@siu', '@<script[^>]*?.*?</script>@siu', ); $string = preg_replace($pattern, '', $string); return strip_tags($string, $allowable_tags); }
/** * Escapes a RFC 4180-compliant CSV string. * Based on https://github.com/Automattic/camptix/blob/f80725094440bf09861383b8f11e96c177c45789/camptix.php#L2867 * * @param string $string The string to be escaped * @param boolean $escape_active_content Whether or not to escape active content trigger characters * @return string The escaped string */ function my_escape_csv($string, $escape_active_content=true) { if($escape_active_content)
|
{
|
{
|
return true;
| $active_content_triggers = array('=', '+', '-', '@'); $delimiters = array(',', ';', ':', '|', '^', "\n", "\t", " ");
$first_character = mb_substr($string, 0, 1);
if( in_array($first_character, $active_content_triggers, true) || in_array($first_character, $delimiters, true) ) { $string = "'".$string; }
foreach($delimiters as $delimiter) { foreach($active_content_triggers as $trigger) { $string = str_replace($delimiter.$trigger, $delimiter."'".$trigger, $string); } }
|
}
|
}
|
return false;
| $string = str_replace('"', '""', $string);
return $string;
|
}
| }
|