Esempio n. 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'));
 }
Esempio n. 2
0
 function delete()
 {
     $online_hold = 60;
     $guest_span = 60;
     $online_hold = TIME_UTC - $online_hold;
     $guest_span = TIME_UTC - $guest_span;
     $condition = " sid='{$this->sid}' ";
     $condition .= " OR last_activity < {$online_hold} ";
     $condition .= " OR (uid='0' AND ip1='{$this->var['ip1']}' AND ip2='{$this->var['ip2']}' AND ip3='{$this->var['ip3']}' AND ip4='{$this->var['ip4']}' AND last_activity > {$guest_span}) ";
     $condition .= $this->var['uid'] ? " OR (uid='{$this->var['uid']}') " : '';
     FDB::delete('sessions', $condition);
 }
Esempio n. 3
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}");
     }
 }
Esempio n. 4
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);
 }
Esempio n. 5
0
    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);
        $uid = (int) $share['uid'];
        FDB::query('UPDATE ' . FDB::table('user_count') . ' SET seconds = seconds - 1 WHERE uid = ' . $uid);
        FDB::delete('second_goods', 'gid = ' . $gid);
        FS('Medal')->runAuto($uid, 'seconds');
    }
 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. 7
0
    public function deletePost($share_id, $is_score = true)
    {
        if (intval($share_id) == 0) {
            return false;
        }
        $post = FDB::fetchFirst('SELECT * FROM ' . FDB::table('ask_post') . ' WHERE share_id = ' . $share_id);
        if (empty($post)) {
            return true;
        }
        FDB::delete('ask_post', 'share_id = ' . $share_id);
        FDB::query('UPDATE ' . FDB::table('ask_thread') . ' SET
				post_count = post_count - 1
				WHERE tid = ' . $post['tid']);
        FDB::query('UPDATE ' . FDB::table('user_count') . ' SET
				ask_posts = ask_posts - 1,
				ask_best_posts = ask_best_posts - ' . $post['is_best'] . '
				WHERE uid = ' . $post['uid']);
        FS("Share")->deleteShare($share_id, $is_score);
        FS('Medal')->runAuto($post['uid'], 'ask_posts');
    }
Esempio n. 8
0
<?php

$sync_bind_exists = $_FANWE['cookie']['sync_bind_exists'];
$result = array();
if (empty($sync_bind_exists)) {
    $result['status'] = 0;
    outputJson($result);
}
$sync_bind_exists = unserialize(authcode($sync_bind_exists, 'DECODE'));
$is_bind = $_FANWE['request']['is_bind'];
if ($is_bind) {
    $avatar = '';
    $type = $sync_bind_exists['type'];
    $keyid = $sync_bind_exists['keyid'];
    FDB::delete('user_bind', "type = '" . $type . "' AND keyid = '" . $keyid . "'");
    require_once FANWE_ROOT . "core/class/user/" . $type . ".class.php";
    $class = ucfirst($type) . 'User';
    $class = new $class();
    $class->bindByData($sync_bind_exists);
    $result['status'] = 1;
} else {
    $result['status'] = 0;
}
fSetCookie('sync_bind_exists', '');
outputJson($result);
    /**  
     * 保存专辑标签
     * @param int $aid 专辑编号
     * @param array $tags 标签数组
     * @return void
     */
    public function saveTags($aid, $tags)
    {
        $aid = (int) $aid;
        if (!$aid) {
            return;
        }
        FDB::query('UPDATE ' . FDB::table('album_tags') . ' SET album_count = album_count - 1 
			WHERE tag_name IN (SELECT tag_name FROM ' . FDB::table('album_tags_related') . ' WHERE album_id = ' . $aid . ')');
        FDB::delete('album_tags_related', 'album_id = ' . $aid);
        foreach ($tags as $tag) {
            if (empty($tag)) {
                continue;
            }
            $related = array();
            $related['tag_name'] = $tag;
            $related['album_id'] = $aid;
            if (FDB::insert('album_tags_related', $related, false, false, true)) {
                $album_tag = FDB::fetchFirst('SELECT * FROM ' . FDB::table('album_tags') . " WHERE tag_name = '{$tag}'");
                if ($album_tag) {
                    FDB::query('UPDATE ' . FDB::table('album_tags') . " SET album_count = album_count + 1 WHERE tag_name = '{$tag}'");
                } else {
                    $album_tag = array();
                    $album_tag['tag_name'] = $tag;
                    $album_tag['album_count'] = 1;
                    $album_tag['is_new'] = 1;
                    FDB::insert('album_tags', $album_tag);
                }
            }
        }
        FDB::fetchFirst('UPDATE ' . FDB::table('album') . " SET tags = '" . implode(' ', $tags) . "' WHERE id = {$aid}");
    }
Esempio n. 10
0
    /**
     * 删除分享评论
     * @param int $comment_id 评论编号
     * @return void
     */
    public function deleteShareComment($comment_id)
    {
        $comment = ShareService::getShareComment($comment_id);
        if (empty($comment)) {
            return;
        }
        FDB::delete('share_comment', 'comment_id = ' . $comment_id);
        $share_id = $comment['share_id'];
        //分享评论数量减1
        FDB::query('UPDATE ' . FDB::table('share') . '
			SET comment_count = comment_count - 1
			WHERE share_id = ' . $share_id . ' and comment_count >=1 ');
        //清除分享评论列表缓存
        ShareService::updateShareCache($share_id, 'comments');
    }
Esempio n. 11
0
 /**
  * 拒绝一个勋章申请
  * @param int $id
  * @return
  */
 public function refuseApplyMedal($id)
 {
     $apply = MedalService::getApply($id);
     if (!$apply) {
         return false;
     }
     MedalService::sendRefuseNotice($apply['uid'], $apply['mid']);
     return FDB::delete('medal_apply', 'id = ' . $id);
 }