Zeile 18 | Zeile 18 |
---|
global $db, $lang, $theme, $templates, $plugins, $mybb; global $debug, $templatecache, $templatelist, $maintimer, $globaltime, $parsetime;
|
global $db, $lang, $theme, $templates, $plugins, $mybb; global $debug, $templatecache, $templatelist, $maintimer, $globaltime, $parsetime;
|
| $contents = $plugins->run_hooks("pre_parse_page", $contents);
|
$contents = parse_page($contents); $totaltime = format_time_duration($maintimer->stop()); $contents = $plugins->run_hooks("pre_output_page", $contents);
| $contents = parse_page($contents); $totaltime = format_time_duration($maintimer->stop()); $contents = $plugins->run_hooks("pre_output_page", $contents);
|
Zeile 223 | Zeile 224 |
---|
// Loop through and run them all foreach($shutdown_queries as $query) {
|
// Loop through and run them all foreach($shutdown_queries as $query) {
|
$db->query($query);
| $db->write_query($query);
|
} }
| } }
|
Zeile 609 | Zeile 610 |
---|
}
/**
|
}
/**
|
* Generates a unique code for POST requests to prevent XSS/CSRF attacks
| * Generates a code for POST requests to prevent XSS/CSRF attacks. * Unique for each user or guest session and rotated every 6 hours.
|
*
|
*
|
| * @param int $rotation_shift Adjustment of the rotation number to generate a past/future code
|
* @return string The generated code */
|
* @return string The generated code */
|
function generate_post_check()
| function generate_post_check($rotation_shift=0)
|
{ global $mybb, $session;
|
{ global $mybb, $session;
|
| $rotation_interval = 6 * 3600; $rotation = floor(TIME_NOW / $rotation_interval) + $rotation_shift;
$seed = $rotation;
|
if($mybb->user['uid'])
|
if($mybb->user['uid'])
|
{ return md5($mybb->user['loginkey'].$mybb->user['salt'].$mybb->user['regdate']); } // Guests get a special string
| { $seed .= $mybb->user['loginkey'].$mybb->user['salt'].$mybb->user['regdate']; }
|
else {
|
else {
|
return md5($session->useragent.$mybb->config['database']['username'].$mybb->settings['internal']['encryption_key']);
| $seed .= $session->sid;
|
}
|
}
|
| $seed .= $mybb->settings['internal']['encryption_key'];
return md5($seed);
|
}
/**
|
}
/**
|
* Verifies a POST check code is valid, if not shows an error (silently returns false on silent parameter)
| * Verifies a POST check code is valid (i.e. generated using a rotation number from the past 24 hours)
|
* * @param string $code The incoming POST check code
|
* * @param string $code The incoming POST check code
|
* @param boolean $silent Silent mode or not (silent mode will not show the error to the user but returns false) * @return bool
| * @param boolean $silent Don't show an error to the user * @return bool|void Result boolean if $silent is true, otherwise shows an error to the user
|
*/ function verify_post_check($code, $silent=false) { global $lang;
|
*/ function verify_post_check($code, $silent=false) { global $lang;
|
if(generate_post_check() !== $code)
| if( generate_post_check() !== $code && generate_post_check(-1) !== $code && generate_post_check(-2) !== $code && generate_post_check(-3) !== $code )
|
{ if($silent == true) {
| { if($silent == true) {
|
Zeile 653 | Zeile 670 |
---|
{ error($lang->invalid_post_code); }
|
{ error($lang->invalid_post_code); }
|
}
| }
|
} else {
| } else {
|
Zeile 684 | Zeile 701 |
---|
{ cache_forums(); return $forum_cache[$fid]['parentlist'];
|
{ 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 701 | Zeile 718 |
---|
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 *
| /** * Load the forum cache in to memory *
|
Zeile 732 | Zeile 749 |
---|
{ $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 748 | Zeile 765 |
---|
/** * Generate an array of all child and descendant forums for a specific forum.
|
/** * Generate an array of all child and descendant forums for a specific forum.
|
* * @param int $fid The forum ID
| * * @param int $fid The forum ID
|
* @return Array of descendants */ function get_child_list($fid)
| * @return Array of descendants */ function get_child_list($fid)
|
Zeile 775 | Zeile 792 |
---|
foreach($forums_by_parent[$fid] as $forum) {
|
foreach($forums_by_parent[$fid] as $forum) {
|
$forums[] = $forum['fid'];
| $forums[] = (int)$forum['fid'];
|
$children = get_child_list($forum['fid']); if(is_array($children)) {
| $children = get_child_list($forum['fid']); if(is_array($children)) {
|
Zeile 813 | Zeile 830 |
---|
if(!$title) { $title = $mybb->settings['bbname'];
|
if(!$title) { $title = $mybb->settings['bbname'];
|
}
| }
|
$timenow = my_date('relative', TIME_NOW); reset_breadcrumb(); add_breadcrumb($lang->error);
| $timenow = my_date('relative', TIME_NOW); reset_breadcrumb(); add_breadcrumb($lang->error);
|
Zeile 845 | Zeile 862 |
---|
if(!is_array($errors)) { $errors = array($errors);
|
if(!is_array($errors)) { $errors = array($errors);
|
}
| }
|
// AJAX error message? if($mybb->get_input('ajax', MyBB::INPUT_INT)) {
| // AJAX error message? if($mybb->get_input('ajax', MyBB::INPUT_INT)) {
|
Zeile 854 | Zeile 871 |
---|
@header("Content-type: application/json; charset={$lang->settings['charset']}");
if(empty($json_data))
|
@header("Content-type: application/json; charset={$lang->settings['charset']}");
if(empty($json_data))
|
{
| {
|
echo json_encode(array("errors" => $errors));
|
echo json_encode(array("errors" => $errors));
|
}
| }
|
else { echo json_encode(array_merge(array("errors" => $errors), $json_data)); } exit;
|
else { echo json_encode(array_merge(array("errors" => $errors), $json_data)); } exit;
|
}
| }
|
$errorlist = '';
foreach($errors as $error) {
|
$errorlist = '';
foreach($errors as $error) {
|
$errorlist .= "<li>".$error."</li>\n";
| eval("\$errorlist .= \"".$templates->get("error_inline_item")."\";");
|
}
eval("\$errors = \"".$templates->get("error_inline")."\";");
| }
eval("\$errors = \"".$templates->get("error_inline")."\";");
|
Zeile 878 | Zeile 895 |
---|
/** * Presents the user with a "no permission" page
|
/** * Presents the user with a "no permission" page
|
*/
| */
|
function error_no_permission() { global $mybb, $theme, $templates, $db, $lang, $plugins, $session;
| function error_no_permission() { global $mybb, $theme, $templates, $db, $lang, $plugins, $session;
|
Zeile 1030 | Zeile 1047 |
---|
*/ function multipage($count, $perpage, $page, $url, $breadcrumb=false) {
|
*/ function multipage($count, $perpage, $page, $url, $breadcrumb=false) {
|
global $theme, $templates, $lang, $mybb;
| global $theme, $templates, $lang, $mybb, $plugins;
|
if($count <= $perpage) { return ''; }
|
if($count <= $perpage) { return ''; }
|
| $args = array( 'count' => &$count, 'perpage' => &$perpage, 'page' => &$page, 'url' => &$url, 'breadcrumb' => &$breadcrumb, ); $plugins->run_hooks('multipage', $args);
|
$page = (int)$page;
| $page = (int)$page;
|
Zeile 1133 | Zeile 1159 |
---|
$next = $page+1; $page_url = fetch_page_url($url, $next); eval("\$nextpage = \"".$templates->get("multipage_nextpage")."\";");
|
$next = $page+1; $page_url = fetch_page_url($url, $next); eval("\$nextpage = \"".$templates->get("multipage_nextpage")."\";");
|
}
| }
|
$jumptopage = ''; if($pages > ($mybb->settings['maxmultipagelinks']+1) && $mybb->settings['jumptopagemultipage'] == 1)
| $jumptopage = ''; if($pages > ($mybb->settings['maxmultipagelinks']+1) && $mybb->settings['jumptopagemultipage'] == 1)
|
Zeile 1381 | Zeile 1407 |
---|
} }
|
} }
|
if(!is_array($forum_cache)) { $forum_cache = cache_forums();
if(!$forum_cache) { return false; } }
if(!is_array($fpermcache))
| if(!is_array($forum_cache)) { $forum_cache = cache_forums();
if(!$forum_cache) { return false; } }
if(!is_array($fpermcache))
|
{ $fpermcache = $cache->read("forumpermissions");
|
{ $fpermcache = $cache->read("forumpermissions");
|
}
| }
|
if($fid) // Fetch the permissions for a single forum {
| if($fid) // Fetch the permissions for a single forum {
|
Zeile 1405 | Zeile 1431 |
---|
return $cached_forum_permissions_permissions[$gid][$fid]; } else
|
return $cached_forum_permissions_permissions[$gid][$fid]; } else
|
{
| {
|
if(empty($cached_forum_permissions[$gid])) { foreach($forum_cache as $forum)
| if(empty($cached_forum_permissions[$gid])) { foreach($forum_cache as $forum)
|
Zeile 1420 | Zeile 1446 |
---|
/** * Fetches the permissions for a specific forum/group applying the inheritance scheme. * Called by forum_permissions()
|
/** * Fetches the permissions for a specific forum/group applying the inheritance scheme. * Called by forum_permissions()
|
*
| *
|
* @param int $fid The forum ID * @param string $gid A comma separated list of usergroups * @param array $groupperms Group permissions
| * @param int $fid The forum ID * @param string $gid A comma separated list of usergroups * @param array $groupperms Group permissions
|
Zeile 1449 | Zeile 1475 |
---|
// 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 1462 | Zeile 1488 |
---|
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 1477 | Zeile 1503 |
---|
{ $current_permissions[$permission] = $access; }
|
{ $current_permissions[$permission] = $access; }
|
}
| }
|
if($level_permissions["canview"] && empty($level_permissions["canonlyviewownthreads"]))
|
if($level_permissions["canview"] && empty($level_permissions["canonlyviewownthreads"]))
|
{
| {
|
$only_view_own_threads = 0;
|
$only_view_own_threads = 0;
|
}
| }
|
if($level_permissions["canpostreplys"] && empty($level_permissions["canonlyreplyownthreads"])) {
| if($level_permissions["canpostreplys"] && empty($level_permissions["canonlyreplyownthreads"])) {
|
Zeile 1493 | Zeile 1519 |
---|
// Figure out if we can view more than our own threads if($only_view_own_threads == 0)
|
// Figure out if we can view more than our own threads if($only_view_own_threads == 0)
|
{
| {
|
$current_permissions["canonlyviewownthreads"] = 0;
|
$current_permissions["canonlyviewownthreads"] = 0;
|
}
| }
|
// Figure out if we can reply more than our own threads if($only_reply_own_threads == 0)
|
// Figure out if we can reply more than our own threads if($only_reply_own_threads == 0)
|
{
| {
|
$current_permissions["canonlyreplyownthreads"] = 0;
|
$current_permissions["canonlyreplyownthreads"] = 0;
|
}
| }
|
if(count($current_permissions) == 0)
|
if(count($current_permissions) == 0)
|
{
| {
|
$current_permissions = $groupperms;
|
$current_permissions = $groupperms;
|
}
| }
|
return $current_permissions;
|
return $current_permissions;
|
| }
/** * Check whether password for given forum was validated for the current user * * @param array $forum The forum data * @param bool $ignore_empty Whether to treat forum password configured as an empty string as validated * @param bool $check_parents Whether to check parent forums using `parentlist` * @return bool */ function forum_password_validated($forum, $ignore_empty=false, $check_parents=false) { global $mybb, $forum_cache;
if($check_parents && isset($forum['parentlist'])) { if(!is_array($forum_cache)) { $forum_cache = cache_forums(); if(!$forum_cache) { return false; } }
$parents = explode(',', $forum['parentlist']); rsort($parents);
foreach($parents as $parent_id) { if($parent_id != $forum['fid'] && !forum_password_validated($forum_cache[$parent_id], true)) { return false; } } }
return ($ignore_empty && $forum['password'] === '') || ( isset($mybb->cookies['forumpass'][$forum['fid']]) && my_hash_equals( md5($mybb->user['uid'].$forum['password']), $mybb->cookies['forumpass'][$forum['fid']] ) );
|
}
/**
| }
/**
|
Zeile 1548 | Zeile 1618 |
---|
continue; }
|
continue; }
|
if($forum_cache[$parent_id]['password'] != "")
| if($forum_cache[$parent_id]['password'] !== "")
|
{ check_forum_password($parent_id, $fid); } } }
|
{ check_forum_password($parent_id, $fid); } } }
|
if(!empty($forum_cache[$fid]['password']))
| if($forum_cache[$fid]['password'] !== '')
|
{
|
{
|
$password = $forum_cache[$fid]['password'];
| |
if(isset($mybb->input['pwverify']) && $pid == 0) {
|
if(isset($mybb->input['pwverify']) && $pid == 0) {
|
if($password === $mybb->get_input('pwverify'))
| if(my_hash_equals($forum_cache[$fid]['password'], $mybb->get_input('pwverify')))
|
{ my_setcookie("forumpass[$fid]", md5($mybb->user['uid'].$mybb->get_input('pwverify')), null, true); $showform = false;
| { my_setcookie("forumpass[$fid]", md5($mybb->user['uid'].$mybb->get_input('pwverify')), null, true); $showform = false;
|
Zeile 1573 | Zeile 1642 |
---|
} else {
|
} else {
|
if(!$mybb->cookies['forumpass'][$fid] || ($mybb->cookies['forumpass'][$fid] && md5($mybb->user['uid'].$password) !== $mybb->cookies['forumpass'][$fid]))
| if(!forum_password_validated($forum_cache[$fid]))
|
{ $showform = true; }
| { $showform = true; }
|
Zeile 1644 | Zeile 1713 |
---|
// Get user groups $perms = array();
|
// Get user groups $perms = array();
|
$user = get_user($uid);
$groups = array($user['usergroup']);
| $user = get_user($uid);
$groups = array($user['usergroup']);
|
if(!empty($user['additionalgroups'])) {
| if(!empty($user['additionalgroups'])) {
|
Zeile 1802 | Zeile 1871 |
---|
} } }
|
} } }
|
| }
/** * Get an array of fids that the forum moderator has access to. * Do not use for administraotrs or global moderators as they moderate any forum and the function will return false. * * @param int $uid The user ID (0 assumes current user) * @return array|bool an array of the fids the user has moderator access to or bool if called incorrectly. */ function get_moderated_fids($uid=0) { global $mybb, $cache;
if($uid == 0) { $uid = $mybb->user['uid']; }
if($uid == 0) { return array(); }
$user_perms = user_permissions($uid);
if($user_perms['issupermod'] == 1) { return false; }
$fids = array();
$modcache = $cache->read('moderators'); if(!empty($modcache)) { $groups = explode(',', $user_perms['all_usergroups']);
foreach($modcache as $fid => $forum) { if(isset($forum['users'][$uid]) && $forum['users'][$uid]['mid']) { $fids[] = $fid; continue; }
foreach($groups as $group) { if(trim($group) != '' && isset($forum['usergroups'][$group])) { $fids[] = $fid; } } } }
return $fids;
|
}
/**
| }
/**
|
Zeile 1816 | Zeile 1941 |
---|
if(isset($mybb->input['icon'])) { $icon = $mybb->get_input('icon');
|
if(isset($mybb->input['icon'])) { $icon = $mybb->get_input('icon');
|
}
| }
|
$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
|
Zeile 1851 | Zeile 1976 |
---|
if(!empty($iconlist)) { eval("\$posticons = \"".$templates->get("posticons")."\";");
|
if(!empty($iconlist)) { eval("\$posticons = \"".$templates->get("posticons")."\";");
|
} else {
| } else {
|
$posticons = ''; }
| $posticons = ''; }
|
Zeile 1876 | Zeile 2001 |
---|
if(!$mybb->settings['cookiepath']) { $mybb->settings['cookiepath'] = "/";
|
if(!$mybb->settings['cookiepath']) { $mybb->settings['cookiepath'] = "/";
|
}
| }
|
if($expires == -1) { $expires = 0;
| if($expires == -1) { $expires = 0;
|
Zeile 1901 | Zeile 2026 |
---|
if($expires > 0) { $cookie .= "; expires=".@gmdate('D, d-M-Y H:i:s \\G\\M\\T', $expires);
|
if($expires > 0) { $cookie .= "; expires=".@gmdate('D, d-M-Y H:i:s \\G\\M\\T', $expires);
|
}
| }
|
if(!empty($mybb->settings['cookiepath'])) {
| if(!empty($mybb->settings['cookiepath'])) {
|
Zeile 2041 | Zeile 2166 |
---|
return false; }
|
return false; }
|
$stack = array(); $expected = array();
| $stack = $list = $expected = array();
|
/* * states:
| /* * states:
|
Zeile 2538 | Zeile 2662 |
---|
$forum = $db->fetch_array($query);
foreach($counters as $counter)
|
$forum = $db->fetch_array($query);
foreach($counters as $counter)
|
{
| {
|
if(array_key_exists($counter, $changes)) { if(substr($changes[$counter], 0, 2) == "+-")
| if(array_key_exists($counter, $changes)) { if(substr($changes[$counter], 0, 2) == "+-")
|
Zeile 2584 | Zeile 2708 |
---|
else { $new_stats['numthreads'] = "{$threads_diff}";
|
else { $new_stats['numthreads'] = "{$threads_diff}";
|
} }
| } }
|
if(array_key_exists('unapprovedthreads', $update_query)) {
| if(array_key_exists('unapprovedthreads', $update_query)) {
|
Zeile 2632 | Zeile 2756 |
---|
if($deletedposts_diff > -1) { $new_stats['numdeletedposts'] = "+{$deletedposts_diff}";
|
if($deletedposts_diff > -1) { $new_stats['numdeletedposts'] = "+{$deletedposts_diff}";
|
}
| }
|
else { $new_stats['numdeletedposts'] = "{$deletedposts_diff}";
| else { $new_stats['numdeletedposts'] = "{$deletedposts_diff}";
|
Zeile 2664 | Zeile 2788 |
---|
* @param int $fid The forum ID */ function update_forum_lastpost($fid)
|
* @param int $fid The forum ID */ function update_forum_lastpost($fid)
|
{ global $db;
| { global $db;
|
// Fetch the last post for this forum $query = $db->query("
| // Fetch the last post for this forum $query = $db->query("
|
Zeile 2686 | Zeile 2810 |
---|
);
$db->update_query("forums", $updated_forum, "fid='{$fid}'");
|
);
$db->update_query("forums", $updated_forum, "fid='{$fid}'");
|
}
| }
|
/** * Updates the thread counters with a specific value (or addition/subtraction of the previous value) *
| /** * Updates the thread counters with a specific value (or addition/subtraction of the previous value) *
|
Zeile 2699 | Zeile 2823 |
---|
global $db;
$update_query = array();
|
global $db;
$update_query = array();
|
$tid = (int)$tid;
| $tid = (int)$tid;
|
$counters = array('replies', 'unapprovedposts', 'attachmentcount', 'deletedposts', 'attachmentcount');
| $counters = array('replies', 'unapprovedposts', 'attachmentcount', 'deletedposts', 'attachmentcount');
|
Zeile 2734 | Zeile 2858 |
---|
$update_query[$counter] = 0; } }
|
$update_query[$counter] = 0; } }
|
}
| }
|
$db->free_result($query);
// Only update if we're actually doing something
| $db->free_result($query);
// Only update if we're actually doing something
|
Zeile 2760 | Zeile 2884 |
---|
if(strpos($thread['closed'], 'moved|') !== false) { return;
|
if(strpos($thread['closed'], 'moved|') !== false) { return;
|
}
$query = $db->query("
| }
$query = $db->query("
|
SELECT u.uid, u.username, p.username AS postusername, p.dateline FROM ".TABLE_PREFIX."posts p LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid)
| SELECT u.uid, u.username, p.username AS postusername, p.dateline FROM ".TABLE_PREFIX."posts p LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid)
|
Zeile 2956 | Zeile 3080 |
---|
if(isset($jumpfcache[$pid]) && is_array($jumpfcache[$pid])) { foreach($jumpfcache[$pid] as $main)
|
if(isset($jumpfcache[$pid]) && is_array($jumpfcache[$pid])) { foreach($jumpfcache[$pid] as $main)
|
{
| {
|
foreach($main as $forum) { $perms = $permissioncache[$forum['fid']];
| foreach($main as $forum) { $perms = $permissioncache[$forum['fid']];
|
Zeile 3150 | Zeile 3274 |
---|
if(!$max_dimensions) { $max_dimensions = $mybb->settings['maxavatardims'];
|
if(!$max_dimensions) { $max_dimensions = $mybb->settings['maxavatardims'];
|
}
| }
|
// An empty key wouldn't work so we need to add a fall back $key = $dimensions;
| // An empty key wouldn't work so we need to add a fall back $key = $dimensions;
|
Zeile 3173 | Zeile 3297 |
---|
if($dimensions) {
|
if($dimensions) {
|
$dimensions = explode("|", $dimensions);
| $dimensions = preg_split('/[|x]/', $dimensions);
|
if($dimensions[0] && $dimensions[1]) {
|
if($dimensions[0] && $dimensions[1]) {
|
list($max_width, $max_height) = explode('x', $max_dimensions);
| list($max_width, $max_height) = preg_split('/[|x]/', $max_dimensions);
|
if(!empty($max_dimensions) && ($dimensions[0] > $max_width || $dimensions[1] > $max_height)) {
| if(!empty($max_dimensions) && ($dimensions[0] > $max_width || $dimensions[1] > $max_height)) {
|
Zeile 3274 | Zeile 3398 |
---|
"editor_invalidyoutube" => "Invalid YouTube video", "editor_dailymotion" => "Dailymotion", "editor_metacafe" => "MetaCafe",
|
"editor_invalidyoutube" => "Invalid YouTube video", "editor_dailymotion" => "Dailymotion", "editor_metacafe" => "MetaCafe",
|
"editor_veoh" => "Veoh",
| "editor_mixer" => "Mixer",
|
"editor_vimeo" => "Vimeo", "editor_youtube" => "Youtube", "editor_facebook" => "Facebook",
| "editor_vimeo" => "Vimeo", "editor_youtube" => "Youtube", "editor_facebook" => "Facebook",
|
Zeile 3444 | Zeile 3568 |
---|
}
return $codeinsert;
|
}
return $codeinsert;
|
| }
/** * @param int $tid * @param array $postoptions The options carried with form submit * * @return string Predefined / updated subscription method of the thread for the user */ function get_subscription_method($tid = 0, $postoptions = array()) { global $mybb;
$subscription_methods = array('', 'none', 'email', 'pm'); // Define methods $subscription_method = (int)$mybb->user['subscriptionmethod']; // Set user default
// If no user default method available then reset method if(!$subscription_method) { $subscription_method = 0; }
// Return user default if no thread id available, in case if(!(int)$tid || (int)$tid <= 0) { return $subscription_methods[$subscription_method]; }
// If method not predefined set using data from database if(isset($postoptions['subscriptionmethod'])) { $method = trim($postoptions['subscriptionmethod']); return (in_array($method, $subscription_methods)) ? $method : $subscription_methods[0]; } else { global $db;
$query = $db->simple_select("threadsubscriptions", "tid, notification", "tid='".(int)$tid."' AND uid='".$mybb->user['uid']."'", array('limit' => 1)); $subscription = $db->fetch_array($query);
if($subscription['tid']) { $subscription_method = (int)$subscription['notification'] + 1; } }
return $subscription_methods[$subscription_method];
|
}
/**
| }
/**
|
Zeile 4218 | Zeile 4389 |
---|
$permissioncache = forum_permissions(); }
|
$permissioncache = forum_permissions(); }
|
$password_forums = $unviewable = array();
| $unviewable = array();
|
foreach($forum_cache as $fid => $forum) { if($permissioncache[$forum['fid']])
| foreach($forum_cache as $fid => $forum) { if($permissioncache[$forum['fid']])
|
Zeile 4232 | Zeile 4403 |
---|
$pwverified = 1;
|
$pwverified = 1;
|
if($forum['password'] != "")
| if(!forum_password_validated($forum, true))
|
{
|
{
|
if($mybb->cookies['forumpass'][$forum['fid']] !== md5($mybb->user['uid'].$forum['password'])) { $pwverified = 0; }
$password_forums[$forum['fid']] = $forum['password'];
| $pwverified = 0;
|
} else {
| } else {
|
Zeile 4247 | Zeile 4414 |
---|
$parents = explode(",", $forum['parentlist']); foreach($parents as $parent) {
|
$parents = explode(",", $forum['parentlist']); foreach($parents as $parent) {
|
if(isset($password_forums[$parent]) && $mybb->cookies['forumpass'][$parent] !== md5($mybb->user['uid'].$password_forums[$parent]))
| if(!forum_password_validated($forum_cache[$parent], true))
|
{ $pwverified = 0;
|
{ $pwverified = 0;
|
| break;
|
} } }
| } } }
|
Zeile 4337 | Zeile 4505 |
---|
eval("\$nav .= \"".$templates->get("nav_bit")."\";"); } }
|
eval("\$nav .= \"".$templates->get("nav_bit")."\";"); } }
|
| $navsize = count($navbits); $navbit = $navbits[$navsize-1];
|
}
|
}
|
$activesep = ''; $navsize = count($navbits); $navbit = $navbits[$navsize-1];
| |
if($nav) {
| if($nav) {
|
Zeile 4589 | Zeile 4755 |
---|
echo "<td bgcolor=\"#FEFEFE\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">{$memory_usage}</span></td>\n"; echo "<td bgcolor=\"#EFEFEF\" width=\"25%\"><b><span style=\"font-family: tahoma; font-size: 12px;\">Memory Limit:</span></b></td>\n"; echo "<td bgcolor=\"#FEFEFE\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">{$memory_limit}</span></td>\n";
|
echo "<td bgcolor=\"#FEFEFE\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">{$memory_usage}</span></td>\n"; echo "<td bgcolor=\"#EFEFEF\" width=\"25%\"><b><span style=\"font-family: tahoma; font-size: 12px;\">Memory Limit:</span></b></td>\n"; echo "<td bgcolor=\"#FEFEFE\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">{$memory_limit}</span></td>\n";
|
echo "</tr>\n";
echo "</table>\n";
| echo "</tr>\n";
echo "</table>\n";
|
echo "<h2>Database Connections (".count($db->connections)." Total) </h2>\n"; echo "<table style=\"background-color: #666;\" width=\"95%\" cellpadding=\"4\" cellspacing=\"1\" align=\"center\">\n"; echo "<tr>\n";
| echo "<h2>Database Connections (".count($db->connections)." Total) </h2>\n"; echo "<table style=\"background-color: #666;\" width=\"95%\" cellpadding=\"4\" cellspacing=\"1\" align=\"center\">\n"; echo "<tr>\n";
|
Zeile 4600 | Zeile 4766 |
---|
echo "</tr>\n"; echo "</table>\n"; echo "<br />\n";
|
echo "</tr>\n"; echo "</table>\n"; echo "<br />\n";
|
|
|
echo "<h2>Database Queries (".$db->query_count." Total) </h2>\n"; echo $db->explain;
| echo "<h2>Database Queries (".$db->query_count." Total) </h2>\n"; echo $db->explain;
|
Zeile 4613 | Zeile 4779 |
---|
echo "<h2>Template Statistics</h2>\n";
if(count($templates->cache) > 0)
|
echo "<h2>Template Statistics</h2>\n";
if(count($templates->cache) > 0)
|
{ echo "<table style=\"background-color: #666;\" width=\"95%\" cellpadding=\"4\" cellspacing=\"1\" align=\"center\">\n"; echo "<tr>\n";
| { echo "<table style=\"background-color: #666;\" width=\"95%\" cellpadding=\"4\" cellspacing=\"1\" align=\"center\">\n"; echo "<tr>\n";
|
echo "<td style=\"background-color: #ccc;\"><strong>Templates Used (Loaded for this Page) - ".count($templates->cache)." Total</strong></td>\n";
|
echo "<td style=\"background-color: #ccc;\"><strong>Templates Used (Loaded for this Page) - ".count($templates->cache)." Total</strong></td>\n";
|
echo "</tr>\n"; echo "<tr>\n"; echo "<td style=\"background: #fff;\">".implode(", ", array_keys($templates->cache))."</td>\n"; echo "</tr>\n"; echo "</table>\n";
| echo "</tr>\n"; echo "<tr>\n"; echo "<td style=\"background: #fff;\">".implode(", ", array_keys($templates->cache))."</td>\n"; echo "</tr>\n"; echo "</table>\n";
|
echo "<br />\n"; }
| echo "<br />\n"; }
|
Zeile 4650 | Zeile 4816 |
---|
global $mybb;
if($mybb->settings['nocacheheaders'] == 1)
|
global $mybb;
if($mybb->settings['nocacheheaders'] == 1)
|
{ header("Expires: Sat, 1 Jan 2000 01:00:00 GMT"); header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); header("Cache-Control: no-cache, must-revalidate"); header("Pragma: no-cache");
| { header("Cache-Control: no-cache, private");
|
} }
| } }
|
Zeile 4676 | Zeile 4839 |
---|
$rids = implode($id, "','"); $rids = "'0','$rids'"; $db->update_query("reportedcontent", array('reportstatus' => 1), "id IN($rids) AND reportstatus='0' AND (type = 'post' OR type = '')");
|
$rids = implode($id, "','"); $rids = "'0','$rids'"; $db->update_query("reportedcontent", array('reportstatus' => 1), "id IN($rids) AND reportstatus='0' AND (type = 'post' OR type = '')");
|
}
| }
|
break; case "post": $db->update_query("reportedcontent", array('reportstatus' => 1), "id='$id' AND reportstatus='0' AND (type = 'post' OR type = '')");
| break; case "post": $db->update_query("reportedcontent", array('reportstatus' => 1), "id='$id' AND reportstatus='0' AND (type = 'post' OR type = '')");
|
Zeile 4691 | Zeile 4854 |
---|
break; case "thread": $db->update_query("reportedcontent", array('reportstatus' => 1), "id2='$id' AND reportstatus='0' AND (type = 'post' OR type = '')");
|
break; case "thread": $db->update_query("reportedcontent", array('reportstatus' => 1), "id2='$id' AND reportstatus='0' AND (type = 'post' OR type = '')");
|
break;
| break;
|
case "forum": $db->update_query("reportedcontent", array('reportstatus' => 1), "id3='$id' AND reportstatus='0' AND (type = 'post' OR type = '')"); break;
| case "forum": $db->update_query("reportedcontent", array('reportstatus' => 1), "id3='$id' AND reportstatus='0' AND (type = 'post' OR type = '')"); break;
|
Zeile 4713 | Zeile 4876 |
---|
* @return string The friendly formatted timestamp */ function nice_time($stamp, $options=array())
|
* @return string The friendly formatted timestamp */ function nice_time($stamp, $options=array())
|
{
| {
|
global $lang;
$ysecs = 365*24*60*60;
| global $lang;
$ysecs = 365*24*60*60;
|
Zeile 4777 | Zeile 4940 |
---|
{ $options = array_merge(array( 'days' => false,
|
{ $options = array_merge(array( 'days' => false,
|
'hours' => false,
| 'hours' => false,
|
'minutes' => false, 'seconds' => false ), $options);
| 'minutes' => false, 'seconds' => false ), $options);
|
Zeile 4809 | Zeile 4972 |
---|
if($years == 1) { $nicetime['years'] = "1".$lang_year;
|
if($years == 1) { $nicetime['years'] = "1".$lang_year;
|
}
| }
|
else if($years > 1)
|
else if($years > 1)
|
{
| {
|
$nicetime['years'] = $years.$lang_years;
|
$nicetime['years'] = $years.$lang_years;
|
}
| }
|
}
if(!isset($options['months']) || $options['months'] !== false) { if($months == 1)
|
}
if(!isset($options['months']) || $options['months'] !== false) { if($months == 1)
|
{
| {
|
$nicetime['months'] = "1".$lang_month; } else if($months > 1) { $nicetime['months'] = $months.$lang_months;
|
$nicetime['months'] = "1".$lang_month; } else if($months > 1) { $nicetime['months'] = $months.$lang_months;
|
} }
| } }
|
if(!isset($options['weeks']) || $options['weeks'] !== false) { if($weeks == 1)
|
if(!isset($options['weeks']) || $options['weeks'] !== false) { if($weeks == 1)
|
{
| {
|
$nicetime['weeks'] = "1".$lang_week;
|
$nicetime['weeks'] = "1".$lang_week;
|
}
| }
|
else if($weeks > 1) { $nicetime['weeks'] = $weeks.$lang_weeks;
| else if($weeks > 1) { $nicetime['weeks'] = $weeks.$lang_weeks;
|
Zeile 4841 | Zeile 5004 |
---|
}
if(!isset($options['days']) || $options['days'] !== false)
|
}
if(!isset($options['days']) || $options['days'] !== false)
|
{
| {
|
if($days == 1)
|
if($days == 1)
|
{
| {
|
$nicetime['days'] = "1".$lang_day; } else if($days > 1)
| $nicetime['days'] = "1".$lang_day; } else if($days > 1)
|
Zeile 4853 | Zeile 5016 |
---|
}
if(!isset($options['hours']) || $options['hours'] !== false)
|
}
if(!isset($options['hours']) || $options['hours'] !== false)
|
{
| {
|
if($hours == 1) { $nicetime['hours'] = "1".$lang_hour;
| if($hours == 1) { $nicetime['hours'] = "1".$lang_hour;
|
Zeile 4879 | Zeile 5042 |
---|
if(!isset($options['seconds']) || $options['seconds'] !== false) { if($seconds == 1)
|
if(!isset($options['seconds']) || $options['seconds'] !== false) { if($seconds == 1)
|
{
| {
|
$nicetime['seconds'] = "1".$lang_second;
|
$nicetime['seconds'] = "1".$lang_second;
|
}
| }
|
else if($seconds > 1) { $nicetime['seconds'] = $seconds.$lang_seconds; }
|
else if($seconds > 1) { $nicetime['seconds'] = $seconds.$lang_seconds; }
|
}
| }
|
if(is_array($nicetime)) { return implode(", ", $nicetime);
|
if(is_array($nicetime)) { return implode(", ", $nicetime);
|
} }
| } }
|
/** * Select an alternating row colour based on the previous call to this function
| /** * Select an alternating row colour based on the previous call to this function
|
Zeile 4905 | Zeile 5068 |
---|
global $alttrow;
if($alttrow == "trow1" && !$reset)
|
global $alttrow;
if($alttrow == "trow1" && !$reset)
|
{
| {
|
$trow = "trow2"; } else
| $trow = "trow2"; } else
|
Zeile 4940 | Zeile 5103 |
---|
}
// Build the new list of additional groups for this user and make sure they're in the right format
|
}
// Build the new list of additional groups for this user and make sure they're in the right format
|
$usergroups = ""; $usergroups = $user['additionalgroups'].",".$joingroup; $groupslist = ""; $groups = explode(",", $usergroups);
| $groups = array_map( 'intval', explode(',', $user['additionalgroups']) );
if(!in_array((int)$joingroup, $groups)) { $groups[] = (int)$joingroup; $groups = array_diff($groups, array($user['usergroup'])); $groups = array_unique($groups);
|
|
|
if(is_array($groups)) { $comma = ''; foreach($groups as $gid) { if(trim($gid) != "" && $gid != $user['usergroup'] && !isset($donegroup[$gid])) { $groupslist .= $comma.$gid; $comma = ","; $donegroup[$gid] = 1; } } }
| $groupslist = implode(',', $groups);
|
|
|
// What's the point in updating if they're the same? if($groupslist != $user['additionalgroups']) {
| |
$db->update_query("users", array('additionalgroups' => $groupslist), "uid='".(int)$uid."'"); return true; }
| $db->update_query("users", array('additionalgroups' => $groupslist), "uid='".(int)$uid."'"); return true; }
|
Zeile 4983 | Zeile 5137 |
---|
$user = get_user($uid);
|
$user = get_user($uid);
|
$groupslist = $comma = ''; $usergroups = $user['additionalgroups'].","; $donegroup = array();
| if($user['usergroup'] == $leavegroup) { return false; }
$groups = array_map( 'intval', explode(',', $user['additionalgroups']) ); $groups = array_diff($groups, array($leavegroup)); $groups = array_unique($groups);
|
|
|
$groups = explode(",", $user['additionalgroups']);
if(is_array($groups)) { foreach($groups as $gid) { if(trim($gid) != "" && $leavegroup != $gid && empty($donegroup[$gid])) { $groupslist .= $comma.$gid; $comma = ","; $donegroup[$gid] = 1; } } }
| $groupslist = implode(',', $groups);
|
$dispupdate = ""; if($leavegroup == $user['displaygroup']) { $dispupdate = ", displaygroup=usergroup";
|
$dispupdate = ""; if($leavegroup == $user['displaygroup']) { $dispupdate = ", displaygroup=usergroup";
|
}
| }
|
$db->write_query(" UPDATE ".TABLE_PREFIX."users
| $db->write_query(" UPDATE ".TABLE_PREFIX."users
|
Zeile 5021 | Zeile 5170 |
---|
* Get the current location taking in to account different web serves and systems * * @param boolean $fields True to return as "hidden" fields
|
* Get the current location taking in to account different web serves and systems * * @param boolean $fields True to return as "hidden" fields
|
* @param array $ignore Array of fields to ignore if first argument is true
| * @param array $ignore Array of fields to ignore for returning "hidden" fields or URL being accessed
|
* @param boolean $quick True to skip all inputs and return only the file path part of the URL
|
* @param boolean $quick True to skip all inputs and return only the file path part of the URL
|
* @return string The current URL being accessed
| * @return string|array The current URL being accessed or form data if $fields is true
|
*/ function get_current_location($fields=false, $ignore=array(), $quick=false) {
|
*/ function get_current_location($fields=false, $ignore=array(), $quick=false) {
|
| global $mybb;
|
if(defined("MYBB_LOCATION")) { return MYBB_LOCATION;
| if(defined("MYBB_LOCATION")) { return MYBB_LOCATION;
|
Zeile 5058 | Zeile 5209 |
---|
return $location; }
|
return $location; }
|
if($fields == true)
| if(!is_array($ignore)) { $ignore = array($ignore); }
if($fields == true)
|
{
|
{
|
global $mybb;
if(!is_array($ignore)) { $ignore = array($ignore); }
| |
$form_html = ''; if(!empty($mybb->input))
| $form_html = ''; if(!empty($mybb->input))
|
Zeile 5076 | Zeile 5226 |
---|
{ continue; }
|
{ 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";
|
} }
| } }
|
return array('location' => $location, 'form_html' => $form_html, 'form_method' => $mybb->request_method); } else {
|
return array('location' => $location, 'form_html' => $form_html, 'form_method' => $mybb->request_method); } else {
|
| $parameters = array();
|
if(isset($_SERVER['QUERY_STRING']))
|
if(isset($_SERVER['QUERY_STRING']))
|
{ $location .= "?".htmlspecialchars_uni($_SERVER['QUERY_STRING']); }
| { $current_query_string = $_SERVER['QUERY_STRING']; }
|
else if(isset($_ENV['QUERY_STRING'])) {
|
else if(isset($_ENV['QUERY_STRING'])) {
|
$location .= "?".htmlspecialchars_uni($_ENV['QUERY_STRING']);
| $current_query_string = $_ENV['QUERY_STRING']; } else { $current_query_string = ''; }
parse_str($current_query_string, $current_parameters);
foreach($current_parameters as $name => $value) { if(!in_array($name, $ignore)) { $parameters[$name] = $value; }
|
}
|
}
|
if((isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == "POST") || (isset($_ENV['REQUEST_METHOD']) && $_ENV['REQUEST_METHOD'] == "POST"))
| if($mybb->request_method === 'post')
|
{ $post_array = array('action', 'fid', 'pid', 'tid', 'uid', 'eid');
foreach($post_array as $var) {
|
{ $post_array = array('action', 'fid', 'pid', 'tid', 'uid', 'eid');
foreach($post_array as $var) {
|
if(isset($_POST[$var]))
| if(isset($_POST[$var]) && !in_array($var, $ignore))
|
{
|
{
|
$addloc[] = urlencode($var).'='.urlencode($_POST[$var]);
| $parameters[$var] = $_POST[$var];
|
} }
|
} }
|
| }
|
|
|
if(isset($addloc) && is_array($addloc)) { if(strpos($location, "?") === false) { $location .= "?"; } else { $location .= "&"; } $location .= implode("&", $addloc); }
| if(!empty($parameters)) { $location .= '?'.http_build_query($parameters, '', '&');
|
}
return $location;
| }
return $location;
|
Zeile 5259 | Zeile 5416 |
---|
$message = str_replace("<", "<", $message); $message = str_replace(">", ">", $message); $message = str_replace("\"", """, $message);
|
$message = str_replace("<", "<", $message); $message = str_replace(">", ">", $message); $message = str_replace("\"", """, $message);
|
return $message;
| return $message;
|
}
/**
| }
/**
|
Zeile 5513 | Zeile 5670 |
---|
'F', 'l', 'M',
|
'F', 'l', 'M',
|
);
| );
|
$bdays = str_replace($find, $html, $bdays); $bmonth = str_replace($find, $html, $bmonth);
| $bdays = str_replace($find, $html, $bdays); $bmonth = str_replace($find, $html, $bmonth);
|
Zeile 5751 | Zeile 5908 |
---|
}
return $string;
|
}
return $string;
|
| }
/** * Finds a needle in a haystack and returns it position, mb strings accounted for, case insensitive * * @param string $haystack String to look in (haystack) * @param string $needle What to look for (needle) * @param int $offset (optional) How much to offset * @return int|bool false on needle not found, integer position if found */ function my_stripos($haystack, $needle, $offset=0) { if($needle == '') { return false; }
if(function_exists("mb_stripos")) { $position = mb_stripos($haystack, $needle, $offset); } else { $position = stripos($haystack, $needle, $offset); }
return $position;
|
}
/**
| }
/**
|
Zeile 5764 | Zeile 5948 |
---|
function my_strpos($haystack, $needle, $offset=0) { if($needle == '')
|
function my_strpos($haystack, $needle, $offset=0) { if($needle == '')
|
{ return false; }
| { return false; }
|
if(function_exists("mb_strpos")) { $position = mb_strpos($haystack, $needle, $offset);
| if(function_exists("mb_strpos")) { $position = mb_strpos($haystack, $needle, $offset);
|
Zeile 5798 | Zeile 5982 |
---|
}
return $string;
|
}
return $string;
|
}
| }
|
/** * Returns any html entities to their original character *
| /** * Returns any html entities to their original character *
|
Zeile 5815 | Zeile 5999 |
---|
// Replace literal entities $trans_tbl = get_html_translation_table(HTML_ENTITIES); $trans_tbl = array_flip($trans_tbl);
|
// Replace literal entities $trans_tbl = get_html_translation_table(HTML_ENTITIES); $trans_tbl = array_flip($trans_tbl);
|
|
|
return strtr($string, $trans_tbl); }
| return strtr($string, $trans_tbl); }
|
Zeile 5861 | Zeile 6045 |
---|
function unichr_callback1($matches) { return unichr(hexdec($matches[1]));
|
function unichr_callback1($matches) { return unichr(hexdec($matches[1]));
|
}
/**
| }
/**
|
* Returns any ascii to it's character (utf-8 safe).
|
* Returns any ascii to it's character (utf-8 safe).
|
*
| *
|
* @param array $matches Matches. * @return string|bool The characterized ascii. False on failure */
| * @param array $matches Matches. * @return string|bool The characterized ascii. False on failure */
|
Zeile 5879 | Zeile 6063 |
---|
* * @param array $event The event data array. * @return string The link to the event poster.
|
* * @param array $event The event data array. * @return string The link to the event poster.
|
*/
| */
|
function get_event_poster($event) { $event['username'] = htmlspecialchars_uni($event['username']);
| function get_event_poster($event) { $event['username'] = htmlspecialchars_uni($event['username']);
|
Zeile 5895 | Zeile 6079 |
---|
* @return string The event date. */ function get_event_date($event)
|
* @return string The event date. */ function get_event_date($event)
|
{
| {
|
global $mybb;
$event_date = explode("-", $event['date']);
| global $mybb;
$event_date = explode("-", $event['date']);
|
Zeile 5927 | Zeile 6111 |
---|
{ $link = str_replace("{aid}", $aid, ANNOUNCEMENT_URL); return htmlspecialchars_uni($link);
|
{ $link = str_replace("{aid}", $aid, ANNOUNCEMENT_URL); return htmlspecialchars_uni($link);
|
}
| }
|
/** * Build the profile link.
| /** * Build the profile link.
|
Zeile 5943 | Zeile 6127 |
---|
global $mybb, $lang;
if(!$username && $uid == 0)
|
global $mybb, $lang;
if(!$username && $uid == 0)
|
{
| {
|
// Return Guest phrase for no UID, no guest nickname return htmlspecialchars_uni($lang->guest);
|
// Return Guest phrase for no UID, no guest nickname return htmlspecialchars_uni($lang->guest);
|
}
| }
|
elseif($uid == 0)
|
elseif($uid == 0)
|
{
| {
|
// Return the guest's nickname if user is a guest but has a nickname return $username; }
| // Return the guest's nickname if user is a guest but has a nickname return $username; }
|
Zeile 5958 | Zeile 6142 |
---|
if(!empty($target)) { $target = " target=\"{$target}\"";
|
if(!empty($target)) { $target = " target=\"{$target}\"";
|
}
| }
|
if(!empty($onclick)) { $onclick = " onclick=\"{$onclick}\"";
| if(!empty($onclick)) { $onclick = " onclick=\"{$onclick}\"";
|
Zeile 5975 | Zeile 6159 |
---|
* @param int $fid The forum id of the forum. * @param int $page (Optional) The page number of the forum. * @return string The url to the forum.
|
* @param int $fid The forum id of the forum. * @param int $page (Optional) The page number of the forum. * @return string The url to the forum.
|
*/
| */
|
function get_forum_link($fid, $page=0) { if($page > 0)
| function get_forum_link($fid, $page=0) { if($page > 0)
|
Zeile 6002 | Zeile 6186 |
---|
function get_thread_link($tid, $page=0, $action='') { if($page > 1)
|
function get_thread_link($tid, $page=0, $action='') { if($page > 1)
|
{ if($action) { $link = THREAD_URL_ACTION; $link = str_replace("{action}", $action, $link); } else
| { if($action) { $link = THREAD_URL_ACTION; $link = str_replace("{action}", $action, $link); } else
|
{ $link = THREAD_URL_PAGED; }
| { $link = THREAD_URL_PAGED; }
|
Zeile 6022 | Zeile 6206 |
---|
{ $link = THREAD_URL_ACTION; $link = str_replace("{action}", $action, $link);
|
{ $link = THREAD_URL_ACTION; $link = str_replace("{action}", $action, $link);
|
}
| }
|
else { $link = THREAD_URL;
| else { $link = THREAD_URL;
|
Zeile 6224 | Zeile 6408 |
---|
global $cache; static $forum_cache;
|
global $cache; static $forum_cache;
|
if(!isset($forum_cache) || is_array($forum_cache))
| if(!isset($forum_cache) || !is_array($forum_cache))
|
{ $forum_cache = $cache->read("forums"); }
| { $forum_cache = $cache->read("forums"); }
|
Zeile 6386 | Zeile 6570 |
---|
} // 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 6427 | Zeile 6611 |
---|
// Are we still locked out? if($attempts['loginlockoutexpiry'] > $now)
|
// Are we still locked out? if($attempts['loginlockoutexpiry'] > $now)
|
{
| {
|
if($fatal) { $secsleft = (int)($attempts['loginlockoutexpiry'] - $now);
| if($fatal) { $secsleft = (int)($attempts['loginlockoutexpiry'] - $now);
|
Zeile 6460 | Zeile 6644 |
---|
// User can attempt another login return $attempts['loginattempts'];
|
// User can attempt another login return $attempts['loginattempts'];
|
}
| }
|
/** * Validates the format of an email address.
| /** * Validates the format of an email address.
|
Zeile 6471 | Zeile 6655 |
---|
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 6516 | Zeile 6700 |
---|
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 6784 | Zeile 6970 |
---|
$banned_ips = $cache->read("bannedips"); if(!is_array($banned_ips))
|
$banned_ips = $cache->read("bannedips"); if(!is_array($banned_ips))
|
{ return false; }
| { return false; }
|
$ip_address = my_inet_pton($ip_address); foreach($banned_ips as $banned_ip) {
| $ip_address = my_inet_pton($ip_address); foreach($banned_ips as $banned_ip) {
|
Zeile 6957 | Zeile 7143 |
---|
$url_components['scheme'] = 'https'; } if(!isset($url_components['port']))
|
$url_components['scheme'] = 'https'; } if(!isset($url_components['port']))
|
{
| {
|
$url_components['port'] = $url_components['scheme'] == 'https' ? 443 : 80; }
| $url_components['port'] = $url_components['scheme'] == 'https' ? 443 : 80; }
|
Zeile 6968 | Zeile 7154 |
---|
(!in_array($url_components['port'], array(80, 8080, 443))) || (!empty($config['disallowed_remote_hosts']) && in_array($url_components['host'], $config['disallowed_remote_hosts'])) )
|
(!in_array($url_components['port'], array(80, 8080, 443))) || (!empty($config['disallowed_remote_hosts']) && in_array($url_components['host'], $config['disallowed_remote_hosts'])) )
|
{
| {
|
return false; }
| return false; }
|
Zeile 6984 | Zeile 7170 |
---|
$packed_address = my_inet_pton($destination_address);
if(is_array($ip_range))
|
$packed_address = my_inet_pton($destination_address);
if(is_array($ip_range))
|
{
| {
|
if(strcmp($ip_range[0], $packed_address) <= 0 && strcmp($ip_range[1], $packed_address) >= 0) { return false; }
|
if(strcmp($ip_range[0], $packed_address) <= 0 && strcmp($ip_range[1], $packed_address) >= 0) { return false; }
|
}
| }
|
elseif($destination_address == $disallowed_address) { return false;
| elseif($destination_address == $disallowed_address) { return false;
|
Zeile 6999 | Zeile 7185 |
---|
$post_body = ''; if(!empty($post_data))
|
$post_body = ''; if(!empty($post_data))
|
{
| {
|
foreach($post_data as $key => $val) { $post_body .= '&'.urlencode($key).'='.urlencode($val);
| foreach($post_data as $key => $val) { $post_body .= '&'.urlencode($key).'='.urlencode($val);
|
Zeile 7010 | Zeile 7196 |
---|
if(function_exists("curl_init")) { $fetch_header = $max_redirects > 0;
|
if(function_exists("curl_init")) { $fetch_header = $max_redirects > 0;
|
|
|
$ch = curl_init();
$curlopt = array(
| $ch = curl_init();
$curlopt = array(
|
Zeile 7042 | Zeile 7228 |
---|
); } elseif(version_compare(PHP_VERSION, '5.5', '>=') && version_compare($curl_version, '7.21.3', '>='))
|
); } elseif(version_compare(PHP_VERSION, '5.5', '>=') && version_compare($curl_version, '7.21.3', '>='))
|
{
| {
|
// CURLOPT_RESOLVE $curlopt[10203] = array( $url_components['host'].':'.$url_components['port'].':'.$destination_address
| // CURLOPT_RESOLVE $curlopt[10203] = array( $url_components['host'].':'.$url_components['port'].':'.$destination_address
|
Zeile 7067 | Zeile 7253 |
---|
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 7128 | Zeile 7314 |
---|
'ssl' => array( 'verify_peer' => false, 'verify_peer_name' => false,
|
'ssl' => array( 'verify_peer' => false, 'verify_peer_name' => false,
|
| 'peer_name' => $url_components['host'],
|
), )); }
| ), )); }
|
Zeile 7192 | Zeile 7379 |
---|
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 7599 | Zeile 7786 |
---|
* @param array $array The array of forums * @return integer The number of sub forums */
|
* @param array $array The array of forums * @return integer The number of sub forums */
|
function subforums_count($array)
| function subforums_count($array=array())
|
{ $count = 0; foreach($array as $array2)
| { $count = 0; foreach($array as $array2)
|
Zeile 8693 | Zeile 8880 |
---|
if(file_exists($file_path)) {
|
if(file_exists($file_path)) {
|
| if(is_object($plugins)) { $hook_args = array( 'file_path' => &$file_path, 'real_file_path' => &$real_file_path, 'file_name' => &$file_name, 'file_dir_path' => &$file_dir_path ); $plugins->run_hooks('copy_file_to_cdn_start', $hook_args); }
|
if($mybb->settings['usecdn'] && !empty($mybb->settings['cdnpath'])) { $cdn_path = rtrim($mybb->settings['cdnpath'], '/\\');
| if($mybb->settings['usecdn'] && !empty($mybb->settings['cdnpath'])) { $cdn_path = rtrim($mybb->settings['cdnpath'], '/\\');
|
Zeile 8742 | Zeile 8941 |
---|
/** * Validate an url
|
/** * Validate an url
|
*
| *
|
* @param string $url The url to validate. * @param bool $relative_path Whether or not the url could be a relative path. * @param bool $allow_local Whether or not the url could be pointing to local networks.
| * @param string $url The url to validate. * @param bool $relative_path Whether or not the url could be a relative path. * @param bool $allow_local Whether or not the url could be pointing to local networks.
|
Zeile 8752 | Zeile 8951 |
---|
function my_validate_url($url, $relative_path=false, $allow_local=false) { if($allow_local)
|
function my_validate_url($url, $relative_path=false, $allow_local=false) { if($allow_local)
|
{
| {
|
$regex = '_^(?:(?:https?|ftp)://)(?:\S+(?::\S*)?@)?(?:(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:localhost|(?:(?:[a-z\x{00a1}-\x{ffff}0-9]-*)*[a-z\x{00a1}-\x{ffff}0-9]+)(?:\.(?:[a-z\x{00a1}-\x{ffff}0-9]-*)*[a-z\x{00a1}-\x{ffff}0-9]+)*(?:\.(?:[a-z\x{00a1}-\x{ffff}]{2,}))\.?))(?::\d{2,5})?(?:[/?#]\S*)?$_iuS'; } else { $regex = '_^(?:(?:https?|ftp)://)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\x{00a1}-\x{ffff}0-9]-*)*[a-z\x{00a1}-\x{ffff}0-9]+)(?:\.(?:[a-z\x{00a1}-\x{ffff}0-9]-*)*[a-z\x{00a1}-\x{ffff}0-9]+)*(?:\.(?:[a-z\x{00a1}-\x{ffff}]{2,}))\.?)(?::\d{2,5})?(?:[/?#]\S*)?$_iuS';
|
$regex = '_^(?:(?:https?|ftp)://)(?:\S+(?::\S*)?@)?(?:(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:localhost|(?:(?:[a-z\x{00a1}-\x{ffff}0-9]-*)*[a-z\x{00a1}-\x{ffff}0-9]+)(?:\.(?:[a-z\x{00a1}-\x{ffff}0-9]-*)*[a-z\x{00a1}-\x{ffff}0-9]+)*(?:\.(?:[a-z\x{00a1}-\x{ffff}]{2,}))\.?))(?::\d{2,5})?(?:[/?#]\S*)?$_iuS'; } else { $regex = '_^(?:(?:https?|ftp)://)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\x{00a1}-\x{ffff}0-9]-*)*[a-z\x{00a1}-\x{ffff}0-9]+)(?:\.(?:[a-z\x{00a1}-\x{ffff}0-9]-*)*[a-z\x{00a1}-\x{ffff}0-9]+)*(?:\.(?:[a-z\x{00a1}-\x{ffff}]{2,}))\.?)(?::\d{2,5})?(?:[/?#]\S*)?$_iuS';
|
}
| }
|
if($relative_path && my_substr($url, 0, 1) == '/' || preg_match($regex, $url)) {
| if($relative_path && my_substr($url, 0, 1) == '/' || preg_match($regex, $url)) {
|
Zeile 8769 | Zeile 8968 |
---|
/** * 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 * * @return string Striped string
|
* @deprecated * @param string $string String to stripe * @param string $allowable_tags Allowed html tags * * @return string Striped string
|
*/
| */
|
function my_strip_tags($string, $allowable_tags = '') { $pattern = array(
| function my_strip_tags($string, $allowable_tags = '') { $pattern = array(
|
Zeile 8791 | Zeile 8990 |
---|
/** * Escapes a RFC 4180-compliant CSV string. * Based on https://github.com/Automattic/camptix/blob/f80725094440bf09861383b8f11e96c177c45789/camptix.php#L2867
|
/** * Escapes a RFC 4180-compliant CSV string. * Based on https://github.com/Automattic/camptix/blob/f80725094440bf09861383b8f11e96c177c45789/camptix.php#L2867
|
*
| *
|
* @param string $string The string to be escaped * @param boolean $escape_active_content Whether or not to escape active content trigger characters * @return string The escaped string
| * @param string $string The string to be escaped * @param boolean $escape_active_content Whether or not to escape active content trigger characters * @return string The escaped string
|
Zeile 8825 | Zeile 9024 |
---|
$string = str_replace('"', '""', $string);
return $string;
|
$string = str_replace('"', '""', $string);
return $string;
|
| }
// Fallback function for 'array_column', PHP < 5.5.0 compatibility if(!function_exists('array_column')) { function array_column($input, $column_key) { $values = array(); if(!is_array($input)) { $input = array($input); } foreach($input as $val) { if(is_array($val) && isset($val[$column_key])) { $values[] = $val[$column_key]; } elseif(is_object($val) && isset($val->$column_key)) { $values[] = $val->$column_key; } } return $values; } }
/** * Performs a timing attack safe string comparison. * * @param string $known_string The first string to be compared. * @param string $user_string The second, user-supplied string to be compared. * @return bool Result of the comparison. */ function my_hash_equals($known_string, $user_string) { if(version_compare(PHP_VERSION, '5.6.0', '>=')) { return hash_equals($known_string, $user_string); } else { $known_string_length = my_strlen($known_string); $user_string_length = my_strlen($user_string);
if($user_string_length != $known_string_length) { return false; }
$result = 0;
for($i = 0; $i < $known_string_length; $i++) { $result |= ord($known_string[$i]) ^ ord($user_string[$i]); }
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;
|
}
| }
|