02 | if (isset( $_GET [ 'ajax' ])){ |
03 |
$typeid = isset( $_GET [ 'typeid' ]) ? intval ( $_GET [ 'typeid' ]): 0; |
04 |
$page = isset( $_GET [ 'page' ]) ? intval ( $_GET [ 'page' ]): 0; |
05 |
$pagesize = isset( $_GET [ 'pagesize' ]) ? intval ( $_GET [ 'pagesize' ]): 15; |
06 |
$start = $page >0 ? ( $page -1)* $pagesize : 0; |
07 |
$typesql = $typeid ? " WHERE typeid=$typeid" : '' ; |
08 |
$total_sql = "SELECT COUNT(id) as num FROM `archives` $typesql " ; |
09 |
$temp = $dsql ->GetOne( $total_sql ); |
13 |
$load_num = round (( $temp [ 'num' ]-15)/ $pagesize ); |
16 |
$sql = "SELECT a.*,t.typedir,t.typename,t.isdefault,t.defaultname,t.namerule, |
17 |
t.namerule2,t.ispart, t.moresite,t.siteurl,t.sitepath |
18 |
FROM `archives` as a JOIN `arctype` AS t ON a.typeid=t.id $typesql ORDER BY id DESC LIMIT $start , $pagesize "; |
20 |
$dsql ->Execute( 'list' ); |
24 |
while ( $row = $dsql ->GetArray( "list" )){ |
25 |
$row [ 'info' ] = $row [ 'info' ] = $row [ 'infos' ] = cn_substr( $row [ 'description' ],160); |
26 |
$row [ 'id' ] = $row [ 'id' ]; |
27 |
$row [ 'filename' ] = $row [ 'arcurl' ] = GetFileUrl( $row [ 'id' ], |
28 |
$row [ 'typeid' ], $row [ 'senddate' ], $row [ 'title' ], $row [ 'ismake' ], |
29 |
$row [ 'arcrank' ], $row [ 'namerule' ], $row [ 'typedir' ], $row [ 'money' ], |
30 |
$row [ 'filename' ], $row [ 'moresite' ], $row [ 'siteurl' ], $row [ 'sitepath' ]); |
31 |
$row [ 'typeurl' ] = GetTypeUrl( $row [ 'typeid' ], $row [ 'typedir' ], |
32 |
$row [ 'isdefault' ], $row [ 'defaultname' ], $row [ 'ispart' ], |
33 |
$row [ 'namerule2' ], $row [ 'moresite' ], $row [ 'siteurl' ], $row [ 'sitepath' ]); |
34 |
if ( $row [ 'litpic' ] == '-' || $row [ 'litpic' ] == '' ){ |
35 |
$row [ 'litpic' ] = $GLOBALS [ 'cfg_cmspath' ]. '/images/defaultpic.gif' ; |
37 |
if (!preg_match( "#^http:\/\/#i" , $row [ 'litpic' ]) && $GLOBALS [ 'cfg_multi_site' ] == 'Y' ){ |
38 |
$row [ 'litpic' ] = $GLOBALS [ 'cfg_mainsite' ]. $row [ 'litpic' ]; |
40 |
$row [ 'picname' ] = $row [ 'litpic' ]; |
42 |
$row [ 'stime' ] = date ( 'Y-m-d H:i' , $row [ 'pubdate' ]); |
43 |
$row [ 'click' ] = $row [ 'click' ]; |
44 |
$row [ 'typelink' ] = "" . $row [ 'typename' ]. "" ; |
45 |
$row [ 'fulltitle' ] = $row [ 'title' ]; |
46 |
$row [ 'shorttitle' ] = $row [ 'shorttitle' ]; |
47 |
$row [ 'title' ] = cn_substr( $row [ 'title' ], 80); |
54 |
$result = array ( 'statu' => $statu , 'list' => $data , 'total' => $total , 'load_num' => $load_num ); |
55 |
echo json_encode( $result ); |
|