<?php
/**
* @author moufer<moufer@163.com>
* @copyright www.modoer.com
* @version $Id 1 2008-08-29 16:35 $
*/
!defined('IN_MUDDER') && exit('Access Denied');

if($mod_article['disable']) cpmsg($mod_article['name'].'模块已禁用。');
if(!$mod_article['ownernews']) cpmsg($mod_article['name'].'模块未启用商家发布资讯的功能。');

if(!check_submit('mysubmit')) {
    $query = $db->query("SELECT sid,shopname,subname FROM {$dbpre}shops WHERE ownerid='$user->uid'");
    $ids = '';
    $items = array();
    while($row = $db->fetch_array($query)) {
        $ids[] .= "'".$row['sid']."'";
        $items[$row['sid']] = $row['shopname'].$row['subname'];
    }
    if(count($items)==0) redirect('对不起，您目前没有自己的商铺，无法发布商家资讯。');
    if($ids) {
        $ids = implode(',',$ids);
        $total = $db->get_value("SELECT COUNT(*) FROM {$dbpre}articles WHERE shopid IN ($ids)");
        if($total > 0) {
            $offset = 10;
            $limit = get_limit($page, $offset);
            $multipage = multi($total, $offset, $page, "index.php?ac=$ac");
            $query = $db->query("SELECT * FROM {$dbpre}articles WHERE shopid IN ($ids) ORDER BY dateline DESC LIMIT $limit");
            $articles = array();
            while($row = $db->fetch_array($query)) {
                $row['fullname'] = $items[$row['shopid']];
                $articles[] = $row;
            }
        }
    }
} else {

}
?>