public function run() { global $_FANWE; $root = array(); $root['return'] = 0; if ($_FANWE['uid'] == 0) { $root['info'] = "请先登陆"; m_display($root); } $user = FS("User")->getUserById($_FANWE['uid']); $data = array('oldpassword' => $_FANWE['requestData']['oldpassword'], 'newpassword' => $_FANWE['requestData']['newpassword']); $vservice = FS('Validate'); $validate = array(array('oldpassword', 'required', '请输入现在的密码'), array('newpassword', 'range_length', '请输入正确的新密码', 6, 32)); if (!$vservice->validation($validate, $data)) { $root['info'] = $vservice->getError(); m_display($root); } else { if (md5($data['oldpassword']) != $user['password']) { $root['info'] = '原密码不正确'; m_display($root); } else { FDB::update('user', array('password' => md5($data['newpassword'])), 'uid = ' . $_FANWE['uid']); $root['info'] = '修改成功'; $user_field = $_FANWE['setting']['integrate_field_id']; $sql = "SELECT {$user_field} FROM " . FDB::table('user') . " WHERE uid = '{$_FANWE['uid']}'"; $integrate_id = intval(FDB::resultFirst($sql)); if ($integrate_id > 0) { FS("Integrate")->editUser($integrate_id, $data['newpassword'], '', ''); } } } $root['return'] = 1; m_display($root); }
public function all() { global $_FANWE; $is_best = false; $is_all = true; $_FANWE['nav_title'] = lang('common', 'daren'); $count = FDB::resultFirst('SELECT COUNT(uid) FROM ' . FDB::table('user_daren') . ' WHERE status = 1'); $pager = buildPage('daren/all', array(), $count, $_FANWE['page'], 18); $col = 3; $index = 0; $list = array(); $today_time = getTodayTime(); $sql = 'SELECT ud.*,u.user_name,u.server_code,uc.fans,uc.goods,uc.shares, up.reside_province,up.reside_city,up.introduce FROM ' . FDB::table('user_daren') . ' AS ud INNER JOIN ' . FDB::table('user') . ' AS u ON u.uid = ud.uid INNER JOIN ' . FDB::table('user_count') . ' AS uc ON uc.uid = u.uid INNER JOIN ' . FDB::table('user_profile') . ' AS up ON up.uid = ud.uid WHERE ud.status = 1 ORDER BY ud.day_time DESC,ud.id DESC LIMIT ' . $pager['limit']; $res = FDB::query($sql); while ($data = FDB::fetch($res)) { $data['today_best'] = false; $data['url'] = FU('u/index', array('uid' => $data['uid'])); $province = $_FANWE['cache']['citys']['all'][$data['reside_province']]['name']; $city = $_FANWE['cache']['citys']['all'][$data['reside_city']]['name']; $data['city'] = $province . ' ' . $city; $list[$index % $col][] = $data; $index++; } include template('page/daren'); display(); }
public function run() { global $_FANWE; $root = array(); $root['return'] = 1; $share_id = (int) $_FANWE['requestData']['share_id']; $page = (int) $_FANWE['requestData']['page']; $page = max(1, $page); $sql_count = "SELECT COUNT(DISTINCT comment_id) FROM " . FDB::table("share_comment") . " WHERE share_id = " . $share_id; $total = FDB::resultFirst($sql_count); $page_size = PAGE_SIZE; $page_total = ceil($total / $page_size); if ($page > $page_total) { $page = $page_total; } $limit = ($page - 1) * $page_size . "," . $page_size; $sql = 'SELECT c.*,u.user_name,u.server_code FROM ' . FDB::table('share_comment') . ' AS c INNER JOIN ' . FDB::table('user') . ' AS u ON u.uid = c.uid WHERE c.share_id = ' . $share_id . ' ORDER BY c.comment_id DESC LIMIT ' . $limit; $res = FDB::query($sql); $list = array(); while ($item = FDB::fetch($res)) { $item['user_avatar'] = avatar($item['uid'], 'm', $item['server_code'], 1, true); $item['time'] = getBeforeTimelag($item['create_time']); m_express(&$item, $item['content']); $list[] = $item; } $root['item'] = $list; $root['page'] = array("page" => $page, "page_total" => $page_total); m_display($root); }
public function run() { global $_FANWE; $root = array(); $root['return'] = 1; $is_hot = (int) $_FANWE['requestData']['is_hot']; $is_new = (int) $_FANWE['requestData']['is_new']; $page = (int) $_FANWE['requestData']['page']; $page = max(1, $page); $today_time = getTodayTime(); $field = ''; $whrer = ''; $book_photo_goods = (int) $_FANWE['setting']['book_photo_goods']; if ($book_photo_goods == 0) { $whrer = " WHERE share_data IN ('goods','photo','goods_photo')"; } elseif ($book_photo_goods == 1) { $whrer = " WHERE share_data IN ('photo','goods_photo')"; } elseif ($book_photo_goods == 2) { $whrer = " WHERE share_data IN ('goods','goods_photo')"; } if ($is_hot == 1) { $day7_time = $today_time - 604800; $field = ",(create_time > {$day7_time}) AS time_sort "; $sort = " ORDER BY time_sort DESC,collect_count DESC"; } if ($is_new == 1) { $sort = " ORDER BY share_id DESC"; } $sql_count = "SELECT COUNT(DISTINCT share_id) FROM " . FDB::table("share"); $total = FDB::resultFirst($sql_count); $page_size = PAGE_SIZE; $max_page = 100; if ($total > $max_page * $page_size) { $total = $max_page * $page_size; } if ($page > $max_page) { $page = $max_page; } $page_total = ceil($total / $page_size); $limit = ($page - 1) * $page_size . "," . $page_size; $sql = 'SELECT DISTINCT(share_id),cache_data ' . $field . ' FROM ' . FDB::table('share') . $whrer . $sort . ' LIMIT ' . $limit; $res = FDB::query($sql); $share_list = array(); while ($item = FDB::fetch($res)) { $cache_data = fStripslashes(unserialize($item['cache_data'])); $img = current($cache_data['imgs']['all']); $data = array(); $data['share_id'] = $item['share_id']; $data['img'] = getImgName($img['img'], 100, 999, 0, true); $data['height'] = $img['height'] * (100 / $img['width']); $share_list[] = $data; } $root['item'] = $share_list; $root['page'] = array("page" => $page, "page_total" => $page_total); m_display($root); }
public function run() { global $_FANWE; $root = array(); $root['return'] = 0; $uid = (int) $_FANWE['requestData']['uid']; if ($uid > 0) { if (!FS('User')->getUserExists($uid)) { $uid = 0; } } if ($uid == 0) { $uid = $_FANWE['uid']; $root['home_user'] = $_FANWE['user']; } if ($uid == 0) { $root['info'] = "请选择要查看的会员"; m_display($root); } if (!isset($root['home_user'])) { $root['home_user'] = FS("User")->getUserById($uid); unset($root['home_user']['user_name_match'], $root['home_user']['password'], $root['home_user']['active_hash'], $root['home_user']['reset_hash']); $root['home_user']['user_avatar'] = avatar($uid, 'm', $root['home_user']['server_code'], 1, true); } $page = (int) $_FANWE['requestData']['page']; $page = max(1, $page); $is_spare_flow = (int) $_FANWE['requestData']['is_spare_flow']; $img_size = 200; $scale = 2; if ($is_spare_flow == 1) { $img_size = 100; $scale = 1; } $total = FDB::resultFirst('SELECT COUNT(photo_id) FROM ' . FDB::table('share_photo') . ' WHERE uid = ' . $uid); $page_size = 20; //PAGE_SIZE; $page_total = max(1, ceil($total / $page_size)); if ($page > $page_total) { $page = $page_total; } $limit = ($page - 1) * $page_size . "," . $page_size; $photo_list = array(); $res = FDB::query('SELECT photo_id,share_id,img FROM ' . FDB::table('share_photo') . ' WHERE uid = ' . $uid . ' ORDER BY photo_id DESC LIMIT ' . $limit); while ($photo = FDB::fetch($res)) { $photo['img'] = getImgName($photo['img'], $img_size, $img_size, 1, true); $photo['height'] = round($img_size / $scale); $photo['url'] = FU('note/m', array('sid' => $photo['share_id'], 'id' => $photo['photo_id']), true); $photo_list[] = $photo; } $root['return'] = 1; $root['item'] = $photo_list; $root['page'] = array("page" => $page, "page_total" => $page_total); m_display($root); }
public function run() { global $_FANWE; $root = array(); $root['return'] = 1; $key = 'm/sharecate'; $cache_list = getCache($key); if ($cache_list !== NULL || TIME_UTC - $cache_list['cache_time'] > 600) { $cate_list = array(); $min_time = $this->getQuarterMinTime(); $max_time = getTodayTime(); FanweService::instance()->cache->loadCache('albums'); $album_cate = $_FANWE['cache']['albums']['category']; foreach ($album_cate as $k => $v) { $cate = array(); $cate['cate_id'] = $v['id']; $cate['cate_name'] = $v['name']; $cate['short_name'] = $v['name']; $cate['cate_code'] = $v['cate_code']; $cate['cate_icon'] = FS("Image")->getImageUrl($v['img'], 2); $cate['desc'] = $v['desc']; $cate['create_time'] = $v['create_time']; //获取本季分享数量 $share_count_sql = 'select count(DISTINCT s.share_id) from ' . FDB::table("share") . ' as s INNER JOIN ' . FDB::table("album_share") . ' as al on s.share_id = al.share_id where al.cid = ' . $v['id'] . " and s.day_time >= {$min_time} AND s.day_time <= {$max_time} "; $cate['share_count'] = FDB::resultFirst($share_count_sql); $cate['img_tags'] = array(); $img_size = 320; $sql = 'select s.share_id,al.title,sp.img from ' . FDB::table("share") . ' as s INNER JOIN ' . FDB::table("album_share") . ' as als ON s.share_id = als.share_id INNER JOIN ' . FDB::table("album") . ' as al ON als.album_id = al.id INNER JOIN ' . FDB::table("share_photo") . " as sp ON s.share_id = sp.share_id \r\n\t\t\t\t\tWHERE s.day_time >= {$min_time} AND s.day_time <= {$max_time} AND als.cid = " . $v['id'] . " GROUP BY s.share_id ORDER BY s.share_id desc limit 5"; $res = FDB::query($sql); while ($data = FDB::fetch($res)) { $img_data = array(); $img_data['share_id'] = $data['share_id']; $img_data['tag_name'] = $data['title']; $img_data['is_tag'] = 0; $img_data['img'] = FS("Image")->getImageUrl(getImgName($data['img'], $img_size, $img_size, 1, true), 2); $img_data['url_tag'] = urlencode($data['title']); $cate['img_tags'][] = $img_data; $img_size = 160; } $cate['txt_tags'] = array(); $cate_list[] = $cate; } $cache_list = array(); $cache_list['cate_list'] = $cate_list; $cache_list['cache_time'] = TIME_UTC; setCache($key, $cache_list); } else { $cate_list = $cache_list['cate_list']; } $root['item'] = $cate_list; m_display($root); }
public function pm() { define("ACTION_NAME", "pm"); if (intval($GLOBALS['fanwe']->var['uid']) == 0) { fHeader("location: " . FU('user/login')); } $uname = addslashes($_POST['uname']); $uid = intval(FDB::resultFirst("select uid from " . FDB::table("user") . " where user_name = '" . $uname . "'")); fHeader("location: " . FU('message/send', array('uid' => $uid))); }
public function searchShop() { vendor("common"); $kw = trim($_REQUEST['kw']); $result['kw'] = $kw; $shop_list = FDB::fetchAll("select * from " . FDB::table("shop") . " where shop_name like '%" . $kw . "%' order by rand() limit 20 "); $shop_count = intval(FDB::resultFirst("select count(*) from " . FDB::table("shop") . " where shop_name like '%" . $kw . "%'")); $result['shop_list'] = $shop_list; $result['shop_count'] = $shop_count; die(json_encode($result)); }
public function jumpUserBindReg($data, $user_name) { do { $max_count = FDB::resultFirst('SELECT COUNT(*) FROM ' . FDB::table("user") . " WHERE user_name = '" . $user_name . "'"); if ($max_count > 0) { $user_name = $user_name . '_' . random(3); } } while ($max_count > 0); $data['user_name'] = $user_name; $data = serialize($data); fSetCookie('bind_user_info', authcode($data, 'ENCODE')); fHeader("location:" . FU('user/bind')); }
public function run() { global $_FANWE; $root = array(); $root['return'] = 1; $page = (int) $_FANWE['requestData']['page']; $page = max(1, $page); $total = FDB::resultFirst('SELECT COUNT(id) FROM ' . FDB::table('user_daren') . ' WHERE status = 1'); $page_size = PAGE_SIZE; $page_total = max(1, ceil($total / $page_size)); if ($page > $page_total) { $page = $page_total; } $limit = ($page - 1) * $page_size . "," . $page_size; $user_follows = array(); $res = FDB::query('SELECT u.uid,u.user_name,u.server_code,uc.fans,ud.reason,up.introduce FROM ' . FDB::table('user_daren') . ' AS ud INNER JOIN ' . FDB::table('user') . ' AS u ON u.uid = ud.uid INNER JOIN ' . FDB::table('user_count') . ' AS uc ON uc.uid = ud.uid INNER JOIN ' . FDB::table('user_profile') . ' AS up ON up.uid = ud.uid WHERE ud.status = 1 ORDER BY ud.id DESC LIMIT ' . $limit); while ($data = FDB::fetch($res)) { $data['user_avatar'] = avatar($data['uid'], 'm', $data['server_code'], 1, true); $data['desc'] = $data['introduce']; if (!empty($data['reason'])) { $data['desc'] = $data['reason']; } unset($data['server_code'], $data['introduce'], $data['reason']); if ($data['uid'] == $_FANWE['uid']) { $data['is_follow'] = -1; } else { $user_follows[$data['uid']] = 0; $data['is_follow'] = 0; } $user_list[$data['uid']] = $data; } $uids = array_keys($user_follows); $uids = implode(',', $uids); $uids = str_replace(',,', ',', $uids); if (!empty($uids)) { $res = FDB::query("SELECT uid FROM " . FDB::table('user_follow') . ' WHERE f_uid = ' . $_FANWE['uid'] . ' AND uid IN (' . $uids . ')'); while ($item = FDB::fetch($res)) { $user_list[$item['uid']]['is_follow'] = 1; } } $root['item'] = array_slice($user_list, 0); $root['page'] = array("page" => $page, "page_total" => $page_total); m_display($root); }
public function run() { global $_FANWE; $root = array(); $root['return'] = 0; $uid = $_FANWE['uid']; if ($uid == 0) { $root['info'] = "请先登陆"; m_display($root); } $root['home_user'] = $_FANWE['user']; $page = (int) $_FANWE['requestData']['page']; $page = max(1, $page); $uids = array(); //获取我关注的会员编号 $sql = 'SELECT uid FROM ' . FDB::table('user_follow') . ' WHERE f_uid = ' . $uid; $res = FDB::query($sql); while ($data = FDB::fetch($res)) { $uids[] = (int) $data['uid']; } if (count($uids) > 0) { $sql = 'SELECT COUNT(share_id) FROM ' . FDB::table("share") . ' WHERE uid IN (' . implode(',', $uids) . ')'; $total = FDB::resultFirst($sql); $page_size = PAGE_SIZE; $page_total = max(1, ceil($total / $page_size)); if ($page > $page_total) { $page = $page_total; } $limit = ($page - 1) * $page_size . "," . $page_size; $share_list = array(); $sql = 'SELECT * FROM ' . FDB::table("share") . ' WHERE uid IN (' . implode(',', $uids) . ') ORDER BY share_id DESC LIMIT ' . $limit; $share_list = FDB::fetchAll($sql); $share_list = mGetShareDetailList($share_list, true); } else { $page_total = 0; $share_list = array(); } $root['return'] = 1; if (count($share_list) > 0) { $root['item'] = array_slice($share_list, 0); } else { $root['item'] = array(); } $root['page'] = array("page" => $page, "page_total" => $page_total); m_display($root); }
public function show() { global $_FANWE; $id = (int) $_FANWE['request']['id']; if (!$id) { exit; } $shop = FDB::fetchFirst('SELECT * FROM ' . FDB::table('shop') . ' WHERE shop_id = ' . $id); if (!$shop) { fHeader("location: " . FU('shop/index')); } $_FANWE['nav_title'] = $shop['shop_name'] . ' - ' . $_FANWE['nav_title']; $cache_data = fStripslashes(unserialize($shop['data'])); $shop['tags'] = $cache_data['tags']; if (empty($shop['taoke_url'])) { $shop['to_url'] = FU('tgo', array('url' => $shop['shop_url'])); } else { $shop['to_url'] = FU('tgo', array('url' => $shop['taoke_url'])); } $page_args['id'] = $id; $sql = 'SELECT COUNT(DISTINCT sg.share_id) FROM ' . FDB::table('share_goods') . ' AS sg INNER JOIN ' . FDB::table('share') . ' AS s ON s.share_id = sg.share_id WHERE s.status = 1 AND sg.shop_id = ' . $id; $share_count = FDB::resultFirst($sql); $page_size = 20; $pager = buildPage('shop/show', $page_args, $share_count, $_FANWE['page'], $page_size); $share_ids = array(); $sql = 'SELECT DISTINCT sg.share_id FROM ' . FDB::table('share_goods') . ' AS sg INNER JOIN ' . FDB::table('share') . ' AS s ON s.share_id = sg.share_id WHERE s.status = 1 AND sg.shop_id = ' . $id . ' ORDER BY sg.share_id DESC LIMIT ' . $pager['limit']; $res = FDB::query($sql); while ($data = FDB::fetch($res)) { $share_ids[] = $data['share_id']; } $share_list = array(); if (count($share_ids) > 0) { $share_ids = implode(',', $share_ids); $sql = 'SELECT * FROM ' . FDB::table('share') . ' WHERE share_id IN (' . $share_ids . ') ORDER BY share_id DESC'; $share_list = FDB::fetchAll($sql); $share_list = FS('Share')->getShareDetailList($share_list, false, true, true, false, 0, 10); } $shops_tags = FS('Shop')->getUserOtherShopAndTags($id); include template('page/shop/shop_show'); display(); }
public function run() { global $_FANWE; $root = array(); $root['return'] = 0; $uid = $_FANWE['uid']; if ($uid == 0) { $root['info'] = "请先登陆"; m_display($root); } $root['home_user'] = $_FANWE['user']; FDB::query("DELETE FROM " . FDB::table('user_notice') . " WHERE uid='{$uid}' AND type=3"); $page = (int) $_FANWE['requestData']['page']; $page = max(1, $page); $sql = 'SELECT COUNT(sc.comment_id) FROM ' . FDB::table("share") . ' AS s INNER JOIN ' . FDB::table("share_comment") . ' AS sc ON sc.share_id = s.share_id WHERE s.uid = ' . $uid; $total = FDB::resultFirst($sql); $page_size = PAGE_SIZE; $page_total = max(1, ceil($total / $page_size)); if ($page > $page_total) { $page = $page_total; } $limit = ($page - 1) * $page_size . "," . $page_size; $comment_list = array(); $sql = 'SELECT sc.*,s.content as scontent,u.user_name,u.server_code FROM ' . FDB::table("share") . ' AS s INNER JOIN ' . FDB::table("share_comment") . ' AS sc ON sc.share_id = s.share_id INNER JOIN ' . FDB::table("user") . ' AS u ON u.uid = sc.uid WHERE s.uid = ' . $uid . ' ORDER BY comment_id DESC LIMIT ' . $limit; $res = FDB::query($sql); while ($data = FDB::fetch($res)) { $data['user_avatar'] = FS("Image")->getImageUrl('.' . avatar($data['uid'], 'm', 1), 2); $data['time'] = getBeforeTimelag($data['create_time']); $data['url'] = FU('note/index', array('sid' => $data['share_id']), true); m_express(&$data, $data['content'] . $data['scontent']); $comment_list[] = $data; } $root['return'] = 1; $root['item'] = $comment_list; $root['page'] = array("page" => $page, "page_total" => $page_total); m_display($root); }
function deleteEvent($share_id) { $share_id = (int) $share_id; $event_id = (int) FDB::resultFirst("select id from " . FDB::table("event") . " \r\n\t\t\twhere share_id = {$share_id}"); if ($event_id > 0) { $share = FDB::fetchFirst("select share_id,uid from " . FDB::table("event_share") . " \r\n\t\t\t\twhere event_id = {$event_id} order by share_id asc limit 0,1"); if ($share) { $share_id = (int) $share['share_id']; $uid = (int) $share['uid']; FDB::query("update " . FDB::table("event") . " set thread_count = thread_count - 1,share_id = {$share_id},uid = {$uid} where id = {$event_id}"); FDB::delete('event_share', 'share_id = ' . $share_id); } else { FDB::delete('event', 'id = ' . $event_id); } } else { FDB::delete('event_share', 'share_id = ' . $share_id); FDB::query("update " . FDB::table("event") . " set thread_count = thread_count - 1 where id = {$event_id}"); } }
public function run() { global $_FANWE; $root = array(); $root['return'] = 0; $uid = $_FANWE['uid']; if ($uid == 0) { $root['info'] = "请先登陆"; m_display($root); } $root['home_user'] = $_FANWE['user']; FDB::query("DELETE FROM " . FDB::table('user_notice') . " WHERE uid='{$uid}' AND type=4"); $page = (int) $_FANWE['requestData']['page']; $page = max(1, $page); $sql = 'SELECT COUNT(*) FROM ' . FDB::table("share") . ' AS s LEFT JOIN ' . FDB::table("atme") . ' as a on a.share_id=s.share_id WHERE a.uid = ' . $uid . ' and s.uid <> ' . $uid . ' and s.type<>\'fav\' '; $total = FDB::resultFirst($sql); $page_size = PAGE_SIZE; $page_total = max(1, ceil($total / $page_size)); if ($page > $page_total) { $page = $page_total; } $limit = ($page - 1) * $page_size . "," . $page_size; $share_list = array(); $sql = 'SELECT s.* FROM ' . FDB::table("share") . ' AS s LEFT JOIN ' . FDB::table("atme") . ' as a on a.share_id=s.share_id WHERE a.uid = ' . $uid . ' and s.uid <> ' . $uid . ' and s.type<>\'fav\' ORDER BY s.share_id DESC LIMIT ' . $limit; $share_list = FDB::fetchAll($sql); $share_list = mGetShareDetailList($share_list, true); $root['return'] = 1; if (count($share_list) > 0) { $root['item'] = array_slice($share_list, 0); } else { $root['item'] = array(); } $root['page'] = array("page" => $page, "page_total" => $page_total); m_display($root); }
public function run() { global $_FANWE; $root = array(); $root['return'] = 1; $city_id = intval($_FANWE['requestData']['city_id']); $quan_id = intval($_FANWE['requestData']['quan_id']); $cate_id = intval($_FANWE['requestData']['cate_id']); $page = intval($_FANWE['requestData']['page']); //分页 $page = $page == 0 ? 1 : $page; $page_size = PAGE_SIZE; $limit = ($page - 1) * $page_size . "," . $page_size; $sql_count = "select count(*) from " . FDB::table("merchant_youhui"); $sql = "select id,merchant_id,title,content,merchant_logo,create_time,merchant_xpoint,merchant_ypoint,merchant_api_address,image_1 from " . FDB::table("merchant_youhui"); $now = TIME_UTC; $where = "1 = 1 and status = 1 and begin_time<" . $now . " and (end_time = 0 or end_time > " . $now . ")"; if ($city_id > 0) { $where .= " and merchant_city_id = {$city_id}"; } if ($quan_id > 0) { $where .= " and merchant_quan_id = {$quan_id}"; } if ($cate_id > 0) { $where .= " and merchant_category_id = {$cate_id}"; } $sql_count .= " where " . $where; $sql .= " where " . $where; $sql .= " limit " . $limit; //echo $sql; exit; $total = FDB::resultFirst($sql_count); $page_total = ceil($total / $page_size); $list = FDB::fetchAll($sql); $youhui_list = array(); foreach ($list as $item) { $youhui_list[] = m_youhuiItem($item); } $root['item'] = $youhui_list; $root['page'] = array("page" => $page, "page_total" => $page_total); m_display($root); }
public function index() { global $_FANWE; $where = ' WHERE status = 1 AND (begin_time <= ' . TIME_UTC . ' OR begin_time = 0) AND (end_time >= ' . TIME_UTC . ' OR end_time = 0)'; $order = ' ORDER BY sort ASC,end_time ASC,id DESC'; $best_list = array(); $best_ids = array(); $sql = 'SELECT * FROM ' . FDB::table('exchange_goods') . $where . ' AND is_best = 1 ' . $order . ' LIMIT 0,4'; $res = FDB::query($sql); while ($data = FDB::fetch($res)) { $data['num'] = $data['stock'] - $data['buy_count']; $data['url'] = FU('exchange/show', array('id' => $data['id'])); $best_list[] = $data; $best_ids[] = $data['id']; } if (count($best_ids) > 0) { $best_ids = implode(',', $best_ids); $where .= ' AND id NOT IN (' . $best_ids . ')'; } $sql = 'SELECT COUNT(id) FROM ' . FDB::table('exchange_goods') . $where; $goods_count = FDB::resultFirst($sql); $page_size = 10; $pager = buildPage('exchange/index', array(), $goods_count, $_FANWE['page'], $page_size); $sql = 'SELECT * FROM ' . FDB::table('exchange_goods') . $where . $order . ' LIMIT ' . $pager['limit']; $goods_list = array(); $res = FDB::query($sql); while ($data = FDB::fetch($res)) { $data['num'] = $data['stock'] - $data['buy_count']; $data['url'] = FU('exchange/show', array('id' => $data['id'])); $goods_list[] = $data; } $order_list = FS("Exchange")->getOrderTop(); $score_list = FS("Exchange")->getScoreTop(); $exchange_list = FS("Exchange")->getExchangeTop(); if ($_FANWE['uid'] > 0) { $consignee = FDB::fetchFirst('SELECT * FROM ' . FDB::table('user_consignee') . ' WHERE uid = ' . $_FANWE['uid']); } include template('page/exchange/exchange_index'); display(); }
public function run() { global $_FANWE; $root = array(); $root['return'] = 1; $email = $_FANWE['requestData']['email']; $pwd = $_FANWE['requestData']['pwd']; $uid = intval(FDB::resultFirst("select uid from " . FDB::table("user") . " where user_name='" . $email . "' and password = '******'")); $latitude = floatval($_FANWE['requestData']['latitude']); //ypoint $longitude = floatval($_FANWE['requestData']['longitude']); //xpoint if ($uid > 0 && $latitude > 0 && $longitude > 0) { $user_x_y_point = array('uid' => $uid, 'xpoint' => $longitude, 'ypoint' => $latitude, 'locate_time' => fGmtTime()); //$root['user_x_y_point'] = $user_x_y_point; $id = FDB::insert('user_x_y_point', $user_x_y_point, true); //FDB::lastSql(); $sql = "update " . FDB::table("user") . " set xpoint = {$longitude}, ypoint = {$latitude}, locate_time = " . fGmtTime() . " where uid = {$uid}"; //$root['sql'] = $sql; FDB::query($sql); } m_display($root); }
public function run() { global $_FANWE; $root = array(); $root['return'] = 1; if ($_FANWE['uid'] == 0) { exit; } $uid = $_FANWE['uid']; $page = (int) $_FANWE['requestData']['page']; $page = max(1, $page); $total = FDB::resultFirst('SELECT COUNT(f_uid) FROM ' . FDB::table('user_follow') . ' WHERE uid = ' . $uid); $page_size = PAGE_SIZE; $page_total = max(1, ceil($total / $page_size)); if ($page > $page_total) { $page = $page_total; } $limit = ($page - 1) * $page_size . "," . $page_size; Cache::getInstance()->loadCache('citys'); $user_follows = array(); $res = FDB::query('SELECT u.uid,u.user_name,u.server_code,uc.fans,up.reside_province,up.reside_city,up.introduce FROM ' . FDB::table('user_follow') . ' AS uf INNER JOIN ' . FDB::table('user') . ' AS u ON u.uid = uf.f_uid INNER JOIN ' . FDB::table('user_count') . ' AS uc ON uc.uid = uf.f_uid INNER JOIN ' . FDB::table('user_profile') . ' AS up ON up.uid = uf.f_uid WHERE uf.uid = ' . $uid . ' ORDER BY uf.create_time DESC LIMIT ' . $limit); while ($data = FDB::fetch($res)) { $data['reside_province'] = $_FANWE['cache']['citys']['all'][$data['reside_province']]['name']; $data['reside_city'] = $_FANWE['cache']['citys']['all'][$data['reside_city']]['name']; $data['user_avatar'] = avatar($data['uid'], 'm', $data['server_code'], 1, true); unset($data['server_code']); $user_list[$data['uid']] = $data; } $root['item'] = array_slice($user_list, 0); $root['page'] = array("page" => $page, "page_total" => $page_total); m_display($root); }
$share_comments_data[$idxj]['user_url'] = FU('u/index', array('uid' => $vv['user']['uid'])); $share_comments_data[$idxj]['user_name'] = $vv['user']['user_name']; $share_comments_data[$idxj]['avt'] = avatar($vv['uid'], 's', $is_src = 1); $share_comments_data[$idxj]['comment'] = cutStr($vv['content'], 20); $idxj++; } $list[$i]['comments'] = $share_comments_data; } $list[$i]['share_url'] = FU('note/index', array('sid' => $v['share_id'])); $list[$i]['u_url'] = FU('u/index', array('uid' => $v['uid'])); $list[$i]['relay_count'] = FDB::resultFirst("select relay_count from " . FDB::table("share") . " where share_id = " . $v['share_id']); $album_sql = "select a.id,a.title from " . FDB::table('album_share') . " as ah left join " . FDB::table('album') . " as a on ah.album_id = a.id where ah.share_id = " . $v['share_id']; $album = FDB::fetchFirst($album_sql); if ($album) { $list[$i]['album_title'] = $album['title']; $list[$i]['is_album'] = 1; $list[$i]['album_url'] = FU("album/show", array('id' => $album['id'])); } else { $list[$i]['album_title'] = ""; $list[$i]['is_album'] = 0; $list[$i]['album_url'] = ""; } $list[$i]['zf_count'] = 10; $list[$i]['xh_count'] = 20; $list[$i]['user_name'] = FDB::resultFirst("select user_name from " . FDB::table('user') . " where uid =" . $v['uid']); $i++; } outputJson(array('result' => $list, 'current_user' => $current_user, 'status' => 1, 'hasNextPage' => $is_next)); } else { outputJson(array('status' => 0, 'hasNextPage' => $is_next)); }
public function fetch($url) { global $_FANWE; $id = $this->getID($url); if (empty($id)) { return false; } $key = '360buy_' . $id; $share_goods = FDB::resultFirst('SELECT share_id,goods_id FROM ' . FDB::table('share_goods') . ' WHERE uid = ' . $_FANWE['uid'] . " AND goods_key = '{$key}'"); if ($share_goods) { $result['status'] = -1; $result['share_id'] = $share_goods['share_id']; $result['goods_id'] = $share_goods['goods_id']; return $result; } //请求数据 $content = getUrlContent("http://www.360buy.com/product/" . $id . ".html"); if (empty($content)) { return false; } $content = gbToUTF8($content); $content = preg_replace("/[\r\n]/", '', $content); @preg_match("/<h1>(.*?)<\\/h1>/", $content, $title); if (empty($title)) { return false; } @preg_match("/<div id=\"preview\".*?>.*?<img.*?src=\"(.*?)\".*?jqimg=\"(.*?)\"\\/><\\/div>/", $content, $img); if (empty($img)) { return false; } @preg_match("/<strong class=\"price\"><img.*?src =\"(.*?)\"\\/><\\/strong>/", $content, $price); if (empty($price)) { return false; } else { $price = $this->getPrice($price[1]); if ($price === false) { return false; } } if (FS("Image")->getIsServer()) { $args = array(); $args['pic_url'] = $img[2]; $server = FS("Image")->formatServer($_FANWE['request']['image_server'], 'DE'); $server = FS("Image")->getImageUrlToken($args, $server, 1); $body = FS("Image")->sendRequest($server, 'savetemp', true); if (empty($body)) { return false; } $image = unserialize($body); $result['image_server'] = $server['image_server']; } else { $image = copyFile($img[2], "temp", false); if ($image === false) { return false; } $image['server_code'] = ''; } $result['item']['key'] = $key; $result['item']['name'] = strip_tags(trim($title[1])); $result['item']['price'] = $price; $result['item']['img'] = $image['path']; $result['item']['server_code'] = $image['server_code']; $result['item']['pic_url'] = $img[1]; $result['item']['url'] = "http://www.360buy.com/product/" . $id . ".html"; $unionId = $_FANWE['cache']['business']['jdbuy']['unionId']; if (!empty($unionId)) { $result['item']['taoke_url'] = "http://click.union.360buy.com/JdClick/?unionId=" . $unionId . "&t=4&to=" . $result['item']['url']; } return $result; }
private function getList() { global $_FANWE; $_FANWE['user_click_share_id'] = (int) $_FANWE['request']['sid']; unset($_FANWE['request']['sid']); $cache_file = getTplCache('page/book/book_index', $_FANWE['request'], 2); if (getCacheIsUpdate($cache_file, BOOK_CACHE_PAGE_TIME)) { $category = urldecode($_FANWE['request']['cate']); $is_root = false; $page_args = array(); if (isset($_FANWE['cache']['goods_category']['cate_code'][$category])) { $page_args['cate'] = $_FANWE['request']['cate']; $cate_id = $_FANWE['cache']['goods_category']['cate_code'][$category]; $goods_cate_code = $category; } else { $is_root = true; $cate_id = $_FANWE['cache']['goods_category']['root']; } $sort = $_FANWE['request']['sort']; $sort = !empty($sort) ? $sort : "pop"; $category_data = $_FANWE['cache']['goods_category']['all'][$cate_id]; $category_tags = array(); $_FANWE['nav_title'] = $category_data['cate_name']; if (!empty($category_data['seo_keywords'])) { $_FANWE['seo_keywords'] = $category_data['seo_keywords']; $_FANWE['setting']['site_keywords'] = ''; } if (!empty($category_data['seo_desc'])) { $_FANWE['seo_description'] = $category_data['seo_desc']; $_FANWE['setting']['site_description'] = ''; } $child_ids = array(); if (isset($category_data['child'])) { $child_ids = $category_data['child']; if (!$is_root) { $tagurlpara['cate'] = urlencode($category_data['cate_code']); } foreach ($category_data['child'] as $child_id) { $child_cate = $_FANWE['cache']['goods_category']['all'][$child_id]; $tag_key = 'goods_category_tags_' . $child_id; FanweService::instance()->cache->loadCache($tag_key); foreach ($_FANWE['cache'][$tag_key] as $k => $tag) { $tagurlpara['tag'] = urlencode($tag['tag_name']); $tag['url'] = FU("book/" . ACTION_NAME, $tagurlpara); $child_cate['tags'][] = $tag; if ($k > 16) { break; } } $category_tags[] = $child_cate; } } $hot_tags = array(); if (!$is_root) { $child_ids[] = $cate_id; require fimport("function/share"); $hot_tags = getHotTags($child_ids, $category, 10); } $condition = " WHERE s.share_data IN ('goods','photo','goods_photo')"; if (!$is_root) { $cids = array(); FS('Share')->getChildCids($cate_id, $cids); $condition .= " AND sc.cate_id IN (" . implode(',', $cids) . ")"; } $title = $category_data['short_name']; $is_match = false; $tag = urldecode($_FANWE['request']['kw']); if (!empty($tag)) { $_FANWE['nav_title'] = $tag . ' - ' . $_FANWE['nav_title']; $title = htmlspecialchars($tag); $is_match = true; //$match_key = FS('Words')->segment($tag,10); //$match_key = tagToUnicode($match_key,'+'); $match_key = segmentToUnicode($tag, '+'); $condition .= " AND match(sm.content_match) against('" . $match_key . "' IN BOOLEAN MODE) "; $page_args['tag'] = urlencode($tag); } //输出排序URL $sort_page_args = $page_args; $sort_page_args['sort'] = 'hot7'; $hot7_url['url'] = FU('book/' . ACTION_NAME, $sort_page_args); if ($sort == 'hot7') { $hot7_url['act'] = 1; } $sort_page_args['sort'] = 'hot30'; $hot30_url['url'] = FU('book/' . ACTION_NAME, $sort_page_args); if ($sort == 'hot30') { $hot30_url['act'] = 1; } $sort_page_args['sort'] = 'new'; $new_url['url'] = FU('book/' . ACTION_NAME, $sort_page_args); if ($sort == 'new') { $new_url['act'] = 1; } $sort_page_args['sort'] = 'pop'; $pop_url['url'] = FU('book/' . ACTION_NAME, $sort_page_args); if ($sort == 'pop') { $pop_url['act'] = 1; } if (!empty($_FANWE['request']['sort'])) { $page_args['sort'] = $sort; } else { $page_args['sort'] = 'pop'; } $today_time = getTodayTime(); switch ($sort) { //7天最热 点击次数 case 'hot7': $day7_time = $today_time - 604800; $field = ",(s.create_time > {$day7_time}) AS time_sort "; $sort = " ORDER BY time_sort DESC,s.click_count DESC"; break; //30天最热 点击次数 //30天最热 点击次数 case 'hot30': $day30_time = $today_time - 2592000; $field = ",(s.create_time > {$day30_time}) AS time_sort "; $sort = " ORDER BY time_sort DESC,s.click_count DESC"; break; //最新 //最新 case 'new': $field = ''; $sort = " ORDER BY s.share_id DESC"; break; //潮流 喜欢人数 //潮流 喜欢人数 case 'pop': default: $day7_time = $today_time - 604800; $field = ",(s.create_time > {$day7_time}) AS time_sort "; $sort = " ORDER BY time_sort DESC,s.collect_count DESC"; break; } $sql = 'SELECT DISTINCT(s.share_id),s.uid,s.content,s.collect_count,s.comment_count,s.create_time,s.cache_data ' . $field . ' FROM ' . FDB::table('share') . ' AS s '; if (!$is_root) { $sql .= 'INNER JOIN ' . FDB::table('share_category') . ' AS sc ON s.share_id = sc.share_id '; } if ($is_match) { $sql .= 'INNER JOIN ' . FDB::table('share_match') . ' AS sm ON sm.share_id = s.share_id '; } $sql .= $condition . $sort; $sql_count = 'SELECT COUNT(DISTINCT s.share_id) FROM ' . FDB::table('share') . ' AS s '; if (!$is_root) { $sql_count .= 'INNER JOIN ' . FDB::table('share_category') . ' AS sc ON s.share_id = sc.share_id '; } if ($is_match) { $sql_count .= 'INNER JOIN ' . FDB::table('share_match') . ' AS sm ON sm.share_id = s.share_id '; } $sql_count .= $condition; $page_size = 50; $max_page = 100; $count = FDB::resultFirst($sql_count); if ($count > $max_page * $page_size) { $count = $max_page * $page_size; } if ($_FANWE['page'] > $max_page) { $_FANWE['page'] = $max_page; } $pager = buildPage('book/' . $action, $page_args, $count, $_FANWE['page'], $page_size, '', 3); $share_datas = array(); $sql = $sql . ' LIMIT ' . $pager['limit']; $share_list = FDB::fetchAll($sql); $share_list = FS('Share')->getShareDetailList($share_list, false, false, false, true, 2); $col = 4; $index = 0; $share_display = array(); foreach ($share_list as $share) { $mod = $index % $col; $share_display['col' . $mod][] = $share; $index++; } include template('page/book/book_index'); display($cache_file); exit; } else { include $cache_file; display(); } }
/** * * 将第三方的数据,同步到本地数据库中 * @param string $user_name_or_email * @param string $password * @param int $gender 性别 * @param array $user 第三方的数据集,如果不为空的话,则直接使用这个数据集,如果为空的话,则调用:$this->getUser * $user = array( 'integrate_id' => $uid, 'email' => $email, 'user_name' => $uname, 'password' => md5(time().rand(100000, 999999)), ); * @return int >0 为:本系统的用户ID; <= 0 出错 */ public function addUserToLoacl($user_name_or_email, $password, $gender = 1, $user = null) { global $_FANWE; $uid = 0; $password = preg_match('/^\\w{32}$/', $password) ? $password : md5($password); $user_field = $_FANWE['setting']['integrate_field_id']; if (empty($user)) { $user_info = $this->getUser($user_name_or_email, $password, 0); //print_r($user_info); exit; } else { $user_info = $user; } $integrate_id = intval($user_info['integrate_id']); if ($integrate_id > 0) { $sql = "SELECT uid FROM " . FDB::table('user') . " WHERE {$user_field} = '{$integrate_id}'"; $uid = intval(FDB::resultFirst($sql)); if ($uid == 0) { if (FS('Validate')->email($user_name_or_email)) { $sql = "SELECT uid FROM " . FDB::table('user') . " WHERE email = '{$user_info['email']}'"; } else { $sql = "SELECT uid FROM " . FDB::table('user') . " WHERE user_name = '{$user_info['user_name']}'"; } $uid = intval(FDB::resultFirst($sql)); } if ($uid > 0) { //更新数据 if ($user_field != 'uid') { $sql = "UPDATE " . FDB::table('user') . " set {$user_field} = '{$integrate_id}', password = '******' where uid = '{$uid}'"; } else { $sql = "UPDATE " . FDB::table('user') . " set password = '******' where uid = '{$uid}'"; } FDB::query($sql); } else { //添加用户数据 $user = array('email' => $user_info['email'], 'user_name' => $user_info['user_name'], 'user_name_match' => segmentToUnicode($user_info['user_name']), 'password' => $password, 'status' => 1, 'email_status' => 0, 'avatar_status' => 0, 'gid' => 7, 'reg_time' => TIME_UTC, $user_field => $integrate_id); $uid = FDB::insert('user', $user, true); if ($uid > 0) { unset($user); FDB::insert('user_count', array('uid' => $uid)); $user_profile = array('uid' => $uid, 'gender' => $gender); FDB::insert('user_profile', $user_profile); unset($user_profile); $user_status = array('uid' => $uid, 'reg_ip' => $_FANWE['client_ip'], 'last_ip' => $_FANWE['client_ip'], 'last_time' => TIME_UTC, 'last_activity' => TIME_UTC); FDB::insert('user_status', $user_status); } return $uid; } } return $uid; }
public function resetPassword() { global $_FANWE; $hash = $_FANWE['request']['resethash']; if (empty($hash)) { fHeader("location: " . FU('user/login')); } $uid = FDB::resultFirst('SELECT uid FROM ' . FDB::table('user_status') . ' WHERE reset_hash = \'' . $hash . '\''); $uid = intval($uid); if ($uid == 0) { fHeader("location: " . FU('user/login')); } $method = strtolower($_SERVER["REQUEST_METHOD"]); if ($method == 'post') { $data_error = false; $data = array('password' => $_FANWE['request']['password'], 'confirm_password' => $_FANWE['request']['confirm_password']); $vservice = FS('Validate'); $validate = array(array('password', 'range_length', lang('user', 'register_password_range'), 6, 20), array('confirm_password', 'equal', lang('user', 'confirm_password_error'), $data['password'])); if (!$vservice->validation($validate, $data)) { $data_error = true; } else { //==================添加同步密码修改 chenfq 2011-10-15================ $user_field = $_FANWE['setting']['integrate_field_id']; $sql = "SELECT {$user_field} FROM " . FDB::table('user') . " WHERE uid = '{$uid}'"; $integrate_id = intval(FDB::resultFirst($sql)); if ($integrate_id > 0) { FS("Integrate")->editUser($integrate_id, $_FANWE['request']['password'], '', ''); } //==================添加同步密码修改 chenfq 2011-10-15================ FDB::query('UPDATE ' . FDB::table('user') . ' SET password = \'' . md5($data['password']) . '\' WHERE uid = ' . $uid); FDB::query('UPDATE ' . FDB::table('user_status') . ' SET reset_hash = \'\' WHERE uid = ' . $uid); } } include template('page/user/user_resetpwd'); display(); }
public function album() { global $_FANWE; $home_uid = $_FANWE['home_uid']; $home_user = FS('User')->getUserById($home_uid); $current_menu = 'album'; $album_list = array(); $pager = array(); $type = (int) $_FANWE['request']['type']; switch ($type) { case '2': $uids = array(); //获取我关注的会员编号 $sql = 'SELECT uid FROM ' . FDB::table('user_follow') . ' WHERE f_uid = ' . $home_uid; $res = FDB::query($sql); while ($data = FDB::fetch($res)) { $uids[] = (int) $data['uid']; } if (count($uids) > 0) { $sql = 'SELECT COUNT(id) FROM ' . FDB::table("album") . ' WHERE uid IN (' . implode(',', $uids) . ')'; $count = FDB::resultFirst($sql); $args['type'] = 2; $pager = buildPage('u/album', $args, $count, $_FANWE['page'], 10); $sql = 'SELECT * FROM ' . FDB::table('album') . ' WHERE uid IN (' . implode(',', $uids) . ') ORDER BY id DESC LIMIT ' . $pager['limit']; $res = FDB::query($sql); while ($data = FDB::fetch($res)) { $data['imgs'] = array(); if (!empty($data['cache_data'])) { $cache_data = fStripslashes(unserialize($data['cache_data'])); $data['imgs'] = $cache_data['imgs']; unset($data['cache_data']); } $data['url'] = FU('album/show', array('id' => $data['id'])); $album_list[$data['id']] = $data; } } break; case '3': $aids = array(); $sql = 'SELECT album_id FROM ' . FDB::table('album_best') . ' WHERE uid = ' . $home_uid; $res = FDB::query($sql); while ($data = FDB::fetch($res)) { $aids[] = (int) $data['album_id']; } if (count($aids) > 0) { $sql = 'SELECT COUNT(id) FROM ' . FDB::table("album") . ' WHERE id IN (' . implode(',', $aids) . ')'; $count = FDB::resultFirst($sql); $args['type'] = 3; $pager = buildPage('u/album', $args, $count, $_FANWE['page'], 10); $sql = 'SELECT * FROM ' . FDB::table('album') . ' WHERE id IN (' . implode(',', $aids) . ') ORDER BY id DESC LIMIT ' . $pager['limit']; $res = FDB::query($sql); while ($data = FDB::fetch($res)) { $data['imgs'] = array(); if (!empty($data['cache_data'])) { $cache_data = fStripslashes(unserialize($data['cache_data'])); $data['imgs'] = $cache_data['imgs']; unset($data['cache_data']); } $data['url'] = FU('album/show', array('id' => $data['id'])); $album_list[$data['id']] = $data; } } break; default: $type = 1; if ($home_user['albums'] > 0) { $args['type'] = 1; $pager = buildPage('u/album', $args, $home_user['albums'], $_FANWE['page'], 10); $sql = 'SELECT * FROM ' . FDB::table('album') . ' WHERE uid = ' . $home_uid . ' ORDER BY id DESC LIMIT ' . $pager['limit']; $res = FDB::query($sql); while ($data = FDB::fetch($res)) { $data['imgs'] = array(); if (!empty($data['cache_data'])) { $cache_data = fStripslashes(unserialize($data['cache_data'])); $data['imgs'] = $cache_data['imgs']; unset($data['cache_data']); } $data['url'] = FU('album/show', array('id' => $data['id'])); $album_list[] = $data; } } break; } include template('page/u/u_album'); display(); }
public function category() { global $_FANWE; $id = (int) $_FANWE['request']['id']; if (!$id) { fHeader("location: " . FU('album')); } if (!isset($_FANWE['cache']['albums']['category'][$id])) { fHeader("location: " . FU('album')); } $album_cate = $_FANWE['cache']['albums']['category'][$id]; $_FANWE['nav_title'] = $album_cate['name'] . $_FANWE['nav_title']; $page_args = array(); $page_args['id'] = $id; $sort = $_FANWE['request']['sort']; switch ($sort) { case 'new': $page_args['sort'] = 'new'; $order = " ORDER BY s.share_id DESC"; break; default: $sort = 'hot'; $page_args['sort'] = 'hot'; $order = " ORDER BY s.collect_count DESC"; break; } $where = ' WHERE a.cid = ' . $id; $sql = 'SELECT COUNT(DISTINCT share_id) FROM ' . FDB::table('album_share') . ' AS a ' . $where; $count = FDB::resultFirst($sql); $share_list = array(); $share_display = array(); if ($count > 0) { $pager = buildPage('album/' . ACTION_NAME, $page_args, $count, $_FANWE['page'], 40); $share_list = FDB::fetchAll('SELECT * FROM ' . FDB::table('album_share') . ' AS a INNER JOIN ' . FDB::table('share') . ' AS s ON s.share_id = a.share_id ' . $where . ' AND s.type = \'album_item\'' . $order . ' LIMIT ' . $pager['limit']); $share_list = FS('Share')->getShareDetailList($share_list, false, false, false, true, 2); $col = 4; $index = 0; $share_display = array(); foreach ($share_list as $share) { $share['empty_content'] = sprintf(lang('album', 'rel_album_empty_content'), $share['title']); $mod = $index % $col; $share_display['col' . $mod][] = $share; $index++; } } include template('page/album/album_category'); display(); }
public function getUserScore($uid) { $uid = (int) $uid; if ($uid > 0) { return FDB::resultFirst('SELECT credits FROM ' . FDB::table('user') . ' WHERE uid = ' . $uid); } else { return -1; } }
private function show($current_type = '') { global $_FANWE; $share_id = intval($_FANWE['request']['sid']); $id = intval($_FANWE['request']['id']); $share_detail = FS('Share')->getShareDetail($share_id); include fimport('dynamic/u'); if ($share_detail === false) { fHeader("location: " . FU('index')); } $page_title = preg_replace("/\\[[^\\]]+\\]/i", "", $share_detail['content']); $_FANWE['nav_title'] = $page_title . ' - ' . lang('common', 'share'); $_FANWE['seo_description'] = $page_title; $_FANWE['setting']['site_description'] = ''; $current_img = FDB::resultFirst("select img from " . FDB::table("share_photo") . " where share_id = " . $share_id . " and img <> '' "); if ($current_img['img_width'] > 468) { $current_img['img_width'] = 468; } $current_img_arr = FDB::fetchFirst("select * from " . FDB::table("share_photo") . " where share_id = " . $share_id . " and img <> '' "); //var_dump($current_img_arr); FDB::query('UPDATE ' . FDB::table('share') . ' SET click_count = click_count + 1 WHERE share_id = ' . $share_id); //上一个,下一个分享 $pns = FS('Share')->getSameAlbumNextShares($share_detail['uid'], $share_id); $other_album_share = FS('share')->getSameAlbumShares($share_id); $current_location = $other_album_share['location']; unset($other_album_share['location']); $same_album_count = $other_album_share['count']; unset($other_album_share['count']); $aid = FDB::resultFirst("select album_id from " . FDB::table('album_share') . " where share_id = " . $share_id); $album_sql = 'select al.id as id,al.title as title from ' . FDB::table('album') . ' as al left join ' . FDB::table('album_share') . ' as als on al.id = als.album_id where als.share_id = ' . $share_id; $album_data = FDB::fetchFirst($album_sql); $is_follow_album = FS('album')->getIsFollow($aid, $_FANWE['uid']); //发布分享的会员 $share_user = FS('User')->getUserById($share_detail['uid']); //喜欢分享的会员 $share_detail['collects'] = FS('Share')->getShareCollectUser($share_id); if (!isset($share_detail['collects'][$_FANWE['uid']])) { if (FS('Share')->getIsCollectByUid($share_id, $_FANWE['uid'])) { $share_detail['collects'][$_FANWE['uid']] = $_FANWE['uid']; } } //会员显示名称 $user_show_name = FS('User')->getUserShowName($share_detail['uid']); //会员勋章 $user_medals = FS('User')->getUserMedal($share_detail['uid']); //分享标签 $share_tags = $share_detail['cache_data']['tags']['user']; FS('Share')->tagsFormat($share_tags); foreach ($share_tags as $seo_tag) { $_FANWE['seo_keywords'] .= $seo_tag['tag_name'] . ','; } //是否可编辑标签 $is_eidt_tag = FS('Share')->getIsEditTag($share_detail); //喜欢分享的会员还喜欢 $fav_user_fav_share = FS('Share')->getCollectShareByShare($share_id); //发布分享的会员喜欢的分享 $user_collect_share = FS('Share')->getCollectShareByUser($share_user['uid']); //是否可删除标签 $is_remove_comment = FS('Share')->getIsRemoveComment($share_detail); //分享评论 $share_detail['comments'] = FS('Share')->getShareCommentList($share_id, '0,10'); //分享评论分页 $pager = buildPage('', array(), $share_detail['comment_count'], $_FANWE['page'], 10); unset($share_detail['cache_data']); $current_obj = NULL; if ($current_type == '' || $id == 0) { if (!empty($share_detail['imgs'])) { $current_obj = current($share_detail['imgs']); if ($current_obj['type'] == 'g') { $current_type = 'bao'; } else { $current_type = 'photo'; } } } else { switch ($current_type) { case 'bao': foreach ($share_detail['imgs'] as $img) { $current_obj = $img; if ($img['type'] == 'g' && $img['id'] == $id) { break; } } break; case 'photo': foreach ($share_detail['imgs'] as $img) { $current_obj = $img; if ($img['type'] == 'm' && $img['id'] == $id) { break; } } break; } } if (!empty($current_obj['name'])) { $_FANWE['nav_title'] = $current_obj['name'] . ' - ' . lang('common', 'share'); } $current_img_id = FDB::resultFirst("select photo_id from " . FDB::table("share_photo") . " where share_id = " . $share_id); //会员最被喜欢的照片 $best_photo_share = FS('Share')->getBestCollectPhotoShareByUser($share_user['uid']); $current_type = FDB::resultFirst("select type from " . FDB::table("share_photo") . " where share_id = " . $share_id); if ($current_type == 'video') { $current_video = FDB::resultFirst("select video from " . FDB::table("share_photo") . " where share_id = " . $share_id); } //会员喜欢的照片 $user_fav_photo = FS('Share')->getUserFavPhotoShare($share_user['uid']); $is_follow = FS('Share')->getIsCollectByUid($share_id, $_FANWE['uid']); include template('page/note/note_index'); display(); }
public function savePassword() { global $_FANWE; $data = array('oldpassword' => $_FANWE['request']['oldpassword'], 'newpassword' => $_FANWE['request']['newpassword'], 'confirm_password' => $_FANWE['request']['newpasswordagain']); $vservice = FS('Validate'); $validate = array(array('oldpassword', 'required', '请输入现在的密码'), array('newpassword', 'range_length', '请输入正确的新密码', 6, 32), array('confirm_password', 'equal', '确认密码不一致', $data['newpassword'])); if (!$vservice->validation($validate, $data)) { $msg = $vservice->getError(); } else { if (md5($data['oldpassword']) != $_FANWE['user']['password']) { $msg = '原密码不正确'; } else { FDB::update('user', array('password' => md5($data['newpassword'])), 'uid = ' . $_FANWE['uid']); $msg = '修改成功'; fSetCookie('sync_password', ''); $user = array('uid' => $_FANWE['uid'], 'password' => md5($data['newpassword'])); FS('User')->setSession($user); //==================添加同步密码修改 chenfq 2011-10-15================ $user_field = $_FANWE['setting']['integrate_field_id']; $sql = "SELECT {$user_field} FROM " . FDB::table('user') . " WHERE uid = '{$_FANWE['uid']}'"; $integrate_id = intval(FDB::resultFirst($sql)); //echo $integrate_id."<br>"; if ($integrate_id > 0) { FS("Integrate")->editUser($integrate_id, $data['newpassword'], '', ''); //echo FS("Integrate")->getInfo(); } //==================添加同步密码修改 chenfq 2011-10-15================ } } include template('page/settings/settings_password'); display(); }
<?php $share_id = intval($_FANWE['request']['id']); if ($share_id == 0) { exit; } if (!checkAuthority('share', 'edit')) { exit; } $share = FS("Share")->getShareById($share_id); if (empty($share)) { deleteManageLock('share', $share_id); exit; } $manage_lock = checkIsManageLock('share', $share_id); if ($manage_lock === false) { createManageLock('share', $share_id); } else { exit; } $share['share_tags'] = FDB::resultFirst("select group_concat(tag_name SEPARATOR ' ') from " . FDB::table("share_tags") . " where share_id = " . $share['share_id']); $share_category = FDB::fetchAll("select c.cate_id,c.cate_name from " . FDB::table("share_category") . " as sc left join " . FDB::table("goods_category") . " as c on sc.cate_id = c.cate_id where sc.share_id = " . $share['share_id']); $fanwe->cache->loadCache("goods_category"); include template('manage/share/edit'); display();