예제 #1
0
 public function run()
 {
     global $_FANWE;
     $root = array();
     $root['return'] = 0;
     if ($_FANWE['uid'] == 0) {
         $root['info'] = "请先登陆";
         m_display($root);
     }
     $user = FS("User")->getUserById($_FANWE['uid']);
     $data = array('oldpassword' => $_FANWE['requestData']['oldpassword'], 'newpassword' => $_FANWE['requestData']['newpassword']);
     $vservice = FS('Validate');
     $validate = array(array('oldpassword', 'required', '请输入现在的密码'), array('newpassword', 'range_length', '请输入正确的新密码', 6, 32));
     if (!$vservice->validation($validate, $data)) {
         $root['info'] = $vservice->getError();
         m_display($root);
     } else {
         if (md5($data['oldpassword']) != $user['password']) {
             $root['info'] = '原密码不正确';
             m_display($root);
         } else {
             FDB::update('user', array('password' => md5($data['newpassword'])), 'uid = ' . $_FANWE['uid']);
             $root['info'] = '修改成功';
             $user_field = $_FANWE['setting']['integrate_field_id'];
             $sql = "SELECT {$user_field} FROM " . FDB::table('user') . " WHERE uid = '{$_FANWE['uid']}'";
             $integrate_id = intval(FDB::resultFirst($sql));
             if ($integrate_id > 0) {
                 FS("Integrate")->editUser($integrate_id, $data['newpassword'], '', '');
             }
         }
     }
     $root['return'] = 1;
     m_display($root);
 }
예제 #2
0
 private function updateBindInfo($user)
 {
     global $_FANWE;
     $data = array();
     $info = array();
     $info['access_token'] = $user['access_token'];
     $data['info'] = serialize($info);
     FDB::update('user_bind', $data, "uid = " . $_FANWE['uid'] . " AND type = '" . $this->type . "'");
 }
예제 #3
0
 public function updateBindInfo($user)
 {
     global $_FANWE;
     $info = array();
     $info['access_token'] = $user['access_token'];
     unset($user['access_token']);
     $info['user'] = $user;
     $data = array();
     $data['info'] = addslashes(serialize($info));
     FDB::update('user_bind', $data, "uid = " . $_FANWE['uid'] . " AND type = '" . $this->type . "'");
 }
예제 #4
0
 private function updateBindInfo($user)
 {
     global $_FANWE;
     $info = array();
     $info['oauth_token'] = $user['last_key']['oauth_token'];
     $info['oauth_token_secret'] = $user['last_key']['oauth_token_secret'];
     unset($user['last_key']);
     $info['user'] = $user;
     $data = array();
     $data['info'] = addslashes(serialize($info));
     FDB::update('user_bind', $data, "uid = " . $_FANWE['uid'] . " AND type = '" . $this->type . "'");
 }
예제 #5
0
 public function updateBindInfo($user)
 {
     global $_FANWE;
     $refresh_time = TIME_UTC + (int) $user['token']['expires_in'];
     $info = array();
     $info['access_token'] = $user['token']['access_token'];
     unset($user['token']);
     $info['user'] = $user;
     $data = array();
     $data['refresh_time'] = $refresh_time;
     $data['info'] = addslashes(serialize($info));
     FDB::update('user_bind', $data, "uid = " . $_FANWE['uid'] . " AND type = '" . $this->type . "'");
 }
예제 #6
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);
 }
예제 #7
0
 public function updateShopStatistic($shop_ids)
 {
     if (is_array($shop_ids)) {
         $shop_ids = array_unique($shop_ids);
         foreach ($shop_ids as $shop_id) {
             $shop_id = (int) $shop_id;
             if ($shop_id > 0) {
                 $data = array();
                 $data['recommend_count'] = ShopService::getShopUserCount($shop_id);
                 $temp = array();
                 $temp['tags'] = ShopService::getShopTags($shop_id);
                 $temp['goods'] = ShopService::getShopGoods($shop_id);
                 $data['data'] = addslashes(serialize($temp));
                 FDB::update('shop', $data, 'shop_id = ' . $shop_id);
             }
         }
     }
 }
예제 #8
0
 public function bindUser($user, $parameters, $session)
 {
     if ($user) {
         global $_FANWE;
         $data = array();
         $data['uid'] = $_FANWE['uid'];
         $data['type'] = $this->type;
         $data['keyid'] = $user['user_id'];
         $info = array();
         $info['session_key'] = $session;
         $info['refresh_token'] = $parameters['refresh_token'];
         $info['user'] = $user;
         $data['info'] = addslashes(serialize($info));
         if ((int) $parameters['expires_in'] > 0) {
             $data['refresh_time'] = TIME_UTC + (int) $parameters['expires_in'];
         } else {
             $data['refresh_time'] = 0;
         }
         $update = array();
         $update['buyer_level'] = $user['buyer_credit']['level'];
         $update['seller_level'] = $user['seller_credit']['level'];
         FDB::update('user', $update, 'uid = ' . $_FANWE['uid']);
         $buyer = array();
         $buyer['is_buyer'] = 1;
         if ($update['buyer_level'] < 2 || $update['seller_level'] > 6) {
             $buyer['is_buyer'] = 0;
         }
         FDB::update('user', $buyer, 'uid = ' . $_FANWE['uid'] . ' AND is_buyer > -1');
         if (!empty($user['avatar']) && !FS('User')->getIsAvatar($_FANWE['uid'])) {
             $img = copyFile($user['avatar']);
             if ($img !== false) {
                 FS('User')->saveAvatar($_FANWE['uid'], $img['path']);
             }
         }
         FDB::insert('user_bind', $data, false, true);
     }
 }
예제 #9
0
if (!checkAuthority('share', 'index')) {
    $result['status'] = 0;
    outputJson($result);
}
$manage_lock = checkIsManageLock('share', $id);
if ($manage_lock !== false) {
    $result['status'] = 1;
    $result['msg'] = $manage_lock['user_name'] . ',' . sprintf(lang('manage', 'manage_lock'), fToDate($manage_lock['time']));
    outputJson($result);
}
$share = FS("Share")->getShareById($id);
if (empty($share)) {
    $result['status'] = 0;
    outputJson($result);
}
$result['status'] = 1;
$update = array();
if ($share['is_index'] == 0) {
    $result['msg'] = lang('manage', 'manage_index_success');
    $update['is_index'] = 1;
} else {
    $result['msg'] = lang('manage', 'manage_unindex_success');
    $update['is_index'] = 0;
    $update['index_img'] = '';
    if (!empty($share['index_img'])) {
        @unlink(FANWE_ROOT . $share['index_img']);
    }
}
createManageLog('share', 'index', $id, $result['msg']);
FDB::update('share', $update, 'share_id = ' . $id);
outputJson($result);
예제 #10
0
<?php

$id = intval($_FANWE['request']['tid']);
if ($id == 0) {
    exit;
}
if (!checkAuthority('ask', 'edit')) {
    exit;
}
$manage_lock = checkIsManageLock('ask', $id);
if ($manage_lock !== false) {
    exit;
}
$old = FS('Ask')->getTopicById($id);
if (empty($old)) {
    deleteManageLock('ask', $id);
    exit;
}
$share_id = $old['share_id'];
$topic = array('title' => htmlspecialchars(trim($_FANWE['request']['title'])), 'content' => htmlspecialchars(trim($_FANWE['request']['content'])), 'aid' => $_FANWE['request']['aid'], 'is_best' => isset($_FANWE['request']['is_best']) ? intval($_FANWE['request']['is_best']) : 0, 'is_top' => isset($_FANWE['request']['is_top']) ? intval($_FANWE['request']['is_top']) : 0);
FDB::update('ask_thread', $topic, 'tid = ' . $id);
FS('Share')->updateShare($share_id, $topic['title'], $topic['content']);
createManageLog('ask', 'edit', $id, lang('manage', 'manage_edit_success'));
deleteManageLock('ask', $id);
$msg = lang('manage', 'manage_edit_success');
include template('manage/tooltip');
display();
예제 #11
0
<?php

define('ROOT_PATH', str_replace('taobao/notify.php', '', str_replace('\\', '/', __FILE__)));
include ROOT_PATH . 'public/data/caches/system/setting.cache.php';
$id = (int) $_REQUEST['exId'];
$sign = trim($_REQUEST['exIdSign']);
if ($id == 0 || empty($sign)) {
    exit;
} else {
    $sign1 = md5($id . $data['setting']['second_taobao_sign']);
    if ($sign != $sign1) {
        exit;
    }
}
define('GOODS_ID', $id);
require "init.php";
$goods['page'] = trim($_FANWE['request']['pages']);
$goods['alipay_gid'] = trim($_FANWE['request']['alipayGoodsId']);
$goods['status'] = 1;
FDB::update('second_goods', $goods, 'gid = ' . GOODS_ID);
예제 #12
0
<?php

$id = intval($_FANWE['request']['tid']);
if ($id == 0) {
    exit;
}
if (!checkAuthority('club', 'edit')) {
    exit;
}
$manage_lock = checkIsManageLock('club', $id);
if ($manage_lock !== false) {
    exit;
}
$old = FS('Topic')->getTopicById($id);
if (empty($old)) {
    deleteManageLock('club', $id);
    exit;
}
$share_id = $old['share_id'];
$topic = array('title' => htmlspecialchars(trim($_FANWE['request']['title'])), 'content' => htmlspecialchars(trim($_FANWE['request']['content'])), 'fid' => $_FANWE['request']['fid'], 'is_best' => isset($_FANWE['request']['is_best']) ? intval($_FANWE['request']['is_best']) : 0, 'is_top' => isset($_FANWE['request']['is_top']) ? intval($_FANWE['request']['is_top']) : 0);
FDB::update('forum_thread', $topic, 'tid = ' . $id);
FS('Share')->updateShare($share_id, $topic['title'], $topic['content']);
createManageLog('club', 'edit', $id, lang('manage', 'manage_edit_success'));
deleteManageLock('club', $id);
$msg = lang('manage', 'manage_edit_success');
include template('manage/tooltip');
display();
 public function unBuyerverifier()
 {
     global $_FANWE;
     $uid = $_FANWE['uid'];
     $data['is_buyer'] = -1;
     FDB::update('user', $data, "uid = {$uid}");
     fHeader("location: " . FU('settings/buyerverifier'));
 }
 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');
     }
 }
    public function updateAlbum($aid)
    {
        $aid = (int) $aid;
        if (!$aid) {
            return false;
        }
        $album = AlbumService::getAlbumById($aid);
        if (empty($album)) {
            return false;
        }
        $share_count = (int) FDB::resultFirst('SELECT COUNT(DISTINCT share_id) FROM ' . FDB::table('album_share') . ' WHERE album_id = ' . $aid);
        $cache_data = array();
        $res = FDB::query('SELECT share_id FROM ' . FDB::table('album_share') . ' 
			WHERE album_id = ' . $aid . ' ORDER BY share_id DESC LIMIT 0,6');
        $ids = array();
        while ($data = FDB::fetch($res)) {
            $ids[] = $data['share_id'];
        }
        if (count($ids) > 0) {
            $imags = array();
            $ids = implode(',', $ids);
            $res = FDB::query('SELECT share_id,cache_data FROM ' . FDB::table('share') . ' WHERE share_id IN (' . $ids . ') ORDER BY share_id DESC');
            while ($data = FDB::fetch($res)) {
                $data['cache_data'] = unserialize($data['cache_data']);
                FS('Share')->shareImageFormat($data);
                unset($data['cache_data']);
                foreach ($data['imgs'] as $img) {
                    $imags[] = $img;
                    if (count($imags) >= 6) {
                        break;
                    }
                }
                if (count($imags) >= 6) {
                    break;
                }
            }
            $cache_data['imgs'] = $imags;
        }
        $cache_data = serialize($cache_data);
        $album = array();
        $album['share_count'] = $share_count;
        $album['cache_data'] = $cache_data;
        FDB::update('album', $album, 'id = ' . $aid);
    }
예제 #16
0
 public function updateShareCache($share_id, $type = 'all')
 {
     $share_id = (int) $share_id;
     if (!$share_id) {
         return;
     }
     $share = FDB::fetchFirst('SELECT cache_data,share_data FROM ' . FDB::table('share') . ' WHERE share_id = ' . $share_id);
     if (!$share) {
         return;
     }
     $cache_data = fStripslashes(unserialize($share['cache_data']));
     switch ($type) {
         case 'tags':
             $cache_data['tags'] = ShareService::getShareTags($share_id, true);
             break;
         case 'collects':
             $cache_data['collects'] = ShareService::getShareCollectUser($share_id, 50);
             break;
         case 'comments':
             $cache_data['comments'] = ShareService::getNewCommentIdsByShare($share_id, 10);
             break;
         case 'imgs':
             $cache_data['imgs'] = ShareService::getShareImage($share_id, $share['share_data']);
             break;
         case 'all':
             $cache_data['tags'] = ShareService::getShareTags($share_id, true);
             $cache_data['collects'] = ShareService::getShareCollectUser($share_id, 50);
             $cache_data['comments'] = ShareService::getNewCommentIdsByShare($share_id, 10);
             $cache_data['imgs'] = ShareService::getShareImage($share_id, $share['share_data']);
             break;
     }
     unset($share['share_data']);
     $share['cache_data'] = addslashes(serialize($cache_data));
     FDB::update("share", $share, 'share_id = ' . $share_id);
 }
    }
    echo "<script type=\"text/javascript\">var fun = function(){location.href='update_share.php?step=2&index=" . ($index + $limit) . "&time=" . time() . "';}; setTimeout(fun,1000);</script>" . "\r\n";
    flush();
    ob_flush();
    exit;
} elseif ($step == 3) {
    $limit = 100;
    $list = FDB::fetchAll('SELECT * FROM ' . FDB::table('shop') . ' ORDER BY shop_id DESC LIMIT ' . $index . ',' . $limit);
    if (count($list) == 0) {
        echo "<h1>更新完成</h1>";
        exit;
    }
    foreach ($list as $data) {
        $shop_id = $data['shop_id'];
        $shop = array();
        $shop['recommend_count'] = FS("Shop")->getShopUserCount($shop_id);
        $temp = array();
        $temp['tags'] = FS("Shop")->getShopTags($shop_id);
        $temp['goods'] = FS("Shop")->getShopGoods($shop_id);
        $shop['data'] = addslashes(serialize($temp));
        FDB::update('shop', $shop, 'shop_id = ' . $shop_id);
        echo "更新店铺 {$shop_id} 图片缓存成功<br/>";
        flush();
        ob_flush();
        usleep(100);
    }
    echo "<script type=\"text/javascript\">var fun = function(){location.href='update_share.php?step=3&index=" . ($index + $limit) . "&time=" . time() . "';}; setTimeout(fun,1000);</script>" . "\r\n";
    flush();
    ob_flush();
    exit;
}
    /**
    * 转发分享
    * @param array $_POST 提交的数据
    * @return array(
    			'share_id'=>分享编号,
    			'pc_id'=>评论编号(如果勾选评论给转发分享),
    			'bc_id'=>原文评论编号(如果勾选评论给原文分享),
    		)
    */
    public function saveRelay($_POST)
    {
        global $_FANWE;
        $share_id = intval($_POST['share_id']);
        $share = ShareService::getShareById($share_id);
        if (empty($share)) {
            return false;
        }
        $data = array();
        $data['share']['uid'] = $_FANWE['uid'];
        $data['share']['parent_id'] = $share_id;
        $content = htmlspecialchars(trim($_POST['content']));
        $data['share']['content'] = $content;
        $type = 'album_item';
        $base_id = $share['base_id'];
        if ($base_id > 0) {
            $base = ShareService::getShareById($share['base_id']);
            if (!empty($base)) {
                $base_id = $base['share_id'];
            } else {
                $base_id = 0;
            }
        }
        $rec_id = $share['rec_id'];
        if ($share['type'] == 'ask' || $share['type'] == 'ask_post') {
            $type = 'ask_post';
        } elseif ($share['type'] == 'bar' || $share['type'] == 'bar_post') {
            $type = 'bar_post';
        }
        $data['share']['albumid'] = intval($_POST['albumid']);
        $data['share']['rec_id'] = $share['rec_id'];
        $data['share']['is_refer'] = $share['is_refer'];
        $data['share']['refer_url'] = $share['refer_url'];
        $data['share']['title'] = addslashes($share['title']);
        $data['share']['base_id'] = $base_id > 0 ? $base_id : $share_id;
        $data['share']['parent_id'] = $base_id > 0 ? $base_id : $share_id;
        $data['share']['type'] = $type;
        //强制改成杂志社分享数据
        $data['share']['share_data'] = 'photo';
        //强制改成杂志社分享数据
        $relay_share = ShareService::save($data);
        //插入share_photo表中,转发修改成有图数据
        $share_photo_data = array();
        $img_data = FDB::fetchFirst("select img,img_width,img_height,is_animate,video from " . FDB::table("share_photo") . " where share_id = " . $share_id);
        $share_photo_data['uid'] = $_FANWE['uid'];
        $share_photo_data['share_id'] = $relay_share['share_id'];
        $share_photo_data['img'] = $img_data['img'];
        $share_photo_data['img_width'] = $img_data['img_width'];
        $share_photo_data['img_height'] = $img_data['img_height'];
        $share_photo_data['is_animate'] = $img_data['is_animate'];
        $share_photo_data['video'] = $img_data['video'];
        if ($share_photo_data['video']) {
            $share_photo_data['type'] = 'video';
        } else {
            $share_photo_data['type'] = 'default';
        }
        $share_photo_data['sort'] = 10;
        FDB::insert('share_photo', $share_photo_data, true);
        if (!$relay_share['status']) {
            return false;
        }
        FDB::query('UPDATE ' . FDB::table('share') . '
			SET relay_count = relay_count + 1
			WHERE share_id = ' . $share_id);
        if (intval($_POST['albumid']) > 0) {
            $album = FDB::fetchFirst('SELECT cid,id,title FROM ' . FDB::table('album') . ' WHERE id = ' . intval($_POST['albumid']));
            if ($album) {
                $update_share['type'] = 'album_item';
                $share_data_now_type = 'album_item';
                $share_data_rec_id = $album['id'];
                $share_data_rec_cate = $album['cid'];
                $update_share['rec_id'] = $album['id'];
                $update_share['title'] = addslashes($album['title']);
                $update_share['share_data'] = 'photo';
                //更新杂志社
                $album_share = array();
                $album_share['album_id'] = intval($_POST['albumid']);
                $album_share['share_id'] = $relay_share['share_id'];
                $album_share['cid'] = $share_data_rec_cate;
                $album_share['create_day'] = getTodayTime();
                FDB::insert("album_share", $album_share);
                FS('Album')->updateAlbumByShare($share_data_rec_id, $relay_share['share_id']);
                FS('Album')->updateAlbum($share_data_rec_id);
            } else {
                $update_share['rec_id'] = 0;
                $share_data_rec_id = 0;
            }
        } else {
            $share_data_rec_id = 0;
        }
        FDB::update("share", $update_share, "share_id=" . $relay_share['share_id']);
        if ($base_id > 0 && $share_id != $base_id) {
            FDB::query('UPDATE ' . FDB::table('share') . '
				SET relay_count = relay_count + 1
				WHERE share_id = ' . $base_id);
        }
        $is_no_post = isset($_POST['is_no_post']) ? intval($_POST['is_no_post']) : 0;
        $share_id = $relay_share['share_id'];
        if ($rec_id > 0 && $is_no_post == 0) {
            if ($type == 'bar_post') {
                FS('Topic')->saveTopicPost($rec_id, $content, $share_id);
            } elseif ($type == 'ask_post') {
                FS('Ask')->saveTopicPost($rec_id, $content, $share_id);
            }
        }
        $is_comment_parent = isset($_POST['is_comment_parent']) ? intval($_POST['is_comment_parent']) : 0;
        $is_comment_base = isset($_POST['is_comment_base']) ? intval($_POST['is_comment_base']) : 0;
        //评论给分享
        $parent_comment_id = 0;
        if ($is_comment_parent == 1) {
            $data = array();
            $data['content'] = $_POST['content'];
            $data['share_id'] = $share['share_id'];
            $parent_comment_id = ShareService::saveComment($data);
        }
        //评论给原创分享
        $base_comment_id = 0;
        if ($is_comment_base == 1 && $base_id > 0) {
            $data = array();
            $data['content'] = $_POST['content'];
            $data['share_id'] = $base_id;
            $base_comment_id = ShareService::saveComment($data);
        }
        return array('share_id' => $share_id, 'pc_id' => $parent_comment_id, 'bc_id' => $base_comment_id);
    }
예제 #19
0
 /**
  * 更新一条记录
  * @param array $data
  * @param int $uid 会员编号
  * @param string $type 类型
  * @return
  */
 function update($data, $uid, $type)
 {
     $uid = (int) $uid;
     $type = StatisticsService::getTypeByKey($type);
     if (!$type || !$uid) {
         return false;
     }
     return FDB::update('user_statistics', $data, 'uid = ' . $uid . ' AND type = ' . $type);
 }
예제 #20
0
}
$old = FS('Topic')->getTopicById($id);
if (empty($old)) {
    deleteManageLock('club', $id);
    exit;
}
$share_id = $old['share_id'];
$topic = array('title' => htmlspecialchars(trim($_FANWE['request']['title'])), 'content' => htmlspecialchars(trim($_FANWE['request']['content'])), 'fid' => $_FANWE['request']['fid'], 'is_best' => isset($_FANWE['request']['is_best']) ? intval($_FANWE['request']['is_best']) : 0, 'is_top' => isset($_FANWE['request']['is_top']) ? intval($_FANWE['request']['is_top']) : 0, 'is_event' => isset($_FANWE['request']['is_event']) ? intval($_FANWE['request']['is_event']) : 0);
FDB::update('forum_thread', $topic, 'tid = ' . $id);
$match_content = $topic['title'];
$match_content .= preg_replace("/\\[[^\\]]+\\]/i", "", $topic['content']);
$res = FDB::query('SELECT name FROM ' . FDB::table('share_goods') . ' WHERE share_id = ' . $share_id);
while ($data = FDB::fetch($res)) {
    $match_content .= $data['name'];
}
$res = FDB::query('SELECT tag_name  FROM ' . FDB::table('share_tags') . ' WHERE share_id = ' . $share_id);
while ($data = FDB::fetch($res)) {
    $match_content .= $data['tag_name '];
}
$share_match = array();
$share_match['content_match'] = segmentToUnicode(clearSymbol($match_content));
FDB::update("share_match", $share_match, 'share_id = ' . $share_id);
$share = array();
$share['title'] = $topic['title'];
$share['content'] = $topic['content'];
FDB::update("share", $share, 'share_id = ' . $share_id);
createManageLog('club', 'edit', $id, lang('manage', 'manage_edit_success'));
deleteManageLock('club', $id);
$msg = lang('manage', 'manage_edit_success');
include template('manage/tooltip');
display();
예제 #21
0
 function update()
 {
     if ($this->sid !== NULL) {
         $data = fAddslashes($this->var);
         if ($this->is_new) {
             $this->delete();
             FDB::insert('sessions', $data, false, false, true);
         } else {
             FDB::update('sessions', $data, "sid='{$data['sid']}'");
         }
         fSetCookie('sid', $this->sid, 86400);
     }
 }
예제 #22
0
         FDB::update('forum_thread', $rec_data, "share_id = '{$share_id}'");
         if ($old_share['title'] != $data['title']) {
             FS("Topic")->updateTopicRec($data['rec_id'], $data['title']);
         }
         FS("Topic")->updateTopicCache($data['rec_id']);
         break;
     case 'bar_post':
         if ($old_share['content'] != $data['content']) {
             FDB::update('forum_post', $rec_data, "share_id = '{$share_id}'");
         }
         break;
     case 'ershou':
         $rec_data1 = array();
         $rec_data1['name'] = $data['title'];
         $rec_data1['content'] = $data['content'];
         FDB::update('second_goods', $rec_data1, "share_id = '{$share_id}'");
         break;
 }
 $tags = $_FANWE['request']['tags'];
 $tags = explode(" ", $tags);
 FS('Share')->updateShareTags($share_id, array('user' => implode(' ', $tags)));
 //更新喜欢统计
 FDB::query("UPDATE " . FDB::table("share") . " set collect_count = (select count(*) from " . FDB::table("user_collect") . " where share_id = '" . $share_id . "' ) where share_id = '" . $share_id . "'");
 //更新评论统计
 FDB::query("UPDATE " . FDB::table("share") . " set comment_count = (select count(*) from " . FDB::table("share_comment") . " where share_id = '" . $share_id . "' ) where share_id = '" . $share_id . "'");
 //更新分类
 $cates_arr = explode(",", $_FANWE['request']['share_cates']);
 foreach ($cates_arr as $k => $v) {
     $cates[] = intval($v);
 }
 FDB::query("delete from " . FDB::table("share_category") . " where share_id = " . $share_id);
