Zeile 6 | Zeile 6 |
---|
* Website: http://www.mybboard.net * License: http://www.mybboard.net/eula.html *
|
* Website: http://www.mybboard.net * License: http://www.mybboard.net/eula.html *
|
* $Id: functions.php 3070 2007-05-18 07:44:28Z chris $
| * $Id: functions.php 3508 2007-11-23 16:10:16Z Tikitiki $
|
*/
/**
| */
/**
|
Zeile 18 | Zeile 18 |
---|
{ global $db, $lang, $theme, $plugins, $mybb; global $querytime, $debug, $templatecache, $templatelist, $maintimer, $globaltime, $parsetime;
|
{ global $db, $lang, $theme, $plugins, $mybb; global $querytime, $debug, $templatecache, $templatelist, $maintimer, $globaltime, $parsetime;
|
| |
$contents = parse_page($contents); $totaltime = $maintimer->stop(); if($mybb->usergroup['cancp'] == "yes")
| $contents = parse_page($contents); $totaltime = $maintimer->stop(); if($mybb->usergroup['cancp'] == "yes")
|
Zeile 38 | Zeile 37 |
---|
$debuglink = htmlspecialchars(getenv("REQUEST_URI")) . "?debug=1"; } if($mybb->settings['gzipoutput'] != "no")
|
$debuglink = htmlspecialchars(getenv("REQUEST_URI")) . "?debug=1"; } if($mybb->settings['gzipoutput'] != "no")
|
{
| {
|
$gzipen = "Enabled"; } else
| $gzipen = "Enabled"; } else
|
Zeile 58 | Zeile 57 |
---|
if(isset($mybb->input['debug'])) { debug_page();
|
if(isset($mybb->input['debug'])) { debug_page();
|
} }
| } }
|
$contents = str_replace("<debugstuff>", "", $contents); $contents = $plugins->run_hooks("pre_output_page", $contents);
if($mybb->settings['gzipoutput'] != "no") { if(version_compare(PHP_VERSION, '4.2.0', '>='))
|
$contents = str_replace("<debugstuff>", "", $contents); $contents = $plugins->run_hooks("pre_output_page", $contents);
if($mybb->settings['gzipoutput'] != "no") { if(version_compare(PHP_VERSION, '4.2.0', '>='))
|
{
| {
|
$contents = gzip_encode($contents, $mybb->settings['gziplevel']);
|
$contents = gzip_encode($contents, $mybb->settings['gziplevel']);
|
}
| }
|
else { $contents = gzip_encode($contents); } }
|
else { $contents = gzip_encode($contents); } }
|
| @header("Content-type: text/html; charset={$lang->settings['charset']}");
|
echo $contents;
$plugins->run_hooks("post_output_page");
| echo $contents;
$plugins->run_hooks("post_output_page");
|
Zeile 131 | Zeile 133 |
---|
{ require_once MYBB_ROOT."inc/class_datacache.php"; $cache = new datacache;
|
{ require_once MYBB_ROOT."inc/class_datacache.php"; $cache = new datacache;
|
}
| }
|
// And finaly.. we have the PHP developers to thank for this "hack" which fixes a problem THEY created if(!is_object($plugins) && !defined("NO_PLUGINS"))
| // And finaly.. we have the PHP developers to thank for this "hack" which fixes a problem THEY created if(!is_object($plugins) && !defined("NO_PLUGINS"))
|
Zeile 219 | Zeile 221 |
---|
{ $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);
|
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'])
|
if($lang->settings['htmllang'])
|
{ $contents = str_replace("<html", "<html lang=\"".$lang->settings['htmllang']."\"", $contents); }
| { $contents = str_replace("<html", "<html xml:lang=\"".$lang->settings['htmllang']."\" lang=\"".$lang->settings['htmllang']."\"", $contents); }
|
if($loadpmpopup) {
| if($loadpmpopup) {
|
Zeile 246 | Zeile 251 |
---|
* @param int The offset in hours that should be applied to times. (timezones) * @param int Whether or not to use today/yesterday formatting. * @return string The formatted timestamp.
|
* @param int The offset in hours that should be applied to times. (timezones) * @param int Whether or not to use today/yesterday formatting. * @return string The formatted timestamp.
|
*/
| */
|
function my_date($format, $stamp="", $offset="", $ty=1) { global $mybb, $lang, $mybbadmin, $plugins;
| function my_date($format, $stamp="", $offset="", $ty=1) { global $mybb, $lang, $mybbadmin, $plugins;
|
Zeile 273 | Zeile 278 |
---|
{ $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 == "yes") {
| // If DST correction is enabled, add an additional hour to the timezone. if($dstcorrection == "yes") {
|
Zeile 287 | Zeile 292 |
---|
if($offset == "-") { $offset = 0;
|
if($offset == "-") { $offset = 0;
|
}
| }
|
$date = gmdate($format, $stamp + ($offset * 3600)); if($mybb->settings['dateformat'] == $format && $ty) {
| $date = gmdate($format, $stamp + ($offset * 3600)); if($mybb->settings['dateformat'] == $format && $ty) {
|
Zeile 301 | Zeile 306 |
---|
elseif($yesterdaysdate == $date) { $date = $lang->yesterday;
|
elseif($yesterdaysdate == $date) { $date = $lang->yesterday;
|
} }
| } }
|
$plugins->run_hooks_by_ref("my_date", $date);
return $date;
| $plugins->run_hooks_by_ref("my_date", $date);
return $date;
|
Zeile 353 | Zeile 358 |
---|
$headers .= "X-Priority: 3\n"; $headers .= "X-MSMail-Priority: Normal\n"; $headers .= "X-Mailer: MyBB\n";
|
$headers .= "X-Priority: 3\n"; $headers .= "X-MSMail-Priority: Normal\n"; $headers .= "X-Mailer: MyBB\n";
|
| if(defined("IN_ADMINCP")) { $_SERVER['PHP_SELF'] = str_replace($mybb->config['admin_dir']."/", "admin-", $_SERVER['PHP_SELF']); }
|
$headers .= "X-MyBB-Script: {$http_host}{$_SERVER['PHP_SELF']}\n";
// For some reason sendmail/qmail doesn't like \r\n
| $headers .= "X-MyBB-Script: {$http_host}{$_SERVER['PHP_SELF']}\n";
// For some reason sendmail/qmail doesn't like \r\n
|
Zeile 474 | Zeile 483 |
---|
add_breadcrumb($lang->error); eval("\$errorpage = \"".$templates->get("error")."\";"); output_page($errorpage);
|
add_breadcrumb($lang->error); eval("\$errorpage = \"".$templates->get("error")."\";"); output_page($errorpage);
|
exit;
| exit;
|
}
/**
| }
/**
|
Zeile 517 | Zeile 526 |
---|
"location1" => 0, "location2" => 0 );
|
"location1" => 0, "location2" => 0 );
|
$db->update_query(TABLE_PREFIX."sessions", $noperm_array, "sid='".$session->sid."'");
| $db->update_query(TABLE_PREFIX."sessions", $noperm_array, "sid='".$session->sid."'", 1);
|
$url = htmlspecialchars_uni($_SERVER['REQUEST_URI']); if($mybb->user['uid']) {
| $url = htmlspecialchars_uni($_SERVER['REQUEST_URI']); if($mybb->user['uid']) {
|
Zeile 663 | Zeile 672 |
---|
}
// Collect group permissions.
|
}
// Collect group permissions.
|
$gid = $user_cache[$uid]['usergroup'].",".$user_cache[$uid]['additionalgroups'];
| $gid = $user_cache[$uid]['usergroup']; if($user_cache[$uid]['additionalgroups']) { $gid .= ",".$user_cache[$uid]['additionalgroups']; }
|
$groupperms = usergroup_permissions($gid);
// Store group permissions in user cache.
| $groupperms = usergroup_permissions($gid);
// Store group permissions in user cache.
|
Zeile 691 | Zeile 704 |
---|
{ $groupscache = $cache->read("usergroups"); }
|
{ $groupscache = $cache->read("usergroups"); }
|
|
|
$groups = explode(",", $gid); if(count($groups) == 1) {
| $groups = explode(",", $gid); if(count($groups) == 1) {
|
Zeile 714 | Zeile 728 |
---|
{ $permbit = ""; }
|
{ $permbit = ""; }
|
$zerogreater = 0;
|
|
if(in_array($perm, $groupzerogreater)) { if($access == 0) { $usergroup[$perm] = 0;
|
if(in_array($perm, $groupzerogreater)) { if($access == 0) { $usergroup[$perm] = 0;
|
$zerogreater = 1;
| continue;
|
}
|
}
|
} if(($access > $permbit || ($access == "yes" && $permbit == "no") || !$permbit) && $zerogreater != 1)
| }
if($access > $permbit || ($access == "yes" && $permbit == "no") || !$permbit)
|
{ $usergroup[$perm] = $access; }
| { $usergroup[$perm] = $access; }
|
Zeile 740 | Zeile 755 |
---|
* @return array Array of display properties for the group */ function usergroup_displaygroup($gid)
|
* @return array Array of display properties for the group */ function usergroup_displaygroup($gid)
|
{
| {
|
global $cache, $groupscache, $displaygroupfields;
if(!is_array($groupscache)) { $groupscache = $cache->read("usergroups");
|
global $cache, $groupscache, $displaygroupfields;
if(!is_array($groupscache)) { $groupscache = $cache->read("usergroups");
|
}
| }
|
$displaygroup = array(); $group = $groupscache[$gid]; foreach($displaygroupfields as $field) { $displaygroup[$field] = $group[$field];
|
$displaygroup = array(); $group = $groupscache[$gid]; foreach($displaygroupfields as $field) { $displaygroup[$field] = $group[$field];
|
}
| }
|
return $displaygroup; }
| return $displaygroup; }
|
Zeile 767 | Zeile 782 |
---|
function forum_permissions($fid=0, $uid=0, $gid=0) { global $db, $cache, $groupscache, $forum_cache, $fpermcache, $mybb, $usercache, $fpermissionscache;
|
function forum_permissions($fid=0, $uid=0, $gid=0) { global $db, $cache, $groupscache, $forum_cache, $fpermcache, $mybb, $usercache, $fpermissionscache;
|
| static $cached_forum_permissions;
|
if($uid == 0) { $uid = $mybb->user['uid'];
| if($uid == 0) { $uid = $mybb->user['uid'];
|
Zeile 792 | Zeile 807 |
---|
$gid .= ",".$mybb->user['additionalgroups']; } $groupperms = $mybb->usergroup;
|
$gid .= ",".$mybb->user['additionalgroups']; } $groupperms = $mybb->usergroup;
|
}
| }
|
} if(!is_array($forum_cache)) {
| } if(!is_array($forum_cache)) {
|
Zeile 805 | Zeile 820 |
---|
if(!is_array($fpermcache)) { $fpermcache = $cache->read("forumpermissions");
|
if(!is_array($fpermcache)) { $fpermcache = $cache->read("forumpermissions");
|
}
| }
|
if($fid) // Fetch the permissions for a single forum
|
if($fid) // Fetch the permissions for a single forum
|
{ $permissions = fetch_forum_permissions($fid, $gid, $groupperms);
| { if(!$cached_forum_permissions[$gid][$fid]) { $cached_forum_permissions_permissions[$gid][$fid] = fetch_forum_permissions($fid, $gid, $groupperms); } return $cached_forum_permissions_permissions[$gid][$fid];
|
} else {
|
} else {
|
foreach($forum_cache as $forum)
| if(!$cached_forum_permissions[$gid])
|
{
|
{
|
$permissions[$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); }
|
}
|
}
|
| return $cached_forum_permissions[$gid];
|
}
|
}
|
return $permissions;
| |
}
/**
| }
/**
|
Zeile 848 | Zeile 870 |
---|
{ // If this forum has permissions set if($fpermcache[$fid][$gid])
|
{ // If this forum has permissions set if($fpermcache[$fid][$gid])
|
{
| {
|
$level_permissions = $fpermcache[$fid][$gid]; foreach($level_permissions as $permission => $access) {
| $level_permissions = $fpermcache[$fid][$gid]; foreach($level_permissions as $permission => $access) {
|
Zeile 872 | Zeile 894 |
---|
* Check the password given on a certain forum for validity * * @param int The forum ID
|
* Check the password given on a certain forum for validity * * @param int The forum ID
|
* @param string The plain text password for the forum
| * @param boolean The Parent ID
|
*/
|
*/
|
function check_forum_password($fid, $password="")
| function check_forum_password($fid, $pid=0)
|
{
|
{
|
global $mybb, $header, $footer, $headerinclude, $theme, $templates, $lang; $showform = 1;
| global $mybb, $header, $footer, $headerinclude, $theme, $templates, $lang, $forum_cache; $showform = true; if(!is_array($forum_cache)) { $forum_cache = cache_forums(); if(!$forum_cache) { return false; } }
// Loop through each of parent forums to ensure we have a password for them too $parents = explode(',', $forum_cache[$fid]['parentlist']); rsort($parents); if(!empty($parents)) { foreach($parents as $parent_id) { if($parent_id == $fid || $parent_id == $pid) { continue; } if($forum_cache[$parent_id]['password'] != "") { check_forum_password($parent_id, $fid); } } } $password = $forum_cache[$fid]['password'];
|
if($password) { if($mybb->input['pwverify'])
| if($password) { if($mybb->input['pwverify'])
|
Zeile 886 | Zeile 938 |
---|
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 = 0;
| $showform = false;
|
} else { eval("\$pwnote = \"".$templates->get("forumdisplay_password_wrongpass")."\";");
|
} else { eval("\$pwnote = \"".$templates->get("forumdisplay_password_wrongpass")."\";");
|
$showform = 1; } }
| $showform = true; } }
|
else { if(!$_COOKIE['forumpass'][$fid] || ($_COOKIE['forumpass'][$fid] && md5($mybb->user['uid'].$password) != $_COOKIE['forumpass'][$fid])) {
|
else { if(!$_COOKIE['forumpass'][$fid] || ($_COOKIE['forumpass'][$fid] && md5($mybb->user['uid'].$password) != $_COOKIE['forumpass'][$fid])) {
|
$showform = 1;
| $showform = true;
|
} else {
|
} else {
|
$showform = 0;
| $showform = false;
|
} } } else {
|
} } } else {
|
$showform = 0;
| $showform = false;
|
}
|
}
|
|
|
if($showform) { $_SERVER['REQUEST_URI'] = htmlspecialchars_uni($_SERVER['REQUEST_URI']);
| if($showform) { $_SERVER['REQUEST_URI'] = htmlspecialchars_uni($_SERVER['REQUEST_URI']);
|
Zeile 1178 | Zeile 1231 |
---|
function get_server_load() { global $lang;
|
function get_server_load() { global $lang;
|
if(strtolower(substr(PHP_OS, 0, 3)) === 'win') { return $lang->unknown; } elseif(@file_exists("/proc/loadavg") && $load = @file_get_contents("/proc/loadavg"))
| $serverload = array();
if(my_strtolower(substr(PHP_OS, 0, 3)) !== 'win')
|
{
|
{
|
$serverload = explode(" ", $load); $serverload[0] = round($serverload[0], 4);
| if(@file_exists("/proc/loadavg") && $load = @file_get_contents("/proc/loadavg")) { $serverload = explode(" ", $load); $serverload[0] = round($serverload[0], 4); }
|
if(!$serverload) {
|
if(!$serverload) {
|
| // Suhosin likes to throw a warning if exec is disabled then die - weird if($func_blacklist = @ini_get('suhosin.executor.func.blacklist')) { if(strpos(",".$func_blacklist.",", 'exec') !== false) { return $lang->unknown; } } // PHP disabled functions? if($func_blacklist = @ini_get('disabled_functions')) { if(strpos(",".$func_blacklist.",", 'exec') !== false) { return $lang->unknown; } }
|
$load = @exec("uptime"); $load = split("load averages?: ", $load); $serverload = explode(",", $load[1]);
|
$load = @exec("uptime"); $load = split("load averages?: ", $load); $serverload = explode(",", $load[1]);
|
| if(!is_array($serverload)) { return $lang->unknown; }
|
}
|
}
|
}
| }
|
else {
|
else {
|
$load = @exec("uptime"); $load = split("load averages?: ", $load); $serverload = explode(",", $load[1]);
| return $lang->unknown;
|
}
|
}
|
|
|
$returnload = trim($serverload[0]);
|
$returnload = trim($serverload[0]);
|
if(!$returnload) { $returnload = $lang->unknown; }
|
|
return $returnload; }
|
return $returnload; }
|
|
|
/** * Updates the forum statistics with specific values (or addition/subtraction of the previous value) *
|
/** * Updates the forum statistics with specific values (or addition/subtraction of the previous value) *
|
* @param array Array of items being updated (numthreads,numposts,numusers)
| * @param array Array of items being updated (numthreads,numposts,numusers,lastuser)
|
*/ function update_stats($changes=array()) { global $cache, $db;
|
*/ function update_stats($changes=array()) { global $cache, $db;
|
$stats = $cache->read("stats");
$counters = array('numthreads','numposts','numusers');
| $stats = $cache->read("stats");
$counters = array('numthreads', 'numposts', 'numusers');
|
$update = array(); foreach($counters as $counter) {
| $update = array(); foreach($counters as $counter) {
|
Zeile 1242 | Zeile 1314 |
---|
}
// Fetch latest user if the user count is changing
|
}
// Fetch latest user if the user count is changing
|
if(array_key_exists('numusers', $changes))
| if(array_key_exists('numusers', $changes) || array_key_exists('lastuser', $changes))
|
{ $query = $db->simple_select(TABLE_PREFIX."users", "uid, username", "", array('order_by' => 'uid', 'order_dir' => 'DESC', 'limit' => 1)); $lastmember = $db->fetch_array($query);
| { $query = $db->simple_select(TABLE_PREFIX."users", "uid, username", "", array('order_by' => 'uid', 'order_dir' => 'DESC', 'limit' => 1)); $lastmember = $db->fetch_array($query);
|
Zeile 1306 | Zeile 1378 |
---|
}
// Guess we should update the statistics too?
|
}
// Guess we should update the statistics too?
|
if($update_query['threads'] || $update_query['posts'])
| if(isset($update_query['threads']) || isset($update_query['posts']))
|
{ $new_stats = array(); if(array_key_exists('threads', $update_query))
| { $new_stats = array(); if(array_key_exists('threads', $update_query))
|
Zeile 1331 | Zeile 1403 |
---|
else { $new_stats['numposts'] = "{$posts_diff}";
|
else { $new_stats['numposts'] = "{$posts_diff}";
|
} }
| } }
|
update_stats($new_stats); }
|
update_stats($new_stats); }
|
|
|
// Update last post info update_forum_lastpost($fid); }
| // Update last post info update_forum_lastpost($fid); }
|
Zeile 1416 | Zeile 1489 |
---|
}
update_thread_data($tid);
|
}
update_thread_data($tid);
|
}
| }
|
/** * Update the first post and lastpost data for a specific thread
| /** * Update the first post and lastpost data for a specific thread
|
Zeile 1535 | Zeile 1608 |
---|
*/ function build_forum_jump($pid="0", $selitem="", $addselect="1", $depth="", $showextras="1", $permissions="", $name="fid") {
|
*/ function build_forum_jump($pid="0", $selitem="", $addselect="1", $depth="", $showextras="1", $permissions="", $name="fid") {
|
global $db, $forum_cache, $fjumpcache, $permissioncache, $mybb, $selecteddone, $forumjump, $forumjumpbits, $gobutton, $theme, $templates, $lang;
| global $db, $forum_cache, $jumpfcache, $permissioncache, $mybb, $selecteddone, $forumjump, $forumjumpbits, $gobutton, $theme, $templates, $lang;
|
$pid = intval($pid); if($permissions)
| $pid = intval($pid); if($permissions)
|
Zeile 1575 | Zeile 1648 |
---|
$optionselected = "selected=\"selected\""; $selecteddone = 1; }
|
$optionselected = "selected=\"selected\""; $selecteddone = 1; }
|
| $forum['name'] = htmlspecialchars_uni($forum['name']);
|
eval("\$forumjumpbits .= \"".$templates->get("forumjump_bit")."\";"); if($forum_cache[$forum['fid']]) {
| eval("\$forumjumpbits .= \"".$templates->get("forumjump_bit")."\";"); if($forum_cache[$forum['fid']]) {
|
Zeile 1707 | Zeile 1783 |
---|
"editor_size_x_small", "editor_size_small", "editor_size_medium",
|
"editor_size_x_small", "editor_size_small", "editor_size_medium",
|
| "editor_size_large",
|
"editor_size_x_large", "editor_size_xx_large", "editor_color_white",
| "editor_size_x_large", "editor_size_xx_large", "editor_color_white",
|
Zeile 1757 | Zeile 1834 |
---|
global $db, $smiliecache, $theme, $templates, $lang, $mybb, $smiliecount;
if($mybb->settings['smilieinserter'] != "off" && $mybb->settings['smilieinsertercols'] && $mybb->settings['smilieinsertertot'])
|
global $db, $smiliecache, $theme, $templates, $lang, $mybb, $smiliecount;
if($mybb->settings['smilieinserter'] != "off" && $mybb->settings['smilieinsertercols'] && $mybb->settings['smilieinsertertot'])
|
{
| {
|
if(!$smiliecount) { $query = $db->simple_select(TABLE_PREFIX."smilies", "COUNT(*) as smilies");
| if(!$smiliecount) { $query = $db->simple_select(TABLE_PREFIX."smilies", "COUNT(*) as smilies");
|
Zeile 1771 | Zeile 1848 |
---|
while($smilie = $db->fetch_array($query)) { $smiliecache[$smilie['find']] = $smilie['image'];
|
while($smilie = $db->fetch_array($query)) { $smiliecache[$smilie['find']] = $smilie['image'];
|
}
| }
|
} unset($smilie); if(is_array($smiliecache)) { reset($smiliecache); if($mybb->settings['smilieinsertertot'] >= $smiliecount)
|
} unset($smilie); if(is_array($smiliecache)) { reset($smiliecache); if($mybb->settings['smilieinsertertot'] >= $smiliecount)
|
{
| {
|
$mybb->settings['smilieinsertertot'] = $smiliecount; } elseif ($mybb->settings['smilieinsertertot'] < $smiliecount) { $smiliecount = $mybb->settings['smilieinsertertot']; eval("\$getmore = \"".$templates->get("smilieinsert_getmore")."\";");
|
$mybb->settings['smilieinsertertot'] = $smiliecount; } elseif ($mybb->settings['smilieinsertertot'] < $smiliecount) { $smiliecount = $mybb->settings['smilieinsertertot']; eval("\$getmore = \"".$templates->get("smilieinsert_getmore")."\";");
|
}
| }
|
$smilies = ""; $counter = 0; $i = 0;
| $smilies = ""; $counter = 0; $i = 0;
|
Zeile 1814 | Zeile 1891 |
---|
$smilies .= "<td colspan=\"{$colspan}\"> </td>\n</tr>\n"; } eval("\$clickablesmilies = \"".$templates->get("smilieinsert")."\";");
|
$smilies .= "<td colspan=\"{$colspan}\"> </td>\n</tr>\n"; } eval("\$clickablesmilies = \"".$templates->get("smilieinsert")."\";");
|
}
| }
|
else { $clickablesmilies = ""; } } else
|
else { $clickablesmilies = ""; } } else
|
{
| {
|
$clickablesmilies = ""; } return $clickablesmilies;
| $clickablesmilies = ""; } return $clickablesmilies;
|
Zeile 1842 | Zeile 1919 |
---|
if(isset($_SERVER['HTTP_ACCEPT_ENCODING'])) { $httpaccept_encoding = $_SERVER['HTTP_ACCEPT_ENCODING'];
|
if(isset($_SERVER['HTTP_ACCEPT_ENCODING'])) { $httpaccept_encoding = $_SERVER['HTTP_ACCEPT_ENCODING'];
|
}
| }
|
if(strpos(" ".$httpaccept_encoding, "x-gzip")) { $encoding = "x-gzip";
| if(strpos(" ".$httpaccept_encoding, "x-gzip")) { $encoding = "x-gzip";
|
Zeile 1871 | Zeile 1948 |
---|
} } return $contents;
|
} } return $contents;
|
}
| }
|
/** * Log the actions of a moderator. *
| /** * Log the actions of a moderator. *
|
Zeile 1894 | Zeile 1971 |
---|
unset($data['fid']); } if($data['tid'] == '')
|
unset($data['fid']); } if($data['tid'] == '')
|
{
| {
|
$tid = 0; } else
| $tid = 0; } else
|
Zeile 1937 | Zeile 2014 |
---|
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 .= "reputation_negative"; } else if($reputation > 0)
|
$display_reputation .= "<strong class=\""; if($reputation < 0) { $display_reputation .= "reputation_negative"; } else if($reputation > 0)
|
{
| {
|
$display_reputation .= "reputation_positive";
|
$display_reputation .= "reputation_positive";
|
}
| }
|
else { $display_reputation .= "reputation_neutral";
| else { $display_reputation .= "reputation_neutral";
|
Zeile 1957 | Zeile 2034 |
---|
$display_reputation .= "</a>"; } return $display_reputation;
|
$display_reputation .= "</a>"; } return $display_reputation;
|
}
| }
|
/** * Fetch the IP address of the current user. *
| /** * Fetch the IP address of the current user. *
|
Zeile 1978 | Zeile 2055 |
---|
break; } }
|
break; } }
|
} }
| } }
|
if(!isset($ip)) { if(isset($_SERVER['HTTP_CLIENT_IP']))
| if(!isset($ip)) { if(isset($_SERVER['HTTP_CLIENT_IP']))
|
Zeile 2022 | Zeile 2099 |
---|
elseif($size == 0) { $size = "0 ".$lang->size_bytes;
|
elseif($size == 0) { $size = "0 ".$lang->size_bytes;
|
}
| }
|
else { $size = $size . " " . $lang->size_bytes;
| else { $size = $size . " " . $lang->size_bytes;
|
Zeile 2041 | Zeile 2118 |
---|
global $cache, $attachtypes;
if(!$attachtypes)
|
global $cache, $attachtypes;
if(!$attachtypes)
|
{
| {
|
$attachtypes = $cache->read("attachtypes"); }
|
$attachtypes = $cache->read("attachtypes"); }
|
| $directory = ""; if(defined("IN_PORTAL")) { global $change_dir; $directory = $change_dir."/"; }
|
$ext = strtolower($ext); if($attachtypes[$ext]['icon']) {
|
$ext = strtolower($ext); if($attachtypes[$ext]['icon']) {
|
return "<img src=\"".$attachtypes[$ext]['icon']."\" border=\"0\" alt=\".$ext File\" />";
| return "<img src=\"{$directory}".$attachtypes[$ext]['icon']."\" border=\"0\" alt=\".$ext File\" />";
|
} else {
|
} else {
|
return "<img src=\"images/attachtypes/unknown.gif\" border=\"0\" alt=\".$ext File\" />";
| return "<img src=\"{$directory}images/attachtypes/unknown.gif\" border=\"0\" alt=\".$ext File\" />";
|
} }
| } }
|
Zeile 2300 | Zeile 2386 |
---|
$gzipen = "Disabled"; } echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
|
$gzipen = "Disabled"; } echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
|
echo "<html lang=\"en\">";
| echo "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">";
|
echo "<head>"; echo "<title>MyBB Debug Information</title>"; echo "</head>";
| echo "<head>"; echo "<title>MyBB Debug Information</title>"; echo "</head>";
|
Zeile 2812 | Zeile 2898 |
---|
} }
|
} }
|
if($tid)
| if($tid == 0)
|
{ $themeselect .= "</select>"; } return $themeselect;
|
{ $themeselect .= "</select>"; } return $themeselect;
|
}
| }
|
/** * Custom function for htmlspecialchars which takes in to account unicode
| /** * Custom function for htmlspecialchars which takes in to account unicode
|
Zeile 2864 | Zeile 2950 |
---|
$decimals = 0; } return number_format($number, $decimals, $mybb->settings['decpoint'], $mybb->settings['thousandssep']);
|
$decimals = 0; } return number_format($number, $decimals, $mybb->settings['decpoint'], $mybb->settings['thousandssep']);
|
} }
| } }
|
/** * Replacement function for PHP's wordwrap(). This version does not break up HTML tags, URLs or unicode references.
| /** * Replacement function for PHP's wordwrap(). This version does not break up HTML tags, URLs or unicode references.
|
Zeile 2876 | Zeile 2962 |
---|
function my_wordwrap($message) { global $mybb;
|
function my_wordwrap($message) { global $mybb;
|
|
|
if($mybb->settings['wordwrap'] > 0) { $message = preg_replace("#(?>[^\s&/<>\"\\-\.\[\]]{{$mybb->settings['wordwrap']}})#", "$0 ", $message); } return $message;
|
if($mybb->settings['wordwrap'] > 0) { $message = preg_replace("#(?>[^\s&/<>\"\\-\.\[\]]{{$mybb->settings['wordwrap']}})#", "$0 ", $message); } return $message;
|
}
| }
|
/** * Workaround for date limitation in PHP to establish the day of a birthday (Provided by meme)
| /** * Workaround for date limitation in PHP to establish the day of a birthday (Provided by meme)
|
Zeile 2913 | Zeile 2999 |
---|
$h = 7; } }
|
$h = 7; } }
|
} } }
/**
| } } }
/**
|
* Workaround for date limitation in PHP to establish the day of a birthday (Provided by meme) * * @param int The year.
| * Workaround for date limitation in PHP to establish the day of a birthday (Provided by meme) * * @param int The year.
|
Zeile 3210 | Zeile 3296 |
---|
* @param string The Username of the profile. * @param int The user id of the profile. * @param string The target frame
|
* @param string The Username of the profile. * @param int The user id of the profile. * @param string The target frame
|
| * @param string Any onclick javascript.
|
* @return string The url to the profile. */
|
* @return string The url to the profile. */
|
function build_profile_link($username="", $uid=0, $target="")
| function build_profile_link($username="", $uid=0, $target="", $onclick="")
|
{ global $lang;
| { global $lang;
|
Zeile 3233 | Zeile 3320 |
---|
{ $target = " target=\"{$target}\""; }
|
{ $target = " target=\"{$target}\""; }
|
return "<a href=\"".get_profile_link($uid)."\"{$target}>{$username}</a>";
| if(!empty($onclick)) { $onclick = " onclick=\"{$onclick}\""; } return "<a href=\"".get_profile_link($uid)."\"{$target}{$onclick}>{$username}</a>";
|
} }
| } }
|
Zeile 3278 | Zeile 3369 |
---|
}
/**
|
}
/**
|
* Get the username of a user id.
| * Get the user data of a user id.
|
* * @param int The user id of the user.
|
* * @param int The user id of the user.
|
* @return string The username of the user.
| * @return array The user data.
|
*/ function get_user($uid) {
| */ function get_user($uid) {
|
Zeile 3518 | Zeile 3609 |
---|
*/ function validate_email_format($email) {
|
*/ function validate_email_format($email) {
|
if(!preg_match("/^(.+)@[a-zA-Z0-9-]+\.[a-zA-Z0-9.-]+$/si", $email) || strpos($email, ' ') !== false)
| if(strpos($email, ' ') !== false)
|
{ return false; }
|
{ return false; }
|
else { return true; }
| // Valid local characters for email addresses: http://www.remote.org/jochen/mail/info/chars.html return preg_match("/^[a-zA-Z0-9&*+\-_.{}~^\?=\/]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9.-]+$/si", $email);
|
}
/**
| }
/**
|
Zeile 3612 | Zeile 3701 |
---|
* @return array The array of banned usernames. */ function get_banned_usernames()
|
* @return array The array of banned usernames. */ function get_banned_usernames()
|
{
| {
|
global $mybb; $banned_usernames = explode(",", $mybb->settings['bannedusernames']); $banned_usernames = array_map("trim", $banned_usernames);
| global $mybb; $banned_usernames = explode(",", $mybb->settings['bannedusernames']); $banned_usernames = array_map("trim", $banned_usernames);
|
Zeile 3703 | Zeile 3792 |
---|
} } return false;
|
} } return false;
|
| }
/** * Fetch the contents of a remote fle. * * @param string The URL of the remote file * @return string The remote file contents. */ function fetch_remote_file($url) { if(function_exists("curl_init")) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $data = curl_exec($ch); curl_close($ch); return $data; } else if(function_exists("fsockopen")) { $url = parse_url($url); if(!$url['host']) { return false; } if(!$url['port']) { $url['port'] = 80; } if(!$url['path']) { $url['path'] = "/"; } if($url['query']) { $url['path'] .= "?{$url['path']}"; } $fp = @fsockopen($url['host'], $url['port'], $error_no, $error, 10); @stream_set_timeout($fp, 10); if(!$fp) { return false; } $headers = "GET {$url['path']} HTTP/1.1\r\n"; $headers .= "Host: {$url['host']}\r\n"; $headers .= "Connection: Close\r\n\r\n"; if(!@fwrite($fp, $headers)) { return false; } while(!feof($fp)) { $data .= fgets($fp, 12800); } fclose($fp); $data = explode("\r\n\r\n", $data, 2); return $data[1]; } else { return @implode("", @file($url)); } }
/** * Unicode function for php function chr() * * @param string The character * @return mixed The unicoded chr() */ function unicode_chr($c) { if($c <= 0x7F) { return chr($c); } elseif($c <= 0x7FF) { return chr(0xC0 | $c >> 6) . chr(0x80 | $c & 0x3F); } elseif($c <= 0xFFFF) { return chr(0xE0 | $c >> 12) . chr(0x80 | $c >> 6 & 0x3F) . chr(0x80 | $c & 0x3F); } elseif($c <= 0x10FFFF) { return chr(0xF0 | $c >> 18) . chr(0x80 | $c >> 12 & 0x3F) . chr(0x80 | $c >> 6 & 0x3F) . chr(0x80 | $c & 0x3F); } else { return false; }
|
}
/**
| }
/**
|