📄 connect.php
字号:
{
return '';
}
$value=str_replace(array("\r\n","<br />","<br>"," ","[!--empirenews.page--]","[/!--empirenews.page--]"),array("","\r\n","\r\n"," ","",""),$value);
$value=strip_tags($value);
if($len)
{
$value=sub($value,0,$len,false);
}
$value=trim($value,"\r\n");
return $value;
}
//返回不生成html的栏目
function ReturnNreInfoWhere(){
global $public_r;
if(empty($public_r['nreinfo'])||$public_r['nreinfo']==',')
{
return '';
}
$cids='';
$r=explode(',',$public_r['nreinfo']);
$count=count($r);
for($i=1;$i<$count-1;$i++)
{
$dh=',';
if($i==1)
{
$dh='';
}
$cids.=$dh.$r[$i];
}
$where=' and classid not in ('.$cids.')';
return $where;
}
//返回标签不调用栏目
function ReturnNottoBqWhere(){
global $public_r;
if(empty($public_r['nottobq'])||$public_r['nottobq']==',')
{
return '';
}
$cids='';
$r=explode(',',$public_r['nottobq']);
$count=count($r);
for($i=1;$i<$count-1;$i++)
{
$dh=',';
if($i==1)
{
$dh='';
}
$cids.=$dh.$r[$i];
}
$where=' and classid not in ('.$cids.')';
return $where;
}
//返回文件名及扩展名
function ReturnCFiletype($file){
$r=explode('.',$file);
$count=count($r)-1;
$re['filetype']=$r[$count];
$re['filename']=substr($file,0,strlen($file)-strlen($re['filetype'])-1);
return $re;
}
//返回栏目目录
function ReturnSaveClassPath($classid,$f=0){
global $class_r;
$classpath=$class_r[$classid][classpath];
if($f==1){
$classpath.="/index".$class_r[$classid][classtype];
}
return $classpath;
}
//返回专题目录
function ReturnSaveZtPath($classid,$f=0){
global $class_zr;
$classpath=$class_zr[$classid][ztpath];
if($f==1){
$classpath.="/index".$class_zr[$classid][zttype];
}
return $classpath;
}
//返回首页文件
function ReturnSaveIndexFile(){
global $public_r;
$file="index".$public_r[indextype];
return $file;
}
//返回内容页存放目录
function ReturnSaveInfoPath($classid,$id){
global $class_r;
if($class_r[$classid][ipath]==''){
$path=$class_r[$classid][classpath].'/';
}
else{
$path=$class_r[$classid][ipath]=='/'?'':$class_r[$classid][ipath].'/';
}
return $path;
}
//格式化信息目录
function FormatPath($classid,$mynewspath,$enews=0){
global $class_r,$addgethtmlpath;
if($enews){
$newspath=$mynewspath;
}
else{
$newspath=date($class_r[$classid][newspath]);
}
if(empty($newspath)){
return "";
}
$path=$addgethtmlpath."../../".ReturnSaveInfoPath($classid,$id);
$returnpath="";
$r=explode("/",$newspath);
$count=count($r);
for($i=0;$i<$count;$i++){
if($i>0){
$returnpath.="/".$r[$i];
}
else{
$returnpath.=$r[$i];
}
$createpath=$path.$returnpath;
$mk=DoMkdir($createpath);
if(empty($mk)){
printerror("CreatePathFail","");
}
}
return $returnpath;
}
//返回内容页目录
function ReturnInfoSPath($filename){
return str_replace('/index','',$filename);
}
//返回附件目录
function ReturnFileSavePath($classid,$fpath=''){
global $public_r,$class_r;
$fpath=$fpath||strstr(','.$fpath.',',',0,')?$fpath:$public_r['fpath'];
if($fpath==1)//p目录
{
$r['filepath']='d/file/p/';
$r['fileurl']=$public_r['fileurl'].'p/';
}
elseif($fpath==2)//file目录
{
$r['filepath']='d/file/';
$r['fileurl']=$public_r['fileurl'];
}
else
{
if(empty($classid))
{
$r['filepath']='d/file/p/';
$r['fileurl']=$public_r['fileurl'].'p/';
}
else
{
$r['filepath']='d/file/'.$class_r[$classid][classpath].'/';
$r['fileurl']=$public_r['fileurl'].$class_r[$classid][classpath].'/';
}
}
return $r;
}
//格式化附件目录
function FormatFilePath($classid,$mynewspath,$enews=0){
global $public_r,$addgethtmlpath;
if($enews)
{
$newspath=$mynewspath;
}
else
{
$newspath=date($public_r['filepath']);
}
if(empty($newspath))
{
return "";
}
$fspath=ReturnFileSavePath($classid);
$path=$addgethtmlpath."../../".$fspath['filepath'];
$returnpath="";
$r=explode("/",$newspath);
$count=count($r);
for($i=0;$i<$count;$i++){
if($i>0){
$returnpath.="/".$r[$i];
}
else{
$returnpath.=$r[$i];
}
$createpath=$path.$returnpath;
$mk=DoMkdir($createpath);
if(empty($mk)){
printerror("CreatePathFail","");
}
}
return $returnpath;
}
//替换表前缀
function RepSqlTbpre($sql){
global $dbtbpre;
$sql=str_replace("[!db.pre!]",$dbtbpre,$sql);
return $sql;
}
//时间转换
function ToChangeUseTime($time){
global $fun_r;
$usetime=time()-$time;
if($usetime<60)
{
$tstr=$usetime.$fun_r['TimeSecond'];
}
else
{
$usetime=round($usetime/60);
$tstr=$usetime.$fun_r['TimeMinute'];
}
return $tstr;
}
//返回栏目集合
function ReturnClass($sonclass){
if($sonclass==""||$sonclass=="|"){
return "classid=0";
}
$where="classid in (".RepSonclassSql($sonclass).")";
return $where;
}
//替换子栏目子
function RepSonclassSql($sonclass){
if($sonclass==""||$sonclass=="|"){
return 0;
}
$sonclass=substr($sonclass,1,strlen($sonclass)-2);
$sonclass=str_replace("|",",",$sonclass);
return $sonclass;
}
//返回多栏目
function sys_ReturnMoreClass($sonclass,$son=0){
global $class_r;
$r=explode(",",$sonclass);
$count=count($r);
$return_r[0]=$r[0];
$where="";
for($i=0;$i<$count;$i++)
{
$or=" or ";
if($i==0)
{
$or="";
}
if($son==1)
{
if($class_r[$r[$i]]['tbname']&&!$class_r[$r[$i]]['islast'])
{
$where.=$or."classid in (".RepSonclassSql($class_r[$r[$i]]['sonclass']).")";
}
else
{
$where.=$or."classid='".$r[$i]."'";
}
}
else
{
$where.=$or."classid='".$r[$i]."'";
}
}
$return_r[1]=$where;
return $return_r;
}
//返回多专题
function sys_ReturnMoreZt($zt){
$r=explode(",",$zt);
$count=count($r);
$return_r[0]=$r[0];
$where="";
for($i=0;$i<$count;$i++)
{
$or=" or ";
if($i==0)
{
$or="";
}
$where.=$or."ztid like '%|".$r[$i]."|%'";
}
$return_r[1]=$where;
return $return_r;
}
//验证是否包含栏目
function CheckHaveInClassid($cr,$checkclass){
global $class_r;
if($cr['islast'])
{
$chclass='|'.$cr['classid'].'|';
}
else
{
$chclass=$cr['sonclass'];
}
$return=0;
$r=explode('|',$chclass);
$count=count($r);
for($i=1;$i<$count-1;$i++)
{
if(strstr($checkclass,'|'.$r[$i].'|'))
{
$return=1;
break;
}
}
return $return;
}
//返回加前缀的下载地址
function ReturnDownQzPath($path,$urlid){
global $empire,$dbtbpre;
if(empty($urlid))
{
$re['repath']=$path;
$re['downtype']=0;
}
else
{
$r=$empire->fetch1("select urlid,url,downtype from {$dbtbpre}enewsdownurlqz where urlid='$urlid'");
if($r['urlid'])
{
$re['repath']=$r['url'].$path;
}
else
{
$re['repath']=$path;
}
$re['downtype']=$r['downtype'];
}
return $re;
}
//返回带防盗链的绝对地址
function ReturnDSofturl($downurl,$qz,$path='../../'){
$urlr=ReturnDownQzPath(stripSlashes($downurl),$qz);
$url=$urlr['repath'];
@include($path."class/enpath.php");//防盗链
$url=DoEnOnlinepath($url);
return $url;
}
//验证提交来源
function CheckCanPostUrl(){
global $public_r;
if($public_r['canposturl'])
{
$r=explode("\r\n",$public_r['canposturl']);
$count=count($r);
$b=0;
for($i=0;$i<$count;$i++)
{
if(strstr($_SERVER['HTTP_REFERER'],$r[$i]))
{
$b=1;
break;
}
}
if($b==0)
{
printerror('NotCanPostUrl','',1);
}
}
}
//验证IP
function eCheckAccessIp($ecms=0){
global $public_r;
$userip=egetip();
if($ecms)//后台
{
//允许IP
if($public_r['hopenip'])
{
$close=1;
foreach(explode("\n",$public_r['hopenip']) as $ctrlip)
{
if(preg_match("/^(".preg_quote(($ctrlip=trim($ctrlip)),'/').")/",$userip))
{
$close=0;
break;
}
}
if($close==1)
{
echo"Ip<font color='#cccccc'>(".$userip.")</font> be prohibited.";
exit();
}
}
}
else
{
//允许IP
if($public_r['openip'])
{
$close=1;
foreach(explode("\n",$public_r['openip']) as $ctrlip)
{
if(preg_match("/^(".preg_quote(($ctrlip=trim($ctrlip)),'/').")/",$userip))
{
$close=0;
break;
}
}
if($close==1)
{
echo"Ip<font color='#cccccc'>(".$userip.")</font> be prohibited.";
exit();
}
}
//禁止IP
if($public_r['closeip'])
{
foreach(explode("\n",$public_r['closeip']) as $ctrlip)
{
if(preg_match("/^(".preg_quote(($ctrlip=trim($ctrlip)),'/').")/",$userip))
{
echo"Ip<font color='#cccccc'>(".$userip.")</font> be prohibited.";
exit();
}
}
}
}
}
//替换评论表情
function RepPltextFace($text){
global $public_r;
if(empty($public_r['plface'])||$public_r['plface']=='||')
{
return $text;
}
$facer=explode('||',$public_r['plface']);
$count=count($facer);
for($i=1;$i<$count-1;$i++)
{
$r=explode('##',$facer[$i]);
$text=str_replace($r[0],"<img src='".$public_r['newsurl']."e/data/face/".$r[1]."' border=0>",$text);
}
return $text;
}
//替换空格
function RepFieldtextNbsp($text){
return str_replace(array("\t",' ',' '),array(' ',' ',' '),$text);
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -