예제 #1
0
 /**
  * 保存申请
  */
 public function save_deliveryOp()
 {
     if (!uk86_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 Uk86UploadFile();
     $upload->uk86_set('default_dir', ATTACH_DELIVERY);
     $result = $upload->uk86_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'));
     }
 }
예제 #2
0
 /**
  * 上传图片
  */
 public function uploadOp()
 {
     if (!uk86_chksubmit()) {
         uk86_redirect('index.php?act=wap_member_setting&op=change_avatar');
     }
     uk86_import('function.thumb');
     $member_id = $_SESSION['member_id'];
     //上传图片
     $upload = new Uk86UploadFile();
     $upload->uk86_set('thumb_width', 500);
     $upload->uk86_set('thumb_height', 499);
     $ext = strtolower(pathinfo($_FILES['pic']['name'], PATHINFO_EXTENSION));
     $upload->uk86_set('file_name', "avatar_{$member_id}.{$ext}");
     $upload->uk86_set('thumb_ext', '_new');
     $upload->uk86_set('ifremove', true);
     $upload->uk86_set('default_dir', ATTACH_AVATAR);
     if (!empty($_FILES['pic']['tmp_name'])) {
         $result = $upload->uk86_upfile('pic');
         if (!$result) {
             $this->wap_showDialog($upload->error);
         }
     } else {
         $this->wap_showDialog('上传失败,请尝试更换图片格式或小图片');
     }
     Tpl::output('menu_sign', 'profile');
     Tpl::output('menu_sign_url', 'index.php?act=member_information&op=member');
     Tpl::output('menu_sign1', 'avatar');
     Tpl::output('newfile', $upload->thumb_image);
     Tpl::output('height', uk86_get_height(BASE_UPLOAD_PATH . '/' . ATTACH_AVATAR . '/' . $upload->thumb_image));
     Tpl::output('width', uk86_get_width(BASE_UPLOAD_PATH . '/' . ATTACH_AVATAR . '/' . $upload->thumb_image));
     Tpl::showpage('setting.account_avatar');
 }
예제 #3
0
 /**
  * 上传图片
  */
 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 = Uk86Language::uk86_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 Uk86UploadFile();
     $upload->uk86_set('default_dir', ATTACH_GOODS . DS . $_SESSION['store_id'] . DS . $upload->getSysSetPath());
     $upload->uk86_set('max_size', C('image_max_filesize'));
     $upload->uk86_set('thumb_width', GOODS_IMAGES_WIDTH);
     $upload->uk86_set('thumb_height', GOODS_IMAGES_HEIGHT);
     $upload->uk86_set('thumb_ext', GOODS_IMAGES_EXT);
     $upload->uk86_set('fprefix', $_SESSION['store_id']);
     $upload->uk86_set('allow_type', array('gif', 'jpg', 'jpeg', 'png'));
     $result = $upload->uk86_upfile($_POST['id']);
     if (!$result) {
         if (strtoupper(CHARSET) == 'GBK') {
             $upload->error = Uk86Language::uk86_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'] = uk86_cthumb($img_path, 240, $_SESSION['store_id']);
     // 整理为json格式
     $output = json_encode($data);
     echo $output;
     exit;
 }
예제 #4
0
 /**
  * 编辑
  */
 public function mb_home_editOp()
 {
     $model = Model('mb_home');
     if ($_POST['form_submit'] == 'ok') {
         //验证
         $obj_validate = new Uk86Validate();
         $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->uk86_validate();
         if ($error != '') {
             uk86_showMessage($error);
         } else {
             $home_array = $model->getMbHomeInfoByID(intval($_POST['h_id']));
             //上传图片
             if ($_FILES['h_img']['name'] != '') {
                 $upload = new Uk86UploadFile();
                 $upload->uk86_set('default_dir', ATTACH_MOBILE . '/home');
                 $result = $upload->uk86_upfile('h_img');
                 if ($result) {
                     $_POST['h_img'] = $upload->file_name;
                 } else {
                     uk86_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']);
                 }
                 uk86_showMessage(L('home_edit_succ'), 'index.php?act=mb_home&op=mb_home_list');
             } else {
                 uk86_showMessage(L('home_edit_fail'));
             }
         }
     }
     $home_array = $model->getMbHomeInfoByID(intval($_GET['h_id']));
     if (empty($home_array)) {
         uk86_showMessage(L('wrong_argument'));
     }
     Tpl::output('home_array', $home_array);
     Tpl::showpage('mb_home.edit');
 }
예제 #5
0
 /**
  * 店铺打印设置
  */
 public function indexOp()
 {
     $model = Model();
     $store_info = $model->table('store')->where(array('store_id' => $_SESSION['store_id']))->find();
     if (empty($store_info)) {
         showDialog(Uk86Language::uk86_get('store_storeinfo_error'), 'index.php?act=store_printsetup', 'error');
     }
     if (uk86_chksubmit()) {
         $obj_validate = new Uk86Validate();
         $obj_validate->validateparam = array(array("input" => $_POST['store_printdesc'], "require" => "true", "validator" => "Length", "min" => 1, "max" => 200, "message" => Uk86Language::uk86_get('store_printsetup_desc_error')));
         $error = $obj_validate->uk86_validate();
         if ($error != '') {
             showDialog($error);
         }
         $update_arr = array();
         //上传认证文件
         if ($_FILES['store_stamp']['name'] != '') {
             $upload = new Uk86UploadFile();
             $upload->uk86_set('default_dir', ATTACH_STORE);
             if ($_FILES['store_stamp']['name'] != '') {
                 $result = $upload->uk86_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(Uk86Language::uk86_get('nc_common_save_succ'), 'index.php?act=store_printsetup', 'succ');
         } else {
             showDialog(Uk86Language::uk86_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');
     }
 }
예제 #6
0
 /**
  * 图片上传
  *
  */
 public function pic_uploadOp()
 {
     if (uk86_chksubmit()) {
         //上传图片
         $upload = new Uk86UploadFile();
         $upload->uk86_set('thumb_width', 500);
         $upload->uk86_set('thumb_height', 499);
         $upload->uk86_set('thumb_ext', '_small');
         $upload->uk86_set('max_size', C('image_max_filesize') ? C('image_max_filesize') : 1024);
         $upload->uk86_set('ifremove', true);
         $upload->uk86_set('default_dir', $_GET['uploadpath']);
         if (!empty($_FILES['_pic']['tmp_name'])) {
             $result = $upload->uk86_upfile('_pic');
             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)));
             }
         }
     }
 }
예제 #7
0
 /**
  * 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 Uk86UploadFile();
         $upload->uk86_set('default_dir', ATTACH_CMS);
         $result = $upload->uk86_upfile('cms_logo');
         if (!$result) {
             uk86_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(Uk86Language::uk86_get('cms_log_manage_save'), 0);
         uk86_showMessage(Uk86Language::uk86_get('nc_common_save_succ'));
     } else {
         $this->log(Uk86Language::uk86_get('cms_log_manage_save'), 0);
         uk86_showMessage(Uk86Language::uk86_get('nc_common_save_fail'));
     }
 }
예제 #8
0
 private function upload_image($file)
 {
     $pic_name = '';
     $upload = new Uk86UploadFile();
     $uploaddir = ATTACH_PATH . DS . 'store_joinin' . DS;
     $upload->uk86_set('default_dir', $uploaddir);
     $upload->uk86_set('allow_type', array('jpg', 'jpeg', 'gif', 'png'));
     if (!empty($_FILES[$file]['name'])) {
         $result = $upload->uk86_upfile($file);
         if ($result) {
             $pic_name = $upload->file_name;
             $upload->file_name = '';
         }
     }
     return $pic_name;
 }
예제 #9
0
 public function uploadOp()
 {
     if (!uk86_chksubmit()) {
         uk86_redirect('index.php?act=member_information&op=avatar');
     }
     uk86_import('function.thumb');
     Uk86Language::uk86_read('member_home_member,cut');
     $lang = Uk86Language::uk86_getLangContent();
     $member_id = $_SESSION['member_id'];
     //上传图片
     $upload = new Uk86UploadFile();
     $upload->uk86_set('thumb_width', 500);
     $upload->uk86_set('thumb_height', 499);
     $ext = strtolower(pathinfo($_FILES['pic']['name'], PATHINFO_EXTENSION));
     $upload->uk86_set('file_name', "avatar_{$member_id}.{$ext}");
     $upload->uk86_set('thumb_ext', '_new');
     $upload->uk86_set('ifremove', true);
     $upload->uk86_set('default_dir', ATTACH_AVATAR);
     if (!empty($_FILES['pic']['tmp_name'])) {
         $result = $upload->uk86_upfile('pic');
         if (!$result) {
             uk86_showMessage($upload->error, '', 'html', 'error');
         }
     } else {
         uk86_showMessage('上传失败,请尝试更换图片格式或小图片', '', 'html', 'error');
     }
     self::profile_menu('member', 'avatar');
     Tpl::output('menu_sign', 'profile');
     Tpl::output('menu_sign_url', 'index.php?act=member_information&op=member');
     Tpl::output('menu_sign1', 'avatar');
     Tpl::output('newfile', $upload->thumb_image);
     Tpl::output('height', uk86_get_height(BASE_UPLOAD_PATH . '/' . ATTACH_AVATAR . '/' . $upload->thumb_image));
     Tpl::output('width', uk86_get_width(BASE_UPLOAD_PATH . '/' . ATTACH_AVATAR . '/' . $upload->thumb_image));
     Tpl::showpage('member_profile.avatar');
 }
예제 #10
0
 /**
  * 文章图片上传
  */
 public function article_image_uploadOp()
 {
     $data = array();
     $data['status'] = 'success';
     if (!empty($this->publisher_name)) {
         if (!empty($_FILES['article_image_upload']['name'])) {
             $upload = new Uk86UploadFile();
             $upload->uk86_set('default_dir', ATTACH_CMS . DS . 'article' . DS . $this->attachment_path);
             $upload->uk86_set('thumb_width', '1024,240');
             $upload->uk86_set('thumb_height', '50000,5000');
             $upload->uk86_set('thumb_ext', '_max,_list');
             $result = $upload->uk86_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'] = uk86_getCMSArticleImageUrl($this->attachment_path, $upload->file_name, 'max');
             $data['file_path'] = $this->attachment_path;
         }
     } else {
         $data['status'] = 'fail';
         $data['error'] = Uk86Language::uk86_get('no_login');
     }
     self::echo_json($data);
 }
예제 #11
0
 /**
  * 上传图片
  *
  */
 public function image_uploadOp()
 {
     $store_id = $_SESSION['store_id'];
     if (!empty($_POST['category_id'])) {
         $category_id = intval($_POST['category_id']);
     } else {
         $error = '上传 图片失败';
         if (strtoupper(CHARSET) == 'GBK') {
             $error = Uk86Language::uk86_getUTF8($error);
         }
         $data['state'] = 'false';
         $data['message'] = $error;
         $data['origin_file_name'] = $_FILES["file"]["name"];
         echo json_encode($data);
         exit;
     }
     // 判断图片数量是否超限
     $album_limit = $this->store_grade['sg_album_limit'];
     if ($album_limit > 0) {
         $album_count = Model('album')->getCount(array('store_id' => $store_id));
         if ($album_count >= $album_limit) {
             // 目前并不出该提示,而是提示上传0张图片
             $error = L('store_goods_album_climit');
             if (strtoupper(CHARSET) == 'GBK') {
                 $error = Uk86Language::uk86_getUTF8($error);
             }
             $data['state'] = 'false';
             $data['message'] = $error;
             $data['origin_file_name'] = $_FILES["file"]["name"];
             $data['state'] = 'true';
             echo json_encode($data);
             exit;
         }
     }
     /**
      * 上传图片
      */
     $upload = new Uk86UploadFile();
     $upload->uk86_set('default_dir', ATTACH_GOODS . DS . $store_id . DS . $upload->getSysSetPath());
     $upload->uk86_set('max_size', C('image_max_filesize'));
     $upload->uk86_set('thumb_width', GOODS_IMAGES_WIDTH);
     $upload->uk86_set('thumb_height', GOODS_IMAGES_HEIGHT);
     $upload->uk86_set('thumb_ext', GOODS_IMAGES_EXT);
     $upload->uk86_set('fprefix', $store_id);
     $result = $upload->uk86_upfile('file');
     if ($result) {
         $pic = $upload->getSysSetPath() . $upload->file_name;
         $pic_thumb = $upload->getSysSetPath() . $upload->thumb_image;
     } else {
         // 目前并不出该提示
         $error = $upload->error;
         if (strtoupper(CHARSET) == 'GBK') {
             $error = Uk86Language::uk86_getUTF8($error);
         }
         $data['state'] = 'false';
         $data['message'] = $error;
         $data['origin_file_name'] = $_FILES["file"]["name"];
         echo json_encode($data);
         exit;
     }
     list($width, $height, $type, $attr) = getimagesize(BASE_UPLOAD_PATH . DS . ATTACH_GOODS . DS . $store_id . DS . $pic);
     $image = explode('.', $_FILES["file"]["name"]);
     if (strtoupper(CHARSET) == 'GBK') {
         $image['0'] = Uk86Language::uk86_getGBK($image['0']);
     }
     $insert_array = array();
     $insert_array['apic_name'] = $image['0'];
     $insert_array['apic_tag'] = '';
     $insert_array['aclass_id'] = $category_id;
     $insert_array['apic_cover'] = $pic;
     $insert_array['apic_size'] = intval($_FILES['file']['size']);
     $insert_array['apic_spec'] = $width . 'x' . $height;
     $insert_array['upload_time'] = time();
     $insert_array['store_id'] = $store_id;
     $result = Model('upload_album')->add($insert_array);
     $data = array();
     $data['file_id'] = $result;
     $data['file_name'] = $pic;
     $data['origin_file_name'] = $_FILES["file"]["name"];
     $data['file_path'] = $pic;
     $data['instance'] = $_GET['instance'];
     $data['state'] = 'true';
     /**
      * 整理为json格式
      */
     $output = json_encode($data);
     echo $output;
 }
예제 #12
0
 /**
  * 幻灯片设置
  */
 public function sliderOp()
 {
     $model_setting = Model('setting');
     if (uk86_chksubmit()) {
         $update = array();
         if (!empty($_FILES['live_pic1']['name'])) {
             $upload = new Uk86UploadFile();
             $upload->uk86_set('default_dir', ATTACH_LIVE);
             $result = $upload->uk86_upfile('live_pic1');
             if ($result) {
                 $update['live_pic1'] = $upload->file_name;
             } else {
                 uk86_showMessage($upload->error, '', '', 'error');
             }
         }
         if (!empty($_POST['live_link1'])) {
             $update['live_link1'] = $_POST['live_link1'];
         }
         if (!empty($_FILES['live_pic2']['name'])) {
             $upload = new Uk86UploadFile();
             $upload->uk86_set('default_dir', ATTACH_LIVE);
             $result = $upload->uk86_upfile('live_pic2');
             if ($result) {
                 $update['live_pic2'] = $upload->file_name;
             } else {
                 uk86_showMessage($upload->error, '', '', 'error');
             }
         }
         if (!empty($_POST['live_link2'])) {
             $update['live_link2'] = $_POST['live_link2'];
         }
         if (!empty($_FILES['live_pic3']['name'])) {
             $upload = new Uk86UploadFile();
             $upload->uk86_set('default_dir', ATTACH_LIVE);
             $result = $upload->uk86_upfile('live_pic3');
             if ($result) {
                 $update['live_pic3'] = $upload->file_name;
             } else {
                 uk86_showMessage($upload->error, '', '', 'error');
             }
         }
         if (!empty($_POST['live_link3'])) {
             $update['live_link3'] = $_POST['live_link3'];
         }
         if (!empty($_FILES['live_pic4']['name'])) {
             $upload = new Uk86UploadFile();
             $upload->uk86_set('default_dir', ATTACH_LIVE);
             $result = $upload->uk86_upfile('live_pic4');
             if ($result) {
                 $update['live_pic4'] = $upload->file_name;
             } else {
                 uk86_showMessage($upload->error, '', '', 'error');
             }
         }
         if (!empty($_POST['live_link4'])) {
             $update['live_link4'] = $_POST['live_link4'];
         }
         $list_setting = $model_setting->getListSetting();
         $result = $model_setting->updateSetting($update);
         if ($result) {
             if ($list_setting['live_pic1'] != '' && isset($update['live_pic1'])) {
                 @unlink(BASE_UPLOAD_PATH . DS . ATTACH_LIVE . DS . $list_setting['live_pic1']);
             }
             if ($list_setting['live_pic2'] != '' && isset($update['live_pic2'])) {
                 @unlink(BASE_UPLOAD_PATH . DS . ATTACH_LIVE . DS . $list_setting['live_pic2']);
             }
             if ($list_setting['live_pic3'] != '' && isset($update['live_pic3'])) {
                 @unlink(BASE_UPLOAD_PATH . DS . ATTACH_LIVE . DS . $list_setting['live_pic3']);
             }
             if ($list_setting['live_pic4'] != '' && isset($update['live_pic4'])) {
                 @unlink(BASE_UPLOAD_PATH . DS . ATTACH_LIVE . DS . $list_setting['live_pic4']);
             }
             uk86_dkcache('setting');
             $this->log('修改抢购幻灯片设置', 1);
             uk86_showMessage('编辑成功', '', '', 'succ');
         } else {
             uk86_showMessage('编辑失败', '', '', 'error');
         }
     }
     $list_setting = $model_setting->getListSetting();
     Tpl::output('list_setting', $list_setting);
     $this->show_menu('slider');
     Tpl::showpage('groupbuy.slider');
 }
예제 #13
0
 /**
  * 积分礼品上传
  */
 public function pointprod_pic_uploadOp()
 {
     /**
      * 上传图片
      */
     $upload = new Uk86UploadFile();
     $upload->uk86_set('default_dir', ATTACH_POINTPROD);
     $result = $upload->uk86_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'] = '6';
     $insert_array['file_size'] = $_FILES['Filedata']['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;
     }
 }
예제 #14
0
 /**
  * 首页图片上传
  */
 public function image_uploadOp()
 {
     $data = array();
     $data['status'] = 'success';
     if (!empty($_FILES['image_upload']['name'])) {
         $upload = new Uk86UploadFile();
         $upload->uk86_set('default_dir', ATTACH_CMS . DS . 'index');
         $result = $upload->uk86_upfile('image_upload');
         if (!$result) {
             $data['status'] = 'fail';
             $data['error'] = $upload->error;
         }
         $data['file_name'] = $upload->file_name;
         $data['file_url'] = uk86_getCMSIndexImageUrl($upload->file_name);
     }
     if (strtoupper(CHARSET) == 'GBK') {
         $data = Uk86Language::uk86_getUTF8($data);
         //网站GBK使用编码时,转换为UTF-8,防止json输出汉字问题
     }
     echo json_encode($data);
 }
예제 #15
0
 public function templateeditOp()
 {
     $t_id = intval($_GET['tid']);
     if ($t_id <= 0) {
         $t_id = intval($_POST['tid']);
     }
     if ($t_id <= 0) {
         uk86_showMessage(Uk86Language::uk86_get('wrong_argument'), 'index.php?act=store_voucher&op=templatelist', 'html', 'error');
     }
     $model = Model('voucher');
     //查询模板信息
     $param = array();
     $param['voucher_t_id'] = $t_id;
     $param['voucher_t_store_id'] = $_SESSION['store_id'];
     $param['voucher_t_state'] = $this->templatestate_arr['usable'][0];
     $param['voucher_t_giveout'] = array('elt', '0');
     $param['voucher_t_end_date'] = array('gt', time());
     $t_info = $model->table('voucher_template')->where($param)->find();
     if (empty($t_info)) {
         uk86_showMessage(Uk86Language::uk86_get('wrong_argument'), 'index.php?act=store_voucher&op=templatelist', 'html', 'error');
     }
     if ($isOwnShop = uk86_checkPlatformStore()) {
         Tpl::output('isOwnShop', true);
     } else {
         //查询套餐信息
         $quotainfo = $model->table('voucher_quota')->where(array('quota_id' => $t_info['voucher_t_quotaid'], 'quota_storeid' => $_SESSION['store_id']))->find();
         if (empty($quotainfo)) {
             uk86_showMessage(Uk86Language::uk86_get('voucher_template_quotanull'), 'index.php?act=store_voucher&op=quotaadd', 'html', 'error');
         }
     }
     //查询面额列表
     $pricelist = $model->table('voucher_price')->order('voucher_price asc')->select();
     if (empty($pricelist)) {
         uk86_showMessage(Uk86Language::uk86_get('voucher_template_pricelisterror'), 'index.php?act=store_voucher&op=templatelist', 'html', 'error');
     }
     if (uk86_chksubmit()) {
         //验证提交的内容面额不能大于限额
         $obj_validate = new Uk86Validate();
         $obj_validate->validateparam = array(array("input" => $_POST['txt_template_title'], "require" => "true", "validator" => "Length", "min" => "1", "max" => "50", "message" => Uk86Language::uk86_get('voucher_template_title_error')), array("input" => $_POST['txt_template_total'], "require" => "true", "validator" => "Number", "message" => Uk86Language::uk86_get('voucher_template_total_error')), array("input" => $_POST['select_template_price'], "require" => "true", "validator" => "Number", "message" => Uk86Language::uk86_get('voucher_template_price_error')), array("input" => $_POST['txt_template_limit'], "require" => "true", "validator" => "Double", "message" => Uk86Language::uk86_get('voucher_template_limit_error')), array("input" => $_POST['txt_template_describe'], "require" => "true", "validator" => "Length", "min" => "1", "max" => "255", "message" => Uk86Language::uk86_get('voucher_template_describe_error')));
         $error = $obj_validate->uk86_validate();
         //金额验证
         $price = intval($_POST['select_template_price']) > 0 ? intval($_POST['select_template_price']) : 0;
         foreach ($pricelist as $k => $v) {
             if ($v['voucher_price'] == $price) {
                 $chooseprice = $v;
                 //取得当前选择的面额记录
             }
         }
         if (empty($chooseprice)) {
             $error .= Uk86Language::uk86_get('voucher_template_pricelisterror');
         }
         $limit = intval($_POST['txt_template_limit']) > 0 ? intval($_POST['txt_template_limit']) : 0;
         if ($price >= $limit) {
             $error .= Uk86Language::uk86_get('voucher_template_price_error');
         }
         if ($error) {
             showDialog($error, 'reload', 'error');
         } else {
             $update_arr = array();
             $update_arr['voucher_t_title'] = trim($_POST['txt_template_title']);
             $update_arr['voucher_t_desc'] = trim($_POST['txt_template_describe']);
             if ($_POST['txt_template_enddate']) {
                 $enddate = strtotime($_POST['txt_template_enddate']);
                 if (!$isOwnShop && $enddate > $quotainfo['quota_endtime']) {
                     $enddate = $quotainfo['quota_endtime'];
                 }
                 $update_arr['voucher_t_end_date'] = $enddate;
             } else {
                 //如果没有添加有效期则默认为套餐的结束时间
                 if ($isOwnShop) {
                     $update_arr['voucher_t_end_date'] = time() + 2592000;
                 } else {
                     $update_arr['voucher_t_end_date'] = $quotainfo['quota_endtime'];
                 }
             }
             $update_arr['voucher_t_price'] = $price;
             $update_arr['voucher_t_limit'] = $limit;
             $update_arr['voucher_t_sc_id'] = intval($_POST['sc_id']);
             $update_arr['voucher_t_state'] = intval($_POST['tstate']) == $this->templatestate_arr['usable'][0] ? $this->templatestate_arr['usable'][0] : $this->templatestate_arr['disabled'][0];
             $update_arr['voucher_t_total'] = intval($_POST['txt_template_total']) > 0 ? intval($_POST['txt_template_total']) : 0;
             $update_arr['voucher_t_points'] = $chooseprice['voucher_defaultpoints'];
             $update_arr['voucher_t_eachlimit'] = intval($_POST['eachlimit']) > 0 ? intval($_POST['eachlimit']) : 0;
             //自定义图片
             if (!empty($_FILES['customimg']['name'])) {
                 $upload = new Uk86UploadFile();
                 $upload->uk86_set('default_dir', ATTACH_VOUCHER . DS . $_SESSION['store_id']);
                 $upload->uk86_set('thumb_width', '160');
                 $upload->uk86_set('thumb_height', '160');
                 $upload->uk86_set('thumb_ext', '_small');
                 $result = $upload->uk86_upfile('customimg');
                 if ($result) {
                     //删除原图
                     if (!empty($t_info['voucher_t_customimg'])) {
                         //如果模板存在,则删除原模板图片
                         @unlink(BASE_UPLOAD_PATH . DS . ATTACH_VOUCHER . DS . $_SESSION['store_id'] . DS . $t_info['voucher_t_customimg']);
                         @unlink(BASE_UPLOAD_PATH . DS . ATTACH_VOUCHER . DS . $_SESSION['store_id'] . DS . str_ireplace('.', '_small.', $t_info['voucher_t_customimg']));
                     }
                     $update_arr['voucher_t_customimg'] = $upload->file_name;
                 }
             }
             $rs = $model->table('voucher_template')->where(array('voucher_t_id' => $t_info['voucher_t_id']))->update($update_arr);
             if ($rs) {
                 showDialog(Uk86Language::uk86_get('nc_common_op_succ'), 'index.php?act=store_voucher&op=templatelist', 'succ');
             } else {
                 showDialog(Uk86Language::uk86_get('nc_common_op_fail'), 'index.php?act=store_voucher&op=templatelist', 'error');
             }
         }
     } else {
         if (!$t_info['voucher_t_customimg'] || !file_exists(BASE_UPLOAD_PATH . DS . ATTACH_VOUCHER . DS . $_SESSION['store_id'] . DS . $t_info['voucher_t_customimg'])) {
             $t_info['voucher_t_customimg'] = UPLOAD_SITE_URL . DS . uk86_defaultGoodsImage(240);
         } else {
             $t_info['voucher_t_customimg'] = UPLOAD_SITE_URL . DS . ATTACH_VOUCHER . DS . $_SESSION['store_id'] . DS . str_ireplace('.', '_small.', $t_info['voucher_t_customimg']);
         }
         TPL::output('type', 'edit');
         TPL::output('t_info', $t_info);
         //店铺分类
         $store_class = uk86_rkcache('store_class', true);
         Tpl::output('store_class', $store_class);
         //查询店铺详情
         $store_info = Model('store')->getStoreInfoByID($_SESSION['store_id']);
         TPL::output('store_info', $store_info);
         TPL::output('quotainfo', $quotainfo);
         TPL::output('pricelist', $pricelist);
         $this->profile_menu('templateedit', 'templateedit');
         Tpl::showpage('store_voucher_template.add');
     }
 }
예제 #16
0
 /**
  * 上传凭证
  *
  */
 private function upload_pic()
 {
     $refund_pic = array();
     $refund_pic[1] = 'refund_pic1';
     $refund_pic[2] = 'refund_pic2';
     $refund_pic[3] = 'refund_pic3';
     $pic_array = array();
     $upload = new Uk86UploadFile();
     $dir = ATTACH_PATH . DS . 'refund' . DS;
     $upload->uk86_set('default_dir', $dir);
     $upload->uk86_set('allow_type', array('jpg', 'jpeg', 'gif', 'png'));
     $count = 1;
     foreach ($refund_pic as $pic) {
         if (!empty($_FILES[$pic]['name'])) {
             $result = $upload->uk86_upfile($pic);
             if ($result) {
                 $pic_array[$count] = $upload->file_name;
                 $upload->file_name = '';
             } else {
                 $pic_array[$count] = '';
             }
         }
         $count++;
     }
     return $pic_array;
 }
예제 #17
0
 /**
  * 上传图片
  **/
 public function image_uploadOp()
 {
     if (!empty($_POST['old_groupbuy_image'])) {
         $this->_image_del($_POST['old_groupbuy_image']);
     }
     $file = 'groupbuy_image';
     $data = array();
     $data['result'] = true;
     if (!empty($_FILES[$file]['name'])) {
         $upload = new Uk86UploadFile();
         $uploaddir = ATTACH_PATH . DS . 'livegroupbuy' . DS . $_SESSION['store_id'] . DS;
         $upload->uk86_set('default_dir', $uploaddir);
         $upload->uk86_set('thumb_width', '480,296,168');
         $upload->uk86_set('thumb_height', '480,296,168');
         $upload->uk86_set('thumb_ext', '_max,_mid,_small');
         $upload->uk86_set('fprefix', $_SESSION['store_id']);
         $result = $upload->uk86_upfile($file);
         if ($result) {
             $data['file_name'] = $upload->file_name;
             $data['origin_file_name'] = $_FILES[$file]['name'];
             $data['file_url'] = lgthumb($upload->file_name, 'mid');
         } else {
             $data['result'] = false;
             $data['message'] = $upload->error;
         }
     } else {
         $data['result'] = false;
     }
     echo json_encode($data);
     die;
 }
