Пример #1
0
 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 cate()
 {
     global $_FANWE;
     $category = urldecode($_FANWE['request']['cate']);
     if (!isset($_FANWE['cache']['goods_category']['cate_code'][$category])) {
         fHeader('location: ' . FU('book/shopping'));
     }
     BookModule::getList();
 }
Пример #3
0
 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'));
 }
Пример #4
0
 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();
 }
Пример #5
0
 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);
 }
Пример #6
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:./');
     }
 }
Пример #7
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();
    }
Пример #8
0
 public function u()
 {
     global $_FANWE;
     $_FANWE['nav_title'] = lang('common', 'user_medal');
     $medal_uid = (int) $_FANWE['request']['uid'];
     if ($medal_uid > 0) {
         $medal_names = FS('User')->getUserShowName($medal_uid);
     } else {
         fHeader("location: " . FU('medal/index'));
     }
     $medal_list = array();
     $award_list = FS('Medal')->getAwardsByUid($medal_uid);
     foreach ($award_list as $mid => $award) {
         $medal_list[] = $_FANWE['cache']['medals']['all'][$mid];
     }
     if ($_FANWE['uid'] > 0 && count($medal_list) > 0) {
         FS('Medal')->medalFormat($_FANWE['uid'], $medal_list);
     }
     include template('page/medal/medal_index');
     display();
 }
Пример #9
0
 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();
 }
Пример #10
0
    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();
    }
Пример #11
0
<?php

include "base.php";
require_once FANWE_ROOT . "sdks/qq/qq.func.php";
$appid = $_FANWE['cache']['logins']['qq']['app_key'];
$appkey = $_FANWE['cache']['logins']['qq']['app_secret'];
$access_token = getQqAccessToken($appid, $appkey);
$openid = getQqOpenid($access_token);
require_once FANWE_ROOT . "core/class/user/qq.class.php";
$qq = new QqUser();
switch ($callback_type) {
    case 'login':
        $qq->loginHandler($access_token, $openid);
        $url = FU('u/index');
        break;
    case 'bind':
        $qq->bindHandler($access_token, $openid);
        $url = FU('settings/bind');
        break;
}
fSetCookie('callback_type', '');
fHeader("location:" . $url);
 public function unBuyerverifier()
 {
     global $_FANWE;
     $uid = $_FANWE['uid'];
     $data['is_buyer'] = -1;
     FDB::update('user', $data, "uid = {$uid}");
     fHeader("location: " . FU('settings/buyerverifier'));
 }
Пример #13
0
} elseif (in_array($action, array('exchange'))) {
    if ($home_uid != $_FANWE['uid']) {
        fHeader("location: " . FU('u/exchange', array('uid' => $_FANWE['uid'])));
    }
} elseif (in_array($action, array('atme'))) {
    if ($home_uid != $_FANWE['uid']) {
        fHeader("location: " . FU('u/atme', array('uid' => $_FANWE['uid'])));
    }
} elseif (in_array($action, array('message', 'sendmsg', 'msgview', 'exchange'))) {
    if ($home_uid != $_FANWE['uid']) {
        fHeader("location: " . FU('u/message', array('uid' => $_FANWE['uid'])));
    }
}
$_FANWE['home_uid'] = $home_uid;
$_FANWE['home_user_names'] = FS('User')->getUserShowName($home_uid);
$home_user = FS('User')->getUserById($home_uid);
if (empty($home_user)) {
    fHeader("location: " . FU('index/index'));
}
$_FANWE['nav_title'] = $home_user['user_name'] . lang('common', 'space');
require fimport('module/u');
if (class_exists("UModule")) {
    $module = new UModule();
    if (method_exists($module, $action)) {
        call_user_method($action, $module);
    } else {
        die("error access");
    }
} else {
    die("error access");
}
Пример #14
0
 public function logout()
 {
     global $_FANWE;
     $_FANWE['nav_title'] = lang('common', 'user_logout');
     FS('User')->clearSession();
     //====add by chenfq 2011-10-14=========
     $syslogout_js = FS("Integrate")->synLogout();
     //js 需要在前台执行
     //echo $syslogout_js; exit;
     if (!empty($syslogout_js)) {
         fSetCookie("dynamic_script", $syslogout_js);
     }
     fHeader("location: " . FU('index/index'));
 }
Пример #15
0
 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'] = '';
     FDB::query('UPDATE ' . FDB::table('share') . ' SET click_count = click_count + 1 WHERE share_id = ' . $share_id);
     //上一个,下一个分享
     //$pns = FS('Share')->getPrevNextShares($share_detail['uid'],$share_id);
     //发布分享的会员
     $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');
     }
     switch ($current_type) {
         case 'bao':
             //会员最被喜欢的宝贝
             $best_goods_share = FS('Share')->getBestCollectGoodsShareByUser($share_user['uid']);
             //会员分享店铺信息
             $shop_percent_html = FS('Shop')->getUserShareShopHtml($share_user['uid']);
             break;
         case 'photo':
             //会员最被喜欢的照片
             $best_photo_share = FS('Share')->getBestCollectPhotoShareByUser($share_user['uid']);
             //会员喜欢的照片
             $user_fav_photo = FS('Share')->getUserFavPhotoShare($share_user['uid']);
             break;
         default:
             //获取原文分享
             $share_detail['is_relay'] = false;
             $share_detail['is_rec'] = false;
             if ($share_detail['parent_id'] > 0 && $share_detail['base_id'] > 0) {
                 $share_detail['is_relay'] = true;
                 $parent_share = FS('Share')->getShareDetail($share_detail['base_id']);
             } elseif ($share_detail['rec_id'] > 0 && $share_detail['base_id'] > 0) {
                 $share_detail['is_rec'] = true;
                 $parent_share = FS('Share')->getShareDetail($share_detail['base_id']);
             }
             $current_type = 'other';
             break;
     }
     include template('page/note/note_index');
     display();
 }
Пример #16
0
    public function save()
    {
        global $_FANWE;
        if ($_FANWE['uid'] == 0) {
            fHeader("location: " . FU('user/login'));
        }
        if ($_FANWE['setting']['second_status'] == 0) {
            fHeader("location: " . FU('index'));
        }
        if (!isset($_FANWE['request']['pics']) || !is_array($_FANWE['request']['pics']) || count($_FANWE['request']['pics']) == 0) {
            exit;
        }
        $data = array('name' => trim($_FANWE['request']['title']), 'content' => trim($_FANWE['request']['content']), 'sid' => (int) $_FANWE['request']['sid'], 'num' => (int) $_FANWE['request']['num'], 'price' => (double) $_FANWE['request']['price'], 'transport_fee' => (double) $_FANWE['request']['fare'], 'valid_time' => (int) $_FANWE['request']['valid_time']);
        $vservice = FS('Validate');
        $validate = array(array('name', 'required', lang('second', 'name_require')), array('name', 'max_length', lang('second', 'name_max'), 40), array('content', 'required', lang('second', 'content_require')), array('content', 'max_length', lang('second', 'content_max'), 1000), array('sid', 'min', lang('second', 'sid_min'), 1), array('num', 'range', lang('second', 'num_range'), 1, 3), array('price', 'min', lang('second', 'price_min'), 0.01), array('transport_fee', 'min', lang('second', 'fee_min'), 0), array('valid_time', 'range', lang('second', 'valid_time_range'), 2, 30));
        if (!$vservice->validation($validate, $data)) {
            exit;
        }
        if (!isset($_FANWE['cache']['seconds'][$data['sid']])) {
            exit;
        }
        if (!checkIpOperation("add_share", SHARE_INTERVAL_TIME)) {
            showError('提交失败', lang('share', 'interval_tips'), -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']['title'], 'title');
        if ($check_result['error_code'] == 1) {
            showError('提交失败', $check_result['error_msg'], -1);
        }
        $_FANWE['request']['uid'] = $_FANWE['uid'];
        $_FANWE['request']['type'] = 'ershou';
        $share = FS('Share')->submit($_FANWE['request']);
        if ($share['status']) {
            $data['name'] = htmlspecialchars($_FANWE['request']['title']);
            $data['content'] = htmlspecialchars($_FANWE['request']['content']);
            $data['uid'] = $_FANWE['uid'];
            $data['share_id'] = $share['share_id'];
            $data['city_id'] = $_FANWE['user']['reside_province'];
            $data['valid_time'] = getTodayTime() + 86400 * $data['valid_time'];
            $data['create_time'] = TIME_UTC;
            $data['status'] = 0;
            $gid = FDB::insert('second_goods', $data, true);
            $sign = md5($gid . $_FANWE['setting']['second_taobao_sign']);
            FDB::query('UPDATE ' . FDB::table('second_goods') . ' SET sign = \'' . $sign . '\' WHERE gid = ' . $gid);
            FDB::query('UPDATE ' . FDB::table('share') . ' SET rec_id = ' . $gid . ' 
				WHERE share_id = ' . $share['share_id']);
            FDB::query("update " . FDB::table("user_count") . " set seconds = seconds + 1 where uid = " . $_FANWE['uid']);
            FS('Medal')->runAuto($_FANWE['uid'], 'seconds');
            $url = "http://communityweb.alipay.com/dispatch.htm?type=exGuarantee&forumId=" . $_FANWE['setting']['second_taobao_forumid'] . "&exId=" . $gid . "&userIP=" . $_FANWE['client_ip'] . "&userIPSign=" . md5($_FANWE['client_ip'] . $_FANWE['setting']['second_taobao_sign']);
            fHeader('location: ' . $url);
        } else {
            showError('提交失败', '添加数据失败', -1);
        }
    }
Пример #17
0
 public function msgview()
 {
     global $_FANWE;
     $home_uid = $_FANWE['uid'];
     $home_user = FS('User')->getUserById($home_uid);
     $current_menu = 'message';
     $mlid = intval($_FANWE['request']['lid']);
     $mid = intval($_FANWE['request']['mid']);
     if ($mlid == 0 && $mid == 0) {
         fHeader("location: " . FU('u/message', array('uid' => $_FANWE['uid'])));
     }
     $pageargs = array();
     if ($mlid > 0) {
         $pageargs['lid'] = $mlid;
         $mlist = FS('Message')->getListByMlid($mlid, $_FANWE['uid']);
         if (empty($mlist)) {
             fHeader("location: " . FU('u/message', array('uid' => $_FANWE['uid'])));
         }
         $pager = buildPage('u/' . ACTION_NAME, $pageargs, $mlist['num'], $_FANWE['page'], 10);
         $msg_list = FS('Message')->getMsgsByMlid($mlid, $_FANWE['uid'], $pager['limit']);
         include template('page/u/u_msgview');
     } elseif ($mid) {
         $msg = FS('Message')->getSysMsgByMid($_FANWE['uid'], $mid);
         include template('page/u/u_smsgview');
     }
     display();
 }
    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);
        }
    }
Пример #19
0
    public function listdetail()
    {
        global $_FANWE;
        if (!isset($_FANWE['request']['type'])) {
            $type = "hot";
        } else {
            $type = $_FANWE['request']['type'];
        }
        $page_args = array();
        $where = "";
        if (!isset($_FANWE['request']['order'])) {
            $order = "time";
        } else {
            $order = $_FANWE['request']['order'];
        }
        switch ($order) {
            case "time":
                $sort = 'e.last_share DESC';
                $page_args['sort'] = 'time';
                break;
            case "thread_count":
                $sort = 'e.thread_count DESC';
                $page_args['sort'] = 'pop';
                break;
        }
        $is_query = true;
        switch ($type) {
            case "new":
                $sort = 'e.id DESC';
                unset($page_args['sort']);
                break;
            case "me":
                if ($_FANWE['uid'] == 0) {
                    fHeader("location: " . FU('user/login'));
                }
                $where .= ' AND e.uid = ' . $_FANWE['uid'];
                break;
            case "reply":
                if ($_FANWE['uid'] == 0) {
                    fHeader("location: " . FU('user/login'));
                }
                $count = FDB::resultFirst('SELECT COUNT(DISTINCT event_id) FROM ' . FDB::table('event_share') . ' WHERE uid = ' . $_FANWE['uid']);
                if ($count == 0) {
                    $is_query = false;
                } else {
                    $sql = 'SELECT DISTINCT event_id FROM ' . FDB::table('event_share') . ' 
						WHERE uid = ' . $_FANWE['uid'];
                    $ids = array();
                    $res = FDB::query($sql);
                    while ($data = FDB::fetch($res)) {
                        $ids[] = $data['event_id'];
                    }
                    $ids = implode(',', $ids);
                    $where .= ' AND e.id IN (' . $ids . ')';
                }
                break;
            default:
                $sort = 'e.thread_count DESC';
                unset($page_args['sort']);
                $type = "hot";
                break;
        }
        if (!empty($where)) {
            $where = ' WHERE' . $where;
            $where = str_replace('WHERE AND', 'WHERE', $where);
        }
        $detaillist = array();
        if ($is_query) {
            if ($type != 'reply') {
                $count = FDB::resultFirst('SELECT COUNT(DISTINCT e.id) FROM ' . FDB::table('event') . ' AS e' . $where);
            }
            $pager = buildPage('event/' . ACTION_NAME, $page_args, $count, $_FANWE['page'], 20);
            if (empty($sort)) {
                $sort = 'e.id DESC';
            } else {
                $sort .= ',e.id DESC';
            }
            $sql = 'SELECT DISTINCT e.id,e.title,e.uid,e.create_time,e.last_share,e.last_share time,e.thread_count FROM ' . FDB::table('event') . ' AS e' . $where . ' ORDER BY ' . $sort . ' LIMIT ' . $pager['limit'];
            $list_users = array();
            $res = FDB::query($sql);
            while ($data = FDB::fetch($res)) {
                $detaillist[$data['id']] = $data;
                $detaillist[$data['id']]['user'] =& $list_users[$data['uid']];
            }
            FS('User')->usersFormat($list_users);
        }
        //热门话题
        $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);
        }
        include template('page/event/event_list');
        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");
 }
Пример #21
0
    function donewtopic()
    {
        global $_FANWE;
        if ($_FANWE['uid'] == 0) {
            fHeader('location: ' . FU('ask/index'));
        }
        $aid = intval($_FANWE['request']['aid']);
        if ($aid == 0) {
            fHeader('location: ' . FU('ask/index'));
        }
        $asks = $_FANWE['cache']['asks'];
        if (!isset($asks[$aid])) {
            fHeader('location: ' . FU('ask/index'));
        }
        $_FANWE['request']['title'] = trim($_FANWE['request']['title']);
        $_FANWE['request']['content'] = trim($_FANWE['request']['content']);
        if ($_FANWE['request']['title'] == '' || $_FANWE['request']['content'] == '') {
            fHeader('location: ' . FU('ask/index'));
        }
        $_FANWE['request']['uid'] = $_FANWE['uid'];
        $_FANWE['request']['type'] = 'ask';
        if (!checkIpOperation("add_share", SHARE_INTERVAL_TIME)) {
            showError('提交失败', lang('share', 'interval_tips'), -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']['title'], 'title');
        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);
        }
        $share = FS('Share')->submit($_FANWE['request']);
        if ($share['status']) {
            $thread = array();
            $thread['aid'] = $aid;
            $thread['share_id'] = $share['share_id'];
            $thread['uid'] = $_FANWE['uid'];
            $thread['title'] = htmlspecialchars($_FANWE['request']['title']);
            $thread['content'] = htmlspecialchars($_FANWE['request']['content']);
            $thread['create_time'] = fGmtTime();
            $tid = FDB::insert('ask_thread', $thread, true);
            FDB::query('UPDATE ' . FDB::table('share') . ' SET rec_id = ' . $tid . '
				WHERE share_id = ' . $share['share_id']);
            FDB::query("update " . FDB::table("user_count") . " set ask = ask + 1,threads = threads + 1 where uid = " . $_FANWE['uid']);
            FDB::query("update " . FDB::table("ask") . " set thread_count = thread_count + 1 where aid = " . $aid);
            FS('Medal')->runAuto($_FANWE['uid'], 'ask');
            FS('User')->medalBehavior($_FANWE['uid'], 'continue_ask');
        }
        fHeader('location: ' . FU('ask/forum', array('aid' => $aid)));
    }