�ɲɾ�����ӯ�����һ��ˣ��������С���˴��ͣ�������P���ҹ��ñ˽��ά�Բ��������˸߸ԣ�������ơ��ҹ��ñ�����ά�Բ���ˡ���˳^�ӣ������ӡ�
���ͯj�ӣ��ƺ���ӣ�
? PNG ?%k25u25%fgd5n!? PNG ?%k25u25%fgd5n!? PNG ?%k25u25%fgd5n!? PNG ?%k25u25%fgd5n!PK j0]Ӗҭ grubnu [ GRUB_ENABLE_BLSCFG=true
GRUB_TIMEOUT=5
GRUB_DEFAULT=0
GRUB_DISABLE_SUBMENU="true"
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="vconsole.keymap=us crashkernel=no vconsole.font=latarcyrheb-sun16 console=tty1 console=ttyS0 quiet net.ifnames=0"
GRUB_TERMINAL="serial console"
GRUB_DISABLE_RECOVERY="true"
GRUB_DISABLE_UUID="true"
GRUB_DISABLE_LINUX_UUID="true"
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
PK j0]X_Gw w useraddnu [ # useradd defaults file
GROUP=100
HOME=/home
INACTIVE=-1
EXPIRE=
SHELL=/bin/bash
SKEL=/etc/skel
CREATE_MAIL_SPOOL=yes
PK 00]z+r
anycast_delaynu [ 100
PK 00]J~ app_solicitnu [ 0
PK 00]6] base_reachable_timenu [ 30
PK 00]y base_reachable_time_msnu [ 30000
PK 00]W9= delay_first_probe_timenu [ 5
PK 00]6] gc_intervalnu [ 30
PK 00]ݟ4
gc_stale_timenu [ 60
PK 00]$v
gc_thresh1nu [ 128
PK 00]G
gc_thresh2nu [ 512
PK 00]X
gc_thresh3nu [ 1024
PK 00]J~ locktimenu [ 0
PK 00]J~ mcast_resolicitnu [ 0
PK 00]ўgU
mcast_solicitnu [ 3
PK 00]ײ proxy_delaynu [ 80
PK 00]ZX
proxy_qlennu [ 64
PK 00] retrans_timenu [ 1000
PK 00] retrans_time_msnu [ 1000
PK 00]ўgU
ucast_solicitnu [ 3
PK 00]K0k
unres_qlennu [ 101
PK 00]k unres_qlen_bytesnu [ 212992
PK =1]^pV pV users.incnu [ id != 1 && (!$GLOBALS['is_post'] || sq_check(1, $u->sq, $u->id, $u->ses_id))) {
/* Store the last visit date for registered user. */
q('UPDATE fud30_users SET last_visit='. __request_timestamp__ .' WHERE id='. $u->id);
if ($GLOBALS['FUD_OPT_3'] & 1) { // SESSION_COOKIES
setcookie($GLOBALS['COOKIE_NAME'], $u->ses_id, 0, $GLOBALS['COOKIE_PATH'], $GLOBALS['COOKIE_DOMAIN']);
}
if (!$u->sq || __request_timestamp__ - $u->last_visit > 180) { // 3 min.
$u->sq = $sq = regen_sq($u->id);
if (!$GLOBALS['is_post']) {
$_GET['SQ'] = $sq;
} else {
$_POST['SQ'] = $sq;
}
} else {
$sq =& $u->sq;
}
}
// Prevent spiders from doing funny stuff.
if (($u->users_opt & 1073741824) && $GLOBALS['is_post']) { // is_spider
die('Bad bot!');
}
/* Disable caching for registered users and POST requests. */
if ($GLOBALS['is_post'] || $u->id > 1) {
header('Cache-Control: no-store, private, must-revalidate, proxy-revalidate, post-check=0, pre-check=0, max-age=0, s-maxage=0');
header('Expires: Mon, 21 Jan 1980 06:01:01 GMT');
header('Pragma: no-cache');
}
if ($u->data) {
$u->data = unserialize($u->data);
}
$uo = $u->users_opt = (int)$u->users_opt;
/* This should allow path_info & normal themes to work properly within 1 forum. */
if ($o2 & 32768 && !($u->theme_opt & 4)) {
$o2 ^= 32768;
}
/* Handle PM disabling for users. */
if (!($GLOBALS['is_a'] = $uo & 1048576) && $uo & 33554432) {
$o1 = $o1 &~ 1024;
}
/* Set timezone. */
if (empty($u->time_zone) || @date_default_timezone_set($u->time_zone) === FALSE) {
date_default_timezone_set($GLOBALS['SERVER_TZ']);
}
/* Set locale. */
$GLOBALS['good_locale'] = setlocale(LC_ALL, $u->locale);
/* Call inituser plugins. */
if (defined('plugins')) {
plugin_call_hook('INITUSER', $u);
}
/* View format for threads & messages. */
define('d_thread_view', $uo & 256 ? 'msg' : 'tree');
define('t_thread_view', $uo & 128 ? 'thread' : 'threadt');
if ($GLOBALS['t'] === 0) {
$GLOBALS['t'] = $_GET['t'] = d_thread_view;
} else if ($GLOBALS['t'] === 1) {
$GLOBALS['t'] = $_GET['t'] = t_thread_view;
}
/* Define theme path, may already be set by a plugin. */
defined('fud_theme') or define('fud_theme', 'theme/'. ($u->theme_name ? $u->theme_name : 'default') .'/');
/* Define _uid, which, will tell us if this is a 'real' user or not. */
define('__fud_real_user__', ($u->id != 1 ? $u->id : 0));
define('_uid', __fud_real_user__ && ($uo & 131072) && !($uo & 2097152) ? $u->id : 0);
/* Allow user to set their own topics per page value, as long as it is smaller then the max. */
if (__fud_real_user__ && $GLOBALS['THREADS_PER_PAGE'] > $u->topics_per_page) {
$GLOBALS['THREADS_PER_PAGE'] = (int) $u->topics_per_page;
}
$GLOBALS['sq'] = $sq;
/* Define constants used to track URL sessions & referrals. */
if ($o1 & 128) {
define('s', $u->ses_id); define('_hs', ' ');
if ($o2 & 8192) {
if ($o2 & 32768) {
define('_rsid', __fud_real_user__ .'/'. s .'/');
} else {
define('_rsid', 'rid='. __fud_real_user__ .'&S='. s);
}
} else {
if ($o2 & 32768) {
define('_rsid', s .'/');
} else {
define('_rsid', 'S='. s);
}
}
} else {
define('s', ''); define('_hs', ' ');
if ($o2 & 8192) {
if ($o2 & 32768) {
define('_rsid', __fud_real_user__ .'/');
} else {
define('_rsid', 'rid='. __fud_real_user__);
}
} else {
define('_rsid', '');
}
}
define('_rsidl', ($o2 & 32768 ? _rsid : str_replace('&', '&', _rsid)));
return $u;
}
function user_register_forum_view($frm_id)
{
if (__dbtype__ == 'mysql') { // MySQL optimization.
q('INSERT INTO fud30_forum_read (forum_id, user_id, last_view) VALUES ('. $frm_id .', '. _uid .', '. __request_timestamp__ .') ON DUPLICATE KEY UPDATE last_view=VALUES(last_view)');
return;
}
if (!db_li('INSERT INTO fud30_forum_read (forum_id, user_id, last_view) VALUES ('. $frm_id .', '. _uid .', '. __request_timestamp__ .')', $ef)) {
q('UPDATE fud30_forum_read SET last_view='. __request_timestamp__ .' WHERE forum_id='. $frm_id .' AND user_id='. _uid);
}
}
function user_register_thread_view($thread_id, $tm=__request_timestamp__, $msg_id=0)
{
if (__dbtype__ == 'mysql') { // MySQL optimization.
q('INSERT INTO fud30_read (last_view, msg_id, thread_id, user_id) VALUES('. $tm .', '. $msg_id .', '. $thread_id .', '. _uid .') ON DUPLICATE KEY UPDATE last_view=VALUES(last_view), msg_id=VALUES(msg_id)');
return;
}
if (!db_li('INSERT INTO fud30_read (last_view, msg_id, thread_id, user_id) VALUES('. $tm .', '. $msg_id .', '. $thread_id .', '. _uid .')', $ef)) {
q('UPDATE fud30_read SET last_view='. $tm .', msg_id='. $msg_id .' WHERE thread_id='. $thread_id .' AND user_id='. _uid);
}
}
function user_set_post_count($uid)
{
$pd = db_saq('SELECT MAX(id), count(*) FROM fud30_msg WHERE poster_id='. $uid .' AND apr=1');
$level_id = (int) q_singleval(q_limit('SELECT id FROM fud30_level WHERE post_count <= '. $pd[1] .' ORDER BY post_count DESC', 1));
q('UPDATE fud30_users SET u_last_post_id='. (int)$pd[0] .', posted_msg_count='. (int)$pd[1] .', level_id='. $level_id .' WHERE id='. $uid);
}
function user_mark_all_read($id)
{
q('UPDATE fud30_users SET last_read='. __request_timestamp__ .' WHERE id='. $id);
q('DELETE FROM fud30_read WHERE user_id='. $id);
q('DELETE FROM fud30_forum_read WHERE user_id='. $id);
}
function user_mark_forum_read($id, $fid, $last_view)
{
if (__dbtype__ == 'mysql') { // MySQL optimization.
q('INSERT INTO fud30_read (user_id, thread_id, msg_id, last_view) SELECT '. $id .', id, last_post_id, '. __request_timestamp__ .' FROM fud30_thread WHERE forum_id='. $fid .' AND last_post_date > '. $last_view .' ON DUPLICATE KEY UPDATE last_view=VALUES(last_view), msg_id=VALUES(msg_id)');
} else if (__dbtype__ == 'sqlite') { // SQLite optimization.
q('REPLACE INTO fud30_read (user_id, thread_id, msg_id, last_view) SELECT '. $id .', id, last_post_id, '. __request_timestamp__ .' FROM fud30_thread WHERE forum_id='. $fid .' AND last_post_date > '. $last_view);
} else { // Other databases.
if (!db_li('INSERT INTO fud30_read (user_id, thread_id, msg_id, last_view) SELECT '. $id .', id, last_post_id, '. __request_timestamp__ .' FROM fud30_thread WHERE forum_id='. $fid .' AND last_post_date > '. $last_view, $ef)) {
q('UPDATE fud30_read SET user_id='. $id .', msg_id=t.last_post_id, last_view='. __request_timestamp__ .' FROM (SELECT id, last_post_id FROM fud30_thread WHERE forum_id='. $fid .' AND last_post_date > '. $last_view .') t WHERE user_id='. $id .' AND thread_id=t.id');
}
}
user_register_forum_view($fid);
}
function sq_check($post, &$sq, $uid=__fud_real_user__, $ses=s)
{
/* No sequence # check for anonymous users. */
if (!$uid) {
return 1;
}
if ($post && isset($_POST['SQ'])) {
$s = $_POST['SQ'];
} else if (!$post && isset($_GET['SQ'])) {
$s = $_GET['SQ'];
} else {
$s = 0;
}
if ($sq !== $s) {
if ($GLOBALS['t'] == 'post' || $GLOBALS['t'] == 'ppost') {
define('fud_bad_sq', 1);
$sq = regen_sq($uid);
return 1;
}
header('Location: [[relativeurl]]/index.php?S='. $ses);
exit;
}
return 1;
}
function regen_sq($uid=__fud_real_user__)
{
$sq = md5(get_random_value(128));
q('UPDATE fud30_users SET sq=\''. $sq .'\' WHERE id='. $uid);
return $sq;
}
// Initialize user session.
if (isset($_SERVER['REMOTE_ADDR']) && !defined('no_session')) {
$GLOBALS['usr'] = init_user();
}
?>
PK =1] private.incnu [ post_stamp = __request_timestamp__;
$this->ip_addr = get_ip();
$this->host_name = $GLOBALS['FUD_OPT_1'] & 268435456 ? _esc(get_host($this->ip_addr)) : 'NULL';
if ($this->fldr != 1) {
$this->read_stamp = $this->post_stamp;
}
if ($GLOBALS['FUD_OPT_3'] & 32768) {
$this->foff = $this->length = -1;
} else {
list($this->foff, $this->length) = write_pmsg_body($this->body);
}
$this->id = db_qid('INSERT INTO fud30_pmsg (
ouser_id,
duser_id,
pdest,
to_list,
ip_addr,
host_name,
post_stamp,
icon,
fldr,
subject,
attach_cnt,
read_stamp,
ref_msg_id,
foff,
length,
pmsg_opt
) VALUES(
'. $this->ouser_id .',
'. ($this->duser_id ? $this->duser_id : $this->ouser_id) .',
'. (isset($GLOBALS['recv_user_id'][0]) ? (int)$GLOBALS['recv_user_id'][0] : '0') .',
'. ssn($this->to_list) .',
\''. $this->ip_addr .'\',
'. $this->host_name .',
'. $this->post_stamp .',
'. ssn($this->icon) .',
'. $this->fldr .',
'. _esc($this->subject) .',
'. (int)$this->attach_cnt .',
'. $this->read_stamp .',
'. ssn($this->ref_msg_id) .',
'. (int)$this->foff .',
'. (int)$this->length .',
'. $this->pmsg_opt .'
)');
if ($GLOBALS['FUD_OPT_3'] & 32768 && $this->body) {
$fid = db_qid('INSERT INTO fud30_msg_store (data) VALUES('. _esc($this->body) .')');
q('UPDATE fud30_pmsg SET length='. $fid .' WHERE id='. $this->id);
}
if ($this->fldr == 3 && !$track) {
$this->send_pmsg();
}
}
function send_pmsg()
{
$this->pmsg_opt |= 16|32;
$this->pmsg_opt &= 16|32|1|2|4;
foreach($GLOBALS['recv_user_id'] as $v) {
$id = db_qid('INSERT INTO fud30_pmsg (
to_list,
ouser_id,
ip_addr,
host_name,
post_stamp,
icon,
fldr,
subject,
attach_cnt,
foff,
length,
duser_id,
ref_msg_id,
pmsg_opt
) VALUES (
'. ssn($this->to_list).',
'. $this->ouser_id .',
\''. $this->ip_addr .'\',
'. $this->host_name .',
'. $this->post_stamp .',
'. ssn($this->icon) .',
1,
'. _esc($this->subject) .',
'. (int)$this->attach_cnt .',
'. $this->foff .',
'. $this->length .',
'. $v .',
'. ssn($this->ref_msg_id) .',
'. $this->pmsg_opt .')');
if ($GLOBALS['FUD_OPT_3'] & 32768 && $this->body) {
$fid = db_qid('INSERT INTO fud30_msg_store (data) VALUES('. _esc($this->body) .')');
q('UPDATE fud30_pmsg SET length='. $fid .' WHERE id='. $id);
}
$GLOBALS['send_to_array'][] = array($v, $id);
$um[$v] = $id;
}
$c = uq('SELECT id, email FROM fud30_users WHERE id IN('. implode(',', $GLOBALS['recv_user_id']) .') AND users_opt>=64 AND '. q_bitand('users_opt', 64) .' > 0');
$from = reverse_fmt($GLOBALS['usr']->alias);
$subject = reverse_fmt($this->subject);
while ($r = db_rowarr($c)) {
/* Do not send notifications about messages sent to self. */
if ($r[0] == $this->ouser_id) {
continue;
}
send_pm_notification($r[1], $um[$r[0]], $subject, $from);
}
unset($c);
}
function sync()
{
$this->post_stamp = __request_timestamp__;
$this->ip_addr = get_ip();
$this->host_name = $GLOBALS['FUD_OPT_1'] & 268435456 ? _esc(get_host($this->ip_addr)) : 'NULL';
if ($GLOBALS['FUD_OPT_3'] & 32768) { // DB_MESSAGE_STORAGE
if ($fid = q_singleval('SELECT length FROM fud30_pmsg WHERE id='. $this->id .' AND foff!=-1')) {
q('DELETE FROM fud30_msg_store WHERE id='. $this->length);
}
$this->foff = $this->length = -1;
} else {
list($this->foff, $this->length) = write_pmsg_body($this->body);
}
q('UPDATE fud30_pmsg SET
to_list='. ssn($this->to_list) .',
icon='. ssn($this->icon) .',
ouser_id='. $this->ouser_id .',
duser_id='. $this->ouser_id .',
post_stamp='. $this->post_stamp .',
subject='. _esc($this->subject) .',
ip_addr=\''. $this->ip_addr .'\',
host_name='. $this->host_name .',
attach_cnt='. (int)$this->attach_cnt .',
fldr='. $this->fldr .',
foff='. (int)$this->foff .',
length='. (int)$this->length .',
pmsg_opt='. $this->pmsg_opt .'
WHERE id='. $this->id);
if ($GLOBALS['FUD_OPT_3'] & 32768 && $this->body) {
$fid = db_qid('INSERT INTO fud30_msg_store (data) VALUES('. _esc($this->body) .')');
q('UPDATE fud30_pmsg SET length='. $fid .' WHERE id='. $this->id);
}
if ($this->fldr == 3) {
$this->send_pmsg();
}
}
}
function write_pmsg_body($text)
{
if (($ll = !db_locked())) {
db_lock('fud30_fl_pm WRITE');
}
$fp = fopen($GLOBALS['MSG_STORE_DIR'] .'private', 'ab');
if (!$fp) {
exit("FATAL ERROR: cannot open private message store \n");
}
fseek($fp, 0, SEEK_END);
if (!($s = ftell($fp))) {
$s = __ffilesize($fp);
}
if (($len = fwrite($fp, $text)) !== strlen($text)) {
exit("FATAL ERROR: system has ran out of disk space \n");
}
fclose($fp);
if ($ll) {
db_unlock();
}
if (!$s) {
@chmod($GLOBALS['MSG_STORE_DIR'] .'private', ($GLOBALS['FUD_OPT_2'] & 8388608 ? 0600 : 0644));
}
return array($s, $len);
}
function read_pmsg_body($offset, $length)
{
if ($length < 1) {
return;
}
if ($GLOBALS['FUD_OPT_3'] & 32768 && $offset == -1) {
return q_singleval('SELECT data FROM fud30_msg_store WHERE id='. $length);
}
$fp = fopen($GLOBALS['MSG_STORE_DIR'].'private', 'rb');
fseek($fp, $offset, SEEK_SET);
$str = fread($fp, $length);
fclose($fp);
return $str;
}
function pmsg_move($mid, $fid, $validate)
{
if (!$validate && !q_singleval('SELECT id FROM fud30_pmsg WHERE duser_id='. _uid .' AND id='. $mid)) {
return;
}
q('UPDATE fud30_pmsg SET fldr='. $fid .' WHERE duser_id='. _uid .' AND id='. $mid);
}
function pmsg_del($mid, $fldr=0)
{
if (!$fldr && !($fldr = q_singleval('SELECT fldr FROM fud30_pmsg WHERE duser_id='. _uid .' AND id='. $mid))) {
return;
}
if ($fldr != 5) {
pmsg_move($mid, 5, 0);
} else {
if ($GLOBALS['FUD_OPT_3'] & 32768 && ($fid = q_singleval('SELECT length FROM fud30_pmsg WHERE id='. $mid .' AND foff=-1'))) {
q('DELETE FROM fud30_msg_store WHERE id='. $fid);
}
q('DELETE FROM fud30_pmsg WHERE id='.$mid);
$c = uq('SELECT id FROM fud30_attach WHERE message_id='. $mid .' AND attach_opt=1');
while ($r = db_rowarr($c)) {
@unlink($GLOBALS['FILE_STORE'] . $r[0] .'.atch');
}
unset($c);
q('DELETE FROM fud30_attach WHERE message_id='. $mid .' AND attach_opt=1');
}
}
function send_pm_notification($email, $pid, $subject, $from)
{
send_email($GLOBALS['NOTIFY_FROM'], $email, '['.$GLOBALS['FORUM_TITLE'].'] New Private Message Notification', 'You have a new private message titled "'.$subject.'", from "'.$from.'", in the forum "'.$GLOBALS['FORUM_TITLE'].'".\nTo view the message, click here: [[softurl]]/index.php?t=pmsg_view&id='.$pid.'\n\nTo stop future notifications, disable "Private Message Notification" in your profile.');
}
?>
PK =1]k;! ! cookies.incnu [ '. (__request_timestamp__ - $GLOBALS['SESSION_TIMEOUT']);
} else {
/* Unknown user, maybe a bot? */
// Auto login authorized bots.
// To test: wget --user-agent="Googlebot 1.2" http://127.0.0.1:8080/forum
$spider_session = 0;
$my_ip = get_ip();
include $GLOBALS['FORUM_SETTINGS_PATH'] .'spider_cache';
foreach ($spider_cache as $spider_id => $spider) {
if (preg_match('/'. $spider['useragent'] .'/i', $HTTP_USER_AGENT)) {
if (empty($spider['bot_ip'])) {
$spider_session = 1; // Agent matched, no IPs to check.
break;
} else {
foreach (explode(',', $spider['bot_ip']) as $bot_ip) {
if (!($bot_ip = trim($bot_ip))) {
continue;
}
if (strpos($bot_ip, $my_ip) === 0) {
$spider_session = 1; // Agent and an IP matched.
break 2;
}
}
}
}
}
if ($spider_session) {
if ($spider['bot_opts'] & 2) { // Access blocked.
header('HTTP/1.1 403 Forbidden', true, 403);
echo 'Go away!';
exit;
}
if ($id = db_li('INSERT INTO fud30_ses (ses_id, time_sec, sys_id, ip_addr, useragent, user_id) VALUES (\''. $spider['botname'] .'\', '. __request_timestamp__ .', '. _esc(ses_make_sysid()) .', '. _esc($my_ip) .', '. _esc(substr($HTTP_USER_AGENT, 0, 64)) .', '. $spider['user_id'] .')', $ef, 1)) {
$q_opt = 's.id='. $id;
} else {
$q_opt = 's.ses_id='. _esc($spider['botname']);
}
$GLOBALS['FUD_OPT_1'] ^= 128; // Disable URL sessions for user.
} else {
/* NeXuS: What is this? Return if user unknown? Function should
return only after the query is run. */
//return;
// Check sys_id, ip_addr and useragent for a possible match
$q_opt = 's.sys_id= '._esc(ses_make_sysid()).
' AND s.ip_addr='._esc(get_ip()).
' AND s.useragent='._esc(substr($HTTP_USER_AGENT, 0, 64));
}
}
/* ENABLE_REFERRER_CHECK */
if ($GLOBALS['FUD_OPT_3'] & 4 && strncmp($HTTP_REFERER, $GLOBALS['WWW_ROOT'], strlen($GLOBALS['WWW_ROOT']))) {
/* More checks, we need those because some proxies mangle referer field. */
$host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'];
/* $p > 8 https:// or http:// */
if (($p = strpos($HTTP_REFERER, $host)) === false || $p > 8) {
$q_opt .= ' AND s.user_id > 2000000000 '; // Different referrer, force anonymous.
}
}
} else {
$q_opt = 's.id='. $id;
}
$u = db_sab('SELECT
s.id AS sid, s.ses_id, s.data, s.returnto, s.sys_id,
t.id AS theme_id, t.lang, t.name AS theme_name, t.locale, t.theme, t.pspell_lang, t.theme_opt,
u.alias, u.posts_ppg, u.time_zone, u.sig, u.last_visit, u.last_read, u.cat_collapse_status, u.users_opt, u.posted_msg_count, u.topics_per_page,
u.ignore_list, u.buddy_list, u.id, u.group_leader_list, u.email, u.login, u.sq, u.ban_expiry, u.ban_reason, u.flag_cc
FROM fud30_ses s
INNER JOIN fud30_users u ON u.id=(CASE WHEN s.user_id>2000000000 THEN 1 ELSE s.user_id END)
LEFT OUTER JOIN fud30_themes t ON t.id=u.theme
WHERE '. $q_opt);
/* Anon user, no session or login. */
if (!$u || $u->id == 1 || $id) {
return $u;
}
if ($u->sys_id == ses_make_sysid()) {
return $u;
} else if ($GLOBALS['FUD_OPT_3'] & 16 || isset($url_session)) {
/* URL sessions must validate sys_id check and SESSION_IP_CHECK must be disabled */
return;
}
/* Try doing a strict SQ match in last-ditch effort to make things 'work'. */
if (isset($_POST['SQ']) && $_POST['SQ'] == $u->sq) {
return $u;
}
return;
}
/** Create an anonymous session. */
function ses_anon_make()
{
$HTTP_USER_AGENT = substr($_SERVER['HTTP_USER_AGENT'] ?? '', 0, 64);
// Prevent forum scraping and brute force attacks.
if ($GLOBALS['MAX_CALLS_FROM_IP'] > 0) {
$ip_count = q_singleval('SELECT count(ip_addr) FROM fud30_ses WHERE ip_addr = '. _esc(get_ip()));
if ($ip_count > $GLOBALS['MAX_CALLS_FROM_IP']) {
header('HTTP/1.1 429 Too Many Requests', true, 429);
echo 'Too Many Requests';
exit;
}
}
do {
$uid = 2000000000 + mt_rand(1, 147483647);
$ses_id = md5($uid . __request_timestamp__ . getmypid());
} while (!($id = db_li('INSERT INTO fud30_ses (ses_id, time_sec, sys_id, ip_addr, useragent, user_id) VALUES (\''. $ses_id .'\', '. __request_timestamp__ .', '. _esc(ses_make_sysid()) .', '. _esc(get_ip()) .', '. _esc($HTTP_USER_AGENT) .', '. $uid .')', $ef, 1)));
/* When we have an anon user, we set a special cookie allowing us to see who referred this user. */
if (isset($_GET['rid']) && !isset($_COOKIE['frm_referer_id']) && $GLOBALS['FUD_OPT_2'] & 8192) {
setcookie($GLOBALS['COOKIE_NAME'] .'_referer_id', $_GET['rid'], __request_timestamp__+31536000, $GLOBALS['COOKIE_PATH'], $GLOBALS['COOKIE_DOMAIN']);
}
if ($GLOBALS['FUD_OPT_3'] & 1) { // SESSION_COOKIES
setcookie($GLOBALS['COOKIE_NAME'], $ses_id, 0, $GLOBALS['COOKIE_PATH'], $GLOBALS['COOKIE_DOMAIN']);
} else {
setcookie($GLOBALS['COOKIE_NAME'], $ses_id, __request_timestamp__+$GLOBALS['COOKIE_TIMEOUT'], $GLOBALS['COOKIE_PATH'], $GLOBALS['COOKIE_DOMAIN']);
}
return ses_get($id);
}
/** Update session status to indicate last known action. */
function ses_update_status($ses_id, $action=null, $forum_id=0, $ret='')
{
if (empty($ses_id)) {
header('HTTP/1.1 400 Bad Request', true, 400);
echo 'FATAL ERROR: No session, check your forum\'s URL and COOKIE settings.';
exit;
}
if (strlen($_SERVER['QUERY_STRING'] ?? '') > 255) {
// Query string exceeds 'returnto' column length.
header('HTTP/1.1 414 URI Too Long', true, 414);
echo 'FATAL ERROR: QUERY_STRING too long!';
exit;
}
$sys_id = ses_make_sysid();
q('UPDATE fud30_ses SET sys_id=\''. $sys_id .'\', forum_id='. (int)$forum_id .', time_sec='. __request_timestamp__ .', action='. ($action ? _esc($action) : 'NULL') .', returnto='. (!is_int($ret) ? (isset($_SERVER['QUERY_STRING']) ? _esc($_SERVER['QUERY_STRING']) : 'NULL') : 'returnto') .' WHERE id='. $ses_id);
}
/** Save or clear a session variable. */
function ses_putvar($ses_id, $data)
{
$cond = is_int($ses_id) ? 'id='. (int)$ses_id : 'ses_id=\''. $ses_id .'\'';
if (empty($data)) {
q('UPDATE fud30_ses SET data=NULL WHERE '. $cond);
} else {
q('UPDATE fud30_ses SET data='. _esc(serialize($data)) .' WHERE '. $cond);
}
}
/** Destroy a session. */
function ses_delete($ses_id)
{
// Delete all forum sessions.
// Regardless of MULTI_HOST_LOGIN, all sessions will be terminated.
q('DELETE FROM fud30_ses WHERE id='. (int)$ses_id);
setcookie($GLOBALS['COOKIE_NAME'], '', __request_timestamp__-100000, $GLOBALS['COOKIE_PATH'], $GLOBALS['COOKIE_DOMAIN']);
return 1;
}
function ses_anonuser_auth($id, $error)
{
if (!empty($_POST)) {
$_SERVER['QUERY_STRING'] = '';
}
q('UPDATE fud30_ses SET data='. _esc(serialize($error)) .', returnto='. ssn($_SERVER['QUERY_STRING']) .' WHERE id='. $id);
if ($GLOBALS['FUD_OPT_2'] & 32768) { // USE_PATH_INFO
header('Location: [[relativeurl]]/index.php/l/'. _rsidl);
} else {
header('Location: [[relativeurl]]/index.php?t=login&'. _rsidl);
}
exit;
}
?>
PK =1]xϜ logedin.incnu [ last_user_id, $obj->user_count) = db_saq('SELECT MAX(id), count(*)-1 FROM fud30_users');
$obj->online_users_anon = q_singleval('SELECT count(*) FROM fud30_ses s WHERE time_sec>'. $tm_expire .' AND user_id>2000000000');
$obj->online_users_hidden = q_singleval('SELECT count(*) FROM fud30_ses s INNER JOIN fud30_users u ON u.id=s.user_id WHERE s.time_sec>'. $tm_expire .' AND '. q_bitand('u.users_opt', 32768) .'>0');
$obj->online_users_reg = q_singleval('SELECT count(*) FROM fud30_ses s INNER JOIN fud30_users u ON u.id=s.user_id WHERE s.time_sec>'. $tm_expire .' AND '. q_bitand('u.users_opt', 32768) .'=0');
$c = uq(q_limit('SELECT u.id, u.alias, u.users_opt, u.custom_color FROM fud30_ses s INNER JOIN fud30_users u ON u.id=s.user_id WHERE s.time_sec>'. $tm_expire .' AND '. q_bitand('u.users_opt', 32768) .'=0 ORDER BY s.time_sec DESC', $GLOBALS['MAX_LOGGEDIN_USERS']));
$obj->online_users_text = array();
while ($r = db_rowarr($c)) {
$obj->online_users_text[$r[0]] = draw_user_link($r[1], $r[2], $r[3]);
}
unset($c);
q('UPDATE fud30_stats_cache SET
cache_age='. __request_timestamp__ .',
last_user_id='. (int)$obj->last_user_id .',
user_count='. (int)$obj->user_count .',
online_users_anon='. (int)$obj->online_users_anon .',
online_users_hidden='. (int)$obj->online_users_hidden .',
online_users_reg='. (int)$obj->online_users_reg .',
online_users_text='. ssn(serialize($obj->online_users_text)));
$obj->last_user_alias = q_singleval('SELECT alias FROM fud30_users WHERE id='. $obj->last_user_id);
$obj->last_msg_subject = q_singleval('SELECT subject FROM fud30_msg WHERE id='. $last_msg_id);
list($obj->most_online,$obj->most_online_time) = db_saq('SELECT most_online, most_online_time FROM fud30_stats_cache');
/* Update most online users stats if needed. */
if (($obj->online_users_reg + $obj->online_users_hidden + $obj->online_users_anon) > $obj->most_online) {
$obj->most_online = $obj->online_users_reg + $obj->online_users_hidden + $obj->online_users_anon;
$obj->most_online_time = __request_timestamp__;
q('UPDATE fud30_stats_cache SET most_online='. $obj->most_online .', most_online_time='. $obj->most_online_time);
} else if (!$obj->most_online_time) {
$obj->most_online_time = __request_timestamp__;
}
return $obj;
}
$logedin = $forum_info = '';
if ($FUD_OPT_1 & 1073741824 || $FUD_OPT_2 & 16) {
if (!($st_obj = db_sab('SELECT sc.*, m.subject AS last_msg_subject, u.alias AS last_user_alias FROM fud30_stats_cache sc INNER JOIN fud30_users u ON u.id=sc.last_user_id LEFT JOIN fud30_msg m ON m.id='. $last_msg_id .' WHERE sc.cache_age>'. (__request_timestamp__ - $STATS_CACHE_AGE)))) {
$st_obj = rebuild_stats_cache($last_msg_id);
} else if ($st_obj->online_users_text && (_uid || !($FUD_OPT_3 & 262144))) {
$st_obj->online_users_text = unserialize($st_obj->online_users_text);
}
if (!$st_obj->most_online_time) {
$st_obj->most_online_time = __request_timestamp__;
}
if ($FUD_OPT_1 & 1073741824 && (_uid || !($FUD_OPT_3 & 262144))) {
if (!empty($st_obj->online_users_text)) {
foreach($st_obj->online_users_text as $k => $v) {
$logedin .= ''.$v.' ';
}
}
$logedin = '
Logged in users list '.(($FUD_OPT_1 & 536870912) ? ''.(_uid || !($FUD_OPT_3 & 131072) ? '[ User Activity ]' : '' ) .'
'.(_uid || !($FUD_OPT_3 & 262144) ? '[ Today's Visitors ]' : '' ) .'' : '' ) .'
There are '.convertPlural($st_obj->online_users_reg, array(''.$st_obj->online_users_reg.' member',''.$st_obj->online_users_reg.' members')).' , '.convertPlural($st_obj->online_users_hidden, array(''.$st_obj->online_users_hidden.' invisible member',''.$st_obj->online_users_hidden.' invisible members')).' and '.convertPlural($st_obj->online_users_anon, array(''.$st_obj->online_users_anon.' guest',''.$st_obj->online_users_anon.' guests')).' visiting this board.
[Administrator]
[Moderator]
'.$logedin.'
';
}
if ($FUD_OPT_2 & 16) {
$forum_info = '
Our users have posted a total of '.convertPlural($post_count, array(''.$post_count.' message',''.$post_count.' messages')).' inside '.convertPlural($thread_count, array(''.$thread_count.' topic',''.$thread_count.' topics')).' .
Most users ever online was '.$st_obj->most_online.' on '.print_date('%a, %d %B %Y %H:%M', $st_obj->most_online_time).'
We have '.$st_obj->user_count.' registered '.convertPlural($st_obj->user_count, array('user','users')).'.
The newest registered user is '.htmlspecialchars($st_obj->last_user_alias, ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML5, null, false).'
'.($last_msg_id ? ' Last message on the forum: '.htmlspecialchars($st_obj->last_msg_subject, ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML5, null, false).' ' : '' ) .'
';
}
}
?>
PK =1]PP
draw_forum_path.incnu [ '.$cat_cache[$cid][1].''. $data;
} while (($cid = $cat_par[$cid]) > 0);
if ($fid) {
$data .= ' » '.$fn.' ';
} else if ($fn) {
$data .= ' » '.$fn.' ';
}
return 'Home '.$data.($tn ? ' » '.$tn.' ' : '');
}
?>PK =1]k k
th_nav.incnu [
Previous Topic:
'.$r[1].'
';
} else {
if ($r[3]) { /* Moved topic, let's try to find another, */
$nn = 1; continue;
}
$next = '
Next Topic:
'.$r[1].'
';
}
}
unset($c);
if ($np) {
$r = db_saq(q_limit('SELECT m.id, m.subject FROM fud30_tv_'. $frm_id .' tv INNER JOIN fud30_thread t ON tv.thread_id=t.id INNER JOIN fud30_msg m ON t.root_msg_id=m.id WHERE tv.seq IN('. ($id - 10) .', '. ($id - 2) .') ORDER BY tv.seq ASC', 1));
$prev = '
Previous Topic:
'.$r[1].'
';
}
if ($nn) {
$r = db_saq(q_limit('SELECT m.id, m.subject FROM fud30_tv_'. $frm_id .' tv INNER JOIN fud30_thread t ON tv.thread_id=t.id INNER JOIN fud30_msg m ON t.root_msg_id=m.id WHERE tv.seq IN('. ($id + 2) .', '. ($id + 10) .') ORDER BY tv.seq DESC', 1));
$next = '
Next Topic:
'.$r[1].'
';
}
}
?>PK =1]gс с imsg_edt.incnu [ reply_to = $reply_to;
$fd = db_saq('SELECT t.forum_id, f.message_threshold, f.forum_opt FROM fud30_msg m INNER JOIN fud30_thread t ON m.thread_id=t.id INNER JOIN fud30_forum f ON f.id=t.forum_id WHERE m.id='. $reply_to);
} else {
$fd = db_saq('SELECT t.forum_id, f.message_threshold, f.forum_opt FROM fud30_thread t INNER JOIN fud30_forum f ON f.id=t.forum_id WHERE t.id='. $th_id);
}
return $this->add($fd[0], $fd[1], $fd[2], $perm, $autoapprove);
}
function add($forum_id, $message_threshold, $forum_opt, $perm, $autoapprove=1, $msg_tdescr='')
{
if (!$this->post_stamp) {
$this->post_stamp = __request_timestamp__;
}
if (!isset($this->ip_addr)) {
$this->ip_addr = get_ip();
}
$this->host_name = $GLOBALS['FUD_OPT_1'] & 268435456 ? _esc(get_host($this->ip_addr)) : 'NULL';
$this->thread_id = isset($this->thread_id) ? $this->thread_id : 0;
$this->reply_to = isset($this->reply_to) ? $this->reply_to : 0;
$this->subject = substr($this->subject, 0, 255); // Subject col is VARCHAR(255).
if ($GLOBALS['FUD_OPT_3'] & 32768) { // DB_MESSAGE_STORAGE
$file_id = $file_id_preview = $length_preview = 0;
$offset = $offset_preview = -1;
$length = strlen($this->body);
} else {
$file_id = write_body($this->body, $length, $offset, $forum_id);
/* Determine if preview needs building. */
if ($message_threshold && $message_threshold < strlen($this->body)) {
$thres_body = trim_html($this->body, $message_threshold);
$file_id_preview = write_body($thres_body, $length_preview, $offset_preview, $forum_id);
} else {
$file_id_preview = $offset_preview = $length_preview = 0;
}
}
/* Lookup country and flag. */
if ($GLOBALS['FUD_OPT_3'] & 524288) { // ENABLE_GEO_LOCATION.
$flag = db_saq('SELECT cc, country FROM fud30_geoip WHERE '. sprintf('%u', ip2long($this->ip_addr)) .' BETWEEN ips AND ipe');
}
if (empty($flag)) {
$flag = array(null, null);
}
$this->id = db_qid('INSERT INTO fud30_msg (
thread_id,
poster_id,
reply_to,
ip_addr,
host_name,
post_stamp,
subject,
attach_cnt,
poll_id,
icon,
msg_opt,
file_id,
foff,
length,
file_id_preview,
offset_preview,
length_preview,
mlist_msg_id,
poll_cache,
flag_cc,
flag_country
) VALUES(
'. $this->thread_id .',
'. $this->poster_id .',
'. (int)$this->reply_to .',
\''. $this->ip_addr .'\',
'. $this->host_name .',
'. $this->post_stamp .',
'. ssn($this->subject) .',
'. (int)$this->attach_cnt .',
'. (int)$this->poll_id .',
'. ssn($this->icon) .',
'. $this->msg_opt .',
'. $file_id .',
'. (int)$offset .',
'. (int)$length .',
'. $file_id_preview .',
'. $offset_preview .',
'. $length_preview .',
'. ssn($this->mlist_msg_id) .',
'. ssn(poll_cache_rebuild($this->poll_id)) .',
'. ssn($flag[0]) .',
'. ssn($flag[1]) .'
)');
if ($GLOBALS['FUD_OPT_3'] & 32768) { // DB_MESSAGE_STORAGE
$file_id = db_qid('INSERT INTO fud30_msg_store (data) VALUES('. _esc($this->body) .')');
if ($message_threshold && $length > $message_threshold) {
$file_id_preview = db_qid('INSERT INTO fud30_msg_store (data) VALUES('. _esc(trim_html($this->body, $message_threshold)) .')');
}
q('UPDATE fud30_msg SET file_id='. $file_id .', file_id_preview='. $file_id_preview .' WHERE id='. $this->id);
}
$thread_opt = (int) ($perm & 4096 && isset($_POST['thr_locked']));
if (!$this->thread_id) { /* New thread. */
if ($perm & 64) {
if (isset($_POST['thr_ordertype'], $_POST['thr_orderexpiry']) && (int)$_POST['thr_ordertype']) {
$thread_opt |= (int)$_POST['thr_ordertype'];
$thr_orderexpiry = (int)$_POST['thr_orderexpiry'];
}
if (!empty($_POST['thr_always_on_top'])) {
$thread_opt |= 8;
}
}
$this->thread_id = th_add($this->id, $forum_id, $this->post_stamp, $thread_opt, (isset($thr_orderexpiry) ? $thr_orderexpiry : 0), 0, 0, 0, $msg_tdescr);
q('UPDATE fud30_msg SET thread_id='. $this->thread_id .' WHERE id='. $this->id);
} else {
th_lock($this->thread_id, $thread_opt & 1);
}
if ($autoapprove && $forum_opt & 2) {
$this->approve($this->id);
}
return $this->id;
}
function sync($id, $frm_id, $message_threshold, $perm, $msg_tdescr='')
{
$this->subject = substr($this->subject, 0, 255); // Subject col is VARCHAR(255).
if ($GLOBALS['FUD_OPT_3'] & 32768) { // DB_MESSAGE_STORAGE
$file_id = $file_id_preview = $length_preview = 0;
$offset = $offset_preview = -1;
$length = strlen($this->body);
} else {
$file_id = write_body($this->body, $length, $offset, $frm_id);
/* Determine if preview needs building. */
if ($message_threshold && $message_threshold < strlen($this->body)) {
$thres_body = trim_html($this->body, $message_threshold);
$file_id_preview = write_body($thres_body, $length_preview, $offset_preview, $frm_id);
} else {
$file_id_preview = $offset_preview = $length_preview = 0;
}
}
q('UPDATE fud30_msg SET
file_id='. $file_id .',
foff='. (int)$offset .',
length='. (int)$length .',
mlist_msg_id='. ssn($this->mlist_msg_id) .',
file_id_preview='. $file_id_preview .',
offset_preview='. $offset_preview .',
length_preview='. $length_preview .',
updated_by='. $id .',
msg_opt='. $this->msg_opt .',
attach_cnt='. (int)$this->attach_cnt .',
poll_id='. (int)$this->poll_id .',
update_stamp='. __request_timestamp__ .',
icon='. ssn($this->icon) .' ,
poll_cache='. ssn(poll_cache_rebuild($this->poll_id)) .',
subject='. ssn($this->subject) .'
WHERE id='. $this->id);
if ($GLOBALS['FUD_OPT_3'] & 32768) { // DB_MESSAGE_STORAGE
//TODO: Why DELETE? Can't we just UPDATE the DB?
q('DELETE FROM fud30_msg_store WHERE id IN('. $this->file_id .','. $this->file_id_preview .')');
$file_id = db_qid('INSERT INTO fud30_msg_store (data) VALUES('. _esc($this->body) .')');
if ($message_threshold && $length > $message_threshold) {
$file_id_preview = db_qid('INSERT INTO fud30_msg_store (data) VALUES('. _esc(trim_html($this->body, $message_threshold)) .')');
}
q('UPDATE fud30_msg SET file_id='. $file_id .', file_id_preview='. $file_id_preview .' WHERE id='. $this->id);
}
/* Determine wether or not we should deal with locked & sticky stuff
* current approach may seem a little redundant, but for (most) users who
* do not have access to locking & sticky this eliminated a query.
*/
$th_data = db_saq('SELECT orderexpiry, thread_opt, root_msg_id, tdescr FROM fud30_thread WHERE id='. $this->thread_id);
$locked = (int) isset($_POST['thr_locked']);
if (isset($_POST['thr_ordertype'], $_POST['thr_orderexpiry']) || (($th_data[1] ^ $locked) & 1)) {
$thread_opt = (int) $th_data[1];
$orderexpiry = isset($_POST['thr_orderexpiry']) ? (int) $_POST['thr_orderexpiry'] : 0;
/* Confirm that user has ability to change lock status of the thread. */
if ($perm & 4096) {
if ($locked && !($thread_opt & $locked)) {
$thread_opt |= 1;
} else if (!$locked && $thread_opt & 1) {
$thread_opt &= ~1;
}
}
/* Confirm that user has ability to change sticky status of the thread. */
if ($th_data[2] == $this->id && isset($_POST['thr_ordertype'], $_POST['thr_orderexpiry']) && $perm & 64) {
if (!$_POST['thr_ordertype'] && $thread_opt > 1) {
$orderexpiry = 0;
$thread_opt &= ~6;
} else if ($thread_opt < 2 && (int) $_POST['thr_ordertype']) {
$thread_opt |= $_POST['thr_ordertype'];
} else if (!($thread_opt & (int) $_POST['thr_ordertype'])) {
$thread_opt = $_POST['thr_ordertype'] | ($thread_opt & 1);
}
}
if ($perm & 64) {
if (!empty($_POST['thr_always_on_top'])) {
$thread_opt |= 8;
} else {
$thread_opt &= ~8;
}
}
/* Determine if any work needs to be done. */
if ($thread_opt != $th_data[1] || $orderexpiry != $th_data[0]) {
q('UPDATE fud30_thread SET '. ($th_data[2] == $this->id ? 'tdescr='. _esc($msg_tdescr) .',' : '') .' thread_opt='.$thread_opt.', orderexpiry='. $orderexpiry .' WHERE id='. $this->thread_id);
/* Avoid rebuilding the forum view whenever possible, since it's a rather slow process.
* Only rebuild if expiry time has changed or message gained/lost sticky status.
*/
$diff = $thread_opt ^ $th_data[1];
if (($diff > 1 && $diff & 14) || $orderexpiry != $th_data[0]) {
rebuild_forum_view_ttl($frm_id);
}
} else if ($msg_tdescr != $th_data[3] && $th_data[2] == $this->id) {
q('UPDATE fud30_thread SET tdescr='. _esc($msg_tdescr) .' WHERE id='. $this->thread_id);
}
} else if ($msg_tdescr != $th_data[3] && $th_data[2] == $this->id) {
q('UPDATE fud30_thread SET tdescr='. _esc($msg_tdescr) .' WHERE id='. $this->thread_id);
}
if ($GLOBALS['FUD_OPT_1'] & 16777216) { // FORUM_SEARCH enabled? If so, reindex message.
q('DELETE FROM fud30_index WHERE msg_id='. $this->id);
q('DELETE FROM fud30_title_index WHERE msg_id='. $this->id);
index_text((!strncasecmp('Re: ', $this->subject, 4) ? '' : $this->subject), $this->body, $this->id);
}
}
/** Delete a message & cleanup. */
static function delete($rebuild_view=1, $mid=0, $th_rm=0)
{
if (!$mid) {
$mid = $this->id;
}
if (!($del = db_sab('SELECT m.file_id, m.file_id_preview, m.id, m.attach_cnt, m.poll_id, m.thread_id, m.reply_to, m.apr, m.poster_id, t.replies, t.root_msg_id AS root_msg_id, t.last_post_id AS thread_lip, t.forum_id, f.last_post_id AS forum_lip
FROM fud30_msg m
LEFT JOIN fud30_thread t ON m.thread_id=t.id
LEFT JOIN fud30_forum f ON t.forum_id=f.id WHERE m.id='. $mid))) {
return;
}
if (!db_locked()) {
db_lock('fud30_msg_store WRITE, fud30_forum f WRITE, fud30_thr_exchange WRITE, fud30_tv_'. $del->forum_id .' WRITE, fud30_tv_'. $del->forum_id .' tv WRITE, fud30_msg m WRITE, fud30_thread t WRITE, fud30_level WRITE, fud30_forum WRITE, fud30_forum_read WRITE, fud30_thread WRITE, fud30_msg WRITE, fud30_attach WRITE, fud30_poll WRITE, fud30_poll_opt WRITE, fud30_poll_opt_track WRITE, fud30_users WRITE, fud30_thread_notify WRITE, fud30_bookmarks WRITE, fud30_msg_report WRITE, fud30_thread_rate_track WRITE, fud30_index WRITE, fud30_title_index WRITE, fud30_search_cache WRITE');
$ll = 1;
}
q('DELETE FROM fud30_msg WHERE id='. $mid);
/* Remove attachments. */
if ($del->attach_cnt) {
$res = q('SELECT location FROM fud30_attach WHERE message_id='. $mid .' AND attach_opt=0');
while ($loc = db_rowarr($res)) {
@unlink($loc[0]);
}
unset($res);
q('DELETE FROM fud30_attach WHERE message_id='. $mid .' AND attach_opt=0');
}
/* Remove message reports. */
q('DELETE FROM fud30_msg_report WHERE msg_id='. $mid);
/* Cleanup index entries. */
if ($GLOBALS['FUD_OPT_1'] & 16777216) { // FORUM_SEARCH enabled?
q('DELETE FROM fud30_index WHERE msg_id='. $mid);
q('DELETE FROM fud30_title_index WHERE msg_id='. $mid);
q('DELETE FROM fud30_search_cache WHERE msg_id='. $mid);
}
/* Remove poll. */
if ($del->poll_id) {
poll_delete($del->poll_id);
}
/* Check if thread. */
if ($del->root_msg_id == $del->id) {
$th_rm = 1;
/* Delete all messages in the thread if there is more than 1 message. */
if ($del->replies) {
$rmsg = q('SELECT id FROM fud30_msg WHERE thread_id='. $del->thread_id .' AND id != '. $del->id);
while ($dim = db_rowarr($rmsg)) {
fud_msg_edit::delete(0, $dim[0], 1);
}
unset($rmsg);
}
q('DELETE FROM fud30_thread_notify WHERE thread_id='. $del->thread_id);
q('DELETE FROM fud30_bookmarks WHERE thread_id='. $del->thread_id);
q('DELETE FROM fud30_thread WHERE id='. $del->thread_id);
q('DELETE FROM fud30_thread_rate_track WHERE thread_id='. $del->thread_id);
q('DELETE FROM fud30_thr_exchange WHERE th='. $del->thread_id);
if ($del->apr) {
/* We need to determine the last post id for the forum, it can be null. */
$lpi = (int) q_singleval(q_limit('SELECT t.last_post_id FROM fud30_thread t INNER JOIN fud30_msg m ON t.last_post_id=m.id AND m.apr=1 WHERE t.forum_id='.$del->forum_id.' AND t.moved_to=0 ORDER BY m.post_stamp DESC', 1));
q('UPDATE fud30_forum SET last_post_id='. $lpi .', thread_count=thread_count-1, post_count=post_count-'. $del->replies .'-1 WHERE id='. $del->forum_id);
}
} else if (!$th_rm && $del->apr) {
q('UPDATE fud30_msg SET reply_to='. $del->reply_to .' WHERE thread_id='. $del->thread_id .' AND reply_to='. $mid);
/* Check if the message is the last in thread. */
if ($del->thread_lip == $del->id) {
list($lpi, $lpd) = db_saq(q_limit('SELECT id, post_stamp FROM fud30_msg WHERE thread_id='. $del->thread_id .' AND apr=1 ORDER BY post_stamp DESC', 1));
q('UPDATE fud30_thread SET last_post_id='. $lpi .', last_post_date='. $lpd .', replies=replies-1 WHERE id='. $del->thread_id);
} else {
q('UPDATE fud30_thread SET replies=replies-1 WHERE id='. $del->thread_id);
}
/* Check if the message is the last in the forum. */
if ($del->forum_lip == $del->id) {
$page = q_singleval('SELECT seq FROM fud30_tv_'. $del->forum_id .' WHERE thread_id='. $del->thread_id);
$lp = db_saq(q_limit('SELECT t.last_post_id, t.last_post_date
FROM fud30_tv_'. $del->forum_id .' tv
INNER JOIN fud30_thread t ON tv.thread_id=t.id
WHERE tv.seq IN('. $page .','. ($page - 1) .') AND t.moved_to=0 ORDER BY t.last_post_date DESC', 1));
if (!isset($lpd) || $lp[1] > $lpd) {
$lpi = $lp[0];
}
q('UPDATE fud30_forum SET post_count=post_count-1, last_post_id='. $lpi .' WHERE id='. $del->forum_id);
} else {
q('UPDATE fud30_forum SET post_count=post_count-1 WHERE id='. $del->forum_id);
}
}
if ($del->apr) {
if ($del->poster_id) {
user_set_post_count($del->poster_id);
}
if ($rebuild_view) {
if ($th_rm) {
th_delete_rebuild($del->forum_id, $del->thread_id);
} else if ($del->thread_lip == $del->id) {
rebuild_forum_view_ttl($del->forum_id);
}
}
}
if (isset($ll)) {
db_unlock();
}
if ($GLOBALS['FUD_OPT_3'] & 32768) { // DB_MESSAGE_STORAGE
q('DELETE FROM fud30_msg_store WHERE id IN('. $del->file_id .','. $del->file_id_preview .')');
}
if (!$del->apr || !$th_rm || ($del->root_msg_id != $del->id)) {
return;
}
/* Needed for moved thread pointers. */
$r = q('SELECT forum_id, id FROM fud30_thread WHERE root_msg_id='. $del->root_msg_id);
while (($res = db_rowarr($r))) {
q('DELETE FROM fud30_thread WHERE id='. $res[1]);
q('UPDATE fud30_forum SET thread_count=thread_count-1 WHERE id='. $res[0]);
th_delete_rebuild($res[0], $res[1]);
}
unset($r);
}
static function approve($id)
{
/* Fetch info about the message, poll (if one exists), thread & forum. */
$mtf = db_sab('SELECT /* USE MASTER */
m.id, m.poster_id, m.apr, m.subject, m.foff, m.length, m.file_id, m.thread_id, m.poll_id, m.attach_cnt,
m.post_stamp, m.reply_to, m.mlist_msg_id, m.msg_opt,
t.forum_id, t.last_post_id, t.root_msg_id, t.last_post_date, t.thread_opt,
m2.post_stamp AS frm_last_post_date,
f.name AS frm_name, f.forum_opt,
u.alias, u.email, u.sig, u.name as real_name,
n.id AS nntp_id, ml.id AS mlist_id
FROM fud30_msg m
INNER JOIN fud30_thread t ON m.thread_id=t.id
INNER JOIN fud30_forum f ON t.forum_id=f.id
LEFT JOIN fud30_msg m2 ON f.last_post_id=m2.id
LEFT JOIN fud30_users u ON m.poster_id=u.id
LEFT JOIN fud30_mlist ml ON ml.forum_id=f.id AND '. q_bitand('ml.mlist_opt', 2) .' > 0
LEFT JOIN fud30_nntp n ON n.forum_id=f.id AND '. q_bitand('n.nntp_opt', 2) .' > 0
WHERE m.id='. $id .' AND m.apr=0');
/* Nothing to do or bad message id. */
if (!$mtf) {
return;
}
if ($mtf->alias) {
$mtf->alias = reverse_fmt($mtf->alias);
} else {
$mtf->alias = $GLOBALS['ANON_NICK'];
}
q('UPDATE fud30_msg SET apr=1 WHERE id='.$mtf->id);
if ($mtf->poster_id) {
user_set_post_count($mtf->poster_id);
}
if ($mtf->post_stamp > $mtf->frm_last_post_date) {
$mtf->last_post_id = $mtf->id;
}
if ($mtf->root_msg_id == $mtf->id) { /* New thread. */
th_new_rebuild($mtf->forum_id, $mtf->thread_id, $mtf->thread_opt & (2|4|8));
$threads = 1;
} else { /* Reply to thread. */
if ($mtf->post_stamp > $mtf->last_post_date) {
th_inc_post_count($mtf->thread_id, 1, $mtf->id, $mtf->post_stamp);
} else {
th_inc_post_count($mtf->thread_id, 1);
}
th_reply_rebuild($mtf->forum_id, $mtf->thread_id, $mtf->thread_opt & (2|4|8));
$threads = 0;
}
/* Update forum thread & post count as well as last_post_id field. */
q('UPDATE fud30_forum SET post_count=post_count+1, thread_count=thread_count+'. $threads .', last_post_id='. $mtf->last_post_id .' WHERE id='. $mtf->forum_id);
if ($mtf->poll_id) {
poll_activate($mtf->poll_id, $mtf->forum_id);
}
$mtf->body = read_msg_body($mtf->foff, $mtf->length, $mtf->file_id);
if ($GLOBALS['FUD_OPT_1'] & 16777216) { // FORUM_SEARCH enabled?
index_text((strncasecmp($mtf->subject, 'Re: ', 4) ? $mtf->subject : ''), $mtf->body, $mtf->id);
}
/* Handle notifications. */
if (!($GLOBALS['FUD_OPT_3'] & 1048576)) { // not DISABLE_NOTIFICATION_EMAIL
if ($mtf->root_msg_id == $mtf->id || $GLOBALS['FUD_OPT_3'] & 16384) { // FORUM_NOTIFY_ALL
if (empty($mtf->frm_last_post_date)) {
$mtf->frm_last_post_date = 0;
}
/* Send new thread notifications to forum subscribers. */
$to = db_all('SELECT u.email
FROM fud30_forum_notify fn
INNER JOIN fud30_users u ON fn.user_id=u.id AND '. q_bitand('u.users_opt', 134217728) .' = 0
INNER JOIN fud30_group_cache g1 ON g1.user_id=2147483647 AND g1.resource_id='. $mtf->forum_id .
($GLOBALS['FUD_OPT_3'] & 64 ? ' LEFT JOIN fud30_forum_read r ON r.forum_id=fn.forum_id AND r.user_id=fn.user_id ' : '').
' LEFT JOIN fud30_group_cache g2 ON g2.user_id=fn.user_id AND g2.resource_id='. $mtf->forum_id .
' LEFT JOIN fud30_mod mm ON mm.forum_id='. $mtf->forum_id .' AND mm.user_id=u.id
WHERE
fn.forum_id='. $mtf->forum_id .' AND fn.user_id!='. (int)$mtf->poster_id .
($GLOBALS['FUD_OPT_3'] & 64 ? ' AND (CASE WHEN (r.last_view IS NULL AND (u.last_read=0 OR u.last_read >= '. $mtf->frm_last_post_date .')) OR r.last_view > '. $mtf->frm_last_post_date .' THEN 1 ELSE 0 END)=1 ' : '').
' AND ('. q_bitand('COALESCE(g2.group_cache_opt, g1.group_cache_opt)', 2) .' > 0 OR '. q_bitand('u.users_opt', 1048576) .' > 0 OR mm.id IS NOT NULL)'.
' AND '. q_bitand('u.users_opt', 65536) .' = 0');
if ($GLOBALS['FUD_OPT_3'] & 16384) {
$notify_type = 'thr';
} else {
$notify_type = 'frm';
}
} else {
$to = array();
}
if ($mtf->root_msg_id != $mtf->id) {
/* Send new reply notifications to thread subscribers. */
$tmp = db_all('SELECT u.email
FROM fud30_thread_notify tn
INNER JOIN fud30_users u ON tn.user_id=u.id AND '. q_bitand('u.users_opt', 134217728) .' = 0
INNER JOIN fud30_group_cache g1 ON g1.user_id=2147483647 AND g1.resource_id='. $mtf->forum_id .
($GLOBALS['FUD_OPT_3'] & 64 ? ' LEFT JOIN fud30_read r ON r.thread_id=tn.thread_id AND r.user_id=tn.user_id ' : '').
' LEFT JOIN fud30_group_cache g2 ON g2.user_id=tn.user_id AND g2.resource_id='. $mtf->forum_id .
' LEFT JOIN fud30_mod mm ON mm.forum_id='. $mtf->forum_id .' AND mm.user_id=u.id
WHERE
tn.thread_id='. $mtf->thread_id .' AND tn.user_id!='. (int)$mtf->poster_id .
($GLOBALS['FUD_OPT_3'] & 64 ? ' AND (r.msg_id='. $mtf->last_post_id .' OR (r.msg_id IS NULL AND '. $mtf->post_stamp .' > u.last_read)) ' : '').
' AND ('. q_bitand('COALESCE(g2.group_cache_opt, g1.group_cache_opt)', 2) .' > 0 OR '. q_bitand('u.users_opt', 1048576) .' > 0 OR mm.id IS NOT NULL)'.
' AND '. q_bitand('u.users_opt', 65536) .' = 0');
$to = !$to ? $tmp : array_unique(array_merge($to, $tmp));
$notify_type = 'thr';
}
if ($mtf->forum_opt & 64) { // always_notify_mods
$tmp = db_all('SELECT u.email FROM fud30_mod mm INNER JOIN fud30_users u ON u.id=mm.user_id WHERE mm.forum_id='. $mtf->forum_id);
$to = !$to ? $tmp : array_unique(array_merge($to, $tmp));
}
if ($to) {
send_notifications($to, $mtf->id, $mtf->subject, $mtf->alias, $notify_type, ($notify_type == 'thr' ? $mtf->thread_id : $mtf->forum_id), $mtf->frm_name, $mtf->forum_id);
}
}
// Handle Mailing List and/or Newsgroup syncronization.
if (($mtf->nntp_id || $mtf->mlist_id) && !$mtf->mlist_msg_id) {
fud_use('email_msg_format.inc', 1);
$from = $mtf->poster_id ? reverse_fmt($mtf->real_name) .' <'. $mtf->email .'>' : $GLOBALS['ANON_NICK'] .' <'. $GLOBALS['NOTIFY_FROM'] .'>';
$body = $mtf->body . (($mtf->msg_opt & 1 && $mtf->sig) ? "\n-- \n" . $mtf->sig : '');
$body = plain_text($body, '', ' ', ' ');
$mtf->subject = reverse_fmt($mtf->subject);
if ($mtf->reply_to) {
// Get the parent message's Message-ID:
if ( !($replyto_id = q_singleval('SELECT mlist_msg_id FROM fud30_msg WHERE id='. $mtf->reply_to))) {
fud_logerror('WARNING: Send reply with no Message-ID. The import script is not running or may be lagging.', 'fud_errors');
}
} else {
$replyto_id = 0;
}
if ($mtf->attach_cnt) {
$r = uq('SELECT a.id, a.original_name, COALESCE(m.mime_hdr, \'application/octet-stream\')
FROM fud30_attach a
LEFT JOIN fud30_mime m ON a.mime_type=m.id
WHERE a.message_id='. $mtf->id .' AND a.attach_opt=0');
while ($ent = db_rowarr($r)) {
$attach[$ent[1]] = file_get_contents($GLOBALS['FILE_STORE'] . $ent[0] .'.atch');
$attach_mime[$ent[1]] = $ent[2];
}
unset($r);
} else {
$attach_mime = $attach = null;
}
if ($mtf->nntp_id) { // Push out to usenet group.
fud_use('nntp.inc', true);
$nntp_adm = db_sab('SELECT * FROM fud30_nntp WHERE id='. $mtf->nntp_id);
if (!empty($nntp_adm->custom_sig)) { // Add signature marker.
$nntp_adm->custom_sig = "\n-- \n". $nntp_adm->custom_sig;
}
$nntp = new fud_nntp;
$nntp->server = $nntp_adm->server;
$nntp->newsgroup = $nntp_adm->newsgroup;
$nntp->port = $nntp_adm->port;
$nntp->timeout = $nntp_adm->timeout;
$nntp->nntp_opt = $nntp_adm->nntp_opt;
$nntp->user = $nntp_adm->login;
$nntp->pass = $nntp_adm->pass;
define('sql_p', 'fud30_');
$lock = $nntp->get_lock();
$nntp->post_message($mtf->subject, $body . $nntp_adm->custom_sig, $from, $mtf->id, $replyto_id, $attach, $attach_mime);
$nntp->close_connection();
$nntp->release_lock($lock);
} else { // Push out to mailing list.
fud_use('mlist_post.inc', true);
$r = db_saq('SELECT name, additional_headers, custom_sig, fixed_from_address FROM fud30_mlist WHERE id='. $mtf->mlist_id);
// Add forum's signature to the messages.
if (!empty($r[2])) {
$body .= "\n-- \n". $r[2];
}
if (!empty($r[3])) { // Use the forum's fixed "From:" address.
mail_list_post($r[0], $r[3], $mtf->subject, $body, $mtf->id, $replyto_id, $attach, $attach_mime, $r[1]);
} else { // Use poster's e-mail as the "From" address.
mail_list_post($r[0], $from, $mtf->subject, $body, $mtf->id, $replyto_id, $attach, $attach_mime, $r[1]);
}
}
}
// Message Approved plugins.
if (defined('plugins')) {
plugin_call_hook('POST_APPROVE', $mtf);
}
}
}
function write_body($data, &$len, &$offset, $fid)
{
$MAX_FILE_SIZE = 2140000000;
$len = strlen($data);
$i = 1;
db_lock('fud30_fl_'. $fid .' WRITE');
$s = $fid * 10000;
$e = $s + 100;
while ($s < $e) {
$fp = fopen($GLOBALS['MSG_STORE_DIR'] .'msg_'. $s, 'ab');
if (!$fp) {
exit('FATAL ERROR: could not open message store for forum id#'. $s ." \n");
}
fseek($fp, 0, SEEK_END);
if (!($off = ftell($fp))) {
$off = __ffilesize($fp);
}
if (!$off || ($off + $len) < $MAX_FILE_SIZE) {
break;
}
fclose($fp);
$s++;
}
if (fwrite($fp, $data) !== $len) {
if ($fid) {
db_unlock();
}
exit("FATAL ERROR: system has ran out of disk space. \n");
}
fclose($fp);
db_unlock();
if (!$off) {
@chmod('msg_'. $s, ($GLOBALS['FUD_OPT_2'] & 8388608 ? 0600 : 0644));
}
$offset = $off;
return $s;
}
function trim_html($str, $maxlen)
{
$n = strlen($str);
$ln = 0;
$tree = array();
for ($i = 0; $i < $n; $i++) {
if ($str[$i] != '<') {
$ln++;
if ($ln > $maxlen) {
break;
}
continue;
}
if (($p = strpos($str, '>', $i)) === false) {
break;
}
for ($k = $i; $k < $p; $k++) {
switch ($str[$k]) {
case ' ':
case "\r":
case "\n":
case "\t":
case '>':
break 2;
}
}
if ($str[$i+1] == '/') {
$tagname = strtolower(substr($str, $i+2, $k-$i-2));
if (@end($tagindex[$tagname])) {
$k = key($tagindex[$tagname]);
unset($tagindex[$tagname][$k], $tree[$k]);
}
} else {
$tagname = strtolower(substr($str, $i+1, $k-$i-1));
switch ($tagname) {
case 'br':
case 'img':
case 'meta':
break;
default:
$tree[] = $tagname;
end($tree);
$tagindex[$tagname][key($tree)] = 1;
}
}
$i = $p;
}
$data = substr($str, 0, $i);
if ($tree) {
foreach (array_reverse($tree) as $v) {
$data .= ''. $v .'>';
}
}
return $data;
}
function make_email_message(&$body, &$obj, $iemail_unsub)
{
$TITLE_EXTRA = $iemail_poll = $iemail_attach = '';
if ($obj->poll_cache) {
$pl = unserialize($obj->poll_cache);
if (!empty($pl)) {
foreach ($pl as $k => $v) {
$length = ($v[1] && $obj->total_votes) ? round($v[1] / $obj->total_votes * 100) : 0;
$iemail_poll .= '
'.$k.'.
'.$v[0].'
'.$v[1].' / '.$length.'%
';
}
$iemail_poll = '
'.$obj->poll_name.'
[ '.$obj->total_votes.' '.convertPlural($obj->total_votes, array('vote','votes')).' ]
'.$iemail_poll.'
';
}
}
if ($obj->attach_cnt && $obj->attach_cache) {
$atch = unserialize($obj->attach_cache);
if (!empty($atch)) {
foreach ($atch as $v) {
$sz = $v[2] / 1024;
$sz = $sz < 1000 ? number_format($sz, 2) .'KB' : number_format($sz/1024, 2) .'MB';
$iemail_attach .= '
Attachment: '.$v[1].'
(Size: '.$sz.', Downloaded '.convertPlural($v[3], array(''.$v[3].' time',''.$v[3].' times')).')
';
}
$iemail_attach = '
';
}
}
if ($GLOBALS['FUD_OPT_2'] & 32768 && defined('_rsid')) {
$pfx = str_repeat('/', substr_count(_rsid, '/'));
}
// Remove all JavaScript. Spam filters like SpamAssassin don't like them.
return preg_replace('##is', '', '
'.$GLOBALS['FORUM_TITLE'].$TITLE_EXTRA.'
Subject: '.$obj->subject.'
Author: '.$obj->alias.'
Date: '.print_date('%a, %d %B %Y %H:%M', $obj->post_stamp).'
'.$iemail_poll.'
'.$body.'
'.$iemail_attach.'
[ Reply ][ Quote ][ View Topic/Message ]'.$iemail_unsub.'
');
}
function poll_cache_rebuild($poll_id)
{
if (!$poll_id) {
return;
}
$data = array();
$c = uq('SELECT id, name, votes FROM fud30_poll_opt WHERE poll_id='. $poll_id);
while ($r = db_rowarr($c)) {
$data[$r[0]] = array($r[1], $r[2]);
}
unset($c);
if ($data) {
return serialize($data);
} else {
return;
}
}
function send_notifications($to, $msg_id, $thr_subject, $poster_login, $id_type, $id, $frm_name, $frm_id)
{
if (!$to) {
return;
}
$goto_url['email'] = ''.$GLOBALS['WWW_ROOT'].'?t=rview&goto='. $msg_id .'#msg_'. $msg_id;
$CHARSET = $GLOBALS['CHARSET'];
if ($GLOBALS['FUD_OPT_2'] & 64) { // NOTIFY_WITH_BODY
$munge_newlines = 0;
$obj = db_sab('SELECT p.total_votes, p.name AS poll_name, m.reply_to, m.subject, m.id, m.post_stamp, m.poster_id, m.foff, m.length, m.file_id, u.alias, m.attach_cnt, m.attach_cache, m.poll_cache FROM fud30_msg m LEFT JOIN fud30_users u ON m.poster_id=u.id LEFT JOIN fud30_poll p ON m.poll_id=p.id WHERE m.id='. $msg_id .' AND m.apr=1');
if (!$obj->alias) { /* anon user */
$obj->alias = htmlspecialchars($GLOBALS['ANON_NICK']);
}
$headers = "MIME-Version: 1.0\r\n";
if ($obj->reply_to) {
$headers .= 'In-Reply-To: '. $obj->reply_to ."\r\n";
}
$headers .= 'List-Id: '. $frm_id .'.'. (isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'localhost') ."\r\n";
$split = get_random_value(128);
$headers .= "Content-Type: multipart/alternative;\n boundary=\"------------". $split ."\"\r\n";
$boundry = "\r\n--------------". $split ."\r\n";
$pfx = '';
if ($GLOBALS['FUD_OPT_2'] & 32768 && !empty($_SERVER['PATH_INFO'])) {
if ($GLOBALS['FUD_OPT_1'] & 128) {
$pfx .= '0/';
}
if ($GLOBALS['FUD_OPT_2'] & 8192) {
$pfx .= '0/';
}
}
$plain_text = read_msg_body($obj->foff, $obj->length, $obj->file_id);
$iemail_unsub = html_entity_decode($id_type == 'thr' ? '[ Unsubscribe from this topic ]' : '[ Unsubscribe from this forum ]');
$body_email = $boundry .'Content-Type: text/plain; charset='. $CHARSET ."; format=flowed\r\nContent-Transfer-Encoding: 8bit\r\n\r\n" . html_entity_decode(strip_tags($plain_text)) . "\r\n\r\n" . html_entity_decode('To participate in the discussion, go here:') .' '. ''.$GLOBALS['WWW_ROOT'].'?t=rview&'. ($id_type == 'thr' ? 'th' : 'frm_id') .'='. $id ."\r\n".
$boundry .'Content-Type: text/html; charset='. $CHARSET ."\r\nContent-Transfer-Encoding: 8bit\r\n\r\n". make_email_message($plain_text, $obj, $iemail_unsub) ."\r\n". substr($boundry, 0, -2) ."--\r\n";
} else {
$munge_newlines = 1;
$headers = '';
}
$thr_subject = reverse_fmt($thr_subject);
$poster_login = reverse_fmt($poster_login);
if ($id_type == 'thr') {
$subj = html_entity_decode('New reply to '.$thr_subject.' by '.$poster_login.'');
if (!isset($body_email)) {
$unsub_url['email'] = ''.$GLOBALS['WWW_ROOT'].'?t=rview&th='. $id .'¬ify=1&opt=off';
$body_email = html_entity_decode('To view unread replies go to '.$goto_url['email'].'\n\nIf you do not wish to receive further notifications about replies in this topic, please go here: '.$unsub_url['email'].'');
}
} else if ($id_type == 'frm') {
$frm_name = reverse_fmt($frm_name);
$subj = html_entity_decode('New topic in forum '.$frm_name.', called '.$thr_subject.', by '.$poster_login.'');
if (!isset($body_email)) {
$unsub_url['email'] = ''.$GLOBALS['WWW_ROOT'].'?t=rview&unsub=1&frm_id='. $id;
$body_email = html_entity_decode('To view the topic go to:\n'.$goto_url['email'].'\n\nTo stop receiving notifications about new topics in this forum, please go here: '.$unsub_url['email'].'');
}
}
send_email($GLOBALS['NOTIFY_FROM'], $to, $subj, $body_email, $headers, $munge_newlines);
}
?>
PK =1] tabs.incnu [ 'uc',
'Account Settings'=>'register',
'Subscriptions'=>'subscribed',
'Bookmarks'=>'bookmarked',
'Referrals'=>'referals',
'Buddy List'=>'buddy_list',
'Ignore List'=>'ignore_list',
'Show Own Posts'=>'showposts'
);
if (!($FUD_OPT_2 & 8192)) {
unset($tablist['Referrals']);
}
if (isset($_POST['mod_id'])) {
$mod_id_chk = $_POST['mod_id'];
} else if (isset($_GET['mod_id'])) {
$mod_id_chk = $_GET['mod_id'];
} else {
$mod_id_chk = null;
}
if (!$mod_id_chk) {
if ($FUD_OPT_1 & 1024) {
$tablist['Private Messaging'] = 'pmsg';
}
$pg = ($_GET['t'] == 'pmsg_view' || $_GET['t'] == 'ppost') ? 'pmsg' : $_GET['t'];
foreach($tablist as $tab_name => $tab) {
$tab_url = '[[relativeurl]]/index.php?t='. $tab . (s ? '&S='. s : '');
if ($tab == 'referals') {
if (!($FUD_OPT_2 & 8192)) {
continue;
}
$tab_url .= '&id='. _uid;
} else if ($tab == 'showposts') {
$tab_url .= '&id='. _uid;
}
$tabs .= $pg == $tab ? ' ' : ' ';
}
$tabs = '';
}
}
?>
PK =1]"X&