⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 functions.php

📁 一个函数
💻 PHP
📖 第 1 页 / 共 5 页
字号:
            $sonclass = "";
        }
        $createpath = "../../".$classpath;
        $mk = domkdir( $createpath );
        $createfilepath = "../../d/file/".$classpath;
        $mk1 = domkdir( $createfilepath );
        if ( $mk )
        {
            domkdir( $createpath."/js" );
        }
        if ( empty( $add[bname] ) )
        {
            $add[bname] = $add[classname];
        }
        $add[lencord] = ( integer )$add[lencord];
        $add[listtempid] = ( integer )$add[listtempid];
        $sql = $empire->query( "insert into {$dbtbpre}enewsclass(bclassid,classname,sonclass,is_zt,lencord,link_num,newstempid,indextext,onclick,listtempid,featherclass,islast,classpath,classtype,newspath,filename,filetype,openpl,openadd,newline,newstrlen,newshowdate,hotline,hotstrlen,hotshowdate,goodline,goodstrlen,goodshowdate,classurl,groupid,myorder,filename_qz,hotplline,hotplshowdate,hotplstrlen,modid,checked,docheckuser,checkuser,firstline,firststrlen,firstshowdate,bname,islist,searchtempid,tid,tbname,maxnum,checkpl,down_num,online_num,listorderf,listorder,reorderf,reorder,intro,classimg,jstempid,addinfofen,listdt,showclass,showdt,checkqadd,qaddlist,qaddgroupid,qaddshowkey,adminqinfo,doctime,classpagekey) values({$add['bclassid']},'{$add['classname']}','{$sonclass}',0,{$add['lencord']},{$add['link_num']},{$add['newstempid']},'".$indextext."',0,{$add['listtempid']},'{$featherclass}',{$add['islast']},'{$classpath}','{$add['classtype']}','{$add['newspath']}',{$add['filename']},'{$add['filetype']}',{$add['openpl']},{$add['openadd']},{$add['newline']},{$add['newstrlen']},{$add['newshowdate']},{$add['hotline']},{$add['hotstrlen']},{$add['hotshowdate']},{$add['goodline']},{$add['goodstrlen']},{$add['goodshowdate']},'{$add['classurl']}',{$add['groupid']},0,'{$add['filename_qz']}',{$add['hotplline']},{$add['hotplshowdate']},{$add['hotplstrlen']},{$add['modid']},{$add['checked']},{$add['docheckuser']},'{$add['checkuser']}',{$add['firstline']},{$add['firststrlen']},{$add['firstshowdate']},'{$add['bname']}',0,{$add['searchtempid']},{$tabler['tid']},'{$tabler['tbname']}',{$add['maxnum']},{$add['checkpl']},{$add['down_num']},{$add['online_num']},'{$add['listorderf']}','{$add['listorder']}','{$add['reorderf']}','{$add['reorder']}','{$add['intro']}','{$add['classimg']}',{$jstempid},{$add['addinfofen']},{$add['listdt']},{$add['showclass']},{$add['showdt']},{$add['checkqadd']},{$add['qaddlist']},{$add['qaddgroupid']},{$add['qaddshowkey']},{$add['adminqinfo']},{$add['doctime']},'{$add['classpagekey']}');" );
        $lastid = $empire->lastid( );
        if ( $add[bclassid] )
        {
            $b_r = $empire->fetch1( "select sonclass,featherclass from {$dbtbpre}enewsclass where classid='{$add['bclassid']}'" );
            if ( empty( $b_r[sonclass] ) )
            {
                $b_r[sonclass] = "|";
            }
            $new_sonclass = $b_r[sonclass].$lastid."|";
            $update = $empire->query( "update {$dbtbpre}enewsclass set sonclass='{$new_sonclass}' where classid='{$add['bclassid']}'" );
            $where = returnclass( $b_r[featherclass] );
            if ( empty( $where ) )
            {
                $where = "classid=0";
            }
            $bsql = $empire->query( "select sonclass,classid from {$dbtbpre}enewsclass where ".$where );
            while ( $br = $empire->fetch( $bsql ) )
            {
                if ( empty( $br[sonclass] ) )
                {
                    $br[sonclass] = "|";
                }
                $new_sonclass = $br[sonclass].$lastid."|";
                $update = $empire->query( "update {$dbtbpre}enewsclass set sonclass='{$new_sonclass}' where classid='{$br['classid']}'" );
            }
        }
        dellistenews( );
        getsearch( $add[modid] );
        getclass( );
        if ( $sql )
        {
            insert_dolog( "classid=".$lastid."<br>classname=".$add[classname] );
            printerror( "AddLastClassSuccess", "AddClass.php?enews=AddClass&from={$add['from']}" );
        }
        else
        {
            printerror( "DbError", "history.go(-1)" );
        }
    }
}

function readfiletext( $filepath )
{
    $filepath = trim( $filepath );
    $htmlfp = @fopen( $filepath, "r" );
    if ( strstr( $filepath, "://" ) )
    {
        while ( $data = @fread( $htmlfp, 500000 ) )
        {
            $string .= $data;
        }
    }
    else
    {
        $string = @fread( $htmlfp, @filesize( $filepath ) );
    }
    @fclose( $htmlfp );
    return $string;
}

function repphpaspjspcode( $string )
{
    global $public_r;
    if ( !$public_r[candocode] )
    {
        $string = str_replace( "<?", "&lt;?", $string );
        $string = str_replace( "<%", "&lt;%", $string );
    }
    return $string;
}

function repphpaspjspcodetext( $string )
{
    $string = str_replace( "<?", "&lt;?", $string );
    $string = str_replace( "<%", "&lt;%", $string );
    return $string;
}

function writefiletext( $filepath, $string )
{
    global $public_r;
    $string = stripslashes( $string );
    $fp = @fopen( $filepath, "w" );
    @fputs( $fp, $string );
    @fclose( $fp );
    if ( $public_r[filechmod] == 1 )
    {
    }
    else
    {
        @chmod( $filepath, 511 );
    }
}

function writefiletext_n( $filepath, $string )
{
    global $public_r;
    $fp = @fopen( $filepath, "w" );
    @fputs( $fp, $string );
    @fclose( $fp );
    if ( $public_r[filechmod] == 1 )
    {
    }
    else
    {
        @chmod( $filepath, 511 );
    }
}