예제 #23
0
}
$share_id = $old['share_id'];
$update = array('title' => htmlspecialchars(trim($_FANWE['request']['title'])), 'content' => htmlspecialchars(trim($_FANWE['request']['content'])), 'cid' => (int) $_FANWE['request']['cid'], 'show_type' => (int) $_FANWE['request']['show_type'], 'is_flash' => $is_flash, 'is_best' => $is_best);
if ($is_flash == 1) {
    $img = FS("Image")->save('flash_img', 'album');
    if ($img) {
        $update['flash_img'] = $img['url'];
    }
}
if ($is_best == 1) {
    $img = FS("Image")->save('best_img', 'album');
    if ($img) {
        $update['best_img'] = $img['url'];
    }
}
$tags = str_replace('***', '', $_FANWE['request']['tags']);
$tags = str_replace(' ', ' ', $tags);
$tags = explode(' ', $tags);
$tags = array_unique($tags);
$update['tags'] = implode(' ', $tags);
FDB::update('album', $update, 'id = ' . $id);
FS('Share')->updateShare($share_id, $update['title'], $update['content']);
FS("Album")->saveTags($id, $tags);
if ($update['cid'] != $old['cid']) {
    FDB::query('UPDATE ' . FDB::table("album_share") . ' SET cid = ' . $update['cid'] . ' WHERE album_id = ' . $id);
}
createManageLog('album', 'edit', $id, lang('manage', 'manage_edit_success'));
deleteManageLock('album', $id);
$msg = lang('manage', 'manage_edit_success');
include template('manage/tooltip');
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);
        }
    }
