public function unBind() { global $_FANWE; if ($_FANWE['uid'] > 0) { FDB::delete('user_bind', "uid = " . $_FANWE['uid'] . " AND type = 'sina'"); } fHeader("location: " . FU('settings/bind')); }
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); }
function bindCacheAsk() { $asks = array(); $res = FDB::query("SELECT a.* FROM " . FDB::table('ask') . " as a \r\n\t\t\t\tWHERE status = 1"); while ($data = FDB::fetch($res)) { $data['url'] = FU('ask/forum', array('aid' => $data['aid'])); $asks[$data['aid']] = $data; } FanweService::instance()->cache->saveCache('asks', $asks); }
public function success() { global $_FANWE; $cache_file = getTplCache('page/collection/collection_success', $_FANWE['uid']); if (!@(include $cache_file)) { $go_url = FU('u/index', array("uid" => $_FANWE['uid'])); include template('page/collection/collection_success'); } display($cache_file); }
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 all() { define("ACTION_NAME", "all"); require fimport('function/user'); require fimport("function/share"); if (intval($GLOBALS['fanwe']->var['uid']) == 0) { fHeader("location: " . FU('user/login')); } global $_FANWE; $list_html = getAllList(); include template('page/home'); display(); }
/** * 获取登陆后的转向 */ function getUserRefer() { global $_FANWE; $refer = $_FANWE['request']['refer']; $redir_url = getCookie('redir_url'); if ($redir_url) { $refer = $redir_url; } if (empty($refer)) { $refer = FU('u/index'); } return $refer; }
/** * 获取登陆后的转向 */ function getUserRefer() { global $_FANWE; if (intval($_FANWE['setting']['regresult_to_bind']) == 1) { $refer = FU("settings/bind"); } else { $refer = $_FANWE['request']['refer']; if (empty($refer)) { $refer = FU('u/index'); } } return $refer; }
public function unBind() { global $_FANWE; if ($_FANWE['uid'] > 0) { FDB::delete('user_bind', "uid = " . $_FANWE['uid'] . " AND type = 'taobao'"); $update = array(); $update['buyer_level'] = 0; $update['seller_level'] = 0; $update['is_buyer'] = 0; FDB::update('user', $update, 'uid = ' . $_FANWE['uid']); } $redirect_uri = urlencode($_FANWE['site_url'] . substr(FU('settings/bind'), 1)); $url = "https://oauth.taobao.com/logoff?client_id=" . $this->config['app_key'] . "&redirect_uri=" . $redirect_uri; fHeader("location: " . $url); }
/** * * @param $cids 分类ID数组 * @param $limit */ function getHotTags($cids = array(), $cate_code, $limit) { $hot_tags = array(); $sql = 'SELECT gt.tag_name,gt.tag_code,gt.count,gt.is_hot FROM ' . FDB::table('goods_tags') . ' as gt INNER JOIN ' . FDB::table("goods_category_tags") . ' AS gct ON gct.tag_id = gt.tag_id WHERE gct.cate_id IN (' . implode(',', $cids) . ') ORDER BY gt.count DESC,gt.sort ASC LIMIT 0,' . $limit; $res = FDB::query($sql); while ($data = FDB::fetch($res)) { $data['url'] = FU("book/cate", array('cate' => $cate_code, 'tag' => urlencode($data['tag_name']))); $hot_tags[] = $data; } return $hot_tags; }
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); }
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(); }
function bindCacheShop() { $list = array(); $res = FDB::query("SELECT * FROM " . FDB::table('shop_category') . " \r\n\t\tORDER BY sort ASC,id ASC"); while ($data = FDB::fetch($res)) { $data['url'] = FU('shop/index', array('cid' => $data['id'])); $list['all'][$data['id']] = $data; } $list['root'] = array(); foreach ($list['all'] as $cate) { if ($cate['parent_id'] > 0) { $list['all'][$cate['parent_id']]['childs'][] = $cate['id']; } else { $list['root'][] = $cate['id']; } } FanweService::instance()->cache->saveCache('shops', $list); }
function bindCacheAlbum() { $list = array(); $res = FDB::query("SELECT * FROM " . FDB::table('album_category') . " WHERE status = 1 ORDER BY sort ASC,id ASC"); while ($data = FDB::fetch($res)) { $data['url'] = FU('album/category', array('id' => $data['id'])); $list['category'][$data['id']] = $data; } $res = FDB::query("SELECT name,val FROM " . FDB::table('sys_conf') . " WHERE group_id = 8"); while ($data = FDB::fetch($res)) { if ($data['name'] == 'ALBUM_DEFAULT_TAGS') { $data['val'] = unserialize($data['val']); } $data['name'] = strtolower($data['name']); $list['setting'][$data['name']] = $data['val']; } FanweService::instance()->cache->saveCache('albums', $list); }
function bindCacheForum() { $list = array(); $res = FDB::query("SELECT * FROM " . FDB::table('forum') . " AS f \r\n\t\t LEFT JOIN " . FDB::table('forum_fields') . " AS ff USING(fid) \r\n\t\t WHERE f.status = 1 ORDER BY f.sort ASC"); while ($data = FDB::fetch($res)) { $data['url'] = FU('club/forum', array('fid' => $data['fid'])); $list['all'][$data['fid']] = $data; } $list['root'] = array(); foreach ($list['all'] as $cate) { if ($cate['parent_id'] > 0) { $list['all'][$cate['parent_id']]['childs'][] = $cate['fid']; } else { $list['root'][] = $cate['fid']; } } FanweService::instance()->cache->saveCache('forums', $list); }
public function loginHandler($user) { global $_FANWE; $bind_user = $this->getUserByTypeKeyId($this->type, $user['id']); if ($bind_user) { if ($bind_user['status'] == 0) { showError('登陆失败', '该帐户已被管理员锁定', FU('index')); } $_FANWE['uid'] = $bind_user['uid']; $this->updateBindInfo($user); FS('User')->setSession($bind_user, 1209600); } else { $data = array(); $data['type'] = $this->type; $data['user'] = $user; $this->jumpUserBindReg($data, $user['name']); } }
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 loginHandler($parameters, $session) { global $_FANWE; $user = $this->getUserInfo($parameters['visitor_nick'], $session); $bind_user = $this->getUserByTypeKeyId($this->type, $user['user_id']); if ($bind_user) { if ($bind_user['status'] == 0) { showError('登陆失败', '该帐户已被管理员锁定', FU('index')); } $_FANWE['uid'] = $bind_user['uid']; $this->bindUser($user, $parameters, $session); FS('User')->setSession($bind_user, 1209600); } else { $data = array(); $data['type'] = $this->type; $data['user_email'] = $user['email']; $data['user'] = $user; $data['parameters'] = $parameters; $data['session'] = $session; $this->jumpUserBindReg($data, $parameters['visitor_nick']); } }
/** * 热门有图活动主题 * @return array */ public function getHotImgEvent($num) { global $_FANWE; $list = array(); $sql = 'SELECT e.id,e.title,e.uid,e.thread_count,e.create_time,e.last_share,e.last_time,e.share_id, s.content,s.cache_data FROM ' . FDB::table('event') . ' AS e INNER JOIN ' . FDB::table('share') . ' AS s ON s.share_id = e.share_id AND s.share_data IN (\'goods\',\'photo\',\'goods_photo\') WHERE e.is_event = 1 ORDER BY e.is_hot DESC,e.thread_count DESC LIMIT 0,' . $num; $res = FDB::query($sql); while ($data = FDB::fetch($res)) { $data['cache_data'] = fStripslashes(unserialize($data['cache_data'])); $data['time'] = getBeforeTimelag($data['create_time']); $data['last_time'] = getBeforeTimelag($data['last_time']); $data['url'] = FU('event/detail', array('id' => $data['id'])); FS('Share')->shareImageFormat($data); unset($data['cache_data']); $list[$data['share_id']] = $data; } return $list; }
public function index() { global $_FANWE; if ($_FANWE['uid'] == 0) { fHeader("location: " . FU('user/login', array('refer' => FU('invite/index')))); } FanweService::instance()->cache->loadCache('medals'); $medal_list = array(); foreach ($_FANWE['cache']['medals']['referrals'] as $id) { $medal = $_FANWE['cache']['medals']['all'][$id]; $medal_list[] = $medal; } $invite_title = $_FANWE['setting']['site_title']; $invite_content = lang('invite', 'invite_content'); $invite_content = sprintf($invite_content, $_FANWE['setting']['site_name']); $invite_url = $_FANWE['site_url'] . '?invite=' . $_FANWE['uid']; $invite_types = array('kaixin', 'renren', 'sina', 'tqq', 'douban', 'qzone', 'baidu'); $invite_pic = $_FANWE['site_url'] . $_FANWE['setting']['site_logo']; $sns_links = getSnsLink($invite_types, $invite_title, $invite_url, $invite_content, $invite_pic); include template('page/invite/invite_index'); display(); }
public function save() { global $_FANWE; if ($_FANWE['uid'] == 0) { exit; } include_once fimport('class/image'); $image = new Image(); if (intval($_FANWE['setting']['max_upload']) > 0) { $image->max_size = intval($_FANWE['setting']['max_upload']); } $daren = array(); $daren['uid'] = $_FANWE['uid']; $daren['reason'] = $_FANWE['request']['reason']; $daren['status'] = 0; $daren['create_time'] = TIME_UTC; //个人街拍照 $img = $_FILES['img']; if (!empty($img)) { $image->init($img, 'daren'); if ($image->save()) { $daren['img'] = $image->file['target']; } } $index_img = $_FILES['index_img']; if (!empty($index_img)) { $image->init($index_img, 'daren'); if ($image->save()) { $daren['index_img'] = $image->file['target']; } } $id = FDB::insert('user_daren', $daren, true, false, true); if ($id > 0) { showSuccess('提交申请成功', '你的达人申请已经成功提交,我们会尽快处理你的达人申请!', FU('daren/index')); } else { showError('提交申请失败', '你的达人申请提交失败,请重新提交达人申请', -1); } }
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 delete() { if (intval($GLOBALS['fanwe']->var['uid']) == 0) { fHeader("location: " . FU('user/login')); } $id = $_REQUEST['id']; FDB::query("delete from " . FDB::table("user_msg_rel") . " where mid in (" . $id . ")"); FDB::query("delete from " . FDB::table("user_msg") . " where mid in (" . $id . ") and author_id > 0"); }
public function save() { global $_FANWE; if ($_FANWE['uid'] == 0) { fHeader("location: " . FU('user/login')); } $id = (int) $_FANWE['request']['id']; if ($id > 0) { $album = FS("Album")->getAlbumById($id); if (empty($album) || $album['uid'] != $_FANWE['uid']) { fHeader("location: " . FU('album')); } } $data = array('title' => trim($_FANWE['request']['title']), 'content' => trim($_FANWE['request']['content']), 'cid' => (int) $_FANWE['request']['cid'], 'show_type' => (int) $_FANWE['request']['show_type'], 'tags' => trim($_FANWE['request']['tags'])); $vservice = FS('Validate'); $validate = array(array('title', 'required', lang('album', 'name_require')), array('title', 'max_length', lang('album', 'name_max'), 60), array('content', 'max_length', lang('album', 'content_max'), 1000), array('cid', 'min', lang('album', 'cid_min'), 1), array('show_type', 'min', lang('album', 'show_type_min'), 1)); if (!$vservice->validation($validate, $data)) { exit($vservice->getError()); } if (!isset($_FANWE['cache']['albums']['category'][$data['cid']])) { exit; } if (!checkIpOperation("add_share", SHARE_INTERVAL_TIME)) { showError('提交失败', lang('share', 'interval_tips'), -1); } $check_result = FS('Share')->checkWord($_FANWE['request']['title'], 'title'); if ($check_result['error_code'] == 1) { showError('提交失败', $check_result['error_msg'], -1); } $check_result = FS('Share')->checkWord($_FANWE['request']['content'], 'content'); if ($check_result['error_code'] == 1) { showError('提交失败', $check_result['error_msg'], -1); } $check_result = FS('Share')->checkWord($_FANWE['request']['tags'], 'tag'); if ($check_result['error_code'] == 1) { showError('提交失败', $check_result['error_msg'], -1); } $tags = str_replace('***', '', $_FANWE['request']['tags']); $tags = str_replace(' ', ' ', $tags); $tags = explode(' ', $tags); $tags = array_unique($tags); if (count($tags) > $_FANWE['cache']['albums']['setting']['album_tag_count']) { exit; } if ($id > 0) { $data['title'] = htmlspecialchars($_FANWE['request']['title']); $data['content'] = htmlspecialchars($_FANWE['request']['content']); $data['tags'] = implode(' ', $tags); FDB::update('album', $data, 'id = ' . $id); FS('Share')->updateShare($album['share_id'], $data['title'], $data['content']); FS("Album")->saveTags($id, $tags); if ($data['cid'] != $album['cid']) { FDB::query('UPDATE ' . FDB::table("album_share") . ' SET cid = ' . $data['cid'] . ' WHERE album_id = ' . $id); } $url = FU('album/show', array('id' => $id)); fHeader('location: ' . $url); exit; } $_FANWE['request']['uid'] = $_FANWE['uid']; $_FANWE['request']['type'] = 'album'; $share = FS('Share')->submit($_FANWE['request']); if ($share['status']) { $data['title'] = htmlspecialchars($_FANWE['request']['title']); $data['content'] = htmlspecialchars($_FANWE['request']['content']); $data['tags'] = implode(' ', $tags); $data['uid'] = $_FANWE['uid']; $data['share_id'] = $share['share_id']; $data['create_day'] = getTodayTime(); $data['create_time'] = TIME_UTC; $aid = FDB::insert('album', $data, true); FS("Album")->saveTags($aid, $tags); FDB::query('UPDATE ' . FDB::table('share') . ' SET rec_id = ' . $aid . ' WHERE share_id = ' . $share['share_id']); FDB::query("update " . FDB::table("user_count") . " set albums = albums + 1 where uid = " . $_FANWE['uid']); FS('Medal')->runAuto($_FANWE['uid'], 'albums'); $url = FU('album/show', array('id' => $aid)); fHeader('location: ' . $url); } else { showError('提交失败', '添加数据失败', -1); } }
?> ">帮助</a> </li> <li> <a href="<?php echo FU('about/etiquette', array()); ?> "><?php echo $_FANWE['setting']['site_name']; ?> 礼仪</a> </li> </ul> </li> <li><a href="<?php echo FU('user/login', array()); ?> " class="regmenu no-icon">登陆</a></li> </ul> <?php } ?> <script> jQuery(function($){ $("#about").hover(function(){ $(this).children("ul").show(); },function(){ $(this).children("ul").hide(); }); $("#user_nav").hover(function(){ $(this).children("ul").show();
</div> <div class="mb25 medals"> <h3 class="mb10">时尚勋章</h3> <a class="pi_setting" href="<?php echo FU('medal/u', array("uid" => $home_uid)); ?> " target="_blank">更多</a> <?php $medals = FS('User')->getUserMedal($home_uid); ?> <ul class="ml5"><?php if (is_array($medals)) { foreach ($medals as $medal) { ?> <li class="medal_f"><a href="<?php echo FU('medal/u', array("uid" => $home_uid)); ?> " target="_blank"><img src="<?php echo $medal['small_img']; ?> " height="25" alt="<?php echo $medal['name']; ?> " title="<?php echo $medal['name']; ?> "></a></li> <?php } } ?>
/** * 获取分类下热门主题 */ public function getHotTopicList($tid, $fid, $num) { global $_FANWE; $where = ''; if ($fid > 0) { $fids = TopicService::getForumIDs($fid); if (count($fids) == 1) { $where .= ' AND fid = ' . $fid; } else { $where .= ' AND fid IN (' . implode(',', $fids) . ')'; } } if ($tid > 0) { $where .= ' AND tid <> ' . $tid; } if (!empty($where)) { $where = 'WHERE' . $where; $where = str_replace('WHERE AND', 'WHERE', $where); } $list = array(); $sql = 'SELECT fid,tid,title,create_time,lastpost,lastposter, uid,post_count,share_id FROM ' . FDB::table('forum_thread') . ' ' . $where . ' ORDER BY post_count DESC,tid DESC LIMIT 0,' . $num; $res = FDB::query($sql); while ($data = FDB::fetch($res)) { $data['time'] = getBeforeTimelag($data['create_time']); $data['last_time'] = getBeforeTimelag($data['lastpost']); $data['url'] = FU('club/detail', array('tid' => $data['tid'])); $list[$data['share_id']] = $data; } return $list; }
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(); } }
<?php global $_FANWE; $result = array(); if ($_FANWE['uid'] == 0) { $result['status'] = 0; $result['message'] = "未登录"; } $result['status'] = 1; $pageUrl = $_FANWE['request']['pageUrl']; $aid = $_FANWE['request']['aidArray']; $content = $_FANWE['request']['contentArray']; $imgs = $_FANWE['request']['imgArray']; $title = $_FANWE['request']['titleArray']; $pub_out_check = $_FANWE['request']['pub_out_check']; $videos = $_FANWE['request']['videoArray']; $data = array(); $data['album_id'] = $aid; $data['content'] = $content; $data['imgs'] = $imgs; $data['videos'] = $videos; $data['title'] = $title; $data['pageUrl'] = $pageUrl; $data['pub_out_check'] = $pub_out_check; $share_submit = FS("Collect")->submitList($data); $success_url = FU("collection/success"); $result['success_url'] = $success_url; outputJson($result);
/** * 根据编号数组获取会员信息 * @return array */ public function usersFormat(&$uid_list) { static $users = array(); $uids = array_keys($uid_list); if (count($uids) > 0) { $static_ids = array_keys($users); $intersects = array_intersect($static_ids, $uids); $temp_ids = array(); foreach ($intersects as $uid) { $temp_ids[] = $uid; $uid_list[$uid] = $users[$uid]; } $diffs = array_diff($uids, $temp_ids); unset($temp_ids); if (count($diffs) > 0) { $diffs[] = 0; $diffs = implode(',', $diffs); $diffs = str_replace(',,', ',', $diffs); if (!empty($diffs)) { $res = FDB::query("SELECT uid,user_name,server_code,reg_time,uc.* FROM " . FDB::table('user') . ' INNER JOIN ' . FDB::table('user_count') . ' uc USING(uid) WHERE uid IN (' . $diffs . ')'); while ($item = FDB::fetch($res)) { $item['url'] = FU('u/index', array('uid' => $item['uid'])); $users[$item['uid']] = $item; $uid_list[$item['uid']] = $item; } } } } return $uid_list; }