?? function.php
字號(hào):
<?php
function list_content($SQL,$which='*',$leng=40){
global $db,$pre;
$query=$db->query("SELECT $which FROM {$pre}mv_video $SQL");
while( $rs=$db->fetch_array($query) ){
$rs[content]=@preg_replace('/<([^>]*)>/is',"",$rs[content]); //把HTML代碼過(guò)濾掉
$rs[content]=get_word($rs[full_content]=$rs[content],100);
$rs[title]=get_word($rs[full_title]=$rs[title],$leng);
$rs[posttime]=date("Y-m-d",$rs[posttime]);
if($rs[picurl]){
$rs[picurl]=tempdir($rs[picurl]);
}
$listdb[]=$rs;
}
return $listdb;
}
function GET_MV($type,$fid,$rows=6,$leng=30,$getson=0){
global $page,$fid;
if($page<1){
$page=1;
}
if($type=='lastview'){
$_order='lastview';
//$INDEX=' USE INDEX(lastview) ';
}elseif($type=='hot'){
//$INDEX=' USE INDEX(hits) ';
$_order='hits';
}elseif($type=='rand'){
$_order='rand()';
}elseif($type=="level"){
$_order='list';
$_SQL=" levels=1 AND ";
}elseif($type=="pic"){
$_order='list';
$_SQL=" ispic=1 AND ";
}else{
//$INDEX=' USE INDEX(list) ';
$_order='list';
}
if($getson==1&&$fid){
$fids=get_fid($fid);
$_SQL.=" fid IN (".implode(",",$fids).") ";
}elseif($fid){
$_SQL.=" fid=$fid ";
}else{
$_SQL.=" 1 ";
}
$min=($page-1)*$rows;
//AND yz=1
$SQL=" $INDEX WHERE $_SQL ORDER BY $_order DESC LIMIT $min,$rows";
$which='*';
$listdb=list_content($SQL,$which,$leng);
return $listdb;
}
function get_fid($fid){
global $db,$pre;
$fid=intval($fid);
$F[]=$fid;
$query = $db->query("SELECT fid FROM {$pre}mv_sort WHERE fup=$fid");
while($rs = $db->fetch_array($query)){
$F[]=$rs[fid];
}
return $F;
}
function list_comment($SQL,$which='*',$leng=400){
global $db,$pre;
$query=$db->query("SELECT $which FROM `{$pre}mv_comments` $SQL");
while( $rs=$db->fetch_array($query) ){
if(!$rs[username]){
$detail=explode(".",$rs[ip]);
$rs[username]="$detail[0].$detail[1].$detail[2].*";
}
$rs[posttime]=date("Y-m-d H:i:s",$rs[posttime]);
$rs[content]=get_word($rs[full_content]=$rs[content],$leng);
$rs[content]=str_replace("\n","<br>",$rs[content]);
$listdb[]=$rs;
}
return $listdb;
}
?>
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -