当前位置: 首页>>代码示例>>PHP>>正文


PHP Language::getUTF8方法代码示例

本文整理汇总了PHP中Language::getUTF8方法的典型用法代码示例。如果您正苦于以下问题:PHP Language::getUTF8方法的具体用法?PHP Language::getUTF8怎么用?PHP Language::getUTF8使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Language的用法示例。


在下文中一共展示了Language::getUTF8方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: image_uploadOp

 /**
  * ajax上传图片
  */
 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' => 0));
         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' => 0, 'is_default' => 1), 'album_class');
     // 上传图片
     $upload = new UploadFile();
     $upload->set('default_dir', ATTACH_GOODS . DS . '0' . 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', '0');
     $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 . '/' . '0' . 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'] = 0;
     $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'] = '0';
     $model_album->addPic($insert_array);
     $data = array();
     $data['image'] = cthumb($img_path, 240, '0');
     $data['filename'] = $img_path;
     // 整理为json格式
     $output = json_encode($data);
     echo $output;
     exit;
 }
开发者ID:lehman3087,项目名称:wanhaoshop,代码行数:62,代码来源:upload.php

示例2: article_classOp

 /**
  * 文章管理
  */
 public function article_classOp()
 {
     $lang = Language::getLangContent();
     $model_class = Model('article_class');
     /**
      * 删除
      */
     if ($_POST['form_submit'] == 'ok') {
         if (!empty($_POST['check_ac_id'])) {
             if (is_array($_POST['check_ac_id'])) {
                 $del_array = $model_class->getChildClass($_POST['check_ac_id']);
                 if (is_array($del_array)) {
                     foreach ($del_array as $k => $v) {
                         $model_class->del($v['ac_id']);
                     }
                 }
             }
             showMessage($lang['article_class_index_del_succ']);
         } else {
             showMessage($lang['article_class_index_choose']);
         }
     }
     /**
      * 父ID
      */
     $parent_id = $_GET['ac_parent_id'] ? intval($_GET['ac_parent_id']) : 0;
     /**
      * 列表
      */
     $tmp_list = $model_class->getTreeClassList(2);
     if (is_array($tmp_list)) {
         foreach ($tmp_list as $k => $v) {
             if ($v['ac_parent_id'] == $parent_id) {
                 /**
                  * 判断是否有子类
                  */
                 if ($tmp_list[$k + 1]['deep'] > $v['deep']) {
                     $v['have_child'] = 1;
                 }
                 $class_list[] = $v;
             }
         }
     }
     if ($_GET['ajax'] == '1') {
         /**
          * 转码
          */
         if (strtoupper(CHARSET) == 'GBK') {
             $class_list = Language::getUTF8($class_list);
         }
         $output = json_encode($class_list);
         print_r($output);
         exit;
     } else {
         Tpl::output('class_list', $class_list);
         Tpl::showpage('article_class.index');
     }
 }
开发者ID:dw250100785,项目名称:shopnc,代码行数:61,代码来源:article_class.php

示例3: goods_classOp

 /**
  * 分类管理
  */
 public function goods_classOp()
 {
     $lang = Language::getLangContent();
     $model_class = Model('goods_class');
     if (chksubmit()) {
         //删除
         if ($_POST['submit_type'] == 'del') {
             $gcids = implode(',', $_POST['check_gc_id']);
             if (!empty($_POST['check_gc_id'])) {
                 if (!is_array($_POST['check_gc_id'])) {
                     $this->log(L('nc_delete,goods_class_index_class') . '[ID:' . $gcids . ']', 0);
                     showMessage($lang['nc_common_del_fail']);
                 }
                 $del_array = $model_class->delGoodsClassByGcIdString($gcids);
                 $this->log(L('nc_delete,goods_class_index_class') . '[ID:' . $gcids . ']', 1);
                 showMessage($lang['nc_common_del_succ']);
             } else {
                 $this->log(L('nc_delete,goods_class_index_class') . '[ID:' . $gcids . ']', 0);
                 showMessage($lang['nc_common_del_fail']);
             }
         }
     }
     //父ID
     $parent_id = $_GET['gc_parent_id'] ? intval($_GET['gc_parent_id']) : 0;
     //列表
     $tmp_list = $model_class->getTreeClassList(3);
     if (is_array($tmp_list)) {
         foreach ($tmp_list as $k => $v) {
             if ($v['gc_parent_id'] == $parent_id) {
                 //判断是否有子类
                 if ($tmp_list[$k + 1]['deep'] > $v['deep']) {
                     $v['have_child'] = 1;
                 }
                 $class_list[] = $v;
             }
         }
     }
     if ($_GET['ajax'] == '1') {
         //转码
         if (strtoupper(CHARSET) == 'GBK') {
             $class_list = Language::getUTF8($class_list);
         }
         $output = json_encode($class_list);
         print_r($output);
         exit;
     } else {
         Tpl::output('class_list', $class_list);
         Tpl::output('top_link', $this->sublink($this->links, 'goods_class'));
         Tpl::showpage('goods_class.index');
     }
 }
