コード例 #1
0
ファイル: pcdoc.php プロジェクト: bianle/www2
function display_fav_folder($link, $pc, $pid = 0, $pur, $order = "")
{
    $rootpid = pc_fav_rootpid($link, $pc["UID"]);
    if (!$rootpid) {
        $pif = pc_init_fav($link, $pc["UID"]);
        if ($pif) {
            ?>
<script language="javascript">window.location.href="pcdoc.php?userid=<?php 
            echo $pc["USER"];
            ?>
&tag=3";</script>
<?php 
        } else {
            html_error_quit("对不起,Blog收藏夹初始化错误!");
            exit;
        }
    }
    if ($pid == 0) {
        $pid = $rootpid;
    } else {
        $query = "UPDATE nodes SET `visitcount` = visitcount + 1 WHERE  `access` = '3' AND `nid` = '" . $pid . "' AND `uid` = '" . $pc["UID"] . "';";
        mysql_query($query, $link);
    }
    $query = "SELECT `nid` , `type` , `created` , `changed` , `emote` , `comment` , `commentcount` , `subject` , `visitcount`,`pid`,`htmltag` " . " FROM nodes WHERE `access` = '3' AND `uid` = '" . $pc["UID"] . "' AND `pid` = '" . $pid . "' ";
    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;
        default:
            $query .= " ORDER BY ";
    }
    $query .= " `type` DESC ;";
    $result = mysql_query($query, $link);
    $i = 0;
    ?>
<form action="pcmanage.php?userid=<?php 
    echo $pc["USER"];
    ?>
" method="post">	
<table cellspacing="0" cellpadding="5" border="0" width="99%" class="t1">
<?php 
    if ($pur > 2) {
        ?>
<tr>
	<td class="t2" width="30">序号</td>
	<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=3&pid=" . $pid . "&order=co";
        ?>
" class="f3">状态</a></td>
	<td class="t2">主题</td>
	<td class="t2" width="120">
	<a href="pcdoc.php?<?php 
        echo "userid=" . $pc["USER"] . "&tag=3&pid=" . $pid . "&order=c";
        ?>
" class="f3">创建</a>
	|
	<a href="pcdoc.php?<?php 
        echo "userid=" . $pc["USER"] . "&tag=3&pid=" . $pid . "&order=u";
        ?>
" class="f3">更新</a>
	</td>
	<td class="t2" width="30"><a href="pcdoc.php?<?php 
        echo "userid=" . $pc["USER"] . "&tag=3&pid=" . $pid . "&order=v";
        ?>
" class="f3">浏览</a></td>
	<td class="t2" width="30"><a href="pcdoc.php?<?php 
        echo "userid=" . $pc["USER"] . "&tag=3&pid=" . $pid . "&order=r";
        ?>
" class="f3">评论</a></td>
	<td class="t2" width="15">改</td>
	<td class="t2" width="15">删</td>
	<td class="t2" colspan="<?php 
        echo $_COOKIE["BLOGFAVACTION"] ? 3 : 2;
        ?>
">操作</a>
</tr>
<?php 
    } else {
        ?>
<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=3&pid=" . $pid . "&order=co";
        ?>
" class="f3">状态</a></td>
	<td class="t2">主题</td>
	<td class="t2" width="120">
	<a href="pcdoc.php?<?php 
        echo "userid=" . $pc["USER"] . "&tag=3&pid=" . $pid . "&order=c";
        ?>
" class="f3">创建</a>
	|
	<a href="pcdoc.php?<?php 
        echo "userid=" . $pc["USER"] . "&tag=3&pid=" . $pid . "&order=u";
        ?>
" class="f3">更新</a></td>
	<td class="t2" width="30"><a href="pcdoc.php?<?php 
        echo "userid=" . $pc["USER"] . "&tag=3&pid=" . $pid . "&order=v";
        ?>
" class="f3">浏览</a></td>
	<td class="t2" width="30"><a href="pcdoc.php?<?php 
        echo "userid=" . $pc["USER"] . "&tag=3&pid=" . $pid . "&order=r";
        ?>
" class="f3">评论</a></td>
</tr>
<?php 
    }
    while ($rows = mysql_fetch_array($result)) {
        $i++;
        if ($rows["comment"] == 1 && $rows["type"] == 0) {
            $c = "<img src='images/open.gif' alt='开放的主题' border='0'>";
        } else {
            $c = "<img src='images/lock.gif' alt='被锁定的主题' border='0'>";
        }
        if ($rows["type"] == 1) {
            $type = "<img src='images/dir.gif' alt='目录' border='0'>";
            $url = "pcdoc.php?userid=" . $pc["USER"] . "&tag=3&pid=" . $rows["nid"];
        } else {
            $type = "<img src='images/art.gif' alt='文章' border='0'>";
            $url = "pccon.php?id=" . $pc["UID"] . "&nid=" . $rows["nid"] . "&order=" . $order;
        }
        if ($pur > 2) {
            echo "<tr>\n<td class='t3'>" . $i . "</td>\n<td align=\"center\" class='t4'>";
            if ($rows["type"] == 0) {
                echo "<input type=\"checkbox\" name=\"art" . $i . "\" value=\"" . $rows["nid"] . "\" class=\"b2\">";
            } else {
                echo "&nbsp;";
            }
            echo "</td>\n<td class='t3'>" . $type . "</td>\n" . "<td class='t4'>" . $c . "</td>\n" . "<td class='t8'>";
            echo $rows["htmltag"] == 1 ? "&nbsp;" : "#";
            echo "<img src=\"icon/" . $rows["emote"] . ".gif\" border=\"0\" align=\"absmiddle\">\n<a href=\"" . $url . "\">" . html_format($rows["subject"]) . "</a></td>\n" . "<td class='t4'>" . time_format($rows["created"]) . "<br/>" . time_format($rows["changed"]) . "</td>\n" . "<td class='t3'>" . $rows["visitcount"] . "</td>\n" . "<td class='t4'>" . $rows["commentcount"] . "</td>\n" . "<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";
            if ($rows["type"] == 0) {
                echo "<td class='t3' width=20><a href=\"pcmanage.php?userid=" . $pc["USER"] . "&act=favcut&nid=" . $rows["nid"] . "\">剪</a></td>" . "<td class='t3' width=20><a href=\"pcmanage.php?userid=" . $pc["USER"] . "&act=favcopy&nid=" . $rows["nid"] . "\">复</a></td>";
            } else {
                echo "<td class='t3' width=20>-</td>\n<td class='t3'>-</td>\n";
            }
            if (isset($_COOKIE["BLOGFAVACTION"]) && $_COOKIE["BLOGFAVACTION"]) {
                if ($rows["type"] == 1) {
                    echo "<td class='t3' width=20><a href=\"pcmanage.php?userid=" . $pc["USER"] . "&act=favpaste&pid=" . $rows["nid"] . "\">贴</a></td>";
                } else {
                    echo "<td class='t3' width=20>-</td>";
                }
            }
            echo "</tr>\n";
        } else {
            echo "<tr>\n<td class='t3'>" . $i . "</td>\n" . "<td class='t4'>" . $type . "</td>\n" . "<td class='t3'>" . $c . "</td>\n" . "<td class='t5'>&nbsp;<img src=\"icon/" . $rows["emote"] . ".gif\" border=\"0\" align=\"absmiddle\">\n<a href=\"" . $url . "\">" . html_format($rows["subject"]) . "</a></td>\n" . "<td class='t3'>" . time_format($rows["created"]) . "<br/>" . time_format($rows["changed"]) . "</td>\n" . "<td class='t4'>" . $rows["visitcount"] . "</td>\n" . "<td class='t3'>" . $rows["commentcount"] . "</td>\n" . "</tr>\n";
        }
    }
    mysql_free_result($result);
    ?>
