Zeile 624 | Zeile 624 |
---|
// Guests get a special string else {
|
// Guests get a special string else {
|
return md5($session->useragent.$mybb->config['database']['username'].$mybb->settings['internal']['encryption_key']);
| return md5($session->sid.$mybb->config['database']['username'].$mybb->settings['internal']['encryption_key']);
|
} }
| } }
|
Zeile 3489 | Zeile 3489 |
---|
$subscription_method = (int)$subscription['notification'] + 1; } }
|
$subscription_method = (int)$subscription['notification'] + 1; } }
|
|
|
return $subscription_methods[$subscription_method]; }
| return $subscription_methods[$subscription_method]; }
|
Zeile 3508 | Zeile 3508 |
---|
{ $smilie_cache = $cache->read("smilies"); $smiliecount = count($smilie_cache);
|
{ $smilie_cache = $cache->read("smilies"); $smiliecount = count($smilie_cache);
|
}
| }
|
if(!$smiliecache) { if(!is_array($smilie_cache))
| if(!$smiliecache) { if(!is_array($smilie_cache))
|
Zeile 3520 | Zeile 3520 |
---|
{ $smilie['image'] = str_replace("{theme}", $theme['imgdir'], $smilie['image']); $smiliecache[$smilie['sid']] = $smilie;
|
{ $smilie['image'] = str_replace("{theme}", $theme['imgdir'], $smilie['image']); $smiliecache[$smilie['sid']] = $smilie;
|
}
| }
|
}
unset($smilie);
| }
unset($smilie);
|
Zeile 3572 | Zeile 3572 |
---|
eval("\$smilies .= \"".$templates->get("smilieinsert_row")."\";"); $smilie_icons = ''; }
|
eval("\$smilies .= \"".$templates->get("smilieinsert_row")."\";"); $smilie_icons = ''; }
|
} }
| } }
|
if($counter != 0) { $colspan = $mybb->settings['smilieinsertercols'] - $counter;
| if($counter != 0) { $colspan = $mybb->settings['smilieinsertercols'] - $counter;
|
Zeile 3594 | Zeile 3594 |
---|
}
return $clickablesmilies;
|
}
return $clickablesmilies;
|
}
/**
| }
/**
|
* Builds thread prefixes and returns a selected prefix (or all) * * @param int $pid The prefix ID (0 to return all)
| * Builds thread prefixes and returns a selected prefix (or all) * * @param int $pid The prefix ID (0 to return all)
|
Zeile 3606 | Zeile 3606 |
---|
{ global $cache; static $prefixes_cache;
|
{ global $cache; static $prefixes_cache;
|
|
|
if(is_array($prefixes_cache)) { if($pid > 0 && is_array($prefixes_cache[$pid])) { return $prefixes_cache[$pid];
|
if(is_array($prefixes_cache)) { if($pid > 0 && is_array($prefixes_cache[$pid])) { return $prefixes_cache[$pid];
|
}
return $prefixes_cache; }
$prefix_cache = $cache->read("threadprefixes");
| }
return $prefixes_cache; }
$prefix_cache = $cache->read("threadprefixes");
|
if(!is_array($prefix_cache)) {
| if(!is_array($prefix_cache)) {
|
Zeile 3628 | Zeile 3628 |
---|
{ return array(); }
|
{ return array(); }
|
}
| }
|
$prefixes_cache = array(); foreach($prefix_cache as $prefix)
| $prefixes_cache = array(); foreach($prefix_cache as $prefix)
|
Zeile 3658 | Zeile 3658 |
---|
* @return string The thread prefix selection menu */ function build_prefix_select($fid, $selected_pid=0, $multiple=0, $previous_pid=0)
|
* @return string The thread prefix selection menu */ function build_prefix_select($fid, $selected_pid=0, $multiple=0, $previous_pid=0)
|
{ global $cache, $db, $lang, $mybb, $templates;
| { global $cache, $db, $lang, $mybb, $templates;
|
if($fid != 'all')
|
if($fid != 'all')
|
{
| {
|
$fid = (int)$fid; }
| $fid = (int)$fid; }
|
Zeile 3670 | Zeile 3670 |
---|
if(empty($prefix_cache)) { // We've got no prefixes to show
|
if(empty($prefix_cache)) { // We've got no prefixes to show
|
return '';
| return '';
|
}
// Go through each of our prefixes and decide which ones we can use
| }
// Go through each of our prefixes and decide which ones we can use
|
Zeile 3681 | Zeile 3681 |
---|
{ // Decide whether this prefix can be used in our forum $forums = explode(",", $prefix['forums']);
|
{ // Decide whether this prefix can be used in our forum $forums = explode(",", $prefix['forums']);
|
|
|
if(!in_array($fid, $forums) && $prefix['pid'] != $previous_pid) { // This prefix is not in our forum list
| if(!in_array($fid, $forums) && $prefix['pid'] != $previous_pid) { // This prefix is not in our forum list
|
Zeile 3699 | Zeile 3699 |
---|
if(empty($prefixes)) { return '';
|
if(empty($prefixes)) { return '';
|
}
$prefixselect = $prefixselect_prefix = '';
| }
$prefixselect = $prefixselect_prefix = '';
|
if($multiple == 1) { $any_selected = "";
| if($multiple == 1) { $any_selected = "";
|
Zeile 3744 | Zeile 3744 |
---|
/** * Build the thread prefix selection menu for a forum without group permission checks
|
/** * Build the thread prefix selection menu for a forum without group permission checks
|
*
| *
|
* @param int $fid The forum ID (integer ID) * @param int $selected_pid The selected prefix ID (integer ID) * @return string The thread prefix selection menu
| * @param int $fid The forum ID (integer ID) * @param int $selected_pid The selected prefix ID (integer ID) * @return string The thread prefix selection menu
|
Zeile 3776 | Zeile 3776 |
---|
// This forum can use this prefix! $prefixes[$prefix['pid']] = $prefix; }
|
// This forum can use this prefix! $prefixes[$prefix['pid']] = $prefix; }
|
}
| }
|
else { // This prefix is for anybody to use...
| else { // This prefix is for anybody to use...
|
Zeile 3787 | Zeile 3787 |
---|
if(empty($prefixes)) { return '';
|
if(empty($prefixes)) { return '';
|
}
| }
|
$default_selected = array(); $selected_pid = (int)$selected_pid;
| $default_selected = array(); $selected_pid = (int)$selected_pid;
|
Zeile 3829 | Zeile 3829 |
---|
* @return string The encoded string */ function gzip_encode($contents, $level=1)
|
* @return string The encoded string */ function gzip_encode($contents, $level=1)
|
{
| {
|
if(function_exists("gzcompress") && function_exists("crc32") && !headers_sent() && !(ini_get('output_buffering') && my_strpos(' '.ini_get('output_handler'), 'ob_gzhandler'))) { $httpaccept_encoding = '';
| if(function_exists("gzcompress") && function_exists("crc32") && !headers_sent() && !(ini_get('output_buffering') && my_strpos(' '.ini_get('output_handler'), 'ob_gzhandler'))) { $httpaccept_encoding = '';
|
Zeile 3999 | Zeile 3999 |
---|
if($level >= 80) { $warning_class = "high_warning";
|
if($level >= 80) { $warning_class = "high_warning";
|
}
| }
|
else if($level >= 50) { $warning_class = "moderate_warning";
| else if($level >= 50) { $warning_class = "moderate_warning";
|
Zeile 4021 | Zeile 4021 |
---|
* Fetch the IP address of the current user. * * @return string The IP address.
|
* Fetch the IP address of the current user. * * @return string The IP address.
|
*/
| */
|
function get_ip() { global $mybb, $plugins;
|
function get_ip() { global $mybb, $plugins;
|
|
|
$ip = strtolower($_SERVER['REMOTE_ADDR']);
if($mybb->settings['ip_forwarded_check']) { $addresses = array();
|
$ip = strtolower($_SERVER['REMOTE_ADDR']);
if($mybb->settings['ip_forwarded_check']) { $addresses = array();
|
|
|
if(isset($_SERVER['HTTP_X_FORWARDED_FOR']))
|
if(isset($_SERVER['HTTP_X_FORWARDED_FOR']))
|
{
| {
|
$addresses = explode(',', strtolower($_SERVER['HTTP_X_FORWARDED_FOR'])); } elseif(isset($_SERVER['HTTP_X_REAL_IP']))
| $addresses = explode(',', strtolower($_SERVER['HTTP_X_FORWARDED_FOR'])); } elseif(isset($_SERVER['HTTP_X_REAL_IP']))
|
Zeile 4042 | Zeile 4042 |
---|
}
if(is_array($addresses))
|
}
if(is_array($addresses))
|
{
| {
|
foreach($addresses as $val) { $val = trim($val);
| foreach($addresses as $val) { $val = trim($val);
|
Zeile 4053 | Zeile 4053 |
---|
break; } }
|
break; } }
|
} }
| } }
|
if(!$ip) { if(isset($_SERVER['HTTP_CLIENT_IP'])) { $ip = strtolower($_SERVER['HTTP_CLIENT_IP']); }
|
if(!$ip) { if(isset($_SERVER['HTTP_CLIENT_IP'])) { $ip = strtolower($_SERVER['HTTP_CLIENT_IP']); }
|
}
| }
|
if($plugins) { $ip_array = array("ip" => &$ip); // Used for backwards compatibility on this hook with the updated run_hooks() function.
| if($plugins) { $ip_array = array("ip" => &$ip); // Used for backwards compatibility on this hook with the updated run_hooks() function.
|
Zeile 4084 | Zeile 4084 |
---|
global $lang;
if(!is_numeric($size))
|
global $lang;
if(!is_numeric($size))
|
{
| {
|
return $lang->na;
|
return $lang->na;
|
}
| }
|
// Yottabyte (1024 Zettabytes) if($size >= 1208925819614629174706176)
| // Yottabyte (1024 Zettabytes) if($size >= 1208925819614629174706176)
|
Zeile 4095 | Zeile 4095 |
---|
} // Zetabyte (1024 Exabytes) elseif($size >= 1180591620717411303424)
|
} // Zetabyte (1024 Exabytes) elseif($size >= 1180591620717411303424)
|
{
| {
|
$size = my_number_format(round(($size / 1180591620717411303424), 2))." ".$lang->size_zb; } // Exabyte (1024 Petabytes)
| $size = my_number_format(round(($size / 1180591620717411303424), 2))." ".$lang->size_zb; } // Exabyte (1024 Petabytes)
|
Zeile 4127 | Zeile 4127 |
---|
elseif($size >= 1024) { $size = my_number_format(round(($size / 1024), 2))." ".$lang->size_kb;
|
elseif($size >= 1024) { $size = my_number_format(round(($size / 1024), 2))." ".$lang->size_kb;
|
}
| }
|
elseif($size == 0)
|
elseif($size == 0)
|
{
| {
|
$size = "0 ".$lang->size_bytes; } else
| $size = "0 ".$lang->size_bytes; } else
|
Zeile 4138 | Zeile 4138 |
---|
}
return $size;
|
}
return $size;
|
}
| }
|
/** * Format a decimal number in to microseconds, milliseconds, or seconds.
| /** * Format a decimal number in to microseconds, milliseconds, or seconds.
|
Zeile 4169 | Zeile 4169 |
---|
}
return $time;
|
}
return $time;
|
}
| }
|
/** * Get the attachment icon for a specific file extension
| /** * Get the attachment icon for a specific file extension
|
Zeile 4337 | Zeile 4337 |
---|
function build_breadcrumb() { global $nav, $navbits, $templates, $theme, $lang, $mybb;
|
function build_breadcrumb() { global $nav, $navbits, $templates, $theme, $lang, $mybb;
|
eval("\$navsep = \"".$templates->get("nav_sep")."\";");
| eval("\$navsep = \"".$templates->get("nav_sep")."\";");
|
$i = 0; $activesep = '';
| $i = 0; $activesep = '';
|
Zeile 4507 | Zeile 4507 |
---|
* @param string $type The type of page (thread|announcement|forum) * @param int $id The ID of the item * @return string The URL
|
* @param string $type The type of page (thread|announcement|forum) * @param int $id The ID of the item * @return string The URL
|
*/
| */
|
function build_archive_link($type="", $id=0) { global $mybb;
| function build_archive_link($type="", $id=0) { global $mybb;
|
Zeile 4847 | Zeile 4847 |
---|
$options = array_merge(array( 'seconds' => false ), $options);
|
$options = array_merge(array( 'seconds' => false ), $options);
|
}
| }
|
if(!isset($options['years']) || $options['years'] !== false) { if($years == 1)
| if(!isset($options['years']) || $options['years'] !== false) { if($years == 1)
|
Zeile 6207 | Zeile 6207 |
---|
function get_user_by_username($username, $options=array()) { global $mybb, $db;
|
function get_user_by_username($username, $options=array()) { global $mybb, $db;
|
|
|
$username = $db->escape_string(my_strtolower($username));
if(!isset($options['username_method']))
| $username = $db->escape_string(my_strtolower($username));
if(!isset($options['username_method']))
|
Zeile 6295 | Zeile 6295 |
---|
}
return $forum_cache[$fid];
|
}
return $forum_cache[$fid];
|
}
| }
|
/** * Get the thread of a thread id.
| /** * Get the thread of a thread id.
|
Zeile 6380 | Zeile 6380 |
---|
if(!$forum_cache) { cache_forums();
|
if(!$forum_cache) { cache_forums();
|
}
$inactive = array();
| }
$inactive = array();
|
foreach($forum_cache as $fid => $forum) { if($forum['active'] == 0)
| foreach($forum_cache as $fid => $forum) { if($forum['active'] == 0)
|
Zeile 6400 | Zeile 6400 |
---|
}
$inactiveforums = implode(",", $inactive);
|
}
$inactiveforums = implode(",", $inactive);
|
|
|
return $inactiveforums; }
| return $inactiveforums; }
|
Zeile 6425 | Zeile 6425 |
---|
$attempts = $db->fetch_array($query);
if($attempts['loginattempts'] <= 0)
|
$attempts = $db->fetch_array($query);
if($attempts['loginattempts'] <= 0)
|
{ return 0; }
| { return 0; }
|
} // This user has a cookie lockout, show waiting time elseif($mybb->cookies['lockoutexpiry'] && $mybb->cookies['lockoutexpiry'] > $now)
|
} // 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);
| if($fatal) { $secsleft = (int)($mybb->cookies['lockoutexpiry'] - $now);
|
Zeile 6455 | Zeile 6455 |
---|
// 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']);
|
// 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}'");
| $db->update_query("users", array( "loginlockoutexpiry" => $attempts['loginlockoutexpiry'] ), "uid='{$uid}'");
|
Zeile 6466 | Zeile 6466 |
---|
$failedtime = $attempts['loginlockoutexpiry']; } else
|
$failedtime = $attempts['loginlockoutexpiry']; } else
|
{
| {
|
$failedtime = $mybb->cookies['lockoutexpiry']; }
// Are we still locked out? if($attempts['loginlockoutexpiry'] > $now)
|
$failedtime = $mybb->cookies['lockoutexpiry']; }
// Are we still locked out? if($attempts['loginlockoutexpiry'] > $now)
|
{
| {
|
if($fatal) { $secsleft = (int)($attempts['loginlockoutexpiry'] - $now);
| if($fatal) { $secsleft = (int)($attempts['loginlockoutexpiry'] - $now);
|
Zeile 6516 | Zeile 6516 |
---|
function validate_email_format($email) { return filter_var($email, FILTER_VALIDATE_EMAIL) !== false;
|
function validate_email_format($email) { return filter_var($email, FILTER_VALIDATE_EMAIL) !== false;
|
}
| }
|
/** * Checks to see if the email is already in use by another *
| /** * Checks to see if the email is already in use by another *
|
Zeile 6528 | Zeile 6528 |
---|
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 = ""; if($uid) {
|
Zeile 6561 | Zeile 6561 |
---|
while($setting = $db->fetch_array($query)) { $mybb->settings[$setting['name']] = $setting['value'];
|
while($setting = $db->fetch_array($query)) { $mybb->settings[$setting['name']] = $setting['value'];
|
| $setting['name'] = addcslashes($setting['name'], "\\'");
|
$setting['value'] = addcslashes($setting['value'], '\\"$'); $settings .= "\$settings['{$setting['name']}'] = \"{$setting['value']}\";\n"; }
| $setting['value'] = addcslashes($setting['value'], '\\"$'); $settings .= "\$settings['{$setting['name']}'] = \"{$setting['value']}\";\n"; }
|
Zeile 7112 | Zeile 7114 |
---|
if(in_array(curl_getinfo($ch, CURLINFO_HTTP_CODE), array(301, 302))) {
|
if(in_array(curl_getinfo($ch, CURLINFO_HTTP_CODE), array(301, 302))) {
|
preg_match('/Location:(.*?)(?:\n|$)/', $header, $matches);
| preg_match('/^Location:(.*?)(?:\n|$)/im', $header, $matches);
|
if($matches) {
| if($matches) {
|
Zeile 7237 | Zeile 7239 |
---|
if($max_redirects > 0 && (strstr($status_line, ' 301 ') || strstr($status_line, ' 302 '))) {
|
if($max_redirects > 0 && (strstr($status_line, ' 301 ') || strstr($status_line, ' 302 '))) {
|
preg_match('/Location:(.*?)(?:\n|$)/', $header, $matches);
| preg_match('/^Location:(.*?)(?:\n|$)/im', $header, $matches);
|
if($matches) {
| if($matches) {
|
Zeile 8929 | Zeile 8931 |
---|
return $result === 0; }
|
return $result === 0; }
|
| }
/** * Retrieves all referrals for a specified user * * @param int uid * @param int start position * @param int total entries * @param bool false (default) only return display info, true for all info * @return array */ function get_user_referrals($uid, $start=0, $limit=0, $full=false) { global $db;
$referrals = $query_options = array(); $uid = (int) $uid;
if($uid === 0) { return $referrals; }
if($start && $limit) { $query_options['limit_start'] = $start; }
if($limit) { $query_options['limit'] = $limit; }
$fields = 'uid, username, usergroup, displaygroup, regdate'; if($full === true) { $fields = '*'; }
$query = $db->simple_select('users', $fields, "referrer='{$uid}'", $query_options);
while($referral = $db->fetch_array($query)) { $referrals[] = $referral; }
return $referrals;
|
}
| }
|