开发者ID:sunxguo,项目名称:qyg,代码行数:54,代码来源:goods_class.php

示例4: store_classOp

 /**
  * 店铺分类
  */
 public function store_classOp()
 {
     $lang = Language::getLangContent();
     $model_class = Model('store_class');
     //删除
     if (chksubmit()) {
         if (!empty($_POST['check_sc_id'])) {
             if (is_array($_POST['check_sc_id'])) {
                 $del_array = $model_class->getChildClass($_POST['check_sc_id']);
                 if (is_array($del_array)) {
                     foreach ($del_array as $k => $v) {
                         $model_class->del($v['sc_id']);
                     }
                 }
             }
             $this->log(L('nc_del,store_class') . '[ID:' . implode(',', $_POST['check_sc_id']) . ']', 1);
             showMessage($lang['nc_common_del_succ']);
         } else {
             showMessage($lang['nc_common_del_fail']);
         }
     }
     $parent_id = $_GET['sc_parent_id'] ? intval($_GET['sc_parent_id']) : 0;
     $tmp_list = $model_class->getTreeClassList(2);
     if (is_array($tmp_list)) {
         foreach ($tmp_list as $k => $v) {
             if ($v['sc_parent_id'] == $parent_id) {
                 //判断是否有子类
                 if ($tmp_list[$k + 1]['deep'] > $v['deep']) {
                     $v['have_child'] = 1;
                 }
                 $class_list[] = $v;
             }
         }
     }
     if ($_GET['ajax'] == '1') {
         //转码
         if (strtoupper(CHARSET) == 'GBK') {
             $class_list = Language::getUTF8($class_list);
         }
         $output = json_encode($class_list);
         print_r($output);
         exit;
     } else {
         Tpl::output('class_list', $class_list);
         Tpl::showpage('store_class.index');
     }
 }
开发者ID:noikiy,项目名称:nc-1,代码行数:50,代码来源:store_class.php

示例5: updateAddressOp

 public function updateAddressOp()
 {
     $address_model = Model('address');
     // 验证提交数据
     $obj_validate = new Validate();
     $obj_validate->validateparam = array(array("input" => $_POST["true_name"], "require" => "true", "message" => "真实姓名必填"), array("input" => $_POST["area_id"], "require" => "true", "validator" => "Number", "message" => "地址信息错误"), array("input" => $_POST["city_id"], "require" => "true", "validator" => "Number", "message" => "地址信息错误"), array("input" => $_POST["area_info"], "require" => "true", "message" => "地址信息错误"), array("input" => $_POST["address"], "require" => "true", "message" => "地址信息错误"), array("input" => $_POST['mob_phone'], 'require' => 'true', "validator" => "mobile", 'message' => "手机号码有误"));
     $error = $obj_validate->validate();
     if ($error != '') {
         $error = strtoupper(CHARSET) == 'GBK' ? Language::getUTF8($error) : $error;
         output_error($error);
     }
     $data = array();
     $data['member_id'] = $this->member_info['member_id'];
     $data['true_name'] = $_POST['true_name'];
     $data['area_id'] = intval($_POST['area_id']);
     $data['city_id'] = intval($_POST['city_id']);
     $data['area_info'] = $_POST['area_info'];
     $data['address'] = $_POST['address'];
     $data['mob_phone'] = $_POST['mob_phone'];
     $data['is_default'] = $_POST['is_default'] ? 1 : 0;
     // 判断用户地址数量,如果为0,设置当前添加地址为默认地址
     $address_num = $address_model->getAddressCount(array('member_id' => $this->member_info['member_id'], 'is_default' => 1));
     if ($address_num == 0) {
         $data['is_default'] = 1;
     }
     if ($data['is_default'] == 1) {
         $address_model->editAddress(array('is_default' => 0), array('member_id' => $this->member_info['member_id'], 'is_default' => 1));
     }
     if (intval($_POST['id']) > 0) {
         $rs = $address_model->editAddress($data, array('address_id' => intval($_POST['id']), 'member_id' => $this->member_info['member_id']));
         if (!$rs) {
             output_error("地址信息修改失败");
         }
     } else {
         $count = $address_model->getAddressCount(array('member_id' => $this->member_info['member_id']));
         if ($count >= 20) {
             output_error("最多允许添加20个有效地址");
         }
         $rs = $address_model->addAddress($data);
         if (!$rs) {
             output_error("地址添加失败");
         }
     }
     output_data("设置成功");
 }
开发者ID:noikiy,项目名称:meizhan,代码行数:45,代码来源:mz_member_address.php

示例6: arealistOp

 public function arealistOp()
 {
     $area_model = Model("area");
     $condition = array();
     $condition['parent_area_id'] = $_GET['area_parent_id'] ? intval($_GET['area_parent_id']) : 0;
     if (isset($_POST) && !empty($_POST)) {
         if (isset($_POST['area_name']) && !empty($_POST['area_name'])) {
             $condition['area_name'] = array(array('like', '%' . trim($_POST['area_name']) . '%'));
             Tpl::output('area_name', trim($_POST['area_name']));
         }
         if (isset($_POST['first_letter']) && !empty($_POST['first_letter'])) {
             $condition['first_letter'] = $_POST['first_letter'];
             Tpl::output('first_letter', $_POST['first_letter']);
         }
     }
     $list = $area_model->getList($condition, 15);
     if (!empty($list)) {
         foreach ($list as $key => $val) {
             $child_area = $area_model->table('area')->where(array('parent_area_id' => $val['area_id']))->select();
             if (!empty($child_area)) {
                 $list[$key]['have_child'] = 1;
             }
             unset($child_area);
         }
     }
     Tpl::output('show_page', $area_model->showpage(2));
     Tpl::output('list', $list);
     //城市首字母
     $letterArr = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z');
     Tpl::output('letter', $letterArr);
     if ($_GET['ajax'] == '1') {
         //转码
         if (strtoupper(CHARSET) == 'GBK') {
             $list = Language::getUTF8($list);
         }
         $output = json_encode($list);
         print_r($output);
         exit;
     } else {
         Tpl::showpage("area.list");
     }
 }
开发者ID:noikiy,项目名称:shopnc-2,代码行数:42,代码来源:area.php

