示例#1
0
 function main()
 {
     global $_G;
     if ($_GET['onsubmit'] && check()) {
         foreach ($_GET[ids] as $k => $v) {
             $id = intval($v);
             if ($_GET[del][$k] == 0) {
                 continue;
             }
             if ($_GET['_del_all'] == 1 && $_GET['del'][$k]) {
                 DB::delete(__CLASS__, "id=" . intval($id));
             }
         }
         cpmsg('操作成功', 'success', 'm=' . __CLASS__ . '&a=' . __FUNCTION__);
         return false;
     }
     $size = 30;
     $start = ($_G['page'] - 1) * $size;
     $url = '';
     $and = '';
     if ($_GET['uid']) {
         $uid = intval($_GET[uid]);
         $and .= " AND uid =" . $uid;
         $url .= "&uid=" . $uid;
     }
     if ($_GET['username']) {
         $username = urldecode_utf8(trim($_GET[username]));
         $and .= " AND username ='******'";
         $url .= "&username="******" AND ip ='" . $ip . "'";
         $url .= "&ip=" . $ip;
     }
     if ($_GET['jf_down']) {
         $jf_down = intval($_GET[jf_down]);
         $and .= " AND org_jf >='" . $jf_down . "'";
         $url .= "&jf_down=" . $jf_down;
     }
     if ($_GET['jf_up']) {
         $jf_up = intval($_GET[jf_up]);
         $and .= " AND org_jf <='" . $jf_up . "'";
         $url .= "&jf_up=" . $jf_up;
     }
     if ($_GET[type] && array_key_exists($_GET[type], $_G['setting']['jf_type'])) {
         $type = addslashes(trim($_GET[type]));
         $and .= " AND type='{$type}'";
         $url .= "&type=" . $type;
     }
     $sign_list = DB::fetch_all("SELECT * FROM " . DB::table(__CLASS__) . " where 1 {$and}  ORDER BY id DESC LIMIT {$start},{$size}");
     $count = getcount(__CLASS__, $and);
     $showpage = multi($count, $size, $_G[page], URL . "m=sign&a=main" . $url);
     foreach ($sign_list as $k => $v) {
         $sign_list[$k][username_url] = urlencode_utf8($v[username]);
         $sign_list[$k][dateline] = dgmdate($v[dateline], 'u');
     }
     $this->add(array('count' => $count, 'sign_list' => $sign_list, 'showpage' => $showpage));
     $this->show('sign/main');
 }
示例#2
0
 function _list()
 {
     global $_G;
     $url = URL . 'm=img&a=list';
     $and = ' `hide` = 0 ';
     $tag = '';
     if ($_GET[tag]) {
         $tag = $_GET['tag'];
         $tag = urldecode_utf8($tag);
         $tag = daddslashes($tag);
         $and .= "AND FIND_IN_SET('" . $tag . "', keywords) ";
         $url .= "&tag=" . urlencode_utf8($tag);
     }
     $img = D(array('and' => $and, 'table' => 'img', 'order' => '`sort` DESC,id DESC', 'key' => 'img_list_' . $tag), array('size' => 10, 'url' => $url));
     $this->add($img);
     seo('值得买 - ' . $_G['setting'][title]);
     $this->show();
 }
