Пример #1
0
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(Html2Text($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;
}
function ClearHtml($str)
{
    $str = Html2Text($str);
    $str = str_replace('<', '&lt;', $str);
    $str = str_replace('>', '&gt;', $str);
    return $str;
}
Пример #3
0
function savegbform()
{
    global $db;
    $title = Html2Text($_POST["title"]);
    $content = HtmlReplace($_POST["content"]);
    $fileurl = HtmlReplace($_POST["fileurl"]);
    $replyid = intval($_POST["replyid"]);
    if (empty($title) || empty($content)) {
        header("location:./");
        exit;
    } else {
        $array = array('title' => $title, 'content' => $content, 'fileurl' => $fileurl, 'replyid' => $replyid, 'addtime' => time(), 'ip' => ip());
        $db->insert("ve123_guestbook", $array);
        header("location:./");
    }
}
Пример #4
0
function savegbform()
{
    global $db, $http_referer;
    $title = Html2Text($_POST["title"]);
    $content = HtmlReplace($_POST["content"]);
    $fileurl = HtmlReplace($_POST["fileurl"]);
    $replyid = intval($_POST["replyid"]);
    if (empty($title) || empty($content)) {
        header("location:" . $http_referer . "");
        exit;
    } else {
        $array = array('title' => $title, 'content' => $content, 'fileurl' => $fileurl, 'replyid' => $replyid, 'addtime' => time(), 'ip' => ip());
        $db->insert("kuaso_guestbook", $array);
        $db->query("update kuaso_guestbook set reply_time='" . time() . "' where gid='" . $replyid . "'");
        header("location:" . $http_referer . "");
    }
}
Пример #5
0
 function url($url)
 {
     $this->url = $url;
     $data = $this->getFileContents($url);
     if ($data["state"] == "ok") {
         $file = $data["file"];
     } else {
         $file = $this->getfile($url);
     }
     $this->charset = $data["charset"];
     $file = $this->Convert_File($file, $data["charset"]);
     $this->htmlcode = $file;
     $data = $this->clean_file($file, $url, "html");
     $this->title = $data["title"];
     $this->fulltxt = Html2Text($data["fulltext"]);
     $this->pagesize = number_format(strlen($file) / 1024, 0, ".", "");
     $this->keywords = $data["keywords"];
     $this->description = $data["description"];
 }
Пример #6
0
 $dsql->SetQuery($fquery);
 $dsql->Execute();
 $sp = new SplitWord();
 while ($row = $dsql->GetObject()) {
     if ($row->keywords != '') {
         continue;
     }
     $tjnum++;
     $id = $row->id;
     $keywords = "";
     if ($cfg_soft_lang == 'utf-8') {
         $row->title = utf82gb($row->title);
         $row->body = utf82gb($row->body);
     }
     $titleindexs = explode(' ', trim($sp->GetIndexText($row->title)));
     $allindexs = explode(' ', trim($sp->GetIndexText(Html2Text($row->body), 500)));
     if (is_array($allindexs) && is_array($titleindexs)) {
         foreach ($titleindexs as $k) {
             if (strlen($keywords) >= 30) {
                 break;
             } else {
                 $keywords .= $k . ",";
             }
         }
         foreach ($allindexs as $k) {
             if (strlen($keywords) >= 30) {
                 break;
             } else {
                 if (!in_array($k, $titleindexs)) {
                     $keywords .= $k . ",";
                 }
Пример #7
0
 function fetchtext($URI)
 {
     if ($this->fetch($URI)) {
         if (is_array($this->results)) {
             for ($x = 0; $x < count($this->results); $x++) {
                 $this->results[$x] = $this->_striptext($this->results[$x]);
             }
         } else {
             $this->bianma = $this->bianma($this->results);
         }
         //获取得到htmlcode的编码
         $this->results = $this->Convert_File($this->results, $this->bianma);
         //转换所有编码为gb2312
         //$this->results=$this->clean_html($this->results, $URI,"html");    //清除代码中非法字符和格式,赋值给输出指针
         //$this->title = $this->get_title($this->results);//过滤htmlcode全文为标题
         //$this->pagesize=number_format(strlen($this->results)/1024, 0, ".", "");
         //$this->fulltxt = $this->_striptext($this->results);//过滤htmlcode全文为文本
         $lry = $this->clean_file($this->results, $URI, "html");
         $this->title = $lry["title"];
         //从数组中得到标题,赋值给title
         $this->pagesize = number_format(strlen($this->results) / 1024, 0, ".", "");
         //$this->fulltxt=$this->_striptext($lry["fulltext"]);     //转换html格式为文本 赋值给fulltxt
         $this->fulltxt = Html2Text($lry["fulltext"]);
         $this->description = $lry["description"];
         //从数组中得到标题,赋值给description
         $this->keywords = $lry["keywords"];
         //从数组中得到标题,赋值给keywords
         return true;
     } else {
         return false;
     }
 }
    function toXml()
    {
        global $dsql, $cfg_webname, $cfg_basehost, $cfg_soft_lang;
        $addonQuery = $limitQuery = "";
        if (!empty($this->Typeid)) {
            $addonQuery .= "AND arc.typeid=" . intval($this->Typeid);
            $typeinfos = $this->getType($this->Typeid);
        }
        if ($this->SitemapType == 2) {
            $setupmaxaid = baidu_get_setting('setupmaxaid');
            $addonQuery .= "AND arc.id>" . intval($setupmaxaid);
        }
        $this->Start = intval($this->Start);
        //var_dump($typeinfos);exit();
        if (!empty($this->Row)) {
            $limitQuery = "LIMIT  {$this->Start}," . intval($this->Row);
        }
        $query = "SELECT arc.*,arc.senddate AS pubdate,tp.typedir,tp.typename,tp.isdefault,tp.defaultname,tp.namerule,\n\t\t\ttp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath,at.body\n\t\t\tFROM `{$this->MainTable}` arc LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id\n            LEFT JOIN `#@__addonarticle` at ON arc.id=at.aid\n\t\t\tWHERE arc.arcrank=0 AND arc.arcrank > -1 AND arc.channel=1 {$addonQuery} ORDER BY arc.senddate DESC {$limitQuery}";
        //var_dump($query);
        $dsql->SetQuery($query);
        $dsql->Execute('dd');
        $xmlstr = '<?xml version="1.0" encoding="UTF-8"?>
<urlset>';
        $setupmaxaid = 0;
        while ($row = $dsql->GetArray('dd')) {
            $row['id'] = isset($row['aid']) ? $row['aid'] : $row['id'];
            $row['filename'] = $row['arcurl'] = GetFileUrl($row['id'], $row['typeid'], $row['senddate'], $row['title'], 1, 0, $row['namerule'], $row['typedir'], 0, '', $row['moresite'], $row['siteurl'], $row['sitepath']);
            $row['showdate'] = Mydate('Y-m-d', $row['pubdate']);
            $row['priority'] = 0;
            $row['body'] = isset($row['body']) ? Html2Text($row['body']) : '';
            $row['body'] = empty($row['body']) ? $row['description'] : $row['body'];
            //var_dump($row);exit;
            if (preg_match("#c#", $row['flag'])) {
                $row['priority'] = '1.0';
            }
            if (!isset($typeinfos)) {
                $typeinfos = $this->getType($row['typeid']);
            }
            //var_dump($typeinfo);exit();
            //var_dump($row);
            $row['source'] = trim(Html2Text($row['source']));
            $row['title'] = baidu_strip_invalid_xml($row['title']);
            $row['body'] = baidu_strip_invalid_xml($row['body']);
            $addstr = $copyrightstr = $yearstr = "";
            $copyrightstr = !empty($row['source']) ? "\r\n\t\t\t\t\t<copyrightHolder><name><![CDATA[{$row['source']}]]></name></copyrightHolder>" : '';
            $addstr .= empty($row['litpic']) ? "" : "\r\n\t\t\t\t\t<image><![CDATA[{$row['litpic']}]]></image>";
            $yearstr = Mydate('Y', $row['pubdate']);
            $rowxmlstr = <<<EOT
\t
\t<url>
\t\t\t<loc><![CDATA[{$cfg_basehost}{$row['filename']}]]></loc>
\t\t\t<lastmod>{$row['showdate']}</lastmod>
\t\t\t<changefreq>always</changefreq>
\t\t\t<priority>{$row['priority']}</priority>
\t\t\t<data>
\t\t\t\t<Webpage>
\t\t\t\t\t<name><![CDATA[{$row['title']}]]></name>
\t\t\t\t\t<url><![CDATA[{$cfg_basehost}{$row['filename']}]]></url>
\t\t\t\t\t<provider>
\t\t\t\t\t\t<name><![CDATA[{$cfg_webname}]]></name>
\t\t\t\t\t\t<url><![CDATA[{$cfg_basehost}]]></url>
\t\t\t\t\t</provider>
\t\t\t\t\t<description><![CDATA[{$row['description']}]]></description>
                    <text><![CDATA[{$row['body']}]]></text>
                    <keywords><![CDATA[{$row['keywords']}]]></keywords>
\t\t\t\t\t<breadcrumb><![CDATA[{$typeinfos['position']}]]></breadcrumb>
\t\t\t\t\t{$addstr}
                    <isPartOf>
\t\t\t\t\t\t<name><![CDATA[{$typeinfos['typename']}]]></name>
\t\t\t\t\t\t<url><![CDATA[{$cfg_basehost}{$typeinfos['typelink']}]]></url>
\t\t\t\t\t</isPartOf>
                    {$copyrightstr}
\t\t\t\t\t<copyrightYear>{$yearstr}</copyrightYear>
\t\t\t\t</Webpage>
\t\t\t</data>
\t\t</url>
EOT;
            if ($cfg_soft_lang == 'gb2312') {
                $rowxmlstr = gb2utf8($rowxmlstr);
            }
            //var_dump($rowxmlstr);exit;
            $xmlstr .= $rowxmlstr;
        }
        //exit($xmlstr);
        $xmlstr .= "\r\n</urlset>";
        //$xmldata['content'] = $xmlstr;
        return $xmlstr;
    }
function lib_duoshuo(&$ctag, &$refObj)
{
    global $dsql, $cfg_basehost, $cfg_cmspath;
    $plugin = Duoshuo_Dedecms::getInstance();
    if ($plugin->getOption('short_name') == '' || $plugin->getOption('secret') == '') {
        return '在管理后台进行一步配置,就可以开始使用多说了';
    }
    $attlist = 'type|0';
    FillAttsDefault($ctag->CAttribute->Items, $attlist);
    extract($ctag->CAttribute->Items, EXTR_SKIP);
    if (empty($refObj->Fields['aid'])) {
        return '';
    }
    $arcid = $refObj->Fields['aid'];
    //设置参数
    $attrs = array();
    $attrs[] = ' data-thread-key="' . $arcid . '"';
    $attrs[] = 'data-author-key="' . $refObj->Fields["mid"] . '"';
    /*
    if(empty($refObj->Fields['arcurl'])){
    	$refObj->Fields['arcurl'] = $refObj->GetTrueUrl(null);
    }
    if(strpos($refObj->Fields['arcurl'],$cfg_basehost) === false){
    	$attrs[] = ' data-url="'.$cfg_basehost.$refObj->Fields['arcurl'].'"';
    }
    
    $attrs[] = ' data-url="'.$refObj->Fields['arcurl'].'"';
    */
    $article_url = $refObj->GetTrueUrl(null);
    if (!strpos($article_url, 'http:')) {
        $article_url = $cfg_basehost . $article_url;
    }
    if (!empty($refObj->Fields['litpic']) && !preg_match('/\\/images\\/defaultpic.gif/', $refObj->Fields['litpic'])) {
        $attrs[] = ' data-image="' . $refObj->Fields['litpic'] . '"';
    }
    if (!empty($refObj->Fields['title'])) {
        $attrs[] = 'data-title="' . htmlspecialchars($refObj->Fields['title'], ENT_QUOTES, 'GB2312') . '"';
    }
    //输出评论框
    ob_start();
    require DEDEROOT . '/plus/duoshuo/templates/comments.htm';
    if ($plugin->getOption('seo_enabled') && !empty($arcid)) {
        // 每篇评论最大字数
        $infolen = 200;
        // 每篇文章seo显示的最大行数
        $totalrow = 100;
        $innertext = file_get_contents(DEDEROOT . '/plus/duoshuo/templates/comments_seo.htm');
        ?>
<div id="ds-ssr" class="mt1">
	<dl class="tbox">
		<dt> <strong>评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)</strong> </dt>
		<dd>
			<div class="dede_comment">
				<div class="decmt-box1">
					<ul>
						<li id="commetcontentNew"></li>

<?php 
        $wsql = " WHERE ischeck=1 AND aid = {$arcid}";
        $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['msg'] = jsTrim(Html2Text($arr['msg']), $infolen);
            $arr['dtime'] = GetDateTimeMK($arr['dtime']);
            $arr['username'] = $str = str_replace('&lt;br/&gt;', ' ', $arr['username']);
            foreach ($ctp->CTags as $tagid => $ctag) {
                if (!empty($arr[$ctag->GetName()])) {
                    $ctp->Assign($tagid, $arr[$ctag->GetName()]);
                }
            }
            echo $ctp->GetResult();
        }
        ?>
 
					</ul>
				</div>
			</div>
		</dd>
	</dl>
</div>

<?php 
    }
    return ob_get_clean();
}
Пример #10
0
<html><head><meta http-equiv=content-type content="text/html;charset=gb2312">
<title><?php 
echo Html2Text($title) . "--" . $config["name"];
?>
</title>
<style>
<!--
body{margin:0px;font-size:12px;font-family:Arial;line-height:180%}
td{font-size:12px;}
img{border:0}
.b{border:1px solid #A1C0DC;margin-bottom:8px;}
.b a{text-decoration:none;}
.b a:hover{text-decoration:underline;}
.b1{padding:4px 0 4px 10px;}
.b2{padding:6px 5px 4px 10px;font-size:14px;line-height:150%}
.b2 img{border:1px solid #D0E3F2;}
-->
</style>

<table width=910 border=0 align="center" cellpadding=0 cellspacing=0>
  <td height=3 bgcolor=005CCD></td>
</table>
<br>
<table width=910 border=0 align="center" cellpadding=0 cellspacing=0>
  <tr>
    <td width=175 rowspan=3><a href="<?php 
echo $config["url"];
?>
"><img src="<?php 
echo $config["url"] . "/images/logo.gif";
?>
Пример #11
0
require_once dirname(__FILE__) . "/config.php";
require_once DEDEINC . "/typelink.class.php";
if (empty($dopost)) {
    $dopost = '';
}
$id = isset($id) ? intval($id) : 0;
//检查权限许可
CheckPurview('t_Edit,t_AccEdit');
//检查栏目操作许可
CheckCatalog($id, '你无权更改本栏目!');
/*-----------------------
function action_save()
----------------------*/
if ($dopost == "save") {
    $description = Html2Text($description, 1);
    $keywords = Html2Text($keywords, 1);
    $uptopsql = $smalltypes = '';
    if (isset($smalltype) && is_array($smalltype)) {
        $smalltypes = join(',', $smalltype);
    }
    if ($topid == 0) {
        $sitepath = $typedir;
        $uptopsql = " ,siteurl='{$siteurl}',sitepath='{$sitepath}',ishidden='{$ishidden}' ";
    }
    if ($ispart != 0) {
        $cross = 0;
    }
    $upquery = "UPDATE `#@__arctype` SET\n     issend='{$issend}',\n     sortrank='{$sortrank}',\n     typename='{$typename}',\n     typedir='{$typedir}',\n     isdefault='{$isdefault}',\n     defaultname='{$defaultname}',\n     issend='{$issend}',\n     ishidden='{$ishidden}',\n     channeltype='{$channeltype}',\n     tempindex='{$tempindex}',\n     templist='{$templist}',\n     temparticle='{$temparticle}',\n     namerule='{$namerule}',\n     namerule2='{$namerule2}',\n     ispart='{$ispart}',\n     corank='{$corank}',\n     description='{$description}',\n     keywords='{$keywords}',\n     seotitle='{$seotitle}',\n     moresite='{$moresite}',\n\t picname='{$picname}',\n     `cross`='{$cross}',\n     `content`='{$content}',\n     `crossid`='{$crossid}',\n     `smalltypes`='{$smalltypes}'\n     {$uptopsql}\n    WHERE id='{$id}' ";
    if (!$dsql->ExecuteNoneQuery($upquery)) {
        ShowMsg("保存当前栏目更改时失败,请检查你的输入资料是否存在问题!", "-1");
        exit;
Пример #12
0
function AnalyseHtmlBody($body, &$description, &$litpic, &$keywords, $dtype = '')
{
    global $autolitpic, $remote, $dellink, $autokey, $cfg_basehost, $cfg_auot_description, $id, $title, $cfg_soft_lang;
    $autolitpic = empty($autolitpic) ? '' : $autolitpic;
    $body = stripslashes($body);
    //远程图片本地化
    if ($remote == 1) {
        $body = GetCurContent($body);
    }
    //删除非站内链接
    if ($dellink == 1) {
        $basehost = "http://" . $_SERVER['HTTP_HOST'];
        $body = str_replace($cfg_basehost, '#basehost#', $body);
        $body = str_replace($basehost, '#2basehost2#', $body);
        $body = preg_replace("/(<a[ \t\r\n]{1,}href=[\"']{0,}http:\\/\\/[^\\/]([^>]*)>)|(<\\/a>)/isU", "", $body);
        $body = str_replace('#basehost#', $cfg_basehost, $body);
        $body = str_replace('#2basehost2#', $basehost, $body);
    }
    //自动摘要
    if ($description == '' && $cfg_auot_description > 0) {
        $description = cn_substr(html2text($body), $cfg_auot_description);
        $description = trim(preg_replace('/#p#|#e#/', '', $description));
        $description = addslashes($description);
    }
    //自动获取缩略图
    if ($autolitpic == 1 && $litpic == '') {
        $litpic = GetDDImgFromBody($body);
    }
    //自动获取关键字
    if ($autokey == 1 && $keywords == '') {
        $subject = $title;
        $message = $body;
        if ($cfg_soft_lang == 'utf-8') {
            $subject = utf82gb($title);
            $message = utf82gb($message);
        }
        include_once DEDEINC . '/splitword.class.php';
        $keywords = '';
        $sp = new SplitWord();
        $titleindexs = explode(' ', preg_replace("/#p#|#e#/", '', $sp->GetIndexText($subject)));
        $allindexs = explode(' ', preg_replace("/#p#|#e#/", '', $sp->GetIndexText(Html2Text($message), 500)));
        if (is_array($allindexs) && is_array($titleindexs)) {
            foreach ($titleindexs as $k) {
                if (strlen($keywords . $k) >= 60) {
                    break;
                } else {
                    $keywords .= $k . ',';
                }
            }
            foreach ($allindexs as $k) {
                if (strlen($keywords . $k) >= 60) {
                    break;
                } else {
                    if (!in_array($k, $titleindexs)) {
                        $keywords .= $k . ',';
                    }
                }
            }
        }
        $sp->Clear();
        $sp = null;
    }
    $body = GetFieldValueA($body, $dtype, $id);
    $body = addslashes($body);
    return $body;
}
Пример #13
0
    $description = Html2Text($description, 1);
    $query = "INSERT INTO #@__mail_type (typename,description) VALUES ('{$typename}','{$description}')";
    if (!$dsql->ExecuteNoneQuery($query)) {
        ShowMsg("更新数据库#@__mail_type表时出错,请检查!", "javascript:;");
        exit;
    } else {
        ShowMsg("添加分类成功!", "mail_type.php");
        exit;
    }
} elseif ($dopost == "editsave") {
    if ($typename == "") {
        ShowMsg("分类名不能为空", "-1");
        exit;
    }
    $typename = Html2Text($typename, 1);
    $description = Html2Text($description, 1);
    $query = "UPDATE #@__mail_type SET typename='{$typename}',description='{$description}' WHERE id={$id}";
    if (!$dsql->ExecuteNoneQuery($query)) {
        ShowMsg("更新数据库#@__mail_type表时出错,请检查!", "javascript:;");
        exit;
    } else {
        ShowMsg("更改分类成功!", "mail_type.php");
        exit;
    }
} elseif ($dopost == "delete") {
    $dsql->ExecuteNoneQuery("Delete From `#@__mail_type` where id='{$id}'");
    ShowMsg("删除分类成功!", "mail_type.php");
    exit;
} else {
    $sql = "SELECT * FROM `#@__mail_type` ORDER BY id ";
    $dlist = new DataListCP();
Пример #14
0
 /**
  *  获得和下一个标记之间的文本内容
  *
  * @access    public
  * @param     string  $pos  位置地址
  * @param     string  $tagname  标签名称
  * @return    string
  */
 function GetInnerText(&$pos, $tagname)
 {
     $startPos = 0;
     $endPos = 0;
     $textLen = 0;
     $str = '';
     $startPos = strpos($this->SourceHtml, '>', $pos);
     if ($tagname == 'title') {
         $endPos = strpos($this->SourceHtml, '<', $startPos);
     } else {
         $endPos1 = strpos($this->SourceHtml, '</a', $startPos);
         $endPos2 = strpos($this->SourceHtml, '</A', $startPos);
         if ($endPos1 === false) {
             $endPos = $endPos2;
         } else {
             if ($endPos2 === false) {
                 $endPos = $endPos1;
             } else {
                 $endPos = $endPos1 < $endPos2 ? $endPos1 : $endPos2;
             }
         }
     }
     if ($endPos > $startPos) {
         $textLen = $endPos - $startPos;
         $str = substr($this->SourceHtml, $startPos + 1, $textLen - 1);
     }
     $pos = $startPos + $textLen + strlen("</" . $tagname) + 1;
     if ($tagname == 'title') {
         return trim($str);
     } else {
         preg_match_all("/<img(.*)src=[\"']{0,1}(.*)[\"']{0,1}[> \r\n\t]{1,}/isU", $str, $imgs);
         if (isset($imgs[2][0])) {
             $txt = trim(Html2Text($str));
             $imgs[2][0] = preg_replace("/[\"']/", '', $imgs[2][0]);
             return "img:" . $this->FillUrl($imgs[2][0]) . ':txt:' . $txt;
         } else {
             $str = strip_tags($str);
             //$str = preg_replace('/<\/(.*)$/i', '', $str);
             //$str = trim(preg_replace('/^(.*)>/i','',$str));
             return $str;
         }
     }
 }
Пример #15
0
                                            }
                                            if (empty($seo_info['baidu_count']) and preg_match("#网站共有([\\d, ]+)个#", $html, $matches)) {
                                                $seo_info['baidu_count'] = isset($matches[1]) ? trim($matches[1]) : 0;
                                            }
                                            $seo_info['baidu_count'] = empty($seo_info['baidu_count']) ? 0 : $seo_info['baidu_count'];
                                            $url = "http://www.sogou.com/web?query=site:{$site}";
                                            $html = Html2Text(dedeseo_http_send($url));
                                            if (preg_match("#结果数约([\\d]+)个#", $html, $matches)) {
                                                $seo_info['sogou_count'] = isset($matches[1]) ? $matches[1] : 0;
                                            }
                                            if (empty($seo_info['sogou_count']) and preg_match("#找到约([\\d, ]+)条结果#", $html, $matches)) {
                                                $seo_info['sogou_count'] = isset($matches[1]) ? trim($matches[1]) : 0;
                                            }
                                            $seo_info['sogou_count'] = empty($seo_info['sogou_count']) ? 0 : $seo_info['sogou_count'];
                                            $url = "http://www.haosou.com/s?q=site%3A{$site}";
                                            $html = Html2Text(dedeseo_http_send($url));
                                            if (preg_match("#结果数约([\\d]+)个#", $html, $matches)) {
                                                $seo_info['haosou360_count'] = isset($matches[1]) ? $matches[1] : 0;
                                            }
                                            if (empty($seo_info['haosou360_count']) and preg_match("#结果约([\\d, ]+)个#", $html, $matches)) {
                                                $seo_info['haosou360_count'] = isset($matches[1]) ? trim($matches[1]) : 0;
                                            }
                                            $seo_info['haosou360_count'] = empty($seo_info['haosou360_count']) ? 0 : $seo_info['haosou360_count'];
                                            $in_query = "INSERT INTO `#@__plus_seoinfo` (`create_time`, `alexa_num`, `alexa_area_num`, `baidu_count`, `sogou_count`, `haosou360_count`) VALUES ({$now}, '{$seo_info['alexa_num']}', '{$seo_info['alexa_area_num']}', '{$seo_info['baidu_count']}', '{$seo_info['sogou_count']}', '{$seo_info['haosou360_count']}');";
                                            $dsql->ExecuteNoneQuery($in_query);
                                        }
                                        $inff = array('alexa_num' => 'Alexa全球排名', 'alexa_area_num' => 'Alexa地区排名', 'baidu_count' => '百度收录', 'sogou_count' => '搜狗收录', 'haosou360_count' => '360收录');
                                        ?>
<table width="100%" class="dboxtable">
    <tbody>
<?php 
Пример #16
0
	CheckCatalog($ID,"你无权在本栏目下创建子类!");
}

$dsql = new DedeSql(false);


//保存栏目
/*------------------------
function __SaveCatalog()
--------------------------*/
if($dopost=="save")
{
   if(empty($reID)) $reID = 0;
   if(empty($upinyin)) $upinyin = 0;
   $description = Html2Text($description);
   $keywords = Html2Text($keywords);

   
   $tmpdir = $typedir;
   if($ispart==3 && $typedir==''){
     ShowMsg("你设置的栏目属性是跳转网址,请指定要跳转的网址!","-1");
     exit();
   }

 if($ispart!=3) //非跳转网址处理栏目目录
 {
   //栏目的参照目录
   if($reID==0 && $moresite==1) $nextdir = '/';
   else{
     if($referpath=='cmspath') $nextdir = '{cmspath}';
     else if($referpath=='basepath') $nextdir = '';
Пример #17
0
 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);
     if ($cfg_soft_lang == 'utf-8') {
         $title = utf82gb($title);
         $body = utf82gb($body);
     }
     $titleindexs = explode(' ', preg_replace("/#p#|#e#/", '', $sp->GetIndexText($title)));
     $allindexs = explode(' ', preg_replace("/#p#|#e#/", '', $sp->GetIndexText(Html2Text($body), 500)));
     if (is_array($allindexs) && is_array($titleindexs)) {
         foreach ($titleindexs as $k) {
             if (strlen($keywords . $k) >= 30) {
                 break;
             } else {
                 $keywords .= $k . ',';
             }
         }
         foreach ($allindexs as $k) {
             if (strlen($keywords . $k) >= 30) {
                 break;
             } else {
                 if (!in_array($k, $titleindexs)) {
                     $keywords .= $k . ',';
                 }
Пример #18
0
function Update_All_Link_($in_url = '', $days, $qiangzhi)
{
    global $db;
    $new_url = array();
    $fen_url = array();
    $fenge = array();
    $numm = 20;
    //开启多少线程
    //if($qiangzhi==0){ $lry="and strlen(lrymd5)!=32";}
    //else { ;}
    if (empty($in_url)) {
        $sql = "select url from ve123_links where length(lrymd5)!=32 order by link_id desc";
    } else {
        $sql = "select url from ve123_links where url like '%" . getdomain($in_url) . "%' and length(lrymd5)!=32 order by link_id desc";
    }
    echo $sql . "<br>";
    $query = $db->query($sql);
    while ($row = $db->fetch_array($query)) {
        $new_url[] = $row[url];
    }
    $he_num = ceil(count($new_url) / $numm);
    //计算需要循环多少次
    //echo "<br><b>需要循环多少次=</b>".$he_num."<br>";
    $fenge = array_chunk($new_url, $numm);
    //把数组分割成多少块数组 每块大小$numm
    for ($i = 0; $i <= $he_num; $i++) {
        $fen_url = cmi($fenge[$i]);
        //需要把得到的数组  (数组只包括 网址和源码) 分析  写入数据库 ,
        foreach ((array) $fen_url as $url => $file) {
            $bianma = bianma($file);
            //获取得到htmlcode的编码
            $file = Convert_File($file, $bianma);
            //转换所有编码为gb2312
            $lry = clean_lry($file, $url, "html");
            $title = $lry["title"];
            //从数组中得到标题,赋值给title
            $pagesize = number_format(strlen($file) / 1024, 0, ".", "");
            $fulltxt = Html2Text($lry["fulltext"]);
            $description = $lry["description"];
            //从数组中得到标题,赋值给description
            $keywords = $lry["keywords"];
            //从数组中得到标题,赋值给keywords
            $lrymd5 = md5($fulltxt);
            $updatetime = time();
            if ($title == "") {
                $title = str_cut($fulltxt, 65);
            }
            echo "<b><font color=#0Ae600>已更新</font></b>";
            echo $title;
            echo "<a href=" . $url . " target=_blank>" . $url . "</a><br>";
            $array = array('lrymd5' => $lrymd5, 'title' => $title, 'fulltxt' => $fulltxt, 'description' => $description, 'keywords' => $keywords, 'pagesize' => $pagesize, 'updatetime' => $updatetime);
            $db->update("ve123_links", $array, "url='" . $url . "'");
        }
    }
}
	$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))));
	$allindexs = explode(" ",trim($sp->GetIndexText($sp->SplitRMM(Html2Text($body)),200)));
	if(is_array($allindexs) && is_array($titleindexs)){
		foreach($titleindexs as $k){
			if(strlen($keywords)>=50) break;
			else $keywords .= $k." ";
		}
		foreach($allindexs as $k){
			if(strlen($keywords)>=50) break;
			else if(!in_array($k,$titleindexs)) $keywords .= $k." ";
	  }
	}
	$sp->Clear();
	unset($sp);
	$keywords = preg_replace("/#p#|#e#/","",$keywords);
	$keywords = addslashes($keywords);
}
Пример #20
0
 /**
  *  记录会员操作日志
  *
  * @access    public
  * @param     string  $type 记录类型
  * @param     string  $title 记录标题
  * @param     string  $note记录描述
  * @param     string  $aid涉及到的内容的id
  * @return    string
  */
 function RecordFeeds($type, $title, $note, $aid)
 {
     global $dsql, $cfg_mb_feedcheck;
     //确定是否需要记录
     if (in_array($type, array('add', 'addsoft', 'feedback', 'addfriends', 'stow'))) {
         $ntime = time();
         $title = htmlspecialchars(cn_substrR($title, 255));
         if (in_array($type, array('add', 'addsoft', 'feedback', 'stow'))) {
             $rcdtype = array('add' => ' 成功发布了', 'addsoft' => ' 成功发布了软件', 'feedback' => ' 评论了文章', 'stow' => ' 收藏了');
             //内容发布处理
             $arcrul = " <a href='/plus/view.php?aid=" . $aid . "'>" . $title . "</a>";
             $title = htmlspecialchars($rcdtype[$type] . $arcrul, ENT_QUOTES);
         } else {
             if ($type == 'addfriends') {
                 //添加好友处理
                 $arcrul = " <a href='/member/index.php?uid=" . $aid . "'>" . $aid . "</a>";
                 $title = htmlspecialchars(' 与' . $arcrul . "成为好友", ENT_QUOTES);
             }
         }
         $note = Html2Text($note);
         $aid = isset($aid) && is_numeric($aid) ? $aid : 0;
         $ischeck = $cfg_mb_feedcheck == 'Y' ? 0 : 1;
         $query = "INSERT INTO `#@__member_feed` (`mid`, `userid`, `uname`, `type`, `aid`, `dtime`,`title`, `note`, `ischeck`) \n                        Values('{$this->M_ID}', '{$this->M_LoginID}', '{$this->M_UserName}', '{$type}', '{$aid}', '{$ntime}', '{$title}', '{$note}', '{$ischeck}'); ";
         $rs = $dsql->ExecuteNoneQuery($query);
         return $rs;
     } else {
         return FALSE;
     }
 }
 $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 . ',';
             }
         }
         foreach ($allindexs as $k => $v) {
             if (strlen($keywords . $k) >= 60) {
/**
 * 处理HTML文本
 * 删除非站外链接、自动摘要、自动获取缩略图
 *
 * @access    public
 * @param     string  $body  内容
 * @param     string  $description  描述
 * @param     string  $litpic  缩略图
 * @param     string  $keywords  关键词
 * @param     string  $dtype  类型
 * @return    string
 */
function AnalyseHtmlBody($body, &$description, &$litpic, &$keywords, $dtype = '')
{
    global $autolitpic, $remote, $dellink, $autokey, $cfg_basehost, $cfg_auot_description, $id, $title, $cfg_soft_lang;
    $autolitpic = empty($autolitpic) ? '' : $autolitpic;
    $body = stripslashes($body);
    //远程图片本地化
    if ($remote == 1) {
        $body = GetCurContent($body);
    }
    //删除非站内链接
    if ($dellink == 1) {
        $allow_urls = array($_SERVER['HTTP_HOST']);
        // 读取允许的超链接设置
        if (file_exists(DEDEDATA . "/admin/allowurl.txt")) {
            $allow_urls = array_merge($allow_urls, file(DEDEDATA . "/admin/allowurl.txt"));
        }
        $body = Replace_Links($body, $allow_urls);
    }
    //自动摘要
    if ($description == '' && $cfg_auot_description > 0) {
        $description = cn_substr(html2text($body), $cfg_auot_description);
        $description = trim(preg_replace('/#p#|#e#/', '', $description));
        $description = addslashes($description);
    }
    //自动获取缩略图
    if ($autolitpic == 1 && $litpic == '') {
        $litpic = GetDDImgFromBody($body);
    }
    //自动获取关键字
    if ($autokey == 1 && $keywords == '') {
        $subject = $title;
        $message = $body;
        include_once DEDEINC . '/splitword.class.php';
        $keywords = '';
        $sp = new SplitWord($cfg_soft_lang, $cfg_soft_lang);
        $sp->SetSource($subject, $cfg_soft_lang, $cfg_soft_lang);
        $sp->StartAnalysis();
        $titleindexs = preg_replace("/#p#|#e#/", '', $sp->GetFinallyIndex());
        $sp->SetSource(Html2Text($message), $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 . ',';
                }
            }
            foreach ($allindexs as $k => $v) {
                if (strlen($keywords . $k) >= 60) {
                    break;
                } else {
                    if (!in_array($k, $titleindexs)) {
                        if (strlen($k) <= 2) {
                            continue;
                        }
                        $keywords .= $k . ',';
                    }
                }
            }
        }
        $sp = null;
    }
    $body = GetFieldValueA($body, $dtype, $id);
    $body = addslashes($body);
    return $body;
}
	    if($sid!=0) $addquery  = " And maintable.ID>='$sid' ";
	    if($eid!=0) $addquery  = " And maintable.ID<='$eid' ";
	    $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();
Пример #24
0
 /**
  * caijixia for dedecms
  * @version        $Id: cjx.class.php 112 2013-05-28 01:22:57Z qinjinpeng $
  * @copyright Copyright (c) 2011,caijixia for dedecms,caijixia.com.
  * @license   This is NOT a freeware, use is subject to license terms
  *
  * @param     NULL
  * @return    NULL
 */
 function ac_suggest()
 {
     $content = Html2Text($this->gv('v'));
     $url = 'http://www.dedeapps.com/Suggest?';
     $query_str = "type=caijixia&content=" . $content;
     $context = array('http' => array('method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded' . "\r\n" . 'User-Agent: Mozilla-cjx-u-api-cli (non-curl) ' . phpversion() . "\r\n" . 'Content-length: ' . strlen($query_str), 'content' => $query_str));
     $contextid = stream_context_create($context);
     $sock = fopen($url, 'r', FALSE, $contextid);
     if ($sock) {
         $result = '';
         while (!feof($sock)) {
             $result .= fgets($sock, 4096);
         }
         fclose($sock);
     }
     print '提交成功,感谢您的建议';
 }