public function __construct($url)
 {
     global $_FANWE;
     FanweService::instance()->cache->loadCache('business');
     $rs = preg_match("/^(http:\\/\\/|https:\\/\\/)/", $url, $match);
     if (intval($rs) == 0) {
         $url = "http://" . $url;
     }
     $rs = parse_url($url);
     $scheme = isset($rs['scheme']) ? $rs['scheme'] . "://" : "http://";
     $host = isset($rs['host']) ? $rs['host'] : "none";
     $host = explode('.', $host);
     $host = array_slice($host, -2, 2);
     $domain = implode('.', $host);
     $class = FDB::fetchFirst("select `class` from " . FDB::table('sharegoods_module') . " where domain like '%" . $domain . "%' and status = 1  limit 1");
     $class = $class['class'];
     $file = FANWE_ROOT . "core/class/sharegoods/" . $class . "_sharegoods.class.php";
     require_once FANWE_ROOT . "core/class/sharegoods/sharegoods.php";
     require_once FANWE_ROOT . "core/class/string.class.php";
     if (file_exists($file) && isset($_FANWE['cache']['business'][$class])) {
         require_once $file;
         $class_name = $class . "_sharegoods";
         if (class_exists($class_name)) {
             $this->share_module = new $class_name();
         }
     }
     $this->url = $url;
 }
    public function run()
    {
        global $_FANWE;
        $root = array();
        $root['return'] = 1;
        $root['act'] = 'delcomment';
        if ($_FANWE['uid'] == 0) {
            exit;
        }
        $comment_id = intval($_FANWE['requestData']['id']);
        if ($comment_id == 0) {
            exit;
        }
        $share = FDB::fetchFirst('SELECT s.uid,s.share_id  
			FROM ' . FDB::table('share_comment') . ' AS sc 
			INNER JOIN ' . FDB::table('share') . ' AS s ON s.share_id = sc.share_id 
			WHERE sc.comment_id = ' . $comment_id);
        if (empty($share)) {
            exit;
        }
        $uid = intval($share['uid']);
        if ($uid != $_FANWE['uid']) {
            exit;
        }
        FS('Share')->deleteShareComment($comment_id);
        $root['return'] = 1;
        m_display($root);
    }
Esempio n. 3
0
    public function getUserByTypeKeyId($type, $key_id)
    {
        $sql = 'SELECT u.uid,u.password,u.status FROM ' . FDB::table('user_bind') . ' as ub 
			INNER JOIN ' . FDB::table('user') . ' as u ON u.uid = ub.uid 
			WHERE ub.type = \'' . $type . '\' AND ub.keyid = \'' . $key_id . '\'';
        return FDB::fetchFirst($sql);
    }
Esempio n. 4
0
 /**
  * 读取Session
  * @access public
  * @param string $session_id
  * @return string
  */
 public function read($session_id)
 {
     $sql = "SELECT session_data AS data FROM " . $this->sessionTable . " WHERE session_id = '{$session_id}'   AND session_expire >" . time();
     $res = FDB::fetchFirst($sql);
     if ($res) {
         return $res['data'];
     }
     return "";
 }
 /**
  * 获取统计信息
  * @param int $uid 会员编号
  * @param string $type 类型
  * @return
  */
 public function get($uid, $type)
 {
     $uid = (int) $uid;
     $type = StatisticsService::getTypeByKey($type);
     if (!$type || !$uid) {
         return array();
     }
     return FDB::fetchFirst('SELECT * FROM ' . FDB::table('user_statistics') . ' WHERE uid = ' . $uid . ' AND type = ' . $type);
 }
Esempio n. 6
0
    public function detail()
    {
        global $_FANWE;
        $id = intval($_FANWE['request']['id']);
        if ($id == 0) {
            fHeader("location: " . FU('index/index'));
        }
        include fimport('dynamic/u');
        //获取相关的分享ID
        $eventinfo = FDB::fetchFirst("select * from " . FDB::table("event") . " where id=" . $id);
        if (intval($eventinfo['share_id']) == 0) {
            fHeader("location: " . FU('index/index'));
        }
        $eventinfo['share'] = FS('Share')->getShareDetail($eventinfo['share_id']);
        if ($share_detail === false) {
            fHeader("location: " . FU('index'));
        }
        $user_share_collect = FS('Share')->getShareCollectUser($eventinfo['share_id']);
        $page_title = preg_replace("/\\[[^\\]]+\\]/i", "", $eventinfo['title']);
        $_FANWE['nav_title'] = $page_title . ' - ' . lang('common', 'event');
        $_FANWE['seo_description'] = $page_title;
        $_FANWE['setting']['site_description'] = '';
        //分享评论
        $page_args = array('id' => $id);
        $count = $eventinfo['thread_count'];
        $post_list = array();
        if ($count > 0) {
            $pager = buildPage('event/' . ACTION_NAME, $page_args, $count, $_FANWE['page'], 10);
            $sql = 'SELECT share_id FROM ' . FDB::table('event_share') . ' 
				WHERE event_id = ' . $id . ' ORDER BY share_id DESC LIMIT ' . $pager['limit'];
            $ids = array();
            $res = FDB::query($sql);
            while ($data = FDB::fetch($res)) {
                $ids[] = $data['share_id'];
            }
            $ids = implode(',', $ids);
            $sql = 'SELECT * from ' . FDB::table('share') . ' where share_id IN (' . $ids . ') ORDER BY share_id';
            $list = FDB::fetchAll($sql);
            $post_list = FS('Share')->getShareDetailList($list, true, true, true);
        }
        $args = array('share_list' => &$post_list, 'pager' => &$pager, 'current_share_id' => $eventinfo['share_id']);
        $post_html = tplFetch("inc/share/post_share_list", $args);
        //热门话题
        $hot_event_list = FS("event")->getHotEvent(10);
        if (intval($_FANWE['uid']) > 0) {
            //我发布的
            $me_event_list = FS("event")->getUserEvent($_FANWE['uid'], 5);
            //我参与的
            $me_join_event_list = FS("event")->getUserJoinevent($_FANWE['uid'], 5);
        }
        if (intval($_FANWE['page']) == 1) {
            FDB::query('UPDATE ' . FDB::table('share') . ' SET click_count = click_count + 1 WHERE share_id = ' . $eventinfo['share_id']);
        }
        include template('page/event/event_detail');
        display();
    }
 public function edit()
 {
     vendor("common");
     $name = $this->getActionName();
     $vo = M($name)->getByGoodsId($_REQUEST['goods_id']);
     $this->assign('vo', $vo);
     //$category = FDB::fetchAll("select cate_id,cate_name from ".FDB::table("goods_category")." where parent_id = 0");
     //$this->assign ( 'category', $category );
     $shop = FDB::fetchFirst("select shop_name,shop_id from " . FDB::table("shop") . " where shop_id = " . $vo['shop_id']);
     $this->assign('shop', $shop);
     $this->display();
 }
 public function ajaxLogin()
 {
     global $_FANWE;
     $user_name_or_email = addslashes($_FANWE['request']['email_name']);
     $password = md5(trim($_FANWE['request']['pass']));
     $life = isset($_FANWE['request']['remember']) ? intval($_FANWE['request']['remember']) : 0;
     $rhash = $_FANWE['request']['rhash'];
     if (empty($rhash) || $rhash != FORM_HASH) {
         exit('Access Denied');
     }
     $return = array();
     $user_field = $_FANWE['setting']['integrate_field_id'];
     $sql = "SELECT uid,status,{$user_field} FROM " . FDB::table('user') . " WHERE (email = '{$user_name_or_email}' OR user_name = '{$user_name_or_email}') AND password = '******'";
     $user_info = FDB::fetchFirst($sql);
     $uid = intval($user_info['uid']);
     $integrate_id = intval($user_info[$user_field]);
     //===========add by chenfq 2011-10-14==========================
     if ($uid <= 0) {
         $uid = FS("Integrate")->addUserToLoacl($user_name_or_email, $password, 1);
         //重新取一下当前数据库的用户数据
         $sql = "SELECT uid,{$user_field} FROM " . FDB::table('user') . " WHERE uid = '{$uid}'";
         $user_info = FDB::fetchFirst($sql);
         $uid = intval($user_info['uid']);
         $integrate_id = intval($user_info[$user_field]);
     }
     //===========add by chenfq 2011-10-14==========================
     if ($uid > 0) {
         if ($user_info['status'] == 0) {
             $return['status'] = 2;
             outputJson($return);
             exit;
         }
         $user = array('uid' => $uid, 'password' => $password);
         fSetCookie('last_request', authcode(TIME_UTC - 10, 'ENCODE'), TIME_UTC + 816400, 1, true);
         FS('User')->setSession($user, $life);
         $syslogin_js = FS("Integrate")->synLogin($integrate_id);
         //js 需要在前台执行 add by chenfq 2011-10-15
         //$return['syslogin_js'] = $syslogin_js;
         if (!empty($syslogin_js)) {
             fSetCookie("dynamic_script", $syslogin_js);
         }
         $return['status'] = 1;
         $return['uid'] = $uid;
         if (getCookie('redir_url')) {
             //判断采集图片回调地址,cookie中保持的地址,只使用一次
             unset($_FANWE['cookie']['redir_url']);
         }
     } else {
         $return['status'] = 0;
     }
     outputJson($return);
 }
Esempio n. 9
0
 public function collectCates()
 {
     setTimeLimit(3600);
     $ccate = FDB::fetchFirst('SELECT * FROM ' . FDB::table('goods_cate_collect') . ' LIMIT 0,1');
     if (!$ccate) {
         return false;
     }
     FDB::query('DELETE FROM ' . FDB::table('goods_cate_collect') . " WHERE id = '{$ccate['id']}'");
     global $_FANWE;
     Cache::getInstance()->loadCache('business');
     //QQ号
     define('PAIPAI_API_UIN', trim($_FANWE['cache']['business']['paipai']['uin']));
     //令牌
     define('PAIPAI_API_APPOAUTHID', trim($_FANWE['cache']['business']['paipai']['appoauthid']));
     //APP_KEY
     define('PAIPAI_API_APPOAUTHKEY', trim($_FANWE['cache']['business']['paipai']['appoauthkey']));
     define('PAIPAI_API_ACCESSTOKEN', trim($_FANWE['cache']['business']['paipai']['accesstoken']));
     define('PAIPAI_API_USERID', trim($_FANWE['cache']['business']['paipai']['userid']));
     $sdk = new PaiPaiOpenApiOauth(PAIPAI_API_APPOAUTHID, PAIPAI_API_APPOAUTHKEY, PAIPAI_API_ACCESSTOKEN, PAIPAI_API_UIN);
     $sdk->setApiPath("/attr/getNavigationChildList.xhtml");
     $sdk->setMethod("get");
     $sdk->setCharset("utf-8");
     $sdk->setFormat("json");
     $params =& $sdk->getParams();
     $params["navigationId"] = $ccate['cid'];
     //请求数据
     $json = $sdk->invoke();
     $json = preg_replace("/[\r\n]/", '', $json);
     preg_match("/getNavigationChildListSuccess\\((.+?)\\);\\}catch\\(/", $json, $list);
     $list = json_decode($list[1], true);
     $sort_file = FANWE_ROOT . '/public/records/cate.sort.php';
     $sort = (int) @file_get_contents($sort_file);
     if (isset($list['childList'])) {
         foreach ($list['childList'] as $item) {
             $cate = array();
             $cate['type'] = 'paipai';
             $cate['id'] = (int) $item['navigationId'];
             if ($cate['id'] > 0) {
                 $cate['pid'] = $ccate['cid'] == 0 ? '' : $ccate['cid'];
                 $cate['name'] = (string) $item['navigationName'];
                 $cate['pids'] = empty($ccate['pids']) ? $cate['pid'] : $ccate['pids'] . ',' . $cate['pid'];
                 $cate['sort'] = ++$sort;
                 FDB::insert('goods_cates', $cate, false, true);
                 if ((int) $item['isClass'] == 0) {
                     FDB::insert('goods_cate_collect', array('id' => 'NULL', 'cid' => $cate['id'], 'pids' => $cate['pids']));
                 }
             }
         }
         @file_put_contents($sort_file, $sort);
     }
     return true;
 }
Esempio n. 10
0
 function init($sid, $ip, $uid)
 {
     $this->old = array('sid' => $sid, 'ip' => $ip, 'uid' => $uid);
     $session = array();
     if ($sid) {
         $session = FDB::fetchFirst("SELECT * FROM " . FDB::table('sessions') . " WHERE sid='{$sid}' AND CONCAT_WS('.', ip1,ip2,ip3,ip4)='{$ip}'");
     }
     if (empty($session) || $session['uid'] != $uid) {
         $session = $this->create($ip, $uid);
     }
     $this->var = $session;
     $this->sid = $session['sid'];
 }
Esempio n. 11
0
 function removeEvent($id)
 {
     $id = (int) $id;
     $event = FDB::fetchFirst("select id from " . FDB::table("event") . " where id = {$id}");
     if ($event) {
         $res = FDB::query("select share_id from " . FDB::table("event_share") . " where event_id = {$id}");
         while ($data = FDB::fetch($res)) {
             FS('Share')->deleteShare($data['share_id']);
         }
         FDB::delete("event_share", "event_id = {$id}");
         FS('Share')->deleteShare($event['share_id']);
         FDB::delete("event", "id = {$id}");
     }
 }
    public function deleteGoods($gid)
    {
        global $_FANWE;
        $gid = (int) $gid;
        $goods = FDB::fetchFirst('SELECT *
			FROM ' . FDB::table('second_goods') . ' WHERE gid = ' . $gid);
        if (empty($goods)) {
            return;
        }
        $share_id = $goods['share_id'];
        $share = FS('Share')->getShareById($share_id);
        FS('Share')->deleteShare($share_id);
        FDB::query('UPDATE ' . FDB::table('user') . ' SET seconds = seconds - 1 WHERE uid = ' . $share['uid']);
        FS('Medal')->runAuto($share['uid'], 'seconds');
    }
Esempio n. 13
0
 public function show()
 {
     global $_FANWE;
     $adv_id = intval($_FANWE['request']['id']);
     $adv = FDB::fetchFirst('SELECT url FROM ' . FDB::table('adv') . ' WHERE id = ' . $adv_id . ' AND status = 1');
     if ($adv) {
         if (!empty($adv['url'])) {
             fHeader('Location:' . $adv['url']);
         } else {
             fHeader('Location:./');
         }
     } else {
         fHeader('Location:./');
     }
 }
 public function run()
 {
     global $_FANWE;
     $root = array();
     $root['return'] = 0;
     //print_r($_FANWE['requestData']);
     $user_name_or_email = addslashes($_FANWE['requestData']['email']);
     $password = md5(trim($_FANWE['requestData']['pwd']));
     if ($user_name_or_email == '') {
         $root['info'] = '登陆帐户不能为空';
         m_display($root);
     }
     $user_field = $_FANWE['setting']['integrate_field_id'];
     $sql = "SELECT uid,status,{$user_field},server_code FROM " . FDB::table('user') . " WHERE (email = '{$user_name_or_email}' OR user_name = '{$user_name_or_email}') AND password = '******'";
     //echo $sql;
     $user_info = FDB::fetchFirst($sql);
     //print_r($user_info);exit;
     $uid = intval($user_info['uid']);
     $integrate_id = intval($user_info[$user_field]);
     //===========add by chenfq 2011-10-14==========================
     if ($uid <= 0) {
         $uid = FS("Integrate")->addUserToLoacl($user_name_or_email, $password, 1);
         //重新取一下当前数据库的用户数据
         $sql = "SELECT uid,{$user_field},status,server_code FROM " . FDB::table('user') . " WHERE uid = '{$uid}'";
         $user_info = FDB::fetchFirst($sql);
         $uid = intval($user_info['uid']);
         $integrate_id = intval($user_info[$user_field]);
     }
     //===========add by chenfq 2011-10-14==========================
     //echo $uid; exit;
     if ($uid > 0) {
         if ($user_info['status'] == 0) {
             m_display($root);
         }
         $root['uid'] = $uid;
         $root['user_avatar'] = avatar($uid, 'b', $user_info['server_code'], 1, true);
         $root['home_user'] = FS("User")->getUserById($uid);
         $root['return'] = 1;
         $deviceuid = addslashes(trim($_FANWE['requestData']['deviceuid']));
         $sql = "update " . FDB::table('apns_devices') . " set clientid = " . $uid . " where clientid = 0 and deviceuid = '" . $deviceuid . "'";
         FDB::query($sql);
     } else {
         $root['info'] = '帐户不存在或密码错误';
     }
     m_display($root);
 }
Esempio n. 15
0
    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 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}");
     }
 }
