📄 functions.php
字号:
}
if ( $add[oldclassname] != $add[classname] || $add[bclassid] != $add[oldbclassid] )
{
dellistenews( );
getsearch( $add[modid] );
}
else if ( $add[openadd] != $add[oldopenadd] )
{
getsearch( $add[modid] );
}
if ( $add[oldclasstype] != $add[classtype] )
{
$todaytime = date( "Y-m-d H:i:s" );
if ( $add[islast] )
{
$query = "select count(*) as total from {$dbtbpre}ecms_".$class_r[$add[classid]][tbname]." where checked=1 and classid='{$add['classid']}'";
$lencord = $add[oldlencord];
$num = $empire->gettotal( $query );
}
else
{
$lencord = $add[oldblencord];
if ( $add[oldislist] )
{
$where = returnclass( $class_r[$add[classid]][sonclass] );
$query = "select count(*) as total from {$dbtbpre}ecms_".$class_r[$add[classid]][tbname]." where checked=1 and (".$where.")";
$num = $empire->gettotal( $query );
}
else
{
$num = 1;
}
}
renamelistfile( $add[classid], $lencord, $num, $add[oldclasstype], $add[classtype], $classpath );
}
if ( $add['from'] )
{
$returnurl = "ListPageClass.php";
}
else
{
$returnurl = "ListClass.php";
}
if ( $sql )
{
insert_dolog( "classid=".$add[classid]."<br>classname=".$add[classname] );
printerror( "EditClassSuccess", $returnurl );
}
else
{
printerror( "DbError", "history.go(-1)" );
}
}
function changeclassislast( $reclassid, $userid, $username )
{
global $empire;
global $dbtbpre;
checklevel( $userid, $username, $classid, "class" );
$count = count( $reclassid );
$classid = ( integer )$reclassid[0];
if ( $count == 0 || !$classid )
{
printerror( "NotChangeIslastClassid", "history.go(-1)" );
}
$r = $empire->fetch1( "select classid,sonclass,featherclass,islist,islast,classname,modid,tbname from {$dbtbpre}enewsclass where classid={$classid}" );
if ( empty( $r[classid] ) )
{
printerror( "NotChangeIslastClassid", "history.go(-1)" );
}
if ( !$r[islast] )
{
$num = $empire->gettotal( "select count(*) as total from {$dbtbpre}enewsclass where bclassid={$classid}" );
if ( $num )
{
printerror( "LastTheClassHaveSonclass", "history.go(-1)" );
}
$where = returnclass( $r[featherclass] );
if ( empty( $where ) )
{
$where = "classid=0";
}
$sql = $empire->query( "select classid,sonclass from {$dbtbpre}enewsclass where ".$where );
while ( $br = $empire->fetch( $sql ) )
{
if ( empty( $br[sonclass] ) )
{
$br[sonclass] = "|";
}
$newsonclass = $br[sonclass].$classid."|";
$usql = $empire->query( "update {$dbtbpre}enewsclass set sonclass='{$newsonclass}' where classid={$br['classid']}" );
}
$dosql = $empire->query( "update {$dbtbpre}enewsclass set islast=1 where classid={$classid}" );
$mess = "ChangeClassToLastSuccess";
}
else
{
$num = $empire->gettotal( "select count(*) as total from {$dbtbpre}ecms_".$r[tbname]." where classid={$classid}" );
if ( $num )
{
printerror( "LastTheClassHaveInfo", "history.go(-1)" );
}
$where = returnclass( $r[featherclass] );
if ( empty( $where ) )
{
$where = "classid=0";
}
$sql = $empire->query( "select classid,sonclass from {$dbtbpre}enewsclass where ".$where );
while ( $br = $empire->fetch( $sql ) )
{
if ( empty( $br[sonclass] ) )
{
$br[sonclass] = "|";
}
$newsonclass = str_replace( "|".$classid."|", "|", $br[sonclass] );
$usql = $empire->query( "update {$dbtbpre}enewsclass set sonclass='{$newsonclass}' where classid={$br['classid']}" );
}
$dosql = $empire->query( "update {$dbtbpre}enewsclass set islast=0 where classid={$classid}" );
$mess = "ChangeClassToNolastSuccess";
}
dellistenews( );
getsearch( $r[modid] );
getclass( );
if ( $dosql )
{
insert_dolog( "classid=".$classid."<br>classname=".$r[classname] );
printerror( $mess, $_SERVER['HTTP_REFERER'] );
}
else
{
printerror( "DbError", "history.go(-1)" );
}
}
function renamelistfile( $classid, $lencord, $num, $type, $newtype, $classpath )
{
$page = ceil( $num / $lencord );
$j = 1;
for ( ; $j <= $page; ++$j )
{
if ( $j == 1 )
{
$listfile = "../../".$classpath."/index";
}
else
{
$listfile = "../../".$classpath."/index_".$j;
}
@rename( $listfile.$type, $listfile.$newtype );
}
}
function getlisttempmid( $tempid )
{
global $empire;
$r = $empire->fetch1( "select modid from ".gettemptb( "enewslisttemp" )." where tempid='{$tempid}'" );
return $r[modid];
}
function getlisttemp( $tempid )
{
global $empire;
$r = $empire->fetch1( "select temptext,subnews,listvar,rownum,showdate,modid,subtitle from ".gettemptb( "enewslisttemp" )." where tempid='{$tempid}'" );
$r[temptext] = newsbq( "list".$tempid, $r[temptext], 2, 0 );
return $r;
}
function getindextemp( )
{
global $empire;
$r = $empire->fetch1( "select indextemp from ".gettemptb( "enewspubtemp" )." limit 1" );
return $r['indextemp'];
}
function reindex( )
{
$indextemp = getindextemp( );
newsbq( $classid, $indextemp, 1, 0 );
insert_dolog( "" );
printerror( "ReIndexSuccess", "history.go(-1)" );
}
function replacelistvars( $no, $listtemp, $subnews, $subtitle, $formatdate, $url, $haveclass = 0, $r, $field )
{
global $empire;
global $public_r;
global $class_r;
global $fun_r;
if ( $haveclass )
{
$add = sys_returnbqclassname( $r, $haveclass );
}
if ( empty( $r[oldtitle] ) )
{
$r[oldtitle] = $r[title];
}
$fr = explode( ",", $field );
$i = 1;
for ( ; $i < count( $fr ); ++$i )
{
$f = $fr[$i];
$value = $r[$f];
if ( $f == "downpath" )
{
}
else if ( $f == "onlinepath" )
{
}
else if ( $f == "morepic" )
{
}
else if ( $f == "title" )
{
if ( !empty( $subtitle ) )
{
$value = sub( $value, 0, $subtitle, false );
}
$value = dotitlefont( $r[titlefont], $r[titlecolor], $value );
}
else if ( $f == "newstime" )
{
if ( strstr( $listtemp, "[!--newstime--]" ) )
{
$value = format_datetime( $value, $formatdate );
}
}
else if ( $f == "smalltext" )
{
if ( strstr( $listtemp, "[!--smalltext--]" ) && !empty( $subnews ) )
{
$value = sub( $value, 0, $subnews, false );
}
}
else if ( $f == "flashsay" )
{
if ( strstr( $listtemp, "[!--flashsay--]" ) && !empty( $subnews ) )
{
$value = sub( $value, 0, $subnews, false );
}
}
else if ( $f == "softsay" )
{
if ( strstr( $listtemp, "[!--softsay--]" ) && !empty( $subnews ) )
{
$value = sub( $value, 0, $subnews, false );
}
}
else if ( $f == "moviesay" )
{
if ( strstr( $listtemp, "[!--moviesay--]" ) && !empty( $subnews ) )
{
$value = sub( $value, 0, $subnews, false );
}
}
else if ( $f == "titlepic" )
{
if ( empty( $value ) )
{
$value = $public_r[newsurl]."e/data/images/notimg.gif";
}
}
else if ( $f == "befrom" )
{
if ( strstr( $listtemp, "[!--befrom--]" ) )
{
$value = replacebefrom( $value );
}
}
else if ( $f == "writer" && strstr( $listtemp, "[!--writer--]" ) )
{
$value = replacewriter( $value );
}
if ( $f != "newstext" && $f != "title" && $f != "titlepic" && $f != "newstime" && $f != "befrom" && $f != "writer" && $f != "downpath" && $f != "onlinepath" && $f != "musicpath" && $f != "booktexturl" )
{
if ( !strstr( $public_r['tobrf'], ",".$class_r[$r[classid]][tbname].".".$f."," ) )
{
$value = nl2br( $value );
}
if ( strstr( $public_r['dohtmlf'], ",".$class_r[$r[classid]][tbname].".".$f."," ) )
{
$value = htmlspecialchars( $value );
}
}
$listtemp = str_replace( "[!--".$f."--]", $value, $listtemp );
}
$titleurl = sys_returnbqtitlelink( $r );
$listtemp = str_replace( "[!--fava.url--]", $public_r[newsurl]."e/member/fava/add?classid={$r['classid']}&id=".$r[id], $listtemp );
$listtemp = str_replace( "[!--id--]", $r[id], $listtemp );
$listtemp = str_replace( "[!--classid--]", $r[classid], $listtemp );
$listtemp = str_replace( "[!--class.name--]", $add, $listtemp );
$listtemp = str_replace( "[!--userfen--]", $r[userfen], $listtemp );
$listtemp = str_replace( "[!--titleurl--]", $titleurl, $listtemp );
$listtemp = str_replace( "[!--no.num--]", $no, $listtemp );
$listtemp = str_replace( "[!--plnum--]", $r[plnum], $listtemp );
$listtemp = str_replace( "[!--news.url--]", $public_r[newsurl], $listtemp );
$listtemp = str_replace( "[!--userid--]", $r[userid], $listtemp );
$listtemp = str_replace( "[!--username--]", $r[username], $listtemp );
$listtemp = str_replace( "[!--ismember--]", $r[ismember], $listtemp );
$listtemp = str_replace( "[!--onclick--]", $r[onclick], $listtemp );
$listtemp = str_replace( "[!--oldtitle--]", $r[oldtitle], $listtemp );
$listtemp = str_replace( "[!--totaldown--]", $r[totaldown], $listtemp );
if ( strstr( $listtemp, "[!--this.classlink--]" ) )
{
$thisclasslink = sys_returnbqclassname( $r, 9 );
$listtemp = str_replace( "[!--this.classlink--]", $thisclasslink, $listtemp );
}
$thisclassname = $class_r[$r[classid]][c
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -