📄 my.php
字号:
<?php
/*
[Discuz!] (C)2001-2006 Comsenz Inc.
This is NOT a freeware, use is subject to license terms
$RCSfile: my.php,v $
$Revision: 1.47.2.4 $
$Date: 2006/09/06 09:30:47 $
*/
require_once './include/common.inc.php';
require_once DISCUZ_ROOT.'./forumdata/cache/cache_forums.php';
$discuz_action = 8;
if(!$discuz_uid) {
showmessage('not_loggedin', NULL, 'NOPERM');
}
$page = empty($page) || !ispage($page) ? 1 : $page;
$start_limit = ($page - 1) * $tpp;
$threadlist = $postlist = array();
$tids = $comma = '';
if(!empty($srchfid) && $srchfid = intval($srchfid)) {
$threadadd = "AND t.fid='$srchfid'";
$postadd = "AND p.fid='$srchfid'";
$forumname = $_DCACHE['forums'][$srchfid]['name'];
$extrafid = '&srchfid='.$srchfid;
} else {
$srchfid = $threadadd = $postadd = $forumname = $extrafid = $extra = '';
}
if(empty($item)) {
$query = $db->query("SELECT m.*, t.subject, t.fid, t.displayorder, t.lastposter, t.lastpost FROM {$tablepre}mythreads m, {$tablepre}threads t
WHERE m.uid='$discuz_uid' AND m.tid=t.tid $threadadd ORDER BY m.dateline DESC LIMIT 5");
while($thread = $db->fetch_array($query)) {
$thread['lastpost'] = gmdate("$dateformat $timeformat", $thread['lastpost'] + $timeoffset * 3600);
$thread['forumname'] = $_DCACHE['forums'][$thread['fid']]['name'];
$thread['lastposterenc'] = rawurlencode($thread['lastposter']);
$threadlist[] = $thread;
}
$query = $db->query("SELECT m.*, p.subject, p.fid, p.invisible FROM {$tablepre}myposts m, {$tablepre}posts p
WHERE m.uid='$discuz_uid' AND m.pid=p.pid $postadd ORDER BY m.dateline DESC LIMIT 5");
while($post = $db->fetch_array($query)) {
$post['forumname'] = $_DCACHE['forums'][$post['fid']]['name'];
$post['page'] = ceil($post['position'] / $ppp);
$postlist[$post['tid']] = $post;
$tids .= $comma.$post['tid'];
$comma = ', ';
}
if($tids) {
$query = $db->query("SELECT tid, subject AS tsubject, lastposter, lastpost FROM {$tablepre}threads WHERE tid IN ($tids)");
while($thread = $db->fetch_array($query)) {
$postlist[$thread['tid']]['tsubject'] = $thread['tsubject'];
$postlist[$thread['tid']]['lastposter'] = $thread['lastposter'];
$postlist[$thread['tid']]['lastpost'] = gmdate("$dateformat $timeformat", $thread['lastpost'] + $timeoffset * 3600);
$postlist[$thread['tid']]['lastposterenc'] = rawurlencode($thread['lastposter']);
}
}
} elseif($item == 'threads') {
$query = $db->query("SELECT COUNT(*) FROM {$tablepre}mythreads m, {$tablepre}threads t WHERE m.uid='$discuz_uid' $threadadd AND m.tid=t.tid");
$num = $db->result($query, 0);
$multipage = multi($num, $tpp, $page, 'my.php?item=threads'.($srchfid ? "&srchfid=$srchfid" : NULL).$extrafid);
$query = $db->query("SELECT m.*, t.subject, t.fid, t.displayorder, t.closed, t.lastposter, t.lastpost FROM {$tablepre}mythreads m, {$tablepre}threads t
WHERE m.uid = '$discuz_uid' $threadadd AND m.tid=t.tid ORDER BY m.dateline DESC LIMIT $start_limit, $tpp");
while($thread = $db->fetch_array($query)) {
$thread['lastpost'] = gmdate("$dateformat $timeformat", $thread['lastpost'] + $timeoffset * 3600);
$thread['forumname'] = $_DCACHE['forums'][$thread['fid']]['name'];
$thread['lastposterenc'] = rawurlencode($thread['lastposter']);
$threadlist[] = $thread;
}
} elseif($item == 'posts') {
$query = $db->query("SELECT COUNT(*) FROM {$tablepre}myposts m, {$tablepre}posts p WHERE m.uid='$discuz_uid' $postadd AND m.pid=p.pid");
$num = $db->result($query, 0);
$multipage = multi($num, $tpp, $page, 'my.php?item=posts'.($srchfid ? "&srchfid=$srchfid" : NULL).$extrafid);
$query = $db->query("SELECT m.uid, m.tid, m.pid, m.position, p.fid, p.invisible, p.dateline FROM {$tablepre}myposts m, {$tablepre}posts p
WHERE m.uid = '$discuz_uid' $postadd AND m.pid=p.pid ORDER BY m.dateline DESC LIMIT $start_limit, $tpp");
while($post = $db->fetch_array($query)) {
$post['forumname'] = $_DCACHE['forums'][$post['fid']]['name'];
$post['page'] = ceil($post['position'] / $ppp);
$postlist[$post['tid']] = $post;
$tids .= $comma.$post['tid'];
$comma = ', ';
}
if($tids) {
$query = $db->query("SELECT tid, subject AS tsubject, lastposter, lastpost FROM {$tablepre}threads WHERE tid IN ($tids)");
while($thread = $db->fetch_array($query)) {
$postlist[$thread['tid']]['tsubject'] = $thread['tsubject'];
$postlist[$thread['tid']]['lastposter'] = $thread['lastposter'];
$postlist[$thread['tid']]['lastpost'] = gmdate("$dateformat $timeformat", $thread['lastpost'] + $timeoffset * 3600);
$postlist[$thread['tid']]['lastposterenc'] = rawurlencode($thread['lastposter']);
}
}
} elseif($item == 'favorites') {
if(!in_array($type, array('forum', 'thread'))) {
showmessage('undefined_action', NULL, 'HALTED');
}
$ftid = $type == 'forum' ? 'fid' : 'tid';
$extra .= $srchfid ? '&type='.$type : '';
if(isset($favadd) && !submitcheck('favsubmit')) {
$query = $db->query("SELECT COUNT(*) FROM {$tablepre}favorites WHERE uid='$discuz_uid' AND $ftid>'0'");
if($db->result($query, 0) >= $maxfavorites) {
showmessage('favorite_is_full', 'my.php?item=favorites&type='.$type);
}
$query = $db->query("SELECT $ftid FROM {$tablepre}favorites WHERE uid='$discuz_uid' AND $ftid='$favadd' LIMIT 1");
if($db->result($query, 0)) {
showmessage('favorite_repeat');
} else {
$db->query("INSERT INTO {$tablepre}favorites (uid, $ftid) VALUES ('$discuz_uid', '$favadd')");
showmessage('favorite_add_referer', dreferer());
}
} elseif(empty($favadd)) {
if(!submitcheck('favsubmit')) {
$favlist = array();
if($type == 'forum') {
$query = $db->query("SELECT COUNT(*) FROM {$tablepre}favorites fav, {$tablepre}forums f
WHERE fav.uid = '$discuz_uid' AND fav.fid=f.fid");
$num = $db->result($query, 0);
$multipage = multi($num, $tpp, $page, "my.php?item=favorites&type=forum$extrafid");
$query = $db->query("SELECT f.fid, f.name, f.threads, f.posts, f.todayposts, f.lastpost
FROM {$tablepre}favorites fav, {$tablepre}forums f
WHERE fav.fid=f.fid AND fav.uid='$discuz_uid' ORDER BY f.lastpost DESC LIMIT $start_limit, $tpp");
while($fav = $db->fetch_array($query)) {
$fav['lastposterenc'] = rawurlencode($fav['lastposter']);
$fav['lastpost'] = gmdate("$dateformat $timeformat", $fav['lastpost'] + $timeoffset * 3600);
$favlist[] = $fav;
}
} else {
$query = $db->query("SELECT COUNT(*) FROM {$tablepre}favorites fav, {$tablepre}threads t
WHERE fav.uid = '$discuz_uid' AND fav.tid=t.tid AND t.displayorder>='0' $threadadd");
$num = $db->result($query, 0);
$multipage = multi($num, $tpp, $page, "my.php?item=favorites&type=thread$extrafid");
$query = $db->query("SELECT t.tid, t.fid, t.subject, t.replies, t.lastpost, t.lastposter, f.name
FROM {$tablepre}favorites fav, {$tablepre}threads t, {$tablepre}forums f
WHERE fav.tid=t.tid AND t.displayorder>='0' AND fav.uid='$discuz_uid' AND t.fid=f.fid $threadadd
ORDER BY t.lastpost DESC LIMIT $start_limit, $tpp");
while($fav = $db->fetch_array($query)) {
$fav['lastposterenc'] = rawurlencode($fav['lastposter']);
$fav['lastpost'] = gmdate("$dateformat $timeformat", $fav['lastpost'] + $timeoffset * 3600);
$favlist[] = $fav;
}
}
} else {
$ids = $comma = '';
if(!empty($delete) && is_array($delete)) {
foreach($delete as $deleteid) {
$ids .= $comma.intval($deleteid);
$comma = ', ';
}
}
if($ids) {
$db->query("DELETE FROM {$tablepre}favorites WHERE uid='$discuz_uid' AND $ftid IN ($ids)");
}
showmessage('favorite_update_succeed', dreferer());
}
}
} elseif($item == 'subscriptions') {
if(isset($subadd) && !submitcheck('subsubmit')) {
$query = $db->query("SELECT COUNT(*) FROM {$tablepre}subscriptions WHERE uid='$discuz_uid'");
if($db->result($query, 0) >= $maxsubscriptions) {
showmessage('subscription_is_full', 'my.php?item=subscriptions');
}
$query = $db->query("SELECT tid FROM {$tablepre}subscriptions WHERE tid='$subadd' AND uid='$discuz_uid' LIMIT 1");
if($db->result($query, 0)) {
showmessage('subscription_exists');
} else {
$db->query("INSERT INTO {$tablepre}subscriptions (uid, tid, lastnotify) VALUES ('$discuz_uid', '$subadd', '')");
showmessage('subscription_add_succeed', dreferer());
}
} elseif(empty($subadd)) {
if(!submitcheck('subsubmit')) {
$query = $db->query("SELECT COUNT(*) FROM {$tablepre}subscriptions s, {$tablepre}threads t
WHERE s.uid = '$discuz_uid' AND s.tid=t.tid $threadadd");
$num = $db->result($query, 0);
$multipage = multi($num, $tpp, $page, "my.php?item=favorites&type=thread$extrafid");
$subslist = array();
$query = $db->query("SELECT t.tid, t.fid, t.subject, t.replies, t.lastpost, t.lastposter, f.name
FROM {$tablepre}subscriptions s, {$tablepre}threads t, {$tablepre}forums f
WHERE t.tid=s.tid AND t.displayorder>='0' AND f.fid=t.fid AND s.uid='$discuz_uid' $threadadd
ORDER BY t.lastpost DESC LIMIT $start_limit, $tpp");
while($subs = $db->fetch_array($query)) {
$subs['lastposterenc'] = rawurlencode($subs['lastposter']);
$subs['lastpost'] = gmdate("$dateformat $timeformat", $subs['lastpost'] + $timeoffset * 3600);
$subslist[] = $subs;
}
} else {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -