<?php
/**
* 图片索引列表
* @author moufer<moufer@163.com>
* @copyright www.modoer.com
* @version $Id: allpic.php 1 2008-01-28 10:13 $
*/
define('SCRIPTNAV', 'allpic');
require_once './include/inc_common.php';

$pcd = isset($pcd) ? (preg_match("/^[0-9]{2}$/",$pcd) ? $pcd : '') : '';

$where .= " a.status=1 AND pictures>0 ".($pcd ? " AND a.classcode like '{$pcd}__' " : '');

$result = $db->get_one("SELECT COUNT(*) as total FROM {$dbpre}shops a WHERE $where");
$total = $result['total'];

if($total > 0) {
    $offset = 20;
    $limit = get_limit($page, $offset);
    $query = $db->query("SELECT a.sid,a.shopname,a.subname,a.pictures,a.thumb FROM {$dbpre}shops a WHERE $where ORDER BY a.pictures DESC LIMIT $limit");
    while($shop = $db->fetch_array($query)) {
        $shop['shopname'] .= $shop['subname'] ? "({$shop['subname']})" : '';
        $p_arr = explode('|',$shop['picture']);
        if($shop['thumb']) {
            $fileinfo = pathinfo($shop['thumb']);
            $shop['thumb'] = get_picture($fileinfo['dirname'], $fileinfo['basename'], 'big');
            unset($fileinfo);
        }
        $shop['thumb'] = $shop['thumb'] ?  $shop['thumb'] : './images/noimg.gif';
        //兼容
        $shop['pciture'] = &$shop['thumb'];
        $shops[] = $shop;
    }
    $multipage = multi($total, $offset, $page, 'allpic.php?pcd='.$pcd);
}

$newpictures_size = $_config['thumbdisplay'] == 'fixed' ? " width=\"{$_picture_thumb['big']['width']}\" height=\"{$_picture_thumb['big']['height']}\"" : "";

$subtitle = '查看'.($pcd ? $_panels[$pcd] : '所有').'图片';

require_once MUDDER_ROOT.'header.php';
require_once template('shop_allpic');
footer();
?>
