/** * * * Framework ºËÐÄ¿ò¼Ü * * * @copyright Copyright (c) 2007-2013 ShopNC Inc. (http://www.shopnc.net) * @license http://www.shopnc.net/ * @link http://www.shopnc.net/ * @since File available since Release v1.1 */ function remote_ftp($path, $file, $ifdel = TRUE) { $image_full_path = $path . "/" . $file; ftpcmd("upload", $image_full_path); $_ext = "." . get_image_type($image_full_path); if (!ftpcmd("error")) { ftpcmd("upload", $image_full_path . "_max" . $_ext); } if (!ftpcmd("error")) { ftpcmd("upload", $image_full_path . "_mid" . $_ext); } if (!ftpcmd("error")) { ftpcmd("upload", $image_full_path . "_small" . $_ext); } if (!ftpcmd("error")) { ftpcmd("upload", $image_full_path . "_tiny" . $_ext); } if (!ftpcmd("error")) { ftpcmd("upload", $image_full_path . "_240x240" . $_ext); } if (!ftpcmd("error")) { if ($ifdel) { @unlink(BasePath . "/" . $image_full_path); @unlink(BasePath . "/" . $image_full_path . "_max" . $_ext); @unlink(BasePath . "/" . $image_full_path . "_mid" . $_ext); @unlink(BasePath . "/" . $image_full_path . "_small" . $_ext); @unlink(BasePath . "/" . $image_full_path . "_tiny" . $_ext); @unlink(BasePath . "/" . $image_full_path . "_240x240" . $_ext); } return c("ftp_access_url") . "/" . $path; } return FALSE; }
/** * 通过FTP同步图片到远程服务器 * * @param string $path 图片路径(upload/store/goods/4) * @param string $file 图片名称(含年月日2012/06/12/03f625d923bfb1ca84355007487ed68b.jpg) * @param boolean $ifdel 是否删除本地图片,目前淘宝导入的图片上传到远程时,不会删除本地图片 * @return string 远程图片路径部分 */ function remote_ftp($path, $file, $ifdel = true) { $image_full_path = $path . '/' . $file; ftpcmd('upload', $image_full_path); $_ext = '.' . get_image_type($image_full_path); if (!ftpcmd('error')) { ftpcmd('upload', $image_full_path . '_max' . $_ext); } if (!ftpcmd('error')) { ftpcmd('upload', $image_full_path . '_mid' . $_ext); } if (!ftpcmd('error')) { ftpcmd('upload', $image_full_path . '_small' . $_ext); } if (!ftpcmd('error')) { ftpcmd('upload', $image_full_path . '_tiny' . $_ext); } if (!ftpcmd('error')) { ftpcmd('upload', $image_full_path . '_240x240' . $_ext); } if (!ftpcmd('error')) { if ($ifdel) { @unlink(BASE_PATH . '/' . $image_full_path); @unlink(BASE_PATH . '/' . $image_full_path . '_max' . $_ext); @unlink(BASE_PATH . '/' . $image_full_path . '_mid' . $_ext); @unlink(BASE_PATH . '/' . $image_full_path . '_small' . $_ext); @unlink(BASE_PATH . '/' . $image_full_path . '_tiny' . $_ext); @unlink(BASE_PATH . '/' . $image_full_path . '_240x240' . $_ext); } return C('ftp_access_url') . '/' . $path; } return false; }
public function voucher_listOp() { //检查过期的代金券,状态设置为过期(vouchet_state=3) $this->check_voucher_expire(); $model = Model(); $where = array('voucher_owner_id' => $_SESSION['member_id']); if (intval($_GET['select_detail_state']) > 0) { $where['voucher_state'] = intval($_GET['select_detail_state']); } $field = "voucher_id,voucher_code,voucher_title,voucher_desc,voucher_start_date,voucher_end_date,voucher_price,voucher_limit,voucher_state,voucher_order_id,voucher_store_id,store_name,store_id,store_domain"; $list = $model->table('voucher,store')->field($field)->join('inner')->on('voucher.voucher_store_id = store.store_id')->where($where)->order('voucher_id desc')->page(10)->select(); if (is_array($list)) { foreach ($list as $key => $val) { if (!$val['voucher_t_customimg'] || !file_exists(BasePath . DS . ATTACH_VOUCHER . DS . $_SESSION['store_id'] . DS . $val['voucher_t_customimg'])) { $list[$key]['voucher_t_customimg'] = defaultGoodsImage('tiny'); } else { $list[$key]['voucher_t_customimg'] = SiteUrl . DS . ATTACH_VOUCHER . DS . $_SESSION['store_id'] . DS . $val['voucher_t_customimg'] . "_small." . get_image_type($val['voucher_t_customimg']); } } } Tpl::output('list', $list); Tpl::output('show_page', $model->showpage(2)); //查询会员信息 $this->get_member_info(); $this->profile_menu('voucher_list'); Tpl::output('menu_sign', 'myvoucher'); Tpl::output('menu_sign_url', 'index.php?act=member_voucher'); Tpl::output('menu_sign1', 'member_voucher'); Tpl::showpage('member_voucher.list'); }
public function indexOp() { $model = Model(); //开启代金券功能后查询代金券相应信息 if (C('voucher_allow') == 1) { //查询已兑换代金券券数量 $vouchercount = 0; if ($_SESSION['is_login'] == '1') { $vouchercount = $model->table('voucher')->where(array('voucher_owner_id' => $_SESSION['member_id'], 'voucher_state' => $this->voucherstate_arr['unused'][0]))->count(); } Tpl::output('vouchercount', $vouchercount); //查询代金券面额 $pricelist = $model->table('voucher_price')->order('voucher_price asc')->select(); Tpl::output('pricelist', $pricelist); //查询代金券列表 $field = 'voucher_template.*,store.store_id,store.store_label,store.store_name,store.store_domain'; $on = 'voucher_template.voucher_t_store_id=store.store_id'; $new_voucher = $model->table('voucher_template,store')->field($field)->join('left')->on($on)->where(array('voucher_t_state' => $this->templatestate_arr['usable'][0], 'voucher_t_end_date' => array('gt', time())))->limit(16)->select(); if (!empty($new_voucher)) { foreach ($new_voucher as $k => $v) { if (!empty($v['voucher_t_customimg'])) { $v['voucher_t_customimg'] = SiteUrl . DS . ATTACH_VOUCHER . DS . $v['voucher_t_store_id'] . DS . $v['voucher_t_customimg'] . "_small." . get_image_type($v['voucher_t_customimg']); } else { $v['voucher_t_customimg'] = defaultGoodsImage('small'); } if (!empty($v['store_label'])) { $v['store_label'] = SiteUrl . DS . ATTACH_STORE . DS . $v['store_label']; } $v['voucher_t_limit'] = intval($v['voucher_t_limit']); $new_voucher[$k] = $v; } } Tpl::output('new_voucher', $new_voucher); } //开启积分兑换功能后查询代金券相应信息 if (C('pointprod_isuse') == 1) { //最新积分兑换商品 $model_pointsprod = Model('pointprod'); $new_pointsprod = $model_pointsprod->getPointProdListNew('*', array('pgoods_show' => 1, 'pgoods_state' => 0), 'pgoods_sort asc,pgoods_id desc', 16); Tpl::output('new_pointsprod', $new_pointsprod); //兑换排行 $converlist = $model_pointsprod->getPointProdListNew('*', array('pgoods_show' => 1, 'pgoods_state' => 0), 'pgoods_salenum desc,pgoods_id desc', 3); Tpl::output('converlist', $converlist); } //SEO Model('seo')->type('point')->show(); Tpl::showpage('pointprod'); }
/** * 兑换信息列表 */ public function orderlistOp() { //条件 $condition_arr = array(); $condition_arr['point_buyerid'] = $_SESSION['member_id']; //分页 $page = new Page(); $page->setEachNum(10); $page->setStyle('admin'); //兑换信息列表 $pointorder_model = Model('pointorder'); $order_list = $pointorder_model->getPointOrderList($condition_arr, $page, 'simple'); $order_idarr = array(); $order_listnew = array(); if (is_array($order_list) && count($order_list) > 0) { foreach ($order_list as $k => $v) { $v['point_orderstatetext'] = $this->pointorder_state($v['point_orderstate']); $order_idarr[] = $v['point_orderid']; $order_listnew[$v['point_orderid']] = $v; } } //查询兑换商品 if (is_array($order_idarr) && count($order_idarr) > 0) { $order_idstr = implode(',', $order_idarr); $prod_list = $pointorder_model->getPointOrderProdList(array('prod_orderid_in' => $order_idstr), ''); if (is_array($prod_list) && count($prod_list) > 0) { foreach ($prod_list as $v) { if (isset($order_listnew[$v['point_orderid']])) { $v['point_goodsimage'] = ATTACH_POINTPROD . DS . $v['point_goodsimage'] . '_small.' . get_image_type($v['point_goodsimage']); $order_listnew[$v['point_orderid']]['prodlist'][] = $v; } } } } //信息输出 Tpl::output('payment_list', $payment_list); Tpl::output('order_list', $order_listnew); Tpl::output('page', $page->show()); //查询会员信息 $this->get_member_info(); self::profile_menu('pointorder', 'orderlist'); Tpl::output('menu_sign', 'pointorder'); Tpl::output('menu_sign_url', 'index.php?act=member_pointorder&op=orderlist'); Tpl::output('menu_sign1', 'pointorder_list'); Tpl::showpage('member_pointorder'); }
/** * 代金券列表 */ public function pointvoucherOp() { $model = Model(); //查询会员信息 $member_info = $model->table('member')->field('member_points')->where(array('member_id' => $_SESSION['member_id']))->find(); Tpl::output('member_info', $member_info); //查询已兑换代金券券数量 $vouchercount = 0; if ($_SESSION['is_login'] == '1') { $vouchercount = $model->table('voucher')->where(array('voucher_owner_id' => $_SESSION['member_id'], 'voucher_state' => $this->voucherstate_arr['unused'][0]))->count(); } Tpl::output('vouchercount', $vouchercount); //查询代金券面额 $pricelist = $model->table('voucher_price')->order('voucher_price asc')->select(); $voucherlist = array(); if (!empty($pricelist)) { foreach ($pricelist as $k => $v) { $voucherlist[$v['voucher_price']]['price'] = $v; } } //查询代金券列表 $field = 'voucher_template.*,store.store_id,store.store_label,store.store_name,store.store_domain'; $on = 'voucher_template.voucher_t_store_id=store.store_id'; $voucher = $model->table('voucher_template,store')->field($field)->join('left')->on($on)->where(array('voucher_t_state' => $this->templatestate_arr['usable'][0], 'voucher_t_end_date' => array('gt', time())))->select(); if (!empty($voucher)) { foreach ($voucher as $k => $v) { if (!empty($v['voucher_t_customimg'])) { $v['voucher_t_customimg'] = SiteUrl . DS . ATTACH_VOUCHER . DS . $v['voucher_t_store_id'] . DS . $v['voucher_t_customimg'] . "_small." . get_image_type($v['voucher_t_customimg']); } else { $v['voucher_t_customimg'] = defaultGoodsImage('small'); } if (!empty($v['store_label'])) { $v['store_label'] = SiteUrl . DS . ATTACH_STORE . DS . $v['store_label']; } $v['voucher_t_limit'] = intval($v['voucher_t_limit']); if (!empty($voucherlist[$v['voucher_t_price']])) { $voucherlist[$v['voucher_t_price']]['voucher'][] = $v; } } } Tpl::output('voucherlist', $voucherlist); Tpl::showpage('pointvoucher'); }
/** * 取得商品默认大小图片 * * @param string $key 图片大小 small tiny * @return string */ function defaultGoodsImage($key) { return ATTACH_COMMON . DS . C('default_goods_image') . '_' . $key . '.' . get_image_type(C('default_goods_image')); }
$datamt['id'] = $datamtold->id; } $idt = insert_record("apps_reading_texts", $datamt); if ($_FILES['varimage']['tmp_name'][$key]) { list($width, $height, $type, $attr) = getimagesize($_FILES['varimage']['tmp_name'][$key]); if ($width > 320 || $height > 250) { $image = new SimpleImage(); $image->load($_FILES['varimage']['tmp_name'][$key]); if ($width > $height) { $image->resizeToWidth(320); } else { $image->resizeToHeight(250); } $image->save($CFG['dirroot'] . "/datas/reading/image/{$id}_{$idt}." . get_image_type($_FILES['varimage']['tmp_name'][$key])); } else { move_uploaded_file($_FILES['varimage']['tmp_name'][$key], $CFG['dirroot'] . "/datas/reading/image/{$id}_{$idt}." . get_image_type($_FILES['varimage']['tmp_name'][$key])); } } } } if ($_FILES['soundtext']['tmp_name']) { move_uploaded_file($_FILES['soundtext']['tmp_name'], $CFG['dirroot'] . "/datas/reading/soundtext/{$id}.mp3"); } $status = statusmessage($title . ' - Content added - ' . ' <a href="index.php?type=apps_reading&act=edit&id=' . $id . '">[Edit content]</a> <a href="#" onclick="$(\'#formadd\').show();return false;">[Add new content]</a>'); unset($id); } } if ($act == "edit" && !empty($id)) { $data = get_record("apps_reading", array("id" => $id)); if (!empty($data->video)) { $actype = $data->video;
<div class="goods-gallery"> <a class='sample_demo' id="select_s" href="index.php?act=flea_album&op=pic_list&item=des" style="display:none;"><?php echo $lang['nc_submit']; ?> </a> <ul class="list"> <?php if (!empty($output['pic_list'])) { ?> <?php foreach ($output['pic_list'] as $v) { ?> <li onclick="insert_editor('<?php echo ATTACH_FLEAS . DS . $_SESSION['member_id'] . DS . $v['file_name'] . '_max.' . get_image_type($v['file_name']); ?> ');"> <a href="JavaScript:void(0);"> <span class="thumb size90"> <i></i> <img src="<?php echo SiteUrl . DS . ATTACH_FLEAS . DS . $_SESSION['member_id'] . DS . $v['file_name'] . '_small.' . get_image_type($v['file_name']); ?> " onload="javascript:DrawImage(this,90,90);" onerror="this.src='<?php echo ATTACH_COMMON . DS . $GLOBALS['setting_config']['default_goods_image']; ?> '" title='<?php echo $v['file_name']; ?> '/> </span> </a> </li> <?php } ?> <?php } else { ?> <?php
&mid=<?php echo $output['master_id']; if (!empty($_GET['sort'])) { ?> &sort=<?php echo $_GET['sort']; } ?> " title="<?php echo $v['ap_name']; ?> "> <img id="img_<?php echo $v['ap_id']; ?> " src="<?php echo SiteUrl . DS . ATTACH_MALBUM . DS . $output['master_id'] . DS . $v['ap_cover'] . '_240x240.' . get_image_type($v['ap_cover']); ?> "></a></span> </dt> <dd> <span class="pinterest-addtime"><?php echo $lang['album_plist_upload_time'] . $lang['nc_colon'] . date("Y-m-d", $v['upload_time']); ?> </span><!--<span class="ops-comment"><a href="index.php?act=member_snshome&op=goodsinfo&type=like&mid=<?php echo $v['share_memberid']; ?> &id=<?php echo $v['share_id']; ?> " title="<?php echo $lang['sns_comment']; ?> "><i></i></a><em><?php
/** * 礼品信息单条 * * @param array $condition 条件数组 * @param array $field 查询字段 */ public function getPointProdInfoNew($where = '', $field = '*') { $prodinfo = $this->table('points_goods')->where($where)->find(); if (!empty($prodinfo)) { $prodinfo['pgoods_image_small'] = ATTACH_POINTPROD . DS . $prodinfo['pgoods_image'] . '_small.' . get_image_type($prodinfo['pgoods_image']); $prodinfo['pgoods_image'] = ATTACH_POINTPROD . DS . $prodinfo['pgoods_image']; $prodinfo['ex_state'] = $this->getPointProdExstate($prodinfo); } return $prodinfo; }
/** * 图片删除 */ public function album_pic_delOp() { if (empty($_GET['id'])) { showDialog(Language::get('album_parameter_error')); } if (!empty($_GET['id']) && is_array($_GET['id'])) { $id = $_GET['id']; } else { $id[] = intval($_GET['id']); } // 模型 $model = Model(); foreach ($id as $v) { $v = intval($v); if ($v <= 0) { continue; } $ap_info = $model->table('sns_albumpic')->where(array('ap_id' => $v, 'member_id' => $_SESSION['member_id']))->find(); if (empty($ap_info)) { continue; } @unlink(BasePath . DS . ATTACH_MALBUM . DS . $_SESSION['member_id'] . DS . $ap_info['ap_cover']); @unlink(BasePath . DS . ATTACH_MALBUM . DS . $_SESSION['member_id'] . DS . $ap_info['ap_cover'] . '_240x240.' . get_image_type($ap_info['ap_cover'])); @unlink(BasePath . DS . ATTACH_MALBUM . DS . $_SESSION['member_id'] . DS . $ap_info['ap_cover'] . '_max.' . get_image_type($ap_info['ap_cover'])); $model->table('sns_albumpic')->delete($ap_info['ap_id']); } showDialog(Language::get('album_class_pic_del_succeed'), 'reload', 'succ'); }
function getMicroshopDefaultImage() { return ATTACH_COMMON . DS . C('default_goods_image') . '_small' . get_image_type(C('default_goods_image')); }
/** * 删除图片 */ public function del_picOp() { $id = intval($_GET['id']); if ($id <= 0) { showMessage(Language::get('wrong_argument')); } $model = Model(); $ap_info = $model->table('sns_albumpic')->find($id); if (!empty($ap_info)) { @unlink(BasePath . DS . ATTACH_MALBUM . DS . $ap_info['member_id'] . DS . $ap_info['ap_cover']); @unlink(BasePath . DS . ATTACH_MALBUM . DS . $ap_info['member_id'] . DS . $ap_info['ap_cover'] . '_240x240.' . get_image_type($ap_info['ap_cover'])); @unlink(BasePath . DS . ATTACH_MALBUM . DS . $ap_info['member_id'] . DS . $ap_info['ap_cover'] . '_max.' . get_image_type($ap_info['ap_cover'])); $model->table('sns_albumpic')->delete($id); } showMessage(Language::get('nc_common_del_succ')); }
/** * 删除代金券 */ public function templatedelOp() { $t_id = intval($_GET['tid']); if ($t_id <= 0) { showMessage(Language::get('wrong_argument'), 'index.php?act=store_voucher&op=templatelist', 'html', 'error'); } $model = Model(); //查询模板信息 $param = array(); $param['voucher_t_id'] = $t_id; $param['voucher_t_store_id'] = $_SESSION['store_id']; $param['voucher_t_giveout'] = array('elt', '0'); //会员没领取过代金券才可删除 $t_info = $model->table('voucher_template')->where($param)->find(); if (empty($t_info)) { showMessage(Language::get('wrong_argument'), 'index.php?act=store_voucher&op=templatelist', 'html', 'error'); } $rs = $model->table('voucher_template')->where(array('voucher_t_id' => $t_info['voucher_t_id']))->delete(); if ($rs) { //删除自定义的图片 if (trim($t_info['voucher_t_customimg'])) { @unlink(BasePath . DS . ATTACH_VOUCHER . DS . $_SESSION['store_id'] . DS . $t_info['voucher_t_customimg']); @unlink(BasePath . DS . ATTACH_VOUCHER . DS . $_SESSION['store_id'] . DS . $t_info['voucher_t_customimg'] . "_small." . get_image_type($t_info['voucher_t_customimg'])); } showDialog(Language::get('nc_common_del_succ'), 'reload', 'succ'); } else { showDialog(Language::get('nc_common_del_fail')); } }
/** * 买家秀图像 */ function showImgUrl($param) { return UPLOAD_SITE_URL . '/' . ATTACH_MALBUM . '/' . $param['member_id'] . '/' . $param['ap_cover'] . '_240x240.' . get_image_type($param['ap_cover']); }
<?php if (is_array($output['orderprod_list']) && count($output['orderprod_list']) > 0) { ?> <?php foreach ($output['orderprod_list'] as $v) { ?> <li> <div class="picFloat"> <div class="pic"><i></i><a href="<?php echo SiteUrl; ?> /index.php?act=pointprod&op=pinfo&id=<?php echo $v['point_goodsid']; ?> "> <img src="<?php echo SiteUrl . DS . 'upload' . DS . 'pointprod' . DS . $v['point_goodsimage'] . '_small.' . get_image_type($v['point_goodsimage']); ?> " onerror="this.src='<?php echo defaultGoodsImage('tiny'); ?> '" onload="javascript:DrawImage(this,64,64);" /></a> </div> </div> <div class="info"> <p class="user"><?php echo str_cut($v['point_buyername'], '4') . '***'; echo $lang['pointprod_info_goods_alreadyexchange']; ?> </p> <p class="name"><?php echo $v['point_goodsname']; ?>
/** * ajax返回图片信息 */ public function ajax_change_imgmessageOp() { $str_array = explode('/', $_GET['url']); $str = array_pop($str_array); $str = explode('.', $str); /** * 实例化图片模型 */ $model_album = Model('album'); $param = array(); $param['like_cover'] = $str['0']; $pic_info = $model_album->getPicList($param); /** * 小图尺寸 */ list($width, $height, $type, $attr) = getimagesize(BasePath . DS . ATTACH_GOODS . DS . $_SESSION['store_id'] . DS . $pic_info['0']['apic_cover'] . '_small.' . get_image_type($pic_info['0']['apic_cover'])); if (strtoupper(CHARSET) == 'GBK') { $pic_info['0']['apic_name'] = Language::getUTF8($pic_info['0']['apic_name']); } echo json_encode(array('img_name' => $pic_info['0']['apic_name'], 'default_size' => sprintf('%.2f', intval($pic_info['0']['apic_size']) / 1024), 'default_spec' => $pic_info['0']['apic_spec'], 'upload_time' => date('Y-m-d', $pic_info['0']['upload_time']), 'small_spec' => $width . 'x' . $height)); }
/** * 追加买家秀 */ public function add_shareOp() { $sid = intval($_GET['sid']); $model = Model(); if ($sid > 0) { // 查询已秀图片 $where = array(); $where['member_id'] = $_SESSION['member_id']; $where['ap_type'] = 1; $where['item_id'] = $sid; $pic_list = $model->table('sns_albumpic')->where($where)->select(); if (!empty($pic_list)) { foreach ($pic_list as $key => $val) { $pic_list[$key]['ap_cover'] = SiteUrl . '/' . ATTACH_MALBUM . '/' . $_SESSION['member_id'] . '/' . $val['ap_cover'] . '_240x240.' . get_image_type($val['ap_cover']); } Tpl::output('pic_list', $pic_list); } } $sharegoods_info = $model->table('sns_goods')->find(intval($_GET['gid'])); Tpl::output('sharegoods_info', $sharegoods_info); Tpl::output('sid', $sid); Tpl::showpage('sns_addshare', 'null_layout'); }
} ?> </select> </div> <ul class="list"> <?php if (!empty($output['pic_list'])) { ?> <?php foreach ($output['pic_list'] as $v) { ?> <li><a href="javascript:void(0);" nctype="chooseimage" data-param="{'img':'<?php echo UPLOAD_SITE_URL . DS . ATTACH_MALBUM . DS . $_SESSION['member_id'] . DS . $v['ap_cover']; ?> '}"><img src="<?php echo UPLOAD_SITE_URL . DS . ATTACH_MALBUM . DS . $_SESSION['member_id'] . DS . $v['ap_cover'] . '_240x240.' . get_image_type($v['ap_cover']); ?> " title='<?php echo $v['ap_name']; ?> '/> <p class="extra"><?php echo $lang['circle_selected']; ?> </p> </a></li> <?php } ?> <?php } else {
/** * 闲置物品多图删除 * * @param array $param 删除条件 */ public function dropImageGoods($param) { if (empty($param)) { return false; } //得到条件语句 $condition_str = $this->getCondition($param); $image_more = Db::select(array('table' => 'flea_upload', 'where' => $condition_str, 'field' => 'file_name')); if (is_array($image_more) && !empty($image_more)) { foreach ($image_more as $v) { @unlink(BasePath . DS . ATTACH_FLEAS . DS . $_SESSION['member_id'] . DS . $v['file_name']); @unlink(BasePath . DS . ATTACH_FLEAS . DS . $_SESSION['member_id'] . DS . $v['file_name'] . "_tiny." . get_image_type($v['file_name'])); @unlink(BasePath . DS . ATTACH_FLEAS . DS . $_SESSION['member_id'] . DS . $v['file_name'] . "_small." . get_image_type($v['file_name'])); @unlink(BasePath . DS . ATTACH_FLEAS . DS . $_SESSION['member_id'] . DS . $v['file_name'] . "_mid." . get_image_type($v['file_name'])); @unlink(BasePath . DS . ATTACH_FLEAS . DS . $_SESSION['member_id'] . DS . $v['file_name'] . "_max." . get_image_type($v['file_name'])); @unlink(BasePath . DS . ATTACH_FLEAS . DS . $_SESSION['member_id'] . DS . $v['file_name'] . "_240x240." . get_image_type($v['file_name'])); } } $state = Db::delete('flea_upload', $condition_str); return $state; }
/** * 验证购物车商品是否符合兑换条件,并返回符合条件的积分礼品和对应的总积分总运费及其他信息 * @return array */ private function getLegalPointGoods() { $return_array = array(); //获取礼品购物车内信息 $pointcart_model = Model('pointcart'); $cart_goods = $pointcart_model->getPointCartList(array('pmember_id' => $_SESSION['member_id'])); if (!is_array($cart_goods) || count($cart_goods) <= 0) { showMessage(Language::get('pointcart_record_error'), 'index.php?act=pointprod', 'html', 'error'); } $cart_goods_new = array(); foreach ($cart_goods as $val) { $cart_goods_new[$val['pgoods_id']] = $val; } $cart_goodsid_arr = array_keys($cart_goods_new); if (!is_array($cart_goodsid_arr) || count($cart_goodsid_arr) <= 0) { showMessage(Language::get('pointcart_record_error'), 'index.php?act=pointprod', 'html', 'error'); } $cart_goodsid_str = implode(',', $cart_goodsid_arr); unset($cart_goodsid_arr); unset($cart_goods); //查询积分礼品信息 $pointprod_model = Model('pointprod'); $pointprod_list = $pointprod_model->getPointProdList(array('pgoods_id_in' => $cart_goodsid_str, 'pgoods_show' => '1', 'pgoods_state' => '0')); if (!is_array($pointprod_list) || count($pointprod_list) <= 0) { showMessage(Language::get('pointcart_record_error'), 'index.php?act=pointprod', 'html', 'error'); } $cart_delid_arr = array(); $pgoods_pointall = 0; //积分总数 $pgoods_freightall = 0; //运费总数 $pgoods_freightcharge = false; //是否需要支付运费 foreach ($pointprod_list as $k => $v) { $v['pgoods_image_new'] = ATTACH_POINTPROD . DS . $v['pgoods_image'] . '_small.' . get_image_type($v['pgoods_image']); $pointprod_list[$k] = $v; //验证积分礼品兑换状态 $ex_state = $pointprod_model->getPointProdExstate($v); switch ($ex_state) { case 'going': //验证兑换数量是否合法 $quantity = $pointprod_model->getPointProdExnum($v, $cart_goods_new[$v['pgoods_id']]['pgoods_choosenum']); if ($quantity <= 0) { //删除积分礼品兑换信息 $cart_delid_arr[] = $cart_goods_new[$v['pgoods_id']]['pcart_id']; unset($pointprod_list[$k]); } else { $pointprod_list[$k]['quantity'] = $quantity; //计算单件礼品积分数 $pointprod_list[$k]['onepoints'] = intval($quantity) * intval($v['pgoods_points']); $pgoods_pointall = $pgoods_pointall + $pointprod_list[$k]['onepoints']; //计算运费 if ($v['pgoods_freightcharge'] == 1) { $pgoods_freightcharge = true; $pgoods_freightall = $pgoods_freightall + $v['pgoods_freightprice']; } } break; default: //删除积分礼品兑换信息 $cart_delid_arr[] = $cart_goods_new[$v['pgoods_id']]['pcart_id']; unset($pointprod_list[$k]); break; } } //删除不符合条件的礼品购物车信息 if (is_array($cart_delid_arr) && count($cart_delid_arr) > 0) { $pointcart_model->dropPointCartById($cart_delid_arr); } if (!is_array($pointprod_list) || count($pointprod_list) <= 0) { showMessage(Language::get('pointcart_record_error'), 'index.php?act=pointprod', 'html', 'error'); } $pgoods_freightall = ncPriceFormat($pgoods_freightall); $return_array = array('pointprod_list' => $pointprod_list, 'pgoods_freightcharge' => $pgoods_freightcharge, 'pgoods_pointall' => $pgoods_pointall, 'pgoods_freightall' => $pgoods_freightall); return $return_array; }
/** * 系统设置 */ public function base_settingOp() { /** * 读取语言包 */ $lang = Language::getLangContent(); /** * 实例化模型 */ $model_setting = Model('setting'); /** * 保存信息 */ if (chksubmit()) { /** * 上传图片 */ $upload = new UploadFile(); $upload->set('default_dir', ATTACH_COMMON); /** * 默认商品图片 */ if (!empty($_FILES['default_goods_image']['name'])) { $thumb_width = C('thumb_tiny_width') . ',' . C('thumb_small_width') . ',' . C('thumb_mid_width') . ',' . C('thumb_max_width'); $thumb_height = C('thumb_tiny_height') . ',' . C('thumb_small_height') . ',' . C('thumb_mid_height') . ',' . C('thumb_max_height'); $upload->set('thumb_width', $thumb_width); $upload->set('thumb_height', $thumb_height); $upload->set('thumb_ext', '_tiny,_small,_mid,_max'); $result = $upload->upfile('default_goods_image'); if ($result) { $_POST['default_goods_image'] = $upload->file_name; } else { showMessage($upload->error, '', '', 'error'); } } /** * 默认店铺标志 */ if (!empty($_FILES['default_store_logo']['name'])) { $upload->set('file_name', ''); $upload->set('thumb_width', 0); $upload->set('thumb_height', 0); $upload->set('thumb_ext', false); $result = $upload->upfile('default_store_logo'); if ($result) { $_POST['default_store_logo'] = $upload->file_name; } else { showMessage($upload->error, '', '', 'error'); } } /** * 默认会员头像 */ if (!empty($_FILES['default_user_portrait']['name'])) { $thumb_width = '32'; $thumb_height = '32'; $upload->set('thumb_width', $thumb_width); $upload->set('thumb_height', $thumb_height); $upload->set('thumb_ext', '_small'); $upload->set('file_name', ''); $result = $upload->upfile('default_user_portrait'); if ($result) { $_POST['default_user_portrait'] = $upload->file_name; } else { showMessage($upload->error, '', '', 'error'); } } $update_array = array(); $update_array['time_format_simple'] = trim($_POST['time_format_simple']); $update_array['time_format_complete'] = trim($_POST['time_format_complete']); if (!empty($_POST['default_goods_image'])) { $update_array['default_goods_image'] = $_POST['default_goods_image']; } if (!empty($_POST['default_store_logo'])) { $update_array['default_store_logo'] = $_POST['default_store_logo']; } if (!empty($_POST['default_user_portrait'])) { $update_array['default_user_portrait'] = $_POST['default_user_portrait']; } $result = $model_setting->updateSetting($update_array); if ($result === true) { /** * 判断有没有之前的图片,如果有则删除 */ if (!empty($_POST['old_goods_image']) && !empty($_POST['default_goods_image'])) { @unlink(BasePath . DS . ATTACH_COMMON . DS . $_POST['old_goods_image']); @unlink(BasePath . DS . ATTACH_COMMON . DS . $_POST['old_goods_image'] . '_small.' . get_image_type($_POST['old_goods_image'])); @unlink(BasePath . DS . ATTACH_COMMON . DS . $_POST['old_goods_image'] . '_tiny.' . get_image_type($_POST['old_goods_image'])); @unlink(BasePath . DS . ATTACH_COMMON . DS . $_POST['old_goods_image'] . '_mid.' . get_image_type($_POST['old_goods_image'])); @unlink(BasePath . DS . ATTACH_COMMON . DS . $_POST['old_goods_image'] . '_max.' . get_image_type($_POST['old_goods_image'])); } if (!empty($_POST['old_store_logo']) && !empty($_POST['default_store_logo'])) { @unlink(BasePath . DS . ATTACH_COMMON . DS . $_POST['old_store_logo']); } if (!empty($_POST['old_user_portrait']) && !empty($_POST['default_user_portrait'])) { @unlink(BasePath . DS . ATTACH_COMMON . DS . $_POST['old_user_portrait']); @unlink(BasePath . DS . ATTACH_COMMON . DS . $_POST['old_user_portrait'] . '_small.' . get_image_type($_POST['old_user_portrait'])); } showMessage($lang['nc_common_save_succ']); } else { showMessage($lang['nc_common_save_fail']); } } /** * 读取设置内容 $list_setting */ $list_setting = $model_setting->getListSetting(); $list_setting['time_zone'] = $list_setting['time_zone'] ? $list_setting['time_zone'] : '8'; /** * 模板输出 */ Tpl::output('list_setting', $list_setting); Tpl::showpage('setting.system_set'); }
?> <time pubdate="pubdate">[<?php echo @date('Y-m-d', $v['geval_addtime']); ?> ]</time> <span class="ml20"><?php echo $v['geval_specinfo']; ?> </span></td> <td class="w150"><dl> <dt><span class="thumb size40"><img src="<?php if ($v['member_avatar'] != '') { echo ATTACH_AVATAR . DS . $v['member_avatar']; } else { echo ATTACH_COMMON . DS . C('default_user_portrait') . '_small.' . get_image_type(C('default_user_portrait')); } ?> " onload="javascript:DrawImage(this,40,40);"></span></dt> <dd><?php echo $v['geval_frommembername']; ?> </dd> <dd> <?php if (empty($v['credit_arr'])) { echo $lang['nc_credit_buyer_credit'] . $v['member_credit']; } else { ?> <span class="buyer-<?php
</tr> </thead> <tbody> <?php if (!empty($output['prod_list']) && is_array($output['prod_list'])) { ?> <?php foreach ($output['prod_list'] as $k => $v) { ?> <tr class="hover"> <td class="w24"><input type="checkbox" name="pg_id[]" value="<?php echo $v['pgoods_id']; ?> " class="checkitem"></td> <td class="w48 picture"><div class="size-44x44"><span class="thumb size-44x44"><i></i><img height="44" width="44" src="<?php echo SiteUrl . DS . ATTACH_POINTPROD . DS . $v['pgoods_image'] . '_small.' . get_image_type($v['pgoods_image']); ?> " onload="javascript:DrawImage(this,44,44);"/></span></div></td> <td><a href="<?php echo SiteUrl . DS; ?> index.php?act=pointprod&op=pinfo&id=<?php echo $v['pgoods_id']; ?> " target="_blank" ><?php echo $v['pgoods_name']; ?> </a></td> <td class="align-center"><?php echo $v['pgoods_points']; ?>
</select> </span></div> <ul class="list" style="width:610px;"> <?php if (!empty($output['pic_list'])) { ?> <?php foreach ($output['pic_list'] as $v) { ?> <li onclick="bundling_insert('<?php echo cthumb($v['apic_cover'], 'small', $_SESSION['store_id']); ?> ', '<?php echo $v['apic_cover'] . '_small.' . get_image_type($v['apic_cover']); ?> ');" style="padding: 4px 0 4px 3px;"><a href="JavaScript:void(0);"><span class="thumb size90"><i></i><img src="<?php echo cthumb($v['apic_cover'], 'tiny', $_SESSION['store_id']); ?> " onload="javascript:DrawImage(this,90,90);" title='<?php echo $v['apic_name']; ?> '/></span></a></li> <?php } ?> <?php } else { ?>
<?php if (!empty($output['pic_list'])) { ?> <?php foreach ($output['pic_list'] as $v) { ?> <li onclick="insert_img(<?php echo $v['apic_id']; ?> ,'<?php echo ATTACH_GOODS . DS . $_SESSION['store_id'] . DS . $v['apic_cover'] . '_small.' . get_image_type($v['apic_cover']); ?> ');"><a href="JavaScript:void(0);"><span class="thumb size90"><i></i><img src="<?php echo SiteUrl . DS . ATTACH_GOODS . DS . $_SESSION['store_id'] . DS . $v['apic_cover'] . '_small.' . get_image_type($v['apic_cover']); ?> " onload="javascript:DrawImage(this,90,90);" onerror="this.src='<?php echo ATTACH_COMMON . DS . $GLOBALS['setting_config']['default_goods_image']; ?> '" title='<?php echo $v['apic_name']; ?> '/></span></a></li> <?php } ?> <?php } else { ?>
<tbody> <?php if (is_array($output['prod_list']) and !empty($output['prod_list'])) { foreach ($output['prod_list'] as $val) { ?> <tr class="bd-line"> <td></td> <td><div class="goods-pic-small"><span class="thumb size60"><i></i><a href="<?php echo SiteUrl . DS; ?> index.php?act=pointprod&op=pinfo&id=<?php echo $val['point_goodsid']; ?> " target="_blank"> <img src="<?php echo SiteUrl . DS . ATTACH_POINTPROD . DS . $val['point_goodsimage'] . '_small.' . get_image_type($val['point_goodsimage']); ?> " onerror="this.src='<?php echo defaultGoodsImage('tiny'); ?> '" onload="javascript:DrawImage(this,60,60);" /></a></span></div></td> <td><dl class="goods-name"> <dt><a href="<?php echo SiteUrl . DS; ?> index.php?act=pointprod&op=pinfo&id=<?php echo $val['point_goodsid']; ?> " target="_blank"><?php echo $val['point_goodsname']; ?>
/** * 删除图片 * * @param string $id * @return bool */ public function delPic($id) { $pic_list = $this->getPicList(array('in_apic_id' => $id), '', 'apic_cover'); /** * 删除图片 */ foreach ($pic_list as $v) { @unlink(BasePath . DS . ATTACH_GOODS . DS . $_SESSION['store_id'] . DS . $v['apic_cover']); @unlink(BasePath . DS . ATTACH_GOODS . DS . $_SESSION['store_id'] . DS . $v['apic_cover'] . "_tiny." . get_image_type($v['apic_cover'])); @unlink(BasePath . DS . ATTACH_GOODS . DS . $_SESSION['store_id'] . DS . $v['apic_cover'] . "_small." . get_image_type($v['apic_cover'])); @unlink(BasePath . DS . ATTACH_GOODS . DS . $_SESSION['store_id'] . DS . $v['apic_cover'] . "_mid." . get_image_type($v['apic_cover'])); @unlink(BasePath . DS . ATTACH_GOODS . DS . $_SESSION['store_id'] . DS . $v['apic_cover'] . "_max." . get_image_type($v['apic_cover'])); @unlink(BasePath . DS . ATTACH_GOODS . DS . $_SESSION['store_id'] . DS . $v['apic_cover'] . "_240x240." . get_image_type($v['apic_cover'])); if (C('ftp_open') && C('thumb.save_type') == 3) { import('function.ftp'); $image_full_path = ATTACH_GOODS . DS . $_SESSION['store_id'] . DS . $v['apic_cover']; $_ext = '.' . get_image_type($image_full_path); if (!ftpcmd('error')) { ftpcmd('delete', $image_full_path); } if (!ftpcmd('error')) { ftpcmd('delete', $image_full_path . '_max' . $_ext); } if (!ftpcmd('error')) { ftpcmd('delete', $image_full_path . '_mid' . $_ext); } if (!ftpcmd('error')) { ftpcmd('delete', $image_full_path . '_small' . $_ext); } if (!ftpcmd('error')) { ftpcmd('delete', $image_full_path . '_tiny' . $_ext); } if (!ftpcmd('error')) { ftpcmd('delete', $image_full_path . '_240x240' . $_ext); } } } if (!empty($id)) { return Db::delete('album_pic', 'apic_id in(' . $id . ')'); } else { return false; } }
function defaultGoodsImage($key) { return ATTACH_COMMON . DS . c("default_goods_image") . "_" . $key . "." . get_image_type(c("default_goods_image")); }