/** * 保存申请 */ public function save_deliveryOp() { if (!chksubmit()) { showDialog(L('wrong_argument')); } $insert = array(); $insert['dlyp_name'] = $_POST['dname']; $insert['dlyp_passwd'] = md5($_POST['dpasswd']); $insert['dlyp_truename'] = $_POST['dtruename']; $insert['dlyp_mobile'] = $_POST['dmobile']; $insert['dlyp_telephony'] = $_POST['dtelephony']; $insert['dlyp_address_name'] = $_POST['daddressname']; $insert['dlyp_area_2'] = $_POST['area_id_2']; $insert['dlyp_area_3'] = $_POST['area_id']; $insert['dlyp_area_info'] = $_POST['area_info']; $insert['dlyp_address'] = $_POST['daddress']; $insert['dlyp_idcard'] = $_POST['didcard']; $insert['dlyp_addtime'] = TIMESTAMP; $insert['dlyp_state'] = 10; $upload = new UploadFile(); $upload->set('default_dir', ATTACH_DELIVERY); $result = $upload->upfile('didcardimg'); if (!$result) { showDialog($upload->error); } $insert['dlyp_idcard_image'] = $upload->file_name; $result = Model('delivery_point')->addDeliveryPoint($insert); if ($result) { showDialog('操作成功,等待管理员审核', 'index.php?act=login', 'succ'); } else { showDialog(L('nc_common_op_fail')); } }
/** * 编辑店铺 */ public function store_editOp() { $upload = new UploadFile(); /** * 上传店铺图片 */ if (!empty($_FILES['store_banner']['name'])) { $upload->set('default_dir', ATTACH_STORE); $upload->set('thumb_ext', ''); $upload->set('file_name', ''); $upload->set('ifremove', false); $result = $upload->upfile('store_banner'); if ($result) { $_POST['store_banner'] = $upload->file_name; } else { showDialog($upload->error); } } //删除旧店铺图片 if (!empty($_POST['store_banner']) && !empty($store_info['store_banner'])) { @unlink(BASE_UPLOAD_PATH . DS . ATTACH_STORE . DS . $this->store_info['store_banner']); } /** * 更新入库 */ $param = array('store_banner' => empty($_POST['store_banner']) ? $this->store_info['store_banner'] : $_POST['store_banner'], 'store_qq' => $_POST['store_qq'], 'store_ww' => $_POST['store_ww'], 'store_phone' => $_POST['store_phone'], 'store_zy' => $_POST['store_zy'], 'store_keywords' => $_POST['seo_keywords'], 'store_description' => $_POST['seo_description']); $result = Model('store')->editStore($param, array('store_id' => $this->store_info['store_id'])); if (!$result) { output_error('编辑失败'); } output_data('1'); }
function upload_image($file) { require_once '../class/upload.class.php'; $db_img = new DB(); if (!empty($file)) { $time = time(); $year_month = date('Ym', $time); $day = date('d', $time); $uploaddir = SHOPPIC_DIR; $pic_array = array(); foreach ($file as $k => $v) { $upload = new UploadFile(); $upload->set('default_dir', $uploaddir); $result = $upload->upfile($k); if ($result) { $sizeinfo = getimagesize($uploaddir . DS . $upload->file_name); $pic_array[] = array($upload->file_name, $v['name'], $v['size'], $sizeinfo[0]); unset($sizeinfo); } unset($upload); } return $pic_array; } return array(); }
/** * 上传图片 */ public function image_uploadOp() { // 判断图片数量是否超限 $model_album = Model('album'); $album_limit = $this->store_grade['sg_album_limit']; if ($album_limit > 0) { $album_count = $model_album->getCount(array('store_id' => $_SESSION['store_id'])); if ($album_count >= $album_limit) { $error = L('store_goods_album_climit'); if (strtoupper(CHARSET) == 'GBK') { $error = Language::getUTF8($error); } exit(json_encode(array('error' => $error))); } } $class_info = $model_album->getOne(array('store_id' => $_SESSION['store_id'], 'is_default' => 1), 'album_class'); // 上传图片 $upload = new UploadFile(); $upload->set('default_dir', ATTACH_GOODS . DS . $_SESSION['store_id'] . DS . $upload->getSysSetPath()); $upload->set('max_size', C('image_max_filesize')); $upload->set('thumb_width', GOODS_IMAGES_WIDTH); $upload->set('thumb_height', GOODS_IMAGES_HEIGHT); $upload->set('thumb_ext', GOODS_IMAGES_EXT); $upload->set('fprefix', $_SESSION['store_id']); $upload->set('allow_type', array('gif', 'jpg', 'jpeg', 'png')); $result = $upload->upfile($_POST['id']); if (!$result) { if (strtoupper(CHARSET) == 'GBK') { $upload->error = Language::getUTF8($upload->error); } $output = array(); $output['error'] = $upload->error; $output = json_encode($output); exit($output); } $img_path = $upload->getSysSetPath() . $upload->file_name; $thumb_page = $upload->getSysSetPath() . $upload->thumb_image; // 取得图像大小 list($width, $height, $type, $attr) = getimagesize(UPLOAD_SITE_URL . '/' . ATTACH_GOODS . '/' . $_SESSION['store_id'] . DS . $img_path); // 存入相册 $image = explode('.', $_FILES[$_POST['id']]["name"]); $insert_array = array(); $insert_array['apic_name'] = $image['0']; $insert_array['apic_tag'] = ''; $insert_array['aclass_id'] = $class_info['aclass_id']; $insert_array['apic_cover'] = $img_path; $insert_array['apic_size'] = intval($_FILES[$_POST['id']]['size']); $insert_array['apic_spec'] = $width . 'x' . $height; $insert_array['upload_time'] = TIMESTAMP; $insert_array['store_id'] = $_SESSION['store_id']; $model_album->addPic($insert_array); $data = array(); $data['image'] = cthumb($img_path, 240, $_SESSION['store_id']); // 整理为json格式 $output = json_encode($data); echo $output; exit; }
/** * 编辑 */ public function mb_home_editOp() { $model = Model('mb_home'); if ($_POST['form_submit'] == 'ok') { //验证 $obj_validate = new Validate(); $obj_validate->validateparam = array(array("input" => $_POST["h_title"], "require" => "true", "message" => L('home_add_null')), array("input" => $_POST["h_desc"], "require" => "true", "message" => L('home_add_null')), array("input" => $_POST["h_keyword"], "require" => "true", "message" => L('home_add_null')), array("input" => $_POST["h_sort"], "require" => "true", 'validator' => 'Number', "message" => L('home_add_sort_int'))); $error = $obj_validate->validate(); if ($error != '') { showMessage($error); } else { $home_array = $model->getMbHomeInfoByID(intval($_POST['h_id'])); //上传图片 if ($_FILES['h_img']['name'] != '') { $upload = new UploadFile(); $upload->set('default_dir', ATTACH_MOBILE . '/home'); $result = $upload->upfile('h_img'); if ($result) { $_POST['h_img'] = $upload->file_name; } else { showMessage($upload->error); } } $update_array = array(); $update_array['h_title'] = trim($_POST['h_title']); $update_array['h_desc'] = trim($_POST['h_desc']); $update_array['h_keyword'] = trim($_POST['h_keyword']); if (!empty($_POST['h_multi_keyword'])) { $update_array['h_multi_keyword'] = $_POST['h_multi_keyword']; } if ($_POST['h_img']) { $update_array['h_img'] = $_POST['h_img']; } $update_array['h_sort'] = trim($_POST['h_sort']); $condition = array(); $condition['h_id'] = intval($_POST['h_id']); $result = $model->editMbHome($update_array, $condition); if ($result) { //除图片 if (!empty($_POST['h_img']) && !empty($home_array['h_img'])) { @unlink(BASE_ROOT_PATH . DS . DIR_UPLOAD . DS . ATTACH_MOBILE . '/home' . DS . $home_array['h_img']); } showMessage(L('home_edit_succ'), 'index.php?act=mb_home&op=mb_home_list'); } else { showMessage(L('home_edit_fail')); } } } $home_array = $model->getMbHomeInfoByID(intval($_GET['h_id'])); if (empty($home_array)) { showMessage(L('wrong_argument')); } Tpl::output('home_array', $home_array); Tpl::showpage('mb_home.edit'); }
/** * 店铺打印设置 */ public function indexOp(){ $model = Model(); $store_info = $model->table('store')->where(array('store_id'=>$_SESSION['store_id']))->find(); if(empty($store_info)){ showDialog(Language::get('store_storeinfo_error'),'index.php?act=store_printsetup','error'); } if(chksubmit()){ $obj_validate = new Validate(); $obj_validate->validateparam = array( array("input"=>$_POST['store_printdesc'], "require"=>"true","validator"=>"Length","min"=>1,"max"=>200,"message"=>Language::get('store_printsetup_desc_error')) ); $error = $obj_validate->validate(); if ($error != ''){ showDialog($error); } $update_arr = array(); //上传认证文件 if($_FILES['store_stamp']['name'] != '') { $upload = new UploadFile(); $upload->set('default_dir',ATTACH_STORE); if($_FILES['store_stamp']['name'] != '') { $result = $upload->upfile('store_stamp'); if ($result){ $update_arr['store_stamp'] = $upload->file_name; //删除旧认证图片 if (!empty($store_info['store_stamp'])){ @unlink(BASE_UPLOAD_PATH.DS.ATTACH_STORE.DS.$store_info['store_stamp']); } } } } $update_arr['store_printdesc'] = $_POST['store_printdesc']; $rs = $model->table('store')->where(array('store_id'=>$_SESSION['store_id']))->update($update_arr); if ($rs){ showDialog(Language::get('nc_common_save_succ'),'index.php?act=store_printsetup','succ'); }else { showDialog(Language::get('nc_common_save_fail'),'index.php?act=store_printsetup','error'); } }else{ Tpl::output('store_info',$store_info); self::profile_menu('store_printsetup'); Tpl::showpage('store_printsetup'); } }
/** * 图片上传 * */ public function pic_uploadOp() { if (chksubmit()) { //上传图片 $upload = new UploadFile(); $upload->set('thumb_width', 500); $upload->set('thumb_height', 499); $upload->set('thumb_ext', '_small'); $upload->set('max_size', C('image_max_filesize') ? C('image_max_filesize') : 1024); $upload->set('ifremove', true); $upload->set('default_dir', $_GET['uploadpath']); if (!empty($_FILES['c_img']['tmp_name'])) { $result = $upload->upfile('c_img'); if ($result) { exit(json_encode(array('status' => 1, 'url' => UPLOAD_SITE_URL . '/' . $_GET['uploadpath'] . '/' . $upload->thumb_image))); } else { exit(json_encode(array('status' => 0, 'msg' => $upload->error))); } } } }
/** * cms设置保存 */ public function cms_manage_saveOp() { $model_setting = Model('setting'); $update_array = array(); $update_array['cms_isuse'] = intval($_POST['cms_isuse']); if (!empty($_FILES['cms_logo']['name'])) { $upload = new UploadFile(); $upload->set('default_dir', ATTACH_CMS); $result = $upload->upfile('cms_logo'); if (!$result) { showMessage($upload->error); } $update_array['cms_logo'] = $upload->file_name; $old_image = BASE_UPLOAD_PATH . DS . ATTACH_CMS . DS . C('microshop_logo'); if (is_file($old_image)) { unlink($old_image); } } $update_array['cms_submit_verify_flag'] = intval($_POST['cms_submit_verify_flag']); $update_array['cms_comment_flag'] = intval($_POST['cms_comment_flag']); $update_array['cms_attitude_flag'] = intval($_POST['cms_attitude_flag']); $update_array['taobao_api_isuse'] = intval($_POST['taobao_api_isuse']); $update_array['taobao_app_key'] = $_POST['taobao_app_key']; $update_array['taobao_secret_key'] = $_POST['taobao_secret_key']; $update_array['cms_seo_title'] = $_POST['cms_seo_title']; $update_array['cms_seo_keywords'] = $_POST['cms_seo_keywords']; $update_array['cms_seo_description'] = $_POST['cms_seo_description']; $result = $model_setting->updateSetting($update_array); if ($result === true) { $this->log(Language::get('cms_log_manage_save'), 0); showMessage(Language::get('nc_common_save_succ')); } else { $this->log(Language::get('cms_log_manage_save'), 0); showMessage(Language::get('nc_common_save_fail')); } }
/** * 上传图片 */ public function image_uploadOp() { $lang = Language::getLangContent(); if ($_GET['upload_type'] == 'uploadedfile') { if ($_POST['file_id'] != '') { $model_store_goods = Model('flea'); $drop_stata = $model_store_goods->dropImageGoods(array('upload_id' => intval($_POST['file_id']))); } /** * 实例化json模型 */ /** * 上传图片 */ $upload = new UploadFile(); $upload_dir = ATTACH_MALBUM . DS . $_SESSION['member_id'] . DS; $upload->set('default_dir', $upload_dir . $upload->getSysSetPath()); $thumb_width = '240,1024'; $thumb_height = '2048,1024'; $upload->set('max_size', C('image_max_filesize')); $upload->set('thumb_width', $thumb_width); $upload->set('thumb_height', $thumb_height); $upload->set('fprefix', $_SESSION['member_id']); $upload->set('thumb_ext', '_240,_1024'); $result = $upload->upfile('file'); if ($result) { $_POST['pic'] = $upload->getSysSetPath() . $upload->file_name; $_POST['pic_thumb'] = $upload->getSysSetPath() . $upload->thumb_image; } else { // echo json_encode(array('state'=>'false','message'=>$lang['iswfupload_upload_pic_fail'])); echo "<script type='text/javascript'>alert('" . $upload->error . "');history.back();</script>"; exit; } $img_path = $_POST['pic']; /** * 取得图像大小 */ list($width, $height, $type, $attr) = getimagesize(BASE_UPLOAD_PATH . DS . ATTACH_MALBUM . DS . $_SESSION['member_id'] . DS . $img_path); /** * 图片数据入库 */ $model_upload = Model('flea_upload'); $insert_array = array(); $image_type = array('goods_image' => 12, 'desc_image' => 13); //debug $insert_array['file_name'] = $_POST['pic']; $insert_array['file_thumb'] = $_POST['pic_thumb']; $insert_array['file_size'] = intval($_FILES['file']['size']); $insert_array['upload_time'] = time(); $insert_array['item_id'] = intval($_POST['item_id']); $insert_array['store_id'] = $_SESSION['member_id']; $insert_array['upload_type'] = $image_type['goods_image']; $result2 = $model_upload->add($insert_array); $data = array(); $data['file_id'] = $result2; $data['file_name'] = $_POST['pic_thumb']; $data['file_path'] = $_POST['pic_thumb']; $data['instance'] = 'goods_image'; $data['id'] = $_POST['id']; /** * 整理为json格式 */ $output = json_encode($data); echo "<script type='text/javascript'>window.parent.add_uploadedfile('" . $output . "');</script>"; } Tpl::showpage('flea_upload_image', 'null_layout'); }
public function reopen_uploadOp() { if (!chksubmit()) { exit; } $upload = new UploadFile(); $uploaddir = ATTACH_PATH . DS . 'store_joinin' . DS; $upload->set('default_dir', $uploaddir); $upload->set('allow_type', array('jpg', 'jpeg', 'gif', 'png')); if (!empty($_FILES['re_pay_cert']['tmp_name'])) { $result = $upload->upfile('re_pay_cert'); if ($result) { $pic_name = $upload->file_name; } } $data = array(); $data['re_pay_cert'] = $pic_name; $data['re_pay_cert_explain'] = $_POST['re_pay_cert_explain']; $data['re_state'] = 1; $model_store_reopen = Model('store_reopen'); $update = $model_store_reopen->editStoreReopen($data, array('re_id' => $_POST['re_id'], 're_state' => 0)); if ($update) { showDialog('上传成功,请等待系统审核', 'reload', 'succ'); } else { showDialog(Language::get('nc_common_del_fail')); } }
/** * 文章图片上传 */ public function article_image_uploadOp() { $data = array(); $data['status'] = 'success'; if (!empty($this->publisher_name)) { if (!empty($_FILES['article_image_upload']['name'])) { $upload = new UploadFile(); $upload->set('default_dir', ATTACH_CMS . DS . 'article' . DS . $this->attachment_path); $upload->set('thumb_width', '1024,240'); $upload->set('thumb_height', '50000,5000'); $upload->set('thumb_ext', '_max,_list'); $result = $upload->upfile('article_image_upload'); if (!$result) { $data['status'] = 'fail'; $data['error'] = '图片上传失败'; } $data['file_name'] = $upload->file_name; $data['origin_file_name'] = $_FILES['article_image_upload']['name']; $data['file_url'] = getCMSArticleImageUrl($this->attachment_path, $upload->file_name, 'max'); $data['file_path'] = $this->attachment_path; } } else { $data['status'] = 'fail'; $data['error'] = Language::get('no_login'); } self::echo_json($data); }
/** * ajax图片上传 */ public function image_uploadOp() { $ap_id = intval($_POST['apid']); /** * 相册 */ $model = Model(); $default_class = $model->table('sns_albumclass')->where(array('member_id' => $_SESSION['member_id'], 'is_default' => 1))->find(); if (empty($default_class)) { // 验证时候存在买家秀相册,不存在添加。 $default_class = array(); $default_class['ac_name'] = Language::get('sns_buyershow'); $default_class['member_id'] = $this->master_id; $default_class['ac_des'] = Language::get('sns_buyershow_album_des'); $default_class['ac_sort'] = '255'; $default_class['is_default'] = 1; $default_class['upload_time'] = time(); $default_class['ac_id'] = $model->table('sns_albumclass')->insert($default_class); } // 验证图片数量 $count = $model->table('sns_albumpic')->where(array('member_id' => $_SESSION['member_id']))->count(); if (C('malbum_max_sum') != 0 && $count >= C('malbum_max_sum')) { $output = array(); $output['error'] = Language::get('sns_upload_img_max_num_error'); $output = json_encode($output); echo $output; die; } /** * 上传图片 */ $upload = new UploadFile(); if ($ap_id > 0) { $pic_info = $model->table('sns_albumpic')->find($ap_id); if (!empty($pic_info)) { $upload->set('file_name', $pic_info['ap_cover']); } // 原图存在设置图片名称为原图名称 } $upload_dir = ATTACH_MALBUM . DS . $_SESSION['member_id'] . DS; $upload->set('default_dir', $upload_dir . $upload->getSysSetPath()); $thumb_width = '240,1024'; $thumb_height = '2048,1024'; $upload->set('max_size', C('image_max_filesize')); $upload->set('thumb_width', $thumb_width); $upload->set('thumb_height', $thumb_height); $upload->set('fprefix', $_SESSION['member_id']); $upload->set('thumb_ext', '_240,_1024'); $result = $upload->upfile(trim($_POST['id'])); if (!$result) { if (strtoupper(CHARSET) == 'GBK') { $upload->error = Language::getUTF8($upload->error); } $output = array(); $output['error'] = $upload->error; $output = json_encode($output); echo $output; die; } if ($ap_id <= 0) { // 如果原图存在,则不需要在插入数据库 $img_path = $upload->getSysSetPath() . $upload->file_name; list($width, $height, $type, $attr) = getimagesize(BASE_UPLOAD_PATH . DS . ATTACH_MALBUM . DS . $_SESSION['member_id'] . DS . $img_path); $image = explode('.', $_FILES[trim($_POST['id'])]["name"]); if (strtoupper(CHARSET) == 'GBK') { $image['0'] = Language::getGBK($image['0']); } $insert = array(); $insert['ap_name'] = $image['0']; $insert['ac_id'] = $default_class['ac_id']; $insert['ap_cover'] = $img_path; $insert['ap_size'] = intval($_FILES[trim($_POST['id'])]['size']); $insert['ap_spec'] = $width . 'x' . $height; $insert['upload_time'] = time(); $insert['member_id'] = $_SESSION['member_id']; $insert['ap_type'] = 1; $insert['item_id'] = intval($_POST['sid']); $result = $model->table('sns_albumpic')->insert($insert); } $data = array(); $data['file_name'] = $ap_id > 0 ? $pic_info['ap_cover'] : $upload->getSysSetPath() . $upload->thumb_image; $data['file_id'] = $ap_id > 0 ? $pic_info['ap_id'] : $result; /** * 整理为json格式 */ $output = json_encode($data); echo $output; die; }
/** * 编辑 */ public function goods_class_editOp() { $lang = Language::getLangContent(); $model_class = Model('goods_class'); if (chksubmit()) { $obj_validate = new Validate(); $obj_validate->validateparam = array(array("input" => $_POST["gc_name"], "require" => "true", "message" => $lang['goods_class_add_name_null']), array("input" => $_POST["commis_rate"], "require" => "true", 'validator' => 'range', 'max' => 100, 'min' => 0, "message" => $lang['goods_class_add_commis_rate_error']), array("input" => $_POST["gc_sort"], "require" => "true", 'validator' => 'Number', "message" => $lang['goods_class_add_sort_int'])); $error = $obj_validate->validate(); if ($error != '') { showMessage($error); } // 更新分类信息 $where = array('gc_id' => intval($_POST['gc_id'])); $update_array = array(); $update_array['gc_name'] = $_POST['gc_name']; $update_array['type_id'] = intval($_POST['t_id']); $update_array['type_name'] = trim($_POST['t_name']); $update_array['commis_rate'] = intval($_POST['commis_rate']); $update_array['gc_sort'] = intval($_POST['gc_sort']); $update_array['gc_virtual'] = intval($_POST['gc_virtual']); $result = $model_class->editGoodsClass($update_array, $where); if (!$result) { $this->log(L('nc_edit,goods_class_index_class') . '[' . $_POST['gc_name'] . ']', 0); showMessage($lang['goods_class_batch_edit_fail']); } if (!empty($_FILES['pic']['name'])) { //上传图片 $upload = new UploadFile(); $upload->set('default_dir', ATTACH_COMMON); $upload->set('file_name', 'category-pic-' . intval($_POST['gc_id']) . '.jpg'); $upload->upfile('pic'); } // 检测是否需要关联自己操作,统一查询子分类 if ($_POST['t_commis_rate'] == '1' || $_POST['t_associated'] == '1' || $_POST['t_gc_virtual'] == '1') { $gc_id_list = $model_class->getChildClass($_POST['gc_id']); $gc_ids = array(); if (is_array($gc_id_list) && !empty($gc_id_list)) { foreach ($gc_id_list as $val) { $gc_ids[] = $val['gc_id']; } } } // 更新该分类下子分类的所有分佣比例 if ($_POST['t_commis_rate'] == '1' && !empty($gc_ids)) { $model_class->editGoodsClass(array('commis_rate' => $update_array['commis_rate']), array('gc_id' => array('in', $gc_ids))); } // 更新该分类下子分类的所有类型 if ($_POST['t_associated'] == '1' && !empty($gc_ids)) { $where = array(); $where['gc_id'] = array('in', $gc_ids); $update = array(); $update['type_id'] = intval($_POST['t_id']); $update['type_name'] = trim($_POST['t_name']); $model_class->editGoodsClass($update, $where); } // 虚拟商品 if ($_POST['t_gc_virtual'] == '1' && !empty($gc_ids)) { $model_class->editGoodsClass(array('gc_virtual' => $update_array['gc_virtual']), array('gc_id' => array('in', $gc_ids))); } $url = array(array('url' => 'index.php?act=goods_class&op=goods_class_edit&gc_id=' . intval($_POST['gc_id']), 'msg' => $lang['goods_class_batch_edit_again']), array('url' => 'index.php?act=goods_class&op=goods_class', 'msg' => $lang['goods_class_add_back_to_list'])); $this->log(L('nc_edit,goods_class_index_class') . '[' . $_POST['gc_name'] . ']', 1); showMessage($lang['goods_class_batch_edit_ok'], $url, 'html', 'succ', 1, 5000); } $class_array = $model_class->getGoodsClassInfoById(intval($_GET['gc_id'])); if (empty($class_array)) { showMessage($lang['goods_class_batch_edit_paramerror']); } //类型列表 $model_type = Model('type'); $type_list = $model_type->typeList(array('order' => 'type_sort asc'), '', 'type_id,type_name,class_id,class_name'); $t_list = array(); if (is_array($type_list) && !empty($type_list)) { foreach ($type_list as $k => $val) { $t_list[$val['class_id']]['type'][$k] = $val; $t_list[$val['class_id']]['name'] = $val['class_name'] == '' ? L('nc_default') : $val['class_name']; } } ksort($t_list); //父类列表,只取到第二级 $parent_list = $model_class->getTreeClassList(2); if (is_array($parent_list)) { foreach ($parent_list as $k => $v) { $parent_list[$k]['gc_name'] = str_repeat(" ", $v['deep'] * 2) . $v['gc_name']; } } Tpl::output('parent_list', $parent_list); // 一级分类列表 $gc_list = Model('goods_class')->getGoodsClassListByParentId(0); Tpl::output('gc_list', $gc_list); $pic_name = BASE_UPLOAD_PATH . '/' . ATTACH_COMMON . '/category-pic-' . $class_array['gc_id'] . '.jpg'; if (file_exists($pic_name)) { $class_array['pic'] = UPLOAD_SITE_URL . '/' . ATTACH_COMMON . '/category-pic-' . $class_array['gc_id'] . '.jpg'; } Tpl::output('type_list', $t_list); Tpl::output('class_array', $class_array); $this->links[] = array('url' => 'act=goods_class&op=goods_class_edit', 'lang' => 'nc_edit'); Tpl::output('top_link', $this->sublink($this->links, 'goods_class_edit')); Tpl::showpage('goods_class.edit'); }
/** * 品牌编辑 */ public function brand_editOp() { $lang = Language::getLangContent(); $model_brand = Model('brand'); if ($_POST['form_submit'] == 'ok') { /** * 验证 */ $obj_validate = new Validate(); $obj_validate->validateparam = array(array("input" => $_POST["brand_name"], "require" => "true", "message" => $lang['brand_add_name_null']), array("input" => $_POST["brand_sort"], "require" => "true", 'validator' => 'Number', "message" => $lang['brand_add_sort_int'])); $error = $obj_validate->validate(); if ($error != '') { showMessage($error); } else { /** * 上传图片 */ $upload = new UploadFile(); $upload->set('default_dir', ATTACH_BRAND); /** * 默认商品图片 */ if (!empty($_FILES['brand_pic']['name'])) { $result = $upload->upfile('brand_pic'); if ($result) { $_POST['brand_pic'] = $upload->file_name; } else { showMessage($upload->error, '', '', 'error'); } } $update_array = array(); $update_array['brand_id'] = intval($_POST['brand_id']); $update_array['brand_name'] = trim($_POST['brand_name']); $update_array['brand_class'] = trim($_POST['brand_class']); if (!empty($_POST['brand_pic'])) { $update_array['brand_pic'] = $_POST['brand_pic']; } $update_array['brand_recommend'] = intval($_POST['brand_recommend']); $update_array['brand_sort'] = intval($_POST['brand_sort']); $result = $model_brand->update($update_array); if ($result) { /** * 删除老图片 */ if (!empty($_POST['brand_pic']) && !empty($_POST['old_brand_pic'])) { @unlink(BasePath . DS . ATTACH_BRAND . DS . $_POST['old_brand_pic']); } $url = array(array('url' => 'index.php?act=brand&op=brand_edit&brand_id=' . intval($_POST['brand_id']), 'msg' => $lang['brand_edit_again']), array('url' => 'index.php?act=brand&op=brand', 'msg' => $lang['brand_add_back_to_list'])); showMessage($lang['brand_edit_succ'], $url); } else { showMessage($lang['brand_edit_fail']); } } } $brand_array = $model_brand->getOneBrand(intval($_GET['brand_id'])); if (empty($brand_array)) { showMessage($lang['wrong_argument']); } Tpl::output('brand_array', $brand_array); Tpl::showpage('brand.edit'); }
private function upload_image($file) { $pic_name = ''; $upload = new UploadFile(); $uploaddir = ATTACH_PATH . DS . 'store_joinin' . DS; $upload->set('default_dir', $uploaddir); $upload->set('allow_type', array('jpg', 'jpeg', 'gif', 'png')); if (!empty($_FILES[$file]['name'])) { $result = $upload->upfile($file); if ($result) { $pic_name = $upload->file_name; $upload->file_name = ''; } } return $pic_name; }
/** * 店铺幻灯片ajax上传 */ public function silde_image_uploadOp() { $upload = new UploadFile(); $upload->set('default_dir', ATTACH_SLIDE); $upload->set('max_size', C('image_max_filesize')); $result = $upload->upfile($_POST['id']); $output = array(); if (!$result) { /** * 转码 */ if (strtoupper(CHARSET) == 'GBK') { $upload->error = Language::getUTF8($upload->error); } $output['error'] = $upload->error; echo json_encode($output); die; } $img_path = $upload->file_name; /** * 模型实例化 */ $model_upload = Model('upload'); if (intval($_POST['file_id']) > 0) { $file_info = $model_upload->getOneUpload($_POST['file_id']); @unlink(BASE_UPLOAD_PATH . DS . ATTACH_SLIDE . DS . $file_info['file_name']); $update_array = array(); $update_array['upload_id'] = intval($_POST['file_id']); $update_array['file_name'] = $img_path; $update_array['file_size'] = $_FILES[$_POST['id']]['size']; $model_upload->update($update_array); $output['file_id'] = intval($_POST['file_id']); $output['id'] = $_POST['id']; $output['file_name'] = $img_path; echo json_encode($output); die; } else { /** * 图片数据入库 */ $insert_array = array(); $insert_array['file_name'] = $img_path; $insert_array['upload_type'] = '3'; $insert_array['file_size'] = $_FILES[$_POST['id']]['size']; $insert_array['item_id'] = $_SESSION['store_id']; $insert_array['upload_time'] = time(); $result = $model_upload->add($insert_array); if (!$result) { @unlink(BASE_UPLOAD_PATH . DS . ATTACH_SLIDE . DS . $img_path); $output['error'] = Language::get('store_slide_upload_fail', 'UTF-8'); echo json_encode($output); die; } $output['file_id'] = $result; $output['id'] = $_POST['id']; $output['file_name'] = $img_path; echo json_encode($output); die; } }
private function _image_upload($file) { $data = array(); $data['result'] = true; if (!empty($_FILES[$file]['name'])) { $upload = new UploadFile(); $uploaddir = ATTACH_PATH . DS . 'groupbuy' . DS . $_SESSION['store_id'] . DS; $upload->set('default_dir', $uploaddir); $upload->set('thumb_width', '480,296,168'); $upload->set('thumb_height', '480,296,168'); $upload->set('thumb_ext', '_max,_mid,_small'); $upload->set('fprefix', $_SESSION['store_id']); $result = $upload->upfile($file); if ($result) { $data['file_name'] = $upload->file_name; $data['origin_file_name'] = $_FILES[$file]['name']; $data['file_url'] = gthumb($upload->file_name, 'mid'); } else { $data['result'] = false; $data['message'] = $upload->error; } } else { $data['result'] = false; } echo json_encode($data); die; }
/** * 编辑 */ public function mb_ad_editOp() { $model_mb_ad = Model('mb_ad'); if ($_POST['form_submit'] == 'ok') { /** * 验证 */ $obj_validate = new Validate(); $obj_validate->validateparam = array(array("input" => $_POST["link_title"], "require" => "true", "message" => L('link_add_title_null')), array("input" => $_POST["link_url"], "require" => "true", "message" => L('link_add_url_wrong')), array("input" => $_POST["link_sort"], "require" => "true", 'validator' => 'Number', "message" => L('link_add_sort_int'))); $error = $obj_validate->validate(); if ($error != '') { showMessage($error); } else { /** * 上传图片 */ if ($_FILES['link_pic']['name'] != '') { $upload = new UploadFile(); $upload->set('default_dir', ATTACH_MOBILE . '/ad'); $result = $upload->upfile('link_pic'); if ($result) { $_POST['link_pic'] = $upload->file_name; } else { showMessage($upload->error); } } $link_array = $model_mb_ad->getMbAdInfoByID(intval($_POST['link_id'])); $update_array = array(); $update_array['link_title'] = trim($_POST['link_title']); $update_array['link_keyword'] = trim($_POST['link_keyword']); if ($_POST['link_pic']) { $update_array['link_pic'] = $_POST['link_pic']; } $update_array['link_sort'] = trim($_POST['link_sort']); $result = $model_mb_ad->editMbAd($update_array, array('link_id' => intval($_POST['link_id']))); if ($result) { //删除图片 if (!empty($_POST['link_pic']) && !empty($link_array['link_pic'])) { @unlink(BASE_ROOT_PATH . DS . DIR_UPLOAD . DS . ATTACH_MOBILE . '/ad' . DS . $link_array['link_pic']); } $url = array(array('url' => 'index.php?act=mb_ad&op=mb_ad_list', 'msg' => L('link_add_back_to_list'))); showMessage(L('link_edit_succ'), $url); } else { showMessage(L('link_edit_fail')); } } } $link_array = $model_mb_ad->getMbAdInfoByID(intval($_GET['link_id'])); if (empty($link_array)) { showMessage(L('wrong_argument')); } Tpl::output('link_array', $link_array); Tpl::showpage('mb_ad.edit'); }
/** * 图片上传 */ public function decoration_album_uploadOp() { $store_id = $_SESSION['store_id']; $data = array(); //判断装修相册数量限制,预设100 if ($this->store_info['store_decoration_image_count'] > 100) { $data['error'] = '相册已满,请首先删除无用图片'; echo json_encode($data); die; } //上传图片 $upload = new UploadFile(); $upload->set('default_dir', ATTACH_STORE_DECORATION . DS . $store_id); $upload->set('max_size', C('image_max_filesize')); $upload->set('fprefix', $store_id); $result_file = $upload->upfile('file'); if ($result_file) { $image = $upload->file_name; } else { $error = $upload->error; $data['error'] = $error; echo json_encode($data); die; } //图片尺寸 list($width, $height) = getimagesize(BASE_UPLOAD_PATH . DS . ATTACH_STORE_DECORATION . DS . $store_id . DS . $image); //图片原始名称 $image_origin_name_array = explode('.', $_FILES["file"]["name"]); //插入相册表 $param = array(); $param['image_name'] = $image; $param['image_origin_name'] = $image_origin_name_array['0']; $param['image_width'] = $width; $param['image_height'] = $height; $param['image_size'] = intval($_FILES['file']['size']); $param['store_id'] = $store_id; $param['upload_time'] = TIMESTAMP; $result = Model('store_decoration_album')->addStoreDecorationAlbum($param); if ($result) { //装修相册计数加1 Model('store')->editStore(array('store_decoration_image_count' => array('exp', 'store_decoration_image_count+1')), array('store_id' => $_SESSION['store_id'])); $data['image_name'] = $image; $data['image_url'] = getStoreDecorationImageUrl($image, $store_id); } else { $data['error'] = '上传失败'; } echo json_encode($data); die; }
/** * 上传图片 * * @param * @return */ public function swfuploadOp() { /** * 读取语言包 */ Language::read('sns_home'); $lang = Language::getLangContent(); $member_id = $_SESSION['member_id']; $class_id = intval($_POST['category_id']); if ($member_id <= 0 && $class_id <= 0) { echo json_encode(array('state' => 'false', 'message' => Language::get('sns_upload_pic_fail'), 'origin_file_name' => $_FILES["file"]["name"])); exit; } $model = Model(); // 验证图片数量 $count = $model->table('sns_albumpic')->where(array('member_id' => $member_id))->count(); if (C('malbum_max_sum') != 0 && $count >= C('malbum_max_sum')) { echo json_encode(array('state' => 'false', 'message' => Language::get('sns_upload_img_max_num_error'), 'origin_file_name' => $_FILES["file"]["name"])); exit; } /** * 上传图片 */ $upload = new UploadFile(); $upload_dir = ATTACH_MALBUM . DS . $member_id . DS; $upload->set('default_dir', $upload_dir . $upload->getSysSetPath()); $thumb_width = '240,1024'; $thumb_height = '2048,1024'; $upload->set('max_size', C('image_max_filesize')); $upload->set('thumb_width', $thumb_width); $upload->set('thumb_height', $thumb_height); $upload->set('fprefix', $member_id); $upload->set('thumb_ext', '_240,_1024'); $result = $upload->upfile('file'); if (!$result) { echo json_encode(array('state' => 'false', 'message' => Language::get('sns_upload_pic_fail'), 'origin_file_name' => $_FILES["file"]["name"])); exit; } $img_path = $upload->getSysSetPath() . $upload->file_name; list($width, $height, $type, $attr) = getimagesize(BASE_UPLOAD_PATH . DS . ATTACH_MALBUM . DS . $member_id . DS . $img_path); $image = explode('.', $_FILES["file"]["name"]); if (strtoupper(CHARSET) == 'GBK') { $image['0'] = Language::getGBK($image['0']); } $insert = array(); $insert['ap_name'] = $image['0']; $insert['ac_id'] = $class_id; $insert['ap_cover'] = $img_path; $insert['ap_size'] = intval($_FILES['file']['size']); $insert['ap_spec'] = $width . 'x' . $height; $insert['upload_time'] = time(); $insert['member_id'] = $member_id; $result = $model->table('sns_albumpic')->insert($insert); $data = array(); $data['file_id'] = $result; $data['file_name'] = $img_path; $data['origin_file_name'] = $_FILES["file"]["name"]; $data['file_path'] = $img_path; $data['file_url'] = snsThumb($img_path, 240); $data['state'] = 'true'; /** * 整理为json格式 */ $output = json_encode($data); echo $output; }
/** * 个人秀图片上传 **/ public function personal_image_uploadOp() { $data = array(); $data['status'] = 'success'; if (isset($_SESSION['member_id'])) { if (!empty($_FILES['personal_image_ajax']['name'])) { $upload = new UploadFile(); $upload->set('default_dir', ATTACH_MICROSHOP . DS . $_SESSION['member_id']); $upload->set('thumb_width', '60,240'); $upload->set('thumb_height', '5000,50000'); $upload->set('thumb_ext', '_tiny,_list'); $result = $upload->upfile('personal_image_ajax'); if (!$result) { $data['status'] = 'fail'; $data['error'] = $upload->error; } $data['file'] = $upload->file_name; } } else { $data['status'] = 'fail'; $data['error'] = Language::get('no_login'); } self::echo_json($data); }
/** * * 修改广告 */ public function adv_editOp() { if ($_POST['form_submit'] != 'ok') { $adv = Model('adv'); $condition['adv_id'] = intval($_GET['adv_id']); $adv_list = $adv->getList($condition); $ap_info = $adv->getApList(); Tpl::output('ref_url', getReferer()); Tpl::output('adv_list', $adv_list); Tpl::output('ap_info', $ap_info); Tpl::showpage('adv.edit'); } else { $lang = Language::getLangContent(); $adv = Model('adv'); $upload = new UploadFile(); /** * 验证 */ $obj_validate = new Validate(); $obj_validate->validateparam = array(array("input" => $_POST["adv_name"], "require" => "true", "message" => $lang['ap_can_not_null']), array("input" => $_POST["adv_start_date"], "require" => "true", "message" => $lang['must_select_start_time']), array("input" => $_POST["adv_end_date"], "require" => "true", "message" => $lang['must_select_end_time'])); $error = $obj_validate->validate(); if ($error != '') { showMessage($error); } else { $param['adv_id'] = intval($_GET['adv_id']); $param['adv_title'] = trim($_POST['adv_name']); $param['adv_start_date'] = $this->getunixtime(trim($_POST['adv_start_date'])); $param['adv_end_date'] = $this->getunixtime(trim($_POST['adv_end_date'])); /** * 建立图片广告信息的入库数组 */ if ($_POST['mark'] == '0') { if ($_FILES['adv_pic']['name'] != '') { $upload->set('default_dir', ATTACH_ADV); $result = $upload->upfile('adv_pic'); if (!$result) { showMessage($upload->error, '', '', 'error'); } $ac = array('adv_pic' => $upload->file_name, 'adv_pic_url' => trim($_POST['adv_pic_url'])); $ac = serialize($ac); $param['adv_content'] = $ac; } else { $ac = array('adv_pic' => trim($_POST['pic_ori']), 'adv_pic_url' => trim($_POST['adv_pic_url'])); $ac = serialize($ac); $param['adv_content'] = $ac; } } /** * 建立文字广告信息的入库数组 */ if ($_POST['mark'] == '1') { //判断页面编码确定汉字所占字节数 switch (CHARSET) { case 'UTF-8': $charrate = 3; break; case 'GBK': $charrate = 2; break; } if (strlen($_POST['adv_word']) > $_POST['adv_word_len'] * $charrate) { $error = $lang['wordadv_toolong']; showMessage($error); die; } $ac = array('adv_word' => trim($_POST['adv_word']), 'adv_word_url' => trim($_POST['adv_word_url'])); $ac = serialize($ac); $param['adv_content'] = $ac; } /** * 建立Flash广告信息的入库数组 */ if ($_POST['mark'] == '3') { if ($_FILES['flash_swf']['name'] != '') { $upload->set('default_dir', ATTACH_ADV); $result = $upload->upfile('flash_swf'); $ac = array('flash_swf' => $upload->file_name, 'flash_url' => trim($_POST['flash_url'])); $ac = serialize($ac); $param['adv_content'] = $ac; } else { $ac = array('flash_swf' => trim($_POST['flash_ori']), 'flash_url' => trim($_POST['flash_url'])); $ac = serialize($ac); $param['adv_content'] = $ac; } } $result = $adv->update($param); if ($result) { $url = array(array('url' => trim($_POST['ref_url']), 'msg' => $lang['goback_ap_manage'])); $this->log(L('adv_change_succ') . '[' . $_POST["ap_name"] . ']', null); showMessage($lang['adv_change_succ'], $url); } else { showMessage($lang['adv_change_fail'], $url); } } } }
public function uploadOp() { if (!chksubmit()) { redirect('index.php?act=home&op=avatar'); } import('function.thumb'); Language::read('member_home_member,cut'); $lang = Language::getLangContent(); $member_id = $_SESSION['member_id']; //上传图片 $upload = new UploadFile(); $upload->set('thumb_width', 500); $upload->set('thumb_height', 499); $ext = strtolower(pathinfo($_FILES['pic']['name'], PATHINFO_EXTENSION)); $upload->set('file_name', "avatar_{$member_id}.{$ext}"); $upload->set('thumb_ext', '_new'); $upload->set('ifremove', true); $upload->set('default_dir', ATTACH_AVATAR); if (!empty($_FILES['pic']['tmp_name'])) { $result = $upload->upfile('pic'); if (!$result) { showMessage($upload->error, '', 'html', 'error'); } } else { showMessage('upload failed', '', 'html', 'error'); } self::profile_menu('member', 'avatar'); Tpl::output('menu_sign', 'profile'); Tpl::output('menu_sign_url', 'index.php?act=member&op=home'); Tpl::output('menu_sign1', 'avatar'); Tpl::output('newfile', $upload->thumb_image); Tpl::output('height', get_height(BASE_UPLOAD_PATH . '/' . ATTACH_AVATAR . '/' . $upload->thumb_image)); Tpl::output('width', get_width(BASE_UPLOAD_PATH . '/' . ATTACH_AVATAR . '/' . $upload->thumb_image)); Tpl::setLayout('member_pub_layout'); Tpl::showpage('member_profile.avatar'); }
/** * 首页图片上传 */ public function image_uploadOp() { $data = array(); $data['status'] = 'success'; if (!empty($_FILES['image_upload']['name'])) { $upload = new UploadFile(); $upload->set('default_dir', ATTACH_CMS . DS . 'index'); $result = $upload->upfile('image_upload'); if (!$result) { $data['status'] = 'fail'; $data['error'] = $upload->error; } $data['file_name'] = $upload->file_name; $data['file_url'] = getCMSIndexImageUrl($upload->file_name); } if (strtoupper(CHARSET) == 'GBK') { $data = Language::getUTF8($data); //网站GBK使用编码时,转换为UTF-8,防止json输出汉字问题 } echo json_encode($data); }
/** * 单位图片上传 */ public function company_pic_uploadOp() { /** * 上传图片 */ $upload = new UploadFile(); $upload->set('default_dir', ATTACH_COMPANY); $result = $upload->upfile('fileupload'); if ($result) { $_POST['pic'] = $upload->file_name; } else { echo 'error'; exit; } /** * 模型实例化 */ $model_upload = Model('upload'); /** * 图片数据入库 */ $insert_array = array(); $insert_array['file_name'] = $_POST['pic']; $insert_array['upload_type'] = '7'; $insert_array['file_size'] = $_FILES['fileupload']['size']; $insert_array['upload_time'] = time(); $insert_array['item_id'] = intval($_POST['item_id']); $result = $model_upload->add($insert_array); if ($result) { $data = array(); $data['file_id'] = $result; $data['file_name'] = $_POST['pic']; $data['file_path'] = $_POST['pic']; /** * 整理为json格式 */ $output = json_encode($data); echo $output; } }
/** * 附件批量上传 话题 */ public function image_uploadOp() { $data['msg'] = 'error'; $data['origin_file_name'] = $_FILES['test_file']['name']; // 验证已上传附件数量 最大10个 $where = array(); $where['member_id'] = $_SESSION['member_id']; if ($_GET['type'] == 'reply') { $where['affix_type'] = 2; $where['reply_id'] = 0; } else { $where['affix_type'] = 1; $where['theme_id'] = 0; } $count = Model()->table('circle_affix')->where($where)->count(); if ($count < 10) { $partpath = themePartPath($_SESSION['member_id']); $upload = new UploadFile(); $upload->set('default_dir', ATTACH_CIRCLE . '/theme/' . $partpath); $upload->set('thumb_width', 1024); $upload->set('thumb_height', 160); $upload->set('thumb_ext', '_160x160'); $result = $upload->upfile('test_file'); // 暂时的名字 if ($result) { $insert = array(); $insert['affix_filename'] = $partpath . '/' . $upload->file_name; $insert['affix_filethumb'] = $partpath . '/' . $upload->thumb_image; $insert['affix_filesize'] = intval($_FILES['test_file']['size']); $insert['affix_addtime'] = time(); $insert['affix_type'] = $_GET['type'] == 'reply' ? 2 : 1; $insert['member_id'] = $_SESSION['member_id']; $insert['theme_id'] = $this->t_id; $insert['reply_id'] = 0; $insert['circle_id'] = $this->c_id; $id = Model()->table('circle_affix')->insert($insert); if ($id) { $data['msg'] = 'success'; $data['file_id'] = $id; $data['file_name'] = $upload->file_name; $data['file_url'] = themeImageUrl($partpath . '/' . $upload->thumb_image); $data['file_insert'] = themeImageUrl($partpath . '/' . $upload->file_name); } } } echo json_encode($data); exit; }
private function upload_pic() { $complain_pic = array(); $complain_pic[1] = 'input_complain_pic1'; $complain_pic[2] = 'input_complain_pic2'; $complain_pic[3] = 'input_complain_pic3'; $pic_name = array(); $upload = new UploadFile(); $uploaddir = ATTACH_PATH . DS . 'complain' . DS; $upload->set('default_dir', $uploaddir); $upload->set('allow_type', array('jpg', 'jpeg', 'gif', 'png')); $count = 1; foreach ($complain_pic as $pic) { if (!empty($_FILES[$pic]['name'])) { $result = $upload->upfile($pic); if ($result) { $pic_name[$count] = $upload->file_name; $upload->file_name = ''; } else { $pic_name[$count] = ''; } } $count++; } return $pic_name; }
/** * 上传图片 */ public function upload_picOp() { $data = array(); if (!empty($_FILES['fileupload']['name'])) { //上传图片 $fprefix = 'help_store'; $upload = new UploadFile(); $upload->set('default_dir', ATTACH_ARTICLE); $upload->set('fprefix', $fprefix); $upload->upfile('fileupload'); $model_upload = Model('upload'); $file_name = $upload->file_name; $insert_array = array(); $insert_array['file_name'] = $file_name; $insert_array['file_size'] = $_FILES['fileupload']['size']; $insert_array['upload_time'] = time(); $insert_array['item_id'] = intval($_GET['item_id']); $insert_array['upload_type'] = '2'; $result = $model_upload->add($insert_array); if ($result) { $data['file_id'] = $result; $data['file_name'] = $file_name; } } echo json_encode($data); exit; }
/** * 基本信息 */ public function baseOp() { $model_setting = Model('setting'); if (chksubmit()) { //上传网站Logo if (!empty($_FILES['site_logo']['name'])) { $upload = new UploadFile(); $upload->set('default_dir', ATTACH_COMMON); $result = $upload->upfile('site_logo'); if ($result) { $_POST['site_logo'] = $upload->file_name; } else { showMessage($upload->error, '', '', 'error'); } } //V3-B11 上传wap手机客户端LOGO if (!empty($_FILES['site_mobile_logo']['name'])) { $upload = new UploadFile(); $upload->set('default_dir', ATTACH_COMMON); $upload->file_name = 'home_logo.png'; $result = $upload->upfile('site_mobile_logo'); if ($result) { $_POST['site_mobile_logo'] = $upload->file_name; } else { showMessage($upload->error, '', '', 'error'); } } //二维码微信图片 by 33 HA O.com if (!empty($_FILES['site_logowx']['name'])) { $upload = new UploadFile(); $upload->set('default_dir', ATTACH_COMMON); $result = $upload->upfile('site_logowx'); if ($result) { $_POST['site_logowx'] = $upload->file_name; } else { showMessage($upload->error, '', '', 'error'); } } if (!empty($_FILES['member_logo']['name'])) { $upload = new UploadFile(); $upload->set('default_dir', ATTACH_COMMON); $result = $upload->upfile('member_logo'); if ($result) { $_POST['member_logo'] = $upload->file_name; } else { showMessage($upload->error, '', '', 'error'); } } if (!empty($_FILES['seller_center_logo']['name'])) { $upload = new UploadFile(); $upload->set('default_dir', ATTACH_COMMON); $result = $upload->upfile('seller_center_logo'); if ($result) { $_POST['seller_center_logo'] = $upload->file_name; } else { showMessage($upload->error, '', '', 'error'); } } $list_setting = $model_setting->getListSetting(); $update_array = array(); $update_array['time_zone'] = $this->setTimeZone($_POST['time_zone']); $update_array['site_name'] = $_POST['site_name']; $update_array['site_phone'] = $_POST['site_phone']; $update_array['site_bank_account'] = $_POST['site_bank_account']; $update_array['site_email'] = $_POST['site_email']; $update_array['statistics_code'] = $_POST['statistics_code']; if (!empty($_POST['site_logo'])) { $update_array['site_logo'] = $_POST['site_logo']; } // V3-B11 if (!empty($_POST['site_mobile_logo'])) { $update_array['site_mobile_logo'] = $_POST['site_mobile_logo']; } if (!empty($_POST['site_logowx'])) { $update_array['site_logowx'] = $_POST['site_logowx']; } if (!empty($_POST['member_logo'])) { $update_array['member_logo'] = $_POST['member_logo']; } if (!empty($_POST['seller_center_logo'])) { $update_array['seller_center_logo'] = $_POST['seller_center_logo']; } $update_array['icp_number'] = $_POST['icp_number']; //设置表 400电话 by 33hao.com $update_array['site_tel400'] = $_POST['site_tel400']; $update_array['site_status'] = $_POST['site_status']; $update_array['closed_reason'] = $_POST['closed_reason']; $result = $model_setting->updateSetting($update_array); if ($result === true) { //判断有没有之前的图片,如果有则删除 if (!empty($list_setting['site_logo']) && !empty($_POST['site_logo'])) { @unlink(BASE_UPLOAD_PATH . DS . ATTACH_COMMON . DS . $list_setting['site_logo']); } if (!empty($list_setting['site_logowx']) && !empty($_POST['site_logowx'])) { @unlink(BASE_UPLOAD_PATH . DS . ATTACH_COMMON . DS . $list_setting['site_logowx']); } if (!empty($list_setting['member_logo']) && !empty($_POST['member_logo'])) { @unlink(BASE_UPLOAD_PATH . DS . ATTACH_COMMON . DS . $list_setting['member_logo']); } if (!empty($list_setting['seller_center_logo']) && !empty($_POST['seller_center_logo'])) { @unlink(BASE_UPLOAD_PATH . DS . ATTACH_COMMON . DS . $list_setting['seller_center_logo']); } $this->log(L('nc_edit,web_set'), 1); showMessage(L('nc_common_save_succ')); } else { $this->log(L('nc_edit,web_set'), 0); showMessage(L('nc_common_save_fail')); } } $list_setting = $model_setting->getListSetting(); foreach ($this->getTimeZone() as $k => $v) { if ($v == $list_setting['time_zone']) { $list_setting['time_zone'] = $k; break; } } Tpl::output('list_setting', $list_setting); //输出子菜单 Tpl::output('top_link', $this->sublink($this->links, 'base')); Tpl::showpage('setting.base'); }
public function appeal_saveOp() { $complain_id = intval($_POST['input_complain_id']); //获取投诉详细信息 $complain_info = $this->get_complain_info($complain_id); //检查当前是不是投诉状态 if (intval($complain_info['complain_state']) !== self::STATE_APPEAL) { showDialog(Language::get('para_error'), 'reload'); } $input = array(); $input['appeal_message'] = trim($_POST['input_appeal_message']); //验证输入的信息 $obj_validate = new Validate(); $obj_validate->validateparam = array(array("input" => $input['appeal_message'], "require" => "true", "validator" => "Length", "min" => "1", "max" => "255", "message" => Language::get('appeal_message_error'))); $error = $obj_validate->validate(); if ($error != '') { showValidateError($error); } //上传图片 $appeal_pic = array(); $appeal_pic[1] = 'input_appeal_pic1'; $appeal_pic[2] = 'input_appeal_pic2'; $appeal_pic[3] = 'input_appeal_pic3'; $pic_name = array(); $upload = new UploadFile(); $uploaddir = ATTACH_PATH . DS . 'complain' . DS; $upload->set('default_dir', $uploaddir); $upload->set('allow_type', array('jpg', 'jpeg', 'gif', 'png')); $count = 1; foreach ($appeal_pic as $pic) { if (!empty($_FILES[$pic]['name'])) { $result = $upload->upfile($pic); if ($result) { $pic_name[$count] = $upload->file_name; $upload->file_name = ''; } else { $pic_name[$count] = ''; } } $count++; } $input['appeal_pic1'] = $pic_name[1]; $input['appeal_pic2'] = $pic_name[2]; $input['appeal_pic3'] = $pic_name[3]; $input['appeal_datetime'] = time(); $input['complain_state'] = self::STATE_TALK; $where_array = array(); $where_array['complain_id'] = $complain_id; //保存申诉信息 $model_complain = Model('complain'); $complain_id = $model_complain->updateComplain($input, $where_array); $this->recordSellerLog('投诉申诉处理,投诉编号:' . $complain_id); showDialog(Language::get('appeal_submit_success'), 'index.php?act=store_complain', 'succ'); }