示例7: updateOp

	/**
	 * 积分礼品购物车更新礼品数量
	 */
	public function updateOp() {
		$pcart_id	= intval($_GET['pc_id']);
		$quantity	= intval($_GET['quantity']);
		//兑换失败提示
		$msg = L('pointcart_cart_modcart_fail');
		//转码
		if (strtoupper(CHARSET) == 'GBK'){
			$msg = Language::getUTF8($msg);//网站GBK使用编码时,转换为UTF-8,防止json输出汉字问题
		}
		if($pcart_id <= 0 || $quantity <= 0) {
			echo json_encode(array('msg'=>$msg));
			die;
		}
		//验证礼品购物车信息是否存在
		$model_pointcart	= Model('pointcart');
		$cart_info	= $model_pointcart->getPointCartInfo(array('pcart_id'=>$pcart_id,'pmember_id'=>$_SESSION['member_id']));
		if (!$cart_info){
			echo json_encode(array('msg'=>$msg)); die;
		}
		
		//验证是否能兑换
		$data = $model_pointcart->checkExchange($cart_info['pgoods_id'], $quantity, $_SESSION['member_id']);
		if (!$data['state']){
		    echo json_encode(array('msg'=>$data['msg'])); die;
		}
		$prod_info = $data['data']['prod_info'];
		$quantity = $prod_info['quantity'];
		
		$cart_state = true;
		//如果数量发生变化则更新礼品购物车内单个礼品数量
		if ($cart_info['pgoods_choosenum'] != $quantity){
		    $cart_state = $model_pointcart->editPointCart(array('pcart_id'=>$pcart_id,'pmember_id'=>$_SESSION['member_id']),array('pgoods_choosenum'=>$quantity));
		}
		if ($cart_state) {
			//计算总金额
			$amount= $model_pointcart->getPointCartAmount($_SESSION['member_id']);
			echo json_encode(array('done'=>'true','subtotal'=>$prod_info['pointsamount'],'amount'=>$amount,'quantity'=>$quantity));
			die;
		}
	}
开发者ID:noikiy,项目名称:ejia,代码行数:43,代码来源:pointcart.php

示例8: ajax_classOp

 /**
  * AJAX获取商品分类
  */
 public function ajax_classOp()
 {
     $id = intval($_GET['id']);
     $deep = intval($_GET['deep']);
     if ($id <= 0 || $deep <= 0 || $deep >= 4) {
         echo 'false';
         exit;
     }
     $deep += 1;
     $model_goodsclass = Model('goods_class');
     // 验证分类是否存在
     $gc_info = $model_goodsclass->getGoodsClassInfo(array('gc_id' => $id), 'type_id');
     if (empty($gc_info)) {
         echo 'false';
         exit;
     }
     // 读取商品分类
     if ($deep != 4) {
         $gc_list = $model_goodsclass->getGoodsClass($_SESSION['store_id'], $id, $deep);
     }
     // 分类不为空输出分类信息
     if (!empty($gc_list)) {
         $data = array('type' => 'class', 'data' => $gc_list, 'deep' => $deep);
     } else {
         // 查询类型
         $model_type = Model('type');
         $spec_list = $model_type->getSpecByType(array('type_id' => $gc_info['type_id']), 'type_id, spec.*');
         $data = array('type' => 'spec', 'data' => $spec_list, 'gcid' => $id, 'deep' => $deep);
     }
     // 转码
     if (strtoupper(CHARSET) == 'GBK') {
         $data = Language::getUTF8($data);
     }
     echo json_encode($data);
     exit;
 }
开发者ID:Maplecms,项目名称:shopnc-yhmall,代码行数:39,代码来源:store_spec.php

示例9: get_complain_talkOp

 public function get_complain_talkOp()
 {
     $complain_id = intval($_POST['complain_id']);
     $complain_info = $this->get_complain_info($complain_id);
     $model_complain_talk = Model('complain_talk');
     $param = array();
     $param['complain_id'] = $complain_id;
     $complain_talk_list = $model_complain_talk->getComplainTalk($param);
     $talk_list = array();
     $i = 0;
     foreach ($complain_talk_list as $talk) {
         $talk_list[$i]['css'] = $talk['talk_member_type'];
         $talk_list[$i]['talk'] = date("Y-m-d H:i:s", $talk['talk_datetime']);
         switch ($talk['talk_member_type']) {
             case 'accuser':
                 $talk_list[$i]['talk'] .= Language::get('complain_accuser');
                 break;
             case 'accused':
                 $talk_list[$i]['talk'] .= Language::get('complain_accused');
                 break;
             case 'admin':
                 $talk_list[$i]['talk'] .= Language::get('complain_admin');
                 break;
             default:
                 $talk_list[$i]['talk'] .= Language::get('complain_unknow');
         }
         if (intval($talk['talk_state']) === 2) {
             $talk['talk_content'] = Language::get('talk_forbit_message');
         }
         $talk_list[$i]['talk'] .= '(' . $talk['talk_member_name'] . ')' . Language::get('complain_text_say') . ':' . $talk['talk_content'];
         $i++;
     }
     if (strtoupper(CHARSET) == 'GBK') {
         $talk_list = Language::getUTF8($talk_list);
     }
     echo json_encode($talk_list);
 }
开发者ID:Maplecms,项目名称:shopnc-api,代码行数:37,代码来源:member_complain.php

示例10: echo_json

 protected function echo_json($data)
 {
     if (strtoupper(CHARSET) == 'GBK') {
         $data = Language::getUTF8($data);
         //网站GBK使用编码时,转换为UTF-8,防止json输出汉字问题
     }
     echo json_encode($data);
 }
开发者ID:bubargaininc,项目名称:oak_oak,代码行数:8,代码来源:control.php

示例11: savereplyOp

 /**
  * 短消息回复保存
  *
  * @param 
  * @return 
  */
 public function savereplyOp()
 {
     Language::read('member_home_message');
     //查询会员是否允许发送站内信
     $isallowsend = $this->allowSendMessage($_SESSION['member_id']);
     if (!$isallowsend) {
         if ($_GET['inajax'] == 1) {
             showDialog(Language::get('home_message_noallowsend'));
         } else {
             showMessage(Language::get('home_message_noallowsend'), 'index.php?act=home&op=message', 'html', 'error');
         }
     }
     if ($_POST['form_submit'] == 'ok') {
         $message_id = intval($_POST["message_id"]);
         if ($message_id <= 0) {
             showMessage(Language::get('wrong_argument'), 'index.php?act=home&op=message', 'html', 'error');
         }
         $obj_validate = new Validate();
         $obj_validate->validateparam = array(array("input" => $_POST["msg_content"], "require" => "true", "message" => Language::get('home_message_reply_content_null')));
         $error = $obj_validate->validate();
         if ($error != '') {
             if ($_GET['inajax'] == 1) {
                 showDialog(Language::get('error'));
             } else {
                 showMessage(Language::get('error') . $error, '', 'html', 'error');
             }
         }
         $model_message = Model('message');
         //查询站内信
         $param = array();
         $param['message_id'] = "{$message_id}";
         $param['no_message_state'] = "2";
         //未删除
         $message_info = $model_message->getRowMessage($param);
         if (empty($message_info)) {
             if ($_GET['inajax'] == 1) {
                 showDialog(Language::get('home_message_no_record'));
             } else {
                 showMessage(Language::get('home_message_no_record') . $error, '', 'html', 'error');
             }
         }
         //不能回复自己的站内信
         if ($message_info['from_member_id'] == $_SESSION['member_id']) {
             showMessage(Language::get('home_message_no_record'), '', 'html', 'error');
         }
         $insert_arr = array();
         if ($message_info['message_parent_id'] > 0) {
             $insert_arr['message_parent_id'] = $message_info['message_parent_id'];
         } else {
             $insert_arr['message_parent_id'] = $message_info['message_id'];
         }
         $insert_arr['from_member_id'] = $_SESSION['member_id'];
         $insert_arr['from_member_name'] = $_SESSION['member_name'];
         $insert_arr['member_id'] = $message_info['from_member_id'];
         $insert_arr['to_member_name'] = $message_info['from_member_name'];
         $insert_arr['msg_content'] = $_POST['msg_content'];
         $insert_state = $model_message->saveMessage($insert_arr);
         if ($insert_state) {
             //更新父类站内信更新时间
             $update_arr = array();
             $update_arr['message_update_time'] = time();
             $update_arr['message_open'] = 1;
             $model_message->updateCommonMessage($update_arr, array('message_id' => "{$insert_arr['message_parent_id']}"));
         }
         if ($_GET['inajax'] == 1) {
             $insert_arr['msg_id'] = $insert_state;
             if (strtoupper(CHARSET) == 'GBK') {
                 $insert_arr['msg_content'] = Language::getUTF8($insert_arr['msg_content']);
             }
             $insert_arr['msg_content'] = parsesmiles($insert_arr['msg_content']);
             $data = json_encode($insert_arr);
             $js = "replyMsgSuccess(" . $data . ")";
             showDialog(Language::get('home_message_send_success'), '', 'succ', $js);
         } else {
             showMessage(Language::get('home_message_send_success'), 'index.php?act=home&op=privatemsg');
         }
     } else {
         if ($_GET['inajax'] == 1) {
             showDialog(Language::get('home_message_reply_command_wrong'));
         } else {
             showMessage(Language::get('home_message_reply_command_wrong'), '', 'html', 'error');
         }
     }
 }
开发者ID:noikiy,项目名称:shopnc-minion,代码行数:90,代码来源:home.php

示例12: viewed_infoOp

 /**
  * 头部最近浏览的商品
  */
 public function viewed_infoOp()
 {
     $info = array();
     if ($_SESSION['is_login'] == '1') {
         $member_id = $_SESSION['member_id'];
         $info['m_id'] = $member_id;
         if (C('voucher_allow') == 1) {
             $time_to = time();
             //当前日期
             $info['voucher'] = Model()->table('voucher')->where(array('voucher_owner_id' => $member_id, 'voucher_state' => 1, 'voucher_start_date' => array('elt', $time_to), 'voucher_end_date' => array('egt', $time_to)))->count();
         }
         $time_to = strtotime(date('Y-m-d'));
         //当前日期
         $time_from = date('Y-m-d', $time_to - 60 * 60 * 24 * 7);
         //7天前
         $info['consult'] = Model()->table('consult')->where(array('member_id' => $member_id, 'consult_reply_time' => array(array('gt', strtotime($time_from)), array('lt', $time_to + 60 * 60 * 24), 'and')))->count();
     }
     $goods_list = Model('goods_browse')->getViewedGoodsList($_SESSION['member_id'], 5);
     if (is_array($goods_list) && !empty($goods_list)) {
         $viewed_goods = array();
         foreach ($goods_list as $key => $val) {
             $goods_id = $val['goods_id'];
             $val['url'] = urlShop('goods', 'index', array('goods_id' => $goods_id));
             $val['goods_image'] = thumb($val, 60);
             $viewed_goods[$goods_id] = $val;
         }
         $info['viewed_goods'] = $viewed_goods;
     }
     if (strtoupper(CHARSET) == 'GBK') {
         $info = Language::getUTF8($info);
     }
     echo json_encode($info);
 }
开发者ID:noikiy,项目名称:shopnc-minion,代码行数:36,代码来源:index.php