示例#3
0
 public function update($cachename)
 {
     global $_G;
     $sys = true;
     //$syn = false,代表不写入缓存,每次都读取
     if (strpos($cachename, '_cate') !== false) {
         $tmp = explode('_', $cachename);
         $cate = new cate($tmp[0], $tmp[0]);
         $cache_data = $cate->get_cate();
         $this->set($cachename, $cache_data, true, 1);
         return $cache_data;
     }
     switch ($cachename) {
         case 'all_channel':
             $all_channel = DB::fetch_all("SELECT * FROM " . DB::table('channel') . " ORDER BY `sort` DESC,fid ASC ", 'fid');
             $tmp = array();
             foreach ($all_channel as $k => $v) {
                 $v[org_url] = $v[url];
                 $v[url] = '/index.php?fid=' . $v[fid];
                 $tmp['k' . $k] = $v;
             }
             $cache_data = $tmp;
             break;
         case 'channels':
             $all_channel = DB::fetch_all("SELECT * FROM " . DB::table('channel') . " ORDER BY `sort` DESC,fid ASC ", 'fid');
             $channel = array();
             //一级
             foreach ($all_channel as $k => $v) {
                 if ($v[fup] == 0) {
                     //$v[count] = getcount('goods'," AND fid = ".$v[fid]);
                     $v[org_url] = $v[url];
                     $v[url] = '/index.php?fid=' . $v[fid];
                     $channel[$k] = $v;
                 }
             }
             //二级
             $tmps = $all_channel;
             foreach ($channel as $k => $v) {
                 $sub = array();
                 $fid_in = array();
                 unset($tmps[$v[fid]]);
                 foreach ($all_channel as $kk => $vv) {
                     if ($vv['fup'] == $k) {
                         //$vv[count] = getcount('goods'," AND fid = ".$vv[fid]);
                         $vv[org_url] = $vv[url];
                         $vv[url] = '/index.php?fid=' . $vv[fid];
                         $sub[$kk] = $vv;
                         //二级栏目
                         $fid_in2 = array();
                         unset($tmps[$vv[fid]]);
                         foreach ($all_channel as $k3 => $v3) {
                             if ($v3['fup'] == $kk) {
                                 $v3[org_url] = $v3[url];
                                 $v3[url] = '/index.php?fid=' . $v3[fid];
                                 //$v3[count] = getcount('goods'," AND fid = ".$v3[fid]);
                                 unset($tmps[$v3[fid]]);
                                 $sub[$kk]['sub'][$k3] = $v3;
                                 //三级栏目
                                 $fid_in2[] = $v3['fid'];
                                 $fid_in[] = $v3['fid'];
                                 $sub[$kk]['sub'][$k3]['fid_in'] = $v3['fid'];
                             }
                         }
                         $fid_in[] = $vv['fid'];
                         $fid_in2[] = $vv['fid'];
                         $sub[$kk]['fid_in'] = implode(',', $fid_in2);
                     }
                 }
                 $fid_in[] = $v['fid'];
                 $channel[$k]['fid_in'] = implode(',', $fid_in);
                 if ($sub) {
                     $channel[$k]['sub'] = $sub;
                 }
             }
             if (count($tmps) > 0) {
                 foreach ($tmps as $k => $v) {
                     if (!array_key_exists($k)) {
                         $v[fid_in] = $v[fid];
                         $channel[$k] = $v;
                     }
                 }
             }
             $cache_data = $channel;
             break;
         case 'setting':
             set_setting('time', TIMESTAMP);
             $st = DB::fetch_all("SELECT * FROM " . DB::table('setting'));
             foreach ($st as $k => $v) {
                 $setting[$v['name']] = $v['value'];
             }
             if ($setting['qq']) {
                 $setting['qq'] = explode(',', $setting['qq']);
             }
             if ($setting['flag']) {
                 $setting['flag'] = explode(',', $setting['flag']);
                 $setting['flag'] = array_filter($setting['flag']);
             }
             if ($setting['shop_tag']) {
                 $setting['shop_tag'] = explode(',', $setting['shop_tag']);
                 $setting['shop_tag'] = array_filter($setting['shop_tag']);
             }
             if ($setting['goods_tag']) {
                 $setting['goods_tag'] = explode(',', $setting['goods_tag']);
                 $setting['goods_tag'] = array_filter($setting['goods_tag']);
             }
             if ($setting['article_tag']) {
                 $setting['article_tag'] = explode(',', $setting['article_tag']);
                 $setting['article_tag'] = array_filter($setting['article_tag']);
             }
             if ($setting['filter_field']) {
                 $setting['filter_field'] = explode(',', $setting['filter_field']);
             }
             if ($setting['shiyong_status']) {
                 $setting['shiyong_status'] = explode(',', $setting['shiyong_status']);
             }
             if ($setting['duihuan_status']) {
                 $setting['duihuan_status'] = explode(',', $setting['duihuan_status']);
             }
             if ($setting['shiyong_tags']) {
                 $setting['shiyong_tags'] = explode(',', $setting['shiyong_tags']);
             }
             if ($setting['activity_tags']) {
                 $setting['activity_tags'] = explode(',', $setting['activity_tags']);
             }
             if ($setting['style_tags']) {
                 $setting['style_tags'] = explode(',', $setting['style_tags']);
             }
             if ($setting['movie_tags']) {
                 $setting['movie_tags'] = explode(',', $setting['movie_tags']);
             }
             if ($setting['zj_tags']) {
                 $setting['zj_tags'] = explode(',', $setting['zj_tags']);
             }
             if ($setting['shishang_flag']) {
                 $setting['shishang_flag'] = explode(',', $setting['shishang_flag']);
             }
             if ($setting['tags']) {
                 $setting['tags'] = explode(',', $setting['tags']);
                 $tags = array();
                 foreach ($setting['tags'] as $k => $v) {
                     $uname = urlencode_utf8($v);
                     $tags[$uname] = $v;
                 }
                 $setting['tags'] = $tags;
             }
             if ($setting['sign_jf']) {
                 $setting['sign_jf'] = (array) dunserialize($setting['sign_jf']);
             }
             if ($setting['sign_tb']) {
                 $setting['sign_tb'] = (array) dunserialize($setting['sign_tb']);
             }
             if ($setting['syn_table']) {
                 $setting['syn_table'] = explode(',', $setting['syn_table']);
             }
             if ($setting['syn_domain']) {
                 $setting['syn_domain'] = explode("\r\n", $setting['syn_domain']);
             }
             if ($setting['uz_tag']) {
                 $setting['uz_tag'] = explode(',', $setting['uz_tag']);
             }
             if ($setting['uz_type']) {
                 $setting['uz_type'] = explode(',', $setting['uz_type']);
             }
             $setting['time'] = TIMESTAMP;
             if ($setting['email']) {
                 $setting['email'] = (array) dunserialize($setting['email']);
             }
             $cache_data = $setting;
             break;
         case 'friend_link':
             //友情链接
             $friend_link = DB::fetch_all("SELECT * FROM " . DB::table('friend_link') . " ORDER BY sort DESC,id DESC", 'id');
             foreach ($friend_link as $k => $v) {
                 $friend_link[$k]['dateline'] = dgmdate($v['dateline'], 'u');
             }
             $cache_data = $friend_link;
             break;
         case 'pics_type':
             $cache_data = DB::fetch_all("SELECT * FROM " . DB::table('pics_type') . " ORDER BY id DESC", 'id');
             break;
         case 'pics':
             $pics_type = DB::fetch_all("SELECT * FROM " . DB::table('pics_type') . " ORDER BY id DESC", 'id');
             $pics_tmp = DB::fetch_all("SELECT * FROM " . DB::table('pics') . " ORDER BY sort ASC,id DESC ", 'id');
             $pics = array();
             foreach ($pics_type as $k => $v) {
                 $pics[$k] = array();
                 foreach ($pics_tmp as $k1 => $v1) {
                     $v1['org_dateline'] = $v1['dateline'];
                     $v1['dateline'] = dgmdate($v1['dateline'], 'u');
                     if ($v1['fup'] == $k) {
                         $pics[$k][$k1] = $v1;
                     }
                 }
             }
             $cache_data = set_key($pics);
             break;
         case 'ad':
             $ad = DB::fetch_all("SELECT * FROM " . DB::table('ad') . " ORDER BY id DESC ", 'id');
             foreach ($ad as $k => $v) {
                 $ad[$k]['org_dateline'] = $v[dateline];
                 $ad[$k]['dateline'] = dgmdate($v[dateline], 'u');
                 $ad[$k]['start_time'] = dgmdate($v[start_time], 'dt');
                 $ad[$k]['end_time'] = dgmdate($v[end_time], 'dt');
                 $ad[$k]['show'] = false;
                 $ad[$k]['show_html'] = '';
                 //先判断是否在显示时间内
                 $show = 0;
                 if ($v['start_time'] < TIMESTAMP && ($v['end_time'] == 0 || $v['end_time'] > TIMESTAMP)) {
                     $show = 1;
                 }
                 if ($show == true && $v['hide'] == 0) {
                     $html = '';
                     if ($v['type'] == 1) {
                         $html = $v['content'];
                     } elseif ($v['type'] == 2) {
                         $width = $v['width'] > 0 ? "width='" . $v['width'] . "'" : '';
                         $height = $v['height'] > 0 ? "height='" . $v['height'] . "'" : '';
                         $img = "<img class='ads_" . $k . "' src='" . $v['picurl'] . "' " . $width . "" . $height . " />";
                         if ($v['url']) {
                             $target = $v['target'] == 1 ? "target='_blank'" : '';
                             $html = "<a href='" . $v['url'] . "' " . $target . " >" . $img . "</a>";
                         } else {
                             $html = $img;
                         }
                     } else {
                         $html = $v['html'];
                     }
                     if (!empty($html)) {
                         $ad[$k]['show'] = true;
                         $ad[$k]['show_html'] = $html;
                     } else {
                         $ad[$k]['show_html'] = '';
                     }
                 }
             }
             $cache_data = set_key($ad);
             break;
         case 'goods_cate':
             $cate = new cate('goods', 'goods');
             $cache_data = $cate->get_cate();
             break;
         case 'shop':
             $shop = DB::fetch_all("SELECT * FROM " . DB::table('shop') . " ORDER BY sort DESC,id DESC", 'id');
             foreach ($shop as $k => $v) {
                 $shop[$k] = parse('shop', $v);
             }
             $cache_data = $shop;
             break;
         case 'shop_cate':
             $cate = new cate('shop', 'shop');
             $cache_data = $cate->get_cate();
             break;
         case 'prize':
             $rs = DB::fetch_all("SELECT * FROM " . DB::table('prize') . " ORDER BY sort DESC ,id DESC ", 'id');
             foreach ($rs as $k => $v) {
                 //统计每个分类,还未中奖的中奖码..
                 $rs[$k][num] = $rs[$k][count] = getcount('ticket', "prizeid = " . $v[id] . " AND is_use=0");
                 $rs[$k][total] = getcount('ticket', "prizeid = " . $v[id]);
             }
             $cache_data = $rs;
             break;
         case 'table':
             $cache_data = update_table();
             break;
         case 'group':
             $rs = DB::fetch_all("SELECT * FROM " . DB::table('group') . " ORDER BY id ASC", 'id');
             foreach ($rs as $k => $v) {
                 $rs[$k][power] = dunserialize($v['power']);
             }
             $cache_data = $rs;
             break;
         case 'rank':
             $rs = DB::fetch_all("SELECT * FROM " . DB::table('rank') . " ORDER BY id ASC", 'id');
             $cache_data = $rs;
             break;
         default:
             $sys = false;
             $cache_data = '';
             break;
     }
     if ($sys == true) {
         $this->set($cachename, $cache_data, true, 1);
     }
     return $cache_data;
 }
示例#4
0
 function img_list()
 {
     global $_G, $assign;
     $new = D(array('and' => ' `hide` = 0', 'table' => 'img', 'limit' => 12, 'cutstr' => 'title|30', 'order' => 'rand()', 'key' => 'img_list'));
     //$goods = $assign[goods];
     $tags = array();
     foreach ($new as $k => $v) {
         $v[keywords] = explode(',', $v[keywords]);
         $v[keywords] = array_filter($v[keywords]);
         $v[keywords] = array_unique($v[keywords]);
         foreach ($v[keywords] as $k1 => $v1) {
             if (!in_array($v1, $tags)) {
                 $uname = urlencode_utf8($v1);
                 $tags[$uname] = $v1;
             }
         }
     }
     return array('new' => $new, 'tags' => $tags);
 }
示例#5
0
 function main()
 {
     global $_G;
     if ($_GET['onsubmit'] && check() && $_GET[ids]) {
         $page = $_G[page] > 1 ? '&page=' . $_G[page] : '';
         foreach ($_GET[ids] as $k => $v) {
             if ($_GET[del][$k] == 0) {
                 continue;
             }
             $aid = intval($v);
             $arr = array();
             $arr['start_time'] = dmktime($_GET['start_time'][$k]);
             $arr['end_time'] = dmktime($_GET['end_time'][$k]);
             $arr['sort'] = intval($_GET['sort'][$k]);
             $arr['flag'] = intval($_GET['flag'][$k]);
             if ($_GET['cate'][$k] > 0) {
                 $arr['cate'] = intval($_GET['cate'][$k]);
             }
             $arr['hide'] = intval($_GET['hide'][$k]);
             if ($_GET['cate_in'] != '-1') {
                 $arr['cate'] = intval($_GET['cate_in']);
             }
             if ($_GET['flag_in'] > 0) {
                 $arr['flag'] = intval($_GET['flag_in']);
             }
             if ($_GET['hide_in'] == 1) {
                 $arr['hide'] = 1;
             }
             if ($_GET['check'] == 1) {
                 $arr['check'] = 1;
             }
             if ($_GET['in_fid']) {
                 $arr['fid'] = intval($_GET['in_fid']);
             }
             if ($_GET['start_time_in'] && dmktime($_GET['start_time_in']) > 0) {
                 $arr['start_time'] = dmktime($_GET['start_time_in']);
             }
             if ($_GET['end_time_in'] && dmktime($_GET['end_time_in']) > 0) {
                 $arr['end_time'] = dmktime($_GET['end_time_in']);
             }
             $num_iid = $_GET['num_iid'][$k];
             if ($_GET['_del_all'] == 1 && $_GET['del'][$k]) {
                 api_post(array('a' => 'delete', 'table' => 'goods', 'id' => $num_iid, 'pre_key' => 'num_iid'));
                 DB::delete("goods", "aid=" . intval($aid));
             } else {
                 api_post(array('a' => 'update', 'table' => 'goods', 'data' => $arr, 'pre_key' => 'num_iid', 'id' => $num_iid));
                 DB::update("goods", $arr, "aid=" . $aid);
             }
         }
         $url = '';
         if ($_GET['post'] == 1) {
             $url .= "&post=1";
         }
         $page .= $_GET[cur_fid] > 0 ? '&fid=' . $_GET[cur_fid] : '';
         cpmsg('操作成功', 'success');
         return false;
     }
     if ($_GET[search] == 1 && $_GET['keyword'] && $_GET[search_type]) {
         $keyword = trim($_GET['keyword']);
         $search_type = trim($_GET['search_type']);
         $and .= " AND `" . $search_type . "` LIKE '%" . $keyword . "%'";
         $url .= "&search=1&keyword=" . urlencode_utf8($keyword) . '&search_type=' . $search_type;
     }
     if ($_GET['fid'] && $_GET['fid'] > 0) {
         $fid = intval($_GET['fid']);
         $and .= " AND fid = {$fid} ";
         $url .= "&fid=" . $fid;
     }
     if (isset($_GET['checks'])) {
         $check = intval($_GET['checks']);
         $and .= " AND  post >0  AND `check` =" . $check;
         $url .= "&checks=" . $check;
     }
     if (isset($_GET['post'])) {
         $and .= " AND `post` >0";
         $url .= "&post=1";
     }
     if (isset($_GET['hide'])) {
         $hide = intval($_GET['hide']);
         $and .= " AND `hide` =" . $hide;
         $url .= "&hide=" . $hide;
     }
     if (isset($_GET['flag']) && $_GET['flag'] != '-1') {
         $flag = intval($_GET['flag']);
         $and .= " AND `flag` =" . $flag;
         $url .= "&flag=" . $flag;
     }
     if ($_GET[cate] > 0) {
         $cate = intval($_GET[cate]);
         $and .= " AND `cate` =" . $cate;
         $url .= "&cate=" . $cate;
     }
     if ($_GET[nick]) {
         $nick = urldecode_utf8($_GET[nick]);
         $and .= " AND `nick` ='{$nick}'";
         $url .= "&nick=" . $nick;
     }
     if (isset($_GET[baoyou])) {
         $baoyou = intval($_GET[baoyou]);
         $and .= " AND `baoyou` =" . $baoyou;
         $url .= "&baoyou=" . $baoyou;
     }
     if (isset($_GET[shop_type]) && $_GET['shop_type'] != '-1') {
         $shop_type = intval($_GET[shop_type]);
         $and .= " AND `shop_type` =" . $shop_type;
         $url .= "&shop_type=" . $shop_type;
     }
     if ($_GET[taoke] == 1) {
         $taoke = '-1';
         $and .= " AND `commission` =-1";
         $url .= "&taoke=-1";
     }
     if ($_GET[line] > 0) {
         $line = intval($_GET[line]);
         $time = TIMESTAMP;
         if ($line == 1) {
             $and .= " AND start_time>0  AND start_time > {$time} ";
         } elseif ($line == 2) {
             $and .= " AND end_time>0  AND end_time<" . $time;
         }
         $url .= "&line=" . $line;
     }
     if ($_GET[display] > 0) {
         $time = TIMESTAMP;
         $display = intval($_GET[display]);
         $and .= " AND `hide`=1 OR `check`=0  OR num =0 OR  (start_time>0  AND start_time> {$time} )  OR (end_time>0  AND end_time< {$time} ) ";
         $url .= "&display=" . $display;
     }
     if ($_GET['commission_down']) {
         $commission_down = intval($_GET[commission_down]);
         $and .= " AND bili >=" . $commission_down;
         $url .= "&commission_down=" . $commission_down;
     }
     if ($_GET['commission_up']) {
         $commission_up = intval($_GET[commission_up]);
         $and .= " AND bili <=" . $commission_up;
         $url .= "&commission_up=" . $commission_up;
     }
     if ($_GET['yh_price_down']) {
         $yh_price_down = intval($_GET[yh_price_down]);
         $and .= " AND yh_price >=" . $yh_price_down;
         $url .= "&yh_price_down=" . $yh_price_down;
     }
     if ($_GET['yh_price_up']) {
         $yh_price_up = intval($_GET[yh_price_up]);
         $and .= " AND yh_price <=" . $yh_price_up;
         $url .= "&yh_price_up=" . $yh_price_up;
     }
     $and .= " AND post = 0";
     $rs = D(array('and' => $and, 'all' => true), array('url' => URL . "m=goods&a=main" . $url, 'size' => 40));
     foreach ($rs['goods'] as $k => $v) {
         $rs['goods'][$k][title] = cutstr($v[title], '60', '');
     }
     $rs['url'] = URL . "m=goods&a=main" . $url . '&page=' . $_G['page'];
     $this->add($rs);
     $this->show('goods/main');
 }
示例#6
0
 function main()
 {
     global $_G;
     if ($_GET['onsubmit'] && check()) {
         foreach ($_GET[ids] as $k => $v) {
             $id = intval($v);
             if ($_GET[del][$k] == 0) {
                 continue;
             }
             if ($_GET['_del_all'] == 1 && $_GET['del'][$k]) {
                 DB::delete(__CLASS__, "id=" . intval($id));
             }
         }
         cpmsg('操作成功', 'success', 'm=' . __CLASS__ . '&a=' . __FUNCTION__);
         return false;
     }
     $url = 'm=' . __CLASS__ . '&a=' . __FUNCTION__;
     $and = '';
     if ($_GET['uid']) {
         $uid = intval($_GET[uid]);
         $and .= " AND uid =" . $uid;
         $url .= "&uid=" . $uid;
     }
     if ($_GET['username']) {
         $username = urldecode_utf8(trim($_GET[username]));
         $and .= " AND username ='******'";
         $url .= "&username="******" AND is_reply =" . $is_reply;
         $url .= "&is_reply=" . $is_reply;
     }
     if ($_GET['type_id']) {
         $type_id = intval($_GET[type_id]);
         $and .= " AND type_id =" . $type_id;
         $url .= "&type_id=" . $type_id;
     }
     if ($_GET['type'] && array_key_exists($_GET['type'], $_G[setting][comment_types])) {
         $type = trim($_GET[type]);
         $and .= " AND type ='{$type}'";
         $url .= "&type=" . $type;
     }
     if ($_GET['reply_id']) {
         $reply_id = intval($_GET[reply_id]);
         $and .= " AND reply_id =" . $reply_id;
         $url .= "&reply_id=" . $reply_id;
     }
     if ($_GET['ip']) {
         $ip = trim($_GET[ip]);
         $and .= " AND ip ='" . $ip . "'";
         $url .= "&ip=" . $ip;
     }
     if ($_GET[type] && array_key_exists($_GET[type], $_G[setting][comment_types])) {
         $type = addslashes(trim($_GET[type]));
         $and .= " AND type='{$type}'";
         $url .= "&type=" . $type;
     }
     $rs = D(array('table' => __CLASS__, 'and' => $and, 'order' => ' id DESC'), array('url' => $url, 'size' => 40));
     $this->add($rs);
     $this->show('comment/main');
 }
示例#7
0
 function get_message($num_iid, $focus = false)
 {
     global $_G;
     if ($_G[setting][get_message] || $focus) {
         //	$url =    'http://hws.m.taobao.com/cache/mtop.wdetail.getItemDescx/4.1/?data=%7B%22item_num_id%22%3A%2243151340941%22%7D';
         $url = 'http://hws.m.taobao.com/cache/mtop.wdetail.getItemDescx/4.1/?data=';
         $url .= urlencode_utf8('{"item_num_id":"' . $num_iid . '"}');
         $message = fetch($url);
         if (!$message) {
             return '';
         }
         if (TAE) {
             $content = unicode_decode($content, 'UTF-8', "");
         }
         $data2 = json_decode($message, 1);
         if (!is_array($data2)) {
             L('详情获取失败:' . $data2[ret][0] . ',url=>' . $url);
             return '';
         } elseif ($data2[ret][0] != 'SUCCESS::接口调用成功') {
             L('详情获取失败:' . $data2[ret][0] . ',url=>' . $url);
             return false;
         } elseif (is_array($data2[data][images])) {
             $message = '';
             foreach ($data2[data][images] as $k => $v) {
                 $message .= '<p class="goods_imgs"><img src="' . $v . '" ></p>';
             }
             return $message;
         }
     }
     return '';
 }
示例#8
0
 function main()
 {
     global $_G;
     if ($_GET['onsubmit'] && check() && !$_GET[search]) {
         foreach ($_GET[ids] as $k => $v) {
             if ($_GET[del][$k] == 0) {
                 continue;
             }
             $id = intval($v);
             $arr = array();
             $arr['views'] = intval($_GET['views'][$k]);
             $arr['cate'] = intval($_GET['cates'][$k]);
             $arr['hide'] = $_GET['hide'][$k] ? 1 : 0;
             $arr['sort'] = $_GET['sort'][$k] ? intval($_GET['sort'][$k]) : 0;
             if ($_GET['in_cate'] != '-1') {
                 $arr['cate'] = intval($_GET['in_cate']);
             }
             if ($_GET['_del_all'] == 1 && $_GET['del'][$k]) {
                 DB::delete(__CLASS__, "id=" . $id);
                 api_post(array('a' => 'delete', 'table' => 'article', 'id' => $id, 'pre_key' => 'id'));
             } else {
                 DB::update(__CLASS__, $arr, "id=" . $id);
                 api_post(array('a' => 'update', 'table' => 'article', 'data' => $arr, 'pre_key' => 'id', 'id' => $id));
             }
         }
         cpmsg('操作成功', 'success', 'm=' . __CLASS__ . '&a=' . __FUNCTION__);
         return false;
     }
     $size = 30;
     $start = ($_G['page'] - 1) * $size;
     $url = '';
     $and = '';
     if ($_GET[search] == 1) {
         $url .= "&search=1";
     }
     if (isset($_GET['cate']) && $_GET['cate']) {
         $cate = intval($_GET['cate']);
         $and .= " AND cate = {$cate} ";
         $url .= "&cate=" . $cate;
     }
     if ($_GET['title']) {
         $title = trim($_GET['title']);
         $and .= " AND `title` LIKE '%" . $title . "%'";
         $url .= "&title=" . urlencode_utf8($title);
     }
     if (isset($_GET['hide']) && $_GET['hide'] > 0) {
         $hide = intval($_GET['hide']);
         $and .= $hide == 2 ? " AND `hide` =0" : " AND `hide` =1";
         $url .= "&hide=" . $hide;
     }
     if (isset($_GET['picurl']) && $_GET['picurl'] > 0) {
         $picurl = intval($_GET['picurl']);
         $and .= $picurl == 2 ? " AND `picurl` =''" : " AND `picurl` !=''";
         $url .= "&hide=" . $picurl;
     }
     if (isset($_GET['url']) && $_GET['url'] > 0) {
         $a_url = intval($_GET['url']);
         $and .= $a_url == 2 ? " AND `url` =''" : " AND `url` !=''";
         $url .= "&hide=" . $a_url;
     }
     $article = DB::fetch_all("SELECT * FROM " . DB::table('article') . " WHERE 1 {$and} ORDER BY sort DESC,id DESC LIMIT {$start},{$size}");
     foreach ($article as $k => $v) {
         $v['org_dateline'] = $v['dateline'];
         $v['dateline'] = dgmdate($v['dateline'], 'u');
         $article[$k] = $v;
     }
     $count = getcount("article", $and);
     $showpage = multi($count, $size, $_G['page'], URL . "m=article&a=main" . $url);
     $this->add(array('article' => $article, 'showpage' => $showpage, 'count' => $count));
     $this->show('article/main');
 }