function newsbq( $classid, $indextext, $enews = 0, $doing = 0 )
{
    global $empire;
    global $public_r;
    global $class_r;
    global $class_zr;
    global $fun_r;
    global $navinfor;
    global $addgethtmlpath;
    global $dbtbpre;
    $phome_digod_buyversion = returnbuyver( );
    $indextext = stripslashes( $indextext );
    if ( $enews == 0 )
    {
        $navclassid = $classid;
        $url = "<!--empire.url-->".returnclasslink( $classid )."<!--empire.url-->";
        if ( $doing )
        {
            $cr = $empire->fetch1( "select classpath,classtype,classname from {$dbtbpre}enewsclass where classid='{$classid}'" );
            $class_r[$classid][classpath] = $cr[classpath];
            $class_r[$classid][classtype] = $cr[classtype];
            $class_r[$classid][classname] = $cr[classname];
        }
        $pagetitle = $class_r[$classid][classname];
        if ( $public_r['openclasspv'] )
        {
            $onclick = "<script src=".$public_r[newsurl]."e/public/onclick?enews=doclass&classid={$classid}></script>";
        }
        $truefile = "../../".$class_r[$classid][classpath]."/index".$class_r[$classid][classtype];
        $file = "../data/tmp/class".$classid.".php";
        $openfile = $public_r[newsurl]."e/data/tmp/class".$classid.".php";
    }
    else if ( $enews == 1 )
    {
        $pagetitle = $public_r[sitename];
        $url = "<!--empire.url--><a href=\"".$public_r[newsurl]."\" class=\"classlinkclass\">".$fun_r['index']."</a><!--empire.url-->";
        if ( $phome_digod_buyversion == "free" && !strstr( $indextext, "[!--license--]" ) )
        {
            $indextext .= "[!--license--]";
        }
        $license = "Powered&nbsp;by&nbsp;<a href=\"http://www.phome.net\" target=\"_blank\" class=\"ecmscopyright\"><strong>Ecms</strong></a>";
        $indextext = str_replace( "[!--license--]", $license, $indextext );
        $onclick = "";
        $truefile = "../../index".$public_r[indextype];
        $file = "../data/tmp/index.php";
        $openfile = $public_r[newsurl]."e/data/tmp/index.php";
    }
    else if ( $enews == 2 )
    {
        $onclick = "";
        $truefile = "";
        $file = $addgethtmlpath."../data/tmp/temp".$classid.".php";
    }
    else if ( $enews == 3 )
    {
        $navclassid = $classid;
        $url = "<!--empire.url-->".returnztlink( $classid )."<!--empire.url-->";
        if ( $doing )
        {
            $cr = $empire->fetch1( "select ztpath,zttype,ztname from {$dbtbpre}enewszt where ztid='{$classid}'" );
            $class_zr[$classid][ztpath] = $cr[ztpath];
            $class_zr[$classid][zttype] = $cr[zttype];
            $class_zr[$classid][ztname] = $cr[ztname];
        }
        $pagetitle = $class_zr[$classid][ztname];
        if ( $public_r['openclasspv'] )
        {
            $onclick = "<script src=".$public_r[newsurl]."e/public/onclick?enews=dozt&ztid={$ztid}></script>";
        }
        $truefile = "../../s/".$class_zr[$classid][ztpath]."/index".$class_zr[$classid][zttype];
        $file = "../data/tmp/zt".$classid.".php";
        $openfile = $public_r[newsurl]."e/data/tmp/zt".$ztid.".php";
    }
    $indextext = replacetempvar( $indextext );
    if ( $classid && $enews == 0 )
    {
        $indextext = repclasspagevar( $indextext, $classid, $r, 0 );
        $indextext = str_replace( "[!--self.classid--]", $classid, $indextext );
        $indextext = str_replace( "[!--news.url--]", $public_r['newsurl'], $indextext );
        $indextext = str_replace( "[!--pagetitle--]", $pagetitle, $indextext );
    }
    else if ( $classid && $enews == 3 )
    {
        $indextext = repclasspagevar( $indextext, $classid, $r, 1 );
        $indextext = str_replace( "[!--self.classid--]", $classid, $indextext );
        $indextext = str_replace( "[!--news.url--]", $public_r['newsurl'], $indextext );
        $indextext = str_replace( "[!--pagetitle--]", $pagetitle, $indextext );
    }
    else if ( $enews == 1 )
    {
        $indextext = str_replace( "[!--news.url--]", $public_r['newsurl'], $indextext );
        $indextext = str_replace( "[!--pagetitle--]", $pagetitle, $indextext );
    }
    if ( $url )
    {
        $indextext = str_replace( "[!--newsnav--]", $url, $indextext );
    }
    $indextext = repbq( $indextext );
    $copyrightbq = "[!--phome.net-empirecms-copyright--]";
    if ( strstr( $indextext, $copyrightbq ) )
    {
        $indextext = str_replace( $copyrightbq, returnecmscopyright( ), $indextext );
    }
    else
    {
        $indextext = $indextext.returnecmscopyright( );
    }
    writefiletext( $file, $indextext );
    @ob_start( );
    @include( $file );
    $string = @ob_get_contents( );
    @ob_end_clean( );
    if ( $enews == 0 || $enews == 1 || $enews == 3 )
    {
        $string = str_replace( "[!--page.stats--]", $onclick, $string );
    }
    $string = repexecode( $string );
    if ( $enews != 2 )
    {
        writefiletext( $truefile, $string );
    }
    writefiletext( $file, "" );
    return $string;
}

function repexecode( $string )
{
    global $public_r;
    if ( $public_r[candocode] )
    {
        $string = str_replace( "<!--code.start-->", "<", $string );
        $string = str_replace( "<!--code.end-->", ">", $string );
    }
    return $string;
}

function formatpath( $classid, $mynewspath, $enews = 0 )
{
    global $class_r;
    global $addgethtmlpath;
    $newspath = date( $class_r[$classid][newspath] );
    if ( $enews )
    {
        $newspath = $mynewspath;
    }
    if ( empty( $newspath ) )
    {
        return "";
    }
    $r = explode( "/", $newspath );
    $path = $addgethtmlpath."../../".$class_r[$classid][classpath]."/";
    $returnpath = "";
    $i = 0;
    for ( ; $i < count( $r ); ++$i )
    {
        if ( 0 < $i )
        {
            $returnpath .= "/".$r[$i];
        }
        else
        {
            $returnpath .= $r[$i];
        }
        $createpath = $path.$returnpath;
        $mk = domkdir( $createpath );
        if ( empty( $mk ) )
        {
            printerror( "CreatePathFail", "history.go(-1)" );
        }
    }
    return $returnpath;
}

function updatesmallclassdomain( $classid, $classurl, $classpath )
{
    global $empire;
    global $dbtbpre;
    if ( empty( $classurl ) )
    {
        $query = "update {$dbtbpre}enewsclass set classurl='' where featherclass like '%|".$classid."|%'";
    }
    else
    {
        $query = "update {$dbtbpre}enewsclass set classurl=CONCAT('".$classurl."',SUBSTRING(classpath,LENGTH('".$classpath."')+1)) where featherclass like '%|".$classid."|%'";

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -