public function proxy() { $city = t($_REQUEST['city']); $data = file_get_contents('http://php.weather.sina.com.cn/iframe/index/w_cl.php?day=2&code=js&cbf=show&city=' . $city); $data = auto_charset($data, 'gb2312', 'utf8'); echo $data; }
function auto_charset(&$fContents, $from = 'gbk', $to = 'utf-8') { $from = strtoupper($from) == 'UTF8' ? 'utf-8' : $from; $to = strtoupper($to) == 'UTF8' ? 'utf-8' : $to; if (strtoupper($from) === strtoupper($to) || empty($fContents) || is_scalar($fContents) && !is_string($fContents)) { //如果编码相同或者非字符串标量则不转换 return $fContents; } if (is_string($fContents)) { if (function_exists('mb_convert_encoding')) { return mb_convert_encoding($fContents, $to, $from); } elseif (function_exists('iconv')) { return iconv($from, $to, $fContents); } else { return $fContents; } } elseif (is_array($fContents)) { foreach ($fContents as $key => $val) { $_key = auto_charset($key, $from, $to); $fContents[$_key] = auto_charset($val, $from, $to); if ($key != $_key) { unset($fContents[$key]); } } return $fContents; } else { return $fContents; } }
public function validateUser() { $retcode = "200"; $arr_message = array("result" => "fail", "message" => "操作出现异常,请稍后再试!"); $db = new DB_test(); $phonenumber = trim($this->arr_body['phonenumber']); $query = "SELECT fd_author_id FROM tb_author WHERE fd_author_username = '******'"; $authorid = $db->get_all($query); if ($authorid != 0 && count($authorid) > 0) { $authorid = $authorid[0]["fd_author_id"]; $query = "SELECT Q.fd_question_contect AS que, A.fd_answer AS answer \n\t\t\t\t\tFROM tb_safeguard_secque_useranswer AS A \n\t\t\t\t\tINNER JOIN tb_safeguard_secque AS Q ON A.fd_question_id = Q.fd_question_id \n\t\t\t\t\tWHERE A.fd_author_id = " . $authorid; $db->query($query); $retcode = "0"; if ($db->nf() > 0) { $arr_msg = auto_charset($db->getData('', 'msgbody'), 'gbk', 'utf-8'); $arr_msg['msgbody']['authorid'] = $authorid; $arr_message = array("result" => "success", "message" => "成功获取密保问题"); } else { $retcode = "200"; $arr_message = array("result" => "failure", "message" => "您还未设置过密保问题"); } } else { $retcode = "200"; $arr_message = array("result" => "failure", "message" => "该手机号还未注册过通付宝账号"); } $arr_msg['msgbody']['result'] = $arr_message['result']; $arr_msg['msgbody']['message'] = $arr_message['message']; $returnvalue = array("msgbody" => $arr_msg['msgbody']); $returnval = TfbxmlResponse::ResponsetoApp($retcode, $returnvalue); return $returnval; }
public function readKuaiDicmpList() { $db = new DB_test(); $arr_header = $this->arr_header; $arr_body = $this->arr_body; $arr_channelinfo = $this->arr_channelinfo; $apptype = trim($arr_body['apptype']); $appversion = trim($arr_body['appversion']); $query = "select fd_kdcompany_id as comid,fd_kdcompany_no as com,fd_kdcompany_name as comname\n\t\t ,fd_kdcompany_api as apitype,fd_kdcompany_pic as comlogo ,fd_kdcompany_phone as comphone from \n\t tb_kdcompany where fd_kdcompany_active = '1' order by fd_kdcompany_api desc"; //只显示激活的列表 $db->query($query); $arr_msg = auto_charset($db->getData('', 'msgbody'), 'gbk', 'utf-8'); if (!$arr_msg) { $arr_message = array("result" => "failure", "message" => "列表为空!"); $retcode = "200"; //反馈状态 0 成功 200 自定义错误 } else { $arr_message = array("result" => "success", "message" => "读取成功!"); $retcode = "0"; //反馈状态 0 成功 200 自定义错误 } $arr_msg['msgbody']['result'] = $arr_message['result']; $arr_msg['msgbody']['message'] = $arr_message['message']; $returnvalue = array("msgbody" => $arr_msg['msgbody']); $returnval = TfbxmlResponse::ResponsetoApp($retcode, $returnvalue); return $returnval; }
public function getAllExpression($flush = false) { $cache_id = '_model_expression'; if (($res = F($cache_id)) === false || $flush === true) { global $ts; $pkg = $ts['site']['expression']; $filepath = SITE_PATH . '/public/themes/' . $ts['site']['site_theme'] . '/images/expression/' . $pkg; require_once ADDON_PATH . '/libs/Io/Dir.class.php'; $expression = new Dir($filepath); $expression_pkg = $expression->toArray(); $res = array(); foreach ($expression_pkg as $value) { if (!is_utf8($value['filename'])) { $value['filename'] = auto_charset($value['filename'], 'GBK', 'UTF8'); } list($file) = explode(".", $value['filename']); $temp['title'] = $file; $temp['emotion'] = '[' . $file . ']'; $temp['filename'] = $value['filename']; $temp['type'] = $pkg; $res[$temp['emotion']] = $temp; } F($cache_id, $res); } return $res; }
private function lists($order = '') { if (empty($order)) { $order = 'id desc'; } $status = $this->input->get('status') === false ? '1' : $this->input->get('status'); $count = $this->db->order_by($order)->where('status', $status)->get($this->table); $count = $count->result_array(); if (count($count) > 0) { //分页 1.load 分页类,2.加载分页配置, $this->load->library('pagination'); $this->config->load('pagination'); $pageconfig = $this->config->item('pagination'); $pageconfig['total_rows'] = count($count); $pageconfig['base_url'] = site_url('user/index'); if (count($count) < $pageconfig['per_page']) { auto_charset($count); return array('lists' => $count); } $offset = $pageconfig['per_page'] * ($this->uri->segment(3, 1) - 1); //return resource object $query = $this->db->_execute("select * from as_" . $this->table . "order by " . $order); $lists = $this->db->limit_access($query, $offset, $pageconfig['per_page']); $pages = $this->paged($pageconfig); $lists = auto_charset($lists); $r = array('lists' => $lists, 'pages' => $pages); return $r; } else { return null; } }
public function readHelpList() { $db = new DB_test(); $arr_header = $this->arr_header; $arr_body = $this->arr_body; $arr_channelinfo = $this->arr_channelinfo; $msgstart = $arr_body['msgstart'] + 0; $msgdisplay = $arr_body['msgdisplay'] + 0; if ($msgstart < 0) { $msgstart = 0; } $query = "select 1 from web_help order by fd_help_no "; $db->query($query); $msgallcount = $db->nf(); $query = "select fd_help_id as helpid ,fd_help_name as helpname,fd_help_contect as helpcontent,\n\t fd_help_date as helpdate from web_help order by fd_help_no limit {$msgstart}, {$msgdisplay} "; $db->query($query); $msgdiscount = $db->nf(); $arr_msg = auto_charset($db->getData('', 'msgbody'), 'gbk', 'utf-8'); $arr_message = array("result" => "success", "message" => "读取成功!"); $retcode = "0"; //反馈状态 0 成功 200 自定义错误 $arr_msg['msgbody']['msgallcount'] = $msgallcount; $arr_msg['msgbody']['msgdiscount'] = $msgdiscount + $msgstart; $arr_msg['msgbody']['result'] = $arr_message['result']; $arr_msg['msgbody']['message'] = $arr_message['message']; $returnvalue = array("msgbody" => $arr_msg['msgbody']); $returnval = TfbxmlResponse::ResponsetoApp($retcode, $returnvalue); return $returnval; }
public function analyseContent($file_contents, $key = '', &$errMsg, &$retCode) { $logger = Logger::getLogger('Ofpay'); $logger->debug("开始解析欧飞返回的数据(" . $file_contents . ")"); $file_contents = auto_charset($file_contents, 'gbk', 'utf-8'); $file_contents = str_replace("gb2312", "utf-8", $file_contents); $file_contents = str_replace("GB2312", "utf-8", $file_contents); $file_contents = simplexml_load_string($file_contents); $logger->debug("开始把数据解析成xml格式:" . $key); foreach ($file_contents->children() as $item) { switch ($item->getName()) { case "err_msg": $errMsg = (string) $item; break; case "retcode": $retCode = (int) $item; break; case $key: return $item; default: $msgBody = $item; } } return $msgBody; }
function toDate($time, $format = 'Y年m月d日 H:i:s') { if (empty($time)) { return ''; } $format = str_replace('#', ':', $format); return date(auto_charset($format), $time); }
function edit($id) { $this->db->where('id', intval($id)); $result = $this->db->get('comments')->result_array(); $result = array_shift($result); auto_charset($result); $this->data['form'] = $result; Displayview::display('comment/edit.html', $this->data); }
function view($type, $id) { //内容类型 $this->type = $this->types[$type]; $query = $this->db->where('id', intval($id))->get('contents'); $data = auto_charset($query->row_array()); //views $this->data['head'] = $this->parser->parse('home/head-page', $this->pagedata, true); $this->data['header'] = $this->parser->parse('home/header.html', $this->pagedata, true); $this->data['footer'] = $this->parser->parse('home/footer.html', $this->pagedata, true); $this->data['content'] = $data; $this->parser->parse($this->type['tpl'], $this->data); }
function Delete() { $id = $_REQUEST['id']; $map['id'] = array('in', $id); if ($list = $this->dao->where($map)->findall()) { $img = auto_charset($list['imgurl'], 'utf-8', 'gbk'); if (file_exists($img)) { unlink($img); } $this->dao->where($map)->delete(); } $this->success("删除成功!"); }
function getStatus($status, $imageShow = true) { switch ($status) { case 0: $showText = '未处理'; $showImg = '<IMG SRC="' . APP_PUBLIC_URL . '/Images/state0.bmp" BORDER="0" ALT="未处理">'; break; case 1: default: $showText = '已处理'; $showImg = '<IMG SRC="' . APP_PUBLIC_URL . '/Images/state1.bmp" BORDER="0" ALT="已处理">'; } return $imageShow === true ? auto_charset($showImg) : $showText; }
public function CreateOrder($msgBody, $authorId, $payType) { $now = time(); $logger = Logger::getLogger('mobilerecharge'); $logger->debug("开始创建手机充值订单({$now})"); $arrPayCard = GetPayCalcuInfo::readpaycardid($msgBody['paycardid'], $authorId); // ****** $logger->debug("正在创建手机充值订单({$now}) : paycardid(" . $msgBody['paycardid'] . "),authorId({$authorId} ),arrPayCard(" . print_r($arrPayCard, true) . ")"); $payCardId = $arrPayCard['paycardid']; // 刷卡器ID $cusId = $arrPayCard['cusid']; // 代理商ID $payfee = 0; // 利润 = 用户支付给通付宝的钱 - 通付宝从向上的进货价- 支付通道的费率 $query = "SELECT (fd_recham_paymoney - fd_recham_costmoney) AS payfee \n\t\t\t\tFROM tb_mobilerechamoney WHERE fd_recham_money = '" . $msgBody['rechargeMoney'] . "'"; $db = new DB_test(); $dataInDB = $db->get_all($query); if (is_array($dataInDB) && count($dataInDB) == 1) { $payfee = $dataInDB[0]['payfee']; $logger->debug("正在创建手机充值订单({$now}) : 用户支付给通付宝的钱 - 通付宝从向上的进货价 = ({$payfee})"); } else { $logger->error("正在创建手机充值订单({$now}) : 无法获取面额" . $msgBody['rechargeMoney'] . "元所对应的利润值"); } $payTypeFee = 0; // 转账费率 switch ($payType) { case "YiBao": $payTypeFee = YiBaoPay::GetPayFee($msgBody['payMoney']); break; case "upmp": $payTypeFee = BankPayInfoV3::GetPayFee($msgBody['payMoney']); break; } // ******** $cusfeeResult = getcusfenrun::get_cusfenrun($cusId, "mobilerecharge", $msgBody['payMoney'], 0, $payfee, 0, date("Y-m-d"), null, null); //$cusfeeResult = getcusfenrun :: get_cusfenrun($cusId, "mobilerecharge", $msgBody['payMoney'], $payTypeFee, $payfee, 0, date("Y-m-d"), null, null); $logger->debug("正在创建手机充值订单({$now}) : cusId({$cusId} ),cusfeeResult(" . print_r($cusfeeResult, true) . ")"); $cusfee = $cusfeeResult["cusfee"]; $cusfee = $cusfee > 0 ? $cusfee : 0; $logger->debug("正在创建手机充值订单({$now}) : 通付宝的利润({$payfee}), 代理商的利润({$cusfee})"); $orderNumber = "tfbmrc" . date("YmdHiss") . mt_rand(1000, 9999); // 创建通付宝订单号 $listno = makeorderno("mobilerechargelist", "mrclist", "mrc"); // ****** $sql = "INSERT INTO tb_mobilerechargelist(fd_mrclist_no, fd_mrclist_paycardid, fd_mrclist_cusid, \n\t\t\t\tfd_mrclist_cusfee, fd_mrclist_authorid, fd_mrclist_paydate, \n\t\t\t\tfd_mrclist_bkordernumber, fd_mrclist_sdcrid, fd_mrclist_payrq, fd_mrclist_paytypeid, \n\t\t\t\tfd_mrclist_paytype, fd_mrclist_rechamoney, fd_mrclist_bkmoney, fd_mrclist_rechaphone, \n\t\t\t\tfd_mrclist_paymoney, fd_mrclist_payfee, fd_mrclist_mobileprov, fd_mrclist_bankcardno, \n\t\t\t\tfd_mrclist_state, fd_mrclist_date, fd_mrclist_datetime) VALUES \n\t\t\t\t('{$listno}', '{$payCardId}', '{$cusId}', \n\t\t\t\t'{$cusfee}', '{$authorId}', NOW(), \n\t\t\t\t'{$orderNumber}', 3, '01', '1', \n\t\t\t\t'mobilerecharge', '" . $msgBody['rechargeMoney'] . "', '" . $msgBody['payMoney'] . "', '" . $msgBody['rechargePhone'] . "', \n\t\t\t\t'" . $msgBody['payMoney'] . "', '{$payfee}', '" . $msgBody['mobileProvince'] . "', '" . $msgBody['bankCardId'] . "', \n\t\t\t\t'0', NOW(), NOW());"; $logger->debug("正在创建手机充值订单({$now}) : ({$sql})"); $sql = auto_charset($sql, 'utf-8', 'gbk'); $db->query($sql); return $orderNumber; }
function getStatus($status, $imageShow = true) { switch ($status) { case 0: $showText = '禁用'; $showImg = '<IMG SRC="../Public/images/locked.gif" WIDTH="20" HEIGHT="20" BORDER="0" ALT="禁用">'; break; case 1: default: $showText = '正常'; $showImg = '<IMG SRC="../Public/images/ok.gif" WIDTH="20" HEIGHT="20" BORDER="0" ALT="正常">'; } return $imageShow === true ? auto_charset($showImg) : $showText; }
public function download() { import("@.ORG.Http"); $id = $_GET['id']; $dao = M("Attach"); $attach = $dao->where("id=" . $id)->find(); $filename = $attach["savepath"] . $attach["savename"]; if (is_file($filename)) { if (!isset($_SESSION['attach_down_count_' . $id])) { $dao->setInc('downCount', "id=" . $id); $_SESSION['attach_down_count_' . $id] = true; } Http::download($filename, auto_charset($attach->name, 'utf-8', 'gbk')); } }
public function down() { $aid = I('get.attach_id'); $attach = D('Attach/Attach')->find($aid); if (!$attach) { die(L('PUBLIC_ATTACH_ISNULL')); } $filename = $attach['filepath'] . $attach['savename']; $realname = auto_charset($attach['name'], 'UTF-8', 'GBK//IGNORE'); if (file_exists($filename)) { Http::download($filename, $realname); } else { die(L('PUBLIC_ATTACH_ISNULL')); } }
public static function getagentprodure($cusid) { $db = new DB_test(); $query = "select fd_cus_fenrunid as fenrunid from tb_customer where fd_cus_id = '{$cusid}' "; if ($db->execute($query)) { $arr_cus = $db->get_one($query); $fenrunid = $arr_cus['fenrunid']; } $query = "select fd_fenrun_agentprodureid as agentprodureid,fd_fenrun_agentprodure as agentprodure,fd_fenrun_agentprice as agentprice,\n fd_fenrun_limitmaxnum as limitmaxnum,fd_fenrun_limitminnum as limitminnum\n from tb_cus_fenrunset where fd_fenrun_id = '{$fenrunid}' "; if ($db->execute($query)) { $arr_fenrun = $db->get_one($query); $arr_fenrun = auto_charset($arr_fenrun, 'gbk', 'utf-8'); } return $arr_fenrun; }
public function getorderinfo($querywhere, $start, $display) { $dbmsale = new DB_mssale(); if ($start < 0) { $start = 0; } $start = $start + 0; $display = $display + 0; $query = "select 1 from web_order where 1=1 {$querywhere} "; $dbmsale->query($query); $msgallcount = $dbmsale->nf(); $wfstate = '未付款'; $wfstate = u2g($wfstate); $yfstate = '已付款'; $yfstate = u2g($yfstate); $qfstate = '其他'; $qfstate = u2g($qfstate); $query = "select case \n\t when fd_order_state ='6' then '" . $wfstate . "'\n\t when fd_order_state ='7' then '" . $yfstate . "'\n\t else '" . $qfstate . "' END orderstate,fd_order_id as orderid,fd_order_no as orderno ,\n\t\t fd_order_date as ordertime ,fd_order_allmoney as ordermoney,fd_order_alldunshu as orderpronum,\n\t\t fd_order_type as orderpaytype,fd_order_shman as shman,fd_order_comnpany as shcmpyname,\n\t\t fd_order_receiveadderss as shaddress , '' as fhstorage,'' as fhwltype,\n\t\t fd_order_memo as ordermemo,'' as allpromoney,'' as fhwlmoney\n\t\t from web_order " . "where 1=1 {$querywhere} limit {$start} ,{$display}"; $dbmsale->query($query); //echo $query; $msgdiscount = $dbmsale->nf(); $arr_value = $dbmsale->getData('', 'msorder'); //$arr_orderinfo = $dbmsale->get_all($query); foreach ($arr_value as $key => $value) { foreach ($value as $k => $v) { $orderid = $v['orderid']; $query = "select fd_orderdetail_quantity as pronum,fd_orderdetail_productname as proname,\n\t\t\t\t\t fd_orderdetail_price as proprice \n\t\t\t\t\t ,(fd_orderdetail_price*fd_orderdetail_quantity) as promoney from web_orderdetail \n\t\t\t\t\t where fd_orderdetail_orderid ='{$orderid}'"; $dbmsale->query($query); //echo $query; if ($dbmsale->nf()) { $arr_value[$key][$k]['msproinfo'] = $dbmsale->getFiledData('msgchild'); } } } if (!$arr_value) { $arr_message = array("result" => "failure", "message" => "很抱歉,没有找到相关的订单信息!"); } else { $arr_message = array("result" => "success", "message" => "读取成功"); } //echo var_dump($arr_value); $arr_message = auto_charset($arr_message, 'utf-8', 'gbk'); $arr_msg['msgbody'] = $arr_value; $arr_msg['msgbody']['result'] = $arr_message['result']; $arr_msg['msgbody']['message'] = $arr_message['message']; $arr_msg['msgbody']['msgallcount'] = $msgallcount; $arr_msg['msgbody']['msgdiscount'] = $msgdiscount + $start; return $arr_msg['msgbody']; }
public function del_attrs($products_id) { if ($products_id) { $map['products_id'] = array('in', $products_id); $list = $this->where($map)->findall(); if ($list) { foreach ($list as $k => $v) { $v['img_url'] = auto_charset($v['img_url'], 'utf-8', 'gbk'); if (file_exists($v['img_url'])) { unlink($v['img_url']); } } } $this->where($map)->delete(); } }
function sendmail($to, $from, $subject = "", $body = "", $mailtype, $cc = "", $bcc = "", $additional_headers = "") { $subject = auto_charset($subject, 'utf-8', 'gbk'); $mail_from = $this->get_address($this->strip_comment($from)); $body = ereg_replace("(^|(\r\n))(\\.)", "\\1.\\3", $body); $header .= "MIME-Version:1.0\r\n"; if ($mailtype == "HTML") { $header .= "Content-Type:text/html;charset=utf-8\r\n"; } $header .= "To: " . $to . "\r\n"; if ($cc != "") { $header .= "Cc: " . $cc . "\r\n"; } $header .= "From: {$from}<" . $from . ">;\r\n"; $header .= "Subject: " . $subject . "\r\n"; $header .= $additional_headers; $header .= "Date: " . date("r") . "\r\n"; $header .= "X-Mailer:By Redhat (PHP/" . phpversion() . ")\r\n"; list($msec, $sec) = explode(" ", microtime()); $header .= "Message-ID: <" . date("YmdHis", $sec) . "." . $msec * 1000000 . "." . $mail_from . ">;\r\n"; $TO = explode(",", $this->strip_comment($to)); if ($cc != "") { $TO = array_merge($TO, explode(",", $this->strip_comment($cc))); } if ($bcc != "") { $TO = array_merge($TO, explode(",", $this->strip_comment($bcc))); } $sent = TRUE; foreach ($TO as $rcpt_to) { $rcpt_to = $this->get_address($rcpt_to); if (!$this->smtp_sockopen($rcpt_to)) { $this->log_write("Error: Cannot send email to " . $rcpt_to . "\n"); $sent = FALSE; continue; } if ($this->smtp_send($this->host_name, $mail_from, $rcpt_to, $header, $body)) { $this->log_write("E-mail has been sent to <" . $rcpt_to . ">;\n"); } else { $this->log_write("Error: Cannot send email to <" . $rcpt_to . ">;\n"); $sent = FALSE; } fclose($this->sock); $this->log_write("Disconnected from remote host\n"); } return $sent; }
public function info() { $tag = urldecode($_GET['tag']); if (!is_utf8($tag)) { $tag = auto_charset($tag, 'gbk', 'utf-8'); } $tag = msubstr(in($tag), 0, 20); //查找tag信息 if (!empty($tag)) { $info = model('tags')->tag_info($tag); } else { $this->error404(); } if (empty($info)) { $this->error404(); } //更新点击计数 model('tags')->views_content($info['id'], $info['click']); /*hook*/ $this->plus_hook('tags', 'index', $info); /*hook end*/ //分页处理 $url = __INDEX__ . '/tags-' . $tag . '/pages-{page}.html'; $listrows = $this->config['TPL_TAGS_PAGE']; if (empty($listrows)) { $listrows = 20; } $limit = $this->pagelimit($url, $listrows); $nav = array(0 => array('name' => 'TAG', 'url' => __INDEX__ . '/tags/index'), 1 => array('name' => $tag, 'url' => __INDEX__ . '/tags-' . $tag . '/')); //MEDIA信息 $this->common = model('pageinfo')->media($info['name'] . ' - TAGS', $tag); //内容列表 $loop = model('tags')->tag_list($info['id'], $limit); //统计总内容数量 $count = model('tags')->tag_count($info['id']); //分页处理 $this->page = $this->page($url, $count, $listrows); //获取上一页代码 $this->prepage = $this->page($url, $count, $listrows, '', 1); //获取下一页代码 $this->nextpage = $this->page($url, $count, $listrows, '', 2); $this->assign('loop', $loop); $this->assign('nav', $nav); $this->assign('info', $info); $this->display($this->config['TPL_TAGS']); }
function get_feature_code() { @exec("systeminfo", $array); for ($i = 1; $i <= 10; $i++) { $new[$i] = auto_charset($array[$i], 'gb2312', 'utf-8'); } $new1 = explode(":", $new[1]); $new9 = explode(":", $new[9]); $new10 = explode(":", $new[10]); $str = $new1[1] . "|" . $new9[1] . "|" . $new10[1]; $str = str_replace(" ", "", $str); $v1 = f_encode($str); $T_k1 = "cdrGDaNiVKRAwoOQgPEWsejkLnHxzShFuJCBXpltfImTUYMbqvyZ"; $T_k2 = "EekCZmLfJblTtiMyDVFRSHnBzXwrKdNgGvcpqhUaosYQAOWjuIPx"; $c = strtr($v1, $T_k1, $T_k2); return $c; }
function Delete() { $id = $_REQUEST['id']; if ($id) { $map['id'] = array('in', $id); if ($list = $this->dao->where($map)->select()) { foreach ($list as $k => $v) { $img = auto_charset($v['img_url'], 'utf-8', 'gbk'); if (file_exists($img)) { unlink($img); } } $this->dao->where($map)->delete(); } } $this->success("删除成功!"); }
public function articlelist() { $map = array(); if (!empty($_REQUEST['pid'])) { $map['pid'] = $_REQUEST['pid']; $this->pid = $map['pid']; } if (!empty($_REQUEST['key'])) { $map['title'] = array('like', '%' . auto_charset($_REQUEST['key'], 'gbk', 'utf-8') . '%'); } $this->cateoption = D('Article_cate')->cate_option(0, 0, $_REQUEST['pid']); $this->sort = 'pid desc'; $this->_list($map); $list = $this->get('list'); $article_cate_model = D('Article_cate'); foreach ($list as $k => $v) { $list[$k]['catename'] = $article_cate_model->where(array('id' => $v['pid']))->getField('name'); } $this->assign('list', $list); $this->display(); }
public function massSendCcdx($mob, $content, $time, $isSub=false){ $client = new SoapClient($this->wsdl); if(!$isSub){ $sName = $this->msgconfig['sms']['user']; $sPwdDES = do_mencrypt($this->msgconfig['sms']['pass'], $this->smsdeskey); }else{ $sName = $this->msgconfig['sms']['subuser']; $sPwdDES = do_mencrypt($this->msgconfig['sms']['subpass'], $this->smsdeskey); } $sDst = do_mencrypt($mob, $this->smsdeskey); $sMsg = do_mencrypt(auto_charset($content,"utf-8",'gbk'), $this->smsdeskey); $sTime = do_mencrypt($time, $this->smsdeskey); $sExNo = do_mencrypt('', $this->smsdeskey); $param = array('sName'=>$sName,'sPwd'=>$sPwdDES, 'sDst'=>$sDst, 'sMsg'=>$sMsg, 'sTime'=>$sTime, 'sExNo'=>$sExNo, 'smsType'=>'CCDX'); try{ $ret = $client->massSendCcdx($param); $data = dealSmsResult($ret->massSendCcdxResult); }catch(Exception $e){ $data = $e->getMessage(); } return $data; }
public function tags_url($tags, $page = null) { if (empty($tags)) { $this->error404(); } if (!is_utf8($tags)) { $tags = auto_charset($tags, 'gbk', 'utf-8'); } $_GET['tag'] = $tags; $info = $this->model->table('tags')->where('name="' . $tags . '"')->find(); if ($info['lang'] != model('lang')->langid()) { $this->error404(); } if (!$info) { $this->error404(); } if (!empty($page)) { $_GET['page'] = $page; } module('tags')->info(); return; }
public function massSend1($mob,$content, $time, $isSub=false) { if(!$isSub){ $uid = $this->msgconfig ['sms'] ['user']; // 分配给你的账号 $pwd = $this->msgconfig ['sms'] ['pass']; // 密码 }else{ $uid = $this->msgconfig ['sms'] ['subuser']; // 分配给你的账号 $pwd = $this->msgconfig ['sms'] ['subpass']; // 密码 } $mob = $mob; // 发送号码用逗号分隔 $content = urlencode ( auto_charset ( $content, "utf-8", 'gbk' ) ); // 短信内容 // 功能:发送短信 // $time = date('YmdHi',time()); // 备用IP地址为203.81.21.13 $fp = fopen ( $this->ismsinfo ["MASSSEND_URL"] . "?name=$uid&pwd=$pwd&dst=$mob&msg=$content&time=$time", "r" ); $ret = fgetss ( $fp, 255 ); $ret = auto_charset ( $ret, "gbk", 'utf-8' ); fclose ( $fp ); $data = dealSmsResult ( $ret ); return $data; }
public function download() { $aid = intval($_REQUEST['id']); $uid = intval($_REQUEST['uid']); $attach = model('Xattach')->where("id='{$aid}' AND uid='{$uid}'")->find(); //$attach = model('Xattach')->where("id='$aid'")->find(); if (!$attach) { $this->error('附件不存在或已被删除!'); } //下载函数 //import("ORG.Net.Http"); //调用下载类 require_cache('./addons/libs/Think/Http.class.php'); if (file_exists(UPLOAD_PATH . '/' . $attach['savepath'] . $attach['savename'])) { //增加下载次数 model('Xattach')->setInc('totaldowns', "id='{$aid}'"); //输出文件 $filename = $attach['name']; $filename = auto_charset($filename, "UTF-8", 'GBK'); //$filename = 'attach_'.$attach['id'].'.'.$attach['extension']; Http::download(UPLOAD_PATH . '/' . $attach['savepath'] . $attach['savename'], $filename); } else { $this->error('附件不存在或已被删除!'); } }
public function addAll($map, $table, $lock, $fetchSql = false) { if (0 === strpos($this->dbType, 'MYSQL')) { $fields = array_keys((array) $map[0]); array_walk($fields, array($this, 'addSpecialChar')); $fieldsStr = implode(',', $fields); $values = array(); foreach ($map as $data) { foreach ($data as $key => $val) { if (is_scalar($val)) { $_data[$key] = $val; } } $_data = auto_charset($_data, C('OUTPUT_CHARSET'), C('DB_CHARSET')); $_values = array_values($_data); array_walk($_values, array($this, 'fieldFormat'), true); $values[] = '( ' . implode(',', $_values) . ' )'; } $valuesStr = implode(',', $values); $this->queryStr = 'INSERT INTO ' . $this->parseTable($table) . ' (' . $fieldsStr . ') VALUES ' . $valuesStr; return $this->execute($this->queryStr, $lock, $fetchSql); } else { //$this->startTrans(); foreach ($map as $data) { $this->add($data, $table); } //$this->commit(); } }