示例#9
0
 public function execute($request, $session = null)
 {
     if ($this->checkRequest) {
         try {
             $request->check();
         } catch (Exception $e) {
             $result->code = $e->getCode();
             $result->msg = $e->getMessage();
             return $result;
         }
     }
     $sysParams["app_key"] = $this->appkey;
     $sysParams["v"] = $this->apiVersion;
     $sysParams["format"] = $this->format;
     $sysParams["sign_method"] = $this->signMethod;
     $sysParams["method"] = $request->getApiMethodName();
     $sysParams["timestamp"] = date("Y-m-d H:i:s");
     $sysParams["partner_id"] = $this->sdkVersion;
     if (null != $session) {
         $sysParams["session"] = $session;
     }
     $apiParams = $request->getApiParas();
     $sysParams["sign"] = $this->generateSign(array_merge($apiParams, $sysParams));
     $requestUrl = $this->gatewayUrl . "?";
     foreach ($sysParams as $sysParamKey => $sysParamValue) {
         $requestUrl .= "{$sysParamKey}=" . urlencode_utf8($sysParamValue) . "&";
     }
     $requestUrl = substr($requestUrl, 0, -1);
     try {
         $resp = $this->curl($requestUrl, $apiParams);
         //非TAE,不用转码,不然出问题
         if (TAE) {
             $resp = utf8_decode($resp);
         }
     } catch (Exception $e) {
         $this->logCommunicationError($sysParams["method"], $requestUrl, "HTTP_ERROR_" . $e->getCode(), $e->getMessage());
         $result->code = $e->getCode();
         $result->msg = $e->getMessage();
         return $result;
     }
     $respWellFormed = false;
     if ("json" == $this->format) {
         $respObject = json_decode($resp);
         if (null !== $respObject) {
             $respWellFormed = true;
             foreach ($respObject as $propKey => $propValue) {
                 $respObject = $propValue;
             }
         }
     } else {
         if ("xml" == $this->format) {
             $respObject = @simplexml_load_string($resp);
             if (false !== $respObject) {
                 $respWellFormed = true;
             }
         }
     }
     if (false === $respWellFormed) {
         $this->logCommunicationError($sysParams["method"], $requestUrl, "HTTP_RESPONSE_NOT_WELL_FORMED", $resp);
         $result->code = 0;
         $result->msg = "HTTP_RESPONSE_NOT_WELL_FORMED";
         return $result;
     }
     if (isset($respObject->code)) {
         $logger = new LtLogger();
         $logger->log(array(date("Y-m-d H:i:s"), $resp));
     }
     return $respObject;
 }
示例#10
0
 function post_img()
 {
     global $_G, $app;
     if (!$_GET['data']) {
         $this->json(array('msg' => '要同步的数据不能为空', 'code' => 2));
         return false;
     }
     $data = $_GET['data'];
     $arr = json_decode($data, true);
     if (!is_array($arr) || !$arr) {
         $arr = json_decode(urldecode_utf8($data), true);
     }
     if (!is_array($arr) || !$arr) {
         $this->json(array('msg' => '要同步的数据解析失败', 'code' => 3));
         return false;
     }
     $filed = table('img');
     $img = get_filed('img', $arr);
     $img['hide'] = intval($img['hide']);
     $img['sort'] = intval($img['sort']);
     $img['hate'] = intval($img['hate']);
     $img['like'] = intval($img['like']);
     if ($arr['desc']) {
         $img[description] = $arr['desc'];
     }
     $img[message] = trim($img[message]);
     $img['dateline'] = TIMESTAMP;
     foreach ($img as $k1 => $v1) {
         if (!array_key_exists($k1, $filed)) {
             unset($img[$k1]);
         }
         if (is_string($v1)) {
             $img[$k1] = str_replace(array('&yen;', '¥'), array('', ''), $v1);
         }
     }
     if (preg_match("/^[0-9\\.]+\$/is", $img[description])) {
         $img[description] = '';
     }
     if (!$img[description]) {
         if (strpos($img[message], '###{') !== false) {
             $img[description] = preg_replace("/###\\{(.*?)\\}###/is", '', $img[message]);
             $img[description] = cutstr(trim_html($img[description], 1), 250, '');
         }
     }
     $count = getcount('img', "title='" . $img[title] . "'");
     if ($count > 0) {
         $this->json(array('status' => 'error', 'id' => 0, 'msg' => '当前看图购已发布过'));
         return false;
     }
     if (!$img[title]) {
         $this->json(array('status' => 'error', 'id' => 0, 'msg' => '标题不能为空'));
         return false;
     }
     $id = DB::insert('img', $img, true);
     if ($id > 0) {
         $this->json(array('status' => 'success', 'id' => $id));
         return false;
     } else {
         if (defined('ERROR') && ERROR === true) {
             if (DB::error()) {
                 $msg = 'DB Error : ' . DB::error();
             } else {
                 $msg = urlencode_utf8($_G['error_msg']);
             }
             $this->json(array('status' => 'error', 'id' => $return_id, 'msg' => $msg));
             return false;
         } else {
             $this->json(array('status' => 'error', 'id' => $id, 'msg' => '未成功,数据库未报错'));
             return false;
         }
     }
 }
