Zeile 322 | Zeile 322 |
---|
/** * Turn a unix timestamp in to a "friendly" date/time format for the user. *
|
/** * Turn a unix timestamp in to a "friendly" date/time format for the user. *
|
* @param string $format A date format according to PHP's date structure.
| * @param string $format A date format (either relative, normal or PHP's date() structure).
|
* @param int $stamp The unix timestamp the date should be generated for. * @param int|string $offset The offset in hours that should be applied to times. (timezones) Or an empty string to determine that automatically * @param int $ty Whether or not to use today/yesterday formatting.
| * @param int $stamp The unix timestamp the date should be generated for. * @param int|string $offset The offset in hours that should be applied to times. (timezones) Or an empty string to determine that automatically * @param int $ty Whether or not to use today/yesterday formatting.
|
Zeile 380 | Zeile 380 |
---|
}
$todaysdate = $yesterdaysdate = '';
|
}
$todaysdate = $yesterdaysdate = '';
|
if($ty && ($format == $mybb->settings['dateformat'] || $format == 'relative'))
| if($ty && ($format == $mybb->settings['dateformat'] || $format == 'relative' || $format == 'normal'))
|
{ $_stamp = TIME_NOW; if($adodb == true)
| { $_stamp = TIME_NOW; if($adodb == true)
|
Zeile 470 | Zeile 470 |
---|
{ if($todaysdate == $date) {
|
{ if($todaysdate == $date) {
|
$date = $lang->sprintf($lang->today, $real_date);
| $date = $lang->sprintf($lang->today_rel, $real_date);
|
} else if($yesterdaysdate == $date) {
|
} else if($yesterdaysdate == $date) {
|
$date = $lang->sprintf($lang->yesterday, $real_date);
| $date = $lang->sprintf($lang->yesterday_rel, $real_date);
|
} }
| } }
|
Zeile 487 | Zeile 487 |
---|
{ $date .= gmdate($mybb->settings['timeformat'], $stamp + ($offset * 3600)); }
|
{ $date .= gmdate($mybb->settings['timeformat'], $stamp + ($offset * 3600)); }
|
| } } elseif($format == 'normal') { // Normal format both date and time if($ty != 2) { if($todaysdate == $date) { $date = $lang->today; } else if($yesterdaysdate == $date) { $date = $lang->yesterday; } }
$date .= $mybb->settings['datetimesep']; if($adodb == true) { $date .= adodb_date($mybb->settings['timeformat'], $stamp + ($offset * 3600)); } else { $date .= gmdate($mybb->settings['timeformat'], $stamp + ($offset * 3600));
|
} } else
| } } else
|
Zeile 495 | Zeile 520 |
---|
{ if($todaysdate == $date) {
|
{ if($todaysdate == $date) {
|
$date = $lang->sprintf($lang->today, $real_date);
| $date = $lang->today;
|
} else if($yesterdaysdate == $date) {
|
} else if($yesterdaysdate == $date) {
|
$date = $lang->sprintf($lang->yesterday, $real_date);
| $date = $lang->yesterday;
|
} } else
| } } else
|
Zeile 521 | Zeile 546 |
---|
}
return $date;
|
}
return $date;
|
}
| }
|
/** * Sends an email using PHP's mail function, formatting it appropriately. *
| /** * Sends an email using PHP's mail function, formatting it appropriately. *
|
Zeile 585 | Zeile 610 |
---|
/** * Generates a unique code for POST requests to prevent XSS/CSRF attacks
|
/** * Generates a unique code for POST requests to prevent XSS/CSRF attacks
|
*
| *
|
* @return string The generated code */ function generate_post_check()
| * @return string The generated code */ function generate_post_check()
|
Zeile 615 | Zeile 640 |
---|
if(generate_post_check() !== $code) { if($silent == true)
|
if(generate_post_check() !== $code) { if($silent == true)
|
{ return false;
| { return false;
|
} else { if(defined("IN_ADMINCP"))
|
} else { if(defined("IN_ADMINCP"))
|
{
| {
|
return false;
|
return false;
|
}
| }
|
else { error($lang->invalid_post_code);
|
else { error($lang->invalid_post_code);
|
} } } else
| } } } else
|
{ return true; }
| { return true; }
|
Zeile 646 | Zeile 671 |
---|
{ global $forum_cache; static $forumarraycache;
|
{ global $forum_cache; static $forumarraycache;
|
|
|
if($forumarraycache[$fid]) { return $forumarraycache[$fid]['parentlist'];
|
if($forumarraycache[$fid]) { return $forumarraycache[$fid]['parentlist'];
|
}
| }
|
elseif($forum_cache[$fid])
|
elseif($forum_cache[$fid])
|
{ return $forum_cache[$fid]['parentlist']; }
| { return $forum_cache[$fid]['parentlist']; }
|
else { cache_forums(); return $forum_cache[$fid]['parentlist'];
|
else { cache_forums(); return $forum_cache[$fid]['parentlist'];
|
} }
| } }
|
/** * Build a parent list of a specific forum, suitable for querying *
| /** * Build a parent list of a specific forum, suitable for querying *
|
Zeile 676 | Zeile 701 |
---|
if(!$parentlist) { $parentlist = get_parent_list($fid);
|
if(!$parentlist) { $parentlist = get_parent_list($fid);
|
}
| }
|
$parentsexploded = explode(",", $parentlist); $builtlist = "("; $sep = '';
|
$parentsexploded = explode(",", $parentlist); $builtlist = "("; $sep = '';
|
|
|
foreach($parentsexploded as $key => $val) { $builtlist .= "$sep$column='$val'"; $sep = " $joiner "; }
|
foreach($parentsexploded as $key => $val) { $builtlist .= "$sep$column='$val'"; $sep = " $joiner "; }
|
$builtlist .= ")";
| $builtlist .= ")";
|
return $builtlist;
|
return $builtlist;
|
}
/**
| }
/**
|
* Load the forum cache in to memory * * @param boolean $force True to force a reload of the cache
| * Load the forum cache in to memory * * @param boolean $force True to force a reload of the cache
|
Zeile 707 | Zeile 732 |
---|
{ $forum_cache = $cache->read("forums", 1); return $forum_cache;
|
{ $forum_cache = $cache->read("forums", 1); return $forum_cache;
|
}
| }
|
if(!$forum_cache) { $forum_cache = $cache->read("forums");
| if(!$forum_cache) { $forum_cache = $cache->read("forums");
|
Zeile 740 | Zeile 765 |
---|
if($forum['active'] != 0) { $forums_by_parent[$forum['pid']][$forum['fid']] = $forum;
|
if($forum['active'] != 0) { $forums_by_parent[$forum['pid']][$forum['fid']] = $forum;
|
} } }
| } } }
|
if(!is_array($forums_by_parent[$fid])) { return $forums;
| if(!is_array($forums_by_parent[$fid])) { return $forums;
|
Zeile 991 | Zeile 1016 |
---|
}
exit;
|
}
exit;
|
}
/**
| }
/**
|
* Generate a listing of page - pagination * * @param int $count The number of items
| * Generate a listing of page - pagination * * @param int $count The number of items
|
Zeile 1006 | Zeile 1031 |
---|
function multipage($count, $perpage, $page, $url, $breadcrumb=false) { global $theme, $templates, $lang, $mybb;
|
function multipage($count, $perpage, $page, $url, $breadcrumb=false) { global $theme, $templates, $lang, $mybb;
|
|
|
if($count <= $perpage) { return ''; }
|
if($count <= $perpage) { return ''; }
|
| $page = (int)$page;
|
$url = str_replace("&", "&", $url); $url = htmlspecialchars_uni($url);
| $url = str_replace("&", "&", $url); $url = htmlspecialchars_uni($url);
|
Zeile 1116 | Zeile 1143 |
---|
eval("\$jumptopage = \"".$templates->get("multipage_jump_page")."\";"); }
|
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) {
|
Zeile 1193 | Zeile 1220 |
---|
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 1495 | Zeile 1522 |
---|
{ $forum_cache = cache_forums(); if(!$forum_cache)
|
{ $forum_cache = cache_forums(); if(!$forum_cache)
|
{ return false; } }
| { return false; } }
|
// Loop through each of parent forums to ensure we have a password for them too if(isset($forum_cache[$fid]['parentlist']))
|
// Loop through each of parent forums to ensure we have a password for them too if(isset($forum_cache[$fid]['parentlist']))
|
{
| {
|
$parents = explode(',', $forum_cache[$fid]['parentlist']); rsort($parents); }
| $parents = explode(',', $forum_cache[$fid]['parentlist']); rsort($parents); }
|
Zeile 1513 | Zeile 1540 |
---|
if($parent_id == $fid || $parent_id == $pid) { continue;
|
if($parent_id == $fid || $parent_id == $pid) { continue;
|
}
| }
|
if($forum_cache[$parent_id]['password'] != "") { check_forum_password($parent_id, $fid);
| if($forum_cache[$parent_id]['password'] != "") { check_forum_password($parent_id, $fid);
|
Zeile 1558 | Zeile 1585 |
---|
if($return) { return $showform;
|
if($return) { return $showform;
|
}
| }
|
if($showform) { if($pid)
| if($showform) { if($pid)
|
Zeile 1620 | Zeile 1647 |
---|
$extra_groups = explode(",", $user['additionalgroups']);
foreach($extra_groups as $extra_group)
|
$extra_groups = explode(",", $user['additionalgroups']);
foreach($extra_groups as $extra_group)
|
{
| {
|
$groups[] = $extra_group; } }
| $groups[] = $extra_group; } }
|
Zeile 1665 | Zeile 1692 |
---|
{ // There are no permissions set for this group continue;
|
{ // There are no permissions set for this group continue;
|
}
| }
|
$perm = $forum['usergroups'][$group]; foreach($perm as $action => $value) {
| $perm = $forum['usergroups'][$group]; foreach($perm as $action => $value) {
|
Zeile 1674 | Zeile 1701 |
---|
{ continue; }
|
{ continue; }
|
|
|
$perms[$action] = max($perm[$action], $perms[$action]);
|
$perms[$action] = max($perm[$action], $perms[$action]);
|
} } }
$modpermscache[$fid][$uid] = $perms;
| } } }
$modpermscache[$fid][$uid] = $perms;
|
return $perms; }
| return $perms; }
|
Zeile 1696 | Zeile 1723 |
---|
function is_moderator($fid=0, $action="", $uid=0) { global $mybb, $cache;
|
function is_moderator($fid=0, $action="", $uid=0) { global $mybb, $cache;
|
if($uid == 0) {
| if($uid == 0) {
|
$uid = $mybb->user['uid'];
|
$uid = $mybb->user['uid'];
|
}
| }
|
if($uid == 0) {
| if($uid == 0) {
|
Zeile 1711 | Zeile 1738 |
---|
if($user_perms['issupermod'] == 1) { if($fid)
|
if($user_perms['issupermod'] == 1) { if($fid)
|
{
| {
|
$forumpermissions = forum_permissions($fid); if($forumpermissions['canview'] && $forumpermissions['canviewthreads'] && !$forumpermissions['canonlyviewownthreads']) {
| $forumpermissions = forum_permissions($fid); if($forumpermissions['canview'] && $forumpermissions['canviewthreads'] && !$forumpermissions['canonlyviewownthreads']) {
|
Zeile 1742 | Zeile 1769 |
---|
if(trim($group) != '' && isset($modusers['usergroups'][$group]) && (!$action || !empty($modusers['usergroups'][$group][$action]))) { return true;
|
if(trim($group) != '' && isset($modusers['usergroups'][$group]) && (!$action || !empty($modusers['usergroups'][$group][$action]))) { return true;
|
} } } }
| } } } }
|
return false; } else
| return false; } else
|
Zeile 1753 | Zeile 1780 |
---|
$modperms = get_moderator_permissions($fid, $uid);
if(!$action && $modperms)
|
$modperms = get_moderator_permissions($fid, $uid);
if(!$action && $modperms)
|
{
| {
|
return true; } else
| return true; } else
|
Zeile 1761 | Zeile 1788 |
---|
if(isset($modperms[$action]) && $modperms[$action] == 1) { return true;
|
if(isset($modperms[$action]) && $modperms[$action] == 1) { return true;
|
}
| }
|
else { return false;
| else { return false;
|
Zeile 1777 | Zeile 1804 |
---|
* @return string The template of posticons. */ function get_post_icons()
|
* @return string The template of posticons. */ function get_post_icons()
|
{
| {
|
global $mybb, $cache, $icon, $theme, $templates, $lang;
if(isset($mybb->input['icon']))
| global $mybb, $cache, $icon, $theme, $templates, $lang;
if(isset($mybb->input['icon']))
|
Zeile 1788 | 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[$posticon['name']] = $posticon;
|
$posticons = array(); foreach($posticons_cache as $posticon) { $posticons[$posticon['name']] = $posticon;
|
}
| }
|
krsort($posticons);
foreach($posticons as $dbicon)
| krsort($posticons);
foreach($posticons as $dbicon)
|
Zeile 1834 | 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 1872 | Zeile 1900 |
---|
if(!empty($mybb->settings['cookiepath'])) { $cookie .= "; path={$mybb->settings['cookiepath']}";
|
if(!empty($mybb->settings['cookiepath'])) { $cookie .= "; path={$mybb->settings['cookiepath']}";
|
}
| }
|
if(!empty($mybb->settings['cookiedomain']))
|
if(!empty($mybb->settings['cookiedomain']))
|
{
| {
|
$cookie .= "; domain={$mybb->settings['cookiedomain']}";
|
$cookie .= "; domain={$mybb->settings['cookiedomain']}";
|
}
| }
|
if($httponly == true)
|
if($httponly == true)
|
{
| {
|
$cookie .= "; HttpOnly";
|
$cookie .= "; HttpOnly";
|
| }
if($samesite != "" && $mybb->settings['cookiesamesiteflag']) { $samesite = strtolower($samesite);
if($samesite == "lax" || $samesite == "strict") { $cookie .= "; SameSite=".$samesite; }
|
}
if($mybb->settings['cookiesecureflag'])
| }
if($mybb->settings['cookiesecureflag'])
|
Zeile 1900 | Zeile 1938 |
---|
* @param string $name The cookie identifier. */ function my_unsetcookie($name)
|
* @param string $name The cookie identifier. */ function my_unsetcookie($name)
|
{ global $mybb;
| { global $mybb;
|
$expires = -3600; my_setcookie($name, "", $expires);
|
$expires = -3600; my_setcookie($name, "", $expires);
|
|
|
unset($mybb->cookies[$name]); }
| unset($mybb->cookies[$name]); }
|
Zeile 1915 | Zeile 1953 |
---|
* @param string $name The cookie identifier. * @param int $id The cookie content id. * @return array|boolean The cookie id's content array or false when non-existent.
|
* @param string $name The cookie identifier. * @param int $id The cookie content id. * @return array|boolean The cookie id's content array or false when non-existent.
|
*/
| */
|
function my_get_array_cookie($name, $id) { global $mybb;
|
function my_get_array_cookie($name, $id) { global $mybb;
|
|
|
if(!isset($mybb->cookies['mybb'][$name]))
|
if(!isset($mybb->cookies['mybb'][$name]))
|
{ return false; }
$cookie = my_unserialize($mybb->cookies['mybb'][$name]);
if(is_array($cookie) && isset($cookie[$id])) { return $cookie[$id]; }
| { return false; }
$cookie = my_unserialize($mybb->cookies['mybb'][$name]);
if(is_array($cookie) && isset($cookie[$id])) { return $cookie[$id]; }
|
else { return 0;
| else { return 0;
|
Zeile 1989 | Zeile 2027 |
---|
if(strlen($str) > MAX_SERIALIZED_INPUT_LENGTH) { // input exceeds MAX_SERIALIZED_INPUT_LENGTH
|
if(strlen($str) > MAX_SERIALIZED_INPUT_LENGTH) { // input exceeds MAX_SERIALIZED_INPUT_LENGTH
|
return false; }
| return false; }
|
if(empty($str) || !is_string($str)) { return false;
| if(empty($str) || !is_string($str)) { return false;
|
Zeile 2115 | Zeile 2153 |
---|
$key = $value; $state = 3;
|
$key = $value; $state = 3;
|
break; }
| break; }
|
// illegal array index type return false;
| // illegal array index type return false;
|
Zeile 2492 | Zeile 2530 |
---|
// Fetch above counters for this forum $query = $db->simple_select("forums", implode(",", $counters), "fid='{$fid}'"); $forum = $db->fetch_array($query);
|
// Fetch above counters for this forum $query = $db->simple_select("forums", implode(",", $counters), "fid='{$fid}'"); $forum = $db->fetch_array($query);
|
foreach($counters as $counter) { if(array_key_exists($counter, $changes)) { if(substr($changes[$counter], 0, 2) == "+-") { $changes[$counter] = substr($changes[$counter], 1); } // Adding or subtracting from previous value? if(substr($changes[$counter], 0, 1) == "+" || substr($changes[$counter], 0, 1) == "-") { if((int)$changes[$counter] != 0)
| foreach($counters as $counter) { if(array_key_exists($counter, $changes)) { if(substr($changes[$counter], 0, 2) == "+-") { $changes[$counter] = substr($changes[$counter], 1); } // Adding or subtracting from previous value? if(substr($changes[$counter], 0, 1) == "+" || substr($changes[$counter], 0, 1) == "-") { if((int)$changes[$counter] != 0)
|
{ $update_query[$counter] = $forum[$counter] + $changes[$counter]; }
| { $update_query[$counter] = $forum[$counter] + $changes[$counter]; }
|
Zeile 2703 | Zeile 2741 |
---|
/** * Update the first post and lastpost data for a specific thread
|
/** * Update the first post and lastpost data for a specific thread
|
* * @param int $tid The thread ID */
| * * @param int $tid The thread ID */
|
function update_thread_data($tid) { global $db;
| function update_thread_data($tid) { global $db;
|
Zeile 2838 | Zeile 2876 |
---|
* @return bool */ function delete_thread($tid)
|
* @return bool */ function delete_thread($tid)
|
{
| {
|
global $moderation;
if(!is_object($moderation))
| global $moderation;
if(!is_object($moderation))
|
Zeile 2855 | Zeile 2893 |
---|
* * @param int $pid The thread ID * @return bool
|
* * @param int $pid The thread ID * @return bool
|
*/
| */
|
function delete_post($pid) { global $moderation;
| function delete_post($pid) { global $moderation;
|
Zeile 2864 | Zeile 2902 |
---|
{ require_once MYBB_ROOT."inc/class_moderation.php"; $moderation = new Moderation;
|
{ require_once MYBB_ROOT."inc/class_moderation.php"; $moderation = new Moderation;
|
}
| }
|
return $moderation->delete_post($pid); }
| return $moderation->delete_post($pid); }
|
Zeile 2905 | Zeile 2943 |
---|
}
if(!is_array($permissioncache))
|
}
if(!is_array($permissioncache))
|
{
| {
|
$permissioncache = forum_permissions(); }
| $permissioncache = forum_permissions(); }
|
Zeile 3025 | 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 3795 | Zeile 3849 |
---|
{ $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 3813 | Zeile 3874 |
---|
"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 4069 | Zeile 4146 |
---|
$attach_icons_schemes[$ext] = $attachtypes[$ext]['icon']; } elseif(defined("IN_ADMINCP"))
|
$attach_icons_schemes[$ext] = $attachtypes[$ext]['icon']; } elseif(defined("IN_ADMINCP"))
|
{
| {
|
$attach_icons_schemes[$ext] = str_replace("{theme}", "", $attachtypes[$ext]['icon']); if(my_substr($attach_icons_schemes[$ext], 0, 1) != "/") {
| $attach_icons_schemes[$ext] = str_replace("{theme}", "", $attachtypes[$ext]['icon']); if(my_substr($attach_icons_schemes[$ext], 0, 1) != "/") {
|
Zeile 4433 | Zeile 4510 |
---|
$call_time = format_time_duration($cache->call_time);
|
$call_time = format_time_duration($cache->call_time);
|
$phpversion = PHP_VERSION;
| $phpversion = PHP_VERSION;
|
$serverload = get_server_load();
if($mybb->settings['gzipoutput'] != 0)
|
$serverload = get_server_load();
if($mybb->settings['gzipoutput'] != 0)
|
{
| {
|
$gzipen = "Enabled"; } else { $gzipen = "Disabled";
|
$gzipen = "Enabled"; } else { $gzipen = "Disabled";
|
}
| }
|
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"; echo "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">";
| echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"; echo "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">";
|
Zeile 4465 | Zeile 4542 |
---|
echo "<td bgcolor=\"#fefefe\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">$totaltime</span></td>\n"; echo "<td bgcolor=\"#efefef\" width=\"25%\"><b><span style=\"font-family: tahoma; font-size: 12px;\">No. DB Queries:</span></b></td>\n"; echo "<td bgcolor=\"#fefefe\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">$db->query_count</span></td>\n";
|
echo "<td bgcolor=\"#fefefe\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">$totaltime</span></td>\n"; echo "<td bgcolor=\"#efefef\" width=\"25%\"><b><span style=\"font-family: tahoma; font-size: 12px;\">No. DB Queries:</span></b></td>\n"; echo "<td bgcolor=\"#fefefe\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">$db->query_count</span></td>\n";
|
echo "</tr>\n"; echo "<tr>\n";
| echo "</tr>\n"; echo "<tr>\n";
|
echo "<td bgcolor=\"#efefef\" width=\"25%\"><b><span style=\"font-family: tahoma; font-size: 12px;\">PHP Processing Time:</span></b></td>\n"; echo "<td bgcolor=\"#fefefe\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">$phptime ($percentphp%)</span></td>\n"; echo "<td bgcolor=\"#efefef\" width=\"25%\"><b><span style=\"font-family: tahoma; font-size: 12px;\">DB Processing Time:</span></b></td>\n";
| echo "<td bgcolor=\"#efefef\" width=\"25%\"><b><span style=\"font-family: tahoma; font-size: 12px;\">PHP Processing Time:</span></b></td>\n"; echo "<td bgcolor=\"#fefefe\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">$phptime ($percentphp%)</span></td>\n"; echo "<td bgcolor=\"#efefef\" width=\"25%\"><b><span style=\"font-family: tahoma; font-size: 12px;\">DB Processing Time:</span></b></td>\n";
|
Zeile 4477 | Zeile 4554 |
---|
echo "<td bgcolor=\"#fefefe\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">{$mybb->config['database']['type']}, xml</span></td>\n"; echo "<td bgcolor=\"#efefef\" width=\"25%\"><b><span style=\"font-family: tahoma; font-size: 12px;\">Global.php Processing Time:</span></b></td>\n"; echo "<td bgcolor=\"#fefefe\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">$globaltime</span></td>\n";
|
echo "<td bgcolor=\"#fefefe\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">{$mybb->config['database']['type']}, xml</span></td>\n"; echo "<td bgcolor=\"#efefef\" width=\"25%\"><b><span style=\"font-family: tahoma; font-size: 12px;\">Global.php Processing Time:</span></b></td>\n"; echo "<td bgcolor=\"#fefefe\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">$globaltime</span></td>\n";
|
echo "</tr>\n";
| echo "</tr>\n";
|
echo "<tr>\n"; echo "<td bgcolor=\"#efefef\" width=\"25%\"><b><span style=\"font-family: tahoma; font-size: 12px;\">PHP Version:</span></b></td>\n"; echo "<td bgcolor=\"#fefefe\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">$phpversion</span></td>\n";
| echo "<tr>\n"; echo "<td bgcolor=\"#efefef\" width=\"25%\"><b><span style=\"font-family: tahoma; font-size: 12px;\">PHP Version:</span></b></td>\n"; echo "<td bgcolor=\"#fefefe\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">$phpversion</span></td>\n";
|
Zeile 4489 | Zeile 4566 |
---|
echo "<td bgcolor=\"#fefefe\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">$gzipen</span></td>\n"; echo "<td bgcolor=\"#efefef\" width=\"25%\"><b><span style=\"font-family: tahoma; font-size: 12px;\">No. Templates Used:</span></b></td>\n"; echo "<td bgcolor=\"#fefefe\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">".count($templates->cache)." (".(int)count(explode(",", $templatelist))." Cached / ".(int)count($templates->uncached_templates)." Manually Loaded)</span></td>\n";
|
echo "<td bgcolor=\"#fefefe\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">$gzipen</span></td>\n"; echo "<td bgcolor=\"#efefef\" width=\"25%\"><b><span style=\"font-family: tahoma; font-size: 12px;\">No. Templates Used:</span></b></td>\n"; echo "<td bgcolor=\"#fefefe\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">".count($templates->cache)." (".(int)count(explode(",", $templatelist))." Cached / ".(int)count($templates->uncached_templates)." Manually Loaded)</span></td>\n";
|
echo "</tr>\n";
| echo "</tr>\n";
|
$memory_usage = get_memory_usage(); if(!$memory_usage)
| $memory_usage = get_memory_usage(); if(!$memory_usage)
|
Zeile 4522 | Zeile 4599 |
---|
echo $db->explain;
if($cache->call_count > 0)
|
echo $db->explain;
if($cache->call_count > 0)
|
{
| {
|
echo "<h2>Cache Calls (".$cache->call_count." Total, ".$call_time.") </h2>\n"; echo $cache->cache_debug; }
| echo "<h2>Cache Calls (".$cache->call_count." Total, ".$call_time.") </h2>\n"; echo $cache->cache_debug; }
|
Zeile 4689 | Zeile 4766 |
---|
$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 4846 | Zeile 4967 |
---|
/** * Remove a user from a specific additional user group
|
/** * Remove a user from a specific additional user group
|
*
| *
|
* @param int $uid The user ID * @param int $leavegroup The user group ID */ function leave_usergroup($uid, $leavegroup) { global $db, $mybb, $cache;
|
* @param int $uid The user ID * @param int $leavegroup The user group ID */ function leave_usergroup($uid, $leavegroup) { global $db, $mybb, $cache;
|
|
|
$user = get_user($uid);
$groupslist = $comma = ''; $usergroups = $user['additionalgroups'].","; $donegroup = array();
|
$user = get_user($uid);
$groupslist = $comma = ''; $usergroups = $user['additionalgroups'].","; $donegroup = array();
|
|
|
$groups = explode(",", $user['additionalgroups']);
if(is_array($groups))
| $groups = explode(",", $user['additionalgroups']);
if(is_array($groups))
|
Zeile 4872 | Zeile 4993 |
---|
$comma = ","; $donegroup[$gid] = 1; }
|
$comma = ","; $donegroup[$gid] = 1; }
|
}
| }
|
}
$dispupdate = "";
| }
$dispupdate = "";
|
Zeile 4910 | Zeile 5031 |
---|
$location = htmlspecialchars_uni($_SERVER['SCRIPT_NAME']); } elseif(!empty($_SERVER['PHP_SELF']))
|
$location = htmlspecialchars_uni($_SERVER['SCRIPT_NAME']); } elseif(!empty($_SERVER['PHP_SELF']))
|
{
| {
|
$location = htmlspecialchars_uni($_SERVER['PHP_SELF']); } elseif(!empty($_ENV['PHP_SELF']))
| $location = htmlspecialchars_uni($_SERVER['PHP_SELF']); } elseif(!empty($_ENV['PHP_SELF']))
|
Zeile 4936 | Zeile 5057 |
---|
global $mybb;
if(!is_array($ignore))
|
global $mybb;
if(!is_array($ignore))
|
{
| {
|
$ignore = array($ignore); }
| $ignore = array($ignore); }
|
Zeile 4948 | Zeile 5069 |
---|
if(in_array($name, $ignore) || is_array($name) || is_array($value)) { continue;
|
if(in_array($name, $ignore) || is_array($name) || is_array($value)) { continue;
|
}
| }
|
$form_html .= "<input type=\"hidden\" name=\"".htmlspecialchars_uni($name)."\" value=\"".htmlspecialchars_uni($value)."\" />\n"; }
| $form_html .= "<input type=\"hidden\" name=\"".htmlspecialchars_uni($name)."\" value=\"".htmlspecialchars_uni($value)."\" />\n"; }
|
Zeile 5153 | Zeile 5274 |
---|
if(is_int($number)) { return number_format($number, 0, $mybb->settings['decpoint'], $mybb->settings['thousandssep']);
|
if(is_int($number)) { return number_format($number, 0, $mybb->settings['decpoint'], $mybb->settings['thousandssep']);
|
}
| }
|
else { $parts = explode('.', $number);
if(isset($parts[1]))
|
else { $parts = explode('.', $number);
if(isset($parts[1]))
|
{
| {
|
$decimals = my_strlen($parts[1]); } else { $decimals = 0;
|
$decimals = my_strlen($parts[1]); } else { $decimals = 0;
|
}
| }
|
return number_format((double)$number, $decimals, $mybb->settings['decpoint'], $mybb->settings['thousandssep']); }
| return number_format((double)$number, $decimals, $mybb->settings['decpoint'], $mybb->settings['thousandssep']); }
|
Zeile 5203 | Zeile 5324 |
---|
if(!isset($use_mb)) { $use_mb = function_exists("mb_convert_encoding");
|
if(!isset($use_mb)) { $use_mb = function_exists("mb_convert_encoding");
|
}
| }
|
if($use_iconv || $use_mb) {
| if($use_iconv || $use_mb) {
|
Zeile 5211 | Zeile 5332 |
---|
{ $from_charset = $lang->settings['charset']; $to_charset = "UTF-8";
|
{ $from_charset = $lang->settings['charset']; $to_charset = "UTF-8";
|
}
| }
|
else { $from_charset = "UTF-8"; $to_charset = $lang->settings['charset'];
|
else { $from_charset = "UTF-8"; $to_charset = $lang->settings['charset'];
|
}
| }
|
if($use_iconv) { return iconv($from_charset, $to_charset."//IGNORE", $str);
| if($use_iconv) { return iconv($from_charset, $to_charset."//IGNORE", $str);
|
Zeile 5241 | Zeile 5362 |
---|
{ return $str; }
|
{ return $str; }
|
}
/**
| }
/**
|
* DEPRECATED! Please use other alternatives. * * @deprecated
| * DEPRECATED! Please use other alternatives. * * @deprecated
|
Zeile 5254 | Zeile 5375 |
---|
function my_wordwrap($message) { return $message;
|
function my_wordwrap($message) { return $message;
|
}
/**
| }
/**
|
* Workaround for date limitation in PHP to establish the day of a birthday (Provided by meme) * * @param int $month The month of the birthday
| * Workaround for date limitation in PHP to establish the day of a birthday (Provided by meme) * * @param int $month The month of the birthday
|
Zeile 5305 | Zeile 5426 |
---|
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,
| 31, 30, 31,
|
30, 31, 31,
| 30, 31, 31,
|
Zeile 5333 | Zeile 5454 |
---|
function format_bdays($display, $bm, $bd, $by, $wd) { global $lang;
|
function format_bdays($display, $bm, $bd, $by, $wd) { global $lang;
|
|
|
$bdays = array( $lang->sunday, $lang->monday,
| $bdays = array( $lang->sunday, $lang->monday,
|
Zeile 5358 | 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 5683 | Zeile 5803 |
---|
function unhtmlentities($string) { // Replace numeric entities
|
function unhtmlentities($string) { // Replace numeric entities
|
$string = preg_replace_callback('~&#x([0-9a-f]+);~i', create_function('$matches', 'return unichr(hexdec($matches[1]));'), $string); $string = preg_replace_callback('~&#([0-9]+);~', create_function('$matches', 'return unichr($matches[1]);'), $string);
| $string = preg_replace_callback('~&#x([0-9a-f]+);~i', 'unichr_callback1', $string); $string = preg_replace_callback('~&#([0-9]+);~', 'unichr_callback2', $string);
|
// Replace literal entities $trans_tbl = get_html_translation_table(HTML_ENTITIES);
| // Replace literal entities $trans_tbl = get_html_translation_table(HTML_ENTITIES);
|
Zeile 5724 | Zeile 5844 |
---|
{ 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 5797 | Zeile 5939 |
---|
if(!$username && $uid == 0) { // Return Guest phrase for no UID, no guest nickname
|
if(!$username && $uid == 0) { // Return Guest phrase for no UID, no guest nickname
|
return $lang->guest;
| return htmlspecialchars_uni($lang->guest);
|
} elseif($uid == 0) {
| } elseif($uid == 0) {
|
Zeile 6036 | Zeile 6178 |
---|
}
switch($options['username_method'])
|
}
switch($options['username_method'])
|
{
| {
|
case 1: $sqlwhere = "{$efield}='{$username}'"; break;
| case 1: $sqlwhere = "{$efield}='{$username}'"; break;
|
Zeile 6059 | Zeile 6201 |
---|
if(isset($options['exists'])) { return (bool)$db->num_rows($query);
|
if(isset($options['exists'])) { return (bool)$db->num_rows($query);
|
}
| }
|
return $db->fetch_array($query); }
| return $db->fetch_array($query); }
|
Zeile 6084 | Zeile 6226 |
---|
if(empty($forum_cache[$fid])) { return false;
|
if(empty($forum_cache[$fid])) { return false;
|
}
| }
|
if($active_override != 1) { $parents = explode(",", $forum_cache[$fid]['parentlist']);
| if($active_override != 1) { $parents = explode(",", $forum_cache[$fid]['parentlist']);
|
Zeile 6135 | Zeile 6277 |
---|
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 6152 | Zeile 6294 |
---|
static $post_cache;
$pid = (int)$pid;
|
static $post_cache;
$pid = (int)$pid;
|
|
|
if(isset($post_cache[$pid])) { return $post_cache[$pid];
| if(isset($post_cache[$pid])) { return $post_cache[$pid];
|
Zeile 6203 | Zeile 6345 |
---|
$inactive[] = $fid1; } }
|
$inactive[] = $fid1; } }
|
} }
| } }
|
$inactiveforums = implode(",", $inactive);
| $inactiveforums = implode(",", $inactive);
|
Zeile 6217 | Zeile 6359 |
---|
* @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)
| function login_attempt_check($uid = 0, $fatal = true)
|
{
|
{
|
global $mybb, $lang, $session, $db;
| global $mybb, $lang, $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']))
| $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']))
| // Set the expiry dateline if not set yet if($attempts['loginlockoutexpiry'] == 0)
|
{
|
{
|
$failedtime = $now;
| $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; } // Unlock if enough time has passed else {
|
|
|
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)) { my_setcookie('loginattempts', 1); my_unsetcookie('failedlogin'); if($mybb->user['uid'] != 0) { $update_array = array( 'loginattempts' => 1 ); $db->update_query("users", $update_array, "uid = '{$mybb->user['uid']}'"); } return 1; } // Not waited long enough else if($mybb->cookies['failedlogin'] > ($now - $mybb->settings['failedlogintime'] * 60)) { if($fatal)
| if($uid > 0)
|
{
|
{
|
error($lang->sprintf($lang->failed_login_wait, $hoursleft, $minsleft, $secsleft));
| $db->update_query("users", array( "loginattempts" => 0, "loginlockoutexpiry" => 0 ), "uid='{$uid}'");
|
}
|
}
|
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 6310 | Zeile 6461 |
---|
* * @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.
|
*/
| */
|
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 6327 | Zeile 6473 |
---|
* @param string $email The email to check. * @param int $uid User ID of the user (updating only) * @return boolean True when in use, false when not.
|
* @param string $email The email to check. * @param int $uid User ID of the user (updating only) * @return boolean True when in use, false when not.
|
*/
| */
|
function email_already_in_use($email, $uid=0) { global $db;
|
function email_already_in_use($email, $uid=0) { global $db;
|
|
|
$uid_string = ""; if($uid) { $uid_string = " AND uid != '".(int)$uid."'"; } $query = $db->simple_select("users", "COUNT(email) as emails", "email = '".$db->escape_string($email)."'{$uid_string}");
|
$uid_string = ""; if($uid) { $uid_string = " AND uid != '".(int)$uid."'"; } $query = $db->simple_select("users", "COUNT(email) as emails", "email = '".$db->escape_string($email)."'{$uid_string}");
|
|
|
if($db->fetch_field($query, "emails") > 0) { return true; }
|
if($db->fetch_field($query, "emails") > 0) { return true; }
|
|
|
return false; }
/** * Rebuilds settings.php
|
return false; }
/** * Rebuilds settings.php
|
*
| *
|
*/ function rebuild_settings() { global $db, $mybb;
|
*/ function rebuild_settings() { 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 6379 | Zeile 6515 |
---|
}
$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 6399 | Zeile 6534 |
---|
if($mybb->settings['minsearchword'] < 1) { $mybb->settings['minsearchword'] = 3;
|
if($mybb->settings['minsearchword'] < 1) { $mybb->settings['minsearchword'] = 3;
|
}
| }
|
if(is_array($terms)) { $terms = implode(' ', $terms);
| if(is_array($terms)) { $terms = implode(' ', $terms);
|
Zeile 6472 | Zeile 6607 |
---|
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 6498 | Zeile 6633 |
---|
}
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);
|
}
/**
| }
/**
|
Zeile 6606 | Zeile 6753 |
---|
{ // Updating last use if($update_lastuse == true)
|
{ // Updating last use if($update_lastuse == true)
|
{
| {
|
$db->update_query("banfilters", array("lastuse" => TIME_NOW), "fid='{$banned_email['fid']}'"); } return true;
| $db->update_query("banfilters", array("lastuse" => TIME_NOW), "fid='{$banned_email['fid']}'"); } return true;
|
Zeile 7727 | 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 7798 | 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 8397 | Zeile 8543 |
---|
}
if(isset($revert))
|
}
if(isset($revert))
|
{
| {
|
// Revert language $lang->set_language($mybb->user['language']); $lang->load($pm['language_file']);
| // Revert language $lang->set_language($mybb->user['language']); $lang->load($pm['language_file']);
|
Zeile 8457 | Zeile 8603 |
---|
}
$pm['options'] = array(
|
}
$pm['options'] = array(
|
"signature" => 0,
| |
"disablesmilies" => 0, "savecopy" => 0, "readreceipt" => 0
| "disablesmilies" => 0, "savecopy" => 0, "readreceipt" => 0
|
Zeile 8618 | Zeile 8763 |
---|
/** * 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
|
*
| *
|
* @return string Striped string */ function my_strip_tags($string, $allowable_tags = '')
| * @return string Striped string */ function my_strip_tags($string, $allowable_tags = '')
|