Zeile 6 | Zeile 6 |
---|
* Website: http://mybb.com * License: http://mybb.com/about/license *
|
* Website: http://mybb.com * License: http://mybb.com/about/license *
|
* $Id: functions.php 5639 2011-10-26 09:16:47Z Tomm $
| * $Id: functions.php 5819 2012-04-27 15:39:09Z Tomm $
|
*/
/**
| */
/**
|
Zeile 92 | Zeile 92 |
---|
echo $contents;
$plugins->run_hooks("post_output_page");
|
echo $contents;
$plugins->run_hooks("post_output_page");
|
// If the use shutdown functionality is turned off, run any shutdown related items now. if($mybb->settings['useshutdownfunc'] == 0 && $mybb->use_shutdown != true) { run_shutdown(); }
| |
}
/**
| }
/**
|
Zeile 287 | Zeile 281 |
---|
} $contents = str_replace("<html", "<html xmlns=\"http://www.w3.org/1999/xhtml\"", $contents);
|
} $contents = str_replace("<html", "<html xmlns=\"http://www.w3.org/1999/xhtml\"", $contents);
|
|
|
if($lang->settings['rtl'] == 1) { $contents = str_replace("<html", "<html dir=\"rtl\"", $contents);
| if($lang->settings['rtl'] == 1) { $contents = str_replace("<html", "<html dir=\"rtl\"", $contents);
|
Zeile 322 | Zeile 316 |
---|
// If the stamp isn't set, use TIME_NOW if(empty($stamp))
|
// If the stamp isn't set, use TIME_NOW if(empty($stamp))
|
{
| {
|
$stamp = TIME_NOW; }
| $stamp = TIME_NOW; }
|
Zeile 334 | Zeile 328 |
---|
$dstcorrection = $mybb->user['dst']; } elseif(defined("IN_ADMINCP"))
|
$dstcorrection = $mybb->user['dst']; } elseif(defined("IN_ADMINCP"))
|
{
| {
|
$offset = $mybbadmin['timezone']; $dstcorrection = $mybbadmin['dst'];
|
$offset = $mybbadmin['timezone']; $dstcorrection = $mybbadmin['dst'];
|
}
| }
|
else { $offset = $mybb->settings['timezoneoffset'];
| else { $offset = $mybb->settings['timezoneoffset'];
|
Zeile 346 | Zeile 340 |
---|
// If DST correction is enabled, add an additional hour to the timezone. if($dstcorrection == 1)
|
// If DST correction is enabled, add an additional hour to the timezone. if($dstcorrection == 1)
|
{
| {
|
++$offset; if(my_substr($offset, 0, 1) != "-") {
| ++$offset; if(my_substr($offset, 0, 1) != "-") {
|
Zeile 358 | Zeile 352 |
---|
if($offset == "-") { $offset = 0;
|
if($offset == "-") { $offset = 0;
|
}
| }
|
if($adodb == true && function_exists('adodb_date')) {
| if($adodb == true && function_exists('adodb_date')) {
|
Zeile 382 | Zeile 376 |
---|
{ $todaysdate = gmdate($format, $stamp + ($offset * 3600)); $yesterdaysdate = gmdate($format, ($stamp - 86400) + ($offset * 3600));
|
{ $todaysdate = gmdate($format, $stamp + ($offset * 3600)); $yesterdaysdate = gmdate($format, ($stamp - 86400) + ($offset * 3600));
|
}
| }
|
if($todaysdate == $date)
|
if($todaysdate == $date)
|
{
| {
|
$date = $lang->today;
|
$date = $lang->today;
|
}
| }
|
else if($yesterdaysdate == $date) { $date = $lang->yesterday;
|
else if($yesterdaysdate == $date) { $date = $lang->yesterday;
|
} }
| } }
|
if(is_object($plugins)) { $date = $plugins->run_hooks("my_date", $date);
| if(is_object($plugins)) { $date = $plugins->run_hooks("my_date", $date);
|
Zeile 416 | Zeile 410 |
---|
* @param string The email address to return to. Defaults to admin return email address. */ function my_mail($to, $subject, $message, $from="", $charset="", $headers="", $keep_alive=false, $format="text", $message_text="", $return_email="")
|
* @param string The email address to return to. Defaults to admin return email address. */ function my_mail($to, $subject, $message, $from="", $charset="", $headers="", $keep_alive=false, $format="text", $message_text="", $return_email="")
|
{ global $mybb;
| { global $mybb;
|
static $mail; // Does our object not exist? Create it
| static $mail; // Does our object not exist? Create it
|
Zeile 476 | Zeile 470 |
---|
else { return md5($mybb->settings['bburl'].$mybb->config['database']['username'].$mybb->settings['internal']['encryption_key']);
|
else { return md5($mybb->settings['bburl'].$mybb->config['database']['username'].$mybb->settings['internal']['encryption_key']);
|
}
| }
|
}
/**
| }
/**
|
Zeile 499 | Zeile 493 |
---|
if(defined("IN_ADMINCP")) { return false;
|
if(defined("IN_ADMINCP")) { return false;
|
}
| }
|
else { error($lang->invalid_post_code); } }
|
else { error($lang->invalid_post_code); } }
|
}
| }
|
else { return true;
|
else { return true;
|
} }
| } }
|
/** * Return a parent list for the specified forum. *
| /** * Return a parent list for the specified forum. *
|
Zeile 535 | Zeile 529 |
---|
{ cache_forums(); return $forum_cache[$fid]['parentlist'];
|
{ cache_forums(); return $forum_cache[$fid]['parentlist'];
|
}
| }
|
}
/**
| }
/**
|
Zeile 571 | Zeile 565 |
---|
/** * Load the forum cache in to memory
|
/** * Load the forum cache in to memory
|
*
| *
|
* @param boolean True to force a reload of the cache */ function cache_forums($force=false)
| * @param boolean True to force a reload of the cache */ function cache_forums($force=false)
|
Zeile 750 | Zeile 744 |
---|
else { // Redirect to where the user came from
|
else { // Redirect to where the user came from
|
if($_SERVER['HTTP_REFERER'])
| $redirect_url = $_SERVER['PHP_SELF']; if($_SERVER['QUERY_STRING'])
|
{
|
{
|
$redirect_url = htmlentities($_SERVER['HTTP_REFERER']);
| $redirect_url .= '?'.$_SERVER['QUERY_STRING'];
|
}
|
}
|
else
| $redirect_url = htmlspecialchars_uni($redirect_url); switch($mybb->settings['username_method'])
|
{
|
{
|
$redirect_url = '';
| case 0: $lang_username = $lang->username; break; case 1: $lang_username = $lang->username1; break; case 2: $lang_username = $lang->username2; break; default: $lang_username = $lang->username; break;
|
}
|
}
|
| |
eval("\$errorpage = \"".$templates->get("error_nopermission")."\";"); }
|
eval("\$errorpage = \"".$templates->get("error_nopermission")."\";"); }
|
|
|
error($errorpage);
|
error($errorpage);
|
}
| }
|
/** * Redirect the user to a given URL with a given message *
| /** * Redirect the user to a given URL with a given message *
|
Zeile 776 | Zeile 784 |
---|
global $header, $footer, $mybb, $theme, $headerinclude, $templates, $lang, $plugins;
$redirect_args = array('url' => &$url, 'message' => &$message, 'title' => &$title);
|
global $header, $footer, $mybb, $theme, $headerinclude, $templates, $lang, $plugins;
$redirect_args = array('url' => &$url, 'message' => &$message, 'title' => &$title);
|
|
|
$plugins->run_hooks("redirect", $redirect_args);
if($mybb->input['ajax'])
| $plugins->run_hooks("redirect", $redirect_args);
if($mybb->input['ajax'])
|
Zeile 799 | Zeile 807 |
---|
if(!$message) { $message = $lang->redirect;
|
if(!$message) { $message = $lang->redirect;
|
}
| }
|
$time = TIME_NOW; $timenow = my_date($mybb->settings['dateformat'], $time) . " " . my_date($mybb->settings['timeformat'], $time);
| $time = TIME_NOW; $timenow = my_date($mybb->settings['dateformat'], $time) . " " . my_date($mybb->settings['timeformat'], $time);
|
Zeile 811 | Zeile 819 |
---|
// Show redirects only if both ACP and UCP settings are enabled, or ACP is enabled, and user is a guest. if($mybb->settings['redirects'] == 1 && ($mybb->user['showredirect'] != 0 || !$mybb->user['uid']))
|
// Show redirects only if both ACP and UCP settings are enabled, or ACP is enabled, and user is a guest. if($mybb->settings['redirects'] == 1 && ($mybb->user['showredirect'] != 0 || !$mybb->user['uid']))
|
{
| {
|
$url = str_replace("&", "&", $url); $url = htmlspecialchars($url);
| $url = str_replace("&", "&", $url); $url = htmlspecialchars($url);
|
Zeile 825 | Zeile 833 |
---|
run_shutdown();
|
run_shutdown();
|
if(my_substr($url, 0, 7) !== 'http://' && my_substr($url, 0, 8) !== 'https://')
| if(my_substr($url, 0, 7) !== 'http://' && my_substr($url, 0, 8) !== 'https://' && my_substr($url, 0, 1) !== '/')
|
{ header("Location: {$mybb->settings['bburl']}/{$url}"); }
| { header("Location: {$mybb->settings['bburl']}/{$url}"); }
|
Zeile 860 | Zeile 868 |
---|
$url = htmlspecialchars_uni($url);
$pages = ceil($count / $perpage);
|
$url = htmlspecialchars_uni($url);
$pages = ceil($count / $perpage);
|
|
|
if($page > 1) { $prev = $page-1;
| if($page > 1) { $prev = $page-1;
|
Zeile 1711 | Zeile 1719 |
---|
return false; }
|
return false; }
|
$cookie = unserialize($mybb->cookies['mybb'][$name]);
| $cookie = my_unserialize($mybb->cookies['mybb'][$name]);
|
if(is_array($cookie) && isset($cookie[$id])) {
| if(is_array($cookie) && isset($cookie[$id])) {
|
Zeile 1735 | Zeile 1743 |
---|
global $mybb; $cookie = $mybb->cookies['mybb'];
|
global $mybb; $cookie = $mybb->cookies['mybb'];
|
$newcookie = unserialize($cookie[$name]);
if(!is_array($newcookie)) { // Burnt / malformed cookie - reset $newcookie = array(); }
| $newcookie = my_unserialize($cookie[$name]);
|
$newcookie[$id] = $value; $newcookie = serialize($newcookie); my_setcookie("mybb[$name]", addslashes($newcookie), $expires);
|
$newcookie[$id] = $value; $newcookie = serialize($newcookie); my_setcookie("mybb[$name]", addslashes($newcookie), $expires);
|
|
|
// Make sure our current viarables are up-to-date as well $mybb->cookies['mybb'][$name] = $newcookie; }
|
// Make sure our current viarables are up-to-date as well $mybb->cookies['mybb'][$name] = $newcookie; }
|
| /** * Verifies that data passed is an array * * @param array Data to unserialize * @return array Unserialized data array */ function my_unserialize($data) { $array = unserialize($data);
if(!is_array($array)) { $array = array(); }
return $array; }
|
/** * Returns the serverload of the system.
| /** * Returns the serverload of the system.
|
Zeile 1766 | Zeile 1786 |
---|
if(DIRECTORY_SEPARATOR != '\\') { if(function_exists("sys_getloadavg"))
|
if(DIRECTORY_SEPARATOR != '\\') { if(function_exists("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);
| // sys_getloadavg() will return an array with [0] being load within the last minute. $serverload = sys_getloadavg(); $serverload[0] = round($serverload[0], 4);
|
Zeile 1806 | Zeile 1826 |
---|
if(!is_array($serverload)) { return $lang->unknown;
|
if(!is_array($serverload)) { return $lang->unknown;
|
} } } else
| } } } else
|
{ return $lang->unknown; }
|
{ return $lang->unknown; }
|
|
|
$returnload = trim($serverload[0]);
return $returnload; }
|
$returnload = trim($serverload[0]);
return $returnload; }
|
|
|
/** * Updates the forum statistics with specific values (or addition/subtraction of the previous value) *
| /** * Updates the forum statistics with specific values (or addition/subtraction of the previous value) *
|
Zeile 1827 | Zeile 1847 |
---|
function update_stats($changes=array()) { global $cache, $db;
|
function update_stats($changes=array()) { global $cache, $db;
|
|
|
$stats = $cache->read("stats");
$counters = array('numthreads','numunapprovedthreads','numposts','numunapprovedposts','numusers');
| $stats = $cache->read("stats");
$counters = array('numthreads','numunapprovedthreads','numposts','numunapprovedposts','numusers');
|
Zeile 1877 | Zeile 1897 |
---|
else { $stats = $new_stats;
|
else { $stats = $new_stats;
|
}
| }
|
// Update stats row for today in the database $todays_stats = array( "dateline" => mktime(0, 0, 0, date("m"), date("j"), date("Y")),
| // Update stats row for today in the database $todays_stats = array( "dateline" => mktime(0, 0, 0, date("m"), date("j"), date("Y")),
|
Zeile 1887 | Zeile 1907 |
---|
"numposts" => $stats['numposts'] ); $db->replace_query("stats", $todays_stats, "dateline");
|
"numposts" => $stats['numposts'] ); $db->replace_query("stats", $todays_stats, "dateline");
|
|
|
$cache->update("stats", $stats, "dateline"); }
| $cache->update("stats", $stats, "dateline"); }
|
Zeile 1904 | Zeile 1924 |
---|
$update_query = array();
$counters = array('threads','unapprovedthreads','posts','unapprovedposts');
|
$update_query = array();
$counters = array('threads','unapprovedthreads','posts','unapprovedposts');
|
|
|
// 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);
|
Zeile 1929 | Zeile 1949 |
---|
$update_query[$counter] = 0; } }
|
$update_query[$counter] = 0; } }
|
}
| }
|
// Only update if we're actually doing something if(count($update_query) > 0) {
| // Only update if we're actually doing something if(count($update_query) > 0) {
|
Zeile 1947 | Zeile 1967 |
---|
if($threads_diff > -1) { $new_stats['numthreads'] = "+{$threads_diff}";
|
if($threads_diff > -1) { $new_stats['numthreads'] = "+{$threads_diff}";
|
}
| }
|
else { $new_stats['numthreads'] = "{$threads_diff}";
| else { $new_stats['numthreads'] = "{$threads_diff}";
|
Zeile 2086 | Zeile 2106 |
---|
/** * Update the first post and lastpost data for a specific thread
|
/** * Update the first post and lastpost data for a specific thread
|
*
| *
|
* @param int The thread ID */ function update_thread_data($tid) { global $db;
|
* @param int The thread ID */ function update_thread_data($tid) { global $db;
|
| $thread = get_thread($tid);
// If this is a moved thread marker, don't update it - we need it to stay as it is if(strpos($thread['closed'], 'moved|') !== false) { return false; }
|
$query = $db->query(" SELECT u.uid, u.username, p.username AS postusername, p.dateline FROM ".TABLE_PREFIX."posts p
| $query = $db->query(" SELECT u.uid, u.username, p.username AS postusername, p.dateline FROM ".TABLE_PREFIX."posts p
|
Zeile 2294 | Zeile 2323 |
---|
else { $template = "advanced";
|
else { $template = "advanced";
|
| if(strpos(FORUM_URL, '.html') !== false) { $forum_link = "'".str_replace('{fid}', "'+this.options[this.selectedIndex].value+'", FORUM_URL)."'"; } else { $forum_link = "'".str_replace('{fid}', "'+this.options[this.selectedIndex].value", FORUM_URL); }
|
}
eval("\$forumjump = \"".$templates->get("forumjump_".$template)."\";");
| }
eval("\$forumjump = \"".$templates->get("forumjump_".$template)."\";");
|
Zeile 2941 | Zeile 2979 |
---|
if($plugins) {
|
if($plugins) {
|
$plugins->run_hooks("get_ip", array("ip" => $ip));
| $ip_array = array("ip" => &$ip); // Used for backwards compatibility on this hook with the updated run_hooks() function. $plugins->run_hooks("get_ip", $ip_array);
|
}
return $ip;
|
}
return $ip;
|
}
| }
|
/** * Fetch the friendly size (GB, MB, KB, B) for a specified file size.
| /** * Fetch the friendly size (GB, MB, KB, B) for a specified file size.
|
Zeile 4676 | Zeile 4715 |
---|
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); } else { $link = str_replace("{fid}", $fid, FORUM_URL);
| $link = str_replace("{page}", $page, $link); return htmlspecialchars_uni($link); } else { $link = str_replace("{fid}", $fid, FORUM_URL);
|
return htmlspecialchars_uni($link); } }
| return htmlspecialchars_uni($link); } }
|
Zeile 4693 | Zeile 4732 |
---|
* @param int (Optional) The page number of the thread. * @param string (Optional) The action we're performing (ex, lastpost, newpost, etc) * @return string The url to the thread.
|
* @param int (Optional) The page number of the thread. * @param string (Optional) The action we're performing (ex, lastpost, newpost, etc) * @return string The url to the thread.
|
*/
| */
|
function get_thread_link($tid, $page=0, $action='') { if($page > 1)
| function get_thread_link($tid, $page=0, $action='') { if($page > 1)
|
Zeile 4717 | Zeile 4756 |
---|
{ $link = THREAD_URL_ACTION; $link = str_replace("{action}", $action, $link);
|
{ $link = THREAD_URL_ACTION; $link = str_replace("{action}", $action, $link);
|
}
| }
|
else { $link = THREAD_URL;
| else { $link = THREAD_URL;
|
Zeile 4729 | Zeile 4768 |
---|
/** * Build the post link.
|
/** * Build the post link.
|
*
| *
|
* @param int The post ID of the post * @param int The thread id of the post. */
| * @param int The post ID of the post * @param int The thread id of the post. */
|
Zeile 4753 | Zeile 4792 |
---|
* * @param int The event ID of the event * @return string The URL of the event
|
* * @param int The event ID of the event * @return string The URL of the event
|
*/
| */
|
function get_event_link($eid) { $link = str_replace("{eid}", $eid, EVENT_URL);
| function get_event_link($eid) { $link = str_replace("{eid}", $eid, EVENT_URL);
|
Zeile 4776 | Zeile 4815 |
---|
$link = str_replace("{month}", $month, CALENDAR_URL_DAY); $link = str_replace("{year}", $year, $link); $link = str_replace("{day}", $day, $link);
|
$link = str_replace("{month}", $month, CALENDAR_URL_DAY); $link = str_replace("{year}", $year, $link); $link = str_replace("{day}", $day, $link);
|
$link = str_replace("{calendar}", $calendar, $link);
| $link = str_replace("{calendar}", $calendar, $link);
|
return htmlspecialchars_uni($link); } else if($month > 0)
| return htmlspecialchars_uni($link); } else if($month > 0)
|
Zeile 5056 | Zeile 5095 |
---|
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));
| if($fatal) { error($lang->sprintf($lang->failed_login_wait, $hoursleft, $minsleft, $secsleft));
|
}
|
}
|
|
|
return false; }
| return false; }
|
Zeile 5070 | Zeile 5109 |
---|
my_setcookie('loginattempts', 1); my_unsetcookie('failedlogin'); if($mybb->user['uid'] != 0)
|
my_setcookie('loginattempts', 1); my_unsetcookie('failedlogin'); if($mybb->user['uid'] != 0)
|
{
| {
|
$update_array = array( 'loginattempts' => 1 );
| $update_array = array( 'loginattempts' => 1 );
|
Zeile 5092 | Zeile 5131 |
---|
// User can attempt another login return $loginattempts;
|
// User can attempt another login return $loginattempts;
|
}
/**
| }
/**
|
* Validates the format of an email address. * * @param string The string to check.
| * Validates the format of an email address. * * @param string The string to check.
|
Zeile 5118 | Zeile 5157 |
---|
* @return boolean True when in use, false when not. */ function email_already_in_use($email, $uid="")
|
* @return boolean True when in use, false when not. */ function email_already_in_use($email, $uid="")
|
{
| {
|
global $db; $uid_string = "";
| global $db; $uid_string = "";
|
Zeile 5153 | Zeile 5192 |
---|
global $db, $mybb;
if(!file_exists(MYBB_ROOT."inc/settings.php"))
|
global $db, $mybb;
if(!file_exists(MYBB_ROOT."inc/settings.php"))
|
{
| {
|
$mode = "x"; } else
| $mode = "x"; } else
|
Zeile 5200 | Zeile 5239 |
---|
if(is_array($terms)) { $terms = implode(' ', $terms);
|
if(is_array($terms)) { $terms = implode(' ', $terms);
|
}
| }
|
// Strip out any characters that shouldn't be included $bad_characters = array(
| // Strip out any characters that shouldn't be included $bad_characters = array(
|
Zeile 5247 | Zeile 5286 |
---|
} } // Otherwise just a simple search query with no phrases
|
} } // Otherwise just a simple search query with no phrases
|
else
| else
|
{ $terms = htmlspecialchars_uni($terms); $split_words = preg_split("#\s{1,}#", $terms, -1);
| { $terms = htmlspecialchars_uni($terms); $split_words = preg_split("#\s{1,}#", $terms, -1);
|
Zeile 5287 | Zeile 5326 |
---|
}
// Now make PREG compatible
|
}
// Now make PREG compatible
|
$find = "#(?!<.*?)(".preg_quote($word, "#").")(?![^<>]*?>)#i";
| $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;
|
$replacement = "<span class=\"highlight\" style=\"padding-left: 0px; padding-right: 0px;\">$1</span>"; $highlight_cache[$find] = $replacement; }
return $highlight_cache;
|
}
/**
| }
/**
|
* 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 5319 | Zeile 5358 |
---|
$dest .= chr(0x80 | ($src & 0x003f)); } elseif($src <= 0xffff)
|
$dest .= chr(0x80 | ($src & 0x003f)); } elseif($src <= 0xffff)
|
{
| {
|
$dest .= chr(0xe0 | ($src >> 12)); $dest .= chr(0x80 | (($src >> 6) & 0x003f)); $dest .= chr(0x80 | ($src & 0x003f));
| $dest .= chr(0xe0 | ($src >> 12)); $dest .= chr(0x80 | (($src >> 6) & 0x003f)); $dest .= chr(0x80 | ($src & 0x003f));
|
Zeile 5342 | Zeile 5381 |
---|
/** * Checks if a username has been disallowed for registration/use.
|
/** * Checks if a username has been disallowed for registration/use.
|
*
| *
|
* @param string The username * @param boolean True if the 'last used' dateline should be updated if a match is found. * @return boolean True if banned, false if not banned
| * @param string The username * @param boolean True if the 'last used' dateline should be updated if a match is found. * @return boolean True if banned, false if not banned
|
Zeile 5366 | Zeile 5405 |
---|
} } // Still here - good username
|
} } // Still here - good username
|
return false;
| return false;
|
}
/**
| }
/**
|
Zeile 5382 | Zeile 5421 |
---|
$banned_cache = $cache->read("bannedemails");
|
$banned_cache = $cache->read("bannedemails");
|
if(!$banned_cache)
| if($banned_cache === false)
|
{
|
{
|
| // Failed to read cache, see if we can rebuild it
|
$cache->update_bannedemails(); $banned_cache = $cache->read("bannedemails");
|
$cache->update_bannedemails(); $banned_cache = $cache->read("bannedemails");
|
}
foreach($banned_cache as $banned_email) { // Make regular expression * match $banned_email['filter'] = str_replace('\*', '(.*)', preg_quote($banned_email['filter'], '#'));
if(preg_match("#{$banned_email['filter']}#i", $email))
| }
if(is_array($banned_cache) && !empty($banned_cache)) { foreach($banned_cache as $banned_email)
|
{
|
{
|
// Updating last use if($update_lastuse == true)
| // Make regular expression * match $banned_email['filter'] = str_replace('\*', '(.*)', preg_quote($banned_email['filter'], '#'));
if(preg_match("#{$banned_email['filter']}#i", $email))
|
{
|
{
|
$db->update_query("banfilters", array("lastuse" => TIME_NOW), "fid='{$banned_email['fid']}'");
| // Updating last use if($update_lastuse == true) { $db->update_query("banfilters", array("lastuse" => TIME_NOW), "fid='{$banned_email['fid']}'"); } return true;
|
}
|
}
|
return true;
| |
} }
|
} }
|
|
|
// Still here - good email return false; }
|
// Still here - good email return false; }
|
|
|
/** * Checks if a specific IP address has been banned. *
| /** * Checks if a specific IP address has been banned. *
|
Zeile 5433 | Zeile 5477 |
---|
// Make regular expression * match $banned_ip['filter'] = str_replace('\*', '(.*)', preg_quote($banned_ip['filter'], '#'));
|
// Make regular expression * match $banned_ip['filter'] = str_replace('\*', '(.*)', preg_quote($banned_ip['filter'], '#'));
|
if(preg_match("#{$banned_ip['filter']}#i", $ip_address))
| if(preg_match("#^{$banned_ip['filter']}$#i", $ip_address))
|
{ // Updating last use if($update_lastuse == true)
| { // Updating last use if($update_lastuse == true)
|
Zeile 5443 | Zeile 5487 |
---|
return true; } }
|
return true; } }
|
|
|
// Still here - good ip return false; }
| // Still here - good ip return false; }
|
Zeile 6216 | Zeile 6261 |
---|
0x0D => 1, 0x0B => 1, 0xAD => 1,
|
0x0D => 1, 0x0B => 1, 0xAD => 1,
|
0xC2 => array(0xA0 => 1, 0xAD => 1, 0xBF => 1, 0x81 => 1, 0x8D => 1, 0x90 => 1, 0x9D => 1,),
| 0xA0 => 1, 0xAD => 1, 0xBF => 1, 0x81 => 1, 0x8D => 1, 0x90 => 1, 0x9D => 1,
|
0xCC => array(0xB7 => 1, 0xB8 => 1), // \x{0337} or \x{0338} 0xE1 => array(0x85 => array(0x9F => 1, 0xA0 => 1)), // \x{115F} or \x{1160} 0xE2 => array(0x80 => array(0x80 => 1, 0x81 => 1, 0x82 => 1, 0x83 => 1, 0x84 => 1, 0x85 => 1, 0x86 => 1, 0x87 => 1, 0x88 => 1, 0x89 => 1, 0x8A => 1, 0x8B => 1, // \x{2000} to \x{200B}
| 0xCC => array(0xB7 => 1, 0xB8 => 1), // \x{0337} or \x{0338} 0xE1 => array(0x85 => array(0x9F => 1, 0xA0 => 1)), // \x{115F} or \x{1160} 0xE2 => array(0x80 => array(0x80 => 1, 0x81 => 1, 0x82 => 1, 0x83 => 1, 0x84 => 1, 0x85 => 1, 0x86 => 1, 0x87 => 1, 0x88 => 1, 0x89 => 1, 0x8A => 1, 0x8B => 1, // \x{2000} to \x{200B}
|