示例#1
0
 function comment($aid)
 {
     if ($aid) {
         $total = $this->db->get_var("SELECT count(*) FROM `#DC@__comment` WHERE `isexamine`='1' AND aid='{$aid}'");
         $rs = $this->db->get_row("SELECT * FROM `#DC@__article` WHERE id='{$aid}'", ARRAY_A);
         $rs['description'] = !empty($rs['description']) ? csubstr($rs['description'], '200') : csubstr(HtmToText($rs['body']), '200');
         $rs['sort']['name'] = $catalog['name'];
         $rs['sort']['url'] = $this->_url('list', array('id' => $rs['cid'], 'link' => $_catalog[$rs['cid']]['dir'], 'url' => $rs['url']));
         $rs['sort']['link'] = "<a href='{$rs['sort']['url']}'>{$catalog['name']}</a>";
         $rs['url'] = $this->_url('show', array('id' => $rs['id'], 'link' => $rs['customlink'], 'url' => $rs['url'], 'dir' => $_catalog[$rs['cid']]['dir'], 'pubdate' => $rs['pubdate']));
         $rs['link'] = "<a href='{$rs['url']}'>{$rs['title']}</a>";
         $this->get['id'] = $rs['id'];
         $this->get['title'] = $rs['title'];
         $this->assign('nav', $this->shownav($rs['cid']));
         $this->assign("total", $total);
         $this->assign("aid", $rs['id']);
         $this->assign("title", $rs['title']);
         $this->assign("description", $rs['description']);
         $this->assign("url", $rs['url']);
         $this->assign("link", $rs['link']);
     }
     $this->DCPrint("DCSYSTEM", "comment");
 }
