Zeile 6 | Zeile 6 |
---|
* Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* $Id: functions.php 4058 2008-08-03 00:37:09Z Tikitiki $
| * $Id: functions.php 4182 2008-09-07 18:05:30Z Tikitiki $
|
*/
/**
| */
/**
|
Zeile 162 | Zeile 162 |
---|
if(isset($config)) { require_once MYBB_ROOT."inc/db_".$config['database']['type'].".php";
|
if(isset($config)) { require_once MYBB_ROOT."inc/db_".$config['database']['type'].".php";
|
$db = new databaseEngine;
| switch($config['database']['type']) { case "sqlite3": $db = new DB_SQLite3; break; case "sqlite2": $db = new DB_SQLite2; break; case "pgsql": $db = new DB_PgSQL; break; case "mysqli": $db = new DB_MySQLi; break; default: $db = new DB_MySQL; }
|
$db->connect($config['database']); define("TABLE_PREFIX", $config['database']['table_prefix']); $db->set_table_prefix(TABLE_PREFIX);
| $db->connect($config['database']); define("TABLE_PREFIX", $config['database']['table_prefix']); $db->set_table_prefix(TABLE_PREFIX);
|
Zeile 192 | Zeile 210 |
---|
foreach($shutdown_queries as $query) { $db->query($query);
|
foreach($shutdown_queries as $query) { $db->query($query);
|
} }
| } }
|
// Run any shutdown functions if we have them if(is_array($shutdown_functions))
| // Run any shutdown functions if we have them if(is_array($shutdown_functions))
|
Zeile 201 | Zeile 219 |
---|
foreach($shutdown_functions as $function) { $function();
|
foreach($shutdown_functions as $function) { $function();
|
} }
| } }
|
$done_shutdown = true; }
| $done_shutdown = true; }
|
Zeile 242 | Zeile 260 |
---|
}
$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 262 | Zeile 280 |
---|
$contents = $htmldoctype.$contents; } else
|
$contents = $htmldoctype.$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 = "<!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) { $contents = str_replace("<html", "<html dir=\"rtl\"", $contents);
|
if($lang->settings['rtl'] == 1) { $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($lang->settings['htmllang']) { $contents = str_replace("<html", "<html xml:lang=\"".$lang->settings['htmllang']."\" lang=\"".$lang->settings['htmllang']."\"", $contents);
|
Zeile 302 | Zeile 320 |
---|
// If the stamp isn't set, use TIME_NOW if(empty($stamp))
|
// If the stamp isn't set, use TIME_NOW if(empty($stamp))
|
{
| {
|
$stamp = TIME_NOW; }
| $stamp = TIME_NOW; }
|
Zeile 312 | Zeile 330 |
---|
{ $offset = $mybb->user['timezone']; $dstcorrection = $mybb->user['dst'];
|
{ $offset = $mybb->user['timezone']; $dstcorrection = $mybb->user['dst'];
|
}
| }
|
elseif(defined("IN_ADMINCP"))
|
elseif(defined("IN_ADMINCP"))
|
{
| {
|
$offset = $mybbadmin['timezone']; $dstcorrection = $mybbadmin['dst']; }
| $offset = $mybbadmin['timezone']; $dstcorrection = $mybbadmin['dst']; }
|
Zeile 322 | Zeile 340 |
---|
{ $offset = $mybb->settings['timezoneoffset']; $dstcorrection = $mybb->settings['dstcorrection'];
|
{ $offset = $mybb->settings['timezoneoffset']; $dstcorrection = $mybb->settings['dstcorrection'];
|
}
| }
|
// If DST correction is enabled, add an additional hour to the timezone. if($dstcorrection == 1)
| // If DST correction is enabled, add an additional hour to the timezone. if($dstcorrection == 1)
|
Zeile 452 | Zeile 470 |
---|
// Guests get a special string else {
|
// Guests get a special string else {
|
return md5($mybb->config['database']['hostname'].$mybb->config['database']['username'].$mybb->config['database']['password']);
| return md5($mybb->config['database']['hostname'].$mybb->config['database']['username'].md5($mybb->config['database']['password']));
|
} }
| } }
|
Zeile 642 | Zeile 660 |
---|
eval("\$errorpage = \"".$templates->get("error")."\";"); output_page($errorpage);
|
eval("\$errorpage = \"".$templates->get("error")."\";"); output_page($errorpage);
|
exit; }
| exit; }
|
/** * Produce an error message for displaying inline on a page *
| /** * Produce an error message for displaying inline on a page *
|
Zeile 802 | Zeile 820 |
---|
* @return string The generated pagination */ function multipage($count, $perpage, $page, $url)
|
* @return string The generated pagination */ function multipage($count, $perpage, $page, $url)
|
{
| {
|
global $theme, $templates, $lang, $mybb;
if($count <= $perpage)
| global $theme, $templates, $lang, $mybb;
if($count <= $perpage)
|
Zeile 960 | Zeile 978 |
---|
else { return $mybb->usergroup;
|
else { return $mybb->usergroup;
|
} }
| } }
|
/** * Fetch the usergroup permissions for a specic group or series of groups combined
| /** * Fetch the usergroup permissions for a specic group or series of groups combined
|
Zeile 973 | Zeile 991 |
---|
{ global $cache, $groupscache, $grouppermignore, $groupzerogreater;
|
{ global $cache, $groupscache, $grouppermignore, $groupzerogreater;
|
if(!is_array($groupscache)) { $groupscache = $cache->read("usergroups"); }
$groups = explode(",", $gid);
if(count($groups) == 1)
| if(!is_array($groupscache)) { $groupscache = $cache->read("usergroups"); }
$groups = explode(",", $gid);
if(count($groups) == 1)
|
{ return $groupscache[$gid]; }
| { return $groupscache[$gid]; }
|
Zeile 989 | Zeile 1007 |
---|
foreach($groups as $gid) { if(trim($gid) == "" || !$groupscache[$gid])
|
foreach($groups as $gid) { if(trim($gid) == "" || !$groupscache[$gid])
|
{
| {
|
continue; }
| continue; }
|
Zeile 1039 | Zeile 1057 |
---|
if(!is_array($groupscache)) { $groupscache = $cache->read("usergroups");
|
if(!is_array($groupscache)) { $groupscache = $cache->read("usergroups");
|
}
| }
|
$displaygroup = array(); $group = $groupscache[$gid];
| $displaygroup = array(); $group = $groupscache[$gid];
|
Zeile 1070 | Zeile 1088 |
---|
}
if(!$gid || $gid == 0) // If no group, we need to fetch it
|
}
if(!$gid || $gid == 0) // If no group, we need to fetch it
|
{ if($uid != $mybb->user['uid'])
| { if($uid != 0 && $uid != $mybb->user['uid'])
|
{ if($usercache[$uid]) {
| { if($usercache[$uid]) {
|
Zeile 1081 | Zeile 1099 |
---|
$gid = $usercache[$uid]['usergroup'].",".$usercache[$uid]['additionalgroups']; $groupperms = usergroup_permissions($gid);
|
$gid = $usercache[$uid]['usergroup'].",".$usercache[$uid]['additionalgroups']; $groupperms = usergroup_permissions($gid);
|
}
| }
|
else { $gid = $mybb->user['usergroup'];
| else { $gid = $mybb->user['usergroup'];
|
Zeile 1111 | Zeile 1129 |
---|
}
if($fid) // Fetch the permissions for a single forum
|
}
if($fid) // Fetch the permissions for a single forum
|
{
| {
|
if(!$cached_forum_permissions_permissions[$gid][$fid])
|
if(!$cached_forum_permissions_permissions[$gid][$fid])
|
{
| {
|
$cached_forum_permissions_permissions[$gid][$fid] = fetch_forum_permissions($fid, $gid, $groupperms); } return $cached_forum_permissions_permissions[$gid][$fid];
| $cached_forum_permissions_permissions[$gid][$fid] = fetch_forum_permissions($fid, $gid, $groupperms); } return $cached_forum_permissions_permissions[$gid][$fid];
|
Zeile 1121 | Zeile 1139 |
---|
else { if(!$cached_forum_permissions[$gid])
|
else { if(!$cached_forum_permissions[$gid])
|
{
| {
|
foreach($forum_cache as $forum) { $cached_forum_permissions[$gid][$forum['fid']] = fetch_forum_permissions($forum['fid'], $gid, $groupperms);
| foreach($forum_cache as $forum) { $cached_forum_permissions[$gid][$forum['fid']] = fetch_forum_permissions($forum['fid'], $gid, $groupperms);
|
Zeile 1279 | Zeile 1297 |
---|
eval("\$pwform = \"".$templates->get("forumdisplay_password")."\";"); output_page($pwform); exit;
|
eval("\$pwform = \"".$templates->get("forumdisplay_password")."\";"); output_page($pwform); exit;
|
} }
| } }
|
/** * Return the permissions for a moderator in a specific forum
| /** * Return the permissions for a moderator in a specific forum
|
Zeile 1440 | Zeile 1458 |
---|
{ $iconlist .= "<br />"; $listed = 0;
|
{ $iconlist .= "<br />"; $listed = 0;
|
} }
| } }
|
eval("\$posticons = \"".$templates->get("posticons")."\";");
return $posticons;
| eval("\$posticons = \"".$templates->get("posticons")."\";");
return $posticons;
|
Zeile 1600 | Zeile 1618 |
---|
if(!$serverload) { if(@ini_get('safe_mode') == 'On')
|
if(!$serverload) { if(@ini_get('safe_mode') == 'On')
|
{ return $lang->unknown; }
| { return $lang->unknown; }
|
// Suhosin likes to throw a warning if exec is disabled then die - weird if($func_blacklist = @ini_get('suhosin.executor.func.blacklist'))
| // Suhosin likes to throw a warning if exec is disabled then die - weird if($func_blacklist = @ini_get('suhosin.executor.func.blacklist'))
|
Zeile 1631 | Zeile 1649 |
---|
} } else
|
} } else
|
{ return $lang->unknown;
| { return $lang->unknown;
|
}
$returnload = trim($serverload[0]);
| }
$returnload = trim($serverload[0]);
|
Zeile 1681 | Zeile 1699 |
---|
$lastmember = $db->fetch_array($query); $new_stats['lastuid'] = $lastmember['uid']; $new_stats['lastusername'] = $lastmember['username'];
|
$lastmember = $db->fetch_array($query); $new_stats['lastuid'] = $lastmember['uid']; $new_stats['lastusername'] = $lastmember['username'];
|
}
| }
|
if(is_array($stats))
|
if(is_array($stats))
|
{
| {
|
$stats = array_merge($stats, $new_stats);
|
$stats = array_merge($stats, $new_stats);
|
}
| }
|
else { $stats = $new_stats;
|
else { $stats = $new_stats;
|
}
| }
|
// Update stats row for today in the database $todays_stats = array( "dateline" => mktime(0, 0, 0, date("m"), date("j"), date("Y")),
| // Update stats row for today in the database $todays_stats = array( "dateline" => mktime(0, 0, 0, date("m"), date("j"), date("Y")),
|
Zeile 1700 | Zeile 1718 |
---|
"numposts" => $stats['numposts'] ); $db->replace_query("stats", $todays_stats, "dateline");
|
"numposts" => $stats['numposts'] ); $db->replace_query("stats", $todays_stats, "dateline");
|
|
|
$cache->update("stats", $stats, "dateline"); }
| $cache->update("stats", $stats, "dateline"); }
|
Zeile 1739 | Zeile 1757 |
---|
if($update_query[$counter] < 0) { $update_query[$counter] = 0;
|
if($update_query[$counter] < 0) { $update_query[$counter] = 0;
|
}
| }
|
} }
| } }
|
Zeile 1760 | Zeile 1778 |
---|
{ $new_stats['numthreads'] = "+{$threads_diff}"; }
|
{ $new_stats['numthreads'] = "+{$threads_diff}"; }
|
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 1853 | Zeile 1871 |
---|
$update_query = array();
|
$update_query = array();
|
$counters = array('replies','unapprovedposts','attachmentcount');
| $counters = array('replies','unapprovedposts','attachmentcount', 'attachmentcount');
|
// Fetch above counters for this thread $query = $db->simple_select("threads", implode(",", $counters), "tid='{$tid}'");
| // Fetch above counters for this thread $query = $db->simple_select("threads", implode(",", $counters), "tid='{$tid}'");
|
Zeile 1923 | Zeile 1941 |
---|
}
if(!$lastpost['username'])
|
}
if(!$lastpost['username'])
|
{
| {
|
$lastpost['username'] = $lastpost['postusername']; }
| $lastpost['username'] = $lastpost['postusername']; }
|
Zeile 2082 | Zeile 2100 |
---|
}
$jumpsel[$selitem] = 'selected="selected"';
|
}
$jumpsel[$selitem] = 'selected="selected"';
|
}
| }
|
if($showextras == 0)
|
if($showextras == 0)
|
{
| {
|
$template = "special";
|
$template = "special";
|
}
| }
|
else { $template = "advanced"; }
|
else { $template = "advanced"; }
|
|
|
eval("\$forumjump = \"".$templates->get("forumjump_".$template)."\";"); }
|
eval("\$forumjump = \"".$templates->get("forumjump_".$template)."\";"); }
|
|
|
return $forumjump; }
/** * Returns the extension of a file.
|
return $forumjump; }
/** * Returns the extension of a file.
|
*
| *
|
* @param string The filename. * @return string The extension of the file. */
| * @param string The filename. * @return string The extension of the file. */
|
Zeile 2120 | Zeile 2138 |
---|
{ $set = array("a","A","b","B","c","C","d","D","e","E","f","F","g","G","h","H","i","I","j","J","k","K","l","L","m","M","n","N","o","O","p","P","q","Q","r","R","s","S","t","T","u","U","v","V","w","W","x","X","y","Y","z","Z","1","2","3","4","5","6","7","8","9"); $str = '';
|
{ $set = array("a","A","b","B","c","C","d","D","e","E","f","F","g","G","h","H","i","I","j","J","k","K","l","L","m","M","n","N","o","O","p","P","q","Q","r","R","s","S","t","T","u","U","v","V","w","W","x","X","y","Y","z","Z","1","2","3","4","5","6","7","8","9"); $str = '';
|
|
|
for($i = 1; $i <= $length; ++$i) { $ch = mt_rand(0, count($set)-1);
| for($i = 1; $i <= $length; ++$i) { $ch = mt_rand(0, count($set)-1);
|
Zeile 2159 | Zeile 2177 |
---|
if($userin == 0) { $format = "{username}";
|
if($userin == 0) { $format = "{username}";
|
}
$format = stripslashes($format);
| }
$format = stripslashes($format);
|
return str_replace("{username}", $username, $format); }
| return str_replace("{username}", $username, $format); }
|
Zeile 2221 | Zeile 2239 |
---|
$js_lang_string = preg_replace("#^editor_#i", "", $lang_string); $string = str_replace("\"", "\\\"", $lang->$lang_string); $editor_language .= "\t{$js_lang_string}: \"{$string}\"";
|
$js_lang_string = preg_replace("#^editor_#i", "", $lang_string); $string = str_replace("\"", "\\\"", $lang->$lang_string); $editor_language .= "\t{$js_lang_string}: \"{$string}\"";
|
|
|
if($editor_lang_strings[$key+1]) { $editor_language .= ",";
| if($editor_lang_strings[$key+1]) { $editor_language .= ",";
|
Zeile 2240 | Zeile 2258 |
---|
else { eval("\$codeinsert = \"".$templates->get("codebuttons")."\";");
|
else { eval("\$codeinsert = \"".$templates->get("codebuttons")."\";");
|
} }
| } }
|
return $codeinsert; }
| return $codeinsert; }
|
Zeile 2400 | Zeile 2418 |
---|
* @param string The message to enter for the action the moderator performed. */ function log_moderator_action($data, $action="")
|
* @param string The message to enter for the action the moderator performed. */ function log_moderator_action($data, $action="")
|
{
| {
|
global $mybb, $db, $session;
// If the fid or tid is not set, set it at 0 so MySQL doesn't choke on it. if($data['fid'] == '')
|
global $mybb, $db, $session;
// If the fid or tid is not set, set it at 0 so MySQL doesn't choke on it. if($data['fid'] == '')
|
{
| {
|
$fid = 0;
|
$fid = 0;
|
} else {
| } else {
|
$fid = $data['fid']; unset($data['fid']); }
| $fid = $data['fid']; unset($data['fid']); }
|
Zeile 2417 | Zeile 2435 |
---|
if($data['tid'] == '') { $tid = 0;
|
if($data['tid'] == '') { $tid = 0;
|
} else {
| } else {
|
$tid = $data['tid']; unset($data['tid']); }
| $tid = $data['tid']; unset($data['tid']); }
|
Zeile 2428 | Zeile 2446 |
---|
if(is_array($data)) { $data = serialize($data);
|
if(is_array($data)) { $data = serialize($data);
|
}
| }
|
$time = TIME_NOW;
$sql_array = array(
| $time = TIME_NOW;
$sql_array = array(
|
Zeile 2458 | Zeile 2476 |
---|
if($uid != 0) { $display_reputation = "<a href=\"reputation.php?uid={$uid}\">";
|
if($uid != 0) { $display_reputation = "<a href=\"reputation.php?uid={$uid}\">";
|
}
| }
|
$display_reputation .= "<strong class=\"";
if($reputation < 0)
|
$display_reputation .= "<strong class=\"";
if($reputation < 0)
|
{
| {
|
$display_reputation .= "reputation_negative"; } elseif($reputation > 0) { $display_reputation .= "reputation_positive";
|
$display_reputation .= "reputation_negative"; } elseif($reputation > 0) { $display_reputation .= "reputation_positive";
|
}
| }
|
else
|
else
|
{
| {
|
$display_reputation .= "reputation_neutral";
|
$display_reputation .= "reputation_neutral";
|
}
| }
|
$display_reputation .= "\">{$reputation}</strong>";
if($uid != 0) { $display_reputation .= "</a>";
|
$display_reputation .= "\">{$reputation}</strong>";
if($uid != 0) { $display_reputation .= "</a>";
|
}
| }
|
return $display_reputation; }
| return $display_reputation; }
|
Zeile 2638 | Zeile 2656 |
---|
$ext = my_strtolower($ext);
if($attachtypes[$ext]['icon'])
|
$ext = my_strtolower($ext);
if($attachtypes[$ext]['icon'])
|
{ if(defined("IN_ADMINCP")) {
| { if(defined("IN_ADMINCP")) {
|
$icon = str_replace("{theme}", "", $attachtypes[$ext]['icon']); if(my_substr($icon, 0, 1) != "/" && my_substr($icon, 0, 7) != "http://") {
| $icon = str_replace("{theme}", "", $attachtypes[$ext]['icon']); if(my_substr($icon, 0, 1) != "/" && my_substr($icon, 0, 7) != "http://") {
|
Zeile 2648 | Zeile 2666 |
---|
} } elseif(defined("IN_PORTAL"))
|
} } elseif(defined("IN_PORTAL"))
|
{ global $change_dir;
| { global $change_dir;
|
$icon = $change_dir."/".str_replace("{theme}", $theme['imgdir'], $attachtypes[$ext]['icon']);
|
$icon = $change_dir."/".str_replace("{theme}", $theme['imgdir'], $attachtypes[$ext]['icon']);
|
}
| }
|
else { $icon = str_replace("{theme}", $theme['imgdir'], $attachtypes[$ext]['icon']);
| else { $icon = str_replace("{theme}", $theme['imgdir'], $attachtypes[$ext]['icon']);
|
Zeile 2659 | Zeile 2677 |
---|
return "<img src=\"{$icon}\" border=\"0\" alt=\".{$ext}\" />"; } else
|
return "<img src=\"{$icon}\" border=\"0\" alt=\".{$ext}\" />"; } else
|
{
| {
|
if(defined("IN_ADMINCP")) { $theme['imgdir'] = "../images";
| if(defined("IN_ADMINCP")) { $theme['imgdir'] = "../images";
|
Zeile 2689 | Zeile 2707 |
---|
if(!$permissions) { $permissions = $mybb->usergroup;
|
if(!$permissions) { $permissions = $mybb->usergroup;
|
}
| }
|
if(!is_array($forum_cache)) {
| if(!is_array($forum_cache)) {
|
Zeile 2719 | Zeile 2737 |
---|
if($mybb->cookies['forumpass'][$forum['fid']] != md5($mybb->user['uid'].$forum['password'])) { $pwverified = 0;
|
if($mybb->cookies['forumpass'][$forum['fid']] != md5($mybb->user['uid'].$forum['password'])) { $pwverified = 0;
|
} }
| } }
|
if($perms['canview'] == 0 || $pwverified == 0 || ($only_readable_threads == true && $perms['canviewthreads'] == 0)) { if($unviewableforums)
| if($perms['canview'] == 0 || $pwverified == 0 || ($only_readable_threads == true && $perms['canviewthreads'] == 0)) { if($unviewableforums)
|
Zeile 2730 | Zeile 2748 |
---|
}
$unviewableforums .= "'".$forum['fid']."'";
|
}
$unviewableforums .= "'".$forum['fid']."'";
|
} }
| } }
|
return $unviewableforums; }
| return $unviewableforums; }
|
Zeile 2787 | Zeile 2805 |
---|
$navsize = count($navbits); $navbit = $navbits[$navsize-1];
|
$navsize = count($navbits); $navbit = $navbits[$navsize-1];
|
|
|
if($nav) { eval("\$activesep = \"".$templates->get("nav_sep_active")."\";"); }
|
if($nav) { eval("\$activesep = \"".$templates->get("nav_sep_active")."\";"); }
|
|
|
eval("\$activebit = \"".$templates->get("nav_bit_active")."\";"); eval("\$donenav = \"".$templates->get("nav")."\";");
|
eval("\$activebit = \"".$templates->get("nav_bit_active")."\";"); eval("\$donenav = \"".$templates->get("nav")."\";");
|
|
|
return $donenav;
|
return $donenav;
|
}
| }
|
/** * Add a breadcrumb menu item to the list. *
| /** * Add a breadcrumb menu item to the list. *
|
Zeile 3062 | Zeile 3080 |
---|
if($mybb->settings['nocacheheaders'] == 1 && $mybb->settings['standardheaders'] != 1) { header("Expires: Sat, 1 Jan 2000 01:00:00 GMT");
|
if($mybb->settings['nocacheheaders'] == 1 && $mybb->settings['standardheaders'] != 1) { header("Expires: Sat, 1 Jan 2000 01:00:00 GMT");
|
header("Last-Modified: ".gmdate("D, d M Y H:i:s")."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, must-revalidate"); header("Pragma: no-cache"); }
|
Zeile 3198 | Zeile 3216 |
---|
else if($months > 1) { $nicetime['months'] = $months.$lang_months;
|
else if($months > 1) { $nicetime['months'] = $months.$lang_months;
|
}
| }
|
if($weeks == 1)
|
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;
|
}
| }
|
if($days == 1)
|
if($days == 1)
|
{
| {
|
$nicetime['days'] = "1".$lang_day;
|
$nicetime['days'] = "1".$lang_day;
|
}
| }
|
else if($days > 1) { $nicetime['days'] = $days.$lang_days;
|
else if($days > 1) { $nicetime['days'] = $days.$lang_days;
|
}
| }
|
if($options['hours'] !== false) { if($hours == 1)
|
if($options['hours'] !== false) { if($hours == 1)
|
{
| {
|
$nicetime['hours'] = "1".$lang_hour; } else if($hours > 1) { $nicetime['hours'] = $hours.$lang_hours;
|
$nicetime['hours'] = "1".$lang_hour; } else if($hours > 1) { $nicetime['hours'] = $hours.$lang_hours;
|
}
| }
|
}
if($options['minutes'] !== false)
| }
if($options['minutes'] !== false)
|
Zeile 3237 | Zeile 3255 |
---|
$nicetime['minutes'] = "1".$lang_minute; } else if($minutes > 1)
|
$nicetime['minutes'] = "1".$lang_minute; } else if($minutes > 1)
|
{
| {
|
$nicetime['minutes'] = $minutes.$lang_minutes; } }
| $nicetime['minutes'] = $minutes.$lang_minutes; } }
|
Zeile 3247 | Zeile 3265 |
---|
if($seconds == 1) { $nicetime['seconds'] = "1".$lang_second;
|
if($seconds == 1) { $nicetime['seconds'] = "1".$lang_second;
|
}
| }
|
else if($seconds > 1) { $nicetime['seconds'] = $seconds.$lang_seconds;
| else if($seconds > 1) { $nicetime['seconds'] = $seconds.$lang_seconds;
|
Zeile 3257 | Zeile 3275 |
---|
if(is_array($nicetime)) { return implode(", ", $nicetime);
|
if(is_array($nicetime)) { return implode(", ", $nicetime);
|
}
| }
|
}
/**
| }
/**
|
Zeile 3277 | Zeile 3295 |
---|
else { $trow = "trow1";
|
else { $trow = "trow1";
|
}
| }
|
$alttrow = $trow;
return $trow;
| $alttrow = $trow;
return $trow;
|
Zeile 3293 | Zeile 3311 |
---|
function join_usergroup($uid, $joingroup) { global $db;
|
function join_usergroup($uid, $joingroup) { global $db;
|
if($uid == $mybb->user['uid']) { $user = $mybb->user; } else
| if($uid == $mybb->user['uid']) { $user = $mybb->user; } else
|
{
|
{
|
$query = $db->simple_select("users", "additionalgroups, usergroup", "uid='{$uid}'");
| $query = $db->simple_select("users", "additionalgroups, usergroup", "uid='".intval($uid)."'");
|
$user = $db->fetch_array($query); }
| $user = $db->fetch_array($query); }
|
Zeile 3308 | Zeile 3326 |
---|
$usergroups = ""; $usergroups = $user['additionalgroups'].",".$joingroup; $groupslist = "";
|
$usergroups = ""; $usergroups = $user['additionalgroups'].",".$joingroup; $groupslist = "";
|
$groups = explode(",", $usergroups);
| $groups = explode(",", $usergroups);
|
if(is_array($groups)) { foreach($groups as $gid) { if(trim($gid) != "" && $gid != $user['usergroup'] && !$donegroup[$gid])
|
if(is_array($groups)) { foreach($groups as $gid) { if(trim($gid) != "" && $gid != $user['usergroup'] && !$donegroup[$gid])
|
{ $groupslist .= $comma.$gid; $comma = ","; $donegroup[$gid] = 1; }
| { $groupslist .= $comma.$gid; $comma = ","; $donegroup[$gid] = 1; }
|
} }
|
} }
|
$db->update_query("users", array('additionalgroups' => $groupslist), "uid='$uid'");
| $db->update_query("users", array('additionalgroups' => $groupslist), "uid='".intval($uid)."'");
|
}
/**
| }
/**
|
Zeile 3342 | Zeile 3360 |
---|
} else {
|
} else {
|
$query = $db->simple_select("users", "*", "uid='{$uid}'");
| $query = $db->simple_select("users", "*", "uid='".intval($uid)."'");
|
$user = $db->fetch_array($query); }
|
$user = $db->fetch_array($query); }
|
|
|
$usergroups = "";
|
$usergroups = "";
|
| $groupslist = "";
|
$usergroups = $user['additionalgroups'].",";
|
$usergroups = $user['additionalgroups'].",";
|
|
|
$groups = explode(",", $user['additionalgroups']);
|
$groups = explode(",", $user['additionalgroups']);
|
|
|
if(is_array($groups)) { foreach($groups as $gid)
| if(is_array($groups)) { foreach($groups as $gid)
|
Zeile 3360 | Zeile 3379 |
---|
$groupslist .= $comma.$gid; $comma = ","; $donegroup[$gid] = 1;
|
$groupslist .= $comma.$gid; $comma = ","; $donegroup[$gid] = 1;
|
} } }
| } } }
$dispupdate = "";
|
if($leavegroup == $user['displaygroup']) { $dispupdate = ", displaygroup=usergroup";
| if($leavegroup == $user['displaygroup']) { $dispupdate = ", displaygroup=usergroup";
|
Zeile 3372 | Zeile 3392 |
---|
$db->write_query(" UPDATE ".TABLE_PREFIX."users SET additionalgroups='$groupslist' $dispupdate
|
$db->write_query(" UPDATE ".TABLE_PREFIX."users SET additionalgroups='$groupslist' $dispupdate
|
WHERE uid='$uid'
| WHERE uid='".intval($uid)."'
|
"); $cache->update_moderators();
| "); $cache->update_moderators();
|
Zeile 3394 | Zeile 3414 |
---|
if(!empty($_SERVER['PATH_INFO'])) {
|
if(!empty($_SERVER['PATH_INFO'])) {
|
$location = $_SERVER['PATH_INFO'];
| $location = htmlspecialchars_uni($_SERVER['PATH_INFO']);
|
} elseif(!empty($_ENV['PATH_INFO'])) {
|
} elseif(!empty($_ENV['PATH_INFO'])) {
|
$location = $_ENV['PATH_INFO'];
| $location = htmlspecialchars_uni($_ENV['PATH_INFO']);
|
} elseif(!empty($_ENV['PHP_SELF']))
|
} elseif(!empty($_ENV['PHP_SELF']))
|
{ $location = $_ENV['PHP_SELF'];
| { $location = htmlspecialchars_uni($_ENV['PHP_SELF']);
|
} else
|
} else
|
{ $location = $_SERVER['PHP_SELF'];
| { $location = htmlspecialchars_uni($_SERVER['PHP_SELF']);
|
}
if($fields == true)
| }
if($fields == true)
|
Zeile 3414 | Zeile 3434 |
---|
global $mybb; if(!is_array($ignore))
|
global $mybb; if(!is_array($ignore))
|
{
| {
|
$ignore = array($ignore); }
|
$ignore = array($ignore); }
|
|
|
$form_html = ""; $field_parts = explode('&', $field_parts);
| $form_html = ""; $field_parts = explode('&', $field_parts);
|
Zeile 3426 | Zeile 3446 |
---|
foreach($mybb->input as $name => $value) { if(in_array($name, $ignore))
|
foreach($mybb->input as $name => $value) { if(in_array($name, $ignore))
|
{
| {
|
continue; }
| continue; }
|
Zeile 3440 | Zeile 3460 |
---|
{ if(isset($_SERVER['QUERY_STRING'])) {
|
{ if(isset($_SERVER['QUERY_STRING'])) {
|
$location .= "?".$_SERVER['QUERY_STRING'];
| $location .= "?".htmlspecialchars_uni($_SERVER['QUERY_STRING']);
|
} else if(isset($_ENV['QUERY_STRING'])) {
|
} else if(isset($_ENV['QUERY_STRING'])) {
|
$location = "?".$_ENV['QUERY_STRING'];
| $location .= "?".htmlspecialchars_uni($_ENV['QUERY_STRING']);
|
} if((isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == "POST") || (isset($_ENV['REQUEST_METHOD']) && $_ENV['REQUEST_METHOD'] == "POST"))
| } if((isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == "POST") || (isset($_ENV['REQUEST_METHOD']) && $_ENV['REQUEST_METHOD'] == "POST"))
|
Zeile 3455 | Zeile 3475 |
---|
{ if(isset($_POST[$var])) {
|
{ if(isset($_POST[$var])) {
|
$addloc[] = $var.'='.$_POST[$var];
| $addloc[] = urlencode($var).'='.urlencode($_POST[$var]);
|
} }
|
} }
|
if(isset($addlock) && is_array($addloc))
| if(isset($addloc) && is_array($addloc))
|
{ $location .= "?".implode("&", $addloc); } }
|
{ $location .= "?".implode("&", $addloc); } }
|
| |
return $location; }
| return $location; }
|
Zeile 3756 | Zeile 3775 |
---|
my_substr($by, 2), $by, ($bd[0] == 0 ? my_substr($bd, 1) : $bd),
|
my_substr($by, 2), $by, ($bd[0] == 0 ? my_substr($bd, 1) : $bd),
|
($db == 1 || $db == 21 || $db == 31 ? 'st' : ($db == 2 || $db == 22 ? 'nd' : ($db == 3 || $db == 23 ? 'rd' : 'th'))),
| ($bd == 1 || $bd == 21 || $bd == 31 ? 'st' : ($bd == 2 || $bd == 22 ? 'nd' : ($bd == 3 || $bd == 23 ? 'rd' : 'th'))),
|
$bdays[$wd], $bmonth[$bm-1], );
| $bdays[$wd], $bmonth[$bm-1], );
|
Zeile 3798 | Zeile 3817 |
---|
{ global $db;
|
{ global $db;
|
$query = $db->simple_select("posts", "pid", "tid='{$tid}'", array('order_by' => 'dateline', 'limit' => 1));
| $query = $db->simple_select("posts", "pid,replyto", "tid='{$tid}'", array('order_by' => 'dateline', 'limit' => 1));
|
$post = $db->fetch_array($query);
if($post['replyto'] != 0)
| $post = $db->fetch_array($query);
if($post['replyto'] != 0)
|
Zeile 3806 | Zeile 3825 |
---|
$replyto_update = array( "replyto" => 0 );
|
$replyto_update = array( "replyto" => 0 );
|
$db->update_query("threads", $replyto_update, "pid='{$post['pid']}'");
| $db->update_query("posts", $replyto_update, "pid='{$post['pid']}'");
|
}
$firstpostup = array(
| }
$firstpostup = array(
|
Zeile 3825 | Zeile 3844 |
---|
{ global $lang;
|
{ global $lang;
|
$string = preg_replace("#&\#(0-9]+);#", "-", $string);
| $string = preg_replace("#&\#([0-9]+);#", "-", $string);
|
if(strtolower($lang->settings['charset']) == "utf-8") {
| if(strtolower($lang->settings['charset']) == "utf-8") {
|
Zeile 3835 | Zeile 3854 |
---|
// Remove dodgy whitespaces $string = str_replace(chr(0xCA), "", $string);
|
// Remove dodgy whitespaces $string = str_replace(chr(0xCA), "", $string);
|
$string = str_replace(" ", " ", $string);
| |
} $string = trim($string);
| } $string = trim($string);
|
Zeile 4613 | Zeile 4631 |
---|
*/ function build_highlight_array($terms) {
|
*/ function build_highlight_array($terms) {
|
$terms = htmlspecialchars_uni($terms);
| |
// Strip out any characters that shouldn't be included $bad_characters = array( "(",
| // Strip out any characters that shouldn't be included $bad_characters = array( "(",
|
Zeile 4632 | Zeile 4648 |
---|
$terms = explode("\"", $terms); foreach($terms as $phrase) {
|
$terms = explode("\"", $terms); foreach($terms as $phrase) {
|
| $phrase = htmlspecialchars_uni($phrase);
|
if($phrase != "") { if($inquote)
|
if($phrase != "") { if($inquote)
|
{
| {
|
$words[] = "\"".trim($phrase)."\""; } else
| $words[] = "\"".trim($phrase)."\""; } else
|
Zeile 4656 | Zeile 4673 |
---|
} } $inquote = !$inquote;
|
} } $inquote = !$inquote;
|
}
| }
|
} // Otherwise just a simple search query with no phrases else {
|
} // Otherwise just a simple search query with no phrases else {
|
| $terms = htmlspecialchars_uni($terms);
|
$split_words = preg_split("#\s{1,}#", $terms, -1); if(!is_array($split_words)) {
| $split_words = preg_split("#\s{1,}#", $terms, -1); if(!is_array($split_words)) {
|
Zeile 5055 | Zeile 5073 |
---|
if($string != "") { if($in_escape)
|
if($string != "") { if($in_escape)
|
{
| {
|
$strings[] = trim($string); } else
| $strings[] = trim($string); } else
|
Zeile 5244 | Zeile 5262 |
---|
* Custom chmod function to fix problems with hosts who's server configurations screw up umasks * * @param string The file to chmod
|
* Custom chmod function to fix problems with hosts who's server configurations screw up umasks * * @param string The file to chmod
|
* @param octal The mode to chmod(i.e. 0666)
| * @param string The mode to chmod(i.e. 0666)
|
*/ function my_chmod($file, $mode) {
|
*/ function my_chmod($file, $mode) {
|
| // Passing $mode as an octal number causes strlen and substr to return incorrect values. Instead pass as a string
|
if(substr($mode, 0, 1) != '0' || strlen($mode) !== 4) { return false; } $old_umask = umask(0);
|
if(substr($mode, 0, 1) != '0' || strlen($mode) !== 4) { return false; } $old_umask = umask(0);
|
$result = chmod($file, $mode);
| // We convert the octal string to a decimal number because passing a octal string doesn't work with chmod // and type casting subsequently removes the prepended 0 which is needed for octal numbers $result = chmod($file, octdec($mode));
|
umask($old_umask); return $result; }
| umask($old_umask); return $result; }
|
Zeile 5286 | Zeile 5308 |
---|
} @closedir($dh); }
|
} @closedir($dh); }
|
|
|
// Are we done? Don't delete the main folder too and return true if($path == $orig_dir) {
| // Are we done? Don't delete the main folder too and return true if($path == $orig_dir) {
|
Zeile 5297 | Zeile 5319 |
---|
} return @unlink($path);
|
} return @unlink($path);
|
| }
/** * Counts the number of subforums in a array([pid][disporder][fid]) starting from the pid * * @param array The array of forums * @return integer The number of sub forums */ function subforums_count($array) { $count = 0; foreach($array as $array2) { $count += count($array2); } return $count;
|
}
?>
| }
?>
|