Zeile 1036 | Zeile 1036 |
---|
{ return ''; }
|
{ return ''; }
|
| $page = (int)$page;
|
$url = str_replace("&", "&", $url); $url = htmlspecialchars_uni($url);
| $url = str_replace("&", "&", $url); $url = htmlspecialchars_uni($url);
|
Zeile 1066 | Zeile 1068 |
---|
}
if($to > $pages)
|
}
if($to > $pages)
|
{
| {
|
$to = $pages; $from = $pages-$mybb->settings['maxmultipagelinks']+1; if($from <= 0)
| $to = $pages; $from = $pages-$mybb->settings['maxmultipagelinks']+1; if($from <= 0)
|
Zeile 1110 | Zeile 1112 |
---|
else { eval("\$mppage .= \"".$templates->get("multipage_page")."\";");
|
else { eval("\$mppage .= \"".$templates->get("multipage_page")."\";");
|
} }
| } }
|
$end = ''; if($to < $pages)
| $end = ''; if($to < $pages)
|
Zeile 1139 | Zeile 1141 |
---|
// When the second parameter is set to 1, fetch_page_url thinks it's the first page and removes it from the URL as it's unnecessary $jump_url = fetch_page_url($url, 1); eval("\$jumptopage = \"".$templates->get("multipage_jump_page")."\";");
|
// When the second parameter is set to 1, fetch_page_url thinks it's the first page and removes it from the URL as it's unnecessary $jump_url = fetch_page_url($url, 1); eval("\$jumptopage = \"".$templates->get("multipage_jump_page")."\";");
|
}
$lang->multipage_pages = $lang->sprintf($lang->multipage_pages, $pages);
| }
$multipage_pages = $lang->sprintf($lang->multipage_pages, $pages);
|
if($breadcrumb == true)
|
if($breadcrumb == true)
|
{
| {
|
eval("\$multipage = \"".$templates->get("multipage_breadcrumb")."\";");
|
eval("\$multipage = \"".$templates->get("multipage_breadcrumb")."\";");
|
}
| }
|
else { eval("\$multipage = \"".$templates->get("multipage")."\";");
| else { eval("\$multipage = \"".$templates->get("multipage")."\";");
|
Zeile 1157 | Zeile 1159 |
---|
/** * Generate a page URL for use by the multipage function
|
/** * Generate a page URL for use by the multipage function
|
*
| *
|
* @param string $url The URL being passed * @param int $page The page number * @return string
| * @param string $url The URL being passed * @param int $page The page number * @return string
|
Zeile 1171 | Zeile 1173 |
---|
"&page={page}", "{page}" );
|
"&page={page}", "{page}" );
|
|
|
// Remove "Page 1" to the defacto URL $url = str_replace($find, array("", "", $page), $url); return $url;
| // Remove "Page 1" to the defacto URL $url = str_replace($find, array("", "", $page), $url); return $url;
|
Zeile 1200 | Zeile 1202 |
---|
/** * Fetch the permissions for a specific user
|
/** * Fetch the permissions for a specific user
|
*
| *
|
* @param int $uid The user ID * @return array Array of user permissions for the specified user */
| * @param int $uid The user ID * @return array Array of user permissions for the specified user */
|
Zeile 1243 | Zeile 1245 |
---|
return $mybb->usergroup; } }
|
return $mybb->usergroup; } }
|
|
|
/** * Fetch the usergroup permissions for a specific group or series of groups combined *
| /** * Fetch the usergroup permissions for a specific group or series of groups combined *
|
Zeile 1253 | Zeile 1255 |
---|
function usergroup_permissions($gid=0) { global $cache, $groupscache, $grouppermignore, $groupzerogreater;
|
function usergroup_permissions($gid=0) { global $cache, $groupscache, $grouppermignore, $groupzerogreater;
|
|
|
if(!is_array($groupscache)) { $groupscache = $cache->read("usergroups");
|
if(!is_array($groupscache)) { $groupscache = $cache->read("usergroups");
|
}
$groups = explode(",", $gid);
| }
$groups = explode(",", $gid);
|
if(count($groups) == 1)
|
if(count($groups) == 1)
|
{
| {
|
$groupscache[$gid]['all_usergroups'] = $gid; return $groupscache[$gid]; }
$usergroup = array(); $usergroup['all_usergroups'] = $gid;
|
$groupscache[$gid]['all_usergroups'] = $gid; return $groupscache[$gid]; }
$usergroup = array(); $usergroup['all_usergroups'] = $gid;
|
|
|
foreach($groups as $gid) { if(trim($gid) == "" || empty($groupscache[$gid]))
|
foreach($groups as $gid) { if(trim($gid) == "" || empty($groupscache[$gid]))
|
{ continue; }
| { continue; }
|
foreach($groupscache[$gid] as $perm => $access) { if(!in_array($perm, $grouppermignore))
| foreach($groupscache[$gid] as $perm => $access) { if(!in_array($perm, $grouppermignore))
|
Zeile 1306 | Zeile 1308 |
---|
}
return $usergroup;
|
}
return $usergroup;
|
}
| }
|
/** * Fetch the display group properties for a specific display group
| /** * Fetch the display group properties for a specific display group
|
Zeile 1321 | Zeile 1323 |
---|
if(!is_array($groupscache)) { $groupscache = $cache->read("usergroups");
|
if(!is_array($groupscache)) { $groupscache = $cache->read("usergroups");
|
}
| }
|
$displaygroup = array(); $group = $groupscache[$gid];
| $displaygroup = array(); $group = $groupscache[$gid];
|
Zeile 1381 | Zeile 1383 |
---|
{ return false; }
|
{ return false; }
|
}
| }
|
if(!is_array($fpermcache)) { $fpermcache = $cache->read("forumpermissions");
|
if(!is_array($fpermcache)) { $fpermcache = $cache->read("forumpermissions");
|
}
| }
|
if($fid) // Fetch the permissions for a single forum { if(empty($cached_forum_permissions_permissions[$gid][$fid])) { $cached_forum_permissions_permissions[$gid][$fid] = fetch_forum_permissions($fid, $gid, $groupperms);
|
if($fid) // Fetch the permissions for a single forum { if(empty($cached_forum_permissions_permissions[$gid][$fid])) { $cached_forum_permissions_permissions[$gid][$fid] = fetch_forum_permissions($fid, $gid, $groupperms);
|
} return $cached_forum_permissions_permissions[$gid][$fid]; } else
| } return $cached_forum_permissions_permissions[$gid][$fid]; } else
|
{ if(empty($cached_forum_permissions[$gid])) {
| { if(empty($cached_forum_permissions[$gid])) {
|
Zeile 1441 | Zeile 1443 |
---|
// If our permissions arn't inherited we need to figure them out if(empty($fpermcache[$fid][$gid]))
|
// If our permissions arn't inherited we need to figure them out if(empty($fpermcache[$fid][$gid]))
|
{
| {
|
$parents = explode(',', $forum_cache[$fid]['parentlist']); rsort($parents); if(!empty($parents))
| $parents = explode(',', $forum_cache[$fid]['parentlist']); rsort($parents); if(!empty($parents))
|
Zeile 1454 | Zeile 1456 |
---|
break; } }
|
break; } }
|
} }
| } }
|
// If we STILL don't have forum permissions we use the usergroup itself if(empty($level_permissions)) {
| // If we STILL don't have forum permissions we use the usergroup itself if(empty($level_permissions)) {
|
Zeile 1501 | Zeile 1503 |
---|
} return $current_permissions; }
|
} return $current_permissions; }
|
|
|
/** * Check the password given on a certain forum for validity *
| /** * Check the password given on a certain forum for validity *
|
Zeile 1515 | Zeile 1517 |
---|
global $mybb, $header, $footer, $headerinclude, $theme, $templates, $lang, $forum_cache;
$showform = true;
|
global $mybb, $header, $footer, $headerinclude, $theme, $templates, $lang, $forum_cache;
$showform = true;
|
|
|
if(!is_array($forum_cache)) { $forum_cache = cache_forums();
| if(!is_array($forum_cache)) { $forum_cache = cache_forums();
|
Zeile 1754 | Zeile 1756 |
---|
if(!empty($modcache)) { foreach($modcache as $modusers)
|
if(!empty($modcache)) { foreach($modcache as $modusers)
|
{
| {
|
if(isset($modusers['users'][$uid]) && $modusers['users'][$uid]['mid'] && (!$action || !empty($modusers['users'][$uid][$action]))) { return true;
| if(isset($modusers['users'][$uid]) && $modusers['users'][$uid]['mid'] && (!$action || !empty($modusers['users'][$uid][$action]))) { return true;
|
Zeile 1813 | Zeile 1815 |
---|
$iconlist = ''; $no_icons_checked = " checked=\"checked\""; // read post icons from cache, and sort them accordingly
|
$iconlist = ''; $no_icons_checked = " checked=\"checked\""; // read post icons from cache, and sort them accordingly
|
$posticons_cache = $cache->read("posticons");
| $posticons_cache = (array)$cache->read("posticons");
|
$posticons = array(); foreach($posticons_cache as $posticon) {
| $posticons = array(); foreach($posticons_cache as $posticon) {
|
Zeile 1859 | Zeile 1861 |
---|
* @param string $value The cookie value. * @param int|string $expires The timestamp of the expiry date. * @param boolean $httponly True if setting a HttpOnly cookie (supported by the majority of web browsers)
|
* @param string $value The cookie value. * @param int|string $expires The timestamp of the expiry date. * @param boolean $httponly True if setting a HttpOnly cookie (supported by the majority of web browsers)
|
| * @param string $samesite The samesite attribute to prevent CSRF.
|
*/
|
*/
|
function my_setcookie($name, $value="", $expires="", $httponly=false)
| function my_setcookie($name, $value="", $expires="", $httponly=false, $samesite="")
|
{ global $mybb;
| { global $mybb;
|
Zeile 1907 | Zeile 1910 |
---|
if($httponly == true) { $cookie .= "; HttpOnly";
|
if($httponly == true) { $cookie .= "; HttpOnly";
|
| }
if($samesite != "" && $mybb->settings['cookiesamesiteflag']) { $samesite = strtolower($samesite);
if($samesite == "lax" || $samesite == "strict") { $cookie .= "; SameSite=".$samesite; }
|
}
if($mybb->settings['cookiesecureflag']) { $cookie .= "; Secure"; }
|
}
if($mybb->settings['cookiesecureflag']) { $cookie .= "; Secure"; }
|
|
|
$mybb->cookies[$name] = $value;
header($cookie, false);
|
$mybb->cookies[$name] = $value;
header($cookie, false);
|
}
/**
| }
/**
|
* Unset a cookie set by MyBB. * * @param string $name The cookie identifier.
| * Unset a cookie set by MyBB. * * @param string $name The cookie identifier.
|
Zeile 1929 | Zeile 1942 |
---|
global $mybb;
$expires = -3600;
|
global $mybb;
$expires = -3600;
|
my_setcookie($name, "", $expires);
| my_setcookie($name, "", $expires);
|
unset($mybb->cookies[$name]); }
| unset($mybb->cookies[$name]); }
|
Zeile 1948 | Zeile 1961 |
---|
if(!isset($mybb->cookies['mybb'][$name])) { return false;
|
if(!isset($mybb->cookies['mybb'][$name])) { return false;
|
}
$cookie = my_unserialize($mybb->cookies['mybb'][$name]);
| }
$cookie = my_unserialize($mybb->cookies['mybb'][$name]);
|
if(is_array($cookie) && isset($cookie[$id])) { return $cookie[$id];
| if(is_array($cookie) && isset($cookie[$id])) { return $cookie[$id];
|
Zeile 1973 | Zeile 1986 |
---|
function my_set_array_cookie($name, $id, $value, $expires="") { global $mybb;
|
function my_set_array_cookie($name, $id, $value, $expires="") { global $mybb;
|
|
|
$cookie = $mybb->cookies['mybb']; if(isset($cookie[$name])) {
| $cookie = $mybb->cookies['mybb']; if(isset($cookie[$name])) {
|
Zeile 1994 | Zeile 2007 |
---|
/* * Arbitrary limits for _safe_unserialize()
|
/* * Arbitrary limits for _safe_unserialize()
|
*/
| */
|
define('MAX_SERIALIZED_INPUT_LENGTH', 10240); define('MAX_SERIALIZED_ARRAY_LENGTH', 256); define('MAX_SERIALIZED_ARRAY_DEPTH', 5);
| define('MAX_SERIALIZED_INPUT_LENGTH', 10240); define('MAX_SERIALIZED_ARRAY_LENGTH', 256); define('MAX_SERIALIZED_ARRAY_DEPTH', 5);
|
Zeile 3050 | Zeile 3063 |
---|
*/ function format_name($username, $usergroup, $displaygroup=0) {
|
*/ function format_name($username, $usergroup, $displaygroup=0) {
|
global $groupscache, $cache;
| global $groupscache, $cache, $plugins;
|
|
|
if(!is_array($groupscache))
| static $formattednames = array();
if(!isset($formattednames[$username]))
|
{
|
{
|
$groupscache = $cache->read("usergroups"); }
if($displaygroup != 0) { $usergroup = $displaygroup; }
| if(!is_array($groupscache)) { $groupscache = $cache->read("usergroups"); }
if($displaygroup != 0) { $usergroup = $displaygroup; }
$format = "{username}";
if(isset($groupscache[$usergroup])) { $ugroup = $groupscache[$usergroup];
if(strpos($ugroup['namestyle'], "{username}") !== false) { $format = $ugroup['namestyle']; } }
$format = stripslashes($format);
$parameters = compact('username', 'usergroup', 'displaygroup', 'format');
$parameters = $plugins->run_hooks('format_name', $parameters);
|
|
|
$ugroup = $groupscache[$usergroup]; $format = $ugroup['namestyle']; $userin = substr_count($format, "{username}");
| $format = $parameters['format'];
|
|
|
if($userin == 0) { $format = "{username}";
| $formattednames[$username] = str_replace("{username}", $username, $format);
|
}
|
}
|
$format = stripslashes($format);
return str_replace("{username}", $username, $format);
| return $formattednames[$username];
|
}
/**
| }
/**
|
Zeile 3582 | Zeile 3611 |
---|
if($fid != 'all') { $fid = (int)$fid;
|
if($fid != 'all') { $fid = (int)$fid;
|
}
$prefix_cache = build_prefixes(0); if(empty($prefix_cache)) { // We've got no prefixes to show return ''; }
// Go through each of our prefixes and decide which ones we can use $prefixes = array(); foreach($prefix_cache as $prefix)
| }
$prefix_cache = build_prefixes(0); if(empty($prefix_cache)) { // We've got no prefixes to show return ''; }
// Go through each of our prefixes and decide which ones we can use $prefixes = array(); foreach($prefix_cache as $prefix)
|
{ if($fid != "all" && $prefix['forums'] != "-1") {
| { if($fid != "all" && $prefix['forums'] != "-1") {
|
Zeile 3615 | Zeile 3644 |
---|
}
if(empty($prefixes))
|
}
if(empty($prefixes))
|
{ return ''; }
$prefixselect = $prefixselect_prefix = '';
| { return ''; }
$prefixselect = $prefixselect_prefix = '';
|
if($multiple == 1) { $any_selected = "";
| if($multiple == 1) { $any_selected = "";
|
Zeile 3646 | Zeile 3675 |
---|
$prefix['prefix'] = htmlspecialchars_uni($prefix['prefix']); eval("\$prefixselect_prefix .= \"".$templates->get("post_prefixselect_prefix")."\";");
|
$prefix['prefix'] = htmlspecialchars_uni($prefix['prefix']); eval("\$prefixselect_prefix .= \"".$templates->get("post_prefixselect_prefix")."\";");
|
}
| }
|
if($multiple != 0) {
| if($multiple != 0) {
|
Zeile 3699 | Zeile 3728 |
---|
{ // This prefix is for anybody to use... $prefixes[$prefix['pid']] = $prefix;
|
{ // This prefix is for anybody to use... $prefixes[$prefix['pid']] = $prefix;
|
} }
| } }
|
if(empty($prefixes))
|
if(empty($prefixes))
|
{
| {
|
return ''; }
|
return ''; }
|
|
|
$default_selected = array(); $selected_pid = (int)$selected_pid;
if($selected_pid == 0) { $default_selected['all'] = ' selected="selected"';
|
$default_selected = array(); $selected_pid = (int)$selected_pid;
if($selected_pid == 0) { $default_selected['all'] = ' selected="selected"';
|
}
| }
|
else if($selected_pid == -1) { $default_selected['none'] = ' selected="selected"';
| else if($selected_pid == -1) { $default_selected['none'] = ' selected="selected"';
|
Zeile 3753 | Zeile 3782 |
---|
$httpaccept_encoding = '';
if(isset($_SERVER['HTTP_ACCEPT_ENCODING']))
|
$httpaccept_encoding = '';
if(isset($_SERVER['HTTP_ACCEPT_ENCODING']))
|
{
| {
|
$httpaccept_encoding = $_SERVER['HTTP_ACCEPT_ENCODING'];
|
$httpaccept_encoding = $_SERVER['HTTP_ACCEPT_ENCODING'];
|
}
| }
|
if(my_strpos(" ".$httpaccept_encoding, "x-gzip"))
|
if(my_strpos(" ".$httpaccept_encoding, "x-gzip"))
|
{
| {
|
$encoding = "x-gzip";
|
$encoding = "x-gzip";
|
}
| }
|
if(my_strpos(" ".$httpaccept_encoding, "gzip")) { $encoding = "gzip";
|
if(my_strpos(" ".$httpaccept_encoding, "gzip")) { $encoding = "gzip";
|
}
| }
|
if(isset($encoding)) { header("Content-Encoding: $encoding");
| if(isset($encoding)) { header("Content-Encoding: $encoding");
|
Zeile 3806 | Zeile 3835 |
---|
{ $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']); }
|
Zeile 3820 | Zeile 3849 |
---|
{ $pid = (int)$data['pid']; unset($data['pid']);
|
{ $pid = (int)$data['pid']; unset($data['pid']);
|
}
| }
|
$tids = array(); if(isset($data['tids']))
|
$tids = array(); if(isset($data['tids']))
|
{
| {
|
$tids = (array)$data['tids']; unset($data['tids']); }
| $tids = (array)$data['tids']; unset($data['tids']); }
|
Zeile 3833 | Zeile 3862 |
---|
if(is_array($data)) { $data = my_serialize($data);
|
if(is_array($data)) { $data = my_serialize($data);
|
}
| }
|
$sql_array = array( "uid" => (int)$mybb->user['uid'],
| $sql_array = array( "uid" => (int)$mybb->user['uid'],
|
Zeile 3857 | Zeile 3886 |
---|
}
$db->insert_query_multiple("moderatorlog", $multiple_sql_array);
|
}
$db->insert_query_multiple("moderatorlog", $multiple_sql_array);
|
} else {
| } else {
|
$db->insert_query("moderatorlog", $sql_array); } }
| $db->insert_query("moderatorlog", $sql_array); } }
|
Zeile 3899 | Zeile 3928 |
---|
{ eval("\$display_reputation = \"".$templates->get("postbit_reputation_formatted")."\";"); }
|
{ eval("\$display_reputation = \"".$templates->get("postbit_reputation_formatted")."\";"); }
|
|
|
return $display_reputation; }
| return $display_reputation; }
|
Zeile 3912 | Zeile 3941 |
---|
function get_colored_warning_level($level) { global $templates;
|
function get_colored_warning_level($level) { global $templates;
|
|
|
$warning_class = ''; if($level >= 80) {
| $warning_class = ''; if($level >= 80) {
|
Zeile 4151 | Zeile 4180 |
---|
{ global $change_dir; $theme['imgdir'] = "{$change_dir}/images";
|
{ global $change_dir; $theme['imgdir'] = "{$change_dir}/images";
|
}
| }
|
$icon = "{$theme['imgdir']}/attachtypes/unknown.png";
| $icon = "{$theme['imgdir']}/attachtypes/unknown.png";
|
Zeile 4628 | Zeile 4657 |
---|
* * @param array|int $id An array or int of the ID numbers you're marking as dealt with * @param string $type The type of item the above IDs are for - post, posts, thread, threads, forum, all
|
* * @param array|int $id An array or int of the ID numbers you're marking as dealt with * @param string $type The type of item the above IDs are for - post, posts, thread, threads, forum, all
|
*/
| */
|
function mark_reports($id, $type="post") { global $db, $cache, $plugins;
| function mark_reports($id, $type="post") { global $db, $cache, $plugins;
|
Zeile 4866 | Zeile 4895 |
---|
* @return string trow1 or trow2 depending on the previous call */ function alt_trow($reset=0)
|
* @return string trow1 or trow2 depending on the previous call */ function alt_trow($reset=0)
|
{
| {
|
global $alttrow;
if($alttrow == "trow1" && !$reset)
| global $alttrow;
if($alttrow == "trow1" && !$reset)
|
Zeile 5219 | Zeile 5248 |
---|
* @return string The string with htmlspecialchars applied */ function htmlspecialchars_uni($message)
|
* @return string The string with htmlspecialchars applied */ function htmlspecialchars_uni($message)
|
{
| {
|
$message = preg_replace("#&(?!\#[0-9]+;)#si", "&", $message); // Fix & but allow unicode $message = str_replace("<", "<", $message); $message = str_replace(">", ">", $message);
| $message = preg_replace("#&(?!\#[0-9]+;)#si", "&", $message); // Fix & but allow unicode $message = str_replace("<", "<", $message); $message = str_replace(">", ">", $message);
|
Zeile 5260 | Zeile 5289 |
---|
}
return number_format((double)$number, $decimals, $mybb->settings['decpoint'], $mybb->settings['thousandssep']);
|
}
return number_format((double)$number, $decimals, $mybb->settings['decpoint'], $mybb->settings['thousandssep']);
|
} }
/**
| } }
/**
|
* Converts a string of text to or from UTF-8. * * @param string $str The string of text to convert
| * Converts a string of text to or from UTF-8. * * @param string $str The string of text to convert
|
Zeile 5337 | Zeile 5366 |
---|
/** * DEPRECATED! Please use other alternatives.
|
/** * DEPRECATED! Please use other alternatives.
|
*
| *
|
* @deprecated * @param string $message *
| * @deprecated * @param string $message *
|
Zeile 5393 | Zeile 5422 |
---|
* @return array The number of days in each month of that year */ function get_bdays($in)
|
* @return array The number of days in each month of that year */ function get_bdays($in)
|
{
| {
|
return array( 31, ($in % 4 == 0 && ($in % 100 > 0 || $in % 400 == 0) ? 29 : 28),
|
return array( 31, ($in % 4 == 0 && ($in % 100 > 0 || $in % 400 == 0) ? 29 : 28),
|
31, 30, 31, 30, 31, 31,
| 31, 30, 31, 30, 31, 31,
|
30, 31, 30, 31
|
30, 31, 30, 31
|
);
| );
|
}
/**
| }
/**
|
Zeile 5434 | Zeile 5463 |
---|
$lang->thursday, $lang->friday, $lang->saturday
|
$lang->thursday, $lang->friday, $lang->saturday
|
);
| );
|
$bmonth = array( $lang->month_1, $lang->month_2,
| $bmonth = array( $lang->month_1, $lang->month_2,
|
Zeile 5450 | Zeile 5479 |
---|
$lang->month_11, $lang->month_12 );
|
$lang->month_11, $lang->month_12 );
|
| |
// This needs to be in this specific order $find = array(
| // This needs to be in this specific order $find = array(
|
Zeile 5574 | Zeile 5602 |
---|
* @param int $tid The thread id for which to update the last post id. */ function update_last_post($tid)
|
* @param int $tid The thread id for which to update the last post id. */ function update_last_post($tid)
|
{
| {
|
global $db;
$query = $db->query("
| global $db;
$query = $db->query("
|
Zeile 5811 | Zeile 5839 |
---|
return chr(0xF0 | $c >> 18) . chr(0x80 | $c >> 12 & 0x3F) . chr(0x80 | $c >> 6 & 0x3F) . chr(0x80 | $c & 0x3F);
|
return chr(0xF0 | $c >> 18) . chr(0x80 | $c >> 12 & 0x3F) . chr(0x80 | $c >> 6 & 0x3F) . chr(0x80 | $c & 0x3F);
|
} else { return false; } }
/** * Returns any ascii to it's character (utf-8 safe). * * @param array $matches Matches.
| } else { 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 string|bool The characterized ascii. False on failure */ function unichr_callback1($matches)
|
Zeile 5838 | Zeile 5866 |
---|
function unichr_callback2($matches) { return unichr($matches[1]);
|
function unichr_callback2($matches) { return unichr($matches[1]);
|
}
| }
|
/** * Get the event poster. *
| /** * Get the event poster. *
|
Zeile 5892 | Zeile 5920 |
---|
function get_announcement_link($aid=0) { $link = str_replace("{aid}", $aid, ANNOUNCEMENT_URL);
|
function get_announcement_link($aid=0) { $link = str_replace("{aid}", $aid, ANNOUNCEMENT_URL);
|
return htmlspecialchars_uni($link);
| return htmlspecialchars_uni($link);
|
}
/**
| }
/**
|
Zeile 6034 | Zeile 6062 |
---|
/** * Build the link to a specified date on the calendar
|
/** * Build the link to a specified date on the calendar
|
*
| *
|
* @param int $calendar The ID of the calendar * @param int $year The year * @param int $month The month
| * @param int $calendar The ID of the calendar * @param int $year The year * @param int $month The month
|
Zeile 6052 | Zeile 6080 |
---|
return htmlspecialchars_uni($link); } else if($month > 0)
|
return htmlspecialchars_uni($link); } else if($month > 0)
|
{
| {
|
$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);
|
Zeile 6079 | Zeile 6107 |
---|
function get_calendar_week_link($calendar, $week) { if($week < 0)
|
function get_calendar_week_link($calendar, $week) { if($week < 0)
|
{
| {
|
$week = str_replace('-', "n", $week); } $link = str_replace("{week}", $week, CALENDAR_URL_WEEK);
| $week = str_replace('-', "n", $week); } $link = str_replace("{week}", $week, CALENDAR_URL_WEEK);
|
Zeile 6097 | Zeile 6125 |
---|
{ global $mybb, $db; static $user_cache;
|
{ global $mybb, $db; static $user_cache;
|
|
|
$uid = (int)$uid;
if(!empty($mybb->user) && $uid == $mybb->user['uid'])
| $uid = (int)$uid;
if(!empty($mybb->user) && $uid == $mybb->user['uid'])
|
Zeile 6105 | Zeile 6133 |
---|
return $mybb->user; } elseif(isset($user_cache[$uid]))
|
return $mybb->user; } elseif(isset($user_cache[$uid]))
|
{
| {
|
return $user_cache[$uid]; } elseif($uid > 0)
| return $user_cache[$uid]; } elseif($uid > 0)
|
Zeile 6114 | Zeile 6142 |
---|
$user_cache[$uid] = $db->fetch_array($query);
return $user_cache[$uid];
|
$user_cache[$uid] = $db->fetch_array($query);
return $user_cache[$uid];
|
}
| }
|
return array(); }
| return array(); }
|
Zeile 6132 | Zeile 6160 |
---|
$username = $db->escape_string(my_strtolower($username));
if(!isset($options['username_method']))
|
$username = $db->escape_string(my_strtolower($username));
if(!isset($options['username_method']))
|
{
| {
|
$options['username_method'] = 0; }
| $options['username_method'] = 0; }
|
Zeile 6150 | Zeile 6178 |
---|
}
switch($options['username_method'])
|
}
switch($options['username_method'])
|
{
| {
|
case 1: $sqlwhere = "{$efield}='{$username}'"; break;
| case 1: $sqlwhere = "{$efield}='{$username}'"; break;
|
Zeile 6166 | Zeile 6194 |
---|
if(isset($options['fields'])) { $fields = array_merge((array)$options['fields'], $fields);
|
if(isset($options['fields'])) { $fields = array_merge((array)$options['fields'], $fields);
|
}
$query = $db->simple_select('users', implode(',', array_unique($fields)), $sqlwhere, array('limit' => 1));
| }
$query = $db->simple_select('users', implode(',', array_unique($fields)), $sqlwhere, array('limit' => 1));
|
if(isset($options['exists'])) { return (bool)$db->num_rows($query); }
return $db->fetch_array($query);
|
if(isset($options['exists'])) { return (bool)$db->num_rows($query); }
return $db->fetch_array($query);
|
}
| }
|
/** * Get the forum of a specific forum id.
| /** * Get the forum of a specific forum id.
|
Zeile 6184 | Zeile 6212 |
---|
* @param int $fid The forum id of the forum. * @param int $active_override (Optional) If set to 1, will override the active forum status * @return array|bool The database row of a forum. False on failure
|
* @param int $fid The forum id of the forum. * @param int $active_override (Optional) If set to 1, will override the active forum status * @return array|bool The database row of a forum. False on failure
|
*/
| */
|
function get_forum($fid, $active_override=0) { global $cache;
| function get_forum($fid, $active_override=0) { global $cache;
|
Zeile 6193 | Zeile 6221 |
---|
if(!isset($forum_cache) || is_array($forum_cache)) { $forum_cache = $cache->read("forums");
|
if(!isset($forum_cache) || is_array($forum_cache)) { $forum_cache = $cache->read("forums");
|
}
| }
|
if(empty($forum_cache[$fid]))
|
if(empty($forum_cache[$fid]))
|
{
| {
|
return false; }
if($active_override != 1)
|
return false; }
if($active_override != 1)
|
{
| {
|
$parents = explode(",", $forum_cache[$fid]['parentlist']); if(is_array($parents)) {
| $parents = explode(",", $forum_cache[$fid]['parentlist']); if(is_array($parents)) {
|
Zeile 6245 | Zeile 6273 |
---|
{ $thread_cache[$tid] = $thread; return $thread;
|
{ $thread_cache[$tid] = $thread; return $thread;
|
} else {
| } else {
|
$thread_cache[$tid] = false; return false; }
| $thread_cache[$tid] = false; return false; }
|
Zeile 6256 | Zeile 6284 |
---|
/** * Get the post of a post id.
|
/** * Get the post of a post id.
|
*
| *
|
* @param int $pid The post id of the post. * @return array|bool The database row of the post. False on failure */
| * @param int $pid The post id of the post. * @return array|bool The database row of the post. False on failure */
|
Zeile 6265 | Zeile 6293 |
---|
global $db; static $post_cache;
|
global $db; static $post_cache;
|
$pid = (int)$pid;
| $pid = (int)$pid;
|
if(isset($post_cache[$pid])) { return $post_cache[$pid];
| if(isset($post_cache[$pid])) { return $post_cache[$pid];
|
Zeile 6316 | Zeile 6344 |
---|
{ $inactive[] = $fid1; }
|
{ $inactive[] = $fid1; }
|
} } }
| } } }
|
$inactiveforums = implode(",", $inactive);
|
$inactiveforums = implode(",", $inactive);
|
|
|
return $inactiveforums; }
/** * Checks to make sure a user has not tried to login more times than permitted
|
return $inactiveforums; }
/** * Checks to make sure a user has not tried to login more times than permitted
|
*
| *
|
* @param bool $fatal (Optional) Stop execution if it finds an error with the login. Default is True * @return bool|int Number of logins when success, false if failed.
|
* @param bool $fatal (Optional) Stop execution if it finds an error with the login. Default is True * @return bool|int Number of logins when success, false if failed.
|
*/ function login_attempt_check($fatal = true) { global $mybb, $lang, $session, $db;
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.
// Use cookie if possible, otherwise use session // Find better solution to prevent clearing cookies $loginattempts = 0; $failedlogin = 0;
if(!empty($mybb->cookies['loginattempts']))
| */ function login_attempt_check($uid = 0, $fatal = true) { global $mybb, $lang, $db;
$attempts = array(); $uid = (int)$uid; $now = TIME_NOW;
// Get this user's login attempts and eventual lockout, if a uid is provided if($uid > 0)
|
{
|
{
|
$loginattempts = $mybb->cookies['loginattempts'];
| $query = $db->simple_select("users", "loginattempts, loginlockoutexpiry", "uid='{$uid}'", 1); $attempts = $db->fetch_array($query);
if($attempts['loginattempts'] <= 0) { return 0; } } // This user has a cookie lockout, show waiting time elseif($mybb->cookies['lockoutexpiry'] && $mybb->cookies['lockoutexpiry'] > $now) { if($fatal) { $secsleft = (int)($mybb->cookies['lockoutexpiry'] - $now); $hoursleft = floor($secsleft / 3600); $minsleft = floor(($secsleft / 60) % 60); $secsleft = floor($secsleft % 60);
error($lang->sprintf($lang->failed_login_wait, $hoursleft, $minsleft, $secsleft)); }
return false;
|
}
|
}
|
if(!empty($mybb->cookies['failedlogin']))
| if($mybb->settings['failedlogincount'] > 0 && $attempts['loginattempts'] >= $mybb->settings['failedlogincount'])
|
{
|
{
|
$failedlogin = $mybb->cookies['failedlogin']; }
// Work out if the user has had more than the allowed number of login attempts if($loginattempts > $mybb->settings['failedlogincount']) { // If so, then we need to work out if they can try to login again // Some maths to work out how long they have left and display it to them $now = TIME_NOW;
if(empty($mybb->cookies['failedlogin'])) { $failedtime = $now; }
| // Set the expiry dateline if not set yet if($attempts['loginlockoutexpiry'] == 0) { $attempts['loginlockoutexpiry'] = $now + ((int)$mybb->settings['failedlogintime'] * 60);
// Add a cookie lockout. This is used to prevent access to the login page immediately. // A deep lockout is issued if he tries to login into a locked out account my_setcookie('lockoutexpiry', $attempts['loginlockoutexpiry']);
$db->update_query("users", array( "loginlockoutexpiry" => $attempts['loginlockoutexpiry'] ), "uid='{$uid}'"); }
if(empty($mybb->cookies['lockoutexpiry'])) { $failedtime = $attempts['loginlockoutexpiry']; }
|
else {
|
else {
|
$failedtime = $mybb->cookies['failedlogin'];
| $failedtime = $mybb->cookies['lockoutexpiry'];
|
}
|
}
|
$secondsleft = $mybb->settings['failedlogintime'] * 60 + $failedtime - $now; $hoursleft = floor($secondsleft / 3600); $minsleft = floor(($secondsleft / 60) % 60); $secsleft = floor($secondsleft % 60);
// This value will be empty the first time the user doesn't login in, set it if(empty($failedlogin)) { my_setcookie('failedlogin', $now);
| // Are we still locked out? if($attempts['loginlockoutexpiry'] > $now) {
|
if($fatal) {
|
if($fatal) {
|
| $secsleft = (int)($attempts['loginlockoutexpiry'] - $now); $hoursleft = floor($secsleft / 3600); $minsleft = floor(($secsleft / 60) % 60); $secsleft = floor($secsleft % 60);
|
error($lang->sprintf($lang->failed_login_wait, $hoursleft, $minsleft, $secsleft)); }
|
error($lang->sprintf($lang->failed_login_wait, $hoursleft, $minsleft, $secsleft)); }
|
|
|
return false; }
|
return false; }
|
| // Unlock if enough time has passed else {
|
|
|
// Work out if the user has waited long enough before letting them login again if($mybb->cookies['failedlogin'] < ($now - $mybb->settings['failedlogintime'] * 60)) { my_setcookie('loginattempts', 1); my_unsetcookie('failedlogin'); if($mybb->user['uid'] != 0)
| if($uid > 0)
|
{
|
{
|
$update_array = array( 'loginattempts' => 1 ); $db->update_query("users", $update_array, "uid = '{$mybb->user['uid']}'");
| $db->update_query("users", array( "loginattempts" => 0, "loginlockoutexpiry" => 0 ), "uid='{$uid}'");
|
}
|
}
|
return 1; } // Not waited long enough else if($mybb->cookies['failedlogin'] > ($now - $mybb->settings['failedlogintime'] * 60)) { if($fatal) { error($lang->sprintf($lang->failed_login_wait, $hoursleft, $minsleft, $secsleft)); }
return false;
| // Wipe the cookie, no matter if a guest or a member my_unsetcookie('lockoutexpiry');
return 0;
|
} }
// User can attempt another login
|
} }
// User can attempt another login
|
return $loginattempts;
| return $attempts['loginattempts'];
|
}
/**
| }
/**
|
Zeile 6427 | Zeile 6464 |
---|
*/ function validate_email_format($email) {
|
*/ function validate_email_format($email) {
|
if(strpos($email, ' ') !== false) { return false; } // Valid local characters for email addresses: http://www.remote.org/jochen/mail/info/chars.html return preg_match("/^[a-zA-Z0-9&*+\-_.{}~^\?=\/]+@[a-zA-Z0-9-]+\.([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]{2,}$/si", $email);
| return filter_var($email, FILTER_VALIDATE_EMAIL) !== false;
|
}
/**
| }
/**
|
Zeile 7842 | Zeile 7874 |
---|
static $time_start;
$time = microtime(true);
|
static $time_start;
$time = microtime(true);
|
| |
// Just starting timer, init and return if(!$time_start)
| // Just starting timer, init and return if(!$time_start)
|
Zeile 7913 | Zeile 7944 |
---|
{ $filename = $path."/".$file; $handle = fopen($filename, "rb");
|
{ $filename = $path."/".$file; $handle = fopen($filename, "rb");
|
$contents = '';
| $hashingContext = hash_init('sha512');
|
while(!feof($handle)) {
|
while(!feof($handle)) {
|
$contents .= fread($handle, 8192);
| hash_update($hashingContext, fread($handle, 8192));
|
} fclose($handle);
|
} fclose($handle);
|
$md5 = md5($contents);
| $checksum = hash_final($hashingContext);
|
// Does it match any of our hashes (unix/windows new lines taken into consideration with the hashes)
|
// Does it match any of our hashes (unix/windows new lines taken into consideration with the hashes)
|
if(!in_array($md5, $checksums[$file_path]))
| if(!in_array($checksum, $checksums[$file_path]))
|
{ $bad_verify_files[] = array("status" => "changed", "path" => $file_path); }
| { $bad_verify_files[] = array("status" => "changed", "path" => $file_path); }
|
Zeile 8289 | Zeile 8320 |
---|
$ord = ord($string[$i]); if(array_key_exists($ord, $array))
|
$ord = ord($string[$i]); if(array_key_exists($ord, $array))
|
{
| {
|
$level = $array[$ord]; ++$n; if(is_array($level))
| $level = $array[$ord]; ++$n; if(is_array($level))
|
Zeile 8317 | Zeile 8348 |
---|
return $gd_version; } if(!extension_loaded('gd'))
|
return $gd_version; } if(!extension_loaded('gd'))
|
{
| {
|
return; }
| return; }
|
Zeile 8400 | Zeile 8431 |
---|
$valid = true; $multibytes = $input[$i]; while($bytes > 1)
|
$valid = true; $multibytes = $input[$i]; while($bytes > 1)
|
{
| {
|
$i++; $b = ord($input[$i]); if($b < 128 || $b > 191)
| $i++; $b = ord($input[$i]); if($b < 128 || $b > 191)
|
Zeile 8572 | Zeile 8603 |
---|
}
$pm['options'] = array(
|
}
$pm['options'] = array(
|
"signature" => 0,
| |
"disablesmilies" => 0, "savecopy" => 0, "readreceipt" => 0
| "disablesmilies" => 0, "savecopy" => 0, "readreceipt" => 0
|
Zeile 8734 | Zeile 8764 |
---|
/** * Strip html tags from string, also removes <script> and <style> contents. *
|
/** * Strip html tags from string, also removes <script> and <style> contents. *
|
| * @deprecated
|
* @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 *
|