Esempio n. 17
0
 public function collectCates()
 {
     setTimeLimit(3600);
     $ccate = FDB::fetchFirst('SELECT * FROM ' . FDB::table('goods_cate_collect') . ' LIMIT 0,1');
     if (!$ccate) {
         return false;
     }
     FDB::query('DELETE FROM ' . FDB::table('goods_cate_collect') . " WHERE id = '{$ccate['id']}'");
     global $_FANWE;
     Cache::getInstance()->loadCache('business');
     $yiqifa = new YiqifaOpen(trim($_FANWE['cache']['business']['yiqifa']['app_key']), trim($_FANWE['cache']['business']['yiqifa']['app_secret']));
     if ($ccate['cid'] == '0') {
         $list = $yiqifa->getCategoryList();
     } else {
         $list = $yiqifa->getSubCategory($ccate['cid'], 1, 10000);
     }
     $sort_file = FANWE_ROOT . '/public/records/cate.sort.php';
     $sort = (int) @file_get_contents($sort_file);
     if (isset($list['categorys'])) {
         foreach ($list['categorys'] as $item) {
             $cate = array();
             $cate['type'] = 'yiqifa';
             if ($ccate['cid'] == '0') {
                 $cate['id'] = $item['catName'];
                 $cate['name'] = $item['catName'];
             } else {
                 $cate['id'] = $item['subCatName'];
                 $cate['name'] = $item['subCatName'];
             }
             $cate['pid'] = $ccate['cid'] == '0' ? '' : $ccate['cid'];
             $cate['pids'] = empty($ccate['pids']) ? $cate['pid'] : $ccate['pids'] . ',' . $cate['pid'];
             $cate['sort'] = ++$sort;
             FDB::insert('goods_cates', $cate, false, true);
             if ($ccate['cid'] == '0') {
                 FDB::insert('goods_cate_collect', array('id' => 'NULL', 'cid' => $item['catName'], 'pids' => $cate['pids']));
             }
         }
         @file_put_contents($sort_file, $sort);
     }
     return true;
 }
Esempio n. 18
0
 public function collectCates()
 {
     setTimeLimit(3600);
     $ccate = FDB::fetchFirst('SELECT * FROM ' . FDB::table('goods_cate_collect') . ' LIMIT 0,1');
     if (!$ccate) {
         return false;
     }
     FDB::query('DELETE FROM ' . FDB::table('goods_cate_collect') . " WHERE id = '{$ccate['id']}'");
     global $_FANWE;
     include_once FANWE_ROOT . 'sdks/taobao/TopClient.php';
     include_once FANWE_ROOT . 'sdks/taobao/request/ItemcatsGetRequest.php';
     Cache::getInstance()->loadCache('business');
     $sort_file = FANWE_ROOT . '/public/records/cate.sort.php';
     $sort = (int) @file_get_contents($sort_file);
     $client = new TopClient();
     $client->appkey = trim($_FANWE['cache']['business']['taobao']['app_key']);
     $client->secretKey = trim($_FANWE['cache']['business']['taobao']['app_secret']);
     $req = new ItemcatsGetRequest();
     $req->setFields("cid,parent_cid,name,is_parent");
     $req->setParentCid($ccate['cid']);
     $resp = $client->execute($req);
     if (isset($resp->item_cats) && isset($resp->item_cats->item_cat)) {
         foreach ($resp->item_cats->item_cat as $item) {
             $item = (array) $item;
             $cate = array();
             $cate['type'] = 'taobao';
             $cate['id'] = $item['cid'];
             $cate['pid'] = $item['parent_cid'] == 0 ? '' : $item['parent_cid'];
             $cate['name'] = $item['name'];
             $cate['pids'] = empty($ccate['pids']) ? $cate['pid'] : $ccate['pids'] . ',' . $cate['pid'];
             $cate['sort'] = ++$sort;
             FDB::insert('goods_cates', $cate, false, true);
             if ($item['is_parent'] == 'true') {
                 FDB::insert('goods_cate_collect', array('id' => 'NULL', 'cid' => $item['cid'], 'pids' => $cate['pids']));
             }
         }
         @file_put_contents($sort_file, $sort);
     }
     return true;
 }
Esempio n. 19
0
 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 reply()
 {
     define("ACTION_NAME", "reply");
     if (intval($GLOBALS['fanwe']->var['uid']) == 0) {
         fHeader("location: " . FU('user/login'));
     }
     global $_FANWE;
     $mid = intval($_REQUEST['mid']);
     $sql = "select m.mid,m.title,m.content,m.create_time,au.uid as auid,au.user_name as auser_name,u.uid,u.user_name from " . FDB::table("user_msg") . " as m left join " . FDB::table("user_msg_rel") . " as ml on ml.mid = m.mid left join " . FDB::table("user") . " as u on u.uid = ml.uid left join " . FDB::table("user") . " as au on au.uid = m.author_id " . " where m.mid = " . $mid . " and m.status = 1 and ml.uid = " . intval($GLOBALS['fanwe']->var['uid']);
     $msg = FDB::fetchFirst($sql);
     if ($msg) {
         include template('page/message_reply');
         display();
     } else {
         showError("非法的私信", "非法的私信");
     }
 }
Esempio n. 21
0
<?php

$comment_id = intval($_FANWE['request']['comment_id']);
if ($comment_id == 0) {
    exit;
}
$share = FDB::fetchFirst('SELECT s.uid,s.share_id  
	FROM ' . FDB::table('share_comment') . ' AS sc 
	INNER JOIN ' . FDB::table('share') . ' AS s ON s.share_id = sc.share_id 
	WHERE sc.comment_id = ' . $comment_id);
if (empty($share)) {
    exit;
}
$uid = intval($share['uid']);
if ($uid != $_FANWE['uid']) {
    exit;
}
FS('Share')->deleteShareComment($comment_id);
$result = array();
$result['status'] = 1;
outputJson($result);
    public function show()
    {
        global $_FANWE;
        $id = (int) $_FANWE['request']['id'];
        if (!$id) {
            exit;
        }
        $album_url = FU('album/show', array('id' => $id));
        $album = FS("Album")->getAlbumById($id);
        $is_follow_album = FS('album')->getIsFollow($id, $_FANWE['uid']);
        if (empty($album)) {
            fHeader("location: " . FU('album'));
        }
        $home_uid = $album['uid'];
        $home_user = FS("User")->getUserById($home_uid);
        $is_show_follow = false;
        if ($home_uid != $_FANWE['uid']) {
            if (!FS('User')->getIsFollowUId($home_uid)) {
                $is_show_follow = true;
            }
        }
        $is_manage_album = false;
        if ($_FANWE['uid'] == $album['uid']) {
            $is_manage_album = true;
        }
        $sql = 'SELECT * FROM ' . FDB::table('album') . ' 
						WHERE uid = ' . $home_uid . ' and id <> ' . $id . ' ORDER BY id DESC ';
        $res = FDB::query($sql);
        while ($data = FDB::fetch($res)) {
            $data['imgs'] = array();
            if (!empty($data['cache_data'])) {
                $cache_data = unserialize($data['cache_data']);
                $data['imgs'] = $cache_data['imgs'];
                unset($data['cache_data']);
            }
            $data['img_count'] = count($data['imgs']);
            $data['url'] = FU('album/show', array('id' => $data['id']));
            $album_list[] = $data;
        }
        $page_num = intval($_FANWE['setting']['share_self_page']) ? intval($_FANWE['setting']['share_self_page']) : 30;
        $is_root = false;
        $img_width = 190;
        $limit = $page_num;
        $share_ids = array();
        $res = FDB::query('SELECT share_id FROM ' . FDB::table('album_share') . ' 
				WHERE album_id = ' . $id . ' ORDER BY share_id DESC ');
        while ($data = FDB::fetch($res)) {
            $share_ids[] = $data['share_id'];
        }
        $share_ids = implode(',', $share_ids);
        if ($share_ids) {
            $sql = 'SELECT *
			FROM ' . FDB::table("share") . '
			WHERE share_data <> ' . " 'default' and share_id IN (" . $share_ids . ") \r\n\t\t\tORDER BY share_id DESC LIMIT " . $limit;
            $share_list = FDB::fetchAll($sql);
        }
        if ($share_list) {
            $share_list = FS('Share')->getShareDetailList($share_list, false, false, false, true, 2);
            $list = array();
            $current_user = array();
            $current_user['u_url'] = FU('u/index', array('uid' => $_FANWE['uid']));
            $current_user['avt'] = avatar($_FANWE['uid'], 's', $is_src = 1);
            $i = 0;
            foreach ($share_list as $k => $v) {
                $list[$i] = $v;
                $img_info = FDB::fetchFirst("select img,img_width,img_height,is_animate,video from " . FDB::table("share_photo") . " where share_id = " . $v['share_id'] . " and img <> '' ");
                if ($img_info['is_animate']) {
                    $img = $img_info['img'];
                } else {
                    $img = getImgName($img_info['img'], $img_width, 999);
                }
                $is_video = 0;
                $vedio_url = '';
                if (!empty($img_info['video'])) {
                    $is_video = 1;
                    $vedio_url = $img_info['video'];
                }
                $list[$i]['is_video'] = $is_video;
                $list[$i]['video'] = $vedio_url;
                $list[$i]['share_img'] = $img;
                $list[$i]['avt'] = avatar($v['uid'], 's', $is_src = 1);
                $list[$i]['height'] = $img_info['img_height'] * ($img_width / $img_info['img_width']);
                /*获取play图标的位置*/
                $list[$i]['video_style_top'] = ($list[$i]['height'] - 33) / 2;
                $list[$i]['video_style_right'] = (254 - 33) / 2;
                $list[$i]['width'] = $img_width;
                $list[$i]['share_img_org'] = $img_info['img'];
                $parent_id = FDB::resultFirst("select parent_id from " . FDB::table("share") . " where share_id = " . $v['share_id']);
                if ($parent_id == 0) {
                    $list[$i]['isOriginal'] = 1;
                } else {
                    $list[$i]['isOriginal'] = 0;
                }
                $list[$i]['likeStatus'] = FS('Share')->getIsCollectByUid($v['share_id'], $_FANWE['uid']) ? 1 : 0;
                $list[$i]['isMe'] = $v['uid'] == $_FANWE['uid'] ? 1 : 0;
                //分享评论
                $share_comments = FS('Share')->getShareCommentList($v['share_id'], '0,2');
                if ($share_comments) {
                    $share_comments_data = array();
                    $idxj = 0;
                    foreach ($share_comments as $vv) {
                        $share_comments_data[$idxj]['comment_id'] = $vv['comment_id'];
                        $share_comments_data[$idxj]['parent_id'] = $vv['parent_id'];
                        $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]['user_name'] = FDB::resultFirst("select user_name from " . FDB::table('user') . " where uid =" . $v['uid']);
                $i++;
            }
        }
        if ($list) {
            $share_detail = $list[0];
        }
        $link_url = $_FANWE['site_url'] . "services/service.php?m=user&a=album_share&width=190&p=2&home_uid=" . $home_uid . "&album_id=" . $id;
        $json_url = $_FANWE['site_url'] . "services/service.php?m=user&a=album_share&width=190&home_uid=" . $home_uid . "&album_id=" . $id;
        include template('page/album/album_show');
        display();
    }
Esempio n. 23
0
    public function fans()
    {
        global $_FANWE;
        $home_uid = $_FANWE['home_uid'];
        $home_user = FS('User')->getUserById($home_uid);
        if ($_FANWE['uid'] == $home_uid) {
            //将我的粉丝信息统计设置为0
            FDB::query("update " . FDB::table("user_notice") . " set num=0 where `type`=1 and uid=" . intval($_FANWE['uid']));
        }
        $page_args = array('uid' => $home_uid);
        Cache::getInstance()->loadCache('citys');
        $reside_province = $_FANWE['cache']['citys']['all'][$home_user['reside_province']]['name'];
        $reside_city = $_FANWE['cache']['citys']['all'][$home_user['reside_city']]['name'];
        $count = FDB::resultFirst('SELECT COUNT(uid) FROM ' . FDB::table('user_follow') . ' WHERE uid = ' . $home_uid);
        $pager = buildPage('u/' . ACTION_NAME, $page_args, $count, $_FANWE['page'], 20);
        $user_list = array();
        $res = FDB::query('SELECT u.uid,u.user_name,u.server_code,uc.fans,up.reside_province,up.reside_city
				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 = ' . $home_uid . ' ORDER BY uf.create_time DESC LIMIT ' . $pager['limit']);
        while ($data = FDB::fetch($res)) {
            $data['is_follow'] = FS('User')->getIsFollowUId($data['uid']);
            $data['reside_province'] = $_FANWE['cache']['citys']['all'][$data['reside_province']]['name'];
            $data['reside_city'] = $_FANWE['cache']['citys']['all'][$data['reside_city']]['name'];
            $data['share'] = FDB::fetchFirst('SELECT share_id,create_time,content
				FROM ' . FDB::table('share') . '
				WHERE uid = ' . $data['uid'] . '
				ORDER BY share_id DESC
				LIMIT 0,1');
            if ($data['share']) {
                $data['share']['url'] = FU('note/index', array('sid' => $data['share']['share_id']));
                $data['share']['time'] = getBeforeTimelag($data['share']['create_time']);
            }
            $user_list[] = $data;
        }
        include template('page/u/u_fans');
        display();
    }
Esempio n. 24
0
    public function deletePost($share_id, $is_score = true)
    {
        if (intval($share_id) == 0) {
            return false;
        }
        $post = FDB::fetchFirst('SELECT * FROM ' . FDB::table('forum_post') . ' WHERE share_id = ' . $share_id);
        if (empty($post)) {
            return true;
        }
        FDB::delete('forum_post', 'share_id = ' . $share_id);
        FDB::query('UPDATE ' . FDB::table('forum_thread') . ' SET
				post_count = post_count - 1
				WHERE tid = ' . $post['tid']);
        FDB::query('UPDATE ' . FDB::table('user_count') . ' SET
				forum_posts = forum_posts - 1
				WHERE uid = ' . $post['uid']);
        FS('Share')->deleteShare($share_id, $is_score);
        FS('Medal')->runAuto($post['uid'], 'ask_posts');
    }
Esempio n. 25
0
<?php

$id = (int) $_REQUEST['id'];
if ($id == 0) {
    exit;
} else {
    define('GOODS_ID', $id);
}
require "init.php";
$goods = FDB::fetchFirst('SELECT sg.*,s.cache_data FROM ' . FDB::table('second_goods') . ' AS sg 
	INNER JOIN ' . FDB::table('share') . ' AS s ON s.share_id =  sg.share_id 
	WHERE sg.gid = ' . GOODS_ID);
if ($goods) {
    header('Content-type: text/xml; charset=utf-8');
    $goods['cache_data'] = fStripslashes(unserialize($goods['cache_data']));
    FS('Share')->shareImageFormat($goods);
    unset($goods['cache_data']);
    $xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n";
    $xml .= "<goods>\r\n";
    $xml .= "<ID>" . GOODS_ID . "</ID>\r\n";
    $xml .= "<title><![CDATA[{$goods['name']}]]></title>\r\n";
    $xml .= "<description><![CDATA[{$goods['content']}]]></description>\r\n";
    $xml .= "<price>{$goods['price']}</price>\r\n";
    $xml .= "<totalNumber>{$goods['num']}</totalNumber>\r\n";
    $valid_time = fToDate($goods['valid_time'], 'Ymd') . '000000';
    $xml .= "<validTime>{$valid_time}</validTime>\r\n";
    $xml .= "<transportFee>{$goods['transport_fee']}</transportFee>\r\n";
    $xml .= "<picPath>\r\n";
    foreach ($goods['imgs'] as $img) {
        $xml .= "<path>" . str_replace('./', $_FANWE['site_url'], $img['img']) . "</path>\r\n";
    }
 public function updateUserTodayScore($uid, $score)
 {
     $uid = (int) $uid;
     $score = (int) $score;
     $statistic = FDB::fetchFirst('SELECT * FROM ' . FDB::table('user_statistics') . ' WHERE uid = ' . $uid . ' AND type = 7');
     $today_time = getTodayTime();
     if (!$statistic) {
         $data['uid'] = $uid;
         $data['num'] = $score;
         $data['last_time'] = $today_time;
         $data['type'] = 7;
         FDB::insert('user_statistics', $data);
     } else {
         $data['last_time'] = $today_time;
         if ($statistic['last_time'] < $today_time) {
             $data['num'] = $score;
         } else {
             $data['num'] = (int) $statistic['num'] + $score;
         }
         FDB::update('user_statistics', $data, 'uid = ' . $uid . ' AND type = 7');
     }
 }
Esempio n. 27
0
/**
 * 分享列表详细数据
 * @param array $list 分享列表
 * @param bool $is_parent 是否获取转发信息
 * @param bool $is_collect 是否获取喜欢的会员
 * @param bool $is_parent 是否获取分享标签
 * @return array
 */
function mGetShareDetailList($list, $is_parent = false, $img_width = 160, $img_height = 160)
{
    global $_FANWE;
    $shares = array();
    $share_ids = array();
    $rec_shares_ids = array();
    $share_users = array();
    foreach ($list as $item) {
        $share_id = $item['share_id'];
        if ($item['share_data'] == 'default') {
            continue;
        }
        $share_ids[] = $share_id;
        $item['cache_data'] = fStripslashes(unserialize($item['cache_data']));
        $item['time'] = getBeforeTimelag($item['create_time']);
        $item['url'] = FU('note/index', array('sid' => $share_id), true);
        if ($item['source'] == 'web') {
            $item['source'] = $_FANWE['setting']['site_name'] . '网站';
        }
        $item['imgs'] = array();
        $img = array();
        $img_sql = 'select photo_id,img,img_width,img_height from ' . FDB::table('share_photo') . ' where share_id = ' . $share_id;
        $img_data = FDB::fetchFirst($img_sql);
        $img['share_id'] = $share_id;
        $img['id'] = $img_data['photo_id'];
        $img['name'] = '';
        $img['type'] = '';
        $img['price'] = '';
        $img['goods_url'] = '';
        $img['taoke_url'] = '';
        $img['price_format'] = '';
        $img['server_code'] = '';
        $img['img_width'] = $img_data['img_width'];
        $img['img'] = FS("Image")->getImageUrl($img_data['img'], 2);
        $img['img_height'] = $img_data['img_height'];
        $img['width'] = 160;
        $img['small_img'] = FS("Image")->getImageUrl(getImgName($img_data['img'], 160, 160, 0, true), 2);
        $item['imgs'][] = $img;
        m_express(&$item, $item['content']);
        $shares[$share_id] = $item;
        unset($shares[$share_id]['cache_data']);
        $shares[$share_id]['user'] =& $share_users[$item['uid']];
        $shares[$share_id]['is_relay'] = false;
        $shares[$share_id]['is_parent'] = false;
        if ($is_parent) {
            if ($item['base_id'] > 0) {
                $shares[$share_id]['is_relay'] = true;
                $rec_shares_ids[$item['base_id']] = false;
                $shares[$share_id]['relay_share'] =& $rec_shares_ids[$item['base_id']];
            } elseif ($item['parent_id'] > 0 && $item['parent_id'] != $item['base_id']) {
                $shares[$share_id]['is_parent'] = true;
                $rec_shares_ids[$item['parent_id']] = false;
                $shares[$share_id]['parent_share'] =& $rec_shares_ids[$item['parent_id']];
            }
        }
    }
    $rec_ids = array_keys($rec_shares_ids);
    if (count($rec_ids) > 0) {
        $intersects = array_intersect($share_ids, $rec_ids);
        $temp_ids = array();
        foreach ($intersects as $share_id) {
            $rec_shares_ids[$share_id] = $shares[$share_id];
            $temp_ids[] = $share_id;
        }
        $diffs = array_diff($rec_ids, $temp_ids);
        if (count($diffs) > 0) {
            $res = FDB::query('SELECT * FROM ' . FDB::table('share') . ' WHERE share_id IN (' . implode(',', $diffs) . ')');
            while ($item = FDB::fetch($res)) {
                $share_id = $item['share_id'];
                $share_ids[] = $share_id;
                $item['cache_data'] = fStripslashes(unserialize($item['cache_data']));
                $item['time'] = getBeforeTimelag($item['create_time']);
                $item['url'] = FU('note/index', array('sid' => $share_id), true);
                if ($item['source'] == 'web') {
                    $item['source'] = $_FANWE['setting']['site_name'] . '网站';
                }
                m_express(&$item, $item['content']);
                $item['imgs'] = array();
                $img = array();
                $img_sql = 'select photo_id,img,img_width,img_height from ' . FDB::table('share_photo') . ' where share_id = ' . $share_id;
                $img_data = FDB::fetchFirst($img_sql);
                $img['share_id'] = $share_id;
                $img['id'] = $img_data['photo_id'];
                $img['name'] = '';
                $img['type'] = '';
                $img['price'] = '';
                $img['goods_url'] = '';
                $img['taoke_url'] = '';
                $img['price_format'] = '';
                $img['server_code'] = '';
                $img['img_width'] = $img_data['img_width'];
                $img['img'] = FS("Image")->getImageUrl($img_data['img'], 2);
                $img['img_height'] = $img_data['img_height'];
                $img['width'] = 160;
                $img['small_img'] = FS("Image")->getImageUrl(getImgName($img_data['img'], 160, 160, 0, true), 2);
                $item['imgs'][] = $img;
                $rec_shares_ids[$share_id] = $item;
                unset($rec_shares_ids[$share_id]['cache_data']);
                $rec_shares_ids[$share_id]['user'] =& $share_users[$item['uid']];
            }
        }
    }
    $user_ids = array_keys($share_users);
    if (count($user_ids) > 0) {
        $res = FDB::query("SELECT uid,user_name,server_code FROM " . FDB::table('user') . ' WHERE uid IN (' . implode(',', $user_ids) . ')');
        while ($item = FDB::fetch($res)) {
            $item['user_avatar'] = FS("Image")->getImageUrl('.' . avatar($item['uid'], 'm', 1), 2);
            $share_users[$item['uid']] = $item;
        }
    }
    return $shares;
}
    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();
    }
/**
 * 显示指定ID的广告位ID
 * @param string $id 广告位
 * @param int $count 显示数量
 * @param string $target 关键字
 * @return array
 */
function getAdvPosition($id, $count = '', $target = '')
{
    global $_FANWE;
    $ap = FDB::fetchFirst('SELECT * FROM ' . FDB::table('adv_position') . ' WHERE id =' . $id);
    if (!$ap) {
        return '';
    }
    if ($target != '') {
        $target = explode(',', $target);
    }
    $where = "status = 1 AND position_id = '{$id}'";
    if ($target != '') {
        $where .= ' AND target_key' . FDB::createIN($target);
    }
    $sql = 'SELECT * FROM ' . FDB::table('adv') . ' WHERE ' . $where . ' ORDER BY sort ASC,id DESC';
    if ($count > 0) {
        $sql .= ' LIMIT 0,' . $count;
    }
    $adv_res = FDB::query($sql);
    $adv_list = array();
    while ($adv = FDB::fetch($adv_res)) {
        $adv['html'] = getAdvHTML($adv, $ap);
        $adv['durl'] = FU("adv/show", array("id" => $adv['id']));
        $adv['turl'] = $adv['url'];
        $adv['url'] = urlencode(FU("adv/show", array("id" => $adv['id'])));
        $adv_list[] = $adv;
    }
    $ap['adv_list'] = $adv_list;
    return $ap;
}
Esempio n. 30
0
         foreach ($share_comments as $vv) {
             $share_comments_data[$idxj]['comment_id'] = $vv['comment_id'];
             $share_comments_data[$idxj]['parent_id'] = $vv['parent_id'];
             $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));