//判斷信息id if ($_GET['action'] == 'edit') { if ($_GET['itemid']) { $wheresql = ' i.itemid=\'' . $_GET['itemid'] . '\''; } else { cpmsg('no_item', 'admin.php?action=list&m=' . $mname); } //取得信息 $query = DB::query('SELECT * FROM ' . tname($mname . 'items') . ' i ' . ($mname == 'album' ? '' : 'INNER JOIN ' . tname($mname . 'message') . ' m ON i.itemid=m.itemid') . ' WHERE ' . $wheresql . ' ORDER BY i.itemid DESC LIMIT 1'); $editvalue = DB::fetch($query); if (empty($editvalue)) { cpmsg('no_item', 'admin.php?action=list&m=' . $mname); } if ($mname == 'good' || $mname == 'groupbuy') { $relatedarr = array(); $relatedarr = getrelatedinfo($mname, $editvalue['itemid'], $editvalue['shopid']); } $editvalue['dateline'] = sgmdate($editvalue['dateline']); //管理員查看基本信息&& $mname=='shop' if ($_GET['op'] == 'adminview') { if (empty($_SGLOBAL['panelinfo'])) { getpanelinfo($_GET['itemid']); } if ($_GET['updatepass'] == 1) { $updateser = DB::fetch(DB::query("SELECT * FROM " . tname("itemupdates") . " WHERE itemid='{$_GET['itemid']}' and type = '{$mname}'")); $update = unserialize($updateser['update']); $update = sstripslashes($update); $update['groupid'] = $_SGLOBAL['panelinfo']['group']['title']; $categorylist = getmodelcategory($mname); $update['attr_catid'] = $update['catid']; $update['catid'] = $categorylist[$update['catid']]['name'];
echo "\n"; } } exit; } } else { $groupbuyattr = loadClass('attr')->get_groupby_user_attr(); $allowreply = $shop['allowreply'] && $groupbuy['allowreply'] ? 1 : 0; $groupbuy['groupbuytime'] = date('Y-m-d', $groupbuy['validity_end']); $groupbuy['groupbuydiscount'] = round($groupbuy['groupbuypriceo'] / $groupbuy['groupbuyprice'], 2) * 10; $groupbuy['groupbuysave'] = round($groupbuy['groupbuyprice'] - $groupbuy['groupbuypriceo']); $groupbuy['surplusnum'] = !empty($groupbuy['groupbuymaxnum']) ? $groupbuy['groupbuymaxnum'] - $groupbuy['buyingnum'] : $lang['groupbuy_notrestricted']; $groupbuy['groupbuypriceo'] = round($groupbuy['groupbuypriceo']); $groupbuy['groupbuyprice'] = round($groupbuy['groupbuyprice']); $relatedarr = array(); $relatedarr = getrelatedinfo('groupbuy', $groupbuy['itemid'], $shop['itemid']); //更新統計數 $isupdate = freshcookie($action, $groupbuy['itemid']); if ($isupdate || !$_G['setting']['updateview']) { updateviewnum($action, $groupbuy['itemid']); } //評論 $listcount = $groupbuy['replynum']; $_G['setting']['viewspace_pernum'] = intval($_G['setting']['viewspace_pernum']); $type = 'groupbuy'; $my_join_info = loadClass('groupbuy')->get_my_join_info($_G['uid'], $groupbuy['itemid']); if ($my_join_info) { $already_joined = true; } else { $already_joined = false; }
$result['time'] = date('Y-m-d', $result['dateline']); $result['thumb'] = str_replace('static/image/nophoto.gif', 'static/image/noimg.gif', $result['thumb']); $result['message'] = trim(strip_tags($result['message'])); $result['intro'] = cutstr($result['intro'], 130, true); $goodlist[] = $result; } $seo_title = $lang['goodlist'] . ' - ' . $seo_title; $theurl = "store.php?id={$shop['itemid']}&action=good"; } else { //商品詳情 $good = $_BCACHE->getiteminfo('good', $_GET['xid'], $_GET['id']); $good['message'] = bbcode2html($good['message']); if (!$good) { showmessage('not_found_msg', 'index.php'); } $allowreply = $shop['allowreply'] && $good['allowreply'] ? 1 : 0; $good['time'] = date('Y-m-d H:i', $good['dateline']); $relatedarr = array(); $relatedarr = getrelatedinfo('good', $good['itemid'], $shop['itemid']); //更新統計數 $isupdate = freshcookie($action, $good['itemid']); if ($isupdate || !$_G['setting']['updateview']) { updateviewnum($action, $good['itemid']); } //評論 $listcount = $good['replynum']; $_G['setting']['viewspace_pernum'] = intval($_G['setting']['viewspace_pernum']); $type = 'good'; $seo_title = $good['subject'] . ' - ' . $seo_title; $seo_description = str_replace(array(' ', "\r", "\n", '\'', '"'), '', cutstr(trim(strip_tags($good['message'])), 200)); }
function bbs_getrelatedinfo($mname, $itemid, $shopid) { $relatedarr = getrelatedinfo($mname, $itemid, $shopid); $relatedstr = ''; foreach ($relatedarr as $key => $relatedinfo) { $relatedstr .= "[size=3][" . b_lang($relatedinfo['type']) . "][url=" . B_URL . "/store.php?id=" . $shopid . "&action=" . $relatedinfo['type'] . "&xid=" . $relatedinfo['itemid'] . "]" . $relatedinfo['simplesubject'] . "[/url][/size]\r\n"; } return $relatedstr; }