Example #1
0
/**
 *  获取一个页面
 *
 * @access    public
 * @param     string  $gurl  操作地址
 * @return    string
 */
function CoOnePage($gurl)
{
    global $dsql, $cfg_auot_description, $cfg_soft_lang;
    $redatas = array('title' => '', 'body' => '', 'source' => '', 'writer' => '', 'description' => '', 'keywords' => '');
    $redatas['source'] = preg_replace("/http:\\/\\//i", "", $gurl);
    $redatas['source'] = preg_replace("/\\/(.*)\$/i", "", $redatas['source']);
    $row = $dsql->GetOne("SELECT * FROM `#@__co_onepage` WHERE url LIKE '" . $redatas['source'] . "' ");
    $s = $e = '';
    if (is_array($row)) {
        list($s, $e) = explode('{@body}', $row['rule']);
        $s = trim($s);
        $e = trim($e);
        if ($row['issource'] == 1) {
            $redatas['source'] = $row['title'];
        }
    }
    $htd = new DedeHttpDown();
    $htd->OpenUrl($gurl);
    $body = $htd->GetHtml();
    if ($body != '') {
        //编码自动转换
        if ($cfg_soft_lang == 'utf-8') {
            if ($row['lang'] == 'gb2312') {
                $body = gb2utf8($body);
            }
        } else {
            if ($cfg_soft_lang == 'gb2312') {
                if ($row['lang'] == 'utf-8') {
                    $body = utf82gb($body);
                }
            }
        }
        //获取标题
        $inarr = array();
        preg_match("/<title>(.*)<\\/title>/isU", $body, $inarr);
        if (isset($inarr[1])) {
            $redatas['title'] = $inarr[1];
        }
        //获取关键词
        $inarr = array();
        preg_match("/<meta[\\s]+name=['\"]keywords['\"] content=['\"](.*)['\"]/isU", $body, $inarr);
        if (isset($inarr[1])) {
            $redatas['keywords'] = cn_substr(html2text($inarr[1]), 30);
        }
        //获取摘要
        $inarr = array();
        preg_match("/<meta[\\s]+name=['\"]description['\"] content=['\"](.*)['\"]/isU", $body, $inarr);
        if (isset($inarr[1])) {
            $redatas['description'] = cn_substr(html2text($inarr[1]), $cfg_auot_description);
        }
        //获取内容
        if ($s != '' && $e != '') {
            $redatas['body'] = GetHtmlAreaA($s, $e, $body);
            if ($redatas['body'] != '' && $redatas['description'] == '') {
                $redatas['description'] = cn_substr(html2text($redatas['body']), $GLOBALS['cfg_auot_description']);
            }
        }
    }
    return $redatas;
}
Example #2
0
/**
 * 调用最新评论
 *
 * @param int row 12
 * int infolen 10
 * @param int titlelen 100
 * @return unknown
 */
function lib_feedback(&$ctag, &$refObj)
{
    global $dsql;
    $attlist = "row|12,titlelen|24,infolen|100";
    FillAttsDefault($ctag->CAttribute->Items, $attlist);
    extract($ctag->CAttribute->Items, EXTR_SKIP);
    $innertext = trim($ctag->GetInnerText());
    $totalrow = $row;
    $revalue = '';
    if (empty($innertext)) {
        $innertext = GetSysTemplets('tag_feedback.htm');
    }
    $wsql = " where ischeck=1 ";
    $equery = "SELECT * FROM `#@__feedback` {$wsql} ORDER BY id DESC LIMIT 0 , {$totalrow}";
    $ctp = new DedeTagParse();
    $ctp->SetNameSpace('field', '[', ']');
    $ctp->LoadSource($innertext);
    $dsql->Execute('fb', $equery);
    while ($arr = $dsql->GetArray('fb')) {
        $arr['title'] = cn_substr($arr['arctitle'], $titlelen);
        $arr['msg'] = jstrim($arr['msg'], $infolen);
        foreach ($ctp->CTags as $tagid => $ctag) {
            if (!empty($arr[$ctag->GetName()])) {
                $ctp->Assign($tagid, $arr[$ctag->GetName()]);
            }
        }
        $revalue .= $ctp->GetResult();
    }
    return $revalue;
}
Example #3
0
/**
 *  获取文档
 *
 * @param     object  $dsql
 * @param     string  $ordertype  排序类型
 * @return    string
 */
function GetArchives($dsql, $ordertype)
{
    $starttime = time() - 24 * 3600 * 30;
    if ($ordertype == 'monthFeedback' || $ordertype == 'monthHot') {
        $swhere = " where senddate>{$starttime} ";
    } else {
        $swhere = "";
    }
    if (preg_match("#feedback#", $ordertype)) {
        $ordersql = " ORDER BY scores DESC ";
    } else {
        $ordersql = " ORDER BY click DESC ";
    }
    $query = "SELECT id,title,click,scores FROM #@__archives {$swhere} {$ordersql} LIMIT 0,20 ";
    $dsql->SetQuery($query);
    $dsql->Execute('ga');
    while ($row = $dsql->GetObject('ga')) {
        if (preg_match("#feedback#i", $ordertype)) {
            $moreinfo = "[<a target='_blank' href='" . $GLOBALS['cfg_phpurl'] . "/feedback.php?aid={$row->id}'><u>评论:{$row->scores}</u></a>]";
        } else {
            $moreinfo = "[点击:{$row->click}]";
        }
        echo "·<a href='archives_do.php?aid={$row->id}&dopost=viewArchives' target='_blank'>";
        echo cn_substr($row->title, 30) . "</a>{$moreinfo}<br/>\r\n";
    }
}
Example #4
0
function JstrimJajxLog($str, $len)
{
    $str = cn_substr($str, $len);
    $str = str_replace('&#039;', '"', $str);
    $str = str_replace('&lt;', '<', $str);
    $str = str_replace('&gt;', '>', $str);
    return $str;
}
Example #5
0
function jsTrim($str, $len)
{
    $str = preg_replace("/{quote}(.*){\\/quote}/is", '', $str);
    $str = str_replace('&lt;br/&gt;', ' ', $str);
    $str = cn_substr($str, $len);
    $str = preg_replace("#['\"\r\n]#", "", $str);
    return $str;
}
Example #6
0
function show_description_text($s, $len)
{
    $s = strip_tags($s);
    $s = preg_replace('/&nbsp;/', ' ', $s);
    $s = preg_replace('/\\s{2,}/', '', $s);
    $s = cn_substr($s, 0, $len);
    return $s;
}
Example #7
0
 public function indexAction()
 {
     $keyword = daddslashes($this->reqVar('keyword', ''));
     $startTime = daddslashes($this->reqVar('start_time', ''));
     $endTime = daddslashes($this->reqVar('end_time', ''));
     $page = (int) $this->reqVar('page', 1);
     $pageUrl = "/admin/operate/";
     if (!empty($keyword)) {
         $opertaeSet['operat'] = $keyword;
         $pageUrl .= "?keyword={$keyword}";
     }
     if (!empty($startTime)) {
         $opertaeSet['start_time'] = $startTime;
         $pageUrl .= !empty($keyword) ? "&" : "?";
         $pageUrl .= "&start_time={$startTime}";
     }
     if (!empty($endTime)) {
         $opertaeSet['end_time'] = $endTime;
         if (!empty($keyword) || !empty($startTime)) {
             $pageUrl .= "&end_time={$endTime}";
         } else {
             $pageUrl .= "?end_time={$endTime}";
         }
     }
     $operateList = $this->operateModel->getOpLogList($opertaeSet, $page, 20);
     if ($operateList) {
         foreach ($operateList as $key => $val) {
             $contentStr = '';
             $content = json_decode($val['content'], true);
             //                die();
             if (is_array($content)) {
                 foreach ($content as $ckey => $cval) {
                     $contentStr .= $ckey . "/" . $cval . ",";
                 }
                 $contentStr = trim($contentStr, ",");
                 $contentSub = cn_substr($contentStr, 20);
                 $operateList[$key]['content'] = $contentStr;
                 $operateList[$key]['content_sub'] = $contentSub;
             } else {
                 $operateList[$key]['content'] = $operateList[$key]['content_sub'] = $content;
             }
             //                $operateList[$key]['content_sub'] = $val['content'];
         }
     }
     $operateCount = $this->operateModel->getOpLogCount($opertaeSet);
     $operatePages = pages($operateCount, $page, 20, $pageUrl, array());
     $this->assign('keyword', $keyword);
     $this->assign('startTime', $startTime);
     $this->assign('endTime', $endTime);
     $this->assign('operateList', $operateList);
     $this->assign('operatePages', $operatePages);
     $this->assign("page", $page);
     $this->getViewer()->needLayout(false);
     $this->render('operate_list');
 }
