示例#1
0
文件: comdofun.php 项目: novnan/meiju
function DoRepNewstextZz($oldword,$newword,$text){
	$zztext=RepInfoZZ($oldword,"empire-cms-wm.chief-phome",0);
	$text=preg_replace($zztext,$newword,$text);
	return $text;
}
示例#2
0
文件: cjfun.php 项目: novnan/meiju
function ViewGetNewsInfo($classid, $newspage, $userid, $username)
{
    global $empire, $class_r, $fun_r, $dbtbpre;
    $classid = (int) $classid;
    if (empty($classid) || empty($newspage)) {
        printerror("FailCX", "history.go(-1)");
    }
    //验证权限
    CheckLevel($userid, $username, $classid, "cj");
    $r = $empire->fetch1("select * from {$dbtbpre}enewsinfoclass where classid='{$classid}'");
    if (empty($r[classid])) {
        printerror("FailCX", "history.go(-1)");
    }
    //副表
    $ra = $empire->fetch1("select * from {$dbtbpre}ecms_infoclass_" . $r[tbname] . " where classid='{$classid}'");
    //组合两数组
    $r = TogTwoArray($r, $ra);
    //导入编码文件
    if ($r['enpagecode']) {
        @(include_once "doiconv.php");
    }
    //取得模型
    $record = "<!--record-->";
    $field = "<!--field--->";
    $mr = $empire->fetch1("select cj from {$dbtbpre}enewsmod where mid='" . $class_r[$r[newsclassid]][modid] . "'");
    $cjr = explode($record, $mr[cj]);
    $count = count($cjr);
    //采集时间
    $newstime = date("Y-m-d H:i:s");
    eCheckCjUrl($newspage, 0);
    //入库数据库是否有记录
    if (empty($r[recjtheurl])) {
        $tmpnum = $empire->gettotal("select count(*) as total from {$dbtbpre}ecms_infotmp_" . $r[tbname] . " where oldurl='{$newspage}' limit 1");
        if ($tmpnum) {
            echo $fun_r['ReCj'];
            exit;
        }
    }
    //取得远程页面,三次取不到值的将不取值
    for ($i = 1; $i <= 3; $i++) {
        $info = ReadFiletext($newspage);
        if (!empty($info)) {
            break;
        }
    }
    if (empty($info)) {
        echo $fun_r['CanNotOpenUrl'];
        exit;
    }
    //替换网页变量
    $info = RepCjPagetextStr($info, $r);
    //替换回车
    $info = ReplaceFc($info);
    //-----------------
    $ifield = "";
    $ivalue = "";
    $next = 0;
    for ($c = 0; $c < $count - 1; $c++) {
        $zzvalue = "";
        $cjr1 = explode($field, $cjr[$c]);
        $dofield = $cjr1[1];
        $dofieldname = $cjr1[0];
        $var = "zz_" . $dofield;
        $var1 = "z_" . $dofield;
        $var2 = "qz_" . $dofield;
        $var3 = "save_" . $dofield;
        //图片集
        if ($dofield == "morepic" && $r[$var]) {
            //替换下载链接
            $text = stripSlashes(stripSlashes($r[$var]));
            //替换回车
            $text = ReplaceFc($text);
            $down = explode("[!empirecms!]", $text);
            //小图
            $zztext = RepInfoZZ($down[0], "ecmsspicurl", 0);
            $strtext = GetInfoStr($down[0], "ecmsspicurl", 1);
            $text1 = stripSlashes(preg_replace($zztext, $strtext, $info));
            //大图
            if ($down[1]) {
                $zztext = RepInfoZZ($down[1], "ecmsbpicurl", 0);
                $strtext = GetInfoStr($down[1], "ecmsbpicurl", 1);
                $text2 = stripSlashes(preg_replace($zztext, $strtext, $info));
            }
            //名称
            if ($down[2]) {
                $zztext = RepInfoZZ($down[2], "ecmspicname", 0);
                $strtext = GetInfoStr($down[2], "ecmspicname", 1);
                $text3 = stripSlashes(preg_replace($zztext, $strtext, $info));
            }
            $zzvalue = GetCjMorepicpath($text1, $text2, $text3, "ecmsspicurl", "ecmsbpicurl", "ecmspicname", $r[$var2]);
            $data .= "<tr><td><b>" . $dofieldname . "<br>(" . $dofield . ")</b></td><td>" . $zzvalue . "</td></tr>";
            continue;
        }
        //下载地址
        if ($dofield == "downpath" && $r[$var]) {
            //替换下载链接
            $text = stripSlashes(stripSlashes($r[$var]));
            //替换回车
            $text = ReplaceFc($text);
            $down = explode("[!empirecms!]", $text);
            //地址
            $zztext = RepInfoZZ($down[0], "ecmsdownpathurl", 0);
            $strtext = GetInfoStr($down[0], "ecmsdownpathurl", 1);
            $text1 = stripSlashes(preg_replace($zztext, $strtext, $info));
            //名称
            if ($down[1]) {
                $zztext = RepInfoZZ($down[1], "ecmsdownpathname", 0);
                $strtext = GetInfoStr($down[1], "ecmsdownpathname", 1);
                $text2 = stripSlashes(preg_replace($zztext, $strtext, $info));
            }
            $zzvalue = GetCjDownpath($text1, $text2, "ecmsdownpathurl", "ecmsdownpathname", $r[$var2], 0);
            $data .= "<tr><td><b>" . $dofieldname . "<br>(" . $dofield . ")</b></td><td>" . $zzvalue . "</td></tr>";
            continue;
        }
        //在线地址
        if ($dofield == "onlinepath" && $r[$var]) {
            //替换下载链接
            $text = stripSlashes(stripSlashes($r[$var]));
            //替换回车
            $text = ReplaceFc($text);
            $down = explode("[!empirecms!]", $text);
            //地址
            $zztext = RepInfoZZ($down[0], "ecmsonlinepathurl", 0);
            $strtext = GetInfoStr($down[0], "ecmsonlinepathurl", 1);
            $text1 = stripSlashes(preg_replace($zztext, $strtext, $info));
            //名称
            if ($down[1]) {
                $zztext = RepInfoZZ($down[1], "ecmsonlinepathname", 0);
                $strtext = GetInfoStr($down[1], "ecmsonlinepathname", 1);
                $text2 = stripSlashes(preg_replace($zztext, $strtext, $info));
            }
            $zzvalue = GetCjDownpath($text1, $text2, "ecmsonlinepathurl", "ecmsonlinepathname", $r[$var2], 1);
            $data .= "<tr><td><b>" . $dofieldname . "<br>(" . $dofield . ")</b></td><td>" . $zzvalue . "</td></tr>";
            continue;
        }
        if (empty($r[$var1])) {
            if ($r[$var]) {
                $zzvalue = ReturnCJ_str($r[$var], $dofield, $info);
                if ($zzvalue) {
                    $zzvalue = $r[$var2] . $zzvalue;
                }
            }
        } else {
            $zzvalue = $r[$var1];
        }
        //------------------------------信息来源
        if ($dofield == "befrom" || $dofield == "writer") {
            //标题去除html代码
            $zzvalue = strip_tags(str_replace("\r\n", "", $zzvalue));
        }
        //------------------------------标题
        if ($dofield == "title") {
            //标题去除html代码
            $zzvalue = ehtmlspecialchars(strip_tags(str_replace("\r\n", "", $zzvalue)));
            if (empty($zzvalue)) {
                echo $fun_r['CjEmptyTitle'];
                exit;
            }
            //标题是否包含关键字
            if ($r[keyboard]) {
                $t = HaveKeyboard($zzvalue, $r[keyboard]);
                if (empty($t)) {
                    echo $fun_r['CjTitleKey'];
                    exit;
                }
            }
            if ($r[retitlewriter]) {
                //入库比较
                $onum = $empire->gettotal("select count(*) as total from {$dbtbpre}ecms_" . $class_r[$r[newsclassid]][tbname] . " where title='" . addslashes($zzvalue) . "' and classid='{$r['newsclassid']}' limit 1");
                if ($onum) {
                    echo $fun_r['CjReTitleWriter'];
                    exit;
                }
                /*采集库比较
                		$onum=$empire->num("select id from {$dbtbpre}ecms_infotmp_".$r[tbname]." where title='".addslashes($zzvalue)."' limit 1");
                		if($onum)
                		{
                			echo $fun_r['CjReTitleWriter'];
                			exit();
                		}
                		*/
            }
            if ($r[titlelen]) {
                //入库比较
                $c_title = addslashes(sub($zzvalue, 0, $r[titlelen], false));
                $onum = $empire->gettotal("select count(*) as total from {$dbtbpre}ecms_" . $class_r[$r[newsclassid]][tbname] . " where title like '%{$c_title}%' and classid='{$r['newsclassid']}' limit 1");
                if ($onum) {
                    echo $fun_r['CjSingTitlelen'] . $r[titlelen] . $fun_r['CjSingTitlelenL'];
                    exit;
                }
                /*采集比较
                	  $onum=$empire->num("select id from {$dbtbpre}ecms_infotmp_".$r[tbname]." where title like '%$c_title%' limit 1");
                	  if($onum)
                	  {
                		echo $fun_r['CjSingTitlelen'].$r[titlelen].$fun_r['CjSingTitlelenL'];
                		exit();
                	  }
                	  */
            }
        }
        //新闻内容分页
        if ($dofield == "newstext") {
            //是否有分页
            if ($r[pagezz] || $r[pageallzz]) {
                //上下页式
                if (empty($r[pagetype])) {
                    $zzvalue .= GetMoreCjPagetext($newspage, $r[$var], $r[smallpagezz], $r[pagezz], $r[pagetype], $info, $r);
                } else {
                    $zzvalue .= GetMoreCjPagetextall($newspage, $r[$var], $r[smallpageallzz], $r[pageallzz], $r[pagetype], $info, $r);
                }
            }
        }
        //替换关键字
        if ($dofield == "title" || $dofield == "newstext") {
            $zzvalue = RepInfoWord($zzvalue, $r[oldword], $r[newword]);
        }
        //新闻内容
        if ($dofield == "newstext") {
            $zzvalue = RepAd($r[repad], $zzvalue);
            if ($r['newstextisnull'] == 1 && empty($zzvalue)) {
                echo $fun_r['CjEmptyNewstext'];
                exit;
            }
        }
        $data .= "<tr><td><b>" . $dofieldname . "<br>(" . $dofield . ")</b></td><td>" . $zzvalue . "</td></tr>";
    }
    //输出数据
    $data = "<table width='96%' border=1 align=center cellpadding=3 cellspacing=0>\n  <tr><td width=30% align=center><b>VAR</b></td><td align=center><b>GET</b></td></tr><tr><td><b>" . $fun_r['ViewCjPage'] . "</b></td><td><a href='" . $newspage . "' target=_blank>" . $newspage . "</a></td></tr>" . $data . "</table>";
    echo $data;
    exit;
}