示例#2
0
function HtmToText($string)
{
    if (is_array($string)) {
        foreach ($string as $key => $val) {
            $string[$key] = HtmToText($val);
        }
    } else {
        $search = array("'<script[^>]*?>.*?</script>'si", "'<[\\/\\!]*?[^<>]*?>'si", "'([\r\n])[\\s]+'", "'&(quot|#34);'i", "'&(amp|#38);'i", "'&(lt|#60);'i", "'&(gt|#62);'i", "'&(nbsp|#160);'i", "'&(iexcl|#161);'i", "'&(cent|#162);'i", "'&(pound|#163);'i", "'&(copy|#169);'i", "'&#(\\d+);'e");
        $replace = array("", "", "\\1", "\"", "&", "<", ">", " ", chr(161), chr(162), chr(163), chr(169), "chr(\\1)");
        $string = preg_replace($search, $replace, $string);
    }
    return $string;
}
示例#3
0
 $dellink = false;
 $autopic = false;
 $postype = "0";
 $body = str_replace(array("\n", "\r", "\t"), "", $_POST['content']);
 empty($title) && alert('标题不能为空!');
 empty($cid) && alert('请选择所属栏目');
 empty($body) && empty($url) && alert('文章内容不能为空!');
 WordFilter($title) && alert('标题包含被系统屏蔽的字符,请返回重新填写。');
 WordFilter($pic) && alert('缩略图包含被系统屏蔽的字符,请返回重新填写。');
 WordFilter($source) && alert('出处包含被系统屏蔽的字符,请返回重新填写。');
 WordFilter($author) && alert('作者包含被系统屏蔽的字符,请返回重新填写。');
 WordFilter($description) && alert('摘要包含被系统屏蔽的字符,请返回重新填写。');
 WordFilter($keywords) && alert('关键字包含被系统屏蔽的字符,请返回重新填写。');
 WordFilter($body) && alert('文章内容包含被系统屏蔽的字符,请返回重新填写。');
 if ($iCMS->config['autodesc'] == "1" && !empty($iCMS->config['descLen']) && empty($description) && empty($url)) {
     $description = csubstr(HtmToText($body), $iCMS->config['descLen']);
 }
 //	    $remote && remote($body);
 //	    (!$remote&&$autopic) && remote($body,true);
 empty($customlink) && ($customlink = pinyin($title, $iCMS->config['CLsplit']));
 $catalog = new catalog();
 $isexamine = $catalog->catalog[$cid]['isexamine'];
 $visible = $isexamine ? '0' : '1';
 if (empty($aid)) {
     empty($userid) && ($userid = $member->uId);
     $hits = $digg = $comments = 0;
     $iCMS->db->getValue("SELECT `id` FROM `#iCMS@__article` where `title` = '{$title}'") && alert('该标题的文章已经存在!请检查是否重复');
     $iCMS->db->insert('article', compact('cid', 'title', 'stitle', 'customlink', 'url', 'source', 'author', 'editor', 'userid', 'postype', 'keywords', 'tags', 'description', 'related', 'pic', 'pubdate', 'hits', 'digg', 'comments', 'type', 'vlink', 'top', 'visible'));
     $aid = $iCMS->db->insert_id;
     $iCMS->db->insert('articledata', compact('aid', 'subtitle', 'tpl', 'body'));
     //insert_db_remote($body,$aid);
示例#4
0
 function doSave()
 {
     //    	print_r($_POST);
     //    	exit;
     set_time_limit(0);
     $aid = (int) $_POST['aid'];
     $fid = (int) $_POST['fid'];
     $userid = (int) $_POST['userid'];
     $type = (int) $_POST['type'];
     $orderNum = (int) $_POST['orderNum'];
     $title = dhtmlspecialchars($_POST['title']);
     $subtitle = dhtmlspecialchars($_POST['subtitle']);
     $stitle = dhtmlspecialchars($_POST['stitle']);
     $pic = dhtmlspecialchars($_POST['pic']);
     $source = dhtmlspecialchars($_POST['source']);
     $author = dhtmlspecialchars($_POST['author']);
     $editor = dhtmlspecialchars($_POST['editor']);
     $description = dhtmlspecialchars($_POST['description']);
     $keywords = dhtmlspecialchars($_POST['keywords']);
     $tags = dhtmlspecialchars($_POST['tags']);
     $clink = dhtmlspecialchars($_POST['clink']);
     $url = dhtmlspecialchars($_POST['url']);
     $tpl = dhtmlspecialchars($_POST['template']);
     $top = _int($_POST['top']);
     $vlink = empty($_POST['vlink']) ? "" : implode(',', $_POST['vlink']);
     $related = empty($_POST['related']) ? "" : implode(',', $_POST['related']);
     $pubdate = _strtotime($_POST['pubdate']);
     $remote = isset($_POST['remote']) ? true : false;
     $dellink = isset($_POST['dellink']) ? true : false;
     $this->autopic = isset($_POST['autopic']) ? true : false;
     $status = isset($_POST['draft']) ? "0" : "1";
     $postype = $_POST['postype'] ? $_POST['postype'] : "1";
     $body = implode('<!--iCMS.PageBreak-->', $_POST['body']);
     $body = str_replace(array("\n", "\r", "\t", '<p>&nbsp;</p><p>&nbsp;</p>', '<p>&nbsp;</p><p>&nbsp;</p>', '<p>&nbsp;</p><p>&nbsp;</p>'), "", $body);
     $body = preg_replace(array('/<script.+?<\\/script>/is', '/<form.+?<\\/form>/is', '/<div\\s+style=\\\\"page-break-after:.*?<\\/div>/is'), array('', '', '<!--iCMS.PageBreak-->'), $body);
     //$body       = strip_tags($body,'<div><br><p><img><a><embed><span><b><strong><u><em>');
     empty($title) && javascript::alert('标题不能为空!');
     empty($fid) && javascript::alert('请选择所属栏目');
     empty($body) && empty($url) && javascript::alert('文章内容不能为空!');
     WordFilter($title) && javascript::alert('标题包含被系统屏蔽的字符,请返回重新填写。');
     WordFilter($body) && javascript::alert('文章内容包含被系统屏蔽的字符,请返回重新填写。');
     if ($clink) {
         for ($i = 0; $i < strlen($clink); $i++) {
             !preg_match("/[a-zA-Z0-9_\\-~" . preg_quote($this->iCMS->config['CLsplit'], '/') . "]/", $clink[$i]) && javascript::alert('自定链接只能由英文字母、数字或_-~组成(不支持中文)');
         }
     }
     isset($_POST['keywordToTag']) && empty($tags) && ($tags = $keywords);
     $tags = implode(',', (array) tag_split($tags));
     if ($this->iCMS->config['autodesc'] == "1" && !empty($this->iCMS->config['descLen']) && empty($description) && empty($url)) {
         $description = csubstr(HtmToText($body), $this->iCMS->config['descLen']);
     }
     $remote && FS::remotepic($body, $title);
     !$remote && $this->autopic && FS::remotepic($body, $title, true);
     if (empty($clink)) {
         include iPATH . 'include/cn.class.php';
         $clink = CN::pinyin($title, $this->iCMS->config['CLsplit']);
     }
     $isPic = empty($pic) ? 0 : 1;
     $dellink && ($body = preg_replace("/<a[^>].*?>(.*?)<\\/a>/si", "\\1", $body));
     $SELFURL = __SELF__ . (empty($_POST['REFERER']) ? '?mo=article&do=manage' : $_POST['REFERER']);
     $forum = new forum();
     if (empty($aid)) {
         empty($userid) && ($userid = Admin::$uId);
         $hits = $good = $bad = $comments = 0;
         $checkCL = iCMS_DB::getValue("SELECT `id` FROM `#iCMS@__article` where `clink` ='{$clink}'");
         if ($this->iCMS->config['repeatitle']) {
             iCMS_DB::getValue("SELECT `id` FROM `#iCMS@__article` where `title` = '{$title}'") && javascript::alert('该标题的文章已经存在!请检查是否重复');
             $checkCL && javascript::alert('该自定链接已经存在!请另选一个');
         } else {
             $checkCL && ($clink .= $this->iCMS->config['CLsplit'] . random(6, 1));
         }
         iCMS_DB::insert('article', compact('fid', 'title', 'stitle', 'clink', 'orderNum', 'url', 'source', 'author', 'editor', 'userid', 'postype', 'keywords', 'tags', 'description', 'related', 'isPic', 'pic', 'pubdate', 'hits', 'good', 'bad', 'comments', 'type', 'vlink', 'top', 'status'));
         $aid = iCMS_DB::$insert_id;
         if (empty($url)) {
             //            	$body	= addslashes($body);
             iCMS_DB::insert('article_data', compact('aid', 'subtitle', 'tpl', 'body'));
             $this->insert_db_remote($body, $aid);
             //$iCMS->setCache('system/search',$res,0);
         }
         addtags($tags, $aid, $forum->rootid($fid));
         $vlink = empty($vlink) ? $fid : $vlink . ',' . $fid;
         vlinkDiff($vlink, '', $aid);
         if (!strstr($forum->forum[$fid]['contentRule'], '{PHP}') && !$forum->forum[$fid]['url'] && $forum->forum[$fid]['mode'] == "1" && $status) {
             include iPATH . 'include/iHtml.class.php';
             iHtml::Article($aid);
             iHtml::forum($fid, 1, 0, 1);
         }
         iCMS_DB::query("UPDATE `#iCMS@__forum` SET `count` = count+1 WHERE `fid` ='{$fid}' LIMIT 1 ");
         $moreaction = array(array("text" => "查看该文章", "url" => $this->iCMS->iurl('show', array(array('id' => $aid, 'link' => $clink, 'url' => $url, 'fid' => $fid, 'pubdate' => $pubdate), $forum->forum[$fid]))->href, "o" => 'target="_blank"'), array("text" => "编辑该文章", "url" => __SELF__ . "?mo=article&do=add&id=" . $aid), array("text" => "继续添加文章", "url" => __SELF__ . "?mo=article&do=add&fid=" . $fid), array("text" => "返回文章列表", "url" => $SELFURL), array("text" => "查看网站首页", "url" => "../index.php", "o" => 'target="_blank"'));
         javascript::dialog('文章添加完成!<br />10秒后返回文章列表', 'url:' . $SELFURL, $moreaction, 10);
     } else {
         $checkCL = iCMS_DB::getValue("SELECT `id` FROM `#iCMS@__article` where `clink` ='{$clink}' AND `id` !='{$aid}'");
         if ($this->iCMS->config['repeatitle']) {
             $checkCL && javascript::alert('该自定链接已经存在!请另选一个');
         } else {
             $checkCL && ($clink .= $this->iCMS->config['CLsplit'] . random(6, 1));
         }
         $art = iCMS_DB::getRow("SELECT `fid`,`tags`,`vlink` FROM `#iCMS@__article` where `id` ='{$aid}'");
         TagsDiff($tags, $art->tags, $aid, $forum->rootid($fid));
         iCMS_DB::update('article', compact('fid', 'title', 'stitle', 'orderNum', 'clink', 'url', 'source', 'author', 'editor', 'userid', 'postype', 'keywords', 'tags', 'description', 'related', 'isPic', 'pic', 'pubdate', 'type', 'vlink', 'top', 'status'), array('id' => $aid));
         $vlink = empty($vlink) ? $fid : $vlink . ',' . $fid;
         vlinkDiff($vlink, $art->vlink, $aid);
         if (empty($url)) {
             //            	$body	= addslashes($body);
             if (iCMS_DB::getValue("SELECT `id` FROM `#iCMS@__article_data` where `aid` ='{$aid}'")) {
                 iCMS_DB::update('article_data', compact('tpl', 'subtitle', 'body'), compact('aid'));
             } else {
                 iCMS_DB::insert('article_data', compact('aid', 'subtitle', 'tpl', 'body'));
             }
             $this->insert_db_remote($body, $aid);
         }
         if (!strstr($forum->forum[$fid]['contentRule'], '{PHP}') && !$forum->forum[$fid]['url'] && $forum->forum[$fid]['mode'] == "1" && $status) {
             include iPATH . 'include/iHtml.class.php';
             iHtml::Article($aid);
             iHtml::forum($fid, 1, 0, 1);
         }
         if ($art->fid != $fid) {
             iCMS_DB::query("UPDATE `#iCMS@__forum` SET `count` = count-1 WHERE `fid` ='{$art->fid}' LIMIT 1 ");
             iCMS_DB::query("UPDATE `#iCMS@__forum` SET `count` = count+1 WHERE `fid` ='{$fid}' LIMIT 1 ");
         }
         javascript::dialog('文章编辑完成!<br />3秒后返回文章列表', 'url:' . $SELFURL);
     }
 }
示例#5
0
    </tr>
  </table>
</div>
<iframe width="100%" height="100" style="display:none" id="post" name="post"></iframe>
</body>
</html>
<?php 
        break;
    case 'post':
        if ($action == 'pagedit') {
            $id = intval($_POST['id']);
            $cid = intval($_POST['cid']);
            $name = htmlspecialchars($_POST['name']);
            $title = htmlspecialchars(HtmToText($_POST['title']));
            $keyword = htmlspecialchars(HtmToText($_POST['keyword']));
            $description = htmlspecialchars(HtmToText($_POST['description']));
            $body = htmlspecialchars($_POST['body']);
            $creater = $updater = $administrator;
            $createtime = _strtotime($_POST['createtime']);
            $updatetime = time();
            $data = compact('cid', 'title', 'keyword', 'description', 'body', 'creater', 'updater', 'createtime', 'updatetime');
            if (empty($id)) {
                $DreamCMS->db->insert('page', $data);
                redirect($name . "页面添加完成!", "admincp.php?do=catalog");
            } else {
                $DreamCMS->db->update('page', $data, compact('id'));
                redirect($name . "编辑完成!", "admincp.php?do=catalog");
            }
        }
        if ($action == 'reupload') {
            $fid = (int) $_POST['fid'];
示例#6
0
    echo $DreamCMS->DCPrint("DCSYSTEM", "post");
} elseif ($do == "post") {
    checkverifycode(trim($_POST['verifycode']), $DreamCMS->language('post:verifycode'), "post");
    $title = htmlspecialchars($_POST['title']);
    $cid = intval($_POST['catalog']);
    $source = htmlspecialchars($_POST['source']);
    $author = htmlspecialchars($_POST['author']);
    $description = htmlspecialchars($_POST['description']);
    $keywords = htmlspecialchars($_POST['keywords']);
    $tags = htmlspecialchars($_POST['tag']);
    $body = $_POST['content'];
    empty($title) && alert($DreamCMS->language('post:checktitlempty'));
    empty($cid) && alert($DreamCMS->language('post:checkcid'));
    empty($body) && alert($DreamCMS->language('post:checkbody'));
    isset($_POST['keywordToTag']) && ($tags = str_replace(',', ' ', $keywords));
    empty($description) && ($description = csubstr(HtmToText($body), $DreamCMS->config['descLen']));
    $_pic = uploadfile("pic", $title);
    $pic = $_pic['FilePath'];
    $customlink = GetPinyin($title);
    $visible = $_catalog[$cid]['isexamine'] == "1" ? "0" : "1";
    $postype = "-1";
    $pubdate = time();
    $userid = $type = $hits = $digg = $comments = "0";
    $filename = $url = "";
    $data = compact('cid', 'title', 'customlink', 'url', 'filename', 'source', 'author', 'userid', 'postype', 'keywords', 'tags', 'description', 'filename', 'pic', 'pubdate', 'hits', 'digg', 'comments', 'type', 'visible');
    $DreamCMS->db->get_var("SELECT `id` FROM `#DC@__article` where `title` = '{$title}'") && alert($DreamCMS->language('post:checktitle'));
    $DreamCMS->db->insert('article', $data);
    $aid = $DreamCMS->db->insert_id;
    $DreamCMS->db->insert('articledata', compact('aid', 'subtitle', 'body'));
    tag($tags);
    MakeArticleHtm($DreamCMS->db->insert_id);