Example #8
0
function lib_flink(&$ctag, &$refObj)
{
    global $dsql;
    $attlist = "type|textall,row|24,titlelen|24,linktype|1,typeid|0";
    FillAttsDefault($ctag->CAttribute->Items, $attlist);
    extract($ctag->CAttribute->Items, EXTR_SKIP);
    $totalrow = $row;
    $revalue = '';
    $wsql = " where ischeck >= '{$linktype}' ";
    if ($typeid == 0) {
        $wsql .= '';
    } else {
        $wsql .= "And typeid = '{$typeid}'";
    }
    if ($type == 'image') {
        $wsql .= " And logo<>'' ";
    } else {
        if ($type == 'text') {
            $wsql .= " And logo='' ";
        }
    }
    $equery = "Select * from #@__flink {$wsql} order by sortrank asc limit 0,{$totalrow}";
    if (trim($ctag->GetInnerText()) == '') {
        $innertext = "<li>[field:link /]</li>";
    } else {
        $innertext = $ctag->GetInnerText();
    }
    $dsql->SetQuery($equery);
    $dsql->Execute();
    while ($dbrow = $dsql->GetObject()) {
        if ($type == 'text' || $type == 'textall') {
            $link = "<a href='" . $dbrow->url . "' target='_blank'>" . cn_substr($dbrow->webname, $titlelen) . "</a> ";
        } else {
            if ($type == 'image') {
                $link = "<a href='" . $dbrow->url . "' target='_blank'><img src='" . $dbrow->logo . "' width='88' height='31' border='0'></a> ";
            } else {
                if ($dbrow->logo == '') {
                    $link = "<a href='" . $dbrow->url . "' target='_blank'>" . cn_substr($dbrow->webname, $titlelen) . "</a> ";
                } else {
                    $link = "<a href='" . $dbrow->url . "' target='_blank'><img src='" . $dbrow->logo . "' width='88' height='31' border='0'></a> ";
                }
            }
        }
        $rbtext = preg_replace("/\\[field:url([\\/\\s]{0,})\\]/isU", $row['url'], $innertext);
        $rbtext = preg_replace("/\\[field:webname([\\/\\s]{0,})\\]/isU", $row['webname'], $rbtext);
        $rbtext = preg_replace("/\\[field:logo([\\/\\s]{0,})\\]/isU", $row['logo'], $rbtext);
        $rbtext = preg_replace("/\\[field:link([\\/\\s]{0,})\\]/isU", $link, $rbtext);
        $revalue .= $rbtext;
    }
    return $revalue;
}
Example #9
0
function plus_spacenewart(&$atts, &$refObj, &$fields)
{
    global $dsql, $_vars;
    $attlist = "channel=1,titlelen=30,infolen=200,row=8,imgwidth=120,imgheight=90";
    FillAtts($atts, $attlist);
    FillFields($atts, $fields, $refObj);
    extract($atts, EXTR_OVERWRITE);
    $query = "Select arc.*,mt.mtypename,tp.typedir,tp.typename,tp.isdefault,tp.defaultname,tp.namerule,\r\n\t\ttp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath\r\n\t\tfrom `#@__archives` arc\r\n\t\tleft join `#@__arctype` tp on arc.typeid=tp.id\r\n\t\tleft join `#@__mtypes` mt on mt.mtypeid=arc.mtype\r\n\t\twhere arc.mid='{$_vars['mid']}' and arc.channel={$channel}\r\n\t\torder by id desc limit 0,{$row}";
    $dsql->SetQuery($query);
    $dsql->Execute("al");
    $artlist = '';
    $rearr = array();
    while ($row = $dsql->GetArray("al")) {
        //处理一些特殊字段
        $row['infos'] = cn_substr($row['description'], $infolen);
        $row['id'] = $row['id'];
        $row['arcurl'] = GetFileUrl($row['id'], $row['typeid'], $row['senddate'], $row['title'], $row['ismake'], $row['arcrank'], $row['namerule'], $row['typedir'], $row['money'], $row['filename'], $row['moresite'], $row['siteurl'], $row['sitepath']);
        $row['typeurl'] = GetTypeUrl($row['typeid'], $row['typedir'], $row['isdefault'], $row['defaultname'], $row['ispart'], $row['namerule2'], $row['moresite'], $row['siteurl'], $row['sitepath']);
        if ($row['litpic'] == '') {
            $row['litpic'] = '/images/defaultpic.gif';
        }
        if (!eregi("^http://", $row['litpic'])) {
            $row['picname'] = $row['litpic'] = $GLOBALS['cfg_cmsurl'] . $row['litpic'];
        } else {
            $row['picname'] = $row['litpic'] = $row['litpic'];
        }
        $row['stime'] = GetDateMK($row['pubdate']);
        $row['typelink'] = "<a href='" . $row['typeurl'] . "'>" . $row['typename'] . "</a>";
        $row['image'] = "<img src='" . $row['picname'] . "' border='0' width='{$imgwidth}' height='{$imgheight}' alt='" . ereg_replace("['><]", "", $row['title']) . "'>";
        $row['imglink'] = "<a href='" . $row['filename'] . "'>" . $row['image'] . "</a>";
        $row['fulltitle'] = $row['title'];
        $row['title'] = cn_substr($row['title'], $titlelen);
        if ($row['color'] != '') {
            $row['title'] = "<font color='" . $row['color'] . "'>" . $row['title'] . "</font>";
        }
        if (ereg('b', $row['flag'])) {
            $row['title'] = "<strong>" . $row['title'] . "</strong>";
        }
        //$row['title'] = "<b>".$row['title']."</b>";
        $row['textlink'] = "<a href='" . $row['filename'] . "'>" . $row['title'] . "</a>";
        $row['plusurl'] = $row['phpurl'] = $GLOBALS['cfg_phpurl'];
        $row['memberurl'] = $GLOBALS['cfg_memberurl'];
        $row['templeturl'] = $GLOBALS['cfg_templeturl'];
        $rearr[] = $row;
    }
    //loop line
    $dsql->FreeResult("al");
    return $rearr;
}
Example #10
0
function plus_ask(&$atts, &$refObj, &$fields)
{
    global $dsql, $_vars;
    $attlist = "titlelen=40,row=8,typeid=0,sort=";
    FillAtts($atts, $attlist);
    FillFields($atts, $fields, $refObj);
    extract($atts, EXTR_OVERWRITE);
    $wheresql = ' 1 ';
    if ($sort == '') {
        $orderby = 'order by id desc';
    } else {
        if ($sort == 'commend') {
            $wheresql .= ' And digest=1';
            $orderby = ' order by dateline desc';
        } else {
            if ($sort == 'ok') {
                $wheresql .= ' And status=1 ';
                $orderby = ' order by solvetime desc';
            } else {
                if ($sort == 'expiredtime') {
                    $wheresql .= ' And status=0 ';
                    $orderby = ' order by expiredtime asc, dateline desc';
                } else {
                    if ($sort == 'reward') {
                        $wheresql .= ' And status=0 ';
                        $orderby = ' order by reward desc';
                    } else {
                        $wheresql .= ' And status=0 ';
                        $orderby = ' order by disorder desc, dateline desc';
                    }
                }
            }
        }
    }
    $query = "select id, tid, tidname, tid2, tid2name, title from `#@__ask` where {$wheresql} {$orderby} limit {$row}";
    $dsql->SetQuery($query);
    $dsql->Execute('an');
    $rearr = array();
    while ($row = $dsql->GetArray('an')) {
        if ($row['tid2'] != 0) {
            $row['typelink'] = $row['typedata'] = " <a href='browser.php?tid2={$row['tid2']}'>{$row['tid2name']}</a>\r\n";
        } else {
            $row['typelink'] = $row['typedata'] = " <a href='browser.php?tid={$row['tid']}'>{$row['tidname']}</a>\r\n";
        }
        $row['title'] = cn_substr($row['title'], $titlelen);
        $rearr[] = $row;
    }
    return $rearr;
}
Example #11
0
function IsCommendArchives($iscommend)
{
    global $arcatts;
    $sn = '';
    foreach ($arcatts as $k => $v) {
        $v = cn_substr($v, 2);
        $sn .= preg_match("#" . $k . "#", $iscommend) ? ' ' . $v : '';
    }
    $sn = trim($sn);
    if ($sn == '') {
        return '';
    } else {
        return "[<font color='red'>{$sn}</font>]";
    }
}
Example #12
0
function lib_groupthread(&$ctag, &$refObj)
{
    global $dsql, $envs, $cfg_dbprefix, $cfg_cmsurl;
    //属性处理
    $attlist = "gid|0,orderby|dateline,orderway|desc,row|12,titlelen|30";
    FillAttsDefault($ctag->CAttribute->Items, $attlist);
    extract($ctag->CAttribute->Items, EXTR_SKIP);
    if (!$dsql->IsTable("{$cfg_dbprefix}groups")) {
        return '没安装圈子模块';
    }
    if (!preg_match("#\\/\$#", $cfg_cmsurl)) {
        $cfg_group_url = $cfg_cmsurl . "/group";
    } else {
        $cfg_group_url = $cfg_cmsurl . "group";
    }
    $innertext = $ctag->GetInnerText();
    if (trim($innertext) == '') {
        $innertext = GetSysTemplets('groupthreads.htm');
    }
    $WhereSql = " WHERE t.closed=0 ";
    $orderby = 't.' . $orderby;
    if ($gid > 0) {
        $WhereSql .= " AND t.gid='{$gid}' ";
    }
    $query = "SELECT t.subject,t.gid,t.tid,t.lastpost,g.groupname FROM `#@__group_threads` t \r\n             LEFT JOIN `#@__groups` g ON g.groupid=t.gid\r\n             {$WhereSql} ORDER BY {$orderby} {$orderway} LIMIT 0,{$row}";
    $dsql->SetQuery($query);
    $dsql->Execute();
    $ctp = new DedeTagParse();
    $ctp->SetNameSpace('field', '[', ']');
    if (!isset($list)) {
        $list = '';
    }
    while ($rs = $dsql->GetArray()) {
        $ctp->LoadSource($innertext);
        $rs['subject'] = cn_substr($rs['subject'], $titlelen);
        $rs['url'] = $cfg_group_url . "/viewthread.php?id={$rs['gid']}&tid={$rs['tid']}";
        $rs['groupurl'] = $cfg_group_url . "/group.php?id={$rs['gid']}";
        foreach ($ctp->CTags as $tagid => $ctag) {
            if (!empty($rs[strtolower($ctag->GetName())])) {
                $ctp->Assign($tagid, $rs[$ctag->GetName()]);
            }
        }
        $list .= $ctp->GetResult();
    }
    return $list;
}
Example #13
0
 function GetOneArchive($aid)
 {
     global $dsql;
     include_once DEDEINC . "/channelunit.func.php";
     $aid = trim(preg_replace('/[^0-9]/', '', $aid));
     $reArr = array();
     $chRow = $dsql->GetOne("SELECT arc.*,ch.maintable,ch.addtable,ch.issystem FROM `#@__arctiny` arc LEFT JOIN `#@__channeltype` ch ON ch.id=arc.channel WHERE arc.id='{$aid}' ");
     if (!is_array($chRow)) {
         return $reArr;
     } else {
         if (empty($chRow['maintable'])) {
             $chRow['maintable'] = '#@__archives';
         }
     }
     if ($chRow['issystem'] != -1) {
         $nquery = " SELECT arc.*,tp.typedir,tp.topid,tp.namerule,tp.moresite,tp.siteurl,tp.sitepath\n                        FROM `{$chRow['maintable']}` arc LEFT JOIN `#@__arctype` tp ON tp.id=arc.typeid\n                        WHERE arc.id='{$aid}' ";
     } else {
         $nquery = " SELECT arc.*,1 AS ismake,0 AS money,'' AS filename,tp.typedir,tp.topid,tp.namerule,tp.moresite,tp.siteurl,tp.sitepath\n                        FROM `{$chRow['addtable']}` arc LEFT JOIN `#@__arctype` tp ON tp.id=arc.typeid\n                        WHERE arc.aid='{$aid}' ";
     }
     $arcRow = $dsql->GetOne($nquery);
     if (!is_array($arcRow)) {
         return $reArr;
     }
     if (!isset($arcRow['description'])) {
         $arcRow['description'] = '';
     }
     if (empty($arcRow['description']) && isset($arcRow['body'])) {
         $arcRow['description'] = cn_substr(html2text($arcRow['body']), 250);
     }
     if (!isset($arcRow['pubdate'])) {
         $arcRow['pubdate'] = $arcRow['senddate'];
     }
     if (!isset($arcRow['notpost'])) {
         $arcRow['notpost'] = 0;
     }
     $reArr = $arcRow;
     $reArr['aid'] = $aid;
     $reArr['topid'] = $arcRow['topid'];
     $reArr['arctitle'] = $arcRow['title'];
     $reArr['arcurl'] = GetFileUrl($aid, $arcRow['typeid'], $arcRow['senddate'], $reArr['title'], $arcRow['ismake'], $arcRow['arcrank'], $arcRow['namerule'], $arcRow['typedir'], $arcRow['money'], $arcRow['filename'], $arcRow['moresite'], $arcRow['siteurl'], $arcRow['sitepath']);
     return $reArr;
 }
