📄 my.php
字号:
<?php
/*
[Discuz!] (C)2001-2007 Comsenz Inc.
This is NOT a freeware, use is subject to license terms
$RCSfile: my.php,v $
$Revision: 1.68.2.8 $
$Date: 2007/03/21 15:52:05 $
*/
define('NOROBOT', TRUE);
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 = max(1, intval($page));
$start_limit = ($page - 1) * $tpp;
$threadlist = $postlist = array();
$tids = $comma = $threadadd = $postadd = $forumname = $extrafid = $extra = '';
if($srchfid = intval($srchfid)) {
$threadadd = "AND t.fid='$srchfid'";
$postadd = "AND p.fid='$srchfid'";
$forumname = $_DCACHE['forums'][$srchfid]['name'];
$extrafid = '&srchfid='.$srchfid;
}
$item = isset($item) ? trim($item) : '';
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.fid, p.invisible FROM {$tablepre}myposts m
INNER JOIN {$tablepre}posts p ON p.pid=m.pid $postadd
INNER JOIN {$tablepre}threads t ON t.tid=m.tid
WHERE m.uid = '$discuz_uid' ORDER BY m.dateline DESC LIMIT 5");
while($post = $db->fetch_array($query)) {
$post['forumname'] = $_DCACHE['forums'][$post['fid']]['name'];
$postlist[$post['tid']] = $post;
$tids .= $comma.$post['tid'];
$comma = ', ';
}
if($tids) {
$query = $db->query("SELECT tid, subject, lastposter, lastpost FROM {$tablepre}threads WHERE tid IN ($tids)");
while($thread = $db->fetch_array($query)) {
$postlist[$thread['tid']]['subject'] = $thread['subject'];
$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
INNER JOIN {$tablepre}posts p ON p.pid=m.pid $postadd
INNER JOIN {$tablepre}threads t ON t.tid=m.tid
WHERE m.uid = '$discuz_uid'");
$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, p.fid, p.invisible, p.dateline FROM {$tablepre}myposts m
INNER JOIN {$tablepre}posts p ON p.pid=m.pid $postadd
INNER JOIN {$tablepre}threads t ON t.tid=m.tid
WHERE m.uid = '$discuz_uid' ORDER BY m.dateline DESC LIMIT $start_limit, $tpp");
while($post = $db->fetch_array($query)) {
$post['forumname'] = $_DCACHE['forums'][$post['fid']]['name'];
$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(in_array($item, array('favorites', 'subscriptions'))) {
if($fid && empty($forum['allowview'])) {
if(!$forum['viewperm'] && !$readaccess) {
showmessage('group_nopermission', NULL, 'NOPERM');
} elseif($forum['viewperm'] && !forumperm($forum['viewperm'])) {
showmessage('forum_nopermission', NULL, 'NOPERM');
}
}
if($item == 'favorites') {
$ftid = $type == 'thread' || $tid ? 'tid' : 'fid';
$type = $type == 'thread' || $tid ? 'thread' : 'forum';
$extra .= $srchfid ? '&type='.$type : '';
if(($fid || $tid) && !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='${$ftid}' LIMIT 1");
if($db->result($query, 0)) {
showmessage('favorite_exists');
} else {
$db->query("INSERT INTO {$tablepre}favorites (uid, $ftid) VALUES ('$discuz_uid', '${$ftid}')");
showmessage('favorite_add_succeed', dreferer());
}
} elseif(!$fid && !$tid) {
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 {
if($ids = implodeids($delete)) {
$db->query("DELETE FROM {$tablepre}favorites WHERE uid='$discuz_uid' AND $ftid IN ($ids)", 'UNBUFFERED');
}
showmessage('favorite_update_succeed', dreferer());
}
}
} else {
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=subscriptions$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 + -