Zeile 3 | Zeile 3 |
---|
* MyBB 1.2 * Copyright � 2006 MyBB Group, All Rights Reserved *
|
* MyBB 1.2 * Copyright � 2006 MyBB Group, All Rights Reserved *
|
* Website: http://www.mybboard.com * License: http://www.mybboard.com/eula.html
| * Website: http://www.mybboard.net * License: http://www.mybboard.net/eula.html
|
*
|
*
|
* $Id: functions.php 2794 2007-02-14 02:37:17Z chris $
| * $Id: functions.php 3070 2007-05-18 07:44:28Z chris $
|
*/
/**
| */
/**
|
Zeile 79 | Zeile 79 |
---|
$plugins->run_hooks("post_output_page");
// If the use shutdown functionality is turned off, run any shutdown related items now.
|
$plugins->run_hooks("post_output_page");
// If the use shutdown functionality is turned off, run any shutdown related items now.
|
if(($mybb->settings['useshutdownfunc'] == "no" || phpversion() >= '5.0.5') && $mybb->use_shutdown != true)
| if(($mybb->settings['useshutdownfunc'] == "no"|| phpversion() >= '5.0.5') && $mybb->use_shutdown != true)
|
{ run_shutdown(); }
| { run_shutdown(); }
|
Zeile 353 | Zeile 353 |
---|
$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";
|
| $headers .= "X-MyBB-Script: {$http_host}{$_SERVER['PHP_SELF']}\n";
|
// For some reason sendmail/qmail doesn't like \r\n $sendmail = @ini_get('sendmail_path');
| // For some reason sendmail/qmail doesn't like \r\n $sendmail = @ini_get('sendmail_path');
|
Zeile 935 | Zeile 936 |
---|
{ $uid = $mybb->user['uid']; }
|
{ $uid = $mybb->user['uid']; }
|
if(!isset($modpermscache[$uid][$fid]))
| if(!isset($modpermscache[$fid][$uid]))
|
{ if(!$parentslist) { $parentslist = get_parent_list($fid); }
|
{ if(!$parentslist) { $parentslist = get_parent_list($fid); }
|
|
|
$sql = build_parent_list($fid, "fid", "OR", $parentslist);
|
$sql = build_parent_list($fid, "fid", "OR", $parentslist);
|
$query = $db->query(" SELECT * FROM ".TABLE_PREFIX."moderators WHERE uid='$uid' AND $sql ");
| $query = $db->simple_select(TABLE_PREFIX."moderators", "*", "uid='{$uid}' AND {$sql}");
|
$perms = $db->fetch_array($query);
|
$perms = $db->fetch_array($query);
|
$modpermscache[$uid][$fid] = $perms;
| $modpermscache[$fid][$uid] = $perms;
|
} else {
|
} else {
|
$perms = $modpermscache[$uid][$fid];
| $perms = $modpermscache[$fid][$uid];
|
}
|
}
|
|
|
return $perms; }
| return $perms; }
|
Zeile 969 | Zeile 968 |
---|
function is_moderator($fid="0", $action="", $uid="0") { global $mybb, $db;
|
function is_moderator($fid="0", $action="", $uid="0") { global $mybb, $db;
|
|
|
if($uid == 0) { $uid = $mybb->user['uid']; }
|
if($uid == 0) { $uid = $mybb->user['uid']; }
|
if($mybb->usergroup['issupermod'] == "yes") {
| $user_perms = user_permissions($uid); if($user_perms['issupermod'] == "yes") {
|
return "yes"; } else { if(!$fid) {
|
return "yes"; } else { if(!$fid) {
|
$query = $db->simple_select(TABLE_PREFIX.'moderators', 'mid', "uid={$uid}", array('limit' => 1));
| $query = $db->simple_select(TABLE_PREFIX.'moderators', 'COUNT(*) as count', "uid={$uid}", array('limit' => 1));
|
$modcheck = $db->fetch_array($query);
|
$modcheck = $db->fetch_array($query);
|
if($modcheck['mid'])
| if($modcheck['count'] > 0)
|
{ return "yes"; }
| { return "yes"; }
|
Zeile 1000 | Zeile 1000 |
---|
if(!$action && $modperms) { return "yes";
|
if(!$action && $modperms) { return "yes";
|
}
| }
|
else { if($modperms[$action] == "yes")
| else { if($modperms[$action] == "yes")
|
Zeile 1029 | Zeile 1029 |
---|
if($mybb->input['icon']) { $icon = $mybb->input['icon'];
|
if($mybb->input['icon']) { $icon = $mybb->input['icon'];
|
}
| }
|
$no_icons_checked = " checked=\"checked\""; $query = $db->query(" SELECT *
| $no_icons_checked = " checked=\"checked\""; $query = $db->query(" SELECT *
|
Zeile 1039 | Zeile 1039 |
---|
while($dbicon = $db->fetch_array($query)) { if($icon == $dbicon['iid'])
|
while($dbicon = $db->fetch_array($query)) { if($icon == $dbicon['iid'])
|
{
| {
|
$iconlist .= "<input type=\"radio\" name=\"icon\" value=\"".$dbicon['iid']."\" checked=\"checked\" /> <img src=\"".$dbicon['path']."\" alt=\"".$dbicon['name']."\" />"; $no_icons_checked = "";
|
$iconlist .= "<input type=\"radio\" name=\"icon\" value=\"".$dbicon['iid']."\" checked=\"checked\" /> <img src=\"".$dbicon['path']."\" alt=\"".$dbicon['name']."\" />"; $no_icons_checked = "";
|
}
| }
|
else { $iconlist .= "<input type=\"radio\" name=\"icon\" value=\"".$dbicon['iid']."\" /> <img src=\"".$dbicon['path']."\" alt=\"".$dbicon['name']."\" />";
| else { $iconlist .= "<input type=\"radio\" name=\"icon\" value=\"".$dbicon['iid']."\" /> <img src=\"".$dbicon['path']."\" alt=\"".$dbicon['name']."\" />";
|
Zeile 1056 | Zeile 1056 |
---|
} eval("\$posticons = \"".$templates->get("posticons")."\";"); return $posticons;
|
} eval("\$posticons = \"".$templates->get("posticons")."\";"); return $posticons;
|
}
| }
|
/** * MyBB setcookie() wrapper. *
| /** * MyBB setcookie() wrapper. *
|
Zeile 1114 | Zeile 1114 |
---|
if($httponly == true) { $cookie .= "; HttpOnly";
|
if($httponly == true) { $cookie .= "; HttpOnly";
|
}
| }
|
header($cookie, false); }
| header($cookie, false); }
|
Zeile 1172 | Zeile 1172 |
---|
/** * Returns the serverload of the system.
|
/** * Returns the serverload of the system.
|
*
| *
|
* @return int The serverload of the system. */ function get_server_load() { global $lang; if(strtolower(substr(PHP_OS, 0, 3)) === 'win')
|
* @return int The serverload of the system. */ function get_server_load() { global $lang; if(strtolower(substr(PHP_OS, 0, 3)) === 'win')
|
{
| {
|
return $lang->unknown; }
|
return $lang->unknown; }
|
elseif(@file_exists("/proc/loadavg"))
| elseif(@file_exists("/proc/loadavg") && $load = @file_get_contents("/proc/loadavg"))
|
{
|
{
|
$load = @file_get_contents("/proc/loadavg");
| |
$serverload = explode(" ", $load); $serverload[0] = round($serverload[0], 4); if(!$serverload)
| $serverload = explode(" ", $load); $serverload[0] = round($serverload[0], 4); if(!$serverload)
|
Zeile 1192 | Zeile 1191 |
---|
$load = @exec("uptime"); $load = split("load averages?: ", $load); $serverload = explode(",", $load[1]);
|
$load = @exec("uptime"); $load = split("load averages?: ", $load); $serverload = explode(",", $load[1]);
|
} }
| } }
|
else
|
else
|
{
| {
|
$load = @exec("uptime"); $load = split("load averages?: ", $load); $serverload = explode(",", $load[1]);
| $load = @exec("uptime"); $load = split("load averages?: ", $load); $serverload = explode(",", $load[1]);
|
Zeile 1206 | Zeile 1205 |
---|
$returnload = $lang->unknown; } return $returnload;
|
$returnload = $lang->unknown; } return $returnload;
|
}
/** * Update the forum counters for a specific forum *
| }
/** * Updates the forum statistics with specific values (or addition/subtraction of the previous value) * * @param array Array of items being updated (numthreads,numposts,numusers) */ function update_stats($changes=array()) { global $cache, $db;
$stats = $cache->read("stats");
$counters = array('numthreads','numposts','numusers'); $update = array(); 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) == "-") { $new_stats[$counter] = $stats[$counter] + $changes[$counter]; } else { $new_stats[$counter] = $changes[$counter]; } // Less than 0? That's bad if($new_stats[$counter] < 0) { $new_stats[$counter] = 0; } } }
// Fetch latest user if the user count is changing if(array_key_exists('numusers', $changes)) { $query = $db->simple_select(TABLE_PREFIX."users", "uid, username", "", array('order_by' => 'uid', 'order_dir' => 'DESC', 'limit' => 1)); $lastmember = $db->fetch_array($query); $new_stats['lastuid'] = $lastmember['uid']; $new_stats['lastusername'] = $lastmember['username']; } if(is_array($stats)) { $stats = array_merge($stats, $new_stats); } else { $stats = $new_stats; } $cache->update("stats", $stats); }
/** * Updates the forum counters with a specific value (or addition/subtraction of the previous value) * * @param int The forum ID * @param array Array of items being updated (threads, posts, unapprovedthreads, unapprovedposts) and their value (ex, 1, +1, -1) */ function update_forum_counters($fid, $changes=array()) { global $db, $cache;
$update_query = array();
$counters = array('threads', 'unapprovedthreads', 'posts', 'unapprovedposts');
// Fetch above counters for this forum $query = $db->simple_select(TABLE_PREFIX."forums", implode(",", $counters), "fid='{$fid}'"); $forum = $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) == "-") { $update_query[$counter] = $forum[$counter] + $changes[$counter]; } else { $update_query[$counter] = $changes[$counter]; } // Less than 0? That's bad if($update_query[$counter] < 0) { $update_query[$counter] = 0; } } }
// Only update if we're actually doing something if(count($update_query) > 0) { $db->update_query(TABLE_PREFIX."forums", $update_query, "fid='".intval($fid)."'"); }
// Guess we should update the statistics too? if($update_query['threads'] || $update_query['posts']) { $new_stats = array(); if(array_key_exists('threads', $update_query)) { $threads_diff = $update_query['threads'] - $forum['threads']; if($threads_diff > -1) { $new_stats['numthreads'] = "+{$threads_diff}"; } else { $new_stats['numthreads'] = "{$threads_diff}"; } } if(array_key_exists('posts', $update_query)) { $posts_diff = $update_query['posts'] - $forum['posts']; if($posts_diff > -1) { $new_stats['numposts'] = "+{$posts_diff}"; } else { $new_stats['numposts'] = "{$posts_diff}"; } } update_stats($new_stats); }
// Update last post info update_forum_lastpost($fid); }
/** * Update the last post information for a specific forum *
|
* @param int The forum ID */
|
* @param int The forum ID */
|
function update_forum_count($fid)
| function update_forum_lastpost($fid)
|
{
|
{
|
global $db, $cache;
| global $db;
|
// Fetch the last post for this forum $query = $db->query("
| // Fetch the last post for this forum $query = $db->query("
|
Zeile 1225 | Zeile 1357 |
---|
ORDER BY lastpost DESC LIMIT 0, 1 ");
|
ORDER BY lastpost DESC LIMIT 0, 1 ");
|
$lastpost = $db->fetch_array($query);
// Fetch the number of threads and replies in this forum (Approved only) $query = $db->query(" SELECT COUNT(*) AS threads, SUM(replies) AS replies FROM ".TABLE_PREFIX."threads WHERE fid='$fid' AND visible='1' AND closed NOT LIKE 'moved|%' "); $count = $db->fetch_array($query); $count['posts'] = $count['threads'] + $count['replies'];
// Fetch the number of threads and replies in this forum (Unapproved only) $query = $db->query(" SELECT COUNT(*) AS threads FROM ".TABLE_PREFIX."threads WHERE fid='$fid' AND visible='0' AND closed NOT LIKE 'moved|%' "); $unapproved_count['threads'] = $db->fetch_field($query, "threads"); $query = $db->query(" SELECT SUM(unapprovedposts) AS posts FROM ".TABLE_PREFIX."threads WHERE fid='$fid' AND closed NOT LIKE 'moved|%' "); $unapproved_count['posts'] = $db->fetch_field($query, "posts");
$update_count = array( "posts" => intval($count['posts']), "threads" => intval($count['threads']), "unapprovedposts" => intval($unapproved_count['posts']), "unapprovedthreads" => intval($unapproved_count['threads']),
| $lastpost = $db->fetch_array($query);
$updated_forum = array(
|
"lastpost" => intval($lastpost['lastpost']), "lastposter" => $db->escape_string($lastpost['lastposter']), "lastposteruid" => intval($lastpost['lastposteruid']), "lastposttid" => intval($lastpost['tid']), "lastpostsubject" => $db->escape_string($lastpost['subject'])
|
"lastpost" => intval($lastpost['lastpost']), "lastposter" => $db->escape_string($lastpost['lastposter']), "lastposteruid" => intval($lastpost['lastposteruid']), "lastposttid" => intval($lastpost['tid']), "lastpostsubject" => $db->escape_string($lastpost['subject'])
|
);
$db->update_query(TABLE_PREFIX."forums", $update_count, "fid='{$fid}'"); }
| );
$db->update_query(TABLE_PREFIX."forums", $updated_forum, "fid='{$fid}'"); }
/** * Updates the thread counters with a specific value (or addition/subtraction of the previous value) * * @param int The thread ID * @param array Array of items being updated (replies, unapprovedposts, attachmentcount) and their value (ex, 1, +1, -1) */ function update_thread_counters($tid, $changes=array()) { global $db;
$update_query = array(); $counters = array('replies', 'unapprovedposts', 'attachmentcount');
// Fetch above counters for this thread $query = $db->simple_select(TABLE_PREFIX."threads", implode(",", $counters), "tid='{$tid}'"); $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) == "-") { $update_query[$counter] = $thread[$counter] + $changes[$counter]; } else { $update_query[$counter] = $changes[$counter]; } // Less than 0? That's bad if($update_query[$counter] < 0) { $update_query[$counter] = 0; } } }
// Only update if we're actually doing something if(count($update_query) > 0) { $db->update_query(TABLE_PREFIX."threads", $update_query, "tid='".intval($tid)."'"); }
update_thread_data($tid); }
|
/**
|
/**
|
* Update the thread counters 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_count($tid)
| function update_thread_data($tid)
|
{
|
{
|
global $db, $cache; $query = $db->query(" SELECT COUNT(*) AS replies FROM ".TABLE_PREFIX."posts WHERE tid='$tid' AND visible='1' "); $replies = $db->fetch_array($query); $treplies = $replies['replies'] - 1; if($treplies < 0) { $treplies = 0; }
| global $db;
|
$query = $db->query(" SELECT u.uid, u.username, p.username AS postusername, p.dateline
|
$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)
| FROM ".TABLE_PREFIX."posts p LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid)
|
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"
|
Zeile 1296 | Zeile 1438 |
---|
$query = $db->query(" SELECT u.uid, u.username, p.username AS postusername, p.dateline
|
$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)
| FROM ".TABLE_PREFIX."posts p LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid)
|
WHERE p.tid='$tid' ORDER BY p.dateline ASC
|
WHERE p.tid='$tid' ORDER BY p.dateline ASC
|
LIMIT 0,1
| LIMIT 1
|
"); $firstpost = $db->fetch_array($query);
|
"); $firstpost = $db->fetch_array($query);
|
|
|
if(!$firstpost['username']) { $firstpost['username'] = $firstpost['postusername']; }
|
if(!$firstpost['username']) { $firstpost['username'] = $firstpost['postusername']; }
|
|
|
if(!$lastpost['username'])
|
if(!$lastpost['username'])
|
{
| {
|
$lastpost['username'] = $lastpost['postusername'];
|
$lastpost['username'] = $lastpost['postusername'];
|
}
| }
|
if(!$lastpost['dateline']) { $lastpost['username'] = $firstpost['username']; $lastpost['uid'] = $firstpost['uid']; $lastpost['dateline'] = $firstpost['dateline'];
|
if(!$lastpost['dateline']) { $lastpost['username'] = $firstpost['username']; $lastpost['uid'] = $firstpost['uid']; $lastpost['dateline'] = $firstpost['dateline'];
|
}
| }
|
$lastpost['username'] = $db->escape_string($lastpost['username']); $firstpost['username'] = $db->escape_string($firstpost['username']);
|
$lastpost['username'] = $db->escape_string($lastpost['username']); $firstpost['username'] = $db->escape_string($firstpost['username']);
|
// Unapproved posts $query = $db->query(" SELECT COUNT(*) AS totunposts FROM ".TABLE_PREFIX."posts WHERE tid='$tid' AND visible='0' "); $nounposts = $db->fetch_field($query, "totunposts");
| |
|
|
// Update the attachment count for this thread update_thread_attachment_count($tid); $db->query(" UPDATE ".TABLE_PREFIX."threads SET username='".$firstpost['username']."', uid='".intval($firstpost['uid'])."', lastpost='".intval($lastpost['dateline'])."', lastposter='".$lastpost['username']."', lastposteruid='".intval($lastpost['uid'])."', replies='$treplies', unapprovedposts='$nounposts' WHERE tid='$tid' ");
| $update_array = array( 'username' => $firstpost['username'], 'uid' => intval($firstpost['uid']), 'lastpost' => intval($lastpost['dateline']), 'lastposter' => $lastpost['username'], 'lastposteruid' => intval($lastpost['uid']), ); $db->update_query(TABLE_PREFIX."threads", $update_array, "tid='{$tid}'"); }
function update_forum_count($fid) { die("Depreciated function call: update_forum_count"); } function update_thread_count($tid) { die("Depreciated function call: update_thread_count");
|
}
|
}
|
/** * Updates the number of attachments for a specific thread * * @param int The thread ID */
| |
function update_thread_attachment_count($tid) {
|
function update_thread_attachment_count($tid) {
|
global $db; $query = $db->query(" SELECT COUNT(*) AS attachment_count FROM ".TABLE_PREFIX."attachments a LEFT JOIN ".TABLE_PREFIX."posts p ON (a.pid=p.pid) WHERE p.tid='$tid' "); $attachment_count = $db->fetch_field($query, "attachment_count"); $db->query(" UPDATE ".TABLE_PREFIX."threads SET attachmentcount='{$attachment_count}' WHERE tid='$tid' ");
| die("Depreciated function call: update_thread_attachment_count");
|
}
/**
| }
/**
|
Zeile 1674 | Zeile 1805 |
---|
{ $counter = 0; $smilies .= "</tr>\n";
|
{ $counter = 0; $smilies .= "</tr>\n";
|
} }
| } }
|
} if($counter != 0) {
| } if($counter != 0) {
|
Zeile 1790 | Zeile 1921 |
---|
"ipaddress" => $db->escape_string($session->ipaddress) ); $db->insert_query(TABLE_PREFIX."moderatorlog", $sql_array);
|
"ipaddress" => $db->escape_string($session->ipaddress) ); $db->insert_query(TABLE_PREFIX."moderatorlog", $sql_array);
|
}
| }
|
/** * Get the formatted reputation for a user. *
| /** * Get the formatted reputation for a user. *
|
Zeile 1860 | Zeile 1991 |
---|
$ip = $_SERVER['REMOTE_ADDR']; } }
|
$ip = $_SERVER['REMOTE_ADDR']; } }
|
global $db; $ip = $db->escape_string(preg_replace("#([^.0-9 ]*)#", $ip, ""));
| $ip = preg_replace("#([^.0-9 ]*)#", "", $ip);
|
return $ip; }
| return $ip; }
|
Zeile 2243 | Zeile 2374 |
---|
{ 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 colspan=\"8\" style=\"background-color: #ccc;\"><strong>Templates Requiring Additional Calls (Not Cached at Startup) - ".count($templates->uncached_templates)." Total</strong></td>\n";
| echo "<td style=\"background-color: #ccc;\"><strong>Templates Requiring Additional Calls (Not Cached at Startup) - ".count($templates->uncached_templates)." Total</strong></td>\n";
|
echo "</tr>\n"; echo "<tr>\n"; echo "<td style=\"background: #fff;\">".implode(", ", $templates->uncached_templates)."</td>\n";
| echo "</tr>\n"; echo "<tr>\n"; echo "<td style=\"background: #fff;\">".implode(", ", $templates->uncached_templates)."</td>\n";
|
Zeile 2364 | Zeile 2495 |
---|
elseif($months > 1) { $nicetime['months'] = $months." ".$lang->months;
|
elseif($months > 1) { $nicetime['months'] = $months." ".$lang->months;
|
}
| }
|
if($weeks == 1) { $nicetime['weeks'] = "1 ".$lang->week;
|
if($weeks == 1) { $nicetime['weeks'] = "1 ".$lang->week;
|
}
| }
|
elseif($weeks > 1) { $nicetime['weeks'] = $weeks." ".$lang->weeks;
|
elseif($weeks > 1) { $nicetime['weeks'] = $weeks." ".$lang->weeks;
|
}
| }
|
if($days == 1)
|
if($days == 1)
|
{
| {
|
$nicetime['days'] = "1 ".$lang->day; } elseif($days > 1)
|
$nicetime['days'] = "1 ".$lang->day; } elseif($days > 1)
|
{
| {
|
$nicetime['days'] = $days." ".$lang->days; }
if($hours == 1) { $nicetime['hours'] = "1 ".$lang->hour;
|
$nicetime['days'] = $days." ".$lang->days; }
if($hours == 1) { $nicetime['hours'] = "1 ".$lang->hour;
|
}
| }
|
elseif($hours > 1) { $nicetime['hours'] = $hours." ".$lang->hours; }
if($minutes == 1)
|
elseif($hours > 1) { $nicetime['hours'] = $hours." ".$lang->hours; }
if($minutes == 1)
|
{
| {
|
$nicetime['minutes'] = "1 ".$lang->minute; } elseif($minutes > 1)
| $nicetime['minutes'] = "1 ".$lang->minute; } elseif($minutes > 1)
|
Zeile 2404 | Zeile 2535 |
---|
if($seconds == 1) {
|
if($seconds == 1) {
|
$nicetime['seconds'] = "1 ".$lang->seconds;
| $nicetime['seconds'] = "1 ".$lang->second;
|
} elseif($seconds > 1) {
| } elseif($seconds > 1) {
|
Zeile 2446 | Zeile 2577 |
---|
function join_usergroup($uid, $joingroup) { global $db;
|
function join_usergroup($uid, $joingroup) { global $db;
|
if($uid == $mybb->user['uid']) { $user = $mybb->user; } else { $query = $db->query("
| if($uid == $mybb->user['uid']) { $user = $mybb->user; } else { $query = $db->query("
|
SELECT additionalgroups, usergroup FROM ".TABLE_PREFIX."users WHERE uid='$uid'
| SELECT additionalgroups, usergroup FROM ".TABLE_PREFIX."users WHERE uid='$uid'
|
Zeile 2480 | Zeile 2611 |
---|
$db->query(" UPDATE ".TABLE_PREFIX."users SET additionalgroups='$groupslist'
|
$db->query(" UPDATE ".TABLE_PREFIX."users SET additionalgroups='$groupslist'
|
WHERE uid='$uid' ");
| WHERE uid='$uid' ");
|
}
/**
| }
/**
|
Zeile 2594 | Zeile 2725 |
---|
if(isset($addlock) && is_array($addloc)) { $location .= "?".implode("&", $addloc);
|
if(isset($addlock) && is_array($addloc)) { $location .= "?".implode("&", $addloc);
|
} }
| } }
|
return $location; }
| return $location; }
|
Zeile 2676 | Zeile 2807 |
---|
if(array_key_exists($theme['tid'], $tcache)) { build_theme_select($name, $selected, $theme['tid'], $depthit, $usergroup_override);
|
if(array_key_exists($theme['tid'], $tcache)) { build_theme_select($name, $selected, $theme['tid'], $depthit, $usergroup_override);
|
} } } } if(!$tid) {
| } } } } if($tid) {
|
$themeselect .= "</select>"; }
| $themeselect .= "</select>"; }
|
Zeile 2701 | Zeile 2832 |
---|
$message = str_replace("<","<",$message); $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 2712 | Zeile 2842 |
---|
* @return int The formatted number. */ function my_number_format($number)
|
* @return int The formatted number. */ function my_number_format($number)
|
{
| {
|
global $mybb; if($number == "-") {
| global $mybb; if($number == "-") {
|
Zeile 2796 | Zeile 2926 |
---|
function get_bdays($in) { return(array(31, ($in % 4 == 0 && ($in % 100 > 0 || $in % 400 == 0) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31));
|
function get_bdays($in) { return(array(31, ($in % 4 == 0 && ($in % 100 > 0 || $in % 400 == 0) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31));
|
}
/**
| }
/**
|
* Formats a birthday appropriately * * @param string The PHP date format string
| * Formats a birthday appropriately * * @param string The PHP date format string
|
Zeile 2809 | Zeile 2939 |
---|
* @return string The formatted birthday */ function format_bdays($display, $bm, $bd, $by, $wd)
|
* @return string The formatted birthday */ function format_bdays($display, $bm, $bd, $by, $wd)
|
{
| {
|
global $lang;
$bdays = array($lang->sunday, $lang->monday, $lang->tuesday, $lang->wednesday, $lang->thursday, $lang->friday, $lang->saturday);
| global $lang;
$bdays = array($lang->sunday, $lang->monday, $lang->tuesday, $lang->wednesday, $lang->thursday, $lang->friday, $lang->saturday);
|
Zeile 2827 | Zeile 2957 |
---|
*/ function get_age($birthday) {
|
*/ function get_age($birthday) {
|
$bday = explode("-", $birthday); if($bday[2] < 1970) { $years = 1970-$bday[2]; $year = $bday[2]+($years*2); $stamp = mktime(0, 0, 0, $bday[1], $bday[0], $year)-($years*31556926*2); } else { $stamp = mktime(0, 0, 0, $bday[1], $bday[0], $bday[2]); } $age = floor((time()-$stamp)/31556926); return $age;
| $bday = explode("-", $birthday); if(!$bday[2]) { return; }
list($day, $month, $year) = explode("-", my_date("j-n-Y", time(), 0, 0));
$age = $year-$bday[2];
if(($month == $bday[1] && $day < $bday[1]) || $month < $bday[1]) { --$age; } return $age;
|
}
/**
| }
/**
|
Zeile 3420 | Zeile 3552 |
---|
while($setting = $db->fetch_array($query)) {
|
while($setting = $db->fetch_array($query)) {
|
$setting['value'] = str_replace("\"", "\\\"", $setting['value']); $settings .= "\$settings['".$setting['name']."'] = \"".$setting['value']."\";\n";
| |
$mybb->settings[$setting['name']] = $setting['value'];
|
$mybb->settings[$setting['name']] = $setting['value'];
|
| $setting['value'] = addcslashes($setting['value'], '\\"$'); $settings .= "\$settings['{$setting['name']}'] = \"{$setting['value']}\";\n";
|
} $settings = "<"."?php\n/*********************************\ \n DO NOT EDIT THIS FILE, PLEASE USE\n THE SETTINGS EDITOR\n\*********************************/\n\n$settings\n?".">"; $file = @fopen(MYBB_ROOT."inc/settings.php", $mode);
| } $settings = "<"."?php\n/*********************************\ \n DO NOT EDIT THIS FILE, PLEASE USE\n THE SETTINGS EDITOR\n\*********************************/\n\n$settings\n?".">"; $file = @fopen(MYBB_ROOT."inc/settings.php", $mode);
|