Example #14
0
function getList($list, $keyword)
{
    global $cfg_cmsurl;
    $key = urlencode($keyword);
    $str = "<h3>您可能感兴趣的内容<span><a href=\"{$cfg_cmsurl}/cloudsearch_{$key}_0_1.html\" target=\"_blank\">+更多&raquo;</a></span></h3>";
    $out = '';
    for ($i = 0; isset($list[$i]); $i++) {
        $row = $list[$i];
        $channelname = getChannelName($row['tablename']);
        $title = setColor($keyword, cn_substr($row['title'], 36));
        $litpic = getLitpic($row['imgurl'], $row['webid'], $row);
        $url = getUrl($row['aid'], $row['webid'], $row['tablename'], $row['tag']);
        if (!empty($row['title'])) {
            $out .= "<li><span class=\"fl\">[{$channelname}]</span><a href=\"{$url}\" target=\"_blank\" title=\"{$row['title']}\">{$title}</a></li>";
        }
    }
    if (!empty($out)) {
        $out = $str . "<ul>" . $out . "</ul>";
    }
    return $out;
}
Example #15
0
function lib_group(&$ctag, &$refObj)
{
    global $dsql, $envs, $cfg_dbprefix, $cfg_cmsurl;
    //属性处理
    $attlist = "row|6,orderby|threads,titlelen|30";
    FillAttsDefault($ctag->CAttribute->Items, $attlist);
    extract($ctag->CAttribute->Items, EXTR_SKIP);
    if (!$dsql->IsTable("{$cfg_dbprefix}groups")) {
        return '没安装圈子模块';
    }
    if (!preg("#\\/\$#", $cfg_cmsurl)) {
        $cfg_group_url = $cfg_cmsurl . '/group';
    } else {
        $cfg_group_url = $cfg_cmsurl . 'group';
    }
    $innertext = $ctag->GetInnerText();
    if (trim($innertext) == '') {
        $innertext = GetSysTemplets("groups.htm");
    }
    $list = '';
    $dsql->SetQuery("SELECT groupimg,groupid,groupname FROM `#@__groups` WHERE ishidden=0 ORDER BY {$orderby} DESC LIMIT 0,{$row}");
    $dsql->Execute();
    $ctp = new DedeTagParse();
    $ctp->SetNameSpace('field', '[', ']');
    while ($rs = $dsql->GetArray()) {
        $ctp->LoadSource($innertext);
        $rs['groupname'] = cn_substr($rs['groupname'], $titlelen);
        $rs['url'] = $cfg_group_url . "/group.php?id={$rs['groupid']}";
        $rs['icon'] = $rs['groupimg'];
        foreach ($ctp->CTags as $tagid => $ctag) {
            if (!empty($rs[strtolower($ctag->GetName())])) {
                $ctp->Assign($tagid, $rs[$ctag->GetName()]);
            }
        }
        $list .= $ctp->GetResult();
    }
    return $list;
}
Example #16
0
function GetFieldValue($dvalue, $dtype, $aid = 0, $job = 'add', $addvar = '')
{
    global $cfg_cookie_encode, $cfg_dir_purview;
    if ($dtype == "int") {
        $dvalue = trim(ereg_replace("[^0-9]", "", $dvalue));
        if ($dvalue == "") {
            $dvalue = 0;
        }
        return $dvalue;
    } else {
        if ($dtype == "float") {
            $dvalue = trim(ereg_replace("[^0-9\\.]", "", $dvalue));
            if ($dvalue == "") {
                $dvalue = 0;
            }
            return $dvalue;
        } else {
            if ($dtype == "datetime") {
                return GetMkTime($dvalue);
            } else {
                if ($dtype == "textdata") {
                    if ($job == 'edit') {
                        $addvarDirs = explode('/', $addvar);
                        $addvarDir = ereg_replace("/" . $addvarDirs[count($addvarDirs) - 1] . "\$", "", $addvar);
                        $mdir = $GLOBALS['cfg_basedir'] . $addvarDir;
                        if (!is_dir($mdir)) {
                            MkdirAll($mdir, $GLOBALS['cfg_dir_purview']);
                        }
                        $fp = fopen($GLOBALS['cfg_basedir'] . $addvar, "w");
                        fwrite($fp, stripslashes($dvalue));
                        fclose($fp);
                        CloseFtp();
                        return $addvar;
                    } else {
                        $ipath = $GLOBALS['cfg_cmspath'] . "/data/textdata";
                        $tpath = ceil($aid / 5000);
                        if (!is_dir($GLOBALS['cfg_basedir'] . $ipath)) {
                            MkdirAll($GLOBALS['cfg_basedir'] . $ipath, $cfg_dir_purview);
                        }
                        if (!is_dir($GLOBALS['cfg_basedir'] . $ipath . '/' . $tpath)) {
                            MkdirAll($GLOBALS['cfg_basedir'] . $ipath . '/' . $tpath, $cfg_dir_purview);
                        }
                        $ipath = $ipath . '/' . $tpath;
                        $filename = "{$ipath}/{$aid}-" . cn_substr(md5($cfg_cookie_encode), 0, 16) . ".txt";
                        $fp = fopen($GLOBALS['cfg_basedir'] . $filename, "w");
                        fwrite($fp, stripslashes($dvalue));
                        fclose($fp);
                        CloseFtp();
                        return $filename;
                    }
                } else {
                    if ($dtype == "img") {
                        $iurl = stripslashes($dvalue);
                        if (trim($iurl) == "") {
                            return "";
                        }
                        $iurl = trim(str_replace($GLOBALS['cfg_basehost'], "", $iurl));
                        $imgurl = "{dede:img text='' width='' height=''} " . $iurl . " {/dede:img}";
                        if (eregi("^http://", $iurl) && $GLOBALS['isUrlOpen']) {
                            //远程图片
                            $reimgs = "";
                            if ($isUrlOpen) {
                                $reimgs = GetRemoteImage($iurl, $GLOBALS['adminid']);
                                if (is_array($reimgs)) {
                                    $imgurl = "{dede:img text='' width='" . $reimgs[1] . "' height='" . $reimgs[2] . "'} " . $reimgs[0] . " {/dede:img}";
                                }
                            } else {
                                $imgurl = "{dede:img text='' width='' height=''} " . $iurl . " {/dede:img}";
                            }
                        } else {
                            if ($iurl != "") {
                                //站内图片
                                $imgfile = $GLOBALS['cfg_basedir'] . $iurl;
                                if (is_file($imgfile)) {
                                    $imginfos = GetImageSize($imgfile, &$info);
                                    $imgurl = "{dede:img text='' width='" . $imginfos[0] . "' height='" . $imginfos[1] . "'} {$iurl} {/dede:img}";
                                }
                            }
                        }
                        return addslashes($imgurl);
                    } else {
                        return $dvalue;
                    }
                }
            }
        }
    }
}
$iscommend = $iscommend + $isbold;

