Zeile 21 | Zeile 21 |
---|
$contents = parse_page($contents); $totaltime = $maintimer->stop();
|
$contents = parse_page($contents); $totaltime = $maintimer->stop();
|
| $contents = $plugins->run_hooks("pre_output_page", $contents);
|
if($mybb->usergroup['cancp'] == 1) {
| if($mybb->usergroup['cancp'] == 1) {
|
Zeile 83 | Zeile 84 |
---|
$other = "PHP version: $phpversion / Server Load: $serverload / GZip Compression: $gzipen"; $debugstuff = "Generated in $totaltime seconds ($percentphp% PHP / $percentsql% ".$database_server.")<br />SQL Queries: $db->query_count / Global Parsing Time: $globaltime$memory_usage<br />$other<br />[<a href=\"$debuglink\" target=\"_blank\">advanced details</a>]<br />"; $contents = str_replace("<debugstuff>", $debugstuff, $contents);
|
$other = "PHP version: $phpversion / Server Load: $serverload / GZip Compression: $gzipen"; $debugstuff = "Generated in $totaltime seconds ($percentphp% PHP / $percentsql% ".$database_server.")<br />SQL Queries: $db->query_count / Global Parsing Time: $globaltime$memory_usage<br />$other<br />[<a href=\"$debuglink\" target=\"_blank\">advanced details</a>]<br />"; $contents = str_replace("<debugstuff>", $debugstuff, $contents);
|
}
| }
|
if($mybb->debug_mode == true) {
| if($mybb->debug_mode == true) {
|
Zeile 92 | Zeile 93 |
---|
}
$contents = str_replace("<debugstuff>", "", $contents);
|
}
$contents = str_replace("<debugstuff>", "", $contents);
|
$contents = $plugins->run_hooks("pre_output_page", $contents);
| |
if($mybb->settings['gzipoutput'] == 1) {
| if($mybb->settings['gzipoutput'] == 1) {
|
Zeile 213 | Zeile 213 |
---|
require_once MYBB_ROOT."inc/class_plugins.php"; $plugins = new pluginSystem; $plugins->load();
|
require_once MYBB_ROOT."inc/class_plugins.php"; $plugins = new pluginSystem; $plugins->load();
|
}
| }
|
// We have some shutdown queries needing to be run if(is_array($shutdown_queries)) {
| // We have some shutdown queries needing to be run if(is_array($shutdown_queries)) {
|
Zeile 262 | Zeile 262 |
---|
{ // Delete the message from the queue $db->delete_query("mailqueue", "mid='{$email['mid']}'");
|
{ // Delete the message from the queue $db->delete_query("mailqueue", "mid='{$email['mid']}'");
|
|
|
if($db->affected_rows() == 1) { my_mail($email['mailto'], $email['subject'], $email['message'], $email['mailfrom'], "", $email['headers'], true);
| if($db->affected_rows() == 1) { my_mail($email['mailto'], $email['subject'], $email['message'], $email['mailfrom'], "", $email['headers'], true);
|
Zeile 274 | Zeile 274 |
---|
$plugins->run_hooks("send_mail_queue_end"); }
|
$plugins->run_hooks("send_mail_queue_end"); }
|
|
|
/** * Parses the contents of a page before outputting it. *
| /** * Parses the contents of a page before outputting it. *
|
Zeile 295 | Zeile 295 |
---|
else { $contents = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n".$contents;
|
else { $contents = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n".$contents;
|
}
$contents = str_replace("<html", "<html xmlns=\"http://www.w3.org/1999/xhtml\"", $contents);
| }
$contents = str_replace("<html", "<html xmlns=\"http://www.w3.org/1999/xhtml\"", $contents);
|
if($lang->settings['rtl'] == 1)
|
if($lang->settings['rtl'] == 1)
|
{
| {
|
$contents = str_replace("<html", "<html dir=\"rtl\"", $contents);
|
$contents = str_replace("<html", "<html dir=\"rtl\"", $contents);
|
}
| }
|
if($lang->settings['htmllang']) { $contents = str_replace("<html", "<html xml:lang=\"".$lang->settings['htmllang']."\" lang=\"".$lang->settings['htmllang']."\"", $contents); }
if($error_handler->warnings)
|
if($lang->settings['htmllang']) { $contents = str_replace("<html", "<html xml:lang=\"".$lang->settings['htmllang']."\" lang=\"".$lang->settings['htmllang']."\"", $contents); }
if($error_handler->warnings)
|
{
| {
|
$contents = str_replace("<body>", "<body>\n".$error_handler->show_warnings(), $contents); }
| $contents = str_replace("<body>", "<body>\n".$error_handler->show_warnings(), $contents); }
|
Zeile 504 | Zeile 504 |
---|
if($silent == true) { return false;
|
if($silent == true) { return false;
|
}
| }
|
else { if(defined("IN_ADMINCP"))
| else { if(defined("IN_ADMINCP"))
|
Zeile 743 | Zeile 743 |
---|
"location2" => 0 );
|
"location2" => 0 );
|
$db->update_query("sessions", $noperm_array, "sid='{$session->sid}'", 1);
| $db->update_query("sessions", $noperm_array, "sid='{$session->sid}'");
|
if($mybb->input['ajax']) {
| if($mybb->input['ajax']) {
|
Zeile 795 | Zeile 795 |
---|
* * @param string The URL to redirect the user to * @param string The redirection message to be shown
|
* * @param string The URL to redirect the user to * @param string The redirection message to be shown
|
*/
| */
|
function redirect($url, $message="", $title="") { global $header, $footer, $mybb, $theme, $headerinclude, $templates, $lang, $plugins;
| function redirect($url, $message="", $title="") { global $header, $footer, $mybb, $theme, $headerinclude, $templates, $lang, $plugins;
|
Zeile 819 | Zeile 819 |
---|
echo 'window.location = "'.addslashes($url).'";'."\n"; echo "</script>\n"; exit;
|
echo 'window.location = "'.addslashes($url).'";'."\n"; echo "</script>\n"; exit;
|
}
| }
|
if(!$message)
|
if(!$message)
|
{
| {
|
$message = $lang->redirect; }
|
$message = $lang->redirect; }
|
|
|
$time = TIME_NOW; $timenow = my_date($mybb->settings['dateformat'], $time) . " " . my_date($mybb->settings['timeformat'], $time);
if(!$title) { $title = $mybb->settings['bbname'];
|
$time = TIME_NOW; $timenow = my_date($mybb->settings['dateformat'], $time) . " " . my_date($mybb->settings['timeformat'], $time);
if(!$title) { $title = $mybb->settings['bbname'];
|
}
| }
|
// Show redirects only if both ACP and UCP settings are enabled, or ACP is enabled, and user is a guest. if($mybb->settings['redirects'] == 1 && ($mybb->user['showredirect'] != 0 || !$mybb->user['uid']))
| // Show redirects only if both ACP and UCP settings are enabled, or ACP is enabled, and user is a guest. if($mybb->settings['redirects'] == 1 && ($mybb->user['showredirect'] != 0 || !$mybb->user['uid']))
|
Zeile 844 | Zeile 844 |
---|
output_page($redirectpage); } else
|
output_page($redirectpage); } else
|
{
| {
|
$url = htmlspecialchars_decode($url); $url = str_replace(array("\n","\r",";"), "", $url);
| $url = htmlspecialchars_decode($url); $url = str_replace(array("\n","\r",";"), "", $url);
|
Zeile 880 | Zeile 880 |
---|
{ return; }
|
{ return; }
|
|
|
$url = str_replace("&", "&", $url); $url = htmlspecialchars_uni($url);
|
$url = str_replace("&", "&", $url); $url = htmlspecialchars_uni($url);
|
|
|
$pages = ceil($count / $perpage);
$prevpage = '';
| $pages = ceil($count / $perpage);
$prevpage = '';
|
Zeile 892 | Zeile 892 |
---|
$prev = $page-1; $page_url = fetch_page_url($url, $prev); eval("\$prevpage = \"".$templates->get("multipage_prevpage")."\";");
|
$prev = $page-1; $page_url = fetch_page_url($url, $prev); eval("\$prevpage = \"".$templates->get("multipage_prevpage")."\";");
|
}
| }
|
// Maximum number of "page bits" to show if(!$mybb->settings['maxmultipagelinks'])
| // Maximum number of "page bits" to show if(!$mybb->settings['maxmultipagelinks'])
|
Zeile 916 | Zeile 916 |
---|
if($from <= 0) { $from = 1;
|
if($from <= 0) { $from = 1;
|
} }
| } }
|
if($to == 0) {
| if($to == 0) {
|
Zeile 941 | Zeile 941 |
---|
{ $page_url = fetch_page_url($url, $i); if($page == $i)
|
{ $page_url = fetch_page_url($url, $i); if($page == $i)
|
{
| {
|
if($breadcrumb == true) { eval("\$mppage .= \"".$templates->get("multipage_page_link_current")."\";");
| if($breadcrumb == true) { eval("\$mppage .= \"".$templates->get("multipage_page_link_current")."\";");
|
Zeile 975 | Zeile 975 |
---|
$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")."\";");
|
}
$lang->multipage_pages = $lang->sprintf($lang->multipage_pages, $pages);
| }
$lang->multipage_pages = $lang->sprintf($lang->multipage_pages, $pages);
|
if($breadcrumb == true)
|
if($breadcrumb == true)
|
{
| {
|
eval("\$multipage = \"".$templates->get("multipage_breadcrumb")."\";");
|
eval("\$multipage = \"".$templates->get("multipage_breadcrumb")."\";");
|
}
| }
|
else { eval("\$multipage = \"".$templates->get("multipage")."\";"); }
return $multipage;
|
else { eval("\$multipage = \"".$templates->get("multipage")."\";"); }
return $multipage;
|
}
| }
|
/** * Generate a page URL for use by the multipage function
| /** * Generate a page URL for use by the multipage function
|
Zeile 1177 | Zeile 1177 |
---|
function forum_permissions($fid=0, $uid=0, $gid=0) { global $db, $cache, $groupscache, $forum_cache, $fpermcache, $mybb, $usercache, $cached_forum_permissions_permissions, $cached_forum_permissions;
|
function forum_permissions($fid=0, $uid=0, $gid=0) { global $db, $cache, $groupscache, $forum_cache, $fpermcache, $mybb, $usercache, $cached_forum_permissions_permissions, $cached_forum_permissions;
|
if($uid == 0) { $uid = $mybb->user['uid']; }
| if($uid == 0) { $uid = $mybb->user['uid']; }
|
if(!$gid || $gid == 0) // If no group, we need to fetch it { if($uid != 0 && $uid != $mybb->user['uid'])
| if(!$gid || $gid == 0) // If no group, we need to fetch it { if($uid != 0 && $uid != $mybb->user['uid'])
|
Zeile 1374 | Zeile 1374 |
---|
if($password == $mybb->input['pwverify']) { my_setcookie("forumpass[$fid]", md5($mybb->user['uid'].$mybb->input['pwverify']), null, true);
|
if($password == $mybb->input['pwverify']) { my_setcookie("forumpass[$fid]", md5($mybb->user['uid'].$mybb->input['pwverify']), null, true);
|
$showform = false; }
| $showform = false; }
|
else { eval("\$pwnote = \"".$templates->get("forumdisplay_password_wrongpass")."\";");
| else { eval("\$pwnote = \"".$templates->get("forumdisplay_password_wrongpass")."\";");
|
Zeile 1466 | Zeile 1466 |
---|
$mod_cache = $cache->read("moderators");
|
$mod_cache = $cache->read("moderators");
|
foreach($mod_cache as $fid => $forum)
| foreach($mod_cache as $forumid => $forum)
|
{
|
{
|
if(!is_array($forum) || !in_array($fid, $parentslist))
| if(!is_array($forum) || !in_array($forumid, $parentslist))
|
{ // No perms or we're not after this forum continue;
| { // No perms or we're not after this forum continue;
|
Zeile 1549 | Zeile 1549 |
---|
$user_perms = user_permissions($uid); if($user_perms['issupermod'] == 1) {
|
$user_perms = user_permissions($uid); if($user_perms['issupermod'] == 1) {
|
| if($fid) { $forumpermissions = forum_permissions($fid); if($forumpermissions['canview'] && $forumpermissions['canviewthreads'] && !$forumpermissions['canonlyviewownthreads']) { return true; } return false; }
|
return true; } else
| return true; } else
|
Zeile 1561 | Zeile 1570 |
---|
foreach($modcache as $modusers) { if(isset($modusers['users'][$uid]) && $modusers['users'][$uid]['mid'])
|
foreach($modcache as $modusers) { if(isset($modusers['users'][$uid]) && $modusers['users'][$uid]['mid'])
|
{ return true;
| { return true;
|
} elseif(isset($modusers['usergroups'][$user_perms['gid']])) { // Moderating usergroup return true;
|
} elseif(isset($modusers['usergroups'][$user_perms['gid']])) { // Moderating usergroup return true;
|
} } }
| } } }
|
return false; } else
| return false; } else
|
Zeile 1785 | Zeile 1794 |
---|
*/ function my_unserialize($data) {
|
*/ function my_unserialize($data) {
|
| // Do no unserialize objects if(substr($data, 0, 1) == 'O') { return array(); }
|
$array = unserialize($data);
if(!is_array($array))
| $array = unserialize($data);
if(!is_array($array))
|
Zeile 2054 | Zeile 2069 |
---|
}
if(!empty($new_stats))
|
}
if(!empty($new_stats))
|
{
| {
|
update_stats($new_stats); }
| update_stats($new_stats); }
|
Zeile 2113 | Zeile 2128 |
---|
$thread = $db->fetch_array($query);
foreach($counters as $counter)
|
$thread = $db->fetch_array($query);
foreach($counters as $counter)
|
{
| {
|
if(array_key_exists($counter, $changes)) { // Adding or subtracting from previous value? if(substr($changes[$counter], 0, 1) == "+" || substr($changes[$counter], 0, 1) == "-")
|
if(array_key_exists($counter, $changes)) { // Adding or subtracting from previous value? if(substr($changes[$counter], 0, 1) == "+" || substr($changes[$counter], 0, 1) == "-")
|
{
| {
|
$update_query[$counter] = $thread[$counter] + $changes[$counter]; } else { $update_query[$counter] = $changes[$counter];
|
$update_query[$counter] = $thread[$counter] + $changes[$counter]; } else { $update_query[$counter] = $changes[$counter];
|
}
| }
|
// Less than 0? That's bad if($update_query[$counter] < 0) {
| // Less than 0? That's bad if($update_query[$counter] < 0) {
|
Zeile 2149 | Zeile 2164 |
---|
/** * Update the first post and lastpost data for a specific thread
|
/** * Update the first post and lastpost data for a specific thread
|
* * @param int The thread ID
| * * @param int The thread ID
|
*/ function update_thread_data($tid) { global $db;
|
*/ function update_thread_data($tid) { global $db;
|
|
|
$thread = get_thread($tid);
// If this is a moved thread marker, don't update it - we need it to stay as it is if(strpos($thread['closed'], 'moved|') !== false)
|
$thread = get_thread($tid);
// If this is a moved thread marker, don't update it - we need it to stay as it is if(strpos($thread['closed'], 'moved|') !== false)
|
{
| {
|
return false; }
| return false; }
|
Zeile 2171 | Zeile 2186 |
---|
WHERE p.tid='$tid' AND p.visible='1' ORDER BY p.dateline DESC LIMIT 1"
|
WHERE p.tid='$tid' AND p.visible='1' ORDER BY p.dateline DESC LIMIT 1"
|
);
| );
|
$lastpost = $db->fetch_array($query);
$db->free_result($query);
| $lastpost = $db->fetch_array($query);
$db->free_result($query);
|
Zeile 2194 | Zeile 2209 |
---|
}
if(!$lastpost['username'])
|
}
if(!$lastpost['username'])
|
{
| {
|
$lastpost['username'] = $lastpost['postusername']; }
| $lastpost['username'] = $lastpost['postusername']; }
|
Zeile 2217 | Zeile 2232 |
---|
'lastposteruid' => intval($lastpost['uid']), ); $db->update_query("threads", $update_array, "tid='{$tid}'");
|
'lastposteruid' => intval($lastpost['uid']), ); $db->update_query("threads", $update_array, "tid='{$tid}'");
|
|
|
unset($firstpost, $lastpost, $update_array);
|
unset($firstpost, $lastpost, $update_array);
|
}
| }
|
function update_forum_count($fid)
|
function update_forum_count($fid)
|
{
| {
|
die("Deprecated function call: update_forum_count"); } function update_thread_count($tid) { die("Deprecated function call: update_thread_count");
|
die("Deprecated function call: update_forum_count"); } function update_thread_count($tid) { die("Deprecated function call: update_thread_count");
|
}
| }
|
function update_thread_attachment_count($tid)
|
function update_thread_attachment_count($tid)
|
{
| {
|
die("Deprecated function call: update_thread_attachment_count"); }
|
die("Deprecated function call: update_thread_attachment_count"); }
|
|
|
/** * Deletes a thread from the database * * @param int The thread ID */ function delete_thread($tid)
|
/** * Deletes a thread from the database * * @param int The thread ID */ function delete_thread($tid)
|
{ global $moderation;
if(!is_object($moderation)) { require_once MYBB_ROOT."inc/class_moderation.php"; $moderation = new Moderation; }
| { global $moderation;
if(!is_object($moderation)) { require_once MYBB_ROOT."inc/class_moderation.php"; $moderation = new Moderation; }
|
return $moderation->delete_thread($tid); }
| return $moderation->delete_thread($tid); }
|
Zeile 2342 | Zeile 2357 |
---|
{ $newdepth = $depth."--"; $forumjumpbits .= build_forum_jump($forum['fid'], $selitem, 0, $newdepth, $showextras, $showall);
|
{ $newdepth = $depth."--"; $forumjumpbits .= build_forum_jump($forum['fid'], $selitem, 0, $newdepth, $showextras, $showall);
|
} }
| } }
|
} } }
| } } }
|
Zeile 2449 | Zeile 2464 |
---|
$format = stripslashes($format);
return str_replace("{username}", $username, $format);
|
$format = stripslashes($format);
return str_replace("{username}", $username, $format);
|
}
| }
|
/** * Build the javascript based MyCode inserter
| /** * Build the javascript based MyCode inserter
|
Zeile 2553 | Zeile 2568 |
---|
{ $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 2712 | Zeile 2727 |
---|
if($mybb->user['additionalgroups']) { $exp = explode(",", $mybb->user['additionalgroups']);
|
if($mybb->user['additionalgroups']) { $exp = explode(",", $mybb->user['additionalgroups']);
|
|
|
foreach($exp as $group) { $groups[] = $group;
| foreach($exp as $group) { $groups[] = $group;
|
Zeile 2732 | Zeile 2747 |
---|
{ // This prefix is not in our forum list continue;
|
{ // This prefix is not in our forum list continue;
|
}
| }
|
}
|
}
|
|
|
if($prefix['groups'] != "-1")
|
if($prefix['groups'] != "-1")
|
{ $prefix_groups = explode(",", $prefix['groups']);
| { $prefix_groups = explode(",", $prefix['groups']);
|
foreach($groups as $group) { if(in_array($group, $prefix_groups) && !isset($prefixes[$prefix['pid']]))
| foreach($groups as $group) { if(in_array($group, $prefix_groups) && !isset($prefixes[$prefix['pid']]))
|
Zeile 2758 | Zeile 2773 |
---|
if(empty($prefixes)) { return false;
|
if(empty($prefixes)) { return false;
|
}
| }
|
$prefixselect = "";
|
$prefixselect = "";
|
$multipleselect = "";
| |
if($multiple != 0) {
|
if($multiple != 0) {
|
$multipleselect = " multiple=\"multiple\" size=\"5\"";
| $prefixselect = "<select name=\"threadprefix[]\" multiple=\"multiple\" size=\"5\">\n"; } else { $prefixselect = "<select name=\"threadprefix\">\n";
|
}
|
}
|
$prefixselect = "<select name=\"threadprefix\"{$multipleselect}>\n";
| |
if($multiple == 1) {
| if($multiple == 1) {
|
Zeile 2987 | Zeile 3003 |
---|
$ip = 0;
|
$ip = 0;
|
if(!preg_match("#^(10|172\.16|192\.168)\.#", $_SERVER['REMOTE_ADDR']))
| if(!preg_match("#^(10|172\.(1[6-9]|2[0-9]|3[0-1])|192\.168)\.#", $_SERVER['REMOTE_ADDR']))
|
{ $ip = $_SERVER['REMOTE_ADDR']; }
| { $ip = $_SERVER['REMOTE_ADDR']; }
|
Zeile 3007 | Zeile 3023 |
---|
{ foreach($addresses[0] as $key => $val) {
|
{ foreach($addresses[0] as $key => $val) {
|
if(!preg_match("#^(10|172\.16|192\.168)\.#", $val))
| if(!preg_match("#^(10|172\.(1[6-9]|2[0-9]|3[0-1])|192\.168)\.#", $val))
|
{ $ip = $val; break;
| { $ip = $val; break;
|
Zeile 3278 | Zeile 3294 |
---|
$multipage_dropdown = null; if(!empty($navbit['multipage'])) {
|
$multipage_dropdown = null; if(!empty($navbit['multipage'])) {
|
| if(!$mybb->settings['threadsperpage'] || (int)$mybb->settings['threadsperpage'] < 1) { $mybb->settings['threadsperpage'] = 20; }
|
$multipage = multipage($navbit['multipage']['num_threads'], $mybb->settings['threadsperpage'], $navbit['multipage']['current_page'], $navbit['multipage']['url'], true); if($multipage) {
| $multipage = multipage($navbit['multipage']['num_threads'], $mybb->settings['threadsperpage'], $navbit['multipage']['current_page'], $navbit['multipage']['url'], true); if($multipage) {
|
Zeile 5440 | Zeile 5461 |
---|
if($update_lastuse == true) { $db->update_query("banfilters", array("lastuse" => TIME_NOW), "fid='{$banned_username['fid']}'");
|
if($update_lastuse == true) { $db->update_query("banfilters", array("lastuse" => TIME_NOW), "fid='{$banned_username['fid']}'");
|
}
| }
|
return true; } }
| return true; } }
|
Zeile 5634 | Zeile 5655 |
---|
}
if(function_exists("curl_init"))
|
}
if(function_exists("curl_init"))
|
{
| {
|
$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, 0);
| $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, 0);
|
Zeile 5680 | Zeile 5701 |
---|
$headers[] = "POST {$url['path']} HTTP/1.0"; $headers[] = "Content-Length: ".strlen($post_body); $headers[] = "Content-Type: application/x-www-form-urlencoded";
|
$headers[] = "POST {$url['path']} HTTP/1.0"; $headers[] = "Content-Length: ".strlen($post_body); $headers[] = "Content-Type: application/x-www-form-urlencoded";
|
} else {
| } else {
|
$headers[] = "GET {$url['path']} HTTP/1.0"; }
| $headers[] = "GET {$url['path']} HTTP/1.0"; }
|
Zeile 5730 | Zeile 5751 |
---|
* @return boolean True if a super admin, false if not */ function is_super_admin($uid)
|
* @return boolean True if a super admin, false if not */ function is_super_admin($uid)
|
{ global $mybb;
$mybb->config['super_admins'] = str_replace(" ", "", $mybb->config['super_admins']); if(my_strpos(",{$mybb->config['super_admins']},", ",{$uid},") === false) {
| { static $super_admins;
if(!isset($super_admins)) { global $mybb; $super_admins = str_replace(" ", "", $mybb->config['super_admins']); }
if(my_strpos(",{$super_admins},", ",{$uid},") === false) {
|
return false;
|
return false;
|
}
| }
|
else
|
else
|
{
| {
|
return true; }
|
return true; }
|
| }
/** * Prevents super administrators being selected in a SELECT. * * @param boolean Prefix with an AND? * @param string The prefix to add to uid when used in a JOIN (e.g. SELECTing users u would mean using 'u' in this argument). * @return string An addition to the WHERE statement */ function not_super_admins($use_and = false, $uid_prefix = '') { static $super_admins;
if(!isset($super_admins)) { global $mybb, $db; $super_admins = $db->escape_string(str_replace(" ", "", $mybb->config['super_admins'])); }
if($super_admins) { $sql_where = ''; if($use_and) { $sql_where .= ' AND '; }
if($uid_prefix != '') { $sql_where .= $uid_prefix.'.'; }
$sql_where .= "uid NOT IN({$super_admins})";
return $sql_where; } return '';
|
}
/**
| }
/**
|
Zeile 5769 | Zeile 5832 |
---|
$escape_preg = "(".implode("|", array_map("escaped_explode_escape", $escape)).")"; } else
|
$escape_preg = "(".implode("|", array_map("escaped_explode_escape", $escape)).")"; } else
|
{
| {
|
$escape_preg = preg_quote($escape, "#"); } $quoted_strings = preg_split("#(?<!\\\){$escape_preg}#", $string); } else
|
$escape_preg = preg_quote($escape, "#"); } $quoted_strings = preg_split("#(?<!\\\){$escape_preg}#", $string); } else
|
{
| {
|
$quoted_strings = array($string); } foreach($quoted_strings as $string) { if($string != "")
|
$quoted_strings = array($string); } foreach($quoted_strings as $string) { if($string != "")
|
{
| {
|
if($in_escape) { $strings[] = trim($string);
| if($in_escape) { $strings[] = trim($string);
|
Zeile 5817 | Zeile 5880 |
---|
$ip_string1 = $ip_string2 = "";
if($ip == "*")
|
$ip_string1 = $ip_string2 = "";
if($ip == "*")
|
{
| {
|
return array(my_ip2long('128.0.0.0'), my_ip2long('127.255.255.255')); }
| return array(my_ip2long('128.0.0.0'), my_ip2long('127.255.255.255')); }
|
Zeile 5825 | Zeile 5888 |
---|
{ $ip = str_replace("*", "", $ip); if(count($ip_bits) == 4)
|
{ $ip = str_replace("*", "", $ip); if(count($ip_bits) == 4)
|
{
| {
|
return my_ip2long($ip);
|
return my_ip2long($ip);
|
} else {
| } else {
|
return array(my_ip2long($ip.".0"), my_ip2long($ip.".255")); } }
| return array(my_ip2long($ip.".0"), my_ip2long($ip.".255")); } }
|
Zeile 6021 | Zeile 6084 |
---|
}
return @unlink($path);
|
}
return @unlink($path);
|
}
| }
|
/** * Counts the number of subforums in a array([pid][disporder][fid]) starting from the pid *
| /** * Counts the number of subforums in a array([pid][disporder][fid]) starting from the pid *
|
Zeile 6209 | Zeile 6272 |
---|
function secure_seed_rng($count=8) { $output = '';
|
function secure_seed_rng($count=8) { $output = '';
|
// Use OpenSSL when available // PHP <5.3.4 had a bug which makes that function unusable on Windows if(function_exists('openssl_random_pseudo_bytes') && version_compare(PHP_VERSION, '5.3.4', '>=')) { $output = openssl_random_pseudo_bytes($count);
| // DIRECTORY_SEPARATOR checks if running windows if(DIRECTORY_SEPARATOR != '\\') { // Unix/Linux // Use OpenSSL when available if(function_exists('openssl_random_pseudo_bytes')) { $output = openssl_random_pseudo_bytes($count); } // Try mcrypt elseif(function_exists('mcrypt_create_iv')) { $output = mcrypt_create_iv($count, MCRYPT_DEV_URANDOM); } // Try /dev/urandom elseif(@is_readable('/dev/urandom') && ($handle = @fopen('/dev/urandom', 'rb'))) { $output = @fread($handle, $count); @fclose($handle); }
|
}
|
}
|
// Try the unix/linux method elseif(@is_readable('/dev/urandom') && ($handle = @fopen('/dev/urandom', 'rb')))
| else
|
{
|
{
|
$output = @fread($handle, $count); @fclose($handle); } // Try Windows CAPICOM before using our own generator elseif(class_exists('COM')) { try
| // Windows // Use OpenSSL when available // PHP <5.3.4 had a bug which makes that function unusable on Windows if(function_exists('openssl_random_pseudo_bytes') && version_compare(PHP_VERSION, '5.3.4', '>='))
|
{
|
{
|
$CAPI_Util = new COM('CAPICOM.Utilities.1'); $output = $CAPI_Util->GetRandom($count, 0); } catch (Exception $ex) {
| $output = openssl_random_pseudo_bytes($count); } // Try mcrypt elseif(function_exists('mcrypt_create_iv')) { $output = mcrypt_create_iv($count, MCRYPT_RAND); } // Try Windows CAPICOM before using our own generator elseif(class_exists('COM')) { try { $CAPI_Util = new COM('CAPICOM.Utilities.1'); if(is_callable(array($CAPI_Util, 'GetRandom'))) { $output = $CAPI_Util->GetRandom($count, 0); } } catch (Exception $e) { }
|
} }
| } }
|