Exemplo n.º 1
0
 if($rows[nodetype] != 0)
 {
 	html_error_quit("该文不可编辑!");
 	exit();
 }
 */
 if ($subject) {
     if ($_POST["comment"] == 1) {
         $c = 0;
     } else {
         $c = 1;
     }
     $useHtmlTag = $_POST["htmltag"] == 1 ? 1 : 0;
     $trackback = $_POST["trackback"] == 1 ? 1 : 0;
     $emote = (int) $_POST["emote"];
     $query = "UPDATE nodes SET `theme` = '" . addslashes($_POST["theme"]) . "'  , `subject` = '" . addslashes($_POST["subject"]) . "' , `body` = '" . addslashes(html_editorstr_format($_POST["blogbody"])) . "' , `changed` = '" . date("YmdHis") . "' , `comment` = '" . $c . "' , `tid` = '" . (int) $_POST["tid"] . "' , `emote` = '" . $emote . "' , `htmltag` = '" . $useHtmlTag . "' , `trackback` = '" . $trackback . "' WHERE `nid` = '" . $nid . "' AND nodetype = 0;";
     mysql_query($query, $link);
     pc_update_record($link, $pc["UID"]);
     if ($rows["subject"] == $_POST["subject"]) {
         $log_action = "EDIT NODE: " . $rows[subject];
     } else {
         $log_action = "EDIT NODE: " . $_POST["subject"];
         $log_content = "OLD SUBJECT: " . $rows["subject"] . "\nNEW SUBJECT: " . $_POST["subject"];
     }
     if ($rows["type"] == 1) {
         pc_return("pcdoc.php?userid=" . $pc["USER"] . "&tag=3&pid=" . $rows["pid"]);
     } else {
         pc_return("pccon.php?id=" . $pc["UID"] . "&nid=" . $nid);
     }
 } else {
     ?>
Exemplo n.º 2
0
function pc_add_node($link, $pc, $pid, $tid, $emote, $comment, $access, $htmlTag, $trackback, $theme, $subject, $body, $nodeType, $autodetecttbp, $tbpUrl, $tbpArt, $convert_encoding, $filtered, $address, $publisher)
{
    global $pcconfig, $support_encodings, $sending_encoding;
    $pid = intval($pid);
    $tid = intval($tid);
    $emote = intval($emote);
    $comment = $comment == 1 ? 1 : 0;
    $access = intval($access);
    $htmlTag = $htmlTag == 1 ? 1 : 0;
    $trackback = $trackback == 1 ? 1 : 0;
    $subject = addslashes(trim($subject));
    $body = html_editorstr_format(trim($body));
    $nodeType = intval($nodeType);
    //0: 普通;1: log,不可删除
    if ($convert_encoding) {
        if (!strstr($support_encodings, $convert_encoding)) {
            $convert_encoding = $sending_encoding;
        }
    } else {
        $convert_encoding = $sending_encoding;
    }
    if (!$pc || !is_array($pc)) {
        return FALSE;
    }
    if (!$subject) {
        //检查主题
        return -1;
    }
    if ($access < 0 || $access > 4) {
        $access = 2;
    }
    //如果参数错误先在私人区发表
    if ($access == 3) {
        if (!pc_load_directory($link, $pc["UID"], $pid)) {
            return -2;
        }
        if (pc_used_space($link, $pc["UID"], 3, $pid) >= $pc["NLIM"]) {
            //目标文件夹使用空间
            return -3;
        }
        $tid = 0;
    } else {
        $pid = 0;
        if (pc_used_space($link, $pc["UID"], $access) >= $pc["NLIM"]) {
            //目标文件夹使用空间
            return -3;
        }
        if ($tid != 0) {
            if (!pc_load_topic($link, $pc["UID"], $tid, $topicname, $access)) {
                return -4;
            }
        }
    }
    if ($access != 0) {
        $tbpUrl = "";
        $autodetecttbp = FALSE;
    }
    $into_filter = false;
    if (!$filtered) {
        //未经过过滤检查的要先检查一次
        if (bbs_checkbadword($subject) || bbs_checkbadword($body)) {
            $into_filter = true;
        }
    }
    if (!pc_is_groupwork($pc)) {
        $publisher = "";
    } elseif (!$publisher) {
        return -10;
    } else {
    }
    if (!$into_filter) {
        if ($tbpUrl && pc_tbp_check_url($tbpUrl) && $tbpArt) {
            if ($htmlTag) {
                $body .= "<br /><br /><strong>相关文章</strong><br />\n" . "<a href='" . $tbpArt . "'>" . $tbpArt . "</a>";
            } else {
                $body .= "\n\n[相关文章]\n" . $tbpArt;
            }
        }
        if (pc_is_groupwork($pc)) {
            //群体BLOG文章要加一个头
            $body = pc_groupwork_addhead($pc, $body, $htmlTag, $publisher);
        }
    }
    if (!isset($pcconfig["SECTION"][$theme])) {
        $theme = "others";
    }
    $theme = addslashes($theme);
    $body = addslashes($body);
    if (!$address) {
        $address = $_SERVER["REMOTE_ADDR"];
    }
    //日志入库
    if ($into_filter) {
        $query = "INSERT INTO `filter` (  `pid` , `nid` , `tid` , `type` , `state` , `recuser` , `emote` , `hostname` , `changed` , `created` , `uid` , `username` , `comment` , `commentcount` , `subject` , `body` , `access` , `visitcount` , `htmltag`,`trackback` ,`trackbackcount`,`nodetype`,`tbp_url`,`tbp_art`,`auto_tbp`,`tbpencoding`,`theme`,`publisher`) " . "VALUES ( '" . $pid . "', 0 , '" . $tid . "' , '0', '0' , '', '" . $emote . "' ,  '" . addslashes($_SERVER["REMOTE_ADDR"]) . "',NOW( ) , NOW( ), '" . $pc["UID"] . "' , '" . addslashes($pc["USER"]) . "' , '" . $comment . "', '0', '" . $subject . "', '" . $body . "', '" . $access . "', '0' , '" . $htmlTag . "' ,'" . $trackback . "','0','" . $nodeType . "','" . addslashes($tbpUrl) . "','" . addslashes($tbpArt) . "','" . intval($autodetecttbp) . "','" . addslashes($convert_encoding) . "','" . $theme . "','" . addslashes($publisher) . "');";
    } else {
        $query = "INSERT INTO `nodes` (  `pid` , `tid` , `type` , `recuser` , `emote` , `hostname` , `changed` , `created` , `uid` , `comment` , `commentcount` , `subject` , `body` , `access` , `visitcount` , `htmltag`,`trackback` ,`trackbackcount`,`nodetype`,`theme`,`publisher`) " . "VALUES ( '" . $pid . "', '" . $tid . "' , '0', '', '" . $emote . "' ,  '" . addslashes($address) . "',NOW( ) , NOW( ), '" . $pc["UID"] . "', '" . $comment . "', '0', '" . $subject . "', '" . $body . "', '" . $access . "', '0' , '" . $htmlTag . "' ,'" . $trackback . "','0','" . $nodeType . "','" . $theme . "','" . addslashes($publisher) . "');";
    }
    if (!mysql_query($query, $link)) {
        return -5;
    }
    //公开区文章发布后更新文章数
    if (!$into_filter) {
        if ($access == 0) {
            pc_update_record($link, $pc["UID"], "+1");
        }
    }
    if (!$into_filter) {
        $detectnum = 0;
        if ($autodetecttbp) {
            $detecttbps = array();
            $detectnum = pc_detect_trackbackpings($body, $detecttbps, $tbpUrl);
        }
        if ($tbpUrl || $detectnum) {
            //提取日志的nid
            $query = "SELECT `nid` FROM nodes WHERE `subject` = '" . $subject . "' AND `body` = '" . $body . "' AND `uid` = '" . $pc["UID"] . "' AND `access` = '" . $access . "' AND `pid` = '" . $pid . "' AND `tid` = '" . $tid . "' ORDER BY nid DESC LIMIT 0,1;";
            $result = mysql_query($query, $link);
            $rows = mysql_fetch_array($result);
            if (!$rows) {
                return -6;
            }
            $thisNid = $rows[nid];
            mysql_free_result($result);
            if ($htmlTag) {
                $tbbody = undo_html_format(strip_tags(stripslashes($body)));
            } else {
                $tbbody = stripslashes($body);
            }
            if (strlen($tbbody) > 255) {
                $tbbody = substr($tbbody, 0, 251) . " ...";
            }
            $subject = stripslashes($subject);
            $blogname = undo_html_format($pc["NAME"]);
            if ($pcconfig["ENCODINGTBP"]) {
                iconv_set_encoding("internal_encoding", $convert_encoding);
                iconv_set_encoding("output_encoding", $convert_encoding);
                $subject = iconv($default_encoding, $convert_encoding, $subject);
                $tbbody = iconv($default_encoding, $convert_encoding, $tbbody);
                $blogname = iconv($default_encoding, $convert_encoding, $blogname);
            }
            $tbarr = array("title" => $subject, "excerpt" => $tbbody, "url" => "http://" . $pcconfig["SITE"] . "/pc/pccon.php?id=" . $pc["UID"] . "&tid=" . $tid . "&nid=" . $thisNid . "&s=all", "blogname" => $blogname);
            if ($tbpUrl) {
                //发送引用通告
                pc_tbp_trackback_ping($tbpUrl, $tbarr);
            }
            for ($i = 0; $i < $detectnum; $i++) {
                pc_tbp_trackback_ping($detecttbps[$i], $tbarr);
            }
        }
    }
    if ($into_filter) {
        return -9;
    } else {
        return 0;
    }
}
Exemplo n.º 3
0
     *
     *   希望使用水木代码的Web站点加上powered by kbs的图标.该图标
     * 位于html/images/poweredby.gif目录,链接指向http://dev.kcn.cn
     * 使用水木代码的站点可以通过dev.kcn.cn获得代码的最新信息.
     *
     */
    powered_by_smth();
    ?>
<p>
<?php 
} else {
    if (!$_POST["subject"]) {
        html_error_quit("请输入评论标题!");
        exit;
    }
    $ret = pc_add_comment($link, $pc, $nid, intval($_POST["emote"]), $currentuser["userid"], $_POST["subject"], html_editorstr_format($_POST["blogbody"]), $_POST["htmltag"] == 1 ? 1 : 0, false);
    switch ($ret) {
        case -6:
            html_error_quit("由于系统原因导致评论失败");
            break;
        case -9:
            echo "<script language=\"javascript\">alert('您的文章可能含有不当词汇,请等待管理员审核。');</script>";
            break;
        default:
    }
    ?>
<script language="javascript">
window.location.href="pccon.php?id=<?php 
    echo $uid;
    ?>
&nid=<?php 
Exemplo n.º 4
0
</table>
</form></center>	
<p align="center">
<?php 
        /**
         *    水木的web代码bbslib和cgi部分是修改于NJUWWWBBS-0.9,此部分
         * 代码遵循原有的nju www bbs的版权声明(GPL)。php部分的代码(
         * phplib以及php页面)不再遵循GPL,正在考虑使用其他开放源码的版
         * 权声明(BSD或者MPL之类)。
         *
         *   希望使用水木代码的Web站点加上powered by kbs的图标.该图标
         * 位于html/images/poweredby.gif目录,链接指向http://dev.kcn.cn
         * 使用水木代码的站点可以通过dev.kcn.cn获得代码的最新信息.
         *
         */
        powered_by_smth();
        ?>
</p>	
<?php 
    } elseif ($act == "edit2") {
        $emote = intval($_POST["emote"]);
        $uid = intval($_GET["id"]);
        $nid = intval($_GET["nid"]);
        $useHtmlTag = $_POST["htmltag"] == 1 ? 1 : 0;
        $query = "UPDATE `comments` SET `subject` = '" . addslashes($_POST["subject"]) . "',`changed` = '" . date("YmdHis") . "',`body` = '" . addslashes(html_editorstr_format($_POST["blogbody"])) . "' , `emote` = '" . $emote . "' , `htmltag` = '" . $useHtmlTag . "' WHERE `cid` = '" . $cid . "' AND `username` = '" . $currentuser["userid"] . "' LIMIT 1 ;";
        mysql_query($query, $link);
        pc_return("pccon.php?id=" . $uid . "&nid=" . $nid . "&s=all");
    }
    pc_db_close($link);
    html_normal_quit();
}