$pubdate = GetMkTime($pubdate);
$senddate = time();
$sortrank = AddDay($senddate,$sortup);

if($ishtml==0) $ismake = -1;
else $ismake = 0;

$title = cn_substr($title,80);
$shorttitle = cn_substr($shorttitle,36);
$color =  cn_substr($color,10);
$writer =  cn_substr($writer,30);
$source = cn_substr($source,50);
$description = cn_substr($description,250);
if($keywords!="") $keywords = trim(cn_substr($keywords,60))." ";


//处理上传的缩略图
if(empty($ddisremote)) $ddisremote = 0;
$litpic = GetDDImage('litpic',$picname,$ddisremote);

$adminID = $cuserLogin->getUserID();

$dsql = new DedeSql(false);
$cts = GetChannelTable($dsql,$channelid);
$arcID = GetIndexKey($dsql,$typeid,$channelid);

//加入主档案表

//----------------------------------
Example #18
0
 /**
  *  获得一个单列的文档列表
  *
  * @access    public
  * @param     int  $limitstart  限制开始  
  * @param     int  $row  行数 
  * @param     int  $col  列数
  * @param     int  $titlelen  标题长度
  * @param     int  $infolen  描述长度
  * @param     int  $imgwidth  图片宽度
  * @param     int  $imgheight  图片高度
  * @param     string  $listtype  列表类型
  * @param     string  $orderby  排列顺序
  * @param     string  $innertext  底层模板
  * @param     string  $tablewidth  表格宽度
  * @param     string  $ismake  是否编译
  * @param     string  $orderWay  排序方式
  * @return    string
  */
 function GetArcList($limitstart = 0, $row = 10, $col = 1, $titlelen = 30, $infolen = 250, $imgwidth = 120, $imgheight = 90, $listtype = "all", $orderby = "default", $innertext = "", $tablewidth = "100", $ismake = 1, $orderWay = 'desc')
 {
     global $cfg_list_son, $cfg_digg_update;
     $typeid = $this->TypeID;
     if ($row == '') {
         $row = 10;
     }
     if ($limitstart == '') {
         $limitstart = 0;
     }
     if ($titlelen == '') {
         $titlelen = 100;
     }
     if ($infolen == '') {
         $infolen = 250;
     }
     if ($imgwidth == '') {
         $imgwidth = 120;
     }
     if ($imgheight == '') {
         $imgheight = 120;
     }
     if ($listtype == '') {
         $listtype = 'all';
     }
     if ($orderWay == '') {
         $orderWay = 'desc';
     }
     if ($orderby == '') {
         $orderby = 'default';
     } else {
         $orderby = strtolower($orderby);
     }
     $tablewidth = str_replace('%', '', $tablewidth);
     if ($tablewidth == '') {
         $tablewidth = 100;
     }
     if ($col == '') {
         $col = 1;
     }
     $colWidth = ceil(100 / $col);
     $tablewidth = $tablewidth . '%';
     $colWidth = $colWidth . '%';
     $innertext = trim($innertext);
     if ($innertext == '') {
         $innertext = GetSysTemplets('list_fulllist.htm');
     }
     //排序方式
     $ordersql = '';
     if ($orderby == "senddate" || $orderby == "id") {
         $ordersql = " ORDER BY arc.id {$orderWay}";
     } else {
         if ($orderby == "hot" || $orderby == "click") {
             $ordersql = " ORDER BY arc.click {$orderWay}";
         } else {
             if ($orderby == "lastpost") {
                 $ordersql = "  ORDER BY arc.lastpost {$orderWay}";
             } else {
                 $ordersql = " ORDER BY arc.sortrank {$orderWay}";
             }
         }
     }
     //获得附加表的相关信息
     $addtable = $this->ChannelUnit->ChannelInfos['addtable'];
     if ($addtable != "") {
         $addJoin = " LEFT JOIN `{$addtable}` ON arc.id = " . $addtable . '.aid ';
         $addField = '';
         $fields = explode(',', $this->ChannelUnit->ChannelInfos['listfields']);
         foreach ($fields as $k => $v) {
             $nfields[$v] = $k;
         }
         if (is_array($this->ChannelUnit->ChannelFields) && !empty($this->ChannelUnit->ChannelFields)) {
             foreach ($this->ChannelUnit->ChannelFields as $k => $arr) {
                 if (isset($nfields[$k])) {
                     if (!empty($arr['rename'])) {
                         $addField .= ',' . $addtable . '.' . $k . ' as ' . $arr['rename'];
                     } else {
                         $addField .= ',' . $addtable . '.' . $k;
                     }
                 }
             }
         }
     } else {
         $addField = '';
         $addJoin = '';
     }
     //如果不用默认的sortrank或id排序,使用联合查询(数据量大时非常缓慢)
     if (preg_match('/hot|click|lastpost/', $orderby)) {
         $query = "SELECT arc.*,tp.typedir,tp.typename,tp.isdefault,tp.defaultname,\n           tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath\n           {$addField}\n           FROM `#@__archives` arc\n           LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id\n           {$addJoin}\n           WHERE {$this->addSql} {$ordersql} LIMIT {$limitstart},{$row}";
     } else {
         $t1 = ExecTime();
         $ids = array();
         $query = "SELECT id FROM `#@__arctiny` arc WHERE {$this->addSql} {$ordersql} LIMIT {$limitstart},{$row} ";
         $this->dsql->SetQuery($query);
         $this->dsql->Execute();
         while ($arr = $this->dsql->GetArray()) {
             $ids[] = $arr['id'];
         }
         $idstr = join(',', $ids);
         if ($idstr == '') {
             return '';
         } else {
             $query = "SELECT arc.*,tp.typedir,tp.typename,tp.corank,tp.isdefault,tp.defaultname,\n                       tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath\n                       {$addField}\n                       FROM `#@__archives` arc LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id\n                       {$addJoin}\n                       WHERE arc.id in({$idstr}) {$ordersql} ";
         }
         $t2 = ExecTime();
         //echo $t2-$t1;
     }
     $this->dsql->SetQuery($query);
     $this->dsql->Execute('al');
     $t2 = ExecTime();
     //echo $t2-$t1;
     $artlist = '';
     $this->dtp2->LoadSource($innertext);
     $GLOBALS['autoindex'] = 0;
     for ($i = 0; $i < $row; $i++) {
         if ($col > 1) {
             $artlist .= "<div>\r\n";
         }
         for ($j = 0; $j < $col; $j++) {
             if ($row = $this->dsql->GetArray("al")) {
                 $GLOBALS['autoindex']++;
                 $ids[$row['id']] = $row['id'];
                 //处理一些特殊字段
                 $row['infos'] = cn_substr($row['description'], $infolen);
                 $row['id'] = $row['id'];
                 if ($cfg_digg_update > 0) {
                     $prefix = 'diggCache';
                     $key = 'aid-' . $row['id'];
                     $cacherow = GetCache($prefix, $key);
                     $row['goodpost'] = $cacherow['goodpost'];
                     $row['badpost'] = $cacherow['badpost'];
                     $row['scores'] = $cacherow['scores'];
                 }
                 if ($row['corank'] > 0 && $row['arcrank'] == 0) {
                     $row['arcrank'] = $row['corank'];
                 }
                 $row['filename'] = $row['arcurl'] = GetFileUrl($row['id'], $row['typeid'], $row['senddate'], $row['title'], $row['ismake'], $row['arcrank'], $row['namerule'], $row['typedir'], $row['money'], $row['filename'], $row['moresite'], $row['siteurl'], $row['sitepath']);
                 $row['typeurl'] = GetTypeUrl($row['typeid'], MfTypedir($row['typedir']), $row['isdefault'], $row['defaultname'], $row['ispart'], $row['namerule2'], $row['moresite'], $row['siteurl'], $row['sitepath']);
                 if ($row['litpic'] == '-' || $row['litpic'] == '') {
                     $row['litpic'] = $GLOBALS['cfg_cmspath'] . '/images/defaultpic.gif';
                 }
                 if (!preg_match("/^http:\\/\\//i", $row['litpic']) && $GLOBALS['cfg_multi_site'] == 'Y') {
                     $row['litpic'] = $GLOBALS['cfg_mainsite'] . $row['litpic'];
                 }
                 $row['picname'] = $row['litpic'];
                 $row['stime'] = GetDateMK($row['pubdate']);
                 $row['typelink'] = "<a href='" . $row['typeurl'] . "'>" . $row['typename'] . "</a>";
                 $row['image'] = "<img src='" . $row['picname'] . "' border='0' width='{$imgwidth}' height='{$imgheight}' alt='" . preg_replace("/['><]/", "", $row['title']) . "'>";
                 $row['imglink'] = "<a href='" . $row['filename'] . "'>" . $row['image'] . "</a>";
                 $row['fulltitle'] = $row['title'];
                 $row['title'] = cn_substr($row['title'], $titlelen);
                 if ($row['color'] != '') {
                     $row['title'] = "<font color='" . $row['color'] . "'>" . $row['title'] . "</font>";
                 }
                 if (preg_match('/c/', $row['flag'])) {
                     $row['title'] = "<b>" . $row['title'] . "</b>";
                 }
                 $row['textlink'] = "<a href='" . $row['filename'] . "'>" . $row['title'] . "</a>";
                 $row['plusurl'] = $row['phpurl'] = $GLOBALS['cfg_phpurl'];
                 $row['memberurl'] = $GLOBALS['cfg_memberurl'];
                 $row['templeturl'] = $GLOBALS['cfg_templeturl'];
                 //编译附加表里的数据
                 foreach ($row as $k => $v) {
                     $row[strtolower($k)] = $v;
                 }
                 foreach ($this->ChannelUnit->ChannelFields as $k => $arr) {
                     if (isset($row[$k])) {
                         $row[$k] = $this->ChannelUnit->MakeField($k, $row[$k]);
                     }
                 }
                 if (is_array($this->dtp2->CTags)) {
                     foreach ($this->dtp2->CTags as $k => $ctag) {
                         if ($ctag->GetName() == 'array') {
                             //传递整个数组,在runphp模式中有特殊作用
                             $this->dtp2->Assign($k, $row);
                         } else {
                             if (isset($row[$ctag->GetName()])) {
                                 $this->dtp2->Assign($k, $row[$ctag->GetName()]);
                             } else {
                                 $this->dtp2->Assign($k, '');
                             }
                         }
                     }
                 }
                 $artlist .= $this->dtp2->GetResult();
             }
             //if hasRow
         }
         //Loop Col
         if ($col > 1) {
             $i += $col - 1;
             $artlist .= "    </div>\r\n";
         }
     }
     //Loop Line
     $t3 = ExecTime();
     //echo ($t3-$t2);
     $this->dsql->FreeResult('al');
     return $artlist;
 }
Example #19
0
 if (substr($urlbase, -1) == "/") {
     $urlbase = substr($urlbase, 0, -1);
 }
 if (substr($url, 0, 1) != "/") {
     $urlbase .= "/";
 }
 if (strpos($url, "http://") === 0) {
     $urlbase = "";
 }
 if (urlbase == "") {
     $urlbase = sprintf("/gen/%s/%s", $proj_data["{$p_id}"]['db_name'], $poly_data[$poly][html_path]);
 }
 $field_tag_data = "";
 foreach ($field_tag_name as $ii => $ff) {
     $field_tag_value = $row[$ff];
     $field_tag_value = cn_substr($field_tag_value, 40);
     if ($ff == "cname") {
         $field_tag_data .= "<td align=center><a href=fenleilist.php?p_id={$p_id}&t_id={$t_id}&parent_id={$row['id']}>{$field_tag_value}</a></td>\n";
     } else {
         $field_tag_data .= "<td align=center>{$field_tag_value}</td>\n";
     }
 }
 if ($row[published] == 'y') {
     $url_str = sprintf("<td align=center><a href=\"%s%s\" target=_blank>%s</a></td>", $urlbase, $url, $url);
 } else {
     $url_str = "<td align=center>{$url}</td>";
     $no_published_list .= sprintf("%s;", $row[d_id]);
 }
 if ($field_tag_data == "") {
     $field_tag_data = $url_str;
 }
Example #20
0
 public function doadd()
 {
     if (!USER_LOGINED) {
         jump(U('Public/login'));
     }
     //基本字段
     $postvar = 'title,mid,color,typeid,litpic,shorttitle,keywords,writer,source,description,modelid,';
     //扩展字段
     $extrapost = $this->parseextendfield();
     $extrapostvar = $extrapost['extravar'];
     $data = $this->getdata($postvar . $extrapostvar);
     if (!empty($extrapost['data'])) {
         $data = array_merge($data, $extrapost['data']);
     }
     //默认字段处理
     $data['description'] = stripslashes(strip_tags($data['description']));
     $data['pubdate'] = time();
     $data['senddate'] = time();
     $data['click'] = 0;
     $data['arcrank'] = 4;
     $data['money'] = 0;
     global $cfg_auot_description, $cfg_arc_dellink;
     //自动摘要处理
     if ($cfg_auot_description > 0 && $cfg_auot_description <= 250 && empty($data['description'])) {
         $data['description'] = cn_substr(strip_tags($data['body']), 0, $cfg_auot_description);
     }
     //0.基本验证
     if (empty($data['title'])) {
         $this->error('标题不能为空!');
     }
     if ($data['typeid'] == '0') {
         $this->error('请选择文章所属栏目!');
     }
     //关键词入库
     $this->inserttag(trim($data['keywords']));
     //1.微型表 更新
     $arctiny = M('arctiny');
     $arctinyvar = 'typeid,modelid,senddate,mid,';
     $arctinydata = $this->parsearray($data, $arctinyvar, 'get');
     $data['id'] = $arctiny->add($arctinydata);
     //2.文档主表 更新
     $archive = M('archive');
     $archivedata = $this->parsearray($data, $extrapostvar, 'del');
     $archive->add($archivedata);
     //3.获取附加表名
     $arcmodel = M('arcmodel');
     $arcmodellist = $arcmodel->field('addtable')->where("id='" . $arctinydata['modelid'] . "'")->find();
     //4. 附加表 更新
     $addon = M($arcmodellist['addtable']);
     $addonvar = $extrapostvar . 'id,typeid,';
     $addondata = $this->parsearray($data, $addonvar, 'get');
     $addon->add($addondata);
     //4.1 积分变动
     global $cfg_money_articleadd, $member;
     $membermodel = M('member');
     $membermodel->where(array('id' => $member['id']))->setInc('money', $cfg_money_articleadd);
     //5.成功跳转
     $this->success('操作成功!', U('Archive/index?status=0'));
 }
 }
 $sp = new SplitWord($cfg_soft_lang, $cfg_soft_lang);
 $arcids = preg_replace("#[^0-9,]#", '', preg_replace("#`#", ',', $qstr));
 $query = "SELECT arc.*, addt.* From `#@__archives` arc LEFT JOIN `#@__addonarticle` addt ON addt.aid=arc.id  WHERE arc.id in({$arcids}) AND arc.channel=1 ";
 $dsql->SetQuery($query);
 $dsql->Execute();
 while ($row = $dsql->GetArray()) {
     //跳过已经有关键字的内容
     if (trim($row['keywords']) != '') {
         continue;
     }
     $aid = $row['id'];
     $keywords = '';
     $title = $row['title'];
     $description = $row['description'];
     $body = cn_substr($row['body'], 5000);
     $sp->SetSource($title, $cfg_soft_lang, $cfg_soft_lang);
     $sp->StartAnalysis();
     $titleindexs = preg_replace("/#p#|#e#/", '', $sp->GetFinallyIndex());
     $sp->SetSource(Html2Text($body), $cfg_soft_lang, $cfg_soft_lang);
     $sp->StartAnalysis();
     $allindexs = preg_replace("/#p#|#e#/", '', $sp->GetFinallyIndex());
     if (is_array($allindexs) && is_array($titleindexs)) {
         foreach ($titleindexs as $k => $v) {
             if (strlen($keywords . $k) >= 60) {
                 break;
             } else {
                 if (strlen($k) <= 2) {
                     continue;
                 }
                 $keywords .= $k . ',';
function cn_substrR($str,$slen,$startdd=0)
{
	$str = cn_substr(stripslashes($str),$slen,$startdd);
	return addslashes($str);
}
$endtime = $senddate + 3600 * 24 * $endtime;


$title = cn_substr($title,80);

if($keywords!="") $keywords = trim(cn_substr($keywords,60))." ";

//处理上传的缩略图
if(empty($ddisremote)) $ddisremote = 0;
$litpic = GetDDImage('none',$picname,$ddisremote);

$body = stripslashes($body);

//自动摘要
if($description=="" && $cfg_auot_description>0){
	$description = stripslashes(cn_substr(html2text($body),$cfg_auot_description));
	$description = trim(preg_replace("/#p#|#e#/","",$description));
	$description = addslashes($description);
}
//把内容中远程的图片资源本地化
//------------------------------------
if($cfg_isUrlOpen && $remote==1){
	$body = GetCurContent($body);
}
//自动获取关键字
//----------------------------------
if($autokey==1){
	require_once(DEDEADMIN."/../include/pub_splitword_www.php");
	$keywords = "";
	$sp = new SplitWord();
	$titleindexs = explode(" ",trim($sp->GetIndexText($sp->SplitRMM($title))));
Example #24
0
     } else {
         $softsize = $softsize . ' ' . $unit;
     }
 }
 //其它链接处理
 for ($i = 2; $i <= 30; $i++) {
     if (!empty(${'softurl' . $i})) {
         $forconfig = empty(${'forconfig' . $i}) ? false : true;
         if ($forconfig) {
             if (empty(${'need' . $i})) {
                 continue;
             }
             $serverUrl = stripslashes(${'softurlfirst' . $i});
             $serverUrl = ereg_replace("/\$", "", $serverUrl);
             $softurl = stripslashes(${'softurl' . $i});
             if (cn_substr($softurl, 1) != '/') {
                 $softurl = '/' . $softurl;
             }
             $softurl = $serverUrl . $softurl;
         } else {
             $softurl = stripslashes(${'softurl' . $i});
         }
         $servermsg = str_replace("'", "", stripslashes(${'servermsg' . $i}));
         if ($servermsg == '') {
             $servermsg = '下载地址' . $i;
         }
         if ($softurl != 'http://') {
             $urls .= "{dede:link text='{$servermsg}'} {$softurl} {/dede:link}\r\n";
         }
     }
 }
Example #25
0
     $flag = 'p';
 }
 //随机推荐
 if ($randcc > 0) {
     $rflag = mt_rand(1, $randcc);
     if ($rflag == $randcc) {
         $flag = $flag == '' ? 'c' : $flag . ',c';
     }
 }
 $indexSql = str_replace('@senddate@', $senddate, $indexSql);
 $indexSql = str_replace('@sortrank@', $sortrank, $indexSql);
 $mainSql = str_replace('@flag@', $flag, $mainSql);
 $mainSql = str_replace('@sortrank@', $sortrank, $mainSql);
 $mainSql = str_replace('@pubdate@', $pubdate, $mainSql);
 $mainSql = str_replace('@senddate@', $senddate, $mainSql);
 $mainSql = str_replace('@title@', cn_substr($title, 60), $mainSql);
 $addSql = str_replace('@sortrank@', $sortrank, $addSql);
 $addSql = str_replace('@senddate@', $senddate, $addSql);
 //替换模型里的其它字段
 foreach ($dtp->CTags as $ctag) {
     if ($ctag->GetName() != 'field') {
         continue;
     }
     $itemname = $ctag->GetAtt('name');
     $itemvalue = addslashes(trim($ctag->GetInnerText()));
     $mainSql = str_replace("@{$itemname}@", $itemvalue, $mainSql);
     $addSql = str_replace("@{$itemname}@", $itemvalue, $addSql);
 }
 //插入数据库
 $rs = $dsql->ExecuteNoneQuery($indexSql);
 if ($rs) {
Example #26
0
    }
    //引入栏目缓存并看关键字是否有相关栏目内容
    require_once $typenameCacheFile;
    if (isset($typeArr) && is_array($typeArr)) {
        foreach ($typeArr as $id => $typename) {
            //$keywordn = str_replace($typename, ' ', $keyword);
            $keywordn = $keyword;
            if ($keyword != $keywordn) {
                $keyword = HtmlReplace($keywordn);
                $typeid = intval($id);
                break;
            }
        }
    }
}
$keyword = addslashes(cn_substr($keyword, 30));
$typeid = intval($typeid);
if ($cfg_notallowstr != '' && preg_match("#" . $cfg_notallowstr . "#i", $keyword)) {
    ShowMsg("你的搜索关键字中存在非法内容,被系统禁止!", "-1");
    exit;
}
if (($keyword == '' || strlen($keyword) < 2) && empty($typeid)) {
    ShowMsg('关键字不能小于2个字节!', '-1');
    exit;
}
//检查搜索间隔时间
$lockfile = DEDEDATA . '/time.lock.inc';
$lasttime = file_get_contents($lockfile);
if (!empty($lasttime) && $lasttime + $cfg_search_time > time()) {
    ShowMsg('管理员设定搜索时间间隔为' . $cfg_search_time . '秒,请稍后再试!', '-1');
    exit;
	    $fquery = "
	      Select maintable.ID,maintable.title,maintable.description,addtable.{$rpfield} as body
	      From $maintable maintable left join {$addtable} addtable on addtable.aid=maintable.ID
	      where maintable.channel='{$channel}' $addquery limit $startdd,$pagesize ;
	    ";

	    $dsql->SetQuery($fquery);
	    $dsql->Execute();
	    while($row=$dsql->GetArray())
	    {
		     $body = $row['body'];
		     $description = $row['description'];
		     if(strlen($description)>10 || $description=='-') continue;
		     $bodytext = preg_replace("/#p#|#e#|副标题|分页标题/isU","",Html2Text($body));
		     if(strlen($bodytext) < $msize) continue;
		     $des = trim(addslashes(cn_substr($bodytext,$dsize)));
		     if(strlen($des)<3) $des = "-";
		     $dsql->ExecuteNoneQuery("Update $maintable set description='{$des}' where ID='{$row['ID']}';");
		     $dsql->ExecuteNoneQuery("Update #@__full_search set addinfos='{$des}' where aid='{$row['ID']}';");
	    }
	    //返回进度信息
	    $startdd = $startdd + $pagesize;
	    if($totalnum > $startdd){
	      	$tjlen = ceil( ($startdd/$totalnum) * 100 );
			$dvlen = $tjlen * 2;
			$tjsta = "<div style='width:200;height:15;border:1px solid #898989;text-align:left'><div style='width:$dvlen;height:15;background-color:#829D83'></div></div>";
			$tjsta .= "<br/>完成处理文档总数的:$tjlen %,继续执行任务...";
			$nurl = "description_fetch_action.php?action=fetch&totalnum=$totalnum&startdd={$startdd}&pagesize=$pagesize&channel={$channel}&rpfield={$rpfield}&dsize={$dsize}&msize={$msize}&sid={$sid}&eid=$eid&addtable=".urlencode($addtable);
			$dsql->Close();
			ShowMsg($tjsta,$nurl,0,500);
			exit();
Example #28
0
 * @copyright      Copyright (c) 2007 - 2010, DesDev, Inc.
 * @license        http://help.dedecms.com/usersguide/license.html
 * @link           http://www.dedecms.com
 */
require_once dirname(__FILE__) . "/../include/common.inc.php";
require_once DEDEINC . '/memberlogin.class.php';
$htmltitle = "错误提交";
$aid = isset($aid) && is_numeric($aid) ? $aid : 0;
if (empty($dopost)) {
    $row = $dsql->GetOne(" SELECT a.`title`,b.`typename` FROM `#@__archives` a left join `#@__arctype` b on(a.typeid=b.id) WHERE a.`id` ='{$aid}'");
    if (!$row) {
        ShowMsg("谢谢您对本网站的支持,我们会尽快处理您的建议!", "javascript:window.close();");
        exit;
    }
    $title = $row['typename'] . "-" . $row['title'];
    require_once DEDEROOT . "/templets/plus/erraddsave.htm";
    $url = $_SERVER["HTTP_REFERER"];
    echo $url;
} elseif ($dopost == "saveedit") {
    $cfg_ml = new MemberLogin();
    $title = HtmlReplace($title);
    $type = isset($type) && is_numeric($type) ? $type : 0;
    $mid = isset($cfg_ml->M_ID) ? $cfg_ml->M_ID : 0;
    $err = trimMsg(cn_substr($err, 2000), 1);
    $oktxt = trimMsg(cn_substr($erradd, 2000), 1);
    $time = time();
    $query = "INSERT INTO `#@__erradd`(aid,mid,title,type,errtxt,oktxt,sendtime)\r\n                  VALUES ('{$aid}','{$mid}','{$title}','{$type}','{$err}','{$oktxt}','{$time}'); ";
    $dsql->ExecuteNoneQuery($query);
    ShowMsg("谢谢您对本网站的支持,我们会尽快处理您的建议!", "javascript:window.close();");
    exit;
}
Example #29
0
 function ac_ask_search()
 {
     $title = request('title', '');
     $title = addslashes(preg_replace("[\"\r\n\t\\*\\?\\(\\)\$%'><]", " ", stripslashes(trim($title))));
     if (!empty($title) && strlen($title) >= 8) {
         $query = "SELECT id,title,content,bestanswer FROM `#@__ask`\r\n                      WHERE title like '%{$title}%' LIMIT 5";
         $this->dsql->setquery($query);
         $this->dsql->execute();
         $searchs = array();
         while ($row = $this->dsql->getarray()) {
             $row["title"] = $this->GetRedKeyWord($title, $row["title"]);
             $row['content'] = cn_substr(strip_tags($row['content']), 300);
             $searchs[] = $row;
         }
         if (count($searchs) > 0) {
             //设定变量值
             $GLOBALS['searchs'] = $searchs;
             //载入模板
             $this->SetTemplate('ask2.htm');
             $this->Display();
         } else {
             Header("Location: ?ct=question&ac=ask_complete&title={$title}");
             exit;
         }
     } else {
         ShowMsg('问题名称不能为空或者不够长!', "-1");
         exit;
     }
 }
Example #30
0
 countArchives($channelid);
 //生成HTML
 InsertTags($tags, $arcID);
 $artUrl = MakeArt($arcID, true);
 if ($artUrl == '') {
     $artUrl = $cfg_phpurl . "/view.php?aid={$arcID}";
 }
 #api{{
 if (defined('UC_API') && @(include_once DEDEROOT . '/api/uc.func.php')) {
     //推送事件
     $feed['icon'] = 'thread';
     $feed['title_template'] = '<b>{username} 在网站共享了一软件</b>';
     $feed['title_data'] = array('username' => $cfg_ml->M_UserName);
     $feed['body_template'] = '<b>{subject}</b><br>{message}';
     $url = !strstr($artUrl, 'http://') ? $cfg_basehost . $artUrl : $artUrl;
     $feed['body_data'] = array('subject' => "<a href=\"" . $url . "\">{$title}</a>", 'message' => cn_substr(strip_tags(preg_replace("/\\[.+?\\]/is", '', $description)), 150));
     $feed['images'][] = array('url' => $cfg_basehost . '/images/scores.gif', 'link' => $cfg_basehost);
     uc_feed_note($cfg_ml->M_LoginID, $feed);
     //同步积分
     uc_credit_note($cfg_ml->M_LoginID, $cfg_sendarc_scores);
 }
 #/aip}}
 //返回成功信息
 $msg = "\r\n\t\t请选择你的后续操作:\r\n\t\t<a href='soft_add.php?cid={$typeid}'><u>继续发布软件</u></a>\r\n\t\t&nbsp;&nbsp;\r\n\t\t<a href='{$artUrl}' target='_blank'><u>查看软件</u></a>\r\n\t\t&nbsp;&nbsp;\r\n\t\t<a href='soft_edit.php?channelid={$channelid}&aid={$arcID}'><u>更改软件</u></a>\r\n\t\t&nbsp;&nbsp;\r\n\t\t<a href='content_list.php?channelid={$channelid}'><u>已发布软件管理</u></a>\r\n\t\t";
 $wintitle = "成功发布文章!";
 $wecome_info = "文章管理::发布文章";
 $win = new OxWindow();
 $win->AddTitle("成功发布文章:");
 $win->AddMsgItem($msg);
 $winform = $win->GetWindow("hand", "&nbsp;", false);
 $win->Display();