예제 #25
0
<?php

$id = intval($_FANWE['request']['id']);
if ($id == 0) {
    exit;
}
if (!checkAuthority('second', 'edit')) {
    exit;
}
$manage_lock = checkIsManageLock('second', $id);
if ($manage_lock !== false) {
    exit;
}
$sql = "select * from " . FDB::table("second_goods") . " where gid = " . $id;
$old = FDB::fetchFirst($sql);
if (empty($old)) {
    deleteManageLock('second', $id);
    exit;
}
$share_id = $old['share_id'];
$update = array('name' => htmlspecialchars(trim($_FANWE['request']['name'])), 'content' => htmlspecialchars(trim($_FANWE['request']['content'])), 'sid' => (int) $_FANWE['request']['cid'], 'city_id' => (int) $_FANWE['request']['city_id'], 'num' => (int) $_FANWE['request']['num'], 'price' => (double) $_FANWE['request']['price'], 'transport_fee' => (double) $_FANWE['request']['transport_fee'], 'valid_time' => str2Time($_FANWE['request']['valid_time']));
FDB::update('second_goods', $update, 'gid = ' . $id);
FS('Share')->updateShare($share_id, $update['title'], $update['content']);
createManageLog('second', 'edit', $id, lang('manage', 'manage_edit_success'));
deleteManageLock('second', $id);
$msg = lang('manage', 'manage_edit_success');
include template('manage/tooltip');
display();