public function edit($responseinfo) { //Api配置参数 $res = unserialize($responseinfo['response_compos']); $config = ''; foreach ($res['replace'] as $key => $value) { if (!empty($value)) { $config .= $key . ':' . $value . "\n"; } } $res['config'] = $config; //Api插件模块 第三方接口 if ($res['type'] == 'cloud') { $cloudlist = M('webuntil')->where(array('status' => 1))->field('id,webuntil_type,webuntil_name,webuntil_backtype,webuntil_title')->select(); $locallist = array(); foreach ($cloudlist as $key => $value) { $locallist[$key] = array('id' => $value['id'], 'title' => $value['webuntil_name'], 'name' => " 请求" . $value['webuntil_type'], 'description' => "回复" . $value['webuntil_backtype']); } } else { $locallist = M('Addons')->where(array('status' => 1, 'weixin' => 1))->field('id,title,name,description,config')->select(); foreach ($locallist as $key => $value) { $locallist[$key]['description'] = msubstr($value['description'], 0, 25, $charset = "utf-8", $suffix = true); } } $res['localapi'] = $locallist; return $res; }
public function get_payment_code($payment_notice_id) { $payment_notice = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment_notice where id = " . $payment_notice_id); $money = round($payment_notice['money'], 2); $payment_info = $GLOBALS['db']->getRow("select id,config,logo from " . DB_PREFIX . "payment where id=" . intval($payment_notice['payment_id'])); $payment_info['config'] = unserialize($payment_info['config']); $sql = "select name " . "from " . DB_PREFIX . "deal_order_item " . "where order_id =" . intval($payment_notice['order_id']); $title_name = $GLOBALS['db']->getOne($sql); $subject = msubstr($title_name, 0, 40); $data_return_url = SITE_DOMAIN . APP_ROOT . '/index.php.php?ctl=payment&act=response&class_name=Wtenpay'; $notify_url = SITE_DOMAIN . APP_ROOT . '/index.php?ctl=payment&act=notify&class_name=Wtenpay'; $pay = array(); $pay['subject'] = $subject; $pay['body'] = $title_name; $pay['total_fee'] = $money; $pay['total_fee_format'] = format_price($money); $pay['out_trade_no'] = $payment_notice['notice_sn']; $pay['notify_url'] = $notify_url; $pay['partner'] = $payment_info['config']['tenpay_partner']; //合作商户ID $pay['key'] = $payment_info['config']['tenpay_key']; //支付宝(RSA)公钥 $pay['pay_code'] = 'wtenpay'; //,支付宝;mtenpay,财付通;mcod,货到付款 return $pay; }
public function update() { $id = $_REQUEST['id']; $title = $_REQUEST['title']; if (!empty($id)) { $data = $_POST; if (!empty($title)) { $data['title'] = $title; } if (empty($_POST['brief'])) { // import("@.ORG.Validation"); // $v = new Validation(); // $description = $v->kill_html($_POST['description']); $description = strip_tags($_POST['description']); $data['brief'] = msubstr(trim($description), 0, 120); } $data['id'] = $id; $model = $this->getActionName(); $case = M($model); // 更新数据 $list = $case->save($data); if (false !== $list) { $this->assign('jumpUrl', U("News/")); $this->success('编辑成功!'); } else { //错误提示 $this->error('编辑失败!'); } } else { //错误提示 $this->error('编辑失败!'); } }
/** * 加载相应的类型消息 * @param unknown_type $msg 数据集(即数据库中的对应消息行) * * 返回:array("id"=>"当前消息ID",title="标题",is_read=>"是否已读","icon"=>"相关数据的图片(可为空)","content"=>"内容","create_time"=>"时间","link"=>"(可为空)相关数据的跳转链接"); */ public function load_msg($msg) { if (!$msg['data']) { require_once APP_ROOT_PATH . "system/model/topic.php"; $data = get_topic_item($msg['data_id']); $msg['data'] = serialize($data); $GLOBALS['db']->autoExecute(DB_PREFIX . "msg_box", $msg, "UPDATE", "id=" . $msg['id'], "SILENT"); } $data = unserialize($msg['data']); //图标,取分享的第一张 if ($data['id'] != $data['origin_id'] && $data['origin']) { $msg['title'] = $data['origin']['forum_title']; $msg['icon'] = $data['origin']['images'][0]['o_path']; $msg['link'] = $data['origin']['url']; } else { $msg['title'] = $data['forum_title']; $msg['icon'] = $data['images'][0]['o_path']; $msg['link'] = $data['url']; } if ($msg['title'] == "") { $msg['title'] = "会员分享"; } $msg['short_title'] = msubstr($msg['title']); return $msg; }
/** * @author Knight * @cnname 我的文章列表 */ public function dailyList() { $where = "status=1 and permission=1"; $typeId = I("id"); //日子类别Id if (!empty($typeId)) { $where .= " and type=" . $typeId; } $count = M("daily")->where($where)->count(); $page = new \Think\Page($count, 5); $show = $page->show(); $dailyList = M("daily")->where($where)->order("c_time desc")->limit($Page->firstRow . ',' . $page->listRows)->select(); foreach ($dailyList as $k => $v) { $where = "id=" . $v['type']; $typeName = $this->getInfo("daily_type", array("type_name"), $where); $dailyList[$k]['typeName'] = $typeName[0]['type_name']; $dailyList[$k]['c_time'] = date("Y-m-d", $v['c_time']); $dailyList[$k]['content'] = msubstr(filterHtml($v['content']), 0, 100, "utf-8"); } $pageList = $page->show(); $this->assign('type', 1); $this->assign("pageList", $pageList); //分页数据 $this->assign("pageTotal", $page->totalPages); //分页总数 $this->assign("dailyList", $dailyList); $this->display("Index/newList"); }
public function add() { if (!$GLOBALS['islogin']) { exit; } if (!checkpost()) { exit; } $diary = M('diary'); $uid = $GLOBALS['i']['uid']; $data['uid'] = $GLOBALS['i']['uid']; $content = postvar('content'); $data['original_cont'] = exp_content($content); $content = msubstr($content, 0, 100, 'utf-8', false); $data['content'] = exp_content($content); $data['mood'] = postvar('mood'); $data['read_type'] = postvar('read_type', 1); $data['add_time'] = time(); $data['set_time'] = strtotime(postvar('set_time')); $did = $diary->add($data); //echo $diary->getLastSql(); $member_field = M('member_field'); $data1['diary_num'] = array('exp', 'diary_num+1'); $member_field->where("uid={$uid}")->save($data1); $body = array('did' => $did, 'content' => $data['content']); //feed_publish(1, $body, $did); $feedModel = D('Feed'); $feedModel->feed_publish(1, $body, $did); echo '{"errno":200}'; }
function get_user_withdraw($limit, $user_id) { $user_id = intval($user_id); $list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "withdraw where user_id = " . $user_id . " and is_delete = 0 order by create_time desc limit " . $limit); foreach ($list as $k => $v) { $bank_account_end = substr($v['bank_account'], -4, 4); $bank_account_show_length = strlen($v['bank_account']) - 4; $bank_account = ""; for ($i = 0; $i < $bank_account_show_length; $i++) { $bank_account .= "*"; } $bank_account .= $bank_account_end; $list[$k]['bank_account'] = $bank_account; $bank_user_end = msubstr($v['bank_user'], -1, 1, "utf-8", false); $bank_user_show_length = mb_strlen($v['bank_user'], "utf-8") - 1; $bank_user = ""; for ($i = 0; $i < $bank_user_show_length; $i++) { $bank_user .= "*"; } $bank_user .= $bank_user_end; $list[$k]['bank_user'] = $bank_user; } $count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "withdraw where user_id = " . $user_id . " and is_delete = 0"); return array("list" => $list, 'count' => $count); }
public function get_payment_code($payment_notice_id) { $payment_notice = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment_notice where id = " . $payment_notice_id); $money = round($payment_notice['money'], 2); $payment_info = $GLOBALS['db']->getRow("select id,config,logo from " . DB_PREFIX . "payment where id=" . intval($payment_notice['payment_id'])); $payment_info['config'] = unserialize($payment_info['config']); $sql = "select name " . "from " . DB_PREFIX . "deal_order_item " . "where order_id =" . intval($payment_notice['order_id']); $title_name = $GLOBALS['db']->getOne($sql); $subject = msubstr($title_name, 0, 40); //$data_return_url = get_domain().APP_ROOT.'/../payment.php?act=return&class_name=Malipay'; $notify_url = get_domain() . APP_ROOT . '/../shop.php?ctl=payment&act=response&class_name=Malipay'; $pay = array(); $pay['subject'] = $subject; $pay['body'] = $title_name; $pay['total_fee'] = $money; $pay['total_fee_format'] = format_price($money); $pay['out_trade_no'] = $payment_notice['notice_sn']; $pay['notify_url'] = $notify_url; $pay['partner'] = $payment_info['config']['alipay_partner']; //合作商户ID $pay['seller'] = $payment_info['config']['alipay_account']; //账户ID $pay['rsa_alipay_public'] = $payment_info['config']['alipay_rsa_public']; //支付宝(RSA)公钥 $pay['pay_code'] = 'malipay'; //,支付宝;mtenpay,财付通;mcod,货到付款 $order_spec = ''; $order_spec .= 'partner="' . $pay['partner'] . '"'; //合作商户ID $order_spec .= '&seller="' . $pay['seller'] . '"'; //账户ID $order_spec .= '&out_trade_no="' . $pay['out_trade_no'] . '"'; $order_spec .= '&subject="' . $pay['subject'] . '"'; $order_spec .= '&body="' . $pay['body'] . '"'; $order_spec .= '&total_fee="' . $pay['total_fee'] . '"'; $order_spec .= '¬ify_url="' . $pay['notify_url'] . '"'; $pay['order_spec'] = $order_spec; $sign = $this->sign($order_spec); $pay['sign'] = urlencode($sign); $pay['sign_type'] = 'RSA'; /* $pubkey = 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC6IQ/HH06GbTIhKNN/YSQXxllnP7cNERMuN16GgZDfuf9NrY/Bw2ZINkq1RMNlbP66Vu5y0gwYPC/7PbO5l6pbnl3N4rw5VY3U6rtIC0f8ADDLrIZwShYUitaFq+Ao7rhk/GbpfSD7vgnugQz74fVewi17S3Apujq4U4LAxFmVowIDAQAB'; $pubkey = $this->getPublicKeyFromX509($pubkey); $res = openssl_pkey_get_public($pubkey); $sign = base64_decode($sign); $verify = openssl_verify($order_spec, $sign, $res); if ($verify == 1) { $pay['openssl_verify'] = 'ok'; }else{ $pay['openssl_verify'] = 'error'; } */ // // print_r($payment_info['config']); // print_r($pay);exit; return $pay; }
public function content() { $id = I('id'); $map['id'] = $id; $info = D('Material')->_get($map); $this->assign('vo', $info); $this->assign('header_title', msubstr($info['title'], 0, 19)); $this->display(); }
protected function auto_desc() { $desc = I('post.desc', ''); if (!empty($desc)) { return $desc; } $content = strip_tags(I('post.content')); $desc = msubstr($content, 0, 200); return $desc; }
public function index($type = 'inbox') { $dao = model('Message'); $list = $type == 'inbox' ? $dao->getInboxByUid($this->mid) : $dao->getOutboxByUid($this->mid); foreach ($list['data'] as $k => $v) { $list['data'][$k]['summary'] = msubstr($v['content'], 0, 100); } $this->assign($list); $session_count = $dao->getSessionCount($this->mid, getSubByKey($list['data'], 'source_message_id')); $this->assign('session_count', $session_count); $this->assign('type', $type); $this->display('list'); }
public function category($category_id = 0) { $map['category'] = $category_id; $map['status'] = 1; $questionModel = new QuestionModel(); $hot_list = $questionModel->getList($map, '*', 5, 'answer_num desc'); foreach ($hot_list as &$val) { $val['info'] = msubstr(op_t($val['description']), 0, 50); } unset($val); $this->assign('hot_list', $hot_list); $this->display(T('Application://Question@Widget/category')); }
/** * 获取收藏列表 * @param int $uid 用户uid */ public function getLists($uid) { $map = array('user_id' => $uid); $lists = $this->where($map)->select(); $product = array(); foreach ($lists as $key => $value) { $product = M('FxProduct')->field('product_name, thumb')->where(array('product_id' => $value['product']))->find(); $lists[$key]['title'] = msubstr($product['product_name'], 0, 15); $lists[$key]['thumb'] = thumb($product['thumb']); $lists[$key]['url'] = U('Index/product', array('id' => $value['product'])); $lists[$key]['del_url'] = U('collect', array('type' => 2, 'product_id' => $value['product'])); } return $lists; }
/** * 加载相应的类型消息 * @param unknown_type $msg 数据集(即数据库中的对应消息行) * * 返回:array("id"=>"当前消息ID",title="标题",is_read=>"是否已读","icon"=>"相关数据的图片(可为空)","content"=>"内容","create_time"=>"时间","link"=>"(可为空)相关数据的跳转链接"); */ public function load_msg($msg) { if (!$msg['data']) { $data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_order_item where id = " . $msg['data_id']); $msg['data'] = serialize($data); $GLOBALS['db']->autoExecute(DB_PREFIX . "msg_box", $msg, "UPDATE", "id=" . $msg['id'], "SILENT"); } $data = unserialize($msg['data']); $msg['title'] = $data['name']; $msg['icon'] = $data['deal_icon']; $msg['link'] = url("index", "uc_order#view", array("id" => $data['order_id'])); $msg['short_title'] = msubstr($msg['title']); return $msg; }
/** * 页面列表 */ public function newslist() { $_REQUEST['tabHash'] = 'newslist'; //按钮 //$this->pageButton[] = array('uid','title'=>'搜索', 'onclick'=>"admin.fold('search_form')"); $this->pageButton[] = array('uid', 'title' => '删除', 'onclick' => "admin.deleteInfo();"); $this->pageButton[] = array('uid', 'title' => '添加资讯', 'onclick' => "location.href='" . U('news/admin/setinfo', array('tabHash' => 'newslist')) . "';"); //处理分类HASH $cs = model('CategoryTree')->setTable('news_category')->getCategoryList(); $categorys = array(); foreach ($cs as $ct) { $categorys[$ct['news_category_id']] = $ct; } //构造搜索条件 //列表key值 DOACTION表示操作 $this->pageKeyList = array('image', 'news_title', 'news_content', 'state', 'is_top', 'hits', 'date', 'DOACTION'); $listData = M('News')->order('news_id desc')->findPage(15); foreach ($listData['data'] as $key => $val) { $listData['data'][$key]['id'] = $val['news_id']; $thumb = APPS_URL . '/' . APP_NAME . '/_static/nopic.jpg'; if ($val['image']) { $attach = model('Attach')->getAttachById($val['image']); if ($attach) { $thumb = getImageUrl($attach['save_path'] . $attach['save_name'], 100, 100, true); } } //获取分类 $type_str = ''; if ($val['type_id']) { if (isset($categorys[$val['type_id']])) { $type_str .= $categorys[$val['type_id']]['title']; if (isset($categorys[$categorys[$val['type_id']]['pid']])) { $type_str = $categorys[$categorys[$val['type_id']]['pid']]['title'] . '--' . $type_str; } } } $listData['data'][$key]['image'] = '<img src="' . $thumb . '">'; $listData['data'][$key]['news_title'] = msubstr($val['news_title'], 0, 20) . "<BR><BR><font style='color:#7d7d7d;'>分类: " . $type_str . "</font>"; $listData['data'][$key]['news_content'] = msubstr(strip_tags($val['news_content']), 0, 20); $listData['data'][$key]['state'] = D('News')->getState($val['state']); $listData['data'][$key]['date'] = '创建:' . date('m/d G:i', $val['created']); if ($val['updated']) { $listData['data'][$key]['date'] .= '<br>更新:' . date('m/d G:i', $val['updated']); } $listData['data'][$key]['is_top'] = $val['is_top'] ? '<font color="red">置顶</font>' : '否'; $listData['data'][$key]['DOACTION'] = '<a href="' . U('news/admin/setinfo', array('news_id' => $val['news_id'], 'tabHash' => 'setinfo')) . '">编辑</a>'; } $this->displayList($listData); }
public function head() { //读取数据库和缓存 $type = M('type'); $article = M('article'); $config = F('basic', '', './Web/Conf/'); //封装网站配置 $this->assign('config', $config); //滚动公告 $data['status'] = 1; $data['typeid'] = $config['noticeid']; $roll = $article->where($data)->field('aid,title')->order('addtime desc')->limit($config['rollnum'])->select(); //处理标题:防止标题过长撑乱页面 foreach ($roll as $k => $v) { $roll[$k]['title'] = msubstr($v['title'], 0, 20, 'gb2312'); } $this->assign('roll', $roll); //网站导航 $menu = $type->where('ismenu=1')->order('drank asc')->select(); foreach ($menu as $k => $v) { $menuson[$k] = $type->where('fid=' . $v['typeid'] . ' AND drank <> 0')->order('drank asc')->select(); } $this->assign('menuson', $menuson); $this->assign('menu', $menu); //位置导航 $nav = '<a href="__APP__">首页</a>'; if (isset($_GET['aid'])) { $typeid = $article->where('aid=' . $_GET['aid'])->getField('typeid'); } else { $typeid = $_GET['typeid']; } $typename = $type->where('typeid=' . $typeid)->getField('typename'); $path = $type->where('typeid=' . $typeid)->getField('path'); $typelist = explode('-', $path); //拼装导航栏字符串 foreach ($typelist as $v) { if ($v == 0) { continue; } $s = $type->where('typeid=' . $v)->getField('typename'); $nav .= " > <a href=\"" . U('lists/' . $v) . "\">{$s}</a>"; } $nav .= " > <a href=\"" . U('lists/' . $typeid) . "\">{$typename}</a>"; $this->assign('nav', $nav); //释放内存 unset($type, $article); $this->assign('head', TMPL_PATH . $config['sitetpl'] . '/head.html'); $this->assign('footer', TMPL_PATH . $config['sitetpl'] . '/footer.html'); }
function smarty_modifier_truncate($string, $length = 80, $etc = '...', $break_words = false) { if ($length == 0) { return ''; } if (strlen($string) > $length) { $length -= strlen($etc); if (!$break_words) { $string = preg_replace('/s+?(S+)?$/', '', msubstr($string, 0, $length + 1)); } return msubstr($string, 0, $length) . $etc; } else { return $string; } }
protected function kuaidi($param) { global $_W; $content = str_replace('+', '', $_W['content']); $content = str_replace(' ', '', $content); if (strstr($_W['content'], '快递')) { wx_success("【快递名字+单号】查询快递\n圆通 中通 申通 顺丰 韵达 邮政 EMS\n例查圆通发送:圆通2728435536\n例查中通发送:中通778044381976"); } $kuaidic = array(); $kuaidil = array(); //单号长度 $kuaidic["圆通"] = 10; $kuaidic["申通"] = 12; $kuaidic["中通"] = 12; $kuaidic["顺丰"] = 12; $kuaidic["邮政"] = 13; $kuaidic["韵达"] = 13; //快递标识 $kuaidil["圆通"] = "yuantong"; $kuaidil["中通"] = "zhongtong"; $kuaidil["申通"] = "shentong"; $kuaidil["顺丰"] = "shunfeng"; $kuaidil["邮政"] = "ems"; $kuaidil["韵达"] = "yunda"; //提取单号 $kuaiditype = msubstr($_W['content'], "0", "2", $charset = "utf-8", $suffix = false); $danhao = str_replace($kuaiditype, '', $content); if (strlen($danhao) != $kuaidic[$kuaiditype]) { wx_error("【快递名字+单号】查询快递\n圆通 中通 申通 顺丰 韵达 邮政 EMS\n检查快递单号长度是否填写正确"); } else { //获取该插件配置参数 $config = Amango_Addons_Config(); $config['kuaidiak'] || wx_error('请联系站长先填写快递API的密匙'); $url = 'http://api.ickd.cn/?com=' . $kuaidil[$kuaiditype] . '&nu=' . $danhao . '&id=82CD8E8282C652F91CAEE36225FD2373&type=text&encode=utf8&ord=asc'; $json = file_get_contents($url); if (!empty($json)) { $str = str_replace(date("Y"), "\n" . date("Y"), $json); $str = "快递:" . $kuaiditype . "\n单号:" . $danhao . "\n--------------\n" . $str; $replycontext['Content'] = $str; $this->assign('Text', $replycontext); $this->display(); } else { wx_error("您输入单号查询不到相关信息!"); } } }
public function index() { $rss = new UniversalFeedCreator(); $rss->useCached(); // use cached version if age<1 hour $rss->title = app_conf("SHOP_TITLE") . " - " . app_conf("SHOP_SEO_TITLE"); $rss->description = app_conf("SHOP_SEO_TITLE"); //optional $rss->descriptionTruncSize = 500; $rss->descriptionHtmlSyndicated = true; $rss->link = get_domain() . APP_ROOT; $rss->syndicationURL = get_domain() . APP_ROOT; //optional $image->descriptionTruncSize = 500; $image->descriptionHtmlSyndicated = true; $domain = app_conf("PUBLIC_DOMAIN_ROOT") == '' ? get_domain() . $GLOBALS['IMG_APP_ROOT'] : app_conf("PUBLIC_DOMAIN_ROOT"); $city = get_current_deal_city(); $city_id = $city['id']; $deal_list = get_deal_list(app_conf("DEAL_PAGE_SIZE"), 0, 0, array(DEAL_ONLINE), " buy_type <> 1 or ( is_shop = 1 and is_effect =1 and is_delete = 0 and buy_type <> 1)"); $deal_list = $deal_list['list']; foreach ($deal_list as $data) { $item = new FeedItem(); if ($data['uname'] != '') { $gurl = url("shop", "goods", array("id" => $data['uname'])); } else { $gurl = url("shop", "goods", array("id" => $data['id'])); } $data['url'] = $gurl; $item->title = msubstr($data['name'], 0, 30); $item->link = get_domain() . $data['url']; $data['description'] = str_replace($GLOBALS['IMG_APP_ROOT'] . "./public/", $domain . "/public/", $data['description']); $data['description'] = str_replace("./public/", $domain . "/public/", $data['description']); $data['img'] = str_replace("./public/", $domain . "/public/", $data['img']); $item->description = "<img src='" . $data['img'] . "' /><br />" . $data['brief'] . "<br /> <a href='" . get_domain() . $data['url'] . "' target='_blank' >" . $GLOBALS['lang']['VIEW_DETAIL'] . "</a>"; //optional $item->descriptionTruncSize = 500; $item->descriptionHtmlSyndicated = true; if ($data['end_time'] != 0) { $item->date = date('r', $data['end_time']); } $item->source = $data['url']; $item->author = app_conf("SHOP_TITLE"); $rss->addItem($item); } $rss->saveFeed($format = "RSS0.91", $filename = APP_ROOT_PATH . "public/runtime/app/tpl_caches/rss.xml"); }
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']); }
public function temp_epub5($url) { require_once APPPATH . 'libraries/simple_html_dom.class.php'; $html = url2html($url, $this->header); //内容 $des = $html->find('div[class=sintro]', 0)->plaintext; $data['des'] = trim(msubstr($des, 0, 150)); //标题 $data['title'] = $html->find('div[class=sinfo] ul li ', 0)->plaintext; //url $data['url'] = trim($url); $data['time'] = time(); $data['md5_url'] = md5($url); $data['type'] = 9; $html->clear(); //var_dump( $data ); return $data; }
function addproject() { $pUserProfile = D('UserProfile'); $pUserProfile->uid = $this->mid; $strType = t($_POST['addtype']); if ($strType == 'education') { $data['school'] = msubstr(t($_POST['school']), 0, 70, 'utf-8', false); $data['classes'] = msubstr(t($_POST['classes']), 0, 70, 'utf-8', false); $data['year'] = $_POST['year']; if (empty($data['school'])) { $return['message'] = L('schoolname_nonull'); $return['boolen'] = "0"; exit(json_encode($return)); } } elseif ($strType == 'career') { $data['company'] = msubstr(t($_POST['company']), 0, 70, 'utf-8', false); $data['position'] = msubstr(t($_POST['position']), 0, 70, 'utf-8', false); $data['begintime'] = intval($_POST['beginyear']) . '-' . intval($_POST['beginmonth']); $data['endtime'] = $_POST['nowworkflag'] ? L('now') : intval($_POST['endyear']) . '-' . intval($_POST['endmonth']); //2011-03-11 添加 $date_begin = explode("-", $data['begintime']); $date_end = explode("-", $data['endtime']); $begin = mktime(0, 0, 0, $date_begin[1], 0, $date_begin[0]); $end = mktime(0, 0, 0, $date_end[1], 0, $date_end[0]); if (empty($data['company'])) { $return['message'] = L('companyname_nonull'); $return['boolen'] = "0"; exit(json_encode($return)); } if ($data['endtime'] != L('now') && $begin > $end) { $return['message'] = L('start_time_later'); $return['boolen'] = "0"; exit(json_encode($return)); } } $data['id'] = $pUserProfile->dosave($strType, $data, 'list', true); if ($data['id']) { $data['addtype'] = $strType; $return['message'] = L('companyname_nonull'); $return['boolen'] = "1"; $return['data'] = $data; exit(json_encode($return)); } }
public function temp_xuexi111($url) { require_once APPPATH . 'libraries/simple_html_dom.class.php'; $html = url2html($url, $this->header); //内容 $des = $html->find('div[class=info-content]', 0)->plaintext; $data['des'] = trim(msubstr($des, 0, 150)); //标题 $title = $html->find('table[id=download-table] tbody tr td', 0)->plaintext; $data['title'] = trim($title); //url $data['url'] = trim($url); $data['time'] = time(); $data['md5_url'] = md5($url); $data['type'] = 7; $html->clear(); var_dump($data); return $data; }
public function temp_book118($url) { require_once APPPATH . 'libraries/simple_html_dom.class.php'; $html = url2html($url, $this->header); //内容 $des = $html->find('div[id=mainSoftIntro]', 0)->plaintext; $data['des'] = trim(msubstr($des, 0, 150)); //标题 $title = $html->find('div[class=downInfoTitle]', 0)->plaintext; $data['title'] = trim($title); //url $data['url'] = trim($url); $data['time'] = time(); $data['md5_url'] = md5($url); $data['type'] = 7; $html->clear(); var_dump($data); return $data; }
public function run() { //过滤并转义 $replyinfo = keyword_replace_text($_POST['replyinfo']); //回复类型判断 $data['response_reply'] = !empty($_POST['replytype']) ? $_POST['replytype'] : $this->ajaxReturn(array('status' => 0, 'errmsg' => '用户请求标识非法'), 'JSON'); //回复体标识 //$data['response_name'] = msubstr($replyinfo,0, 10, $charset="utf-8", $suffix=true); $data['response_name'] = empty($_POST['response_name']) ? msubstr($replyinfo, 0, 10, $charset = "utf-8", $suffix = true) : $_POST['response_name']; //结构组合体 $neiron = array('type' => 'text', 'num' => 1, 'neiron' => $replyinfo, 'replace' => ''); $data['response_compos'] = serialize($neiron); //生成XML $data['response_xml'] = Factory('Text')->load($replyinfo)->select(); //数据静态化 $data['response_static'] = 1; $data['status'] = 1; return empty($data['response_xml']) ? false : $data; }
public function temp_feng($url) { require_once APPPATH . 'libraries/simple_html_dom.class.php'; $html = url2html($url, $this->header); //内容 $des = $html->find('div[class=t_fsz]', 0)->plaintext; $data['des'] = trim(msubstr($des, 0, 150)); //标题 $title = $html->find('div[class=pl_tit_panel] h1', 0)->plaintext; $data['title'] = trim($title); //url $data['url'] = trim($url); $data['time'] = time(); $data['md5_url'] = md5($url); $data['type'] = 7; $html->clear(); var_dump($data); return $data; }
/** * 获取分享单个 * @param unknown_type $id */ function get_topic_item($id) { $sql = "select * from " . DB_PREFIX . "topic where id = " . $id; $topic = $GLOBALS['db']->getRow($sql); $topic = format_topic_item($topic); if (msubstr(preg_replace("/<[^>]+>/i", "", $topic['content']), 0, 50) != preg_replace("/<[^>]+>/i", "", $topic['content'])) { $topic['short_content'] = msubstr(preg_replace("/<[^>]+>/i", "", $topic['content']), 0, 50); } else { $topic['short_content'] = preg_replace("/<br[^>]+>/i", "", $topic['content']); } if ($topic['origin']) { if (msubstr(preg_replace("/<[^>]+>/i", "", $topic['origin']['content']), 0, 50) != preg_replace("/<[^>]+>/i", "", $topic['origin']['content'])) { $topic['origin']['short_content'] = msubstr(preg_replace("/<[^>]+>/i", "", $topic['origin']['content']), 0, 50); } else { $topic['origin']['short_content'] = preg_replace("/<br[^>]+>/i", "", $topic['origin']['content']); } } return $topic; }
public function get_payment_code($payment_notice_id) { $payment_notice = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment_notice where id = " . $payment_notice_id); $money = round($payment_notice['money'], 2); $payment_info = $GLOBALS['db']->getRow("select id,config,logo from " . DB_PREFIX . "payment where id=" . intval($payment_notice['payment_id'])); $payment_info['config'] = unserialize($payment_info['config']); $sql = "select name " . "from " . DB_PREFIX . "deal_order_item " . "where order_id =" . intval($payment_notice['order_id']); $title_name = $GLOBALS['db']->getOne($sql); $subject = msubstr($title_name, 0, 40); $data_return_url = get_domain() . APP_ROOT . '/../payment.php?act=return&class_name=Malipay'; $pay = array(); $pay['subject'] = $subject; $pay['body'] = $title_name; $pay['total_fee'] = $money; $pay['total_fee_format'] = format_price($money); $pay['out_trade_no'] = $payment_notice['notice_sn']; $pay['pay_code'] = 'mcod'; //,支付宝;mtenpay,财付通;mcod,货到付款 return $pay; }
private function _getList($map, $limit, $order) { $questionModel = new QuestionModel(); $questionAnswerModel = new QuestionAnswerModel(); $list = $questionModel->getList($map, '*', $limit, $order); foreach ($list as &$val) { $val['info'] = msubstr(op_t($val['description']), 0, 200); $val['img'] = get_pic($val['description']); $val['user'] = query_user(array('uid', 'space_url', 'nickname', 'avatar64'), $val['uid']); if ($val['best_answer']) { $val['best_answer_info'] = $questionAnswerModel->getData(array('id' => $val['best_answer'], 'status' => 1)); } else { $val['best_answer_info'] = $questionAnswerModel->getData(array('question_id' => $val['id'], 'status' => 1), 'support desc'); } if ($val['best_answer_info']) { $val['best_answer_info']['content'] = msubstr(op_t($val['best_answer_info']['content']), 0, 200); } } return $list; }
private function _getList($map, $page = 1, $r = 20) { $questionModel = new QuestionModel(); $questionAnswerModel = new QuestionAnswerModel(); list($list, $totalCount) = $questionModel->getListPageByMap($map, $page, 'create_time desc', $r, '*'); foreach ($list as &$val) { $val['info'] = msubstr(op_t($val['description']), 0, 200); $val['img'] = get_pic($val['description']); $val['user'] = query_user(array('uid', 'space_url', 'nickname'), $val['uid']); if ($val['best_answer']) { $val['best_answer_info'] = $questionAnswerModel->getData(array('id' => $val['best_answer'], 'status' => 1)); } else { $val['best_answer_info'] = $questionAnswerModel->getData(array('question_id' => $val['id'], 'status' => 1), 'support desc'); } if ($val['best_answer_info']) { $val['best_answer_info']['content'] = msubstr(op_t($val['best_answer_info']['content']), 0, 200); } } return array($list, $totalCount); }