Exemple #1
0
function pc_admin_check_permission()
{
    global $loginok, $currentuser, $pcconfig;
    if ($loginok != 1) {
        html_nologin();
    } elseif (!strcmp($currentuser["userid"], "guest")) {
        html_init("gb2312");
        html_error_quit("对不起,请先登录");
        exit;
    } elseif (!pc_is_manager($currentuser)) {
        html_init("gb2312");
        html_error_quit("对不起,您无权访问该页");
        exit;
    } else {
        return;
    }
}
Exemple #2
0
function display_art_list($link, $pc, $tag, $pur, $tid = 0, $order = "", $pno)
{
    global $currentuser;
    if ($pc['USER'] == '_filter') {
        $query = "SELECT `fid` , `pid` , `nid` , `state` , `username`, `uid` , `recuser`, `created` , `emote` , `changed` , `comment` , `commentcount` , `subject` , `visitcount` , `htmltag` ,`trackbackcount` , `trackback` " . " FROM filter WHERE `state` = '" . $tag . "' ";
    } else {
        $query = "SELECT `nid` , `pid` ,  `created` , `emote` , `changed` , `comment` , `commentcount` , `subject` , `visitcount` , `htmltag` ,`trackbackcount` , `trackback` " . " FROM nodes WHERE `access` = '" . $tag . "' AND `uid` = '" . $pc["UID"] . "'  AND `tid` = '" . $tid . "' ";
    }
    switch ($order) {
        case "c":
            $query .= " ORDER BY `created` DESC , ";
            break;
        case "u":
            $query .= " ORDER BY `changed` DESC , ";
            break;
        case "v":
            $query .= " ORDER BY `visitcount`  DESC , ";
            break;
        case "r":
            $query .= " ORDER BY `commentcount`  DESC , ";
            break;
        case "co":
            $query .= " ORDER BY `comment`  ASC , ";
            break;
        case "tb":
            $query .= " ORDER BY `trackbackcount` DESC , ";
            break;
        default:
            $query .= " ORDER BY ";
    }
    $query .= "  `created` DESC  ";
    $pno = intval($pno);
    if ($pno < 1) {
        $pno = 1;
    }
    $cnt = 40;
    //cnt
    $start = ($pno - 1) * $cnt;
    $query .= " LIMIT " . $start . "," . $cnt . " ;";
    $result = mysql_query($query, $link);
    $i = 0;
    $is_admin = pc_is_manager($currentuser);
    ?>
<form action="pcmanage.php?userid=<?php 
    echo $pc["USER"];
    ?>
" method="post">	
<table cellspacing="0" cellpadding="3" border="0" width="99%" class="t1">
<?php 
    if ($pc['USER'] == '_filter') {
        ?>
<tr>
	<td class="t2" width="30">序号</td>
	<td class="t2" width="40">类别</td>
	<td class="t2" width="80">作者</td>
	<td class="t2" width="30"><a href="pcdoc.php?<?php 
        echo "userid=" . $pc["USER"] . "&tag=" . $tag . "&order=co&tid=" . $tid;
        ?>
" class="f3">状态</a></td>
	<td class="t2">主题</td>
	<td class="t2" width="120">
	<a href="pcdoc.php?<?php 
        echo "userid=" . $pc["USER"] . "&tag=" . $tag . "&order=c&tid=" . $tid;
        ?>
" class="f3">创建</a>
	<td class="t2" width="30"><a href="pcdoc.php?<?php 
        echo "userid=" . $pc["USER"] . "&tag=" . $tag . "&order=v&tid=" . $tid;
        ?>
" class="f3">浏览</a></td>
	<td class="t2" width="30"><a href="pcdoc.php?<?php 
        echo "userid=" . $pc["USER"] . "&tag=" . $tag . "&order=r&tid=" . $tid;
        ?>
" class="f3">评论</a></td>
<?php 
        if ($tag < 3) {
            ?>
	<td class="t2" width="15">过</td>
	<td class="t2" width="15">滤</td>
<?php 
        } else {
            ?>
	<td class="t2" width="30">恢复</td>
	<td class="t2" width="80">删文屠夫</td>
<?php 
        }
        ?>
</tr>
<?php 
    } elseif ($pur > 2) {
        ?>
<tr>
	<td class="t2" width="30">序号</td>
	<td class="t2" width="30">选中</td>
	<td class="t2" width="30"><a href="pcdoc.php?<?php 
        echo "userid=" . $pc["USER"] . "&tag=" . $tag . "&order=co&tid=" . $tid;
        ?>
" class="f3">状态</a></td>
	<td class="t2">主题</td>
	<td class="t2" width="120">
	<a href="pcdoc.php?<?php 
        echo "userid=" . $pc["USER"] . "&tag=" . $tag . "&order=c&tid=" . $tid;
        ?>
" class="f3">创建</a>
	|
	<a href="pcdoc.php?<?php 
        echo "userid=" . $pc["USER"] . "&tag=" . $tag . "&order=u&tid=" . $tid;
        ?>
" class="f3">更新</a></td>
	<td class="t2" width="30"><a href="pcdoc.php?<?php 
        echo "userid=" . $pc["USER"] . "&tag=" . $tag . "&order=v&tid=" . $tid;
        ?>
" class="f3">浏览</a></td>
	<td class="t2" width="30"><a href="pcdoc.php?<?php 
        echo "userid=" . $pc["USER"] . "&tag=" . $tag . "&order=r&tid=" . $tid;
        ?>
" class="f3">评论</a></td>
<?php 
        if ($tag == 0) {
            ?>
	<td class="t2" width="30"><a href="pcdoc.php?<?php 
            echo "userid=" . $pc["USER"] . "&tag=" . $tag . "&order=tb&tid=" . $tid;
            ?>
" class="f3">引用</td>
<?php 
        }
        ?>
	
	<td class="t2" width="15">改</td>
	<td class="t2" width="15">删</td>
</tr>
<?php 
    } else {
        ?>
<tr>
	<td class="t2" width="30">序号</td>
	<td class="t2" width="30"><a href="pcdoc.php?<?php 
        echo "userid=" . $pc["USER"] . "&tag=" . $tag . "&order=co&tid=" . $tid;
        ?>
" class="f3">状态</a></td>
	<td class="t2">主题</td>
	<td class="t2" width="120"><a href="pcdoc.php?<?php 
        echo "userid=" . $pc["USER"] . "&tag=" . $tag . "&order=c&tid=" . $tid;
        ?>
" class="f3">创建</a>
	|
	<a href="pcdoc.php?<?php 
        echo "userid=" . $pc["USER"] . "&tag=" . $tag . "&order=u&tid=" . $tid;
        ?>
" class="f3">更新</a></td>
	<td class="t2" width="30"><a href="pcdoc.php?<?php 
        echo "userid=" . $pc["USER"] . "&tag=" . $tag . "&order=v&tid=" . $tid;
        ?>
" class="f3">浏览</a></td>
	<td class="t2" width="30"><a href="pcdoc.php?<?php 
        echo "userid=" . $pc["USER"] . "&tag=" . $tag . "&order=r&tid=" . $tid;
        ?>
" class="f3">评论</a></td>
<?php 
        if ($tag == 0) {
            ?>
	<td class="t2" width="30"><a href="pcdoc.php?<?php 
            echo "userid=" . $pc["USER"] . "&tag=" . $tag . "&order=tb&tid=" . $tid;
            ?>
" class="f3">引用</td>
<?php 
        }
        if ($is_admin) {
            ?>
	<td class="t2" width="30">滤</td>
<?php 
        }
        ?>
</tr>
<?php 
    }
    while ($rows = mysql_fetch_array($result)) {
        $i++;
        if ($rows["comment"] == 0) {
            $c = "<img src='images/lock.gif' alt='被锁定的主题' border='0'>";
        } else {
            $c = "<img src='images/open.gif' alt='开放的主题' border='0'>";
        }
        if ($pc['USER'] == '_filter') {
            echo "<tr>\n<td class='t3'>" . ($start + $i) . "</td>\n" . "<td class='t4'>" . ($rows[nid] && $tag < 3 ? '评论' : '文章') . "</td>" . "<td align=\"center\" class='t4'><a href=\"/bbsqry.php?userid=" . $rows["username"] . "\">" . html_format($rows["username"]) . "</a></td>\n" . "<td class='t3'>" . $c . "</td>\n" . "<td class='t5'>";
            echo $rows["htmltag"] == 1 ? "&nbsp;" : "#";
            echo "<img src=\"icon/" . $rows["emote"] . ".gif\" border=\"0\" align=\"absmiddle\">\n<a href=\"pccon.php?id=" . $pc["UID"] . "&nid=" . $rows["fid"] . "&order=" . $order . "&tid=" . $tid . "\">" . html_format($rows["subject"]) . "</a></td>\n" . "<td class='t3'>\n" . time_format($rows["created"]) . "</td>\n" . "<td class='t4'>" . $rows["visitcount"] . "</td>\n" . "<td class='t3'>" . $rows["commentcount"] . "</td>\n";
            if ($tag < 3) {
                echo "<td class='t3'><a href=\"pcadmin_flt.php?fid=" . $rows["fid"] . "&filter=n\">过</a></td>\n" . "<td class='t4'><a href=\"pcadmin_flt.php?fid=" . $rows["fid"] . "&filter=y\">滤</a></td>\n";
            } else {
                echo "<td class='t3'><a href=\"pcadmin_flt.php?fid=" . $rows["fid"] . "&filter=r\">恢复</a></td>\n" . "<td class='t4'>" . $rows["recuser"] . "</td>\n";
            }
            echo "</tr>\n";
        } elseif ($pur > 2) {
            echo "<tr>\n<td class='t3'>" . ($start + $i) . "</td>\n" . "<td align=\"center\" class='t4'><input type=\"checkbox\" name=\"art" . $i . "\" value=\"" . $rows["nid"] . "\" class=\"b2\"></td>\n" . "<td class='t3'>" . $c . "</td>\n" . "<td class='t5'>";
            echo $rows["htmltag"] == 1 ? "&nbsp;" : "#";
            echo "<img src=\"icon/" . $rows["emote"] . ".gif\" border=\"0\" align=\"absmiddle\">\n<a href=\"pccon.php?id=" . $pc["UID"] . "&nid=" . $rows["nid"] . "&order=" . $order . "&tid=" . $tid . "\">" . html_format($rows["subject"]) . "</a></td>\n" . "<td class='t3'>\n" . time_format($rows["created"]) . "<br/>" . time_format($rows["changed"]) . "\n</td>\n" . "<td class='t4'>" . $rows["visitcount"] . "</td>\n" . "<td class='t3'>" . $rows["commentcount"] . "</td>\n";
            if ($tag == 0) {
                echo "<td class='t4'>";
                echo $rows["trackback"] ? $rows["trackbackcount"] : "-";
                echo "</td>\n";
            }
            echo "<td class='t3'><a href=\"pcmanage.php?userid=" . $pc["USER"] . "&act=edit&nid=" . $rows["nid"] . "\">改</a></td>\n" . "<td class='t4'><a href=\"#\" onclick=\"bbsconfirm('pcmanage.php?userid=" . $pc["USER"] . "&act=del&nid=" . $rows["nid"] . "','确认删除?')\">删</a></td>\n" . "</tr>\n";
        } else {
            echo "<tr>\n<td class='t3'>" . ($start + $i) . "</td>\n" . "<td class='t4'>" . $c . "</td>\n" . "<td class='t8'>&nbsp;<img src=\"icon/" . $rows["emote"] . ".gif\" border=\"0\\ align=\"absmiddle\">\n<a href=\"pccon.php?id=" . $pc["UID"] . "&nid=" . $rows["nid"] . "&order=" . $order . "&tid=" . $tid . "\">" . html_format($rows["subject"]) . "</a></td>\n" . "<td class='t4'>\n" . time_format($rows["created"]) . "<br/>" . time_format($rows["changed"]) . "\n</td>\n" . "<td class='t3'>" . $rows["visitcount"] . "</td>\n" . "<td class='t4'>" . $rows["commentcount"] . "</td>\n";
            if ($tag == 0) {
                echo "<td class='t3'>";
                echo $rows["trackback"] ? $rows["trackbackcount"] : "-";
                echo "</td>\n";
            }
            if ($is_admin) {
                echo "<td class='t4'><a href=\"#\" onclick=\"bbsconfirm('pcadmin_del.php?userid=" . $pc["USER"] . "&nid=" . $rows["nid"] . "','确认删除?')\">滤</a></td>\n";
            }
            echo "</tr>\n";
        }
    }
    ?>
</table>
<p align="center" class="f1">
<?php 
    if ($pno > 1) {
        echo "[<a href=\"pcdoc.php?userid=" . $pc["USER"] . "&tag=" . $tag . "&tid=" . $tid . "\">第一页</a>]&nbsp;[<a href=\"pcdoc.php?userid=" . $pc["USER"] . "&tag=" . $tag . "&tid=" . $tid . "&pno=" . ($pno - 1) . "\">上一页</a>]&nbsp;";
    }
    if ($cnt == $i) {
        echo "[<a href=\"pcdoc.php?userid=" . $pc["USER"] . "&tag=" . $tag . "&tid=" . $tid . "&pno=" . ($pno + 1) . "\">下一页</a>]";
    }
    ?>
</p>
<?php 
    if ($pur > 2) {
        display_action_bar($tag, $tid);
    }
    ?>
</form>
<?php 
    mysql_free_result($result);
}
Exemple #3
0
function pc_get_user_permission($currentuser, $pc)
{
    global $loginok;
    if ($pc['USER'] == '_filter' && pc_is_manager($currentuser)) {
        $sec = array(0 => "待处理", 1 => "已通过", 2 => "未通过", 4 => "被删除");
        $pur = 1;
        $tags = array(1, 1, 1, 0, 1, 0, 0, 0);
    } elseif (pc_is_groupwork($pc)) {
        if (pc_is_admin($currentuser, $pc) && $loginok == 1) {
            $sec = array(0 => "俱乐部", 1 => "会议室", 4 => "备份中心", 6 => "栏目管理", 7 => "参数设定");
            $pur = 3;
            $tags = array(1, 1, 0, 0, 1, 0, 1, 1);
        } else {
            $sec = array(0 => "俱乐部");
            $pur = 0;
            $tags = array(1, 0, 0, 0, 0, 0, 0, 0);
        }
    } elseif (pc_is_admin($currentuser, $pc) && $loginok == 1) {
        $sec = array("公开区", "好友区", "私人区", "收藏区", "删除区", "设定好友", "分类管理", "参数设定");
        $pur = 3;
        $tags = array(1, 1, 1, 1, 1, 1, 1, 1);
    } elseif (pc_is_friend($currentuser["userid"], $pc["USER"]) || pc_is_manager($currentuser)) {
        $sec = array("公开区", "好友区");
        $pur = 1;
        $tags = array(1, 1, 0, 0, 0, 0, 0, 0);
        if ($pc["FAVMODE"] == 1 || $pc["FAVMODE"] == 2) {
            $sec[3] = "收藏区";
            $tags[3] = 1;
        }
    } else {
        $sec = array("公开区");
        $pur = 0;
        $tags = array(1, 0, 0, 0, 0, 0, 0, 0);
        if ($pc["FAVMODE"] == 2) {
            $sec[3] = "收藏区";
            $tags[3] = 1;
        }
    }
    return array("tags" => $tags, "pur" => $pur, "sec" => $sec);
}
Exemple #4
0
echo $pc["NAME"] . "(" . time_format($archDate[0]) . " ~ " . time_format($archDate[1]) . "档案)";
?>
</TITLE>
<style>
.date{FONT-WEIGHT: bold;MARGIN-BOTTOM: 10px;FONT-SIZE: 18px;COLOR: #993366;FONT-FAMILY: palatino, georgia, times new roman, serif}
.content{font-size:14px;line-height:24px;}
</style>
</head>
<body>
<?php 
echo "<a name=\"top\"></a><p class=date>::Blog信息::<br />名称: " . $pc["NAME"] . "<br />作者: <a href=\"http://" . $pcconfig["SITE"] . "/bbsqry.php?userid=" . $pc["USER"] . "\">" . $pc["USER"] . "</a><br />域名: <a href=\"" . pc_personal_domainname($pc["USER"]) . "\">" . pc_personal_domainname($pc["USER"]) . "</a><br />站点: <a href=\"http://" . $pcconfig["SITE"] . "\">" . $pcconfig["BBSNAME"] . "</a><br /></p>";
echo "<p class=date>档案日期:" . time_format($archDate[0]) . " ~ " . time_format($archDate[1]) . "</p><hr size=1>";
$query = "SELECT * FROM nodes WHERE uid = '" . $pc["UID"] . "' AND type = 0 AND created >= " . $archDate[0] . " AND created <= " . $archDate[1] . " ";
if (pc_is_admin($currentuser, $pc) && $loginok == 1) {
    $query .= " AND ( access = 0 OR access = 1 OR access = 2 ) ";
} elseif (pc_is_friend($currentuser["userid"], $pc["USER"]) || pc_is_manager($currentuser)) {
    $query .= " AND ( access = 0 OR access = 1 ) ";
} else {
    $query .= " AND access = 0 ";
}
$query .= " ORDER BY nid DESC ;";
$result = mysql_query($query);
while ($rows = mysql_fetch_array($result)) {
    echo "<p class=date>" . time_format($rows[created]) . "</p>";
    echo "<p class=content><strong>主题: </strong><a href=\"http://" . $pcconfig["SITE"] . "/pc/pccon.php?id=" . $pc["UID"] . "&nid=" . $rows[nid] . "&s=all\">" . html_format($rows[subject]) . "</a><br />";
    echo "<font class=content>" . html_format($rows[body], TRUE, $rows[htmltag]) . "</font><br /><br /><a href=\"#top\">[返回顶部]</a></p><hr size=1>";
}
mysql_free_result($result);
echo "<p align=center><a href=\"http://" . $pcconfig["SITE"] . "\">" . $pcconfig["BBSNAME"] . "</a></p>";
?>
<p align="center">
Exemple #5
0
if ($loginok != 1) {
    html_nologin();
} elseif (!strcmp($currentuser["userid"], "guest")) {
    html_init("gb2312");
    html_error_quit("guest 不能发表评论!");
    exit;
} else {
    $act = $_GET["act"];
    $cid = (int) $_GET["cid"];
    $link = pc_db_connect();
    if ($act == "del") {
        $query = "SELECT `username` , `uid` ,`nid` FROM comments WHERE `cid` = '" . $cid . "' LIMIT 0 , 1 ;";
        $result = mysql_query($query);
        $rows = mysql_fetch_array($result);
        mysql_free_result($result);
        if (strtolower($rows["username"]) == strtolower($currentuser["userid"]) || pc_is_manager($currentuser)) {
            $query = "DELETE FROM comments WHERE `cid` = '" . $cid . "' LIMIT 1;";
            mysql_query($query, $link);
            $query = "UPDATE nodes SET commentcount = commentcount - 1 WHERE `nid` = '" . $rows["nid"] . "' ;";
            mysql_query($query, $link);
        } else {
            $query = "SELECT `uid` FROM users WHERE `username` = '" . $currentuser["userid"] . "' AND `uid` = '" . $rows["uid"] . "' LIMIT 0 , 1;";
            $result = mysql_query($query, $link);
            if ($rows1 = mysql_fetch_array($result)) {
                $query = "DELETE FROM comments WHERE `cid` = '" . $cid . "' LIMIT 1;";
                mysql_query($query, $link);
                $query = "UPDATE nodes SET commentcount = commentcount - 1 WHERE `nid` = '" . $rows["nid"] . "' ;";
                mysql_query($query, $link);
            }
            @mysql_free_result($result);
        }
Exemple #6
0
function display_pc_comments($link, $uid, $nid, $spr)
{
    global $pc;
    global $currentuser;
    if (strtolower($pc["USER"]) == strtolower($currentuser["userid"])) {
        $perm = TRUE;
    } else {
        $perm = FALSE;
    }
    if ($spr) {
        $query = "SELECT * FROM comments WHERE `nid` = '" . $nid . "' AND `uid` = '" . $uid . "' ORDER BY `cid` ASC ;";
    } else {
        $query = "SELECT `username` , `emote` , `subject` , `created`,`cid`,`htmltag` FROM comments WHERE `nid` = '" . $nid . "' AND `uid` = '" . $uid . "' ORDER BY `cid` ASC ;";
    }
    $result = mysql_query($query, $link);
    $re_num = mysql_num_rows($result);
    ?>
<table cellspacing="0" cellpadding="3" border="0" width="90%" class="t1">
<tr>
	<td class="t9" colspan="2">共有 <?php 
    echo $re_num;
    ?>
 条评论</td>
</tr>
<?php 
    for ($i = 0; $i < $re_num; $i++) {
        $rows = mysql_fetch_array($result);
        $contentcss = $rows["htmltag"] ? "contentwithhtml" : "content";
        if ($i % 2 == 0) {
            $tdclass = array("t8", "t10", "t11");
        } else {
            $tdclass = array("t5", "t12", "t13");
        }
        echo "<tr>\n<td class=\"" . $tdclass[1] . "\">&nbsp;" . "<img src=\"icon/" . $rows["emote"] . ".gif\" border=\"0\" align=\"absmiddle\">\n" . "<a href=\"pcshowcom.php?cid=" . $rows["cid"] . "\">" . html_format($rows["subject"]) . "</a>" . "[<a href=\"/bbsqry.php?userid=" . $rows["username"] . "\">" . $rows["username"] . "</a> 于 " . time_format($rows["created"]) . " 提到]\n";
        if ($perm || strtolower($rows["username"]) == strtolower($currentuser["userid"]) && strtolower($rows["username"]) != "guest" || pc_is_manager($currentuser)) {
            echo "[<a href=\"#\" onclick=\"bbsconfirm('pceditcom.php?act=del&cid=" . $rows["cid"] . "','确认删除?')\">删</a>]\n";
        }
        if (strtolower($rows["username"]) == strtolower($currentuser["userid"]) && strtolower($rows["username"]) != "guest") {
            echo "[<a href=\"pceditcom.php?act=edit&cid=" . $rows["cid"] . "\">改</a>]\n";
        }
        echo "</td><td width=\"100\" align=\"right\" class=\"" . $tdclass[0] . "\"><font class=\"f4\">" . ($i + 1) . "</font>&nbsp;&nbsp;</td>\n</tr>\n";
        if ($spr) {
            echo "<tr>\n<td colspan='2' class=\"" . $tdclass[2] . "\"><font class='" . $contentcss . "'>" . html_format($rows["body"], TRUE, $rows["htmltag"]) . "</font></td>\n</tr>\n" . "<tr>\n<td colspan='2' align='right' class=\"" . $tdclass[0] . "\">[FROM: " . pc_hide_ip($rows["hostname"]) . "]" . "</td>\n</tr>\n";
        }
    }
    ?>
</table>
<?php 
    mysql_free_result($result);
    return $re_num;
}