<?php 

// 当文件写入时，syscode，temp_index
// 1 $ls_canonical

$writeurl2=str_replace("192.168.2.20","",$http.$writeurl);
$writeurl=str_replace("192.168.2.20","",$writeurl);
$writefilesql="select * from ls_writefiles where 1 ";
$writefile_query=$opendb->query($writefilesql);
$writefileall=mysqli_num_rows($writefile_query); //总类数 
$noSitemap="sendmail,select,search,test.html,download";
$arrnoSitemap=explode(",",$noSitemap);
$flag=true;
foreach($arrnoSitemap as $e) {
	if(!(strpos($writeurl,$e)===false)){
	//echo $writeurl."---".$e."<br>";
	$flag=false;break;}}

$Num=$writefileall+1;

if(!$writeimportent  && strpos($myindexpath,"product")===false && strpos($myindexpath,"new")===false  && strpos($myindexpath,"blog")===false  && strpos($myindexpath,"faq")===false  && strpos($myindexpath,"cate")===false ){$priority=0.64;$changefreq="monthly";}else{$priority=0.81;$changefreq="weekly";}

if(!strpos($myindexpath,"download")===false){$priority=0.51;$changefreq="monthly";}

$createtime=date('Y-m-d H:i:s');
$lastmod=$createtime;
 
$writefilesql="select * from ls_writefiles where url like '%".$writeurl."%' ";
$writefile_query=$opendb->query($writefilesql);
$writefile_rows=mysqli_fetch_assoc($writefile_query);

$myindexpath= $index_newspath!=""?$index_newspath:($index_path==""?$index_path2:$index_path);

$fromtable=(!(strpos($myindexpath,"product")===false ) || !(strpos($myindexpath,"catedetail")===false ) || !(strpos($myindexpath,"prolist")===false ))
? "ls_products":(!(strpos($myindexpath,"new")===false )? "ls_news":(!(strpos($myindexpath,"blog")===false )? "ls_article":($fromtable)));

$fromtable=!(strpos($myindexpath,"workshop")===false )? "ls_workshop":(!(strpos($myindexpath,"certificate")===false )? "ls_certificate":(!(strpos($myindexpath,"management")===false )? "ls_management":(!(strpos($myindexpath,"video")===false )? "ls_video":($fromtable))));  

$fromlineid= $products_rows['ID']!=""?$products_rows['ID']:( $news_rows['ID']!=""?$news_rows['ID']:($classpro_rows['ID']!=""?$classpro_rows['ID']:($fromlineid))); 

//echo $myindexpath."-1-".$index_path."-2-".$index_path2;
 
if( $flag){			
if($writefile_rows==0){
	$writefilesql="insert into ls_writefiles(url , createtime, lastmod, priority, changefreq, Num,fromtable,fromlineid) values ('".$writeurl2."','".$createtime."','".$lastmod."','".$priority."','".$changefreq."','".$Num."','".$fromtable."','".($fromlineid==""?0:$fromlineid)."')";
}else{	$writefilesql="update ls_writefiles set lastmod='".$lastmod."' ,  url='".$writeurl2."'  where url='".$writeurl."' ";}
	$writefile_query=$opendb->query($writefilesql);
	//echo $writefilesql."======= ok<br/>";
	//echo "====".$writeurl2;
}
//下载需要登陆
if($downloadLogin) $content=str_replace("download.html","download_download.php",$content);  
$content=strippattern($content); //删除注释
$procontent = strippattern($procontent); //删除注释

$procontent = str_replace("</translate>","",$procontent); //删除翻译tag, 原来的在线即时翻译无法使用 
$procontent = str_replace("<translate>","",$procontent);
$content = str_replace("</translate>","",$content); //删除翻译tag 
$content = str_replace("<translate>","",$content);





?>