code
stringlengths
1
2.01M
repo_name
stringlengths
3
62
path
stringlengths
1
267
language
stringclasses
231 values
license
stringclasses
13 values
size
int64
1
2.01M
<!-- $Id: snatch_list.htm 14216 2008-03-10 02:27:21Z testyang $ --> <?php if ($this->_var['full_page']): ?> <?php echo $this->fetch('pageheader.htm'); ?> <?php echo $this->smarty_insert_scripts(array('files'=>'../js/utils.js,listtable.js')); ?> <div class="form-div"> <form action="javascript:searchSnatch()" name="searchForm"> <img src="images/icon_search.gif" width="26" height="22" border="0" alt="SEARCH" /> <?php echo $this->_var['lang']['snatch_name']; ?> <input type="text" name="keyword" /> <input type="submit" value="<?php echo $this->_var['lang']['button_search']; ?>" class="button" /> </form> </div> <form method="post" action="" name="listForm"> <div class="list-div" id="listDiv"> <?php endif; ?> <table cellpadding="3" cellspacing="1"> <tr> <th><a href="javascript:listTable.sort('act_id'); "><?php echo $this->_var['lang']['record_id']; ?></a><?php echo $this->_var['sort_act_id']; ?></th> <th><a href="javascript:listTable.sort('snatch_name'); "><?php echo $this->_var['lang']['snatch_name']; ?></a><?php echo $this->_var['sort_snatch_name']; ?></th> <th><a href="javascript:listTable.sort('goods_name'); "><?php echo $this->_var['lang']['goods_name']; ?></a><?php echo $this->_var['sort_goods_name']; ?></th> <th><a href="javascript:listTable.sort('start_time'); "><?php echo $this->_var['lang']['start_time']; ?></a><?php echo $this->_var['sort_start_time']; ?></th> <th><a href="javascript:listTable.sort('end_time'); "><?php echo $this->_var['lang']['end_time']; ?></a><?php echo $this->_var['sort_end_time']; ?></th> <th><?php echo $this->_var['lang']['min_price']; ?></a></th> <th><?php echo $this->_var['lang']['integral']; ?></a></th> <th><?php echo $this->_var['lang']['handler']; ?></th> </tr> <?php $_from = $this->_var['snatch_list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'snatch');if (count($_from)): foreach ($_from AS $this->_var['snatch']): ?> <tr> <td align="center"><?php echo $this->_var['snatch']['act_id']; ?></td> <td class="first-cell"><span onclick="listTable.edit(this, 'edit_snatch_name', <?php echo $this->_var['snatch']['act_id']; ?>)"><?php echo $this->_var['snatch']['snatch_name']; ?></span></td> <td><span><?php echo $this->_var['snatch']['goods_name']; ?></span></td> <td align="center"><?php echo $this->_var['snatch']['start_time']; ?></td> <td align="center"><?php echo $this->_var['snatch']['end_time']; ?></td> <td align="right"><?php echo $this->_var['snatch']['start_price']; ?></td> <td align="right"><?php echo $this->_var['snatch']['cost_points']; ?></td> <td align="center"> <a href="snatch.php?act=view&amp;snatch_id=<?php echo $this->_var['snatch']['act_id']; ?>" title="<?php echo $this->_var['lang']['view_detail']; ?>"><img src="images/icon_view.gif" border="0" height="16" width="16"></a> <a href="snatch.php?act=edit&amp;id=<?php echo $this->_var['snatch']['act_id']; ?>" title="<?php echo $this->_var['lang']['edit']; ?>"><img src="images/icon_edit.gif" border="0" height="16" width="16"></a> <a href="javascript:;" onclick="listTable.remove(<?php echo $this->_var['snatch']['act_id']; ?>,'<?php echo $this->_var['lang']['drop_confirm']; ?>')" title="<?php echo $this->_var['lang']['remove']; ?>"><img src="images/icon_drop.gif" border="0" height="16" width="16"></a> </td> </tr> <?php endforeach; else: ?> <tr><td class="no-records" colspan="10"><?php echo $this->_var['lang']['no_records']; ?></td></tr> <?php endif; unset($_from); ?><?php $this->pop_vars();; ?> <tr> <td align="right" nowrap="true" colspan="10"><?php echo $this->fetch('page.htm'); ?></td> </tr> </table> <?php if ($this->_var['full_page']): ?> </div> </form> <!-- end article list --> <script type="text/javascript" language="JavaScript"> <!-- listTable.recordCount = <?php echo $this->_var['record_count']; ?>; listTable.pageCount = <?php echo $this->_var['page_count']; ?>; <?php $_from = $this->_var['filter']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'item');if (count($_from)): foreach ($_from AS $this->_var['key'] => $this->_var['item']): ?> listTable.filter.<?php echo $this->_var['key']; ?> = '<?php echo $this->_var['item']; ?>'; <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> onload = function() { document.forms['searchForm'].elements['keyword'].focus(); // 开始检查订单 startCheckOrder(); } /** * 搜索文章 */ function searchSnatch() { var keyword = Utils.trim(document.forms['searchForm'].elements['keyword'].value); listTable.filter.keywords = keyword; listTable.filter.page = 1; listTable.loadList(); } //--> </script> <?php echo $this->fetch('pagefooter.htm'); ?> <?php endif; ?>
zzshop
trunk/temp/compiled/admin/snatch_list.htm.php
PHP
asf20
5,047
<!-- $Id: setting_first.htm 16339 2009-06-24 08:01:25Z liuhui $ --> <?php echo $this->fetch('pageheader.htm'); ?> <?php echo $this->smarty_insert_scripts(array('files'=>'../js/utils.js,../js/region.js')); ?> <div class="main-div"> <div class="step1"><?php echo $this->_var['lang']['shop_basic_first']; ?></em></div> <form action="index.php?act=second" name="theForm" method="post" onsubmit="return validator()" > <table cellspacing="1" cellpadding="3" width="100%"> <tr> <td class="micro-label"><?php echo $this->_var['lang']['shop_name']; ?>:</td> <td><input type="text" name="shop_name" value="<?php echo $this->_var['shop_name']; ?>" /></td> </tr> <tr> <td class="micro-label"><?php echo $this->_var['lang']['shop_title']; ?>:</td> <td><input type="text" name="shop_title" value="<?php echo $this->_var['shop_title']; ?>" /></td> </tr> <tr> <td class="micro-label"><?php echo $this->_var['lang']['shop_country']; ?>:</td> <td> <select name="shop_country" id="selCountries" onchange="region.changed(this, 1, 'selProvinces')"> <option value=''><?php echo $this->_var['lang']['select_please']; ?></option> <?php $_from = $this->_var['countries']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'region');if (count($_from)): foreach ($_from AS $this->_var['region']): ?> <option value="<?php echo $this->_var['region']['region_id']; ?>" <?php if ($this->_var['region']['region_id'] == 1): ?>selected<?php endif; ?>><?php echo $this->_var['region']['region_name']; ?></option> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </select> </td> </tr> <tr> <td class="micro-label"><?php echo $this->_var['lang']['shop_province']; ?>:</td> <td> <select name="shop_province" id="selProvinces" onchange="region.changed(this, 2, 'selCities')"> <option value=''><?php echo $this->_var['lang']['select_please']; ?></option> <?php $_from = $this->_var['provinces']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'region');if (count($_from)): foreach ($_from AS $this->_var['region']): ?> <option value="<?php echo $this->_var['region']['region_id']; ?>" <?php if ($this->_var['region']['region_id'] == 2): ?>selected<?php endif; ?>> <?php echo $this->_var['region']['region_name']; ?></option> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </select> </td> </tr> <tr> <td class="micro-label"><?php echo $this->_var['lang']['shop_city']; ?>:</td> <td> <select name="shop_city" id="selCities"> <option value=''><?php echo $this->_var['lang']['select_please']; ?></option> <?php $_from = $this->_var['cities']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'region');if (count($_from)): foreach ($_from AS $this->_var['region']): ?> <option value="<?php echo $this->_var['region']['region_id']; ?>" <?php if ($this->_var['region']['region_id'] == 35): ?>selected<?php endif; ?>><?php echo $this->_var['region']['region_name']; ?></option> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </select> </td> </tr> <tr> <td class="micro-label"><?php echo $this->_var['lang']['shop_address']; ?>:</td> <td><input type="text" name="shop_address" /></td> </tr> <tr> <td class="micro-label"><?php echo $this->_var['lang']['shop_ship']; ?>:</td> <td> <select name="shipping" id="shipping_type" onchange="show_shipping_area()"> <option value=''><?php echo $this->_var['lang']['select_please']; ?></option> <?php $_from = $this->_var['modules']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'module');if (count($_from)): foreach ($_from AS $this->_var['module']): ?> <option value="<?php echo $this->_var['module']['code']; ?>" ><?php echo $this->_var['module']['name']; ?></option> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </select> </td> </tr> <tr> <td></td> <td> <div id="shipping_area" style="display:none"> <table cellspacing="1" cellpadding="3" width="100%"> <tr> <td width="80"><?php echo $this->_var['lang']['ship_name']; ?>:</td> <td><input type="text" name="area_name" style="margin-bottom:5px;vertical-align:middle"></td> </tr> <tr> <td><?php echo $this->_var['lang']['ship_country']; ?>:</td> <td> <select name="shipping_country" id="sel_Countries" onchange="region.changed(this, 1, 'sel_Provinces')"> <?php $_from = $this->_var['countries']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'region');if (count($_from)): foreach ($_from AS $this->_var['region']): ?> <option value="<?php echo $this->_var['region']['region_id']; ?>" ><?php echo $this->_var['region']['region_name']; ?></option> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </select> </td> </tr> <tr> <td><?php echo $this->_var['lang']['ship_province']; ?>:</td> <td> <select name="shipping_province" id="sel_Provinces" onchange="region.changed(this, 2, 'sel_Cities')"> <option value=''><?php echo $this->_var['lang']['select_please']; ?></option> <?php $_from = $this->_var['provinces']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'region');if (count($_from)): foreach ($_from AS $this->_var['region']): ?> <option value="<?php echo $this->_var['region']['region_id']; ?>" ><?php echo $this->_var['region']['region_name']; ?></option> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </select> </td> </tr> <tr> <td><?php echo $this->_var['lang']['ship_city']; ?>:</td> <td> <select name="shipping_city" id="sel_Cities" onchange="region.changed(this, 3, 'sel_Districts')"> <option value=''><?php echo $this->_var['lang']['select_please']; ?></option> </select> </td> </tr> <tr> <td><?php echo $this->_var['lang']['select_please']; ?></td> <td> <select name="shipping_district" id="sel_Districts"> <option value=''><?php echo $this->_var['lang']['select_please']; ?></option> </select> </td> </tr> </table> </div> </td> </tr> <tr> <td class="micro-label"><?php echo $this->_var['lang']['shop_pay']; ?>:</td> <td> <table border="0" cellpadding="0" cellspacing="0" style="margin-top:-10px"><tr><td width="50"><select name="payment" id="payment_type" onchange="loadConfig()" > <option value=''><?php echo $this->_var['lang']['select_please']; ?></option> <?php $_from = $this->_var['modules_payment']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'module');if (count($_from)): foreach ($_from AS $this->_var['module']): ?> <option value="<?php echo $this->_var['module']['code']; ?>" ><?php echo $this->_var['module']['name']; ?></option> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </select></td> <td> <div align="left"><span id="paynon"><?php echo $this->_var['lang']['alipay_login']; ?></span> </div></td></tr></table> </td> </tr> <tr> <td></td> <td> <div id="paymentConfig" style="display:none"> </div> </td> </tr> <tr> <td></td> <td> <input type="submit" value=<?php echo $this->_var['lang']['next_step']; ?> class="button" /> <input type="button" value=<?php echo $this->_var['lang']['skip']; ?> onclick="javascript:window.location.href='index.php?act=main'" class="button" /> </td> </tr> </table> </form> </div> <?php echo $this->smarty_insert_scripts(array('files'=>'validator.js')); ?> <script type="Text/Javascript" language="JavaScript"> <!-- region.isAdmin = true; onload = function() { document.getElementById('paynon').style.display = 'none'; } function validator() { var validator = new Validator('theForm'); validator.required('shop_name', shop_name_not_null); return validator.passed(); } function show_shipping_area() { Ajax.call('shipping.php?act=shipping_priv', '', shippingResponse, 'GET', 'JSON'); } function shippingResponse(result) { var shipping_name = document.getElementById('shipping_type'); if (result.error == '1' && result.message != '') { alert(result.message); shipping_name.options[0].selected = true; return; } var area = document.getElementById('shipping_area'); if(shipping_name.value == '') { area.style.display = 'none'; } else { area.style.display = "block"; } } function loadConfig() { var payment = document.forms['theForm'].elements['payment']; var paymentConfig = document.getElementById('paymentConfig'); if(payment.value == '') { paymentConfig.style.display = 'none'; return; } else { paymentConfig.style.display = 'block'; } if(payment.value == 'alipay') { document.getElementById('paynon').style.display = 'block'; } else { document.getElementById('paynon').style.display = 'none'; } var params = 'code=' + payment.value; Ajax.call('payment.php?is_ajax=1&act=get_config', params, showConfig, 'GET', 'JSON'); } function showConfig(result) { var payment = document.forms['theForm'].elements['payment']; if (result.error == '1' && result.message != '') { alert(result.message); payment.options[0].selected = true; return; } var paymentConfig = document.getElementById('paymentConfig'); var config = result.content; paymentConfig.innerHTML = config; } //--> </script> <?php echo $this->fetch('pagefooter.htm'); ?>
zzshop
trunk/temp/compiled/admin/setting_first.htm.php
PHP
asf20
10,805
<!-- $Id: comment_list.htm 14216 2008-03-10 02:27:21Z testyang $ --> <?php if ($this->_var['full_page']): ?> <?php echo $this->fetch('pageheader.htm'); ?> <?php echo $this->smarty_insert_scripts(array('files'=>'../js/utils.js,listtable.js')); ?> <div class="form-div"> <form action="javascript:searchComment()" name="searchForm"> <img src="images/icon_search.gif" width="26" height="22" border="0" alt="SEARCH" /> <?php echo $this->_var['lang']['search_comment']; ?> <input type="text" name="keyword" /> <input type="submit" class="Button" value="<?php echo $this->_var['lang']['button_search']; ?>" /> </form> </div> <form method="POST" action="comment_manage.php?act=batch_drop" name="listForm" onsubmit="return confirm_bath()"> <!-- start comment list --> <div class="list-div" id="listDiv"> <?php endif; ?> <table cellpadding="3" cellspacing="1"> <tr> <th> <input onclick='listTable.selectAll(this, "checkboxes")' type="checkbox"> <a href="javascript:listTable.sort('comment_id'); "><?php echo $this->_var['lang']['record_id']; ?></a> <?php echo $this->_var['sort_comment_id']; ?></th> <th><a href="javascript:listTable.sort('user_name'); "><?php echo $this->_var['lang']['user_name']; ?></a><?php echo $this->_var['sort_user_name']; ?></th> <th><a href="javascript:listTable.sort('comment_type'); "><?php echo $this->_var['lang']['comment_type']; ?></a><?php echo $this->_var['sort_comment_type']; ?></th> <th><a href="javascript:listTable.sort('id_value'); "><?php echo $this->_var['lang']['comment_obj']; ?></a><?php echo $this->_var['sort_id_value']; ?></th> <th><a href="javascript:listTable.sort('ip_address'); "><?php echo $this->_var['lang']['ip_address']; ?></a><?php echo $this->_var['sort_ip_address']; ?></th> <th><a href="javascript:listTable.sort('add_time'); "><?php echo $this->_var['lang']['comment_time']; ?></a><?php echo $this->_var['sort_add_time']; ?></th> <th><?php echo $this->_var['lang']['comment_flag']; ?></th> <th><?php echo $this->_var['lang']['handler']; ?></th> </tr> <?php $_from = $this->_var['comment_list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'comment');if (count($_from)): foreach ($_from AS $this->_var['comment']): ?> <tr> <td><input value="<?php echo $this->_var['comment']['comment_id']; ?>" name="checkboxes[]" type="checkbox"><?php echo $this->_var['comment']['comment_id']; ?></td> <td><?php if ($this->_var['comment']['user_name']): ?><?php echo $this->_var['comment']['user_name']; ?><?php else: ?><?php echo $this->_var['lang']['anonymous']; ?><?php endif; ?></td> <td><?php echo $this->_var['lang']['type'][$this->_var['comment']['comment_type']]; ?></td> <td><a href="../<?php if ($this->_var['comment']['comment_type'] == '0'): ?>goods<?php else: ?>article<?php endif; ?>.php?id=<?php echo $this->_var['comment']['id_value']; ?>" target="_blank"><?php echo $this->_var['comment']['title']; ?></td> <td><?php echo $this->_var['comment']['ip_address']; ?></td> <td align="center"><?php echo $this->_var['comment']['add_time']; ?></td> <td align="center"><?php if ($this->_var['comment']['status'] == 0): ?><?php echo $this->_var['lang']['hidden']; ?><?php else: ?><?php echo $this->_var['lang']['display']; ?><?php endif; ?></td> <td align="center"> <a href="comment_manage.php?act=reply&amp;id=<?php echo $this->_var['comment']['comment_id']; ?>"><?php echo $this->_var['lang']['view_content']; ?></a> | <a href="javascript:" onclick="listTable.remove(<?php echo $this->_var['comment']['comment_id']; ?>, '<?php echo $this->_var['lang']['drop_confirm']; ?>')"><?php echo $this->_var['lang']['remove']; ?></a> </td> </tr> <?php endforeach; else: ?> <tr><td class="no-records" colspan="10"><?php echo $this->_var['lang']['no_records']; ?></td></tr> <?php endif; unset($_from); ?><?php $this->pop_vars();; ?> </table> <table cellpadding="4" cellspacing="0"> <tr> <td> <div> <select name="sel_action"> <option value="remove"><?php echo $this->_var['lang']['drop_select']; ?></option> <option value="allow"><?php echo $this->_var['lang']['allow']; ?></option> <option value="deny"><?php echo $this->_var['lang']['forbid']; ?></option> </select> <input type="hidden" name="act" value="batch" /> <input type="submit" name="drop" id="btnSubmit" value="<?php echo $this->_var['lang']['button_submit']; ?>" class="button" disabled="true" /></div></td> <td align="right"><?php echo $this->fetch('page.htm'); ?></td> </tr> </table> <?php if ($this->_var['full_page']): ?> </div> <!-- end comment list --> </form> <script type="text/javascript" language="JavaScript"> <!-- listTable.recordCount = <?php echo $this->_var['record_count']; ?>; listTable.pageCount = <?php echo $this->_var['page_count']; ?>; cfm = new Object(); cfm['allow'] = '<?php echo $this->_var['lang']['cfm_allow']; ?>'; cfm['remove'] = '<?php echo $this->_var['lang']['cfm_remove']; ?>'; cfm['deny'] = '<?php echo $this->_var['lang']['cfm_deny']; ?>'; <?php $_from = $this->_var['filter']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'item');if (count($_from)): foreach ($_from AS $this->_var['key'] => $this->_var['item']): ?> listTable.filter.<?php echo $this->_var['key']; ?> = '<?php echo $this->_var['item']; ?>'; <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> onload = function() { document.forms['searchForm'].elements['keyword'].focus(); // 开始检查订单 startCheckOrder(); } /** * 搜索评论 */ function searchComment() { var keyword = Utils.trim(document.forms['searchForm'].elements['keyword'].value); if (keyword.length > 0) { listTable.filter['keywords'] = keyword; listTable.filter.page = 1; listTable.loadList(); } else { document.forms['searchForm'].elements['keyword'].focus(); } } function confirm_bath() { var action = document.forms['listForm'].elements['sel_action'].value; return confirm(cfm[action]); } //--> </script> <?php echo $this->fetch('pagefooter.htm'); ?> <?php endif; ?>
zzshop
trunk/temp/compiled/admin/comment_list.htm.php
PHP
asf20
6,458
<!-- $Id: shop_config_mail_settings.htm 14216 2008-03-10 02:27:21Z testyang $ --> <?php echo $this->fetch('pageheader.htm'); ?> <?php echo $this->smarty_insert_scripts(array('files'=>'validator.js')); ?> <form method="POST" action="shop_config.php?act=post" name="theForm"> <div class="main-div"><p style="padding: 0 10px"><?php echo $this->_var['lang']['mail_settings_note']; ?></p></div> <div class="main-div"> <table width="100%" id="<?php echo $this->_var['group']['code']; ?>-table" > <?php $_from = $this->_var['cfg']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'var');if (count($_from)): foreach ($_from AS $this->_var['key'] => $this->_var['var']): ?> <?php echo $this->fetch('shop_config_form.htm'); ?> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <tr> <td class="label"><?php echo $this->_var['lang']['cfg_name']['test_mail_address']; ?>:</td> <td> <input type="text" name="test_mail_address" size="30" /> <input type="button" value="<?php echo $this->_var['lang']['cfg_name']['send']; ?>" onclick="sendTestEmail();" class="button" /> </td> </tr> <tr> <td align="center" colspan="2"> <input name="submit" type="submit" value="<?php echo $this->_var['lang']['button_submit']; ?>" class="button" /> <input name="reset" type="reset" value="<?php echo $this->_var['lang']['button_reset']; ?>" class="button" /> <input name="type" type="hidden" value="mail_setting" class="button" /> </td> </tr> </table> </div> </form> <script type="text/javascript" language="JavaScript"> <!-- onload = function() { // 开始检查订单 startCheckOrder(); } /** * 测试邮件的发送 */ function sendTestEmail() { var eles = document.forms['theForm'].elements; var smtp_host = eles['value[501]'].value; var smtp_port = eles['value[502]'].value; var smtp_user = eles['value[503]'].value; var smtp_pass = eles['value[504]'].value; var reply_email = eles['value[505]'].value; var test_mail_address = eles['test_mail_address'].value; var mail_charset = 0; for (i = 0; i < eles['value[506]'].length; i++) { if (eles['value[506]'][i].checked) { mail_charset = eles['value[506]'][i].value; } } var mail_service = 0; for (i = 0; i < eles['value[507]'].length; i++) { if (eles['value[507]'][i].checked) { mail_service = eles['value[507]'][i].value; } } Ajax.call('shop_config.php?is_ajax=1&act=send_test_email', 'email=' + test_mail_address + '&mail_service=' + mail_service + '&smtp_host=' + smtp_host + '&smtp_port=' + smtp_port + '&smtp_user=' + smtp_user + '&smtp_pass=' + encodeURIComponent(smtp_pass) + '&reply_email=' + reply_email + '&mail_charset=' + mail_charset, emailResponse, 'POST', 'JSON'); } /** * 邮件发送的反馈信息 */ function emailResponse(result) { alert(result.message); } //--> </script> <?php echo $this->fetch('pagefooter.htm'); ?>
zzshop
trunk/temp/compiled/admin/shop_config_mail_settings.htm.php
PHP
asf20
3,180
<!-- $Id: goods_list.htm 17126 2010-04-23 10:30:26Z liuhui $ --> <?php if ($this->_var['full_page']): ?> <?php echo $this->fetch('pageheader.htm'); ?> <?php echo $this->smarty_insert_scripts(array('files'=>'../js/utils.js,listtable.js')); ?> <!-- 商品搜索 --> <?php echo $this->fetch('goods_search.htm'); ?> <!-- 商品列表 --> <form method="post" action="" name="listForm" onsubmit="return confirmSubmit(this)"> <!-- start goods list --> <div class="list-div" id="listDiv"> <?php endif; ?> <table cellpadding="3" cellspacing="1"> <tr> <th> <input onclick='listTable.selectAll(this, "checkboxes")' type="checkbox" /> <a href="javascript:listTable.sort('goods_id'); "><?php echo $this->_var['lang']['record_id']; ?></a><?php echo $this->_var['sort_goods_id']; ?> </th> <th><a href="javascript:listTable.sort('goods_name'); "><?php echo $this->_var['lang']['goods_name']; ?></a><?php echo $this->_var['sort_goods_name']; ?></th> <th><a href="javascript:listTable.sort('goods_sn'); "><?php echo $this->_var['lang']['goods_sn']; ?></a><?php echo $this->_var['sort_goods_sn']; ?></th> <th><a href="javascript:listTable.sort('shop_price'); "><?php echo $this->_var['lang']['shop_price']; ?></a><?php echo $this->_var['sort_shop_price']; ?></th> <th><a href="javascript:listTable.sort('is_on_sale'); "><?php echo $this->_var['lang']['is_on_sale']; ?></a><?php echo $this->_var['sort_is_on_sale']; ?></th> <th><a href="javascript:listTable.sort('is_best'); "><?php echo $this->_var['lang']['is_best']; ?></a><?php echo $this->_var['sort_is_best']; ?></th> <th><a href="javascript:listTable.sort('is_new'); "><?php echo $this->_var['lang']['is_new']; ?></a><?php echo $this->_var['sort_is_new']; ?></th> <th><a href="javascript:listTable.sort('is_hot'); "><?php echo $this->_var['lang']['is_hot']; ?></a><?php echo $this->_var['sort_is_hot']; ?></th> <th><a href="javascript:listTable.sort('sort_order'); "><?php echo $this->_var['lang']['sort_order']; ?></a><?php echo $this->_var['sort_sort_order']; ?></th> <?php if ($this->_var['use_storage']): ?> <th><a href="javascript:listTable.sort('goods_number'); "><?php echo $this->_var['lang']['goods_number']; ?></a><?php echo $this->_var['sort_goods_number']; ?></th> <?php endif; ?> <th><?php echo $this->_var['lang']['handler']; ?></th> <tr> <?php $_from = $this->_var['goods_list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'goods');if (count($_from)): foreach ($_from AS $this->_var['goods']): ?> <tr> <td><input type="checkbox" name="checkboxes[]" value="<?php echo $this->_var['goods']['goods_id']; ?>" /><?php echo $this->_var['goods']['goods_id']; ?></td> <td class="first-cell" style="<?php if ($this->_var['goods']['is_promote']): ?>color:red;<?php endif; ?>"><span onclick="listTable.edit(this, 'edit_goods_name', <?php echo $this->_var['goods']['goods_id']; ?>)"><?php echo htmlspecialchars($this->_var['goods']['goods_name']); ?></span></td> <td><span onclick="listTable.edit(this, 'edit_goods_sn', <?php echo $this->_var['goods']['goods_id']; ?>)"><?php echo $this->_var['goods']['goods_sn']; ?></span></td> <td align="right"><span onclick="listTable.edit(this, 'edit_goods_price', <?php echo $this->_var['goods']['goods_id']; ?>)"><?php echo $this->_var['goods']['shop_price']; ?> </span></td> <td align="center"><img src="images/<?php if ($this->_var['goods']['is_on_sale']): ?>yes<?php else: ?>no<?php endif; ?>.gif" onclick="listTable.toggle(this, 'toggle_on_sale', <?php echo $this->_var['goods']['goods_id']; ?>)" /></td> <td align="center"><img src="images/<?php if ($this->_var['goods']['is_best']): ?>yes<?php else: ?>no<?php endif; ?>.gif" onclick="listTable.toggle(this, 'toggle_best', <?php echo $this->_var['goods']['goods_id']; ?>)" /></td> <td align="center"><img src="images/<?php if ($this->_var['goods']['is_new']): ?>yes<?php else: ?>no<?php endif; ?>.gif" onclick="listTable.toggle(this, 'toggle_new', <?php echo $this->_var['goods']['goods_id']; ?>)" /></td> <td align="center"><img src="images/<?php if ($this->_var['goods']['is_hot']): ?>yes<?php else: ?>no<?php endif; ?>.gif" onclick="listTable.toggle(this, 'toggle_hot', <?php echo $this->_var['goods']['goods_id']; ?>)" /></td> <td align="center"><span onclick="listTable.edit(this, 'edit_sort_order', <?php echo $this->_var['goods']['goods_id']; ?>)"><?php echo $this->_var['goods']['sort_order']; ?></span></td> <?php if ($this->_var['use_storage']): ?> <td align="right"><span onclick="listTable.edit(this, 'edit_goods_number', <?php echo $this->_var['goods']['goods_id']; ?>)"><?php echo $this->_var['goods']['goods_number']; ?></span></td> <?php endif; ?> <td align="center"> <a href="../goods.php?id=<?php echo $this->_var['goods']['goods_id']; ?>" target="_blank" title="<?php echo $this->_var['lang']['view']; ?>"><img src="images/icon_view.gif" width="16" height="16" border="0" /></a> <a href="goods.php?act=edit&goods_id=<?php echo $this->_var['goods']['goods_id']; ?><?php if ($this->_var['code'] != 'real_goods'): ?>&extension_code=<?php echo $this->_var['code']; ?><?php endif; ?>" title="<?php echo $this->_var['lang']['edit']; ?>"><img src="images/icon_edit.gif" width="16" height="16" border="0" /></a> <a href="goods.php?act=copy&goods_id=<?php echo $this->_var['goods']['goods_id']; ?><?php if ($this->_var['code'] != 'real_goods'): ?>&extension_code=<?php echo $this->_var['code']; ?><?php endif; ?>" title="<?php echo $this->_var['lang']['copy']; ?>"><img src="images/icon_copy.gif" width="16" height="16" border="0" /></a> <a href="javascript:;" onclick="listTable.remove(<?php echo $this->_var['goods']['goods_id']; ?>, '<?php echo $this->_var['lang']['trash_goods_confirm']; ?>')" title="<?php echo $this->_var['lang']['trash']; ?>"><img src="images/icon_trash.gif" width="16" height="16" border="0" /></a> <?php if ($this->_var['specifications'] [ $this->_var['goods']['goods_type'] ] != ''): ?><a href="goods.php?act=product_list&goods_id=<?php echo $this->_var['goods']['goods_id']; ?>" title="<?php echo $this->_var['lang']['item_list']; ?>"><img src="images/icon_docs.gif" width="16" height="16" border="0" /></a><?php else: ?><img src="images/empty.gif" width="16" height="16" border="0" /><?php endif; ?> <?php if ($this->_var['add_handler']): ?> | <?php $_from = $this->_var['add_handler']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'handler');if (count($_from)): foreach ($_from AS $this->_var['handler']): ?> <a href="<?php echo $this->_var['handler']['url']; ?>&goods_id=<?php echo $this->_var['goods']['goods_id']; ?>" title="<?php echo $this->_var['handler']['title']; ?>"><img src="images/<?php echo $this->_var['handler']['img']; ?>" width="16" height="16" border="0" /></a> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <?php endif; ?> </td> </tr> <?php endforeach; else: ?> <tr><td class="no-records" colspan="10"><?php echo $this->_var['lang']['no_records']; ?></td></tr> <?php endif; unset($_from); ?><?php $this->pop_vars();; ?> </table> <!-- end goods list --> <!-- 分页 --> <table id="page-table" cellspacing="0"> <tr> <td align="right" nowrap="true"> <?php echo $this->fetch('page.htm'); ?> </td> </tr> </table> <?php if ($this->_var['full_page']): ?> </div> <div> <input type="hidden" name="act" value="batch" /> <select name="type" id="selAction" onchange="changeAction()"> <option value=""><?php echo $this->_var['lang']['select_please']; ?></option> <option value="trash"><?php echo $this->_var['lang']['trash']; ?></option> <option value="on_sale"><?php echo $this->_var['lang']['on_sale']; ?></option> <option value="not_on_sale"><?php echo $this->_var['lang']['not_on_sale']; ?></option> <option value="best"><?php echo $this->_var['lang']['best']; ?></option> <option value="not_best"><?php echo $this->_var['lang']['not_best']; ?></option> <option value="new"><?php echo $this->_var['lang']['new']; ?></option> <option value="not_new"><?php echo $this->_var['lang']['not_new']; ?></option> <option value="hot"><?php echo $this->_var['lang']['hot']; ?></option> <option value="not_hot"><?php echo $this->_var['lang']['not_hot']; ?></option> <option value="move_to"><?php echo $this->_var['lang']['move_to']; ?></option> <?php if ($this->_var['suppliers_list'] > 0): ?> <option value="suppliers_move_to"><?php echo $this->_var['lang']['suppliers_move_to']; ?></option> <?php endif; ?> </select> <select name="target_cat" style="display:none"> <option value="0"><?php echo $this->_var['lang']['select_please']; ?></option><?php echo $this->_var['cat_list']; ?> </select> <?php if ($this->_var['suppliers_list'] > 0): ?> <!--二级主菜单:转移供货商--> <select name="suppliers_id" style="display:none"> <option value="-1"><?php echo $this->_var['lang']['select_please']; ?></option> <option value="0"><?php echo $this->_var['lang']['lab_to_shopex']; ?></option> <?php $_from = $this->_var['suppliers_list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'sl');$this->_foreach['sln'] = array('total' => count($_from), 'iteration' => 0); if ($this->_foreach['sln']['total'] > 0): foreach ($_from AS $this->_var['sl']): $this->_foreach['sln']['iteration']++; ?> <option value="<?php echo $this->_var['sl']['suppliers_id']; ?>"><?php echo $this->_var['sl']['suppliers_name']; ?></option> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </select> <!--end!--> <?php endif; ?> <?php if ($this->_var['code'] != 'real_goods'): ?> <input type="hidden" name="extension_code" value="<?php echo $this->_var['code']; ?>" /> <?php endif; ?> <input type="submit" value="<?php echo $this->_var['lang']['button_submit']; ?>" id="btnSubmit" name="btnSubmit" class="button" disabled="true" /> </div> </form> <script type="text/javascript"> listTable.recordCount = <?php echo $this->_var['record_count']; ?>; listTable.pageCount = <?php echo $this->_var['page_count']; ?>; <?php $_from = $this->_var['filter']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'item');if (count($_from)): foreach ($_from AS $this->_var['key'] => $this->_var['item']): ?> listTable.filter.<?php echo $this->_var['key']; ?> = '<?php echo $this->_var['item']; ?>'; <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> onload = function() { startCheckOrder(); // 开始检查订单 document.forms['listForm'].reset(); } /** * @param: bool ext 其他条件:用于转移分类 */ function confirmSubmit(frm, ext) { if (frm.elements['type'].value == 'trash') { return confirm(batch_trash_confirm); } else if (frm.elements['type'].value == 'not_on_sale') { return confirm(batch_no_on_sale); } else if (frm.elements['type'].value == 'move_to') { ext = (ext == undefined) ? true : ext; return ext && frm.elements['target_cat'].value != 0; } else if (frm.elements['type'].value == '') { return false; } else { return true; } } function changeAction() { var frm = document.forms['listForm']; // 切换分类列表的显示 frm.elements['target_cat'].style.display = frm.elements['type'].value == 'move_to' ? '' : 'none'; <?php if ($this->_var['suppliers_list'] > 0): ?> frm.elements['suppliers_id'].style.display = frm.elements['type'].value == 'suppliers_move_to' ? '' : 'none'; <?php endif; ?> if (!document.getElementById('btnSubmit').disabled && confirmSubmit(frm, false)) { frm.submit(); } } </script> <?php echo $this->fetch('pagefooter.htm'); ?> <?php endif; ?>
zzshop
trunk/temp/compiled/admin/goods_list.htm.php
PHP
asf20
12,336
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title><?php echo $this->_var['app_name']; ?></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link href="styles/general.css" rel="stylesheet" type="text/css" /> <style type="text/css"> #header-div { background: #278296; border-bottom: 1px solid #FFF; } #logo-div { height: 50px; float: left; } #license-div { height: 50px; float: left; text-align:center; vertical-align:middle; line-height:50px; } #license-div a:visited, #license-div a:link { color: #EB8A3D; } #license-div a:hover { text-decoration: none; color: #EB8A3D; } #submenu-div { height: 50px; } #submenu-div ul { margin: 0; padding: 0; list-style-type: none; } #submenu-div li { float: right; padding: 0 10px; margin: 3px 0; border-left: 1px solid #FFF; } #submenu-div a:visited, #submenu-div a:link { color: #FFF; text-decoration: none; } #submenu-div a:hover { color: #F5C29A; } #loading-div { clear: right; text-align: right; display: block; } #menu-div { background: #80BDCB; font-weight: bold; height: 24px; line-height:24px; } #menu-div ul { margin: 0; padding: 0; list-style-type: none; } #menu-div li { float: left; border-right: 1px solid #192E32; border-left:1px solid #BBDDE5; } #menu-div a:visited, #menu-div a:link { display:block; padding: 0 20px; text-decoration: none; color: #335B64; background:#9CCBD6; } #menu-div a:hover { color: #000; background:#80BDCB; } #submenu-div a.fix-submenu{clear:both; margin-left:5px; padding:1px 5px; *padding:3px 5px 5px; background:#DDEEF2; color:#278296;} #submenu-div a.fix-submenu:hover{padding:1px 5px; *padding:3px 5px 5px; background:#FFF; color:#278296;} #menu-div li.fix-spacel{width:30px; border-left:none;} #menu-div li.fix-spacer{border-right:none;} </style> <?php echo $this->smarty_insert_scripts(array('files'=>'../js/transport.js')); ?> <script type="text/javascript"> onload = function() { Ajax.call('index.php?is_ajax=1&act=license','', start_sendmail_Response, 'GET', 'JSON'); } /** * 帮助系统调用 */ function web_address() { var ne_add = parent.document.getElementById('main-frame'); var ne_list = ne_add.contentWindow.document.getElementById('search_id').innerHTML; ne_list.replace('-', ''); var arr = ne_list.split('-'); window.open('help.php?al='+arr[arr.length - 1],'_blank'); } /** * 授权检测回调处理 */ function start_sendmail_Response(result) { // 运行正常 if (result.error == 0) { var str = ''; if (result['content']['auth_str']) { str = '<a href="javascript:void(0);" target="_blank">' + result['content']['auth_str']; if (result['content']['auth_type']) { str += '[' + result['content']['auth_type'] + ']'; } str += '</a> '; } document.getElementById('license-div').innerHTML = str; } } function modalDialog(url, name, width, height) { if (width == undefined) { width = 400; } if (height == undefined) { height = 300; } if (window.showModalDialog) { window.showModalDialog(url, name, 'dialogWidth=' + (width) + 'px; dialogHeight=' + (height+5) + 'px; status=off'); } else { x = (window.screen.width - width) / 2; y = (window.screen.height - height) / 2; window.open(url, name, 'height='+height+', width='+width+', left='+x+', top='+y+', toolbar=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, modal=yes'); } } function ShowToDoList() { try { var mainFrame = window.top.frames['main-frame']; mainFrame.window.showTodoList(adminId); } catch (ex) { } } var adminId = "<?php echo $this->_var['admin_id']; ?>"; </script> </head> <body> <div id="header-div"> <div id="logo-div" style="bgcolor:#000000;"><img src="images/ecshop_logo.gif" alt="ECSHOP - power for e-commerce" /></div> <div id="license-div" style="bgcolor:#000000;"></div> <div id="submenu-div"> <ul> <li><a href="index.php?act=about_us" target="main-frame"><?php echo $this->_var['lang']['about']; ?></a></li> <li><a href="javascript:web_address();"><?php echo $this->_var['lang']['help']; ?></a></li> <li><a href="javascript:modalDialog('index.php?act=calculator', 'calculator', 340, 250)"><?php echo $this->_var['lang']['toggle_calculator']; ?></a></li> <li><a href="../" target="_blank"><?php echo $this->_var['lang']['preview']; ?></a></li> <li><a href="message.php?act=list" target="main-frame"><?php echo $this->_var['lang']['view_message']; ?></a></li> <li><a href="privilege.php?act=modif" target="main-frame"><?php echo $this->_var['lang']['profile']; ?></a></li> <li><a href="javascript:window.top.frames['main-frame'].document.location.reload();window.top.frames['header-frame'].document.location.reload()"><?php echo $this->_var['lang']['refresh']; ?></a></li> <li><a href="#" onclick="ShowToDoList()"><?php echo $this->_var['lang']['todolist']; ?></a></li> <li style="border-left:none;"><a href="index.php?act=first" target="main-frame"><?php echo $this->_var['lang']['shop_guide']; ?></a></li> </ul> <div id="send_info" style="padding: 5px 10px 0 0; clear:right;text-align: right; color: #FF9900;width:40%;float: right;"> <?php if ($this->_var['send_mail_on'] == 'on'): ?> <span id="send_msg"><img src="images/top_loader.gif" width="16" height="16" alt="<?php echo $this->_var['lang']['loading']; ?>" style="vertical-align: middle" /> <?php echo $this->_var['lang']['email_sending']; ?></span> <a href="javascript:;" onClick="Javascript:switcher()" id="lnkSwitch" style="margin-right:10px;color: #FF9900;text-decoration: underline"><?php echo $this->_var['lang']['pause']; ?></a> <?php endif; ?> <a href="index.php?act=clear_cache" target="main-frame" class="fix-submenu"><?php echo $this->_var['lang']['clear_cache']; ?></a> <a href="privilege.php?act=logout" target="_top" class="fix-submenu"><?php echo $this->_var['lang']['signout']; ?></a> </div> <?php if ($this->_var['send_mail_on'] == 'on'): ?> <script type="text/javascript" charset="gb2312"> var sm = window.setInterval("start_sendmail()", 5000); var finished = 0; var error = 0; var conti = "<?php echo $this->_var['lang']['conti']; ?>"; var pause = "<?php echo $this->_var['lang']['pause']; ?>"; var counter = 0; var str = "<?php echo $this->_var['lang']['str']; ?>"; function start_sendmail() { Ajax.call('index.php?is_ajax=1&act=send_mail','', start_sendmail_Response, 'GET', 'JSON'); } function start_sendmail_Response(result) { if (typeof(result.count) == 'undefined') { result.count = 0; result.message = ''; } if (typeof(result.count) != 'undefined' && result.count == 0) { counter --; document.getElementById('lnkSwitch').style.display = "none"; window.clearInterval(sm); } if( typeof(result.goon) != 'undefined' ) { start_sendmail(); } counter ++ ; document.getElementById('send_msg').innerHTML = result.message; } function switcher() { if(document.getElementById('lnkSwitch').innerHTML == conti) { //do pause document.getElementById('lnkSwitch').innerHTML = pause; sm = window.setInterval("start_sendmail()", 5000); } else { //do continue document.getElementById('lnkSwitch').innerHTML = conti; document.getElementById('send_msg').innerHTML = sprintf(str, counter); window.clearInterval(sm); } } sprintfWrapper = { init : function () { if (typeof arguments == "undefined") {return null;} if (arguments.length < 1) {return null;} if (typeof arguments[0] != "string") {return null;} if (typeof RegExp == "undefined") {return null;} var string = arguments[0]; var exp = new RegExp(/(%([%]|(\-)?(\+|\x20)?(0)?(\d+)?(\.(\d)?)?([bcdfosxX])))/g); var matches = new Array(); var strings = new Array(); var convCount = 0; var stringPosStart = 0; var stringPosEnd = 0; var matchPosEnd = 0; var newString = ''; var match = null; while (match = exp.exec(string)) { if (match[9]) {convCount += 1;} stringPosStart = matchPosEnd; stringPosEnd = exp.lastIndex - match[0].length; strings[strings.length] = string.substring(stringPosStart, stringPosEnd); matchPosEnd = exp.lastIndex; matches[matches.length] = { match: match[0], left: match[3] ? true : false, sign: match[4] || '', pad: match[5] || ' ', min: match[6] || 0, precision: match[8], code: match[9] || '%', negative: parseInt(arguments[convCount]) < 0 ? true : false, argument: String(arguments[convCount]) }; } strings[strings.length] = string.substring(matchPosEnd); if (matches.length == 0) {return string;} if ((arguments.length - 1) < convCount) {return null;} var code = null; var match = null; var i = null; for (i=0; i<matches.length; i++) { if (matches[i].code == '%') {substitution = '%'} else if (matches[i].code == 'b') { matches[i].argument = String(Math.abs(parseInt(matches[i].argument)).toString(2)); substitution = sprintfWrapper.convert(matches[i], true); } else if (matches[i].code == 'c') { matches[i].argument = String(String.fromCharCode(parseInt(Math.abs(parseInt(matches[i].argument))))); substitution = sprintfWrapper.convert(matches[i], true); } else if (matches[i].code == 'd') { matches[i].argument = String(Math.abs(parseInt(matches[i].argument))); substitution = sprintfWrapper.convert(matches[i]); } else if (matches[i].code == 'f') { matches[i].argument = String(Math.abs(parseFloat(matches[i].argument)).toFixed(matches[i].precision ? matches[i].precision : 6)); substitution = sprintfWrapper.convert(matches[i]); } else if (matches[i].code == 'o') { matches[i].argument = String(Math.abs(parseInt(matches[i].argument)).toString(8)); substitution = sprintfWrapper.convert(matches[i]); } else if (matches[i].code == 's') { matches[i].argument = matches[i].argument.substring(0, matches[i].precision ? matches[i].precision : matches[i].argument.length) substitution = sprintfWrapper.convert(matches[i], true); } else if (matches[i].code == 'x') { matches[i].argument = String(Math.abs(parseInt(matches[i].argument)).toString(16)); substitution = sprintfWrapper.convert(matches[i]); } else if (matches[i].code == 'X') { matches[i].argument = String(Math.abs(parseInt(matches[i].argument)).toString(16)); substitution = sprintfWrapper.convert(matches[i]).toUpperCase(); } else { substitution = matches[i].match; } newString += strings[i]; newString += substitution; } newString += strings[i]; return newString; }, convert : function(match, nosign){ if (nosign) { match.sign = ''; } else { match.sign = match.negative ? '-' : match.sign; } var l = match.min - match.argument.length + 1 - match.sign.length; var pad = new Array(l < 0 ? 0 : l).join(match.pad); if (!match.left) { if (match.pad == "0" || nosign) { return match.sign + pad + match.argument; } else { return pad + match.sign + match.argument; } } else { if (match.pad == "0" || nosign) { return match.sign + match.argument + pad.replace(/0/g, ' '); } else { return match.sign + match.argument + pad; } } } } sprintf = sprintfWrapper.init; </script> <?php endif; ?> <div id="load-div" style="padding: 5px 10px 0 0; text-align: right; color: #FF9900; display: none;width:40%;float:right;"><img src="images/top_loader.gif" width="16" height="16" alt="<?php echo $this->_var['lang']['loading']; ?>" style="vertical-align: middle" /> <?php echo $this->_var['lang']['loading']; ?></div> </div> </div> <div id="menu-div"> <ul> <li class="fix-spacel">&nbsp;</li> <li><a href="index.php?act=main" target="main-frame"><?php echo $this->_var['lang']['admin_home']; ?></a></li> <li><a href="privilege.php?act=modif" target="main-frame"><?php echo $this->_var['lang']['set_navigator']; ?></a></li> <?php $_from = $this->_var['nav_list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'item');if (count($_from)): foreach ($_from AS $this->_var['key'] => $this->_var['item']): ?> <li><a href="<?php echo $this->_var['key']; ?>" target="main-frame"><?php echo $this->_var['item']; ?></a></li> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <li class="fix-spacer">&nbsp;</li> </ul> <br class="clear" /> </div> </body> </html>
zzshop
trunk/temp/compiled/admin/top.htm.php
PHP
asf20
14,516
<?php if ($this->_var['full_page']): ?> <!-- $Id: users_list.htm 17053 2010-03-15 06:50:26Z sxc_shop $ --> <?php echo $this->fetch('pageheader.htm'); ?> <?php echo $this->smarty_insert_scripts(array('files'=>'../js/utils.js,listtable.js')); ?> <div class="form-div"> <form action="javascript:searchUser()" name="searchForm"> <img src="images/icon_search.gif" width="26" height="22" border="0" alt="SEARCH" /> &nbsp;<?php echo $this->_var['lang']['label_rank_name']; ?> <select name="user_rank"><option value="0"><?php echo $this->_var['lang']['all_option']; ?></option><?php echo $this->html_options(array('options'=>$this->_var['user_ranks'])); ?></select> &nbsp;<?php echo $this->_var['lang']['label_pay_points_gt']; ?>&nbsp;<input type="text" name="pay_points_gt" size="8" />&nbsp;<?php echo $this->_var['lang']['label_pay_points_lt']; ?>&nbsp;<input type="text" name="pay_points_lt" size="10" /> &nbsp;<?php echo $this->_var['lang']['label_user_name']; ?> &nbsp;<input type="text" name="keyword" /> <input type="submit" value="<?php echo $this->_var['lang']['button_search']; ?>" /> </form> </div> <form method="POST" action="" name="listForm" onsubmit="return confirm_bath()"> <!-- start users list --> <div class="list-div" id="listDiv"> <?php endif; ?> <!--用户列表部分--> <table cellpadding="3" cellspacing="1"> <tr> <th> <input onclick='listTable.selectAll(this, "checkboxes")' type="checkbox"> <a href="javascript:listTable.sort('user_id'); "><?php echo $this->_var['lang']['record_id']; ?></a><?php echo $this->_var['sort_user_id']; ?> </th> <th><a href="javascript:listTable.sort('user_name'); "><?php echo $this->_var['lang']['username']; ?></a><?php echo $this->_var['sort_user_name']; ?></th> <th><a href="javascript:listTable.sort('email'); "><?php echo $this->_var['lang']['email']; ?></a><?php echo $this->_var['sort_email']; ?></th> <th><a href="javascript:listTable.sort('is_validated'); "><?php echo $this->_var['lang']['is_validated']; ?></a><?php echo $this->_var['sort_is_validate']; ?></th> <th><?php echo $this->_var['lang']['user_money']; ?></th> <th><?php echo $this->_var['lang']['frozen_money']; ?></th> <th><?php echo $this->_var['lang']['rank_points']; ?></th> <th><?php echo $this->_var['lang']['pay_points']; ?></th> <th><a href="javascript:listTable.sort('reg_time'); "><?php echo $this->_var['lang']['reg_date']; ?></a><?php echo $this->_var['sort_reg_time']; ?></th> <th><?php echo $this->_var['lang']['handler']; ?></th> <tr> <?php $_from = $this->_var['user_list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'user');if (count($_from)): foreach ($_from AS $this->_var['user']): ?> <tr> <td><input type="checkbox" name="checkboxes[]" value="<?php echo $this->_var['user']['user_id']; ?>" notice="<?php if ($this->_var['user']['user_money'] != 0): ?>1<?php else: ?>0<?php endif; ?>"/><?php echo $this->_var['user']['user_id']; ?></td> <td class="first-cell"><?php echo htmlspecialchars($this->_var['user']['user_name']); ?></td> <td><span onclick="listTable.edit(this, 'edit_email', <?php echo $this->_var['user']['user_id']; ?>)"><?php echo $this->_var['user']['email']; ?></span></td> <td align="center"><?php if ($this->_var['user']['is_validated']): ?> <img src="images/yes.gif"> <?php else: ?> <img src="images/no.gif"> <?php endif; ?></td> <td><?php echo $this->_var['user']['user_money']; ?></td> <td><?php echo $this->_var['user']['frozen_money']; ?></td> <td><?php echo $this->_var['user']['rank_points']; ?></td> <td><?php echo $this->_var['user']['pay_points']; ?></td> <td align="center"><?php echo $this->_var['user']['reg_time']; ?></td> <td align="center"> <a href="users.php?act=edit&id=<?php echo $this->_var['user']['user_id']; ?>" title="<?php echo $this->_var['lang']['edit']; ?>"><img src="images/icon_edit.gif" border="0" height="16" width="16" /></a> <a href="users.php?act=address_list&id=<?php echo $this->_var['user']['user_id']; ?>" title="<?php echo $this->_var['lang']['address_list']; ?>"><img src="images/book_open.gif" border="0" height="16" width="16" /></a> <a href="order.php?act=list&user_id=<?php echo $this->_var['user']['user_id']; ?>" title="<?php echo $this->_var['lang']['view_order']; ?>"><img src="images/icon_view.gif" border="0" height="16" width="16" /></a> <a href="account_log.php?act=list&user_id=<?php echo $this->_var['user']['user_id']; ?>" title="<?php echo $this->_var['lang']['view_deposit']; ?>"><img src="images/icon_account.gif" border="0" height="16" width="16" /></a> <a href="javascript:confirm_redirect('<?php if ($this->_var['user']['user_money'] != 0): ?><?php echo $this->_var['lang']['still_accounts']; ?><?php endif; ?><?php echo $this->_var['lang']['remove_confirm']; ?>', 'users.php?act=remove&id=<?php echo $this->_var['user']['user_id']; ?>')" title="<?php echo $this->_var['lang']['remove']; ?>"><img src="images/icon_drop.gif" border="0" height="16" width="16" /></a> </td> </tr> <?php endforeach; else: ?> <tr><td class="no-records" colspan="10"><?php echo $this->_var['lang']['no_records']; ?></td></tr> <?php endif; unset($_from); ?><?php $this->pop_vars();; ?> <tr> <td colspan="2"> <input type="hidden" name="act" value="batch_remove" /> <input type="submit" id="btnSubmit" value="<?php echo $this->_var['lang']['button_remove']; ?>" disabled="true" class="button" /></td> <td align="right" nowrap="true" colspan="8"> <?php echo $this->fetch('page.htm'); ?> </td> </tr> </table> <?php if ($this->_var['full_page']): ?> </div> <!-- end users list --> </form> <script type="text/javascript" language="JavaScript"> <!-- listTable.recordCount = <?php echo $this->_var['record_count']; ?>; listTable.pageCount = <?php echo $this->_var['page_count']; ?>; <?php $_from = $this->_var['filter']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'item');if (count($_from)): foreach ($_from AS $this->_var['key'] => $this->_var['item']): ?> listTable.filter.<?php echo $this->_var['key']; ?> = '<?php echo $this->_var['item']; ?>'; <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> onload = function() { document.forms['searchForm'].elements['keyword'].focus(); // 开始检查订单 startCheckOrder(); } /** * 搜索用户 */ function searchUser() { listTable.filter['keywords'] = Utils.trim(document.forms['searchForm'].elements['keyword'].value); listTable.filter['rank'] = document.forms['searchForm'].elements['user_rank'].value; listTable.filter['pay_points_gt'] = Utils.trim(document.forms['searchForm'].elements['pay_points_gt'].value); listTable.filter['pay_points_lt'] = Utils.trim(document.forms['searchForm'].elements['pay_points_lt'].value); listTable.filter['page'] = 1; listTable.loadList(); } function confirm_bath() { userItems = document.getElementsByName('checkboxes[]'); cfm = '<?php echo $this->_var['lang']['list_remove_confirm']; ?>'; for (i=0; userItems[i]; i++) { if (userItems[i].checked && userItems[i].notice == 1) { cfm = '<?php echo $this->_var['lang']['list_still_accounts']; ?>' + '<?php echo $this->_var['lang']['list_remove_confirm']; ?>'; break; } } return confirm(cfm); } //--> </script> <?php echo $this->fetch('pagefooter.htm'); ?> <?php endif; ?>
zzshop
trunk/temp/compiled/admin/users_list.htm.php
PHP
asf20
7,646
<!-- $Id: goods_batch_add.htm 16544 2009-08-13 07:55:57Z liuhui $ --> <?php echo $this->fetch('pageheader.htm'); ?> <div class="main-div"> <form action="goods_batch.php?act=upload" method="post" enctype="multipart/form-data" name="theForm" onsubmit="return formValidate()"> <table cellspacing="1" cellpadding="3" width="100%"> <tr> <td class="label"><?php echo $this->_var['lang']['export_format']; ?></td> <td><select name="data_cat" id="data_cat"> <option value="0"><?php echo $this->_var['lang']['select_please']; ?></option> <?php echo $this->html_options(array('options'=>$this->_var['data_format'])); ?> </select></td> </tr> <tr> <td class="label"><?php echo $this->_var['lang']['goods_cat']; ?></td> <td><select name="cat" id="cat"> <option value="0"><?php echo $this->_var['lang']['select_please']; ?></option> <?php echo $this->_var['cat_list']; ?> </select></td> </tr> <tr> <td class="label"><?php echo $this->_var['lang']['file_charset']; ?></td> <td><select name="charset" id="charset"> <?php echo $this->html_options(array('options'=>$this->_var['lang_list'])); ?> </select></td> </tr> <tr> <td class="label"> <a href="javascript:showNotice('noticeFile');" title="<?php echo $this->_var['lang']['form_notice']; ?>"><img src="images/notice.gif" width="16" height="16" border="0" alt="<?php echo $this->_var['lang']['form_notice']; ?>"></a> <?php echo $this->_var['lang']['csv_file']; ?></td> <td><input name="file" type="file" size="40"> <br /> <span class="notice-span" <?php if ($this->_var['help_open']): ?>style="display:block" <?php else: ?> style="display:none" <?php endif; ?> id="noticeFile"><?php echo $this->_var['lang']['notice_file']; ?></span></td> </tr> <?php $_from = $this->_var['download_list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('charset', 'download');if (count($_from)): foreach ($_from AS $this->_var['charset'] => $this->_var['download']): ?> <tr> <td>&nbsp;</td> <td><a href="goods_batch.php?act=download&charset=<?php echo $this->_var['charset']; ?>"><?php echo $this->_var['download']; ?></a></td> </tr> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <tr align="center"> <td colspan="2"><input name="submit" type="submit" id="submit" value="<?php echo $this->_var['lang']['button_submit']; ?>" class="button" /></td> </tr> </table> </form> <table width="100%"> <tr> <td>&nbsp;</td> <td width="80%"><?php echo $this->_var['lang']['use_help']; ?></td> <td>&nbsp;</td> </tr> </table> </div> <?php echo $this->smarty_insert_scripts(array('files'=>'../js/utils.js,validator.js')); ?> <script language="JavaScript"> var elements; onload = function() { // 文档元素对象 elements = document.forms['theForm'].elements; // 开始检查订单 startCheckOrder(); } /** * 检查是否底级分类 */ function checkIsLeaf(selObj) { if (selObj.options[selObj.options.selectedIndex].className != 'leafCat') { alert(goods_cat_not_leaf); selObj.options.selectedIndex = 0; } } /** * 检查输入是否完整 */ function formValidate() { if (elements['cat'].value <= 0) { alert(please_select_cat); return false; } if (elements['file'].value == '') { alert(please_upload_file); return false; } return true; } </script> <?php echo $this->fetch('pagefooter.htm'); ?>
zzshop
trunk/temp/compiled/admin/goods_batch_add.htm.php
PHP
asf20
3,774
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title><?php echo $this->_var['lang']['cp_home']; ?><?php if ($this->_var['ur_here']): ?> - <?php echo $this->_var['ur_here']; ?><?php endif; ?></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link href="styles/general.css" rel="stylesheet" type="text/css" /> <link href="styles/main.css" rel="stylesheet" type="text/css" /> <style type="text/css"> body { color: white; } </style> <?php echo $this->smarty_insert_scripts(array('files'=>'../js/utils.js,validator.js')); ?> <script language="JavaScript"> <!-- // 这里把JS用到的所有语言都赋值到这里 <?php $_from = $this->_var['lang']['js_languages']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'item');if (count($_from)): foreach ($_from AS $this->_var['key'] => $this->_var['item']): ?> var <?php echo $this->_var['key']; ?> = "<?php echo $this->_var['item']; ?>"; <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> if (window.parent != window) { window.top.location.href = location.href; } //--> </script> </head> <body style="background: #278296"> <form method="post" action="privilege.php" name='theForm' onsubmit="return validate()"> <table cellspacing="0" cellpadding="0" style="margin-top: 100px" align="center"> <tr> <td><img src="images/login.png" width="178" height="256" border="0" alt="ECSHOP" /></td> <td style="padding-left: 50px"> <table> <tr> <td><?php echo $this->_var['lang']['label_username']; ?></td> <td><input type="text" name="username" /></td> </tr> <tr> <td><?php echo $this->_var['lang']['label_password']; ?></td> <td><input type="password" name="password" /></td> </tr> <?php if ($this->_var['gd_version'] > 0): ?> <tr> <td><?php echo $this->_var['lang']['label_captcha']; ?></td> <td><input type="text" name="captcha" class="capital" /></td> </tr> <tr> <td colspan="2" align="right"><img src="index.php?act=captcha&<?php echo $this->_var['random']; ?>" width="145" height="20" alt="CAPTCHA" border="1" onclick= this.src="index.php?act=captcha&"+Math.random() style="cursor: pointer;" title="<?php echo $this->_var['lang']['click_for_another']; ?>" /> </td> </tr> <?php endif; ?> <tr><td colspan="2"><input type="checkbox" value="1" name="remember" id="remember" /><label for="remember"><?php echo $this->_var['lang']['remember']; ?></label></td></tr> <tr><td>&nbsp;</td><td><input type="submit" value="<?php echo $this->_var['lang']['signin_now']; ?>" class="button" /></td></tr> <tr> <td colspan="2" align="right">&raquo; <a href="../" style="color:white"><?php echo $this->_var['lang']['back_home']; ?></a> &raquo; <a href="get_password.php?act=forget_pwd" style="color:white"><?php echo $this->_var['lang']['forget_pwd']; ?></a></td> </tr> </table> </td> </tr> </table> <input type="hidden" name="act" value="signin" /> </form> <script language="JavaScript"> <!-- document.forms['theForm'].elements['username'].focus(); /** * 检查表单输入的内容 */ function validate() { var validator = new Validator('theForm'); validator.required('username', user_name_empty); //validator.required('password', password_empty); if (document.forms['theForm'].elements['captcha']) { validator.required('captcha', captcha_empty); } return validator.passed(); } //--> </script> </body>
zzshop
trunk/temp/compiled/admin/login.htm.php
PHP
asf20
3,790
<?php echo $this->fetch('pageheader.htm'); ?> <div class="list-div"> <div style="background:#FFF; padding: 20px 50px; margin: 2px;"> <table align="center" width="400"> <tr> <td width="50" valign="top"> <?php if ($this->_var['msg_type'] == 0): ?> <img src="images/information.gif" width="32" height="32" border="0" alt="information" /> <?php elseif ($this->_var['msg_type'] == 1): ?> <img src="images/warning.gif" width="32" height="32" border="0" alt="warning" /> <?php else: ?> <img src="images/confirm.gif" width="32" height="32" border="0" alt="confirm" /> <?php endif; ?> </td> <td style="font-size: 14px; font-weight: bold"><?php echo $this->_var['msg_detail']; ?></td> </tr> <tr> <td></td> <td id="redirectionMsg"> <?php if ($this->_var['auto_redirect']): ?><?php echo $this->_var['lang']['auto_redirection']; ?><?php endif; ?> </td> </tr> <tr> <td></td> <td> <ul style="margin:0; padding:0 10px" class="msg-link"> <?php $_from = $this->_var['links']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'link');if (count($_from)): foreach ($_from AS $this->_var['link']): ?> <li><a href="<?php echo $this->_var['link']['href']; ?>" <?php if ($this->_var['link']['target']): ?>target="<?php echo $this->_var['link']['target']; ?>"<?php endif; ?>><?php echo $this->_var['link']['text']; ?></a></li> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </ul> </td> </tr> </table> </div> </div> <?php if ($this->_var['auto_redirect']): ?> <script language="JavaScript"> <!-- var seconds = 3; var defaultUrl = "<?php echo $this->_var['default_url']; ?>"; onload = function() { if (defaultUrl == 'javascript:history.go(-1)' && window.history.length == 0) { document.getElementById('redirectionMsg').innerHTML = ''; return; } window.setInterval(redirection, 1000); } function redirection() { if (seconds <= 0) { window.clearInterval(); return; } seconds --; document.getElementById('spanSeconds').innerHTML = seconds; if (seconds == 0) { window.clearInterval(); location.href = defaultUrl; } } //--> </script> <?php endif; ?> <?php echo $this->fetch('pagefooter.htm'); ?>
zzshop
trunk/temp/compiled/admin/message.htm.php
PHP
asf20
2,523
<!-- $Id: category_list.htm 17019 2010-01-29 10:10:34Z liuhui $ --> <?php if ($this->_var['full_page']): ?> <?php echo $this->fetch('pageheader.htm'); ?> <?php echo $this->smarty_insert_scripts(array('files'=>'../js/utils.js,listtable.js')); ?> <form method="post" action="" name="listForm"> <!-- start ad position list --> <div class="list-div" id="listDiv"> <?php endif; ?> <table width="100%" cellspacing="1" cellpadding="2" id="list-table"> <tr> <th><?php echo $this->_var['lang']['cat_name']; ?></th> <th><?php echo $this->_var['lang']['goods_number']; ?></th> <th><?php echo $this->_var['lang']['measure_unit']; ?></th> <th><?php echo $this->_var['lang']['nav']; ?></th> <th><?php echo $this->_var['lang']['is_show']; ?></th> <th><?php echo $this->_var['lang']['short_grade']; ?></th> <th><?php echo $this->_var['lang']['sort_order']; ?></th> <th><?php echo $this->_var['lang']['handler']; ?></th> </tr> <?php $_from = $this->_var['cat_info']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'cat');if (count($_from)): foreach ($_from AS $this->_var['cat']): ?> <tr align="center" class="<?php echo $this->_var['cat']['level']; ?>" id="<?php echo $this->_var['cat']['level']; ?>_<?php echo $this->_var['cat']['cat_id']; ?>"> <td align="left" class="first-cell" > <?php if ($this->_var['cat']['is_leaf'] != 1): ?> <img src="images/menu_minus.gif" id="icon_<?php echo $this->_var['cat']['level']; ?>_<?php echo $this->_var['cat']['cat_id']; ?>" width="9" height="9" border="0" style="margin-left:<?php echo $this->_var['cat']['level']; ?>em" onclick="rowClicked(this)" /> <?php else: ?> <img src="images/menu_arrow.gif" width="9" height="9" border="0" style="margin-left:<?php echo $this->_var['cat']['level']; ?>em" /> <?php endif; ?> <span><a href="goods.php?act=list&cat_id=<?php echo $this->_var['cat']['cat_id']; ?>"><?php echo $this->_var['cat']['cat_name']; ?></a></span> <?php if ($this->_var['cat']['cat_image']): ?> <img src="../<?php echo $this->_var['cat']['cat_image']; ?>" border="0" style="vertical-align:middle;" width="60px" height="21px"> <?php endif; ?> </td> <td width="10%"><?php echo $this->_var['cat']['goods_num']; ?></td> <td width="10%"><span onclick="listTable.edit(this, 'edit_measure_unit', <?php echo $this->_var['cat']['cat_id']; ?>)"><!-- <?php if ($this->_var['cat']['measure_unit']): ?> --><?php echo $this->_var['cat']['measure_unit']; ?><!-- <?php else: ?> -->&nbsp;&nbsp;&nbsp;&nbsp;<!-- <?php endif; ?> --></span></td> <td width="10%"><img src="images/<?php if ($this->_var['cat']['show_in_nav'] == '1'): ?>yes<?php else: ?>no<?php endif; ?>.gif" onclick="listTable.toggle(this, 'toggle_show_in_nav', <?php echo $this->_var['cat']['cat_id']; ?>)" /></td> <td width="10%"><img src="images/<?php if ($this->_var['cat']['is_show'] == '1'): ?>yes<?php else: ?>no<?php endif; ?>.gif" onclick="listTable.toggle(this, 'toggle_is_show', <?php echo $this->_var['cat']['cat_id']; ?>)" /></td> <td><span onclick="listTable.edit(this, 'edit_grade', <?php echo $this->_var['cat']['cat_id']; ?>)"><?php echo $this->_var['cat']['grade']; ?></span></td> <td width="10%" align="right"><span onclick="listTable.edit(this, 'edit_sort_order', <?php echo $this->_var['cat']['cat_id']; ?>)"><?php echo $this->_var['cat']['sort_order']; ?></span></td> <td width="24%" align="center"> <a href="category.php?act=move&cat_id=<?php echo $this->_var['cat']['cat_id']; ?>"><?php echo $this->_var['lang']['move_goods']; ?></a> | <a href="category.php?act=edit&amp;cat_id=<?php echo $this->_var['cat']['cat_id']; ?>"><?php echo $this->_var['lang']['edit']; ?></a> | <a href="javascript:;" onclick="listTable.remove(<?php echo $this->_var['cat']['cat_id']; ?>, '<?php echo $this->_var['lang']['drop_confirm']; ?>')" title="<?php echo $this->_var['lang']['remove']; ?>"><?php echo $this->_var['lang']['remove']; ?></a> </td> </tr> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </table> <?php if ($this->_var['full_page']): ?> </div> </form> <script language="JavaScript"> <!-- onload = function() { // 开始检查订单 startCheckOrder(); } var imgPlus = new Image(); imgPlus.src = "images/menu_plus.gif"; /** * 折叠分类列表 */ function rowClicked(obj) { // 当前图像 img = obj; // 取得上二级tr>td>img对象 obj = obj.parentNode.parentNode; // 整个分类列表表格 var tbl = document.getElementById("list-table"); // 当前分类级别 var lvl = parseInt(obj.className); // 是否找到元素 var fnd = false; var sub_display = img.src.indexOf('menu_minus.gif') > 0 ? 'none' : (Browser.isIE) ? 'block' : 'table-row' ; // 遍历所有的分类 for (i = 0; i < tbl.rows.length; i++) { var row = tbl.rows[i]; if (row == obj) { // 找到当前行 fnd = true; //document.getElementById('result').innerHTML += 'Find row at ' + i +"<br/>"; } else { if (fnd == true) { var cur = parseInt(row.className); var icon = 'icon_' + row.id; if (cur > lvl) { row.style.display = sub_display; if (sub_display != 'none') { var iconimg = document.getElementById(icon); iconimg.src = iconimg.src.replace('plus.gif', 'minus.gif'); } } else { fnd = false; break; } } } } for (i = 0; i < obj.cells[0].childNodes.length; i++) { var imgObj = obj.cells[0].childNodes[i]; if (imgObj.tagName == "IMG" && imgObj.src != 'images/menu_arrow.gif') { imgObj.src = (imgObj.src == imgPlus.src) ? 'images/menu_minus.gif' : imgPlus.src; } } } //--> </script> <?php echo $this->fetch('pagefooter.htm'); ?> <?php endif; ?>
zzshop
trunk/temp/compiled/admin/category_list.htm.php
PHP
asf20
6,220
<!-- $Id: link_info.htm 16752 2009-10-20 09:59:38Z wangleisvn $ --> <?php echo $this->fetch('pageheader.htm'); ?> <div class="main-div"> <form action="friend_link.php" method="post" name="theForm" enctype="multipart/form-data" onsubmit="return validate()"> <table width="100%" id="general-table"> <tr> <td class="label"><a href="javascript:showNotice('LogoNameNotic');" title="<?php echo $this->_var['lang']['form_notice']; ?>"> <img src="images/notice.gif" width="16" height="16" border="0" alt="<?php echo $this->_var['lang']['form_notice']; ?>"></a><?php echo $this->_var['lang']['link_name']; ?></td> <td> <input type="text" name="link_name" value="<?php echo htmlspecialchars($this->_var['link_arr']['link_name']); ?>" size="30" /> <br /><span class="notice-span" <?php if ($this->_var['help_open']): ?>style="display:block" <?php else: ?> style="display:none" <?php endif; ?> id="LogoNameNotic"><?php echo $this->_var['lang']['link_name_desc']; ?></span> </td> </tr> <tr> <td class="label"><?php echo $this->_var['lang']['link_url']; ?></td> <td> <input type='text' name='link_url' value='<?php echo $this->_var['link_arr']['link_url']; ?>' size="30" /> </td> </tr> <tr> <td class="label"><?php echo $this->_var['lang']['show_order']; ?></td> <td> <input type='text' name='show_order' <?php if ($this->_var['link_arr']['show_order']): ?> value="<?php echo $this->_var['link_arr']['show_order']; ?>" <?php else: ?> value="50" <?php endif; ?> size="30" /> </td> </tr> <?php if ($this->_var['action'] == "add"): ?> <tr> <td class="label"><?php echo $this->_var['lang']['link_logo']; ?></td> <td> <input type='file' name='link_img' size="35" /> </td> </tr> <tr> <td class="label"><a href="javascript:showNotice('LogoUrlNotic');" title="<?php echo $this->_var['lang']['form_notice']; ?>"> <img src="images/notice.gif" width="16" height="16" border="0" alt="<?php echo $this->_var['lang']['form_notice']; ?>"></a><?php echo $this->_var['lang']['url_logo']; ?></td> <td> <input type='text' name='url_logo' size="42" /> <br /><span class="notice-span" <?php if ($this->_var['help_open']): ?>style="display:block" <?php else: ?> style="display:none" <?php endif; ?> id="LogoUrlNotic"><?php echo $this->_var['lang']['url_logo_value']; ?></span> </td> </tr> <?php endif; ?> <?php if ($this->_var['action'] == "edit"): ?> <tr> <td class="label"><?php echo $this->_var['lang']['link_logo']; ?></td> <td> <input type='file' name='link_img' size="35" /> </td> </tr> <tr> <td class="label"><a href="javascript:showNotice('LogoUrlNotic');" title="<?php echo $this->_var['lang']['form_notice']; ?>"> <img src="images/notice.gif" width="16" height="16" border="0" alt="<?php echo $this->_var['lang']['form_notice']; ?>"></a><?php echo $this->_var['lang']['url_logo']; ?></td> <td> <input type='text' name='url_logo' value="<?php echo $this->_var['link_logo']; ?>" size="42" /> <br /><span class="notice-span" <?php if ($this->_var['help_open']): ?>style="display:block" <?php else: ?> style="display:none" <?php endif; ?> id="LogoUrlNotic"><?php echo $this->_var['lang']['url_logo_value']; ?></span> </td> </tr> <?php endif; ?> <tr> <td class="label">&nbsp;</td> <td> <input type="submit" value="<?php echo $this->_var['lang']['button_submit']; ?>" class="button" /> <input type="reset" value="<?php echo $this->_var['lang']['button_reset']; ?>" class="button" /> <input type="hidden" name="act" value="<?php echo $this->_var['form_act']; ?>" /> <input type="hidden" name="id" value="<?php echo $this->_var['link_arr']['link_id']; ?>" /> <input type="hidden" name="type" value="<?php echo $this->_var['type']; ?>" /> </td> </tr> </table> </form> </div> <?php echo $this->smarty_insert_scripts(array('files'=>'../js/utils.js,validator.js')); ?> <script language="JavaScript"> <!-- /** * 检查表单输入的数据 */ function validate() { validator = new Validator("theForm"); validator.required("link_name", link_name_empty); validator.required("link_url", link_url_empty); validator.isNumber("show_order", show_order_type); return validator.passed(); } onload = function() { // 开始检查订单 startCheckOrder(); } //--> </script> <?php echo $this->fetch('pagefooter.htm'); ?>
zzshop
trunk/temp/compiled/admin/link_info.htm.php
PHP
asf20
4,586
<?php if ($this->_var['full_page']): ?> <?php echo $this->fetch('pageheader.htm'); ?> <?php echo $this->smarty_insert_scripts(array('files'=>'../js/utils.js,listtable.js')); ?> <!-- 订单搜索 --> <div class="form-div"> <form action="javascript:searchOrder()" name="searchForm"> <img src="images/icon_search.gif" width="26" height="22" border="0" alt="SEARCH" /> <?php echo $this->_var['lang']['order_sn']; ?><input name="order_sn" type="text" id="order_sn" size="15"> <?php echo htmlspecialchars($this->_var['lang']['consignee']); ?><input name="consignee" type="text" id="consignee" size="15"> <?php echo $this->_var['lang']['all_status']; ?> <select name="status" id="status"> <option value="-1"><?php echo $this->_var['lang']['select_please']; ?></option> <?php echo $this->html_options(array('options'=>$this->_var['status_list'])); ?> </select> <input type="submit" value="<?php echo $this->_var['lang']['button_search']; ?>" class="button" /> <a href="order.php?act=list&composite_status=<?php echo $this->_var['os_unconfirmed']; ?>"><?php echo $this->_var['lang']['cs'][$this->_var['os_unconfirmed']]; ?></a> <a href="order.php?act=list&composite_status=<?php echo $this->_var['cs_await_pay']; ?>"><?php echo $this->_var['lang']['cs'][$this->_var['cs_await_pay']]; ?></a> <a href="order.php?act=list&composite_status=<?php echo $this->_var['cs_await_ship']; ?>"><?php echo $this->_var['lang']['cs'][$this->_var['cs_await_ship']]; ?></a> </form> </div> <!-- 订单列表 --> <form method="post" action="order.php?act=operate" name="listForm" onsubmit="return check()"> <div class="list-div" id="listDiv"> <?php endif; ?> <table cellpadding="3" cellspacing="1"> <tr> <th> <input onclick='listTable.selectAll(this, "checkboxes")' type="checkbox" /><a href="javascript:listTable.sort('order_sn', 'DESC'); "><?php echo $this->_var['lang']['order_sn']; ?></a><?php echo $this->_var['sort_order_sn']; ?> </th> <th><a href="javascript:listTable.sort('add_time', 'DESC'); "><?php echo $this->_var['lang']['order_time']; ?></a><?php echo $this->_var['sort_order_time']; ?></th> <th><a href="javascript:listTable.sort('consignee', 'DESC'); "><?php echo $this->_var['lang']['consignee']; ?></a><?php echo $this->_var['sort_consignee']; ?></th> <th><a href="javascript:listTable.sort('total_fee', 'DESC'); "><?php echo $this->_var['lang']['total_fee']; ?></a><?php echo $this->_var['sort_total_fee']; ?></th> <th><a href="javascript:listTable.sort('order_amount', 'DESC'); "><?php echo $this->_var['lang']['order_amount']; ?></a><?php echo $this->_var['sort_order_amount']; ?></th> <th><?php echo $this->_var['lang']['all_status']; ?></th> <th><?php echo $this->_var['lang']['handler']; ?></th> <tr> <?php $_from = $this->_var['order_list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('okey', 'order');if (count($_from)): foreach ($_from AS $this->_var['okey'] => $this->_var['order']): ?> <tr> <td valign="top" nowrap="nowrap"><input type="checkbox" name="checkboxes" value="<?php echo $this->_var['order']['order_sn']; ?>" /><a href="order.php?act=info&order_id=<?php echo $this->_var['order']['order_id']; ?>" id="order_<?php echo $this->_var['okey']; ?>"><?php echo $this->_var['order']['order_sn']; ?><?php if ($this->_var['order']['extension_code'] == "group_buy"): ?><br /><div align="center"><?php echo $this->_var['lang']['group_buy']; ?></div><?php elseif ($this->_var['order']['extension_code'] == "exchange_goods"): ?><br /><div align="center"><?php echo $this->_var['lang']['exchange_goods']; ?></div><?php endif; ?></a></td> <td><?php echo htmlspecialchars($this->_var['order']['buyer']); ?><br /><?php echo $this->_var['order']['short_order_time']; ?></td> <td align="left" valign="top"><a href="mailto:<?php echo $this->_var['order']['email']; ?>"> <?php echo htmlspecialchars($this->_var['order']['consignee']); ?></a><?php if ($this->_var['order']['tel']): ?> [TEL: <?php echo htmlspecialchars($this->_var['order']['tel']); ?>]<?php endif; ?> <br /><?php echo htmlspecialchars($this->_var['order']['address']); ?></td> <td align="right" valign="top" nowrap="nowrap"><?php echo $this->_var['order']['formated_total_fee']; ?></td> <td align="right" valign="top" nowrap="nowrap"><?php echo $this->_var['order']['formated_order_amount']; ?></td> <td align="center" valign="top" nowrap="nowrap"><?php echo $this->_var['lang']['os'][$this->_var['order']['order_status']]; ?>,<?php echo $this->_var['lang']['ps'][$this->_var['order']['pay_status']]; ?>,<?php echo $this->_var['lang']['ss'][$this->_var['order']['shipping_status']]; ?></td> <td align="center" valign="top" nowrap="nowrap"> <a href="order.php?act=info&order_id=<?php echo $this->_var['order']['order_id']; ?>"><?php echo $this->_var['lang']['detail']; ?></a> <?php if ($this->_var['order']['can_remove']): ?> <br /><a href="javascript:;" onclick="listTable.remove(<?php echo $this->_var['order']['order_id']; ?>, remove_confirm, 'remove_order')"><?php echo $this->_var['lang']['remove']; ?></a> <?php endif; ?> </td> </tr> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </table> <!-- 分页 --> <table id="page-table" cellspacing="0"> <tr> <td align="right" nowrap="true"> <?php echo $this->fetch('page.htm'); ?> </td> </tr> </table> <?php if ($this->_var['full_page']): ?> </div> <div> <input name="confirm" type="submit" id="btnSubmit" value="<?php echo $this->_var['lang']['op_confirm']; ?>" class="button" disabled="true" onclick="this.form.target = '_self'" /> <input name="invalid" type="submit" id="btnSubmit1" value="<?php echo $this->_var['lang']['op_invalid']; ?>" class="button" disabled="true" onclick="this.form.target = '_self'" /> <input name="cancel" type="submit" id="btnSubmit2" value="<?php echo $this->_var['lang']['op_cancel']; ?>" class="button" disabled="true" onclick="this.form.target = '_self'" /> <input name="remove" type="submit" id="btnSubmit3" value="<?php echo $this->_var['lang']['remove']; ?>" class="button" disabled="true" onclick="this.form.target = '_self'" /> <input name="print" type="submit" id="btnSubmit4" value="<?php echo $this->_var['lang']['print_order']; ?>" class="button" disabled="true" onclick="this.form.target = '_blank'" /> <input name="batch" type="hidden" value="1" /> <input name="order_id" type="hidden" value="" /> </div> </form> <script language="JavaScript"> listTable.recordCount = <?php echo $this->_var['record_count']; ?>; listTable.pageCount = <?php echo $this->_var['page_count']; ?>; <?php $_from = $this->_var['filter']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'item');if (count($_from)): foreach ($_from AS $this->_var['key'] => $this->_var['item']): ?> listTable.filter.<?php echo $this->_var['key']; ?> = '<?php echo $this->_var['item']; ?>'; <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> onload = function() { // 开始检查订单 startCheckOrder(); } /** * 搜索订单 */ function searchOrder() { listTable.filter['order_sn'] = Utils.trim(document.forms['searchForm'].elements['order_sn'].value); listTable.filter['consignee'] = Utils.trim(document.forms['searchForm'].elements['consignee'].value); listTable.filter['composite_status'] = document.forms['searchForm'].elements['status'].value; listTable.filter['page'] = 1; listTable.loadList(); } function check() { var snArray = new Array(); var eles = document.forms['listForm'].elements; for (var i=0; i<eles.length; i++) { if (eles[i].tagName == 'INPUT' && eles[i].type == 'checkbox' && eles[i].checked && eles[i].value != 'on') { snArray.push(eles[i].value); } } if (snArray.length == 0) { return false; } else { eles['order_id'].value = snArray.toString(); return true; } } /** * 显示订单商品及缩图 */ var show_goods_layer = 'order_goods_layer'; var goods_hash_table = new Object; var timer = new Object; /** * 绑定订单号事件 * * @return void */ function bind_order_event() { var order_seq = 0; while(true) { var order_sn = Utils.$('order_'+order_seq); if (order_sn) { order_sn.onmouseover = function(e) { try { window.clearTimeout(timer); } catch(e) { } var order_id = Utils.request(this.href, 'order_id'); show_order_goods(e, order_id, show_goods_layer); } order_sn.onmouseout = function(e) { hide_order_goods(show_goods_layer) } order_seq++; } else { break; } } } listTable.listCallback = function(result, txt) { if (result.error > 0) { alert(result.message); } else { try { document.getElementById('listDiv').innerHTML = result.content; bind_order_event(); if (typeof result.filter == "object") { listTable.filter = result.filter; } listTable.pageCount = result.page_count; } catch(e) { alert(e.message); } } } /** * 浏览器兼容式绑定Onload事件 * */ if (Browser.isIE) { window.attachEvent("onload", bind_order_event); } else { window.addEventListener("load", bind_order_event, false); } /** * 建立订单商品显示层 * * @return void */ function create_goods_layer(id) { if (!Utils.$(id)) { var n_div = document.createElement('DIV'); n_div.id = id; n_div.className = 'order-goods'; document.body.appendChild(n_div); Utils.$(id).onmouseover = function() { window.clearTimeout(window.timer); } Utils.$(id).onmouseout = function() { hide_order_goods(id); } } else { Utils.$(id).style.display = ''; } } /** * 显示订单商品数据 * * @return void */ function show_order_goods(e, order_id, layer_id) { create_goods_layer(layer_id); $layer_id = Utils.$(layer_id); $layer_id.style.top = (Utils.y(e) + 12) + 'px'; $layer_id.style.left = (Utils.x(e) + 12) + 'px'; if (typeof(goods_hash_table[order_id]) == 'object') { response_goods_info(goods_hash_table[order_id]); } else { $layer_id.innerHTML = loading; Ajax.call('order.php?is_ajax=1&act=get_goods_info&order_id='+order_id, '', response_goods_info , 'POST', 'JSON'); } } /** * 隐藏订单商品 * * @return void */ function hide_order_goods(layer_id) { $layer_id = Utils.$(layer_id); window.timer = window.setTimeout('$layer_id.style.display = "none"', 500); } /** * 处理订单商品的Callback * * @return void */ function response_goods_info(result) { if (result.error > 0) { alert(result.message); hide_order_goods(show_goods_layer); return; } if (typeof(goods_hash_table[result.content[0].order_id]) == 'undefined') { goods_hash_table[result.content[0].order_id] = result; } Utils.$(show_goods_layer).innerHTML = result.content[0].str; } </script> <?php echo $this->fetch('pagefooter.htm'); ?> <?php endif; ?>
zzshop
trunk/temp/compiled/admin/order_list.htm.php
PHP
asf20
12,660
<tr> <td class="label" valign="top"> <?php if ($this->_var['var']['desc']): ?> <a href="javascript:showNotice('notice<?php echo $this->_var['var']['code']; ?>');" title="<?php echo $this->_var['lang']['form_notice']; ?>"><img src="images/notice.gif" width="16" height="16" border="0" alt="<?php echo $this->_var['lang']['form_notice']; ?>" /></a> <?php endif; ?> <?php echo $this->_var['var']['name']; ?>: </td> <td> <?php if ($this->_var['var']['type'] == "text"): ?> <input name="value[<?php echo $this->_var['var']['id']; ?>]" type="text" value="<?php echo $this->_var['var']['value']; ?>" size="40" /><?php if ($this->_var['var']['url'] == 1): ?><?php echo $this->_var['lang']['sms_url']; ?><?php endif; ?> <?php elseif ($this->_var['var']['type'] == "password"): ?> <input name="value[<?php echo $this->_var['var']['id']; ?>]" type="password" value="<?php echo $this->_var['var']['value']; ?>" size="40" /> <?php elseif ($this->_var['var']['type'] == "textarea"): ?> <textarea name="value[<?php echo $this->_var['var']['id']; ?>]" cols="40" rows="5"><?php echo $this->_var['var']['value']; ?></textarea> <?php elseif ($this->_var['var']['type'] == "select"): ?> <?php $_from = $this->_var['var']['store_options']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('k', 'opt');if (count($_from)): foreach ($_from AS $this->_var['k'] => $this->_var['opt']): ?> <label for="value_<?php echo $this->_var['var']['id']; ?>_<?php echo $this->_var['k']; ?>"><input type="radio" name="value[<?php echo $this->_var['var']['id']; ?>]" id="value_<?php echo $this->_var['var']['id']; ?>_<?php echo $this->_var['k']; ?>" value="<?php echo $this->_var['opt']; ?>" <?php if ($this->_var['var']['value'] == $this->_var['opt']): ?>checked="true"<?php endif; ?> <?php if ($this->_var['var']['code'] == 'rewrite'): ?> onclick="return ReWriterConfirm(this);" <?php endif; ?> <?php if ($this->_var['var']['code'] == 'smtp_ssl' && $this->_var['opt'] == 1): ?> onclick="return confirm('<?php echo $this->_var['lang']['smtp_ssl_confirm']; ?>');" <?php endif; ?> <?php if ($this->_var['var']['code'] == 'enable_gzip' && $this->_var['opt'] == 1): ?> onclick="return confirm('<?php echo $this->_var['lang']['gzip_confirm']; ?>');" <?php endif; ?> <?php if ($this->_var['var']['code'] == 'retain_original_img' && $this->_var['opt'] == 0): ?> onclick="return confirm('<?php echo $this->_var['lang']['retain_original_confirm']; ?>');" <?php endif; ?> /><?php echo $this->_var['var']['display_options'][$this->_var['k']]; ?></label> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <?php elseif ($this->_var['var']['type'] == "options"): ?> <select name="value[<?php echo $this->_var['var']['id']; ?>]" id="value_<?php echo $this->_var['var']['id']; ?>_<?php echo $this->_var['key']; ?>"> <?php echo $this->html_options(array('options'=>$this->_var['lang']['cfg_range'][$this->_var['var']['code']],'selected'=>$this->_var['var']['value'])); ?> </select> <?php elseif ($this->_var['var']['type'] == "file"): ?> <input name="<?php echo $this->_var['var']['code']; ?>" type="file" size="40" /> <?php if (( $this->_var['var']['code'] == "shop_logo" || $this->_var['var']['code'] == "no_picture" || $this->_var['var']['code'] == "watermark" || $this->_var['var']['code'] == "shop_slagon" || $this->_var['var']['code'] == "wap_logo" ) && $this->_var['var']['value']): ?> <a href="?act=del&code=<?php echo $this->_var['var']['code']; ?>"><img src="images/no.gif" alt="Delete" border="0" /></a> <img src="images/yes.gif" border="0" onmouseover="showImg('<?php echo $this->_var['var']['code']; ?>_layer', 'show')" onmouseout="showImg('<?php echo $this->_var['var']['code']; ?>_layer', 'hide')" /> <div id="<?php echo $this->_var['var']['code']; ?>_layer" style="position:absolute; width:100px; height:100px; z-index:1; visibility:hidden" border="1"> <img src="<?php echo $this->_var['var']['value']; ?>" border="0" /> </div> <?php else: ?> <?php if ($this->_var['var']['value'] != ""): ?> <img src="images/yes.gif" alt="yes" /> <?php else: ?> <img src="images/no.gif" alt="no" /> <?php endif; ?> <?php endif; ?> <?php elseif ($this->_var['var']['type'] == "manual"): ?> <?php if ($this->_var['var']['code'] == "shop_country"): ?> <select name="value[<?php echo $this->_var['var']['id']; ?>]" id="selCountries" onchange="region.changed(this, 1, 'selProvinces')"> <option value=''><?php echo $this->_var['lang']['select_please']; ?></option> <?php $_from = $this->_var['countries']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'region');if (count($_from)): foreach ($_from AS $this->_var['region']): ?> <option value="<?php echo $this->_var['region']['region_id']; ?>" <?php if ($this->_var['region']['region_id'] == $this->_var['cfg']['shop_country']): ?>selected<?php endif; ?>><?php echo $this->_var['region']['region_name']; ?></option> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </select> <?php elseif ($this->_var['var']['code'] == "shop_province"): ?> <select name="value[<?php echo $this->_var['var']['id']; ?>]" id="selProvinces" onchange="region.changed(this, 2, 'selCities')"> <option value=''><?php echo $this->_var['lang']['select_please']; ?></option> <?php $_from = $this->_var['provinces']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'region');if (count($_from)): foreach ($_from AS $this->_var['region']): ?> <option value="<?php echo $this->_var['region']['region_id']; ?>" <?php if ($this->_var['region']['region_id'] == $this->_var['cfg']['shop_province']): ?>selected<?php endif; ?>><?php echo $this->_var['region']['region_name']; ?></option> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </select> <?php elseif ($this->_var['var']['code'] == "shop_city"): ?> <select name="value[<?php echo $this->_var['var']['id']; ?>]" id="selCities"> <option value=''><?php echo $this->_var['lang']['select_please']; ?></option> <?php $_from = $this->_var['cities']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'region');if (count($_from)): foreach ($_from AS $this->_var['region']): ?> <option value="<?php echo $this->_var['region']['region_id']; ?>" <?php if ($this->_var['region']['region_id'] == $this->_var['cfg']['shop_city']): ?>selected<?php endif; ?>><?php echo $this->_var['region']['region_name']; ?></option> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </select> <?php elseif ($this->_var['var']['code'] == "lang"): ?> <select name="value[<?php echo $this->_var['var']['id']; ?>]"> <?php echo $this->html_options(array('values'=>$this->_var['lang_list'],'output'=>$this->_var['lang_list'],'selected'=>$this->_var['var']['value'])); ?> </select> <?php elseif ($this->_var['var']['code'] == "invoice_type"): ?> <table> <tr> <th scope="col"><?php echo $this->_var['lang']['invoice_type']; ?></th> <th scope="col"><?php echo $this->_var['lang']['invoice_rate']; ?></th> </tr> <tr> <td><input name="invoice_type[]" type="text" value="<?php echo $this->_var['cfg']['invoice_type']['type']['0']; ?>" /></td> <td><input name="invoice_rate[]" type="text" value="<?php echo $this->_var['cfg']['invoice_type']['rate']['0']; ?>" /></td> </tr> <tr> <td><input name="invoice_type[]" type="text" value="<?php echo $this->_var['cfg']['invoice_type']['type']['1']; ?>" /></td> <td><input name="invoice_rate[]" type="text" value="<?php echo $this->_var['cfg']['invoice_type']['rate']['1']; ?>" /></td> </tr> <tr> <td><input name="invoice_type[]" type="text" value="<?php echo $this->_var['cfg']['invoice_type']['type']['2']; ?>" /></td> <td><input name="invoice_rate[]" type="text" value="<?php echo $this->_var['cfg']['invoice_type']['rate']['2']; ?>" /></td> </tr> </table> <?php endif; ?> <?php endif; ?> <?php if ($this->_var['var']['desc']): ?> <br /> <span class="notice-span" <?php if ($this->_var['help_open']): ?>style="display:block" <?php else: ?> style="display:none" <?php endif; ?> id="notice<?php echo $this->_var['var']['code']; ?>"><?php echo nl2br($this->_var['var']['desc']); ?></span> <?php endif; ?> </td> </tr>
zzshop
trunk/temp/compiled/admin/shop_config_form.htm.php
PHP
asf20
9,633
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title><?php echo $this->_var['lang']['cp_home']; ?><?php if ($this->_var['ur_here']): ?> - <?php echo $this->_var['ur_here']; ?> <?php endif; ?></title> <meta name="robots" content="noindex, nofollow"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link href="styles/general.css" rel="stylesheet" type="text/css" /> <link href="styles/main.css" rel="stylesheet" type="text/css" /> <?php echo $this->smarty_insert_scripts(array('files'=>'../js/transport.js,common.js')); ?> <script language="JavaScript"> <!-- // 这里把JS用到的所有语言都赋值到这里 <?php $_from = $this->_var['lang']['js_languages']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'item');if (count($_from)): foreach ($_from AS $this->_var['key'] => $this->_var['item']): ?> var <?php echo $this->_var['key']; ?> = "<?php echo $this->_var['item']; ?>"; <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> //--> </script> </head> <body> <h1> <?php if ($this->_var['action_link']): ?> <span class="action-span"><a href="<?php echo $this->_var['action_link']['href']; ?>"><?php echo $this->_var['action_link']['text']; ?></a></span> <?php endif; ?> <?php if ($this->_var['action_link2']): ?> <span class="action-span"><a href="<?php echo $this->_var['action_link2']['href']; ?>"><?php echo $this->_var['action_link2']['text']; ?></a>&nbsp;&nbsp;</span> <?php endif; ?> <span class="action-span1"><a href="index.php?act=main"><?php echo $this->_var['lang']['cp_home']; ?></a> </span><span id="search_id" class="action-span1"><?php if ($this->_var['ur_here']): ?> - <?php echo $this->_var['ur_here']; ?> <?php endif; ?></span> <div style="clear:both"></div> </h1>
zzshop
trunk/temp/compiled/admin/pageheader.htm.php
PHP
asf20
1,945
<!-- <?php if ($this->_var['full_page']): ?> --> <?php echo $this->fetch('pageheader.htm'); ?> <?php echo $this->smarty_insert_scripts(array('files'=>'../js/utils.js,listtable.js')); ?> <div class="form-div"> <?php if ($_GET['auid']): ?> <?php echo $this->_var['lang']['show_affiliate_orders']; ?> <?php else: ?> <form action="affiliate_ck.php?act=list"> <?php echo $this->_var['lang']['sch_stats']['info']; ?> <a href="affiliate_ck.php?act=list"><?php echo $this->_var['lang']['sch_stats']['all']; ?></a> <a href="affiliate_ck.php?act=list&status=0"><?php echo $this->_var['lang']['sch_stats']['0']; ?></a> <a href="affiliate_ck.php?act=list&status=1"><?php echo $this->_var['lang']['sch_stats']['1']; ?></a> <a href="affiliate_ck.php?act=list&status=2"><?php echo $this->_var['lang']['sch_stats']['2']; ?></a> <?php echo $this->_var['lang']['sch_order']; ?> <input type="hidden" name="act" value="list" /> <input name="order_sn" type="text" id="order_sn" size="15"><input type="submit" value="<?php echo $this->_var['lang']['button_search']; ?>" class="button" /> </form> <?php endif; ?> </div> <form method="post" action="" name="listForm"> <div class="list-div" id="listDiv"> <!-- <?php endif; ?> --> <table cellspacing='1' cellpadding='3'> <tr> <th width="20%"><?php echo $this->_var['lang']['order_id']; ?></th> <th width="8%"><?php echo $this->_var['lang']['order_stats']['name']; ?></th> <th width="8%"><?php echo $this->_var['lang']['sch_stats']['name']; ?></th> <th><?php echo $this->_var['lang']['log_info']; ?></th> <th width="8%"><?php echo $this->_var['lang']['separate_type']; ?></th> <th width="10%"><?php echo $this->_var['lang']['handler']; ?></th> </tr> <!-- <?php $_from = $this->_var['logdb']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'val');if (count($_from)): foreach ($_from AS $this->_var['val']): ?> --> <tr> <td align="center"><a href="order.php?act=info&order_id=<?php echo $this->_var['val']['order_id']; ?>"><?php echo $this->_var['val']['order_sn']; ?></a></td> <td><?php echo $this->_var['lang']['order_stats'][$this->_var['val']['order_status']]; ?></td> <td><?php echo $this->_var['lang']['sch_stats'][$this->_var['val']['is_separate']]; ?></td> <td><?php echo $this->_var['val']['info']; ?></td> <td><?php echo $this->_var['lang']['separate_by'][$this->_var['val']['separate_type']]; ?></td> <td> <!-- <?php if ($this->_var['val']['is_separate'] == 0 && $this->_var['val']['separate_able'] == 1 && $this->_var['on'] == 1): ?> --> <a href="javascript:confirm_redirect(separate_confirm, 'affiliate_ck.php?act=separate&oid=<?php echo $this->_var['val']['order_id']; ?>')"><?php echo $this->_var['lang']['affiliate_separate']; ?></a> | <a href="javascript:confirm_redirect(cancel_confirm, 'affiliate_ck.php?act=del&oid=<?php echo $this->_var['val']['order_id']; ?>')"><?php echo $this->_var['lang']['affiliate_cancel']; ?></a> <!-- <?php elseif ($this->_var['val']['is_separate'] == 1): ?> --> <a href="javascript:confirm_redirect(rollback_confirm, 'affiliate_ck.php?act=rollback&logid=<?php echo $this->_var['val']['log_id']; ?>')"><?php echo $this->_var['lang']['affiliate_rollback']; ?></a> <!-- <?php else: ?> --> - <!-- <?php endif; ?> --> </td> </tr> <!-- <?php endforeach; else: ?> --> <tr><td class="no-records" colspan="10"><?php echo $this->_var['lang']['no_records']; ?></td></tr> <!-- <?php endif; unset($_from); ?><?php $this->pop_vars();; ?> --> </table> <table cellpadding="4" cellspacing="0"> <tr> <td align="right"><?php echo $this->fetch('page.htm'); ?></td> </tr> </table> <!-- <?php if ($this->_var['full_page']): ?> --> </div> </form> <script type="Text/Javascript" language="JavaScript"> listTable.recordCount = <?php echo $this->_var['record_count']; ?>; listTable.pageCount = <?php echo $this->_var['page_count']; ?>; <?php $_from = $this->_var['filter']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'item');if (count($_from)): foreach ($_from AS $this->_var['key'] => $this->_var['item']): ?> listTable.filter.<?php echo $this->_var['key']; ?> = '<?php echo $this->_var['item']; ?>'; <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <!-- --> onload = function() { // 开始检查订单 startCheckOrder(); } <!-- --> </script> <?php echo $this->fetch('pagefooter.htm'); ?> <!-- <?php endif; ?> -->
zzshop
trunk/temp/compiled/admin/affiliate_ck_list.htm.php
PHP
asf20
4,555
<table width="100%" cellpadding="3" cellspacing="1"> <tr> <td scope="col"><div align="center"><strong><?php echo $this->_var['lang']['goods_name_brand']; ?></strong></div></td> <td scope="col"><div align="center"><strong><?php echo $this->_var['lang']['goods_sn']; ?></strong></div></td> <td scope="col"><div align="center"><strong><?php echo $this->_var['lang']['goods_price']; ?></strong></div></td> <td scope="col"><div align="center"><strong><?php echo $this->_var['lang']['goods_number']; ?></strong></div></td> <td scope="col"><div align="center"><strong><?php echo $this->_var['lang']['goods_attr']; ?></strong></div></td> <td scope="col"><div align="center"><strong><?php echo $this->_var['lang']['storage']; ?></strong></div></td> <td scope="col"><div align="center"><strong><?php echo $this->_var['lang']['subtotal']; ?></strong></div></td> </tr> <?php $_from = $this->_var['goods_list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'goods');if (count($_from)): foreach ($_from AS $this->_var['goods']): ?> <tr> <?php if ($this->_var['goods']['goods_id'] > 0 && $this->_var['goods']['extension_code'] != 'package_buy'): ?> <td><img src="<?php echo $this->_var['goods']['goods_thumb']; ?>" /><br /><a href="../goods.php?id=<?php echo $this->_var['goods']['goods_id']; ?>" target="_blank"><?php echo $this->_var['goods']['goods_name']; ?> <?php if ($this->_var['goods']['brand_name']): ?>[ <?php echo $this->_var['goods']['brand_name']; ?> ]<?php endif; ?> <?php if ($this->_var['goods']['is_gift']): ?><?php if ($this->_var['goods']['goods_price'] > 0): ?><?php echo $this->_var['lang']['remark_favourable']; ?><?php else: ?><?php echo $this->_var['lang']['remark_gift']; ?><?php endif; ?><?php endif; ?> <?php if ($this->_var['goods']['parent_id'] > 0): ?><?php echo $this->_var['lang']['remark_fittings']; ?><?php endif; ?></a></td> <?php else: ?> <td><?php echo $this->_var['goods']['goods_name']; ?><?php echo $this->_var['lang']['remark_package']; ?></td> <?php endif; ?> <td><?php echo $this->_var['goods']['goods_sn']; ?></td> <td><div align="right"><?php echo $this->_var['goods']['formated_goods_price']; ?></div></td> <td><div align="right"><?php echo $this->_var['goods']['goods_number']; ?> </div></td> <td><?php echo nl2br($this->_var['goods']['goods_attr']); ?></td> <td><div align="right"><?php echo $this->_var['goods']['storage']; ?></div></td> <td><div align="right"><?php echo $this->_var['goods']['formated_subtotal']; ?></div></td> </tr> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </table>
zzshop
trunk/temp/compiled/admin/order_goods_info.htm.php
PHP
asf20
2,728
<!-- $Id: page.htm 14216 2008-03-10 02:27:21Z testyang $ --> <?php echo $this->smarty_insert_scripts(array('files'=>'../js/utils.js')); ?> <div id="turn-page"> <?php echo $this->_var['lang']['total_records']; ?> <span id="totalRecords"><?php echo $this->_var['record_count']; ?></span> <?php echo $this->_var['lang']['total_pages']; ?> <span id="totalPages"><?php echo $this->_var['page_count']; ?></span> <?php echo $this->_var['lang']['page_current']; ?> <span id="pageCurrent"><?php echo $this->_var['filter']['page']; ?></span> <?php echo $this->_var['lang']['page_size']; ?> <input type='text' size='3' id='pageSize' value="<?php echo $this->_var['filter']['page_size']; ?>" onkeypress="return listTable.changePageSize(event)" /> <span id="page-link"> <a href="javascript:listTable.gotoPageFirst()"><?php echo $this->_var['lang']['page_first']; ?></a> <a href="javascript:listTable.gotoPagePrev()"><?php echo $this->_var['lang']['page_prev']; ?></a> <a href="javascript:listTable.gotoPageNext()"><?php echo $this->_var['lang']['page_next']; ?></a> <a href="javascript:listTable.gotoPageLast()"><?php echo $this->_var['lang']['page_last']; ?></a> <select id="gotoPage" onchange="listTable.gotoPage(this.value)"> <?php echo $this->smarty_create_pages(array('count'=>$this->_var['page_count'],'page'=>$this->_var['filter']['page'])); ?> </select> </span> </div>
zzshop
trunk/temp/compiled/admin/page.htm.php
PHP
asf20
1,525
<!-- $Id: goods_type.htm 14216 2008-03-10 02:27:21Z testyang $ --> <?php if ($this->_var['full_page']): ?> <?php echo $this->fetch('pageheader.htm'); ?> <?php echo $this->smarty_insert_scripts(array('files'=>'../js/utils.js,listtable.js')); ?> <form method="post" action="" name="listForm"> <!-- start goods type list --> <div class="list-div" id="listDiv"> <?php endif; ?> <table width="100%" cellpadding="3" cellspacing="1" id="listTable"> <tr> <th><?php echo $this->_var['lang']['goods_type_name']; ?></th> <th><?php echo $this->_var['lang']['attr_groups']; ?></th> <th><?php echo $this->_var['lang']['attribute_number']; ?></th> <th><?php echo $this->_var['lang']['goods_type_status']; ?></th> <th><?php echo $this->_var['lang']['handler']; ?></th> </tr> <?php $_from = $this->_var['goods_type_arr']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'goods_type');if (count($_from)): foreach ($_from AS $this->_var['goods_type']): ?> <tr> <td class="first-cell"><span onclick="javascript:listTable.edit(this, 'edit_type_name', <?php echo $this->_var['goods_type']['cat_id']; ?>)"><?php echo $this->_var['goods_type']['cat_name']; ?></span></td> <td><?php echo $this->_var['goods_type']['attr_group']; ?></td> <td align="right"><?php echo $this->_var['goods_type']['attr_count']; ?></td> <td align="center"><img src="images/<?php if ($this->_var['goods_type']['enabled']): ?>yes<?php else: ?>no<?php endif; ?>.gif" ></td> <td align="center"> <a href="attribute.php?act=list&goods_type=<?php echo $this->_var['goods_type']['cat_id']; ?>" title="<?php echo $this->_var['lang']['attribute']; ?>"><?php echo $this->_var['lang']['attribute']; ?></a> | <a href="goods_type.php?act=edit&cat_id=<?php echo $this->_var['goods_type']['cat_id']; ?>" title="<?php echo $this->_var['lang']['edit']; ?>"><?php echo $this->_var['lang']['edit']; ?></a> | <a href="javascript:;" onclick="listTable.remove(<?php echo $this->_var['goods_type']['cat_id']; ?>, '<?php echo $this->_var['lang']['remove_confirm']; ?>')" title="<?php echo $this->_var['lang']['remove']; ?>"><?php echo $this->_var['lang']['remove']; ?></a> </td> </tr> <?php endforeach; else: ?> <tr><td class="no-records" colspan="10"><?php echo $this->_var['lang']['no_records']; ?></td></tr> <?php endif; unset($_from); ?><?php $this->pop_vars();; ?> <tr> <td align="right" nowrap="true" colspan="6"> <?php echo $this->fetch('page.htm'); ?> </td> </tr> </table> <?php if ($this->_var['full_page']): ?> </div> <!-- end goods type list --> </form> <script type="text/javascript" language="JavaScript"> <!-- listTable.recordCount = <?php echo $this->_var['record_count']; ?>; listTable.pageCount = <?php echo $this->_var['page_count']; ?>; <?php $_from = $this->_var['filter']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'item');if (count($_from)): foreach ($_from AS $this->_var['key'] => $this->_var['item']): ?> listTable.filter.<?php echo $this->_var['key']; ?> = '<?php echo $this->_var['item']; ?>'; <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> onload = function() { // 开始检查订单 startCheckOrder(); } //--> </script> <?php echo $this->fetch('pagefooter.htm'); ?> <?php endif; ?>
zzshop
trunk/temp/compiled/admin/goods_type.htm.php
PHP
asf20
3,494
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title><?php echo $this->_var['lang']['cp_home']; ?></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script type="Text/Javascript" language="JavaScript"> <!-- if (window.top != window) { window.top.location.href = document.location.href; } //--> </script> <frameset rows="76,*" framespacing="0" border="0"> <frame src="index.php?act=top" id="header-frame" name="header-frame" frameborder="no" scrolling="no"> <frameset cols="180, 10, *" framespacing="0" border="0" id="frame-body"> <frame src="index.php?act=menu" id="menu-frame" name="menu-frame" frameborder="no" scrolling="yes"> <frame src="index.php?act=drag" id="drag-frame" name="drag-frame" frameborder="no" scrolling="no"> <frame src="index.php?act=main" id="main-frame" name="main-frame" frameborder="no" scrolling="yes"> </frameset> </frameset> <frameset rows="0, 0" framespacing="0" border="0"> <frame src="http://api.ecshop.com/record.php?mod=login&url=<?php echo $this->_var['shop_url']; ?>" id="hidd-frame" name="hidd-frame" frameborder="no" scrolling="no"> </frameset> </head> <body> </body> </html>
zzshop
trunk/temp/compiled/admin/index.htm.php
PHP
asf20
1,327
<!-- $Id: goods_export.htm 17107 2010-04-15 03:29:13Z liuhui $ --> <?php echo $this->fetch('pageheader.htm'); ?> <table width="100%"> <tr> <td> <div class="main-div" style="background-color: white;"> <?php echo $this->_var['lang']['user_guide']; ?> <h3><center><?php echo $this->_var['lang']['export_condition']; ?></center></h3> <div> <form action="goods_export.php" method="post" name="searchForm" onsubmit="return queryGoods(this)"> <strong><?php echo $this->_var['lang']['custom_goods_search']; ?></strong> <!-- 分类 --> <select name="cat_id"><option value="0"><?php echo $this->_var['lang']['custom_goods_cat']; ?></option><?php echo $this->_var['cat_list']; ?></select> <!-- 品牌 --> <select name="brand_id"><option value="0"><?php echo $this->_var['lang']['custom_goods_brand']; ?></option><?php echo $this->html_options(array('options'=>$this->_var['brand_list'])); ?></select> <!-- 关键字 --> <?php echo $this->_var['lang']['custom_keyword']; ?><input type="text" name="keyword"/> <!-- 搜索 --> <input type="submit" name="search_submit" id="search_submit" value="<?php echo $this->_var['lang']['export_condition_search']; ?>" class="button" /> </form> </div> <table> <tr> <td width="46%"><select name="src_goods_lists" id="src_goods_lists" size="14" style="width:100%" multiple="true"> </select></td> <td rowspan="2" width="8%" style="text-align:center;"> <p><input type="button" value=">>" id="addAllGoods" class="button" /></p> <p><input type="button" value=">" id="addGoods" class="button" /></p> <p><input type="button" value="<" id="delGoods" class="button" /></p> <p><input type="button" value="<<" id="delAllGoods" class="button" /></p> </td> <td width="46%"><select name="dst_goods_lists" id="dst_goods_lists" size="14" style="width:100%" multiple="true"> </select></td> </tr> </table> <div> <strong><?php echo $this->_var['lang']['export_format']; ?></strong> <!-- 导出的数据格式 --> <select name="data_format" id="data_format"><?php echo $this->html_options(array('options'=>$this->_var['data_format'])); ?></select> <div id="export_format"> </div> </div> </div> </td> </tr> </table> <div id="ecshop_form" style="display:none"> <form action="goods_export.php" method="post" name="theForm" onsubmit="return formValidate0()"> <table width="100%" > <tr> <td class="label"><?php echo $this->_var['lang']['select_charset']; ?></td> <td> <select name="charset" > <option value="UTF8">UTF8</option> <option value="GB2312">GB2312</option> <option value="GBK">GBK</option> </select> </td> </tr> <tr> <td> <input name="cat_id" type="hidden" value="" /> <input name="brand_id" type="hidden" value="" /> <input name="keyword" type="hidden" value="" /> <input name="goods_ids" type="hidden" value="" /> <input type="hidden" name="act" value="act_export_ecshop"> </td> <td> <input name="submit" type="submit" id="submit" value="<?php echo $this->_var['lang']['button_submit']; ?>" class="button" /> </td> </tr> </table> </form> </div> <div id="taobao_form" style="display:none"> <form action="goods_export.php" method="post" name="theForm1" onsubmit="return formValidate1()"> <table width="100%" > <tr> <td class="label"><a href="javascript:showNotice('noticeGoodsClass');" title="<?php echo $this->_var['lang']['form_notice']; ?>"><img src="images/notice.gif" width="16" height="16" border="0" alt="<?php echo $this->_var['lang']['form_notice']; ?>"></a><?php echo $this->_var['lang']['goods_class']; ?></td> <td><input type="text" name="goods_class" value="0" /><br /> <span class="notice-span" <?php if ($this->_var['help_open']): ?>style="display:block" <?php else: ?> style="display:none" <?php endif; ?> id="noticeGoodsClass"><?php echo $this->_var['lang']['notice_goods_class']; ?></span></tr> <tr> <tr> <td ></tr> <tr> <tr> <td class="label"><?php echo $this->_var['lang']['post_express']; ?></td> <td><input type="text" name="post_express" value="0" /></tr> <tr> <tr> <td class="label"><?php echo $this->_var['lang']['express']; ?></td> <td><input type="text" name="express" value="0" /></tr> <tr> <tr> <td class="label"><?php echo $this->_var['lang']['ems']; ?></td> <td><input type="text" name="ems" value="0" /></tr> <tr> <tr> <td>&nbsp; <input name="cat_id" type="hidden" value="" /> <input name="brand_id" type="hidden" value="" /> <input name="keyword" type="hidden" value="" /> <input name="goods_ids" type="hidden" value="" /><input type="hidden" name="act" value="act_export_taobao"></td> <td><input name="submit" type="submit" id="submit" value="<?php echo $this->_var['lang']['button_submit']; ?>" class="button" /></td> </tr> </table> </form> </div> <div id="taobao V4.3_form" style="display:none"> <form action="goods_export.php" method="post" name="theForm1" onsubmit="return formValidate1()"> <table width="100%" > <tr> <td class="label"><a href="javascript:showNotice('noticeGoodsClass');" title="<?php echo $this->_var['lang']['form_notice']; ?>"><img src="images/notice.gif" width="16" height="16" border="0" alt="<?php echo $this->_var['lang']['form_notice']; ?>"></a><?php echo $this->_var['lang']['goods_class']; ?></td> <td><input type="text" name="goods_class" value="0" /><br /> <span class="notice-span" <?php if ($this->_var['help_open']): ?>style="display:block" <?php else: ?> style="display:none" <?php endif; ?> id="noticeGoodsClass"><?php echo $this->_var['lang']['notice_goods_class']; ?></span></tr> <tr> <tr> <td ></tr> <tr> <tr> <td class="label"><?php echo $this->_var['lang']['post_express']; ?></td> <td><input type="text" name="post_express" value="0" /></tr> <tr> <tr> <td class="label"><?php echo $this->_var['lang']['express']; ?></td> <td><input type="text" name="express" value="0" /></tr> <tr> <tr> <td class="label"><?php echo $this->_var['lang']['ems']; ?></td> <td><input type="text" name="ems" value="0" /></tr> <tr> <tr> <td>&nbsp; <input name="cat_id" type="hidden" value="" /> <input name="brand_id" type="hidden" value="" /> <input name="keyword" type="hidden" value="" /> <input name="goods_ids" type="hidden" value="" /><input type="hidden" name="act" value="act_export_taobao V4.3"></td> <td><input name="submit" type="submit" id="submit" value="<?php echo $this->_var['lang']['button_submit']; ?>" class="button" /></td> </tr> </table> </form> </div> <div id="paipai_form" style="display:none"> <form action="goods_export.php" method="post" name="theForm2" onsubmit="return formValidate2()"> <table width="100%" > <tr> <td ></tr> <tr> <tr> <td class="label"><?php echo $this->_var['lang']['post_express']; ?></td> <td><input type="text" name="post_express" value="0" /></tr> <tr> <tr> <td class="label"><?php echo $this->_var['lang']['express']; ?></td> <td><input type="text" name="express" value="0" /></tr> <tr> <tr> <td>&nbsp; <input name="cat_id" type="hidden" value="" /> <input name="brand_id" type="hidden" value="" /> <input name="keyword" type="hidden" value="" /> <input name="goods_ids" type="hidden" value="" /><input type="hidden" name="act" value="act_export_paipai"></td> <td><input name="submit" type="submit" id="submit" value="<?php echo $this->_var['lang']['button_submit']; ?>" class="button" /></td> </tr> </table> </form> </div> <div id="paipai4_form" style="display:none"> <form action="goods_export.php" method="post" name="theForm5" onsubmit="return formValidate5()"> <table width="100%" > <tr> <td ></tr> <tr> <tr> <td class="label"><?php echo $this->_var['lang']['post_express']; ?></td> <td><input type="text" name="post_express" value="0" /></tr> <tr> <tr> <td class="label"><?php echo $this->_var['lang']['express']; ?></td> <td><input type="text" name="express" value="0" /></tr> <tr> <tr> <td>&nbsp; <input name="cat_id" type="hidden" value="" /> <input name="brand_id" type="hidden" value="" /> <input name="keyword" type="hidden" value="" /> <input name="goods_ids" type="hidden" value="" /><input type="hidden" name="act" value="act_export_paipai4"></td> <td><input name="submit" type="submit" id="submit" value="<?php echo $this->_var['lang']['button_submit']; ?>" class="button" /></td> </tr> </table> </form> </div> <div id="custom_form" style="display:none"> <form action="goods_export.php" method="post" name="theForm4" onsubmit="return formValidate4()"> <table width="100%"> <tr> <td> <div class="main-div" style="background-color: white;"> <table> <tr> <td width="45%"><strong><?php echo $this->_var['lang']['custom_goods_list']; ?></strong><span style="margin-left:20px;"><select name="goods_type" id="goods_type"><option value="0"><?php echo $this->_var['lang']['custom_goods_type']; ?></option><?php echo $this->_var['goods_type_list']; ?></select></span></td> <td rowspan="2" width="5%" style="text-align:center;"><p><input type="button" value=">>" id="addAllItem" class="button" /></p> <p><input type="button" value=">" id="addItem" class="button" /></p> <p><input type="button" value="<" id="delItem" class="button" /></p> <p><input type="button" value="<<" id="delAllItem" class="button" /></p></td> <td width="45%"><strong><?php echo $this->_var['lang']['custom_export_list']; ?></strong></td> <td rowspan="2" width="5%" style="text-align:center;"><p><input type="button" value="<?php echo $this->_var['lang']['custom_up']; ?>" id="mvUp" class="button" /></p><p><input type="button" value="<?php echo $this->_var['lang']['custom_down']; ?>" id="mvDown" class="button" /></p></td> </tr> <tr> <td><select name="src_goods_fields" id="src_goods_fields" size="14" style="width:100%" multiple="true"><?php echo $this->html_options(array('options'=>$this->_var['goods_fields'])); ?> </select></td> <td><select name="dst_goods_fields" id="dst_goods_fields" size="14" style="width:100%" multiple="true"> </select></td> </tr> <tr><td class="label"><?php echo $this->_var['lang']['select_charset']; ?></td> <td> <select name="charset_custom" > <option value="UTF8">UTF8</option> <option value="GB2312">GB2312</option> <option value="GBK">GBK</option> </select> </td></tr> <tr> <td></td> <td></td> <td> <input name="cat_id" type="hidden" value="" /> <input name="brand_id" type="hidden" value="" /> <input name="keyword" type="hidden" value="" /> <input name="goods_ids" type="hidden" value="" /> <input type="hidden" name="act" value="act_export_custom"> <input type="hidden" name="custom_goods_export" value=""> <input name="submit" type="submit" id="submit" value="<?php echo $this->_var['lang']['button_submit']; ?>" class="button" /> </td> <td></td> </tr> </table> </div> </td> </tr> </table> </form> </div> <?php echo $this->smarty_insert_scripts(array('files'=>'../js/utils.js,validator.js')); ?> <script language="JavaScript"> var post_express_not_null = "<?php echo $this->_var['lang']['post_express_not_null']; ?>"; var express_not_null = "<?php echo $this->_var['lang']['express_not_null']; ?>"; var ems_not_null = "<?php echo $this->_var['lang']['ems_not_null']; ?>"; var custom_goods_field_not_null = "<?php echo $this->_var['lang']['custom_goods_field_not_null']; ?>"; var elements; onload = function() { // 开始检查订单 startCheckOrder(); } function formValidate0() { var src_obj = document.forms['searchForm']; var dst_obj = document.forms['theForm']; copy_search_result(src_obj, dst_obj); return true; } /** * 检查输入是否完整 */ function formValidate2() { var elements = document.forms['theForm2'].elements; var msg = ''; if (parseFloat(elements['post_express'].value) <= 0) { msg += post_express_not_null + '\n'; } if (parseFloat(elements['express'].value) <= 0) { msg += express_not_null + '\n'; } if (msg.length > 0) { alert(msg); return false; } else { var src_obj = document.forms['searchForm']; var dst_obj = document.forms['theForm2']; copy_search_result(src_obj, dst_obj); return true; } } /** * 检查输入是否完整 */ function formValidate1() { var elements = document.forms['theForm1'].elements; var msg = ''; if (parseFloat(elements['post_express'].value) <= 0) { msg += post_express_not_null + '\n'; } if (parseFloat(elements['express'].value) <= 0) { msg += express_not_null + '\n'; } if (parseFloat(elements['ems'].value) <= 0) { msg += ems_not_null + '\n'; } if (msg.length > 0) { alert(msg); return false; } else { var src_obj = document.forms['searchForm']; var dst_obj = document.forms['theForm1']; copy_search_result(src_obj, dst_obj); return true; } } /* 检查输入是否完整 */ function formValidate4 () { var elements = document.forms['theForm4'].elements; var msg = ''; if (elements['dst_goods_fields'].options.length <= 0) { msg += custom_goods_field_not_null + '\n'; } if (msg.length > 0) { alert(msg); return false; } else { elements['custom_goods_export'].value = ''; for (var i=0,l=elements['dst_goods_fields'].options.length; i<l; i++) { var separator = (i==0)?'':','; elements['custom_goods_export'].value += separator + elements['dst_goods_fields'].options[i].value; } var src_obj = document.forms['searchForm']; var dst_obj = document.forms['theForm4']; copy_search_result(src_obj, dst_obj); return true; } } /** * 检查输入是否完整 */ function formValidate5() { var elements = document.forms['theForm5'].elements; var msg = ''; if (parseFloat(elements['post_express'].value) <= 0) { msg += post_express_not_null + '\n'; } if (parseFloat(elements['express'].value) <= 0) { msg += express_not_null + '\n'; } if (msg.length > 0) { alert(msg); return false; } else { var src_obj = document.forms['searchForm']; var dst_obj = document.forms['theForm5']; copy_search_result(src_obj, dst_obj); return true; } } function copy_search_result(src_obj, dst_obj) { dst_obj.cat_id.value = src_obj.cat_id.value; dst_obj.brand_id.value = src_obj.brand_id.value; dst_obj.keyword.value = src_obj.keyword.value; var goods_lists = Utils.$('dst_goods_lists'); for (var i=0,l=goods_lists.options.length; i<l; i++) { var separator = (i==0)?'':','; dst_obj.goods_ids.value += separator + goods_lists.options[i].value; } } /** * 绑定商品类型控件事件 */ if(Utils.$('goods_type')) { Utils.$('goods_type').onchange = function () { Ajax.call('goods_export.php?is_ajax=1&act=get_goods_fields&cat_id='+this.value, '' , goodsFieldsResponse , 'POST', 'JSON'); } } function goodsFieldsResponse (result) { if (result.error > 0) { alert(result.message); return; } Utils.$('src_goods_fields').innerHTML = ''; for (var key in result.content) { if (typeof (result.content[key]) == 'string') { var new_opt = document.createElement('OPTION'); new_opt.value = key; new_opt.innerHTML = result.content[key]; Utils.$('src_goods_fields').appendChild(new_opt); } } } /* 搜索商品列表 */ function queryGoods(obj) { var filters = new Object; filters.cat_id = obj.cat_id.value; filters.brand_id = obj.brand_id.value; filters.keyword = obj.keyword.value; Ajax.call('goods_export.php?is_ajax=1&act=get_goods_list', filters, queryGoodsResponse , 'POST', 'JSON'); return false; } function queryGoodsResponse (result) { if (result.error > 0) { alert(result.message); return; } Utils.$('src_goods_lists').innerHTML = ''; for (var i=0,l=result.content.length;i<l;++i) { var new_opt = document.createElement('OPTION'); new_opt.value = result.content[i].goods_id; new_opt.innerHTML = result.content[i].goods_name; Utils.$('src_goods_lists').appendChild(new_opt); } } /* 操作自定义导出商品的Select Box */ var MySelectBox; var MySelectBox2; if (!MySelectBox) { var global = $import("../js/global.js","js"); global.onload = global.onreadystatechange= function() { if(this.readyState && this.readyState=="loading")return; var selectbox = $import("js/selectbox.js","js"); selectbox.onload = selectbox.onreadystatechange = function() { if(this.readyState && this.readyState=="loading")return; MySelectBox = new SelectBox('src_goods_fields', 'dst_goods_fields'); MySelectBox2 = new SelectBox('src_goods_lists', 'dst_goods_lists', true); } } } if (Utils.$('addItem')) { Utils.$('addItem').onclick = function () { MySelectBox.addItem(); } } if (Utils.$('delItem')) { Utils.$('delItem').onclick = function () { MySelectBox.delItem(); } } if (Utils.$('addAllItem')) { Utils.$('addAllItem').onclick = function () { MySelectBox.addItem(true); } } if (Utils.$('delAllItem')) { Utils.$('delAllItem').onclick = function () { MySelectBox.delItem(true); } } if (Utils.$('src_goods_fields')) { Utils.$('src_goods_fields').ondblclick = function () { MySelectBox.addItem(); } } if (Utils.$('dst_goods_fields')) { Utils.$('dst_goods_fields').ondblclick = function () { MySelectBox.delItem(); } } if (Utils.$('mvUp')) { Utils.$('mvUp').onclick = function () { MySelectBox.moveItem('up'); } } if (Utils.$('mvDown')) { Utils.$('mvDown').onclick = function () { MySelectBox.moveItem('down'); } } if (Utils.$('addGoods')) { Utils.$('addGoods').onclick = function () { MySelectBox2.addItem(); } } if (Utils.$('delGoods')) { Utils.$('delGoods').onclick = function () { MySelectBox2.delItem(); } } if (Utils.$('addAllGoods')) { Utils.$('addAllGoods').onclick = function () { MySelectBox2.addItem(true); } } if (Utils.$('delAllGoods')) { Utils.$('delAllGoods').onclick = function () { MySelectBox2.delItem(true); } } if (Utils.$('src_goods_lists')) { Utils.$('src_goods_lists').ondblclick = function () { MySelectBox2.addItem(); } } if (Utils.$('dst_goods_lists')) { Utils.$('dst_goods_lists').ondblclick = function () { MySelectBox2.delItem(); } } /** * 上一次操作的对象 */ window.last_form = new Object; /** * 初始化导出格式 */ function init_data_format () { var _format = Utils.$('data_format'); show_data_format(_format.value); _format.onchange = function () { show_data_format(this.value); } } /** * 显示要导出的格式页面 * * @param page string 页面 * * @return void */ function show_data_format (page) { try { window.last_form.style.display = 'none'; } catch (e) { } var _page = Utils.$(page+'_form'); _page.style.display = ''; Utils.$('export_format').appendChild(_page); window.last_form = _page; } if (Browser.isIE) { window.attachEvent("onload", init_data_format); } else { window.addEventListener("load", init_data_format, false); } </script> <?php echo $this->fetch('pagefooter.htm'); ?>
zzshop
trunk/temp/compiled/admin/goods_export.htm.php
PHP
asf20
22,691
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta name="Generator" content="ECSHOP v2.7.2" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="Keywords" content="<?php echo $this->_var['keywords']; ?>" /> <meta name="Description" content="<?php echo $this->_var['description']; ?>" /> <title><?php echo $this->_var['page_title']; ?></title> <link rel="shortcut icon" href="favicon.ico" /> <link rel="icon" href="animated_favicon.gif" type="image/gif" /> <link href="<?php echo $this->_var['ecs_css_path']; ?>" rel="stylesheet" type="text/css" /> <?php echo $this->smarty_insert_scripts(array('files'=>'common.js')); ?> <script type="text/javascript"> function $id(element) { return document.getElementById(element); } //切屏--是按钮,_v是内容平台,_h是内容库 function reg(str){ var bt=$id(str+"_b").getElementsByTagName("h2"); for(var i=0;i<bt.length;i++){ bt[i].subj=str; bt[i].pai=i; bt[i].style.cursor="pointer"; bt[i].onclick=function(){ $id(this.subj+"_v").innerHTML=$id(this.subj+"_h").getElementsByTagName("blockquote")[this.pai].innerHTML; for(var j=0;j<$id(this.subj+"_b").getElementsByTagName("h2").length;j++){ var _bt=$id(this.subj+"_b").getElementsByTagName("h2")[j]; var ison=j==this.pai; _bt.className=(ison?"":"h2bg"); } } } $id(str+"_h").className="none"; $id(str+"_v").innerHTML=$id(str+"_h").getElementsByTagName("blockquote")[0].innerHTML; } </script> </head> <body> <?php echo $this->fetch('library/page_header.lbi'); ?> <div class="block box"> <div id="ur_here"> <?php echo $this->fetch('library/ur_here.lbi'); ?> </div> </div> <div class="blank"></div> <div class="block clearfix"> <div class="AreaL"> <?php echo $this->fetch('library/cart.lbi'); ?> <?php echo $this->fetch('library/category_tree.lbi'); ?> <?php echo $this->fetch('library/goods_related.lbi'); ?> <?php echo $this->fetch('library/goods_fittings.lbi'); ?> <?php echo $this->fetch('library/goods_article.lbi'); ?> <?php echo $this->fetch('library/goods_attrlinked.lbi'); ?> <?php echo $this->fetch('library/history.lbi'); ?> </div> <div class="AreaR"> <div id="goodsInfo" class="clearfix"> <div class="imgInfo"> <?php if ($this->_var['pictures']): ?> <a href="javascript:;" onclick="window.open('gallery.php?id=<?php echo $this->_var['goods']['goods_id']; ?>'); return false;"> <img src="<?php echo $this->_var['goods']['goods_img']; ?>" alt="<?php echo htmlspecialchars($this->_var['goods']['goods_name']); ?>"/> </a> <?php else: ?> <img src="<?php echo $this->_var['goods']['goods_img']; ?>" alt="<?php echo htmlspecialchars($this->_var['goods']['goods_name']); ?>"/> <?php endif; ?> <div class="blank5"></div> <?php echo $this->fetch('library/goods_gallery.lbi'); ?> <div class="blank5"></div> </div> <div class="textInfo"> <form action="javascript:addToCart(<?php echo $this->_var['goods']['goods_id']; ?>)" method="post" name="ECS_FORMBUY" id="ECS_FORMBUY" > <div class="clearfix"> <p class="f_l"><?php echo $this->_var['goods']['goods_style_name']; ?></p> <p class="f_r"> <?php if ($this->_var['prev_good']): ?> <a href="<?php echo $this->_var['prev_good']['url']; ?>"><img alt="prev" src="themes/default/images/up.gif" /></a> <?php endif; ?> <?php if ($this->_var['next_good']): ?> <a href="<?php echo $this->_var['next_good']['url']; ?>"><img alt="next" src="themes/default/images/down.gif" /></a> <?php endif; ?> </p> </div> <ul> <?php if ($this->_var['promotion']): ?> <li class="padd"> <?php $_from = $this->_var['promotion']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'item');if (count($_from)): foreach ($_from AS $this->_var['key'] => $this->_var['item']): ?> <?php echo $this->_var['lang']['activity']; ?> <?php if ($this->_var['item']['type'] == "snatch"): ?> <a href="snatch.php" title="<?php echo $this->_var['lang']['snatch']; ?>" style="font-weight:100; color:#006bcd; text-decoration:none;">[<?php echo $this->_var['lang']['snatch']; ?>]</a> <?php elseif ($this->_var['item']['type'] == "group_buy"): ?> <a href="group_buy.php" title="<?php echo $this->_var['lang']['group_buy']; ?>" style="font-weight:100; color:#006bcd; text-decoration:none;">[<?php echo $this->_var['lang']['group_buy']; ?>]</a> <?php elseif ($this->_var['item']['type'] == "auction"): ?> <a href="auction.php" title="<?php echo $this->_var['lang']['auction']; ?>" style="font-weight:100; color:#006bcd; text-decoration:none;">[<?php echo $this->_var['lang']['auction']; ?>]</a> <?php elseif ($this->_var['item']['type'] == "favourable"): ?> <a href="activity.php" title="<?php echo $this->_var['lang']['favourable']; ?>" style="font-weight:100; color:#006bcd; text-decoration:none;">[<?php echo $this->_var['lang']['favourable']; ?>]</a> <?php endif; ?> <a href="<?php echo $this->_var['item']['url']; ?>" title="<?php echo $this->_var['lang'][$this->_var['item']['type']]; ?> <?php echo $this->_var['item']['act_name']; ?><?php echo $this->_var['item']['time']; ?>" style="font-weight:100; color:#006bcd;"><?php echo $this->_var['item']['act_name']; ?></a><br /> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </li> <?php endif; ?> <li class="clearfix"> <dd> <?php if ($this->_var['cfg']['show_goodssn']): ?> <strong><?php echo $this->_var['lang']['goods_sn']; ?></strong><?php echo $this->_var['goods']['goods_sn']; ?> <?php endif; ?> </dd> <dd class="ddR"> <?php if ($this->_var['goods']['goods_number'] != "" && $this->_var['cfg']['show_goodsnumber']): ?> <?php if ($this->_var['goods']['goods_number'] == 0): ?> <strong><?php echo $this->_var['lang']['goods_number']; ?></strong> <font color='red'><?php echo $this->_var['lang']['stock_up']; ?></font> <?php else: ?> <strong><?php echo $this->_var['lang']['goods_number']; ?></strong> <?php echo $this->_var['goods']['goods_number']; ?> <?php echo $this->_var['goods']['measure_unit']; ?> <?php endif; ?> <?php endif; ?> </dd> </li> <li class="clearfix"> <dd> <?php if ($this->_var['goods']['goods_brand'] != "" && $this->_var['cfg']['show_brand']): ?> <strong><?php echo $this->_var['lang']['goods_brand']; ?></strong><a href="<?php echo $this->_var['goods']['goods_brand_url']; ?>" ><?php echo $this->_var['goods']['goods_brand']; ?></a> <?php endif; ?> </dd> <dd class="ddR"> <?php if ($this->_var['cfg']['show_goodsweight']): ?> <strong><?php echo $this->_var['lang']['goods_weight']; ?></strong><?php echo $this->_var['goods']['goods_weight']; ?> <?php endif; ?> </dd> </li> <li class="clearfix"> <dd> <?php if ($this->_var['cfg']['show_addtime']): ?> <strong><?php echo $this->_var['lang']['add_time']; ?></strong><?php echo $this->_var['goods']['add_time']; ?> <?php endif; ?> </dd> <dd class="ddR"> <strong><?php echo $this->_var['lang']['goods_click_count']; ?>:</strong><?php echo $this->_var['goods']['click_count']; ?> </dd> </li> <li class="clearfix"> <dd class="ddL"> <?php if ($this->_var['cfg']['show_marketprice']): ?> <strong><?php echo $this->_var['lang']['market_price']; ?></strong><font class="market"><?php echo $this->_var['goods']['market_price']; ?></font><br /> <?php endif; ?> <strong><?php echo $this->_var['lang']['shop_price']; ?></strong><font class="shop" id="ECS_SHOPPRICE"><?php echo $this->_var['goods']['shop_price_formated']; ?></font><br /> <?php $_from = $this->_var['rank_prices']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'rank_price');if (count($_from)): foreach ($_from AS $this->_var['key'] => $this->_var['rank_price']): ?> <strong><?php echo $this->_var['rank_price']['rank_name']; ?>:</strong><font class="shop" id="ECS_RANKPRICE_<?php echo $this->_var['key']; ?>"><?php echo $this->_var['rank_price']['price']; ?></font><br /> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </dd> <dd style="width:48%; padding-left:7px;"> <strong><?php echo $this->_var['lang']['goods_rank']; ?></strong> <img src="themes/default/images/stars<?php echo $this->_var['goods']['comment_rank']; ?>.gif" alt="comment rank <?php echo $this->_var['goods']['comment_rank']; ?>" /> </dd> </li> <?php if ($this->_var['volume_price_list']): ?> <li class="padd"> <font class="f1"><?php echo $this->_var['lang']['volume_price']; ?>:</font><br /> <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#aad6ff"> <tr> <td align="center" bgcolor="#FFFFFF"><strong><?php echo $this->_var['lang']['number_to']; ?></strong></td> <td align="center" bgcolor="#FFFFFF"><strong><?php echo $this->_var['lang']['preferences_price']; ?></strong></td> </tr> <?php $_from = $this->_var['volume_price_list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('price_key', 'price_list');if (count($_from)): foreach ($_from AS $this->_var['price_key'] => $this->_var['price_list']): ?> <tr> <td align="center" bgcolor="#FFFFFF" class="shop"><?php echo $this->_var['price_list']['number']; ?></td> <td align="center" bgcolor="#FFFFFF" class="shop"><?php echo $this->_var['price_list']['format_price']; ?></td> </tr> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </table> </li> <?php endif; ?> <?php if ($this->_var['goods']['is_promote'] && $this->_var['goods']['gmt_end_time']): ?> <?php echo $this->smarty_insert_scripts(array('files'=>'lefttime.js')); ?> <li class="padd loop" style="margin-bottom:5px; border-bottom:1px dashed #ccc;"> <strong><?php echo $this->_var['lang']['promote_price']; ?></strong><font class="shop"><?php echo $this->_var['goods']['promote_price']; ?></font><br /> <strong><?php echo $this->_var['lang']['residual_time']; ?></strong> <font class="f4" id="leftTime"><?php echo $this->_var['lang']['please_waiting']; ?></font><br /> </li> <?php endif; ?> <li class="clearfix"> <dd> <strong><?php echo $this->_var['lang']['amount']; ?>:</strong><font id="ECS_GOODS_AMOUNT" class="shop"></font> </dd> <dd class="ddR"> <?php if ($this->_var['goods']['give_integral'] > 0): ?> <strong><?php echo $this->_var['lang']['goods_give_integral']; ?></strong><font class="f4"><?php echo $this->_var['goods']['give_integral']; ?> <?php echo $this->_var['points_name']; ?></font> <?php endif; ?> </dd> </li> <?php if ($this->_var['goods']['bonus_money']): ?> <li class="padd loop" style="margin-bottom:5px; border-bottom:1px dashed #ccc;"> <strong><?php echo $this->_var['lang']['goods_bonus']; ?></strong><font class="shop"><?php echo $this->_var['goods']['bonus_money']; ?></font><br /> </li> <?php endif; ?> <li class="clearfix"> <dd> <strong><?php echo $this->_var['lang']['number']; ?>:</strong> <input name="number" type="text" id="number" value="1" size="4" onblur="changePrice()" style="border:1px solid #ccc; "/> </dd> <dd class="ddR"> <?php if ($this->_var['cfg']['use_integral']): ?> <strong><?php echo $this->_var['lang']['goods_integral']; ?></strong><font class="f4"><?php echo $this->_var['goods']['integral']; ?> <?php echo $this->_var['points_name']; ?></font> <?php endif; ?> </dd> </li> <?php if ($this->_var['goods']['is_shipping']): ?> <li style="height:30px;padding-top:4px;"> <?php echo $this->_var['lang']['goods_free_shipping']; ?><br /> </li> <?php endif; ?> <?php $_from = $this->_var['specification']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('spec_key', 'spec');if (count($_from)): foreach ($_from AS $this->_var['spec_key'] => $this->_var['spec']): ?> <li class="padd loop"> <strong><?php echo $this->_var['spec']['name']; ?>:</strong><br /> <?php if ($this->_var['spec']['attr_type'] == 1): ?> <?php if ($this->_var['cfg']['goodsattr_style'] == 1): ?> <?php $_from = $this->_var['spec']['values']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'value');if (count($_from)): foreach ($_from AS $this->_var['key'] => $this->_var['value']): ?> <label for="spec_value_<?php echo $this->_var['value']['id']; ?>"> <input type="radio" name="spec_<?php echo $this->_var['spec_key']; ?>" value="<?php echo $this->_var['value']['id']; ?>" id="spec_value_<?php echo $this->_var['value']['id']; ?>" <?php if ($this->_var['key'] == 0): ?>checked<?php endif; ?> onclick="changePrice()" /> <?php echo $this->_var['value']['label']; ?> [<?php if ($this->_var['value']['price'] > 0): ?><?php echo $this->_var['lang']['plus']; ?><?php elseif ($this->_var['value']['price'] < 0): ?><?php echo $this->_var['lang']['minus']; ?><?php endif; ?> <?php echo $this->_var['value']['format_price']; ?>] </label><br /> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <input type="hidden" name="spec_list" value="<?php echo $this->_var['key']; ?>" /> <?php else: ?> <select name="spec_<?php echo $this->_var['spec_key']; ?>" onchange="changePrice()"> <?php $_from = $this->_var['spec']['values']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'value');if (count($_from)): foreach ($_from AS $this->_var['key'] => $this->_var['value']): ?> <option label="<?php echo $this->_var['value']['label']; ?>" value="<?php echo $this->_var['value']['id']; ?>"><?php echo $this->_var['value']['label']; ?> <?php if ($this->_var['value']['price'] > 0): ?><?php echo $this->_var['lang']['plus']; ?><?php elseif ($this->_var['value']['price'] < 0): ?><?php echo $this->_var['lang']['minus']; ?><?php endif; ?><?php if ($this->_var['value']['price'] != 0): ?><?php echo $this->_var['value']['format_price']; ?><?php endif; ?></option> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </select> <input type="hidden" name="spec_list" value="<?php echo $this->_var['key']; ?>" /> <?php endif; ?> <?php else: ?> <?php $_from = $this->_var['spec']['values']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'value');if (count($_from)): foreach ($_from AS $this->_var['key'] => $this->_var['value']): ?> <label for="spec_value_<?php echo $this->_var['value']['id']; ?>"> <input type="checkbox" name="spec_<?php echo $this->_var['spec_key']; ?>" value="<?php echo $this->_var['value']['id']; ?>" id="spec_value_<?php echo $this->_var['value']['id']; ?>" onclick="changePrice()" /> <?php echo $this->_var['value']['label']; ?> [<?php if ($this->_var['value']['price'] > 0): ?><?php echo $this->_var['lang']['plus']; ?><?php elseif ($this->_var['value']['price'] < 0): ?><?php echo $this->_var['lang']['minus']; ?><?php endif; ?> <?php echo $this->_var['value']['format_price']; ?>] </label><br /> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <input type="hidden" name="spec_list" value="<?php echo $this->_var['key']; ?>" /> <?php endif; ?> </li> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <li class="padd"> <a href="javascript:addToCart(<?php echo $this->_var['goods']['goods_id']; ?>)"><img src="themes/default/images/bnt_cat.gif" /></a> <a href="javascript:collect(<?php echo $this->_var['goods']['goods_id']; ?>)"><img src="themes/default/images/bnt_colles.gif" /></a> <?php if ($this->_var['affiliate']['on']): ?> <a href="user.php?act=affiliate&goodsid=<?php echo $this->_var['goods']['goods_id']; ?>"><img src='themes/default/images/bnt_recommend.gif'></a> <?php endif; ?> </li> </ul> </form> </div> </div> <div class="blank"></div> <div class="box"> <div class="box_1"> <h3 style="padding:0 5px;"> <div id="com_b" class="history clearfix"> <h2><?php echo $this->_var['lang']['goods_brief']; ?></h2> <h2 class="h2bg"><?php echo $this->_var['lang']['goods_attr']; ?></h2> <?php if ($this->_var['package_goods_list']): ?> <h2 class="h2bg" style="color:red;"><?php echo $this->_var['lang']['remark_package']; ?></h2> <?php endif; ?> </div> </h3> <div id="com_v" class="boxCenterList RelaArticle"></div> <div id="com_h"> <blockquote> <?php echo $this->_var['goods']['goods_desc']; ?> </blockquote> <blockquote> <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#dddddd"> <?php $_from = $this->_var['properties']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'property_group');if (count($_from)): foreach ($_from AS $this->_var['key'] => $this->_var['property_group']): ?> <tr> <th colspan="2" bgcolor="#FFFFFF"><?php echo htmlspecialchars($this->_var['key']); ?></th> </tr> <?php $_from = $this->_var['property_group']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'property');if (count($_from)): foreach ($_from AS $this->_var['property']): ?> <tr> <td bgcolor="#FFFFFF" align="left" width="30%" class="f1">[<?php echo htmlspecialchars($this->_var['property']['name']); ?>]</td> <td bgcolor="#FFFFFF" align="left" width="70%"><?php echo $this->_var['property']['value']; ?></td> </tr> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </table> </blockquote> <?php if ($this->_var['package_goods_list']): ?> <blockquote> <?php $_from = $this->_var['package_goods_list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'package_goods');if (count($_from)): foreach ($_from AS $this->_var['package_goods']): ?> <strong><?php echo $this->_var['package_goods']['act_name']; ?></strong><br /> <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#dddddd"> <tr> <td bgcolor="#FFFFFF"> <?php $_from = $this->_var['package_goods']['goods_list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'goods_list');if (count($_from)): foreach ($_from AS $this->_var['goods_list']): ?> <a href="goods.php?id=<?php echo $this->_var['goods_list']['goods_id']; ?>" target="_blank"><font class="f1"><?php echo $this->_var['goods_list']['goods_name']; ?><?php echo $this->_var['goods_list']['goods_attr_str']; ?></font></a> &nbsp;&nbsp;X <?php echo $this->_var['goods_list']['goods_number']; ?><br /> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </td> <td bgcolor="#FFFFFF"> <strong><?php echo $this->_var['lang']['old_price']; ?></strong><font class="market"><?php echo $this->_var['package_goods']['subtotal']; ?></font><br /> <strong><?php echo $this->_var['lang']['package_price']; ?></strong><font class="shop"><?php echo $this->_var['package_goods']['package_price']; ?></font><br /> <strong><?php echo $this->_var['lang']['then_old_price']; ?></strong><font class="shop"><?php echo $this->_var['package_goods']['saving']; ?></font><br /> </td> <td bgcolor="#FFFFFF"> <a href="javascript:addPackageToCart(<?php echo $this->_var['package_goods']['act_id']; ?>)" style="background:transparent"><img src="themes/default/images/bnt_buy_1.gif" alt="<?php echo $this->_var['lang']['add_to_cart']; ?>" /></a> </td> </tr> </table> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </blockquote> <?php endif; ?> </div> </div> </div> <script type="text/javascript"> <!-- reg("com"); //--> </script> <div class="blank"></div> <?php echo $this->fetch('library/goods_tags.lbi'); ?> <?php echo $this->fetch('library/bought_goods.lbi'); ?> <?php echo $this->fetch('library/bought_note_guide.lbi'); ?> <?php echo $this->fetch('library/comments.lbi'); ?> </div> </div> <div class="blank5"></div> <div class="block"> <div class="box"> <div class="helpTitBg clearfix"> <?php echo $this->fetch('library/help.lbi'); ?> </div> </div> </div> <div class="blank"></div> <?php if ($this->_var['img_links'] || $this->_var['txt_links']): ?> <div id="bottomNav" class="box"> <div class="box_1"> <div class="links clearfix"> <?php $_from = $this->_var['img_links']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'link');if (count($_from)): foreach ($_from AS $this->_var['link']): ?> <a href="<?php echo $this->_var['link']['url']; ?>" target="_blank" title="<?php echo $this->_var['link']['name']; ?>"><img src="<?php echo $this->_var['link']['logo']; ?>" alt="<?php echo $this->_var['link']['name']; ?>" border="0" /></a> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <?php if ($this->_var['txt_links']): ?> <?php $_from = $this->_var['txt_links']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'link');if (count($_from)): foreach ($_from AS $this->_var['link']): ?> [<a href="<?php echo $this->_var['link']['url']; ?>" target="_blank" title="<?php echo $this->_var['link']['name']; ?>"><?php echo $this->_var['link']['name']; ?></a>] <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <?php endif; ?> </div> </div> </div> <?php endif; ?> <div class="blank"></div> <?php echo $this->fetch('library/page_footer.lbi'); ?> </body> <script type="text/javascript"> var goods_id = <?php echo $this->_var['goods_id']; ?>; var goodsattr_style = <?php echo empty($this->_var['cfg']['goodsattr_style']) ? '1' : $this->_var['cfg']['goodsattr_style']; ?>; var gmt_end_time = <?php echo empty($this->_var['promote_end_time']) ? '0' : $this->_var['promote_end_time']; ?>; <?php $_from = $this->_var['lang']['goods_js']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'item');if (count($_from)): foreach ($_from AS $this->_var['key'] => $this->_var['item']): ?> var <?php echo $this->_var['key']; ?> = "<?php echo $this->_var['item']; ?>"; <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> var goodsId = <?php echo $this->_var['goods_id']; ?>; var now_time = <?php echo $this->_var['now_time']; ?>; onload = function(){ changePrice(); fixpng(); try {onload_leftTime();} catch (e) {} } /** * 点选可选属性或改变数量时修改商品价格的函数 */ function changePrice() { var attr = getSelectedAttributes(document.forms['ECS_FORMBUY']); var qty = document.forms['ECS_FORMBUY'].elements['number'].value; Ajax.call('goods.php', 'act=price&id=' + goodsId + '&attr=' + attr + '&number=' + qty, changePriceResponse, 'GET', 'JSON'); } /** * 接收返回的信息 */ function changePriceResponse(res) { if (res.err_msg.length > 0) { alert(res.err_msg); } else { document.forms['ECS_FORMBUY'].elements['number'].value = res.qty; if (document.getElementById('ECS_GOODS_AMOUNT')) document.getElementById('ECS_GOODS_AMOUNT').innerHTML = res.result; } } </script> </html>
zzshop
trunk/temp/compiled/goods.dwt.php
PHP
asf20
25,456
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta name="Generator" content="ECSHOP v2.7.2" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="Keywords" content="<?php echo $this->_var['keywords']; ?>" /> <meta name="Description" content="<?php echo $this->_var['description']; ?>" /> <title><?php echo $this->_var['page_title']; ?></title> <link rel="shortcut icon" href="favicon.ico" /> <link rel="icon" href="animated_favicon.gif" type="image/gif" /> <link href="<?php echo $this->_var['ecs_css_path']; ?>" rel="stylesheet" type="text/css" /> <?php if ($this->_var['cat_style']): ?> <link href="<?php echo $this->_var['cat_style']; ?>" rel="stylesheet" type="text/css" /> <?php endif; ?> <?php echo $this->smarty_insert_scripts(array('files'=>'common.js,global.js,compare.js')); ?> </head> <body> <?php echo $this->fetch('library/page_header.lbi'); ?> <div class="block box"> <div id="ur_here"> <?php echo $this->fetch('library/ur_here.lbi'); ?> </div> </div> <div class="blank"></div> <div class="block clearfix"> <div class="AreaL"> <?php echo $this->fetch('library/cart.lbi'); ?> <?php echo $this->fetch('library/category_tree.lbi'); ?> <?php echo $this->fetch('library/history.lbi'); ?> </div> <div class="AreaR"> <?php if ($this->_var['brands']['1'] || $this->_var['price_grade']['1'] || $this->_var['filter_attr_list']): ?> <div class="box"> <div class="box_1"> <h3><span><?php echo $this->_var['lang']['goods_filter']; ?></span></h3> <?php if ($this->_var['brands']['1']): ?> <div class="screeBox"> <strong><?php echo $this->_var['lang']['brand']; ?>:</strong> <?php $_from = $this->_var['brands']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'brand');if (count($_from)): foreach ($_from AS $this->_var['brand']): ?> <?php if ($this->_var['brand']['selected']): ?> <span><?php echo $this->_var['brand']['brand_name']; ?></span> <?php else: ?> <a href="<?php echo $this->_var['brand']['url']; ?>"><?php echo $this->_var['brand']['brand_name']; ?></a>&nbsp; <?php endif; ?> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </div> <?php endif; ?> <?php if ($this->_var['price_grade']['1']): ?> <div class="screeBox"> <strong><?php echo $this->_var['lang']['price']; ?>:</strong> <?php $_from = $this->_var['price_grade']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'grade');if (count($_from)): foreach ($_from AS $this->_var['grade']): ?> <?php if ($this->_var['grade']['selected']): ?> <span><?php echo $this->_var['grade']['price_range']; ?></span> <?php else: ?> <a href="<?php echo $this->_var['grade']['url']; ?>"><?php echo $this->_var['grade']['price_range']; ?></a>&nbsp; <?php endif; ?> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </div> <?php endif; ?> <?php $_from = $this->_var['filter_attr_list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'filter_attr_0_94755300_1299760898');if (count($_from)): foreach ($_from AS $this->_var['filter_attr_0_94755300_1299760898']): ?> <div class="screeBox"> <strong><?php echo htmlspecialchars($this->_var['filter_attr_0_94755300_1299760898']['filter_attr_name']); ?> :</strong> <?php $_from = $this->_var['filter_attr_0_94755300_1299760898']['attr_list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'attr');if (count($_from)): foreach ($_from AS $this->_var['attr']): ?> <?php if ($this->_var['attr']['selected']): ?> <span><?php echo $this->_var['attr']['attr_value']; ?></span> <?php else: ?> <a href="<?php echo $this->_var['attr']['url']; ?>"><?php echo $this->_var['attr']['attr_value']; ?></a>&nbsp; <?php endif; ?> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </div> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </div> </div> <div class="blank5"></div> <?php endif; ?> <?php echo $this->fetch('library/recommend_best.lbi'); ?> <?php echo $this->fetch('library/goods_list.lbi'); ?> <?php echo $this->fetch('library/pages.lbi'); ?> </div> </div> <div class="blank5"></div> <div class="block"> <div class="box"> <div class="helpTitBg clearfix"> <?php echo $this->fetch('library/help.lbi'); ?> </div> </div> </div> <div class="blank"></div> <?php if ($this->_var['img_links'] || $this->_var['txt_links']): ?> <div id="bottomNav" class="box"> <div class="box_1"> <div class="links clearfix"> <?php $_from = $this->_var['img_links']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'link');if (count($_from)): foreach ($_from AS $this->_var['link']): ?> <a href="<?php echo $this->_var['link']['url']; ?>" target="_blank" title="<?php echo $this->_var['link']['name']; ?>"><img src="<?php echo $this->_var['link']['logo']; ?>" alt="<?php echo $this->_var['link']['name']; ?>" border="0" /></a> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <?php if ($this->_var['txt_links']): ?> <?php $_from = $this->_var['txt_links']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'link');if (count($_from)): foreach ($_from AS $this->_var['link']): ?> [<a href="<?php echo $this->_var['link']['url']; ?>" target="_blank" title="<?php echo $this->_var['link']['name']; ?>"><?php echo $this->_var['link']['name']; ?></a>] <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <?php endif; ?> </div> </div> </div> <?php endif; ?> <div class="blank"></div> <?php echo $this->fetch('library/page_footer.lbi'); ?> </body> </html>
zzshop
trunk/temp/compiled/category.dwt.php
PHP
asf20
6,230
<?php $_from = $this->_var['attribute_linked']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'linked');if (count($_from)): foreach ($_from AS $this->_var['linked']): ?> <?php if ($this->_var['linked']['goods']): ?> <div class="box"> <div class="box_1"> <h3><span title="<?php echo $this->_var['linked']['title']; ?>"><?php echo sub_str($this->_var['linked']['title'],11); ?></span></h3> <div class="boxCenterList clearfix"> <?php $_from = $this->_var['linked']['goods']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'linked_goods_data');if (count($_from)): foreach ($_from AS $this->_var['linked_goods_data']): ?> <ul class="clearfix"> <li class="goodsimg"> <a href="<?php echo $this->_var['linked_goods_data']['url']; ?>" target="_blank"><img src="<?php echo $this->_var['linked_goods_data']['goods_thumb']; ?>" alt="<?php echo htmlspecialchars($this->_var['linked_goods_data']['name']); ?>" class="B_blue" /></a> </li> <li> <a href="<?php echo $this->_var['linked_goods_data']['url']; ?>" target="_blank" title="<?php echo htmlspecialchars($this->_var['goods']['linked_goods_data_name']); ?>"><?php echo htmlspecialchars($this->_var['linked_goods_data']['short_name']); ?></a><br /> <?php echo $this->_var['lang']['shop_price']; ?><font class="f1"><?php echo $this->_var['linked_goods_data']['shop_price']; ?></font><br /> </li> </ul> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </div> </div> </div> <div class="blank5"></div> <?php endif; ?> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
zzshop
trunk/temp/compiled/goods_attrlinked.lbi.php
PHP
asf20
1,736
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta name="Generator" content="ECSHOP v2.7.2" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="Keywords" content="<?php echo $this->_var['keywords']; ?>" /> <meta name="Description" content="<?php echo $this->_var['description']; ?>" /> <title><?php echo $this->_var['page_title']; ?></title> <link rel="shortcut icon" href="favicon.ico" /> <link rel="icon" href="animated_favicon.gif" type="image/gif" /> <link href="<?php echo $this->_var['ecs_css_path']; ?>" rel="stylesheet" type="text/css" /> <?php echo $this->smarty_insert_scripts(array('files'=>'common.js')); ?> </head> <body> <?php echo $this->fetch('library/page_header.lbi'); ?> <div class="block box"> <div id="ur_here"> <?php echo $this->fetch('library/ur_here.lbi'); ?> </div> </div> <div class="blank"></div> <div class="block clearfix"> <div class="AreaL"> <?php echo $this->fetch('library/cart.lbi'); ?> <?php echo $this->fetch('library/category_tree.lbi'); ?> <?php echo $this->fetch('library/goods_related.lbi'); ?> <?php echo $this->fetch('library/goods_fittings.lbi'); ?> <?php echo $this->fetch('library/goods_article.lbi'); ?> <?php echo $this->fetch('library/goods_attrlinked.lbi'); ?> <?php echo $this->fetch('library/history.lbi'); ?> </div> <div class="AreaR"> <div class="blank5"></div> <div class="box"> <div class="box_1"> <h3><span><?php echo $this->_var['lang']['auction_goods']; ?></span></h3> <div class="boxCenterList"> <?php if ($this->_var['auction_list']): ?> <?php $_from = $this->_var['auction_list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'auction');if (count($_from)): foreach ($_from AS $this->_var['auction']): ?> <ul class="group clearfix"> <li style="margin-right:8px; text-align:center;"> <a href="<?php echo $this->_var['auction']['url']; ?>"><img src="<?php echo $this->_var['auction']['goods_thumb']; ?>" border="0" alt="<?php echo htmlspecialchars($this->_var['auction']['goods_name']); ?>" style="vertical-align: middle" /></a> </li> <li style="width:555px; line-height:23px;"> <?php echo $this->_var['lang']['goods_name']; ?>:<a href="<?php echo $this->_var['auction']['url']; ?>" class="f5"><?php echo htmlspecialchars($this->_var['auction']['goods_name']); ?></a><br /> <?php echo $this->_var['lang']['act_status']; ?>: <?php if ($this->_var['auction']['status_no'] == 0): ?> <?php echo $this->_var['lang']['au_pre_start']; ?><br> <?php elseif ($this->_var['auction']['status_no'] == 1): ?> <?php echo $this->_var['lang']['au_under_way_1']; ?><br> <?php else: ?> <?php echo $this->_var['lang']['au_finished']; ?><br> <?php endif; ?> <?php echo $this->_var['lang']['au_start_price']; ?>:<?php echo $this->_var['auction']['formated_start_price']; ?><br> <?php if ($this->_var['auction']['end_price'] > 0): ?> <?php echo $this->_var['lang']['au_end_price']; ?>:<?php echo $this->_var['auction']['formated_end_price']; ?> <?php endif; ?> </li> </ul> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <?php else: ?> <span style="margin:2px 10px; font-size:14px; line-height:36px;"><?php echo $this->_var['lang']['no_auction']; ?></span> <?php endif; ?> </div> </div> </div> <div class="blank5"></div> <?php echo $this->fetch('library/pages.lbi'); ?> </div> </div> <div class="blank5"></div> <div class="block"> <div class="box"> <div class="helpTitBg clearfix"> <?php echo $this->fetch('library/help.lbi'); ?> </div> </div> </div> <div class="blank"></div> <?php if ($this->_var['img_links'] || $this->_var['txt_links']): ?> <div id="bottomNav" class="box"> <div class="box_1"> <div class="links clearfix"> <?php $_from = $this->_var['img_links']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'link');if (count($_from)): foreach ($_from AS $this->_var['link']): ?> <a href="<?php echo $this->_var['link']['url']; ?>" target="_blank" title="<?php echo $this->_var['link']['name']; ?>"><img src="<?php echo $this->_var['link']['logo']; ?>" alt="<?php echo $this->_var['link']['name']; ?>" border="0" /></a> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <?php if ($this->_var['txt_links']): ?> <?php $_from = $this->_var['txt_links']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'link');if (count($_from)): foreach ($_from AS $this->_var['link']): ?> [<a href="<?php echo $this->_var['link']['url']; ?>" target="_blank" title="<?php echo $this->_var['link']['name']; ?>"><?php echo $this->_var['link']['name']; ?></a>] <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <?php endif; ?> </div> </div> </div> <?php endif; ?> <div class="blank"></div> <?php echo $this->fetch('library/page_footer.lbi'); ?> </body> </html>
zzshop
trunk/temp/compiled/auction_list.dwt.php
PHP
asf20
5,464
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta name="Generator" content="ECSHOP v2.7.2" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="Keywords" content="<?php echo $this->_var['keywords']; ?>" /> <meta name="Description" content="<?php echo $this->_var['description']; ?>" /> <title><?php echo $this->_var['page_title']; ?></title> <link rel="shortcut icon" href="favicon.ico" /> <link rel="icon" href="animated_favicon.gif" type="image/gif" /> <link href="<?php echo $this->_var['ecs_css_path']; ?>" rel="stylesheet" type="text/css" /> <?php echo $this->smarty_insert_scripts(array('files'=>'common.js')); ?> </head> <body> <?php echo $this->fetch('library/page_header.lbi'); ?> <div class="block box"> <div id="ur_here"> <?php echo $this->fetch('library/ur_here.lbi'); ?> </div> </div> <div class="blank"></div> <div class="block clearfix"> <div class="AreaL"> <?php echo $this->fetch('library/cart.lbi'); ?> <?php echo $this->fetch('library/category_tree.lbi'); ?> <?php echo $this->fetch('library/goods_related.lbi'); ?> <?php echo $this->fetch('library/goods_fittings.lbi'); ?> <?php echo $this->fetch('library/goods_article.lbi'); ?> <?php echo $this->fetch('library/goods_attrlinked.lbi'); ?> <?php echo $this->fetch('library/history.lbi'); ?> </div> <div class="AreaR"> <div class="blank5"></div> <div class="box"> <div class="box_1"> <h3><span><?php echo $this->_var['lang']['gb_goods_name']; ?></span></h3> <div class="boxCenterList"> <?php if ($this->_var['gb_list']): ?> <?php $_from = $this->_var['gb_list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'group_buy');if (count($_from)): foreach ($_from AS $this->_var['group_buy']): ?> <ul class="group clearfix"> <li style="margin-right:8px; text-align:center;"> <a href="<?php echo $this->_var['group_buy']['url']; ?>"><img src="<?php echo $this->_var['group_buy']['goods_thumb']; ?>" border="0" alt="<?php echo htmlspecialchars($this->_var['group_buy']['goods_name']); ?>" style="vertical-align: middle" /></a> </li> <li style="width:555px; line-height:23px;"> <?php echo $this->_var['lang']['gb_goods_name']; ?><a href="<?php echo $this->_var['group_buy']['url']; ?>" class="f5"><?php echo htmlspecialchars($this->_var['group_buy']['goods_name']); ?></a><br /> <?php echo $this->_var['lang']['act_time']; ?>:<?php echo $this->_var['group_buy']['formated_start_date']; ?> -- <?php echo $this->_var['group_buy']['formated_end_date']; ?><br /> <?php echo $this->_var['lang']['gb_price_ladder']; ?><br /> <table width="100%" border="0" cellpadding="5" cellspacing="1" bgcolor="#dddddd"> <tr> <th width="29%" bgcolor="#FFFFFF"><?php echo $this->_var['lang']['gb_ladder_amount']; ?></th> <th width="71%" bgcolor="#FFFFFF"><?php echo $this->_var['lang']['gb_ladder_price']; ?></th> </tr> <?php $_from = $this->_var['group_buy']['price_ladder']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'item');if (count($_from)): foreach ($_from AS $this->_var['item']): ?> <tr> <td width="29%" bgcolor="#FFFFFF"><?php echo $this->_var['item']['amount']; ?></td> <td width="71%" bgcolor="#FFFFFF"><?php echo $this->_var['item']['formated_price']; ?></td> </tr> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </table> </li> </ul> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <?php else: ?> <span style="margin:2px 10px; font-size:14px; line-height:36px;"><?php echo $this->_var['lang']['group_goods_empty']; ?></span> <?php endif; ?> </div> </div> </div> <div class="blank5"></div> <?php echo $this->fetch('library/pages.lbi'); ?> </div> </div> <div class="blank5"></div> <div class="block"> <div class="box"> <div class="helpTitBg clearfix"> <?php echo $this->fetch('library/help.lbi'); ?> </div> </div> </div> <div class="blank"></div> <?php if ($this->_var['img_links'] || $this->_var['txt_links']): ?> <div id="bottomNav" class="box"> <div class="box_1"> <div class="links clearfix"> <?php $_from = $this->_var['img_links']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'link');if (count($_from)): foreach ($_from AS $this->_var['link']): ?> <a href="<?php echo $this->_var['link']['url']; ?>" target="_blank" title="<?php echo $this->_var['link']['name']; ?>"><img src="<?php echo $this->_var['link']['logo']; ?>" alt="<?php echo $this->_var['link']['name']; ?>" border="0" /></a> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <?php if ($this->_var['txt_links']): ?> <?php $_from = $this->_var['txt_links']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'link');if (count($_from)): foreach ($_from AS $this->_var['link']): ?> [<a href="<?php echo $this->_var['link']['url']; ?>" target="_blank" title="<?php echo $this->_var['link']['name']; ?>"><?php echo $this->_var['link']['name']; ?></a>] <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <?php endif; ?> </div> </div> </div> <?php endif; ?> <div class="blank"></div> <?php echo $this->fetch('library/page_footer.lbi'); ?> </body> </html>
zzshop
trunk/temp/compiled/group_buy_list.dwt.php
PHP
asf20
5,831
<div class="box"> <div class="box_1"> <h3><span><?php echo $this->_var['lang']['message_board']; ?></span></h3> <div class="boxCenterList"> <?php $_from = $this->_var['msg_lists']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'msg');$this->_foreach['message_lists'] = array('total' => count($_from), 'iteration' => 0); if ($this->_foreach['message_lists']['total'] > 0): foreach ($_from AS $this->_var['key'] => $this->_var['msg']): $this->_foreach['message_lists']['iteration']++; ?> <div class="f_l" style="width:100%; position:relative;"> [<b><?php echo $this->_var['msg']['msg_type']; ?></b>]&nbsp;<?php echo $this->_var['msg']['user_name']; ?><?php if ($this->_var['msg']['user_name'] == ''): ?><?php echo $this->_var['lang']['anonymous']; ?><?php endif; ?>:<?php if ($this->_var['msg']['id_value'] > 0): ?><?php echo $this->_var['lang']['feed_user_comment']; ?><b><a class="f3" href="<?php echo $this->_var['msg']['goods_url']; ?>" target="_blank" title="<?php echo $this->_var['msg']['goods_name']; ?>"><?php echo $this->_var['msg']['goods_name']; ?></a></b><?php endif; ?><font class="f4"><?php echo $this->_var['msg']['msg_title']; ?></font> (<?php echo $this->_var['msg']['msg_time']; ?>)<?php if ($this->_var['msg']['comment_rank'] > 0): ?><img style="position:absolute; right:0px;" src="themes/default/images/stars<?php echo $this->_var['msg']['comment_rank']; ?>.gif" alt="<?php echo $this->_var['msg']['comment_rank']; ?>" /><?php endif; ?> </div> <div class="msgBottomBorder word"> <?php echo $this->_var['msg']['msg_content']; ?><br> <?php if ($this->_var['msg']['re_content']): ?> <font class="f2"><?php echo $this->_var['lang']['shopman_reply']; ?></font><br /> <?php echo $this->_var['msg']['re_content']; ?> <?php endif; ?> </div> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </div> </div> </div> <div class="blank5"></div>
zzshop
trunk/temp/compiled/message_list.lbi.php
PHP
asf20
2,066
<form name="selectPageForm" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get"> <?php if ($this->_var['pager']['styleid'] == 0): ?> <div id="pager"> <?php echo $this->_var['lang']['pager_1']; ?><?php echo $this->_var['pager']['record_count']; ?><?php echo $this->_var['lang']['pager_2']; ?><?php echo $this->_var['lang']['pager_3']; ?><?php echo $this->_var['pager']['page_count']; ?><?php echo $this->_var['lang']['pager_4']; ?> <span> <a href="<?php echo $this->_var['pager']['page_first']; ?>"><?php echo $this->_var['lang']['page_first']; ?></a> <a href="<?php echo $this->_var['pager']['page_prev']; ?>"><?php echo $this->_var['lang']['page_prev']; ?></a> <a href="<?php echo $this->_var['pager']['page_next']; ?>"><?php echo $this->_var['lang']['page_next']; ?></a> <a href="<?php echo $this->_var['pager']['page_last']; ?>"><?php echo $this->_var['lang']['page_last']; ?></a> </span> <?php $_from = $this->_var['pager']['search']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'item');if (count($_from)): foreach ($_from AS $this->_var['key'] => $this->_var['item']): ?> <?php if ($this->_var['key'] == 'keywords'): ?> <input type="hidden" name="<?php echo $this->_var['key']; ?>" value="<?php echo urldecode($this->_var['item']); ?>" /> <?php else: ?> <input type="hidden" name="<?php echo $this->_var['key']; ?>" value="<?php echo $this->_var['item']; ?>" /> <?php endif; ?> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <select name="page" id="page" onchange="selectPage(this)"> <?php echo $this->html_options(array('options'=>$this->_var['pager']['array'],'selected'=>$this->_var['pager']['page'])); ?> </select> </div> <?php else: ?> <div id="pager" class="pagebar"> <span class="f_l f6" style="margin-right:10px;"><?php echo $this->_var['lang']['pager_1']; ?><b><?php echo $this->_var['pager']['record_count']; ?></b> <?php echo $this->_var['lang']['pager_2']; ?></span> <?php if ($this->_var['pager']['page_first']): ?><a href="<?php echo $this->_var['pager']['page_first']; ?>"><?php echo $this->_var['lang']['page_first']; ?> ...</a><?php endif; ?> <?php if ($this->_var['pager']['page_prev']): ?><a class="prev" href="<?php echo $this->_var['pager']['page_prev']; ?>"><?php echo $this->_var['lang']['page_prev']; ?></a><?php endif; ?> <?php if ($this->_var['pager']['page_count'] != 1): ?> <?php $_from = $this->_var['pager']['page_number']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'item');if (count($_from)): foreach ($_from AS $this->_var['key'] => $this->_var['item']): ?> <?php if ($this->_var['pager']['page'] == $this->_var['key']): ?> <span class="page_now"><?php echo $this->_var['key']; ?></span> <?php else: ?> <a href="<?php echo $this->_var['item']; ?>">[<?php echo $this->_var['key']; ?>]</a> <?php endif; ?> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <?php endif; ?> <?php if ($this->_var['pager']['page_next']): ?><a class="next" href="<?php echo $this->_var['pager']['page_next']; ?>"><?php echo $this->_var['lang']['page_next']; ?></a><?php endif; ?> <?php if ($this->_var['pager']['page_last']): ?><a class="last" href="<?php echo $this->_var['pager']['page_last']; ?>">...<?php echo $this->_var['lang']['page_last']; ?></a><?php endif; ?> <?php if ($this->_var['pager']['page_kbd']): ?> <?php $_from = $this->_var['pager']['search']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'item');if (count($_from)): foreach ($_from AS $this->_var['key'] => $this->_var['item']): ?> <?php if ($this->_var['key'] == 'keywords'): ?> <input type="hidden" name="<?php echo $this->_var['key']; ?>" value="<?php echo urldecode($this->_var['item']); ?>" /> <?php else: ?> <input type="hidden" name="<?php echo $this->_var['key']; ?>" value="<?php echo $this->_var['item']; ?>" /> <?php endif; ?> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <kbd style="float:left; margin-left:8px; position:relative; bottom:3px;"><input type="text" name="page" onkeydown="if(event.keyCode==13)selectPage(this)" size="3" class="B_blue" /></kbd> <?php endif; ?> </div> <?php endif; ?> </form> <script type="Text/Javascript" language="JavaScript"> <!-- function selectPage(sel) { sel.form.submit(); } //--> </script>
zzshop
trunk/temp/compiled/pages.lbi.php
PHP
asf20
4,627
<?php if ($this->_var['new_goods']): ?> <?php if ($this->_var['cat_rec_sign'] != 1): ?> <div class="box"> <div class="box_2 centerPadd"> <div class="itemTit New" id="itemNew"> <?php if ($this->_var['cat_rec'] [ 2 ]): ?> <h2><a href="javascript:void(0)" onclick="change_tab_style('itemNew', 'h2', this);get_cat_recommend(2, 0);"><?php echo $this->_var['lang']['all_goods']; ?></a></h2> <?php $_from = $this->_var['cat_rec']['2']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'rec_data_0_55783500_1299760685');if (count($_from)): foreach ($_from AS $this->_var['rec_data_0_55783500_1299760685']): ?> <h2 class="h2bg"><a href="javascript:void(0)" onclick="change_tab_style('itemNew', 'h2', this);get_cat_recommend(2, <?php echo $this->_var['rec_data_0_55783500_1299760685']['cat_id']; ?>)"><?php echo $this->_var['rec_data_0_55783500_1299760685']['cat_name']; ?></a></h2> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <?php endif; ?> </div> <div id="show_new_area" class="clearfix goodsBox"> <?php endif; ?> <?php $_from = $this->_var['new_goods']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'goods_0_55806300_1299760685');if (count($_from)): foreach ($_from AS $this->_var['goods_0_55806300_1299760685']): ?> <div class="goodsItem"> <span class="news"></span> <a href="<?php echo $this->_var['goods_0_55806300_1299760685']['url']; ?>"><img src="<?php echo $this->_var['goods_0_55806300_1299760685']['thumb']; ?>" alt="<?php echo htmlspecialchars($this->_var['goods_0_55806300_1299760685']['name']); ?>" class="goodsimg" /></a><br /> <p><a href="<?php echo $this->_var['goods_0_55806300_1299760685']['url']; ?>" title="<?php echo htmlspecialchars($this->_var['goods_0_55806300_1299760685']['name']); ?>"><?php echo $this->_var['goods_0_55806300_1299760685']['short_style_name']; ?></a></p> <font class="f1"> <?php if ($this->_var['goods_0_55806300_1299760685']['promote_price'] != ""): ?> <?php echo $this->_var['goods_0_55806300_1299760685']['promote_price']; ?> <?php else: ?> <?php echo $this->_var['goods_0_55806300_1299760685']['shop_price']; ?> <?php endif; ?> </font> </div> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <div class="more"><a href="search.php?intro=new"><img src="themes/default/images/more.gif" /></a></div> <?php if ($this->_var['cat_rec_sign'] != 1): ?> </div> </div> </div> <div class="blank5"></div> <?php endif; ?> <?php endif; ?>
zzshop
trunk/temp/compiled/recommend_new.lbi.php
PHP
asf20
2,727
<?php if ($this->_var['goods_article_list']): ?> <div class="box"> <div class="box_1"> <h3><span><?php echo $this->_var['lang']['article_releate']; ?></span></h3> <div class="boxCenterList RelaArticle"> <?php $_from = $this->_var['goods_article_list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'article');if (count($_from)): foreach ($_from AS $this->_var['article']): ?> <a href="<?php echo $this->_var['article']['url']; ?>" title="<?php echo htmlspecialchars($this->_var['article']['title']); ?>"><?php echo htmlspecialchars($this->_var['article']['short_title']); ?></a><br /> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </div> </div> </div> <div class="blank5"></div> <?php endif; ?>
zzshop
trunk/temp/compiled/goods_article.lbi.php
PHP
asf20
807
<?php if ($this->_var['bought_goods']): ?> <div class="box"> <div class="box_1"> <h3><span class="text"><?php echo $this->_var['lang']['shopping_and_other']; ?></span></h3> <div class="boxCenterList clearfix ie6"> <?php $_from = $this->_var['bought_goods']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'bought_goods_data');if (count($_from)): foreach ($_from AS $this->_var['bought_goods_data']): ?> <div class="goodsItem"> <a href="<?php echo $this->_var['bought_goods_data']['url']; ?>"><img src="<?php echo $this->_var['bought_goods_data']['goods_thumb']; ?>" alt="<?php echo $this->_var['bought_goods_data']['goods_name']; ?>" class="goodsimg" /></a><br /> <p><a href="<?php echo $this->_var['bought_goods_data']['url']; ?>" title="<?php echo $this->_var['bought_goods_data']['goods_name']; ?>"><?php echo $this->_var['bought_goods_data']['short_name']; ?></a></p> <?php if ($this->_var['bought_goods_data']['promote_price'] != 0): ?> <font class="shop_s"><?php echo $this->_var['bought_goods_data']['formated_promote_price']; ?></font> <?php else: ?> <font class="shop_s"><?php echo $this->_var['bought_goods_data']['shop_price']; ?></font> <?php endif; ?> </div> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </div> </div> </div> <div class="blank5"></div> <?php endif; ?>
zzshop
trunk/temp/compiled/bought_goods.lbi.php
PHP
asf20
1,517
<?php if ($this->_var['promotion_info']): ?> <div class="box"> <div class="box_1"> <h3><span><?php echo $this->_var['lang']['promotion_info']; ?></span></h3> <div class="boxCenterList RelaArticle"> <?php $_from = $this->_var['promotion_info']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'item');if (count($_from)): foreach ($_from AS $this->_var['key'] => $this->_var['item']): ?> <?php if ($this->_var['item']['type'] == "snatch"): ?> <a href="snatch.php" title="<?php echo $this->_var['lang'][$this->_var['item']['type']]; ?>"><?php echo $this->_var['lang']['snatch_promotion']; ?></a> <?php elseif ($this->_var['item']['type'] == "group_buy"): ?> <a href="group_buy.php" title="<?php echo $this->_var['lang'][$this->_var['item']['type']]; ?>"><?php echo $this->_var['lang']['group_promotion']; ?></a> <?php elseif ($this->_var['item']['type'] == "auction"): ?> <a href="auction.php" title="<?php echo $this->_var['lang'][$this->_var['item']['type']]; ?>"><?php echo $this->_var['lang']['auction_promotion']; ?></a> <?php elseif ($this->_var['item']['type'] == "favourable"): ?> <a href="activity.php" title="<?php echo $this->_var['lang'][$this->_var['item']['type']]; ?>"><?php echo $this->_var['lang']['favourable_promotion']; ?></a> <?php elseif ($this->_var['item']['type'] == "package"): ?> <a href="package.php" title="<?php echo $this->_var['lang'][$this->_var['item']['type']]; ?>"><?php echo $this->_var['lang']['package_promotion']; ?></a> <?php endif; ?> <a href="<?php echo $this->_var['item']['url']; ?>" title="<?php echo $this->_var['lang'][$this->_var['item']['type']]; ?> <?php echo $this->_var['item']['act_name']; ?><?php echo $this->_var['item']['time']; ?>" style="background:none; padding-left:0px;"><?php echo $this->_var['item']['act_name']; ?></a><br /> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </div> </div> </div> <div class="blank5"></div> <?php endif; ?>
zzshop
trunk/temp/compiled/promotion_info.lbi.php
PHP
asf20
2,066
<div class="box"> <div class="box_1"> <h3><span class="text"><?php echo $this->_var['lang']['bought_notes']; ?></span>(<?php echo $this->_var['lang']['later_bought_amounts']; ?><font class="f1"><?php echo $this->_var['pager']['record_count']; ?></font>)</h3> <div class="boxCenterList"> <?php if ($this->_var['notes']): ?> <table width="100%" cellpadding="4"> <tr style="background:url(themes/default/images/lineBg.gif) repeat-x left bottom;text-align:center; color:#006bd0; font-weight:bold;"><td width="25%" align="left" style="padding-left:20px"><?php echo $this->_var['lang']['username']; ?></td><td width="10%"><?php echo $this->_var['lang']['number']; ?></td><td width="45%"><?php echo $this->_var['lang']['bought_time']; ?></td><td width="20%"><?php echo $this->_var['lang']['order_status']; ?></td></tr> <?php $_from = $this->_var['notes']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'note');if (count($_from)): foreach ($_from AS $this->_var['note']): ?> <tr align="center"><td align="left" style="padding-left:20px"><?php if ($this->_var['note']['user_name']): ?><?php echo htmlspecialchars($this->_var['note']['user_name']); ?><?php else: ?><?php echo $this->_var['lang']['anonymous']; ?><?php endif; ?></td><td><?php echo $this->_var['note']['goods_number']; ?></td><td><?php echo $this->_var['note']['add_time']; ?></td><td><?php if ($this->_var['note']['order_status']): ?><?php echo $this->_var['lang']['turnover']; ?><?php else: ?><?php echo $this->_var['lang']['is_cancel']; ?><?php endif; ?></td></tr> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </table> <?php else: ?> <?php echo $this->_var['lang']['no_notes']; ?> <?php endif; ?> <div id="buy_pagebar" class="f_r" style="margin-top:10px"> <form name="selectPageForm" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get"> <?php if ($this->_var['pager']['styleid'] == 0): ?> <div id="buy_pager"> <?php echo $this->_var['lang']['pager_1']; ?><?php echo $this->_var['pager']['record_count']; ?><?php echo $this->_var['lang']['pager_2']; ?><?php echo $this->_var['lang']['pager_3']; ?><?php echo $this->_var['pager']['page_count']; ?><?php echo $this->_var['lang']['pager_4']; ?> <span> <a href="<?php echo $this->_var['pager']['page_first']; ?>"><?php echo $this->_var['lang']['page_first']; ?></a> <a href="<?php echo $this->_var['pager']['page_prev']; ?>"><?php echo $this->_var['lang']['page_prev']; ?></a> <a href="<?php echo $this->_var['pager']['page_next']; ?>"><?php echo $this->_var['lang']['page_next']; ?></a> <a href="<?php echo $this->_var['pager']['page_last']; ?>"><?php echo $this->_var['lang']['page_last']; ?></a> </span> <?php $_from = $this->_var['pager']['search']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'item_0_23352400_1299762420');if (count($_from)): foreach ($_from AS $this->_var['key'] => $this->_var['item_0_23352400_1299762420']): ?> <input type="hidden" name="<?php echo $this->_var['key']; ?>" value="<?php echo $this->_var['item_0_23352400_1299762420']; ?>" /> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </div> <?php else: ?> <div id="buy_pager" class="pagebar"> <span class="f_l f6" style="margin-right:10px;"><?php echo $this->_var['lang']['total']; ?> <b><?php echo $this->_var['pager']['record_count']; ?></b> <?php echo $this->_var['lang']['user_comment_num']; ?></span> <?php if ($this->_var['pager']['page_first']): ?><a href="<?php echo $this->_var['pager']['page_first']; ?>">1 ...</a><?php endif; ?> <?php if ($this->_var['pager']['page_prev']): ?><a class="prev" href="<?php echo $this->_var['pager']['page_prev']; ?>"><?php echo $this->_var['lang']['page_prev']; ?></a><?php endif; ?> <?php $_from = $this->_var['pager']['page_number']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'item_0_23405000_1299762420');if (count($_from)): foreach ($_from AS $this->_var['key'] => $this->_var['item_0_23405000_1299762420']): ?> <?php if ($this->_var['pager']['page'] == $this->_var['key']): ?> <span class="page_now"><?php echo $this->_var['key']; ?></span> <?php else: ?> <a href="<?php echo $this->_var['item_0_23405000_1299762420']; ?>">[<?php echo $this->_var['key']; ?>]</a> <?php endif; ?> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <?php if ($this->_var['pager']['page_next']): ?><a class="next" href="<?php echo $this->_var['pager']['page_next']; ?>"><?php echo $this->_var['lang']['page_next']; ?></a><?php endif; ?> <?php if ($this->_var['pager']['page_last']): ?><a class="last" href="<?php echo $this->_var['pager']['page_last']; ?>">...<?php echo $this->_var['pager']['page_count']; ?></a><?php endif; ?> <?php if ($this->_var['pager']['page_kbd']): ?> <?php $_from = $this->_var['pager']['search']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'item_0_23479000_1299762420');if (count($_from)): foreach ($_from AS $this->_var['key'] => $this->_var['item_0_23479000_1299762420']): ?> <input type="hidden" name="<?php echo $this->_var['key']; ?>" value="<?php echo $this->_var['item_0_23479000_1299762420']; ?>" /> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <kbd style="float:left; margin-left:8px; position:relative; bottom:3px;"><input type="text" name="page" onkeydown="if(event.keyCode==13)selectPage(this)" size="3" class="B_blue" /></kbd> <?php endif; ?> </div> <?php endif; ?> </form> <script type="Text/Javascript" language="JavaScript"> <!-- function selectPage(sel) { sel.form.submit(); } //--> </script> </div> <div class="blank5"></div> </div> </div> </div> <div class="blank5"></div>
zzshop
trunk/temp/compiled/bought_notes.lbi.php
PHP
asf20
6,436
<?php echo $this->smarty_insert_scripts(array('files'=>'transport.js')); ?> <div class="cart" id="ECS_CARTINFO"> <?php $k = array ( 'name' => 'cart_info', ); echo $this->_echash . $k['name'] . '|' . serialize($k) . $this->_echash; ?> </div> <div class="blank5"></div>
zzshop
trunk/temp/compiled/cart.lbi.php
PHP
asf20
277
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta name="Generator" content="ECSHOP v2.7.2" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="Keywords" content="<?php echo $this->_var['keywords']; ?>" /> <meta name="Description" content="<?php echo $this->_var['description']; ?>" /> <title><?php echo $this->_var['page_title']; ?></title> <link rel="shortcut icon" href="favicon.ico" /> <link rel="icon" href="animated_favicon.gif" type="image/gif" /> <link href="<?php echo $this->_var['ecs_css_path']; ?>" rel="stylesheet" type="text/css" /> <?php echo $this->smarty_insert_scripts(array('files'=>'common.js,myship.js')); ?> </head> <body> <?php echo $this->fetch('library/page_header.lbi'); ?> <div class="block box"> <div id="ur_here"> <?php echo $this->fetch('library/ur_here.lbi'); ?> </div> </div> <div class="blank"></div> <div class="block"> <h5><span><?php echo $this->_var['lang']['shipping_method']; ?></span></h5> <div class="blank"></div> <?php echo $this->smarty_insert_scripts(array('files'=>'region.js,utils.js')); ?> <script type="text/javascript"> region.isAdmin = false; <?php $_from = $this->_var['lang']['flow_js']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'item');if (count($_from)): foreach ($_from AS $this->_var['key'] => $this->_var['item']): ?> var <?php echo $this->_var['key']; ?> = "<?php echo $this->_var['item']; ?>"; <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> onload = function() { if (!document.all) { document.forms['theForm'].reset(); } } /* $Id : myship.js 4865 2007-01-31 14:04:10Z Hackfan $ */ /* * * 检查收货地址信息表单中填写的内容 */ function checkForm(frm) { var msg = new Array(); var err = false; if (frm.elements['country'].value == 0) { msg.push(country_not_null); err = true; } if (frm.elements['province'].value == 0 && frm.elements['province'].length > 1) { err = true; msg.push(province_not_null); } if (frm.elements['city'].value == 0 && frm.elements['city'].length > 1) { err = true; msg.push(city_not_null); } if (frm.elements['district'].length > 1) { if (frm.elements['district'].value == 0) { err = true; msg.push(district_not_null); } } if (err) { message = msg.join("\n"); alert(message); } return ! err; } </script> <form action="myship.php" method="post" name="theForm" id="theForm" onsubmit="return checkForm(this)"> <?php echo $this->fetch('library/myship.lbi'); ?> </form> </div> <div class="blank5"></div> <div class="block"> <div class="box"> <div class="helpTitBg clearfix"> <?php echo $this->fetch('library/help.lbi'); ?> </div> </div> </div> <div class="blank"></div> <?php if ($this->_var['img_links'] || $this->_var['txt_links']): ?> <div id="bottomNav" class="box"> <div class="box_1"> <div class="links clearfix"> <?php $_from = $this->_var['img_links']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'link');if (count($_from)): foreach ($_from AS $this->_var['link']): ?> <a href="<?php echo $this->_var['link']['url']; ?>" target="_blank" title="<?php echo $this->_var['link']['name']; ?>"><img src="<?php echo $this->_var['link']['logo']; ?>" alt="<?php echo $this->_var['link']['name']; ?>" border="0" /></a> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <?php if ($this->_var['txt_links']): ?> <?php $_from = $this->_var['txt_links']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'link');if (count($_from)): foreach ($_from AS $this->_var['link']): ?> [<a href="<?php echo $this->_var['link']['url']; ?>" target="_blank" title="<?php echo $this->_var['link']['name']; ?>"><?php echo $this->_var['link']['name']; ?></a>] <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <?php endif; ?> </div> </div> </div> <?php endif; ?> <div class="blank"></div> <?php echo $this->fetch('library/page_footer.lbi'); ?> </body> </html>
zzshop
trunk/temp/compiled/myship.dwt.php
PHP
asf20
4,572
<?php if (empty ( $this->_var['order_query'] )): ?> <script>var invalid_order_sn = "<?php echo $this->_var['lang']['invalid_order_sn']; ?>"</script> <div class="box"> <div class="box_1"> <h3><span><?php echo $this->_var['lang']['order_query']; ?></span></h3> <div class="boxCenterList"> <form name="ecsOrderQuery"> <input type="text" name="order_sn" class="inputBg" /><br /> <div class="blank5"></div> <input type="button" value="<?php echo $this->_var['lang']['query_order']; ?>" class="bnt_blue_2" onclick="orderQuery()" /> </form> <div id="ECS_ORDER_QUERY" style="margin-top:8px;"> <?php else: ?> <?php if ($this->_var['order_query']['user_id']): ?> <b><?php echo $this->_var['lang']['order_number']; ?>:</b><a href="user.php?act=order_detail&order_id=<?php echo $this->_var['order_query']['order_id']; ?>" class="f6"><?php echo $this->_var['order_query']['order_sn']; ?></a><br> <?php else: ?> <b><?php echo $this->_var['lang']['order_number']; ?>:</b><?php echo $this->_var['order_query']['order_sn']; ?><br> <?php endif; ?> <b><?php echo $this->_var['lang']['order_status']; ?>:</b><br><font class="f1"><?php echo $this->_var['order_query']['order_status']; ?></font><br> <?php if ($this->_var['order_query']['invoice_no']): ?> <b><?php echo $this->_var['lang']['consignment']; ?>:</b><?php echo $this->_var['order_query']['invoice_no']; ?><br> <?php endif; ?> <?php if ($this->_var['order_query']['shipping_date']): ?>:<?php echo $this->_var['lang']['shipping_date']; ?> <?php echo $this->_var['order_query']['shipping_date']; ?><br> <?php endif; ?> <?php endif; ?> </div> </div> </div> </div> <div class="blank5"></div>
zzshop
trunk/temp/compiled/order_query.lbi.php
PHP
asf20
1,734
<div id="bottomNav" class="box"> <div class="box_1"> <div class="bNavList clearfix"> <div class="f_l"> <?php if ($this->_var['navigator_list']['bottom']): ?> <?php $_from = $this->_var['navigator_list']['bottom']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'nav_0_22445600_1299760613');$this->_foreach['nav_bottom_list'] = array('total' => count($_from), 'iteration' => 0); if ($this->_foreach['nav_bottom_list']['total'] > 0): foreach ($_from AS $this->_var['nav_0_22445600_1299760613']): $this->_foreach['nav_bottom_list']['iteration']++; ?> <a href="<?php echo $this->_var['nav_0_22445600_1299760613']['url']; ?>" <?php if ($this->_var['nav_0_22445600_1299760613']['opennew'] == 1): ?> target="_blank" <?php endif; ?>><?php echo $this->_var['nav_0_22445600_1299760613']['name']; ?></a> <?php if (! ($this->_foreach['nav_bottom_list']['iteration'] == $this->_foreach['nav_bottom_list']['total'])): ?> - <?php endif; ?> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <?php endif; ?> </div> <div class="f_r"> <a href="#top"><img src="themes/default/images/bnt_top.gif" /></a> <a href="index.php"><img src="themes/default/images/bnt_home.gif" /></a> </div> </div> </div> </div> <div class="blank"></div> <div id="footer"> <div class="text"> <?php echo $this->_var['copyright']; ?><br /> <?php echo $this->_var['shop_address']; ?> <?php echo $this->_var['shop_postcode']; ?> <?php if ($this->_var['service_phone']): ?> Tel: <?php echo $this->_var['service_phone']; ?> <?php endif; ?> <?php if ($this->_var['service_email']): ?> E-mail: <?php echo $this->_var['service_email']; ?><br /> <?php endif; ?> <?php $_from = $this->_var['qq']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'im');if (count($_from)): foreach ($_from AS $this->_var['im']): ?> <?php if ($this->_var['im']): ?> <a href="http://wpa.qq.com/msgrd?V=1&amp;Uin=<?php echo $this->_var['im']; ?>&amp;Site=<?php echo $this->_var['shop_name']; ?>&amp;Menu=yes" target="_blank"><img src="http://wpa.qq.com/pa?p=1:<?php echo $this->_var['im']; ?>:4" height="16" border="0" alt="QQ" /> <?php echo $this->_var['im']; ?></a> <?php endif; ?> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <?php $_from = $this->_var['ww']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'im');if (count($_from)): foreach ($_from AS $this->_var['im']): ?> <?php if ($this->_var['im']): ?> <a href="http://amos1.taobao.com/msg.ww?v=2&uid=<?php echo urlencode($this->_var['im']); ?>&s=2" target="_blank"><img src="http://amos1.taobao.com/online.ww?v=2&uid=<?php echo urlencode($this->_var['im']); ?>&s=2" width="16" height="16" border="0" alt="淘宝旺旺" /><?php echo $this->_var['im']; ?></a> <?php endif; ?> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <?php $_from = $this->_var['ym']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'im');if (count($_from)): foreach ($_from AS $this->_var['im']): ?> <?php if ($this->_var['im']): ?> <a href="http://edit.yahoo.com/config/send_webmesg?.target=<?php echo $this->_var['im']; ?>n&.src=pg" target="_blank"><img src="themes/default/images/yahoo.gif" width="18" height="17" border="0" alt="Yahoo Messenger" /> <?php echo $this->_var['im']; ?></a> <?php endif; ?> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <?php $_from = $this->_var['msn']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'im');if (count($_from)): foreach ($_from AS $this->_var['im']): ?> <?php if ($this->_var['im']): ?> <img src="themes/default/images/msn.gif" width="18" height="17" border="0" alt="MSN" /> <a href="msnim:chat?contact=<?php echo $this->_var['im']; ?>"><?php echo $this->_var['im']; ?></a> <?php endif; ?> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <?php $_from = $this->_var['skype']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'im');if (count($_from)): foreach ($_from AS $this->_var['im']): ?> <?php if ($this->_var['im']): ?> <img src="http://mystatus.skype.com/smallclassic/<?php echo urlencode($this->_var['im']); ?>" alt="Skype" /><a href="skype:<?php echo urlencode($this->_var['im']); ?>?call"><?php echo $this->_var['im']; ?></a> <?php endif; ?> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?><br /> <?php if ($this->_var['icp_number']): ?> <?php echo $this->_var['lang']['icp_number']; ?>:<a href="http://www.miibeian.gov.cn/" target="_blank"><?php echo $this->_var['icp_number']; ?></a><br /> <?php endif; ?> <?php $k = array ( 'name' => 'query_info', ); echo $this->_echash . $k['name'] . '|' . serialize($k) . $this->_echash; ?><br /> <?php $_from = $this->_var['lang']['p_y']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'pv');if (count($_from)): foreach ($_from AS $this->_var['pv']): ?><?php echo $this->_var['pv']; ?><?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?><?php echo $this->_var['licensed']; ?><br /> <?php if ($this->_var['stats_code']): ?> <div align="left"><?php echo $this->_var['stats_code']; ?></div> <?php endif; ?> <div align="left" id="rss"><a href="<?php echo $this->_var['feed_url']; ?>"><img src="themes/default/images/xml_rss2.gif" alt="rss" /></a></div> </div> </div>
zzshop
trunk/temp/compiled/page_footer.lbi.php
PHP
asf20
5,888
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta name="Generator" content="ECSHOP v2.7.2" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="Keywords" content="<?php echo $this->_var['keywords']; ?>" /> <meta name="Description" content="<?php echo $this->_var['description']; ?>" /> <title><?php echo $this->_var['page_title']; ?></title> <link rel="shortcut icon" href="favicon.ico" /> <link rel="icon" href="animated_favicon.gif" type="image/gif" /> <link href="<?php echo $this->_var['ecs_css_path']; ?>" rel="stylesheet" type="text/css" /> <?php echo $this->smarty_insert_scripts(array('files'=>'common.js')); ?> </head> <body> <?php echo $this->fetch('library/page_header.lbi'); ?> <div class="block box"> <div id="ur_here"> <?php echo $this->fetch('library/ur_here.lbi'); ?> </div> </div> <div class="blank"></div> <div class="block clearfix"> <div class="AreaL"> <?php echo $this->fetch('library/cart.lbi'); ?> <?php echo $this->fetch('library/category_tree.lbi'); ?> <?php echo $this->fetch('library/article_category_tree.lbi'); ?> <?php echo $this->fetch('library/filter_attr.lbi'); ?> <?php echo $this->fetch('library/price_grade.lbi'); ?> <?php echo $this->fetch('library/goods_related.lbi'); ?> <?php echo $this->fetch('library/history.lbi'); ?> </div> <div class="AreaR"> <div class="box"> <div class="box_1"> <div style="border:4px solid #fcf8f7; background-color:#fff; padding:20px 15px;"> <div class="tc" style="padding:8px;"> <font class="f5 f6"><?php echo htmlspecialchars($this->_var['article']['title']); ?></font><br /><font class="f3"><?php echo htmlspecialchars($this->_var['article']['author']); ?> / <?php echo $this->_var['article']['add_time']; ?></font> </div> <?php if ($this->_var['article']['content']): ?> <?php echo $this->_var['article']['content']; ?> <?php endif; ?> <?php if ($this->_var['article']['open_type'] == 2 || $this->_var['article']['open_type'] == 1): ?><br /> <div><a href="<?php echo $this->_var['article']['file_url']; ?>" target="_blank"><?php echo $this->_var['lang']['relative_file']; ?></a></div> <?php endif; ?> <div style="padding:8px; margin-top:15px; text-align:left; border-top:1px solid #ccc;"> <?php if ($this->_var['next_article']): ?> <?php echo $this->_var['lang']['next_article']; ?>:<a href="<?php echo $this->_var['next_article']['url']; ?>" class="f6"><?php echo $this->_var['next_article']['title']; ?></a><br /> <?php endif; ?> <?php if ($this->_var['prev_article']): ?> <?php echo $this->_var['lang']['prev_article']; ?>:<a href="<?php echo $this->_var['prev_article']['url']; ?>" class="f6"><?php echo $this->_var['prev_article']['title']; ?></a> <?php endif; ?> </div> </div> </div> </div> <div class="blank"></div> <?php echo $this->fetch('library/comments.lbi'); ?> </div> </div> <div class="blank5"></div> <div class="block"> <div class="box"> <div class="helpTitBg clearfix"> <?php echo $this->fetch('library/help.lbi'); ?> </div> </div> </div> <div class="blank"></div> <?php if ($this->_var['img_links'] || $this->_var['txt_links']): ?> <div id="bottomNav" class="box"> <div class="box_1"> <div class="links clearfix"> <?php $_from = $this->_var['img_links']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'link');if (count($_from)): foreach ($_from AS $this->_var['link']): ?> <a href="<?php echo $this->_var['link']['url']; ?>" target="_blank" title="<?php echo $this->_var['link']['name']; ?>"><img src="<?php echo $this->_var['link']['logo']; ?>" alt="<?php echo $this->_var['link']['name']; ?>" border="0" /></a> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <?php if ($this->_var['txt_links']): ?> <?php $_from = $this->_var['txt_links']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'link');if (count($_from)): foreach ($_from AS $this->_var['link']): ?> [<a href="<?php echo $this->_var['link']['url']; ?>" target="_blank" title="<?php echo $this->_var['link']['name']; ?>"><?php echo $this->_var['link']['name']; ?></a>] <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <?php endif; ?> </div> </div> </div> <?php endif; ?> <div class="blank"></div> <?php echo $this->fetch('library/page_footer.lbi'); ?> </body> </html>
zzshop
trunk/temp/compiled/article.dwt.php
PHP
asf20
4,858
<?php if ($this->_var['filter_attr_list']): ?> <div class="box"> <div class="box_1"> <h3><span><?php echo $this->_var['filter_attr_name']; ?></span></h3> <div class="boxCenterList RelaArticle"> <?php $_from = $this->_var['filter_attr_list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'attr');if (count($_from)): foreach ($_from AS $this->_var['attr']): ?> <?php if ($this->_var['attr']['selected']): ?> <a href="<?php echo $this->_var['attr']['url']; ?>"><?php echo $this->_var['attr']['attr_value']; ?><?php if ($this->_var['attr']['goods_num']): ?>(<?php echo $this->_var['attr']['goods_num']; ?>)<?php endif; ?></a><br /> <?php else: ?> <a href="<?php echo $this->_var['attr']['url']; ?>"><?php echo $this->_var['attr']['attr_value']; ?><?php if ($this->_var['attr']['goods_num']): ?>(<?php echo $this->_var['attr']['goods_num']; ?>)<?php endif; ?></a><br /> <?php endif; ?> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </div> </div> </div> <div class="blank5"></div> <?php endif; ?>
zzshop
trunk/temp/compiled/filter_attr.lbi.php
PHP
asf20
1,123
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta name="Generator" content="ECSHOP v2.7.2" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="Keywords" content="<?php echo $this->_var['keywords']; ?>" /> <meta name="Description" content="<?php echo $this->_var['description']; ?>" /> <meta name="Description" content="<?php echo $this->_var['description']; ?>" /> <?php if ($this->_var['auto_redirect']): ?> <meta http-equiv="refresh" content="3;URL=<?php echo $this->_var['message']['back_url']; ?>" /> <?php endif; ?> <title><?php echo $this->_var['page_title']; ?></title> <link rel="shortcut icon" href="favicon.ico" /> <link rel="icon" href="animated_favicon.gif" type="image/gif" /> <link href="<?php echo $this->_var['ecs_css_path']; ?>" rel="stylesheet" type="text/css" /> <?php echo $this->smarty_insert_scripts(array('files'=>'common.js')); ?> <style type="text/css"> p a{color:#006acd; text-decoration:underline;} </style> </head> <body> <?php echo $this->fetch('library/page_header.lbi'); ?> <div class="blank"></div> <div class="block"> <div class="box"> <div class="box_1"> <h3><span><?php echo $this->_var['lang']['system_info']; ?></span></h3> <div class="boxCenterList RelaArticle" align="center"> <div style="margin:20px auto;"> <p style="font-size: 14px; font-weight:bold; color: red;"><?php echo $this->_var['message']['content']; ?></p> <div class="blank"></div> <?php if ($this->_var['message']['url_info']): ?> <?php $_from = $this->_var['message']['url_info']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('info', 'url');if (count($_from)): foreach ($_from AS $this->_var['info'] => $this->_var['url']): ?> <p><a href="<?php echo $this->_var['url']; ?>"><?php echo $this->_var['info']; ?></a></p> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <?php endif; ?> </div> </div> </div> </div> </div> <div class="blank5"></div> <div class="block"> <div class="box"> <div class="helpTitBg clearfix"> <?php echo $this->fetch('library/help.lbi'); ?> </div> </div> </div> <div class="blank"></div> <?php if ($this->_var['img_links'] || $this->_var['txt_links']): ?> <div id="bottomNav" class="box"> <div class="box_1"> <div class="links clearfix"> <?php $_from = $this->_var['img_links']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'link');if (count($_from)): foreach ($_from AS $this->_var['link']): ?> <a href="<?php echo $this->_var['link']['url']; ?>" target="_blank" title="<?php echo $this->_var['link']['name']; ?>"><img src="<?php echo $this->_var['link']['logo']; ?>" alt="<?php echo $this->_var['link']['name']; ?>" border="0" /></a> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <?php if ($this->_var['txt_links']): ?> <?php $_from = $this->_var['txt_links']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'link');if (count($_from)): foreach ($_from AS $this->_var['link']): ?> [<a href="<?php echo $this->_var['link']['url']; ?>" target="_blank" title="<?php echo $this->_var['link']['name']; ?>"><?php echo $this->_var['link']['name']; ?></a>] <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <?php endif; ?> </div> </div> </div> <?php endif; ?> <div class="blank"></div> <?php echo $this->fetch('library/page_footer.lbi'); ?> </body> </html>
zzshop
trunk/temp/compiled/message.dwt.php
PHP
asf20
3,800
<?php if ($this->_var['related_goods']): ?> <div class="box"> <div class="box_1"> <h3><span><?php echo $this->_var['lang']['releate_goods']; ?></span></h3> <div class="boxCenterList clearfix"> <?php $_from = $this->_var['related_goods']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'releated_goods_data');if (count($_from)): foreach ($_from AS $this->_var['releated_goods_data']): ?> <ul class="clearfix"> <li class="goodsimg"><a href="<?php echo $this->_var['releated_goods_data']['url']; ?>"><img src="<?php echo $this->_var['releated_goods_data']['goods_thumb']; ?>" alt="<?php echo $this->_var['releated_goods_data']['goods_name']; ?>" class="B_blue" /></a></li> <li> <a href="<?php echo $this->_var['releated_goods_data']['url']; ?>" title="<?php echo $this->_var['releated_goods_data']['goods_name']; ?>"><?php echo $this->_var['releated_goods_data']['short_name']; ?></a><br /> <?php if ($this->_var['releated_goods_data']['promote_price'] != 0): ?> <?php echo $this->_var['lang']['promote_price']; ?><font class="f1"><?php echo $this->_var['releated_goods_data']['formated_promote_price']; ?></font> <?php else: ?> <?php echo $this->_var['lang']['shop_price']; ?><font class="f1"><?php echo $this->_var['releated_goods_data']['shop_price']; ?></font> <?php endif; ?> </li> </ul> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </div> </div> </div> <div class="blank5"></div> <?php endif; ?>
zzshop
trunk/temp/compiled/goods_related.lbi.php
PHP
asf20
1,642
<div class="box"> <div class="box_1"> <h3><span class="text"><?php echo $this->_var['lang']['user_comment']; ?></span>(<?php echo $this->_var['lang']['total']; ?><font class="f1"><?php echo $this->_var['pager']['record_count']; ?></font><?php echo $this->_var['lang']['user_comment_num']; ?>)</h3> <div class="boxCenterList clearfix" style="height:1%;"> <ul class="comments"> <?php if ($this->_var['comments']): ?> <?php $_from = $this->_var['comments']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'comment');if (count($_from)): foreach ($_from AS $this->_var['comment']): ?> <li class="word"> <font class="f2"><?php if ($this->_var['comment']['username']): ?><?php echo htmlspecialchars($this->_var['comment']['username']); ?><?php else: ?><?php echo $this->_var['lang']['anonymous']; ?><?php endif; ?></font> <font class="f3">( <?php echo $this->_var['comment']['add_time']; ?> )</font><br /> <img src="themes/default/images/stars<?php echo $this->_var['comment']['rank']; ?>.gif" alt="<?php echo $this->_var['comment']['comment_rank']; ?>" /> <p><?php echo $this->_var['comment']['content']; ?></p> <?php if ($this->_var['comment']['re_content']): ?> <p><font class="f1"><?php echo $this->_var['lang']['admin_username']; ?></font><?php echo $this->_var['comment']['re_content']; ?></p> <?php endif; ?> </li> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <?php else: ?> <li><?php echo $this->_var['lang']['no_comments']; ?></li> <?php endif; ?> </ul> <div id="pagebar" class="f_r"> <form name="selectPageForm" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get"> <?php if ($this->_var['pager']['styleid'] == 0): ?> <div id="pager"> <?php echo $this->_var['lang']['pager_1']; ?><?php echo $this->_var['pager']['record_count']; ?><?php echo $this->_var['lang']['pager_2']; ?><?php echo $this->_var['lang']['pager_3']; ?><?php echo $this->_var['pager']['page_count']; ?><?php echo $this->_var['lang']['pager_4']; ?> <span> <a href="<?php echo $this->_var['pager']['page_first']; ?>"><?php echo $this->_var['lang']['page_first']; ?></a> <a href="<?php echo $this->_var['pager']['page_prev']; ?>"><?php echo $this->_var['lang']['page_prev']; ?></a> <a href="<?php echo $this->_var['pager']['page_next']; ?>"><?php echo $this->_var['lang']['page_next']; ?></a> <a href="<?php echo $this->_var['pager']['page_last']; ?>"><?php echo $this->_var['lang']['page_last']; ?></a> </span> <?php $_from = $this->_var['pager']['search']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'item_0_70115900_1299762484');if (count($_from)): foreach ($_from AS $this->_var['key'] => $this->_var['item_0_70115900_1299762484']): ?> <input type="hidden" name="<?php echo $this->_var['key']; ?>" value="<?php echo $this->_var['item_0_70115900_1299762484']; ?>" /> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </div> <?php else: ?> <div id="pager" class="pagebar"> <span class="f_l f6" style="margin-right:10px;"><?php echo $this->_var['lang']['total']; ?> <b><?php echo $this->_var['pager']['record_count']; ?></b> <?php echo $this->_var['lang']['user_comment_num']; ?></span> <?php if ($this->_var['pager']['page_first']): ?><a href="<?php echo $this->_var['pager']['page_first']; ?>">1 ...</a><?php endif; ?> <?php if ($this->_var['pager']['page_prev']): ?><a class="prev" href="<?php echo $this->_var['pager']['page_prev']; ?>"><?php echo $this->_var['lang']['page_prev']; ?></a><?php endif; ?> <?php $_from = $this->_var['pager']['page_number']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'item_0_70167800_1299762484');if (count($_from)): foreach ($_from AS $this->_var['key'] => $this->_var['item_0_70167800_1299762484']): ?> <?php if ($this->_var['pager']['page'] == $this->_var['key']): ?> <span class="page_now"><?php echo $this->_var['key']; ?></span> <?php else: ?> <a href="<?php echo $this->_var['item_0_70167800_1299762484']; ?>">[<?php echo $this->_var['key']; ?>]</a> <?php endif; ?> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <?php if ($this->_var['pager']['page_next']): ?><a class="next" href="<?php echo $this->_var['pager']['page_next']; ?>"><?php echo $this->_var['lang']['page_next']; ?></a><?php endif; ?> <?php if ($this->_var['pager']['page_last']): ?><a class="last" href="<?php echo $this->_var['pager']['page_last']; ?>">...<?php echo $this->_var['pager']['page_count']; ?></a><?php endif; ?> <?php if ($this->_var['pager']['page_kbd']): ?> <?php $_from = $this->_var['pager']['search']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'item_0_70229500_1299762484');if (count($_from)): foreach ($_from AS $this->_var['key'] => $this->_var['item_0_70229500_1299762484']): ?> <input type="hidden" name="<?php echo $this->_var['key']; ?>" value="<?php echo $this->_var['item_0_70229500_1299762484']; ?>" /> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <kbd style="float:left; margin-left:8px; position:relative; bottom:3px;"><input type="text" name="page" onkeydown="if(event.keyCode==13)selectPage(this)" size="3" class="B_blue" /></kbd> <?php endif; ?> </div> <?php endif; ?> </form> <script type="Text/Javascript" language="JavaScript"> <!-- function selectPage(sel) { sel.form.submit(); } //--> </script> </div> <div class="blank5"></div> <div class="commentsList"> <form action="javascript:;" onsubmit="submitComment(this)" method="post" name="commentForm" id="commentForm"> <table width="710" border="0" cellspacing="5" cellpadding="0"> <tr> <td width="64" align="right"><?php echo $this->_var['lang']['username']; ?>:</td> <td width="631"<?php if (! $this->_var['enabled_captcha']): ?><?php endif; ?>><?php if ($_SESSION['user_name']): ?><?php echo $_SESSION['user_name']; ?><?php else: ?><?php echo $this->_var['lang']['anonymous']; ?><?php endif; ?></td> </tr> <tr> <td align="right">E-mail:</td> <td> <input type="text" name="email" id="email" maxlength="100" value="<?php echo htmlspecialchars($_SESSION['email']); ?>" class="inputBorder"/> </td> </tr> <tr> <td align="right"><?php echo $this->_var['lang']['comment_rank']; ?>:</td> <td> <input name="comment_rank" type="radio" value="1" id="comment_rank1" /> <img src="themes/default/images/stars1.gif" /> <input name="comment_rank" type="radio" value="2" id="comment_rank2" /> <img src="themes/default/images/stars2.gif" /> <input name="comment_rank" type="radio" value="3" id="comment_rank3" /> <img src="themes/default/images/stars3.gif" /> <input name="comment_rank" type="radio" value="4" id="comment_rank4" /> <img src="themes/default/images/stars4.gif" /> <input name="comment_rank" type="radio" value="5" checked="checked" id="comment_rank5" /> <img src="themes/default/images/stars5.gif" /> </td> </tr> <tr> <td align="right" valign="top"><?php echo $this->_var['lang']['comment_content']; ?>:</td> <td> <textarea name="content" class="inputBorder" style="height:50px; width:620px;"></textarea> <input type="hidden" name="cmt_type" value="<?php echo $this->_var['comment_type']; ?>" /> <input type="hidden" name="id" value="<?php echo $this->_var['id']; ?>" /> </td> </tr> <tr> <td colspan="2"> <?php if ($this->_var['enabled_captcha']): ?> <div style="padding-left:15px; text-align:left; float:left;"> <?php echo $this->_var['lang']['comment_captcha']; ?>:<input type="text" name="captcha" class="inputBorder" style="width:50px; margin-left:5px;"/> <img src="captcha.php?<?php echo $this->_var['rand']; ?>" alt="captcha" onClick="this.src='captcha.php?'+Math.random()" class="captcha"> </div> <?php endif; ?> <input name="" type="submit" value="" class="f_r" style="border:none; background:url(themes/default/images/commentsBnt.gif); width:75px; height:21px; margin-right:8px;"> </td> </tr> </table> </form> </div> </div> </div> </div> <div class="blank5"></div> <script type="text/javascript"> //<![CDATA[ <?php $_from = $this->_var['lang']['cmt_lang']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'item_0_70307400_1299762484');if (count($_from)): foreach ($_from AS $this->_var['key'] => $this->_var['item_0_70307400_1299762484']): ?> var <?php echo $this->_var['key']; ?> = "<?php echo $this->_var['item_0_70307400_1299762484']; ?>"; <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> /** * 提交评论信息 */ function submitComment(frm) { var cmt = new Object; //cmt.username = frm.elements['username'].value; cmt.email = frm.elements['email'].value; cmt.content = frm.elements['content'].value; cmt.type = frm.elements['cmt_type'].value; cmt.id = frm.elements['id'].value; cmt.enabled_captcha = frm.elements['enabled_captcha'] ? frm.elements['enabled_captcha'].value : '0'; cmt.captcha = frm.elements['captcha'] ? frm.elements['captcha'].value : ''; cmt.rank = 0; for (i = 0; i < frm.elements['comment_rank'].length; i++) { if (frm.elements['comment_rank'][i].checked) { cmt.rank = frm.elements['comment_rank'][i].value; } } // if (cmt.username.length == 0) // { // alert(cmt_empty_username); // return false; // } if (cmt.email.length > 0) { if (!(Utils.isEmail(cmt.email))) { alert(cmt_error_email); return false; } } else { alert(cmt_empty_email); return false; } if (cmt.content.length == 0) { alert(cmt_empty_content); return false; } if (cmt.enabled_captcha > 0 && cmt.captcha.length == 0 ) { alert(captcha_not_null); return false; } Ajax.call('comment.php', 'cmt=' + cmt.toJSONString(), commentResponse, 'POST', 'JSON'); return false; } /** * 处理提交评论的反馈信息 */ function commentResponse(result) { if (result.message) { alert(result.message); } if (result.error == 0) { var layer = document.getElementById('ECS_COMMENT'); if (layer) { layer.innerHTML = result.content; } } } //]]> </script>
zzshop
trunk/temp/compiled/comments_list.lbi.php
PHP
asf20
11,520
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta name="Generator" content="ECSHOP v2.7.2" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="Keywords" content="<?php echo $this->_var['keywords']; ?>" /> <meta name="Description" content="<?php echo $this->_var['description']; ?>" /> <title><?php echo $this->_var['page_title']; ?></title> <link rel="shortcut icon" href="favicon.ico" /> <link rel="icon" href="animated_favicon.gif" type="image/gif" /> <link href="<?php echo $this->_var['ecs_css_path']; ?>" rel="stylesheet" type="text/css" /> <link rel="alternate" type="application/rss+xml" title="RSS|<?php echo $this->_var['page_title']; ?>" href="<?php echo $this->_var['feed_url']; ?>" /> <?php echo $this->smarty_insert_scripts(array('files'=>'common.js,index.js')); ?> </head> <body> <?php echo $this->fetch('library/page_header.lbi'); ?> <div class="blank"></div> <div class="block clearfix"> <div class="AreaL"> <div class="box"> <div class="box_1"> <h3><span><?php echo $this->_var['lang']['shop_notice']; ?></span></h3> <div class="boxCenterList RelaArticle"> <?php echo $this->_var['shop_notice']; ?> </div> </div> </div> <div class="blank5"></div> <?php echo $this->fetch('library/cart.lbi'); ?> <?php echo $this->fetch('library/category_tree.lbi'); ?> <?php echo $this->fetch('library/top10.lbi'); ?> <?php echo $this->fetch('library/promotion_info.lbi'); ?> <?php echo $this->fetch('library/order_query.lbi'); ?> <?php echo $this->fetch('library/invoice_query.lbi'); ?> <?php echo $this->fetch('library/vote_list.lbi'); ?> <?php echo $this->fetch('library/email_list.lbi'); ?> </div> <div class="AreaR"> <div class="box clearfix"> <div class="box_1 clearfix"> <div class="f_l" id="focus"> <?php echo $this->fetch('library/index_ad.lbi'); ?> </div> <div id="mallNews" class="f_r"> <div class="NewsTit"></div> <div class="NewsList tc"> <?php echo $this->fetch('library/new_articles.lbi'); ?> </div> </div> </div> </div> <div class="blank5"></div> <div class="clearfix"> <?php echo $this->fetch('library/recommend_promotion.lbi'); ?> <div class="box f_r brandsIe6"> <div class="box_1 clearfix" id="brands"> <?php echo $this->fetch('library/brands.lbi'); ?> </div> </div> </div> <div class="blank5"></div> <?php echo $this->fetch('library/recommend_best.lbi'); ?> <?php echo $this->fetch('library/recommend_new.lbi'); ?> <?php echo $this->fetch('library/recommend_hot.lbi'); ?> <?php echo $this->fetch('library/auction.lbi'); ?> <?php echo $this->fetch('library/group_buy.lbi'); ?> </div> </div> <div class="blank5"></div> <div class="block"> <div class="box"> <div class="helpTitBg clearfix"> <?php echo $this->fetch('library/help.lbi'); ?> </div> </div> </div> <div class="blank"></div> <?php if ($this->_var['img_links'] || $this->_var['txt_links']): ?> <div id="bottomNav" class="box"> <div class="box_1"> <div class="links clearfix"> <?php $_from = $this->_var['img_links']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'link');if (count($_from)): foreach ($_from AS $this->_var['link']): ?> <a href="<?php echo $this->_var['link']['url']; ?>" target="_blank" title="<?php echo $this->_var['link']['name']; ?>"><img src="<?php echo $this->_var['link']['logo']; ?>" alt="<?php echo $this->_var['link']['name']; ?>" border="0" /></a> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <?php if ($this->_var['txt_links']): ?> <?php $_from = $this->_var['txt_links']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'link');if (count($_from)): foreach ($_from AS $this->_var['link']): ?> [<a href="<?php echo $this->_var['link']['url']; ?>" target="_blank" title="<?php echo $this->_var['link']['name']; ?>"><?php echo $this->_var['link']['name']; ?></a>] <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <?php endif; ?> </div> </div> </div> <?php endif; ?> <div class="blank"></div> <?php echo $this->fetch('library/page_footer.lbi'); ?> </body> </html>
zzshop
trunk/temp/compiled/index.dwt.php
PHP
asf20
4,635
<?php if ($this->_var['price_grade']): ?> <div class="box"> <div class="box_1"> <h3><span><?php echo $this->_var['lang']['price_grade']; ?></span></h3> <div class="boxCenterList RelaArticle"> <?php $_from = $this->_var['price_grade']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'grade');if (count($_from)): foreach ($_from AS $this->_var['grade']): ?> <?php if ($this->_var['grade']['selected']): ?> <img src="themes/default/images/alone.gif" style=" margin-right:8px;"><font class="f1 f5"><?php echo $this->_var['grade']['start']; ?> - <?php echo $this->_var['grade']['end']; ?> <?php if ($this->_var['grade']['goods_num']): ?>(<?php echo $this->_var['grade']['goods_num']; ?>)<?php endif; ?></font><br /> <?php else: ?> <a href="<?php echo $this->_var['grade']['url']; ?>"><?php echo $this->_var['grade']['start']; ?> - <?php echo $this->_var['grade']['end']; ?></a> <?php if ($this->_var['grade']['goods_num']): ?>(<?php echo $this->_var['grade']['goods_num']; ?>)<?php endif; ?><br /> <?php endif; ?> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </div> </div> </div> <div class="blank5"></div> <?php endif; ?>
zzshop
trunk/temp/compiled/price_grade.lbi.php
PHP
asf20
1,251
<div class="box"> <div class="box_1"> <h3><span><?php echo $this->_var['lang']['email_subscribe']; ?></span></h3> <div class="boxCenterList RelaArticle"> <input type="text" id="user_email" class="inputBg" /><br /> <div class="blank5"></div> <input type="button" class="bnt_blue" value="<?php echo $this->_var['lang']['email_list_ok']; ?>" onclick="add_email_list();" /> <input type="button" class="bnt_bonus" value="<?php echo $this->_var['lang']['email_list_cancel']; ?>" onclick="cancel_email_list();" /> </div> </div> </div> <div class="blank5"></div> <script type="text/javascript"> var email = document.getElementById('user_email'); function add_email_list() { if (check_email()) { Ajax.call('user.php?act=email_list&job=add&email=' + email.value, '', rep_add_email_list, 'GET', 'TEXT'); } } function rep_add_email_list(text) { alert(text); } function cancel_email_list() { if (check_email()) { Ajax.call('user.php?act=email_list&job=del&email=' + email.value, '', rep_cancel_email_list, 'GET', 'TEXT'); } } function rep_cancel_email_list(text) { alert(text); } function check_email() { if (Utils.isEmail(email.value)) { return true; } else { alert('<?php echo $this->_var['lang']['email_invalid']; ?>'); return false; } } </script>
zzshop
trunk/temp/compiled/email_list.lbi.php
PHP
asf20
1,360
<?php if ($this->_var['article_categories']): ?> <div class="box"> <div class="box_1"> <h3><span><?php echo $this->_var['lang']['article_cat']; ?></span></h3> <div class="boxCenterList RelaArticle"> <?php $_from = $this->_var['article_categories']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'cat_0_79000000_1299760903');if (count($_from)): foreach ($_from AS $this->_var['cat_0_79000000_1299760903']): ?> <a href="<?php echo $this->_var['cat_0_79000000_1299760903']['url']; ?>"><?php echo htmlspecialchars($this->_var['cat_0_79000000_1299760903']['name']); ?></a><br /> <?php $_from = $this->_var['cat_0_79000000_1299760903']['children']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'child_0_79019000_1299760903');if (count($_from)): foreach ($_from AS $this->_var['child_0_79019000_1299760903']): ?> <a href="<?php echo $this->_var['child_0_79019000_1299760903']['url']; ?>" style="background-image:none;"><?php echo htmlspecialchars($this->_var['child_0_79019000_1299760903']['name']); ?></a><br /> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </div> </div> </div> <div class="blank5"></div> <?php endif; ?>
zzshop
trunk/temp/compiled/article_category_tree.lbi.php
PHP
asf20
1,375
<div class="box"> <div class="box_1"> <h3><span class="text"><?php echo $this->_var['lang']['goods_tag']; ?></span></h3> <div class="boxCenterList clearfix ie6"> <form name="tagForm" action="javascript:;" onSubmit="return submitTag(this)" id="tagForm"> <p id="ECS_TAGS" style="margin-bottom:5px;"> <?php $_from = $this->_var['tags']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'tag');if (count($_from)): foreach ($_from AS $this->_var['tag']): ?> <a href="search.php?keywords=<?php echo urlencode($this->_var['tag']['tag_words']); ?>" style="color:#006ace; text-decoration:none; margin-right:5px;"><?php echo htmlspecialchars($this->_var['tag']['tag_words']); ?>[<?php echo $this->_var['tag']['tag_count']; ?>]</a> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </p> <p> <input type="text" name="tag" id="tag" class="inputBg" size="35" /> <input type="submit" value="添 加" class="bnt_blue" style="border:none;" /> <input type="hidden" name="goods_id" value="<?php echo $this->_var['goods']['goods_id']; ?>" /> </p> <script type="text/javascript"> //<![CDATA[ /** * 用户添加标记的处理函数 */ function submitTag(frm) { try { var tag = frm.elements['tag'].value; var idx = frm.elements['goods_id'].value; if (tag.length > 0 && parseInt(idx) > 0) { Ajax.call('user.php?act=add_tag', "id=" + idx + "&tag=" + tag, submitTagResponse, "POST", "JSON"); } } catch (e) {alert(e);} return false; } function submitTagResponse(result) { var div = document.getElementById('ECS_TAGS'); if (result.error > 0) { alert(result.message); } else { try { div.innerHTML = ''; var tags = result.content; for (i = 0; i < tags.length; i++) { div.innerHTML += '<a href="search.php?keywords='+tags[i].word+'" style="color:#006ace; text-decoration:none; margin-right:5px;">' +tags[i].word + '[' + tags[i].count + ']<\/a>&nbsp;&nbsp; '; } } catch (e) {alert(e);} } } //]]> </script> </form> </div> </div> </div> <div class="blank5"></div>
zzshop
trunk/temp/compiled/goods_tags.lbi.php
PHP
asf20
3,051
<div class="box" id='history_div'> <div class="box_1"> <h3><span><?php echo $this->_var['lang']['view_history']; ?></span></h3> <div class="boxCenterList clearfix" id='history_list'> <?php $k = array ( 'name' => 'history', ); echo $this->_echash . $k['name'] . '|' . serialize($k) . $this->_echash; ?> </div> </div> </div> <div class="blank5"></div> <script type="text/javascript"> if (document.getElementById('history_list').innerHTML.replace(/\s/g,'').length<1) { document.getElementById('history_div').style.display='none'; } else { document.getElementById('history_div').style.display='block'; } function clear_history() { Ajax.call('user.php', 'act=clear_history',clear_history_Response, 'GET', 'TEXT',1,1); } function clear_history_Response(res) { document.getElementById('history_list').innerHTML = '<?php echo $this->_var['lang']['no_history']; ?>'; } </script>
zzshop
trunk/temp/compiled/history.lbi.php
PHP
asf20
918
<?php if ($this->_var['promotion_goods']): ?> <div id="sales" class="f_l clearfix"> <h1><a href="search.php?intro=promotion"><img src="themes/default/images/more.gif" /></a></h1> <div class="clearfix goodBox"> <?php $_from = $this->_var['promotion_goods']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'goods_0_22559600_1299762388');$this->_foreach['promotion_foreach'] = array('total' => count($_from), 'iteration' => 0); if ($this->_foreach['promotion_foreach']['total'] > 0): foreach ($_from AS $this->_var['goods_0_22559600_1299762388']): $this->_foreach['promotion_foreach']['iteration']++; ?> <?php if (($this->_foreach['promotion_foreach']['iteration'] - 1) <= 3): ?> <div class="goodList"> <a href="<?php echo $this->_var['goods_0_22559600_1299762388']['url']; ?>"><img src="<?php echo $this->_var['goods_0_22559600_1299762388']['thumb']; ?>" border="0" alt="<?php echo htmlspecialchars($this->_var['goods_0_22559600_1299762388']['name']); ?>"/></a><br /> <p><a href="<?php echo $this->_var['goods_0_22559600_1299762388']['url']; ?>" title="<?php echo htmlspecialchars($this->_var['goods_0_22559600_1299762388']['name']); ?>"><?php echo htmlspecialchars($this->_var['goods_0_22559600_1299762388']['short_name']); ?></a></p> <?php echo $this->_var['lang']['promote_price']; ?><font class="f1"><?php echo $this->_var['goods_0_22559600_1299762388']['promote_price']; ?></font> </div> <?php endif; ?> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </div> </div> <?php endif; ?>
zzshop
trunk/temp/compiled/recommend_promotion.lbi.php
PHP
asf20
1,696
<script type="text/javascript"> var process_request = "<?php echo $this->_var['lang']['process_request']; ?>"; </script> <div class="block clearfix"> <div class="f_l"><a href="index.php" name="top"><img src="themes/default/images/logo.gif" /></a></div> <div class="f_r log"> <ul> <li class="userInfo"> <?php echo $this->smarty_insert_scripts(array('files'=>'transport.js,utils.js')); ?> <font id="ECS_MEMBERZONE"><?php $k = array ( 'name' => 'member_info', ); echo $this->_echash . $k['name'] . '|' . serialize($k) . $this->_echash; ?> </font> </li> <?php if ($this->_var['navigator_list']['top']): ?> <li id="topNav" class="clearfix"> <?php $_from = $this->_var['navigator_list']['top']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'nav');$this->_foreach['nav_top_list'] = array('total' => count($_from), 'iteration' => 0); if ($this->_foreach['nav_top_list']['total'] > 0): foreach ($_from AS $this->_var['nav']): $this->_foreach['nav_top_list']['iteration']++; ?> <a href="<?php echo $this->_var['nav']['url']; ?>" <?php if ($this->_var['nav']['opennew'] == 1): ?> target="_blank" <?php endif; ?>><?php echo $this->_var['nav']['name']; ?></a> <?php if (! ($this->_foreach['nav_top_list']['iteration'] == $this->_foreach['nav_top_list']['total'])): ?> | <?php endif; ?> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <div class="topNavR"></div> </li> <?php endif; ?> </ul> </div> </div> <div class="blank"></div> <div id="mainNav" class="clearfix"> <a href="index.php"<?php if ($this->_var['navigator_list']['config']['index'] == 1): ?> class="cur"<?php endif; ?>><?php echo $this->_var['lang']['home']; ?><span></span></a> <?php $_from = $this->_var['navigator_list']['middle']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'nav');$this->_foreach['nav_middle_list'] = array('total' => count($_from), 'iteration' => 0); if ($this->_foreach['nav_middle_list']['total'] > 0): foreach ($_from AS $this->_var['nav']): $this->_foreach['nav_middle_list']['iteration']++; ?> <a href="<?php echo $this->_var['nav']['url']; ?>" <?php if ($this->_var['nav']['opennew'] == 1): ?>target="_blank" <?php endif; ?> <?php if ($this->_var['nav']['active'] == 1): ?> class="cur"<?php endif; ?>><?php echo $this->_var['nav']['name']; ?><span></span></a> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </div> <div id="search" class="clearfix"> <div class="keys f_l"> <script type="text/javascript"> <!-- function checkSearchForm() { if(document.getElementById('keyword').value) { return true; } else { alert("<?php echo $this->_var['lang']['no_keywords']; ?>"); return false; } } --> </script> <?php if ($this->_var['searchkeywords']): ?> <?php echo $this->_var['lang']['hot_search']; ?> : <?php $_from = $this->_var['searchkeywords']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'val');if (count($_from)): foreach ($_from AS $this->_var['val']): ?> <a href="search.php?keywords=<?php echo urlencode($this->_var['val']); ?>"><?php echo $this->_var['val']; ?></a> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <?php endif; ?> </div> <form id="searchForm" name="searchForm" method="get" action="search.php" onSubmit="return checkSearchForm()" class="f_r" style="_position:relative; top:5px;"> <select name="category" id="category" class="B_input"> <option value="0"><?php echo $this->_var['lang']['all_category']; ?></option> <?php echo $this->_var['category_list']; ?> </select> <input name="keywords" type="text" id="keyword" value="<?php echo htmlspecialchars($this->_var['search_keywords']); ?>" class="B_input" style="width:110px;"/> <input name="imageField" type="submit" value="" class="go" style="cursor:pointer;" /> <a href="search.php?act=advanced_search"><?php echo $this->_var['lang']['advanced_search']; ?></a> </form> </div>
zzshop
trunk/temp/compiled/page_header.lbi.php
PHP
asf20
4,335
<?php if ($this->_var['group_buy_goods']): ?> <div class="box"> <div class="box_1"> <h3><span><?php echo $this->_var['lang']['group_buy_goods']; ?></span><a href="group_buy.php"><img src="themes/default/images/more.gif"></a></h3> <div class="centerPadd"> <div class="clearfix goodsBox" style="border:none;"> <?php $_from = $this->_var['group_buy_goods']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'goods_0_24543200_1299762388');if (count($_from)): foreach ($_from AS $this->_var['goods_0_24543200_1299762388']): ?> <div class="goodsItem"> <a href="<?php echo $this->_var['goods_0_24543200_1299762388']['url']; ?>"><img src="<?php echo $this->_var['goods_0_24543200_1299762388']['thumb']; ?>" alt="<?php echo htmlspecialchars($this->_var['goods_0_24543200_1299762388']['goods_name']); ?>" class="goodsimg" /></a><br /> <p><a href="<?php echo $this->_var['goods_0_24543200_1299762388']['url']; ?>" title="<?php echo htmlspecialchars($this->_var['goods_0_24543200_1299762388']['goods_name']); ?>"><?php echo htmlspecialchars($this->_var['goods_0_24543200_1299762388']['short_style_name']); ?></a></p> <font class="shop_s"><?php echo $this->_var['goods_0_24543200_1299762388']['last_price']; ?></font> </div> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </div> </div> </div> </div> <div class="blank5"></div> <?php endif; ?>
zzshop
trunk/temp/compiled/group_buy.lbi.php
PHP
asf20
1,497
<?php if ($this->_var['vote']): ?> <?php echo $this->smarty_insert_scripts(array('files'=>'transport.js')); ?> <div id="ECS_VOTE"> <div class="box"> <div class="box_1"> <h3><span><?php echo $this->_var['lang']['online_vote']; ?></span></h3> <div class="boxCenterList"> <form id="formvote" name="ECS_VOTEFORM" method="post" action="javascript:submit_vote()"> <?php $_from = $this->_var['vote']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'title');if (count($_from)): foreach ($_from AS $this->_var['title']): ?> <?php echo $this->_var['title']['vote_name']; ?><br /> (<?php echo $this->_var['lang']['vote_times']; ?>:<?php echo $this->_var['title']['vote_count']; ?>)<br /> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <?php $_from = $this->_var['vote']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'title');if (count($_from)): foreach ($_from AS $this->_var['title']): ?> <?php $_from = $this->_var['title']['options']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'item');if (count($_from)): foreach ($_from AS $this->_var['item']): ?> <?php if ($this->_var['title']['can_multi'] == 0): ?> <input type="checkbox" name="option_id" value="<?php echo $this->_var['item']['option_id']; ?>" /> <?php echo $this->_var['item']['option_name']; ?> (<?php echo $this->_var['item']['percent']; ?>%)<br /> <?php else: ?> <input type="radio" name="option_id" value="<?php echo $this->_var['item']['option_id']; ?>" /> <?php echo $this->_var['item']['option_name']; ?> (<?php echo $this->_var['item']['percent']; ?>%)<br /> <?php endif; ?> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <input type="hidden" name="type" value="<?php echo $this->_var['title']['can_multi']; ?>" /> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> <input type="hidden" name="id" value="<?php echo $this->_var['vote_id']; ?>" /> <input type="submit" name="submit" style="border:none;" value="<?php echo $this->_var['lang']['submit']; ?>" class="bnt_bonus" /> <input type="reset" style="border:none;" value="<?php echo $this->_var['lang']['reset']; ?>" class="bnt_blue" /> </form> </div> </div> </div> </div> <div class="blank5"></div> <script type="text/javascript"> /** * 处理用户的投票 */ function submit_vote() { var frm = document.forms['ECS_VOTEFORM']; var type = frm.elements['type'].value; var vote_id = frm.elements['id'].value; var option_id = 0; if (frm.elements['option_id'].checked) { option_id = frm.elements['option_id'].value; } else { for (i=0; i<frm.elements['option_id'].length; i++ ) { if (frm.elements['option_id'][i].checked) { option_id = (type == 0) ? option_id + "," + frm.elements['option_id'][i].value : frm.elements['option_id'][i].value; } } } if (option_id == 0) { return; } else { Ajax.call('vote.php', 'vote=' + vote_id + '&options=' + option_id + "&type=" + type, voteResponse, 'POST', 'JSON'); } } /** * 处理投票的反馈信息 */ function voteResponse(result) { if (result.message.length > 0) { alert(result.message); } if (result.error == 0) { var layer = document.getElementById('ECS_VOTE'); if (layer) { layer.innerHTML = result.content; } } } </script> <?php endif; ?>
zzshop
trunk/temp/compiled/vote.lbi.php
PHP
asf20
3,739
<?php echo $this->smarty_insert_scripts(array('files'=>'transport.js,utils.js')); ?> <div id="ECS_COMMENT"> <?php $k = array ( 'name' => 'comments', 'type' => $this->_var['type'], 'id' => $this->_var['id'], ); echo $this->_echash . $k['name'] . '|' . serialize($k) . $this->_echash; ?></div>
zzshop
trunk/temp/compiled/comments.lbi.php
PHP
asf20
301
<ul> <?php $_from = $this->_var['new_articles']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'article');if (count($_from)): foreach ($_from AS $this->_var['article']): ?> <li> [<a href="<?php echo $this->_var['article']['cat_url']; ?>"><?php echo $this->_var['article']['cat_name']; ?></a>] <a href="<?php echo $this->_var['article']['url']; ?>" title="<?php echo htmlspecialchars($this->_var['article']['title']); ?>"><?php echo sub_str($this->_var['article']['short_title'],10); ?></a> </li> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </ul>
zzshop
trunk/temp/compiled/new_articles.lbi.php
PHP
asf20
637
<?php echo $this->smarty_insert_scripts(array('files'=>'transport.js,utils.js')); ?> <div id="ECS_BOUGHT"><?php $k = array ( 'name' => 'bought_notes', 'id' => $this->_var['id'], ); echo $this->_echash . $k['name'] . '|' . serialize($k) . $this->_echash; ?></div>
zzshop
trunk/temp/compiled/bought_note_guide.lbi.php
PHP
asf20
268
<?php if ($this->_var['hot_goods']): ?> <div class="box"> <div class="box_2 centerPadd"> <div class="itemTit Hot" id="itemHot"></div> <div id="show_hot_area" class="clearfix goodsBox"> <?php $_from = $this->_var['hot_goods']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'goods');if (count($_from)): foreach ($_from AS $this->_var['goods']): ?> <div class="goodsItem"> <span class="hot"></span> <a href="<?php echo $this->_var['goods']['url']; ?>"><img src="<?php echo $this->_var['goods']['thumb']; ?>" alt="<?php echo htmlspecialchars($this->_var['goods']['name']); ?>" class="goodsimg" /></a><br /> <p><a href="<?php echo $this->_var['goods']['url']; ?>" title="<?php echo htmlspecialchars($this->_var['goods']['name']); ?>"><?php echo $this->_var['goods']['short_style_name']; ?></a></p> <?php echo $this->_var['lang']['exchange_integral']; ?><font class="f1"><?php echo $this->_var['goods']['exchange_integral']; ?></font> </div> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </div> </div> </div> <div class="blank5"></div> <?php endif; ?>
zzshop
trunk/temp/compiled/exchange_hot.lbi.php
PHP
asf20
1,212
<?php if ($this->_var['fittings']): ?> <div class="box"> <div class="box_1"> <h3><span><?php echo $this->_var['lang']['accessories_releate']; ?></span></h3> <div class="boxCenterList clearfix"> <?php $_from = $this->_var['fittings']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'goods_0_17152600_1299760613');if (count($_from)): foreach ($_from AS $this->_var['goods_0_17152600_1299760613']): ?> <ul class="clearfix"> <li class="goodsimg"> <a href="<?php echo $this->_var['goods_0_17152600_1299760613']['url']; ?>" target="_blank"><img src="<?php echo $this->_var['goods_0_17152600_1299760613']['goods_thumb']; ?>" alt="<?php echo htmlspecialchars($this->_var['goods_0_17152600_1299760613']['name']); ?>" class="B_blue" /></a> </li> <li> <a href="<?php echo $this->_var['goods_0_17152600_1299760613']['url']; ?>" target="_blank" title="<?php echo htmlspecialchars($this->_var['goods_0_17152600_1299760613']['goods_name']); ?>"><?php echo htmlspecialchars($this->_var['goods_0_17152600_1299760613']['short_name']); ?></a><br /> <?php echo $this->_var['lang']['fittings_price']; ?><font class="f1"><?php echo $this->_var['goods_0_17152600_1299760613']['fittings_price']; ?></font><br /> </li> </ul> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </div> </div> </div> <div class="blank5"></div> <?php endif; ?>
zzshop
trunk/temp/compiled/goods_fittings.lbi.php
PHP
asf20
1,484
<?php if ($this->_var['invoice_list']): ?> <style type="text/css"> .boxCenterList form{display:inline;} .boxCenterList form a{color:#404040; text-decoration:underline;} </style> <div class="box"> <div class="box_1"> <h3><span><?php echo $this->_var['lang']['shipping_query']; ?></span></h3> <div class="boxCenterList"> <?php $_from = $this->_var['invoice_list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'invoice');if (count($_from)): foreach ($_from AS $this->_var['invoice']): ?> <?php echo $this->_var['lang']['order_number']; ?> <?php echo $this->_var['invoice']['order_sn']; ?><br /> <?php echo $this->_var['lang']['consignment']; ?> <?php echo $this->_var['invoice']['invoice_no']; ?> <div class="blank"></div> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </div> </div> </div> <div class="blank5"></div> <?php endif; ?>
zzshop
trunk/temp/compiled/invoice_query.lbi.php
PHP
asf20
953
<div class="box"> <div class="box_1"> <h3> <span><?php echo $this->_var['lang']['goods_list']; ?></span> <form method="GET" class="sort" name="listform"> <?php echo $this->_var['lang']['btn_display']; ?>: <a href="javascript:;" onClick="javascript:display_mode('list')"><img src="themes/default/images/display_mode_list<?php if ($this->_var['pager']['display'] == 'list'): ?>_act<?php endif; ?>.gif" alt="<?php echo $this->_var['lang']['display']['list']; ?>"></a> <a href="javascript:;" onClick="javascript:display_mode('grid')"><img src="themes/default/images/display_mode_grid<?php if ($this->_var['pager']['display'] == 'grid'): ?>_act<?php endif; ?>.gif" alt="<?php echo $this->_var['lang']['display']['grid']; ?>"></a> <a href="javascript:;" onClick="javascript:display_mode('text')"><img src="themes/default/images/display_mode_text<?php if ($this->_var['pager']['display'] == 'text'): ?>_act<?php endif; ?>.gif" alt="<?php echo $this->_var['lang']['display']['text']; ?>"></a>&nbsp;&nbsp; <select name="sort" style="border:1px solid #ccc;"> <?php echo $this->html_options(array('options'=>$this->_var['lang']['exchange_sort'],'selected'=>$this->_var['pager']['sort'])); ?> </select> <select name="order" style="border:1px solid #ccc;"> <?php echo $this->html_options(array('options'=>$this->_var['lang']['order'],'selected'=>$this->_var['pager']['order'])); ?> </select> <input type="image" name="imageField" src="themes/default/images/bnt_go.gif" alt="go"/> <input type="hidden" name="category" value="<?php echo $this->_var['category']; ?>" /> <input type="hidden" name="display" value="<?php echo $this->_var['pager']['display']; ?>" id="display" /> <input type="hidden" name="integral_min" value="<?php echo $this->_var['integral_min']; ?>" /> <input type="hidden" name="integral_max" value="<?php echo $this->_var['integral_max']; ?>" /> <input type="hidden" name="page" value="<?php echo $this->_var['pager']['page']; ?>" /> </form> </h3> <form name="compareForm" method="post"> <?php if ($this->_var['pager']['display'] == 'list'): ?> <div class="goodsList"> <?php $_from = $this->_var['goods_list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'goods');$this->_foreach['goods_list'] = array('total' => count($_from), 'iteration' => 0); if ($this->_foreach['goods_list']['total'] > 0): foreach ($_from AS $this->_var['goods']): $this->_foreach['goods_list']['iteration']++; ?> <ul class="clearfix bgcolor"<?php if (($this->_foreach['goods_list']['iteration'] - 1) % 2 == 0): ?>id=""<?php else: ?>id="bgcolor"<?php endif; ?>> <li class="thumb"><a href="<?php echo $this->_var['goods']['url']; ?>"><img src="<?php echo $this->_var['goods']['goods_thumb']; ?>" alt="<?php echo $this->_var['goods']['goods_name']; ?>" /></a></li> <li class="goodsName"> <a href="<?php echo $this->_var['goods']['url']; ?>" class="f6"> <?php if ($this->_var['goods']['goods_style_name']): ?> <?php echo $this->_var['goods']['goods_style_name']; ?><br /> <?php else: ?> <?php echo $this->_var['goods']['goods_name']; ?><br /> <?php endif; ?> </a> <?php if ($this->_var['goods']['goods_brief']): ?> <?php echo $this->_var['lang']['goods_brief']; ?><?php echo $this->_var['goods']['goods_brief']; ?><br /> <?php endif; ?> </li> <li> <?php echo $this->_var['lang']['exchange_integral']; ?><font class="shop_s"><?php echo $this->_var['goods']['exchange_integral']; ?></font> </li> </ul> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </div> <?php elseif ($this->_var['pager']['display'] == 'grid'): ?> <div class="centerPadd"> <div class="clearfix goodsBox" style="border:none;"> <?php $_from = $this->_var['goods_list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'goods');if (count($_from)): foreach ($_from AS $this->_var['goods']): ?> <?php if ($this->_var['goods']['goods_id']): ?> <div class="goodsItem"> <a href="<?php echo $this->_var['goods']['url']; ?>"><img src="<?php echo $this->_var['goods']['goods_thumb']; ?>" alt="<?php echo $this->_var['goods']['goods_name']; ?>" class="goodsimg" /></a><br /> <p><a href="<?php echo $this->_var['goods']['url']; ?>" title="<?php echo htmlspecialchars($this->_var['goods']['name']); ?>"><?php echo $this->_var['goods']['goods_name']; ?></a></p> <?php echo $this->_var['lang']['exchange_integral']; ?><font class="shop_s"><?php echo $this->_var['goods']['exchange_integral']; ?></font><br /> </div> <?php endif; ?> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </div> </div> <?php elseif ($this->_var['pager']['display'] == 'text'): ?> <div class="goodsList"> <?php $_from = $this->_var['goods_list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'goods');if (count($_from)): foreach ($_from AS $this->_var['goods']): ?> <ul class="clearfix bgcolor" <?php if (($this->_foreach['goods_list']['iteration'] - 1) % 2 == 0): ?>id=""<?php else: ?>id="bgcolor"<?php endif; ?>> <li class="goodsName"> <a href="<?php echo $this->_var['goods']['url']; ?>" class="f6 f5"> <?php if ($this->_var['goods']['goods_style_name']): ?> <?php echo $this->_var['goods']['goods_style_name']; ?><br /> <?php else: ?> <?php echo $this->_var['goods']['goods_name']; ?><br /> <?php endif; ?> </a> <?php if ($this->_var['goods']['goods_brief']): ?> <?php echo $this->_var['lang']['goods_brief']; ?><?php echo $this->_var['goods']['goods_brief']; ?><br /> <?php endif; ?> </li> <li> <?php echo $this->_var['lang']['exchange_integral']; ?><font class="shop_s"><?php echo $this->_var['goods']['exchange_integral']; ?></font> </li> </ul> <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </div> <?php endif; ?> </form> </div> </div> <div class="blank5"></div> <script type="text/javascript"> window.onload = function() { Compare.init(); fixpng(); } var button_compare = ''; </script>
zzshop
trunk/temp/compiled/exchange_list.lbi.php
PHP
asf20
6,818
<?php $this->mysql_config_cache_file_time = 1299762388; $this->timeline = 0; $this->timezone = 0; $this->platform = 'OTHER'; ?>
zzshop
trunk/temp/query_caches/sqlcache_config_file_443cefe3c60021147a9dacf5c1b8ab4c.php
PHP
asf20
132
<?php $this->mysql_config_cache_file_time = 1299762157; $this->timeline = 0; $this->timezone = 0; $this->platform = 'OTHER'; ?>
zzshop
trunk/temp/query_caches/sqlcache_config_file_ab32a74aeaeef12073504c209e781bc1.php
PHP
asf20
132
<?php /** * ECSHOP 轮播图片程序 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: cycle_image.php 17063 2010-03-25 06:35:46Z liuhui $ */ define('IN_ECS', true); define('INIT_NO_USERS', true); define('INIT_NO_SMARTY', true); require(dirname(__FILE__) . '/includes/init.php'); header('Content-Type: application/xml; charset=' . EC_CHARSET); header('Cache-Control: no-cache, must-revalidate'); header('Expires: Thu, 27 Mar 1975 07:38:00 GMT'); header('Last-Modified: ' . date('r')); header('Pragma: no-cache'); if (file_exists(ROOT_PATH . DATA_DIR . '/cycle_image.xml')) { echo file_get_contents(ROOT_PATH . DATA_DIR . '/cycle_image.xml'); } else { echo '<?xml version="1.0" encoding="' . EC_CHARSET . '"?><bcaster><item item_url="images/200609/05.jpg" link="http://www.ecshop.com" /></bcaster>'; } ?>
zzshop
trunk/cycle_image.php
PHP
asf20
1,392
<?php /** * ECSHOP 品牌列表 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: sxc_shop $ * $Id: brand.php 17141 2010-04-28 08:11:09Z sxc_shop $ */ define('IN_ECS', true); require(dirname(__FILE__) . '/includes/init.php'); if ((DEBUG_MODE & 2) != 2) { $smarty->caching = true; } /*------------------------------------------------------ */ //-- INPUT /*------------------------------------------------------ */ /* 获得请求的分类 ID */ if (!empty($_REQUEST['id'])) { $brand_id = intval($_REQUEST['id']); } if (!empty($_REQUEST['brand'])) { $brand_id = intval($_REQUEST['brand']); } if (empty($brand_id)) { /* 缓存编号 */ $cache_id = sprintf('%X', crc32($_CFG['lang'])); if (!$smarty->is_cached('brand_list.dwt', $cache_id)) { assign_template(); $position = assign_ur_here('', $_LANG['all_brand']); $smarty->assign('page_title', $position['title']); // 页面标题 $smarty->assign('ur_here', $position['ur_here']); // 当前位置 $smarty->assign('categories', get_categories_tree()); // 分类树 $smarty->assign('helps', get_shop_help()); // 网店帮助 $smarty->assign('top_goods', get_top10()); // 销售排行 $smarty->assign('brand_list', get_brands()); } $smarty->display('brand_list.dwt', $cache_id); exit(); } /* 初始化分页信息 */ $page = !empty($_REQUEST['page']) && intval($_REQUEST['page']) > 0 ? intval($_REQUEST['page']) : 1; $size = !empty($_CFG['page_size']) && intval($_CFG['page_size']) > 0 ? intval($_CFG['page_size']) : 10; $cate = !empty($_REQUEST['cat']) && intval($_REQUEST['cat']) > 0 ? intval($_REQUEST['cat']) : 0; /* 排序、显示方式以及类型 */ $default_display_type = $_CFG['show_order_type'] == '0' ? 'list' : ($_CFG['show_order_type'] == '1' ? 'grid' : 'text'); $default_sort_order_method = $_CFG['sort_order_method'] == '0' ? 'DESC' : 'ASC'; $default_sort_order_type = $_CFG['sort_order_type'] == '0' ? 'goods_id' : ($_CFG['sort_order_type'] == '1' ? 'shop_price' : 'last_update'); $sort = (isset($_REQUEST['sort']) && in_array(trim(strtolower($_REQUEST['sort'])), array('goods_id', 'shop_price', 'last_update'))) ? trim($_REQUEST['sort']) : $default_sort_order_type; $order = (isset($_REQUEST['order']) && in_array(trim(strtoupper($_REQUEST['order'])), array('ASC', 'DESC'))) ? trim($_REQUEST['order']) : $default_sort_order_method; $display = (isset($_REQUEST['display']) && in_array(trim(strtolower($_REQUEST['display'])), array('list', 'grid', 'text'))) ? trim($_REQUEST['display']) : (isset($_COOKIE['ECS']['display']) ? $_COOKIE['ECS']['display'] : $default_display_type); setcookie('ECS[display]', $display, gmtime() + 86400 * 7); /*------------------------------------------------------ */ //-- PROCESSOR /*------------------------------------------------------ */ /* 页面的缓存ID */ $cache_id = sprintf('%X', crc32($brand_id . '-' . $display . '-' . $sort . '-' . $order . '-' . $page . '-' . $size . '-' . $_SESSION['user_rank'] . '-' . $_CFG['lang'] . '-' . $cate)); if (!$smarty->is_cached('brand.dwt', $cache_id)) { $brand_info = get_brand_info($brand_id); if (empty($brand_info)) { ecs_header("Location: ./\n"); exit; } $smarty->assign('data_dir', DATA_DIR); $smarty->assign('keywords', htmlspecialchars($brand_info['brand_desc'])); $smarty->assign('description', htmlspecialchars($brand_info['brand_desc'])); /* 赋值固定内容 */ assign_template(); $position = assign_ur_here($cate, $brand_info['brand_name']); $smarty->assign('page_title', $position['title']); // 页面标题 $smarty->assign('ur_here', $position['ur_here']); // 当前位置 $smarty->assign('brand_id', $brand_id); $smarty->assign('category', $cate); $smarty->assign('categories', get_categories_tree()); // 分类树 $smarty->assign('helps', get_shop_help()); // 网店帮助 $smarty->assign('top_goods', get_top10()); // 销售排行 $smarty->assign('show_marketprice', $_CFG['show_marketprice']); $smarty->assign('brand_cat_list', brand_related_cat($brand_id)); // 相关分类 $smarty->assign('feed_url', ($_CFG['rewrite'] == 1) ? "feed-b$brand_id.xml" : 'feed.php?brand=' . $brand_id); /* 调查 */ $vote = get_vote(); if (!empty($vote)) { $smarty->assign('vote_id', $vote['id']); $smarty->assign('vote', $vote['content']); } $smarty->assign('best_goods', brand_recommend_goods('best', $brand_id, $cate)); $smarty->assign('promotion_goods', brand_recommend_goods('promote', $brand_id, $cate)); $smarty->assign('brand', $brand_info); $smarty->assign('promotion_info', get_promotion_info()); $count = goods_count_by_brand($brand_id, $cate); $goodslist = brand_get_goods($brand_id, $cate, $size, $page, $sort, $order); if($display == 'grid') { if(count($goodslist) % 2 != 0) { $goodslist[] = array(); } } $smarty->assign('goods_list', $goodslist); $smarty->assign('script_name', 'brand'); assign_pager('brand', $cate, $count, $size, $sort, $order, $page, '', $brand_id, 0, 0, $display); // 分页 assign_dynamic('brand'); // 动态内容 } $smarty->display('brand.dwt', $cache_id); /*------------------------------------------------------ */ //-- PRIVATE FUNCTION /*------------------------------------------------------ */ /** * 获得指定品牌的详细信息 * * @access private * @param integer $id * @return void */ function get_brand_info($id) { $sql = 'SELECT * FROM ' . $GLOBALS['ecs']->table('brand') . " WHERE brand_id = '$id'"; return $GLOBALS['db']->getRow($sql); } /** * 获得指定品牌下的推荐和促销商品 * * @access private * @param string $type * @param integer $brand * @return array */ function brand_recommend_goods($type, $brand, $cat = 0) { static $result = NULL; $time = gmtime(); if ($result === NULL) { if ($cat > 0) { $cat_where = "AND " . get_children($cat); } else { $cat_where = ''; } $sql = 'SELECT g.goods_id, g.goods_name, g.market_price, g.shop_price AS org_price, g.promote_price, ' . "IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price, ". 'promote_start_date, promote_end_date, g.goods_brief, g.goods_thumb, goods_img, ' . 'b.brand_name, g.is_best, g.is_new, g.is_hot, g.is_promote ' . 'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('brand') . ' AS b ON b.brand_id = g.brand_id ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('member_price') . ' AS mp '. "ON mp.goods_id = g.goods_id AND mp.user_rank = '$_SESSION[user_rank]' ". "WHERE g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 AND g.brand_id = '$brand' AND " . "(g.is_best = 1 OR (g.is_promote = 1 AND promote_start_date <= '$time' AND ". "promote_end_date >= '$time')) $cat_where" . 'ORDER BY g.sort_order, g.last_update DESC'; $result = $GLOBALS['db']->getAll($sql); } /* 取得每一项的数量限制 */ $num = 0; $type2lib = array('best'=>'recommend_best', 'new'=>'recommend_new', 'hot'=>'recommend_hot', 'promote'=>'recommend_promotion'); $num = get_library_number($type2lib[$type]); $idx = 0; $goods = array(); foreach ($result AS $row) { if ($idx >= $num) { break; } if (($type == 'best' && $row['is_best'] == 1) || ($type == 'promote' && $row['is_promote'] == 1 && $row['promote_start_date'] <= $time && $row['promote_end_date'] >= $time)) { if ($row['promote_price'] > 0) { $promote_price = bargain_price($row['promote_price'], $row['promote_start_date'], $row['promote_end_date']); $goods[$idx]['promote_price'] = $promote_price > 0 ? price_format($promote_price) : ''; } else { $goods[$idx]['promote_price'] = ''; } $goods[$idx]['id'] = $row['goods_id']; $goods[$idx]['name'] = $row['goods_name']; $goods[$idx]['brief'] = $row['goods_brief']; $goods[$idx]['brand_name'] = $row['brand_name']; $goods[$idx]['short_style_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name']; $goods[$idx]['market_price'] = price_format($row['market_price']); $goods[$idx]['shop_price'] = price_format($row['shop_price']); $goods[$idx]['thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true); $goods[$idx]['goods_img'] = get_image_path($row['goods_id'], $row['goods_img']); $goods[$idx]['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']); $idx++; } } return $goods; } /** * 获得指定的品牌下的商品总数 * * @access private * @param integer $brand_id * @param integer $cate * @return integer */ function goods_count_by_brand($brand_id, $cate = 0) { $sql = 'SELECT COUNT(*) FROM ' .$GLOBALS['ecs']->table('goods'). ' AS g '. "WHERE brand_id = '$brand_id' AND g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0"; if ($cate > 0) { $sql .= " AND " . get_children($cate); } return $GLOBALS['db']->getOne($sql); } /** * 获得品牌下的商品 * * @access private * @param integer $brand_id * @return array */ function brand_get_goods($brand_id, $cate, $size, $page, $sort, $order) { $cate_where = ($cate > 0) ? 'AND ' . get_children($cate) : ''; /* 获得商品列表 */ $sql = 'SELECT g.goods_id, g.goods_name, g.market_price, g.shop_price AS org_price, ' . "IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price, g.promote_price, " . 'g.promote_start_date, g.promote_end_date, g.goods_brief, g.goods_thumb , g.goods_img ' . 'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('member_price') . ' AS mp ' . "ON mp.goods_id = g.goods_id AND mp.user_rank = '$_SESSION[user_rank]' " . "WHERE g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 AND g.brand_id = '$brand_id' $cate_where". "ORDER BY $sort $order"; $res = $GLOBALS['db']->selectLimit($sql, $size, ($page - 1) * $size); $arr = array(); while ($row = $GLOBALS['db']->fetchRow($res)) { if ($row['promote_price'] > 0) { $promote_price = bargain_price($row['promote_price'], $row['promote_start_date'], $row['promote_end_date']); } else { $promote_price = 0; } $arr[$row['goods_id']]['goods_id'] = $row['goods_id']; if($GLOBALS['display'] == 'grid') { $arr[$row['goods_id']]['goods_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name']; } else { $arr[$row['goods_id']]['goods_name'] = $row['goods_name']; } $arr[$row['goods_id']]['market_price'] = price_format($row['market_price']); $arr[$row['goods_id']]['shop_price'] = price_format($row['shop_price']); $arr[$row['goods_id']]['promote_price'] = ($promote_price > 0) ? price_format($promote_price) : ''; $arr[$row['goods_id']]['goods_brief'] = $row['goods_brief']; $arr[$row['goods_id']]['goods_thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true); $arr[$row['goods_id']]['goods_img'] = get_image_path($row['goods_id'], $row['goods_img']); $arr[$row['goods_id']]['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']); } return $arr; } /** * 获得与指定品牌相关的分类 * * @access public * @param integer $brand * @return array */ function brand_related_cat($brand) { $arr[] = array('cat_id' => 0, 'cat_name' => $GLOBALS['_LANG']['all_category'], 'url' => build_uri('brand', array('bid' => $brand), $GLOBALS['_LANG']['all_category'])); $sql = "SELECT c.cat_id, c.cat_name, COUNT(g.goods_id) AS goods_count FROM ". $GLOBALS['ecs']->table('category'). " AS c, ". $GLOBALS['ecs']->table('goods') . " AS g " . "WHERE g.brand_id = '$brand' AND c.cat_id = g.cat_id ". "GROUP BY g.cat_id"; $res = $GLOBALS['db']->query($sql); while ($row = $GLOBALS['db']->fetchRow($res)) { $row['url'] = build_uri('brand', array('cid' => $row['cat_id'], 'bid' => $brand), $row['cat_name']); $arr[] = $row; } return $arr; } ?>
zzshop
trunk/brand.php
PHP
asf20
14,393
<?php /** * ECSHOP RSS Feed 生成程序 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: feed.php 17063 2010-03-25 06:35:46Z liuhui $ */ define('IN_ECS', true); define('INIT_NO_USERS', true); define('INIT_NO_SMARTY', true); require(dirname(__FILE__) . '/includes/init.php'); require(ROOT_PATH . 'includes/cls_rss.php'); header('Content-Type: application/xml; charset=' . EC_CHARSET); header('Cache-Control: no-cache, must-revalidate'); header('Expires: Fri, 14 Mar 1980 20:53:00 GMT'); header('Last-Modified: ' . date('r')); header('Pragma: no-cache'); $ver = isset($_REQUEST['ver']) ? $_REQUEST['ver'] : '2.00'; $cat = isset($_REQUEST['cat']) ? ' AND ' . get_children(intval($_REQUEST['cat'])) : ''; $brd = isset($_REQUEST['brand']) ? ' AND g.brand_id=' . intval($_REQUEST['brand']) . ' ' : ''; $uri = $ecs->url(); $rss = new RSSBuilder(EC_CHARSET, $uri, htmlspecialchars($_CFG['shop_name']), htmlspecialchars($_CFG['shop_desc']), $uri . 'animated_favicon.gif'); $rss->addDCdata('', 'http://www.ecshop.com', date('r')); if (isset($_REQUEST['type'])) { if($_REQUEST['type'] == 'group_buy') { $now = gmtime(); $sql = 'SELECT act_id, act_name, act_desc, start_time ' . "FROM " . $GLOBALS['ecs']->table('goods_activity') . "WHERE act_type = '" . GAT_GROUP_BUY . "' " . "AND start_time <= '$now' AND is_finished < 3 ORDER BY start_time DESC"; $res = $db->query($sql); if ($res !== false) { while ($row = $db->fetchRow($res)) { $item_url = build_uri('group_buy', array('gbid' => $row['act_id']), $row['act_name']); $separator = (strpos($item_url, '?') === false)? '?' : '&amp;'; $about = $uri . $item_url; $title = htmlspecialchars($row['act_name']); $link = $uri . $item_url . $separator . 'from=rss'; $desc = htmlspecialchars($row['act_desc']); $subject = $_LANG['group_buy']; $date = local_date('r', $row['start_time']); $rss->addItem($about, $title, $link, $desc, $subject, $date); } $rss->outputRSS($ver); } } elseif($_REQUEST['type'] == 'snatch') { $now = gmtime(); $sql = 'SELECT act_id, act_name, act_desc, start_time ' . "FROM " . $GLOBALS['ecs']->table('goods_activity') . "WHERE act_type = '" . GAT_SNATCH . "' " . "AND start_time <= '$now' AND is_finished < 3 ORDER BY start_time DESC"; $res = $db->query($sql); if ($res !== false) { while ($row = $db->fetchRow($res)) { $item_url = build_uri('snatch', array('sid' => $row['act_id']), $row['act_name']); $separator = (strpos($item_url, '?') === false)? '?' : '&amp;'; $about = $uri . $item_url; $title = htmlspecialchars($row['act_name']); $link = $uri . $item_url . $separator . 'from=rss'; $desc = htmlspecialchars($row['act_desc']); $subject = $_LANG['snatch']; $date = local_date('r', $row['start_time']); $rss->addItem($about, $title, $link, $desc, $subject, $date); } $rss->outputRSS($ver); } } elseif($_REQUEST['type'] == 'auction') { $now = gmtime(); $sql = 'SELECT act_id, act_name, act_desc, start_time ' . "FROM " . $GLOBALS['ecs']->table('goods_activity') . "WHERE act_type = '" . GAT_AUCTION . "' " . "AND start_time <= '$now' AND is_finished < 3 ORDER BY start_time DESC"; $res = $db->query($sql); if ($res !== false) { while ($row = $db->fetchRow($res)) { $item_url = build_uri('auction', array('auid' => $row['act_id']), $row['act_name']); $separator = (strpos($item_url, '?') === false)? '?' : '&amp;'; $about = $uri . $item_url; $title = htmlspecialchars($row['act_name']); $link = $uri . $item_url . $separator . 'from=rss'; $desc = htmlspecialchars($row['act_desc']); $subject = $_LANG['auction']; $date = local_date('r', $row['start_time']); $rss->addItem($about, $title, $link, $desc, $subject, $date); } $rss->outputRSS($ver); } } elseif($_REQUEST['type'] == 'exchange') { $sql = 'SELECT g.goods_id, g.goods_name, g.goods_brief, g.last_update ' . "FROM " . $GLOBALS['ecs']->table('exchange_goods') . " AS eg, " . $GLOBALS['ecs']->table('goods') . " AS g " . "WHERE eg.goods_id = g.goods_id"; $res = $db->query($sql); if ($res !== false) { while ($row = $db->fetchRow($res)) { $item_url = build_uri('exchange_goods', array('gid' => $row['goods_id']), $row['goods_name']); $separator = (strpos($item_url, '?') === false)? '?' : '&amp;'; $about = $uri . $item_url; $title = htmlspecialchars($row['goods_name']); $link = $uri . $item_url . $separator . 'from=rss'; $desc = htmlspecialchars($row['goods_brief']); $subject = $_LANG['exchange']; $date = local_date('r', $row['last_update']); $rss->addItem($about, $title, $link, $desc, $subject, $date); } $rss->outputRSS($ver); } } elseif($_REQUEST['type'] == 'activity') { $now = gmtime(); $sql = 'SELECT act_id, act_name, start_time ' . "FROM " . $GLOBALS['ecs']->table('favourable_activity') . " WHERE start_time <= '$now' AND end_time >= '$now'"; $res = $db->query($sql); if ($res !== false) { while ($row = $db->fetchRow($res)) { $item_url = 'activity.php'; $separator = (strpos($item_url, '?') === false)? '?' : '&amp;'; $about = $uri . $item_url; $title = htmlspecialchars($row['act_name']); $link = $uri . $item_url . $separator . 'from=rss'; $desc = ''; $subject = $_LANG['favourable']; $date = local_date('r', $row['start_time']); $rss->addItem($about, $title, $link, $desc, $subject, $date); } $rss->outputRSS($ver); } } elseif($_REQUEST['type'] == 'package') { $now = gmtime(); $sql = 'SELECT act_id, act_name, act_desc, start_time ' . "FROM " . $GLOBALS['ecs']->table('goods_activity') . "WHERE act_type = '" . GAT_PACKAGE . "' " . "AND start_time <= '$now' AND is_finished < 3 ORDER BY start_time DESC"; $res = $db->query($sql); if ($res !== false) { while ($row = $db->fetchRow($res)) { $item_url = 'package.php'; $separator = (strpos($item_url, '?') === false)? '?' : '&amp;'; $about = $uri . $item_url; $title = htmlspecialchars($row['act_name']); $link = $uri . $item_url . $separator . 'from=rss'; $desc = htmlspecialchars($row['act_desc']); $subject = $_LANG['remark_package']; $date = local_date('r', $row['start_time']); $rss->addItem($about, $title, $link, $desc, $subject, $date); } $rss->outputRSS($ver); } } elseif(substr($_REQUEST['type'], 0, 11) == 'article_cat') { $sql = 'SELECT article_id, title, author, add_time' . ' FROM ' .$GLOBALS['ecs']->table('article') . ' WHERE is_open = 1 AND ' . get_article_children(substr($_REQUEST['type'], 11)) . ' ORDER BY add_time DESC LIMIT ' . $_CFG['article_page_size']; $res = $db->query($sql); if ($res !== false) { while ($row = $db->fetchRow($res)) { $item_url = build_uri('article', array('aid' => $row['article_id']), $row['title']); $separator = (strpos($item_url, '?') === false)? '?' : '&amp;'; $about = $uri . $item_url; $title = htmlspecialchars($row['title']); $link = $uri . $item_url . $separator . 'from=rss'; $desc = ''; $subject = htmlspecialchars($row['author']); $date = local_date('r', $row['add_time']); $rss->addItem($about, $title, $link, $desc, $subject, $date); } $rss->outputRSS($ver); } } } else { $in_cat = $cat > 0 ? ' AND ' . get_children($cat) : ''; $sql = 'SELECT c.cat_name, g.goods_id, g.goods_name, g.goods_brief, g.last_update ' . 'FROM ' . $ecs->table('category') . ' AS c, ' . $ecs->table('goods') . ' AS g ' . 'WHERE c.cat_id = g.cat_id AND g.is_delete = 0 AND g.is_alone_sale = 1 ' . $brd . $cat . 'ORDER BY g.last_update DESC'; $res = $db->query($sql); if ($res !== false) { while ($row = $db->fetchRow($res)) { $item_url = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']); $separator = (strpos($item_url, '?') === false)? '?' : '&amp;'; $about = $uri . $item_url; $title = htmlspecialchars($row['goods_name']); $link = $uri . $item_url . $separator . 'from=rss'; $desc = htmlspecialchars($row['goods_brief']); $subject = htmlspecialchars($row['cat_name']); $date = local_date('r', $row['last_update']); $rss->addItem($about, $title, $link, $desc, $subject, $date); } $rss->outputRSS($ver); } } ?>
zzshop
trunk/feed.php
PHP
asf20
10,890
<?php /** * ECSHOP 商品详情 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: goods.php 17063 2010-03-25 06:35:46Z liuhui $ */ define('IN_ECS', true); require(dirname(__FILE__) . '/includes/init.php'); if ((DEBUG_MODE & 2) != 2) { $smarty->caching = true; } $affiliate = unserialize($GLOBALS['_CFG']['affiliate']); $smarty->assign('affiliate', $affiliate); /*------------------------------------------------------ */ //-- INPUT /*------------------------------------------------------ */ $goods_id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; /*------------------------------------------------------ */ //-- 改变属性、数量时重新计算商品价格 /*------------------------------------------------------ */ if (!empty($_REQUEST['act']) && $_REQUEST['act'] == 'price') { include('includes/cls_json.php'); $json = new JSON; $res = array('err_msg' => '', 'result' => '', 'qty' => 1); $attr_id = isset($_REQUEST['attr']) ? explode(',', $_REQUEST['attr']) : array(); $number = (isset($_REQUEST['number'])) ? intval($_REQUEST['number']) : 1; if ($goods_id == 0) { $res['err_msg'] = $_LANG['err_change_attr']; $res['err_no'] = 1; } else { if ($number == 0) { $res['qty'] = $number = 1; } else { $res['qty'] = $number; } $shop_price = get_final_price($goods_id, $number, true, $attr_id); $res['result'] = price_format($shop_price * $number); } die($json->encode($res)); } /*------------------------------------------------------ */ //-- 商品购买记录ajax处理 /*------------------------------------------------------ */ if (!empty($_REQUEST['act']) && $_REQUEST['act'] == 'gotopage') { include('includes/cls_json.php'); $json = new JSON; $res = array('err_msg' => '', 'result' => ''); $goods_id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; $page = (isset($_REQUEST['page'])) ? intval($_REQUEST['page']) : 1; if (!empty($goods_id)) { $need_cache = $GLOBALS['smarty']->caching; $need_compile = $GLOBALS['smarty']->force_compile; $GLOBALS['smarty']->caching = false; $GLOBALS['smarty']->force_compile = true; /* 商品购买记录 */ $sql = 'SELECT u.user_name, og.goods_number, oi.add_time, IF(oi.order_status IN (2, 3, 4), 0, 1) AS order_status ' . 'FROM ' . $ecs->table('order_info') . ' AS oi LEFT JOIN ' . $ecs->table('users') . ' AS u ON oi.user_id = u.user_id, ' . $ecs->table('order_goods') . ' AS og ' . 'WHERE oi.order_id = og.order_id AND ' . time() . ' - oi.add_time < 2592000 AND og.goods_id = ' . $goods_id . ' ORDER BY oi.add_time DESC LIMIT ' . (($page > 1) ? ($page-1) : 0) * 5 . ',5'; $bought_notes = $db->getAll($sql); foreach ($bought_notes as $key => $val) { $bought_notes[$key]['add_time'] = local_date("Y-m-d G:i:s", $val['add_time']); } $sql = 'SELECT count(*) ' . 'FROM ' . $ecs->table('order_info') . ' AS oi LEFT JOIN ' . $ecs->table('users') . ' AS u ON oi.user_id = u.user_id, ' . $ecs->table('order_goods') . ' AS og ' . 'WHERE oi.order_id = og.order_id AND ' . time() . ' - oi.add_time < 2592000 AND og.goods_id = ' . $goods_id; $count = $db->getOne($sql); /* 商品购买记录分页样式 */ $pager = array(); $pager['page'] = $page; $pager['size'] = $size = 5; $pager['record_count'] = $count; $pager['page_count'] = $page_count = ($count > 0) ? intval(ceil($count / $size)) : 1;; $pager['page_first'] = "javascript:gotoBuyPage(1,$goods_id)"; $pager['page_prev'] = $page > 1 ? "javascript:gotoBuyPage(" .($page-1). ",$goods_id)" : 'javascript:;'; $pager['page_next'] = $page < $page_count ? 'javascript:gotoBuyPage(' .($page + 1) . ",$goods_id)" : 'javascript:;'; $pager['page_last'] = $page < $page_count ? 'javascript:gotoBuyPage(' .$page_count. ",$goods_id)" : 'javascript:;'; $smarty->assign('notes', $bought_notes); $smarty->assign('pager', $pager); $res['result'] = $GLOBALS['smarty']->fetch('library/bought_notes.lbi'); $GLOBALS['smarty']->caching = $need_cache; $GLOBALS['smarty']->force_compile = $need_compile; } die($json->encode($res)); } /*------------------------------------------------------ */ //-- PROCESSOR /*------------------------------------------------------ */ $cache_id = $goods_id . '-' . $_SESSION['user_rank'].'-'.$_CFG['lang']; $cache_id = sprintf('%X', crc32($cache_id)); if (!$smarty->is_cached('goods.dwt', $cache_id)) { $smarty->assign('image_width', $_CFG['image_width']); $smarty->assign('image_height', $_CFG['image_height']); $smarty->assign('helps', get_shop_help()); // 网店帮助 $smarty->assign('id', $goods_id); $smarty->assign('type', 0); $smarty->assign('cfg', $_CFG); $smarty->assign('promotion', get_promotion_info($goods_id));//促销信息 $smarty->assign('promotion_info', get_promotion_info()); /* 获得商品的信息 */ $goods = get_goods_info($goods_id); if ($goods === false) { /* 如果没有找到任何记录则跳回到首页 */ ecs_header("Location: ./\n"); exit; } else { if ($goods['brand_id'] > 0) { $goods['goods_brand_url'] = build_uri('brand', array('bid'=>$goods['brand_id']), $goods['goods_brand']); } $shop_price = $goods['shop_price']; $linked_goods = get_linked_goods($goods_id); $goods['goods_style_name'] = add_style($goods['goods_name'], $goods['goods_name_style']); /* 购买该商品可以得到多少钱的红包 */ if ($goods['bonus_type_id'] > 0) { $time = gmtime(); $sql = "SELECT type_money FROM " . $ecs->table('bonus_type') . " WHERE type_id = '$goods[bonus_type_id]' " . " AND send_type = '" . SEND_BY_GOODS . "' " . " AND send_start_date <= '$time'" . " AND send_end_date >= '$time'"; $goods['bonus_money'] = floatval($db->getOne($sql)); if ($goods['bonus_money'] > 0) { $goods['bonus_money'] = price_format($goods['bonus_money']); } } $smarty->assign('goods', $goods); $smarty->assign('goods_id', $goods['goods_id']); $smarty->assign('promote_end_time', $goods['gmt_end_time']); $smarty->assign('categories', get_categories_tree($goods['cat_id'])); // 分类树 /* meta */ $smarty->assign('keywords', htmlspecialchars($goods['keywords'])); $smarty->assign('description', htmlspecialchars($goods['goods_brief'])); $catlist = array(); foreach(get_parent_cats($goods['cat_id']) as $k=>$v) { $catlist[] = $v['cat_id']; } assign_template('c', $catlist); /* 上一个商品下一个商品 */ $prev_gid = $db->getOne("SELECT goods_id FROM " .$ecs->table('goods'). " WHERE cat_id=" . $goods['cat_id'] . " AND goods_id > " . $goods['goods_id'] . " AND is_on_sale = 1 AND is_alone_sale = 1 AND is_delete = 0 LIMIT 1"); if (!empty($prev_gid)) { $prev_good['url'] = build_uri('goods', array('gid' => $prev_gid), $goods['goods_name']); $smarty->assign('prev_good', $prev_good);//上一个商品 } $next_gid = $db->getOne("SELECT max(goods_id) FROM " . $ecs->table('goods') . " WHERE cat_id=".$goods['cat_id']." AND goods_id < ".$goods['goods_id'] . " AND is_on_sale = 1 AND is_alone_sale = 1 AND is_delete = 0"); if (!empty($next_gid)) { $next_good['url'] = build_uri('goods', array('gid' => $next_gid), $goods['goods_name']); $smarty->assign('next_good', $next_good);//下一个商品 } $position = assign_ur_here($goods['cat_id'], $goods['goods_name']); /* current position */ $smarty->assign('page_title', $position['title']); // 页面标题 $smarty->assign('ur_here', $position['ur_here']); // 当前位置 $properties = get_goods_properties($goods_id); // 获得商品的规格和属性 $smarty->assign('properties', $properties['pro']); // 商品属性 $smarty->assign('specification', $properties['spe']); // 商品规格 $smarty->assign('attribute_linked', get_same_attribute_goods($properties)); // 相同属性的关联商品 $smarty->assign('related_goods', $linked_goods); // 关联商品 $smarty->assign('goods_article_list', get_linked_articles($goods_id)); // 关联文章 $smarty->assign('fittings', get_goods_fittings(array($goods_id))); // 配件 $smarty->assign('rank_prices', get_user_rank_prices($goods_id, $shop_price)); // 会员等级价格 $smarty->assign('pictures', get_goods_gallery($goods_id)); // 商品相册 $smarty->assign('bought_goods', get_also_bought($goods_id)); // 购买了该商品的用户还购买了哪些商品 $smarty->assign('goods_rank', get_goods_rank($goods_id)); // 商品的销售排名 //获取tag $tag_array = get_tags($goods_id); $smarty->assign('tags', $tag_array); // 商品的标记 //获取关联礼包 $package_goods_list = get_package_goods_list($goods['goods_id']); $smarty->assign('package_goods_list',$package_goods_list); // 获取关联礼包 assign_dynamic('goods'); $volume_price_list = get_volume_price_list($goods['goods_id'], '1'); $smarty->assign('volume_price_list',$volume_price_list); // 商品优惠价格区间 } } /* 记录浏览历史 */ if (!empty($_COOKIE['ECS']['history'])) { $history = explode(',', $_COOKIE['ECS']['history']); array_unshift($history, $goods_id); $history = array_unique($history); while (count($history) > $_CFG['history_number']) { array_pop($history); } setcookie('ECS[history]', implode(',', $history), gmtime() + 3600 * 24 * 30); } else { setcookie('ECS[history]', $goods_id, gmtime() + 3600 * 24 * 30); } /* 更新点击次数 */ $db->query('UPDATE ' . $ecs->table('goods') . " SET click_count = click_count + 1 WHERE goods_id = '$_REQUEST[id]'"); $smarty->assign('now_time', gmtime()); // 当前系统时间 $smarty->display('goods.dwt', $cache_id); /*------------------------------------------------------ */ //-- PRIVATE FUNCTION /*------------------------------------------------------ */ /** * 获得指定商品的关联商品 * * @access public * @param integer $goods_id * @return array */ function get_linked_goods($goods_id) { $sql = 'SELECT g.goods_id, g.goods_name, g.goods_thumb, g.goods_img, g.shop_price AS org_price, ' . "IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price, ". 'g.market_price, g.promote_price, g.promote_start_date, g.promote_end_date ' . 'FROM ' . $GLOBALS['ecs']->table('link_goods') . ' lg ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('goods') . ' AS g ON g.goods_id = lg.link_goods_id ' . "LEFT JOIN " . $GLOBALS['ecs']->table('member_price') . " AS mp ". "ON mp.goods_id = g.goods_id AND mp.user_rank = '$_SESSION[user_rank]' ". "WHERE lg.goods_id = '$goods_id' AND g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 ". "LIMIT " . $GLOBALS['_CFG']['related_goods_number']; $res = $GLOBALS['db']->query($sql); $arr = array(); while ($row = $GLOBALS['db']->fetchRow($res)) { $arr[$row['goods_id']]['goods_id'] = $row['goods_id']; $arr[$row['goods_id']]['goods_name'] = $row['goods_name']; $arr[$row['goods_id']]['short_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name']; $arr[$row['goods_id']]['goods_thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true); $arr[$row['goods_id']]['goods_img'] = get_image_path($row['goods_id'], $row['goods_img']); $arr[$row['goods_id']]['market_price'] = price_format($row['market_price']); $arr[$row['goods_id']]['shop_price'] = price_format($row['shop_price']); $arr[$row['goods_id']]['url'] = build_uri('goods', array('gid'=>$row['goods_id']), $row['goods_name']); if ($row['promote_price'] > 0) { $arr[$row['goods_id']]['promote_price'] = bargain_price($row['promote_price'], $row['promote_start_date'], $row['promote_end_date']); $arr[$row['goods_id']]['formated_promote_price'] = price_format($arr[$row['goods_id']]['promote_price']); } else { $arr[$row['goods_id']]['promote_price'] = 0; } } return $arr; } /** * 获得指定商品的关联文章 * * @access public * @param integer $goods_id * @return void */ function get_linked_articles($goods_id) { $sql = 'SELECT a.article_id, a.title, a.file_url, a.open_type, a.add_time ' . 'FROM ' . $GLOBALS['ecs']->table('goods_article') . ' AS g, ' . $GLOBALS['ecs']->table('article') . ' AS a ' . "WHERE g.article_id = a.article_id AND g.goods_id = '$goods_id' AND a.is_open = 1 " . 'ORDER BY a.add_time DESC'; $res = $GLOBALS['db']->query($sql); $arr = array(); while ($row = $GLOBALS['db']->fetchRow($res)) { $row['url'] = $row['open_type'] != 1 ? build_uri('article', array('aid'=>$row['article_id']), $row['title']) : trim($row['file_url']); $row['add_time'] = local_date($GLOBALS['_CFG']['date_format'], $row['add_time']); $row['short_title'] = $GLOBALS['_CFG']['article_title_length'] > 0 ? sub_str($row['title'], $GLOBALS['_CFG']['article_title_length']) : $row['title']; $arr[] = $row; } return $arr; } /** * 获得指定商品的各会员等级对应的价格 * * @access public * @param integer $goods_id * @return array */ function get_user_rank_prices($goods_id, $shop_price) { $sql = "SELECT rank_id, IFNULL(mp.user_price, r.discount * $shop_price / 100) AS price, r.rank_name, r.discount " . 'FROM ' . $GLOBALS['ecs']->table('user_rank') . ' AS r ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('member_price') . " AS mp ". "ON mp.goods_id = '$goods_id' AND mp.user_rank = r.rank_id " . "WHERE r.show_price = 1 OR r.rank_id = '$_SESSION[user_rank]'"; $res = $GLOBALS['db']->query($sql); $arr = array(); while ($row = $GLOBALS['db']->fetchRow($res)) { $arr[$row['rank_id']] = array( 'rank_name' => htmlspecialchars($row['rank_name']), 'price' => price_format($row['price'])); } return $arr; } /** * 获得购买过该商品的人还买过的商品 * * @access public * @param integer $goods_id * @return array */ function get_also_bought($goods_id) { $sql = 'SELECT COUNT(b.goods_id ) AS num, g.goods_id, g.goods_name, g.goods_thumb, g.goods_img, g.shop_price, g.promote_price, g.promote_start_date, g.promote_end_date ' . 'FROM ' . $GLOBALS['ecs']->table('order_goods') . ' AS a ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('order_goods') . ' AS b ON b.order_id = a.order_id ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('goods') . ' AS g ON g.goods_id = b.goods_id ' . "WHERE a.goods_id = '$goods_id' AND b.goods_id <> '$goods_id' AND g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 " . 'GROUP BY b.goods_id ' . 'ORDER BY num DESC ' . 'LIMIT ' . $GLOBALS['_CFG']['bought_goods']; $res = $GLOBALS['db']->query($sql); $key = 0; $arr = array(); while ($row = $GLOBALS['db']->fetchRow($res)) { $arr[$key]['goods_id'] = $row['goods_id']; $arr[$key]['goods_name'] = $row['goods_name']; $arr[$key]['short_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name']; $arr[$key]['goods_thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true); $arr[$key]['goods_img'] = get_image_path($row['goods_id'], $row['goods_img']); $arr[$key]['shop_price'] = price_format($row['shop_price']); $arr[$key]['url'] = build_uri('goods', array('gid'=>$row['goods_id']), $row['goods_name']); if ($row['promote_price'] > 0) { $arr[$key]['promote_price'] = bargain_price($row['promote_price'], $row['promote_start_date'], $row['promote_end_date']); $arr[$key]['formated_promote_price'] = price_format($arr[$key]['promote_price']); } else { $arr[$key]['promote_price'] = 0; } $key++; } return $arr; } /** * 获得指定商品的销售排名 * * @access public * @param integer $goods_id * @return integer */ function get_goods_rank($goods_id) { /* 统计时间段 */ $period = intval($GLOBALS['_CFG']['top10_time']); if ($period == 1) // 一年 { $ext = " AND o.add_time > '" . local_strtotime('-1 years') . "'"; } elseif ($period == 2) // 半年 { $ext = " AND o.add_time > '" . local_strtotime('-6 months') . "'"; } elseif ($period == 3) // 三个月 { $ext = " AND o.add_time > '" . local_strtotime('-3 months') . "'"; } elseif ($period == 4) // 一个月 { $ext = " AND o.add_time > '" . local_strtotime('-1 months') . "'"; } else { $ext = ''; } /* 查询该商品销量 */ $sql = 'SELECT IFNULL(SUM(g.goods_number), 0) ' . 'FROM ' . $GLOBALS['ecs']->table('order_info') . ' AS o, ' . $GLOBALS['ecs']->table('order_goods') . ' AS g ' . "WHERE o.order_id = g.order_id " . "AND o.order_status = '" . OS_CONFIRMED . "' " . "AND o.shipping_status " . db_create_in(array(SS_SHIPPED, SS_RECEIVED)) . " AND o.pay_status " . db_create_in(array(PS_PAYED, PS_PAYING)) . " AND g.goods_id = '$goods_id'" . $ext; $sales_count = $GLOBALS['db']->getOne($sql); if ($sales_count > 0) { /* 只有在商品销售量大于0时才去计算该商品的排行 */ $sql = 'SELECT DISTINCT SUM(goods_number) AS num ' . 'FROM ' . $GLOBALS['ecs']->table('order_info') . ' AS o, ' . $GLOBALS['ecs']->table('order_goods') . ' AS g ' . "WHERE o.order_id = g.order_id " . "AND o.order_status = '" . OS_CONFIRMED . "' " . "AND o.shipping_status " . db_create_in(array(SS_SHIPPED, SS_RECEIVED)) . " AND o.pay_status " . db_create_in(array(PS_PAYED, PS_PAYING)) . $ext . " GROUP BY g.goods_id HAVING num > $sales_count"; $res = $GLOBALS['db']->query($sql); $rank = $GLOBALS['db']->num_rows($res) + 1; if ($rank > 10) { $rank = 0; } } else { $rank = 0; } return $rank; } /** * 获得商品选定的属性的附加总价格 * * @param integer $goods_id * @param array $attr * * @return void */ function get_attr_amount($goods_id, $attr) { $sql = "SELECT SUM(attr_price) FROM " . $GLOBALS['ecs']->table('goods_attr') . " WHERE goods_id='$goods_id' AND " . db_create_in($attr, 'goods_attr_id'); return $GLOBALS['db']->getOne($sql); } /** * 取得跟商品关联的礼包列表 * * @param string $goods_id 商品编号 * * @return 礼包列表 */ function get_package_goods_list($goods_id) { $now = gmtime(); $sql = "SELECT MAX(pg.goods_id), ga.act_id, ga.act_name, ga.act_desc, ga.goods_name, ga.start_time, ga.end_time, ga.is_finished, ga.ext_info FROM " . $GLOBALS['ecs']->table('goods_activity') . " AS ga, " . $GLOBALS['ecs']->table('package_goods') . " AS pg WHERE pg.package_id = ga.act_id AND ga.start_time <= '" . $now . "' AND ga.end_time >= '" . $now . "' AND pg.goods_id = " . $goods_id . " GROUP BY pg.goods_id ORDER BY ga.act_id"; $res = $GLOBALS['db']->getAll($sql); foreach ($res as $tempkey => $value) { $subtotal = 0; $row = unserialize($value['ext_info']); unset($value['ext_info']); if ($row) { foreach ($row as $key=>$val) { $res[$tempkey][$key] = $val; } } $sql = "SELECT pg.package_id, pg.goods_id, pg.goods_number, pg.admin_id, p.goods_attr, g.goods_sn, g.goods_name, g.market_price, g.goods_thumb, IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS rank_price FROM " . $GLOBALS['ecs']->table('package_goods') . " AS pg LEFT JOIN ". $GLOBALS['ecs']->table('goods') . " AS g ON g.goods_id = pg.goods_id LEFT JOIN ". $GLOBALS['ecs']->table('products') . " AS p ON p.product_id = pg.product_id LEFT JOIN " . $GLOBALS['ecs']->table('member_price') . " AS mp ON mp.goods_id = g.goods_id AND mp.user_rank = '$_SESSION[user_rank]' WHERE pg.package_id = " . $value['act_id']. " ORDER BY pg.package_id, pg.goods_id"; $goods_res = $GLOBALS['db']->getAll($sql); foreach($goods_res as $key => $val) { $goods_id_array[] = $val['goods_id']; $goods_res[$key]['goods_thumb'] = get_image_path($val['goods_id'], $val['goods_thumb'], true); $goods_res[$key]['market_price'] = price_format($val['market_price']); $goods_res[$key]['rank_price'] = price_format($val['rank_price']); $subtotal += $val['rank_price'] * $val['goods_number']; } /* 取商品属性 */ $sql = "SELECT ga.goods_attr_id, ga.attr_value FROM " .$GLOBALS['ecs']->table('goods_attr'). " AS ga, " .$GLOBALS['ecs']->table('attribute'). " AS a WHERE a.attr_id = ga.attr_id AND a.attr_type = 1 AND " . db_create_in($goods_id_array, 'goods_id'); $result_goods_attr = $GLOBALS['db']->getAll($sql); $_goods_attr = array(); foreach ($result_goods_attr as $value) { $_goods_attr[$value['goods_attr_id']] = $value['attr_value']; } /* 处理货品 */ $format = '[%s]'; foreach($goods_res as $key => $val) { if ($val['goods_attr'] != '') { $goods_attr_array = explode('|', $val['goods_attr']); $goods_attr = array(); foreach ($goods_attr_array as $_attr) { $goods_attr[] = $_goods_attr[$_attr]; } $goods_res[$key]['goods_attr_str'] = sprintf($format, implode(',', $goods_attr)); } } $res[$tempkey]['goods_list'] = $goods_res; $res[$tempkey]['subtotal'] = price_format($subtotal); $res[$tempkey]['saving'] = price_format(($subtotal - $res[$tempkey]['package_price'])); $res[$tempkey]['package_price'] = price_format($res[$tempkey]['package_price']); } return $res; } ?>
zzshop
trunk/goods.php
PHP
asf20
25,508
<?php /** * ECSHOP OPEN API统一接口 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: sxc_shop $ * $Id: goods.php 15921 2009-05-07 05:35:58Z sxc_shop $ */ define('IN_ECS', true); require(dirname(__FILE__) . '/includes/init.php'); require(ROOT_PATH . 'includes/lib_license.php'); require_once('includes/cls_json.php'); define('RETURN_TYPE', empty($_POST['return_data']) ? 1 : ($_POST['return_data'] == 'json' ? 2 : 1)); /* 接收传递参数并初步检验 */ if (empty($_POST) || empty($_POST['ac'])) { api_err('0x003', 'no parameter'); //输出系统级错误:数据异常 } /* 根据请求类型进入相应的接口处理程序 */ switch ($_POST['act']) { case 'search_goods_list': search_goods_list(); break; case 'search_goods_detail': search_goods_detail(); break; case 'search_deleted_goods_list': search_deleted_goods_list(); break; case 'search_products_list': search_products_list(); break; case 'search_site_info': search_site_info(); break; default: api_err('0x008', 'no this type api'); //输出系统级错误:数据异常 } /** * 获取商品列表接口函数 */ function search_goods_list() { check_auth(); //检查基本权限 $version = '1.0'; //版本号 if ($_POST['api_version'] != $version) //网店的接口版本低 { api_err('0x008', 'a low version api'); } if (is_numeric($_POST['last_modify_st_time']) && is_numeric($_POST['last_modify_en_time'])) { $sql = 'SELECT COUNT(*) AS count' . ' FROM ' . $GLOBALS['ecs']->table('goods') . " WHERE is_delete = 0 AND is_on_sale = 1 AND (last_update > '" . $_POST['last_modify_st_time'] . "' OR last_update = 0)"; $date_count = $GLOBALS['db']->getRow($sql); if (empty($date_count)) { api_err('0x003', 'no data to back'); //无符合条件数据 } $page = empty($_POST['pages']) ? 1 : $_POST['pages']; //确定读取哪些记录 $counts = empty($_POST['counts']) ? 100 : $_POST['counts']; $sql = 'SELECT goods_id, last_update AS last_modify' . ' FROM ' . $GLOBALS['ecs']->table('goods') . " WHERE is_delete = 0 AND is_on_sale = 1 AND (last_update > '" . $_POST['last_modify_st_time'] . "' OR last_update = 0)". " LIMIT ".($page - 1) * $counts . ', ' . $counts; $date_arr = $GLOBALS['db']->getAll($sql); if (!empty($_POST['columns'])) { $column_arr = explode('|', $_POST['columns']); foreach ($date_arr as $k => $v) { foreach ($v as $key => $val) { if (in_array($key, $column_arr)) { $re_arr['data_info'][$k][$key] = $val; } } } } else { $re_arr['data_info'] = $date_arr; } /* 处理更新时间等于0的数据 */ $sql = 'UPDATE ' . $GLOBALS['ecs']->table('goods') . " SET last_update = 1 WHERE is_delete = 0 AND is_on_sale = 1 AND last_update = 0"; $GLOBALS['db']->query($sql, 'SILENT'); $re_arr['counts'] = $date_count['count']; data_back($re_arr, '', RETURN_TYPE); //返回数据 } else { api_err('0x003', 'required date invalid'); //请求数据异常 } } /** * 商品详细信息接口函数 */ function search_goods_detail() { check_auth(); //检查基本权限 $version = '1.0'; //版本号 if ($_POST['api_version'] != $version) //网店的接口版本低 { api_err('0x008', 'a low version api'); } if (!empty($_POST['goods_id']) && is_numeric($_POST['goods_id'])) { $sql = 'SELECT g.goods_id, g.last_update AS last_modify, g.cat_id, c.cat_name AS category_name, g.brand_id, b.brand_name, g.shop_price AS price, g.goods_sn AS bn, g.goods_name AS name, g.is_on_sale AS marketable, g.goods_weight AS weight, g.goods_number AS store , g.give_integral AS score, g.add_time AS uptime, g.original_img AS image_default, g.goods_desc AS intro' . ' FROM ' . $GLOBALS['ecs']->table('category') . ' AS c, ' . $GLOBALS['ecs']->table('goods') . ' AS g LEFT JOIN ' . $GLOBALS['ecs']->table('brand') . ' AS b ON g.brand_id = b.brand_id'. ' WHERE g.cat_id = c.cat_id AND g.goods_id = ' . $_POST['goods_id']; $goods_data = $GLOBALS['db']->getRow($sql); if (empty($goods_data)) { api_err('0x003', 'no data to back'); //无符合条件数据 } $goods_data['goods_link'] = 'http://' . $_SERVER['HTTP_HOST'] . '/goods.php?id=' . $goods_data['goods_id']; $goods_data['image_default'] = 'http://' . $_SERVER['HTTP_HOST'] . '/' . $goods_data['image_default']; $goods_data['unit'] = '千克'; $goods_data['brand_name'] = empty($goods_data['brand_name']) ? '' : $goods_data['brand_name']; $prop = create_goods_properties($_POST['goods_id']); $goods_data['props_name'] = $prop['props_name']; $goods_data['props'] = $prop['props']; if (!empty($_POST['columns'])) { $column_arr = explode('|', $_POST['columns']); foreach ($goods_data as $key=>$val) { if (in_array($key, $column_arr)) { $re_arr['data_info'][$key] = $val; } } } else { $re_arr['data_info'] = $goods_data; } data_back($re_arr, '', RETURN_TYPE); //返回数据 } else { api_err('0x003', 'required date invalid'); //请求数据异常 } } /** * 被删除商品列表接口函数 */ function search_deleted_goods_list() { api_err('0x007', '暂时不提供此服务功能'); //服务不可用 } /** * 获取货品列表接口函数 */ function search_products_list() { check_auth(); //检查基本权限 $version = '1.0'; //版本号 if ($_POST['api_version'] != $version) //网店的接口版本低 { api_err('0x008', 'a low version api'); } if (!empty($_POST['goods_id']) && is_numeric($_POST['goods_id']) || !empty($_POST['bn'])) { $sql = 'SELECT goods_id, last_update AS last_modify, shop_price AS price, goods_sn AS bn, goods_name AS name, goods_weight AS weight, goods_number AS store, add_time AS uptime' . ' FROM ' . $GLOBALS['ecs']->table('goods') . ' WHERE ' . empty($_POST['bn']) ? "goods_id = $_POST[goods_id]" : "goods_sn = $_POST[bn]"; $goods_data = $GLOBALS['db']->getRow($sql); if (empty($goods_data)) { api_err('0x003', 'no data to back'); //无符合条件数据 } $goods_data['product_id'] = $_POST['goods_id']; $goods_data['cost'] = $goods_data['price']; $prop = create_goods_properties($_POST['goods_id']); $goods_data['props'] = $prop['props']; if (!empty($_POST['columns'])) { $column_arr = explode('|', $_POST['columns']); foreach ($goods_data as $key=>$val) { if (in_array($key, $column_arr)) { $re_arr['data_info'][$key] = $val; } } } else { $re_arr['data_info'] = $goods_data; } data_back($re_arr, '', RETURN_TYPE); //返回数据 } else { api_err('0x003', 'required date invalid'); //请求数据异常 } } /** * 获取站点信息接口函数 */ function search_site_info() { check_auth(); //检查基本权限 $version = '1.0'; //版本号 if ($_POST['api_version'] != $version) //网店的接口版本低 { api_err('0x008', 'a low version api'); } $sql = 'SELECT code, value'. ' FROM ' . $GLOBALS['ecs']->table('shop_config') . " WHERE code IN ('shop_name', 'service_phone')"; $siteinfo['data_info'] = $GLOBALS['db']->getRow($sql); $siteinfo['data_info']['site_address'] = $_SERVER['SERVER_NAME']; data_back($siteinfo, '', RETURN_TYPE); //返回数据 } /** * 权限校验函数 */ function check_auth() { $license = get_shop_license(); // 取出网店 license信息 if (empty($license['certificate_id']) || empty($license['token']) || empty($license['certi'])) { api_err('0x006', 'no certificate'); //没有证书数据,输出系统级错误:用户权限不够 } if (!check_shopex_ac($_POST, $license['token'])) { api_err('0x009'); //输出系统级错误:签名无效 } /* 对应用申请的session进行验证 */ $certi['certificate_id'] = $license['certificate_id']; // 网店证书ID $certi['app_id'] = 'ecshop_b2c'; // 说明客户端来源 $certi['app_instance_id'] = 'webcollect'; // 应用服务ID $certi['version'] = VERSION . '#' . RELEASE; // 网店软件版本号 $certi['format'] = 'json'; // 官方返回数据格式 $certi['certi_app'] = 'sess.valid_session'; // 证书方法 $certi['certi_session'] = $_POST['app_session']; //应用服务器申请的session值 $certi['certi_ac'] = make_shopex_ac($certi, $license['token']); // 网店验证字符串 $request_arr = exchange_shop_license($certi, $license); if ($request_arr['res'] != 'succ') { api_err('0x001', 'session is invalid'); //输出系统级错误:身份验证失败 } } /** * 验证POST签名 * * @param string $post_params POST传递参数 * @param string $token 证书加密码 * * @return boolean 返回是否有效 */ function check_shopex_ac($post_params,$token) { ksort($post_params); $str = ''; foreach($post_params as $key=>$value) { if ($key!='ac') { $str.=$value; } } if ($post_params['ac'] == md5($str.$token)) { return true; } else { return false; } } /** * 系统级错误处理 * * @param string $err_type 错误类型代号 * @param string $err_info 错误说明 * */ function api_err($err_type, $err_info = '') { /* 系统级错误列表 */ $err_arr = array(); $err_arr['0x001'] = 'Verify fail'; //身份验证失败 $err_arr['0x002'] = 'Time out'; //请求/执行超时 $err_arr['0x003'] = 'Data fail'; //数据异常 $err_arr['0x004'] = 'Db error'; //数据库执行失败 $err_arr['0x005'] = 'Service error'; //服务器导常 $err_arr['0x006'] = 'User permissions'; //用户权限不够 $err_arr['0x007'] = 'Service unavailable'; //服务不可用 $err_arr['0x008'] = 'Missing Method'; //方法不可用 $err_arr['0x009'] = 'Missing signature'; //签名无效 $err_arr['0x010'] = 'Missing api version'; //版本丢失 $err_arr['0x011'] = 'Api verion error'; //API版本异常 $err_arr['0x012'] = 'Api need update'; //API需要升级 $err_arr['0x013'] = 'Shop Error'; //网痁服务异常 $err_arr['0x014'] = 'Shop Space Error'; //网店空间不足 data_back($err_info == '' ? $err_arr[$err_type] : $err_info, $err_type, RETURN_TYPE, 'fail'); //回复请求以错误信息 } /** * 返回结果集 * * @param mixed $info 返回的有效数据集或是错误说明 * @param string $msg 为空或是错误类型代号 * @param string $result 请求成功或是失败的标识 * @param int $post 1为xml方式,2为json方式 * */ function data_back($info, $msg = '', $post, $result = 'success') { /* 分为xml和json两种方式 */ $data_arr = array('result'=>$result, 'msg'=>$msg, 'info'=>$info); $data_arr = to_utf8_iconv($data_arr); //确保传递的编码为UTF-8 if ($post == 1) { /* xml方式 */ if (class_exists('DOMDocument')) { $doc=new DOMDocument('1.0','UTF-8'); $doc->formatOutput=true; $shopex=$doc->createElement('shopex'); $doc->appendChild($shopex); $result=$doc->createElement('result'); $shopex->appendChild($result); $result->appendChild($doc->createCDATASection($data_arr['result'])); $msg=$doc->createElement('msg'); $shopex->appendChild($msg); $msg->appendChild($doc->createCDATASection($data_arr['msg'])); $info=$doc->createElement('info'); $shopex->appendChild($info); create_tree($doc, $info, $data_arr['info']); die($doc->saveXML()); } die('<?xml version="1.0" encoding="UTF-8"?>' . array2xml($data_arr)) ; } else { /* json方式 */ $json = new JSON; die($json->encode($data_arr)); //把生成的返回字符串打印出来 } } /** * 循环生成xml节点 * * @param handle $doc xml实例句柄 * @param handle $top 当前父节点 * @param array $info_arr 需要解析的数组 * @param boolean $have_item 是否是数据数组,是则需要在每条数据上加item父节点 * */ function create_tree($doc, $top, $info_arr, $have_item = false) { if (is_array($info_arr)) { foreach ($info_arr as $key => $val) { if (is_array($val)) { if ($have_item == false) { $data_info=$doc->createElement('data_info'); $top->appendChild($data_info); create_tree($doc, $data_info, $val, true); } else { $item=$doc->createElement('item'); $top->appendChild($item); $key_code = $doc->createAttribute('key'); $item->appendChild($key_code); $key_code->appendChild($doc->createTextNode($key)); create_tree($doc, $item, $val); } } else { $text_code=$doc->createElement($key); $top->appendChild($text_code); if (is_string($val)) { $text_code->appendChild($doc->createCDATASection($val)); } else { $text_code->appendChild($doc->createTextNode($val)); } } } } else { $top->appendChild($doc->createCDATASection($info_arr)); } } function array2xml($data,$root='shopex'){ $xml='<'.$root.'>'; _array2xml($data,$xml); $xml.='</'.$root.'>'; return $xml; } function _array2xml(&$data,&$xml){ if(is_array($data)){ foreach($data as $k=>$v){ if(is_numeric($k)){ $xml.='<item key="' . $k . '">'; $xml.=_array2xml($v,$xml); $xml.='</item>'; }else{ $xml.='<'.$k.'>'; $xml.=_array2xml($v,$xml); $xml.='</'.$k.'>'; } } }elseif(is_numeric($data)){ $xml.=$data; }elseif(is_string($data)){ $xml.='<![CDATA['.$data.']]>'; } } function create_goods_properties($goods_id) { /* 对属性进行重新排序和分组 $sql = "SELECT attr_group ". "FROM " . $GLOBALS['ecs']->table('goods_type') . " AS gt, " . $GLOBALS['ecs']->table('goods') . " AS g ". "WHERE g.goods_id='$goods_id' AND gt.cat_id=g.goods_type"; $grp = $GLOBALS['db']->getOne($sql); if (!empty($grp)) { $groups = explode("\n", strtr($grp, "\r", '')); } */ /* 获得商品的规格 */ $sql = "SELECT a.attr_id, a.attr_name, a.attr_group, a.is_linked, a.attr_type, ". "g.goods_attr_id, g.attr_value, g.attr_price " . 'FROM ' . $GLOBALS['ecs']->table('goods_attr') . ' AS g ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('attribute') . ' AS a ON a.attr_id = g.attr_id ' . "WHERE g.goods_id = '$goods_id' " . 'ORDER BY a.sort_order, g.attr_price, g.goods_attr_id'; $res = $GLOBALS['db']->getAll($sql); $arr = array(); $arr['props_name'] = array(); // props_name $arr['props'] = array(); // props foreach ($res AS $row) { if ($row['attr_type'] == 0) { //$group = (isset($groups[$row['attr_group']])) ? $groups[$row['attr_group']] : $GLOBALS['_LANG']['goods_attr']; //$arr['props_name'][$row['attr_group']]['name'] = $group; $arr['props_name'][] = array('name' => $row['attr_name'], 'value' => $row['attr_value']); $arr['props'][] = array('pid' => $row['attr_id'], 'vid' => $row['goods_attr_id']); } } return $arr; } ?>
zzshop
trunk/api.php
PHP
asf20
18,093
<?php /** * ECSHOP 程序说明 * =========================================================== * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ========================================================== * $Author: liuhui $ * $Id: goods_auto.php 17063 2010-03-25 06:35:46Z liuhui $ */ define('IN_ECS', true); require(dirname(__FILE__) . '/includes/init.php'); admin_priv('goods_auto'); $smarty->assign('thisfile', 'goods_auto.php'); if ($_REQUEST['act'] == 'list') { $goodsdb = get_auto_goods(); $crons_enable = $db->getOne("SELECT enable FROM " . $GLOBALS['ecs']->table('crons') . " WHERE cron_code='auto_manage'"); $smarty->assign('crons_enable', $crons_enable); $smarty->assign('full_page', 1); $smarty->assign('ur_here', $_LANG['goods_auto']); $smarty->assign('cfg_lang', $_CFG['lang']); $smarty->assign('goodsdb', $goodsdb['goodsdb']); $smarty->assign('filter', $goodsdb['filter']); $smarty->assign('record_count', $goodsdb['record_count']); $smarty->assign('page_count', $goodsdb['page_count']); assign_query_info(); $smarty->display('goods_auto.htm'); } elseif ($_REQUEST['act'] == 'query') { $goodsdb = get_auto_goods(); $smarty->assign('goodsdb', $goodsdb['goodsdb']); $smarty->assign('filter', $goodsdb['filter']); $smarty->assign('cfg_lang', $_CFG['lang']); $smarty->assign('record_count', $goodsdb['record_count']); $smarty->assign('page_count', $goodsdb['page_count']); $sort_flag = sort_flag($goodsdb['filter']); $smarty->assign($sort_flag['tag'], $sort_flag['img']); make_json_result($smarty->fetch('goods_auto.htm'), '', array('filter' => $goodsdb['filter'], 'page_count' => $goodsdb['page_count'])); } elseif ($_REQUEST['act'] == 'del') { $goods_id = (int)$_REQUEST['goods_id']; $sql = "DELETE FROM " . $ecs->table('auto_manage') . " WHERE item_id = '$goods_id' AND type = 'goods'"; $db->query($sql); $links[] = array('text' => $_LANG['goods_auto'], 'href' => 'goods_auto.php?act=list'); sys_msg($_LANG['edit_ok'], 0 ,$links); } elseif ($_REQUEST['act'] == 'edit_starttime') { check_authz_json('goods_auto'); if(! preg_match('/^\d{4}-\d{2}-\d{2}$/', trim($_POST['val'])) ) { make_json_error(''); } $id = intval($_POST['id']); $time = local_strtotime(trim($_POST['val'])); if($id <= 0 || $_POST['val'] == '0000-00-00' || $time <= 0) { make_json_error(''); } $db->autoReplace($ecs->table('auto_manage'), array('item_id' => $id,'type' => 'goods', 'starttime' => $time), array('starttime' =>(string)$time)); clear_cache_files(); make_json_result(stripslashes($_POST['val']), '', array('act' => 'goods_auto', 'id' => $id)); } elseif ($_REQUEST['act'] == 'edit_endtime') { check_authz_json('goods_auto'); if(! preg_match('/^\d{4}-\d{2}-\d{2}$/', trim($_POST['val'])) ) { make_json_error(''); } $id = intval($_POST['id']); $time = local_strtotime(trim($_POST['val'])); if($id <= 0 || $_POST['val'] == '0000-00-00' || $time <= 0) { make_json_error(''); } $db->autoReplace($ecs->table('auto_manage'), array('item_id' => $id,'type' => 'goods', 'endtime' => $time), array('endtime' =>(string)$time)); clear_cache_files(); make_json_result(stripslashes($_POST['val']), '', array('act' => 'goods_auto', 'id' => $id)); } //批量上架 elseif ($_REQUEST['act'] == 'batch_start') { admin_priv('goods_auto'); if (!isset($_POST['checkboxes']) || !is_array($_POST['checkboxes'])) { sys_msg($_LANG['no_select_goods'], 1); } if($_POST['date'] == '0000-00-00') { $_POST['date'] = 0; } else { $_POST['date'] = local_strtotime(trim($_POST['date'])); } foreach($_POST['checkboxes'] as $id) { $db->autoReplace($ecs->table('auto_manage'), array('item_id' => $id,'type' => 'goods', 'starttime' => $_POST['date']), array('starttime' =>(string)$_POST['date'])); } $lnk[] = array('text' => $_LANG['back_list'], 'href' => 'goods_auto.php?act=list'); sys_msg($_LANG['batch_start_succeed'], 0, $lnk); } //批量下架 elseif ($_REQUEST['act'] == 'batch_end') { admin_priv('goods_auto'); if (!isset($_POST['checkboxes']) || !is_array($_POST['checkboxes'])) { sys_msg($_LANG['no_select_goods'], 1); } if($_POST['date'] == '0000-00-00') { $_POST['date'] = 0; } else { $_POST['date'] = local_strtotime(trim($_POST['date'])); } foreach($_POST['checkboxes'] as $id) { $db->autoReplace($ecs->table('auto_manage'), array('item_id' => $id,'type' => 'goods', 'endtime' => $_POST['date']), array('endtime' =>(string)$_POST['date'])); } $lnk[] = array('text' => $_LANG['back_list'], 'href' => 'goods_auto.php?act=list'); sys_msg($_LANG['batch_end_succeed'], 0, $lnk); } function get_auto_goods() { $where = ' WHERE g.is_delete <> 1 '; if (!empty($_POST['goods_name'])) { $goods_name = trim($_POST['goods_name']); $where .= " AND g.goods_name LIKE '%$goods_name%'"; $filter['goods_name'] = $goods_name; } $result = get_filter(); if ($result === false) { $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'last_update' : trim($_REQUEST['sort_by']); $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']); $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('goods') . " g" . $where; $filter['record_count'] = $GLOBALS['db']->getOne($sql); /* 分页大小 */ $filter = page_and_size($filter); /* 查询 */ $sql = "SELECT g.*,a.starttime,a.endtime FROM " . $GLOBALS['ecs']->table('goods') . " g LEFT JOIN " . $GLOBALS['ecs']->table('auto_manage') . " a ON g.goods_id = a.item_id AND a.type='goods'" . $where . " ORDER by goods_id, " . $filter['sort_by'] . ' ' . $filter['sort_order'] . " LIMIT " . $filter['start'] . ",$filter[page_size]"; set_filter($filter, $sql); } else { $sql = $result['sql']; $filter = $result['filter']; } $query = $GLOBALS['db']->query($sql); $goodsdb = array(); while ($rt = $GLOBALS['db']->fetch_array($query)) { if (!empty($rt['starttime'])) { $rt['starttime'] = local_date('Y-m-d',$rt['starttime']); } if (!empty($rt['endtime'])) { $rt['endtime'] = local_date('Y-m-d',$rt['endtime']); } $goodsdb[] = $rt; } $arr = array('goodsdb' => $goodsdb, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']); return $arr; } ?>
zzshop
trunk/admin/goods_auto.php
PHP
asf20
7,410
<?php /** * ECSHOP 会员等级管理程序 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: user_rank.php 17063 2010-03-25 06:35:46Z liuhui $ */ define('IN_ECS', true); require(dirname(__FILE__) . '/includes/init.php'); $exc = new exchange($ecs->table("user_rank"), $db, 'rank_id', 'rank_name'); $exc_user = new exchange($ecs->table("users"), $db, 'user_rank', 'user_rank'); /*------------------------------------------------------ */ //-- 会员等级列表 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'list') { $ranks = array(); $ranks = $db->getAll("SELECT * FROM " .$ecs->table('user_rank')); $smarty->assign('ur_here', $_LANG['05_user_rank_list']); $smarty->assign('action_link', array('text' => $_LANG['add_user_rank'], 'href'=>'user_rank.php?act=add')); $smarty->assign('full_page', 1); $smarty->assign('user_ranks', $ranks); assign_query_info(); $smarty->display('user_rank.htm'); } /*------------------------------------------------------ */ //-- 翻页,排序 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'query') { $ranks = array(); $ranks = $db->getAll("SELECT * FROM " .$ecs->table('user_rank')); $smarty->assign('user_ranks', $ranks); make_json_result($smarty->fetch('user_rank.htm')); } /*------------------------------------------------------ */ //-- 添加会员等级 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'add') { admin_priv('user_rank'); $rank['rank_id'] = 0; $rank['rank_special'] = 0; $rank['show_price'] = 1; $rank['min_points'] = 0; $rank['max_points'] = 0; $rank['discount'] = 100; $form_action = 'insert'; $smarty->assign('rank', $rank); $smarty->assign('ur_here', $_LANG['add_user_rank']); $smarty->assign('action_link', array('text' => $_LANG['05_user_rank_list'], 'href'=>'user_rank.php?act=list')); $smarty->assign('ur_here', $_LANG['add_user_rank']); $smarty->assign('form_action', $form_action); assign_query_info(); $smarty->display('user_rank_info.htm'); } /*------------------------------------------------------ */ //-- 增加会员等级到数据库 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'insert') { admin_priv('user_rank'); $special_rank = isset($_POST['special_rank']) ? intval($_POST['special_rank']) : 0; $_POST['min_points'] = empty($_POST['min_points']) ? 0 : intval($_POST['min_points']); $_POST['max_points'] = empty($_POST['max_points']) ? 0 : intval($_POST['max_points']); /* 检查是否存在重名的会员等级 */ if (!$exc->is_only('rank_name', trim($_POST['rank_name']))) { sys_msg(sprintf($_LANG['rank_name_exists'], trim($_POST['rank_name'])), 1); } /* 非特殊会员组检查积分的上下限是否合理 */ if ($_POST['min_points'] >= $_POST['max_points'] && $special_rank == 0) { sys_msg($_LANG['js_languages']['integral_max_small'], 1); } /* 特殊等级会员组不判断积分限制 */ if ($special_rank == 0) { /* 检查下限制有无重复 */ if (!$exc->is_only('min_points', intval($_POST['min_points']))) { sys_msg(sprintf($_LANG['integral_min_exists'], intval($_POST['min_points']))); } } /* 特殊等级会员组不判断积分限制 */ if ($special_rank == 0) { /* 检查上限有无重复 */ if (!$exc->is_only('max_points', intval($_POST['max_points']))) { sys_msg(sprintf($_LANG['integral_max_exists'], intval($_POST['max_points']))); } } $sql = "INSERT INTO " .$ecs->table('user_rank') ."( ". "rank_name, min_points, max_points, discount, special_rank, show_price". ") VALUES (". "'$_POST[rank_name]', '" .intval($_POST['min_points']). "', '" .intval($_POST['max_points']). "', ". "'$_POST[discount]', '$special_rank', '" .intval($_POST['show_price']). "')"; $db->query($sql); /* 管理员日志 */ admin_log(trim($_POST['rank_name']), 'add', 'user_rank'); clear_cache_files(); $lnk[] = array('text' => $_LANG['back_list'], 'href'=>'user_rank.php?act=list'); $lnk[] = array('text' => $_LANG['add_continue'], 'href'=>'user_rank.php?act=add'); sys_msg($_LANG['add_rank_success'], 0, $lnk); } /*------------------------------------------------------ */ //-- 删除会员等级 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'remove') { check_authz_json('user_rank'); $rank_id = intval($_GET['id']); if ($exc->drop($rank_id)) { /* 更新会员表的等级字段 */ $exc_user->edit("user_rank = 0", $rank_id); $rank_name = $exc->get_name($rank_id); admin_log(addslashes($rank_name), 'remove', 'user_rank'); clear_cache_files(); } $url = 'user_rank.php?act=query&' . str_replace('act=remove', '', $_SERVER['QUERY_STRING']); ecs_header("Location: $url\n"); exit; } /* * 编辑会员等级名称 */ elseif ($_REQUEST['act'] == 'edit_name') { $id = intval($_REQUEST['id']); $val = empty($_REQUEST['val']) ? '' : json_str_iconv(trim($_REQUEST['val'])); check_authz_json('user_rank'); if ($exc->is_only('rank_name', $val, $id)) { if ($exc->edit("rank_name = '$val'", $id)) { /* 管理员日志 */ admin_log($val, 'edit', 'user_rank'); clear_cache_files(); make_json_result(stripcslashes($val)); } else { make_json_error($db->error()); } } else { make_json_error(sprintf($_LANG['rank_name_exists'], htmlspecialchars($val))); } } /* * ajax编辑积分下限 */ elseif ($_REQUEST['act'] == 'edit_min_points') { check_authz_json('user_rank'); $rank_id = empty($_REQUEST['id']) ? 0 : intval($_REQUEST['id']); $val = empty($_REQUEST['val']) ? 0 : intval($_REQUEST['val']); $rank = $db->getRow("SELECT max_points, special_rank FROM " . $ecs->table('user_rank') . " WHERE rank_id = '$rank_id'"); if ($val >= $rank['max_points'] && $rank['special_rank'] == 0) { make_json_error($_LANG['js_languages']['integral_max_small']); } if ($rank['special_rank'] ==0 && !$exc->is_only('min_points', $val, $rank_id)) { make_json_error(sprintf($_LANG['integral_min_exists'], $val)); } if ($exc->edit("min_points = '$val'", $rank_id)) { $rank_name = $exc->get_name($rank_id); admin_log(addslashes($rank_name), 'edit', 'user_rank'); make_json_result($val); } else { make_json_error($db->error()); } } /* * ajax修改积分上限 */ elseif ($_REQUEST['act'] == 'edit_max_points') { check_authz_json('user_rank'); $rank_id = empty($_REQUEST['id']) ? 0 : intval($_REQUEST['id']); $val = empty($_REQUEST['val']) ? 0 : intval($_REQUEST['val']); $rank = $db->getRow("SELECT min_points, special_rank FROM " . $ecs->table('user_rank') . " WHERE rank_id = '$rank_id'"); if ($val <= $rank['min_points'] && $rank['special_rank'] == 0) { make_json_error($_LANG['js_languages']['integral_max_small']); } if ($rank['special_rank'] ==0 && !$exc->is_only('max_points', $val, $rank_id)) { make_json_error(sprintf($_LANG['integral_max_exists'], $val)); } if ($exc->edit("max_points = '$val'", $rank_id)) { $rank_name = $exc->get_name($rank_id); admin_log(addslashes($rank_name), 'edit', 'user_rank'); make_json_result($val); } else { make_json_error($db->error()); } } /* * 修改折扣率 */ elseif ($_REQUEST['act'] == 'edit_discount') { check_authz_json('user_rank'); $rank_id = empty($_REQUEST['id']) ? 0 : intval($_REQUEST['id']); $val = empty($_REQUEST['val']) ? 0 : intval($_REQUEST['val']); if ($val < 1 || $val > 100) { make_json_error($_LANG['js_languages']['discount_invalid']); } if ($exc->edit("discount = '$val'", $rank_id)) { $rank_name = $exc->get_name($rank_id); admin_log(addslashes($rank_name), 'edit', 'user_rank'); clear_cache_files(); make_json_result($val); } else { make_json_error($val); } } /*------------------------------------------------------ */ //-- 切换是否是特殊会员组 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'toggle_special') { check_authz_json('user_rank'); $rank_id = intval($_POST['id']); $is_special = intval($_POST['val']); if ($exc->edit("special_rank = '$is_special'", $rank_id)) { $rank_name = $exc->get_name($rank_id); admin_log(addslashes($rank_name), 'edit', 'user_rank'); make_json_result($is_special); } else { make_json_error($db->error()); } } /*------------------------------------------------------ */ //-- 切换是否显示价格 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'toggle_showprice') { check_authz_json('user_rank'); $rank_id = intval($_POST['id']); $is_show = intval($_POST['val']); if ($exc->edit("show_price = '$is_show'", $rank_id)) { $rank_name = $exc->get_name($rank_id); admin_log(addslashes($rank_name), 'edit', 'user_rank'); clear_cache_files(); make_json_result($is_show); } else { make_json_error($db->error()); } } ?>
zzshop
trunk/admin/user_rank.php
PHP
asf20
10,634
<?php /** * ECSHOP 客户统计 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: guest_stats.php 17063 2010-03-25 06:35:46Z liuhui $ */ define('IN_ECS', true); require(dirname(__FILE__) . '/includes/init.php'); require_once(ROOT_PATH . 'includes/lib_order.php'); require_once(ROOT_PATH . 'languages/' .$_CFG['lang']. '/admin/statistic.php'); /* act操作项的初始化 */ if (empty($_REQUEST['act'])) { $_REQUEST['act'] = 'list'; } else { $_REQUEST['act'] = trim($_REQUEST['act']); } /*------------------------------------------------------ */ //-- 客户统计列表 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'list') { /* 权限判断 */ admin_priv('client_flow_stats'); /* 取得会员总数 */ $users =& init_users(); $sql = "SELECT COUNT(*) FROM " . $ecs->table("users"); $res = $db->getCol($sql); $user_num = $res[0]; /* 计算订单各种费用之和的语句 */ $total_fee = " SUM(" . order_amount_field() . ") AS turnover "; /* 有过订单的会员数 */ $sql = 'SELECT COUNT(DISTINCT user_id) FROM ' .$ecs->table('order_info'). " WHERE user_id > 0 " . order_query_sql('finished'); $have_order_usernum = $db->getOne($sql); /* 会员订单总数和订单总购物额 */ $user_all_order = array(); $sql = "SELECT COUNT(*) AS order_num, " . $total_fee. "FROM " .$ecs->table('order_info'). " WHERE user_id > 0 " . order_query_sql('finished'); $user_all_order = $db->getRow($sql); $user_all_order['turnover'] = floatval($user_all_order['turnover']); /* 匿名会员订单总数和总购物额 */ $guest_all_order = array(); $sql = "SELECT COUNT(*) AS order_num, " . $total_fee. "FROM " .$ecs->table('order_info'). " WHERE user_id = 0 " . order_query_sql('finished'); $guest_all_order = $db->getRow($sql); /* 匿名会员平均订单额: 购物总额/订单数 */ $guest_order_amount = ($guest_all_order['order_num'] > 0) ? floatval($guest_all_order['turnover'] / $guest_all_order['order_num']) : '0.00'; $_GET['flag'] = isset($_GET['flag']) ? 'download' : ''; if($_GET['flag'] == 'download') { $filename = ecs_iconv(EC_CHARSET, 'GB2312', $_LANG['guest_statistics']); header("Content-type: application/vnd.ms-excel; charset=utf-8"); header("Content-Disposition: attachment; filename=$filename.xls"); /* 生成会员购买率 */ $data = $_LANG['percent_buy_member'] . "\t\n"; $data .= $_LANG['member_count'] . "\t" . $_LANG['order_member_count'] . "\t" . $_LANG['member_order_count'] . "\t" . $_LANG['percent_buy_member'] . "\n"; $data .= $user_num . "\t" . $have_order_usernum . "\t" . $user_all_order['order_num'] . "\t" . sprintf("%0.2f", ($user_num > 0 ? $have_order_usernum / $user_num : 0) * 100) . "\n\n"; /* 每会员平均订单数及购物额 */ $data .= $_LANG['order_turnover_peruser'] . "\t\n"; $data .= $_LANG['member_sum'] . "\t" . $_LANG['average_member_order'] . "\t" . $_LANG['member_order_sum'] . "\n"; $ave_user_ordernum = $user_num > 0 ? sprintf("%0.2f", $user_all_order['order_num'] / $user_num) : 0; $ave_user_turnover = $user_num > 0 ? price_format($user_all_order['turnover'] / $user_num) : 0; $data .= price_format($user_all_order['turnover']) . "\t" . $ave_user_ordernum . "\t" . $ave_user_turnover . "\n\n"; /* 每会员平均订单数及购物额 */ $data .= $_LANG['order_turnover_percus'] . "\t\n"; $data .= $_LANG['guest_member_orderamount'] . "\t" . $_LANG['guest_member_ordercount'] . "\t" . $_LANG['guest_order_sum'] . "\n"; $order_num = $guest_all_order['order_num'] > 0 ? price_format($guest_all_order['turnover'] / $guest_all_order['order_num']) : 0; $data .= price_format($guest_all_order['turnover']) . "\t" . $guest_all_order['order_num'] . "\t" . $order_num; echo ecs_iconv(EC_CHARSET, 'GB2312', $data) . "\t"; exit; } /* 赋值到模板 */ $smarty->assign('user_num', $user_num); // 会员总数 $smarty->assign('have_order_usernum', $have_order_usernum); // 有过订单的会员数 $smarty->assign('user_order_turnover', $user_all_order['order_num']); // 会员总订单数 $smarty->assign('user_all_turnover', price_format($user_all_order['turnover'])); //会员购物总额 $smarty->assign('guest_all_turnover', price_format($guest_all_order['turnover'])); //匿名会员购物总额 $smarty->assign('guest_order_num', $guest_all_order['order_num']); //匿名会员订单总数 /* 每会员订单数 */ $smarty->assign('ave_user_ordernum', $user_num > 0 ? sprintf("%0.2f", $user_all_order['order_num'] / $user_num) : 0); /* 每会员购物额 */ $smarty->assign('ave_user_turnover', $user_num > 0 ? price_format($user_all_order['turnover'] / $user_num) : 0); /* 注册会员购买率 */ $smarty->assign('user_ratio', sprintf("%0.2f", ($user_num > 0 ? $have_order_usernum / $user_num : 0) * 100)); /* 匿名会员平均订单额 */ $smarty->assign('guest_order_amount', $guest_all_order['order_num'] > 0 ? price_format($guest_all_order['turnover'] / $guest_all_order['order_num']) : 0); $smarty->assign('all_order', $user_all_order); //所有订单总数以及所有购物总额 $smarty->assign('ur_here', $_LANG['report_guest']); $smarty->assign('lang', $_LANG); $smarty->assign('action_link', array('text' => $_LANG['down_guest_stats'], 'href'=>'guest_stats.php?flag=download')); assign_query_info(); $smarty->display('guest_stats.htm'); } ?>
zzshop
trunk/admin/guest_stats.php
PHP
asf20
6,566
<?php /** * ECSHOP 会员管理程序 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: users.php 17063 2010-03-25 06:35:46Z liuhui $ */ define('IN_ECS', true); require(dirname(__FILE__) . '/includes/init.php'); /*------------------------------------------------------ */ //-- 用户帐号列表 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'list') { /* 检查权限 */ admin_priv('users_manage'); $sql = "SELECT rank_id, rank_name, min_points FROM ".$ecs->table('user_rank')." ORDER BY min_points ASC "; $rs = $db->query($sql); $ranks = array(); while ($row = $db->FetchRow($rs)) { $ranks[$row['rank_id']] = $row['rank_name']; } $smarty->assign('user_ranks', $ranks); $smarty->assign('ur_here', $_LANG['03_users_list']); $smarty->assign('action_link', array('text' => $_LANG['04_users_add'], 'href'=>'users.php?act=add')); $user_list = user_list(); $smarty->assign('user_list', $user_list['user_list']); $smarty->assign('filter', $user_list['filter']); $smarty->assign('record_count', $user_list['record_count']); $smarty->assign('page_count', $user_list['page_count']); $smarty->assign('full_page', 1); $smarty->assign('sort_user_id', '<img src="images/sort_desc.gif">'); assign_query_info(); $smarty->display('users_list.htm'); } /*------------------------------------------------------ */ //-- ajax返回用户列表 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'query') { $user_list = user_list(); $smarty->assign('user_list', $user_list['user_list']); $smarty->assign('filter', $user_list['filter']); $smarty->assign('record_count', $user_list['record_count']); $smarty->assign('page_count', $user_list['page_count']); $sort_flag = sort_flag($user_list['filter']); $smarty->assign($sort_flag['tag'], $sort_flag['img']); make_json_result($smarty->fetch('users_list.htm'), '', array('filter' => $user_list['filter'], 'page_count' => $user_list['page_count'])); } /*------------------------------------------------------ */ //-- 添加会员帐号 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'add') { /* 检查权限 */ admin_priv('users_manage'); $user = array( 'rank_points' => $_CFG['register_points'], 'pay_points' => $_CFG['register_points'], 'sex' => 0, 'credit_line' => 0 ); /* 取出注册扩展字段 */ $sql = 'SELECT * FROM ' . $ecs->table('reg_fields') . ' WHERE type < 2 AND display = 1 AND id != 6 ORDER BY dis_order, id'; $extend_info_list = $db->getAll($sql); $smarty->assign('extend_info_list', $extend_info_list); $smarty->assign('ur_here', $_LANG['04_users_add']); $smarty->assign('action_link', array('text' => $_LANG['03_users_list'], 'href'=>'users.php?act=list')); $smarty->assign('form_action', 'insert'); $smarty->assign('user', $user); $smarty->assign('special_ranks', get_rank_list(true)); assign_query_info(); $smarty->display('user_info.htm'); } /*------------------------------------------------------ */ //-- 添加会员帐号 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'insert') { /* 检查权限 */ admin_priv('users_manage'); $username = empty($_POST['username']) ? '' : trim($_POST['username']); $password = empty($_POST['password']) ? '' : trim($_POST['password']); $email = empty($_POST['email']) ? '' : trim($_POST['email']); $sex = empty($_POST['sex']) ? 0 : intval($_POST['sex']); $sex = in_array($sex, array(0, 1, 2)) ? $sex : 0; $birthday = $_POST['birthdayYear'] . '-' . $_POST['birthdayMonth'] . '-' . $_POST['birthdayDay']; $rank = empty($_POST['user_rank']) ? 0 : intval($_POST['user_rank']); $credit_line = empty($_POST['credit_line']) ? 0 : floatval($_POST['credit_line']); $users =& init_users(); if (!$users->add_user($username, $password, $email)) { /* 插入会员数据失败 */ if ($users->error == ERR_INVALID_USERNAME) { $msg = $_LANG['username_invalid']; } elseif ($users->error == ERR_USERNAME_NOT_ALLOW) { $msg = $_LANG['username_not_allow']; } elseif ($users->error == ERR_USERNAME_EXISTS) { $msg = $_LANG['username_exists']; } elseif ($users->error == ERR_INVALID_EMAIL) { $msg = $_LANG['email_invalid']; } elseif ($users->error == ERR_EMAIL_NOT_ALLOW) { $msg = $_LANG['email_not_allow']; } elseif ($users->error == ERR_EMAIL_EXISTS) { $msg = $_LANG['email_exists']; } else { //die('Error:'.$users->error_msg()); } sys_msg($msg, 1); } /* 注册送积分 */ if (!empty($GLOBALS['_CFG']['register_points'])) { log_account_change($_SESSION['user_id'], 0, 0, $GLOBALS['_CFG']['register_points'], $GLOBALS['_CFG']['register_points'], $_LANG['register_points']); } /*把新注册用户的扩展信息插入数据库*/ $sql = 'SELECT id FROM ' . $ecs->table('reg_fields') . ' WHERE type = 0 AND display = 1 ORDER BY dis_order, id'; //读出所有扩展字段的id $fields_arr = $db->getAll($sql); $extend_field_str = ''; //生成扩展字段的内容字符串 $user_id_arr = $users->get_profile_by_name($username); foreach ($fields_arr AS $val) { $extend_field_index = 'extend_field' . $val['id']; if(!empty($_POST[$extend_field_index])) { $temp_field_content = strlen($_POST[$extend_field_index]) > 100 ? mb_substr($_POST[$extend_field_index], 0, 99) : $_POST[$extend_field_index]; $extend_field_str .= " ('" . $user_id_arr['user_id'] . "', '" . $val['id'] . "', '" . $temp_field_content . "'),"; } } $extend_field_str = substr($extend_field_str, 0, -1); if ($extend_field_str) //插入注册扩展数据 { $sql = 'INSERT INTO '. $ecs->table('reg_extend_info') . ' (`user_id`, `reg_field_id`, `content`) VALUES' . $extend_field_str; $db->query($sql); } /* 更新会员的其它信息 */ $other = array(); $other['credit_line'] = $credit_line; $other['user_rank'] = $rank; $other['sex'] = $sex; $other['birthday'] = $birthday; $other['reg_time'] = local_strtotime(local_date('Y-m-d H:i:s')); $other['msn'] = isset($_POST['extend_field1']) ? htmlspecialchars(trim($_POST['extend_field1'])) : ''; $other['qq'] = isset($_POST['extend_field2']) ? htmlspecialchars(trim($_POST['extend_field2'])) : ''; $other['office_phone'] = isset($_POST['extend_field3']) ? htmlspecialchars(trim($_POST['extend_field3'])) : ''; $other['home_phone'] = isset($_POST['extend_field4']) ? htmlspecialchars(trim($_POST['extend_field4'])) : ''; $other['mobile_phone'] = isset($_POST['extend_field5']) ? htmlspecialchars(trim($_POST['extend_field5'])) : ''; $db->autoExecute($ecs->table('users'), $other, 'UPDATE', "user_name = '$username'"); /* 记录管理员操作 */ admin_log($_POST['username'], 'add', 'users'); /* 提示信息 */ $link[] = array('text' => $_LANG['go_back'], 'href'=>'users.php?act=list'); sys_msg(sprintf($_LANG['add_success'], htmlspecialchars(stripslashes($_POST['username']))), 0, $link); } /*------------------------------------------------------ */ //-- 编辑用户帐号 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'edit') { /* 检查权限 */ admin_priv('users_manage'); $sql = "SELECT u.user_name, u.sex, u.birthday, u.pay_points, u.rank_points, u.user_rank , u.user_money, u.frozen_money, u.credit_line, u.parent_id, u2.user_name as parent_username, u.qq, u.msn, u.office_phone, u.home_phone, u.mobile_phone". " FROM " .$ecs->table('users'). " u LEFT JOIN " . $ecs->table('users') . " u2 ON u.parent_id = u2.user_id WHERE u.user_id='$_GET[id]'"; $row = $db->GetRow($sql); $row['user_name'] = addslashes($row['user_name']); $users =& init_users(); $user = $users->get_user_info($row['user_name']); $sql = "SELECT u.user_id, u.sex, u.birthday, u.pay_points, u.rank_points, u.user_rank , u.user_money, u.frozen_money, u.credit_line, u.parent_id, u2.user_name as parent_username, u.qq, u.msn, u.office_phone, u.home_phone, u.mobile_phone". " FROM " .$ecs->table('users'). " u LEFT JOIN " . $ecs->table('users') . " u2 ON u.parent_id = u2.user_id WHERE u.user_id='$_GET[id]'"; $row = $db->GetRow($sql); if ($row) { $user['user_id'] = $row['user_id']; $user['sex'] = $row['sex']; $user['birthday'] = date($row['birthday']); $user['pay_points'] = $row['pay_points']; $user['rank_points'] = $row['rank_points']; $user['user_rank'] = $row['user_rank']; $user['user_money'] = $row['user_money']; $user['frozen_money'] = $row['frozen_money']; $user['credit_line'] = $row['credit_line']; $user['formated_user_money'] = price_format($row['user_money']); $user['formated_frozen_money'] = price_format($row['frozen_money']); $user['parent_id'] = $row['parent_id']; $user['parent_username']= $row['parent_username']; $user['qq'] = $row['qq']; $user['msn'] = $row['msn']; $user['office_phone'] = $row['office_phone']; $user['home_phone'] = $row['home_phone']; $user['mobile_phone'] = $row['mobile_phone']; } else { $user['sex'] = 0; $user['pay_points'] = 0; $user['rank_points'] = 0; $user['user_money'] = 0; $user['frozen_money'] = 0; $user['credit_line'] = 0; $user['formated_user_money'] = price_format(0); $user['formated_frozen_money'] = price_format(0); } /* 取出注册扩展字段 */ $sql = 'SELECT * FROM ' . $ecs->table('reg_fields') . ' WHERE type < 2 AND display = 1 AND id != 6 ORDER BY dis_order, id'; $extend_info_list = $db->getAll($sql); $sql = 'SELECT reg_field_id, content ' . 'FROM ' . $ecs->table('reg_extend_info') . " WHERE user_id = $user[user_id]"; $extend_info_arr = $db->getAll($sql); $temp_arr = array(); foreach ($extend_info_arr AS $val) { $temp_arr[$val['reg_field_id']] = $val['content']; } foreach ($extend_info_list AS $key => $val) { switch ($val['id']) { case 1: $extend_info_list[$key]['content'] = $user['msn']; break; case 2: $extend_info_list[$key]['content'] = $user['qq']; break; case 3: $extend_info_list[$key]['content'] = $user['office_phone']; break; case 4: $extend_info_list[$key]['content'] = $user['home_phone']; break; case 5: $extend_info_list[$key]['content'] = $user['mobile_phone']; break; default: $extend_info_list[$key]['content'] = empty($temp_arr[$val['id']]) ? '' : $temp_arr[$val['id']] ; } } $smarty->assign('extend_info_list', $extend_info_list); /* 当前会员推荐信息 */ $affiliate = unserialize($GLOBALS['_CFG']['affiliate']); $smarty->assign('affiliate', $affiliate); empty($affiliate) && $affiliate = array(); if(empty($affiliate['config']['separate_by'])) { //推荐注册分成 $affdb = array(); $num = count($affiliate['item']); $up_uid = "'$_GET[id]'"; for ($i = 1 ; $i <=$num ;$i++) { $count = 0; if ($up_uid) { $sql = "SELECT user_id FROM " . $ecs->table('users') . " WHERE parent_id IN($up_uid)"; $query = $db->query($sql); $up_uid = ''; while ($rt = $db->fetch_array($query)) { $up_uid .= $up_uid ? ",'$rt[user_id]'" : "'$rt[user_id]'"; $count++; } } $affdb[$i]['num'] = $count; } if ($affdb[1]['num'] > 0) { $smarty->assign('affdb', $affdb); } } assign_query_info(); $smarty->assign('ur_here', $_LANG['users_edit']); $smarty->assign('action_link', array('text' => $_LANG['03_users_list'], 'href'=>'users.php?act=list&' . list_link_postfix())); $smarty->assign('user', $user); $smarty->assign('form_action', 'update'); $smarty->assign('special_ranks', get_rank_list(true)); $smarty->display('user_info.htm'); } /*------------------------------------------------------ */ //-- 更新用户帐号 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'update') { /* 检查权限 */ admin_priv('users_manage'); $username = empty($_POST['username']) ? '' : trim($_POST['username']); $password = empty($_POST['password']) ? '' : trim($_POST['password']); $email = empty($_POST['email']) ? '' : trim($_POST['email']); $sex = empty($_POST['sex']) ? 0 : intval($_POST['sex']); $sex = in_array($sex, array(0, 1, 2)) ? $sex : 0; $birthday = $_POST['birthdayYear'] . '-' . $_POST['birthdayMonth'] . '-' . $_POST['birthdayDay']; $rank = empty($_POST['user_rank']) ? 0 : intval($_POST['user_rank']); $credit_line = empty($_POST['credit_line']) ? 0 : floatval($_POST['credit_line']); $users =& init_users(); if (!$users->edit_user(array('username'=>$username, 'password'=>$password, 'email'=>$email, 'gender'=>$sex, 'bday'=>$birthday ), 1)) { if ($users->error == ERR_EMAIL_EXISTS) { $msg = $_LANG['email_exists']; } else { $msg = $_LANG['edit_user_failed']; } sys_msg($msg, 1); } /* 更新用户扩展字段的数据 */ $sql = 'SELECT id FROM ' . $ecs->table('reg_fields') . ' WHERE type = 0 AND display = 1 ORDER BY dis_order, id'; //读出所有扩展字段的id $fields_arr = $db->getAll($sql); $user_id_arr = $users->get_profile_by_name($username); $user_id = $user_id_arr['user_id']; foreach ($fields_arr AS $val) //循环更新扩展用户信息 { $extend_field_index = 'extend_field' . $val['id']; if(isset($_POST[$extend_field_index])) { $temp_field_content = strlen($_POST[$extend_field_index]) > 100 ? mb_substr($_POST[$extend_field_index], 0, 99) : $_POST[$extend_field_index]; $sql = 'SELECT * FROM ' . $ecs->table('reg_extend_info') . " WHERE reg_field_id = '$val[id]' AND user_id = '$user_id'"; if ($db->getOne($sql)) //如果之前没有记录,则插入 { $sql = 'UPDATE ' . $ecs->table('reg_extend_info') . " SET content = '$temp_field_content' WHERE reg_field_id = '$val[id]' AND user_id = '$user_id'"; } else { $sql = 'INSERT INTO '. $ecs->table('reg_extend_info') . " (`user_id`, `reg_field_id`, `content`) VALUES ('$user_id', '$val[id]', '$temp_field_content')"; } $db->query($sql); } } /* 更新会员的其它信息 */ $other = array(); $other['credit_line'] = $credit_line; $other['user_rank'] = $rank; $other['msn'] = isset($_POST['extend_field1']) ? htmlspecialchars(trim($_POST['extend_field1'])) : ''; $other['qq'] = isset($_POST['extend_field2']) ? htmlspecialchars(trim($_POST['extend_field2'])) : ''; $other['office_phone'] = isset($_POST['extend_field3']) ? htmlspecialchars(trim($_POST['extend_field3'])) : ''; $other['home_phone'] = isset($_POST['extend_field4']) ? htmlspecialchars(trim($_POST['extend_field4'])) : ''; $other['mobile_phone'] = isset($_POST['extend_field5']) ? htmlspecialchars(trim($_POST['extend_field5'])) : ''; $db->autoExecute($ecs->table('users'), $other, 'UPDATE', "user_name = '$username'"); /* 记录管理员操作 */ admin_log($username, 'edit', 'users'); /* 提示信息 */ $links[0]['text'] = $_LANG['goto_list']; $links[0]['href'] = 'users.php?act=list&' . list_link_postfix(); $links[1]['text'] = $_LANG['go_back']; $links[1]['href'] = 'javascript:history.back()'; sys_msg($_LANG['update_success'], 0, $links); } /*------------------------------------------------------ */ //-- 批量删除会员帐号 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'batch_remove') { /* 检查权限 */ admin_priv('users_drop'); if (isset($_POST['checkboxes'])) { $sql = "SELECT user_name FROM " . $ecs->table('users') . " WHERE user_id " . db_create_in($_POST['checkboxes']); $col = $db->getCol($sql); $usernames = implode(',',addslashes_deep($col)); $count = count($col); /* 通过插件来删除用户 */ $users =& init_users(); $users->remove_user($col); admin_log($usernames, 'batch_remove', 'users'); $lnk[] = array('text' => $_LANG['go_back'], 'href'=>'users.php?act=list'); sys_msg(sprintf($_LANG['batch_remove_success'], $count), 0, $lnk); } else { $lnk[] = array('text' => $_LANG['go_back'], 'href'=>'users.php?act=list'); sys_msg($_LANG['no_select_user'], 0, $lnk); } } /* 编辑用户名 */ elseif ($_REQUEST['act'] == 'edit_username') { /* 检查权限 */ check_authz_json('users_manage'); $username = empty($_REQUEST['val']) ? '' : json_str_iconv(trim($_REQUEST['val'])); $id = empty($_REQUEST['id']) ? 0 : intval($_REQUEST['id']); if ($id == 0) { make_json_error('NO USER ID'); return; } if ($username == '') { make_json_error($GLOBALS['_LANG']['username_empty']); return; } $users =& init_users(); if ($users->edit_user($id, $username)) { if ($_CFG['integrate_code'] != 'ecshop') { /* 更新商城会员表 */ $db->query('UPDATE ' .$ecs->table('users'). " SET user_name = '$username' WHERE user_id = '$id'"); } admin_log(addslashes($username), 'edit', 'users'); make_json_result(stripcslashes($username)); } else { $msg = ($users->error == ERR_USERNAME_EXISTS) ? $GLOBALS['_LANG']['username_exists'] : $GLOBALS['_LANG']['edit_user_failed']; make_json_error($msg); } } /*------------------------------------------------------ */ //-- 编辑email /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'edit_email') { /* 检查权限 */ check_authz_json('users_manage'); $id = empty($_REQUEST['id']) ? 0 : intval($_REQUEST['id']); $email = empty($_REQUEST['val']) ? '' : json_str_iconv(trim($_REQUEST['val'])); $users =& init_users(); $sql = "SELECT user_name FROM " . $ecs->table('users') . " WHERE user_id = '$id'"; $username = $db->getOne($sql); if (is_email($email)) { if ($users->edit_user(array('username'=>$username, 'email'=>$email))) { admin_log(addslashes($username), 'edit', 'users'); make_json_result(stripcslashes($email)); } else { $msg = ($users->error == ERR_EMAIL_EXISTS) ? $GLOBALS['_LANG']['email_exists'] : $GLOBALS['_LANG']['edit_user_failed']; make_json_error($msg); } } else { make_json_error($GLOBALS['_LANG']['invalid_email']); } } /*------------------------------------------------------ */ //-- 删除会员帐号 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'remove') { /* 检查权限 */ admin_priv('users_drop'); $sql = "SELECT user_name FROM " . $ecs->table('users') . " WHERE user_id = '" . $_GET['id'] . "'"; $username = $db->getOne($sql); /* 通过插件来删除用户 */ $users =& init_users(); $users->remove_user($username); //已经删除用户所有数据 /* 记录管理员操作 */ admin_log(addslashes($username), 'remove', 'users'); /* 提示信息 */ $link[] = array('text' => $_LANG['go_back'], 'href'=>'users.php?act=list'); sys_msg(sprintf($_LANG['remove_success'], $username), 0, $link); } /*------------------------------------------------------ */ //-- 收货地址查看 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'address_list') { $id = isset($_GET['id']) ? intval($_GET['id']) : 0; $sql = "SELECT a.*, c.region_name AS country_name, p.region_name AS province, ct.region_name AS city_name, d.region_name AS district_name ". " FROM " .$ecs->table('user_address'). " as a ". " LEFT JOIN " . $ecs->table('region') . " AS c ON c.region_id = a.country " . " LEFT JOIN " . $ecs->table('region') . " AS p ON p.region_id = a.province " . " LEFT JOIN " . $ecs->table('region') . " AS ct ON ct.region_id = a.city " . " LEFT JOIN " . $ecs->table('region') . " AS d ON d.region_id = a.district " . " WHERE user_id='$id'"; $address = $db->getAll($sql); $smarty->assign('address', $address); assign_query_info(); $smarty->assign('ur_here', $_LANG['address_list']); $smarty->assign('action_link', array('text' => $_LANG['03_users_list'], 'href'=>'users.php?act=list&' . list_link_postfix())); $smarty->display('user_address_list.htm'); } /*------------------------------------------------------ */ //-- 脱离推荐关系 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'remove_parent') { /* 检查权限 */ admin_priv('users_manage'); $sql = "UPDATE " . $ecs->table('users') . " SET parent_id = 0 WHERE user_id = '" . $_GET['id'] . "'"; $db->query($sql); /* 记录管理员操作 */ $sql = "SELECT user_name FROM " . $ecs->table('users') . " WHERE user_id = '" . $_GET['id'] . "'"; $username = $db->getOne($sql); admin_log(addslashes($username), 'edit', 'users'); /* 提示信息 */ $link[] = array('text' => $_LANG['go_back'], 'href'=>'users.php?act=list'); sys_msg(sprintf($_LANG['update_success'], $username), 0, $link); } /*------------------------------------------------------ */ //-- 查看用户推荐会员列表 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'aff_list') { /* 检查权限 */ admin_priv('users_manage'); $smarty->assign('ur_here', $_LANG['03_users_list']); $auid = $_GET['auid']; $user_list['user_list'] = array(); $affiliate = unserialize($GLOBALS['_CFG']['affiliate']); $smarty->assign('affiliate', $affiliate); empty($affiliate) && $affiliate = array(); $num = count($affiliate['item']); $up_uid = "'$auid'"; $all_count = 0; for ($i = 1; $i<=$num; $i++) { $count = 0; if ($up_uid) { $sql = "SELECT user_id FROM " . $ecs->table('users') . " WHERE parent_id IN($up_uid)"; $query = $db->query($sql); $up_uid = ''; while ($rt = $db->fetch_array($query)) { $up_uid .= $up_uid ? ",'$rt[user_id]'" : "'$rt[user_id]'"; $count++; } } $all_count += $count; if ($count) { $sql = "SELECT user_id, user_name, '$i' AS level, email, is_validated, user_money, frozen_money, rank_points, pay_points, reg_time ". " FROM " . $GLOBALS['ecs']->table('users') . " WHERE user_id IN($up_uid)" . " ORDER by level, user_id"; $user_list['user_list'] = array_merge($user_list['user_list'], $db->getAll($sql)); } } $temp_count = count($user_list['user_list']); for ($i=0; $i<$temp_count; $i++) { $user_list['user_list'][$i]['reg_time'] = local_date($_CFG['date_format'], $user_list['user_list'][$i]['reg_time']); } $user_list['record_count'] = $all_count; $smarty->assign('user_list', $user_list['user_list']); $smarty->assign('record_count', $user_list['record_count']); $smarty->assign('full_page', 1); $smarty->assign('action_link', array('text' => $_LANG['back_note'], 'href'=>"users.php?act=edit&id=$auid")); assign_query_info(); $smarty->display('affiliate_list.htm'); } /** * 返回用户列表数据 * * @access public * @param * * @return void */ function user_list() { $result = get_filter(); if ($result === false) { /* 过滤条件 */ $filter['keywords'] = empty($_REQUEST['keywords']) ? '' : trim($_REQUEST['keywords']); if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) { $filter['keywords'] = json_str_iconv($filter['keywords']); } $filter['rank'] = empty($_REQUEST['rank']) ? 0 : intval($_REQUEST['rank']); $filter['pay_points_gt'] = empty($_REQUEST['pay_points_gt']) ? 0 : intval($_REQUEST['pay_points_gt']); $filter['pay_points_lt'] = empty($_REQUEST['pay_points_lt']) ? 0 : intval($_REQUEST['pay_points_lt']); $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'user_id' : trim($_REQUEST['sort_by']); $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']); $ex_where = ' WHERE 1 '; if ($filter['keywords']) { $ex_where .= " AND user_name LIKE '%" . mysql_like_quote($filter['keywords']) ."%'"; } if ($filter['rank']) { $sql = "SELECT min_points, max_points, special_rank FROM ".$GLOBALS['ecs']->table('user_rank')." WHERE rank_id = '$filter[rank]'"; $row = $GLOBALS['db']->getRow($sql); if ($row['special_rank'] > 0) { /* 特殊等级 */ $ex_where .= " AND user_rank = '$filter[rank]' "; } else { $ex_where .= " AND rank_points >= " . intval($row['min_points']) . " AND rank_points < " . intval($row['max_points']); } } if ($filter['pay_points_gt']) { $ex_where .=" AND pay_points >= '$filter[pay_points_gt]' "; } if ($filter['pay_points_lt']) { $ex_where .=" AND pay_points < '$filter[pay_points_lt]' "; } $filter['record_count'] = $GLOBALS['db']->getOne("SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('users') . $ex_where); /* 分页大小 */ $filter = page_and_size($filter); $sql = "SELECT user_id, user_name, email, is_validated, user_money, frozen_money, rank_points, pay_points, reg_time ". " FROM " . $GLOBALS['ecs']->table('users') . $ex_where . " ORDER by " . $filter['sort_by'] . ' ' . $filter['sort_order'] . " LIMIT " . $filter['start'] . ',' . $filter['page_size']; $filter['keywords'] = stripslashes($filter['keywords']); set_filter($filter, $sql); } else { $sql = $result['sql']; $filter = $result['filter']; } $user_list = $GLOBALS['db']->getAll($sql); $count = count($user_list); for ($i=0; $i<$count; $i++) { $user_list[$i]['reg_time'] = local_date($GLOBALS['_CFG']['date_format'], $user_list[$i]['reg_time']); } $arr = array('user_list' => $user_list, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']); return $arr; } ?>
zzshop
trunk/admin/users.php
PHP
asf20
29,317
<?php /** * ECSHOP * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: captcha_manage.php 17063 2010-03-25 06:35:46Z liuhui $ */ define('IN_ECS', true); require(dirname(__FILE__) . '/includes/init.php'); /* 检查权限 */ admin_priv('shop_config'); /*------------------------------------------------------ */ //-- 验证码设置 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'main') { if (gd_version() == 0) { sys_msg($_LANG['captcha_note'], 1); } assign_query_info(); $captcha = intval($_CFG['captcha']); $captcha_check = array(); if ($captcha & CAPTCHA_REGISTER) { $captcha_check['register'] = 'checked="checked"'; } if ($captcha & CAPTCHA_LOGIN) { $captcha_check['login'] = 'checked="checked"'; } if ($captcha & CAPTCHA_COMMENT) { $captcha_check['comment'] = 'checked="checked"'; } if ($captcha & CAPTCHA_ADMIN) { $captcha_check['admin'] = 'checked="checked"'; } if ($captcha & CAPTCHA_MESSAGE) { $captcha_check['message'] = 'checked="checked"'; } if ($captcha & CAPTCHA_LOGIN_FAIL) { $captcha_check['login_fail_yes'] = 'checked="checked"'; } else { $captcha_check['login_fail_no'] = 'checked="checked"'; } $smarty->assign('captcha', $captcha_check); $smarty->assign('captcha_width', $_CFG['captcha_width']); $smarty->assign('captcha_height', $_CFG['captcha_height']); $smarty->assign('ur_here', $_LANG['captcha_manage']); $smarty->display('captcha_manage.htm'); } /*------------------------------------------------------ */ //-- 保存设置 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'save_config') { $captcha = 0; $captcha = empty($_POST['captcha_register']) ? $captcha : $captcha | CAPTCHA_REGISTER; $captcha = empty($_POST['captcha_login']) ? $captcha : $captcha | CAPTCHA_LOGIN; $captcha = empty($_POST['captcha_comment']) ? $captcha : $captcha | CAPTCHA_COMMENT; $captcha = empty($_POST['captcha_tag']) ? $captcha : $captcha | CAPTCHA_TAG; $captcha = empty($_POST['captcha_admin']) ? $captcha : $captcha | CAPTCHA_ADMIN; $captcha = empty($_POST['captcha_login_fail']) ? $captcha : $captcha | CAPTCHA_LOGIN_FAIL; $captcha = empty($_POST['captcha_message']) ? $captcha : $captcha | CAPTCHA_MESSAGE; $captcha_width = empty($_POST['captcha_width']) ? 145 : intval($_POST['captcha_width']); $captcha_height = empty($_POST['captcha_height']) ? 20 : intval($_POST['captcha_height']); $sql = "UPDATE " . $ecs->table('shop_config') . " SET value='$captcha' WHERE code='captcha'"; $db->query($sql); $sql = "UPDATE " . $ecs->table('shop_config') . " SET value='$captcha_width' WHERE code='captcha_width'"; $db->query($sql); $sql = "UPDATE " . $ecs->table('shop_config') . " SET value='$captcha_height' WHERE code='captcha_height'"; $db->query($sql); clear_cache_files(); sys_msg($_LANG['save_ok'], 0, array(array('href'=>'captcha_manage.php?act=main', 'text'=>$_LANG['captcha_manage']))); } ?>
zzshop
trunk/admin/captcha_manage.php
PHP
asf20
3,906
<?php /** * ECSHOP 记录管理员操作日志 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: admin_logs.php 17063 2010-03-25 06:35:46Z liuhui $ */ define('IN_ECS', true); require(dirname(__FILE__) . '/includes/init.php'); /* act操作项的初始化 */ if (empty($_REQUEST['act'])) { $_REQUEST['act'] = 'list'; } else { $_REQUEST['act'] = trim($_REQUEST['act']); } /*------------------------------------------------------ */ //-- 获取所有日志列表 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'list') { /* 权限的判断 */ admin_priv('logs_manage'); $user_id = !empty($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; $admin_ip = !empty($_REQUEST['ip']) ? $_REQUEST['ip'] : ''; $log_date = !empty($_REQUEST['log_date']) ? $_REQUEST['log_date'] : ''; /* 查询IP地址列表 */ $ip_list = array(); $res = $db->query("SELECT DISTINCT ip_address FROM " .$ecs->table('admin_log')); while ($row = $db->FetchRow($res)) { $ip_list[$row['ip_address']] = $row['ip_address']; } $smarty->assign('ur_here', $_LANG['admin_logs']); $smarty->assign('ip_list', $ip_list); $smarty->assign('full_page', 1); $log_list = get_admin_logs(); $smarty->assign('log_list', $log_list['list']); $smarty->assign('filter', $log_list['filter']); $smarty->assign('record_count', $log_list['record_count']); $smarty->assign('page_count', $log_list['page_count']); $sort_flag = sort_flag($log_list['filter']); $smarty->assign($sort_flag['tag'], $sort_flag['img']); assign_query_info(); $smarty->display('admin_logs.htm'); } /*------------------------------------------------------ */ //-- 排序、分页、查询 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'query') { $log_list = get_admin_logs(); $smarty->assign('log_list', $log_list['list']); $smarty->assign('filter', $log_list['filter']); $smarty->assign('record_count', $log_list['record_count']); $smarty->assign('page_count', $log_list['page_count']); $sort_flag = sort_flag($log_list['filter']); $smarty->assign($sort_flag['tag'], $sort_flag['img']); make_json_result($smarty->fetch('admin_logs.htm'), '', array('filter' => $log_list['filter'], 'page_count' => $log_list['page_count'])); } /*------------------------------------------------------ */ //-- 批量删除日志记录 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'batch_drop') { admin_priv('logs_drop'); $drop_type_date = isset($_POST['drop_type_date']) ? $_POST['drop_type_date'] : ''; /* 按日期删除日志 */ if ($drop_type_date) { if ($_POST['log_date'] == '0') { ecs_header("Location: admin_logs.php?act=list\n"); exit; } elseif ($_POST['log_date'] > '0') { $where = " WHERE 1 "; switch ($_POST['log_date']) { case '1': $a_week = gmtime()-(3600 * 24 * 7); $where .= " AND log_time <= '".$a_week."'"; break; case '2': $a_month = gmtime()-(3600 * 24 * 30); $where .= " AND log_time <= '".$a_month."'"; break; case '3': $three_month = gmtime()-(3600 * 24 * 90); $where .= " AND log_time <= '".$three_month."'"; break; case '4': $half_year = gmtime()-(3600 * 24 * 180); $where .= " AND log_time <= '".$half_year."'"; break; case '5': $a_year = gmtime()-(3600 * 24 * 365); $where .= " AND log_time <= '".$a_year."'"; break; } $sql = "DELETE FROM " .$ecs->table('admin_log').$where; $res = $db->query($sql); if ($res) { admin_log('','remove', 'adminlog'); $link[] = array('text' => $_LANG['back_list'], 'href' => 'admin_logs.php?act=list'); sys_msg($_LANG['drop_sueeccud'], 1, $link); } } } /* 如果不是按日期来删除, 就按ID删除日志 */ else { $count = 0; foreach ($_POST['checkboxes'] AS $key => $id) { $sql = "DELETE FROM " .$ecs->table('admin_log'). " WHERE log_id = '$id'"; $result = $db->query($sql); $count++; } if ($result) { admin_log('', 'remove', 'adminlog'); $link[] = array('text' => $_LANG['back_list'], 'href' => 'admin_logs.php?act=list'); sys_msg(sprintf($_LANG['batch_drop_success'], $count), 0, $link); } } } /* 获取管理员操作记录 */ function get_admin_logs() { $user_id = !empty($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; $admin_ip = !empty($_REQUEST['ip']) ? $_REQUEST['ip'] : ''; $filter = array(); $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'al.log_id' : trim($_REQUEST['sort_by']); $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']); //查询条件 $where = " WHERE 1 "; if (!empty($user_id)) { $where .= " AND al.user_id = '$user_id' "; } elseif (!empty($admin_ip)) { $where .= " AND al.ip_address = '$admin_ip' "; } /* 获得总记录数据 */ $sql = 'SELECT COUNT(*) FROM ' .$GLOBALS['ecs']->table('admin_log'). ' AS al ' . $where; $filter['record_count'] = $GLOBALS['db']->getOne($sql); $filter = page_and_size($filter); /* 获取管理员日志记录 */ $list = array(); $sql = 'SELECT al.*, u.user_name FROM ' .$GLOBALS['ecs']->table('admin_log'). ' AS al '. 'LEFT JOIN ' .$GLOBALS['ecs']->table('admin_user'). ' AS u ON u.user_id = al.user_id '. $where .' ORDER by '.$filter['sort_by'].' '.$filter['sort_order']; $res = $GLOBALS['db']->selectLimit($sql, $filter['page_size'], $filter['start']); while ($rows = $GLOBALS['db']->fetchRow($res)) { $rows['log_time'] = local_date($GLOBALS['_CFG']['time_format'], $rows['log_time']); $list[] = $rows; } return array('list' => $list, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']); } ?>
zzshop
trunk/admin/admin_logs.php
PHP
asf20
7,372
<?php /** * ECSHOP 管理中心商店设置 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: sxc_shop $ * $Id: shop_config.php 17074 2010-03-26 10:38:21Z sxc_shop $ */ define('IN_ECS', true); /* 代码 */ require(dirname(__FILE__) . '/includes/init.php'); if($GLOBALS['_CFG']['certificate_id'] == '') { $certi_id='error'; } else { $certi_id=$GLOBALS['_CFG']['certificate_id']; } $sess_id = $GLOBALS['sess']->get_session_id(); $auth = mktime(); $ac = md5($certi_id.'SHOPEX_SMS'.$auth); $url = 'http://service.shopex.cn/sms/index.php?certificate_id='.$certi_id.'&sess_id='.$sess_id.'&auth='.$auth.'&ac='.$ac; /*------------------------------------------------------ */ //-- 列表编辑 ?act=list_edit /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'list_edit') { /* 检查权限 */ admin_priv('shop_config'); /* 可选语言 */ $dir = opendir('../languages'); $lang_list = array(); while (@$file = readdir($dir)) { if ($file != '.' && $file != '..' && $file != '.svn' && $file != '_svn' && is_dir('../languages/' .$file)) { $lang_list[] = $file; } } @closedir($dir); $smarty->assign('lang_list', $lang_list); $smarty->assign('ur_here', $_LANG['01_shop_config']); $smarty->assign('group_list', get_settings(null, array('5'))); $smarty->assign('countries', get_regions()); if (strpos(strtolower($_SERVER['SERVER_SOFTWARE']), 'iis') !== false) { $rewrite_confirm = $_LANG['rewrite_confirm_iis']; } else { $rewrite_confirm = $_LANG['rewrite_confirm_apache']; } $smarty->assign('rewrite_confirm', $rewrite_confirm); if ($_CFG['shop_country'] > 0) { $smarty->assign('provinces', get_regions(1, $_CFG['shop_country'])); if ($_CFG['shop_province']) { $smarty->assign('cities', get_regions(2, $_CFG['shop_province'])); } } $smarty->assign('cfg', $_CFG); assign_query_info(); $smarty->display('shop_config.htm'); } /*------------------------------------------------------ */ //-- 邮件服务器设置 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'mail_settings') { /* 检查权限 */ admin_priv('shop_config'); $arr = get_settings(array(5)); assign_query_info(); $smarty->assign('ur_here', $_LANG['mail_settings']); $smarty->assign('cfg', $arr[5]['vars']); $smarty->display('shop_config_mail_settings.htm'); } /*------------------------------------------------------ */ //-- 提交 ?act=post /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'post') { $type = empty($_POST['type']) ? '' : $_POST['type']; /* 检查权限 */ admin_priv('shop_config'); /* 允许上传的文件类型 */ $allow_file_types = '|GIF|JPG|PNG|BMP|SWF|DOC|XLS|PPT|MID|WAV|ZIP|RAR|PDF|CHM|RM|TXT|CERT|'; /* 保存变量值 */ $count = count($_POST['value']); $arr = array(); $sql = 'SELECT id, value FROM ' . $ecs->table('shop_config'); $res= $db->query($sql); while($row = $db->fetchRow($res)) { $arr[$row['id']] = $row['value']; } foreach ($_POST['value'] AS $key => $val) { if($arr[$key] != $val) { $sql = "UPDATE " . $ecs->table('shop_config') . " SET value = '" . trim($val) . "' WHERE id = '" . $key . "'"; $db->query($sql); } } /* 处理上传文件 */ $file_var_list = array(); $sql = "SELECT * FROM " . $ecs->table('shop_config') . " WHERE parent_id > 0 AND type = 'file'"; $res = $db->query($sql); while ($row = $db->fetchRow($res)) { $file_var_list[$row['code']] = $row; } foreach ($_FILES AS $code => $file) { /* 判断用户是否选择了文件 */ if ((isset($file['error']) && $file['error'] == 0) || (!isset($file['error']) && $file['tmp_name'] != 'none')) { /* 检查上传的文件类型是否合法 */ if (!check_file_type($file['tmp_name'], $file['name'], $allow_file_types)) { sys_msg(sprintf($_LANG['msg_invalid_file'], $file['name'])); } else { if ($code == 'shop_logo') { include_once('includes/lib_template.php'); $info = get_template_info($_CFG['template']); $file_name = str_replace('{$template}', $_CFG['template'], $file_var_list[$code]['store_dir']) . $info['logo']; } elseif ($code == 'watermark') { $ext = array_pop(explode('.', $file['name'])); $file_name = $file_var_list[$code]['store_dir'] . 'watermark.' . $ext; if (file_exists($file_var_list[$code]['value'])) { @unlink($file_var_list[$code]['value']); } } elseif($code == 'wap_logo') { $ext = array_pop(explode('.', $file['name'])); $file_name = $file_var_list[$code]['store_dir'] . 'wap_logo.' . $ext; if (file_exists($file_var_list[$code]['value'])) { @unlink($file_var_list[$code]['value']); } } else { $file_name = $file_var_list[$code]['store_dir'] . $file['name']; } /* 判断是否上传成功 */ if (move_upload_file($file['tmp_name'], $file_name)) { $sql = "UPDATE " . $ecs->table('shop_config') . " SET value = '$file_name' WHERE code = '$code'"; $db->query($sql); } else { sys_msg(sprintf($_LANG['msg_upload_failed'], $file['name'], $file_var_list[$code]['store_dir'])); } } } } /* 处理发票类型及税率 */ if (!empty($_POST['invoice_rate'])) { foreach ($_POST['invoice_rate'] as $key => $rate) { $rate = round(floatval($rate), 2); if ($rate < 0) { $rate = 0; } $_POST['invoice_rate'][$key] = $rate; } $invoice = array( 'type' => $_POST['invoice_type'], 'rate' => $_POST['invoice_rate'] ); $sql = "UPDATE " . $ecs->table('shop_config') . " SET value = '" . serialize($invoice) . "' WHERE code = 'invoice_type'"; $db->query($sql); } /* 记录日志 */ admin_log('', 'edit', 'shop_config'); /* 清除缓存 */ clear_all_files(); $_CFG = load_config(); $shop_country = $db->getOne("SELECT region_name FROM ".$ecs->table('region')." WHERE region_id='$_CFG[shop_country]'"); $shop_province = $db->getOne("SELECT region_name FROM ".$ecs->table('region')." WHERE region_id='$_CFG[shop_province]'"); $shop_city = $db->getOne("SELECT region_name FROM ".$ecs->table('region')." WHERE region_id='$_CFG[shop_city]'"); $spt = '<script type="text/javascript" src="http://api.ecshop.com/record.php?'; $spt .= "url=" .urlencode($ecs->url()); $spt .= "&shop_name=" .urlencode($_CFG['shop_name']); $spt .= "&shop_title=".urlencode($_CFG['shop_title']); $spt .= "&shop_desc=" .urlencode($_CFG['shop_desc']); $spt .= "&shop_keywords=" .urlencode($_CFG['shop_keywords']); $spt .= "&country=".urlencode($shop_country)."&province=".urlencode($shop_province)."&city=".urlencode($shop_city); $spt .= "&address=" .urlencode($_CFG['shop_address']); $spt .= "&qq=$_CFG[qq]&ww=$_CFG[ww]&ym=$_CFG[ym]&msn=$_CFG[msn]"; $spt .= "&email=$_CFG[service_email]&phone=$_CFG[service_phone]&icp=".urlencode($_CFG['icp_number']); $spt .= "&version=".VERSION."&language=$_CFG[lang]&php_ver=" .PHP_VERSION. "&mysql_ver=" .$db->version(); $spt .= "&charset=".EC_CHARSET; $spt .= '"></script>'; if ($type == 'mail_setting') { $links[] = array('text' => $_LANG['back_mail_settings'], 'href' => 'shop_config.php?act=mail_settings'); sys_msg($_LANG['mail_save_success'].$spt, 0, $links); } else { $links[] = array('text' => $_LANG['back_shop_config'], 'href' => 'shop_config.php?act=list_edit'); sys_msg($_LANG['save_success'].$spt, 0, $links); } } /*------------------------------------------------------ */ //-- 发送测试邮件 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'send_test_email') { /* 检查权限 */ check_authz_json('shop_config'); /* 取得参数 */ $email = trim($_POST['email']); /* 更新配置 */ $_CFG['mail_service'] = intval($_POST['mail_service']); $_CFG['smtp_host'] = trim($_POST['smtp_host']); $_CFG['smtp_port'] = trim($_POST['smtp_port']); $_CFG['smtp_user'] = json_str_iconv(trim($_POST['smtp_user'])); $_CFG['smtp_pass'] = trim($_POST['smtp_pass']); $_CFG['smtp_mail'] = trim($_POST['reply_email']); $_CFG['mail_charset'] = trim($_POST['mail_charset']); if (send_mail('', $email, $_LANG['test_mail_title'], $_LANG['cfg_name']['email_content'], 0)) { make_json_result('', $_LANG['sendemail_success'] . $email); } else { make_json_error(join("\n", $err->_message)); } } /*------------------------------------------------------ */ //-- 删除上传文件 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'del') { /* 检查权限 */ check_authz_json('shop_config'); /* 取得参数 */ $code = trim($_GET['code']); $filename = $_CFG[$code]; //删除文件 @unlink($filename); //更新设置 update_configure($code, ''); /* 记录日志 */ admin_log('', 'edit', 'shop_config'); /* 清除缓存 */ clear_all_files(); sys_msg($_LANG['save_success'], 0); } /** * 设置系统设置 * * @param string $key * @param string $val * * @return boolean */ function update_configure($key, $val='') { if (!empty($key)) { $sql = "UPDATE " . $GLOBALS['ecs']->table('shop_config') . " SET value='$val' WHERE code='$key'"; return $GLOBALS['db']->query($sql); } return true; } /** * 获得设置信息 * * @param array $groups 需要获得的设置组 * @param array $excludes 不需要获得的设置组 * * @return array */ function get_settings($groups=null, $excludes=null) { global $db, $ecs, $_LANG; $config_groups = ''; $excludes_groups = ''; if (!empty($groups)) { foreach ($groups AS $key=>$val) { $config_groups .= " AND (id='$val' OR parent_id='$val')"; } } if (!empty($excludes)) { foreach ($excludes AS $key=>$val) { $excludes_groups .= " AND (parent_id<>'$val' AND id<>'$val')"; } } /* 取出全部数据:分组和变量 */ $sql = "SELECT * FROM " . $ecs->table('shop_config') . " WHERE type<>'hidden' $config_groups $excludes_groups ORDER BY parent_id, sort_order, id"; $item_list = $db->getAll($sql); /* 整理数据 */ $group_list = array(); foreach ($item_list AS $key => $item) { $pid = $item['parent_id']; $item['name'] = isset($_LANG['cfg_name'][$item['code']]) ? $_LANG['cfg_name'][$item['code']] : $item['code']; $item['desc'] = isset($_LANG['cfg_desc'][$item['code']]) ? $_LANG['cfg_desc'][$item['code']] : ''; if ($item['code'] == 'sms_shop_mobile') { $item['url'] = 1; } if ($pid == 0) { /* 分组 */ if ($item['type'] == 'group') { $group_list[$item['id']] = $item; } } else { /* 变量 */ if (isset($group_list[$pid])) { if ($item['store_range']) { $item['store_options'] = explode(',', $item['store_range']); foreach ($item['store_options'] AS $k => $v) { $item['display_options'][$k] = isset($_LANG['cfg_range'][$item['code']][$v]) ? $_LANG['cfg_range'][$item['code']][$v] : $v; } } $group_list[$pid]['vars'][] = $item; } } } return $group_list; } ?>
zzshop
trunk/admin/shop_config.php
PHP
asf20
13,708
<?php /** * ECSHOP 程序说明 * =========================================================== * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ========================================================== * $Author: liuhui $ * $Id: search_log.php 17063 2010-03-25 06:35:46Z liuhui $ */ define('IN_ECS', true); require(dirname(__FILE__) . '/includes/init.php'); $_REQUEST['act'] = trim($_REQUEST['act']); admin_priv('search_log'); if ($_REQUEST['act'] == 'list') { $logdb = get_search_log(); $smarty->assign('ur_here', $_LANG['search_log']); $smarty->assign('full_page', 1); $smarty->assign('logdb', $logdb['logdb']); $smarty->assign('filter', $logdb['filter']); $smarty->assign('record_count', $logdb['record_count']); $smarty->assign('page_count', $logdb['page_count']); $smarty->assign('start_date', local_date('Y-m-d')); $smarty->assign('end_date', local_date('Y-m-d')); assign_query_info(); $smarty->display('search_log_list.htm'); } elseif ($_REQUEST['act'] == 'query') { $logdb = get_search_log(); $smarty->assign('full_page', 0); $smarty->assign('logdb', $logdb['logdb']); $smarty->assign('filter', $logdb['filter']); $smarty->assign('record_count', $logdb['record_count']); $smarty->assign('page_count', $logdb['page_count']); $smarty->assign('start_date', local_date('Y-m-d')); $smarty->assign('end_date', local_date('Y-m-d')); make_json_result($smarty->fetch('search_log_list.htm'), '', array('filter' => $logdb['filter'], 'page_count' => $logdb['page_count'])); } function get_search_log() { $where = ''; if (isset($_REQUEST['start_dateYear']) && isset($_REQUEST['end_dateYear'])) { $start_date = $_POST['start_dateYear']. '-' .$_POST['start_dateMonth']. '-' .$_POST['start_dateDay']; $end_date = $_POST['end_dateYear']. '-' .$_POST['end_dateMonth']. '-' .$_POST['end_dateDay']; $where .= " AND date <= '$end_date' AND date >= '$start_date'"; $filter['start_dateYear'] = $_REQUEST['start_dateYear']; $filter['start_dateMonth'] = $_REQUEST['start_dateMonth']; $filter['start_dateDay'] = $_REQUEST['start_dateDay']; $filter['end_dateYear'] = $_REQUEST['end_dateYear']; $filter['end_dateMonth'] = $_REQUEST['end_dateMonth']; $filter['end_dateDay'] = $_REQUEST['end_dateDay']; } $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('keywords') . " WHERE searchengine='ecshop' $where"; $filter['record_count'] = $GLOBALS['db']->getOne($sql); $logdb = array(); $filter = page_and_size($filter); $sql = "SELECT * FROM " . $GLOBALS['ecs']->table('keywords') . " WHERE searchengine='ecshop' $where" . " ORDER BY date DESC, count DESC" . " LIMIT $filter[start],$filter[page_size]"; $query = $GLOBALS['db']->query($sql); while ($rt = $GLOBALS['db']->fetch_array($query)) { $logdb[] = $rt; } $arr = array('logdb' => $logdb, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']); return $arr; } ?>
zzshop
trunk/admin/search_log.php
PHP
asf20
3,607
<?php /** * ECSHOP 短信模块 之 控制器 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: yehuaixiao $ * $Id: sms.php 17155 2010-05-06 06:29:05Z yehuaixiao $ */ define('IN_ECS', true); require(dirname(__FILE__) . '/includes/init.php'); require_once(ROOT_PATH . 'includes/cls_sms.php'); $action = isset($_REQUEST['act']) ? $_REQUEST['act'] : 'display_my_info'; $sms = new sms(); switch ($action) { // /* 注册短信服务。*/ // case 'register' : // $email = isset($_POST['email']) ? $_POST['email'] : ''; // $password = isset($_POST['password']) ? $_POST['password'] : ''; // $domain = isset($_POST['domain']) ? $_POST['domain'] : ''; // $phone = isset($_POST['phone']) ? $_POST['phone'] : ''; // // $result = $sms->register($email, $password, $domain, $phone); // // $link[] = array('text' => $_LANG['back'], // 'href' => 'sms.php?act=display_my_info'); // // if ($result === true)//注册成功 // { // sys_msg($_LANG['register_ok'], 0, $link); // } // else // { // @$error_detail = $_LANG['server_errors'][$sms->errors['server_errors']['error_no']] // . $_LANG['api_errors']['register'][$sms->errors['api_errors']['error_no']]; // sys_msg($_LANG['register_error'] . $error_detail, 1, $link); // } // // break; // // /* 启用短信服务。 */ // case 'enable' : // $username = isset($_POST['email']) ? $_POST['email'] : ''; // //由于md5函数对空串也加密,所以要进行判空操作 // $password = isset($_POST['password']) && $_POST['password'] !== '' // ? md5($_POST['password']) // : ''; // // $result = $sms->restore($username, $password); // // $link[] = array('text' => $_LANG['back'], // 'href' => 'sms.php?act=display_my_info'); // // if ($result === true)//启用成功 // { // sys_msg($_LANG['enable_ok'], 0, $link); // } // else // { // @$error_detail = $_LANG['server_errors'][$sms->errors['server_errors']['error_no']] // . $_LANG['api_errors']['auth'][$sms->errors['api_errors']['error_no']]; // sys_msg($_LANG['enable_error'] . $error_detail, 1, $link); // } // // break; // // /* 注销短信特服信息 */ // case 'disable' : // $result = $sms->clear_my_info(); // // $link[] = array('text' => $_LANG['back'], // 'href' => 'sms.php?act=display_my_info'); // // if ($result === true)//注销成功 // { // sys_msg($_LANG['disable_ok'], 0, $link); // } // else // { // sys_msg($_LANG['disable_error'], 1, $link); // } // // break; /* 显示短信发送界面,如果尚未注册或启用短信服务则显示注册界面。 */ case 'display_send_ui' : /* 检查权限 */ admin_priv('sms_send'); if ($sms->has_registered()) { $smarty->assign('ur_here', $_LANG['03_sms_send']); $special_ranks = get_rank_list(); $send_rank['1_0'] = $_LANG['user_list']; foreach($special_ranks as $rank_key => $rank_value) { $send_rank['2_' . $rank_key] = $rank_value; } assign_query_info(); $smarty->assign('send_rank', $send_rank); $smarty->display('sms_send_ui.htm'); } else { $smarty->assign('ur_here', $_LANG['register_sms']); $smarty->assign('sms_site_info', $sms->get_site_info()); assign_query_info(); $smarty->display('sms_register_ui.htm'); } break; /* 发送短信 */ case 'send_sms' : $send_num = isset($_POST['send_num']) ? $_POST['send_num'] : ''; if(isset($send_num)) { $phone = $send_num.','; } $send_rank = isset($_POST['send_rank']) ? $_POST['send_rank'] : 0; if ($send_rank != 0) { $rank_array = explode('_', $send_rank); if($rank_array['0'] == 1) { $sql = 'SELECT mobile_phone FROM ' . $ecs->table('users') . "WHERE mobile_phone <>'' "; $row = $db->query($sql); while ($rank_rs = $db->fetch_array($row)) { $value[] = $rank_rs['mobile_phone']; } } else { $rank_sql = "SELECT * FROM " . $ecs->table('user_rank') . " WHERE rank_id = '" . $rank_array['1'] . "'"; $rank_row = $db->getRow($rank_sql); //$sql = 'SELECT mobile_phone FROM ' . $ecs->table('users') . "WHERE mobile_phone <>'' AND rank_points > " .$rank_row['min_points']." AND rank_points < ".$rank_row['max_points']." "; if($rank_row['special_rank']==1) { $sql = 'SELECT mobile_phone FROM ' . $ecs->table('users') . " WHERE mobile_phone <>'' AND user_rank = '" . $rank_array['1'] . "'"; } else { $sql = 'SELECT mobile_phone FROM ' . $ecs->table('users') . "WHERE mobile_phone <>'' AND rank_points > " .$rank_row['min_points']." AND rank_points < ".$rank_row['max_points']." "; } $row = $db->query($sql); while ($rank_rs = $db->fetch_array($row)) { $value[] = $rank_rs['mobile_phone']; } } if(isset($value)) { $phone .= implode(',',$value); } } $msg = isset($_POST['msg']) ? $_POST['msg'] : ''; $send_date = isset($_POST['send_date']) ? $_POST['send_date'] : ''; $result = $sms->send($phone, $msg, $send_date, $send_num = 13); $link[] = array('text' => $_LANG['back'] . $_LANG['03_sms_send'], 'href' => 'sms.php?act=display_send_ui'); if ($result === true)//发送成功 { sys_msg($_LANG['send_ok'], 0, $link); } else { @$error_detail = $_LANG['server_errors'][$sms->errors['server_errors']['error_no']] . $_LANG['api_errors']['send'][$sms->errors['api_errors']['error_no']]; sys_msg($_LANG['send_error'] . $error_detail, 1, $link); } break; // /* 显示发送记录的查询界面,如果尚未注册或启用短信服务则显示注册界面。 */ // case 'display_send_history_ui' : // /* 检查权限 */ // admin_priv('send_history'); // if ($sms->has_registered()) // { // $smarty->assign('ur_here', $_LANG['05_sms_send_history']); // assign_query_info(); // $smarty->display('sms_send_history_query_ui.htm'); // } // else // { // $smarty->assign('ur_here', $_LANG['register_sms']); // $smarty->assign('sms_site_info', $sms->get_site_info()); // assign_query_info(); // $smarty->display('sms_register_ui.htm'); // } // // break; // // /* 获得发送记录,如果客户端支持XSLT,则直接发送XML格式的文本到客户端; // 否则在服务器端把XML转换成XHTML后发送到客户端。 // */ // case 'get_send_history' : // $start_date = isset($_POST['start_date']) ? $_POST['start_date'] : ''; // $end_date = isset($_POST['end_date']) ? $_POST['end_date'] : ''; // $page_size = isset($_POST['page_size']) ? $_POST['page_size'] : 20; // $page = isset($_POST['page']) ? $_POST['page'] : 1; // // $is_xslt_supported = isset($_POST['is_xslt_supported']) ? $_POST['is_xslt_supported'] : 'no'; // if ($is_xslt_supported === 'yes') // { // $xml = $sms->get_send_history_by_xml($start_date, $end_date, $page_size, $page); // header('Content-Type: application/xml; charset=utf-8'); // //TODO:判断错误信息,链上XSLT // echo $xml; // } // else // { // $result = $sms->get_send_history($start_date, $end_date, $page_size, $page); // // if ($result !== false) // { // $smarty->assign('sms_send_history', $result); // $smarty->assign('ur_here', $_LANG['05_sms_send_history']); // // /* 分页信息 */ // $turn_page = array( 'total_records' => $result['count'], // 'total_pages' => intval(ceil($result['count']/$page_size)), // 'page' => $page, // 'page_size' => $page_size); // $smarty->assign('turn_page', $turn_page); // $smarty->assign('start_date', $start_date); // $smarty->assign('end_date', $end_date); // // assign_query_info(); // // $smarty->display('sms_send_history.htm'); // } // else // { // $link[] = array('text' => $_LANG['back_send_history'], // 'href' => 'sms.php?act=display_send_history_ui'); // // @$error_detail = $_LANG['server_errors'][$sms->errors['server_errors']['error_no']] // . $_LANG['api_errors']['get_history'][$sms->errors['api_errors']['error_no']]; // // sys_msg($_LANG['history_query_error'] . $error_detail, 1, $link); // } // } // // break; // // /* 显示充值页面 */ // case 'display_charge_ui' : // /* 检查权限 */ // admin_priv('sms_charge'); // if ($sms->has_registered()) // { // $smarty->assign('ur_here', $_LANG['04_sms_charge']); // assign_query_info(); // $sms_charge = array(); // $sms_charge['charge_url'] = $sms->get_url('charge'); // $sms_charge['login_info'] = $sms->get_login_info(); // $smarty->assign('sms_charge', $sms_charge); // $smarty->display('sms_charge_ui.htm'); // } // else // { // $smarty->assign('ur_here', $_LANG['register_sms']); // $smarty->assign('sms_site_info', $sms->get_site_info()); // assign_query_info(); // $smarty->display('sms_register_ui.htm'); // } // // break; // // /* 显示充值记录的查询界面,如果尚未注册或启用短信服务则显示注册界面。 */ // case 'display_charge_history_ui' : // /* 检查权限 */ // admin_priv('charge_history'); // if ($sms->has_registered()) // { // $smarty->assign('ur_here', $_LANG['06_sms_charge_history']); // assign_query_info(); // $smarty->display('sms_charge_history_query_ui.htm'); // } // else // { // $smarty->assign('ur_here', $_LANG['register_sms']); // $smarty->assign('sms_site_info', $sms->get_site_info()); // assign_query_info(); // $smarty->display('sms_register_ui.htm'); // } // // break; // // /* 获得充值记录,如果客户端支持XSLT,则直接发送XML格式的文本到客户端; // 否则在服务器端把XML转换成XHTML后发送到客户端。 // */ // case 'get_charge_history' : // $start_date = isset($_POST['start_date']) ? $_POST['start_date'] : ''; // $end_date = isset($_POST['end_date']) ? $_POST['end_date'] : ''; // $page_size = isset($_POST['page_size']) ? $_POST['page_size'] : 20; // $page = isset($_POST['page']) ? $_POST['page'] : 1; // // $is_xslt_supported = isset($_POST['is_xslt_supported']) ? $_POST['is_xslt_supported'] : 'no'; // if ($is_xslt_supported === 'yes') // { // $xml = $sms->get_charge_history_by_xml($start_date, $end_date, $page_size, $page); // header('Content-Type: application/xml; charset=utf-8'); // //TODO:判断错误信息,链上XSLT // echo $xml; // } // else // { // $result = $sms->get_charge_history($start_date, $end_date, $page_size, $page); // if ($result !== false) // { // $smarty->assign('sms_charge_history', $result); // // /* 分页信息 */ // $turn_page = array( 'total_records' => $result['count'], // 'total_pages' => intval(ceil($result['count']/$page_size)), // 'page' => $page, // 'page_size' => $page_size); // $smarty->assign('turn_page', $turn_page); // $smarty->assign('start_date', $start_date); // $smarty->assign('end_date', $end_date); // // assign_query_info(); // // $smarty->display('sms_charge_history.htm'); // } // else // { // $link[] = array('text' => $_LANG['back_charge_history'], // 'href' => 'sms.php?act=display_charge_history_ui'); // // @$error_detail = $_LANG['server_errors'][$sms->errors['server_errors']['error_no']] // . $_LANG['api_errors']['get_history'][$sms->errors['api_errors']['error_no']]; // // sys_msg($_LANG['history_query_error'] . $error_detail, 1, $link); // } // } // // break; // // /* 显示我的短信服务个人信息 */ // default : // /* 检查权限 */ // admin_priv('my_info'); // $sms_my_info = $sms->get_my_info(); // if (!$sms_my_info) // { // $link[] = array('text' => $_LANG['back'], 'href' => './'); // sys_msg($_LANG['empty_info'], 1, $link); // } // // if (!$sms_my_info['sms_user_name'])//此处不用$sms->has_registered()能够减少一次数据库查询 // { // $smarty->assign('ur_here', $_LANG['register_sms']); // $smarty->assign('sms_site_info', $sms->get_site_info()); // assign_query_info(); // $smarty->display('sms_register_ui.htm'); // } // else // { // /* 立即更新短信特服信息 */ // $sms->restore($sms_my_info['sms_user_name'], $sms_my_info['sms_password']); // // /* 再次获取个人数据,保证显示的数据是最新的 */ // $sms_my_info = $sms->get_my_info();//这里不再进行判空处理,主要是因为如果前个式子不出错,这里一般不会出错 // // /* 格式化时间输出 */ // $sms_last_request = $sms_my_info['sms_last_request'] // ? $sms_my_info['sms_last_request'] // : 0;//赋0防出错 // $sms_my_info['sms_last_request'] = local_date('Y-m-d H:i:s O', $sms_my_info['sms_last_request']); // // $smarty->assign('sms_my_info', $sms_my_info); // $smarty->assign('ur_here', $_LANG['02_sms_my_info']); // assign_query_info(); // $smarty->display('sms_my_info.htm'); // } } ?>
zzshop
trunk/admin/sms.php
PHP
asf20
16,650
<?php /** * ECSHOP 帮助信息管理程序 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: shophelp.php 17063 2010-03-25 06:35:46Z liuhui $ */ define('IN_ECS', true); require(dirname(__FILE__) . '/includes/init.php'); require_once(ROOT_PATH . "includes/fckeditor/fckeditor.php"); /*初始化数据交换对象 */ $exc_article = new exchange($ecs->table("article"), $db, 'article_id', 'title'); $exc_cat = new exchange($ecs->table("article_cat"), $db, 'cat_id', 'cat_name'); /*------------------------------------------------------ */ //-- 列出所有文章分类 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'list_cat') { $smarty->assign('action_link', array('text' => $_LANG['article_add'], 'href' => 'shophelp.php?act=add')); $smarty->assign('ur_here', $_LANG['cat_list']); $smarty->assign('full_page', 1); $smarty->assign('list', get_shophelp_list()); assign_query_info(); $smarty->display('shophelp_cat_list.htm'); } /*------------------------------------------------------ */ //-- 分类下的文章 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'list_article') { $smarty->assign('ur_here', $_LANG['article_list']); $smarty->assign('action_link', array('text' => $_LANG['article_add'], 'href' => 'shophelp.php?act=add&cat_id=' . $_REQUEST['cat_id'])); $smarty->assign('full_page', 1); $smarty->assign('cat', article_cat_list($_REQUEST['cat_id'], true, 'cat_id', 0, "onchange=\"location.href='?act=list_article&cat_id='+this.value\"")); $smarty->assign('list', shophelp_article_list($_REQUEST['cat_id'])); assign_query_info(); $smarty->display('shophelp_article_list.htm'); } /*------------------------------------------------------ */ //-- 查询分类下的文章 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'query_art') { $cat_id = intval($_GET['cat']); $smarty->assign('list', shophelp_article_list($cat_id)); make_json_result($smarty->fetch('shophelp_article_list.htm')); } /*------------------------------------------------------ */ //-- 查询 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'query') { $smarty->assign('list', get_shophelp_list()); make_json_result($smarty->fetch('shophelp_cat_list.htm')); } /*------------------------------------------------------ */ //-- 添加文章 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'add') { /* 权限判断 */ admin_priv('shophelp_manage'); /* 创建 html editor */ create_html_editor('FCKeditor1'); if (empty($_REQUEST['cat_id'])) { $selected = 0; } else { $selected = $_REQUEST['cat_id']; } $cat_list = article_cat_list($selected,true, 'cat_id', 0); $cat_list = str_replace('select please', $_LANG['select_plz'], $cat_list); $smarty->assign('cat_list', $cat_list); $smarty->assign('ur_here', $_LANG['article_add']); $smarty->assign('action_link', array('text' => $_LANG['cat_list'], 'href' => 'shophelp.php?act=list_cat')); $smarty->assign('form_action', 'insert'); $smarty->display('shophelp_info.htm'); } if ($_REQUEST['act'] == 'insert') { /* 权限判断 */ admin_priv('shophelp_manage'); /* 判断是否重名 */ $exc_article->is_only('title', $_POST['title'], $_LANG['title_exist']); /* 插入数据 */ $add_time = gmtime(); $sql = "INSERT INTO ".$ecs->table('article')."(title, cat_id, article_type, content, add_time, author) VALUES('$_POST[title]', '$_POST[cat_id]', '$_POST[article_type]','$_POST[FCKeditor1]','$add_time', '_SHOPHELP' )"; $db ->query($sql); $link[0]['text'] = $_LANG['back_list']; $link[0]['href'] = 'shophelp.php?act=list_article&cat_id=' . $_POST['cat_id']; $link[1]['text'] = $_LANG['continue_add']; $link[1]['href'] = 'shophelp.php?act=add&cat_id=' . $_POST['cat_id']; /* 清除缓存 */ clear_cache_files(); admin_log($_POST['title'], 'add', 'shophelp'); sys_msg($_LANG['articleadd_succeed'], 0, $link); } /*------------------------------------------------------ */ //-- 编辑文章 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'edit') { /* 权限判断 */ admin_priv('shophelp_manage'); /* 取文章数据 */ $sql = "SELECT article_id,title, cat_id, article_type, is_open, author, author_email, keywords, content FROM " .$ecs->table('article'). " WHERE article_id='$_REQUEST[id]'"; $article = $db->GetRow($sql); /* 创建 html editor */ create_html_editor('FCKeditor1', $article['content']); $smarty->assign('cat_list', article_cat_list($article['cat_id'], true, 'cat_id', 0)); $smarty->assign('ur_here', $_LANG['article_add']); $smarty->assign('action_link', array('text' => $_LANG['article_list'], 'href' => 'shophelp.php?act=list_article&cat_id='.$article['cat_id'])); $smarty->assign('article', $article); $smarty->assign('form_action', 'update'); assign_query_info(); $smarty->display('shophelp_info.htm'); } if ($_REQUEST['act'] == 'update') { /* 权限判断 */ admin_priv('shophelp_manage'); /* 检查重名 */ if ($_POST['title'] != $_POST['old_title'] ) { $exc_article->is_only('title', $_POST['title'], $_LANG['articlename_exist'], $_POST['id']); } /* 更新 */ if ($exc_article->edit("title = '$_POST[title]', cat_id = '$_POST[cat_id]', article_type = '$_POST[article_type]', content = '$_POST[FCKeditor1]'", $_POST['id'])) { /* 清除缓存 */ clear_cache_files(); $link[0]['text'] = $_LANG['back_list']; $link[0]['href'] = 'shophelp.php?act=list_article&cat_id='.$_POST['cat_id']; sys_msg(sprintf($_LANG['articleedit_succeed'], $_POST['title']), 0, $link); admin_log($_POST['title'], 'edit', 'shophelp'); } } /*------------------------------------------------------ */ //-- 编辑分类的名称 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'edit_catname') { check_authz_json('shophelp_manage'); $id = intval($_POST['id']); $cat_name = json_str_iconv(trim($_POST['val'])); /* 检查分类名称是否重复 */ if ($exc_cat->num("cat_name", $cat_name, $id) != 0) { make_json_error(sprintf($_LANG['catname_exist'], $cat_name)); } else { if ($exc_cat->edit("cat_name = '$cat_name'", $id)) { clear_cache_files(); admin_log($cat_name, 'edit', 'shophelpcat'); make_json_result(stripslashes($cat_name)); } else { make_json_error($db->error()); } } } /*------------------------------------------------------ */ //-- 编辑分类的排序 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'edit_cat_order') { check_authz_json('shophelp_manage'); $id = intval($_POST['id']); $order = json_str_iconv(trim($_POST['val'])); /* 检查输入的值是否合法 */ if (!preg_match("/^[0-9]+$/", $order)) { make_json_result('', sprintf($_LANG['enter_int'], $order)); } else { if ($exc_cat->edit("sort_order = '$order'", $id)) { clear_cache_files(); make_json_result(stripslashes($order)); } } } /*------------------------------------------------------ */ //-- 删除分类 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'remove') { check_authz_json('shophelp_manage'); $id = intval($_GET['id']); /* 非空的分类不允许删除 */ if ($exc_article->num('cat_id', $id) != 0) { make_json_error(sprintf($_LANG['not_emptycat'])); } else { $exc_cat->drop($id); clear_cache_files(); admin_log('', 'remove', 'shophelpcat'); } $url = 'shophelp.php?act=query&' . str_replace('act=remove', '', $_SERVER['QUERY_STRING']); ecs_header("Location: $url\n"); exit; } /*------------------------------------------------------ */ //-- 删除分类下的某文章 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'remove_art') { check_authz_json('shophelp_manage'); $id = intval($_GET['id']); $cat_id = $db->getOne('SELECT cat_id FROM ' .$ecs->table('article'). " WHERE article_id='$id'"); if ($exc_article->drop($id)) { /* 清除缓存 */ clear_cache_files(); admin_log('', 'remove', 'shophelp'); } else { make_json_error(sprintf($_LANG['remove_fail'])); } $url = 'shophelp.php?act=query_art&cat='.$cat_id.'&' . str_replace('act=remove_art', '', $_SERVER['QUERY_STRING']); ecs_header("Location: $url\n"); exit; } /*------------------------------------------------------ */ //-- 添加一个新分类 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'add_catname') { check_authz_json('shophelp_manage'); $cat_name = trim($_POST['cat_name']); if (!empty($cat_name)) { if ($exc_cat->num("cat_name", $cat_name) != 0) { make_json_error($_LANG['catname_exist']); } else { $sql = "INSERT INTO " .$ecs->table('article_cat'). " (cat_name, cat_type) VALUES ('$cat_name', 0)"; $db->query($sql); admin_log($cat_name, 'add', 'shophelpcat'); ecs_header("Location: shophelp.php?act=query\n"); exit; } } else { make_json_error($_LANG['js_languages']['no_catname']); } ecs_header("Location: shophelp.php?act=list_cat\n"); exit; } /*------------------------------------------------------ */ //-- 编辑文章标题 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'edit_title') { check_authz_json('shophelp_manage'); $id = intval($_POST['id']); $title = json_str_iconv(trim($_POST['val'])); /* 检查文章标题是否有重名 */ if ($exc_article->num('title', $title, $id) == 0) { if ($exc_article->edit("title = '$title'", $id)) { clear_cache_files(); admin_log($title, 'edit', 'shophelp'); make_json_result(stripslashes($title)); } } else { make_json_error(sprintf($_LANG['articlename_exist'], $title)); } } /* 获得网店帮助文章分类 */ function get_shophelp_list() { $list = array(); $sql = 'SELECT cat_id, cat_name, sort_order'. ' FROM ' .$GLOBALS['ecs']->table('article_cat'). ' WHERE cat_type = 0 ORDER BY sort_order'; $res = $GLOBALS['db']->query($sql); while ($rows = $GLOBALS['db']->fetchRow($res)) { $sql = 'SELECT COUNT(*) FROM ' .$GLOBALS['ecs']->table('article'). " WHERE cat_id = '$rows[cat_id]'"; $rows['num'] = $GLOBALS['db']->getOne($sql); $list[] = $rows; } return $list; } /* 获得网店帮助某分类下的文章 */ function shophelp_article_list($cat_id) { $list=array(); $sql = 'SELECT article_id, title, article_type , add_time'. ' FROM ' .$GLOBALS['ecs']->table('article'). " WHERE cat_id = '$cat_id' ORDER BY article_type DESC"; $res = $GLOBALS['db']->query($sql); while ($rows = $GLOBALS['db']->fetchRow($res)) { $rows['add_time'] = local_date($GLOBALS['_CFG']['time_format'], $rows['add_time']); $list[] = $rows; } return $list; } ?>
zzshop
trunk/admin/shophelp.php
PHP
asf20
12,658
<?php /** * ECSHOP 注册短信 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: sms_url.php 16654 2009-09-09 10:29:24Z liuhui $ */ $url = ''; if(isset($GLOBALS['_CFG']['certificate_id'])) { if($GLOBALS['_CFG']['certificate_id'] == '') { $certi_id='error'; } else { $certi_id=$GLOBALS['_CFG']['certificate_id']; } $sess_id = $GLOBALS['sess']->get_session_id(); $auth = mktime(); $ac = md5($certi_id.'SHOPEX_SMS'.$auth); $url = 'http://service.shopex.cn/sms/index.php?certificate_id='.$certi_id.'&sess_id='.$sess_id.'&auth='.$auth.'&ac='.$ac; } ?>
zzshop
trunk/admin/sms_url.php
PHP
asf20
1,186
<?php /** * ECSHOP 地区列表管理文件 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: area_manage.php 17063 2010-03-25 06:35:46Z liuhui $ */ define('IN_ECS', true); require(dirname(__FILE__) . '/includes/init.php'); $exc = new exchange($ecs->table('region'), $db, 'region_id', 'region_name'); /* act操作项的初始化 */ if (empty($_REQUEST['act'])) { $_REQUEST['act'] = 'list'; } else { $_REQUEST['act'] = trim($_REQUEST['act']); } /*------------------------------------------------------ */ //-- 列出某地区下的所有地区列表 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'list') { admin_priv('area_manage'); /* 取得参数:上级地区id */ $region_id = empty($_REQUEST['pid']) ? 0 : intval($_REQUEST['pid']); $smarty->assign('parent_id', $region_id); /* 取得列表显示的地区的类型 */ if ($region_id == 0) { $region_type = 0; } else { $region_type = $exc->get_name($region_id, 'region_type') + 1; } $smarty->assign('region_type', $region_type); /* 获取地区列表 */ $region_arr = area_list($region_id); $smarty->assign('region_arr', $region_arr); /* 当前的地区名称 */ if ($region_id > 0) { $area_name = $exc->get_name($region_id); $area = '[ '. $area_name . ' ] '; if ($region_arr) { $area .= $region_arr[0]['type']; } } else { $area = $_LANG['country']; } $smarty->assign('area_here', $area); /* 返回上一级的链接 */ if ($region_id > 0) { $parent_id = $exc->get_name($region_id, 'parent_id'); $action_link = array('text' => $_LANG['back_page'], 'href' => 'area_manage.php?act=list&&pid=' . $parent_id); } else { $action_link = ''; } $smarty->assign('action_link', $action_link); /* 赋值模板显示 */ $smarty->assign('ur_here', $_LANG['05_area_list']); $smarty->assign('full_page', 1); assign_query_info(); $smarty->display('area_list.htm'); } /*------------------------------------------------------ */ //-- 添加新的地区 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'add_area') { check_authz_json('area_manage'); $parent_id = intval($_POST['parent_id']); $region_name = json_str_iconv(trim($_POST['region_name'])); $region_type = intval($_POST['region_type']); if (empty($region_name)) { make_json_error($_LANG['region_name_empty']); } /* 查看区域是否重复 */ if (!$exc->is_only('region_name', $region_name, 0, "parent_id = '$parent_id'")) { make_json_error($_LANG['region_name_exist']); } $sql = "INSERT INTO " . $ecs->table('region') . " (parent_id, region_name, region_type) ". "VALUES ('$parent_id', '$region_name', '$region_type')"; if ($GLOBALS['db']->query($sql, 'SILENT')) { admin_log($region_name, 'add','area'); /* 获取地区列表 */ $region_arr = area_list($parent_id); $smarty->assign('region_arr', $region_arr); $smarty->assign('region_type', $region_type); make_json_result($smarty->fetch('area_list.htm')); } else { make_json_error($_LANG['add_area_error']); } } /*------------------------------------------------------ */ //-- 编辑区域名称 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'edit_area_name') { check_authz_json('area_manage'); $id = intval($_POST['id']); $region_name = json_str_iconv(trim($_POST['val'])); if (empty($region_name)) { make_json_error($_LANG['region_name_empty']); } $msg = ''; /* 查看区域是否重复 */ $parent_id = $exc->get_name($id, 'parent_id'); if (!$exc->is_only('region_name', $region_name, $id, "parent_id = '$parent_id'")) { make_json_error($_LANG['region_name_exist']); } if ($exc->edit("region_name = '$region_name'", $id)) { admin_log($region_name, 'edit', 'area'); make_json_result(stripslashes($region_name)); } else { make_json_error($db->error()); } } /*------------------------------------------------------ */ //-- 删除区域 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'drop_area') { check_authz_json('area_manage'); $id = intval($_REQUEST['id']); $sql = "SELECT * FROM " . $ecs->table('region') . " WHERE region_id = '$id'"; $region = $db->getRow($sql); /* 如果底下有下级区域,不能删除 */ $sql = "SELECT COUNT(*) FROM " . $ecs->table('region') . " WHERE parent_id = '$id'"; if ($db->getOne($sql) > 0) { make_json_error($_LANG['parent_id_exist']); } if ($exc->drop($id)) { admin_log(addslashes($region['region_name']), 'remove', 'area'); /* 获取地区列表 */ $region_arr = area_list($region['parent_id']); $smarty->assign('region_arr', $region_arr); $smarty->assign('region_type', $region['region_type']); make_json_result($smarty->fetch('area_list.htm')); } else { make_json_error($db->error()); } } ?>
zzshop
trunk/admin/area_manage.php
PHP
asf20
6,097
<?php /** * ECSHOP 图片批量处理程序 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: picture_batch.php 17063 2010-03-25 06:35:46Z liuhui $ */ define('IN_ECS', true); require(dirname(__FILE__) . '/includes/init.php'); include_once(ROOT_PATH . 'includes/cls_image.php'); include_once(ROOT_PATH . '/' . ADMIN_PATH . '/includes/lib_goods.php'); $image = new cls_image($_CFG['bgcolor']); /* 权限检查 */ admin_priv('picture_batch'); if (empty($_GET['is_ajax'])) { assign_query_info(); $smarty->assign('ur_here', $_LANG['12_batch_pic']); $smarty->assign('cat_list', cat_list(0, 0)); $smarty->assign('brand_list', get_brand_list()); $smarty->display('picture_batch.htm'); } elseif (!empty($_GET['get_goods'])) { include_once(ROOT_PATH . 'includes/cls_json.php'); $json = new JSON(); $brand_id = intval($_GET['brand_id']); $cat_id = intval($_GET['cat_id']); $goods_where = ''; if (!empty($cat_id)) { $goods_where .= ' AND ' . get_children($cat_id); } if (!empty($brand_id)) { $goods_where .= " AND g.`brand_id` = '$brand_id'"; } $sql = 'SELECT `goods_id`, `goods_name` FROM ' . $ecs->table('goods') . ' AS g WHERE 1 ' . $goods_where . ' LIMIT 50'; die($json->encode($db->getAll($sql))); } else { include_once(ROOT_PATH . 'includes/cls_json.php'); $json = new JSON(); $proc_thumb = (isset($GLOBALS['shop_id']) && $GLOBALS['shop_id'] > 0); $do_album = empty($_GET['do_album']) ? 0 : 1; $do_icon = empty($_GET['do_icon']) ? 0 : 1; $goods_id = trim($_GET['goods_id']); $brand_id = intval($_GET['brand_id']); $cat_id = intval($_GET['cat_id']); $goods_where = ''; $album_where = ''; $module_no = 0; if ($do_album == 1 AND $do_icon == 0) { $module_no = 1; } if (empty($goods_id)) { if (!empty($cat_id)) { $goods_where .= ' AND ' . get_children($cat_id); } if (!empty($brand_id)) { $goods_where .= " AND g.`brand_id` = '$brand_id'"; } } else { $goods_where .= ' AND g.`goods_id` ' . db_create_in($goods_id); } if (!empty($goods_where)) { $album_where = ', ' . $ecs->table('goods'). " AS g WHERE album.img_original > '' AND album.goods_id = g.goods_id " . $goods_where; } else { $album_where = " WHERE album.img_original > ''"; } /* 设置最长执行时间为5分钟 */ @set_time_limit(300); if (isset($_GET['start'])) { $page_size = 50; // 默认50张/页 $thumb = empty($_GET['thumb']) ? 0 : 1; $watermark = empty($_GET['watermark']) ? 0 : 1; $change = empty($_GET['change']) ? 0 : 1; $silent = empty($_GET['silent']) ? 0 : 1; /* 检查GD */ if ($image->gd_version() < 1) { make_json_error($_LANG['missing_gd']); } /* 如果需要添加水印,检查水印文件 */ if ((!empty($_CFG['watermark'])) && ($_CFG['watermark_place'] > 0) && $watermark && (!$image->validate_image($_CFG['watermark']))) { make_json_error($image->error_msg()); } $title = ''; if (isset($_GET['total_icon'])) { $count = $db->GetOne("SELECT COUNT(*) FROM ".$ecs->table('goods'). " AS g WHERE g.original_img <> ''" . $goods_where); $title = sprintf($_LANG['goods_format'], $count, $page_size); } if (isset($_GET['total_album'])) { $count = $GLOBALS['db']->GetOne("SELECT COUNT(*) FROM ".$GLOBALS['ecs']->table('goods_gallery'). ' AS album ' . $album_where); $title = sprintf('&nbsp;' . $_LANG['gallery_format'], $count, $page_size); $module_no = 1; } $result = array('error' => 0, 'message' => '', 'content' => '', 'module_no' => $module_no, 'done' => 1, 'title' => $title, 'page_size' => $page_size, 'page' => 1, 'thumb'=> $thumb, 'watermark' => $watermark, 'total' => 1, 'change' => $change, 'silent' => $silent, 'do_album' => $do_album, 'do_icon'=> $do_icon, 'goods_id'=> $goods_id, 'brand_id'=> $brand_id, 'cat_id'=> $cat_id, 'row' => array('new_page' => sprintf($_LANG['page_format'], 1), 'new_total' => sprintf($_LANG['total_format'], ceil($count/$page_size)), 'new_time' => $_LANG['wait'], 'cur_id' => 'time_1')); die($json->encode($result)); } else { $result = array('error' => 0, 'message' => '', 'content' => '', 'done' => 2, 'do_album' => $do_album, 'do_icon'=> $do_icon, 'goods_id'=> $goods_id, 'brand_id'=> $brand_id, 'cat_id'=> $cat_id); $result['thumb'] = empty($_GET['thumb']) ? 0 : 1; $result['watermark'] = empty($_GET['watermark']) ? 0 : 1; $result['change'] = empty($_GET['change']) ? 0 : 1; $result['page_size'] = empty($_GET['page_size']) ? 100 : intval($_GET['page_size']); $result['module_no'] = empty($_GET['module_no']) ? 0 : intval($_GET['module_no']); $result['page'] = isset($_GET['page']) ? intval($_GET['page']) : 1; $result['total'] = isset($_GET['total']) ? intval($_GET['total']) : 1; $result['silent'] = empty($_GET['silent']) ? 0 : 1; if ($result['silent']) { $err_msg = array(); } /*------------------------------------------------------ */ //-- 商品图片 /*------------------------------------------------------ */ if ($result['module_no'] == 0) { $count = $GLOBALS['db']->GetOne("SELECT COUNT(*) FROM ".$ecs->table('goods'). " AS g WHERE g.original_img > ''" . $goods_where); /* 页数在许可范围内 */ if ($result['page'] <= ceil($count / $result['page_size'])) { $start_time = gmtime(); //开始执行时间 /* 开始处理 */ if ($proc_thumb) { process_image_ex($result['page'], $result['page_size'], $result['module_no'], $result['thumb'], $result['watermark'], $result['change'], $result['silent']); } else { process_image($result['page'], $result['page_size'], $result['module_no'], $result['thumb'], $result['watermark'], $result['change'], $result['silent']); } $end_time = gmtime(); $result['row']['pre_id'] = 'time_' . $result['total']; $result['row']['pre_time'] = ($end_time > $start_time) ? $end_time - $start_time : 1; $result['row']['pre_time'] = sprintf($_LANG['time_format'], $result['row']['pre_time']); $result['row']['cur_id'] = 'time_' . ($result['total'] + 1); $result['page']++; // 新行 $result['row']['new_page'] = sprintf($_LANG['page_format'], $result['page']); $result['row']['new_total'] = sprintf($_LANG['total_format'], ceil($count/$result['page_size'])); $result['row']['new_time'] = $_LANG['wait']; $result['total']++; } else { --$result['total']; --$result['page']; $result['done'] = 0; $result['message'] = ($do_album) ? '' : $_LANG['done']; /* 清除缓存 */ clear_cache_files(); die($json->encode($result)); } } else if ($result['module_no'] == 1 && $result['do_album'] == 1) { //商品相册 $count = $GLOBALS['db']->GetOne("SELECT COUNT(*) FROM ".$GLOBALS['ecs']->table('goods_gallery'). ' AS album ' . $album_where); if ($result['page'] <= ceil($count / $result['page_size'])) { $start_time = gmtime(); // 开始执行时间 /* 开始处理 */ if ($proc_thumb) { process_image_ex($result['page'], $result['page_size'], $result['module_no'], $result['thumb'], $result['watermark'], $result['change'], $result['silent']); } else { process_image($result['page'], $result['page_size'], $result['module_no'], $result['thumb'], $result['watermark'], $result['change'], $result['silent']); } $end_time = gmtime(); $result['row']['pre_id'] = 'time_' . $result['total']; $result['row']['pre_time'] = ($end_time > $start_time) ? $end_time - $start_time : 1; $result['row']['pre_time'] = sprintf($_LANG['time_format'], $result['row']['pre_time']); $result['row']['cur_id'] = 'time_' . ($result['total'] + 1); $result['page']++; $result['row']['new_page'] = sprintf($_LANG['page_format'], $result['page']); $result['row']['new_total'] = sprintf($_LANG['total_format'], ceil($count/$result['page_size'])); $result['row']['new_time'] = $_LANG['wait']; $result['total']++; } else { $result['row']['pre_id'] = 'time_' . $result['total']; $result['row']['cur_id'] = 'time_' . ($result['total'] + 1); $result['row']['new_page'] = sprintf($_LANG['page_format'], $result['page']); $result['row']['new_total'] = sprintf($_LANG['total_format'], ceil($count/$result['page_size'])); $result['row']['new_time'] = $_LANG['wait']; /* 执行结束 */ $result['done'] = 0; $result['message'] = $_LANG['done']; /* 清除缓存 */ clear_cache_files(); } } if ($result['silent'] && $err_msg) { $result['content'] = implode('<br />' , $err_msg); } die($json->encode($result)); } } /** * 图片处理函数 * * @access public * @param integer $page * @param integer $page_size * @param integer $type * @param boolen $thumb 是否生成缩略图 * @param boolen $watermark 是否生成水印图 * @param boolen $change true 生成新图,删除旧图 false 用新图覆盖旧图 * @param boolen $silent 是否执行能忽略错误 * * @return void */ function process_image($page = 1, $page_size = 100, $type = 0, $thumb= true, $watermark = true, $change = false, $silent = true) { if ($type == 0) { $sql = "SELECT g.goods_id, g.original_img, g.goods_img, g.goods_thumb FROM ".$GLOBALS['ecs']->table('goods'). " AS g WHERE g.original_img > ''" . $GLOBALS['goods_where']; $res = $GLOBALS['db']->SelectLimit($sql, $page_size, ($page-1)*$page_size); while ($row = $GLOBALS['db']->fetchRow($res)) { $goods_thumb = ''; $image = ''; /* 水印 */ if ($watermark) { /* 获取加水印图片的目录 */ if (empty($row['goods_img'])) { $dir = dirname(ROOT_PATH . $row['original_img']) . '/'; } else { $dir = dirname(ROOT_PATH . $row['goods_img']) . '/'; } $image = $GLOBALS['image']->make_thumb(ROOT_PATH . $row['original_img'], $GLOBALS['_CFG']['image_width'], $GLOBALS['_CFG']['image_height'], $dir); //先生成缩略图 if (!$image) { //出错返回 $msg = sprintf($GLOBALS['_LANG']['error_pos'], $row['goods_id']) . "\n" . $GLOBALS['image']->error_msg(); if ($silent) { $GLOBALS['err_msg'][] = $msg; continue; } else { make_json_error($msg); } } $image = $GLOBALS['image']->add_watermark(ROOT_PATH . $image, '', $GLOBALS['_CFG']['watermark'], $GLOBALS['_CFG']['watermark_place'], $GLOBALS['_CFG']['watermark_alpha']); if (!$image) { //出错返回 $msg = sprintf($GLOBALS['_LANG']['error_pos'], $row['goods_id']) . "\n" . $GLOBALS['image']->error_msg(); if ($silent) { $GLOBALS['err_msg'][] = $msg; continue; } else { make_json_error($msg); } } /* 重新格式化图片名称 */ $image = reformat_image_name('goods', $row['goods_id'], $image, 'goods'); if ($change || empty($row['goods_img'])) { /* 要生成新链接的处理过程 */ if ($image != $row['goods_img']) { $sql = "UPDATE " .$GLOBALS['ecs']->table('goods'). " SET goods_img = '$image' WHERE goods_id = '" . $row['goods_id'] . "'"; $GLOBALS['db']->query($sql); /* 防止原图被删除 */ if ($row['goods_img'] != $row['original_img']) { @unlink(ROOT_PATH . $row['goods_img']); } } } else { replace_image($image, $row['goods_img'], $row['goods_id'], $silent); } } /* 缩略图 */ if ($thumb) { if (empty($row['goods_thumb'])) { $dir = dirname(ROOT_PATH . $row['original_img']) . '/'; } else { $dir = dirname(ROOT_PATH . $row['goods_thumb']) . '/'; } $goods_thumb = $GLOBALS['image']->make_thumb(ROOT_PATH.$row['original_img'], $GLOBALS['_CFG']['thumb_width'], $GLOBALS['_CFG']['thumb_height'], $dir); /* 出错处理 */ if (!$goods_thumb) { $msg = sprintf($GLOBALS['_LANG']['error_pos'], $row['goods_id']) . "\n" . $GLOBALS['image']->error_msg(); if ($silent) { $GLOBALS['err_msg'][] = $msg; continue; } else { make_json_error($msg); } } /* 重新格式化图片名称 */ $goods_thumb = reformat_image_name('goods_thumb', $row['goods_id'], $goods_thumb, 'thumb'); if ($change || empty($row['goods_thumb'])) { if ($row['goods_thumb'] != $goods_thumb) { $sql = "UPDATE " .$GLOBALS['ecs']->table('goods'). " SET goods_thumb = '$goods_thumb' WHERE goods_id = '" . $row['goods_id'] . "'"; $GLOBALS['db']->query($sql); /* 防止原图被删除 */ if ($row['goods_thumb'] != $row['original_img']) { @unlink(ROOT_PATH . $row['goods_thumb']); } } } else { replace_image($goods_thumb, $row['goods_thumb'], $row['goods_id'], $silent); } } } } else { /* 遍历商品相册 */ $sql = "SELECT album.goods_id, album.img_id, album.img_url, album.thumb_url, album.img_original FROM ".$GLOBALS['ecs']->table('goods_gallery'). " AS album " . $GLOBALS['album_where']; $res = $GLOBALS['db']->SelectLimit($sql, $page_size, ($page - 1) * $page_size); while ($row = $GLOBALS['db']->fetchRow($res)) { $thumb_url = ''; $image = ''; /* 水印 */ if ($watermark && file_exists(ROOT_PATH . $row['img_original'])) { if (empty($row['img_url'])) { $dir = dirname(ROOT_PATH . $row['img_original']) . '/'; } else { $dir = dirname(ROOT_PATH . $row['img_url']) . '/'; } $file_name = cls_image::unique_name($dir); $file_name .= cls_image::get_filetype(empty($row['img_url']) ? $row['img_original']: $row['img_url']); copy(ROOT_PATH . $row['img_original'], $dir . $file_name); $image = $GLOBALS['image']->add_watermark($dir . $file_name ,'',$GLOBALS['_CFG']['watermark'], $GLOBALS['_CFG']['watermark_place'], $GLOBALS['_CFG']['watermark_alpha']); if (!$image) { @unlink($dir . $file_name); $msg = sprintf($GLOBALS['_LANG']['error_pos'], $row['goods_id']) . "\n" . $GLOBALS['image']->error_msg(); if ($silent) { $GLOBALS['err_msg'][] = $msg; continue; } else { make_json_error($msg); } } /* 重新格式化图片名称 */ $image = reformat_image_name('gallery', $row['goods_id'], $image, 'goods'); if ($change || empty($row['img_url']) || $row['img_original'] == $row['img_url']) { if ($image != $row['img_url']) { $sql = "UPDATE " .$GLOBALS['ecs']->table('goods_gallery'). " SET img_url='$image' WHERE img_id='$row[img_id]'"; $GLOBALS['db']->query($sql); if ($row['img_original'] != $row['img_url']) { @unlink(ROOT_PATH . $row['img_url']); } } } else { replace_image($image, $row['img_url'], $row['goods_id'], $silent); } } /* 缩略图 */ if ($thumb) { if (empty($row['thumb_url'])) { $dir = dirname(ROOT_PATH . $row['img_original']) . '/'; } else { $dir = dirname(ROOT_PATH . $row['thumb_url']) . '/'; } $thumb_url = $GLOBALS['image']->make_thumb(ROOT_PATH . $row['img_original'], $GLOBALS['_CFG']['thumb_width'], $GLOBALS['_CFG']['thumb_height'], $dir); if (!$thumb_url) { $msg = sprintf($GLOBALS['_LANG']['error_pos'], $row['goods_id']) . "\n" . $GLOBALS['image']->error_msg(); if ($silent) { $GLOBALS['err_msg'][] = $msg; continue; } else { make_json_error($msg); } } /* 重新格式化图片名称 */ $thumb_url = reformat_image_name('gallery_thumb', $row['goods_id'], $thumb_url, 'thumb'); if ($change || empty($row['thumb_url'])) { if ($thumb_url != $row['thumb_url']) { $sql = "UPDATE " .$GLOBALS['ecs']->table('goods_gallery'). " SET thumb_url='$thumb_url' WHERE img_id='$row[img_id]'"; $GLOBALS['db']->query($sql); @unlink(ROOT_PATH . $row['thumb_url']); } } else { replace_image($thumb_url, $row['thumb_url'], $row['goods_id'],$silent); } } } } } /** * 图片处理函数 * * @access public * @param integer $page * @param integer $page_size * @param integer $type * @param boolen $thumb 是否生成缩略图 * @param boolen $watermark 是否生成水印图 * @param boolen $change true 生成新图,删除旧图 false 用新图覆盖旧图 * @param boolen $silent 是否执行能忽略错误 * * @return void */ function process_image_ex($page = 1, $page_size = 100, $type = 0, $thumb= true, $watermark = true, $change = false, $silent = true) { if ($type == 0) { $sql = "SELECT g.goods_id, g.original_img, g.goods_img, g.goods_thumb FROM ".$GLOBALS['ecs']->table('goods'). " AS g WHERE g.original_img > ''" . $goods_where; $res = $GLOBALS['db']->SelectLimit($sql, $page_size, ($page-1)*$page_size); while ($row = $GLOBALS['db']->fetchRow($res)) { if ($thumb) { get_image_path($row['goods_id'], '', true, 'goods', true); } if ($watermark) { get_image_path($row['goods_id'], '', false, 'goods', true); } } } else { $sql = "SELECT album.goods_id, album.img_id, album.img_url, album.thumb_url, album.img_original FROM ".$GLOBALS['ecs']->table('goods_gallery'). " AS album " . $GLOBALS['album_where']; $res = $GLOBALS['db']->SelectLimit($sql, $page_size, ($page - 1) * $page_size); while ($row = $GLOBALS['db']->fetchRow($res)) { if ($thumb) { get_image_path($row['goods_id'], $row['img_original'], true, 'gallery', true); } if ($watermark) { get_image_path($row['goods_id'], $row['img_original'], false, 'gallery', true); } } } } /** * 用新图片替换指定图片 * * @access public * @param string $new_image 新图片 * @param string $old_image 旧图片 * @param string $goods_id 商品图片 * @param boolen $silent 是否使用静态函数 * * @return void */ function replace_image($new_image, $old_image, $goods_id, $silent) { $error = false; if (file_exists(ROOT_PATH . $old_image)) { @rename(ROOT_PATH . $old_image, ROOT_PATH . $old_image . '.bak'); if (!@rename(ROOT_PATH . $new_image, ROOT_PATH . $old_image)) { $error = true; } } else { if (!@rename(ROOT_PATH . $new_image, ROOT_PATH . $old_image)) { $error = true; } } if ($error === true) { if (file_exists(ROOT_PATH . $old_image . '.bak')) { @rename(ROOT_PATH . $old_image . '.bak', ROOT_PATH . $old_image); } $msg = sprintf($GLOBALS['_LANG']['error_pos'], $goods_id) . "\n" . sprintf($GLOBALS['_LANG']['error_rename'], $new_image, $old_image); if ($silent) { $GLOBALS['err_msg'][] = $msg; } else { make_json_error($msg); } } else { if (file_exists(ROOT_PATH . $old_image . '.bak')) { @unlink(ROOT_PATH . $old_image . '.bak'); } return; } } ?>
zzshop
trunk/admin/picture_batch.php
PHP
asf20
24,897
<?php /** * ECSHOP 程序说明 * =========================================================== * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ========================================================== * $Author: liuhui $ * $Id: navigator.php 17063 2010-03-25 06:35:46Z liuhui $ */ define('IN_ECS', true); require(dirname(__FILE__) . '/includes/init.php'); admin_priv('navigator'); $exc = new exchange($ecs->table("nav"), $db, 'id', 'name'); /*------------------------------------------------------ */ //-- 自定义导航栏列表 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'list') { $smarty->assign('ur_here', $_LANG['navigator']); $smarty->assign('action_link', array('text' => $_LANG['add_new'], 'href' => 'navigator.php?act=add')); $smarty->assign('full_page', 1); $navdb = get_nav(); $smarty->assign('navdb', $navdb['navdb']); $smarty->assign('filter', $navdb['filter']); $smarty->assign('record_count', $navdb['record_count']); $smarty->assign('page_count', $navdb['page_count']); assign_query_info(); $smarty->display('navigator.htm'); } /*------------------------------------------------------ */ //-- 自定义导航栏列表Ajax /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'query') { $navdb = get_nav(); $smarty->assign('navdb', $navdb['navdb']); $smarty->assign('filter', $navdb['filter']); $smarty->assign('record_count', $navdb['record_count']); $smarty->assign('page_count', $navdb['page_count']); $sort_flag = sort_flag($navdb['filter']); $smarty->assign($sort_flag['tag'], $sort_flag['img']); make_json_result($smarty->fetch('navigator.htm'), '', array('filter' => $navdb['filter'], 'page_count' => $navdb['page_count'])); } /*------------------------------------------------------ */ //-- 自定义导航栏增加 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'add') { if (empty($_REQUEST['step'])) { $rt = array('act'=>'add'); $sysmain = get_sysnav(); $smarty->assign('action_link', array('text' => $_LANG['go_list'], 'href' => 'navigator.php?act=list')); $smarty->assign('ur_here', $_LANG['navigator']); assign_query_info(); $smarty->assign('sysmain',$sysmain); $smarty->assign('rt', $rt); $smarty->display('navigator_add.htm'); } elseif ($_REQUEST['step'] == 2) { $item_name = $_REQUEST['item_name']; $item_url = $_REQUEST['item_url']; $item_ifshow = $_REQUEST['item_ifshow']; $item_opennew = $_REQUEST['item_opennew']; $item_type = $_REQUEST['item_type']; $vieworder = $db->getOne("SELECT max(vieworder) FROM ". $ecs->table('nav') . " WHERE type = '". $item_type ."'"); $item_vieworder = empty($_REQUEST['item_vieworder']) ? $vieworder+1 : $_REQUEST['item_vieworder']; if($item_ifshow == 1 && $item_type == 'middle') { //如果设置为在中部显示 $arr = analyse_uri($item_url); //分析URI if($arr) { //如果为分类 set_show_in_nav($arr['type'], $arr['id'], 1); //设置显示 $sql = "INSERT INTO " . $GLOBALS['ecs']->table('nav') . " (name,ctype,cid,ifshow,vieworder,opennew,url,type) VALUES('$item_name','".$arr['type']."','".$arr['id']."','$item_ifshow','$item_vieworder','$item_opennew','$item_url','$item_type')"; } } if(empty($sql)) { $sql = "INSERT INTO " . $GLOBALS['ecs']->table('nav') . " (name,ifshow,vieworder,opennew,url,type) VALUES('$item_name','$item_ifshow','$item_vieworder','$item_opennew','$item_url','$item_type')"; } $db->query($sql); clear_cache_files(); $links[] = array('text' => $_LANG['navigator'], 'href' => 'navigator.php?act=list'); $links[] = array('text' => $_LANG['add_new'], 'href' => 'navigator.php?act=add'); sys_msg($_LANG['edit_ok'], 0, $links); } } /*------------------------------------------------------ */ //-- 自定义导航栏编辑 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'edit') { $id = $_REQUEST['id']; if (empty($_REQUEST['step'])) { $rt = array('act'=>'edit','id'=>$id); $row = $db->getRow("SELECT * FROM " . $GLOBALS['ecs']->table('nav') . " WHERE id='$id'"); $rt['item_name'] = $row['name']; $rt['item_url'] = $row['url']; $rt['item_vieworder'] = $row['vieworder']; $rt['item_ifshow_'.$row['ifshow']] = 'selected'; $rt['item_opennew_'.$row['opennew']] = 'selected'; $rt['item_type_'.$row['type']] = 'selected'; $sysmain = get_sysnav(); $smarty->assign('action_link', array('text' => $_LANG['go_list'], 'href' => 'navigator.php?act=list')); $smarty->assign('ur_here', $_LANG['navigator']); assign_query_info(); $smarty->assign('sysmain',$sysmain); $smarty->assign('rt', $rt); $smarty->display('navigator_add.htm'); } elseif ($_REQUEST['step'] == 2) { $item_name = $_REQUEST['item_name']; $item_url = $_REQUEST['item_url']; $item_ifshow = $_REQUEST['item_ifshow']; $item_opennew = $_REQUEST['item_opennew']; $item_type = $_REQUEST['item_type']; $item_vieworder = (int)$_REQUEST['item_vieworder']; $row = $db->getRow("SELECT ctype,cid,ifshow,type FROM " . $GLOBALS['ecs']->table('nav') . " WHERE id = '$id'"); $arr = analyse_uri($item_url); if($arr) { //目标为分类 if($row['ctype'] == $arr['type'] && $row['cid'] == $arr['id']) { //没有修改分类 if($item_type != 'middle') { //位置不在中部 set_show_in_nav($arr['type'], $arr['id'], 0); } } else { //修改了分类 if($row['ifshow'] == 1 && $row['type'] == 'middle') { //原来在中部显示 set_show_in_nav($row['ctype'], $row['cid'], 0); //设置成不显示 } elseif($row['ifshow'] == 0 && $row['type'] == 'middle') { //原来不显示 } } //分类判断 if($item_ifshow != is_show_in_nav($arr['type'], $arr['id']) && $item_type == 'middle') { set_show_in_nav($arr['type'], $arr['id'], $item_ifshow); } $sql = "UPDATE " . $GLOBALS['ecs']->table('nav') . " SET name='$item_name',ctype='" . $arr['type'] . "',cid='" . $arr['id'] . "',ifshow='$item_ifshow',vieworder='$item_vieworder',opennew='$item_opennew',url='$item_url',type='$item_type' WHERE id='$id'"; } else { //目标不是分类 if($row['ctype'] && $row['cid']) { //原来是分类 set_show_in_nav($row['ctype'], $row['cid'], 0); } $sql = "UPDATE " . $GLOBALS['ecs']->table('nav') . " SET name='$item_name',ctype='',cid='',ifshow='$item_ifshow',vieworder='$item_vieworder',opennew='$item_opennew',url='$item_url',type='$item_type' WHERE id='$id'"; } $db->query($sql); clear_cache_files(); $links[] = array('text' => $_LANG['navigator'], 'href' => 'navigator.php?act=list'); sys_msg($_LANG['edit_ok'], 0, $links); } } /*------------------------------------------------------ */ //-- 自定义导航栏删除 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'del') { $id = (int)$_GET['id']; $row = $db->getRow("SELECT ctype,cid,type FROM " . $GLOBALS['ecs']->table('nav') . " WHERE id = '$id' LIMIT 1"); if($row['type'] == 'middle' && $row['ctype'] && $row['cid']) { set_show_in_nav($row['ctype'], $row['cid'], 0); } $sql = " DELETE FROM " . $GLOBALS['ecs']->table('nav') . " WHERE id='$id' LIMIT 1"; $db->query($sql); clear_cache_files(); ecs_header("Location: navigator.php?act=list\n"); exit; } /*------------------------------------------------------ */ //-- 编辑排序 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'edit_sort_order') { check_authz_json('nav'); $id = intval($_POST['id']); $order = json_str_iconv(trim($_POST['val'])); /* 检查输入的值是否合法 */ if (!preg_match("/^[0-9]+$/", $order)) { make_json_error(sprintf($_LANG['enter_int'], $order)); } else { if ($exc->edit("vieworder = '$order'", $id)) { clear_cache_files(); make_json_result(stripslashes($order)); } else { make_json_error($db->error()); } } } /*------------------------------------------------------ */ //-- 切换是否显示 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'toggle_ifshow') { $id = intval($_POST['id']); $val = intval($_POST['val']); $row = $db->getRow("SELECT type,ctype,cid FROM " . $GLOBALS['ecs']->table('nav') . " WHERE id = '$id' LIMIT 1"); if($row['type'] == 'middle' && $row['ctype'] && $row['cid']) { set_show_in_nav($row['ctype'], $row['cid'], $val); } if (nav_update($id, array('ifshow' => $val)) != false) { clear_cache_files(); make_json_result($val); } else { make_json_error($db->error()); } } /*------------------------------------------------------ */ //-- 切换是否新窗口 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'toggle_opennew') { $id = intval($_POST['id']); $val = intval($_POST['val']); if (nav_update($id, array('opennew' => $val)) != false) { clear_cache_files(); make_json_result($val); } else { make_json_error($db->error()); } } function get_nav() { $result = get_filter(); if($result === false) { $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'type DESC, vieworder' : 'type DESC, '.trim($_REQUEST['sort_by']); $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'ASC' : trim($_REQUEST['sort_order']); $sql = "SELECT count(*) FROM " .$GLOBALS['ecs']->table('nav'); $filter['record_count'] = $GLOBALS['db']->getOne($sql); /* 分页大小 */ $filter = page_and_size($filter); /* 查询 */ $sql = "SELECT id, name, ifshow, vieworder, opennew, url, type". " FROM ".$GLOBALS['ecs']->table('nav'). " ORDER by " . $filter['sort_by'] . ' ' . $filter['sort_order'] . " LIMIT " . $filter['start'] . ',' . $filter['page_size']; set_filter($filter, $sql); } else { $sql = $result['sql']; $filter = $result['filter']; } $navdb = $GLOBALS['db']->getAll($sql); $type = ""; $navdb2 = array(); foreach($navdb as $k=>$v) { if(!empty($type) && $type != $v['type']) { $navdb2[] = array(); } $navdb2[] = $v; $type = $v['type']; } $arr = array('navdb' => $navdb2, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']); return $arr; } /*------------------------------------------------------ */ //-- 排序相关 /*------------------------------------------------------ */ function sort_nav($a,$b) { return $a['vieworder'] > $b['vieworder'] ? 1 : -1; } /*------------------------------------------------------ */ //-- 获得系统列表 /*------------------------------------------------------ */ function get_sysnav() { global $_LANG; $sysmain = array( array($_LANG['view_cart'],'flow.php'), array($_LANG['pick_out'],'pick_out.php'), array($_LANG['group_buy_goods'],'group_buy.php'), array($_LANG['snatch'],'snatch.php'), array($_LANG['tag_cloud'],'tag_cloud.php'), array($_LANG['user_center'],'user.php'), array($_LANG['wholesale'], 'wholesale.php'), array($_LANG['activity'], 'activity.php'), array($_LANG['myship'], 'myship.php'), array($_LANG['message_board'], 'message.php'), array($_LANG['quotation'], 'quotation.php'), ); $sysmain[] = array('-','-'); $catlist = array_merge(cat_list(0, 0, false), array('-'), article_cat_list(0, 0, false)); foreach($catlist as $key => $val) { $val['view_name'] = $val['cat_name']; for($i=0;$i<$val['level'];$i++) { $val['view_name'] = '&nbsp;&nbsp;&nbsp;&nbsp;' . $val['view_name']; } $val['url'] = str_replace( '&amp;', '&', $val['url']); $val['url'] = str_replace( '&', '&amp;', $val['url']); $sysmain[] = array($val['cat_name'], $val['url'], $val['view_name']); } return $sysmain; } /*------------------------------------------------------ */ //-- 列表项修改 /*------------------------------------------------------ */ function nav_update($id, $args) { if (empty($args) || empty($id)) { return false; } return $GLOBALS['db']->autoExecute($GLOBALS['ecs']->table('nav'), $args, 'update', "id='$id'"); } /*------------------------------------------------------ */ //-- 根据URI对导航栏项目进行分析,确定其为商品分类还是文章分类 /*------------------------------------------------------ */ function analyse_uri($uri) { $uri = strtolower(str_replace('&amp;', '&', $uri)); $arr = explode('-', $uri); switch($arr[0]) { case 'category' : return array('type' => 'c', 'id' => $arr[1]); break; case 'article_cat' : return array('type' => 'a', 'id' => $arr[1]); break; default: break; } list($fn, $pm) = explode('?', $uri); if(strpos($uri, '&') === FALSE) { $arr = array($pm); } else { $arr = explode('&', $pm); } switch($fn) { case 'category.php' : //商品分类 foreach($arr as $k => $v) { list($key, $val) = explode('=', $v); if($key == 'id') { return array('type' => 'c', 'id'=> $val); } } break; case 'article_cat.php' : //文章分类 foreach($arr as $k => $v) { list($key, $val) = explode('=', $v); if($key == 'id') { return array('type' => 'a', 'id'=> $val); } } break; default: //未知 return false; break; } } /*------------------------------------------------------ */ //-- 是否显示 /*------------------------------------------------------ */ function is_show_in_nav($type, $id) { if($type == 'c') { $tablename = $GLOBALS['ecs']->table('category'); } else { $tablename = $GLOBALS['ecs']->table('article_cat'); } return $GLOBALS['db']->getOne("SELECT show_in_nav FROM $tablename WHERE cat_id = '$id'"); } /*------------------------------------------------------ */ //-- 设置是否显示 /*------------------------------------------------------ */ function set_show_in_nav($type, $id, $val) { if($type == 'c') { $tablename = $GLOBALS['ecs']->table('category'); } else { $tablename = $GLOBALS['ecs']->table('article_cat'); } $GLOBALS['db']->query("UPDATE $tablename SET show_in_nav = '$val' WHERE cat_id = '$id'"); clear_cache_files(); } ?>
zzshop
trunk/admin/navigator.php
PHP
asf20
16,925
<?php /** * ECSHOP 会员帐目管理(包括预付款,余额) * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: user_account.php 17063 2010-03-25 06:35:46Z liuhui $ */ define('IN_ECS', true); require(dirname(__FILE__) . '/includes/init.php'); /* act操作项的初始化 */ if (empty($_REQUEST['act'])) { $_REQUEST['act'] = 'list'; } else { $_REQUEST['act'] = trim($_REQUEST['act']); } /*------------------------------------------------------ */ //-- 会员余额记录列表 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'list') { /* 权限判断 */ admin_priv('surplus_manage'); /* 指定会员的ID为查询条件 */ $user_id = !empty($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; /* 获得支付方式列表 */ $payment = array(); $sql = "SELECT pay_id, pay_name FROM ".$ecs->table('payment'). " WHERE enabled = 1 AND pay_code != 'cod' ORDER BY pay_id"; $res = $db->query($sql); while ($row = $db->fetchRow($res)) { $payment[$row['pay_name']] = $row['pay_name']; } /* 模板赋值 */ if (isset($_REQUEST['process_type'])) { $smarty->assign('process_type_' . intval($_REQUEST['process_type']), 'selected="selected"'); } if (isset($_REQUEST['is_paid'])) { $smarty->assign('is_paid_' . intval($_REQUEST['is_paid']), 'selected="selected"'); } $smarty->assign('ur_here', $_LANG['09_user_account']); $smarty->assign('id', $user_id); $smarty->assign('payment_list', $payment); $smarty->assign('action_link', array('text' => $_LANG['surplus_add'], 'href'=>'user_account.php?act=add')); $list = account_list(); $smarty->assign('list', $list['list']); $smarty->assign('filter', $list['filter']); $smarty->assign('record_count', $list['record_count']); $smarty->assign('page_count', $list['page_count']); $smarty->assign('full_page', 1); assign_query_info(); $smarty->display('user_account_list.htm'); } /*------------------------------------------------------ */ //-- 添加/编辑会员余额页面 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'add' || $_REQUEST['act'] == 'edit') { admin_priv('surplus_manage'); //权限判断 $ur_here = ($_REQUEST['act'] == 'add') ? $_LANG['surplus_add'] : $_LANG['surplus_edit']; $form_act = ($_REQUEST['act'] == 'add') ? 'insert' : 'update'; $id = isset($_GET['id']) ? intval($_GET['id']) : 0; /* 获得支付方式列表, 不包括“货到付款” */ $user_account = array(); $payment = array(); $sql = "SELECT pay_id, pay_name FROM ".$ecs->table('payment'). " WHERE enabled = 1 AND pay_code != 'cod' ORDER BY pay_id"; $res = $db->query($sql); while ($row = $db->fetchRow($res)) { $payment[$row['pay_name']] = $row['pay_name']; } if ($_REQUEST['act'] == 'edit') { /* 取得余额信息 */ $user_account = $db->getRow("SELECT * FROM " .$ecs->table('user_account') . " WHERE id = '$id'"); // 如果是负数,去掉前面的符号 $user_account['amount'] = str_replace('-', '', $user_account['amount']); /* 取得会员名称 */ $sql = "SELECT user_name FROM " .$ecs->table('users'). " WHERE user_id = '$user_account[user_id]'"; $user_name = $db->getOne($sql); } else { $surplus_type = ''; $user_name = ''; } /* 模板赋值 */ $smarty->assign('ur_here', $ur_here); $smarty->assign('form_act', $form_act); $smarty->assign('payment_list', $payment); $smarty->assign('action', $_REQUEST['act']); $smarty->assign('user_surplus', $user_account); $smarty->assign('user_name', $user_name); if ($_REQUEST['act'] == 'add') { $href = 'user_account.php?act=list'; } else { $href = 'user_account.php?act=list&' . list_link_postfix(); } $smarty->assign('action_link', array('href' => $href, 'text' => $_LANG['09_user_account'])); assign_query_info(); $smarty->display('user_account_info.htm'); } /*------------------------------------------------------ */ //-- 添加/编辑会员余额的处理部分 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'insert' || $_REQUEST['act'] == 'update') { /* 权限判断 */ admin_priv('surplus_manage'); /* 初始化变量 */ $id = isset($_POST['id']) ? intval($_POST['id']) : 0; $is_paid = !empty($_POST['is_paid']) ? intval($_POST['is_paid']) : 0; $amount = !empty($_POST['amount']) ? floatval($_POST['amount']) : 0; $process_type = !empty($_POST['process_type']) ? intval($_POST['process_type']) : 0; $user_name = !empty($_POST['user_id']) ? trim($_POST['user_id']) : ''; $admin_note = !empty($_POST['admin_note']) ? trim($_POST['admin_note']) : ''; $user_note = !empty($_POST['user_note']) ? trim($_POST['user_note']) : ''; $payment = !empty($_POST['payment']) ? trim($_POST['payment']) : ''; $user_id = $db->getOne("SELECT user_id FROM " .$ecs->table('users'). " WHERE user_name = '$user_name'"); /* 此会员是否存在 */ if ($user_id == 0) { $link[] = array('text' => $_LANG['go_back'], 'href'=>'javascript:history.back(-1)'); sys_msg($_LANG['username_not_exist'], 0, $link); } /* 退款,检查余额是否足够 */ if ($process_type == 1) { $user_account = get_user_surplus($user_id); /* 如果扣除的余额多于此会员拥有的余额,提示 */ if ($amount > $user_account) { $link[] = array('text' => $_LANG['go_back'], 'href'=>'javascript:history.back(-1)'); sys_msg($_LANG['surplus_amount_error'], 0, $link); } } if ($_REQUEST['act'] == 'insert') { /* 入库的操作 */ if ($process_type == 1) { $amount = (-1) * $amount; } $sql = "INSERT INTO " .$ecs->table('user_account'). " VALUES ('', '$user_id', '$_SESSION[admin_name]', '$amount', '".gmtime()."', '".gmtime()."', '$admin_note', '$user_note', '$process_type', '$payment', '$is_paid')"; $db->query($sql); $id = $db->insert_id(); } else { /* 更新数据表 */ $sql = "UPDATE " .$ecs->table('user_account'). " SET ". "admin_note = '$admin_note', ". "user_note = '$user_note', ". "payment = '$payment' ". "WHERE id = '$id'"; $db->query($sql); } // 更新会员余额数量 if ($is_paid == 1) { $change_desc = $amount > 0 ? $_LANG['surplus_type_0'] : $_LANG['surplus_type_1']; $change_type = $amount > 0 ? ACT_SAVING : ACT_DRAWING; log_account_change($user_id, $amount, 0, 0, 0, $change_desc, $change_type); } //如果是预付款并且未确认,向pay_log插入一条记录 if ($process_type == 0 && $is_paid == 0) { include_once(ROOT_PATH . 'includes/lib_order.php'); /* 取支付方式信息 */ $payment_info = array(); $payment_info = $db->getRow('SELECT * FROM ' . $ecs->table('payment'). " WHERE pay_name = '$payment' AND enabled = '1'"); //计算支付手续费用 $pay_fee = pay_fee($payment_info['pay_id'], $amount, 0); $total_fee = $pay_fee + $amount; /* 插入 pay_log */ $sql = 'INSERT INTO ' . $ecs->table('pay_log') . " (order_id, order_amount, order_type, is_paid)" . " VALUES ('$id', '$total_fee', '" .PAY_SURPLUS. "', 0)"; $db->query($sql); } /* 记录管理员操作 */ if ($_REQUEST['act'] == 'update') { admin_log($user_name, 'edit', 'user_surplus'); } else { admin_log($user_name, 'add', 'user_surplus'); } /* 提示信息 */ if ($_REQUEST['act'] == 'insert') { $href = 'user_account.php?act=list'; } else { $href = 'user_account.php?act=list&' . list_link_postfix(); } $link[0]['text'] = $_LANG['back_list']; $link[0]['href'] = $href; $link[1]['text'] = $_LANG['continue_add']; $link[1]['href'] = 'user_account.php?act=add'; sys_msg($_LANG['attradd_succed'], 0, $link); } /*------------------------------------------------------ */ //-- 审核会员余额页面 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'check') { /* 检查权限 */ admin_priv('surplus_manage'); /* 初始化 */ $id = isset($_GET['id']) ? intval($_GET['id']) : 0; /* 如果参数不合法,返回 */ if ($id == 0) { ecs_header("Location: user_account.php?act=list\n"); exit; } /* 查询当前的预付款信息 */ $account = array(); $account = $db->getRow("SELECT * FROM " .$ecs->table('user_account'). " WHERE id = '$id'"); $account['add_time'] = local_date($_CFG['time_format'], $account['add_time']); //余额类型:预付款,退款申请,购买商品,取消订单 if ($account['process_type'] == 0) { $process_type = $_LANG['surplus_type_0']; } elseif ($account['process_type'] == 1) { $process_type = $_LANG['surplus_type_1']; } elseif ($account['process_type'] == 2) { $process_type = $_LANG['surplus_type_2']; } else { $process_type = $_LANG['surplus_type_3']; } $sql = "SELECT user_name FROM " .$ecs->table('users'). " WHERE user_id = '$account[user_id]'"; $user_name = $db->getOne($sql); /* 模板赋值 */ $smarty->assign('ur_here', $_LANG['check']); $account['user_note'] = htmlspecialchars($account['user_note']); $smarty->assign('surplus', $account); $smarty->assign('process_type', $process_type); $smarty->assign('user_name', $user_name); $smarty->assign('id', $id); $smarty->assign('action_link', array('text' => $_LANG['09_user_account'], 'href'=>'user_account.php?act=list&' . list_link_postfix())); /* 页面显示 */ assign_query_info(); $smarty->display('user_account_check.htm'); } /*------------------------------------------------------ */ //-- 更新会员余额的状态 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'action') { /* 检查权限 */ admin_priv('surplus_manage'); /* 初始化 */ $id = isset($_POST['id']) ? intval($_POST['id']) : 0; $is_paid = isset($_POST['is_paid']) ? intval($_POST['is_paid']) : 0; $admin_note = isset($_POST['admin_note']) ? trim($_POST['admin_note']) : ''; /* 如果参数不合法,返回 */ if ($id == 0 || empty($admin_note)) { ecs_header("Location: user_account.php?act=list\n"); exit; } /* 查询当前的预付款信息 */ $account = array(); $account = $db->getRow("SELECT * FROM " .$ecs->table('user_account'). " WHERE id = '$id'"); $amount = $account['amount']; //如果状态为未确认 if ($account['is_paid'] == 0) { //如果是退款申请, 并且已完成,更新此条记录,扣除相应的余额 if ($is_paid == '1' && $account['process_type'] == '1') { $user_account = get_user_surplus($account['user_id']); $fmt_amount = str_replace('-', '', $amount); //如果扣除的余额多于此会员拥有的余额,提示 if ($fmt_amount > $user_account) { $link[] = array('text' => $_LANG['go_back'], 'href'=>'javascript:history.back(-1)'); sys_msg($_LANG['surplus_amount_error'], 0, $link); } update_user_account($id, $amount, $admin_note, $is_paid); //更新会员余额数量 log_account_change($account['user_id'], $amount, 0, 0, 0, $_LANG['surplus_type_1'], ACT_DRAWING); } elseif ($is_paid == '1' && $account['process_type'] == '0') { //如果是预付款,并且已完成, 更新此条记录,增加相应的余额 update_user_account($id, $amount, $admin_note, $is_paid); //更新会员余额数量 log_account_change($account['user_id'], $amount, 0, 0, 0, $_LANG['surplus_type_0'], ACT_SAVING); } elseif ($is_paid == '0') { /* 否则更新信息 */ $sql = "UPDATE " .$ecs->table('user_account'). " SET ". "admin_user = '$_SESSION[admin_name]', ". "admin_note = '$admin_note', ". "is_paid = 0 WHERE id = '$id'"; $db->query($sql); } /* 记录管理员日志 */ admin_log('(' . addslashes($_LANG['check']) . ')' . $admin_note, 'edit', 'user_surplus'); /* 提示信息 */ $link[0]['text'] = $_LANG['back_list']; $link[0]['href'] = 'user_account.php?act=list&' . list_link_postfix(); sys_msg($_LANG['attradd_succed'], 0, $link); } } /*------------------------------------------------------ */ //-- ajax帐户信息列表 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'query') { $list = account_list(); $smarty->assign('list', $list['list']); $smarty->assign('filter', $list['filter']); $smarty->assign('record_count', $list['record_count']); $smarty->assign('page_count', $list['page_count']); $sort_flag = sort_flag($list['filter']); $smarty->assign($sort_flag['tag'], $sort_flag['img']); make_json_result($smarty->fetch('user_account_list.htm'), '', array('filter' => $list['filter'], 'page_count' => $list['page_count'])); } /*------------------------------------------------------ */ //-- ajax删除一条信息 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'remove') { /* 检查权限 */ check_authz_json('surplus_manage'); $id = @intval($_REQUEST['id']); $sql = "SELECT u.user_name FROM " . $ecs->table('users') . " AS u, " . $ecs->table('user_account') . " AS ua " . " WHERE u.user_id = ua.user_id AND ua.id = '$id' "; $user_name = $db->getOne($sql); $sql = "DELETE FROM " . $ecs->table('user_account') . " WHERE id = '$id'"; if ($db->query($sql, 'SILENT')) { admin_log(addslashes($user_name), 'remove', 'user_surplus'); $url = 'user_account.php?act=query&' . str_replace('act=remove', '', $_SERVER['QUERY_STRING']); ecs_header("Location: $url\n"); exit; } else { make_json_error($db->error()); } } /*------------------------------------------------------ */ //-- 会员余额函数部分 /*------------------------------------------------------ */ /** * 查询会员余额的数量 * @access public * @param int $user_id 会员ID * @return int */ function get_user_surplus($user_id) { $sql = "SELECT SUM(user_money) FROM " .$GLOBALS['ecs']->table('account_log'). " WHERE user_id = '$user_id'"; return $GLOBALS['db']->getOne($sql); } /** * 更新会员账目明细 * * @access public * @param array $id 帐目ID * @param array $admin_note 管理员描述 * @param array $amount 操作的金额 * @param array $is_paid 是否已完成 * * @return int */ function update_user_account($id, $amount, $admin_note, $is_paid) { $sql = "UPDATE " .$GLOBALS['ecs']->table('user_account'). " SET ". "admin_user = '$_SESSION[admin_name]', ". "amount = '$amount', ". "paid_time = '".gmtime()."', ". "admin_note = '$admin_note', ". "is_paid = '$is_paid' WHERE id = '$id'"; return $GLOBALS['db']->query($sql); } /** * * * @access public * @param * * @return void */ function account_list() { $result = get_filter(); if ($result === false) { /* 过滤列表 */ $filter['user_id'] = !empty($_REQUEST['user_id']) ? intval($_REQUEST['user_id']) : 0; $filter['keywords'] = empty($_REQUEST['keywords']) ? '' : trim($_REQUEST['keywords']); if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) { $filter['keywords'] = json_str_iconv($filter['keywords']); } $filter['process_type'] = isset($_REQUEST['process_type']) ? intval($_REQUEST['process_type']) : -1; $filter['payment'] = empty($_REQUEST['payment']) ? '' : trim($_REQUEST['payment']); $filter['is_paid'] = isset($_REQUEST['is_paid']) ? intval($_REQUEST['is_paid']) : -1; $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'add_time' : trim($_REQUEST['sort_by']); $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']); $filter['start_date'] = empty($_REQUEST['start_date']) ? '' : local_strtotime($_REQUEST['start_date']); $filter['end_date'] = empty($_REQUEST['end_date']) ? '' : (local_strtotime($_REQUEST['end_date']) + 86400); $where = " WHERE 1 "; if ($filter['user_id'] > 0) { $where .= " AND ua.user_id = '$filter[user_id]' "; } if ($filter['process_type'] != -1) { $where .= " AND ua.process_type = '$filter[process_type]' "; } else { $where .= " AND ua.process_type " . db_create_in(array(SURPLUS_SAVE, SURPLUS_RETURN)); } if ($filter['payment']) { $where .= " AND ua.payment = '$filter[payment]' "; } if ($filter['is_paid'] != -1) { $where .= " AND ua.is_paid = '$filter[is_paid]' "; } if ($filter['keywords']) { $where .= " AND u.user_name LIKE '%" . mysql_like_quote($filter['keywords']) . "%'"; $sql = "SELECT COUNT(*) FROM " .$GLOBALS['ecs']->table('user_account'). " AS ua, ". $GLOBALS['ecs']->table('users') . " AS u " . $where; } /* 时间过滤 */ if (!empty($filter['start_date']) && !empty($filter['end_date'])) { $where .= "AND paid_time >= " . $filter['start_date']. " AND paid_time < '" . $filter['end_date'] . "'"; } $sql = "SELECT COUNT(*) FROM " .$GLOBALS['ecs']->table('user_account'). " AS ua, ". $GLOBALS['ecs']->table('users') . " AS u " . $where; $filter['record_count'] = $GLOBALS['db']->getOne($sql); /* 分页大小 */ $filter = page_and_size($filter); /* 查询数据 */ $sql = 'SELECT ua.*, u.user_name FROM ' . $GLOBALS['ecs']->table('user_account'). ' AS ua LEFT JOIN ' . $GLOBALS['ecs']->table('users'). ' AS u ON ua.user_id = u.user_id'. $where . "ORDER by " . $filter['sort_by'] . " " .$filter['sort_order']. " LIMIT ".$filter['start'].", ".$filter['page_size']; $filter['keywords'] = stripslashes($filter['keywords']); set_filter($filter, $sql); } else { $sql = $result['sql']; $filter = $result['filter']; } $list = $GLOBALS['db']->getAll($sql); foreach ($list AS $key => $value) { $list[$key]['surplus_amount'] = price_format(abs($value['amount']), false); $list[$key]['add_date'] = local_date($GLOBALS['_CFG']['time_format'], $value['add_time']); $list[$key]['process_type_name'] = $GLOBALS['_LANG']['surplus_type_' . $value['process_type']]; } $arr = array('list' => $list, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']); return $arr; } ?>
zzshop
trunk/admin/user_account.php
PHP
asf20
21,195
<?php /** * ECSHOP 订单统计 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: order_stats.php 17063 2010-03-25 06:35:46Z liuhui $ */ define('IN_ECS', true); require(dirname(__FILE__) . '/includes/init.php'); require_once(ROOT_PATH . 'includes/lib_order.php'); require_once(ROOT_PATH . 'languages/' .$_CFG['lang']. '/admin/statistic.php'); $smarty->assign('lang', $_LANG); /* act操作项的初始化 */ if (empty($_REQUEST['act'])) { $_REQUEST['act'] = 'list'; } else { $_REQUEST['act'] = trim($_REQUEST['act']); } /*------------------------------------------------------ */ //--订单统计 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'list') { admin_priv('sale_order_stats'); /* 随机的颜色数组 */ $color_array = array('33FF66', 'FF6600', '3399FF', '009966', 'CC3399', 'FFCC33', '6699CC', 'CC3366'); /* 计算订单各种费用之和的语句 */ $total_fee = " SUM(" . order_amount_field() . ") AS total_turnover "; /* 取得订单转化率数据 */ $sql = "SELECT COUNT(*) AS total_order_num, " .$total_fee. " FROM " . $ecs->table('order_info'). " WHERE 1 " . order_query_sql('finished'); $order_general = $db->getRow($sql); $order_general['total_turnover'] = floatval($order_general['total_turnover']); /* 取得商品总点击数量 */ $sql = 'SELECT SUM(click_count) FROM ' .$ecs->table('goods') .' WHERE is_delete = 0'; $click_count = floatval($db->getOne($sql)); /* 每千个点击的订单数 */ $click_ordernum = $click_count > 0 ? round(($order_general['total_order_num'] * 1000)/$click_count,2) : 0; /* 每千个点击的购物额 */ $click_turnover = $click_count > 0 ? round(($order_general['total_turnover'] * 1000)/$click_count,2) : 0; /* 时区 */ $timezone = isset($_SESSION['timezone']) ? $_SESSION['timezone'] : $GLOBALS['_CFG']['timezone']; /* 时间参数 */ $is_multi = empty($_POST['is_multi']) ? false : true; /* 时间参数 */ if (isset($_POST['start_date']) && !empty($_POST['end_date'])) { $start_date = local_strtotime($_POST['start_date']); $end_date = local_strtotime($_POST['end_date']); if ($start_date == $end_date) { $end_date = $start_date + 86400; } } else { $today = strtotime(local_date('Y-m-d')); //本地时间 $start_date = $today - 86400 * 6; $end_date = $today + 86400; //至明天零时 } $start_date_arr = array(); $end_date_arr = array(); if(!empty($_POST['year_month'])) { $tmp = $_POST['year_month']; for ($i = 0; $i < count($tmp); $i++) { if (!empty($tmp[$i])) { $tmp_time = local_strtotime($tmp[$i] . '-1'); $start_date_arr[] = $tmp_time; $end_date_arr[] = local_strtotime($tmp[$i] . '-' . date('t', $tmp_time)); } } } else { $tmp_time = local_strtotime(local_date('Y-m-d')); $start_date_arr[] = local_strtotime(local_date('Y-m') . '-1'); $end_date_arr[] = local_strtotime(local_date('Y-m') . '-31');; } /* 按月份交叉查询 */ if ($is_multi) { /* 订单概况 */ $order_general_xml = "<chart caption='$_LANG[order_circs]' shownames='1' showvalues='0' decimals='0' outCnvBaseFontSize='12' baseFontSize='12' >"; $order_general_xml .= "<categories><category label='$_LANG[confirmed]' />" . "<category label='$_LANG[succeed]' />" . "<category label='$_LANG[unconfirmed]' />" . "<category label='$_LANG[invalid]' /></categories>"; foreach($start_date_arr AS $k => $val) { $seriesName = local_date('Y-m',$val); $order_info = get_orderinfo($start_date_arr[$k], $end_date_arr[$k]); $order_general_xml .= "<dataset seriesName='$seriesName' color='$color_array[$k]' showValues='0'>"; $order_general_xml .= "<set value='$order_info[confirmed_num]' />"; $order_general_xml .= "<set value='$order_info[succeed_num]' />"; $order_general_xml .= "<set value='$order_info[unconfirmed_num]' />"; $order_general_xml .= "<set value='$order_info[invalid_num]' />"; $order_general_xml .= "</dataset>"; } $order_general_xml .= "</chart>"; /* 支付方式 */ $pay_xml = "<chart caption='$_LANG[pay_method]' shownames='1' showvalues='0' decimals='0' outCnvBaseFontSize='12' baseFontSize='12' >"; $payment = array(); $payment_count = array(); foreach($start_date_arr AS $k => $val) { $sql = 'SELECT i.pay_id, p.pay_name, i.pay_time, COUNT(i.order_id) AS order_num ' . 'FROM ' .$ecs->table('payment'). ' AS p, ' .$ecs->table('order_info'). ' AS i '. "WHERE p.pay_id = i.pay_id AND i.order_status = '" .OS_CONFIRMED. "' ". "AND i.pay_status > '" .PS_UNPAYED. "' AND i.shipping_status > '" .SS_UNSHIPPED. "' ". "AND i.add_time >= '$start_date_arr[$k]' AND i.add_time <= '$end_date_arr[$k]'". "GROUP BY i.pay_id ORDER BY order_num DESC"; $pay_res = $db->query($sql); while ($pay_item = $db->FetchRow($pay_res)) { $payment[$pay_item['pay_name']] = null; $paydate = local_date('Y-m', $pay_item['pay_time']); $payment_count[$pay_item['pay_name']][$paydate] = $pay_item['order_num']; } } $pay_xml .= "<categories>"; foreach ($payment AS $k => $val) { $pay_xml .= "<category label='$k' />"; } $pay_xml .= "</categories>"; foreach($start_date_arr AS $k => $val) { $date = local_date('Y-m', $start_date_arr[$k]); $pay_xml .= "<dataset seriesName='$date' color='$color_array[$k]' showValues='0'>"; foreach ($payment AS $k => $val) { $count = 0; if (!empty($payment_count[$k][$date])) { $count = $payment_count[$k][$date]; } $pay_xml .= "<set value='$count' name='$date' />"; } $pay_xml .= "</dataset>"; } $pay_xml .= "</chart>"; /* 配送方式 */ $ship = array(); $ship_count = array(); $ship_xml = "<chart caption='$_LANG[shipping_method]' shownames='1' showvalues='0' decimals='0' outCnvBaseFontSize='12' baseFontSize='12' >"; foreach($start_date_arr AS $k => $val) { $sql = 'SELECT sp.shipping_id, sp.shipping_name AS ship_name, i.shipping_time, COUNT(i.order_id) AS order_num ' . 'FROM ' .$ecs->table('shipping'). ' AS sp, ' .$ecs->table('order_info'). ' AS i ' . 'WHERE sp.shipping_id = i.shipping_id ' . order_query_sql('finished') . "AND i.add_time >= '$start_date_arr[$k]' AND i.add_time <= '$end_date_arr[$k]' " . "GROUP BY i.shipping_id ORDER BY order_num DESC"; $ship_res = $db->query($sql); while ($ship_item = $db->FetchRow($ship_res)) { $ship[$ship_item['ship_name']] = null; $shipdate = local_date('Y-m', $ship_item['shipping_time']); $ship_count[$ship_item['ship_name']][$shipdate] = $ship_item['order_num']; } } $ship_xml .= "<categories>"; foreach ($ship AS $k => $val) { $ship_xml .= "<category label='$k' />"; } $ship_xml .= "</categories>"; foreach($start_date_arr AS $k => $val) { $date = local_date('Y-m', $start_date_arr[$k]); $ship_xml .= "<dataset seriesName='$date' color='$color_array[$k]' showValues='0'>"; foreach ($ship AS $k => $val) { $count = 0; if (!empty($ship_count[$k][$date])) { $count = $ship_count[$k][$date]; } $ship_xml .= "<set value='$count' name='$date' />"; } $ship_xml .= "</dataset>"; } $ship_xml .= "</chart>"; } /* 按时间段查询 */ else { /* 订单概况 */ $order_info = get_orderinfo($start_date, $end_date); $order_general_xml = "<graph caption='".$_LANG['order_circs']."' decimalPrecision='2' showPercentageValues='0' showNames='1' showValues='1' showPercentageInLabel='0' pieYScale='45' pieBorderAlpha='40' pieFillAlpha='70' pieSliceDepth='15' pieRadius='100' outCnvBaseFontSize='13' baseFontSize='12'>"; $order_general_xml .= "<set value='" .$order_info['confirmed_num']. "' name='" . $_LANG['confirmed'] . "' color='".$color_array[5]."' />"; $order_general_xml .= "<set value='" .$order_info['succeed_num']."' name='" . $_LANG['succeed'] . "' color='".$color_array[0]."' />"; $order_general_xml .= "<set value='" .$order_info['unconfirmed_num']. "' name='" . $_LANG['unconfirmed'] . "' color='".$color_array[1]."' />"; $order_general_xml .= "<set value='" .$order_info['invalid_num']. "' name='" . $_LANG['invalid'] . "' color='".$color_array[4]."' />"; $order_general_xml .= "</graph>"; /* 支付方式 */ $pay_xml = "<graph caption='" . $_LANG['pay_method'] . "' decimalPrecision='2' showPercentageValues='0' showNames='1' numberPrefix='' showValues='1' showPercentageInLabel='0' pieYScale='45' pieBorderAlpha='40' pieFillAlpha='70' pieSliceDepth='15' pieRadius='100' outCnvBaseFontSize='13' baseFontSize='12'>"; $sql = 'SELECT i.pay_id, p.pay_name, COUNT(i.order_id) AS order_num ' . 'FROM ' .$ecs->table('payment'). ' AS p, ' .$ecs->table('order_info'). ' AS i '. "WHERE p.pay_id = i.pay_id " . order_query_sql('finished') . "AND i.add_time >= '$start_date' AND i.add_time <= '$end_date' ". "GROUP BY i.pay_id ORDER BY order_num DESC"; $pay_res= $db->query($sql); while ($pay_item = $db->FetchRow($pay_res)) { $pay_xml .= "<set value='".$pay_item['order_num']."' name='".$pay_item['pay_name']."' color='".$color_array[mt_rand(0,7)]."'/>"; } $pay_xml .= "</graph>"; /* 配送方式 */ $ship_xml = "<graph caption='".$_LANG['shipping_method']."' decimalPrecision='2' showPercentageValues='0' showNames='1' numberPrefix='' showValues='1' showPercentageInLabel='0' pieYScale='45' pieBorderAlpha='40' pieFillAlpha='70' pieSliceDepth='15' pieRadius='100' outCnvBaseFontSize='13' baseFontSize='12'>"; $sql = 'SELECT sp.shipping_id, sp.shipping_name AS ship_name, COUNT(i.order_id) AS order_num ' . 'FROM ' .$ecs->table('shipping'). ' AS sp, ' .$ecs->table('order_info'). ' AS i ' . 'WHERE sp.shipping_id = i.shipping_id ' . order_query_sql('finished') . "AND i.add_time >= '$start_date' AND i.add_time <= '$end_date' " . "GROUP BY i.shipping_id ORDER BY order_num DESC"; $ship_res = $db->query($sql); while ($ship_item = $db->fetchRow($ship_res)) { $ship_xml .= "<set value='".$ship_item['order_num']."' name='".$ship_item['ship_name']."' color='".$color_array[mt_rand(0,7)]."' />"; } $ship_xml .= "</graph>"; } /* 赋值到模板 */ $smarty->assign('order_general', $order_general); $smarty->assign('total_turnover', price_format($order_general['total_turnover'])); $smarty->assign('click_count', $click_count); //商品总点击数 $smarty->assign('click_ordernum', $click_ordernum); //每千点订单数 $smarty->assign('click_turnover', price_format($click_turnover)); //每千点购物额 $smarty->assign('is_multi', $is_multi); $smarty->assign('order_general_xml', $order_general_xml); $smarty->assign('ship_xml', $ship_xml); $smarty->assign('pay_xml', $pay_xml); $smarty->assign('ur_here', $_LANG['report_order']); $smarty->assign('start_date', local_date($_CFG['date_format'], $start_date)); $smarty->assign('end_date', local_date($_CFG['date_format'], $end_date)); for ($i = 0; $i < 5; $i++) { if (isset($start_date_arr[$i])) { $start_date_arr[$i] = local_date('Y-m', $start_date_arr[$i]); } else { $start_date_arr[$i] = null; } } $smarty->assign('start_date_arr', $start_date_arr); if (!$is_multi) { $filename = local_date('Ymd', $start_date) . '_' . local_date('Ymd', $end_date); $smarty->assign('action_link', array('text' => $_LANG['down_order_statistics'], 'href' => 'order_stats.php?act=download&start_date=' . $start_date . '&end_date=' . $end_date . '&filename=' . $filename)); } assign_query_info(); $smarty->display('order_stats.htm'); } elseif ($act = 'download') { $filename = !empty($_REQUEST['filename']) ? trim($_REQUEST['filename']) : ''; header("Content-type: application/vnd.ms-excel; charset=utf-8"); header("Content-Disposition: attachment; filename=$filename.xls"); $start_date = $_REQUEST['start_date']; $end_date = $_REQUEST['end_date']; /* 订单概况 */ $order_info = get_orderinfo($start_date, $end_date); $data = $_LANG['order_circs'] . "\n"; $data .= "$_LANG[confirmed] \t $_LANG[succeed] \t $_LANG[unconfirmed] \t $_LANG[invalid] \n"; $data .= "$order_info[confirmed_num] \t $order_info[succeed_num] \t $order_info[unconfirmed_num] \t $order_info[invalid_num]\n"; $data .= "\n$_LANG[pay_method]\n"; /* 支付方式 */ $sql = 'SELECT i.pay_id, p.pay_name, COUNT(i.order_id) AS order_num ' . 'FROM ' .$ecs->table('payment'). ' AS p, ' .$ecs->table('order_info'). ' AS i '. "WHERE p.pay_id = i.pay_id " . order_query_sql('finished') . "AND i.add_time >= '$start_date' AND i.add_time <= '$end_date' ". "GROUP BY i.pay_id ORDER BY order_num DESC"; $pay_res= $db->getAll($sql); foreach ($pay_res AS $val) { $data .= $val['pay_name'] . "\t"; } $data .= "\n"; foreach ($pay_res AS $val) { $data .= $val['order_num'] . "\t"; } /* 配送方式 */ $sql = 'SELECT sp.shipping_id, sp.shipping_name AS ship_name, COUNT(i.order_id) AS order_num ' . 'FROM ' .$ecs->table('shipping'). ' AS sp, ' .$ecs->table('order_info'). ' AS i ' . 'WHERE sp.shipping_id = i.shipping_id ' . order_query_sql('finished') . "AND i.add_time >= '$start_date' AND i.add_time <= '$end_date' " . "GROUP BY i.shipping_id ORDER BY order_num DESC"; $ship_res = $db->getAll($sql); $data .= "\n$_LANG[shipping_method]\n"; foreach ($ship_res AS $val) { $data .= $val['ship_name'] . "\t"; } $data .= "\n"; foreach ($ship_res AS $val) { $data .= $val['order_num'] . "\t"; } echo ecs_iconv(EC_CHARSET, 'GB2312', $data) . "\t"; exit; } /*------------------------------------------------------ */ //--订单统计需要的函数 /*------------------------------------------------------ */ /** * 取得订单概况数据(包括订单的几种状态) * @param $start_date 开始查询的日期 * @param $end_date 查询的结束日期 * @return $order_info 订单概况数据 */ function get_orderinfo($start_date, $end_date) { $order_info = array(); /* 未确认订单数 */ $sql = 'SELECT COUNT(*) AS unconfirmed_num FROM ' .$GLOBALS['ecs']->table('order_info'). " WHERE order_status = '" .OS_UNCONFIRMED. "' AND add_time >= '$start_date'". " AND add_time < '" . ($end_date + 86400) . "'"; $order_info['unconfirmed_num'] = $GLOBALS['db']->getOne($sql); /* 已确认订单数 */ $sql = 'SELECT COUNT(*) AS confirmed_num FROM ' .$GLOBALS['ecs']->table('order_info'). " WHERE order_status = '" .OS_CONFIRMED. "' AND shipping_status NOT ". db_create_in(array(SS_SHIPPED, SS_RECEIVED)) . " AND pay_status NOT" . db_create_in(array(PS_PAYED, PS_PAYING)) ." AND add_time >= '$start_date'". " AND add_time < '" . ($end_date + 86400) . "'"; $order_info['confirmed_num'] = $GLOBALS['db']->getOne($sql); /* 已成交订单数 */ $sql = 'SELECT COUNT(*) AS succeed_num FROM ' .$GLOBALS['ecs']->table('order_info'). " WHERE 1 " . order_query_sql('finished') . " AND add_time >= '$start_date' AND add_time < '" . ($end_date + 86400) . "'"; $order_info['succeed_num'] = $GLOBALS['db']->getOne($sql); /* 无效或已取消订单数 */ $sql = "SELECT COUNT(*) AS invalid_num FROM " .$GLOBALS['ecs']->table('order_info'). " WHERE order_status > '" .OS_CONFIRMED. "'". " AND add_time >= '$start_date' AND add_time < '" . ($end_date + 86400) . "'"; $order_info['invalid_num'] = $GLOBALS['db']->getOne($sql); return $order_info; } ?>
zzshop
trunk/admin/order_stats.php
PHP
asf20
18,301
<?php /** * ECSHOP 管理中心团购商品管理 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: group_buy.php 17063 2010-03-25 06:35:46Z liuhui $ */ define('IN_ECS', true); require(dirname(__FILE__) . '/includes/init.php'); require_once(ROOT_PATH . 'includes/lib_goods.php'); require_once(ROOT_PATH . 'includes/lib_order.php'); /* 检查权限 */ admin_priv('group_by'); /* act操作项的初始化 */ if (empty($_REQUEST['act'])) { $_REQUEST['act'] = 'list'; } else { $_REQUEST['act'] = trim($_REQUEST['act']); } /*------------------------------------------------------ */ //-- 团购活动列表 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'list') { /* 模板赋值 */ $smarty->assign('full_page', 1); $smarty->assign('ur_here', $_LANG['group_buy_list']); $smarty->assign('action_link', array('href' => 'group_buy.php?act=add', 'text' => $_LANG['add_group_buy'])); $list = group_buy_list(); $smarty->assign('group_buy_list', $list['item']); $smarty->assign('filter', $list['filter']); $smarty->assign('record_count', $list['record_count']); $smarty->assign('page_count', $list['page_count']); $sort_flag = sort_flag($list['filter']); $smarty->assign($sort_flag['tag'], $sort_flag['img']); /* 显示商品列表页面 */ assign_query_info(); $smarty->display('group_buy_list.htm'); } elseif ($_REQUEST['act'] == 'query') { $list = group_buy_list(); $smarty->assign('group_buy_list', $list['item']); $smarty->assign('filter', $list['filter']); $smarty->assign('record_count', $list['record_count']); $smarty->assign('page_count', $list['page_count']); $sort_flag = sort_flag($list['filter']); $smarty->assign($sort_flag['tag'], $sort_flag['img']); make_json_result($smarty->fetch('group_buy_list.htm'), '', array('filter' => $list['filter'], 'page_count' => $list['page_count'])); } /*------------------------------------------------------ */ //-- 添加/编辑团购活动 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'add' || $_REQUEST['act'] == 'edit') { /* 初始化/取得团购活动信息 */ if ($_REQUEST['act'] == 'add') { $group_buy = array( 'act_id' => 0, 'start_time' => date('Y-m-d', time() + 86400), 'end_time' => date('Y-m-d', time() + 4 * 86400), 'price_ladder' => array(array('amount' => 0, 'price' => 0)) ); } else { $group_buy_id = intval($_REQUEST['id']); if ($group_buy_id <= 0) { die('invalid param'); } $group_buy = group_buy_info($group_buy_id); } $smarty->assign('group_buy', $group_buy); /* 模板赋值 */ $smarty->assign('ur_here', $_LANG['add_group_buy']); $smarty->assign('action_link', list_link($_REQUEST['act'] == 'add')); $smarty->assign('cat_list', cat_list()); $smarty->assign('brand_list', get_brand_list()); /* 显示模板 */ assign_query_info(); $smarty->display('group_buy_info.htm'); } /*------------------------------------------------------ */ //-- 添加/编辑团购活动的提交 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] =='insert_update') { /* 取得团购活动id */ $group_buy_id = intval($_POST['act_id']); if (isset($_POST['finish']) || isset($_POST['succeed']) || isset($_POST['fail']) || isset($_POST['mail'])) { if ($group_buy_id <= 0) { sys_msg($_LANG['error_group_buy'], 1); } $group_buy = group_buy_info($group_buy_id); if (empty($group_buy)) { sys_msg($_LANG['error_group_buy'], 1); } } if (isset($_POST['finish'])) { /* 判断订单状态 */ if ($group_buy['status'] != GBS_UNDER_WAY) { sys_msg($_LANG['error_status'], 1); } /* 结束团购活动,修改结束时间为当前时间 */ $sql = "UPDATE " . $ecs->table('goods_activity') . " SET end_time = '" . gmtime() . "' " . "WHERE act_id = '$group_buy_id' LIMIT 1"; $db->query($sql); /* 清除缓存 */ clear_cache_files(); /* 提示信息 */ $links = array( array('href' => 'group_buy.php?act=list', 'text' => $_LANG['back_list']) ); sys_msg($_LANG['edit_success'], 0, $links); } elseif (isset($_POST['succeed'])) { /* 设置活动成功 */ /* 判断订单状态 */ if ($group_buy['status'] != GBS_FINISHED) { sys_msg($_LANG['error_status'], 1); } /* 如果有订单,更新订单信息 */ if ($group_buy['total_order'] > 0) { /* 查找该团购活动的已确认或未确认订单(已取消的就不管了) */ $sql = "SELECT order_id " . "FROM " . $ecs->table('order_info') . " WHERE extension_code = 'group_buy' " . "AND extension_id = '$group_buy_id' " . "AND (order_status = '" . OS_CONFIRMED . "' or order_status = '" . OS_UNCONFIRMED . "')"; $order_id_list = $db->getCol($sql); /* 更新订单商品价 */ $final_price = $group_buy['trans_price']; $sql = "UPDATE " . $ecs->table('order_goods') . " SET goods_price = '$final_price' " . "WHERE order_id " . db_create_in($order_id_list); $db->query($sql); /* 查询订单商品总额 */ $sql = "SELECT order_id, SUM(goods_number * goods_price) AS goods_amount " . "FROM " . $ecs->table('order_goods') . " WHERE order_id " . db_create_in($order_id_list) . " GROUP BY order_id"; $res = $db->query($sql); while ($row = $db->fetchRow($res)) { $order_id = $row['order_id']; $goods_amount = floatval($row['goods_amount']); /* 取得订单信息 */ $order = order_info($order_id); /* 判断订单是否有效:余额支付金额 + 已付款金额 >= 保证金 */ if ($order['surplus'] + $order['money_paid'] >= $group_buy['deposit']) { /* 有效,设为已确认,更新订单 */ // 更新商品总额 $order['goods_amount'] = $goods_amount; // 如果保价,重新计算保价费用 if ($order['insure_fee'] > 0) { $shipping = shipping_info($order['shipping_id']); $order['insure_fee'] = shipping_insure_fee($shipping['shipping_code'], $goods_amount, $shipping['insure']); } // 重算支付费用 $order['order_amount'] = $order['goods_amount'] + $order['shipping_fee'] + $order['insure_fee'] + $order['pack_fee'] + $order['card_fee'] - $order['money_paid'] - $order['surplus']; if ($order['order_amount'] > 0) { $order['pay_fee'] = pay_fee($order['pay_id'], $order['order_amount']); } else { $order['pay_fee'] = 0; } // 计算应付款金额 $order['order_amount'] += $order['pay_fee']; // 计算付款状态 if ($order['order_amount'] > 0) { $order['pay_status'] = PS_UNPAYED; $order['pay_time'] = 0; } else { $order['pay_status'] = PS_PAYED; $order['pay_time'] = gmtime(); } // 如果需要退款,退到帐户余额 if ($order['order_amount'] < 0) { // todo (现在手工退款) } // 订单状态 $order['order_status'] = OS_CONFIRMED; $order['confirm_time'] = gmtime(); // 更新订单 $order = addslashes_deep($order); update_order($order_id, $order); } else { /* 无效,取消订单,退回已付款 */ // 修改订单状态为已取消,付款状态为未付款 $order['order_status'] = OS_CANCELED; $order['to_buyer'] = $_LANG['cancel_order_reason']; $order['pay_status'] = PS_UNPAYED; $order['pay_time'] = 0; /* 如果使用余额或有已付款金额,退回帐户余额 */ $money = $order['surplus'] + $order['money_paid']; if ($money > 0) { $order['surplus'] = 0; $order['money_paid'] = 0; $order['order_amount'] = $money; // 退款到帐户余额 order_refund($order, 1, $_LANG['cancel_order_reason'] . ':' . $order['order_sn']); } /* 更新订单 */ $order = addslashes_deep($order); update_order($order['order_id'], $order); } } } /* 修改团购活动状态为成功 */ $sql = "UPDATE " . $ecs->table('goods_activity') . " SET is_finished = '" . GBS_SUCCEED . "' " . "WHERE act_id = '$group_buy_id' LIMIT 1"; $db->query($sql); /* 清除缓存 */ clear_cache_files(); /* 提示信息 */ $links = array( array('href' => 'group_buy.php?act=list', 'text' => $_LANG['back_list']) ); sys_msg($_LANG['edit_success'], 0, $links); } elseif (isset($_POST['fail'])) { /* 设置活动失败 */ /* 判断订单状态 */ if ($group_buy['status'] != GBS_FINISHED) { sys_msg($_LANG['error_status'], 1); } /* 如果有有效订单,取消订单 */ if ($group_buy['valid_order'] > 0) { /* 查找未确认或已确认的订单 */ $sql = "SELECT * " . "FROM " . $ecs->table('order_info') . " WHERE extension_code = 'group_buy' " . "AND extension_id = '$group_buy_id' " . "AND (order_status = '" . OS_CONFIRMED . "' OR order_status = '" . OS_UNCONFIRMED . "') "; $res = $db->query($sql); while ($order = $db->fetchRow($res)) { // 修改订单状态为已取消,付款状态为未付款 $order['order_status'] = OS_CANCELED; $order['to_buyer'] = $_LANG['cancel_order_reason']; $order['pay_status'] = PS_UNPAYED; $order['pay_time'] = 0; /* 如果使用余额或有已付款金额,退回帐户余额 */ $money = $order['surplus'] + $order['money_paid']; if ($money > 0) { $order['surplus'] = 0; $order['money_paid'] = 0; $order['order_amount'] = $money; // 退款到帐户余额 order_refund($order, 1, $_LANG['cancel_order_reason'] . ':' . $order['order_sn'], $money); } /* 更新订单 */ $order = addslashes_deep($order); update_order($order['order_id'], $order); } } /* 修改团购活动状态为失败,记录失败原因(活动说明) */ $sql = "UPDATE " . $ecs->table('goods_activity') . " SET is_finished = '" . GBS_FAIL . "', " . "act_desc = '$_POST[act_desc]' " . "WHERE act_id = '$group_buy_id' LIMIT 1"; $db->query($sql); /* 清除缓存 */ clear_cache_files(); /* 提示信息 */ $links = array( array('href' => 'group_buy.php?act=list', 'text' => $_LANG['back_list']) ); sys_msg($_LANG['edit_success'], 0, $links); } elseif (isset($_POST['mail'])) { /* 发送通知邮件 */ /* 判断订单状态 */ if ($group_buy['status'] != GBS_SUCCEED) { sys_msg($_LANG['error_status'], 1); } /* 取得邮件模板 */ $tpl = get_mail_template('group_buy'); /* 初始化订单数和成功发送邮件数 */ $count = 0; $send_count = 0; /* 取得有效订单 */ $sql = "SELECT o.consignee, o.add_time, g.goods_number, o.order_sn, " . "o.order_amount, o.order_id, o.email " . "FROM " . $ecs->table('order_info') . " AS o, " . $ecs->table('order_goods') . " AS g " . "WHERE o.order_id = g.order_id " . "AND o.extension_code = 'group_buy' " . "AND o.extension_id = '$group_buy_id' " . "AND o.order_status = '" . OS_CONFIRMED . "'"; $res = $db->query($sql); while ($order = $db->fetchRow($res)) { /* 邮件模板赋值 */ $smarty->assign('consignee', $order['consignee']); $smarty->assign('add_time', local_date($_CFG['time_format'], $order['add_time'])); $smarty->assign('goods_name', $group_buy['goods_name']); $smarty->assign('goods_number', $order['goods_number']); $smarty->assign('order_sn', $order['order_sn']); $smarty->assign('order_amount', price_format($order['order_amount'])); $smarty->assign('shop_url', $ecs->url() . 'user.php?act=order_detail&order_id='.$order['order_id']); $smarty->assign('shop_name', $_CFG['shop_name']); $smarty->assign('send_date', local_date($_CFG['date_format'])); /* 取得模板内容,发邮件 */ $content = $smarty->fetch('str:' . $tpl['template_content']); if (send_mail($order['consignee'], $order['email'], $tpl['template_subject'], $content, $tpl['is_html'])) { $send_count++; } $count++; } /* 提示信息 */ sys_msg(sprintf($_LANG['mail_result'], $count, $send_count)); } else { /* 保存团购信息 */ $goods_id = intval($_POST['goods_id']); if ($goods_id <= 0) { sys_msg($_LANG['error_goods_null']); } $info = goods_group_buy($goods_id); if ($info && $info['act_id'] != $group_buy_id) { sys_msg($_LANG['error_goods_exist']); } $goods_name = $db->getOne("SELECT goods_name FROM " . $ecs->table('goods') . " WHERE goods_id = '$goods_id'"); $act_name = empty($_POST['act_name']) ? $goods_name : sub_str($_POST['act_name'], 0, 255, false); $deposit = floatval($_POST['deposit']); if ($deposit < 0) { $deposit = 0; } $restrict_amount = intval($_POST['restrict_amount']); if ($restrict_amount < 0) { $restrict_amount = 0; } $gift_integral = intval($_POST['gift_integral']); if ($gift_integral < 0) { $gift_integral = 0; } $price_ladder = array(); $count = count($_POST['ladder_amount']); for ($i = $count - 1; $i >= 0; $i--) { /* 如果数量小于等于0,不要 */ $amount = intval($_POST['ladder_amount'][$i]); if ($amount <= 0) { continue; } /* 如果价格小于等于0,不要 */ $price = round(floatval($_POST['ladder_price'][$i]), 2); if ($price <= 0) { continue; } /* 加入价格阶梯 */ $price_ladder[$amount] = array('amount' => $amount, 'price' => $price); } if (count($price_ladder) < 1) { sys_msg($_LANG['error_price_ladder']); } /* 限购数量不能小于价格阶梯中的最大数量 */ $amount_list = array_keys($price_ladder); if ($restrict_amount > 0 && max($amount_list) > $restrict_amount) { sys_msg($_LANG['error_restrict_amount']); } ksort($price_ladder); $price_ladder = array_values($price_ladder); /* 检查开始时间和结束时间是否合理 */ $start_time = local_strtotime($_POST['start_time']); $end_time = local_strtotime($_POST['end_time']); if ($start_time >= $end_time) { sys_msg($_LANG['invalid_time']); } $group_buy = array( 'act_name' => $act_name, 'act_desc' => $_POST['act_desc'], 'act_type' => GAT_GROUP_BUY, 'goods_id' => $goods_id, 'goods_name' => $goods_name, 'start_time' => $start_time, 'end_time' => $end_time, 'ext_info' => serialize(array( 'price_ladder' => $price_ladder, 'restrict_amount' => $restrict_amount, 'gift_integral' => $gift_integral, 'deposit' => $deposit )) ); /* 清除缓存 */ clear_cache_files(); /* 保存数据 */ if ($group_buy_id > 0) { /* update */ $db->autoExecute($ecs->table('goods_activity'), $group_buy, 'UPDATE', "act_id = '$group_buy_id'"); /* log */ admin_log(addslashes($goods_name) . '[' . $group_buy_id . ']', 'edit', 'group_buy'); /* todo 更新活动表 */ /* 提示信息 */ $links = array( array('href' => 'group_buy.php?act=list&' . list_link_postfix(), 'text' => $_LANG['back_list']) ); sys_msg($_LANG['edit_success'], 0, $links); } else { /* insert */ $db->autoExecute($ecs->table('goods_activity'), $group_buy, 'INSERT'); /* log */ admin_log(addslashes($goods_name), 'add', 'group_buy'); /* 提示信息 */ $links = array( array('href' => 'group_buy.php?act=add', 'text' => $_LANG['continue_add']), array('href' => 'group_buy.php?act=list', 'text' => $_LANG['back_list']) ); sys_msg($_LANG['add_success'], 0, $links); } } } /*------------------------------------------------------ */ //-- 批量删除团购活动 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'batch_drop') { if (isset($_POST['checkboxes'])) { $del_count = 0; //初始化删除数量 foreach ($_POST['checkboxes'] AS $key => $id) { /* 取得团购活动信息 */ $group_buy = group_buy_info($id); /* 如果团购活动已经有订单,不能删除 */ if ($group_buy['valid_order'] <= 0) { /* 删除团购活动 */ $sql = "DELETE FROM " . $GLOBALS['ecs']->table('goods_activity') . " WHERE act_id = '$id' LIMIT 1"; $GLOBALS['db']->query($sql, 'SILENT'); admin_log(addslashes($group_buy['goods_name']) . '[' . $id . ']', 'remove', 'group_buy'); $del_count++; } } /* 如果删除了团购活动,清除缓存 */ if ($del_count > 0) { clear_cache_files(); } $links[] = array('text' => $_LANG['back_list'], 'href'=>'group_buy.php?act=list'); sys_msg(sprintf($_LANG['batch_drop_success'], $del_count), 0, $links); } else { $links[] = array('text' => $_LANG['back_list'], 'href'=>'group_buy.php?act=list'); sys_msg($_LANG['no_select_group_buy'], 0, $links); } } /*------------------------------------------------------ */ //-- 搜索商品 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'search_goods') { check_authz_json('group_by'); include_once(ROOT_PATH . 'includes/cls_json.php'); $json = new JSON; $filter = $json->decode($_GET['JSON']); $arr = get_goods_list($filter); make_json_result($arr); } /*------------------------------------------------------ */ //-- 编辑保证金 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'edit_deposit') { check_authz_json('group_by'); $id = intval($_POST['id']); $val = floatval($_POST['val']); $sql = "SELECT ext_info FROM " . $ecs->table('goods_activity') . " WHERE act_id = '$id' AND act_type = '" . GAT_GROUP_BUY . "'"; $ext_info = unserialize($db->getOne($sql)); $ext_info['deposit'] = $val; $sql = "UPDATE " . $ecs->table('goods_activity') . " SET ext_info = '" . serialize($ext_info) . "'" . " WHERE act_id = '$id'"; $db->query($sql); clear_cache_files(); make_json_result(number_format($val, 2)); } /*------------------------------------------------------ */ //-- 编辑保证金 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'edit_restrict_amount') { check_authz_json('group_by'); $id = intval($_POST['id']); $val = intval($_POST['val']); $sql = "SELECT ext_info FROM " . $ecs->table('goods_activity') . " WHERE act_id = '$id' AND act_type = '" . GAT_GROUP_BUY . "'"; $ext_info = unserialize($db->getOne($sql)); $ext_info['restrict_amount'] = $val; $sql = "UPDATE " . $ecs->table('goods_activity') . " SET ext_info = '" . serialize($ext_info) . "'" . " WHERE act_id = '$id'"; $db->query($sql); clear_cache_files(); make_json_result($val); } /*------------------------------------------------------ */ //-- 删除团购活动 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'remove') { check_authz_json('group_by'); $id = intval($_GET['id']); /* 取得团购活动信息 */ $group_buy = group_buy_info($id); /* 如果团购活动已经有订单,不能删除 */ if ($group_buy['valid_order'] > 0) { make_json_error($_LANG['error_exist_order']); } /* 删除团购活动 */ $sql = "DELETE FROM " . $ecs->table('goods_activity') . " WHERE act_id = '$id' LIMIT 1"; $db->query($sql); admin_log(addslashes($group_buy['goods_name']) . '[' . $id . ']', 'remove', 'group_buy'); clear_cache_files(); $url = 'group_buy.php?act=query&' . str_replace('act=remove', '', $_SERVER['QUERY_STRING']); ecs_header("Location: $url\n"); exit; } /* * 取得团购活动列表 * @return array */ function group_buy_list() { $result = get_filter(); if ($result === false) { /* 过滤条件 */ $filter['keyword'] = empty($_REQUEST['keyword']) ? '' : trim($_REQUEST['keyword']); if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) { $filter['keyword'] = json_str_iconv($filter['keyword']); } $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'act_id' : trim($_REQUEST['sort_by']); $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']); $where = (!empty($filter['keyword'])) ? " AND goods_name LIKE '%" . mysql_like_quote($filter['keyword']) . "%'" : ''; $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('goods_activity') . " WHERE act_type = '" . GAT_GROUP_BUY . "' $where"; $filter['record_count'] = $GLOBALS['db']->getOne($sql); /* 分页大小 */ $filter = page_and_size($filter); /* 查询 */ $sql = "SELECT * ". "FROM " . $GLOBALS['ecs']->table('goods_activity') . " WHERE act_type = '" . GAT_GROUP_BUY . "' $where ". " ORDER BY $filter[sort_by] $filter[sort_order] ". " LIMIT ". $filter['start'] .", $filter[page_size]"; $filter['keyword'] = stripslashes($filter['keyword']); set_filter($filter, $sql); } else { $sql = $result['sql']; $filter = $result['filter']; } $res = $GLOBALS['db']->query($sql); $list = array(); while ($row = $GLOBALS['db']->fetchRow($res)) { $ext_info = unserialize($row['ext_info']); $stat = group_buy_stat($row['act_id'], $ext_info['deposit']); $arr = array_merge($row, $stat, $ext_info); /* 处理价格阶梯 */ $price_ladder = $arr['price_ladder']; if (!is_array($price_ladder) || empty($price_ladder)) { $price_ladder = array(array('amount' => 0, 'price' => 0)); } else { foreach ($price_ladder AS $key => $amount_price) { $price_ladder[$key]['formated_price'] = price_format($amount_price['price']); } } /* 计算当前价 */ $cur_price = $price_ladder[0]['price']; // 初始化 $cur_amount = $stat['valid_goods']; // 当前数量 foreach ($price_ladder AS $amount_price) { if ($cur_amount >= $amount_price['amount']) { $cur_price = $amount_price['price']; } else { break; } } $arr['cur_price'] = $cur_price; $status = group_buy_status($arr); $arr['start_time'] = local_date($GLOBALS['_CFG']['date_format'], $arr['start_time']); $arr['end_time'] = local_date($GLOBALS['_CFG']['date_format'], $arr['end_time']); $arr['cur_status'] = $GLOBALS['_LANG']['gbs'][$status]; $list[] = $arr; } $arr = array('item' => $list, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']); return $arr; } /** * 取得某商品的团购活动 * @param int $goods_id 商品id * @return array */ function goods_group_buy($goods_id) { $sql = "SELECT * FROM " . $GLOBALS['ecs']->table('goods_activity') . " WHERE goods_id = '$goods_id' " . " AND act_type = '" . GAT_GROUP_BUY . "'" . " AND start_time <= " . gmtime() . " AND end_time >= " . gmtime(); return $GLOBALS['db']->getRow($sql); } /** * 列表链接 * @param bool $is_add 是否添加(插入) * @return array('href' => $href, 'text' => $text) */ function list_link($is_add = true) { $href = 'group_buy.php?act=list'; if (!$is_add) { $href .= '&' . list_link_postfix(); } return array('href' => $href, 'text' => $GLOBALS['_LANG']['group_buy_list']); } ?>
zzshop
trunk/admin/group_buy.php
PHP
asf20
29,045
<?php /** * ECSHOP 管理中心品牌管理 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: brand.php 17063 2010-03-25 06:35:46Z liuhui $ */ define('IN_ECS', true); require(dirname(__FILE__) . '/includes/init.php'); include_once(ROOT_PATH . 'includes/cls_image.php'); $image = new cls_image($_CFG['bgcolor']); $exc = new exchange($ecs->table("brand"), $db, 'brand_id', 'brand_name'); /*------------------------------------------------------ */ //-- 品牌列表 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'list') { $smarty->assign('ur_here', $_LANG['06_goods_brand_list']); $smarty->assign('action_link', array('text' => $_LANG['07_brand_add'], 'href' => 'brand.php?act=add')); $smarty->assign('full_page', 1); $brand_list = get_brandlist(); $smarty->assign('brand_list', $brand_list['brand']); $smarty->assign('filter', $brand_list['filter']); $smarty->assign('record_count', $brand_list['record_count']); $smarty->assign('page_count', $brand_list['page_count']); assign_query_info(); $smarty->display('brand_list.htm'); } /*------------------------------------------------------ */ //-- 添加品牌 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'add') { /* 权限判断 */ admin_priv('brand_manage'); $smarty->assign('ur_here', $_LANG['07_brand_add']); $smarty->assign('action_link', array('text' => $_LANG['06_goods_brand_list'], 'href' => 'brand.php?act=list')); $smarty->assign('form_action', 'insert'); assign_query_info(); $smarty->assign('brand', array('sort_order'=>50, 'is_show'=>1)); $smarty->display('brand_info.htm'); } elseif ($_REQUEST['act'] == 'insert') { /*检查品牌名是否重复*/ admin_priv('brand_manage'); $is_show = isset($_REQUEST['is_show']) ? intval($_REQUEST['is_show']) : 0; $is_only = $exc->is_only('brand_name', $_POST['brand_name']); if (!$is_only) { sys_msg(sprintf($_LANG['brandname_exist'], stripslashes($_POST['brand_name'])), 1); } /*对描述处理*/ if (!empty($_POST['brand_desc'])) { $_POST['brand_desc'] = $_POST['brand_desc']; } /*处理图片*/ $img_name = basename($image->upload_image($_FILES['brand_logo'],'brandlogo')); /*处理URL*/ $site_url = sanitize_url( $_POST['site_url'] ); /*插入数据*/ $sql = "INSERT INTO ".$ecs->table('brand')."(brand_name, site_url, brand_desc, brand_logo, is_show, sort_order) ". "VALUES ('$_POST[brand_name]', '$site_url', '$_POST[brand_desc]', '$img_name', '$is_show', '$_POST[sort_order]')"; $db->query($sql); admin_log($_POST['brand_name'],'add','brand'); /* 清除缓存 */ clear_cache_files(); $link[0]['text'] = $_LANG['continue_add']; $link[0]['href'] = 'brand.php?act=add'; $link[1]['text'] = $_LANG['back_list']; $link[1]['href'] = 'brand.php?act=list'; sys_msg($_LANG['brandadd_succed'], 0, $link); } /*------------------------------------------------------ */ //-- 编辑品牌 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'edit') { /* 权限判断 */ admin_priv('brand_manage'); $sql = "SELECT brand_id, brand_name, site_url, brand_logo, brand_desc, brand_logo, is_show, sort_order ". "FROM " .$ecs->table('brand'). " WHERE brand_id='$_REQUEST[id]'"; $brand = $db->GetRow($sql); $smarty->assign('ur_here', $_LANG['brand_edit']); $smarty->assign('action_link', array('text' => $_LANG['06_goods_brand_list'], 'href' => 'brand.php?act=list&' . list_link_postfix())); $smarty->assign('brand', $brand); $smarty->assign('form_action', 'updata'); assign_query_info(); $smarty->display('brand_info.htm'); } elseif ($_REQUEST['act'] == 'updata') { admin_priv('brand_manage'); if ($_POST['brand_name'] != $_POST['old_brandname']) { /*检查品牌名是否相同*/ $is_only = $exc->is_only('brand_name', $_POST['brand_name'], $_POST['id']); if (!$is_only) { sys_msg(sprintf($_LANG['brandname_exist'], stripslashes($_POST['brand_name'])), 1); } } /*对描述处理*/ if (!empty($_POST['brand_desc'])) { $_POST['brand_desc'] = $_POST['brand_desc']; } $is_show = isset($_REQUEST['is_show']) ? intval($_REQUEST['is_show']) : 0; /*处理URL*/ $site_url = sanitize_url( $_POST['site_url'] ); /* 处理图片 */ $img_name = basename($image->upload_image($_FILES['brand_logo'],'brandlogo')); $param = "brand_name = '$_POST[brand_name]', site_url='$site_url', brand_desc='$_POST[brand_desc]', is_show='$is_show', sort_order='$_POST[sort_order]' "; if (!empty($img_name)) { //有图片上传 $param .= " ,brand_logo = '$img_name' "; } if ($exc->edit($param, $_POST['id'])) { /* 清除缓存 */ clear_cache_files(); admin_log($_POST['brand_name'], 'edit', 'brand'); $link[0]['text'] = $_LANG['back_list']; $link[0]['href'] = 'brand.php?act=list&' . list_link_postfix(); $note = vsprintf($_LANG['brandedit_succed'], $_POST['brand_name']); sys_msg($note, 0, $link); } else { die($db->error()); } } /*------------------------------------------------------ */ //-- 编辑品牌名称 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'edit_brand_name') { check_authz_json('brand_manage'); $id = intval($_POST['id']); $name = json_str_iconv(trim($_POST['val'])); /* 检查名称是否重复 */ if ($exc->num("brand_name",$name, $id) != 0) { make_json_error(sprintf($_LANG['brandname_exist'], $name)); } else { if ($exc->edit("brand_name = '$name'", $id)) { admin_log($name,'edit','brand'); make_json_result(stripslashes($name)); } else { make_json_result(sprintf($_LANG['brandedit_fail'], $name)); } } } elseif($_REQUEST['act'] == 'add_brand') { $brand = empty($_REQUEST['brand']) ? '' : json_str_iconv(trim($_REQUEST['brand'])); if(brand_exists($brand)) { make_json_error($_LANG['brand_name_exist']); } else { $sql = "INSERT INTO " . $ecs->table('brand') . "(brand_name)" . "VALUES ( '$brand')"; $db->query($sql); $brand_id = $db->insert_id(); $arr = array("id"=>$brand_id, "brand"=>$brand); make_json_result($arr); } } /*------------------------------------------------------ */ //-- 编辑排序序号 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'edit_sort_order') { check_authz_json('brand_manage'); $id = intval($_POST['id']); $order = intval($_POST['val']); $name = $exc->get_name($id); if ($exc->edit("sort_order = '$order'", $id)) { admin_log(addslashes($name),'edit','brand'); make_json_result($order); } else { make_json_error(sprintf($_LANG['brandedit_fail'], $name)); } } /*------------------------------------------------------ */ //-- 切换是否显示 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'toggle_show') { check_authz_json('brand_manage'); $id = intval($_POST['id']); $val = intval($_POST['val']); $exc->edit("is_show='$val'", $id); make_json_result($val); } /*------------------------------------------------------ */ //-- 删除品牌 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'remove') { check_authz_json('brand_manage'); $id = intval($_GET['id']); /* 删除该品牌的图标 */ $sql = "SELECT brand_logo FROM " .$ecs->table('brand'). " WHERE brand_id = '$id'"; $logo_name = $db->getOne($sql); if (!empty($logo_name)) { @unlink(ROOT_PATH . DATA_DIR . '/brandlogo/' .$logo_name); } $exc->drop($id); /* 更新商品的品牌编号 */ $sql = "UPDATE " .$ecs->table('goods'). " SET brand_id=0 WHERE brand_id='$id'"; $db->query($sql); $url = 'brand.php?act=query&' . str_replace('act=remove', '', $_SERVER['QUERY_STRING']); ecs_header("Location: $url\n"); exit; } /*------------------------------------------------------ */ //-- 删除品牌图片 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'drop_logo') { /* 权限判断 */ admin_priv('brand_manage'); $brand_id = isset($_GET['id']) ? intval($_GET['id']) : 0; /* 取得logo名称 */ $sql = "SELECT brand_logo FROM " .$ecs->table('brand'). " WHERE brand_id = '$brand_id'"; $logo_name = $db->getOne($sql); if (!empty($logo_name)) { @unlink(ROOT_PATH . DATA_DIR . '/brandlogo/' .$logo_name); $sql = "UPDATE " .$ecs->table('brand'). " SET brand_logo = '' WHERE brand_id = '$brand_id'"; $db->query($sql); } $link= array(array('text' => $_LANG['brand_edit_lnk'], 'href' => 'brand.php?act=edit&id=' . $brand_id), array('text' => $_LANG['brand_list_lnk'], 'href' => 'brand.php?act=list')); sys_msg($_LANG['drop_brand_logo_success'], 0, $link); } /*------------------------------------------------------ */ //-- 排序、分页、查询 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'query') { $brand_list = get_brandlist(); $smarty->assign('brand_list', $brand_list['brand']); $smarty->assign('filter', $brand_list['filter']); $smarty->assign('record_count', $brand_list['record_count']); $smarty->assign('page_count', $brand_list['page_count']); make_json_result($smarty->fetch('brand_list.htm'), '', array('filter' => $brand_list['filter'], 'page_count' => $brand_list['page_count'])); } /** * 获取品牌列表 * * @access public * @return array */ function get_brandlist() { $result = get_filter(); if ($result === false) { /* 分页大小 */ $filter = array(); /* 记录总数以及页数 */ if (isset($_POST['brand_name'])) { $sql = "SELECT COUNT(*) FROM ".$GLOBALS['ecs']->table('brand') .' WHERE brand_name = \''.$_POST['brand_name'].'\''; } else { $sql = "SELECT COUNT(*) FROM ".$GLOBALS['ecs']->table('brand'); } $filter['record_count'] = $GLOBALS['db']->getOne($sql); $filter = page_and_size($filter); /* 查询记录 */ if (isset($_POST['brand_name'])) { if(strtoupper(EC_CHARSET) == 'GBK') { $keyword = iconv("UTF-8", "gb2312", $_POST['brand_name']); } else { $keyword = $_POST['brand_name']; } $sql = "SELECT * FROM ".$GLOBALS['ecs']->table('brand')." WHERE brand_name like '%{$keyword}%' ORDER BY sort_order ASC"; } else { $sql = "SELECT * FROM ".$GLOBALS['ecs']->table('brand')." ORDER BY sort_order ASC"; } set_filter($filter, $sql); } else { $sql = $result['sql']; $filter = $result['filter']; } $res = $GLOBALS['db']->selectLimit($sql, $filter['page_size'], $filter['start']); $arr = array(); while ($rows = $GLOBALS['db']->fetchRow($res)) { $brand_logo = empty($rows['brand_logo']) ? '' : '<a href="../' . DATA_DIR . '/brandlogo/'.$rows['brand_logo'].'" target="_brank"><img src="images/picflag.gif" width="16" height="16" border="0" alt='.$GLOBALS['_LANG']['brand_logo'].' /></a>'; $site_url = empty($rows['site_url']) ? 'N/A' : '<a href="'.$rows['site_url'].'" target="_brank">'.$rows['site_url'].'</a>'; $rows['brand_logo'] = $brand_logo; $rows['site_url'] = $site_url; $arr[] = $rows; } return array('brand' => $arr, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']); } ?>
zzshop
trunk/admin/brand.php
PHP
asf20
13,158
<?php /** * ECSHOP * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * * $Author: liuhui $ * $Id: goods_export.php 17107 2010-04-15 03:29:13Z liuhui $ */ define('IN_ECS', true); require(dirname(__FILE__) . '/includes/init.php'); if ($_REQUEST['act'] == 'goods_export') { /* 检查权限 */ admin_priv('goods_export'); $smarty->assign('ur_here', $_LANG['14_goods_export']); $smarty->assign('cat_list', cat_list()); $smarty->assign('brand_list', get_brand_list()); $smarty->assign('goods_type_list', goods_type_list(0)); $goods_fields = my_array_merge($_LANG['custom'], get_attributes()); $data_format_array = array( 'ecshop' => $_LANG['export_ecshop'], 'taobao V4.3' => $_LANG['export_taobao_v43'], 'taobao' => $_LANG['export_taobao'], 'paipai' => $_LANG['export_paipai'], 'paipai4' => $_LANG['export_paipai4'], 'custom' => $_LANG['export_custom'], ); $smarty->assign('data_format', $data_format_array); $smarty->assign('goods_fields', $goods_fields); assign_query_info(); $smarty->display('goods_export.htm'); } elseif ($_REQUEST['act'] == 'act_export_taobao') { /* 检查权限 */ admin_priv('goods_export'); include_once('includes/cls_phpzip.php'); $zip = new PHPZip; $where = get_export_where_sql($_POST); $goods_class = intval($_POST['goods_class']); $post_express = floatval($_POST['post_express']); $express = floatval($_POST['express']); $ems = floatval($_POST['ems']); $shop_province = '""'; $shop_city = '""'; if ($_CFG['shop_province'] || $_CFG['shop_city']) { $sql = "SELECT region_id, region_name FROM " . $ecs->table('region') . " WHERE region_id IN ('$_CFG[shop_province]', '$_CFG[shop_city]')"; $arr = $db->getAll($sql); if ($arr) { if (count($arr) == 1) { if ($arr[0]['region_id'] == $_CFG['shop_province']) { $shop_province = '"' . $arr[0]['region_name'] . '"' ; } else { $shop_city = '"' . $arr[0]['region_name'] . '"' ; } } else { if ($arr[0]['region_id'] == $_CFG['shop_province']) { $shop_province = '"' . $arr[0]['region_name'] . '"' ; $shop_city = '"' . $arr[1]['region_name'] . '"'; } else { $shop_province = '"' . $arr[1]['region_name'] . '"' ; $shop_city = '"' . $arr[0]['region_name'] . '"'; } } } } $sql = "SELECT g.goods_id, g.goods_name, g.shop_price, g.goods_number, g.goods_desc, g.goods_img ". " FROM " . $ecs->table('goods') . " AS g ". $where; $res = $db->query($sql); /* csv文件数组 */ $goods_value = array('goods_name'=>'""', 'goods_class'=>$goods_class, 'shop_class'=>0, 'new_level'=>5, 'province'=>$shop_province, 'city'=>$shop_city, 'sell_type'=>'"b"', 'shop_price'=>0, 'add_price'=>0, 'goods_number'=>0, 'die_day'=>14, 'load_type'=>1, 'post_express'=>$post_express, 'ems'=>$ems, 'express'=>$express, 'pay_type'=>2, 'allow_alipay'=>1, 'invoice'=>0, 'repair'=>0, 'resend'=>1, 'is_store'=>0, 'window'=>0, 'add_time'=>'"1980-1-1 0:00:00"', 'story'=>'""', 'goods_desc'=>'""', 'goods_img'=>'""', 'goods_attr'=>'""', 'group_buy'=>0, 'group_buy_num'=>0, 'template'=>0, 'discount'=>0, 'modify_time'=>'""', 'upload_status'=>100, 'img_status'=>1); $content = implode(",", $_LANG['taobao']) . "\n"; while ($row = $db->fetchRow($res)) { $goods_value['goods_name'] = '"' . $row['goods_name'] . '"'; $goods_value['shop_price'] = $row['shop_price']; $goods_value['goods_number'] = $row['goods_number']; $goods_value['goods_desc'] = replace_special_char($row['goods_desc']); $goods_value['goods_img'] = '"' . $row['goods_img'] . '"'; $content .= implode("\t", $goods_value) . "\n"; /* 压缩图片 */ if (!empty($row['goods_img']) && is_file(ROOT_PATH . $row['goods_img'])) { $zip->add_file(file_get_contents(ROOT_PATH . $row['goods_img']), $row['goods_img']); } } if (EC_CHARSET != 'utf-8') { $content = ecs_iconv(EC_CHARSET, 'utf-8', $content); } $zip->add_file("\xFF\xFE" . utf82u2($content), 'goods_list.csv'); header("Content-Disposition: attachment; filename=goods_list.zip"); header("Content-Type: application/unknown"); die($zip->file()); } elseif ($_REQUEST['act'] == 'act_export_taobao V4.3') { /* 检查权限 */ admin_priv('goods_export'); include_once('includes/cls_phpzip.php'); $zip = new PHPZip; $where = get_export_where_sql($_POST); $goods_class = intval($_POST['goods_class']); $post_express = floatval($_POST['post_express']); $express = floatval($_POST['express']); $ems = floatval($_POST['ems']); $shop_province = '""'; $shop_city = '""'; if ($_CFG['shop_province'] || $_CFG['shop_city']) { $sql = "SELECT region_id, region_name FROM " . $ecs->table('region') . " WHERE region_id IN ('$_CFG[shop_province]', '$_CFG[shop_city]')"; $arr = $db->getAll($sql); if ($arr) { if (count($arr) == 1) { if ($arr[0]['region_id'] == $_CFG['shop_province']) { $shop_province = '"' . $arr[0]['region_name'] . '"' ; } else { $shop_city = '"' . $arr[0]['region_name'] . '"' ; } } else { if ($arr[0]['region_id'] == $_CFG['shop_province']) { $shop_province = '"' . $arr[0]['region_name'] . '"' ; $shop_city = '"' . $arr[1]['region_name'] . '"'; } else { $shop_province = '"' . $arr[1]['region_name'] . '"' ; $shop_city = '"' . $arr[0]['region_name'] . '"'; } } } } $sql = "SELECT g.goods_id, g.goods_name, g.shop_price, g.goods_number, g.goods_desc, g.goods_img ". " FROM " . $ecs->table('goods') . " AS g ". $where; $res = $db->query($sql); /* csv文件数组 */ $goods_value = array('goods_name'=>'""', 'goods_class'=>$goods_class, 'shop_class'=>0, 'new_level'=>5, 'province'=>$shop_province, 'city'=>$shop_city, 'sell_type'=>'"b"', 'shop_price'=>0, 'add_price'=>0, 'goods_number'=>0, 'die_day'=>14, 'load_type'=>1, 'post_express'=>$post_express, 'ems'=>$ems, 'express'=>$express, 'pay_type'=>2, 'allow_alipay'=>1, 'invoice'=>0, 'repair'=>0, 'resend'=>1, 'is_store'=>0, 'window'=>0, 'add_time'=>'"1980-1-1 0:00:00"', 'story'=>'""', 'goods_desc'=>'""', 'goods_img'=>'""', 'goods_attr'=>'""', 'group_buy'=>0, 'group_buy_num'=>0, 'template'=>0, 'discount'=>0, 'modify_time'=>'""', 'upload_status'=>100, 'img_status'=>1); $content = implode("\t", $_LANG['taobao']) . "\n"; while ($row = $db->fetchRow($res)) { $goods_value['goods_name'] = '"' . $row['goods_name'] . '"'; $goods_value['shop_price'] = $row['shop_price']; $goods_value['goods_number'] = $row['goods_number']; $goods_value['goods_desc'] = replace_special_char($row['goods_desc']); $goods_value['goods_img'] = '"' . $row['goods_img'] . '"'; $content .= implode("\t", $goods_value) . "\n"; /* 压缩图片 */ if (!empty($row['goods_img']) && is_file(ROOT_PATH . $row['goods_img'])) { $zip->add_file(file_get_contents(ROOT_PATH . $row['goods_img']), $row['goods_img']); } } if (EC_CHARSET != 'utf-8') { $content = ecs_iconv(EC_CHARSET, 'utf-8', $content); } $zip->add_file("\xFF\xFE" . utf82u2($content), 'goods_list.csv'); header("Content-Disposition: attachment; filename=goods_list.zip"); header("Content-Type: application/unknown"); die($zip->file()); } /* 从淘宝导入数据 */ elseif ($_REQUEST['act'] == 'import_taobao') { $smarty->display('import_taobao.htm'); } elseif($_REQUEST['act'] == 'act_export_ecshop') { /* 检查权限 */ admin_priv('goods_export'); include_once('includes/cls_phpzip.php'); $zip = new PHPZip; $where = get_export_where_sql($_POST); $sql = "SELECT g.*, b.brand_name as brandname " . " FROM " . $ecs->table('goods') . " AS g LEFT JOIN " . $ecs->table('brand') . " AS b " . "ON g.brand_id = b.brand_id" . $where; $res = $db->query($sql); /* csv文件数组 */ $goods_value = array(); $goods_value['goods_name'] = '""'; $goods_value['goods_sn'] = '""'; $goods_value['brand_name'] = '""'; $goods_value['market_price'] = 0; $goods_value['shop_price'] = 0; $goods_value['integral'] = 0; $goods_value['original_img'] = '""'; $goods_value['goods_img'] = '""'; $goods_value['goods_thumb'] = '""'; $goods_value['keywords'] = '""'; $goods_value['goods_brief'] = '""'; $goods_value['goods_desc'] = '""'; $goods_value['goods_weight'] = 0; $goods_value['goods_number'] = 0; $goods_value['warn_number'] = 0; $goods_value['is_best'] = 0; $goods_value['is_new'] = 0; $goods_value['is_hot'] = 0; $goods_value['is_on_sale'] = 1; $goods_value['is_alone_sale'] = 1; $goods_value['is_real'] = 1; $content = '"' . implode('","', $_LANG['ecshop']) . "\"\n"; while ($row = $db->fetchRow($res)) { $goods_value['goods_name'] = '"' . $row['goods_name'] . '"'; $goods_value['goods_sn'] = '"' . $row['goods_sn'] . '"'; $goods_value['brand_name'] = '"' . $row['brandname'] . '"'; $goods_value['market_price'] = $row['market_price']; $goods_value['shop_price'] = $row['shop_price']; $goods_value['integral'] = $row['integral']; $goods_value['original_img'] = '"' . $row['original_img'] . '"'; $goods_value['goods_img'] = '"' . $row['goods_img'] . '"'; $goods_value['goods_thumb'] = '"' . $row['goods_thumb'] . '"'; $goods_value['keywords'] = '"' . $row['keywords'] . '"'; $goods_value['goods_brief'] = '"' . replace_special_char($row['goods_brief'], false) . '"'; $goods_value['goods_desc'] = '"' . replace_special_char($row['goods_desc'], false) . '"'; $goods_value['goods_weight'] = $row['goods_weight']; $goods_value['goods_number'] = $row['goods_number']; $goods_value['warn_number'] = $row['warn_number']; $goods_value['is_best'] = $row['is_best']; $goods_value['is_new'] = $row['is_new']; $goods_value['is_hot'] = $row['is_hot']; $goods_value['is_on_sale'] = $row['is_on_sale']; $goods_value['is_alone_sale'] = $row['is_alone_sale']; $goods_value['is_real'] = $row['is_real']; $content .= implode(",", $goods_value) . "\n"; /* 压缩图片 */ if (!empty($row['goods_img']) && is_file(ROOT_PATH . $row['goods_img'])) { $zip->add_file(file_get_contents(ROOT_PATH . $row['goods_img']), $row['goods_img']); } if (!empty($row['original_img']) && is_file(ROOT_PATH . $row['original_img'])) { $zip->add_file(file_get_contents(ROOT_PATH . $row['original_img']), $row['original_img']); } if (!empty($row['goods_thumb']) && is_file(ROOT_PATH . $row['goods_thumb'])) { $zip->add_file(file_get_contents(ROOT_PATH . $row['goods_thumb']), $row['goods_thumb']); } } $charset = empty($_POST['charset']) ? 'UTF8' : trim($_POST['charset']); $zip->add_file(ecs_iconv(EC_CHARSET, $charset, $content), 'goods_list.csv'); header("Content-Disposition: attachment; filename=goods_list.zip"); header("Content-Type: application/unknown"); die($zip->file()); } elseif ($_REQUEST['act'] == 'act_export_paipai') { /* 检查权限 */ admin_priv('goods_export'); include_once('includes/cls_phpzip.php'); $zip = new PHPZip; $where = get_export_where_sql($_POST); $post_express = floatval($_POST['post_express']); $express = floatval($_POST['express']); if ($post_express < 0) { $post_express = 10; } if ($express < 0) { $express = 20; } $shop_province = '""'; $shop_city = '""'; if ($_CFG['shop_province'] || $_CFG['shop_city']) { $sql = "SELECT region_id, region_name FROM " . $ecs->table('region') . " WHERE region_id IN ('$_CFG[shop_province]', '$_CFG[shop_city]')"; $arr = $db->getAll($sql); if ($arr) { if (count($arr) == 1) { if ($arr[0]['region_id'] == $_CFG['shop_province']) { $shop_province = '"' . $arr[0]['region_name'] . '"' ; } else { $shop_city = '"' . $arr[0]['region_name'] . '"' ; } } else { if ($arr[0]['region_id'] == $_CFG['shop_province']) { $shop_province = '"' . $arr[0]['region_name'] . '"' ; $shop_city = '"' . $arr[1]['region_name'] . '"'; } else { $shop_province = '"' . $arr[1]['region_name'] . '"' ; $shop_city = '"' . $arr[0]['region_name'] . '"'; } } } } $sql = "SELECT g.goods_id, g.goods_name, g.shop_price, g.goods_number, g.goods_desc, g.goods_img ". " FROM " . $ecs->table('goods') . " AS g ". $where; $res = $db->query($sql); $goods_value = array(); $goods_value['id'] = -1; $goods_value['tree_node_id'] = -1; $goods_value['old_tree_node_id'] = -1; $goods_value['title'] = '""'; $goods_value['id_in_web'] = '""'; $goods_value['auctionType'] = '"b"'; $goods_value['category'] = 0; $goods_value['shopCategoryId'] = '""'; $goods_value['pictURL'] = '""'; $goods_value['quantity'] = 0; $goods_value['duration'] = 14; $goods_value['startDate'] = '""'; $goods_value['stuffStatus'] = 5; $goods_value['price'] = 0; $goods_value['increment'] = 0; $goods_value['prov'] = $shop_province; $goods_value['city'] = $shop_city; $goods_value['shippingOption'] = 1; $goods_value['ordinaryPostFee'] = $post_express; $goods_value['fastPostFee'] = $express; $goods_value['paymentOption'] = 5; $goods_value['haveInvoice'] = 0; $goods_value['haveGuarantee'] = 0; $goods_value['secureTradeAgree'] = 1; $goods_value['autoRepost'] = 1; $goods_value['shopWindow'] = 0; $goods_value['failed_reason'] = '""'; $goods_value['pic_size'] = 0; $goods_value['pic_filename'] = '""'; $goods_value['pic'] = '""'; $goods_value['description'] = '""'; $goods_value['story'] = '""'; $goods_value['putStore'] = 0; $goods_value['pic_width'] = 80; $goods_value['pic_height'] = 80; $goods_value['skin'] = 0; $goods_value['prop'] = '""'; $content = '"' . implode('","', $_LANG['paipai']) . "\"\n"; while ($row = $db->fetchRow($res)) { $goods_value['title'] = '"' . $row['goods_name'] . '"'; $goods_value['price'] = $row['shop_price']; $goods_value['quantity'] = $row['goods_number']; $goods_value['description'] = replace_special_char($row['goods_desc']); $goods_value['pic_filename'] = '"' . $row['goods_img'] . '"'; $content .= implode(",", $goods_value) . "\n"; /* 压缩图片 */ if (!empty($row['goods_img']) && is_file(ROOT_PATH . $row['goods_img'])) { $zip->add_file(file_get_contents(ROOT_PATH . $row['goods_img']), $row['goods_img']); } } if (EC_CHARSET == 'utf-8') { $zip->add_file(ecs_iconv('UTF8', 'GB2312', $content), 'goods_list.csv'); } else { $zip->add_file($content, 'goods_list.csv'); } header("Content-Disposition: attachment; filename=goods_list.zip"); header("Content-Type: application/unknown"); die($zip->file()); } elseif ($_REQUEST['act'] == 'act_export_paipai4') { /* 检查权限 */ admin_priv('goods_export'); include_once('includes/cls_phpzip.php'); $zip = new PHPZip; $where = get_export_where_sql($_POST); $post_express = floatval($_POST['post_express']); $express = floatval($_POST['express']); if ($post_express < 0) { $post_express = 10; } if ($express < 0) { $express = 20; } $shop_province = '""'; $shop_city = '""'; if ($_CFG['shop_province'] || $_CFG['shop_city']) { $sql = "SELECT region_id, region_name FROM " . $ecs->table('region') . " WHERE region_id IN ('$_CFG[shop_province]', '$_CFG[shop_city]')"; $arr = $db->getAll($sql); if ($arr) { if (count($arr) == 1) { if ($arr[0]['region_id'] == $_CFG['shop_province']) { $shop_province = '"' . $arr[0]['region_name'] . '"' ; } else { $shop_city = '"' . $arr[0]['region_name'] . '"' ; } } else { if ($arr[0]['region_id'] == $_CFG['shop_province']) { $shop_province = '"' . $arr[0]['region_name'] . '"' ; $shop_city = '"' . $arr[1]['region_name'] . '"'; } else { $shop_province = '"' . $arr[1]['region_name'] . '"' ; $shop_city = '"' . $arr[0]['region_name'] . '"'; } } } } $sql = "SELECT g.goods_id, g.goods_name, g.shop_price, g.goods_number, g.goods_desc, g.goods_img ". " FROM " . $ecs->table('goods') . " AS g ". $where; $res = $db->query($sql); $goods_value = array(); $goods_value['id'] = -1; $goods_value['goods_name'] = '""'; $goods_value['auctionType'] = '"b"'; $goods_value['category'] = 0; $goods_value['shopCategoryId'] = '""'; $goods_value['quantity'] = 0; $goods_value['duration'] = 14; $goods_value['startDate'] = '""'; $goods_value['stuffStatus'] = 5; $goods_value['price'] = 0; $goods_value['increment'] = 0; $goods_value['prov'] = $shop_province; $goods_value['city'] = $shop_city; $goods_value['shippingOption'] = 1; $goods_value['ordinaryPostFee'] = $post_express; $goods_value['fastPostFee'] = $express; $goods_value['buyLimit'] = 0; $goods_value['paymentOption'] = 5; $goods_value['haveInvoice'] = 0; $goods_value['haveGuarantee'] = 0; $goods_value['secureTradeAgree'] = 1; $goods_value['autoRepost'] = 1; $goods_value['failed_reason'] = '""'; $goods_value['pic_filename'] = '""'; $goods_value['description'] = '""'; $goods_value['shelfOption'] = 0; $goods_value['skin'] = 0; $goods_value['attr'] = '""'; $goods_value['chengBao'] = '""'; $goods_value['shopWindow'] = 0; $content = '"' . implode('","', $_LANG['paipai4']) . "\"\n"; while ($row = $db->fetchRow($res)) { $goods_value['goods_name'] = '"' . $row['goods_name'] . '"'; $goods_value['price'] = $row['shop_price']; $goods_value['quantity'] = $row['goods_number']; $goods_value['description'] = replace_special_char($row['goods_desc']); $goods_value['pic_filename'] = '"' . $row['goods_img'] . '"'; $content .= implode(",", $goods_value) . "\n"; /* 压缩图片 */ if (!empty($row['goods_img']) && is_file(ROOT_PATH . $row['goods_img'])) { $zip->add_file(file_get_contents(ROOT_PATH . $row['goods_img']), $row['goods_img']); } } if (EC_CHARSET == 'utf-8') { $zip->add_file(ecs_iconv('UTF8', 'GB2312', $content), 'goods_list.csv'); } else { $zip->add_file($content, 'goods_list.csv'); } header("Content-Disposition: attachment; filename=goods_list.zip"); header("Content-Type: application/unknown"); die($zip->file()); } /* 从拍拍网导入数据 */ elseif ($_REQUEST['act'] == 'import_paipai') { $smarty->display('import_paipai.htm'); } /* 处理Ajax调用 */ elseif ($_REQUEST['act'] == 'get_goods_fields') { $cat_id = isset($_REQUEST['cat_id'])?intval($_REQUEST['cat_id']):0; $goods_fields = my_array_merge($_LANG['custom'], get_attributes($cat_id)); make_json_result($goods_fields); } elseif ($_REQUEST['act'] == 'act_export_custom') { /* 检查输出列 */ if (empty ($_POST['custom_goods_export'])) { sys_msg($_LANG['custom_goods_field_not_null'], 1, array(), false); } /* 检查权限 */ admin_priv('goods_export'); include_once('includes/cls_phpzip.php'); $zip = new PHPZip; $where = get_export_where_sql($_POST); $sql = "SELECT g.*, b.brand_name as brandname " . " FROM " . $ecs->table('goods') . " AS g LEFT JOIN " . $ecs->table('brand') . " AS b " . "ON g.brand_id = b.brand_id" . $where; $res = $db->query($sql); $goods_fields = explode(',', $_POST['custom_goods_export']); $goods_field_name = set_goods_field_name($goods_fields, $_LANG['custom']); /* csv文件数组 */ $goods_field_value = array(); foreach ($goods_fields as $field) { if ($field == 'market_price' || $field == 'shop_price' || $field == 'integral' || $field == 'goods_weight' || $field == 'goods_number' || $field == 'warn_number' || $field == 'is_best' || $field == 'is_new' || $field == 'is_hot') { $goods_field_value[$field] = 0; } elseif ($field == 'is_on_sale' || $field == 'is_alone_sale' || $field == 'is_real') { $goods_field_value[$field] = 1; } else { $goods_field_value[$field] = '""'; } } $content = '"' . implode('","', $goods_field_name) . "\"\n"; while ($row = $db->fetchRow($res)) { $goods_value = $goods_field_value; isset($goods_value['goods_name']) && ($goods_value['goods_name'] = '"' . $row['goods_name'] . '"'); isset($goods_value['goods_sn']) && ($goods_value['goods_sn'] = '"' . $row['goods_sn'] . '"'); isset($goods_value['brand_name']) && ($goods_value['brand_name'] = $row['brandname']); isset($goods_value['market_price']) && ($goods_value['market_price'] = $row['market_price']); isset($goods_value['shop_price']) && ($goods_value['shop_price'] = $row['shop_price']); isset($goods_value['integral']) && ($goods_value['integral'] = $row['integral']); isset($goods_value['original_img']) && ($goods_value['original_img'] = '"' . $row['original_img'] . '"'); isset($goods_value['keywords']) && ($goods_value['keywords'] = '"' . $row['keywords'] . '"'); isset($goods_value['goods_brief']) && ($goods_value['goods_brief'] = '"' . replace_special_char($row['goods_brief']) . '"'); isset($goods_value['goods_desc']) && ($goods_value['goods_desc'] = '"' . replace_special_char($row['goods_desc']) . '"'); isset($goods_value['goods_weight']) && ($goods_value['goods_weight'] = $row['goods_weight']); isset($goods_value['goods_number']) && ($goods_value['goods_number'] = $row['goods_number']); isset($goods_value['warn_number']) && ($goods_value['warn_number'] = $row['warn_number']); isset($goods_value['is_best']) && ($goods_value['is_best'] = $row['is_best']); isset($goods_value['is_new']) && ($goods_value['is_new'] = $row['is_new']); isset($goods_value['is_hot']) && ($goods_value['is_hot'] = $row['is_hot']); isset($goods_value['is_on_sale']) && ($goods_value['is_on_sale'] = $row['is_on_sale']); isset($goods_value['is_alone_sale']) && ($goods_value['is_alone_sale'] = $row['is_alone_sale']); isset($goods_value['is_real']) && ($goods_value['is_real'] = $row['is_real']); $sql = "SELECT `attr_id`, `attr_value` FROM " . $ecs->table('goods_attr') . " WHERE `goods_id` = '" . $row['goods_id'] . "'"; $query = $db->query($sql); while ($attr = $db->fetchRow($query)) { if (in_array($attr['attr_id'], $goods_fields)) { $goods_value[$attr['attr_id']] = '"' . $attr['attr_value'] . '"'; } } $content .= implode(",", $goods_value) . "\n"; /* 压缩图片 */ if (!empty($row['goods_img']) && is_file(ROOT_PATH . $row['goods_img'])) { $zip->add_file(file_get_contents(ROOT_PATH . $row['goods_img']), $row['goods_img']); } } $charset = empty($_POST['charset_custom']) ? 'UTF8' : trim($_POST['charset_custom']); $zip->add_file(ecs_iconv(EC_CHARSET, $charset, $content), 'goods_list.csv'); header("Content-Disposition: attachment; filename=goods_list.zip"); header("Content-Type: application/unknown"); die($zip->file()); } elseif ($_REQUEST['act'] == 'get_goods_list') { include_once(ROOT_PATH . 'includes/cls_json.php'); $json = new JSON; $filters = $json->decode($_REQUEST['JSON']); $arr = get_goods_list($filters); $opt = array(); foreach ($arr AS $key => $val) { $opt[] = array('goods_id' => $val['goods_id'], 'goods_name' => $val['goods_name'] ); } make_json_result($opt); } /** * * * @access public * @param * * @return void */ function utf82u2($str) { $len = strlen($str); $start = 0; $result = ''; if ($len == 0) { return $result; } while ($start < $len) { $num = ord($str{$start}); if ($num < 127) { $result .= chr($num) . chr($num >> 8); $start += 1; } else { if ($num < 192) { /* 无效字节 */ $start ++; } elseif ($num < 224) { if ($start + 1 < $len) { $num = (ord($str{$start}) & 0x3f) << 6; $num += ord($str{$start+1}) & 0x3f; $result .= chr($num & 0xff) . chr($num >> 8) ; } $start += 2; } elseif ($num < 240) { if ($start + 2 < $len) { $num = (ord($str{$start}) & 0x1f) << 12; $num += (ord($str{$start+1}) & 0x3f) << 6; $num += ord($str{$start+2}) & 0x3f; $result .= chr($num & 0xff) . chr($num >> 8) ; } $start += 3; } elseif ($num < 248) { if ($start + 3 < $len) { $num = (ord($str{$start}) & 0x0f) << 18; $num += (ord($str{$start+1}) & 0x3f) << 12; $num += (ord($str{$start+2}) & 0x3f) << 6; $num += ord($str{$start+3}) & 0x3f; $result .= chr($num & 0xff) . chr($num >> 8) . chr($num >>16); } $start += 4; } elseif ($num < 252) { if ($start + 4 < $len) { /* 不做处理 */ } $start += 5; } else { if ($start + 5 < $len) { /* 不做处理 */ } $start += 6; } } } return $result; } /** * * * @access public * @param * * @return string */ function image_path_format($content) { $prefix = 'http://' . $_SERVER['SERVER_NAME']; $pattern = '/(background|src)=[\'|\"]((?!http:\/\/).*?)[\'|\"]/i'; $replace = "$1='" . $prefix . "$2'"; return preg_replace($pattern, $replace, $content); } /** * 获取商品类型属性 * * @param int $cat_id 商品类型ID * * @return array */ function get_attributes($cat_id = 0) { $sql = "SELECT `attr_id`, `cat_id`, `attr_name` FROM " . $GLOBALS['ecs']->table('attribute') . " "; if (!empty($cat_id)) { $cat_id = intval($cat_id); $sql .= " WHERE `cat_id` = '{$cat_id}' "; } $sql .= " ORDER BY `cat_id` ASC, `attr_id` ASC "; $attributes = array(); $query = $GLOBALS['db']->query($sql); while ($row = $GLOBALS['db']->fetchRow($query)) { $attributes[$row['attr_id']] = $row['attr_name']; } return $attributes; } /** * 设置导出商品字段名 * * @param array $array 字段数组 * @param array $lang 字段名 * * @return array */ function set_goods_field_name($array, $lang) { $tmp_fields = $array; foreach ($array as $key => $value) { if (isset($lang[$value])) { $tmp_fields[$key] = $lang[$value]; } else { $tmp_fields[$key] = $GLOBALS['db']->getOne("SELECT `attr_name` FROM " . $GLOBALS['ecs']->table('attribute') . " WHERE `attr_id` = '" . intval($value) . "'"); } } return $tmp_fields; } /** * 数组合并 * * @param array $array1 数组1 * @param array $array2 数组2 * * @return array */ function my_array_merge($array1, $array2) { $new_array = $array1; foreach ($array2 as $key => $val) { $new_array[$key] = $val; } return $new_array; } /** * 生成商品导出过滤条件 * * @param array $filter 过滤条件数组 * * @return string */ function get_export_where_sql($filter) { $where = ''; if (!empty($filter['goods_ids'])) { $goods_ids = explode(',', $filter['goods_ids']); if (is_array($goods_ids) && !empty($goods_ids)) { $goods_ids = array_unique($goods_ids); $goods_ids = "'" . implode("','", $goods_ids) . "'"; } else { $goods_ids = "'0'"; } $where = " WHERE g.is_delete = 0 AND g.goods_id IN (" . $goods_ids . ") "; } else { $_filter = new StdClass(); $_filter->cat_id = $filter['cat_id']; $_filter->brand_id = $filter['brand_id']; $_filter->keyword = $filter['keyword']; $where = get_where_sql($_filter); } return $where; } /** * 替换影响csv文件的字符 * * @param $str string 处理字符串 */ function replace_special_char($str, $replace = true) { $str = str_replace("\r\n", "", image_path_format($str)); $str = str_replace("\t", " ", $str); $str = str_replace("\n", "", $str); if ($replace == true) { $str = '"' . str_replace('"', '""', $str) . '"'; } return $str; } ?>
zzshop
trunk/admin/goods_export.php
PHP
asf20
32,742
<?php /** * ECSHOP 红包类型的处理 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: bonus.php 17063 2010-03-25 06:35:46Z liuhui $ */ define('IN_ECS', true); require(dirname(__FILE__) . '/includes/init.php'); /* act操作项的初始化 */ if (empty($_REQUEST['act'])) { $_REQUEST['act'] = 'list'; } else { $_REQUEST['act'] = trim($_REQUEST['act']); } /* 初始化$exc对象 */ $exc = new exchange($ecs->table('bonus_type'), $db, 'type_id', 'type_name'); /*------------------------------------------------------ */ //-- 红包类型列表页面 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'list') { $smarty->assign('ur_here', $_LANG['04_bonustype_list']); $smarty->assign('action_link', array('text' => $_LANG['bonustype_add'], 'href' => 'bonus.php?act=add')); $smarty->assign('full_page', 1); $list = get_type_list(); $smarty->assign('type_list', $list['item']); $smarty->assign('filter', $list['filter']); $smarty->assign('record_count', $list['record_count']); $smarty->assign('page_count', $list['page_count']); $sort_flag = sort_flag($list['filter']); $smarty->assign($sort_flag['tag'], $sort_flag['img']); assign_query_info(); $smarty->display('bonus_type.htm'); } /*------------------------------------------------------ */ //-- 翻页、排序 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'query') { $list = get_type_list(); $smarty->assign('type_list', $list['item']); $smarty->assign('filter', $list['filter']); $smarty->assign('record_count', $list['record_count']); $smarty->assign('page_count', $list['page_count']); $sort_flag = sort_flag($list['filter']); $smarty->assign($sort_flag['tag'], $sort_flag['img']); make_json_result($smarty->fetch('bonus_type.htm'), '', array('filter' => $list['filter'], 'page_count' => $list['page_count'])); } /*------------------------------------------------------ */ //-- 编辑红包类型名称 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'edit_type_name') { check_authz_json('bonus_manage'); $id = intval($_POST['id']); $val = json_str_iconv(trim($_POST['val'])); /* 检查红包类型名称是否重复 */ if (!$exc->is_only('type_name', $id, $val)) { make_json_error($_LANG['type_name_exist']); } else { $exc->edit("type_name='$val'", $id); make_json_result(stripslashes($val)); } } /*------------------------------------------------------ */ //-- 编辑红包金额 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'edit_type_money') { check_authz_json('bonus_manage'); $id = intval($_POST['id']); $val = floatval($_POST['val']); /* 检查红包类型名称是否重复 */ if ($val <= 0) { make_json_error($_LANG['type_money_error']); } else { $exc->edit("type_money='$val'", $id); make_json_result(number_format($val, 2)); } } /*------------------------------------------------------ */ //-- 编辑订单下限 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'edit_min_amount') { check_authz_json('bonus_manage'); $id = intval($_POST['id']); $val = floatval($_POST['val']); if ($val < 0) { make_json_error($_LANG['min_amount_empty']); } else { $exc->edit("min_amount='$val'", $id); make_json_result(number_format($val, 2)); } } /*------------------------------------------------------ */ //-- 删除红包类型 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'remove') { check_authz_json('bonus_manage'); $id = intval($_GET['id']); $exc->drop($id); /* 更新商品信息 */ $db->query("UPDATE " .$ecs->table('goods'). " SET bonus_type_id = 0 WHERE bonus_type_id = '$id'"); /* 删除用户的红包 */ $db->query("DELETE FROM " .$ecs->table('user_bonus'). " WHERE bonus_type_id = '$id'"); $url = 'bonus.php?act=query&' . str_replace('act=remove', '', $_SERVER['QUERY_STRING']); ecs_header("Location: $url\n"); exit; } /*------------------------------------------------------ */ //-- 红包类型添加页面 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'add') { admin_priv('bonus_manage'); $smarty->assign('lang', $_LANG); $smarty->assign('ur_here', $_LANG['bonustype_add']); $smarty->assign('action_link', array('href' => 'bonus.php?act=list', 'text' => $_LANG['04_bonustype_list'])); $smarty->assign('action', 'add'); $smarty->assign('form_act', 'insert'); $smarty->assign('cfg_lang', $_CFG['lang']); $next_month = local_strtotime('+1 months'); $bonus_arr['send_start_date'] = local_date('Y-m-d'); $bonus_arr['use_start_date'] = local_date('Y-m-d'); $bonus_arr['send_end_date'] = local_date('Y-m-d', $next_month); $bonus_arr['use_end_date'] = local_date('Y-m-d', $next_month); $smarty->assign('bonus_arr', $bonus_arr); assign_query_info(); $smarty->display('bonus_type_info.htm'); } /*------------------------------------------------------ */ //-- 红包类型添加的处理 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'insert') { /* 去掉红包类型名称前后的空格 */ $type_name = !empty($_POST['type_name']) ? trim($_POST['type_name']) : ''; /* 初始化变量 */ $type_id = !empty($_POST['type_id']) ? intval($_POST['type_id']) : 0; $min_amount = !empty($_POST['min_amount']) ? intval($_POST['min_amount']) : 0; /* 检查类型是否有重复 */ $sql = "SELECT COUNT(*) FROM " .$ecs->table('bonus_type'). " WHERE type_name='$type_name'"; if ($db->getOne($sql) > 0) { $link[] = array('text' => $_LANG['go_back'], 'href' => 'javascript:history.back(-1)'); sys_msg($_LANG['type_name_exist'], 0, $link); } /* 获得日期信息 */ $send_startdate = local_strtotime($_POST['send_start_date']); $send_enddate = local_strtotime($_POST['send_end_date']); $use_startdate = local_strtotime($_POST['use_start_date']); $use_enddate = local_strtotime($_POST['use_end_date']); /* 插入数据库。 */ $sql = "INSERT INTO ".$ecs->table('bonus_type')." (type_name, type_money,send_start_date,send_end_date,use_start_date,use_end_date,send_type,min_amount,min_goods_amount) VALUES ('$type_name', '$_POST[type_money]', '$send_startdate', '$send_enddate', '$use_startdate', '$use_enddate', '$_POST[send_type]', '$min_amount','" . floatval($_POST['min_goods_amount']) . "')"; $db->query($sql); /* 记录管理员操作 */ admin_log($_POST['type_name'], 'add', 'bonustype'); /* 清除缓存 */ clear_cache_files(); /* 提示信息 */ $link[0]['text'] = $_LANG['continus_add']; $link[0]['href'] = 'bonus.php?act=add'; $link[1]['text'] = $_LANG['back_list']; $link[1]['href'] = 'bonus.php?act=list'; sys_msg($_LANG['add'] . "&nbsp;" .$_POST['type_name'] . "&nbsp;" . $_LANG['attradd_succed'],0, $link); } /*------------------------------------------------------ */ //-- 红包类型编辑页面 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'edit') { admin_priv('bonus_manage'); /* 获取红包类型数据 */ $type_id = !empty($_GET['type_id']) ? intval($_GET['type_id']) : 0; $bonus_arr = $db->getRow("SELECT * FROM " .$ecs->table('bonus_type'). " WHERE type_id = '$type_id'"); $bonus_arr['send_start_date'] = local_date('Y-m-d', $bonus_arr['send_start_date']); $bonus_arr['send_end_date'] = local_date('Y-m-d', $bonus_arr['send_end_date']); $bonus_arr['use_start_date'] = local_date('Y-m-d', $bonus_arr['use_start_date']); $bonus_arr['use_end_date'] = local_date('Y-m-d', $bonus_arr['use_end_date']); $smarty->assign('lang', $_LANG); $smarty->assign('ur_here', $_LANG['bonustype_edit']); $smarty->assign('action_link', array('href' => 'bonus.php?act=list&' . list_link_postfix(), 'text' => $_LANG['04_bonustype_list'])); $smarty->assign('form_act', 'update'); $smarty->assign('bonus_arr', $bonus_arr); assign_query_info(); $smarty->display('bonus_type_info.htm'); } /*------------------------------------------------------ */ //-- 红包类型编辑的处理 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'update') { /* 获得日期信息 */ $send_startdate = local_strtotime($_POST['send_start_date']); $send_enddate = local_strtotime($_POST['send_end_date']); $use_startdate = local_strtotime($_POST['use_start_date']); $use_enddate = local_strtotime($_POST['use_end_date']); /* 对数据的处理 */ $type_name = !empty($_POST['type_name']) ? trim($_POST['type_name']) : ''; $type_id = !empty($_POST['type_id']) ? intval($_POST['type_id']) : 0; $min_amount = !empty($_POST['min_amount']) ? intval($_POST['min_amount']) : 0; $sql = "UPDATE " .$ecs->table('bonus_type'). " SET ". "type_name = '$type_name', ". "type_money = '$_POST[type_money]', ". "send_start_date = '$send_startdate', ". "send_end_date = '$send_enddate', ". "use_start_date = '$use_startdate', ". "use_end_date = '$use_enddate', ". "send_type = '$_POST[send_type]', ". "min_amount = '$min_amount', " . "min_goods_amount = '" . floatval($_POST['min_goods_amount']) . "' ". "WHERE type_id = '$type_id'"; $db->query($sql); /* 记录管理员操作 */ admin_log($_POST['type_name'], 'edit', 'bonustype'); /* 清除缓存 */ clear_cache_files(); /* 提示信息 */ $link[] = array('text' => $_LANG['back_list'], 'href' => 'bonus.php?act=list&' . list_link_postfix()); sys_msg($_LANG['edit'] .' '.$_POST['type_name'].' '. $_LANG['attradd_succed'], 0, $link); } /*------------------------------------------------------ */ //-- 红包发送页面 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'send') { admin_priv('bonus_manage'); /* 取得参数 */ $id = !empty($_REQUEST['id']) ? intval($_REQUEST['id']) : ''; assign_query_info(); $smarty->assign('ur_here', $_LANG['send_bonus']); $smarty->assign('action_link', array('href' => 'bonus.php?act=list', 'text' => $_LANG['04_bonustype_list'])); if ($_REQUEST['send_by'] == SEND_BY_USER) { $smarty->assign('id', $id); $smarty->assign('ranklist', get_rank_list()); $smarty->display('bonus_by_user.htm'); } elseif ($_REQUEST['send_by'] == SEND_BY_GOODS) { /* 查询此红包类型信息 */ $bonus_type = $db->GetRow("SELECT type_id, type_name FROM ".$ecs->table('bonus_type'). " WHERE type_id='$_REQUEST[id]'"); /* 查询红包类型的商品列表 */ $goods_list = get_bonus_goods($_REQUEST['id']); /* 查询其他红包类型的商品 */ $sql = "SELECT goods_id FROM " .$ecs->table('goods'). " WHERE bonus_type_id > 0 AND bonus_type_id <> '$_REQUEST[id]'"; $other_goods_list = $db->getCol($sql); $smarty->assign('other_goods', join(',', $other_goods_list)); /* 模板赋值 */ $smarty->assign('cat_list', cat_list()); $smarty->assign('brand_list', get_brand_list()); $smarty->assign('bonus_type', $bonus_type); $smarty->assign('goods_list', $goods_list); $smarty->display('bonus_by_goods.htm'); } elseif ($_REQUEST['send_by'] == SEND_BY_PRINT) { $smarty->assign('type_list', get_bonus_type()); $smarty->display('bonus_by_print.htm'); } } /*------------------------------------------------------ */ //-- 处理红包的发送页面 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'send_by_user') { $user_list = array(); $start = empty($_REQUEST['start']) ? 0 : intval($_REQUEST['start']); $limit = empty($_REQUEST['limit']) ? 10 : intval($_REQUEST['limit']); $validated_email = empty($_REQUEST['validated_email']) ? 0 : intval($_REQUEST['validated_email']); $send_count = 0; if (isset($_REQUEST['send_rank'])) { /* 按会员等级来发放红包 */ $rank_id = intval($_REQUEST['rank_id']); if ($rank_id > 0) { $sql = "SELECT min_points, max_points, special_rank FROM " . $ecs->table('user_rank') . " WHERE rank_id = '$rank_id'"; $row = $db->getRow($sql); if ($row['special_rank']) { /* 特殊会员组处理 */ $sql = 'SELECT COUNT(*) FROM ' . $ecs->table('users'). " WHERE user_rank = '$rank_id'"; $send_count = $db->getOne($sql); if($validated_email) { $sql = 'SELECT user_id, email, user_name FROM ' . $ecs->table('users'). " WHERE user_rank = '$rank_id' AND is_validated = 1". " LIMIT $start, $limit"; } else { $sql = 'SELECT user_id, email, user_name FROM ' . $ecs->table('users'). " WHERE user_rank = '$rank_id'". " LIMIT $start, $limit"; } } else { $sql = 'SELECT COUNT(*) FROM ' . $ecs->table('users'). " WHERE rank_points >= " . intval($row['min_points']) . " AND rank_points < " . intval($row['max_points']); $send_count = $db->getOne($sql); if($validated_email) { $sql = 'SELECT user_id, email, user_name FROM ' . $ecs->table('users'). " WHERE rank_points >= " . intval($row['min_points']) . " AND rank_points < " . intval($row['max_points']) . " AND is_validated = 1 LIMIT $start, $limit"; } else { $sql = 'SELECT user_id, email, user_name FROM ' . $ecs->table('users'). " WHERE rank_points >= " . intval($row['min_points']) . " AND rank_points < " . intval($row['max_points']) . " LIMIT $start, $limit"; } } $user_list = $db->getAll($sql); $count = count($user_list); } } elseif (isset($_REQUEST['send_user'])) { /* 按会员列表发放红包 */ /* 如果是空数组,直接返回 */ if (empty($_REQUEST['user'])) { sys_msg($_LANG['send_user_empty'], 1); } $user_array = (is_array($_REQUEST['user'])) ? $_REQUEST['user'] : explode(',', $_REQUEST['user']); $send_count = count($user_array); $id_array = array_slice($user_array, $start, $limit); /* 根据会员ID取得用户名和邮件地址 */ $sql = "SELECT user_id, email, user_name FROM " .$ecs->table('users'). " WHERE user_id " .db_create_in($id_array); $user_list = $db->getAll($sql); $count = count($user_list); } /* 发送红包 */ $loop = 0; $bonus_type = bonus_type_info($_REQUEST['id']); $tpl = get_mail_template('send_bonus'); $today = local_date($_CFG['date_format']); foreach ($user_list AS $key => $val) { /* 发送邮件通知 */ $smarty->assign('user_name', $val['user_name']); $smarty->assign('shop_name', $GLOBALS['_CFG']['shop_name']); $smarty->assign('send_date', $today); $smarty->assign('sent_date', $today); $smarty->assign('count', 1); $smarty->assign('money', price_format($bonus_type['type_money'])); $content = $smarty->fetch('str:' . $tpl['template_content']); if (add_to_maillist($val['user_name'], $val['email'], $tpl['template_subject'], $content, $tpl['is_html'])) { /* 向会员红包表录入数据 */ $sql = "INSERT INTO " . $ecs->table('user_bonus') . "(bonus_type_id, bonus_sn, user_id, used_time, order_id, emailed) " . "VALUES ('$_REQUEST[id]', 0, '$val[user_id]', 0, 0, " .BONUS_MAIL_SUCCEED. ")"; $db->query($sql); } else { /* 邮件发送失败,更新数据库 */ $sql = "INSERT INTO " . $ecs->table('user_bonus') . "(bonus_type_id, bonus_sn, user_id, used_time, order_id, emailed) " . "VALUES ('$_REQUEST[id]', 0, '$val[user_id]', 0, 0, " .BONUS_MAIL_FAIL. ")"; $db->query($sql); } if ($loop >= $limit) { break; } else { $loop++; } } //admin_log(addslashes($_LANG['send_bonus']), 'add', 'bonustype'); if ($send_count > ($start + $limit)) { /* */ $href = "bonus.php?act=send_by_user&start=" . ($start+$limit) . "&limit=$limit&id=$_REQUEST[id]&"; if (isset($_REQUEST['send_rank'])) { $href .= "send_rank=1&rank_id=$rank_id"; } if (isset($_REQUEST['send_user'])) { $href .= "send_user=1&user=" . implode(',', $user_array); } $link[] = array('text' => $_LANG['send_continue'], 'href' => $href); } $link[] = array('text' => $_LANG['back_list'], 'href' => 'bonus.php?act=list'); sys_msg(sprintf($_LANG['sendbonus_count'], $count), 0, $link); } /*------------------------------------------------------ */ //-- 发送邮件 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'send_mail') { /* 取得参数:红包id */ $bonus_id = intval($_REQUEST['bonus_id']); if ($bonus_id <= 0) { die('invalid params'); } /* 取得红包信息 */ include_once(ROOT_PATH . 'includes/lib_order.php'); $bonus = bonus_info($bonus_id); if (empty($bonus)) { sys_msg($_LANG['bonus_not_exist']); } /* 发邮件 */ $count = send_bonus_mail($bonus['bonus_type_id'], array($bonus_id)); $link[0]['text'] = $_LANG['back_bonus_list']; $link[0]['href'] = 'bonus.php?act=bonus_list&bonus_type=' . $bonus['bonus_type_id']; sys_msg(sprintf($_LANG['success_send_mail'], $count), 0, $link); } /*------------------------------------------------------ */ //-- 按印刷品发放红包 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'send_by_print') { @set_time_limit(0); /* 红下红包的类型ID和生成的数量的处理 */ $bonus_typeid = !empty($_POST['bonus_type_id']) ? $_POST['bonus_type_id'] : 0; $bonus_sum = !empty($_POST['bonus_sum']) ? $_POST['bonus_sum'] : 1; /* 生成红包序列号 */ $num = $db->getOne("SELECT MAX(bonus_sn) FROM ". $ecs->table('user_bonus')); $num = $num ? floor($num / 10000) : 100000; for ($i = 0, $j = 0; $i < $bonus_sum; $i++) { $bonus_sn = ($num + $i) . str_pad(mt_rand(0, 9999), 4, '0', STR_PAD_LEFT); $db->query("INSERT INTO ".$ecs->table('user_bonus')." (bonus_type_id, bonus_sn) VALUES('$bonus_typeid', '$bonus_sn')"); $j++; } /* 记录管理员操作 */ admin_log($bonus_sn, 'add', 'userbonus'); /* 清除缓存 */ clear_cache_files(); /* 提示信息 */ $link[0]['text'] = $_LANG['back_bonus_list']; $link[0]['href'] = 'bonus.php?act=bonus_list&bonus_type=' . $bonus_typeid; sys_msg($_LANG['creat_bonus'] . $j . $_LANG['creat_bonus_num'], 0, $link); } /*------------------------------------------------------ */ //-- 导出线下发放的信息 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'gen_excel') { @set_time_limit(0); /* 获得此线下红包类型的ID */ $tid = !empty($_GET['tid']) ? intval($_GET['tid']) : 0; $type_name = $db->getOne("SELECT type_name FROM ".$ecs->table('bonus_type')." WHERE type_id = '$tid'"); /* 文件名称 */ $bonus_filename = $type_name .'_bonus_list'; if (EC_CHARSET != 'gbk') { $bonus_filename = ecs_iconv('UTF8', 'GB2312',$bonus_filename); } header("Content-type: application/vnd.ms-excel; charset=utf-8"); header("Content-Disposition: attachment; filename=$bonus_filename.xls"); /* 文件标题 */ if (EC_CHARSET != 'gbk') { echo ecs_iconv('UTF8', 'GB2312', $_LANG['bonus_excel_file']) . "\t\n"; /* 红包序列号, 红包金额, 类型名称(红包名称), 使用结束日期 */ echo ecs_iconv('UTF8', 'GB2312', $_LANG['bonus_sn']) ."\t"; echo ecs_iconv('UTF8', 'GB2312', $_LANG['type_money']) ."\t"; echo ecs_iconv('UTF8', 'GB2312', $_LANG['type_name']) ."\t"; echo ecs_iconv('UTF8', 'GB2312', $_LANG['use_enddate']) ."\t\n"; } else { echo $_LANG['bonus_excel_file'] . "\t\n"; /* 红包序列号, 红包金额, 类型名称(红包名称), 使用结束日期 */ echo $_LANG['bonus_sn'] ."\t"; echo $_LANG['type_money'] ."\t"; echo $_LANG['type_name'] ."\t"; echo $_LANG['use_enddate'] ."\t\n"; } $val = array(); $sql = "SELECT ub.bonus_id, ub.bonus_type_id, ub.bonus_sn, bt.type_name, bt.type_money, bt.use_end_date ". "FROM ".$ecs->table('user_bonus')." AS ub, ".$ecs->table('bonus_type')." AS bt ". "WHERE bt.type_id = ub.bonus_type_id AND ub.bonus_type_id = '$tid' ORDER BY ub.bonus_id DESC"; $res = $db->query($sql); $code_table = array(); while ($val = $db->fetchRow($res)) { echo $val['bonus_sn'] . "\t"; echo $val['type_money'] . "\t"; if (!isset($code_table[$val['type_name']])) { if (EC_CHARSET != 'gbk') { $code_table[$val['type_name']] = ecs_iconv('UTF8', 'GB2312', $val['type_name']); } else { $code_table[$val['type_name']] = $val['type_name']; } } echo $code_table[$val['type_name']] . "\t"; echo local_date('Y-m-d', $val['use_end_date']); echo "\t\n"; } } /*------------------------------------------------------ */ //-- 搜索商品 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'get_goods_list') { include_once(ROOT_PATH . 'includes/cls_json.php'); $json = new JSON; $filters = $json->decode($_GET['JSON']); $arr = get_goods_list($filters); $opt = array(); foreach ($arr AS $key => $val) { $opt[] = array('value' => $val['goods_id'], 'text' => $val['goods_name'], 'data' => $val['shop_price']); } make_json_result($opt); } /*------------------------------------------------------ */ //-- 添加发放红包的商品 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'add_bonus_goods') { include_once(ROOT_PATH . 'includes/cls_json.php'); $json = new JSON; check_authz_json('bonus_manage'); $add_ids = $json->decode($_GET['add_ids']); $args = $json->decode($_GET['JSON']); $type_id = $args[0]; foreach ($add_ids AS $key => $val) { $sql = "UPDATE " .$ecs->table('goods'). " SET bonus_type_id='$type_id' WHERE goods_id='$val'"; $db->query($sql, 'SILENT') or make_json_error($db->error()); } /* 重新载入 */ $arr = get_bonus_goods($type_id); $opt = array(); foreach ($arr AS $key => $val) { $opt[] = array('value' => $val['goods_id'], 'text' => $val['goods_name'], 'data' => ''); } make_json_result($opt); } /*------------------------------------------------------ */ //-- 删除发放红包的商品 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'drop_bonus_goods') { include_once(ROOT_PATH . 'includes/cls_json.php'); $json = new JSON; check_authz_json('bonus_manage'); $drop_goods = $json->decode($_GET['drop_ids']); $drop_goods_ids = db_create_in($drop_goods); $arguments = $json->decode($_GET['JSON']); $type_id = $arguments[0]; $db->query("UPDATE ".$ecs->table('goods')." SET bonus_type_id = 0 ". "WHERE bonus_type_id = '$type_id' AND goods_id " .$drop_goods_ids); /* 重新载入 */ $arr = get_bonus_goods($type_id); $opt = array(); foreach ($arr AS $key => $val) { $opt[] = array('value' => $val['goods_id'], 'text' => $val['goods_name'], 'data' => ''); } make_json_result($opt); } /*------------------------------------------------------ */ //-- 搜索用户 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'search_users') { $keywords = json_str_iconv(trim($_GET['keywords'])); $sql = "SELECT user_id, user_name FROM " . $ecs->table('users') . " WHERE user_name LIKE '%" . mysql_like_quote($keywords) . "%' OR user_id LIKE '%" . mysql_like_quote($keywords) . "%'"; $row = $db->getAll($sql); make_json_result($row); } /*------------------------------------------------------ */ //-- 红包列表 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'bonus_list') { $smarty->assign('full_page', 1); $smarty->assign('ur_here', $_LANG['bonus_list']); $smarty->assign('action_link', array('href' => 'bonus.php?act=list', 'text' => $_LANG['04_bonustype_list'])); $list = get_bonus_list(); /* 赋值是否显示红包序列号 */ $bonus_type = bonus_type_info(intval($_REQUEST['bonus_type'])); if ($bonus_type['send_type'] == SEND_BY_PRINT) { $smarty->assign('show_bonus_sn', 1); } /* 赋值是否显示发邮件操作和是否发过邮件 */ elseif ($bonus_type['send_type'] == SEND_BY_USER) { $smarty->assign('show_mail', 1); } $smarty->assign('bonus_list', $list['item']); $smarty->assign('filter', $list['filter']); $smarty->assign('record_count', $list['record_count']); $smarty->assign('page_count', $list['page_count']); $sort_flag = sort_flag($list['filter']); $smarty->assign($sort_flag['tag'], $sort_flag['img']); assign_query_info(); $smarty->display('bonus_list.htm'); } /*------------------------------------------------------ */ //-- 红包列表翻页、排序 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'query_bonus') { $list = get_bonus_list(); /* 赋值是否显示红包序列号 */ $bonus_type = bonus_type_info(intval($_REQUEST['bonus_type'])); if ($bonus_type['send_type'] == SEND_BY_PRINT) { $smarty->assign('show_bonus_sn', 1); } /* 赋值是否显示发邮件操作和是否发过邮件 */ elseif ($bonus_type['send_type'] == SEND_BY_USER) { $smarty->assign('show_mail', 1); } $smarty->assign('bonus_list', $list['item']); $smarty->assign('filter', $list['filter']); $smarty->assign('record_count', $list['record_count']); $smarty->assign('page_count', $list['page_count']); $sort_flag = sort_flag($list['filter']); $smarty->assign($sort_flag['tag'], $sort_flag['img']); make_json_result($smarty->fetch('bonus_list.htm'), '', array('filter' => $list['filter'], 'page_count' => $list['page_count'])); } /*------------------------------------------------------ */ //-- 删除红包 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'remove_bonus') { check_authz_json('bonus_manage'); $id = intval($_GET['id']); $db->query("DELETE FROM " .$ecs->table('user_bonus'). " WHERE bonus_id='$id'"); $url = 'bonus.php?act=query_bonus&' . str_replace('act=remove_bonus', '', $_SERVER['QUERY_STRING']); ecs_header("Location: $url\n"); exit; } /*------------------------------------------------------ */ //-- 批量操作 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'batch') { /* 检查权限 */ admin_priv('bonus_manage'); /* 去掉参数:红包类型 */ $bonus_type_id = intval($_REQUEST['bonus_type']); /* 取得选中的红包id */ if (isset($_POST['checkboxes'])) { $bonus_id_list = $_POST['checkboxes']; /* 删除红包 */ if (isset($_POST['drop'])) { $sql = "DELETE FROM " . $ecs->table('user_bonus'). " WHERE bonus_id " . db_create_in($bonus_id_list); $db->query($sql); admin_log(count($bonus_id_list), 'remove', 'userbonus'); clear_cache_files(); $link[] = array('text' => $_LANG['back_bonus_list'], 'href' => 'bonus.php?act=bonus_list&bonus_type='. $bonus_type_id); sys_msg(sprintf($_LANG['batch_drop_success'], count($bonus_id_list)), 0, $link); } /* 发邮件 */ elseif (isset($_POST['mail'])) { $count = send_bonus_mail($bonus_type_id, $bonus_id_list); $link[] = array('text' => $_LANG['back_bonus_list'], 'href' => 'bonus.php?act=bonus_list&bonus_type='. $bonus_type_id); sys_msg(sprintf($_LANG['success_send_mail'], $count), 0, $link); } } else { sys_msg($_LANG['no_select_bonus'], 1); } } /** * 获取红包类型列表 * @access public * @return void */ function get_type_list() { /* 获得所有红包类型的发放数量 */ $sql = "SELECT bonus_type_id, COUNT(*) AS sent_count". " FROM " .$GLOBALS['ecs']->table('user_bonus') . " GROUP BY bonus_type_id"; $res = $GLOBALS['db']->query($sql); $sent_arr = array(); while ($row = $GLOBALS['db']->fetchRow($res)) { $sent_arr[$row['bonus_type_id']] = $row['sent_count']; } /* 获得所有红包类型的发放数量 */ $sql = "SELECT bonus_type_id, COUNT(*) AS used_count". " FROM " .$GLOBALS['ecs']->table('user_bonus') . " WHERE used_time > 0". " GROUP BY bonus_type_id"; $res = $GLOBALS['db']->query($sql); $used_arr = array(); while ($row = $GLOBALS['db']->fetchRow($res)) { $used_arr[$row['bonus_type_id']] = $row['used_count']; } $result = get_filter(); if ($result === false) { /* 查询条件 */ $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'type_id' : trim($_REQUEST['sort_by']); $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']); $sql = "SELECT COUNT(*) FROM ".$GLOBALS['ecs']->table('bonus_type'); $filter['record_count'] = $GLOBALS['db']->getOne($sql); /* 分页大小 */ $filter = page_and_size($filter); $sql = "SELECT * FROM " .$GLOBALS['ecs']->table('bonus_type'). " ORDER BY $filter[sort_by] $filter[sort_order]"; set_filter($filter, $sql); } else { $sql = $result['sql']; $filter = $result['filter']; } $arr = array(); $res = $GLOBALS['db']->selectLimit($sql, $filter['page_size'], $filter['start']); while ($row = $GLOBALS['db']->fetchRow($res)) { $row['send_by'] = $GLOBALS['_LANG']['send_by'][$row['send_type']]; $row['send_count'] = isset($sent_arr[$row['type_id']]) ? $sent_arr[$row['type_id']] : 0; $row['use_count'] = isset($used_arr[$row['type_id']]) ? $used_arr[$row['type_id']] : 0; $arr[] = $row; } $arr = array('item' => $arr, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']); return $arr; } /** * 查询红包类型的商品列表 * * @access public * @param integer $type_id * @return array */ function get_bonus_goods($type_id) { $sql = "SELECT goods_id, goods_name FROM " .$GLOBALS['ecs']->table('goods'). " WHERE bonus_type_id = '$type_id'"; $row = $GLOBALS['db']->getAll($sql); return $row; } /** * 获取用户红包列表 * @access public * @param $page_param * @return void */ function get_bonus_list() { /* 查询条件 */ $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'bonus_type_id' : trim($_REQUEST['sort_by']); $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']); $filter['bonus_type'] = empty($_REQUEST['bonus_type']) ? 0 : intval($_REQUEST['bonus_type']); $where = empty($filter['bonus_type']) ? '' : " WHERE bonus_type_id='$filter[bonus_type]'"; $sql = "SELECT COUNT(*) FROM ".$GLOBALS['ecs']->table('user_bonus'). $where; $filter['record_count'] = $GLOBALS['db']->getOne($sql); /* 分页大小 */ $filter = page_and_size($filter); $sql = "SELECT ub.*, u.user_name, u.email, o.order_sn, bt.type_name ". " FROM ".$GLOBALS['ecs']->table('user_bonus'). " AS ub ". " LEFT JOIN " .$GLOBALS['ecs']->table('bonus_type'). " AS bt ON bt.type_id=ub.bonus_type_id ". " LEFT JOIN " .$GLOBALS['ecs']->table('users'). " AS u ON u.user_id=ub.user_id ". " LEFT JOIN " .$GLOBALS['ecs']->table('order_info'). " AS o ON o.order_id=ub.order_id $where ". " ORDER BY ".$filter['sort_by']." ".$filter['sort_order']. " LIMIT ". $filter['start'] .", $filter[page_size]"; $row = $GLOBALS['db']->getAll($sql); foreach ($row AS $key => $val) { $row[$key]['used_time'] = $val['used_time'] == 0 ? $GLOBALS['_LANG']['no_use'] : local_date($GLOBALS['_CFG']['date_format'], $val['used_time']); $row[$key]['emailed'] = $GLOBALS['_LANG']['mail_status'][$row[$key]['emailed']]; } $arr = array('item' => $row, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']); return $arr; } /** * 取得红包类型信息 * @param int $bonus_type_id 红包类型id * @return array */ function bonus_type_info($bonus_type_id) { $sql = "SELECT * FROM " . $GLOBALS['ecs']->table('bonus_type') . " WHERE type_id = '$bonus_type_id'"; return $GLOBALS['db']->getRow($sql); } /** * 发送红包邮件 * @param int $bonus_type_id 红包类型id * @param array $bonus_id_list 红包id数组 * @return int 成功发送数量 */ function send_bonus_mail($bonus_type_id, $bonus_id_list) { /* 取得红包类型信息 */ $bonus_type = bonus_type_info($bonus_type_id); if ($bonus_type['send_type'] != SEND_BY_USER) { return 0; } /* 取得属于该类型的红包信息 */ $sql = "SELECT b.bonus_id, u.user_name, u.email " . "FROM " . $GLOBALS['ecs']->table('user_bonus') . " AS b, " . $GLOBALS['ecs']->table('users') . " AS u " . " WHERE b.user_id = u.user_id " . " AND b.bonus_id " . db_create_in($bonus_id_list) . " AND b.order_id = 0 " . " AND u.email <> ''"; $bonus_list = $GLOBALS['db']->getAll($sql); if (empty($bonus_list)) { return 0; } /* 初始化成功发送数量 */ $send_count = 0; /* 发送邮件 */ $tpl = get_mail_template('send_bonus'); $today = local_date($GLOBALS['_CFG']['date_format']); foreach ($bonus_list AS $bonus) { $GLOBALS['smarty']->assign('user_name', $bonus['user_name']); $GLOBALS['smarty']->assign('shop_name', $GLOBALS['_CFG']['shop_name']); $GLOBALS['smarty']->assign('send_date', $today); $GLOBALS['smarty']->assign('sent_date', $today); $GLOBALS['smarty']->assign('count', 1); $GLOBALS['smarty']->assign('money', price_format($bonus_type['type_money'])); $content = $GLOBALS['smarty']->fetch('str:' . $tpl['template_content']); if (add_to_maillist($bonus['user_name'], $bonus['email'], $tpl['template_subject'], $content, $tpl['is_html'], false)) { $sql = "UPDATE " . $GLOBALS['ecs']->table('user_bonus') . " SET emailed = '" . BONUS_MAIL_SUCCEED . "'" . " WHERE bonus_id = '$bonus[bonus_id]'"; $GLOBALS['db']->query($sql); $send_count++; } else { $sql = "UPDATE " . $GLOBALS['ecs']->table('user_bonus') . " SET emailed = '" . BONUS_MAIL_FAIL . "'" . " WHERE bonus_id = '$bonus[bonus_id]'"; $GLOBALS['db']->query($sql); } } return $send_count; } function add_to_maillist($username, $email, $subject, $content, $is_html) { $time = time(); $content = addslashes($content); $template_id = $GLOBALS['db']->getOne("SELECT template_id FROM " . $GLOBALS['ecs']->table('mail_templates') . " WHERE template_code = 'send_bonus'"); $sql = "INSERT INTO " . $GLOBALS['ecs']->table('email_sendlist') . " ( email, template_id, email_content, pri, last_send) VALUES ('$email', $template_id, '$content', 1, '$time')"; $GLOBALS['db']->query($sql); return true; } ?>
zzshop
trunk/admin/bonus.php
PHP
asf20
39,508
<?php /** * ECSHOP 贺卡管理程序 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: card.php 17063 2010-03-25 06:35:46Z liuhui $ */ define('IN_ECS', true); require(dirname(__FILE__) . '/includes/init.php'); include_once(ROOT_PATH . 'includes/cls_image.php'); $image = new cls_image($_CFG['bgcolor']); $exc = new exchange($ecs->table("card"), $db, 'card_id', 'card_name'); /*------------------------------------------------------ */ //-- 包装列表 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'list') { assign_query_info(); $smarty->assign('ur_here', $_LANG['07_card_list']); $smarty->assign('action_link', array('text' => $_LANG['card_add'], 'href' => 'card.php?act=add')); $smarty->assign('full_page', 1); $cards_list = cards_list(); $smarty->assign('card_list', $cards_list['card_list']); $smarty->assign('filter', $cards_list['filter']); $smarty->assign('record_count', $cards_list['record_count']); $smarty->assign('page_count', $cards_list['page_count']); $smarty->display('card_list.htm'); } /*------------------------------------------------------ */ //-- ajax列表 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'query') { $cards_list = cards_list(); $smarty->assign('card_list', $cards_list['card_list']); $smarty->assign('filter', $cards_list['filter']); $smarty->assign('record_count', $cards_list['record_count']); $smarty->assign('page_count', $cards_list['page_count']); $sort_flag = sort_flag($cards_list['filter']); $smarty->assign($sort_flag['tag'], $sort_flag['img']); make_json_result($smarty->fetch('card_list.htm'), '', array('filter' => $cards_list['filter'], 'page_count' => $cards_list['page_count'])); } /*------------------------------------------------------ */ //-- 删除贺卡 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'remove') { /* 检查权限 */ check_authz_json('card_manage'); $card_id = empty($_REQUEST['id']) ? 0 : intval($_REQUEST['id']); $name = $exc->get_name($card_id); $img = $exc->get_name($card_id, 'card_img'); if ($exc->drop($card_id)) { /* 删除图片 */ if (!empty($img)) { @unlink('../' . DATA_DIR . '/cardimg/'.$img); } admin_log(addslashes($name),'remove','card'); $url = 'card.php?act=query&' . str_replace('act=remove', '', $_SERVER['QUERY_STRING']); ecs_header("Location: $url\n"); exit; } else { make_json_error($db->error()); } } /*------------------------------------------------------ */ //-- 添加新包装 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'add') { /* 权限判断 */ admin_priv('card_manage'); /*初始化显示*/ $card['card_fee'] = 0; $card['free_money'] = 0; $smarty->assign('card', $card); $smarty->assign('ur_here', $_LANG['card_add']); $smarty->assign('action_link', array('text' => $_LANG['07_card_list'], 'href' => 'card.php?act=list')); $smarty->assign('form_action', 'insert'); assign_query_info(); $smarty->display('card_info.htm'); } elseif ($_REQUEST['act'] == 'insert') { /* 权限判断 */ admin_priv('card_manage'); /*检查包装名是否重复*/ $is_only = $exc->is_only('card_name', $_POST['card_name']); if (!$is_only) { sys_msg(sprintf($_LANG['cardname_exist'], stripslashes($_POST['card_name'])), 1); } /*处理图片*/ $img_name = basename($image->upload_image($_FILES['card_img'],"cardimg")); /*插入数据*/ $sql = "INSERT INTO ".$ecs->table('card')."(card_name, card_fee, free_money, card_desc, card_img) VALUES ('$_POST[card_name]', '$_POST[card_fee]', '$_POST[free_money]', '$_POST[card_desc]', '$img_name')"; $db->query($sql); admin_log($_POST['card_name'],'add','card'); /*添加链接*/ $link[0]['text'] = $_LANG['continue_add']; $link[0]['href'] = 'card.php?act=add'; $link[1]['text'] = $_LANG['back_list']; $link[1]['href'] = 'card.php?act=list'; sys_msg($_POST['card_name'].$_LANG['cardadd_succeed'],0, $link); } /*------------------------------------------------------ */ //-- 编辑包装 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'edit') { /* 权限判断 */ admin_priv('card_manage'); $sql = "SELECT card_id, card_name, card_fee, free_money, card_desc, card_img FROM " .$ecs->table('card'). " WHERE card_id='$_REQUEST[id]'"; $card = $db->GetRow($sql); $smarty->assign('ur_here', $_LANG['card_edit']); $smarty->assign('action_link', array('text' => $_LANG['07_card_list'], 'href' => 'card.php?act=list&' . list_link_postfix())); $smarty->assign('card', $card); $smarty->assign('form_action', 'update'); assign_query_info(); $smarty->display('card_info.htm'); } elseif ($_REQUEST['act'] == 'update') { /* 权限判断 */ admin_priv('card_manage'); if ($_POST['card_name'] != $_POST['old_cardname']) { /*检查品牌名是否相同*/ $is_only = $exc->is_only('card_name', $_POST['card_name'], $_POST['id']); if (!$is_only) { sys_msg(sprintf($_LANG['cardname_exist'], stripslashes($_POST['card_name'])), 1); } } $param = "card_name = '$_POST[card_name]', card_fee = '$_POST[card_fee]', free_money= $_POST[free_money], card_desc = '$_POST[card_desc]'"; /* 处理图片 */ $img_name = basename($image->upload_image($_FILES['card_img'],"cardimg", $_POST['old_cardimg'])); if ($img_name) { $param .= " ,card_img ='$img_name' "; } if ($exc->edit($param, $_POST['id'])) { admin_log($_POST['card_name'], 'edit', 'card'); $link[0]['text'] = $_LANG['back_list']; $link[0]['href'] = 'card.php?act=list&' . list_link_postfix(); $note = sprintf($_LANG['cardedit_succeed'], $_POST['card_name']); sys_msg($note, 0, $link); } else { die($db->error()); } } /* 删除卡片图片 */ elseif ($_REQUEST['act'] == 'drop_card_img') { /* 权限判断 */ admin_priv('card_manage'); $card_id = isset($_GET['id']) ? intval($_GET['id']) : 0; /* 取得logo名称 */ $sql = "SELECT card_img FROM " .$ecs->table('card'). " WHERE card_id = '$card_id'"; $img_name = $db->getOne($sql); if (!empty($img_name)) { @unlink(ROOT_PATH . DATA_DIR . '/cardimg/' .$img_name); $sql = "UPDATE " .$ecs->table('card'). " SET card_img = '' WHERE card_id = '$card_id'"; $db->query($sql); } $link= array(array('text' => $_LANG['card_edit_lnk'], 'href'=>'card.php?act=edit&id=' .$card_id), array('text' => $_LANG['card_list_lnk'], 'href'=>'brand.php?act=list')); sys_msg($_LANG['drop_card_img_success'], 0, $link); } /*------------------------------------------------------ */ //-- ajax编辑卡片名字 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'edit_card_name') { check_authz_json('card_manage'); $card_id = empty($_REQUEST['id']) ? 0 : intval($_REQUEST['id']); $card_name = empty($_REQUEST['val']) ? '' : json_str_iconv(trim($_REQUEST['val'])); if (!$exc->is_only('card_name', $card_name, $card_id)) { make_json_error(sprintf($_LANG['cardname_exist'], $card_name)); } $old_card_name = $exc->get_name($card_id); if ($exc->edit("card_name='$card_name'", $card_id)) { admin_log(addslashes($old_card_name), 'edit', 'card'); make_json_result(stripcslashes($card_name)); } else { make_json_error($db->error()); } } /*------------------------------------------------------ */ //-- ajax编辑卡片费用 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'edit_card_fee') { check_authz_json('card_manage'); $card_id = empty($_REQUEST['id']) ? 0 : intval($_REQUEST['id']); $card_fee = empty($_REQUEST['val']) ? 0.00 : floatval($_REQUEST['val']); $card_name = $exc->get_name($card_id); if ($exc->edit("card_fee ='$card_fee'", $card_id)) { admin_log(addslashes($card_name), 'edit', 'card'); make_json_result($card_fee); } else { make_json_error($db->error()); } } /*------------------------------------------------------ */ //-- ajax编辑免费额度 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'edit_free_money') { check_authz_json('card_manage'); $card_id = empty($_REQUEST['id']) ? 0 : intval($_REQUEST['id']); $free_money = empty($_REQUEST['val']) ? 0.00 : floatval($_REQUEST['val']); $card_name = $exc->get_name($card_id); if ($exc->edit("free_money ='$free_money'", $card_id)) { admin_log(addslashes($card_name), 'edit', 'card'); make_json_result($free_money); } else { make_json_error($db->error()); } } function cards_list() { $result = get_filter(); if ($result === false) { $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'card_id' : trim($_REQUEST['sort_by']); $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']); /* 分页大小 */ $sql = "SELECT count(*) FROM " .$GLOBALS['ecs']->table('card'); $filter['record_count'] = $GLOBALS['db']->getOne($sql); $filter = page_and_size($filter); /* 查询 */ $sql = "SELECT card_id, card_name, card_img, card_fee, free_money, card_desc". " FROM ".$GLOBALS['ecs']->table('card'). " ORDER by " . $filter['sort_by'] . ' ' . $filter['sort_order'] . " LIMIT " . $filter['start'] . ',' . $filter['page_size']; set_filter($filter, $sql); } else { $sql = $result['sql']; $filter = $result['filter']; } $card_list = $GLOBALS['db']->getAll($sql); $arr = array('card_list' => $card_list, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']); return $arr; } ?>
zzshop
trunk/admin/card.php
PHP
asf20
11,190
<?php /** * ECSHOP 管理中心积分兑换商品程序文件 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author $ * $Id $ */ define('IN_ECS', true); require(dirname(__FILE__) . '/includes/init.php'); /*初始化数据交换对象 */ $exc = new exchange($ecs->table("exchange_goods"), $db, 'goods_id', 'exchange_integral'); //$image = new cls_image(); /*------------------------------------------------------ */ //-- 商品列表 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'list') { /* 权限判断 */ admin_priv('exchange_goods'); /* 取得过滤条件 */ $filter = array(); $smarty->assign('ur_here', $_LANG['15_exchange_goods_list']); $smarty->assign('action_link', array('text' => $_LANG['exchange_goods_add'], 'href' => 'exchange_goods.php?act=add')); $smarty->assign('full_page', 1); $smarty->assign('filter', $filter); $goods_list = get_exchange_goodslist(); $smarty->assign('goods_list', $goods_list['arr']); $smarty->assign('filter', $goods_list['filter']); $smarty->assign('record_count', $goods_list['record_count']); $smarty->assign('page_count', $goods_list['page_count']); $sort_flag = sort_flag($goods_list['filter']); $smarty->assign($sort_flag['tag'], $sort_flag['img']); assign_query_info(); $smarty->display('exchange_goods_list.htm'); } /*------------------------------------------------------ */ //-- 翻页,排序 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'query') { check_authz_json('exchange_goods'); $goods_list = get_exchange_goodslist(); $smarty->assign('goods_list', $goods_list['arr']); $smarty->assign('filter', $goods_list['filter']); $smarty->assign('record_count', $goods_list['record_count']); $smarty->assign('page_count', $goods_list['page_count']); $sort_flag = sort_flag($goods_list['filter']); $smarty->assign($sort_flag['tag'], $sort_flag['img']); make_json_result($smarty->fetch('exchange_goods_list.htm'), '', array('filter' => $goods_list['filter'], 'page_count' => $goods_list['page_count'])); } /*------------------------------------------------------ */ //-- 添加商品 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'add') { /* 权限判断 */ admin_priv('exchange_goods'); /*初始化*/ $goods = array(); $goods['is_exchange'] = 1; $goods['is_hot'] = 0; $goods['option'] = '<option value="0">'.$_LANG['make_option'].'</option>'; $smarty->assign('goods', $goods); $smarty->assign('ur_here', $_LANG['exchange_goods_add']); $smarty->assign('action_link', array('text' => $_LANG['15_exchange_goods_list'], 'href' => 'exchange_goods.php?act=list')); $smarty->assign('form_action', 'insert'); assign_query_info(); $smarty->display('exchange_goods_info.htm'); } /*------------------------------------------------------ */ //-- 添加商品 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'insert') { /* 权限判断 */ admin_priv('exchange_goods'); /*检查是否重复*/ $is_only = $exc->is_only('goods_id', $_POST['goods_id'],0, " goods_id ='$_POST[goods_id]'"); if (!$is_only) { sys_msg($_LANG['goods_exist'], 1); } /*插入数据*/ $add_time = gmtime(); if (empty($_POST['goods_id'])) { $_POST['goods_id'] = 0; } $sql = "INSERT INTO ".$ecs->table('exchange_goods')."(goods_id, exchange_integral, is_exchange, is_hot) ". "VALUES ('$_POST[goods_id]', '$_POST[exchange_integral]', '$_POST[is_exchange]', '$_POST[is_hot]')"; $db->query($sql); $link[0]['text'] = $_LANG['continue_add']; $link[0]['href'] = 'exchange_goods.php?act=add'; $link[1]['text'] = $_LANG['back_list']; $link[1]['href'] = 'exchange_goods.php?act=list'; admin_log($_POST['goods_id'],'add','exchange_goods'); clear_cache_files(); // 清除相关的缓存文件 sys_msg($_LANG['articleadd_succeed'],0, $link); } /*------------------------------------------------------ */ //-- 编辑 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'edit') { /* 权限判断 */ admin_priv('exchange_goods'); /* 取商品数据 */ $sql = "SELECT eg.goods_id, eg.exchange_integral,eg.is_exchange, eg.is_hot, g.goods_name ". " FROM " . $ecs->table('exchange_goods') . " AS eg ". " LEFT JOIN " . $ecs->table('goods') . " AS g ON g.goods_id = eg.goods_id ". " WHERE eg.goods_id='$_REQUEST[id]'"; $goods = $db->GetRow($sql); $goods['option'] = '<option value="'.$goods['goods_id'].'">'.$goods['goods_name'].'</option>'; $smarty->assign('goods', $goods); $smarty->assign('ur_here', $_LANG['exchange_goods_add']); $smarty->assign('action_link', array('text' => $_LANG['15_exchange_goods_list'], 'href' => 'exchange_goods.php?act=list&' . list_link_postfix())); $smarty->assign('form_action', 'update'); assign_query_info(); $smarty->display('exchange_goods_info.htm'); } /*------------------------------------------------------ */ //-- 编辑 /*------------------------------------------------------ */ if ($_REQUEST['act'] =='update') { /* 权限判断 */ admin_priv('exchange_goods'); if (empty($_POST['goods_id'])) { $_POST['goods_id'] = 0; } if ($exc->edit("exchange_integral='$_POST[exchange_integral]', is_exchange='$_POST[is_exchange]', is_hot='$_POST[is_hot]' ", $_POST['goods_id'])) { $link[0]['text'] = $_LANG['back_list']; $link[0]['href'] = 'exchange_goods.php?act=list&' . list_link_postfix(); admin_log($_POST['goods_id'], 'edit', 'exchange_goods'); clear_cache_files(); sys_msg($_LANG['articleedit_succeed'], 0, $link); } else { die($db->error()); } } /*------------------------------------------------------ */ //-- 编辑使用积分值 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'edit_exchange_integral') { check_authz_json('exchange_goods'); $id = intval($_POST['id']); $exchange_integral = floatval($_POST['val']); /* 检查文章标题是否重复 */ if ($exchange_integral < 0 || $exchange_integral == 0 && $_POST['val'] != "$goods_price") { make_json_error($_LANG['exchange_integral_invalid']); } else { if ($exc->edit("exchange_integral = '$exchange_integral'", $id)) { clear_cache_files(); admin_log($id, 'edit', 'exchange_goods'); make_json_result(stripslashes($exchange_integral)); } else { make_json_error($db->error()); } } } /*------------------------------------------------------ */ //-- 切换是否兑换 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'toggle_exchange') { check_authz_json('exchange_goods'); $id = intval($_POST['id']); $val = intval($_POST['val']); $exc->edit("is_exchange = '$val'", $id); clear_cache_files(); make_json_result($val); } /*------------------------------------------------------ */ //-- 切换是否兑换 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'toggle_hot') { check_authz_json('exchange_goods'); $id = intval($_POST['id']); $val = intval($_POST['val']); $exc->edit("is_hot = '$val'", $id); clear_cache_files(); make_json_result($val); } /*------------------------------------------------------ */ //-- 批量删除商品 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'batch_remove') { admin_priv('exchange_goods'); if (!isset($_POST['checkboxes']) || !is_array($_POST['checkboxes'])) { sys_msg($_LANG['no_select_goods'], 1); } $count = 0; foreach ($_POST['checkboxes'] AS $key => $id) { if ($exc->drop($id)) { admin_log($id,'remove','exchange_goods'); $count++; } } $lnk[] = array('text' => $_LANG['back_list'], 'href' => 'exchange_goods.php?act=list'); sys_msg(sprintf($_LANG['batch_remove_succeed'], $count), 0, $lnk); } /*------------------------------------------------------ */ //-- 删除商品 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'remove') { check_authz_json('exchange_goods'); $id = intval($_GET['id']); if ($exc->drop($id)) { admin_log($id,'remove','article'); clear_cache_files(); } $url = 'exchange_goods.php?act=query&' . str_replace('act=remove', '', $_SERVER['QUERY_STRING']); ecs_header("Location: $url\n"); exit; } /*------------------------------------------------------ */ //-- 搜索商品 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'search_goods') { include_once(ROOT_PATH . 'includes/cls_json.php'); $json = new JSON; $filters = $json->decode($_GET['JSON']); $arr = get_goods_list($filters); make_json_result($arr); } /* 获得商品列表 */ function get_exchange_goodslist() { $result = get_filter(); if ($result === false) { $filter = array(); $filter['keyword'] = empty($_REQUEST['keyword']) ? '' : trim($_REQUEST['keyword']); if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) { $filter['keyword'] = json_str_iconv($filter['keyword']); } $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'eg.goods_id' : trim($_REQUEST['sort_by']); $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']); $where = ''; if (!empty($filter['keyword'])) { $where = " AND g.goods_name LIKE '%" . mysql_like_quote($filter['keyword']) . "%'"; } /* 文章总数 */ $sql = 'SELECT COUNT(*) FROM ' .$GLOBALS['ecs']->table('exchange_goods'). ' AS eg '. 'LEFT JOIN ' .$GLOBALS['ecs']->table('goods'). ' AS g ON g.goods_id = eg.goods_id '. 'WHERE 1 ' .$where; $filter['record_count'] = $GLOBALS['db']->getOne($sql); $filter = page_and_size($filter); /* 获取文章数据 */ $sql = 'SELECT eg.* , g.goods_name '. 'FROM ' .$GLOBALS['ecs']->table('exchange_goods'). ' AS eg '. 'LEFT JOIN ' .$GLOBALS['ecs']->table('goods'). ' AS g ON g.goods_id = eg.goods_id '. 'WHERE 1 ' .$where. ' ORDER by '.$filter['sort_by'].' '.$filter['sort_order']; $filter['keyword'] = stripslashes($filter['keyword']); set_filter($filter, $sql); } else { $sql = $result['sql']; $filter = $result['filter']; } $arr = array(); $res = $GLOBALS['db']->selectLimit($sql, $filter['page_size'], $filter['start']); while ($rows = $GLOBALS['db']->fetchRow($res)) { $arr[] = $rows; } return array('arr' => $arr, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']); } ?>
zzshop
trunk/admin/exchange_goods.php
PHP
asf20
12,273
<?php /** * ECSHOP 商品类型管理程序 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: goods_type.php 17063 2010-03-25 06:35:46Z liuhui $ */ define('IN_ECS', true); require(dirname(__FILE__) . '/includes/init.php'); $exc = new exchange($ecs->table("goods_type"), $db, 'cat_id', 'cat_name'); /*------------------------------------------------------ */ //-- 管理界面 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'manage') { assign_query_info(); $smarty->assign('ur_here', $_LANG['08_goods_type']); $smarty->assign('full_page', 1); $good_type_list = get_goodstype(); $good_in_type = ''; $smarty->assign('goods_type_arr', $good_type_list['type']); $smarty->assign('filter', $good_type_list['filter']); $smarty->assign('record_count', $good_type_list['record_count']); $smarty->assign('page_count', $good_type_list['page_count']); $query = $db->query("SELECT a.cat_id FROM " . $ecs->table('attribute') . " AS a RIGHT JOIN " . $ecs->table('goods_attr') . " AS g ON g.attr_id = a.attr_id GROUP BY a.cat_id"); while ($row = $db->fetchRow($query)) { $good_in_type[$row['cat_id']]=1; } $smarty->assign('good_in_type', $good_in_type); $smarty->assign('action_link', array('text' => $_LANG['new_goods_type'], 'href' => 'goods_type.php?act=add')); $smarty->display('goods_type.htm'); } /*------------------------------------------------------ */ //-- 获得列表 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'query') { $good_type_list = get_goodstype(); $smarty->assign('goods_type_arr', $good_type_list['type']); $smarty->assign('filter', $good_type_list['filter']); $smarty->assign('record_count', $good_type_list['record_count']); $smarty->assign('page_count', $good_type_list['page_count']); make_json_result($smarty->fetch('goods_type.htm'), '', array('filter' => $good_type_list['filter'], 'page_count' => $good_type_list['page_count'])); } /*------------------------------------------------------ */ //-- 修改商品类型名称 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'edit_type_name') { check_authz_json('goods_type'); $type_id = !empty($_POST['id']) ? intval($_POST['id']) : 0; $type_name = !empty($_POST['val']) ? json_str_iconv(trim($_POST['val'])) : ''; /* 检查名称是否重复 */ $is_only = $exc->is_only('cat_name', $type_name, $type_id); if ($is_only) { $exc->edit("cat_name='$type_name'", $type_id); admin_log($type_name, 'edit', 'goods_type'); make_json_result(stripslashes($type_name)); } else { make_json_error($_LANG['repeat_type_name']); } } /*------------------------------------------------------ */ //-- 切换启用状态 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'toggle_enabled') { check_authz_json('goods_type'); $id = intval($_POST['id']); $val = intval($_POST['val']); $exc->edit("enabled='$val'", $id); make_json_result($val); } /*------------------------------------------------------ */ //-- 添加商品类型 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'add') { admin_priv('goods_type'); $smarty->assign('ur_here', $_LANG['new_goods_type']); $smarty->assign('action_link', array('href'=>'goods_type.php?act=manage', 'text' => $_LANG['goods_type_list'])); $smarty->assign('action', 'add'); $smarty->assign('form_act', 'insert'); $smarty->assign('goods_type', array('enabled' => 1)); assign_query_info(); $smarty->display('goods_type_info.htm'); } elseif ($_REQUEST['act'] == 'insert') { //$goods_type['cat_name'] = trim_right(sub_str($_POST['cat_name'], 60)); //$goods_type['attr_group'] = trim_right(sub_str($_POST['attr_group'], 255)); $goods_type['cat_name'] = sub_str($_POST['cat_name'], 60); $goods_type['attr_group'] = sub_str($_POST['attr_group'], 255); $goods_type['enabled'] = intval($_POST['enabled']); if ($db->autoExecute($ecs->table('goods_type'), $goods_type) !== false) { $links = array(array('href' => 'goods_type.php?act=manage', 'text' => $_LANG['back_list'])); sys_msg($_LANG['add_goodstype_success'], 0, $links); } else { sys_msg($_LANG['add_goodstype_failed'], 1); } } /*------------------------------------------------------ */ //-- 编辑商品类型 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'edit') { $goods_type = get_goodstype_info(intval($_GET['cat_id'])); if (empty($goods_type)) { sys_msg($_LANG['cannot_found_goodstype'], 1); } admin_priv('goods_type'); $smarty->assign('ur_here', $_LANG['edit_goods_type']); $smarty->assign('action_link', array('href'=>'goods_type.php?act=manage', 'text' => $_LANG['goods_type_list'])); $smarty->assign('action', 'add'); $smarty->assign('form_act', 'update'); $smarty->assign('goods_type', $goods_type); assign_query_info(); $smarty->display('goods_type_info.htm'); } elseif ($_REQUEST['act'] == 'update') { $goods_type['cat_name'] = sub_str($_POST['cat_name'], 60); $goods_type['attr_group'] = sub_str($_POST['attr_group'], 255); $goods_type['enabled'] = intval($_POST['enabled']); $cat_id = intval($_POST['cat_id']); $old_groups = get_attr_groups($cat_id); if ($db->autoExecute($ecs->table('goods_type'), $goods_type, 'UPDATE', "cat_id='$cat_id'") !== false) { /* 对比原来的分组 */ $new_groups = explode("\n", str_replace("\r", '', $goods_type['attr_group'])); // 新的分组 foreach ($old_groups AS $key=>$val) { $found = array_search($val, $new_groups); if ($found === NULL || $found === false) { /* 老的分组没有在新的分组中找到 */ update_attribute_group($cat_id, $key, 0); } else { /* 老的分组出现在新的分组中了 */ if ($key != $found) { update_attribute_group($cat_id, $key, $found); // 但是分组的key变了,需要更新属性的分组 } } } $links = array(array('href' => 'goods_type.php?act=manage', 'text' => $_LANG['back_list'])); sys_msg($_LANG['edit_goodstype_success'], 0, $links); } else { sys_msg($_LANG['edit_goodstype_failed'], 1); } } /*------------------------------------------------------ */ //-- 删除商品类型 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'remove') { check_authz_json('goods_type'); $id = intval($_GET['id']); $name = $exc->get_name($id); if ($exc->drop($id)) { admin_log(addslashes($name), 'remove', 'goods_type'); /* 清除该类型下的所有属性 */ $sql = "SELECT attr_id FROM " .$ecs->table('attribute'). " WHERE cat_id = '$id'"; $arr = $db->getCol($sql); $GLOBALS['db']->query("DELETE FROM " .$ecs->table('attribute'). " WHERE attr_id " . db_create_in($arr)); $GLOBALS['db']->query("DELETE FROM " .$ecs->table('goods_attr'). " WHERE attr_id " . db_create_in($arr)); $url = 'goods_type.php?act=query&' . str_replace('act=remove', '', $_SERVER['QUERY_STRING']); ecs_header("Location: $url\n"); exit; } else { make_json_error($_LANG['remove_failed']); } } /** * 获得所有商品类型 * * @access public * @return array */ function get_goodstype() { $result = get_filter(); if ($result === false) { /* 分页大小 */ $filter = array(); /* 记录总数以及页数 */ $sql = "SELECT COUNT(*) FROM ".$GLOBALS['ecs']->table('goods_type'); $filter['record_count'] = $GLOBALS['db']->getOne($sql); $filter = page_and_size($filter); /* 查询记录 */ $sql = "SELECT t.*, COUNT(a.cat_id) AS attr_count ". "FROM ". $GLOBALS['ecs']->table('goods_type'). " AS t ". "LEFT JOIN ". $GLOBALS['ecs']->table('attribute'). " AS a ON a.cat_id=t.cat_id ". "GROUP BY t.cat_id " . 'LIMIT ' . $filter['start'] . ',' . $filter['page_size']; set_filter($filter, $sql); } else { $sql = $result['sql']; $filter = $result['filter']; } $all = $GLOBALS['db']->getAll($sql); foreach ($all AS $key=>$val) { $all[$key]['attr_group'] = strtr($val['attr_group'], array("\r" => '', "\n" => ", ")); } return array('type' => $all, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']); } /** * 获得指定的商品类型的详情 * * @param integer $cat_id 分类ID * * @return array */ function get_goodstype_info($cat_id) { $sql = "SELECT * FROM " .$GLOBALS['ecs']->table('goods_type'). " WHERE cat_id='$cat_id'"; return $GLOBALS['db']->getRow($sql); } /** * 更新属性的分组 * * @param integer $cat_id 商品类型ID * @param integer $old_group * @param integer $new_group * * @return void */ function update_attribute_group($cat_id, $old_group, $new_group) { $sql = "UPDATE " . $GLOBALS['ecs']->table('attribute') . " SET attr_group='$new_group' WHERE cat_id='$cat_id' AND attr_group='$old_group'"; $GLOBALS['db']->query($sql); } ?>
zzshop
trunk/admin/goods_type.php
PHP
asf20
10,675
<?php /** * ECSHOP 文章分类管理程序 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: articlecat.php 17063 2010-03-25 06:35:46Z liuhui $ */ define('IN_ECS', true); require(dirname(__FILE__) . '/includes/init.php'); $exc = new exchange($ecs->table("article_cat"), $db, 'cat_id', 'cat_name'); /* act操作项的初始化 */ $_REQUEST['act'] = trim($_REQUEST['act']); if (empty($_REQUEST['act'])) { $_REQUEST['act'] = 'list'; } /*------------------------------------------------------ */ //-- 分类列表 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'list') { $articlecat = article_cat_list(0, 0, false); foreach ($articlecat as $key => $cat) { $articlecat[$key]['type_name'] = $_LANG['type_name'][$cat['cat_type']]; } $smarty->assign('ur_here', $_LANG['02_articlecat_list']); $smarty->assign('action_link', array('text' => $_LANG['articlecat_add'], 'href' => 'articlecat.php?act=add')); $smarty->assign('full_page', 1); $smarty->assign('articlecat', $articlecat); assign_query_info(); $smarty->display('articlecat_list.htm'); } /*------------------------------------------------------ */ //-- 查询 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'query') { $articlecat = article_cat_list(0, 0, false); foreach ($articlecat as $key => $cat) { $articlecat[$key]['type_name'] = $_LANG['type_name'][$cat['cat_type']]; } $smarty->assign('articlecat', $articlecat); make_json_result($smarty->fetch('articlecat_list.htm')); } /*------------------------------------------------------ */ //-- 添加分类 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'add') { /* 权限判断 */ admin_priv('article_cat'); $smarty->assign('cat_select', article_cat_list(0)); $smarty->assign('ur_here', $_LANG['articlecat_add']); $smarty->assign('action_link', array('text' => $_LANG['02_articlecat_list'], 'href' => 'articlecat.php?act=list')); $smarty->assign('form_action', 'insert'); assign_query_info(); $smarty->display('articlecat_info.htm'); } elseif ($_REQUEST['act'] == 'insert') { /* 权限判断 */ admin_priv('article_cat'); /*检查分类名是否重复*/ $is_only = $exc->is_only('cat_name', $_POST['cat_name']); if (!$is_only) { sys_msg(sprintf($_LANG['catname_exist'], stripslashes($_POST['cat_name'])), 1); } $cat_type = 1; if ($_POST['parent_id'] > 0) { $sql = "SELECT cat_type FROM " . $ecs->table('article_cat') . " WHERE cat_id = '$_POST[parent_id]'"; $p_cat_type = $db->getOne($sql); if ($p_cat_type == 2 || $p_cat_type == 3 || $p_cat_type == 5) { sys_msg($_LANG['not_allow_add'], 0); } else if ($p_cat_type == 4) { $cat_type = 5; } } $sql = "INSERT INTO ".$ecs->table('article_cat')."(cat_name, cat_type, cat_desc,keywords, parent_id, sort_order, show_in_nav) VALUES ('$_POST[cat_name]', '$cat_type', '$_POST[cat_desc]','$_POST[keywords]', '$_POST[parent_id]', '$_POST[sort_order]', '$_POST[show_in_nav]')"; $db->query($sql); if($_POST['show_in_nav'] == 1) { $vieworder = $db->getOne("SELECT max(vieworder) FROM ". $ecs->table('nav') . " WHERE type = 'middle'"); $vieworder += 2; //显示在自定义导航栏中 $sql = "INSERT INTO " . $ecs->table('nav') . " (name,ctype,cid,ifshow,vieworder,opennew,url,type) VALUES('" . $_POST['cat_name'] . "', 'a', '" . $db->insert_id() . "','1','$vieworder','0', '" . build_uri('article_cat', array('acid'=> $db->insert_id()), $_POST['cat_name']) . "','middle')"; $db->query($sql); } admin_log($_POST['cat_name'],'add','articlecat'); $link[0]['text'] = $_LANG['continue_add']; $link[0]['href'] = 'articlecat.php?act=add'; $link[1]['text'] = $_LANG['back_list']; $link[1]['href'] = 'articlecat.php?act=list'; clear_cache_files(); sys_msg($_POST['cat_name'].$_LANG['catadd_succed'],0, $link); } /*------------------------------------------------------ */ //-- 编辑文章分类 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'edit') { /* 权限判断 */ admin_priv('article_cat'); $sql = "SELECT cat_id, cat_name, cat_type, cat_desc, show_in_nav, keywords, parent_id,sort_order FROM ". $ecs->table('article_cat'). " WHERE cat_id='$_REQUEST[id]'"; $cat = $db->GetRow($sql); if ($cat['cat_type'] == 2 || $cat['cat_type'] == 3 || $cat['cat_type'] ==4) { $smarty->assign('disabled', 1); } $options = article_cat_list(0, $cat['parent_id'], false); $select = ''; $selected = $cat['parent_id']; foreach ($options as $var) { if ($var['cat_id'] == $_REQUEST['id']) { continue; } $select .= '<option value="' . $var['cat_id'] . '" '; $select .= ' cat_type="' . $var['cat_type'] . '" '; $select .= ($selected == $var['cat_id']) ? "selected='ture'" : ''; $select .= '>'; if ($var['level'] > 0) { $select .= str_repeat('&nbsp;', $var['level'] * 4); } $select .= htmlspecialchars($var['cat_name']) . '</option>'; } unset($options); $smarty->assign('cat', $cat); $smarty->assign('cat_select', $select); $smarty->assign('ur_here', $_LANG['articlecat_edit']); $smarty->assign('action_link', array('text' => $_LANG['02_articlecat_list'], 'href' => 'articlecat.php?act=list')); $smarty->assign('form_action', 'update'); assign_query_info(); $smarty->display('articlecat_info.htm'); } elseif ($_REQUEST['act'] == 'update') { /* 权限判断 */ admin_priv('article_cat'); /*检查重名*/ if ($_POST['cat_name'] != $_POST['old_catname']) { $is_only = $exc->is_only('cat_name', $_POST['cat_name'], $_POST['id']); if (!$is_only) { sys_msg(sprintf($_LANG['catname_exist'], stripslashes($_POST['cat_name'])), 1); } } if(!isset($_POST['parent_id'])) { $_POST['parent_id'] = 0; } $row = $db->getRow("SELECT cat_type, parent_id FROM " . $ecs->table('article_cat') . " WHERE cat_id='$_POST[id]'"); $cat_type = $row['cat_type']; if ($cat_type == 3 || $cat_type ==4) { $_POST['parent_id'] = $row['parent_id']; } /* 检查设定的分类的父分类是否合法 */ $child_cat = article_cat_list($_POST['id'], 0, false); if (!empty($child_cat)) { foreach ($child_cat as $child_data) { $catid_array[] = $child_data['cat_id']; } } if (in_array($_POST['parent_id'], $catid_array)) { sys_msg(sprintf($_LANG['parent_id_err'], stripslashes($_POST['cat_name'])), 1); } if ($cat_type == 1 || $cat_type == 5) { if ($_POST['parent_id'] > 0) { $sql = "SELECT cat_type FROM " . $ecs->table('article_cat') . " WHERE cat_id = '$_POST[parent_id]'"; $p_cat_type = $db->getOne($sql); if ($p_cat_type == 4) { $cat_type = 5; } else { $cat_type = 1; } } else { $cat_type = 1; } } $dat = $db->getOne("SELECT cat_name, show_in_nav FROM ". $ecs->table('article_cat') . " WHERE cat_id = '" . $_POST['id'] . "'"); if ($exc->edit("cat_name = '$_POST[cat_name]', cat_desc ='$_POST[cat_desc]', keywords='$_POST[keywords]',parent_id = '$_POST[parent_id]', cat_type='$cat_type', sort_order='$_POST[sort_order]', show_in_nav = '$_POST[show_in_nav]'", $_POST['id'])) { if($_POST['cat_name'] != $dat['cat_name']) { //如果分类名称发生了改变 $sql = "UPDATE " . $ecs->table('nav') . " SET name = '" . $_POST['cat_name'] . "' WHERE ctype = 'a' AND cid = '" . $_POST['id'] . "' AND type = 'middle'"; $db->query($sql); } if($_POST['show_in_nav'] != $dat['show_in_nav']) { if($_POST['show_in_nav'] == 1) { //显示 $nid = $db->getOne("SELECT id FROM ". $ecs->table('nav') . " WHERE ctype = 'a' AND cid = '" . $_POST['id'] . "' AND type = 'middle'"); if(empty($nid)) { $vieworder = $db->getOne("SELECT max(vieworder) FROM ". $ecs->table('nav') . " WHERE type = 'middle'"); $vieworder += 2; $uri = build_uri('article_cat', array('acid'=> $_POST['id']), $_POST['cat_name']); //不存在 $sql = "INSERT INTO " . $ecs->table('nav') . " (name,ctype,cid,ifshow,vieworder,opennew,url,type) ". "VALUES('" . $_POST['cat_name'] . "', 'a', '" . $_POST['id'] . "','1','$vieworder','0', '" . $uri . "','middle')"; } else { $sql = "UPDATE " . $ecs->table('nav') . " SET ifshow = 1 WHERE ctype = 'a' AND cid = '" . $_POST['id'] . "' AND type = 'middle'"; } $db->query($sql); } else { //去除 $db->query("UPDATE " . $ecs->table('nav') . " SET ifshow = 0 WHERE ctype = 'a' AND cid = '" . $_POST['id'] . "' AND type = 'middle'"); } } $link[0]['text'] = $_LANG['back_list']; $link[0]['href'] = 'articlecat.php?act=list'; $note = sprintf($_LANG['catedit_succed'], $_POST['cat_name']); admin_log($_POST['cat_name'], 'edit', 'articlecat'); clear_cache_files(); sys_msg($note, 0, $link); } else { die($db->error()); } } /*------------------------------------------------------ */ //-- 编辑文章分类的排序 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'edit_sort_order') { check_authz_json('article_cat'); $id = intval($_POST['id']); $order = json_str_iconv(trim($_POST['val'])); /* 检查输入的值是否合法 */ if (!preg_match("/^[0-9]+$/", $order)) { make_json_error(sprintf($_LANG['enter_int'], $order)); } else { if ($exc->edit("sort_order = '$order'", $id)) { clear_cache_files(); make_json_result(stripslashes($order)); } else { make_json_error($db->error()); } } } /*------------------------------------------------------ */ //-- 删除文章分类 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'remove') { check_authz_json('article_cat'); $id = intval($_GET['id']); $sql = "SELECT cat_type FROM " . $ecs->table('article_cat') . " WHERE cat_id = '$id'"; $cat_type = $db->getOne($sql); if ($cat_type == 2 || $cat_type == 3 || $cat_type ==4) { /* 系统保留分类,不能删除 */ make_json_error($_LANG['not_allow_remove']); } $sql = "SELECT COUNT(*) FROM " . $ecs->table('article_cat') . " WHERE parent_id = '$id'"; if ($db->getOne($sql) > 0) { /* 还有子分类,不能删除 */ make_json_error($_LANG['is_fullcat']); } /* 非空的分类不允许删除 */ $sql = "SELECT COUNT(*) FROM ".$ecs->table('article')." WHERE cat_id = '$id'"; if ($db->getOne($sql) > 0) { make_json_error(sprintf($_LANG['not_emptycat'])); } else { $exc->drop($id); $db->query("DELETE FROM " . $ecs->table('nav') . "WHERE ctype = 'a' AND cid = '$id' AND type = 'middle'"); clear_cache_files(); admin_log($cat_name, 'remove', 'category'); } $url = 'articlecat.php?act=query&' . str_replace('act=remove', '', $_SERVER['QUERY_STRING']); ecs_header("Location: $url\n"); exit; } /*------------------------------------------------------ */ //-- 切换是否显示在导航栏 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'toggle_show_in_nav') { check_authz_json('cat_manage'); $id = intval($_POST['id']); $val = intval($_POST['val']); if (cat_update($id, array('show_in_nav' => $val)) != false) { if($val == 1) { //显示 $nid = $db->getOne("SELECT id FROM ". $ecs->table('nav') . " WHERE ctype='a' AND cid='$id' AND type = 'middle'"); if(empty($nid)) { //不存在 $vieworder = $db->getOne("SELECT max(vieworder) FROM ". $ecs->table('nav') . " WHERE type = 'middle'"); $vieworder += 2; $catname = $db->getOne("SELECT cat_name FROM ". $ecs->table('article_cat') . " WHERE cat_id = '$id'"); $uri = build_uri('article_cat', array('acid'=> $id), $_POST['cat_name']); $sql = "INSERT INTO " . $ecs->table('nav') . " (name,ctype,cid,ifshow,vieworder,opennew,url,type) ". "VALUES('" . $catname . "', 'a', '$id','1','$vieworder','0', '" . $uri . "','middle')"; } else { $sql = "UPDATE " . $ecs->table('nav') . " SET ifshow = 1 WHERE ctype='a' AND cid='$id' AND type = 'middle'"; } $db->query($sql); } else { //去除 $db->query("UPDATE " . $ecs->table('nav') . " SET ifshow = 0 WHERE ctype='a' AND cid='$id' AND type = 'middle'"); } clear_cache_files(); make_json_result($val); } else { make_json_error($db->error()); } } /** * 添加商品分类 * * @param integer $cat_id * @param array $args * * @return mix */ function cat_update($cat_id, $args) { if (empty($args) || empty($cat_id)) { return false; } return $GLOBALS['db']->autoExecute($GLOBALS['ecs']->table('article_cat'), $args, 'update', "cat_id='$cat_id'"); } ?>
zzshop
trunk/admin/articlecat.php
PHP
asf20
15,178
<?php /** * ECSHOP 第三方程序会员数据整合插件管理程序 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: integrate.php 17063 2010-03-25 06:35:46Z liuhui $ */ define('IN_ECS', true); require(dirname(__FILE__) . '/includes/init.php'); /*------------------------------------------------------ */ //-- 会员数据整合插件列表 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'list') { $modules = read_modules('../includes/modules/integrates'); for ($i = 0; $i < count($modules); $i++) { $modules[$i]['installed'] = ($modules[$i]['code'] == $_CFG['integrate_code']) ? 1 : 0; } $allow_set_points = $_CFG['integrate_code'] == 'ecshop' ? 0 : 1; $smarty->assign('allow_set_points', $allow_set_points); $smarty->assign('ur_here', $_LANG['06_list_integrate']); $smarty->assign('modules', $modules); assign_query_info(); $smarty->display('integrates_list.htm'); } /*------------------------------------------------------ */ //-- 安装会员数据整合插件 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'install') { admin_priv('integrate_users', ''); /* 增加ucenter设置时先检测uc_client与uc_client/data是否可写 */ if ($_GET['code'] == 'ucenter') { $uc_client_dir = file_mode_info(ROOT_PATH . 'uc_client/data'); if ($uc_client_dir === false) { sys_msg($_LANG['uc_client_not_exists'], 0); } if ($uc_client_dir < 7) { sys_msg($_LANG['uc_client_not_write'], 0); } } if ($_GET['code'] == 'ecshop') { $sql = "UPDATE " .$ecs->table('shop_config'). " SET value = 'ecshop' WHERE code = 'integrate_code'"; $db->query($sql); $sql = "UPDATE " . $GLOBALS['ecs']->table('shop_config') . " SET value = '' WHERE code = 'points_rule'"; $GLOBALS['db']->query($sql); /* 清除shopconfig表的sql的缓存 */ clear_cache_files(); $links[0]['text'] = $_LANG['go_back']; $links[0]['href'] = 'integrate.php?act=list'; sys_msg($_LANG['update_success'], 0, $links); } else { $sql = "UPDATE " . $GLOBALS['ecs']->table('users') . " SET flag = 0, alias=''". " WHERE flag > 0"; $db->query($sql); //如果有标记,清空标记 $set_modules = true; include_once(ROOT_PATH."includes/modules/integrates/".$_GET['code'].".php"); $set_modules = false; // if ($_GET['code'] == 'ucenter' && !empty($_CFG['integrate_config'])) // { // $cfg = unserialize($_CFG['integrate_config']); // } // else // { $cfg = $modules[0]['default']; $cfg['integrate_url'] = "http://"; // } /* 判断 */ assign_query_info(); $smarty->assign('cfg', $cfg); $smarty->assign('save', 0); $smarty->assign('set_list', get_charset_list()); $smarty->assign('ur_here', $_LANG['integrate_setup']); $smarty->assign('code', $_GET['code']); $smarty->display('integrates_setup.htm'); } } if ($_REQUEST['act'] == 'view_install_log') { $code = empty($_GET['code']) ? '' : trim($_GET['code']); if (empty($code) || file_exists(ROOT_PATH . DATA_DIR . '/integrate_' . $code . '_log.php' )) { sys_msg($_LANG['lost_intall_log'], 1); } include(ROOT_PATH . DATA_DIR . '/integrate_' . $code . '_log.php'); if (isset($del_list) || isset($rename_list) || isset($ignore_list)) { if (isset($del_list)) { var_dump($del_list); } if (isset($rename_list)) { var_dump($rename_list); } if (isset($ignore_list)) { var_dump($ignore_list); } } else { sys_msg($_LANG['empty_intall_log'], 1); } } /*------------------------------------------------------ */ //-- 设置会员数据整合插件 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'setup') { admin_priv('integrate_users', ''); if ($_GET['code'] == 'ecshop') { sys_msg($_LANG['need_not_setup']); } else { $cfg = unserialize($_CFG['integrate_config']); assign_query_info(); $smarty->assign('save', 1); $smarty->assign('set_list', get_charset_list()); $smarty->assign('ur_here', $_LANG['integrate_setup']); $smarty->assign('code', $_GET['code']); $smarty->assign('cfg', $cfg); $smarty->display('integrates_setup.htm'); } } /*------------------------------------------------------ */ //-- 检查用户填写资料 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'check_config') { $code = $_POST['code']; include_once(ROOT_PATH."includes/modules/integrates/".$code.".php"); $_POST['cfg']['quiet'] = 1; $cls_user = new $code ($_POST['cfg']); if ($cls_user->error) { /* 出错提示 */ if ($cls_user->error == 1) { sys_msg($_LANG['error_db_msg']); } elseif ($cls_user->error == 2) { sys_msg($_LANG['error_table_exist']); } elseif ($cls_user->error == 1049) { sys_msg($_LANG['error_db_exist']); } else { sys_msg($cls_user->db->error()); } } if ($cls_user->db->version >= '4.1') { /* 检测数据表字符集 */ $sql = "SHOW TABLE STATUS FROM `" . $cls_user->db_name . "` LIKE '" . $cls_user->prefix . $cls_user->user_table . "'"; $row = $cls_user->db->getRow($sql); if (isset($row['Collation'])) { $db_charset = trim(substr($row['Collation'], 0, strpos($row['Collation'], '_'))); if ($db_charset == 'latin1') { if (empty($_POST['cfg']['is_latin1'])) { sys_msg($_LANG['error_is_latin1'], null, null, false); } } else { $user_db_charset = $_POST['cfg']['db_charset'] == 'GB2312' ? 'GBK' : $_POST['cfg']['db_charset']; if (!empty($_POST['cfg']['is_latin1'])) { sys_msg($_LANG['error_not_latin1'], null, null, false); } if ($user_db_charset != strtoupper($db_charset)) { sys_msg(sprintf($_LANG['invalid_db_charset'], strtoupper($db_charset), $user_db_charset), null, null, false); } } } } /* 中文检测 */ $test_str = '测试中文字符'; if ($_POST['cfg']['db_charset'] != 'UTF8') { $test_str = ecs_iconv('UTF8', $_POST['cfg']['db_charset']); } $sql = "SELECT " . $cls_user->field_name . " FROM " . $cls_user->table($cls_user->user_table) . " WHERE " . $cls_user->field_name . " = '$test_str'"; $test = $cls_user->db->query($sql, 'SILENT'); if (!$test) { sys_msg($_LANG['error_latin1'] , null, null, false); } if (!empty($_POST['save'])) { /* 直接保存修改 */ if (save_integrate_config($code, $_POST['cfg'])) { sys_msg($_LANG['save_ok'],0, array(array('text'=>$_LANG['06_list_integrate'],'href'=>'integrate.php?act=list'))); } else { sys_msg($_LANG['save_error'],0, array(array('text'=>$_LANG['06_list_integrate'],'href'=>'integrate.php?act=list'))); } } $sql = "SELECT COUNT(*) FROM " . $ecs->table('users'); $total = $db->getOne($sql); if ($total == 0) { /* 商城没有用户时,直接保存完成整合 */ save_integrate_config($_POST['code'], $_POST['cfg']); ecs_header("Location: integrate.php?act=complete\n"); exit; } /* 检测成功临时保存论坛配置参数 */ $_SESSION['cfg'] = $_POST['cfg']; $_SESSION['code'] = $code; $size = 100; $smarty->assign('ur_here',$_LANG['conflict_username_check']); $smarty->assign('domain', '@ecshop'); $smarty->assign('lang_total', sprintf($_LANG['shop_user_total'], $total)); $smarty->assign('size', $size); $smarty->display('integrates_check.htm'); } /*------------------------------------------------------ */ //-- 保存UCenter填写的资料 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'save_uc_config') { $code = $_POST['code']; $cfg = unserialize($_CFG['integrate_config']); include_once(ROOT_PATH."includes/modules/integrates/".$code.".php"); $_POST['cfg']['quiet'] = 1; $cls_user = new $code ($_POST['cfg']); if ($cls_user->error) { /* 出错提示 */ if ($cls_user->error == 1) { sys_msg($_LANG['error_db_msg']); } elseif ($cls_user->error == 2) { sys_msg($_LANG['error_table_exist']); } elseif ($cls_user->error == 1049) { sys_msg($_LANG['error_db_exist']); } else { sys_msg($cls_user->db->error()); } } /* 合并数组,保存原值 */ $cfg = array_merge($cfg, $_POST['cfg']); /* 直接保存修改 */ if (save_integrate_config($code, $cfg)) { sys_msg($_LANG['save_ok'],0, array(array('text'=>$_LANG['06_list_integrate'],'href'=>'integrate.php?act=list'))); } else { sys_msg($_LANG['save_error'],0, array(array('text'=>$_LANG['06_list_integrate'],'href'=>'integrate.php?act=list'))); } } /*------------------------------------------------------ */ //-- 第一次保存UCenter安装的资料 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'save_uc_config_first') { $code = $_POST['code']; include_once(ROOT_PATH."includes/modules/integrates/".$code.".php"); $_POST['cfg']['quiet'] = 1; $cls_user = new $code ($_POST['cfg']); if ($cls_user->error) { /* 出错提示 */ if ($cls_user->error == 1) { sys_msg($_LANG['error_db_msg']); } elseif ($cls_user->error == 2) { sys_msg($_LANG['error_table_exist']); } elseif ($cls_user->error == 1049) { sys_msg($_LANG['error_db_exist']); } else { sys_msg($cls_user->db->error()); } } list($appauthkey, $appid, $ucdbhost, $ucdbname, $ucdbuser, $ucdbpw, $ucdbcharset, $uctablepre, $uccharset, $ucapi, $ucip) = explode('|', $_POST['ucconfig']); $uc_ip = !empty($ucip)? $ucip : trim($_POST['uc_ip']); $uc_url = !empty($ucapi)? $ucapi : trim($_POST['uc_url']); $cfg = array( 'uc_id' => $appid, 'uc_key' => $appauthkey, 'uc_url' => $uc_url, 'uc_ip' => $uc_ip, 'uc_connect' => 'mysql', 'uc_charset' => $uccharset, 'db_host' => $ucdbhost, 'db_user' => $ucdbuser, 'db_name' => $ucdbname, 'db_pass' => $ucdbpw, 'db_pre' => $uctablepre, 'db_charset' => $ucdbcharset, ); /* 增加UC语言项 */ $cfg['uc_lang'] = $_LANG['uc_lang']; /* 检测成功临时保存论坛配置参数 */ $_SESSION['cfg'] = $cfg; $_SESSION['code'] = $code; /* 直接保存修改 */ if (!empty($_POST['save'])) { if (save_integrate_config($code, $cfg)) { sys_msg($_LANG['save_ok'],0, array(array('text'=>$_LANG['06_list_integrate'],'href'=>'integrate.php?act=list'))); } else { sys_msg($_LANG['save_error'],0, array(array('text'=>$_LANG['06_list_integrate'],'href'=>'integrate.php?act=list'))); } } $query = $db->query("SHOW TABLE STATUS LIKE '" . $GLOBALS['prefix'] . 'users' . "'"); $data = $db->fetch_array($query); if($data["Auto_increment"]) { $maxuid = $data["Auto_increment"] - 1; } else { $maxuid = 0; } /* 保存完成整合 */ save_integrate_config($code, $cfg); $smarty->assign('ur_here',$_LANG['ucenter_import_username']); $smarty->assign('user_startid_intro', sprintf($_LANG['user_startid_intro'], $maxuid, $maxuid)); $smarty->display('integrates_uc_import.htm'); } /*------------------------------------------------------ */ //-- 用户重名检查 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'check_user') { $code = $_SESSION['code']; include_once(ROOT_PATH . 'includes/cls_json.php'); include_once(ROOT_PATH."includes/modules/integrates/".$code.".php"); $cls_user = new $code ($_SESSION['cfg']); $json = new JSON(); $start = empty($_GET['start']) ? 0 : intval($_GET['start']); $size = empty($_GET['size']) ? 100 : intval($_GET['size']); $method = empty($_GET['method']) ? 1 : intval($_GET['method']); $domain = empty($_GET['domain']) ? '@ecshop' : trim($_GET['domain']); if ($size <2) { $size = 2; } $_SESSION['domain'] = $domain; $sql = "SELECT COUNT(*) FROM " . $ecs->table('users'); $total = $db->getOne($sql); $result = array('error'=>0, 'message'=>'', 'start'=>0, 'size'=>$size, 'content'=>'','method'=>$method, 'domain'=>$domain, 'is_end'=>0); $sql = "SELECT user_name FROM " . $ecs->table('users') . " LIMIT $start, $size"; $user_list = $db->getCol($sql); $post_user_list = $cls_user->test_conflict($user_list); if ($post_user_list) { /* 标记重名用户 */ if ($method == 2) { $sql = "UPDATE " . $GLOBALS['ecs']->table('users') . " SET flag = '$method', alias = CONCAT(user_name, '$domain') WHERE " . db_create_in($post_user_list, 'user_name'); } else { $sql = "UPDATE " . $GLOBALS['ecs']->table('users') . " SET flag = '$method' WHERE " . db_create_in($post_user_list, 'user_name'); } $GLOBALS['db']->ping(); $GLOBALS['db']->query($sql); if ($method == 2 ) { /* 需要改名,验证是否能成功改名 */ $count = count($post_user_list); $test_user_list = array(); for ($i=0; $i<$count; $i++) { $test_user_list[] = $post_user_list[$i] . $domain; } /* 检查改名后用户是否和论坛用户有重名 */ $error_user_list = $cls_user->test_conflict($test_user_list); //检查 if ($error_user_list) { $domain_len = 0 - str_len($domain); $count = count($error_user_list); for ($i=0; $i < $count; $i++) { $error_user_list[$i] = substr($error_user_list[$i], 0, $domain_len); } /* 将用户标记为改名失败 */ $sql = "UPDATE " . $GLOBALS['ecs']->table('users') . " SET flag = '1' WHERE " . db_create_in($error_user_list, 'user_name'); } /* 检查改名后用户是否与商城用户重名 */ $sql = "SELECT user_name FROM " .$GLOBALS['ecs']->table('users') . " WHERE " . db_create_in($test_user_list, 'user_name'); $error_user_list = $GLOBALS['db']->getCol($sql); if ($error_user_list) { $domain_len = 0 - str_len($domain); $count = count($error_user_list); for ($i=0; $i < $count; $i++) { $error_user_list[$i] = substr($error_user_list[$i], 0, $domain_len); } /* 将用户标记为改名失败 */ $sql = "UPDATE " . $GLOBALS['ecs']->table('users') . " SET flag = '1' WHERE " . db_create_in($error_user_list, 'user_name'); } } } if (($start + $size) < $total) { $result['start'] = $start + $size; $result['content'] = sprintf($_LANG['notice'], $result['start'], $total); } else { $start = $total; $result['content'] = $_LANG['check_complete']; $result['is_end'] = 1; /* 查找有无重名用户,无重名用户则直接同步,有则查看重名用户 */ $sql = "SELECT COUNT(*) FROM " . $ecs->table('users') . " WHERE flag > 0 "; if ($db->getOne($sql) > 0) { $result['href'] = "integrate.php?act=modify"; } else { $result['href'] = "integrate.php?act=sync"; } } die($json->encode($result)); } if ($_REQUEST['act'] == 'import_user') { $cfg = $_SESSION['cfg']; include_once(ROOT_PATH . 'includes/cls_json.php'); $ucdb = new cls_mysql($cfg['db_host'], $cfg['db_user'], $cfg['db_pass'], $cfg['db_name'], $cfg['db_charset']); $json = new JSON(); $result = array('error' => 0, 'message' => ''); $query = $db->query("SHOW TABLE STATUS LIKE '" . $GLOBALS['prefix'] . 'users' . "'"); $data = $db->fetch_array($query); if($data["Auto_increment"]) { $maxuid = $data["Auto_increment"] - 1; } else { $maxuid = 0; } $merge_method = intval($_POST['merge']); $merge_uid = array(); $uc_uid = array(); $repeat_user = array(); $query = $db->query("SELECT * FROM " . $ecs->table('users') . " ORDER BY `user_id` ASC"); while($data = $db->fetch_array($query)) { $salt = rand(100000, 999999); $password = md5($data['password'].$salt); $data['username'] = addslashes($data['user_name']); $lastuid = $data['user_id'] + $maxuid; $uc_userinfo = $ucdb->getRow("SELECT `uid`, `password`, `salt` FROM ".$cfg['db_pre']."members WHERE `username`='$data[username]'"); if(!$uc_userinfo) { $ucdb->query("INSERT LOW_PRIORITY INTO ".$cfg['db_pre']."members SET uid='$lastuid', username='$data[username]', password='$password', email='$data[email]', regip='$data[regip]', regdate='$data[regdate]', salt='$salt'", 'SILENT'); $ucdb->query("INSERT LOW_PRIORITY INTO ".$cfg['db_pre']."memberfields SET uid='$lastuid'",'SILENT'); } else { if ($merge_method == 1) { if (md5($data['password'].$uc_userinfo['salt']) == $uc_userinfo['password']) { $merge_uid[] = $data['user_id']; $uc_uid[] = array('user_id' => $data['user_id'], 'uid' => $uc_userinfo['uid']); continue; } } $ucdb->query("REPLACE INTO ".$cfg['db_pre']."mergemembers SET appid='".UC_APPID."', username='$data[username]'", 'SILENT'); $repeat_user[] = $data; } } $ucdb->query("ALTER TABLE ".$cfg['db_pre']."members AUTO_INCREMENT=".($lastuid + 1), 'SILENT'); //需要更新user_id的表 $up_user_table = array('account_log', 'affiliate_log', 'booking_goods', 'collect_goods', 'comment', 'feedback', 'order_info', 'snatch_log', 'tag', 'users', 'user_account', 'user_address', 'user_bonus', 'reg_extend_info', 'user_feed', 'delivery_order', 'back_order'); // 清空的表 $truncate_user_table = array('cart', 'sessions', 'sessions_data'); if (!empty($merge_uid)) { $merge_uid = implode(',', $merge_uid); } else { $merge_uid = 0; } // 更新ECSHOP表 foreach ($up_user_table as $table) { $db->query("UPDATE " . $ecs->table($table) . " SET `user_id`=`user_id`+ $maxuid ORDER BY `user_id` DESC"); foreach ($uc_uid as $uid) { $db->query("UPDATE " . $ecs->table($table) . " SET `user_id`='" . $uid['uid'] . "' WHERE `user_id`='" . ($uid['user_id'] + $maxuid) . "'"); } } foreach ($truncate_user_table as $table) { $db->query("TRUNCATE TABLE " . $ecs->table($table)); } // 保存重复的用户信息 if (!empty($repeat_user)) { @file_put_contents(ROOT_PATH . 'data/repeat_user.php', $json->encode($repeat_user)); } $result['error'] = 0; $result['message'] = $_LANG['import_user_success']; die($json->encode($result)); } /*------------------------------------------------------ */ //-- 重名用户处理 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'modify') { /* 检查是否有改名失败的用户 */ $sql = "SELECT COUNT(*) FROM " . $ecs->table('users') . " WHERE flag = 1"; if ($db->getOne($sql) > 0) { $_REQUEST['flag'] = 1; $smarty->assign('default_flag', 1); } else { $_REQUEST['flag'] = 0; $smarty->assign('default_flag', 0); } /* 显示重名用户及处理方法 */ $flags = array(0=>$_LANG['all_user'], 1=>$_LANG['error_user'], 2=>$_LANG['rename_user'], 3=>$_LANG['delete_user'], 4=>$_LANG['ignore_user'] ); $smarty->assign('flags', $flags); $arr = conflict_userlist(); $smarty->assign('ur_here', $_LANG['conflict_username_modify']); $smarty->assign('domain', '@ecshop'); $smarty->assign('list', $arr['list']); $smarty->assign('filter', $arr['filter']); $smarty->assign('record_count', $arr['record_count']); $smarty->assign('page_count', $arr['page_count']); $smarty->assign('full_page', 1); $smarty->display('integrates_modify.htm'); } /*------------------------------------------------------ */ //-- ajax 用户列表查询 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'query') { $arr = conflict_userlist(); $smarty->assign('list', $arr['list']); $smarty->assign('filter', $arr['filter']); $smarty->assign('record_count', $arr['record_count']); $smarty->assign('page_count', $arr['page_count']); $smarty->assign('full_page', 0); make_json_result($smarty->fetch('integrates_modify.htm'), '', array('filter' => $arr['filter'], 'page_count' => $arr['page_count'])); } /*------------------------------------------------------ */ //-- 重名用户处理过程 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'act_modify') { /* 先处理要改名的用户,改名用户要先检查是否有重名情况,有则标记出来 */ $alias = array(); foreach ($_POST['opt'] AS $user_id=>$val) { if ($val = 2) { $alias[] = $_POST['alias'][$user_id]; } } if ($alias) { /* 检查改名后用户名是否会重名 */ $sql = 'SELECT user_name FROM ' . $GLOBALS['ecs']->table('users') . ' WHERE ' . db_create_in($alias, 'user_name'); $ecs_error_list = $db->getCol($sql); /* 检查和商城是否有重名 */ $code = $_SESSION['code']; include_once(ROOT_PATH."includes/modules/integrates/".$code.".php"); $cls_user = new $code ($_SESSION['cfg']); $bbs_error_list = $cls_user->test_conflict($alias); $error_list = array_unique(array_merge($ecs_error_list, $bbs_error_list)); if ($error_list) { /* 将重名用户标记 */ foreach ($_POST['opt'] AS $user_id=>$val) { if ($val = 2) { if (in_array($_POST['alias'][$user_id], $error_list)) { /* 重名用户,需要标记 */ $sql = "UPDATE " . $GLOBALS['ecs']->table('users') . " SET flag = 1, alias='' WHERE user_id = '$user_id'"; } else { /* 用户名无重复,可以正常改名 */ $sql = "UPDATE " . $GLOBALS['ecs']->table('users'). " SET flag = 2, alias = '" . $_POST['alias'][$user_id] . "'". " WHERE user_id = '$user_id'"; } $db->query($sql); } } } else { /* 处理没有重名的情况 */ foreach ($_POST['opt'] AS $user_id=>$val) { $sql = "UPDATE " . $GLOBALS['ecs']->table('users'). " SET flag = 2, alias = '" . $_POST['alias'][$user_id] . "'". " WHERE user_id = '$user_id'"; $db->query($sql); } } } /* 处理删除和保留情况 */ foreach ($_POST['opt'] as $user_id=>$val) { if ($val == 3 || $val == 4) { $sql = "UPDATE " . $GLOBALS['ecs']->table('users') . " SET flag='$val' WHERE user_id='$user_id'"; $db->query($sql); } } /* 跳转 */ ecs_header("Location: integrate.php?act=modify"); exit; } /*------------------------------------------------------ */ //-- 将商城数据同步到论坛 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'sync') { $size = 100; $total = $db->getOne("SELECT COUNT(*) FROM " . $ecs->table("users")); $task_del = $db->getOne("SELECT COUNT(*) FROM " . $ecs->table("users") . " WHERE flag = 3"); $task_rename = $db->getOne("SELECT COUNT(*) FROM " . $ecs->table("users") . " WHERE flag = 2"); $task_ignore = $db->getOne("SELECT COUNT(*) FROM " . $ecs->table("users") . " WHERE flag = 4"); $task_sync = $total - $task_del - $task_ignore; $_SESSION['task'] = array('del'=>array('total'=>$task_del, 'start'=>0), 'rename'=>array('total'=>$task_rename, 'start'=>0), 'sync'=>array('total'=>$task_sync, 'start'=>0)); $del_list = ""; $rename_list = ""; $ignore_list = ""; $tasks = array(); if ($task_del > 0) { $tasks[] = array('task_name'=>sprintf($_LANG['task_del'], $task_del),'task_status'=>'<span id="task_del">' . $_LANG['task_uncomplete'] . '<span>'); $sql = "SELECT user_name FROM " . $ecs->table('users') . " WHERE flag = 2"; $del_list = $db->getCol($sql); } if ($task_rename > 0) { $tasks[] = array('task_name'=>sprintf($_LANG['task_rename'], $task_rename),'task_status'=>'<span id="task_rename">' . $_LANG['task_uncomplete'] . '</span>'); $sql = "SELECT user_name, alias FROM " . $ecs->table('users') . " WHERE flag = 3"; $rename_list = $db->getAll($sql); } if ($task_ignore >0) { $sql = "SELECT user_name FROM " . $ecs->table('users') . " WHERE flag = 4"; $ignore_list = $db->getCol($sql); } if ($task_sync > 0) { $tasks[] = array('task_name'=>sprintf($_LANG['task_sync'], $task_sync),'task_status'=>'<span id="task_sync">' . $_LANG['task_uncomplete'] . '</span>'); } $tasks[] = array('task_name'=>$_LANG['task_save'],'task_status'=>'<span id="task_save">' . $_LANG['task_uncomplete'] . '</span>'); /* 保存修改日志 */ $fp = @fopen(ROOT_PATH . DATA_DIR . '/integrate_' . $_SESSION['code'] . '_log.php', 'wb'); $log = ''; if (isset($del_list)) { $log .= '$del_list=' . var_export($del_list,true) . ';'; } if (isset($rename_list)) { $log .= '$rename_list=' . var_export($rename_list, true) . ';'; } if (isset($ignore_list)) { $log .= '$ignore_list=' . var_export($ignore_list, true) . ';'; } fwrite($fp, $log); fclose($fp); $smarty->assign('tasks', $tasks); $smarty->assign('ur_here',$_LANG['user_sync']); $smarty->assign('size', $size); $smarty->display('integrates_sync.htm'); } /*------------------------------------------------------ */ //-- 完成任务 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'task') { if (empty($_GET['size']) || $_GET['size'] < 0) { $size = 100; } else { $size = intval($_GET['size']); } include_once(ROOT_PATH . 'includes/cls_json.php'); $json = new JSON(); $result = array('message'=>'', 'error'=>0, 'content'=>'', 'id'=>'', 'end'=>0, 'size'=>$size); if ($_SESSION['task']['del']['start'] < $_SESSION['task']['del']['total']) { /* 执行操作 */ /* 查找要删除用户 */ $arr = $db->getCol("SELECT user_name FROM " . $ecs->table('users') . " WHERE flag = 3 LIMIT " . $_SESSION['task']['del']['start'] . ',' . $result['size']); $db->query("DELETE FROM " . $ecs->table('users') . " WHERE " . db_create_in($arr,'user_name')); /* 保存设置 */ $result['id'] = 'task_del'; if ($_SESSION['task']['del']['start'] + $result['size'] >= $_SESSION['task']['del']['total']) { $_SESSION['task']['del']['start'] = $_SESSION['task']['del']['total']; $result['content'] = $_LANG['task_complete']; } else { $_SESSION['task']['del']['start'] += $result['size']; $result['content'] = sprintf($_LANG['task_run'], $_SESSION['task']['del']['start'], $_SESSION['task']['del']['total']); } die($json->encode($result)); } else if ($_SESSION['task']['rename']['start'] < $_SESSION['task']['rename']['total']) { /* 查找要改名用户 */ $arr = $db->getCol("SELECT user_name FROM " . $ecs->table('users') . " WHERE flag = 2 LIMIT " . $_SESSION['task']['del']['start'] . ',' . $result['size']); $db->query("UPDATE " . $ecs->table('users') . " SET user_name=alias, alias='' WHERE " . db_create_in($arr,'user_name')); /* 保存设置 */ $result['id'] = 'task_rename'; if ($_SESSION['task']['rename']['start'] + $result['size'] >= $_SESSION['task']['rename']['total']) { $_SESSION['task']['rename']['start'] = $_SESSION['task']['rename']['total']; $result['content'] = $_LANG['task_complete']; } else { $_SESSION['task']['rename']['start'] += $result['size']; $result['content'] = sprintf($_LANG['task_run'], $_SESSION['task']['rename']['start'], $_SESSION['task']['rename']['total']); } die($json->encode($result)); } else if ($_SESSION['task']['sync']['start'] < $_SESSION['task']['sync']['total']) { $code = $_SESSION['code']; include_once(ROOT_PATH."includes/modules/integrates/".$code.".php"); $cls_user = new $code ($_SESSION['cfg']); $cls_user->need_sync = false; $sql = "SELECT user_name, password, email, sex, birthday, reg_time ". "FROM " . $ecs->table('users') . " LIMIT " . $_SESSION['task']['del']['start'] . ',' . $result['size']; $arr = $db->getAll($sql); foreach ($arr as $user) { @$cls_user->add_user($user['user_name'], '', $user['email'], $user['sex'], $user['birthday'], $user['reg_time'], $user['password']); } /* 保存设置 */ $result['id'] = 'task_sync'; if ($_SESSION['task']['sync']['start'] + $result['size'] >= $_SESSION['task']['sync']['total']) { $_SESSION['task']['sync']['start'] = $_SESSION['task']['sync']['total']; $result['content'] = $_LANG['task_complete']; } else { $_SESSION['task']['sync']['start'] += $result['size']; $result['content'] = sprintf($_LANG['task_run'], $_SESSION['task']['sync']['start'], $_SESSION['task']['sync']['total']); } die($json->encode($result)); } else { /* 记录合并用户 */ /* 插入code到shop_config表 */ $sql = "SELECT COUNT(*) FROM " .$ecs->table('shop_config'). " WHERE code = 'integrate_code'"; if ($db->GetOne($sql) == 0) { $sql = "INSERT INTO " .$ecs->table('shop_config'). " (code, value) ". "VALUES ('integrate_code', '$_SESSION[code]')"; } else { $sql = "UPDATE " .$ecs->table('shop_config'). " SET value = '$_SESSION[code]' WHERE code = 'integrate_code'"; } $db->query($sql); /* 序列化设置信息,并保存到数据库 */ save_integrate_config($_SESSION['code'], $_SESSION['cfg']); $result['content'] = $_LANG['task_complete']; $result['id'] = 'task_save'; $result['end'] = 1; /* 清理多余信息 */ unset($_SESSION['cfg']); unset($_SESSION['code']); unset($_SESSION['task']); unset($_SESSION['domain']); $sql = "UPDATE " . $ecs->table('users') . " set flag = 0, alias = '' WHERE flag > 0"; $db->query($sql); die($json->encode($result)); } } /*------------------------------------------------------ */ //-- 保存UCenter设置 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'setup_ucenter') { include_once(ROOT_PATH . 'includes/cls_json.php'); include_once(ROOT_PATH . 'includes/cls_transport.php'); $json = new JSON(); $result = array('error' => 0, 'message' => ''); $app_type = 'ECSHOP'; $app_name = $db->getOne('SELECT value FROM ' . $ecs->table('shop_config') . " WHERE code = 'shop_name'"); $app_url = $GLOBALS['ecs']->url(); $app_charset = EC_CHARSET; $app_dbcharset = strtolower((str_replace('-', '', EC_CHARSET))); $ucapi = !empty($_POST['ucapi']) ? trim($_POST['ucapi']) : ''; $ucip = !empty($_POST['ucip']) ? trim($_POST['ucip']) : ''; $dns_error = false; if(!$ucip) { $temp = @parse_url($ucapi); $ucip = gethostbyname($temp['host']); if(ip2long($ucip) == -1 || ip2long($ucip) === FALSE) { $ucip = ''; $dns_error = true; } } if($dns_error){ $result['error'] = 2; $result['message'] = ''; die($json->encode($result)); } $ucfounderpw = trim($_POST['ucfounderpw']); $app_tagtemplates = 'apptagtemplates[template]='.urlencode('<a href="{url}" target="_blank">{goods_name}</a>').'&'. 'apptagtemplates[fields][goods_name]='.urlencode($_LANG['tagtemplates_goodsname']).'&'. 'apptagtemplates[fields][uid]='.urlencode($_LANG['tagtemplates_uid']).'&'. 'apptagtemplates[fields][username]='.urlencode($_LANG['tagtemplates_username']).'&'. 'apptagtemplates[fields][dateline]='.urlencode($_LANG['tagtemplates_dateline']).'&'. 'apptagtemplates[fields][url]='.urlencode($_LANG['tagtemplates_url']).'&'. 'apptagtemplates[fields][image]='.urlencode($_LANG['tagtemplates_image']).'&'. 'apptagtemplates[fields][goods_price]='.urlencode($_LANG['tagtemplates_price']); $postdata ="m=app&a=add&ucfounder=&ucfounderpw=".urlencode($ucfounderpw)."&apptype=".urlencode($app_type). "&appname=".urlencode($app_name)."&appurl=".urlencode($app_url)."&appip=&appcharset=".$app_charset. '&appdbcharset='.$app_dbcharset.'&apptagtemplates='.$app_tagtemplates; $t = new transport; $ucconfig = $t->request($ucapi.'/index.php', $postdata); $ucconfig = $ucconfig['body']; if(empty($ucconfig)) { //ucenter 验证失败 $result['error'] = 1; $result['message'] = $_LANG['uc_msg_verify_failur']; } elseif($ucconfig == '-1') { //管理员密码无效 $result['error'] = 1; $result['message'] = $_LANG['uc_msg_password_wrong']; } else { list($appauthkey, $appid) = explode('|', $ucconfig); if(empty($appauthkey) || empty($appid)) { //ucenter 安装数据错误 $result['error'] = 1; $result['message'] = $_LANG['uc_msg_data_error']; } else { $result['error'] = 0; $result['message'] = $ucconfig; } } die($json->encode($result)); } /* 显示整合成功信息 */ if ($_REQUEST['act'] == 'complete') { sys_msg($_LANG['sync_ok'],0, array(array('text'=>$_LANG['06_list_integrate'],'href'=>'integrate.php?act=list'))); } if ($_REQUEST['act'] == 'points_set') { $rule_index = empty($_GET['rule_index']) ? '' : trim($_GET['rule_index']); $user = &init_users(); $points = $user->get_points_name(); //获取商城可用积分 if (empty($points)) { sys_msg($_LANG['no_points'], 0, array(array('text'=>$_LANG['06_list_integrate'],'href'=>'integrate.php?act=list'))); } elseif ($points == 'ucenter') { sys_msg($_LANG['uc_points'], 0, array(array('text'=>$_LANG['uc_set_credits'],'href'=>UC_API, 'target'=>'_blank')), false); } $rule = array(); //取得一样规则 if ($_CFG['points_rule']) { $rule = unserialize($_CFG['points_rule']); } $points_key = array_keys($points); $count = count($points_key); $select_rule = array(); $exist_rule = array(); for ($i=0; $i < $count ; $i++ ) { if (!isset($rule[TO_P . $points_key[$i]])) { $select_rule[TO_P . $points_key[$i]] = $_LANG['bbs'] . $points[$points_key[$i]]['title'] . '->' . $_LANG['shop_pay_points']; } else { $exist_rule[TO_P . $points_key[$i]] = $_LANG['bbs'] . $points[$points_key[$i]]['title'] . '->' . $_LANG['shop_pay_points']; } } for ($i=0; $i < $count ; $i++ ) { if (!isset($rule[TO_R . $points_key[$i]])) { $select_rule[TO_R . $points_key[$i]] = $_LANG['bbs'] . $points[$points_key[$i]]['title'] . '->' . $_LANG['shop_rank_points']; } else { $exist_rule[TO_R . $points_key[$i]] = $_LANG['bbs'] . $points[$points_key[$i]]['title'] . '->' . $_LANG['shop_rank_points']; } } for ($i=0; $i < $count ; $i++ ) { if (!isset($rule[FROM_P . $points_key[$i]])) { $select_rule[FROM_P . $points_key[$i]] = $_LANG['shop_pay_points'] . '->' . $_LANG['bbs'] . $points[$points_key[$i]]['title']; } else { $exist_rule[FROM_P . $points_key[$i]] = $_LANG['shop_pay_points'] . '->' . $_LANG['bbs'] . $points[$points_key[$i]]['title']; } } for ($i=0; $i < $count ; $i++ ) { if (!isset($rule[FROM_R . $points_key[$i]])) { $select_rule[FROM_R . $points_key[$i]] = $_LANG['shop_rank_points'] . '->' . $_LANG['bbs'] . $points[$points_key[$i]]['title']; } else { $exist_rule[FROM_R . $points_key[$i]] = $_LANG['shop_rank_points'] . '->' . $_LANG['bbs'] . $points[$points_key[$i]]['title']; } } /* 判断是否还能添加新规则 */ if (($rule_index && isset($rule[$rule_index])) || empty($select_rule)) { $allow_add = 0; } else { $allow_add = 1; } if ($rule_index && isset($rule[$rule_index])) { list($from_val, $to_val) = explode(':', $rule[$rule_index]); $select_rule[$rule_index] = $exist_rule[$rule_index]; $smarty->assign('from_val', $from_val); $smarty->assign('to_val', $to_val); } $smarty->assign('rule_index', $rule_index); $smarty->assign('allow_add', $allow_add); $smarty->assign('select_rule', $select_rule); $smarty->assign('exist_rule', $exist_rule); $smarty->assign('rule_list', $rule); $smarty->assign('integral_name', $_CFG['integral_name']); $smarty->assign('full_page', 1); $smarty->assign('points', $points); $smarty->display('integrates_points.htm'); } if ($_REQUEST['act'] == 'edit_points') { $rule_index = empty($_REQUEST['rule_index']) ? '' : trim($_REQUEST['rule_index']); $rule = array(); //取得一样规则 if ($_CFG['points_rule']) { $rule = unserialize($_CFG['points_rule']); } if (isset($_POST['from_val']) && isset($_POST['to_val'])) { /* 添加rule */ $from_val = empty($_POST['from_val']) ? 0 : intval($_POST['from_val']); $to_val = empty($_POST['to_val']) ? 1 : intval($_POST['to_val']); $old_rule_index = empty($_POST['old_rule_index']) ? '' : trim($_POST['old_rule_index']); if (empty($old_rule_index) || $old_rule_index == $rule_index) { $rule[$rule_index] = $from_val . ':' . $to_val; } else { $tmp_rule = array(); foreach ($rule as $key=>$val) { if ($key == $old_rule_index) { $tmp_rule[$rule_index] = $from_val . ':' . $to_val; } else { $tmp_rule[$key] = $val; } } $rule = $tmp_rule; } } else { /* 删除rule */ unset($rule[$rule_index]); } $sql = "UPDATE " . $ecs->table('shop_config') . " SET value ='" . serialize($rule) . "' WHERE code='points_rule'"; $db->query($sql); clear_cache_files(); ecs_header("Location: integrate.php?act=points_set\n"); exit; } if ($_REQUEST['act'] == 'save_points') { $keys = array_keys($_POST); $cfg = array(); foreach ($keys as $key) { if (is_array($_POST[$key])) { $cfg[$key]['bbs_points'] = empty($_POST[$key]['bbs_points']) ? 0 : intval($_POST[$key]['bbs_points']); $cfg[$key]['fee_points'] = empty($_POST[$key]['fee_points']) ? 0 : intval($_POST[$key]['fee_points']); $cfg[$key]['pay_points'] = empty($_POST[$key]['pay_points']) ? 0 : intval($_POST[$key]['pay_points']); $cfg[$key]['rank_points'] = empty($_POST[$key]['rank_points']) ? 0 : intval($_POST[$key]['rank_points']); } } $sql = "SELECT COUNT(*) FROM " . $ecs->table('shop_config') . " WHERE code='points_set'"; if ($db->getOne($sql) == 0) { $sql = "INSERT INTO " . $ecs->table('shop_config') . " (parent_id, type, code, value) VALUES (6, 'hidden', 'points_set', '" . serialize($cfg) . "')"; } else { $sql = "UPDATE " . $ecs->table('shop_config') . " SET value ='" . serialize($cfg) . "' WHERE code='points_set'"; } $db->query($sql); clear_cache_files(); sys_msg($_LANG['save_ok'],0, array(array('text'=>$_LANG['06_list_integrate'],'href'=>'integrate.php?act=list'))); } /** * 返回冲突用户列表数据 * * @access public * @param * * @return void */ function conflict_userlist() { $filter['flag'] = empty($_REQUEST['flag']) ? 0 : intval($_REQUEST['flag']); $where = ' WHERE flag'; if ($filter['flag']) { $where .= "=" . $filter['flag']; } else { $where .= ">" . 0; } $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('users') . $where; $filter['record_count'] = $GLOBALS['db']->getOne($sql); /* 分页大小 */ $filter = page_and_size($filter); $sql = "SELECT user_id, user_name, email, reg_time, flag, alias ". " FROM " . $GLOBALS['ecs']->table('users') . $where . " ORDER BY user_id ASC". " LIMIT " . $filter['start'] . ',' . $filter['page_size']; $list = $GLOBALS['db']->getAll($sql); $list_count = count($list); for ($i=0; $i < $list_count; $i++) { $list[$i]['reg_date'] = local_date($GLOBALS['_CFG']['date_format'], $list[$i]['reg_time']); } $arr = array('list' => $list, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']); return $arr; } /** * * * @access public * @param * * @return void */ function save_integrate_config ($code, $cfg) { $sql = "SELECT COUNT(*) FROM " .$GLOBALS['ecs']->table('shop_config'). " WHERE code = 'integrate_code'"; if ($GLOBALS['db']->GetOne($sql) == 0) { $sql = "INSERT INTO " .$ecs->table('shop_config'). " (code, value) ". "VALUES ('integrate_code', '$code')"; } else { $sql = "SELECT value FROM " . $GLOBALS['ecs']->table('shop_config') . " WHERE code = 'integrate_code'"; if ($code != $GLOBALS['db']->getOne($sql)) { /* 有缺换整合插件,需要把积分设置也清除 */ $sql = "UPDATE " . $GLOBALS['ecs']->table('shop_config') . " SET value = '' WHERE code = 'points_rule'"; $GLOBALS['db']->query($sql); } $sql = "UPDATE " .$GLOBALS['ecs']->table('shop_config'). " SET value = '$code' WHERE code = 'integrate_code'"; } $GLOBALS['db']->query($sql); /* 当前的域名 */ if (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) { $cur_domain = $_SERVER['HTTP_X_FORWARDED_HOST']; } elseif (isset($_SERVER['HTTP_HOST'])) { $cur_domain = $_SERVER['HTTP_HOST']; } else { if (isset($_SERVER['SERVER_NAME'])) { $cur_domain = $_SERVER['SERVER_NAME']; } elseif (isset($_SERVER['SERVER_ADDR'])) { $cur_domain = $_SERVER['SERVER_ADDR']; } } /* 整合对象的域名 */ $int_domain = str_replace(array('http://', 'https://'), array('', ''), $cfg['integrate_url']); if (strrpos($int_domain, '/')) { $int_domain = substr($int_domain, 0, strrpos($int_domain, '/')); } if ($cur_domain != $int_domain) { $same_domain = true; $domain = ''; /* 域名不一样,检查是否在同一域下 */ $cur_domain_arr = explode(".", $cur_domain); $int_domain_arr = explode(".", $int_domain); if (count($cur_domain_arr) != count($int_domain_arr) || $cur_domain_arr[0] == '' || $int_domain_arr[0] == '') { /* 域名结构不相同 */ $same_domain = false; } else { /* 域名结构一致,检查除第一节以外的其他部分是否相同 */ $count = count($cur_domain_arr); for ($i = 1; $i < $count; $i++) { if ($cur_domain_arr[$i] != $int_domain_arr[$i]) { $domain = ''; $same_domain = false; break; } else { $domain .= ".$cur_domain_arr[$i]"; } } } if ($same_domain == false) { /* 不在同一域,设置提示信息 */ $cfg['cookie_domain'] = ''; $cfg['cookie_path'] = '/'; } else { $cfg['cookie_domain'] = $domain; $cfg['cookie_path'] = '/'; } } else { $cfg['cookie_domain'] = ''; $cfg['cookie_path'] = '/'; } $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('shop_config') . " WHERE code = 'integrate_config'"; if ($GLOBALS['db']->GetOne($sql) == 0) { $sql = "INSERT INTO " . $GLOBALS['ecs']->table('shop_config') . " (code, value) ". "VALUES ('integrate_config', '" . serialize($cfg) . "')"; } else { $sql = "UPDATE " . $GLOBALS['ecs']->table('shop_config') . " SET value='". serialize($cfg) ."' ". "WHERE code='integrate_config'"; } $GLOBALS['db']->query($sql); clear_cache_files(); return true; } ?>
zzshop
trunk/admin/integrate.php
PHP
asf20
49,414
<?php /** * ECSHOP 配送方式管理程序 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: shipping.php 17063 2010-03-25 06:35:46Z liuhui $ */ define('IN_ECS', true); require(dirname(__FILE__) . '/includes/init.php'); $exc = new exchange($ecs->table('shipping'), $db, 'shipping_code', 'shipping_name'); /*------------------------------------------------------ */ //-- 配送方式列表 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'list') { $modules = read_modules('../includes/modules/shipping'); for ($i = 0; $i < count($modules); $i++) { $lang_file = ROOT_PATH.'languages/' .$_CFG['lang']. '/shipping/' .$modules[$i]['code']. '.php'; if (file_exists($lang_file)) { include_once($lang_file); } /* 检查该插件是否已经安装 */ $sql = "SELECT shipping_id, shipping_name, shipping_desc, insure, support_cod FROM " .$ecs->table('shipping'). " WHERE shipping_code='" .$modules[$i]['code']. "'"; $row = $db->GetRow($sql); if ($row) { /* 插件已经安装了,获得名称以及描述 */ $modules[$i]['id'] = $row['shipping_id']; $modules[$i]['name'] = $row['shipping_name']; $modules[$i]['desc'] = $row['shipping_desc']; $modules[$i]['insure_fee'] = $row['insure']; $modules[$i]['cod'] = $row['support_cod']; $modules[$i]['install'] = 1; if (isset($modules[$i]['insure']) && ($modules[$i]['insure'] === false)) { $modules[$i]['is_insure'] = 0; } else { $modules[$i]['is_insure'] = 1; } } else { $modules[$i]['name'] = $_LANG[$modules[$i]['code']]; $modules[$i]['desc'] = $_LANG[$modules[$i]['desc']]; $modules[$i]['insure_fee'] = empty($modules[$i]['insure'])? 0 : $modules[$i]['insure']; $modules[$i]['cod'] = $modules[$i]['cod']; $modules[$i]['install'] = 0; } } $smarty->assign('ur_here', $_LANG['03_shipping_list']); $smarty->assign('modules', $modules); assign_query_info(); $smarty->display('shipping_list.htm'); } /*------------------------------------------------------ */ //-- 安装配送方式 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'install') { admin_priv('ship_manage'); $set_modules = true; include_once(ROOT_PATH . 'includes/modules/shipping/' . $_GET['code'] . '.php'); /* 检查该配送方式是否已经安装 */ $sql = "SELECT shipping_id FROM " .$ecs->table('shipping'). " WHERE shipping_code = '$_GET[code]'"; $id = $db->GetOne($sql); if ($id > 0) { /* 该配送方式已经安装过, 将该配送方式的状态设置为 enable */ $db->query("UPDATE " .$ecs->table('shipping'). " SET enabled = 1 WHERE shipping_code = '$_GET[code]' LIMIT 1"); } else { /* 该配送方式没有安装过, 将该配送方式的信息添加到数据库 */ $insure = empty($modules[0]['insure']) ? 0 : $modules[0]['insure']; $sql = "INSERT INTO " . $ecs->table('shipping') . " (" . "shipping_code, shipping_name, shipping_desc, insure, support_cod, enabled, print_bg, config_lable, print_model" . ") VALUES (" . "'" . addslashes($modules[0]['code']). "', '" . addslashes($_LANG[$modules[0]['code']]) . "', '" . addslashes($_LANG[$modules[0]['desc']]) . "', '$insure', '" . intval($modules[0]['cod']) . "', 1, '" . addslashes($modules[0]['print_bg']) . "', '" . addslashes($modules[0]['config_lable']) . "', '" . $modules[0]['print_model'] . "')"; $db->query($sql); $id = $db->insert_Id(); } /* 记录管理员操作 */ admin_log(addslashes($_LANG[$modules[0]['code']]), 'install', 'shipping'); /* 提示信息 */ $lnk[] = array('text' => $_LANG['add_shipping_area'], 'href' => 'shipping_area.php?act=add&shipping=' . $id); $lnk[] = array('text' => $_LANG['go_back'], 'href' => 'shipping.php?act=list'); sys_msg(sprintf($_LANG['install_succeess'], $_LANG[$modules[0]['code']]), 0, $lnk); } /*------------------------------------------------------ */ //-- 卸载配送方式 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'uninstall') { global $ecs, $_LANG; admin_priv('ship_manage'); /* 获得该配送方式的ID */ $row = $db->GetRow("SELECT shipping_id, shipping_name, print_bg FROM " .$ecs->table('shipping'). " WHERE shipping_code='$_GET[code]'"); $shipping_id = $row['shipping_id']; $shipping_name = $row['shipping_name']; /* 删除 shipping_fee 以及 shipping 表中的数据 */ if ($row) { $all = $db->getCol("SELECT shipping_area_id FROM " .$ecs->table('shipping_area'). " WHERE shipping_id='$shipping_id'"); $in = db_create_in(join(',', $all)); $db->query("DELETE FROM " .$ecs->table('area_region'). " WHERE shipping_area_id $in"); $db->query("DELETE FROM " .$ecs->table('shipping_area'). " WHERE shipping_id='$shipping_id'"); $db->query("DELETE FROM " .$ecs->table('shipping'). " WHERE shipping_id='$shipping_id'"); //删除上传的非默认快递单 if (($row['print_bg'] != '') && (!is_print_bg_default($row['print_bg']))) { @unlink(ROOT_PATH . $row['print_bg']); } //记录管理员操作 admin_log(addslashes($shipping_name), 'uninstall', 'shipping'); $lnk[] = array('text' => $_LANG['go_back'], 'href'=>'shipping.php?act=list'); sys_msg(sprintf($_LANG['uninstall_success'], $shipping_name), 0, $lnk); } } /*------------------------------------------------------ */ //-- 模板Flash编辑器 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'print_index') { //检查登录权限 admin_priv('ship_manage'); $shipping_id = !empty($_GET['shipping']) ? intval($_GET['shipping']) : 0; /* 检查该插件是否已经安装 取值 */ $sql = "SELECT * FROM " .$ecs->table('shipping'). " WHERE shipping_id = '$shipping_id' LIMIT 0,1"; $row = $db->GetRow($sql); if ($row) { include_once(ROOT_PATH . 'includes/modules/shipping/' . $row['shipping_code'] . '.php'); $row['shipping_print'] = !empty($row['shipping_print']) ? $row['shipping_print'] : ''; $row['print_bg'] = empty($row['print_bg']) ? '' : get_site_root_url() . $row['print_bg']; } $smarty->assign('shipping', $row); $smarty->assign('shipping_id', $shipping_id); $smarty->display('print_index.htm'); } /*------------------------------------------------------ */ //-- 模板Flash编辑器 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'recovery_default_template') { /* 检查登录权限 */ admin_priv('ship_manage'); $shipping_id = !empty($_POST['shipping']) ? intval($_POST['shipping']) : 0; /* 取配送代码 */ $sql = "SELECT shipping_code FROM " .$ecs->table('shipping'). " WHERE shipping_id = '$shipping_id'"; $code = $db->GetOne($sql); $set_modules = true; include_once(ROOT_PATH . 'includes/modules/shipping/' . $code . '.php'); /* 恢复默认 */ $db->query("UPDATE " .$ecs->table('shipping'). " SET print_bg = '" . addslashes($modules[0]['print_bg']) . "', config_lable = '" . addslashes($modules[0]['config_lable']) . "' WHERE shipping_code = '$code' LIMIT 1"); $url = "shipping.php?act=edit_print_template&shipping=$shipping_id"; ecs_header("Location: $url\n"); } /*------------------------------------------------------ */ //-- 模板Flash编辑器 上传图片 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'print_upload') { //检查登录权限 admin_priv('ship_manage'); //设置上传文件类型 $allow_suffix = array('jpg', 'png', 'jpeg'); $shipping_id = !empty($_POST['shipping']) ? intval($_POST['shipping']) : 0; //接收上传文件 if (!empty($_FILES['bg']['name'])) { if(!get_file_suffix($_FILES['bg']['name'], $allow_suffix)) { echo '<script language="javascript">'; echo 'parent.alert("' . sprintf($_LANG['js_languages']['upload_falid'], implode(',', $allow_suffix)) . '");'; echo '</script>'; exit; } $name = date('Ymd'); for ($i = 0; $i < 6; $i++) { $name .= chr(mt_rand(97, 122)); } $name .= '.' . end(explode('.', $_FILES['bg']['name'])); $target = ROOT_PATH . '/images/receipt/' . $name; if (move_upload_file($_FILES['bg']['tmp_name'], $target)) { $src = '/images/receipt/' . $name; } } //保存 $sql = "UPDATE " .$ecs->table('shipping'). " SET print_bg = '$src' WHERE shipping_id = '$shipping_id'"; $res = $db->query($sql); if ($res) { echo '<script language="javascript">'; echo 'parent.call_flash("bg_add", "' . get_site_root_url() . $src . '");'; echo '</script>'; } } /*------------------------------------------------------ */ //-- 模板Flash编辑器 删除图片 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'print_del') { /* 检查权限 */ check_authz_json('ship_manage'); $shipping_id = !empty($_GET['shipping']) ? intval($_GET['shipping']) : 0; $shipping_id = json_str_iconv($shipping_id); /* 检查该插件是否已经安装 取值 */ $sql = "SELECT print_bg FROM " .$ecs->table('shipping'). " WHERE shipping_id = '$shipping_id' LIMIT 0,1"; $row = $db->GetRow($sql); if ($row) { if (($row['print_bg'] != '') && (!is_print_bg_default($row['print_bg']))) { @unlink(ROOT_PATH . $row['print_bg']); } $sql = "UPDATE " .$ecs->table('shipping'). " SET print_bg = '' WHERE shipping_id = '$shipping_id'"; $res = $db->query($sql); } else { make_json_error($_LANG['js_languages']['upload_del_falid']); } make_json_result($shipping_id); } /*------------------------------------------------------ */ //-- 编辑打印模板 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'edit_print_template') { admin_priv('ship_manage'); $shipping_id = !empty($_GET['shipping']) ? intval($_GET['shipping']) : 0; /* 检查该插件是否已经安装 */ $sql = "SELECT * FROM " .$ecs->table('shipping'). " WHERE shipping_id=$shipping_id"; $row = $db->GetRow($sql); if ($row) { include_once(ROOT_PATH . 'includes/modules/shipping/' . $row['shipping_code'] . '.php'); $row['shipping_print'] = !empty($row['shipping_print']) ? $row['shipping_print'] : ''; $row['print_model'] = empty($row['print_model']) ? 1 : $row['print_model']; //兼容以前版本 $smarty->assign('shipping', $row); } else { $lnk[] = array('text' => $_LANG['go_back'], 'href'=>'shipping.php?act=list'); sys_msg($_LANG['no_shipping_install'] , 0, $lnk); } $smarty->assign('ur_here', $_LANG['03_shipping_list'] .' - '. $row['shipping_name'] .' - '. $_LANG['shipping_print_template']); $smarty->assign('action_link', array('text' => $_LANG['03_shipping_list'], 'href' => 'shipping.php?act=list')); $smarty->assign('shipping_id', $shipping_id); assign_query_info(); $smarty->display('shipping_template.htm'); } /*------------------------------------------------------ */ //-- 编辑打印模板 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'do_edit_print_template') { /* 检查权限 */ admin_priv('ship_manage'); /* 参数处理 */ $print_model = !empty($_POST['print_model']) ? intval($_POST['print_model']) : 0; $shipping_id = !empty($_REQUEST['shipping']) ? intval($_REQUEST['shipping']) : 0; /* 处理不同模式编辑的表单 */ if ($print_model == 2) { //所见即所得模式 $db->query("UPDATE " . $ecs->table('shipping'). " SET config_lable = '" . $_POST['config_lable'] . "', print_model = '$print_model' WHERE shipping_id = '$shipping_id'"); } elseif ($print_model == 1) { //代码模式 $template = !empty($_POST['shipping_print']) ? $_POST['shipping_print'] : ''; $db->query("UPDATE " . $ecs->table('shipping'). " SET shipping_print = '" . $template . "', print_model = '$print_model' WHERE shipping_id = '$shipping_id'"); } /* 记录管理员操作 */ admin_log(addslashes($_POST['shipping_name']), 'edit', 'shipping'); $lnk[] = array('text' => $_LANG['go_back'], 'href'=>'shipping.php?act=list'); sys_msg($_LANG['edit_template_success'], 0, $lnk); } /*------------------------------------------------------ */ //-- 编辑配送方式名称 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'edit_name') { /* 检查权限 */ check_authz_json('ship_manage'); /* 取得参数 */ $id = json_str_iconv(trim($_POST['id'])); $val = json_str_iconv(trim($_POST['val'])); /* 检查名称是否为空 */ if (empty($val)) { make_json_error($_LANG['no_shipping_name']); } /* 检查名称是否重复 */ if (!$exc->is_only('shipping_name', $val, $id)) { make_json_error($_LANG['repeat_shipping_name']); } /* 更新支付方式名称 */ $exc->edit("shipping_name = '$val'", $id); make_json_result(stripcslashes($val)); } /*------------------------------------------------------ */ //-- 编辑配送方式描述 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'edit_desc') { /* 检查权限 */ check_authz_json('ship_manage'); /* 取得参数 */ $id = json_str_iconv(trim($_POST['id'])); $val = json_str_iconv(trim($_POST['val'])); /* 更新描述 */ $exc->edit("shipping_desc = '$val'", $id); make_json_result(stripcslashes($val)); } /*------------------------------------------------------ */ //-- 修改配送方式保价费 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'edit_insure') { /* 检查权限 */ check_authz_json('ship_manage'); /* 取得参数 */ $id = json_str_iconv(trim($_POST['id'])); $val = json_str_iconv(trim($_POST['val'])); if (empty($val)) { $val = 0; } else { $val = make_semiangle($val); //全角转半角 if (strpos($val, '%') === false) { $val = floatval($val); } else { $val = floatval($val) . '%'; } } /* 检查该插件是否支持保价 */ $set_modules = true; include_once(ROOT_PATH . 'includes/modules/shipping/' .$id. '.php'); if (isset($modules[0]['insure']) && $modules[0]['insure'] === false) { make_json_error($_LANG['not_support_insure']); } /* 更新保价费用 */ $exc->edit("insure = '$val'", $id); make_json_result(stripcslashes($val)); } elseif($_REQUEST['act'] == 'shipping_priv') { check_authz_json('ship_manage'); make_json_result(''); } /** * 获取站点根目录网址 * * @access private * @return Bool */ function get_site_root_url() { return 'http://' . $_SERVER['HTTP_HOST'] . str_replace('/' . ADMIN_PATH . '/shipping.php', '', PHP_SELF); } /** * 判断是否为默认安装快递单背景图片 * * @param string $print_bg 快递单背景图片路径名 * @access private * * @return Bool */ function is_print_bg_default($print_bg) { $_bg = basename($print_bg); $_bg_array = explode('.', $_bg); if (count($_bg_array) != 2) { return false; } if (strpos('|' . $_bg_array[0], 'dly_') != 1) { return false; } $_bg_array[0] = ltrim($_bg_array[0], 'dly_'); $list = explode('|', SHIP_LIST); if (in_array($_bg_array[0], $list)) { return true; } return false; } ?>
zzshop
trunk/admin/shipping.php
PHP
asf20
17,416
<?php /** * ECSHOP 商品管理程序 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: wangleisvn $ * $Id: goods.php 17114 2010-04-16 07:13:03Z wangleisvn $ */ define('IN_ECS', true); require(dirname(__FILE__) . '/includes/init.php'); require_once(ROOT_PATH . '/' . ADMIN_PATH . '/includes/lib_goods.php'); include_once(ROOT_PATH . '/includes/cls_image.php'); $image = new cls_image($_CFG['bgcolor']); $exc = new exchange($ecs->table('goods'), $db, 'goods_id', 'goods_name'); /*------------------------------------------------------ */ //-- 商品列表,商品回收站 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'list' || $_REQUEST['act'] == 'trash') { admin_priv('goods_manage'); $cat_id = empty($_REQUEST['cat_id']) ? 0 : intval($_REQUEST['cat_id']); $code = empty($_REQUEST['extension_code']) ? '' : trim($_REQUEST['extension_code']); $suppliers_id = isset($_REQUEST['suppliers_id']) ? (empty($_REQUEST['suppliers_id']) ? '' : trim($_REQUEST['suppliers_id'])) : ''; $is_on_sale = isset($_REQUEST['is_on_sale']) ? ((empty($_REQUEST['is_on_sale']) && $_REQUEST['is_on_sale'] === 0) ? '' : trim($_REQUEST['is_on_sale'])) : ''; $handler_list = array(); $handler_list['virtual_card'][] = array('url'=>'virtual_card.php?act=card', 'title'=>$_LANG['card'], 'img'=>'icon_send_bonus.gif'); $handler_list['virtual_card'][] = array('url'=>'virtual_card.php?act=replenish', 'title'=>$_LANG['replenish'], 'img'=>'icon_add.gif'); $handler_list['virtual_card'][] = array('url'=>'virtual_card.php?act=batch_card_add', 'title'=>$_LANG['batch_card_add'], 'img'=>'icon_output.gif'); if ($_REQUEST['act'] == 'list' && isset($handler_list[$code])) { $smarty->assign('add_handler', $handler_list[$code]); } /* 供货商名 */ $suppliers_list_name = suppliers_list_name(); $suppliers_exists = 1; if (empty($suppliers_list_name)) { $suppliers_exists = 0; } $smarty->assign('is_on_sale', $is_on_sale); $smarty->assign('suppliers_id', $suppliers_id); $smarty->assign('suppliers_exists', $suppliers_exists); $smarty->assign('suppliers_list_name', $suppliers_list_name); unset($suppliers_list_name, $suppliers_exists); /* 模板赋值 */ $goods_ur = array('' => $_LANG['01_goods_list'], 'virtual_card'=>$_LANG['50_virtual_card_list']); $ur_here = ($_REQUEST['act'] == 'list') ? $goods_ur[$code] : $_LANG['11_goods_trash']; $smarty->assign('ur_here', $ur_here); $action_link = ($_REQUEST['act'] == 'list') ? add_link($code) : array('href' => 'goods.php?act=list', 'text' => $_LANG['01_goods_list']); $smarty->assign('action_link', $action_link); $smarty->assign('code', $code); $smarty->assign('cat_list', cat_list(0, $cat_id)); $smarty->assign('brand_list', get_brand_list()); $smarty->assign('intro_list', get_intro_list()); $smarty->assign('lang', $_LANG); $smarty->assign('list_type', $_REQUEST['act'] == 'list' ? 'goods' : 'trash'); $smarty->assign('use_storage', empty($_CFG['use_storage']) ? 0 : 1); $suppliers_list = suppliers_list_info(' is_check = 1 '); $suppliers_list_count = count($suppliers_list); $smarty->assign('suppliers_list', ($suppliers_list_count == 0 ? 0 : $suppliers_list)); // 取供货商列表 $goods_list = goods_list($_REQUEST['act'] == 'list' ? 0 : 1, ($_REQUEST['act'] == 'list') ? (($code == '') ? 1 : 0) : -1); $smarty->assign('goods_list', $goods_list['goods']); $smarty->assign('filter', $goods_list['filter']); $smarty->assign('record_count', $goods_list['record_count']); $smarty->assign('page_count', $goods_list['page_count']); $smarty->assign('full_page', 1); /* 排序标记 */ $sort_flag = sort_flag($goods_list['filter']); $smarty->assign($sort_flag['tag'], $sort_flag['img']); /* 获取商品类型存在规格的类型 */ $specifications = get_goods_type_specifications(); $smarty->assign('specifications', $specifications); /* 显示商品列表页面 */ assign_query_info(); $htm_file = ($_REQUEST['act'] == 'list') ? 'goods_list.htm' : (($_REQUEST['act'] == 'trash') ? 'goods_trash.htm' : 'group_list.htm'); $smarty->display($htm_file); } /*------------------------------------------------------ */ //-- 添加新商品 编辑商品 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'add' || $_REQUEST['act'] == 'edit' || $_REQUEST['act'] == 'copy') { include_once(ROOT_PATH . 'includes/fckeditor/fckeditor.php'); // 包含 html editor 类文件 $is_add = $_REQUEST['act'] == 'add'; // 添加还是编辑的标识 $is_copy = $_REQUEST['act'] == 'copy'; //是否复制 $code = empty($_REQUEST['extension_code']) ? '' : trim($_REQUEST['extension_code']); if ($code == 'virual_card') { admin_priv('virualcard'); // 检查权限 } else { admin_priv('goods_manage'); // 检查权限 } /* 供货商名 */ $suppliers_list_name = suppliers_list_name(); $suppliers_exists = 1; if (empty($suppliers_list_name)) { $suppliers_exists = 0; } $smarty->assign('suppliers_exists', $suppliers_exists); $smarty->assign('suppliers_list_name', $suppliers_list_name); unset($suppliers_list_name, $suppliers_exists); /* 如果是安全模式,检查目录是否存在 */ if (ini_get('safe_mode') == 1 && (!file_exists('../' . IMAGE_DIR . '/'.date('Ym')) || !is_dir('../' . IMAGE_DIR . '/'.date('Ym')))) { if (@!mkdir('../' . IMAGE_DIR . '/'.date('Ym'), 0777)) { $warning = sprintf($_LANG['safe_mode_warning'], '../' . IMAGE_DIR . '/'.date('Ym')); $smarty->assign('warning', $warning); } } /* 如果目录存在但不可写,提示用户 */ elseif (file_exists('../' . IMAGE_DIR . '/'.date('Ym')) && file_mode_info('../' . IMAGE_DIR . '/'.date('Ym')) < 2) { $warning = sprintf($_LANG['not_writable_warning'], '../' . IMAGE_DIR . '/'.date('Ym')); $smarty->assign('warning', $warning); } /* 取得商品信息 */ if ($is_add) { /* 默认值 */ $last_choose = array(0, 0); if (!empty($_COOKIE['ECSCP']['last_choose'])) { $last_choose = explode('|', $_COOKIE['ECSCP']['last_choose']); } $goods = array( 'goods_id' => 0, 'goods_desc' => '', 'cat_id' => $last_choose[0], 'brand_id' => $last_choose[1], 'is_on_sale' => '1', 'is_alone_sale' => '1', 'is_shipping' => '0', 'other_cat' => array(), // 扩展分类 'goods_type' => 0, // 商品类型 'shop_price' => 0, 'promote_price' => 0, 'market_price' => 0, 'integral' => 0, 'goods_number' => $_CFG['default_storage'], 'warn_number' => 1, 'promote_start_date' => local_date('Y-m-d'), 'promote_end_date' => local_date('Y-m-d', local_strtotime('+1 month')), 'goods_weight' => 0, 'give_integral' => -1, 'rank_integral' => -1 ); if ($code != '') { $goods['goods_number'] = 0; } /* 关联商品 */ $link_goods_list = array(); $sql = "DELETE FROM " . $ecs->table('link_goods') . " WHERE (goods_id = 0 OR link_goods_id = 0)" . " AND admin_id = '$_SESSION[admin_id]'"; $db->query($sql); /* 组合商品 */ $group_goods_list = array(); $sql = "DELETE FROM " . $ecs->table('group_goods') . " WHERE parent_id = 0 AND admin_id = '$_SESSION[admin_id]'"; $db->query($sql); /* 关联文章 */ $goods_article_list = array(); $sql = "DELETE FROM " . $ecs->table('goods_article') . " WHERE goods_id = 0 AND admin_id = '$_SESSION[admin_id]'"; $db->query($sql); /* 属性 */ $sql = "DELETE FROM " . $ecs->table('goods_attr') . " WHERE goods_id = 0"; $db->query($sql); /* 图片列表 */ $img_list = array(); } else { /* 商品信息 */ $sql = "SELECT * FROM " . $ecs->table('goods') . " WHERE goods_id = '$_REQUEST[goods_id]'"; $goods = $db->getRow($sql); /* 虚拟卡商品复制时, 将其库存置为0*/ if ($is_copy && $code != '') { $goods['goods_number'] = 0; } if (empty($goods) === true) { /* 默认值 */ $goods = array( 'goods_id' => 0, 'goods_desc' => '', 'cat_id' => 0, 'is_on_sale' => '1', 'is_alone_sale' => '1', 'is_shipping' => '0', 'other_cat' => array(), // 扩展分类 'goods_type' => 0, // 商品类型 'shop_price' => 0, 'promote_price' => 0, 'market_price' => 0, 'integral' => 0, 'goods_number' => 1, 'warn_number' => 1, 'promote_start_date' => local_date('Y-m-d'), 'promote_end_date' => local_date('Y-m-d', gmstr2tome('+1 month')), 'goods_weight' => 0, 'give_integral' => -1, 'rank_integral' => -1 ); } /* 获取商品类型存在规格的类型 */ $specifications = get_goods_type_specifications(); $goods['specifications_id'] = $specifications[$goods['goods_type']]; $_attribute = get_goods_specifications_list($goods['goods_id']); $goods['_attribute'] = empty($_attribute) ? '' : 1; /* 根据商品重量的单位重新计算 */ if ($goods['goods_weight'] > 0) { $goods['goods_weight_by_unit'] = ($goods['goods_weight'] >= 1) ? $goods['goods_weight'] : ($goods['goods_weight'] / 0.001); } if (!empty($goods['goods_brief'])) { //$goods['goods_brief'] = trim_right($goods['goods_brief']); $goods['goods_brief'] = $goods['goods_brief']; } if (!empty($goods['keywords'])) { //$goods['keywords'] = trim_right($goods['keywords']); $goods['keywords'] = $goods['keywords']; } /* 如果不是促销,处理促销日期 */ if (isset($goods['is_promote']) && $goods['is_promote'] == '0') { unset($goods['promote_start_date']); unset($goods['promote_end_date']); } else { $goods['promote_start_date'] = local_date('Y-m-d', $goods['promote_start_date']); $goods['promote_end_date'] = local_date('Y-m-d', $goods['promote_end_date']); } /* 如果是复制商品,处理 */ if ($_REQUEST['act'] == 'copy') { // 商品信息 $goods['goods_id'] = 0; $goods['goods_sn'] = ''; $goods['goods_name'] = ''; $goods['goods_img'] = ''; $goods['goods_thumb'] = ''; $goods['original_img'] = ''; // 扩展分类不变 // 关联商品 $sql = "DELETE FROM " . $ecs->table('link_goods') . " WHERE (goods_id = 0 OR link_goods_id = 0)" . " AND admin_id = '$_SESSION[admin_id]'"; $db->query($sql); $sql = "SELECT '0' AS goods_id, link_goods_id, is_double, '$_SESSION[admin_id]' AS admin_id" . " FROM " . $ecs->table('link_goods') . " WHERE goods_id = '$_REQUEST[goods_id]' "; $res = $db->query($sql); while ($row = $db->fetchRow($res)) { $db->autoExecute($ecs->table('link_goods'), $row, 'INSERT'); } $sql = "SELECT goods_id, '0' AS link_goods_id, is_double, '$_SESSION[admin_id]' AS admin_id" . " FROM " . $ecs->table('link_goods') . " WHERE link_goods_id = '$_REQUEST[goods_id]' "; $res = $db->query($sql); while ($row = $db->fetchRow($res)) { $db->autoExecute($ecs->table('link_goods'), $row, 'INSERT'); } // 配件 $sql = "DELETE FROM " . $ecs->table('group_goods') . " WHERE parent_id = 0 AND admin_id = '$_SESSION[admin_id]'"; $db->query($sql); $sql = "SELECT 0 AS parent_id, goods_id, goods_price, '$_SESSION[admin_id]' AS admin_id " . "FROM " . $ecs->table('group_goods') . " WHERE parent_id = '$_REQUEST[goods_id]' "; $res = $db->query($sql); while ($row = $db->fetchRow($res)) { $db->autoExecute($ecs->table('group_goods'), $row, 'INSERT'); } // 关联文章 $sql = "DELETE FROM " . $ecs->table('goods_article') . " WHERE goods_id = 0 AND admin_id = '$_SESSION[admin_id]'"; $db->query($sql); $sql = "SELECT 0 AS goods_id, article_id, '$_SESSION[admin_id]' AS admin_id " . "FROM " . $ecs->table('goods_article') . " WHERE goods_id = '$_REQUEST[goods_id]' "; $res = $db->query($sql); while ($row = $db->fetchRow($res)) { $db->autoExecute($ecs->table('goods_article'), $row, 'INSERT'); } // 图片不变 // 商品属性 $sql = "DELETE FROM " . $ecs->table('goods_attr') . " WHERE goods_id = 0"; $db->query($sql); $sql = "SELECT 0 AS goods_id, attr_id, attr_value, attr_price " . "FROM " . $ecs->table('goods_attr') . " WHERE goods_id = '$_REQUEST[goods_id]' "; $res = $db->query($sql); while ($row = $db->fetchRow($res)) { $db->autoExecute($ecs->table('goods_attr'), addslashes_deep($row), 'INSERT'); } } // 扩展分类 $other_cat_list = array(); $sql = "SELECT cat_id FROM " . $ecs->table('goods_cat') . " WHERE goods_id = '$_REQUEST[goods_id]'"; $goods['other_cat'] = $db->getCol($sql); foreach ($goods['other_cat'] AS $cat_id) { $other_cat_list[$cat_id] = cat_list(0, $cat_id); } $smarty->assign('other_cat_list', $other_cat_list); $link_goods_list = get_linked_goods($goods['goods_id']); // 关联商品 $group_goods_list = get_group_goods($goods['goods_id']); // 配件 $goods_article_list = get_goods_articles($goods['goods_id']); // 关联文章 /* 商品图片路径 */ if (isset($GLOBALS['shop_id']) && ($GLOBALS['shop_id'] > 10) && !empty($goods['original_img'])) { $goods['goods_img'] = get_image_path($_REQUEST['goods_id'], $goods['goods_img']); $goods['goods_thumb'] = get_image_path($_REQUEST['goods_id'], $goods['goods_thumb'], true); } /* 图片列表 */ $sql = "SELECT * FROM " . $ecs->table('goods_gallery') . " WHERE goods_id = '$goods[goods_id]'"; $img_list = $db->getAll($sql); /* 格式化相册图片路径 */ if (isset($GLOBALS['shop_id']) && ($GLOBALS['shop_id'] > 0)) { foreach ($img_list as $key => $gallery_img) { $gallery_img[$key]['img_url'] = get_image_path($gallery_img['goods_id'], $gallery_img['img_original'], false, 'gallery'); $gallery_img[$key]['thumb_url'] = get_image_path($gallery_img['goods_id'], $gallery_img['img_original'], true, 'gallery'); } } else { foreach ($img_list as $key => $gallery_img) { $gallery_img[$key]['thumb_url'] = '../' . (empty($gallery_img['thumb_url']) ? $gallery_img['img_url'] : $gallery_img['thumb_url']); } } } /* 拆分商品名称样式 */ $goods_name_style = explode('+', empty($goods['goods_name_style']) ? '+' : $goods['goods_name_style']); /* 创建 html editor */ create_html_editor('goods_desc', $goods['goods_desc']); /* 模板赋值 */ $smarty->assign('code', $code); $smarty->assign('ur_here', $is_add ? (empty($code) ? $_LANG['02_goods_add'] : $_LANG['51_virtual_card_add']) : ($_REQUEST['act'] == 'edit' ? $_LANG['edit_goods'] : $_LANG['copy_goods'])); $smarty->assign('action_link', list_link($is_add, $code)); $smarty->assign('goods', $goods); $smarty->assign('goods_name_color', $goods_name_style[0]); $smarty->assign('goods_name_style', $goods_name_style[1]); $smarty->assign('cat_list', cat_list(0, $goods['cat_id'])); $smarty->assign('brand_list', get_brand_list()); $smarty->assign('unit_list', get_unit_list()); $smarty->assign('user_rank_list', get_user_rank_list()); $smarty->assign('weight_unit', $is_add ? '1' : ($goods['goods_weight'] >= 1 ? '1' : '0.001')); $smarty->assign('cfg', $_CFG); $smarty->assign('form_act', $is_add ? 'insert' : ($_REQUEST['act'] == 'edit' ? 'update' : 'insert')); if ($_REQUEST['act'] == 'add' || $_REQUEST['act'] == 'edit') { $smarty->assign('is_add', true); } if(!$is_add) { $smarty->assign('member_price_list', get_member_price_list($_REQUEST['goods_id'])); } $smarty->assign('link_goods_list', $link_goods_list); $smarty->assign('group_goods_list', $group_goods_list); $smarty->assign('goods_article_list', $goods_article_list); $smarty->assign('img_list', $img_list); $smarty->assign('goods_type_list', goods_type_list($goods['goods_type'])); $smarty->assign('gd', gd_version()); $smarty->assign('thumb_width', $_CFG['thumb_width']); $smarty->assign('thumb_height', $_CFG['thumb_height']); $smarty->assign('goods_attr_html', build_attr_html($goods['goods_type'], $goods['goods_id'])); $volume_price_list = ''; if(isset($_REQUEST['goods_id'])) { $volume_price_list = get_volume_price_list($_REQUEST['goods_id']); } if (empty($volume_price_list)) { $volume_price_list = array('0'=>array('number'=>'','price'=>'')); } $smarty->assign('volume_price_list', $volume_price_list); /* 显示商品信息页面 */ assign_query_info(); $smarty->display('goods_info.htm'); } /*------------------------------------------------------ */ //-- 插入商品 更新商品 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'insert' || $_REQUEST['act'] == 'update') { $code = empty($_REQUEST['extension_code']) ? '' : trim($_REQUEST['extension_code']); /* 是否处理缩略图 */ $proc_thumb = (isset($GLOBALS['shop_id']) && $GLOBALS['shop_id'] > 0)? false : true; if ($code == 'virtual_card') { admin_priv('virualcard'); // 检查权限 } else { admin_priv('goods_manage'); // 检查权限 } /* 检查货号是否重复 */ if ($_POST['goods_sn']) { $sql = "SELECT COUNT(*) FROM " . $ecs->table('goods') . " WHERE goods_sn = '$_POST[goods_sn]' AND is_delete = 0 AND goods_id <> '$_POST[goods_id]'"; if ($db->getOne($sql) > 0) { sys_msg($_LANG['goods_sn_exists'], 1, array(), false); } } /* 检查图片:如果有错误,检查尺寸是否超过最大值;否则,检查文件类型 */ if (isset($_FILES['goods_img']['error'])) // php 4.2 版本才支持 error { // 最大上传文件大小 $php_maxsize = ini_get('upload_max_filesize'); $htm_maxsize = '2M'; // 商品图片 if ($_FILES['goods_img']['error'] == 0) { if (!$image->check_img_type($_FILES['goods_img']['type'])) { sys_msg($_LANG['invalid_goods_img'], 1, array(), false); } } elseif ($_FILES['goods_img']['error'] == 1) { sys_msg(sprintf($_LANG['goods_img_too_big'], $php_maxsize), 1, array(), false); } elseif ($_FILES['goods_img']['error'] == 2) { sys_msg(sprintf($_LANG['goods_img_too_big'], $htm_maxsize), 1, array(), false); } // 商品缩略图 if (isset($_FILES['goods_thumb'])) { if ($_FILES['goods_thumb']['error'] == 0) { if (!$image->check_img_type($_FILES['goods_thumb']['type'])) { sys_msg($_LANG['invalid_goods_thumb'], 1, array(), false); } } elseif ($_FILES['goods_thumb']['error'] == 1) { sys_msg(sprintf($_LANG['goods_thumb_too_big'], $php_maxsize), 1, array(), false); } elseif ($_FILES['goods_thumb']['error'] == 2) { sys_msg(sprintf($_LANG['goods_thumb_too_big'], $htm_maxsize), 1, array(), false); } } // 相册图片 foreach ($_FILES['img_url']['error'] AS $key => $value) { if ($value == 0) { if (!$image->check_img_type($_FILES['img_url']['type'][$key])) { sys_msg(sprintf($_LANG['invalid_img_url'], $key + 1), 1, array(), false); } } elseif ($value == 1) { sys_msg(sprintf($_LANG['img_url_too_big'], $key + 1, $php_maxsize), 1, array(), false); } elseif ($_FILES['img_url']['error'] == 2) { sys_msg(sprintf($_LANG['img_url_too_big'], $key + 1, $htm_maxsize), 1, array(), false); } } } /* 4.1版本 */ else { // 商品图片 if ($_FILES['goods_img']['tmp_name'] != 'none') { if (!$image->check_img_type($_FILES['goods_img']['type'])) { sys_msg($_LANG['invalid_goods_img'], 1, array(), false); } } // 商品缩略图 if (isset($_FILES['goods_thumb'])) { if ($_FILES['goods_thumb']['tmp_name'] != 'none') { if (!$image->check_img_type($_FILES['goods_thumb']['type'])) { sys_msg($_LANG['invalid_goods_thumb'], 1, array(), false); } } } // 相册图片 foreach ($_FILES['img_url']['tmp_name'] AS $key => $value) { if ($value != 'none') { if (!$image->check_img_type($_FILES['img_url']['type'][$key])) { sys_msg(sprintf($_LANG['invalid_img_url'], $key + 1), 1, array(), false); } } } } /* 插入还是更新的标识 */ $is_insert = $_REQUEST['act'] == 'insert'; /* 处理商品图片 */ $goods_img = ''; // 初始化商品图片 $goods_thumb = ''; // 初始化商品缩略图 $original_img = ''; // 初始化原始图片 $old_original_img = ''; // 初始化原始图片旧图 // 如果上传了商品图片,相应处理 if (($_FILES['goods_img']['tmp_name'] != '' && $_FILES['goods_img']['tmp_name'] != 'none') or (($_POST['goods_img_url'] != $_LANG['lab_picture_url'] && $_POST['goods_img_url'] != 'http://') && $is_url_goods_img = 1)) { if ($_REQUEST['goods_id'] > 0) { /* 删除原来的图片文件 */ $sql = "SELECT goods_thumb, goods_img, original_img " . " FROM " . $ecs->table('goods') . " WHERE goods_id = '$_REQUEST[goods_id]'"; $row = $db->getRow($sql); if ($row['goods_thumb'] != '' && is_file('../' . $row['goods_thumb'])) { @unlink('../' . $row['goods_thumb']); } if ($row['goods_img'] != '' && is_file('../' . $row['goods_img'])) { @unlink('../' . $row['goods_img']); } if ($row['original_img'] != '' && is_file('../' . $row['original_img'])) { /* 先不处理,以防止程序中途出错停止 */ //$old_original_img = $row['original_img']; //记录旧图路径 } /* 清除原来商品图片 */ if ($proc_thumb === false) { get_image_path($_REQUEST[goods_id], $row['goods_img'], false, 'goods', true); get_image_path($_REQUEST[goods_id], $row['goods_thumb'], true, 'goods', true); } } if (empty($is_url_goods_img)) { $original_img = $image->upload_image($_FILES['goods_img']); // 原始图片 } elseif (copy(trim($_POST['goods_img_url']), ROOT_PATH . 'temp/' . basename($_POST['goods_img_url']))) { $original_img = 'temp/' . basename($_POST['goods_img_url']); } if ($original_img === false) { sys_msg($image->error_msg(), 1, array(), false); } $goods_img = $original_img; // 商品图片 /* 复制一份相册图片 */ /* 添加判断是否自动生成相册图片 */ if ($_CFG['auto_generate_gallery']) { $img = $original_img; // 相册图片 $pos = strpos(basename($img), '.'); $newname = dirname($img) . '/' . $image->random_filename() . substr(basename($img), $pos); if (!copy('../' . $img, '../' . $newname)) { sys_msg('fail to copy file: ' . realpath('../' . $img), 1, array(), false); } $img = $newname; $gallery_img = $img; $gallery_thumb = $img; } // 如果系统支持GD,缩放商品图片,且给商品图片和相册图片加水印 if ($proc_thumb && $image->gd_version() > 0 && $image->check_img_function($_FILES['goods_img']['type']) || $is_url_goods_img) { if (empty($is_url_goods_img)) { // 如果设置大小不为0,缩放图片 if ($_CFG['image_width'] != 0 || $_CFG['image_height'] != 0) { $goods_img = $image->make_thumb('../'. $goods_img , $GLOBALS['_CFG']['image_width'], $GLOBALS['_CFG']['image_height']); if ($goods_img === false) { sys_msg($image->error_msg(), 1, array(), false); } } /* 添加判断是否自动生成相册图片 */ if ($_CFG['auto_generate_gallery']) { $newname = dirname($img) . '/' . $image->random_filename() . substr(basename($img), $pos); if (!copy('../' . $img, '../' . $newname)) { sys_msg('fail to copy file: ' . realpath('../' . $img), 1, array(), false); } $gallery_img = $newname; } // 加水印 if (intval($_CFG['watermark_place']) > 0 && !empty($GLOBALS['_CFG']['watermark'])) { if ($image->add_watermark('../'.$goods_img,'',$GLOBALS['_CFG']['watermark'], $GLOBALS['_CFG']['watermark_place'], $GLOBALS['_CFG']['watermark_alpha']) === false) { sys_msg($image->error_msg(), 1, array(), false); } /* 添加判断是否自动生成相册图片 */ if ($_CFG['auto_generate_gallery']) { if ($image->add_watermark('../'. $gallery_img,'',$GLOBALS['_CFG']['watermark'], $GLOBALS['_CFG']['watermark_place'], $GLOBALS['_CFG']['watermark_alpha']) === false) { sys_msg($image->error_msg(), 1, array(), false); } } } } // 相册缩略图 /* 添加判断是否自动生成相册图片 */ if ($_CFG['auto_generate_gallery']) { if ($_CFG['thumb_width'] != 0 || $_CFG['thumb_height'] != 0) { $gallery_thumb = $image->make_thumb('../' . $img, $GLOBALS['_CFG']['thumb_width'], $GLOBALS['_CFG']['thumb_height']); if ($gallery_thumb === false) { sys_msg($image->error_msg(), 1, array(), false); } } } } /* 取消该原图复制流程 */ // else // { // /* 复制一份原图 */ // $pos = strpos(basename($img), '.'); // $gallery_img = dirname($img) . '/' . $image->random_filename() . // substr(basename($img), $pos); // if (!copy('../' . $img, '../' . $gallery_img)) // { // sys_msg('fail to copy file: ' . realpath('../' . $img), 1, array(), false); // } // $gallery_thumb = ''; // } } // 是否上传商品缩略图 if (isset($_FILES['goods_thumb']) && $_FILES['goods_thumb']['tmp_name'] != '' && isset($_FILES['goods_thumb']['tmp_name']) &&$_FILES['goods_thumb']['tmp_name'] != 'none') { // 上传了,直接使用,原始大小 $goods_thumb = $image->upload_image($_FILES['goods_thumb']); if ($goods_thumb === false) { sys_msg($image->error_msg(), 1, array(), false); } } else { // 未上传,如果自动选择生成,且上传了商品图片,生成所略图 if ($proc_thumb && isset($_POST['auto_thumb']) && !empty($original_img)) { // 如果设置缩略图大小不为0,生成缩略图 if ($_CFG['thumb_width'] != 0 || $_CFG['thumb_height'] != 0) { $goods_thumb = $image->make_thumb('../' . $original_img, $GLOBALS['_CFG']['thumb_width'], $GLOBALS['_CFG']['thumb_height']); if ($goods_thumb === false) { sys_msg($image->error_msg(), 1, array(), false); } } else { $goods_thumb = $original_img; } } } /* 删除下载的外链原图 */ if (!empty($is_url_goods_img)) { unlink(ROOT_PATH . $original_img); empty($newname) || unlink(ROOT_PATH . $newname); $url_goods_img = $goods_img = $original_img = htmlspecialchars(trim($_POST['goods_img_url'])); } /* 如果没有输入商品货号则自动生成一个商品货号 */ if (empty($_POST['goods_sn'])) { $max_id = $is_insert ? $db->getOne("SELECT MAX(goods_id) + 1 FROM ".$ecs->table('goods')) : $_REQUEST['goods_id']; $goods_sn = generate_goods_sn($max_id); } else { $goods_sn = $_POST['goods_sn']; } /* 处理商品数据 */ $shop_price = !empty($_POST['shop_price']) ? $_POST['shop_price'] : 0; $market_price = !empty($_POST['market_price']) ? $_POST['market_price'] : 0; $promote_price = !empty($_POST['promote_price']) ? floatval($_POST['promote_price'] ) : 0; $is_promote = empty($promote_price) ? 0 : 1; $promote_start_date = ($is_promote && !empty($_POST['promote_start_date'])) ? local_strtotime($_POST['promote_start_date']) : 0; $promote_end_date = ($is_promote && !empty($_POST['promote_end_date'])) ? local_strtotime($_POST['promote_end_date']) : 0; $goods_weight = !empty($_POST['goods_weight']) ? $_POST['goods_weight'] * $_POST['weight_unit'] : 0; $is_best = isset($_POST['is_best']) ? 1 : 0; $is_new = isset($_POST['is_new']) ? 1 : 0; $is_hot = isset($_POST['is_hot']) ? 1 : 0; $is_on_sale = isset($_POST['is_on_sale']) ? 1 : 0; $is_alone_sale = isset($_POST['is_alone_sale']) ? 1 : 0; $is_shipping = isset($_POST['is_shipping']) ? 1 : 0; $goods_number = isset($_POST['goods_number']) ? $_POST['goods_number'] : 0; $warn_number = isset($_POST['warn_number']) ? $_POST['warn_number'] : 0; $goods_type = isset($_POST['goods_type']) ? $_POST['goods_type'] : 0; $give_integral = isset($_POST['give_integral']) ? intval($_POST['give_integral']) : '-1'; $rank_integral = isset($_POST['rank_integral']) ? intval($_POST['rank_integral']) : '-1'; $suppliers_id = isset($_POST['suppliers_id']) ? intval($_POST['suppliers_id']) : '0'; $goods_name_style = $_POST['goods_name_color'] . '+' . $_POST['goods_name_style']; $catgory_id = empty($_POST['cat_id']) ? '' : intval($_POST['cat_id']); $brand_id = empty($_POST['brand_id']) ? '' : intval($_POST['brand_id']); $goods_thumb = (empty($goods_thumb) && !empty($_POST['goods_thumb_url']) && goods_parse_url($_POST['goods_thumb_url'])) ? htmlspecialchars(trim($_POST['goods_thumb_url'])) : $goods_thumb; $goods_thumb = (empty($goods_thumb) && isset($_POST['auto_thumb']))? $goods_img : $goods_thumb; /* 入库 */ if ($is_insert) { if ($code == '') { $sql = "INSERT INTO " . $ecs->table('goods') . " (goods_name, goods_name_style, goods_sn, " . "cat_id, brand_id, shop_price, market_price, is_promote, promote_price, " . "promote_start_date, promote_end_date, goods_img, goods_thumb, original_img, keywords, goods_brief, " . "seller_note, goods_weight, goods_number, warn_number, integral, give_integral, is_best, is_new, is_hot, " . "is_on_sale, is_alone_sale, is_shipping, goods_desc, add_time, last_update, goods_type, rank_integral, suppliers_id)" . "VALUES ('$_POST[goods_name]', '$goods_name_style', '$goods_sn', '$catgory_id', " . "'$brand_id', '$shop_price', '$market_price', '$is_promote','$promote_price', ". "'$promote_start_date', '$promote_end_date', '$goods_img', '$goods_thumb', '$original_img', ". "'$_POST[keywords]', '$_POST[goods_brief]', '$_POST[seller_note]', '$goods_weight', '$goods_number',". " '$warn_number', '$_POST[integral]', '$give_integral', '$is_best', '$is_new', '$is_hot', '$is_on_sale', '$is_alone_sale', $is_shipping, ". " '$_POST[goods_desc]', '" . gmtime() . "', '". gmtime() ."', '$goods_type', '$rank_integral', '$suppliers_id')"; } else { $sql = "INSERT INTO " . $ecs->table('goods') . " (goods_name, goods_name_style, goods_sn, " . "cat_id, brand_id, shop_price, market_price, is_promote, promote_price, " . "promote_start_date, promote_end_date, goods_img, goods_thumb, original_img, keywords, goods_brief, " . "seller_note, goods_weight, goods_number, warn_number, integral, give_integral, is_best, is_new, is_hot, is_real, " . "is_on_sale, is_alone_sale, is_shipping, goods_desc, add_time, last_update, goods_type, extension_code, rank_integral)" . "VALUES ('$_POST[goods_name]', '$goods_name_style', '$goods_sn', '$catgory_id', " . "'$brand_id', '$shop_price', '$market_price', '$is_promote','$promote_price', ". "'$promote_start_date', '$promote_end_date', '$goods_img', '$goods_thumb', '$original_img', ". "'$_POST[keywords]', '$_POST[goods_brief]', '$_POST[seller_note]', '$goods_weight', '$goods_number',". " '$warn_number', '$_POST[integral]', '$give_integral', '$is_best', '$is_new', '$is_hot', 0, '$is_on_sale', '$is_alone_sale', $is_shipping, ". " '$_POST[goods_desc]', '" . gmtime() . "', '". gmtime() ."', '$goods_type', '$code', '$rank_integral')"; } } else { /* 如果有上传图片,删除原来的商品图 */ $sql = "SELECT goods_thumb, goods_img, original_img " . " FROM " . $ecs->table('goods') . " WHERE goods_id = '$_REQUEST[goods_id]'"; $row = $db->getRow($sql); if ($proc_thumb && $goods_img && $row['goods_img'] && !goods_parse_url($row['goods_img'])) { @unlink(ROOT_PATH . $row['goods_img']); @unlink(ROOT_PATH . $row['original_img']); } if ($proc_thumb && $goods_thumb && $row['goods_thumb'] && !goods_parse_url($row['goods_thumb'])) { @unlink(ROOT_PATH . $row['goods_thumb']); } $sql = "UPDATE " . $ecs->table('goods') . " SET " . "goods_name = '$_POST[goods_name]', " . "goods_name_style = '$goods_name_style', " . "goods_sn = '$goods_sn', " . "cat_id = '$catgory_id', " . "brand_id = '$brand_id', " . "shop_price = '$shop_price', " . "market_price = '$market_price', " . "is_promote = '$is_promote', " . "promote_price = '$promote_price', " . "promote_start_date = '$promote_start_date', " . "suppliers_id = '$suppliers_id', " . "promote_end_date = '$promote_end_date', "; /* 如果有上传图片,需要更新数据库 */ if ($goods_img) { $sql .= "goods_img = '$goods_img', original_img = '$original_img', "; } if ($goods_thumb) { $sql .= "goods_thumb = '$goods_thumb', "; } if ($code != '') { $sql .= "is_real=0, extension_code='$code', "; } $sql .= "keywords = '$_POST[keywords]', " . "goods_brief = '$_POST[goods_brief]', " . "seller_note = '$_POST[seller_note]', " . "goods_weight = '$goods_weight'," . "goods_number = '$goods_number', " . "warn_number = '$warn_number', " . "integral = '$_POST[integral]', " . "give_integral = '$give_integral', " . "rank_integral = '$rank_integral', " . "is_best = '$is_best', " . "is_new = '$is_new', " . "is_hot = '$is_hot', " . "is_on_sale = '$is_on_sale', " . "is_alone_sale = '$is_alone_sale', " . "is_shipping = '$is_shipping', " . "goods_desc = '$_POST[goods_desc]', " . "last_update = '". gmtime() ."', ". "goods_type = '$goods_type' " . "WHERE goods_id = '$_REQUEST[goods_id]' LIMIT 1"; } $db->query($sql); /* 商品编号 */ $goods_id = $is_insert ? $db->insert_id() : $_REQUEST['goods_id']; /* 记录日志 */ if ($is_insert) { admin_log($_POST['goods_name'], 'add', 'goods'); } else { admin_log($_POST['goods_name'], 'edit', 'goods'); } /* 处理属性 */ if ((isset($_POST['attr_id_list']) && isset($_POST['attr_value_list'])) || (empty($_POST['attr_id_list']) && empty($_POST['attr_value_list']))) { // 取得原有的属性值 $goods_attr_list = array(); $keywords_arr = explode(" ", $_POST['keywords']); $keywords_arr = array_flip($keywords_arr); if (isset($keywords_arr[''])) { unset($keywords_arr['']); } $sql = "SELECT attr_id, attr_index FROM " . $ecs->table('attribute') . " WHERE cat_id = '$goods_type'"; $attr_res = $db->query($sql); $attr_list = array(); while ($row = $db->fetchRow($attr_res)) { $attr_list[$row['attr_id']] = $row['attr_index']; } $sql = "SELECT g.*, a.attr_type FROM " . $ecs->table('goods_attr') . " AS g LEFT JOIN " . $ecs->table('attribute') . " AS a ON a.attr_id = g.attr_id WHERE g.goods_id = '$goods_id'"; $res = $db->query($sql); while ($row = $db->fetchRow($res)) { $goods_attr_list[$row['attr_id']][$row['attr_value']] = array('sign' => 'delete', 'goods_attr_id' => $row['goods_attr_id']); } // 循环现有的,根据原有的做相应处理 if(isset($_POST['attr_id_list'])) { foreach ($_POST['attr_id_list'] AS $key => $attr_id) { $attr_value = $_POST['attr_value_list'][$key]; $attr_price = $_POST['attr_price_list'][$key]; if (!empty($attr_value)) { if (isset($goods_attr_list[$attr_id][$attr_value])) { // 如果原来有,标记为更新 $goods_attr_list[$attr_id][$attr_value]['sign'] = 'update'; $goods_attr_list[$attr_id][$attr_value]['attr_price'] = $attr_price; } else { // 如果原来没有,标记为新增 $goods_attr_list[$attr_id][$attr_value]['sign'] = 'insert'; $goods_attr_list[$attr_id][$attr_value]['attr_price'] = $attr_price; } $val_arr = explode(' ', $attr_value); foreach ($val_arr AS $k => $v) { if (!isset($keywords_arr[$v]) && $attr_list[$attr_id] == "1") { $keywords_arr[$v] = $v; } } } } } $keywords = join(' ', array_flip($keywords_arr)); $sql = "UPDATE " .$ecs->table('goods'). " SET keywords = '$keywords' WHERE goods_id = '$goods_id' LIMIT 1"; $db->query($sql); /* 插入、更新、删除数据 */ foreach ($goods_attr_list as $attr_id => $attr_value_list) { foreach ($attr_value_list as $attr_value => $info) { if ($info['sign'] == 'insert') { $sql = "INSERT INTO " .$ecs->table('goods_attr'). " (attr_id, goods_id, attr_value, attr_price)". "VALUES ('$attr_id', '$goods_id', '$attr_value', '$info[attr_price]')"; } elseif ($info['sign'] == 'update') { $sql = "UPDATE " .$ecs->table('goods_attr'). " SET attr_price = '$info[attr_price]' WHERE goods_attr_id = '$info[goods_attr_id]' LIMIT 1"; } else { $sql = "DELETE FROM " .$ecs->table('goods_attr'). " WHERE goods_attr_id = '$info[goods_attr_id]' LIMIT 1"; } $db->query($sql); } } } /* 处理会员价格 */ if (isset($_POST['user_rank']) && isset($_POST['user_price'])) { handle_member_price($goods_id, $_POST['user_rank'], $_POST['user_price']); } /* 处理优惠价格 */ if (isset($_POST['volume_number']) && isset($_POST['volume_price'])) { $temp_num = array_count_values($_POST['volume_number']); foreach($temp_num as $v) { if ($v > 1) { sys_msg($_LANG['volume_number_continuous'], 1, array(), false); break; } } handle_volume_price($goods_id, $_POST['volume_number'], $_POST['volume_price']); } /* 处理扩展分类 */ if (isset($_POST['other_cat'])) { handle_other_cat($goods_id, array_unique($_POST['other_cat'])); } if ($is_insert) { /* 处理关联商品 */ handle_link_goods($goods_id); /* 处理组合商品 */ handle_group_goods($goods_id); /* 处理关联文章 */ handle_goods_article($goods_id); } /* 重新格式化图片名称 */ $original_img = reformat_image_name('goods', $goods_id, $original_img, 'source'); $goods_img = reformat_image_name('goods', $goods_id, $goods_img, 'goods'); $goods_thumb = reformat_image_name('goods_thumb', $goods_id, $goods_thumb, 'thumb'); if ($goods_img !== false) { $db->query("UPDATE " . $ecs->table('goods') . " SET goods_img = '$goods_img' WHERE goods_id='$goods_id'"); } if ($original_img !== false) { $db->query("UPDATE " . $ecs->table('goods') . " SET original_img = '$original_img' WHERE goods_id='$goods_id'"); } if ($goods_thumb !== false) { $db->query("UPDATE " . $ecs->table('goods') . " SET goods_thumb = '$goods_thumb' WHERE goods_id='$goods_id'"); } /* 如果有图片,把商品图片加入图片相册 */ if (isset($img)) { /* 重新格式化图片名称 */ if (empty($is_url_goods_img)) { $img = reformat_image_name('gallery', $goods_id, $img, 'source'); $gallery_img = reformat_image_name('gallery', $goods_id, $gallery_img, 'goods'); } else { $img = $url_goods_img; $gallery_img = $url_goods_img; } $gallery_thumb = reformat_image_name('gallery_thumb', $goods_id, $gallery_thumb, 'thumb'); $sql = "INSERT INTO " . $ecs->table('goods_gallery') . " (goods_id, img_url, img_desc, thumb_url, img_original) " . "VALUES ('$goods_id', '$gallery_img', '', '$gallery_thumb', '$img')"; $db->query($sql); } /* 处理相册图片 */ handle_gallery_image($goods_id, $_FILES['img_url'], $_POST['img_desc'], $_POST['img_file']); /* 编辑时处理相册图片描述 */ if (!$is_insert && isset($_POST['old_img_desc'])) { foreach ($_POST['old_img_desc'] AS $img_id => $img_desc) { $sql = "UPDATE " . $ecs->table('goods_gallery') . " SET img_desc = '$img_desc' WHERE img_id = '$img_id' LIMIT 1"; $db->query($sql); } } /* 不保留商品原图的时候删除原图 */ if ($proc_thumb && !$_CFG['retain_original_img'] && !empty($original_img)) { $db->query("UPDATE " . $ecs->table('goods') . " SET original_img='' WHERE `goods_id`='{$goods_id}'"); $db->query("UPDATE " . $ecs->table('goods_gallery') . " SET img_original='' WHERE `goods_id`='{$goods_id}'"); @unlink('../' . $original_img); @unlink('../' . $img); } /* 记录上一次选择的分类和品牌 */ setcookie('ECSCP[last_choose]', $catgory_id . '|' . $brand_id, gmtime() + 86400); /* 清空缓存 */ clear_cache_files(); /* 提示页面 */ $link = array(); if (check_goods_specifications_exist($goods_id)) { $link[0] = array('href' => 'goods.php?act=product_list&goods_id=' . $goods_id, 'text' => $_LANG['product']); } if ($code == 'virtual_card') { $link[1] = array('href' => 'virtual_card.php?act=replenish&goods_id=' . $goods_id, 'text' => $_LANG['add_replenish']); } if ($is_insert) { $link[2] = add_link($code); } $link[3] = list_link($is_insert, $code); if (empty($is_insert)) { $key_array = array_keys($link); krsort($link); $link = array_combine($key_array, $link); } sys_msg($is_insert ? $_LANG['add_goods_ok'] : $_LANG['edit_goods_ok'], 0, $link); } /*------------------------------------------------------ */ //-- 批量操作 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'batch') { $code = empty($_REQUEST['extension_code'])? '' : trim($_REQUEST['extension_code']); /* 取得要操作的商品编号 */ $goods_id = !empty($_POST['checkboxes']) ? join(',', $_POST['checkboxes']) : 0; if (isset($_POST['type'])) { /* 放入回收站 */ if ($_POST['type'] == 'trash') { /* 检查权限 */ admin_priv('remove_back'); update_goods($goods_id, 'is_delete', '1'); /* 记录日志 */ admin_log('', 'batch_trash', 'goods'); } /* 上架 */ elseif ($_POST['type'] == 'on_sale') { /* 检查权限 */ admin_priv('goods_manage'); update_goods($goods_id, 'is_on_sale', '1'); } /* 下架 */ elseif ($_POST['type'] == 'not_on_sale') { /* 检查权限 */ admin_priv('goods_manage'); update_goods($goods_id, 'is_on_sale', '0'); } /* 设为精品 */ elseif ($_POST['type'] == 'best') { /* 检查权限 */ admin_priv('goods_manage'); update_goods($goods_id, 'is_best', '1'); } /* 取消精品 */ elseif ($_POST['type'] == 'not_best') { /* 检查权限 */ admin_priv('goods_manage'); update_goods($goods_id, 'is_best', '0'); } /* 设为新品 */ elseif ($_POST['type'] == 'new') { /* 检查权限 */ admin_priv('goods_manage'); update_goods($goods_id, 'is_new', '1'); } /* 取消新品 */ elseif ($_POST['type'] == 'not_new') { /* 检查权限 */ admin_priv('goods_manage'); update_goods($goods_id, 'is_new', '0'); } /* 设为热销 */ elseif ($_POST['type'] == 'hot') { /* 检查权限 */ admin_priv('goods_manage'); update_goods($goods_id, 'is_hot', '1'); } /* 取消热销 */ elseif ($_POST['type'] == 'not_hot') { /* 检查权限 */ admin_priv('goods_manage'); update_goods($goods_id, 'is_hot', '0'); } /* 转移到分类 */ elseif ($_POST['type'] == 'move_to') { /* 检查权限 */ admin_priv('goods_manage'); update_goods($goods_id, 'cat_id', $_POST['target_cat']); } /* 转移到供货商 */ elseif ($_POST['type'] == 'suppliers_move_to') { /* 检查权限 */ admin_priv('goods_manage'); update_goods($goods_id, 'suppliers_id', $_POST['suppliers_id']); } /* 还原 */ elseif ($_POST['type'] == 'restore') { /* 检查权限 */ admin_priv('remove_back'); update_goods($goods_id, 'is_delete', '0'); /* 记录日志 */ admin_log('', 'batch_restore', 'goods'); } /* 删除 */ elseif ($_POST['type'] == 'drop') { /* 检查权限 */ admin_priv('remove_back'); delete_goods($goods_id); /* 记录日志 */ admin_log('', 'batch_remove', 'goods'); } } /* 清除缓存 */ clear_cache_files(); if ($_POST['type'] == 'drop' || $_POST['type'] == 'restore') { $link[] = array('href' => 'goods.php?act=trash', 'text' => $_LANG['11_goods_trash']); } else { $link[] = list_link(true, $code); } sys_msg($_LANG['batch_handle_ok'], 0, $link); } /*------------------------------------------------------ */ //-- 显示图片 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'show_image') { if (isset($GLOBALS['shop_id']) && $GLOBALS['shop_id'] > 0) { $img_url = $_GET['img_url']; } else { if (strpos($_GET['img_url'], 'http://') === 0) { $img_url = $_GET['img_url']; } else { $img_url = '../' . $_GET['img_url']; } } $smarty->assign('img_url', $img_url); $smarty->display('goods_show_image.htm'); } /*------------------------------------------------------ */ //-- 修改商品名称 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'edit_goods_name') { check_authz_json('goods_manage'); $goods_id = intval($_POST['id']); $goods_name = json_str_iconv(trim($_POST['val'])); if ($exc->edit("goods_name = '$goods_name', last_update=" .gmtime(), $goods_id)) { clear_cache_files(); make_json_result(stripslashes($goods_name)); } } /*------------------------------------------------------ */ //-- 修改商品货号 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'edit_goods_sn') { check_authz_json('goods_manage'); $goods_id = intval($_POST['id']); $goods_sn = json_str_iconv(trim($_POST['val'])); /* 检查是否重复 */ if (!$exc->is_only('goods_sn', $goods_sn, $goods_id)) { make_json_error($_LANG['goods_sn_exists']); } if ($exc->edit("goods_sn = '$goods_sn', last_update=" .gmtime(), $goods_id)) { clear_cache_files(); make_json_result(stripslashes($goods_sn)); } } elseif ($_REQUEST['act'] == 'check_goods_sn') { check_authz_json('goods_manage'); $goods_id = intval($_REQUEST['goods_id']); $goods_sn = json_str_iconv(trim($_REQUEST['goods_sn'])); /* 检查是否重复 */ if (!$exc->is_only('goods_sn', $goods_sn, $goods_id)) { make_json_error($_LANG['goods_sn_exists']); } make_json_result(''); } /*------------------------------------------------------ */ //-- 修改商品价格 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'edit_goods_price') { check_authz_json('goods_manage'); $goods_id = intval($_POST['id']); $goods_price = floatval($_POST['val']); $price_rate = floatval($_CFG['market_price_rate'] * $goods_price); if ($goods_price < 0 || $goods_price == 0 && $_POST['val'] != "$goods_price") { make_json_error($_LANG['shop_price_invalid']); } else { if ($exc->edit("shop_price = '$goods_price', market_price = '$price_rate', last_update=" .gmtime(), $goods_id)) { clear_cache_files(); make_json_result(number_format($goods_price, 2, '.', '')); } } } /*------------------------------------------------------ */ //-- 修改商品库存数量 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'edit_goods_number') { check_authz_json('goods_manage'); $goods_id = intval($_POST['id']); $goods_num = intval($_POST['val']); if($goods_num < 0 || $goods_num == 0 && $_POST['val'] != "$goods_num") { make_json_error($_LANG['goods_number_error']); } if(check_goods_product_exist($goods_id) == 1) { make_json_error($_LANG['sys']['wrong'] . $_LANG['cannot_goods_number']); } if ($exc->edit("goods_number = '$goods_num', last_update=" .gmtime(), $goods_id)) { clear_cache_files(); make_json_result($goods_num); } } /*------------------------------------------------------ */ //-- 修改上架状态 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'toggle_on_sale') { check_authz_json('goods_manage'); $goods_id = intval($_POST['id']); $on_sale = intval($_POST['val']); if ($exc->edit("is_on_sale = '$on_sale', last_update=" .gmtime(), $goods_id)) { clear_cache_files(); make_json_result($on_sale); } } /*------------------------------------------------------ */ //-- 修改精品推荐状态 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'toggle_best') { check_authz_json('goods_manage'); $goods_id = intval($_POST['id']); $is_best = intval($_POST['val']); if ($exc->edit("is_best = '$is_best', last_update=" .gmtime(), $goods_id)) { clear_cache_files(); make_json_result($is_best); } } /*------------------------------------------------------ */ //-- 修改新品推荐状态 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'toggle_new') { check_authz_json('goods_manage'); $goods_id = intval($_POST['id']); $is_new = intval($_POST['val']); if ($exc->edit("is_new = '$is_new', last_update=" .gmtime(), $goods_id)) { clear_cache_files(); make_json_result($is_new); } } /*------------------------------------------------------ */ //-- 修改热销推荐状态 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'toggle_hot') { check_authz_json('goods_manage'); $goods_id = intval($_POST['id']); $is_hot = intval($_POST['val']); if ($exc->edit("is_hot = '$is_hot', last_update=" .gmtime(), $goods_id)) { clear_cache_files(); make_json_result($is_hot); } } /*------------------------------------------------------ */ //-- 修改商品排序 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'edit_sort_order') { check_authz_json('goods_manage'); $goods_id = intval($_POST['id']); $sort_order = intval($_POST['val']); if ($exc->edit("sort_order = '$sort_order', last_update=" .gmtime(), $goods_id)) { clear_cache_files(); make_json_result($sort_order); } } /*------------------------------------------------------ */ //-- 排序、分页、查询 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'query') { $is_delete = empty($_REQUEST['is_delete']) ? 0 : intval($_REQUEST['is_delete']); $code = empty($_REQUEST['extension_code']) ? '' : trim($_REQUEST['extension_code']); $goods_list = goods_list($is_delete, ($code=='') ? 1 : 0); $handler_list = array(); $handler_list['virtual_card'][] = array('url'=>'virtual_card.php?act=card', 'title'=>$_LANG['card'], 'img'=>'icon_send_bonus.gif'); $handler_list['virtual_card'][] = array('url'=>'virtual_card.php?act=replenish', 'title'=>$_LANG['replenish'], 'img'=>'icon_add.gif'); $handler_list['virtual_card'][] = array('url'=>'virtual_card.php?act=batch_card_add', 'title'=>$_LANG['batch_card_add'], 'img'=>'icon_output.gif'); if (isset($handler_list[$code])) { $smarty->assign('add_handler', $handler_list[$code]); } $smarty->assign('code', $code); $smarty->assign('goods_list', $goods_list['goods']); $smarty->assign('filter', $goods_list['filter']); $smarty->assign('record_count', $goods_list['record_count']); $smarty->assign('page_count', $goods_list['page_count']); $smarty->assign('list_type', $is_delete ? 'trash' : 'goods'); $smarty->assign('use_storage', empty($_CFG['use_storage']) ? 0 : 1); /* 排序标记 */ $sort_flag = sort_flag($goods_list['filter']); $smarty->assign($sort_flag['tag'], $sort_flag['img']); /* 获取商品类型存在规格的类型 */ $specifications = get_goods_type_specifications(); $smarty->assign('specifications', $specifications); $tpl = $is_delete ? 'goods_trash.htm' : 'goods_list.htm'; make_json_result($smarty->fetch($tpl), '', array('filter' => $goods_list['filter'], 'page_count' => $goods_list['page_count'])); } /*------------------------------------------------------ */ //-- 放入回收站 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'remove') { $goods_id = intval($_REQUEST['id']); /* 检查权限 */ check_authz_json('remove_back'); if ($exc->edit("is_delete = 1", $goods_id)) { clear_cache_files(); $goods_name = $exc->get_name($goods_id); admin_log(addslashes($goods_name), 'trash', 'goods'); // 记录日志 $url = 'goods.php?act=query&' . str_replace('act=remove', '', $_SERVER['QUERY_STRING']); ecs_header("Location: $url\n"); exit; } } /*------------------------------------------------------ */ //-- 还原回收站中的商品 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'restore_goods') { $goods_id = intval($_REQUEST['id']); check_authz_json('remove_back'); // 检查权限 $exc->edit("is_delete = 0, add_time = '" . gmtime() . "'", $goods_id); clear_cache_files(); $goods_name = $exc->get_name($goods_id); admin_log(addslashes($goods_name), 'restore', 'goods'); // 记录日志 $url = 'goods.php?act=query&' . str_replace('act=restore_goods', '', $_SERVER['QUERY_STRING']); ecs_header("Location: $url\n"); exit; } /*------------------------------------------------------ */ //-- 彻底删除商品 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'drop_goods') { // 检查权限 check_authz_json('remove_back'); // 取得参数 $goods_id = intval($_REQUEST['id']); if ($goods_id <= 0) { make_json_error('invalid params'); } /* 取得商品信息 */ $sql = "SELECT goods_id, goods_name, is_delete, is_real, goods_thumb, " . "goods_img, original_img " . "FROM " . $ecs->table('goods') . " WHERE goods_id = '$goods_id'"; $goods = $db->getRow($sql); if (empty($goods)) { make_json_error($_LANG['goods_not_exist']); } if ($goods['is_delete'] != 1) { make_json_error($_LANG['goods_not_in_recycle_bin']); } /* 删除商品图片和轮播图片 */ if (!empty($goods['goods_thumb'])) { @unlink('../' . $goods['goods_thumb']); } if (!empty($goods['goods_img'])) { @unlink('../' . $goods['goods_img']); } if (!empty($goods['original_img'])) { @unlink('../' . $goods['original_img']); } /* 删除商品 */ $exc->drop($goods_id); /* 删除商品的货品记录 */ $sql = "DELETE FROM " . $ecs->table('products') . " WHERE goods_id = '$goods_id'"; $db->query($sql); /* 记录日志 */ admin_log(addslashes($goods['goods_name']), 'remove', 'goods'); /* 删除商品相册 */ $sql = "SELECT img_url, thumb_url, img_original " . "FROM " . $ecs->table('goods_gallery') . " WHERE goods_id = '$goods_id'"; $res = $db->query($sql); while ($row = $db->fetchRow($res)) { if (!empty($row['img_url'])) { @unlink('../' . $row['img_url']); } if (!empty($row['thumb_url'])) { @unlink('../' . $row['thumb_url']); } if (!empty($row['img_original'])) { @unlink('../' . $row['img_original']); } } $sql = "DELETE FROM " . $ecs->table('goods_gallery') . " WHERE goods_id = '$goods_id'"; $db->query($sql); /* 删除相关表记录 */ $sql = "DELETE FROM " . $ecs->table('collect_goods') . " WHERE goods_id = '$goods_id'"; $db->query($sql); $sql = "DELETE FROM " . $ecs->table('goods_article') . " WHERE goods_id = '$goods_id'"; $db->query($sql); $sql = "DELETE FROM " . $ecs->table('goods_attr') . " WHERE goods_id = '$goods_id'"; $db->query($sql); $sql = "DELETE FROM " . $ecs->table('goods_cat') . " WHERE goods_id = '$goods_id'"; $db->query($sql); $sql = "DELETE FROM " . $ecs->table('member_price') . " WHERE goods_id = '$goods_id'"; $db->query($sql); $sql = "DELETE FROM " . $ecs->table('group_goods') . " WHERE parent_id = '$goods_id'"; $db->query($sql); $sql = "DELETE FROM " . $ecs->table('group_goods') . " WHERE goods_id = '$goods_id'"; $db->query($sql); $sql = "DELETE FROM " . $ecs->table('link_goods') . " WHERE goods_id = '$goods_id'"; $db->query($sql); $sql = "DELETE FROM " . $ecs->table('link_goods') . " WHERE link_goods_id = '$goods_id'"; $db->query($sql); $sql = "DELETE FROM " . $ecs->table('tag') . " WHERE goods_id = '$goods_id'"; $db->query($sql); $sql = "DELETE FROM " . $ecs->table('comment') . " WHERE comment_type = 0 AND id_value = '$goods_id'"; $db->query($sql); $sql = "DELETE FROM " . $ecs->table('collect_goods') . " WHERE goods_id = '$goods_id'"; $db->query($sql); $sql = "DELETE FROM " . $ecs->table('booking_goods') . " WHERE goods_id = '$goods_id'"; $db->query($sql); $sql = "DELETE FROM " . $ecs->table('goods_activity') . " WHERE goods_id = '$goods_id'"; $db->query($sql); /* 如果不是实体商品,删除相应虚拟商品记录 */ if ($goods['is_real'] != 1) { $sql = "DELETE FROM " . $ecs->table('virtual_card') . " WHERE goods_id = '$goods_id'"; if (!$db->query($sql, 'SILENT') && $db->errno() != 1146) { die($db->error()); } } clear_cache_files(); $url = 'goods.php?act=query&' . str_replace('act=drop_goods', '', $_SERVER['QUERY_STRING']); ecs_header("Location: $url\n"); exit; } /*------------------------------------------------------ */ //-- 切换商品类型 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'get_attr') { check_authz_json('goods_manage'); $goods_id = empty($_GET['goods_id']) ? 0 : intval($_GET['goods_id']); $goods_type = empty($_GET['goods_type']) ? 0 : intval($_GET['goods_type']); $content = build_attr_html($goods_type, $goods_id); make_json_result($content); } /*------------------------------------------------------ */ //-- 删除图片 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'drop_image') { check_authz_json('goods_manage'); $img_id = empty($_REQUEST['img_id']) ? 0 : intval($_REQUEST['img_id']); /* 删除图片文件 */ $sql = "SELECT img_url, thumb_url, img_original " . " FROM " . $GLOBALS['ecs']->table('goods_gallery') . " WHERE img_id = '$img_id'"; $row = $GLOBALS['db']->getRow($sql); if ($row['img_url'] != '' && is_file('../' . $row['img_url'])) { @unlink('../' . $row['img_url']); } if ($row['thumb_url'] != '' && is_file('../' . $row['thumb_url'])) { @unlink('../' . $row['thumb_url']); } if ($row['img_original'] != '' && is_file('../' . $row['img_original'])) { @unlink('../' . $row['img_original']); } /* 删除数据 */ $sql = "DELETE FROM " . $GLOBALS['ecs']->table('goods_gallery') . " WHERE img_id = '$img_id' LIMIT 1"; $GLOBALS['db']->query($sql); clear_cache_files(); make_json_result($img_id); } /*------------------------------------------------------ */ //-- 搜索商品,仅返回名称及ID /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'get_goods_list') { include_once(ROOT_PATH . 'includes/cls_json.php'); $json = new JSON; $filters = $json->decode($_GET['JSON']); $arr = get_goods_list($filters); $opt = array(); foreach ($arr AS $key => $val) { $opt[] = array('value' => $val['goods_id'], 'text' => $val['goods_name'], 'data' => $val['shop_price']); } make_json_result($opt); } /*------------------------------------------------------ */ //-- 把商品加入关联 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'add_link_goods') { include_once(ROOT_PATH . 'includes/cls_json.php'); $json = new JSON; check_authz_json('goods_manage'); $linked_array = $json->decode($_GET['add_ids']); $linked_goods = $json->decode($_GET['JSON']); $goods_id = $linked_goods[0]; $is_double = $linked_goods[1] == true ? 0 : 1; foreach ($linked_array AS $val) { if ($is_double) { /* 双向关联 */ $sql = "INSERT INTO " . $ecs->table('link_goods') . " (goods_id, link_goods_id, is_double, admin_id) " . "VALUES ('$val', '$goods_id', '$is_double', '$_SESSION[admin_id]')"; $db->query($sql, 'SILENT'); } $sql = "INSERT INTO " . $ecs->table('link_goods') . " (goods_id, link_goods_id, is_double, admin_id) " . "VALUES ('$goods_id', '$val', '$is_double', '$_SESSION[admin_id]')"; $db->query($sql, 'SILENT'); } $linked_goods = get_linked_goods($goods_id); $options = array(); foreach ($linked_goods AS $val) { $options[] = array('value' => $val['goods_id'], 'text' => $val['goods_name'], 'data' => ''); } clear_cache_files(); make_json_result($options); } /*------------------------------------------------------ */ //-- 删除关联商品 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'drop_link_goods') { include_once(ROOT_PATH . 'includes/cls_json.php'); $json = new JSON; check_authz_json('goods_manage'); $drop_goods = $json->decode($_GET['drop_ids']); $drop_goods_ids = db_create_in($drop_goods); $linked_goods = $json->decode($_GET['JSON']); $goods_id = $linked_goods[0]; $is_signle = $linked_goods[1]; if (!$is_signle) { $sql = "DELETE FROM " .$ecs->table('link_goods') . " WHERE link_goods_id = '$goods_id' AND goods_id " . $drop_goods_ids; } else { $sql = "UPDATE " .$ecs->table('link_goods') . " SET is_double = 0 ". " WHERE link_goods_id = '$goods_id' AND goods_id " . $drop_goods_ids; } if ($goods_id == 0) { $sql .= " AND admin_id = '$_SESSION[admin_id]'"; } $db->query($sql); $sql = "DELETE FROM " .$ecs->table('link_goods') . " WHERE goods_id = '$goods_id' AND link_goods_id " . $drop_goods_ids; if ($goods_id == 0) { $sql .= " AND admin_id = '$_SESSION[admin_id]'"; } $db->query($sql); $linked_goods = get_linked_goods($goods_id); $options = array(); foreach ($linked_goods AS $val) { $options[] = array( 'value' => $val['goods_id'], 'text' => $val['goods_name'], 'data' => ''); } clear_cache_files(); make_json_result($options); } /*------------------------------------------------------ */ //-- 增加一个配件 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'add_group_goods') { include_once(ROOT_PATH . 'includes/cls_json.php'); $json = new JSON; check_authz_json('goods_manage'); $fittings = $json->decode($_GET['add_ids']); $arguments = $json->decode($_GET['JSON']); $goods_id = $arguments[0]; $price = $arguments[1]; foreach ($fittings AS $val) { $sql = "INSERT INTO " . $ecs->table('group_goods') . " (parent_id, goods_id, goods_price, admin_id) " . "VALUES ('$goods_id', '$val', '$price', '$_SESSION[admin_id]')"; $db->query($sql, 'SILENT'); } $arr = get_group_goods($goods_id); $opt = array(); foreach ($arr AS $val) { $opt[] = array('value' => $val['goods_id'], 'text' => $val['goods_name'], 'data' => ''); } clear_cache_files(); make_json_result($opt); } /*------------------------------------------------------ */ //-- 删除一个配件 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'drop_group_goods') { include_once(ROOT_PATH . 'includes/cls_json.php'); $json = new JSON; check_authz_json('goods_manage'); $fittings = $json->decode($_GET['drop_ids']); $arguments = $json->decode($_GET['JSON']); $goods_id = $arguments[0]; $price = $arguments[1]; $sql = "DELETE FROM " .$ecs->table('group_goods') . " WHERE parent_id='$goods_id' AND " .db_create_in($fittings, 'goods_id'); if ($goods_id == 0) { $sql .= " AND admin_id = '$_SESSION[admin_id]'"; } $db->query($sql); $arr = get_group_goods($goods_id); $opt = array(); foreach ($arr AS $val) { $opt[] = array('value' => $val['goods_id'], 'text' => $val['goods_name'], 'data' => ''); } clear_cache_files(); make_json_result($opt); } /*------------------------------------------------------ */ //-- 搜索文章 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'get_article_list') { include_once(ROOT_PATH . 'includes/cls_json.php'); $json = new JSON; $filters =(array) $json->decode(json_str_iconv($_GET['JSON'])); $where = " WHERE cat_id > 0 "; if (!empty($filters['title'])) { $keyword = trim($filters['title']); $where .= " AND title LIKE '%" . mysql_like_quote($keyword) . "%' "; } $sql = 'SELECT article_id, title FROM ' .$ecs->table('article'). $where. 'ORDER BY article_id DESC LIMIT 50'; $res = $db->query($sql); $arr = array(); while ($row = $db->fetchRow($res)) { $arr[] = array('value' => $row['article_id'], 'text' => $row['title'], 'data'=>''); } make_json_result($arr); } /*------------------------------------------------------ */ //-- 添加关联文章 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'add_goods_article') { include_once(ROOT_PATH . 'includes/cls_json.php'); $json = new JSON; check_authz_json('goods_manage'); $articles = $json->decode($_GET['add_ids']); $arguments = $json->decode($_GET['JSON']); $goods_id = $arguments[0]; foreach ($articles AS $val) { $sql = "INSERT INTO " . $ecs->table('goods_article') . " (goods_id, article_id, admin_id) " . "VALUES ('$goods_id', '$val', '$_SESSION[admin_id]')"; $db->query($sql); } $arr = get_goods_articles($goods_id); $opt = array(); foreach ($arr AS $val) { $opt[] = array('value' => $val['article_id'], 'text' => $val['title'], 'data' => ''); } clear_cache_files(); make_json_result($opt); } /*------------------------------------------------------ */ //-- 删除关联文章 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'drop_goods_article') { include_once(ROOT_PATH . 'includes/cls_json.php'); $json = new JSON; check_authz_json('goods_manage'); $articles = $json->decode($_GET['drop_ids']); $arguments = $json->decode($_GET['JSON']); $goods_id = $arguments[0]; $sql = "DELETE FROM " .$ecs->table('goods_article') . " WHERE " . db_create_in($articles, "article_id") . " AND goods_id = '$goods_id'"; $db->query($sql); $arr = get_goods_articles($goods_id); $opt = array(); foreach ($arr AS $val) { $opt[] = array('value' => $val['article_id'], 'text' => $val['title'], 'data' => ''); } clear_cache_files(); make_json_result($opt); } /*------------------------------------------------------ */ //-- 货品列表 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'product_list') { admin_priv('goods_manage'); /* 是否存在商品id */ if (empty($_GET['goods_id'])) { $link[] = array('href' => 'goods.php?act=list', 'text' => $_LANG['cannot_found_goods']); sys_msg($_LANG['cannot_found_goods'], 1, $link); } else { $goods_id = intval($_GET['goods_id']); } /* 取出商品信息 */ $sql = "SELECT goods_sn, goods_name, goods_type, shop_price FROM " . $ecs->table('goods') . " WHERE goods_id = '$goods_id'"; $goods = $db->getRow($sql); if (empty($goods)) { $link[] = array('href' => 'goods.php?act=list', 'text' => $_LANG['01_goods_list']); sys_msg($_LANG['cannot_found_goods'], 1, $link); } $smarty->assign('sn', sprintf($_LANG['good_goods_sn'], $goods['goods_sn'])); $smarty->assign('price', sprintf($_LANG['good_shop_price'], $goods['shop_price'])); $smarty->assign('goods_name', sprintf($_LANG['products_title'], $goods['goods_name'])); $smarty->assign('goods_sn', sprintf($_LANG['products_title_2'], $goods['goods_sn'])); /* 获取商品规格列表 */ $attribute = get_goods_specifications_list($goods_id); if (empty($attribute)) { $link[] = array('href' => 'goods.php?act=edit&goods_id=' . $goods_id, 'text' => $_LANG['edit_goods']); sys_msg($_LANG['not_exist_goods_attr'], 1, $link); } foreach ($attribute as $attribute_value) { //转换成数组 $_attribute[$attribute_value['attr_id']]['attr_values'][] = $attribute_value['attr_value']; $_attribute[$attribute_value['attr_id']]['attr_id'] = $attribute_value['attr_id']; $_attribute[$attribute_value['attr_id']]['attr_name'] = $attribute_value['attr_name']; } $attribute_count = count($_attribute); $smarty->assign('attribute_count', $attribute_count); $smarty->assign('attribute_count_3', ($attribute_count + 3)); $smarty->assign('attribute', $_attribute); $smarty->assign('product_sn', $goods['goods_sn'] . '_'); $smarty->assign('product_number', $_CFG['default_storage']); /* 取商品的货品 */ $product = product_list($goods_id, ''); $smarty->assign('ur_here', $_LANG['18_product_list']); $smarty->assign('action_link', array('href' => 'goods.php?act=list', 'text' => $_LANG['01_goods_list'])); $smarty->assign('product_list', $product['product']); $smarty->assign('product_null', empty($product['product']) ? 0 : 1); $smarty->assign('use_storage', empty($_CFG['use_storage']) ? 0 : 1); $smarty->assign('goods_id', $goods_id); $smarty->assign('filter', $product['filter']); $smarty->assign('full_page', 1); /* 显示商品列表页面 */ assign_query_info(); $smarty->display('product_info.htm'); } /*------------------------------------------------------ */ //-- 货品排序、分页、查询 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'product_query') { /* 是否存在商品id */ if (empty($_REQUEST['goods_id'])) { make_json_error($_LANG['sys']['wrong'] . $_LANG['cannot_found_goods']); } else { $goods_id = intval($_REQUEST['goods_id']); } /* 取出商品信息 */ $sql = "SELECT goods_sn, goods_name, goods_type, shop_price FROM " . $ecs->table('goods') . " WHERE goods_id = '$goods_id'"; $goods = $db->getRow($sql); if (empty($goods)) { make_json_error($_LANG['sys']['wrong'] . $_LANG['cannot_found_goods']); } $smarty->assign('sn', sprintf($_LANG['good_goods_sn'], $goods['goods_sn'])); $smarty->assign('price', sprintf($_LANG['good_shop_price'], $goods['shop_price'])); $smarty->assign('goods_name', sprintf($_LANG['products_title'], $goods['goods_name'])); $smarty->assign('goods_sn', sprintf($_LANG['products_title_2'], $goods['goods_sn'])); /* 获取商品规格列表 */ $attribute = get_goods_specifications_list($goods_id); if (empty($attribute)) { make_json_error($_LANG['sys']['wrong'] . $_LANG['cannot_found_goods']); } foreach ($attribute as $attribute_value) { //转换成数组 $_attribute[$attribute_value['attr_id']]['attr_values'][] = $attribute_value['attr_value']; $_attribute[$attribute_value['attr_id']]['attr_id'] = $attribute_value['attr_id']; $_attribute[$attribute_value['attr_id']]['attr_name'] = $attribute_value['attr_name']; } $attribute_count = count($_attribute); $smarty->assign('attribute_count', $attribute_count); $smarty->assign('attribute', $_attribute); $smarty->assign('attribute_count_3', ($attribute_count + 3)); $smarty->assign('product_sn', $goods['goods_sn'] . '_'); $smarty->assign('product_number', $_CFG['default_storage']); /* 取商品的货品 */ $product = product_list($goods_id, ''); $smarty->assign('ur_here', $_LANG['18_product_list']); $smarty->assign('action_link', array('href' => 'goods.php?act=list', 'text' => $_LANG['01_goods_list'])); $smarty->assign('product_list', $product['product']); $smarty->assign('use_storage', empty($_CFG['use_storage']) ? 0 : 1); $smarty->assign('goods_id', $goods_id); $smarty->assign('filter', $product['filter']); /* 排序标记 */ $sort_flag = sort_flag($product['filter']); $smarty->assign($sort_flag['tag'], $sort_flag['img']); make_json_result($smarty->fetch('product_info.htm'), '', array('filter' => $product['filter'], 'page_count' => $product['page_count'])); } /*------------------------------------------------------ */ //-- 货品删除 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'product_remove') { /* 检查权限 */ check_authz_json('remove_back'); /* 是否存在商品id */ if (empty($_REQUEST['id'])) { make_json_error($_LANG['product_id_null']); } else { $product_id = intval($_REQUEST['id']); } /* 货品库存 */ $product = get_product_info($product_id, 'product_number, goods_id'); /* 删除货品 */ $sql = "DELETE FROM " . $ecs->table('products') . " WHERE product_id = '$product_id'"; $result = $db->query($sql); if ($result) { /* 修改商品库存 */ if (update_goods_stock($product['goods_id'], $product_number - $product['product_number'])) { //记录日志 admin_log('', 'update', 'goods'); } //记录日志 admin_log('', 'trash', 'products'); $url = 'goods.php?act=product_query&' . str_replace('act=product_remove', '', $_SERVER['QUERY_STRING']); ecs_header("Location: $url\n"); exit; } } /*------------------------------------------------------ */ //-- 修改货品价格 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'edit_product_sn') { check_authz_json('goods_manage'); $product_id = intval($_POST['id']); $product_sn = json_str_iconv(trim($_POST['val'])); $product_sn = ($_LANG['n_a'] == $product_sn) ? '' : $product_sn; if (check_product_sn_exist($product_sn, $product_id)) { make_json_error($_LANG['sys']['wrong'] . $_LANG['exist_same_product_sn']); } /* 修改 */ $sql = "UPDATE " . $ecs->table('products') . " SET product_sn = '$product_sn' WHERE product_id = '$product_id'"; $result = $db->query($sql); if ($result) { clear_cache_files(); make_json_result($product_sn); } } /*------------------------------------------------------ */ //-- 修改货品库存 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'edit_product_number') { check_authz_json('goods_manage'); $product_id = intval($_POST['id']); $product_number = intval($_POST['val']); /* 货品库存 */ $product = get_product_info($product_id, 'product_number, goods_id'); /* 修改货品库存 */ $sql = "UPDATE " . $ecs->table('products') . " SET product_number = '$product_number' WHERE product_id = '$product_id'"; $result = $db->query($sql); if ($result) { /* 修改商品库存 */ if (update_goods_stock($product['goods_id'], $product_number - $product['product_number'])) { clear_cache_files(); make_json_result($product_number); } } } /*------------------------------------------------------ */ //-- 货品添加 执行 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'product_add_execute') { admin_priv('goods_manage'); $product['goods_id'] = intval($_POST['goods_id']); $product['attr'] = $_POST['attr']; $product['product_sn'] = $_POST['product_sn']; $product['product_number'] = $_POST['product_number']; /* 是否存在商品id */ if (empty($product['goods_id'])) { sys_msg($_LANG['sys']['wrong'] . $_LANG['cannot_found_goods'], 1, array(), false); } /* 判断是否为初次添加 */ $insert = true; if (product_number_count($product['goods_id']) > 0) { $insert = false; } /* 取出商品信息 */ $sql = "SELECT goods_sn, goods_name, goods_type, shop_price FROM " . $ecs->table('goods') . " WHERE goods_id = '" . $product['goods_id'] . "'"; $goods = $db->getRow($sql); if (empty($goods)) { sys_msg($_LANG['sys']['wrong'] . $_LANG['cannot_found_goods'], 1, array(), false); } /* */ foreach($product['product_sn'] as $key => $value) { //过滤 $product['product_number'][$key] = empty($product['product_number'][$key]) ? (empty($_CFG['use_storage']) ? 0 : $_CFG['default_storage']) : trim($product['product_number'][$key]); //库存 //获取规格在商品属性表中的id foreach($product['attr'] as $attr_key => $attr_value) { /* 检测:如果当前所添加的货品规格存在空值或0 */ if (empty($attr_value[$key])) { continue 2; } $is_spec_list[$attr_key] = 'true'; $value_price_list[$attr_key] = $attr_value[$key] . chr(9) . ''; //$key,当前 $id_list[$attr_key] = $attr_key; } $goods_attr_id = handle_goods_attr($product['goods_id'], $id_list, $is_spec_list, $value_price_list); /* 是否为重复规格的货品 */ $goods_attr = sort_goods_attr_id_array($goods_attr_id); $goods_attr = implode('|', $goods_attr['sort']); if (check_goods_attr_exist($goods_attr, $product['goods_id'])) { continue; //sys_msg($_LANG['sys']['wrong'] . $_LANG['exist_same_goods_attr'], 1, array(), false); } //货品号不为空 if (!empty($value)) { /* 检测:货品货号是否在商品表和货品表中重复 */ if (check_goods_sn_exist($value)) { continue; //sys_msg($_LANG['sys']['wrong'] . $_LANG['exist_same_goods_sn'], 1, array(), false); } if (check_product_sn_exist($value)) { continue; //sys_msg($_LANG['sys']['wrong'] . $_LANG['exist_same_product_sn'], 1, array(), false); } } /* 插入货品表 */ $sql = "INSERT INTO " . $GLOBALS['ecs']->table('products') . " (goods_id, goods_attr, product_sn, product_number) VALUES ('" . $product['goods_id'] . "', '$goods_attr', '$value', '" . $product['product_number'][$key] . "')"; if (!$GLOBALS['db']->query($sql)) { continue; //sys_msg($_LANG['sys']['wrong'] . $_LANG['cannot_add_products'], 1, array(), false); } //货品号为空 自动补货品号 if (empty($value)) { $sql = "UPDATE " . $GLOBALS['ecs']->table('products') . " SET product_sn = '" . $goods['goods_sn'] . "g_p" . $GLOBALS['db']->insert_id() . "' WHERE product_id = '" . $GLOBALS['db']->insert_id() . "'"; $GLOBALS['db']->query($sql); } /* 修改商品表库存 */ $product_count = product_number_count($product['goods_id']); if (update_goods($product['goods_id'], 'goods_number', $product_count)) { //记录日志 admin_log($product['goods_id'], 'update', 'goods'); } } clear_cache_files(); /* 返回 */ if ($insert) { $link[] = array('href' => 'goods.php?act=add', 'text' => $_LANG['02_goods_add']); $link[] = array('href' => 'goods.php?act=list', 'text' => $_LANG['01_goods_list']); $link[] = array('href' => 'goods.php?act=product_list&goods_id=' . $product['goods_id'], 'text' => $_LANG['18_product_list']); } else { $link[] = array('href' => 'goods.php?act=list', 'text' => $_LANG['01_goods_list']); $link[] = array('href' => 'goods.php?act=edit&goods_id=' . $product['goods_id'], 'text' => $_LANG['edit_goods']); $link[] = array('href' => 'goods.php?act=product_list&goods_id=' . $product['goods_id'], 'text' => $_LANG['18_product_list']); } sys_msg($_LANG['save_products'], 0, $link); } /*------------------------------------------------------ */ //-- 货品批量操作 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'batch_product') { /* 定义返回 */ $link[] = array('href' => 'goods.php?act=product_list&goods_id=' . $_POST['goods_id'], 'text' => $_LANG['item_list']); /* 批量操作 - 批量删除 */ if ($_POST['type'] == 'drop') { //检查权限 admin_priv('remove_back'); //取得要操作的商品编号 $product_id = !empty($_POST['checkboxes']) ? join(',', $_POST['checkboxes']) : 0; $product_bound = db_create_in($product_id); //取出货品库存总数 $sum = 0; $goods_id = 0; $sql = "SELECT product_id, goods_id, product_number FROM " . $GLOBALS['ecs']->table('products') . " WHERE product_id $product_bound"; $product_array = $GLOBALS['db']->getAll($sql); if (!empty($product_array)) { foreach ($product_array as $value) { $sum += $value['product_number']; } $goods_id = $product_array[0]['goods_id']; /* 删除货品 */ $sql = "DELETE FROM " . $ecs->table('products') . " WHERE product_id $product_bound"; if ($db->query($sql)) { //记录日志 admin_log('', 'delete', 'products'); } /* 修改商品库存 */ if (update_goods_stock($goods_id, -$sum)) { //记录日志 admin_log('', 'update', 'goods'); } /* 返回 */ sys_msg($_LANG['product_batch_del_success'], 0, $link); } else { /* 错误 */ sys_msg($_LANG['cannot_found_products'], 1, $link); } } /* 返回 */ sys_msg($_LANG['no_operation'], 1, $link); } /** * 列表链接 * @param bool $is_add 是否添加(插入) * @param string $extension_code 虚拟商品扩展代码,实体商品为空 * @return array('href' => $href, 'text' => $text) */ function list_link($is_add = true, $extension_code = '') { $href = 'goods.php?act=list'; if (!empty($extension_code)) { $href .= '&extension_code=' . $extension_code; } if (!$is_add) { $href .= '&' . list_link_postfix(); } if ($extension_code == 'virtual_card') { $text = $GLOBALS['_LANG']['50_virtual_card_list']; } else { $text = $GLOBALS['_LANG']['01_goods_list']; } return array('href' => $href, 'text' => $text); } /** * 添加链接 * @param string $extension_code 虚拟商品扩展代码,实体商品为空 * @return array('href' => $href, 'text' => $text) */ function add_link($extension_code = '') { $href = 'goods.php?act=add'; if (!empty($extension_code)) { $href .= '&extension_code=' . $extension_code; } if ($extension_code == 'virtual_card') { $text = $GLOBALS['_LANG']['51_virtual_card_add']; } else { $text = $GLOBALS['_LANG']['02_goods_add']; } return array('href' => $href, 'text' => $text); } /** * 检查图片网址是否合法 * * @param string $url 网址 * * @return boolean */ function goods_parse_url($url) { $parse_url = @parse_url($url); return (!empty($parse_url['scheme']) && !empty($parse_url['host'])); } /** * 保存某商品的优惠价格 * @param int $goods_id 商品编号 * @param array $number_list 优惠数量列表 * @param array $price_list 价格列表 * @return void */ function handle_volume_price($goods_id, $number_list, $price_list) { $sql = "DELETE FROM " . $GLOBALS['ecs']->table('volume_price') . " WHERE price_type = '1' AND goods_id = '$goods_id'"; $GLOBALS['db']->query($sql); /* 循环处理每个优惠价格 */ foreach ($price_list AS $key => $price) { /* 价格对应的数量上下限 */ $volume_number = $number_list[$key]; if (!empty($price)) { $sql = "INSERT INTO " . $GLOBALS['ecs']->table('volume_price') . " (price_type, goods_id, volume_number, volume_price) " . "VALUES ('1', '$goods_id', '$volume_number', '$price')"; $GLOBALS['db']->query($sql); } } } /** * 修改商品库存 * @param string $goods_id 商品编号,可以为多个,用 ',' 隔开 * @param string $value 字段值 * @return bool */ function update_goods_stock($goods_id, $value) { if ($goods_id) { /* $res = $goods_number - $old_product_number + $product_number; */ $sql = "UPDATE " . $GLOBALS['ecs']->table('goods') . " SET goods_number = goods_number + $value, last_update = '". gmtime() ."' WHERE goods_id = '$goods_id'"; $result = $GLOBALS['db']->query($sql); /* 清除缓存 */ clear_cache_files(); return $result; } else { return false; } } ?>
zzshop
trunk/admin/goods.php
PHP
asf20
97,740
<?php /** * ECSHOP 访问购买比例 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: visit_sold.php 17063 2010-03-25 06:35:46Z liuhui $ */ define('IN_ECS', true); require(dirname(__FILE__) . '/includes/init.php'); require_once(ROOT_PATH . 'includes/lib_order.php'); require_once('../languages/' .$_CFG['lang']. '/admin/statistic.php'); $smarty->assign('lang', $_LANG); /* act操作项的初始化 */ if (empty($_REQUEST['act'])) { $_REQUEST['act'] = 'list'; } else { $_REQUEST['act'] = trim($_REQUEST['act']); } admin_priv('client_flow_stats'); /*------------------------------------------------------ */ //--访问购买比例 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'list' || $_REQUEST['act'] == 'download') { /* 变量的初始化 */ $cat_id = (!empty($_REQUEST['cat_id'])) ? intval($_REQUEST['cat_id']) : 0; $brand_id = (!empty($_REQUEST['brand_id'])) ? intval($_REQUEST['brand_id']) : 0; $show_num = (!empty($_REQUEST['show_num'])) ? intval($_REQUEST['show_num']) : 15; /* 获取访问购买的比例数据 */ $click_sold_info = click_sold_info($cat_id, $brand_id, $show_num); /* 下载报表 */ if ($_REQUEST['act'] == "download") { $filename = 'visit_sold'; header("Content-type: application/vnd.ms-excel; charset=utf-8"); header("Content-Disposition: attachment; filename=$filename.xls"); $data = "$_LANG[visit_buy]\t\n"; $data .= "$_LANG[order_by]\t$_LANG[goods_name]\t$_LANG[fav_exponential]\t$_LANG[buy_times]\t$_LANG[visit_buy]\n"; foreach ($click_sold_info AS $k => $row) { $order_by = $k + 1; $data .= "$order_by\t$row[goods_name]\t$row[click_count]\t$row[sold_times]\t$row[scale]\n"; } echo ecs_iconv(EC_CHARSET, 'GB2312', $data); exit; } /* 赋值到模板 */ $smarty->assign('ur_here', $_LANG['visit_buy_per']); $smarty->assign('show_num', $show_num); $smarty->assign('brand_id', $brand_id); $smarty->assign('click_sold_info', $click_sold_info); $smarty->assign('cat_list', cat_list(0, $cat_id)); $smarty->assign('brand_list', get_brand_list()); $filename = 'visit_sold'; $smarty->assign('action_link', array('text' => $_LANG['download_visit_buy'], 'href' => 'visit_sold.php?act=download&show_num=' . $show_num . '&cat_id=' . $cat_id . '&brand_id=' . $brand_id . '&show_num=' . $show_num )); /* 显示页面 */ assign_query_info(); $smarty->display('visit_sold.htm'); } /*------------------------------------------------------ */ //--订单统计需要的函数 /*------------------------------------------------------ */ /** * 取得访问和购买次数统计数据 * * @param int $cat_id 分类编号 * @param int $brand_id 品牌编号 * @param int $show_num 显示个数 * @return array $click_sold_info 访问购买比例数据 */ function click_sold_info($cat_id, $brand_id, $show_num) { global $db, $ecs; $where = " WHERE o.order_id = og.order_id AND g.goods_id = og.goods_id " . order_query_sql('finished', 'o.'); $limit = " LIMIT " .$show_num; if ($cat_id > 0) { $where .= " AND " . get_children($cat_id); } if ($brand_id > 0) { $where .= " AND g.brand_id = '$brand_id' "; } $click_sold_info = array(); $sql = "SELECT og.goods_id, g.goods_sn, g.goods_name, g.click_count, COUNT(og.goods_id) AS sold_times ". " FROM ". $ecs->table('goods') ." AS g, ". $ecs->table('order_goods') ." AS og, " .$ecs->table('order_info') . " AS o " . $where . " GROUP BY og.goods_id ORDER BY g.click_count DESC " . $limit; $res = $db->query($sql); while ($item = $db->fetchRow($res)) { if ($item['click_count'] <= 0) { $item['scale'] = 0; } else { /* 每一百个点击的订单比率 */ $item['scale'] = sprintf("%0.2f", ($item['sold_times'] / $item['click_count']) * 100) .'%'; } $click_sold_info[] = $item; } return $click_sold_info; } ?>
zzshop
trunk/admin/visit_sold.php
PHP
asf20
4,901
<?php /** * ECSHOP 用户评论管理程序 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: comment_manage.php 17123 2010-04-22 07:28:54Z liuhui $ */ define('IN_ECS', true); require(dirname(__FILE__) . '/includes/init.php'); /* act操作项的初始化 */ if (empty($_REQUEST['act'])) { $_REQUEST['act'] = 'list'; } else { $_REQUEST['act'] = trim($_REQUEST['act']); } /*------------------------------------------------------ */ //-- 获取没有回复的评论列表 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'list') { /* 检查权限 */ admin_priv('comment_priv'); $smarty->assign('ur_here', $_LANG['05_comment_manage']); $smarty->assign('full_page', 1); $list = get_comment_list(); $smarty->assign('comment_list', $list['item']); $smarty->assign('filter', $list['filter']); $smarty->assign('record_count', $list['record_count']); $smarty->assign('page_count', $list['page_count']); $sort_flag = sort_flag($list['filter']); $smarty->assign($sort_flag['tag'], $sort_flag['img']); assign_query_info(); $smarty->display('comment_list.htm'); } /*------------------------------------------------------ */ //-- 翻页、搜索、排序 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'query') { $list = get_comment_list(); $smarty->assign('comment_list', $list['item']); $smarty->assign('filter', $list['filter']); $smarty->assign('record_count', $list['record_count']); $smarty->assign('page_count', $list['page_count']); $sort_flag = sort_flag($list['filter']); $smarty->assign($sort_flag['tag'], $sort_flag['img']); make_json_result($smarty->fetch('comment_list.htm'), '', array('filter' => $list['filter'], 'page_count' => $list['page_count'])); } /*------------------------------------------------------ */ //-- 回复用户评论(同时查看评论详情) /*------------------------------------------------------ */ if ($_REQUEST['act']=='reply') { /* 检查权限 */ admin_priv('comment_priv'); $comment_info = array(); $reply_info = array(); $id_value = array(); /* 获取评论详细信息并进行字符处理 */ $sql = "SELECT * FROM " .$ecs->table('comment'). " WHERE comment_id = '$_REQUEST[id]'"; $comment_info = $db->getRow($sql); $comment_info['content'] = str_replace('\r\n', '<br />', htmlspecialchars($comment_info['content'])); $comment_info['content'] = nl2br(str_replace('\n', '<br />', $comment_info['content'])); $comment_info['add_time'] = local_date($_CFG['time_format'], $comment_info['add_time']); /* 获得评论回复内容 */ $sql = "SELECT * FROM ".$ecs->table('comment'). " WHERE parent_id = '$_REQUEST[id]'"; $reply_info = $db->getRow($sql); if (empty($reply_info)) { $reply_info['content'] = ''; $reply_info['add_time'] = ''; } else { $reply_info['content'] = nl2br(htmlspecialchars($reply_info['content'])); $reply_info['add_time'] = local_date($_CFG['time_format'], $reply_info['add_time']); } /* 获取管理员的用户名和Email地址 */ $sql = "SELECT user_name, email FROM ". $ecs->table('admin_user'). " WHERE user_id = '$_SESSION[admin_id]'"; $admin_info = $db->getRow($sql); /* 取得评论的对象(文章或者商品) */ if ($comment_info['comment_type'] == 0) { $sql = "SELECT goods_name FROM ".$ecs->table('goods'). " WHERE goods_id = '$comment_info[id_value]'"; $id_value = $db->getOne($sql); } else { $sql = "SELECT title FROM ".$ecs->table('article'). " WHERE article_id='$comment_info[id_value]'"; $id_value = $db->getOne($sql); } /* 模板赋值 */ $smarty->assign('msg', $comment_info); //评论信息 $smarty->assign('admin_info', $admin_info); //管理员信息 $smarty->assign('reply_info', $reply_info); //回复的内容 $smarty->assign('id_value', $id_value); //评论的对象 $smarty->assign('send_fail', !empty($_REQUEST['send_ok'])); $smarty->assign('ur_here', $_LANG['comment_info']); $smarty->assign('action_link', array('text' => $_LANG['05_comment_manage'], 'href' => 'comment_manage.php?act=list')); /* 页面显示 */ assign_query_info(); $smarty->display('comment_info.htm'); } /*------------------------------------------------------ */ //-- 处理 回复用户评论 /*------------------------------------------------------ */ if ($_REQUEST['act']=='action') { admin_priv('comment_priv'); /* 获取IP地址 */ $ip = real_ip(); /* 获得评论是否有回复 */ $sql = "SELECT comment_id, content, parent_id FROM ".$ecs->table('comment'). " WHERE parent_id = '$_REQUEST[comment_id]'"; $reply_info = $db->getRow($sql); if (!empty($reply_info['content'])) { /* 更新回复的内容 */ $sql = "UPDATE ".$ecs->table('comment')." SET ". "email = '$_POST[email]', ". "user_name = '$_POST[user_name]', ". "content = '$_POST[content]', ". "add_time = '" . gmtime() . "', ". "ip_address= '$ip', ". "status = 0". " WHERE comment_id = '".$reply_info['comment_id']."'"; } else { /* 插入回复的评论内容 */ $sql = "INSERT INTO ".$ecs->table('comment')." (comment_type, id_value, email, user_name , ". "content, add_time, ip_address, status, parent_id) ". "VALUES('$_POST[comment_type]', '$_POST[id_value]','$_POST[email]', " . "'$_SESSION[admin_name]','$_POST[content]','" . gmtime() . "', '$ip', '0', '$_POST[comment_id]')"; } $db->query($sql); /* 更新当前的评论状态为已回复并且可以显示此条评论 */ $sql = "UPDATE " .$ecs->table('comment'). " SET status = 1 WHERE comment_id = '$_POST[comment_id]'"; $db->query($sql); /* 邮件通知处理流程 */ if (!empty($_POST['send_email_notice']) or isset($_POST['remail'])) { //获取邮件中的必要内容 $sql = 'SELECT user_name, email, content ' . 'FROM ' .$ecs->table('comment') . " WHERE comment_id ='$_REQUEST[comment_id]'"; $comment_info = $db->getRow($sql); /* 设置留言回复模板所需要的内容信息 */ $template = get_mail_template('recomment'); $smarty->assign('user_name', $comment_info['user_name']); $smarty->assign('recomment', $_POST['content']); $smarty->assign('comment', $comment_info['content']); $smarty->assign('shop_name', "<a href='".$ecs->url()."'>" . $_CFG['shop_name'] . '</a>'); $smarty->assign('send_date', date('Y-m-d')); $content = $smarty->fetch('str:' . $template['template_content']); /* 发送邮件 */ if (send_mail($comment_info['user_name'], $comment_info['email'], $template['template_subject'], $content, $template['is_html'])) { $send_ok = 0; } else { $send_ok = 1; } } /* 清除缓存 */ clear_cache_files(); /* 记录管理员操作 */ admin_log(addslashes($_LANG['reply']), 'edit', 'users_comment'); ecs_header("Location: comment_manage.php?act=reply&id=$_REQUEST[comment_id]&send_ok=$send_ok\n"); exit; } /*------------------------------------------------------ */ //-- 更新评论的状态为显示或者禁止 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'check') { if ($_REQUEST['check'] == 'allow') { /* 允许评论显示 */ $sql = "UPDATE " .$ecs->table('comment'). " SET status = 1 WHERE comment_id = '$_REQUEST[id]'"; $db->query($sql); //add_feed($_REQUEST['id'], COMMENT_GOODS); /* 清除缓存 */ clear_cache_files(); ecs_header("Location: comment_manage.php?act=reply&id=$_REQUEST[id]\n"); exit; } else { /* 禁止评论显示 */ $sql = "UPDATE " .$ecs->table('comment'). " SET status = 0 WHERE comment_id = '$_REQUEST[id]'"; $db->query($sql); /* 清除缓存 */ clear_cache_files(); ecs_header("Location: comment_manage.php?act=reply&id=$_REQUEST[id]\n"); exit; } } /*------------------------------------------------------ */ //-- 删除某一条评论 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'remove') { check_authz_json('comment_priv'); $id = intval($_GET['id']); $sql = "DELETE FROM " .$ecs->table('comment'). " WHERE comment_id = '$id'"; $res = $db->query($sql); if ($res) { $db->query("DELETE FROM " .$ecs->table('comment'). " WHERE parent_id = '$id'"); } admin_log('', 'remove', 'ads'); $url = 'comment_manage.php?act=query&' . str_replace('act=remove', '', $_SERVER['QUERY_STRING']); ecs_header("Location: $url\n"); exit; } /*------------------------------------------------------ */ //-- 批量删除用户评论 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'batch') { admin_priv('comment_priv'); $action = isset($_POST['sel_action']) ? trim($_POST['sel_action']) : 'deny'; if (isset($_POST['checkboxes'])) { switch ($action) { case 'remove': $db->query("DELETE FROM " . $ecs->table('comment') . " WHERE " . db_create_in($_POST['checkboxes'], 'comment_id')); $db->query("DELETE FROM " . $ecs->table('comment') . " WHERE " . db_create_in($_POST['checkboxes'], 'parent_id')); break; case 'allow' : $db->query("UPDATE " . $ecs->table('comment') . " SET status = 1 WHERE " . db_create_in($_POST['checkboxes'], 'comment_id')); break; case 'deny' : $db->query("UPDATE " . $ecs->table('comment') . " SET status = 0 WHERE " . db_create_in($_POST['checkboxes'], 'comment_id')); break; default : break; } clear_cache_files(); $action = ($action == 'remove') ? 'remove' : 'edit'; admin_log('', $action, 'adminlog'); $link[] = array('text' => $_LANG['back_list'], 'href' => 'comment_manage.php?act=list'); sys_msg(sprintf($_LANG['batch_drop_success'], count($_POST['checkboxes'])), 0, $link); } else { /* 提示信息 */ $link[] = array('text' => $_LANG['back_list'], 'href' => 'comment_manage.php?act=list'); sys_msg($_LANG['no_select_comment'], 0, $link); } } /** * 获取评论列表 * @access public * @return array */ function get_comment_list() { /* 查询条件 */ $filter['keywords'] = empty($_REQUEST['keywords']) ? 0 : trim($_REQUEST['keywords']); if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) { $filter['keywords'] = json_str_iconv($filter['keywords']); } $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'add_time' : trim($_REQUEST['sort_by']); $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']); $where = (!empty($filter['keywords'])) ? " AND content LIKE '%" . mysql_like_quote($filter['keywords']) . "%' " : ''; $sql = "SELECT count(*) FROM " .$GLOBALS['ecs']->table('comment'). " WHERE parent_id = 0 $where"; $filter['record_count'] = $GLOBALS['db']->getOne($sql); /* 分页大小 */ $filter = page_and_size($filter); /* 获取评论数据 */ $arr = array(); $sql = "SELECT * FROM " .$GLOBALS['ecs']->table('comment'). " WHERE parent_id = 0 $where " . " ORDER BY $filter[sort_by] $filter[sort_order] ". " LIMIT ". $filter['start'] .", $filter[page_size]"; $res = $GLOBALS['db']->query($sql); while ($row = $GLOBALS['db']->fetchRow($res)) { $sql = ($row['comment_type'] == 0) ? "SELECT goods_name FROM " .$GLOBALS['ecs']->table('goods'). " WHERE goods_id='$row[id_value]'" : "SELECT title FROM ".$GLOBALS['ecs']->table('article'). " WHERE article_id='$row[id_value]'"; $row['title'] = $GLOBALS['db']->getOne($sql); /* 标记是否回复过 */ // $sql = "SELECT COUNT(*) FROM " .$GLOBALS['ecs']->table('comment'). " WHERE parent_id = '$row[comment_id]'"; // $row['is_reply'] = ($GLOBALS['db']->getOne($sql) > 0) ? // $GLOBALS['_LANG']['yes_reply'] : $GLOBALS['_LANG']['no_reply']; $row['add_time'] = local_date($GLOBALS['_CFG']['time_format'], $row['add_time']); $arr[] = $row; } $filter['keywords'] = stripslashes($filter['keywords']); $arr = array('item' => $arr, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']); return $arr; } ?>
zzshop
trunk/admin/comment_manage.php
PHP
asf20
14,028
<?php /** * ECSHOP 站点地图生成程序 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: sitemap.php 17063 2010-03-25 06:35:46Z liuhui $ */ define('IN_ECS', true); require(dirname(__FILE__) . '/includes/init.php'); /* 检查权限 */ admin_priv('sitemap'); if ($_SERVER['REQUEST_METHOD'] == 'GET') { /*------------------------------------------------------ */ //-- 设置更新频率 /*------------------------------------------------------ */ assign_query_info(); $config = unserialize($_CFG['sitemap']); $smarty->assign('config', $config); $smarty->assign('ur_here', $_LANG['sitemap']); $smarty->assign('arr_changefreq', array(1,0.9,0.8,0.7,0.6,0.5,0.4,0.3,0.2,0.1)); $smarty->display('sitemap.htm'); } else { /*------------------------------------------------------ */ //-- 生成站点地图 /*------------------------------------------------------ */ include_once('includes/cls_phpzip.php'); include_once('includes/cls_google_sitemap.php'); $domain = $ecs->url(); $today = local_date('Y-m-d'); $sm =& new google_sitemap(); $smi =& new google_sitemap_item($domain, $today, $_POST['homepage_changefreq'], $_POST['homepage_priority']); $sm->add_item($smi); $config = array( 'homepage_changefreq' => $_POST['homepage_changefreq'], 'homepage_priority' => $_POST['homepage_priority'], 'category_changefreq' => $_POST['category_changefreq'], 'category_priority' => $_POST['category_priority'], 'content_changefreq' => $_POST['content_changefreq'], 'content_priority' => $_POST['content_priority'], ); $config = serialize($config); $db->query("UPDATE " .$ecs->table('shop_config'). " SET VALUE='$config' WHERE code='sitemap'"); /* 商品分类 */ $sql = "SELECT cat_id,cat_name FROM " .$ecs->table('category'). " ORDER BY parent_id"; $res = $db->query($sql); while ($row = $db->fetchRow($res)) { $smi =& new google_sitemap_item($domain . build_uri('category', array('cid' => $row['cat_id']), $row['cat_name']), $today, $_POST['category_changefreq'], $_POST['category_priority']); $sm->add_item($smi); } /* 文章分类 */ $sql = "SELECT cat_id,cat_name FROM " .$ecs->table('article_cat'). " WHERE cat_type=1"; $res = $db->query($sql); while ($row = $db->fetchRow($res)) { $smi =& new google_sitemap_item($domain . build_uri('article_cat', array('acid' => $row['cat_id']), $row['cat_name']), $today, $_POST['category_changefreq'], $_POST['category_priority']); $sm->add_item($smi); } /* 商品 */ $sql = "SELECT goods_id, goods_name FROM " .$ecs->table('goods'). " WHERE is_delete = 0"; $res = $db->query($sql); while ($row = $db->fetchRow($res)) { $smi =& new google_sitemap_item($domain . build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']), $today, $_POST['content_changefreq'], $_POST['content_priority']); $sm->add_item($smi); } /* 文章 */ $sql = "SELECT article_id,title,file_url,open_type FROM " .$ecs->table('article'). " WHERE is_open=1"; $res = $db->query($sql); while ($row = $db->fetchRow($res)) { $article_url=$row['open_type'] != 1 ? build_uri('article', array('aid'=>$row['article_id']), $row['title']) : trim($row['file_url']); $smi =& new google_sitemap_item($domain . $article_url, $today, $_POST['content_changefreq'], $_POST['content_priority']); $sm->add_item($smi); } clear_cache_files(); // 清除缓存 $sm_file = '../sitemaps.xml'; if ($sm->build($sm_file)) { sys_msg(sprintf($_LANG['generate_success'], $ecs->url()."sitemaps.xml")); } else { $sm_file = '../' . DATA_DIR . '/sitemaps.xml'; if ($sm->build($sm_file)) { sys_msg(sprintf($_LANG['generate_success'], $ecs->url(). DATA_DIR . '/sitemaps.xml')); } else { sys_msg(sprintf($_LANG['generate_failed'])); } } } ?>
zzshop
trunk/admin/sitemap.php
PHP
asf20
4,815
<?php /** * ECSHOP 会员等级管理程序 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: testyang $ * $Id: reg_fields.php 15013 2008-10-23 09:31:42Z testyang $ */ define('IN_ECS', true); require(dirname(__FILE__) . '/includes/init.php'); $exc = new exchange($ecs->table("reg_fields"), $db, 'id', 'reg_field_name'); /*------------------------------------------------------ */ //-- 会员注册项列表 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'list') { $fields = array(); $fields = $db->getAll("SELECT * FROM " . $ecs->table('reg_fields') . " ORDER BY dis_order, id"); $smarty->assign('ur_here', $_LANG['021_reg_fields']); $smarty->assign('action_link', array('text' => $_LANG['add_reg_field'], 'href'=>'reg_fields.php?act=add')); $smarty->assign('full_page', 1); $smarty->assign('reg_fields', $fields); assign_query_info(); $smarty->display('reg_fields.htm'); } /*------------------------------------------------------ */ //-- 翻页,排序 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'query') { $fields = array(); $fields = $db->getAll("SELECT * FROM " .$ecs->table('reg_fields') . "ORDER BY id"); $smarty->assign('reg_fields', $fields); make_json_result($smarty->fetch('reg_fields.htm')); } /*------------------------------------------------------ */ //-- 添加会员注册项 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'add') { admin_priv('reg_fields'); $form_action = 'insert'; $reg_field['reg_field_order'] = 100; $reg_field['reg_field_display'] = 1; $reg_field['reg_field_need'] = 1; $smarty->assign('reg_field', $reg_field); $smarty->assign('ur_here', $_LANG['add_reg_field']); $smarty->assign('action_link', array('text' => $_LANG['021_reg_fields'], 'href'=>'reg_fields.php?act=list')); $smarty->assign('form_action', $form_action); assign_query_info(); $smarty->display('reg_field_info.htm'); } /*------------------------------------------------------ */ //-- 增加会员注册项到数据库 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'insert') { admin_priv('reg_fields'); /* 检查是否存在重名的会员注册项 */ if (!$exc->is_only('reg_field_name', trim($_POST['reg_field_name']))) { sys_msg(sprintf($_LANG['field_name_exist'], trim($_POST['reg_field_name'])), 1); } $sql = "INSERT INTO " .$ecs->table('reg_fields') ."( ". "reg_field_name, dis_order, display, is_need". ") VALUES (". "'$_POST[reg_field_name]', '$_POST[reg_field_order]', '$_POST[reg_field_display]', '$_POST[reg_field_need]')"; $db->query($sql); /* 管理员日志 */ admin_log(trim($_POST['reg_field_name']), 'add', 'reg_fields'); clear_cache_files(); $lnk[] = array('text' => $_LANG['back_list'], 'href'=>'reg_fields.php?act=list'); $lnk[] = array('text' => $_LANG['add_continue'], 'href'=>'reg_fields.php?act=add'); sys_msg($_LANG['add_field_success'], 0, $lnk); } /*------------------------------------------------------ */ //-- 编辑会员注册项 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'edit') { admin_priv('reg_fields'); $form_action = 'update'; $sql = "SELECT id AS reg_field_id, reg_field_name, dis_order AS reg_field_order, display AS reg_field_display, is_need AS reg_field_need FROM ". $ecs->table('reg_fields'). " WHERE id='$_REQUEST[id]'"; $reg_field = $db->GetRow($sql); $smarty->assign('reg_field', $reg_field); $smarty->assign('ur_here', $_LANG['add_reg_field']); $smarty->assign('action_link', array('text' => $_LANG['021_reg_fields'], 'href'=>'reg_fields.php?act=list')); $smarty->assign('form_action', $form_action); assign_query_info(); $smarty->display('reg_field_info.htm'); } /*------------------------------------------------------ */ //-- 更新会员注册项 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'update') { admin_priv('reg_fields'); /* 检查是否存在重名的会员注册项 */ if ($_POST['reg_field_name'] != $_POST['old_field_name'] && !$exc->is_only('reg_field_name', trim($_POST['reg_field_name']))) { sys_msg(sprintf($_LANG['field_name_exist'], trim($_POST['reg_field_name'])), 1); } $sql = "UPDATE " .$ecs->table('reg_fields') . " SET `reg_field_name` = '$_POST[reg_field_name]', `dis_order` = '$_POST[reg_field_order]', `display` = '$_POST[reg_field_display]', `is_need` = '$_POST[reg_field_need]' WHERE `id` = '$_POST[id]'"; $db->query($sql); /* 管理员日志 */ admin_log(trim($_POST['reg_field_name']), 'edit', 'reg_fields'); clear_cache_files(); $lnk[] = array('text' => $_LANG['back_list'], 'href'=>'reg_fields.php?act=list'); sys_msg($_LANG['update_field_success'], 0, $lnk); } /*------------------------------------------------------ */ //-- 删除会员注册项 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'remove') { check_authz_json('reg_fields'); $field_id = intval($_GET['id']); $field_name = $exc->get_name($field_id); if ($exc->drop($field_id)) { /* 删除会员扩展信息表的相应信息 */ $sql = "DELETE FROM " . $GLOBALS['ecs']->table('reg_extend_info') . " WHERE reg_field_id = '" . $field_id . "'"; @$GLOBALS['db']->query($sql); admin_log(addslashes($field_name), 'remove', 'reg_fields'); clear_cache_files(); } $url = 'reg_fields.php?act=query&' . str_replace('act=remove', '', $_SERVER['QUERY_STRING']); ecs_header("Location: $url\n"); exit; } /* * 编辑会员注册项名称 */ elseif ($_REQUEST['act'] == 'edit_name') { $id = intval($_REQUEST['id']); $val = empty($_REQUEST['val']) ? '' : json_str_iconv(trim($_REQUEST['val'])); check_authz_json('reg_fields'); if ($exc->is_only('reg_field_name', $val, $id)) { if ($exc->edit("reg_field_name = '$val'", $id)) { /* 管理员日志 */ admin_log($val, 'edit', 'reg_fields'); clear_cache_files(); make_json_result(stripcslashes($val)); } else { make_json_error($db->error()); } } else { make_json_error(sprintf($_LANG['field_name_exist'], htmlspecialchars($val))); } } /* * 编辑会员注册项排序权值 */ elseif ($_REQUEST['act'] == 'edit_order') { $id = intval($_REQUEST['id']); $val = isset($_REQUEST['val']) ? json_str_iconv(trim($_REQUEST['val'])) : '' ; check_authz_json('reg_fields'); if (is_numeric($val)) { if ($exc->edit("dis_order = '$val'", $id)) { /* 管理员日志 */ admin_log($val, 'edit', 'reg_fields'); clear_cache_files(); make_json_result(stripcslashes($val)); } else { make_json_error($db->error()); } } else { make_json_error($_LANG['order_not_num']); } } /*------------------------------------------------------ */ //-- 修改会员注册项显示状态 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'toggle_dis') { check_authz_json('reg_fields'); $id = intval($_POST['id']); $is_dis = intval($_POST['val']); if ($exc->edit("display = '$is_dis'", $id)) { clear_cache_files(); make_json_result($is_dis); } } /*------------------------------------------------------ */ //-- 修改会员注册项必填状态 /*------------------------------------------------------ */ elseif ($_REQUEST['act'] == 'toggle_need') { check_authz_json('reg_fields'); $id = intval($_POST['id']); $is_need = intval($_POST['val']); if ($exc->edit("is_need = '$is_need'", $id)) { clear_cache_files(); make_json_result($is_need); } } ?>
zzshop
trunk/admin/reg_fields.php
PHP
asf20
8,966
/* $Id : selectzone.js 4824 2007-01-31 08:23:56Z paulgao $ */ /* * * SelectZone 类 */ function SelectZone() { this.filters = new Object(); this.id = arguments[0] ? arguments[0] : 1; // 过滤条件 this.sourceSel = arguments[1] ? arguments[1] : null; // 1 商品关联 2 组合、赠品(带价格) this.targetSel = arguments[2] ? arguments[2] : null; // 源 select 对象 this.priceObj = arguments[3] ? arguments[3] : null; // 目标 select 对象 this.filename = location.href.substring((location.href.lastIndexOf("/")) + 1, location.href.lastIndexOf("?")) + "?is_ajax=1"; var _self = this; /** * 载入源select对象的options * @param string funcName ajax函数名称 * @param function response 处理函数 */ this.loadOptions = function(act, filters) { Ajax.call(this.filename+"&act=" + act, filters, this.loadOptionsResponse, "GET", "JSON"); } /** * 将返回的数据解析为options的形式 * @param result 返回的数据 */ this.loadOptionsResponse = function(result, txt) { if (!result.error) { _self.createOptions(_self.sourceSel, result.content); } if (result.message.length > 0) { alert(result.message); } return; } /** * 检查对象 * @return boolean */ this.check = function() { /* source select */ if ( ! this.sourceSel) { alert('source select undefined'); return false; } else { if (this.sourceSel.nodeName != 'SELECT') { alert('source select is not SELECT'); return false; } } /* target select */ if ( ! this.targetSel) { alert('target select undefined'); return false; } else { if (this.targetSel.nodeName != 'SELECT') { alert('target select is not SELECT'); return false; } } /* price object */ if (this.id == 2 && ! this.priceObj) { alert('price obj undefined'); return false; } return true; } /** * 添加选中项 * @param boolean all * @param string act * @param mix arguments 其他参数,下标从[2]开始 */ this.addItem = function(all, act) { if (!this.check()) { return; } var selOpt = new Array(); for (var i = 0; i < this.sourceSel.length; i ++ ) { if (!this.sourceSel.options[i].selected && all == false) continue; if (this.targetSel.length > 0) { var exsits = false; for (var j = 0; j < this.targetSel.length; j ++ ) { if (this.targetSel.options[j].value == this.sourceSel.options[i].value) { exsits = true; break; } } if (!exsits) { selOpt[selOpt.length] = this.sourceSel.options[i].value; } } else { selOpt[selOpt.length] = this.sourceSel.options[i].value; } } if (selOpt.length > 0) { var args = new Array(); for (var i=2; i<arguments.length; i++) { args[args.length] = arguments[i]; } Ajax.call(this.filename + "&act="+act+"&add_ids=" +selOpt.toJSONString(), args, this.addRemoveItemResponse, "GET", "JSON"); } } /** * 删除选中项 * @param boolean all * @param string act */ this.dropItem = function(all, act) { if (!this.check()) { return; } var arr = new Array(); for (var i = this.targetSel.length - 1; i >= 0 ; i -- ) { if (this.targetSel.options[i].selected || all) { arr[arr.length] = this.targetSel.options[i].value; } } if (arr.length > 0) { var args = new Array(); for (var i=2; i<arguments.length; i++) { args[args.length] = arguments[i]; } Ajax.call(this.filename + "&act="+act+"&drop_ids=" + arr.toJSONString(), args, this.addRemoveItemResponse, 'GET', 'JSON'); } } /** * 处理添加项返回的函数 */ this.addRemoveItemResponse = function(result,txt) { if (!result.error) { _self.createOptions(_self.targetSel, result.content); } if (result.message.length > 0) { alert(result.message); } } /** * 为select元素创建options */ this.createOptions = function(obj, arr) { obj.length = 0; for (var i=0; i < arr.length; i++) { var opt = document.createElement("OPTION"); opt.value = arr[i].value; opt.text = arr[i].text; opt.id = arr[i].data; obj.options.add(opt); } } }
zzshop
trunk/admin/js/selectzone.js
JavaScript
asf20
4,873
/* $Id : common.js 4824 2007-01-31 08:23:56Z paulgao $ */ /* 检查新订单的时间间隔 */ var NEW_ORDER_INTERVAL = 180000; /* * * 开始检查新订单; */ function startCheckOrder() { checkOrder() window.setInterval("checkOrder()", NEW_ORDER_INTERVAL); } /* * 检查订单 */ function checkOrder() { var lastCheckOrder = new Date(document.getCookie('ECS_LastCheckOrder')); var today = new Date(); if (lastCheckOrder == null || today-lastCheckOrder >= NEW_ORDER_INTERVAL) { document.setCookie('ECS_LastCheckOrder', today.toGMTString()); try { Ajax.call('index.php?is_ajax=1&act=check_order','', checkOrderResponse, 'GET', 'JSON'); } catch (e) { } } } /* * * 处理检查订单的反馈信息 */ function checkOrderResponse(result) { //出错屏蔽 if (result.error != 0 || (result.new_orders == 0 && result.new_paid == 0)) { return; } try { document.getElementById('spanNewOrder').innerHTML = result.new_orders; document.getElementById('spanNewPaid').innerHTML = result.new_paid; Message.show(); } catch (e) { } } /** * 确认后跳转到指定的URL */ function confirm_redirect(msg, url) { if (confirm(msg)) { location.href=url; } } /* * * 设置页面宽度 */ function set_size(w) { var y_width = document.body.clientWidth var s_width = screen.width var agent = navigator.userAgent.toLowerCase(); if (y_width < w) { if (agent.indexOf("msie") != - 1) { document.body.style.width = w + "px"; } else { document.getElementById("bd").style.width = (w - 10) + 'px'; } } } /* * * 显示隐藏图片 * @param id div的id * @param show | hide */ function showImg(id, act) { if (act == 'show') { document.getElementById(id).style.visibility = 'visible'; } else { document.getElementById(id).style.visibility = 'hidden'; } } /* * 气泡式提示信息 */ var Message = Object(); Message.bottom = 0; Message.count = 0; Message.elem = "popMsg"; Message.mvTimer = null; Message.show = function() { try { Message.controlSound('msgBeep'); document.getElementById(Message.elem).style.visibility = "visible" document.getElementById(Message.elem).style.display = "block" Message.bottom = 0 - parseInt(document.getElementById(Message.elem).offsetHeight); Message.mvTimer = window.setInterval("Message.move()", 10); document.getElementById(Message.elem).style.bottom = Message.bottom + "px"; } catch (e) { alert(e); } } Message.move = function() { try { if (Message.bottom == 0) { window.clearInterval(Message.mvTimer) Message.mvTimer = window.setInterval("Message.close()", 10000) } Message.bottom ++ ; document.getElementById(Message.elem).style.bottom = Message.bottom + "px"; } catch (e) { alert(e); } } Message.close = function() { document.getElementById(Message.elem).style.visibility = 'hidden'; document.getElementById(Message.elem).style.display = 'none'; if (Message.mvTimer) window.clearInterval(Message.mvTimer) } Message.controlSound = function(_sndObj) { sndObj = document.getElementById(_sndObj); try { sndObj.Play(); } catch (e) { } } var listZone = new Object(); /* * * 显示正在载入 */ listZone.showLoader = function() { listZone.toggleLoader(true); } listZone.hideLoader = function() { listZone.toggleLoader(false); } listZone.toggleLoader = function(disp) { document.getElementsByTagName('body').item(0).style.cursor = (disp) ? "wait" : 'auto'; try { var doc = top.frames['header-frame'].document; var loader = doc.getElementById("load-div"); if (typeof loader == 'object') loader.style.display = disp ? "block" : "none"; } catch (ex) { } } function $import(path,type,title){ var s,i; if(type == "js"){ var ss = document.getElementsByTagName("script"); for(i =0;i < ss.length; i++) { if(ss[i].src && ss[i].src.indexOf(path) != -1)return ss[i]; } s = document.createElement("script"); s.type = "text/javascript"; s.src =path; } else if(type == "css") { var ls = document.getElementsByTagName("link"); for(i = 0; i < ls.length; i++) { if(ls[i].href && ls[i].href.indexOf(path)!=-1)return ls[i]; } s = document.createElement("link"); s.rel = "alternate stylesheet"; s.type = "text/css"; s.href = path; s.title = title; s.disabled = false; } else return; var head = document.getElementsByTagName("head")[0]; head.appendChild(s); return s; } /** * 返回随机数字符串 * * @param : prefix 前缀字符 * * @return : string */ function rand_str(prefix) { var dd = new Date(); var tt = dd.getTime(); tt = prefix + tt; var rand = Math.random(); rand = Math.floor(rand * 100); return (tt + rand); }
zzshop
trunk/admin/js/common.js
JavaScript
asf20
5,152
/* $Id: listtable.js 14980 2008-10-22 05:01:19Z testyang $ */ if (typeof Ajax != 'object') { alert('Ajax object doesn\'t exists.'); } if (typeof Utils != 'object') { alert('Utils object doesn\'t exists.'); } var listTable = new Object; listTable.query = "query"; listTable.filter = new Object; listTable.url = location.href.lastIndexOf("?") == -1 ? location.href.substring((location.href.lastIndexOf("/")) + 1) : location.href.substring((location.href.lastIndexOf("/")) + 1, location.href.lastIndexOf("?")); listTable.url += "?is_ajax=1"; /** * 创建一个可编辑区 */ listTable.edit = function(obj, act, id) { var tag = obj.firstChild.tagName; if (typeof(tag) != "undefined" && tag.toLowerCase() == "input") { return; } /* 保存原始的内容 */ var org = obj.innerHTML; var val = Browser.isIE ? obj.innerText : obj.textContent; /* 创建一个输入框 */ var txt = document.createElement("INPUT"); txt.value = (val == 'N/A') ? '' : val; txt.style.width = (obj.offsetWidth + 12) + "px" ; /* 隐藏对象中的内容,并将输入框加入到对象中 */ obj.innerHTML = ""; obj.appendChild(txt); txt.focus(); /* 编辑区输入事件处理函数 */ txt.onkeypress = function(e) { var evt = Utils.fixEvent(e); var obj = Utils.srcElement(e); if (evt.keyCode == 13) { obj.blur(); return false; } if (evt.keyCode == 27) { obj.parentNode.innerHTML = org; } } /* 编辑区失去焦点的处理函数 */ txt.onblur = function(e) { if (Utils.trim(txt.value).length > 0) { res = Ajax.call(listTable.url, "act="+act+"&val=" + encodeURIComponent(Utils.trim(txt.value)) + "&id=" +id, null, "POST", "JSON", false); if (res.message) { alert(res.message); } if(res.id && (res.act == 'goods_auto' || res.act == 'article_auto')) { document.getElementById('del'+res.id).innerHTML = "<a href=\""+ thisfile +"?goods_id="+ res.id +"&act=del\" onclick=\"return confirm('"+deleteck+"');\">"+deleteid+"</a>"; } obj.innerHTML = (res.error == 0) ? res.content : org; } else { obj.innerHTML = org; } } } /** * 切换状态 */ listTable.toggle = function(obj, act, id) { var val = (obj.src.match(/yes.gif/i)) ? 0 : 1; var res = Ajax.call(this.url, "act="+act+"&val=" + val + "&id=" +id, null, "POST", "JSON", false); if (res.message) { alert(res.message); } if (res.error == 0) { obj.src = (res.content > 0) ? 'images/yes.gif' : 'images/no.gif'; } } /** * 切换排序方式 */ listTable.sort = function(sort_by, sort_order) { var args = "act="+this.query+"&sort_by="+sort_by+"&sort_order="; if (this.filter.sort_by == sort_by) { args += this.filter.sort_order == "DESC" ? "ASC" : "DESC"; } else { args += "DESC"; } for (var i in this.filter) { if (typeof(this.filter[i]) != "function" && i != "sort_order" && i != "sort_by" && !Utils.isEmpty(this.filter[i])) { args += "&" + i + "=" + this.filter[i]; } } this.filter['page_size'] = this.getPageSize(); Ajax.call(this.url, args, this.listCallback, "POST", "JSON"); } /** * 翻页 */ listTable.gotoPage = function(page) { if (page != null) this.filter['page'] = page; if (this.filter['page'] > this.pageCount) this.filter['page'] = 1; this.filter['page_size'] = this.getPageSize(); this.loadList(); } /** * 载入列表 */ listTable.loadList = function() { var args = "act="+this.query+"" + this.compileFilter(); Ajax.call(this.url, args, this.listCallback, "POST", "JSON"); } /** * 删除列表中的一个记录 */ listTable.remove = function(id, cfm, opt) { if (opt == null) { opt = "remove"; } if (confirm(cfm)) { var args = "act=" + opt + "&id=" + id + this.compileFilter(); Ajax.call(this.url, args, this.listCallback, "GET", "JSON"); } } listTable.gotoPageFirst = function() { if (this.filter.page > 1) { listTable.gotoPage(1); } } listTable.gotoPagePrev = function() { if (this.filter.page > 1) { listTable.gotoPage(this.filter.page - 1); } } listTable.gotoPageNext = function() { if (this.filter.page < listTable.pageCount) { listTable.gotoPage(parseInt(this.filter.page) + 1); } } listTable.gotoPageLast = function() { if (this.filter.page < listTable.pageCount) { listTable.gotoPage(listTable.pageCount); } } listTable.changePageSize = function(e) { var evt = Utils.fixEvent(e); if (evt.keyCode == 13) { listTable.gotoPage(); return false; }; } listTable.listCallback = function(result, txt) { if (result.error > 0) { alert(result.message); } else { try { document.getElementById('listDiv').innerHTML = result.content; if (typeof result.filter == "object") { listTable.filter = result.filter; } listTable.pageCount = result.page_count; } catch (e) { alert(e.message); } } } listTable.selectAll = function(obj, chk) { if (chk == null) { chk = 'checkboxes'; } var elems = obj.form.getElementsByTagName("INPUT"); for (var i=0; i < elems.length; i++) { if (elems[i].name == chk || elems[i].name == chk + "[]") { elems[i].checked = obj.checked; } } } listTable.compileFilter = function() { var args = ''; for (var i in this.filter) { if (typeof(this.filter[i]) != "function" && typeof(this.filter[i]) != "undefined") { args += "&" + i + "=" + encodeURIComponent(this.filter[i]); } } return args; } listTable.getPageSize = function() { var ps = 15; pageSize = document.getElementById("pageSize"); if (pageSize) { ps = Utils.isInt(pageSize.value) ? pageSize.value : 15; document.cookie = "ECSCP[page_size]=" + ps + ";"; } } listTable.addRow = function(checkFunc) { cleanWhitespace(document.getElementById("listDiv")); var table = document.getElementById("listDiv").childNodes[0]; var firstRow = table.rows[0]; var newRow = table.insertRow(-1); newRow.align = "center"; var items = new Object(); for(var i=0; i < firstRow.cells.length;i++) { var cel = firstRow.cells[i]; var celName = cel.getAttribute("name"); var newCel = newRow.insertCell(-1); if (!cel.getAttribute("ReadOnly") && cel.getAttribute("Type")=="TextBox") { items[celName] = document.createElement("input"); items[celName].type = "text"; items[celName].style.width = "50px"; items[celName].onkeypress = function(e) { var evt = Utils.fixEvent(e); var obj = Utils.srcElement(e); if (evt.keyCode == 13) { listTable.saveFunc(); } } newCel.appendChild(items[celName]); } if (cel.getAttribute("Type") == "Button") { var saveBtn = document.createElement("input"); saveBtn.type = "image"; saveBtn.src = "./images/icon_add.gif"; saveBtn.value = save; newCel.appendChild(saveBtn); this.saveFunc = function() { if (checkFunc) { if (!checkFunc(items)) { return false; } } var str = "act=add"; for(var key in items) { if (typeof(items[key]) != "function") { str += "&" + key + "=" + items[key].value; } } res = Ajax.call(listTable.url, str, null, "POST", "JSON", false); if (res.error) { alert(res.message); table.deleteRow(table.rows.length-1); items = null; } else { document.getElementById("listDiv").innerHTML = res.content; if (document.getElementById("listDiv").childNodes[0].rows.length < 6) { listTable.addRow(checkFunc); } items = null; } } saveBtn.onclick = this.saveFunc; //var delBtn = document.createElement("input"); //delBtn.type = "image"; //delBtn.src = "./images/no.gif"; //delBtn.value = cancel; //newCel.appendChild(delBtn); } } }
zzshop
trunk/admin/js/listtable.js
JavaScript
asf20
8,555