예제 #18
0
 /**
  * 图片上传
  */
 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 Uk86UploadFile();
     $upload->uk86_set('default_dir', ATTACH_STORE_DECORATION . DS . $store_id);
     $upload->uk86_set('max_size', C('image_max_filesize'));
     $upload->uk86_set('fprefix', $store_id);
     $result_file = $upload->uk86_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'] = uk86_getStoreDecorationImageUrl($image, $store_id);
     } else {
         $data['error'] = '上传失败';
     }
     echo json_encode($data);
     die;
 }
예제 #19
0
 private function inform_upload_pic($inform_pic)
 {
     $pic_name = array();
     $upload = new Uk86UploadFile();
     $uploaddir = ATTACH_PATH . DS . 'inform' . DS;
     $upload->uk86_set('default_dir', $uploaddir);
     $upload->uk86_set('allow_type', array('jpg', 'jpeg', 'gif', 'png'));
     $count = 1;
     foreach ($inform_pic as $pic) {
         if (!empty($_FILES[$pic]['name'])) {
             $result = $upload->uk86_upfile($pic);
             if ($result) {
                 $pic_name[$count] = $upload->file_name;
                 $upload->file_name = '';
             } else {
                 $pic_name[$count] = '';
             }
         }
         $count++;
     }
     return $pic_name;
 }
예제 #20
0
 /**
  * 上传图片
  */
 private function _upload_pic($file_name)
 {
     $pic_name = '';
     if (!empty($file_name)) {
         if (!empty($_FILES['pic']['name'])) {
             //上传图片
             $upload = new Uk86UploadFile();
             $filename_tmparr = explode('.', $_FILES['pic']['name']);
             $ext = end($filename_tmparr);
             $upload->uk86_set('default_dir', ATTACH_EDITOR);
             $upload->uk86_set('file_name', $file_name . "." . $ext);
             $result = $upload->uk86_upfile('pic');
             if ($result) {
                 $pic_name = ATTACH_EDITOR . "/" . $upload->file_name . '?' . mt_rand(100, 999);
                 //加随机数防止浏览器缓存图片
             }
         }
     }
     return $pic_name;
 }
예제 #21
0
 /**
  * 编辑
  */
 public function goods_class_editOp()
 {
     $lang = Uk86Language::uk86_getLangContent();
     $model_class = Model('goods_class');
     if (uk86_chksubmit()) {
         $obj_validate = new Uk86Validate();
         $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->uk86_validate();
         if ($error != '') {
             uk86_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']);
         $update_array['gc_parent_id'] = intval($_POST['gc_parent_id']);
         $result = $model_class->editGoodsClass($update_array, $where);
         if (!$result) {
             $this->log(L('nc_edit,goods_class_index_class') . '[' . $_POST['gc_name'] . ']', 0);
             uk86_showMessage($lang['goods_class_batch_edit_fail']);
         }
         if (!empty($_FILES['pic']['name'])) {
             //上传图片
             $upload = new Uk86UploadFile();
             $upload->uk86_set('default_dir', ATTACH_COMMON);
             $upload->uk86_set('file_name', 'category-pic-' . intval($_POST['gc_id']) . '.jpg');
             $upload->uk86_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);
         uk86_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)) {
         uk86_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("&nbsp;", $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');
 }
예제 #22
0
 /**
  * 上传图片
  *
  * @param
  * @return
  */
 public function swfuploadOp()
 {
     /**
      * 读取语言包
      */
     Uk86Language::uk86_read('sns_home');
     $lang = Uk86Language::uk86_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' => Uk86Language::uk86_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' => Uk86Language::uk86_get('sns_upload_img_max_num_error'), 'origin_file_name' => $_FILES["file"]["name"]));
         exit;
     }
     /**
      * 上传图片
      */
     $upload = new Uk86UploadFile();
     $upload_dir = ATTACH_MALBUM . DS . $member_id . DS;
     $upload->uk86_set('default_dir', $upload_dir . $upload->getSysSetPath());
     $thumb_width = '240,1024';
     $thumb_height = '2048,1024';
     $upload->uk86_set('max_size', C('image_max_filesize'));
     $upload->uk86_set('thumb_width', $thumb_width);
     $upload->uk86_set('thumb_height', $thumb_height);
     $upload->uk86_set('fprefix', $member_id);
     $upload->uk86_set('thumb_ext', '_240,_1024');
     $result = $upload->uk86_upfile('file');
     if (!$result) {
         echo json_encode(array('state' => 'false', 'message' => Uk86Language::uk86_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'] = Uk86Language::uk86_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'] = uk86_snsThumb($img_path, 240);
     $data['state'] = 'true';
     /**
      * 整理为json格式
      */
     $output = json_encode($data);
     echo $output;
 }
예제 #23
0
 /**
  * 圈子管理
  */
 public function indexOp()
 {
     // 圈子信息
     $this->circleInfo();
     // 会员信息
     $this->circleMemberInfo();
     if ($this->identity == 2) {
         @header("location: " . CIRCLE_SITE_URL . '/index.php?act=manage&op=applying&c_id=' . $this->c_id);
     }
     // 会员加入圈子列表
     $this->memberJoinCircle();
     $model = Model();
     if (uk86_chksubmit()) {
         $update = array();
         $update['circle_id'] = $this->c_id;
         // 上传图片
         if (!empty($_FILES['c_img']['name'])) {
             $upload = new Uk86UploadFile();
             $upload->uk86_set('default_dir', ATTACH_CIRCLE . '/group');
             $upload->uk86_set('thumb_width', 120);
             $upload->uk86_set('thumb_height', 120);
             $upload->uk86_set('thumb_ext', '_120x120');
             $upload->uk86_set('ifremove', true);
             $result = $upload->uk86_upfile('c_img');
             if ($result) {
                 $update['circle_img'] = $upload->thumb_image;
                 $model->table('circle')->update($update);
             } else {
                 showDialog($upload->error);
             }
         }
         $update['circle_desc'] = $_POST['c_desc'];
         $update['circle_notice'] = $_POST['c_notice'];
         $update['circle_joinaudit'] = $_POST['c_joinaudit'];
         if ($_POST['c_mapply'] == 1) {
             $update['mapply_open'] = 1;
             $update['mapply_ml'] = $_POST['c_ml'];
         } else {
             $update['mapply_open'] = 0;
             $update['mapply_ml'] = 0;
             $update['new_mapplycount'] = 0;
             // Delete the application information
             $model->table('circle_mapply')->where(array('circle_id' => $this->c_id))->delete();
         }
         $model->table('circle')->update($update);
         showDialog(L('nc_common_op_succ'), 'reload', 'succ');
     }
     $circle_info = $model->table('circle')->find($this->c_id);
     Tpl::output('circle_info', $circle_info);
     // member level
     $ml_info = $model->table('circle_ml')->find($this->c_id);
     if (empty($ml_info)) {
         $mld_array = uk86_rkcache('circle_level') ? uk86_rkcache('circle_level') : uk86_rkcache('circle_level', true);
         $ml_info['ml_1'] = $mld_array['1']['mld_name'];
         $ml_info['ml_2'] = $mld_array['2']['mld_name'];
         $ml_info['ml_3'] = $mld_array['3']['mld_name'];
         $ml_info['ml_4'] = $mld_array['4']['mld_name'];
         $ml_info['ml_5'] = $mld_array['5']['mld_name'];
         $ml_info['ml_6'] = $mld_array['6']['mld_name'];
         $ml_info['ml_7'] = $mld_array['7']['mld_name'];
         $ml_info['ml_8'] = $mld_array['8']['mld_name'];
         $ml_info['ml_9'] = $mld_array['9']['mld_name'];
         $ml_info['ml_10'] = $mld_array['10']['mld_name'];
         $ml_info['ml_11'] = $mld_array['11']['mld_name'];
         $ml_info['ml_12'] = $mld_array['12']['mld_name'];
         $ml_info['ml_13'] = $mld_array['13']['mld_name'];
         $ml_info['ml_14'] = $mld_array['14']['mld_name'];
         $ml_info['ml_15'] = $mld_array['15']['mld_name'];
         $ml_info['ml_16'] = $mld_array['16']['mld_name'];
     }
     Tpl::output('ml_info', $ml_info);
     $this->sidebar_menu('index');
     Tpl::showpage('group_manage_index');
 }
예제 #24
0
 /**
  * 附件批量上传 话题
  */
 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 Uk86UploadFile();
         $upload->uk86_set('default_dir', ATTACH_CIRCLE . '/theme/' . $partpath);
         $upload->uk86_set('thumb_width', 1024);
         $upload->uk86_set('thumb_height', 160);
         $upload->uk86_set('thumb_ext', '_160x160');
         $result = $upload->uk86_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'] = uk86_themeImageUrl($partpath . '/' . $upload->thumb_image);
                 $data['file_insert'] = uk86_themeImageUrl($partpath . '/' . $upload->file_name);
             }
         }
     }
     echo json_encode($data);
     exit;
 }
예제 #25
0
 /**
  * 图片上传
  */
 public function special_image_uploadOp()
 {
     $data = array();
     if (!empty($_FILES['special_image']['name'])) {
         $prefix = 's' . $_POST['special_id'];
         $upload = new Uk86UploadFile();
         $upload->uk86_set('default_dir', ATTACH_MOBILE . DS . 'special' . DS . $prefix);
         $upload->uk86_set('fprefix', $prefix);
         $upload->uk86_set('allow_type', array('gif', 'jpg', 'jpeg', 'png'));
         $result = $upload->uk86_upfile('special_image');
         if (!$result) {
             $data['error'] = $upload->error;
         }
         $data['image_name'] = $upload->file_name;
         $data['image_url'] = uk86_getMbSpecialImageUrl($data['image_name']);
     }
     echo json_encode($data);
 }
예제 #26
0
 /**
  * 上传图片
  */
 public function image_uploadOp()
 {
     $lang = Uk86Language::uk86_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 Uk86UploadFile();
         $upload_dir = ATTACH_MALBUM . DS . $_SESSION['member_id'] . DS;
         $upload->uk86_set('default_dir', $upload_dir . $upload->getSysSetPath());
         $thumb_width = '240,1024';
         $thumb_height = '2048,1024';
         $upload->uk86_set('max_size', C('image_max_filesize'));
         $upload->uk86_set('thumb_width', $thumb_width);
         $upload->uk86_set('thumb_height', $thumb_height);
         $upload->uk86_set('fprefix', $_SESSION['member_id']);
         $upload->uk86_set('thumb_ext', '_240,_1024');
         $result = $upload->uk86_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');
 }