示例#11
0
 function goods()
 {
     global $_G;
     $sql = make_sql();
     $url = 'm=ajax&a=goods';
     $size = $_G[setting][cate_page] ? $_G[setting][cate_page] : 120;
     if ($_GET['field']) {
         $sql['field'] = trim($_GET['field']);
     }
     $and = '';
     if ($_GET['kw']) {
         $string = stripsearchkey(trim($_GET['kw']));
         if (preg_match("/^%+\$|^_+\$|^\\*+\$/is", $string)) {
             msg('非法搜索关键字');
         }
         $string = safe_output($string);
         if (dstrlen($string) < 2) {
             msg('要搜索的关键字长度不能小于2');
         }
         $_GET[kw] = $string;
         $and .= " AND title like '%{$string}%' ";
         $url .= "&kw=" . urlencode_utf8($string);
     }
     if ($_GET[tag]) {
         $tag = trim_html($tag, 1);
         $tag = daddslashes($_GET[tag]);
         $and .= "AND FIND_IN_SET('" . $tag . "', keywords) ";
         $url .= "&tag=" . urlencode_utf8($tag);
         $sql['and'] .= $and;
         $sql['url'] .= $url;
     }
     $rs = D(array('and' => $and . $sql['and'], 'all' => false, 'order' => $sql[order]), array('url' => $url . $sql[url], 'size' => $size));
     $goods = array();
     foreach ($rs['goods'] as $k => $v) {
         $tmp = array();
         $tmp['picurl'] = $v['picurl'];
         $tmp['url'] = $v['url'];
         $tmp['id_url'] = $v['id_url'];
         $tmp['num_iid'] = $v['num_iid'];
         $tmp['aid'] = $v['aid'];
         $tmp['yh_price'] = $v['yh_price'];
         $tmp['sum'] = $v['sum'];
         $tmp['like'] = $v['like'];
         $tmp['title'] = $v['title'];
         $tmp['username'] = $v['username'];
         $goods[] = $tmp;
     }
     json(array('data' => $goods, 'status' => 'success'));
 }
示例#12
0
function get_share($arr)
{
    global $_G;
    //$type,$title,$picurl,$cotent
    $title = $arr[title] ? $arr[title] : $_G[setting][seo_title];
    $title .= '-' . $_G[setting][title];
    $picurl = $arr[picurl] ? $arr[picurl] : $_G[setting][logo];
    if ($arr[num_iid]) {
        if (!preg_match("/^http:/is", $arr[url])) {
            $arr[url] = $_G[siteurl] . str_replace('/index.php', '/index.php', $arr[url]);
        }
        $url = $arr[url];
        $content = $arr[ly] ? $arr[ly] : $arr[title];
        $content .= '-' . $arr[channel][name] . '-' . $_G[setting][title];
    } else {
        $url = $arr[url] ? $_G[siteurl] . $arr[url] : $_G[siteurl];
        $content = $arr[content] ? $arr[content] : $_G[setting][seo_description];
        $content .= '-' . $_G[setting][title];
    }
    $url = urlencode_utf8($url);
    $title = urlencode_utf8($title);
    $content = urlencode_utf8($content);
    $picurl = urlencode_utf8($picurl);
    $share[qzone] = $share[qqzone] = 'http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=' . $url . '&title=' . $title . '&summary=' . $content . '&pic=' . $picurl . "&site=";
    $share[weibo] = 'http://service.weibo.com/share/share.php?url=' . $url . '&title=' . $title . '&pic=' . $picurl;
    $share[t] = 'http://share.v.t.qq.com/index.php?c=share&a=index&url=' . $url . '&title=' . $title . '&pic=' . $picurl;
    $share[renren] = 'http://widget.renren.com/dialog/share?resourceUrl=' . $url . '&title=' . $title . '&pic=' . $picurl . '&description=' . $content;
    $share[kaixin] = 'http://www.kaixin001.com/rest/records.php?url=' . $url . '&content=' . $content . '&pic=' . $picurl . '&style=11&stime=&sig=';
    $share[douban] = 'http://www.douban.com/share/service?bm=&image=&href=' . $url . 'name=' . $title . '&text=' . $content;
    if ($arr[type]) {
        return $share[$arr[type]];
    } else {
        return $share;
    }
}
示例#13
0
function make_tags($kw, $url)
{
    global $_G;
    if (!$kw) {
        return array();
    }
    $tag = explode(',', $kw);
    $keywords = array();
    if ($tag) {
        $tag = array_unique($tag);
        $tag = array_filter($tag);
        foreach ($tag as $k => $v) {
            if ($v) {
                $uname = urlencode_utf8($v);
                $keywords[$uname] = $v;
                if ($_G['setting']['get_tag'] && $url && !array_key_exists($v, $_G['tag_list'])) {
                    $_G['tag_list'][$v] = array('url' => $url . $uname, 'title' => $v);
                }
            }
        }
    }
    return $keywords;
}
示例#14
0
 function main()
 {
     global $_G;
     if ($_GET['onsubmit'] && check() && !$_GET[search]) {
         foreach ($_GET[ids] as $k => $v) {
             if ($_GET[del][$k] == 0) {
                 continue;
             }
             $id = intval($v);
             $arr = array();
             $arr['like'] = intval($_GET['like'][$k]);
             $arr['hate'] = intval($_GET['hate'][$k]);
             $arr['hide'] = $_GET['hide'][$k] ? 1 : 0;
             $arr['sort'] = $_GET['sort'][$k] ? intval($_GET['sort'][$k]) : 0;
             if ($_GET['_del_all'] == 1 && $_GET['del'][$k]) {
                 DB::delete(__CLASS__, "id=" . $id);
             } else {
                 DB::update(__CLASS__, $arr, "id=" . $id);
             }
         }
         cpmsg('操作成功', 'success', 'm=' . __CLASS__ . '&a=' . __FUNCTION__);
         return false;
     }
     $size = 30;
     $start = ($_G['page'] - 1) * $size;
     $url = '';
     $and = '';
     if ($_GET[search] == 1) {
         $url .= "&search=1";
     }
     if (isset($_GET['from_url']) && $_GET['from_url']) {
         $from_url = trim($_GET['from_url']);
         $and .= " AND `from_url` LIKE '%" . $from_url . "%'";
         $url .= "&from_url=" . urlencode_utf8($from_url);
     }
     if ($_GET['from_name']) {
         $from_name = trim($_GET['from_name']);
         $and .= " AND `from_name` LIKE '%" . $from_name . "%'";
         $url .= "&from_name=" . urlencode_utf8($from_name);
     }
     if ($_GET['keywords']) {
         $keywords = trim($_GET['keywords']);
         $and .= " AND `keywords` LIKE '%" . $keywords . "%'";
         $url .= "&keywords=" . urlencode_utf8($keywords);
     }
     if ($_GET['title']) {
         $title = trim($_GET['title']);
         $and .= " AND `title` LIKE '%" . $title . "%'";
         $url .= "&title=" . urlencode_utf8($title);
     }
     if (isset($_GET['hide']) && $_GET['hide'] > 0) {
         $hide = intval($_GET['hide']);
         $and .= $hide == 2 ? " AND `hide` =0" : " AND `hide` =1";
         $url .= "&hide=" . $hide;
     }
     if (isset($_GET['picurl']) && $_GET['picurl'] > 0) {
         $picurl = intval($_GET['picurl']);
         $and .= $picurl == 2 ? " AND `picurl` =''" : " AND `picurl` !=''";
         $url .= "&hide=" . $picurl;
     }
     if (isset($_GET['url']) && $_GET['url'] > 0) {
         $a_url = intval($_GET['url']);
         $and .= $a_url == 2 ? " AND `url` =''" : " AND `url` !=''";
         $url .= "&hide=" . $a_url;
     }
     $img = DB::fetch_all("SELECT * FROM " . DB::table('img') . " WHERE 1 {$and} ORDER BY sort DESC,id DESC LIMIT {$start},{$size}");
     foreach ($img as $k => $v) {
         $v['org_dateline'] = $v['dateline'];
         $v['dateline'] = dgmdate($v['dateline'], 'u');
         $img[$k] = $v;
     }
     $count = getcount("img", $and);
     $showpage = multi($count, $size, $_G['page'], URL . "m=img&a=main" . $url);
     $tag = isset($_GET['tag']) ? intval($_GET['tag']) : -1;
     $this->add(array('img' => $img, 'showpage' => $showpage, 'count' => $count, 'tag' => $tag));
     $this->show('img/main');
 }
