/** * 商舖的自定義導航 * * @param int $shopid 商舖 ID */ function get_shop_nav($shopid) { global $_G, $_SGLOBAL, $_BCACHE, $_SBLOCK; $nav_default = $this->get_shop_nav_default($shopid); $_SGLOBAL['shop_nav'] = array(); $_BCACHE->cachesql('shopnav', 'SELECT * FROM ' . tname('nav') . " WHERE (type=\\'sys\\' OR type=\\'shop\\') AND shopid='{$shopid}' AND displayorder>-1 ORDER BY displayorder ASC", 0, 0, 10, 0, 'detail', 'nav', $shopid); foreach ($_SBLOCK['shopnav'] as $value) { if ($value['available'] == 1) { $value['target'] = $value['target'] ? ' target=\'_blank\'' : ''; $value['style'] = ' style=\'' . pktitlestyle($value['highlight']) . '\''; $value['url'] = $nav_default[$value['flag']]['url']; $_SGLOBAL['shop_nav'][$value['flag']] = $value; unset($nav_default[$value['flag']]); } else { unset($nav_default[$value['flag']]); } } foreach ($nav_default as $key => $value) { if (!isset($rowitems[$key])) { $_SGLOBAL['shop_nav'][$key] = $value; } $_SGLOBAL['shop_nav'][$key]['url'] = $value['url']; } return $_SGLOBAL['shop_nav']; }
function updatesettingcache() { global $_G, $_SGLOBAL, $_SSCONFIG, $lang; $_SSCONFIG = array(); $query = DB::query('SELECT * FROM ' . tname('settings')); while ($set = DB::fetch($query)) { $_G['setting'][$set['variable']] = $set['value']; } // 附件設置 $_G['setting']['attach'] = unserialize($_G['setting']['attach']); $_G['setting']['attachmenturlarr'] = explode("\r\n", trim($_G['setting']['attachmenturls'])); //縮略圖設置 if (empty($_G['setting']['thumbarray'])) { $_G['setting']['thumbarray'] = array('news' => array('400', '300')); } else { $_G['setting']['thumbarray'] = unserialize($_G['setting']['thumbarray']); } //讀取UC中論壇地址 require_once B_ROOT . './uc_client/client.php'; $ucapparray = uc_app_ls(); if (count($ucapparray) > 0) { foreach ($ucapparray as $apparray) { if ($apparray['type'] == 'DISCUZ') { $_G['setting']['discuz_url'] = $apparray['url']; break; } } } // 讀取導航 $query = DB::query('SELECT name,flag,url,target,highlight FROM ' . tname('nav') . ' WHERE (type=\'sys\' or type=\'site\') and shopid=0 and available=1 order by displayorder limit 7'); while ($value = DB::fetch($query)) { $value['ext'] = ($value['target'] == 1 ? ' target=\'_blank\'' : '') . ' style=\'' . pktitlestyle($value['highlight']) . '\''; $_G['setting']['site_nav'][$value['flag']] = $value; } // 會員卡商家導航 if (empty($_G['setting']['enablecard'])) { unset($_G['setting']['site_nav']['card']); } // make cache $cachefile = B_ROOT . './data/system/config.cache.php'; $cachetext = '$_G[\'setting\'] = ' . arrayeval($_G['setting']); writefile($cachefile, $cachetext, 'php'); }
function showbasicfield($mname, $editvalue, $_SSCONFIG, $categorylist, $file = 'admin') { global $_G, $_SGLOBAL, $item; //編輯頁面基本字段 $required = '<span style="color:red">*</span>'; pklabel(array('type' => 'input', 'other' => 'style="' . pktitlestyle($editvalue['styletitle']) . '"', 'alang' => $mname . '_subject', 'name' => 'subject', 'value' => $editvalue['subject'], 'required' => $required)); if ($mname == 'notice' || $mname == 'shop') { showstyletitle($mname, substr($editvalue['styletitle'], 0, 7)); } if (in_array($mname, array('good', 'album', 'consume', 'notice', 'groupbuy')) || pkperm('isadmin') && $mname == 'shop') { if (pkperm('isadmin') && $mname == 'shop') { $categorylist = getmodelcategory($mname); showsetting('syncfid', 'syncfid', '' . (empty($editvalue['syncfid']) ? '' : $editvalue['syncfid']), 'text'); echo '<tr><td class="td27" colspan="2">' . lang('category_' . $mname) . '<span style="color:red">*</span></td></tr><tr><td colspan="2" class="vtop rowform" id="' . $showarr['name'] . 'div">'; echo InteractionCategoryMenu($categorylist, 'catid', $editvalue['catid'], 1); echo '<span id="span_catid"></span></td></tr>'; } else { $categorylist = mymodelcategory($mname); echo '<tr><td class="td27" colspan="2">' . lang('category_' . $mname) . '<span style="color:red">*</span></td></tr><tr><td class="vtop rowform" id="catiddiv" colspan="2">'; echo InteractionCategoryMenu($categorylist, 'catid', $editvalue['catid'], 1); echo '<span id="span_catid"></span></td></tr>'; } if ($editvalue['attr_ids']) { require_once B_ROOT . '/batch.attribute.php'; $itemattrupdate = getattributesettingsupdate($editvalue['catid'], $editvalue['attr_ids']); } else { $itemattrupdate = ''; } echo '<tr><td colspan="2" style="border-top:none;"><div id="attributes">' . $itemattrupdate . '</div></td></tr>'; } elseif (!pkperm('isadmin') && $mname == 'shop') { $categorylist = getmodelcategory($mname); $editvalue['catid'] = $categorylist[$editvalue['catid']]['name']; showsetting($mname . '_catid', 'catid', $editvalue['catid'], 'p'); } if ($mname != 'consume') { pklabel(array('type' => 'file', 'alang' => $mname . '_subjectimage', 'name' => 'subjectimage', 'value' => $editvalue['subjectimage'], 'fileurl' => A_URL . '/' . $editvalue['subjectimage'])); } // 過期時間 if (in_array($mname, array('shop', 'good', 'consume', 'notice', 'groupbuy'))) { if (empty($editvalue['validity_start'])) { $editvalue['validity_start'] = date('Y-m-d', $_G['timestamp']); } else { $editvalue['validity_start'] = date('Y-m-d', $editvalue['validity_start']); } if (!pkperm('isadmin') && $_G['myshopstatus'] == 'verified' && $mname == 'shop') { showsetting('validity_start', 'validity_start', $editvalue['validity_start'], 'p'); } else { showsetting('validity_start', 'validity_start', $editvalue['validity_start'], 'calendar', '', 0, '', '', $value['required']); } if (empty($editvalue['validity_end'])) { $editvalue['validity_end'] = mktime(0, 0, 0, date('m', $_G['timestamp']), date('d', $_G['timestamp']), date('Y', $_G['timestamp']) + 10); if ($mname == 'consume') { $editvalue['validity_end'] = mktime(0, 0, 0, date('m', $_G['timestamp']) + 10, date('d', $_G['timestamp']), date('Y', $_G['timestamp'])); } } $editvalue['validity_end'] = date('Y-m-d', $editvalue['validity_end']); if (!pkperm('isadmin') && $_G['myshopstatus'] == 'verified' && $mname == 'shop') { showsetting('validity_end', 'validity_end', $editvalue['validity_end'], 'p'); } else { showsetting('validity_end', 'validity_end', $editvalue['validity_end'], 'calendar', '', 0, '', '', $value['required']); } } if ($mname == 'consume') { pklabel(array('type' => 'textarea', 'alang' => 'consume_message', 'name' => 'message', 'value' => $editvalue['message'])); pklabel(array('type' => 'textarea', 'alang' => 'consume_exception', 'name' => 'exception', 'value' => $editvalue['exception'])); if ($_G['setting']['allowcreateimg']) { $createimgradio = array(0, lang('createimg'), array('createimg' => '', 'uploadimg' => 'none')); } if ($_SGLOBAL['panelinfo']['group']['consumemaker'] == 1 || ckfounder($_G['uid'])) { $uploadimgradio = array(1, lang('uploadimg'), array('createimg' => 'none', 'uploadimg' => '')); } if (!empty($createimgradio) || !empty($uploadimgradio)) { showconsumemaker(array($uploadimgradio, $createimgradio), $file); } } /* 顯示商品描述 */ if ($mname == 'good') { pklabel(array('type' => 'textarea', 'alang' => 'good_intro', 'name' => 'intro', 'value' => $editvalue['intro'])); } if (pkperm('isadmin') && $mname != 'shop') { /* if($_GET['action'] == 'add') { showtablerow('', 'colspan="2" class="td27"', lang($mname.'_shopid').$required); showtablerow('class="noborder"', array('class="vtop rowform"', 'class="vtop tips2"'), array( show_cat_shop_linkarea(), lang($mname.'_shopid_comment') )); } elseif($_GET['action'] == 'edit') { showhiddenfields(array('shopid' => $editvalue['shopid'])); }*/ } elseif ($mname != 'shop') { showhiddenfields(array('shopid' => $editvalue['shopid'])); } else { pkregion(array('alang' => $mname . '_region', 'name' => 'region', 'options' => getmodelcategory('region'), 'value' => $editvalue['region'], 'required' => $required)); } if ($mname == 'shop') { pklabel(array('type' => 'input', 'alang' => 'global_seokeywords', 'name' => 'keywords', 'value' => $editvalue['keywords'])); pklabel(array('type' => 'textarea', 'alang' => 'global_seodescription', 'name' => 'description', 'value' => $editvalue['description'])); pklabel(array('type' => 'textarea', 'alang' => $mname . '_message', 'name' => 'message', 'value' => $editvalue['message'])); pklabel(array('type' => 'input', 'alang' => 'shop_letter', 'name' => 'letter', 'value' => $editvalue['letter'])); } elseif ($mname == 'good' || $mname == 'notice' || $mname == 'groupbuy') { $editvalue['message'] = bbcode2html($editvalue['message']); pklabel(array('type' => 'edit', 'alang' => $mname . '_message', 'name' => 'message', 'value' => $editvalue['message'])); } /* if($editvalue['grade'] > 1) { showsetting($mname.'_onshow', array('grade', array( array(3, lang($mname.'_onshow_true')), array(2, lang($mname.'_onshow_false')) )), $editvalue['grade'], 'select', '', 0, '', '', $required); }*/ }
} elseif ($_GET['op'] == 'add' || $_GET['op'] == 'edit') { shownav('global', 'nav_' . $_GET['op']); showsubmenu('nav_list', array(array('nav_list', 'nav', '0'), array('nav_' . ($_GET['op'] == 'add' ? 'add' : 'edit'), 'nav&op=add', '1'), array('nav_search', 'nav&op=search', '0'))); showformheader('nav&op=' . $_GET['op']); showtableheader(''); if ($_GET['op'] == 'edit') { if ($navid > 0) { $query = DB::query('select * from ' . tname('nav') . ' where navid=' . $navid); $navitem = DB::fetch($query); } else { cpmsg('ID ERROR .'); } } else { $navitem['available'] = 1; } showsetting('nav_name', 'subject', $navitem['name'], 'text', '', '', '', ' style=\'' . pktitlestyle($navitem['highlight']) . '\'', '<span style="color:red">*</span>'); showstyletitle('nav'); if ($navitem['type'] != 'sys') { showsetting('nav_url', 'url', $navitem['url'], 'text'); } showsetting('nav_target', 'nav_target', $navitem['target'], 'radio'); showsetting('nav_available', 'available', $navitem['available'], 'radio'); showsetting('nav_displayorder', 'displayorder', $navitem['displayorder'], 'number'); showhiddenfields(array('navid' => $_GET['navid'])); showsubmit('valuesubmit'); showtablefooter(); showformfooter(); bind_ajax_form(); } else { //沒有提交數據的列表頁 shownav('global', 'nav_list');
echo '<tbody id="_ads_topic" style="display:none;"><tr><td class="td27" colspan="2">' . lang('ads_topic') . ' <span style="font-weight:100">' . lang('ads_topic_comment') . '</td></tr>'; echo '<tr><td style="border:none;"><table>'; for ($i = 0; $i < 7; $i++) { echo '<tr class="noborder"><td class="vtop rowform"> <input type="text" class="txt" value="' . (!empty($editvalue['topic'][$i]) ? $editvalue['topic'][$i]['image'] : '') . '" name="topic[' . $i . '][image]"> </td> <td align="left" class="vtop rowform"> <input type="text" class="txt" value="' . (!empty($editvalue['topic'][$i]) ? $editvalue['topic'][$i]['url'] : '') . '" name="topic[' . $i . '][url]"></td></tr>'; } echo '</table></td></tr>'; showtablefooter(); showtableheader(); echo '<tr><td class="td27">' . lang('ads_notice') . '<span style="margin-left:80px; font-weight:normal;">' . lang('ads_notice_comment') . '</span></td></tr>'; echo '<tr><td style="border:none;"><table width="100%">'; for ($i = 0; $i < 7; $i++) { echo '<tr class="noborder"><td class="vtop rowform"><input type="text" class="txt" style="' . pktitlestyle($editvalue['notice'][$i]['style']) . '" value="' . (!empty($editvalue['notice'][$i]) ? $editvalue['notice'][$i]['title'] : '') . '" name="notice[' . $i . '][title]" id="notice' . $i . '"></td><td align="left" class="vtop rowform" style="width:auto;">' . '<input type="text" class="txt" style="float:left;" value="' . (!empty($editvalue['notice'][$i]) ? $editvalue['notice'][$i]['url'] : '') . '" name="notice[' . $i . '][url]" />' . '<div style="float:left; width:200px;">' . show_style_picker('notice' . $i, substr($editvalue['notice'][$i]['style'], 0, 7)) . '</div>' . '</td></tr>'; } echo "</table>"; showtablefooter(); showtableheader(); showsetting('ads_hotgoods', 'hotgoods', $editvalue['hotgoods'], 'text'); showsetting('ads_consume', 'consume', $editvalue['consume'], 'text'); showsetting('ads_groupbuy', 'groupbuy', $editvalue['groupbuy'], 'text'); showsetting('ads_discount', 'discount', $editvalue['discount'], 'text'); showsetting('ads_hotshop', 'hotshop', $editvalue['hotshop'], 'text'); showsetting('ads_sidebarconsume', 'sidebarconsume', $editvalue['sidebarconsume'], 'text'); showsetting('ads_sidebargroupbuy', 'sidebargroupbuy', $editvalue['sidebargroupbuy'], 'text'); showsetting('ads_sidebarshop', 'sidebarshop', $editvalue['sidebarshop'], 'text'); showsubmit('settingsubmit', 'submit', '', $extbutton . (!empty($from) ? '<input type="hidden" name="from" value="' . $from . '">' : '')); showtablefooter(); echo '