예제 #27
0
 /**
  * 上传图片
  */
 public function upload_picOp()
 {
     $data = array();
     if (!empty($_FILES['fileupload']['name'])) {
         //上传图片
         $fprefix = 'help_store';
         $upload = new Uk86UploadFile();
         $upload->uk86_set('default_dir', ATTACH_ARTICLE);
         $upload->uk86_set('fprefix', $fprefix);
         $upload->uk86_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;
 }
예제 #28
0
 /**
  * 登录主题图片
  */
 public function loginOp()
 {
     $model_setting = Model('setting');
     if (uk86_chksubmit()) {
         $input = array();
         //上传图片
         $upload = new Uk86UploadFile();
         $upload->uk86_set('default_dir', ATTACH_PATH . '/login');
         $upload->uk86_set('thumb_ext', '');
         $upload->uk86_set('file_name', '1.jpg');
         $upload->uk86_set('ifremove', false);
         if (!empty($_FILES['login_pic1']['name'])) {
             $result = $upload->uk86_upfile('login_pic1');
             if (!$result) {
                 uk86_showMessage($upload->error, '', '', 'error');
             } else {
                 $input[] = $upload->file_name;
             }
         } elseif ($_POST['old_login_pic1'] != '') {
             $input[] = '1.jpg';
         }
         $upload->uk86_set('default_dir', ATTACH_PATH . '/login');
         $upload->uk86_set('thumb_ext', '');
         $upload->uk86_set('file_name', '2.jpg');
         $upload->uk86_set('ifremove', false);
         if (!empty($_FILES['login_pic2']['name'])) {
             $result = $upload->uk86_upfile('login_pic2');
             if (!$result) {
                 uk86_showMessage($upload->error, '', '', 'error');
             } else {
                 $input[] = $upload->file_name;
             }
         } elseif ($_POST['old_login_pic2'] != '') {
             $input[] = '2.jpg';
         }
         $upload->uk86_set('default_dir', ATTACH_PATH . '/login');
         $upload->uk86_set('thumb_ext', '');
         $upload->uk86_set('file_name', '3.jpg');
         $upload->uk86_set('ifremove', false);
         if (!empty($_FILES['login_pic3']['name'])) {
             $result = $upload->uk86_upfile('login_pic3');
             if (!$result) {
                 uk86_showMessage($upload->error, '', '', 'error');
             } else {
                 $input[] = $upload->file_name;
             }
         } elseif ($_POST['old_login_pic3'] != '') {
             $input[] = '3.jpg';
         }
         $upload->uk86_set('default_dir', ATTACH_PATH . '/login');
         $upload->uk86_set('thumb_ext', '');
         $upload->uk86_set('file_name', '4.jpg');
         $upload->uk86_set('ifremove', false);
         if (!empty($_FILES['login_pic4']['name'])) {
             $result = $upload->uk86_upfile('login_pic4');
             if (!$result) {
                 uk86_showMessage($upload->error, '', '', 'error');
             } else {
                 $input[] = $upload->file_name;
             }
         } elseif ($_POST['old_login_pic4'] != '') {
             $input[] = '4.jpg';
         }
         $update_array = array();
         if (count($input) > 0) {
             $update_array['login_pic'] = serialize($input);
         }
         $result = $model_setting->updateSetting($update_array);
         if ($result === true) {
             $this->log(L('nc_edit,loginSettings'), 1);
             uk86_showMessage(L('nc_common_save_succ'));
         } else {
             $this->log(L('nc_edit,loginSettings'), 0);
             uk86_showMessage(L('nc_common_save_fail'));
         }
     }
     $list_setting = $model_setting->getListSetting();
     if ($list_setting['login_pic'] != '') {
         $list = unserialize($list_setting['login_pic']);
     }
     Tpl::output('list', $list);
     Tpl::output('top_link', $this->sublink($this->links, 'login'));
     Tpl::showpage('upload.login');
 }
예제 #29
0
 /**
  * 编辑
  */
 public function mb_ad_editOp()
 {
     $model_mb_ad = Model('mb_ad');
     if ($_POST['form_submit'] == 'ok') {
         /**
          * 验证
          */
         $obj_validate = new Uk86Validate();
         $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->uk86_validate();
         if ($error != '') {
             uk86_showMessage($error);
         } else {
             /**
              * 上传图片
              */
             if ($_FILES['link_pic']['name'] != '') {
                 $upload = new Uk86UploadFile();
                 $upload->uk86_set('default_dir', ATTACH_MOBILE . '/ad');
                 $result = $upload->uk86_upfile('link_pic');
                 if ($result) {
                     $_POST['link_pic'] = $upload->file_name;
                 } else {
                     uk86_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')));
                 uk86_showMessage(L('link_edit_succ'), $url);
             } else {
                 uk86_showMessage(L('link_edit_fail'));
             }
         }
     }
     $link_array = $model_mb_ad->getMbAdInfoByID(intval($_GET['link_id']));
     if (empty($link_array)) {
         uk86_showMessage(L('wrong_argument'));
     }
     Tpl::output('link_array', $link_array);
     Tpl::showpage('mb_ad.edit');
 }
예제 #30
0
 /**
  * 编辑
  */
 public function mb_category_editOp()
 {
     $lang = Uk86Language::uk86_getLangContent();
     $model_link = Model('mb_category');
     if ($_POST['form_submit'] == 'ok') {
         /**
          * 上传图片
          */
         if ($_FILES['link_pic']['name'] != '') {
             $upload = new Uk86UploadFile();
             $upload->uk86_set('default_dir', ATTACH_MOBILE . '/category');
             $result = $upload->uk86_upfile('link_pic');
             if ($result) {
                 $_POST['gc_thumb'] = $upload->file_name;
             } else {
                 uk86_showMessage($upload->error);
             }
         }
         $link_array = $model_link->getOneLink(intval($_POST['gc_id']));
         $update_array = array();
         $update_array['gc_id'] = intval($_POST['gc_id']);
         if ($_POST['gc_thumb']) {
             $update_array['gc_thumb'] = $_POST['gc_thumb'];
         }
         $result = $model_link->update($update_array);
         if ($result) {
             /**
              * 删除图片
              */
             if (!empty($_POST['gc_thumb']) && !empty($link_array['gc_thumb'])) {
                 @unlink(BASE_ROOT_PATH . DS . DIR_UPLOAD . DS . ATTACH_MOBILE . '/category/' . $link_array['gc_thumb']);
             }
             $url = array(array('url' => 'index.php?act=mb_category&op=mb_category_edit&gc_id=' . intval($_POST['gc_id']), 'msg' => $lang['link_edit_again']), array('url' => 'index.php?act=mb_category&op=mb_category_list', 'msg' => $lang['link_add_back_to_list']));
             uk86_showMessage($lang['link_edit_succ'], $url);
         } else {
             uk86_showMessage($lang['link_edit_fail']);
         }
     }
     $link_array = $model_link->getOneLink(intval($_GET['gc_id']));
     if (empty($link_array)) {
         uk86_showMessage($lang['wrong_argument']);
     }
     /**
      * 商品分类
      */
     $goods_class = Model('goods_class')->getGoodsClassForCacheModel();
     Tpl::output('goods_class', $goods_class);
     Tpl::output('link_array', $link_array);
     Tpl::showpage('mb_category.edit');
 }