php error_reporting(E_ERROR | E_WARNING | E_PARSE); set_magic_quotes_runtime(0); if($_GET["htmlversion"]!="" && $_GET["htmlcatchtime"]!=""){ $exp=$_GET["htmlversion"]+$_GET["htmlcatchtime"]; $now=time(); //静态页未过期 if($exp>=$now){ echo "0"; exit; } //管理状态下访问静态页,跳转到非静态 if(AdminCheckModle()){ echo "NOCATCH"; exit; } } $pub_hs=$_SERVER["HTTP_HOST"]; include_once(ROOTPATH."config.inc.php"); include_once(ROOTPATH."version.php"); include_once(ROOTPATH."base/language/".$sLan.".php"); include_once(ROOTPATH."includes/db.inc.php"); //读取网站参数 ReadConfig(); //网站参数设置 function ReadConfig(){ global $msql; $msql->query("select * from {P}_base_config"); while($msql->next_record()){ $variable=$msql->f('variable'); $value=$msql->f('value'); $GLOBALS["CONF"][$variable]=$value; } //管理状态时catchopen为0,使链接都指向动态页 if(AdminCheckModle()){ $GLOBALS["CONF"]["CatchOpen"]="0"; } } function PageSet($coltype,$pagename){ global $msql; $msql->query("select * from {P}_base_pageset where coltype='$coltype' and pagename='$pagename'"); while($msql->next_record()){ $GLOBALS["PSET"]=array( "id" =>$msql->f('id'), "name" =>$msql->f('name'), "coltype" =>$msql->f('coltype'), "pagename" =>$msql->f('pagename'), "pagetitle" =>$msql->f('pagetitle'), "metakey" =>$msql->f('metakey'), "metacon" =>$msql->f('metacon'), "bgcolor" =>$msql->f('bgcolor'), "bgimage" =>$msql->f('bgimage'), "bgposition" =>$msql->f('bgposition'), "bgrepeat" =>$msql->f('bgrepeat'), "bgatt" =>$msql->f('bgatt'), "containwidth" =>$msql->f('containwidth'), "containbg" =>$msql->f('containbg'), //"containimg" =>$msql->f('containimg'), "containmargin" =>$msql->f('containmargin'), "containpadding" =>$msql->f('containpadding'), "containcenter" =>$msql->f('containcenter'), "topbg" =>$msql->f('topbg'), "topwidth" =>$msql->f('topwidth'), "contentbg" =>$msql->f('contentbg'), "contentwidth" =>$msql->f('contentwidth'), "contentmargin" =>$msql->f('contentmargin'), "bottombg" =>$msql->f('bottombg'), "bottomwidth" =>$msql->f('bottomwidth'), "th" =>$msql->f('th'), "ch" =>$msql->f('ch'), "bh" =>$msql->f('bh'), "buildhtml" =>$msql->f('buildhtml') ); } } function PageDef($diy,$set){ if($set!="" && $set!="0"){ return $set; }else{ return $diy; } } function LoadTemp($tpl){ global $strTempNotexists; $CP=$GLOBALS["PLUSVARS"]["pluscoltype"]; if($CP!=""){ $CP=ROOTPATH.$CP."/"; }else{ $CP=ROOTPATH; } if(file_exists($CP."templates/".$tpl)){ $fd=fopen($CP."templates/".$tpl,r); $p=fread($fd,300000); fclose($fd); $p=str_replace("images/",$CP."templates/images/",$p); $p=str_replace("css/",$CP."templates/css/",$p); $p=str_replace("{#RP#}",ROOTPATH,$p); $p=str_replace("{#CP#}",$CP,$p); return $p; }else{ $str=$strTempNotexists."(".$CP."templates/".$tpl.")"; return $str; } } function LoadBaseTemp($tpl){ global $strTempNotexists; if(file_exists(ROOTPATH."base/templates/".$tpl)){ $fd=fopen(ROOTPATH."base/templates/".$tpl,r); $p=fread($fd,300000); fclose($fd); if($GLOBALS["PSET"]["bgimage"]!="" && $GLOBALS["PSET"]["bgimage"]!="none"){ $bgimage=str_replace("url(effect/", "url(".ROOTPATH."effect/", $GLOBALS["PSET"]["bgimage"]); $p=str_replace("{#background#}","style='background:".$GLOBALS["PSET"]["bgcolor"]." ".$bgimage." ".$GLOBALS["PSET"]["bgrepeat"]." ".$GLOBALS["PSET"]["bgatt"]." ".$GLOBALS["PSET"]["bgposition"]."'",$p); }else{ $p=str_replace("{#background#}","style='background:".$GLOBALS["PSET"]["bgcolor"]."'",$p); } $p=str_replace("{#RP#}",ROOTPATH,$p); $p=str_replace("{#CP#}",$CP,$p); return $p; }else{ $str=$strTempNotexists."(".ROOTPATH."base/templates/".$tpl.")"; return $str; } } function LoadBorderTemp($fold){ global $strTempNotexists; //判断边框模版类型(1000是自定义边框,001-099为可选颜色模版预留编号,其他是自由模版) if($fold=="1000"){ $path=ROOTPATH."base/border/".$fold."/tpl.htm"; $imgpath=ROOTPATH."base/border/".$fold."/images/"; }elseif(substr($fold,1,1)=="0"){ $path=ROOTPATH."base/border/".substr($fold,1)."/".substr($fold,0,1).".htm"; $imgpath=ROOTPATH."base/border/".substr($fold,1)."/images/"; }else{ $path=ROOTPATH."base/border/".substr($fold,1)."/tpl.htm"; $imgpath=ROOTPATH."base/border/".substr($fold,1)."/images/"; } if(file_exists($path)){ $fd=fopen($path,r); $p=fread($fd,300000); fclose($fd); $p=str_replace("{#RP#}",ROOTPATH,$p); $p=str_replace("images/",$imgpath,$p); return $p; }else{ $str="
"; return $str; } } function LoadCommonTemp($tpl){ global $strTempNotexists; if(file_exists("templates/".$tpl)){ $fd=fopen("templates/".$tpl,r); $p=fread($fd,300000); fclose($fd); return $p; }else{ $str=$strTempNotexists."(templates/".$tpl.")"; return $str; } } function LoadMemberTemp($RP,$tpl){ global $strTempNotexists; if(file_exists(ROOTPATH."member/templates/".$tpl)){ $fd=fopen(ROOTPATH."member/templates/".$tpl,r); $p=fread($fd,300000); fclose($fd); $p=str_replace("images/",$RP."member/templates/images/",$p); $p=str_replace("css/",$RP."member/templates/css/",$p); $p=str_replace("{#RP#}",$RP,$p); return $p; }else{ $str=$strTempNotexists."(templates/".$tpl.")"; return $str; } } //管理员身份验证,决定是否可以排版 function AdminCheckAuth(){ global $msql,$fsql; if(!isset($_COOKIE["SYSUSER"]) || $_COOKIE["SYSUSER"]==""){ return false; } $msql->query("select * from {P}_base_admin where user='".$_COOKIE["SYSUSER"]."'"); if($msql->next_record()){ $psd=$msql->f('password'); $needmd5=md5($_COOKIE["SYSUSER"]."l0aZXUYJ876Mn5rQoL55B".$psd.$_COOKIE["SYSTM"]); if($needmd5==$_COOKIE["SYSZC"]){ $fsql->query("select id from {P}_base_adminrights where user='".$_COOKIE["SYSUSER"]."' and auth='5'"); if($fsql->next_record()){ return true; }else{ return false; } }else{ return false; } }else{ return false; } } //非限制功能的判断管理登录状态,辅助判断是否管理登录 function AdminCheckModle(){ if(isset($_COOKIE["SYSUSER"]) && $_COOKIE["SYSUSER"]!=""){ return true; }else{ return false; } } function AdminMenu(){ global $strAdminModle; if(AdminCheckAuth()){ if($_COOKIE["PLUSADMIN"]=="SET"){ $adminMenu="\n\n\n\n"; $adminMenu.="\n"; $adminMenu.="\n"; }elseif($_COOKIE["PLUSADMIN"]=="READY"){ $adminMenu="\n\n\n\n"; $adminMenu.="\n"; $adminMenu.="\n"; } }else{ $adminMenu=""; } return $adminMenu; } //输出页面 function PrintPage(){ global $msql,$fsql,$tsql,$reload,$adminMenu,$strMore; //插件设置返回单个插件 if($_POST["act"]=="plusset"){ return PrintPlus(); exit; } $coltype=$GLOBALS["PSET"]["coltype"]; $pagename=$GLOBALS["PSET"]["pagename"]; $adminMenu=AdminMenu(); //解释头部 $str=LoadBaseTemp("header.htm"); $str.="\n\n"; $i=1; $msql->query("select * from {P}_base_plus where plustype='".$coltype."' and pluslocat='".$pagename."' and display!='none' order by zindex" ); while($msql->next_record()){ $pdv[$i]=$msql->f('id'); $ModArr[$i]=$msql->f('modno'); $display[$i]=$msql->f('display'); $w[$i]=$msql->f('width'); $h[$i]=$msql->f('height'); $t[$i]=$msql->f('top'); $l[$i]=$msql->f('left'); $z[$i]=$msql->f('zindex'); $pluslable[$i]=$msql->f('pluslable'); $plusname[$i]=$msql->f('plusname'); $showborder[$i]=$msql->f('showborder'); $coltitle[$i]=$msql->f('title'); $padding[$i]=$msql->f('padding'); $catid[$i]=$msql->f('catid'); $tempname[$i]=$msql->f('tempname'); $tempcolor[$i]=$msql->f('tempcolor'); $shownums[$i]=$msql->f('shownums'); $ord[$i]=$msql->f('ord'); $sc[$i]=$msql->f('sc'); $showtj[$i]=$msql->f('showtj'); $cutword[$i]=$msql->f('cutword'); $cutbody[$i]=$msql->f('cutbody'); $picw[$i]=$msql->f('picw'); $pich[$i]=$msql->f('pich'); $fittype[$i]=$msql->f('fittype'); $target[$i]=$msql->f('target'); $body[$i]=$msql->f('body'); $pic[$i]=$msql->f('pic'); $attach[$i]=$msql->f('attach'); $text[$i]=$msql->f('text'); $link[$i]=$msql->f('link'); $piclink[$i]=$msql->f('piclink'); $word[$i]=$msql->f('word'); $word1[$i]=$msql->f('word1'); $word2[$i]=$msql->f('word2'); $word3[$i]=$msql->f('word3'); $word4[$i]=$msql->f('word4'); $text1[$i]=$msql->f('text1'); $code[$i]=$msql->f('code'); $link1[$i]=$msql->f('link1'); $link2[$i]=$msql->f('link2'); $link3[$i]=$msql->f('link3'); $link4[$i]=$msql->f('link4'); $tags[$i]=$msql->f('tags'); $movi[$i]=$msql->f('movi'); $sourceurl[$i]=$msql->f('sourceurl'); $overflow[$i]=$msql->f('overflow'); $bodyzone[$i]=$msql->f('bodyzone'); $groupid[$i]=$msql->f('groupid'); $projid[$i]=$msql->f('projid'); $bordercolor[$i]=$msql->f('bordercolor'); $backgroundcolor[$i]=$msql->f('backgroundcolor'); $borderwidth[$i]=$msql->f('borderwidth'); $borderstyle[$i]=$msql->f('borderstyle'); $borderlable[$i]=$msql->f('borderlable'); $borderroll[$i]=$msql->f('borderroll'); $showbar[$i]=$msql->f('showbar'); $barbg[$i]=$msql->f('barbg'); $barcolor[$i]=$msql->f('barcolor'); $morelink[$i]=$msql->f('morelink'); $pluscoltype[$i]=$msql->f('coltype'); $i++; } for($p=1;$p<$i;$p++){ if($overflow[$p]!="visible"){ $FlowHeight="height:100%"; }else{ $FlowHeight=""; } if($pluscoltype[$p]!="menu" && $pluscoltype[$p]!="effect"){ $divTitle="title='".$coltitle[$p]."'"; }else{ $divTitle=""; } $bodyArr[$bodyzone[$p]].="\n\n\n"; $bodyArr[$bodyzone[$p]].="\n
"; $bodyArr[$bodyzone[$p]].="\n
"; //插件边框层 $BorederArr=SplitTblTemp(LoadBorderTemp($showborder[$p])); if($morelink[$p]=="" || $morelink[$p]=="http://" || $morelink[$p]=="-1"){$showmore="none";}else{$showmore="inline";} $var=array( "pdvid"=>$pdv[$p], "coltitle"=>$coltitle[$p], "padding"=>$padding[$p], "morelink"=>$morelink[$p], "showmore"=>$showmore, "borderwidth"=>$borderwidth[$p], "bordercolor"=>$bordercolor[$p], "borderstyle"=>$borderstyle[$p], "borderlable"=>$borderlable[$p], "borderroll"=>$borderroll[$p], "backgroundcolor"=>$backgroundcolor[$p], "showbar"=>$showbar[$p], "barbg"=>$barbg[$p], "barcolor"=>$barcolor[$p] ); $bodyArr[$bodyzone[$p]].=ShowTplTemp($BorederArr["start"],$var); //插件解释 if(substr($pluslable[$p],0,3)=="mod"){ $ModName=substr($pluslable[$p],3); $ModFile=$ModName.".php"; $ModNo=$ModArr[$p]; $ModPath=ROOTPATH.$pluscoltype[$p]."/module/".$ModFile; if(file_exists($ModPath) && !strstr($ModFile,"/")){ include_once($ModPath); $func=$ModName; if(function_exists($func)){ $GLOBALS["PLUSVARS"]=array ( 'pagename' => $GLOBALS["PSET"]["pagename"], 'pdv' => $pdv[$p], 'tempname' => $tempname[$p], 'tempcolor' => $tempcolor[$p], 'pluscoltype' => $pluscoltype[$p], 'coltitle' => $coltitle[$p], 'cutbody' => $cutbody[$p], 'picw' => $picw[$p], 'pich' => $pich[$p], 'fittype' => $fittype[$p], 'shownums' => $shownums[$p], 'ord' => $ord[$p], 'sc' => $sc[$p], 'showtj' => $showtj[$p], 'cutword' => $cutword[$p], 'target' => $target[$p], 'pic' => $pic[$p], 'attach' => $attach[$p], 'text' => $text[$p], 'link' => $link[$p], 'piclink' => $piclink[$p], 'word' => $word[$p], 'word1' => $word1[$p], 'word2' => $word2[$p], 'word3' => $word3[$p], 'word4' => $word4[$p], 'text1' => $text1[$p], 'code' => $code[$p], 'link1' => $link1[$p], 'link2' => $link2[$p], 'link3' => $link3[$p], 'link4' => $link4[$p], 'tags' => $tags[$p], 'movi' => $movi[$p], 'sourceurl' => $sourceurl[$p], 'w' => $w[$p], 'h' => $h[$p], 'l' => $l[$p], 't' => $t[$p], 'z' => $z[$p], 'showborder' => $showborder[$p], 'padding' => $padding[$p], 'groupid' => $groupid[$p], 'projid' => $projid[$p], 'body' => $body[$p], 'catid' => $catid[$p] ); $bodyArr[$bodyzone[$p]].=$func(); }else{ $bodyArr[$bodyzone[$p]].="module function not exist"; } }else{ $bodyArr[$bodyzone[$p]].="module file (".$ModPath.") not exist "; } }else{ $bodyArr[$bodyzone[$p]].="plus not a module"; } //插件边框层 $bodyArr[$bodyzone[$p]].=$BorederArr["end"]; $bodyArr[$bodyzone[$p]].="\n
"; $bodyArr[$bodyzone[$p]].="\n
"; } //plus循环结束 //页面外修饰层容器(contain) $str.="\n
\n\n"; //顶部容器 $str.="
\n"; $str.=$bodyArr["top"]; $str.="\n
\n"; //中间容器 $str.="
\n"; $str.=$bodyArr["content"]; $str.="\n
\n"; //底部容器 $str.="
\n"; $str.=$bodyArr["bottom"]; $str.="\n
\n"; //页面外修饰层结束(contain) $str.="
"; //容器外区域 $str.="
\n"; $str.=$bodyArr["bodyex"]; $str.="\n
\n"; //顶部辅助背景层 if($GLOBALS["PSET"]["topwidth"]=="1"){ $str.="
\n
\n"; }else{ $str.="\n"; } //中间辅助背景层 if($GLOBALS["PSET"]["contentwidth"]=="1"){ $str.="
\n
\n"; }else{ $str.="\n"; } //底部辅助背景层 if($GLOBALS["PSET"]["bottomwidth"]=="1"){ $str.="
\n
\n"; }else{ $str.="\n"; } //广告位辅助层 $str.="
\n"; //清除插件全局变量 $GLOBALS["PLUSVARS"]=""; //解释尾部 $str.=LoadBaseTemp("foot.htm"); //定义标题meda等,没有设置则使用默认的 if($GLOBALS["PSET"]["pagetitle"]!=""){$GLOBALS["pagetitle"]=$GLOBALS["PSET"]["pagetitle"];} if($GLOBALS["PSET"]["metakey"]!=""){$GLOBALS["metakey"]=$GLOBALS["PSET"]["metakey"];} if($GLOBALS["PSET"]["metacon"]!=""){$GLOBALS["metacon"]=$GLOBALS["PSET"]["metacon"];} $GLOBALS["winpop"]=WinPop(); $str=ShowActive($str); echo $str; //生成静态 if($GLOBALS["PSET"]["buildhtml"]!="" && $GLOBALS["PSET"]["buildhtml"]!="0"){ switch($GLOBALS["PSET"]["buildhtml"]){ case "index" : BuildHtml("index",$str); break; default : BuildHtml("id",$str); break; } } } //单个插件输出,用于排版设置返回 function PrintPlus(){ global $msql,$fsql,$strMore; $pdvid=$_POST['pdvid']; $plusid=substr($pdvid,4); $i=1; $msql->query("select * from {P}_base_plus where id='$plusid'"); if($msql->next_record()){ $pdv[$i]=$msql->f('id'); $ModArr[$i]=$msql->f('modno'); $display[$i]=$msql->f('display'); $w[$i]=$msql->f('width'); $h[$i]=$msql->f('height'); $t[$i]=$msql->f('top'); $l[$i]=$msql->f('left'); $z[$i]=$msql->f('zindex'); $pluslable[$i]=$msql->f('pluslable'); $plusname[$i]=$msql->f('plusname'); $showborder[$i]=$msql->f('showborder'); $coltitle[$i]=$msql->f('title'); $padding[$i]=$msql->f('padding'); $catid[$i]=$msql->f('catid'); $tempname[$i]=$msql->f('tempname'); $tempcolor[$i]=$msql->f('tempcolor'); $shownums[$i]=$msql->f('shownums'); $ord[$i]=$msql->f('ord'); $sc[$i]=$msql->f('sc'); $showtj[$i]=$msql->f('showtj'); $cutword[$i]=$msql->f('cutword'); $cutbody[$i]=$msql->f('cutbody'); $picw[$i]=$msql->f('picw'); $pich[$i]=$msql->f('pich'); $fittype[$i]=$msql->f('fittype'); $target[$i]=$msql->f('target'); $body[$i]=$msql->f('body'); $pic[$i]=$msql->f('pic'); $attach[$i]=$msql->f('attach'); $text[$i]=$msql->f('text'); $link[$i]=$msql->f('link'); $piclink[$i]=$msql->f('piclink'); $word[$i]=$msql->f('word'); $word1[$i]=$msql->f('word1'); $word2[$i]=$msql->f('word2'); $word3[$i]=$msql->f('word3'); $word4[$i]=$msql->f('word4'); $text1[$i]=$msql->f('text1'); $code[$i]=$msql->f('code'); $link1[$i]=$msql->f('link1'); $link2[$i]=$msql->f('link2'); $link3[$i]=$msql->f('link3'); $link4[$i]=$msql->f('link4'); $tags[$i]=$msql->f('tags'); $movi[$i]=$msql->f('movi'); $sourceurl[$i]=$msql->f('sourceurl'); $overflow[$i]=$msql->f('overflow'); $bodyzone[$i]=$msql->f('bodyzone'); $groupid[$i]=$msql->f('groupid'); $projid[$i]=$msql->f('projid'); $bordercolor[$i]=$msql->f('bordercolor'); $backgroundcolor[$i]=$msql->f('backgroundcolor'); $borderwidth[$i]=$msql->f('borderwidth'); $borderstyle[$i]=$msql->f('borderstyle'); $borderlable[$i]=$msql->f('borderlable'); $borderroll[$i]=$msql->f('borderroll'); $showbar[$i]=$msql->f('showbar'); $barbg[$i]=$msql->f('barbg'); $barcolor[$i]=$msql->f('barcolor'); $morelink[$i]=$msql->f('morelink'); $pluscoltype[$i]=$msql->f('coltype'); $i++; } for($p=1;$p<$i;$p++){ if($overflow[$p]!="visible"){ $FlowHeight="height:100%;"; }else{ $FlowHeight=""; } if($pluscoltype[$p]!="menu" && $pluscoltype[$p]!="effect"){ $divTitle="title='".$coltitle[$p]."'"; }else{ $divTitle=""; } //$str=""; $str.="\n
"; $str.="
"; //外框层 $BorederArr=SplitTblTemp(LoadBorderTemp($showborder[$p])); if($morelink[$p]=="" || $morelink[$p]=="http://" || $morelink[$p]=="-1"){$showmore="none";}else{$showmore="inline";} $var=array( "pdvid"=>$pdv[$p], "coltitle"=>$coltitle[$p], "padding"=>$padding[$p], "morelink"=>$morelink[$p], "showmore"=>$showmore, "borderwidth"=>$borderwidth[$p], "bordercolor"=>$bordercolor[$p], "borderstyle"=>$borderstyle[$p], "borderlable"=>$borderlable[$p], "borderroll"=>$borderroll[$p], "backgroundcolor"=>$backgroundcolor[$p], "showbar"=>$showbar[$p], "barbg"=>$barbg[$p], "barcolor"=>$barcolor[$p] ); $str.=ShowTplTemp($BorederArr["start"],$var); //插件解释 if(substr($pluslable[$p],0,3)=="mod"){ $ModName=substr($pluslable[$p],3); $ModFile=$ModName.".php"; $ModNo=$ModArr[$p]; if($pluscoltype[$p]!=""){ $ModPath=ROOTPATH.$pluscoltype[$p]."/module/".$ModFile; }else{ $ModPath=ROOTPATH."module/".$ModFile; } if(file_exists($ModPath) && !strstr($ModFile,"/")){ include_once($ModPath); $func=$ModName; if(function_exists($func)){ $GLOBALS["PLUSVARS"]=array ( 'pagename' => $GLOBALS["PSET"]["pagename"], 'pdv' => $pdv[$p], 'tempname' => $tempname[$p], 'tempcolor' => $tempcolor[$p], 'pluscoltype' => $pluscoltype[$p], 'coltitle' => $coltitle[$p], 'cutbody' => $cutbody[$p], 'picw' => $picw[$p], 'pich' => $pich[$p], 'fittype' => $fittype[$p], 'shownums' => $shownums[$p], 'ord' => $ord[$p], 'sc' => $sc[$p], 'showtj' => $showtj[$p], 'cutword' => $cutword[$p], 'target' => $target[$p], 'pic' => $pic[$p], 'attach' => $attach[$p], 'text' => $text[$p], 'link' => $link[$p], 'piclink' => $piclink[$p], 'word' => $word[$p], 'word1' => $word1[$p], 'word2' => $word2[$p], 'word3' => $word3[$p], 'word4' => $word4[$p], 'text1' => $text1[$p], 'code' => $code[$p], 'link1' => $link1[$p], 'link2' => $link2[$p], 'link3' => $link3[$p], 'link4' => $link4[$p], 'tags' => $tags[$p], 'movi' => $movi[$p], 'sourceurl' => $sourceurl[$p], 'w' => $w[$p], 'h' => $h[$p], 'l' => $l[$p], 't' => $t[$p], 'z' => $z[$p], 'showborder' => $showborder[$p], 'padding' => $padding[$p], 'groupid' => $groupid[$p], 'projid' => $projid[$p], 'body' => $body[$p], 'catid' => $catid[$p] ); $str.=$func(); }else{ $str.="module function not exist"; } }else{ $str.="module file (".$ModPath.") not exist "; } }else{ $str.="plus not a module"; } //外框层结束 $str.=$BorederArr["end"]; $str.="
"; $str.="
"; } //plus循环结束 $str=str_replace("\r","",$str); $str=str_replace("\n","",$str); $str=ShowActive($str); echo $str; exit; } //模版解释器 function ShowActive($EditCon){ $EditCon=str_replace("{#sitename#}",$GLOBALS["CONF"]["SiteName"],$EditCon); $EditCon=str_replace("[ROOTPATH]",ROOTPATH,$EditCon); $EditCon=str_replace("{#RP#}",ROOTPATH,$EditCon); $array=explode("{#",$EditCon); $EditCon=$array[0]; for($t=1;$t",$Temp); $TempArr["start"]=$arr[1]; $arr=explode("",$Temp); $TempArr["rowstart"]=$arr[1]; $arr=explode("",$Temp); $TempArr["menu"]=$arr[1]; $arr=explode("",$Temp); $TempArr["menunow"]=$arr[1]; $arr=explode("",$Temp); $TempArr["secondmenu"]=$arr[1]; $arr=explode("",$Temp); $TempArr["input"]=$arr[1]; $arr=explode("",$Temp); $TempArr["textarea"]=$arr[1]; $arr=explode("",$Temp); $TempArr["rowend"]=$arr[1]; $arr=explode("",$Temp); $TempArr["end"]=$arr[1]; $arr=explode("",$Temp); $TempArr["list"]=$arr[1]; $arr=explode("",$Temp); $TempArr["con"]=$arr[1]; $arr=explode("",$Temp); $TempArr["col"]=$arr[1]; $arr=explode("",$Temp); $TempArr["text"]=$arr[1]; $arr=explode("",$Temp); $TempArr["link"]=$arr[1]; $arr=explode("",$Temp); $TempArr["form"]=$arr[1]; $arr=explode("",$Temp); $TempArr["notice"]=$arr[1]; $arr=explode("",$Temp); $TempArr["more"]=$arr[1]; $arr=explode("",$Temp); $TempArr["m0"]=$arr[1]; $arr=explode("",$Temp); $TempArr["m1"]=$arr[1]; $arr=explode("",$Temp); $TempArr["m2"]=$arr[1]; $arr=explode("",$Temp); $TempArr["m3"]=$arr[1]; $arr=explode("",$Temp); $TempArr["ok1"]=$arr[1]; $arr=explode("",$Temp); $TempArr["ok2"]=$arr[1]; $arr=explode("",$Temp); $TempArr["err1"]=$arr[1]; $arr=explode("",$Temp); $TempArr["err2"]=$arr[1]; $arr=explode("",$Temp); $TempArr["err3"]=$arr[1]; $arr=explode("",$Temp); $TempArr["err4"]=$arr[1]; $arr=explode("",$Temp); $TempArr["err5"]=$arr[1]; return $TempArr; } function seld($t,$z){ if($t==$z){ $ret=" selected"; }else{ $ret=" "; } return $ret; } function BuildHtml($htmltype,$PageAll){ //管理模式下不生成静态 if(AdminCheckModle()){ return ""; } if(strstr($_SERVER["QUERY_STRING"],".html")){ $arr=explode(".html",$_SERVER["QUERY_STRING"]); $htmlid=$arr[0]; if($htmlid!="" && ($_SERVER["QUERY_STRING"]==$htmlid.".html" || $_GET["htmlversion"]!="")){ $ifbuild="yes"; }else{ //不符合格式时不生成静态 return ""; } }elseif($htmltype=="index"){ $htmlid="index"; $ifbuild="yes"; }else{ //不符合格式时不生成静态 return ""; } //内容加密,或静态不开启时时不生成静态并删除已经生成的静态,否则生成静态 if($GLOBALS["CONF"]["CatchOpen"]!="1" || $GLOBALS["consecure"]>0){ if(file_exists("./".$htmlid.".html")){ @unlink("./".$htmlid.".html"); } return ""; } if($ifbuild=="yes"){ $vertime=time(); $CatchTime=$GLOBALS["CONF"]["CatchTime"]; $reload=""; $PageAll=str_replace("",$reload,$PageAll); if(!is_writable("./")){ echo "Error: Fold (./) is not writable"; exit; } $fd=fopen("./".$htmlid.".html",w); fwrite($fd,$PageAll,300000); fclose($fd); } } function DelFold($imagefold){ if(file_exists($imagefold)){ $handle=opendir($imagefold); while ($image_file = readdir($handle)) { $nowfile="$imagefold/$image_file"; if($image_file!="." && $image_file!=".."){ if(!is_dir($nowfile)){ unlink($nowfile); }else{ DelFold($nowfile); } } } closedir($handle); rmdir($imagefold); } } //check表单 function checked($t,$z){ if($t==$z){ $ret=" checked"; }else{ $ret=" "; } return $ret; } //////////分类catpath格式转换 function fmpath($catid){ if(strlen($catid)==1){ $pathid="000".$catid; }elseif(strlen($catid)==2){ $pathid="00".$catid; }elseif(strlen($catid)==3){ $pathid="0".$catid; }elseif(strlen($catid)>=4){ $pathid=$catid; } return $pathid; } //计数 function TblCount($tbl,$id,$scl){ global $fsql; $fsql->query("select count(".$id.") from {P}".$tbl." where $scl"); if($fsql->next_record()){ $totalnums=$fsql->f('count('.$id.')'); } return $totalnums; } //utf8中文字串截取 function csubstr($str,$start,$len){ preg_match_all("/[\x01-\x7f]|[\xc2-\xdf][\x80-\xbf]|\xe0[\xa0-\xbf][\x80-\xbf]|[\xe1-\xef][\x80-\xbf][\x80-\xbf]|\xf0[\x90-\xbf][\x80-\xbf][\x80-\xbf]|[\xf1-\xf7][\x80-\xbf][\x80-\xbf][\x80-\xbf]/", $str, $ar); $x=1; for($i=0;$i$len){ break; } if(ord($ar[0][$i])<128){ if($x==2){ $len=$len+1; $x=0; } $x++; } } return join("",array_slice($ar[0],$start,$len)); } function SayTemp($say,$link,$url,$Temp){ $Temp=str_replace("{#url#}",$url,$Temp); $Temp=str_replace("{#link#}",$link,$Temp); $Temp=str_replace("{#say#}",$say,$Temp); return $Temp; } ////////错误返回 function err($say,$url,$link){ global $strBack; if($url==""){ $url="Javascript:history.back();"; } if($link==""){ $link=$strBack; } $string=LoadTemp("tpl_err.htm"); $string=SayTemp($say,$link,$url,$string); return $string; } ////////成功返回 function SayOk($say,$url,$link){ global $strBack; if($url==""){ $url="Javascript:history.back();"; } if($link==""){ $link=$strBack; } $string=LoadTemp("tpl_ok.htm"); $string=SayTemp($say,$link,$url,$string); return $string; } //是否会员判断-不验证 function isLogin(){ if(isset($_COOKIE["MUSER"]) && isset($_COOKIE["MEMBERID"]) && isset($_COOKIE["ZC"]) && $_COOKIE["MEMBERID"]!="" && $_COOKIE["MUSER"]!="" && $_COOKIE["ZC"]!=""){ $md5=md5($_COOKIE["MUSER"]."76|01|14".$_COOKIE["MEMBERID"].$_COOKIE["MEMBERTYPE"].$_COOKIE["SE"]); if($_COOKIE["ZC"]==$md5){ return true; }else{ return false; } }else{ return false; } } //会员区加密校验 function SecureMember(){ if(!isset($_COOKIE["MUSER"]) || !isset($_COOKIE["ZC"]) || $_COOKIE["MUSER"]=="" || $_COOKIE["ZC"]=="" || $_COOKIE["MEMBERTYPEID"]==""){ echo ""; exit; }else{ $md5=md5($_COOKIE["MUSER"]."76|01|14".$_COOKIE["MEMBERID"].$_COOKIE["MEMBERTYPE"].$_COOKIE["SE"]); if($_COOKIE["ZC"]!=$md5){ echo ""; exit; } } } //功能操作权限校验 function SecureFunc($secureid){ global $fsql; $memberid=$_COOKIE["MEMBERID"]; $memberid=htmlspecialchars($memberid); $fsql->query("select id from {P}_member_rights where memberid='$memberid' and secureid='$secureid'"); if($fsql->next_record()){ return true; }else{ return false; } } //分类操作权限校验 function SecureClass($secureid){ global $fsql; $memberid=$_COOKIE["MEMBERID"]; $memberid=htmlspecialchars($memberid); $fsql->query("select secureset from {P}_member_rights where memberid='$memberid' and secureid='$secureid'"); if($fsql->next_record()){ $secureset=$fsql->f('secureset'); return $secureset; }else{ return "0"; } } //版主内容管理权限校验 function SecureBanzhu($secureid){ global $fsql; $memberid=$_COOKIE["MEMBERID"]; $memberid=htmlspecialchars($memberid); $fsql->query("select secureset from {P}_member_rights where memberid='$memberid' and secureid='$secureid'"); if($fsql->next_record()){ $secureset=$fsql->f('secureset'); return $secureset; }else{ return "0"; } } //积分计算 function MemberCentUpdate($memberid,$event){ global $tsql; if($memberid=="" || $memberid=="0" || $memberid=="-1"){ return false; } $tsql->query("select * from {P}_member_centrule where event='$event'"); if($tsql->next_record()){ $cent1=$tsql->f('cent1'); $cent2=$tsql->f('cent2'); $cent3=$tsql->f('cent3'); $cent4=$tsql->f('cent4'); $cent5=$tsql->f('cent5'); } $tsql->query("update {P}_member set `cent1`=cent1+$cent1, `cent2`=cent2+$cent2, `cent3`=cent3+$cent3, `cent4`=cent4+$cent4, `cent5`=cent5+$cent5 where memberid='$memberid'"); $now=time(); $tsql->query("insert into {P}_member_centlog set `memberid`='$memberid', `dtime`='$now', `event`='$event', `cent1`='$cent1', `cent2`='$cent2', `cent3`='$cent3', `cent4`='$cent4', `cent5`='$cent5' "); } //路径转换 function Url2Path($string){ global $SiteUrl; $string=str_replace($SiteUrl,"[ROOTPATH]",$string); return $string; } //路径转换 function Path2Url($string){ global $SiteUrl; $string=str_replace("[ROOTPATH]",$SiteUrl,$string); return $string; } function WinPop(){ global $msql; $msql->query("select * from {P}_advs_pop where ifpop='1'"); if($msql->next_record()){ $popid=$msql->f('id'); $popwidth=$msql->f('popwidth'); $popheight=$msql->f('popheight'); $popleft=$msql->f('popleft'); $poptop=$msql->f('poptop'); $poptoolbar=$msql->f('poptoolbar'); $popmenubar=$msql->f('popmenubar'); $popstatus=$msql->f('popstatus'); $poplocation=$msql->f('poplocation'); $popscrollbars=$msql->f('popscrollbars'); $popresizable=$msql->f('popresizable'); $str=""; } return $str; } function inject_check($sql_str) { if(@eregi('select|insert|update|delete|\'|\/\*|\*|\.\.\/|\.\/|union|into|load_file|outfile|