示例13: store_sns_saveOp

    /**
     * 保存动态
     */
    public function store_sns_saveOp()
    {
        /**
         * 验证表单
         */
        $obj_validate = new Validate();
        $obj_validate->validateparam = array(array("input" => $_POST["content"], "require" => "true", "validator" => "Length", "max" => 140, "min" => 1, "message" => Language::get('store_sns_center_error')), array("input" => $_POST["goods_url"], "require" => "false", "validator" => "url", "message" => Language::get('store_goods_index_goods_price_null')));
        $error = $obj_validate->validate();
        if ($error != '') {
            showDialog($error);
        }
        // 实例化模型
        $model = Model();
        $goodsdata = '';
        $content = '';
        $_POST['type'] = intval($_POST['type']);
        switch ($_POST['type']) {
            case '2':
                $sns_image = trim($_POST['sns_image']);
                if ($sns_image != '') {
                    $content = '<div class="fd-media">
									<div class="thumb-image"><a href="javascript:void(0);" nc_type="thumb-image"><img src="' . $sns_image . '" /><i></i></a></div>
									<div class="origin-image"><a href="javascript:void(0);" nc_type="origin-image"></a></div>
								</div>';
                }
                break;
            case '9':
                $data = $this->getGoodsByUrl(html_entity_decode($_POST['goods_url']));
                if (CHARSET == 'GBK') {
                    foreach ((array) $data as $k => $v) {
                        $data[$k] = Language::getUTF8($v);
                    }
                }
                $goodsdata = addslashes(json_encode($data));
                break;
            case '10':
                if (is_array($_POST['goods_id'])) {
                    $goods_id_array = $_POST['goods_id'];
                } else {
                    showDialog(Language::get('store_sns_choose_goods'));
                }
                $field = 'goods_id,store_id,goods_name,goods_image,goods_price,goods_freight';
                $where = array('store_id' => $_SESSION['store_id'], 'goods_id' => array('in', $goods_id_array));
                $goods_array = Model('goods')->getGoodsList($where, $field);
                if (!empty($goods_array) && is_array($goods_array)) {
                    $goodsdata = array();
                    foreach ($goods_array as $val) {
                        if (CHARSET == 'GBK') {
                            foreach ((array) $val as $k => $v) {
                                $val[$k] = Language::getUTF8($v);
                            }
                        }
                        $goodsdata[] = addslashes(json_encode($val));
                    }
                }
                break;
            case '3':
                if (is_array($_POST['goods_id'])) {
                    $goods_id_array = $_POST['goods_id'];
                } else {
                    showDialog(Language::get('store_sns_choose_goods'));
                }
                $field = 'goods_id,store_id,goods_name,goods_image,goods_price,goods_freight';
                $where = array('store_id' => $_SESSION['store_id'], 'goods_id' => array('in', $goods_id_array));
                $goods_array = Model('goods')->getGoodsList($where, $field);
                if (!empty($goods_array) && is_array($goods_array)) {
                    $goodsdata = array();
                    foreach ($goods_array as $val) {
                        if (CHARSET == 'GBK') {
                            foreach ((array) $val as $k => $v) {
                                $val[$k] = Language::getUTF8($v);
                            }
                        }
                        $goodsdata[] = addslashes(json_encode($val));
                    }
                }
                break;
            default:
                showDialog(Language::get('para_error'));
        }
        $model_stracelog = Model('store_sns_tracelog');
        // 插入数据
        $stracelog_array = array();
        $stracelog_array['strace_storeid'] = $this->store_info['store_id'];
        $stracelog_array['strace_storename'] = $this->store_info['store_name'];
        $stracelog_array['strace_storelogo'] = empty($this->store_info['store_label']) ? '' : $this->store_info['store_label'];
        $stracelog_array['strace_title'] = $_POST['content'];
        $stracelog_array['strace_content'] = $content;
        $stracelog_array['strace_time'] = time();
        $stracelog_array['strace_type'] = $_POST['type'];
        if (isset($goodsdata) && is_array($goodsdata)) {
            $stracelog = array();
            foreach ($goodsdata as $val) {
                $stracelog_array['strace_goodsdata'] = $val;
                $stracelog[] = $stracelog_array;
            }
            $rs = $model_stracelog->saveStoreSnsTracelogAll($stracelog);
//.........这里部分代码省略.........
开发者ID:norain2050,项目名称:xingkang,代码行数:101,代码来源:store_sns.php

示例14: myjoinedcircleOp

 /**
  * 我加入的圈子
  */
 public function myjoinedcircleOp()
 {
     $model = Model('circle_member');
     $cm_list = $model->getCircleMemberList(array('member_id' => $_SESSION['member_id'], 'circle_id' => array('neq', 0)), 'circle_id,circle_name,is_identity', 0, 'is_identity asc');
     if (empty($cm_list)) {
         echo false;
         die;
     }
     if (strtoupper(CHARSET) == 'GBK') {
         $cm_list = Language::getUTF8($cm_list);
     }
     echo json_encode($cm_list);
 }
开发者ID:dotku,项目名称:shopnc_cnnewyork,代码行数:16,代码来源:index.php

示例15: silde_image_uploadOp

 /**
  * 店铺幻灯片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;
     }
 }
开发者ID:ff00x0,项目名称:shopnc,代码行数:63,代码来源:store_setting.php


注:本文中的Language::getUTF8方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。