</table>
<?php 
    if ($pid != $rootpid) {
        $query = "SELECT `pid` FROM nodes WHERE `nid` = '" . $pid . "' LIMIT 0 , 1 ;";
        $result = mysql_query($query);
        $rows = mysql_fetch_array($result);
        mysql_free_result($result);
        $prepid = $rows["pid"] > $rootpid ? $rows["pid"] : $rootpid;
        ?>
<p align="center"  class="b2">
[<a href="pcdoc.php?<?php 
        echo "userid=" . $pc["USER"] . "&tag=3&pid=" . $rows["pid"];
        ?>
">返回上层目录</a>]
[<a href="pcdoc.php?<?php 
        echo "userid=" . $pc["USER"] . "&tag=3";
        ?>
">返回根目录</a>]
</p>
<?php 
    }
    if ($pur > 2) {
        display_action_bar(3, 0, $pid);
        ?>
</form>
<?php 
        if (isset($_COOKIE["BLOGFAVACTION"]) && $_COOKIE["BLOGFAVACTION"]) {
            echo "<p align='center' class='b2'>[<a href=\"pcmanage.php?userid=" . $pc["USER"] . "&act=favpaste&pid=" . $rootpid . "\">粘贴到根目录</a>]</p>\n";
        }
        ?>
<form action="pcmanage.php?userid=<?php 
        echo $pc["USER"];
        ?>
&act=adddir" method="post" onsubmit="if(this.dir.value==''){alert('请输入目录名!');return false;}">
<input type="hidden" name="pid" value="<?php 
        echo $pid;
        ?>
">
<p class="b2" align="center">
新建目录:
<input type="text" name="dir" maxlength="200" size="40" id="dir" class="b2">
<input type="submit" value="新建目录" class="b1">
</p>
</form>
<?php 
    }
}
コード例 #2
0
ファイル: pcmanage.php プロジェクト: bianle/www2
     $target = intval(substr($_POST["target"], 1, strlen($_POST["target"]) - 1));
     $in_section = 1;
     if (!pc_load_topic($link, $pc["UID"], $target, $topicname)) {
         $target = 0;
     }
     //如果参数错误就移入未分类
 } else {
     $target = intval($_POST["target"]);
     $in_section = 0;
     if ($target < 0 || $target > 4) {
         $target = 2;
     }
     //如果参数错误先移入私人区
 }
 if (!$in_section && 3 == $target) {
     $rootpid = pc_fav_rootpid($link, $pc["UID"]);
     if (!$rootpid) {
         html_error_quit("收藏夹根目录错误!");
         exit;
     }
 } else {
     $rootpid = 0;
 }
 if ($in_section) {
     if ($act == "cut") {
         $query = "UPDATE nodes SET created = created , `tid` = '" . $target . "' , `changed` = NOW( ) , `pid` = '0' WHERE `uid` = '" . $pc["UID"] . "' AND `type` = 0 AND ( `nid` = '0' ";
     } else {
         $query = "SELECT * FROM nodes WHERE `uid` = '" . $pc["UID"] . "' AND `type` = 0 AND ( `nid` = '0' ";
     }
 } else {
     if ($act == "cut" && $target == 3) {