示例#15
0
    function info()
    {
        global $_G;
        $uid = intval($_GET[uid]);
        $user = getuser($uid, 'uid');
        if (!$user[uid]) {
            json(array('status' => 'error', 'msg' => '未找到用户信息'));
            return false;
        }
        $admin = $user[admin] == 1 ? '是' : '否';
        $wangwang = '';
        if ($user[wangwang]) {
            $w = urlencode_utf8($user[wangwang]);
            $wangwang = '<a target="_blank" href="http://www.taobao.com/webww/ww.php?ver=3&touid=' . $w . '&siteid=cntaobao&status=1&charset=utf-8" >
			<img border="0" src="http://amos.alicdn.com/online.aw?v=2&uid=' . $w . '&site=cntaobao&s=1&charset=utf-8" alt="点击这里给我发消息" /></a>';
        }
        $user[regdate] = dgmdate($user[regdate], 'u');
        $text = "\n\t\t用户名:\t\t{$user['username']}\t<br/>\n\n\t\t是否管理员:\t{$admin}\t\t\t<br/>\n\t\t旺旺:\t\t{$wangwang}\t\t<br/>\t\t\n\t\t电话:\t\t{$user['phone']}\t<br/>\n\t\t收货地址:\t{$user['address']}\t<br/>\n\t\t留言或介绍信息:\t{$user['content']}\t<br/>\n\t\t注册IP:\t\t{$user['regip']}\t<br/>\n\t\t注册时间:\t{$user['regdate']}\t<br/>";
        //$text .= '编辑会员信息:	<a href="'.URL.'m=member&a=post&uid='.$user[uid].'" target="_blank">点击修改</a><br/>';
        json(array('status' => 'success', 'msg' => $text));
    }
示例#16
0
 function search()
 {
     global $_G;
     $and = '';
     $url = URL . 'a=search';
     $rs = array();
     if ($_GET['kw']) {
         $string = stripsearchkey(trim($_GET['kw']));
         if (preg_match("/^%+\$|^_+\$|^\\*+\$/is", $string)) {
             msg('非法搜索关键字');
         }
         $string = safe_output($string);
         if (dstrlen($string) < 2) {
             msg('要搜索的关键字长度不能小于2');
         }
         $_GET[kw] = $string;
         $and .= " AND title like '%{$string}%' ";
         $url .= "&kw=" . urlencode_utf8($string);
         $and .= " AND `check`=1 AND `hide`=0 ";
         $and .= " AND ( end_time = 0 or  end_time > " . TIMESTAMP . ")";
         $sql = make_sql();
         $size = 60;
         $rs = D(array('and' => $and . $sql['and'], 'order' => $sql[order]), array('url' => $url . $sql[url], 'size' => $size));
         //dump($and .$sql['and'],1);
     } else {
         if ($_GET['price1'] && $_GET['price2']) {
             $sql = make_sql();
             $size = 60;
             $rs = D(array('and' => $and . $sql['and'], 'all' => true, 'order' => $sql[order], 'key' => 'search'), array('url' => $url . $sql[url], 'size' => $size));
         }
     }
     seo($string . ' - 商品搜索');
     $this->add($rs);
     $this->show();
 }