public function run() { global $_FANWE; $root = array(); $root['return'] = 0; FanweService::instance()->cache->loadCache(array('mindex', 'madv')); $advs = $_FANWE['cache']['madv']['index']; if ($advs) { foreach ($advs as $adv) { $adv['img'] = FS("Image")->getImageUrl($adv['img'], 2); if ($adv['type'] == 1) { $tag_count = count($adv['data']['tags']); unset($adv['data']); $adv['data']['count'] = $tag_count; } elseif ($adv['type'] != 2 && $adv['type'] != 8) { unset($adv['data']); } unset($adv['sort'], $adv['status'], $adv['page']); $root['advs'][] = $adv; } } foreach ($_FANWE['cache']['mindex'] as $index) { $index['img'] = FS("Image")->getImageUrl($index['img'], 2); if ($index['type'] == 1) { $tag_count = count($index['data']['tags']); unset($index['data']); $index['data']['count'] = $tag_count; } elseif ($index['type'] != 2 && $index['type'] != 8) { unset($index['data']); } unset($index['sort'], $index['status']); $root['indexs'][] = $index; } m_display($root); }
public function run() { global $_FANWE; $root = array(); $root['return'] = 1; //未登陆直接退出 if ($_FANWE['uid'] == 0) { $root['status'] = -1; m_display($root); } $uid = (int) $_FANWE['requestData']['uid']; //没有关注的会员编号直接退出 if ($uid == 0) { $root['status'] = -2; m_display($root); } //没有会员直接退出 if (!FS('User')->getUserExists($uid)) { $root['status'] = -3; m_display($root); } if (FS('User')->followUser($uid)) { $root['is_follow'] = 1; } else { $root['is_follow'] = 0; } $root['status'] = 1; m_display($root); }
public function run() { global $_FANWE; $root = array(); $root['return'] = 1; $share_id = (int) $_FANWE['requestData']['share_id']; $page = (int) $_FANWE['requestData']['page']; $page = max(1, $page); $sql_count = "SELECT COUNT(DISTINCT comment_id) FROM " . FDB::table("share_comment") . " WHERE share_id = " . $share_id; $total = FDB::resultFirst($sql_count); $page_size = PAGE_SIZE; $page_total = ceil($total / $page_size); if ($page > $page_total) { $page = $page_total; } $limit = ($page - 1) * $page_size . "," . $page_size; $sql = 'SELECT c.*,u.user_name,u.server_code FROM ' . FDB::table('share_comment') . ' AS c INNER JOIN ' . FDB::table('user') . ' AS u ON u.uid = c.uid WHERE c.share_id = ' . $share_id . ' ORDER BY c.comment_id DESC LIMIT ' . $limit; $res = FDB::query($sql); $list = array(); while ($item = FDB::fetch($res)) { $item['user_avatar'] = avatar($item['uid'], 'm', $item['server_code'], 1, true); $item['time'] = getBeforeTimelag($item['create_time']); m_express(&$item, $item['content']); $list[] = $item; } $root['item'] = $list; $root['page'] = array("page" => $page, "page_total" => $page_total); m_display($root); }
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); }
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); }
public function run() { global $_FANWE; $root = array(); $root['return'] = 0; $data = array('email' => $_FANWE['requestData']['email'], 'user_name' => $_FANWE['requestData']['user_name'], 'password' => $_FANWE['requestData']['password'], 'gender' => intval($_FANWE['requestData']['gender'])); $vservice = FS('Validate'); $validate = array(array('email', 'required', lang('user', 'register_email_require')), array('email', 'email', lang('user', 'register_email_error')), array('user_name', 'required', lang('user', 'register_user_name_require')), array('user_name', 'range_length', lang('user', 'register_user_name_len'), 2, 20), array('user_name', '/^[\\x{4e00}-\\x{9fa5}a-zA-Z][\\x{4e00}-\\x{9fa5}a-zA-Z0-9]+$/u', lang('user', 'register_user_name_error')), array('password', 'range_length', lang('user', 'register_password_range'), 6, 20)); if (!$vservice->validation($validate, $data)) { $root['info'] = "注册失败:" . $vservice->getError(); m_display($root); } $uservice = FS('User'); if ($uservice->getEmailExists($data['email'])) { $root['info'] = "注册失败:" . lang('user', 'register_email_exist'); m_display($root); } if ($uservice->getUserNameExists($data['user_name'])) { $root['info'] = "注册失败:" . lang('user', 'register_user_name_exist'); m_display($root); } //================add by chenfq 2011-10-14 ======================= $user_field = $_FANWE['setting']['integrate_field_id']; $integrate_id = FS("Integrate")->addUser($data['user_name'], $data['password'], $data['email']); if ($integrate_id < 0) { $info = FS("Integrate")->getInfo(); $root['info'] = "注册失败:" . $info; m_display($root); } //================add by chenfq 2011-10-14======================= $user = array('email' => $data['email'], 'user_name' => $data['user_name'], 'user_name_match' => segmentToUnicode($data['user_name']), 'password' => md5($data['password']), 'status' => 1, 'email_status' => 0, 'avatar_status' => 0, 'gid' => 7, 'invite_id' => FS('User')->getReferrals(), 'reg_time' => TIME_UTC, $user_field => $integrate_id); $uid = FDB::insert('user', $user, true); if ($uid > 0) { $_FANWE['uid'] = $uid; FDB::insert('user_count', array('uid' => $uid)); if ($user['invite_id'] > 0) { FS('User')->insertReferral($uid, $user['invite_id'], $user['user_name']); } FS("User")->updateUserScore($uid, 'user', 'register'); unset($user); $user_profile = array('uid' => $uid, 'gender' => $data['gender']); FDB::insert('user_profile', $user_profile); unset($user_profile); $user_status = array('uid' => $uid, 'reg_ip' => $_FANWE['client_ip'], 'last_ip' => $_FANWE['client_ip'], 'last_time' => TIME_UTC, 'last_activity' => TIME_UTC); FDB::insert('user_status', $user_status); $root['return'] = 1; $root['info'] = "用户注册成功"; $root['uid'] = $uid; $root['user_name'] = $data['user_name']; $root['user_avatar'] = avatar($uid, 'm', '', 1, true); $root['user_email'] = $data['email']; $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'] = lang('user', 'register_error'); } m_display($root); }
public function run() { global $_FANWE; $root = array(); $root['return'] = 1; $root['newslist'] = $_FANWE['MConfig']['newslist']; m_display($root); }
public function run() { global $_FANWE; $root = array(); $root['return'] = 1; $is_hot = (int) $_FANWE['requestData']['is_hot']; $is_new = (int) $_FANWE['requestData']['is_new']; $page = (int) $_FANWE['requestData']['page']; $page = max(1, $page); $today_time = getTodayTime(); $field = ''; $whrer = ''; $book_photo_goods = (int) $_FANWE['setting']['book_photo_goods']; if ($book_photo_goods == 0) { $whrer = " WHERE share_data IN ('goods','photo','goods_photo')"; } elseif ($book_photo_goods == 1) { $whrer = " WHERE share_data IN ('photo','goods_photo')"; } elseif ($book_photo_goods == 2) { $whrer = " WHERE share_data IN ('goods','goods_photo')"; } if ($is_hot == 1) { $day7_time = $today_time - 604800; $field = ",(create_time > {$day7_time}) AS time_sort "; $sort = " ORDER BY time_sort DESC,collect_count DESC"; } if ($is_new == 1) { $sort = " ORDER BY share_id DESC"; } $sql_count = "SELECT COUNT(DISTINCT share_id) FROM " . FDB::table("share"); $total = FDB::resultFirst($sql_count); $page_size = PAGE_SIZE; $max_page = 100; if ($total > $max_page * $page_size) { $total = $max_page * $page_size; } if ($page > $max_page) { $page = $max_page; } $page_total = ceil($total / $page_size); $limit = ($page - 1) * $page_size . "," . $page_size; $sql = 'SELECT DISTINCT(share_id),cache_data ' . $field . ' FROM ' . FDB::table('share') . $whrer . $sort . ' LIMIT ' . $limit; $res = FDB::query($sql); $share_list = array(); while ($item = FDB::fetch($res)) { $cache_data = fStripslashes(unserialize($item['cache_data'])); $img = current($cache_data['imgs']['all']); $data = array(); $data['share_id'] = $item['share_id']; $data['img'] = getImgName($img['img'], 100, 999, 0, true); $data['height'] = $img['height'] * (100 / $img['width']); $share_list[] = $data; } $root['item'] = $share_list; $root['page'] = array("page" => $page, "page_total" => $page_total); m_display($root); }
public function run() { global $_FANWE; $root = array(); $root['return'] = 0; $uid = (int) $_FANWE['requestData']['uid']; $cid = (int) $_FANWE['requestData']['cid']; $album_title = trim($_FANWE['requestData']['title']); $data = array('title' => $album_title, 'cid' => $cid); $vservice = FS('Validate'); $validate = array(array('title', 'required', lang('album', 'name_require')), array('title', 'max_length', lang('album', 'name_max'), 60), array('cid', 'min', lang('album', 'cid_min'), 1)); if (!$vservice->validation($validate, $data)) { $root['info'] = $vservice->getError(); m_display($root); } $check_result = FS('Share')->checkWord($album_title, 'title'); if ($check_result['error_code'] == 1) { $root['info'] = $check_result['error_msg']; m_display($root); } if ($uid > 0) { if (!FS('User')->getUserExists($uid)) { $uid = 0; } } if ($cid == 0) { $uid == 0; } if ($uid == 0) { $root['info'] = "请先登录"; m_display($root); } $share_data = array(); $share_data['uid'] = $uid; $share_data['type'] = 'album'; $share_data['content'] = $album_title; $share = FS('Share')->submit($share_data, false, true, true); if ($share['status']) { $data = array(); $data['title'] = htmlspecialchars($album_title); $data['album_title_match'] = segmentToUnicode(clearSymbol($album_title)); $data['uid'] = $uid; $data['cid'] = $cid; $data['share_id'] = $share['share_id']; $data['create_day'] = getTodayTime(); $data['create_time'] = TIME_UTC; $data['show_type'] = 2; $aid = FDB::insert('album', $data, true); 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 = " . $uid); $root['aid'] = $aid; $root['album_name'] = $album_title; $root['return'] = 1; } m_display($root); }
public function run() { global $_FANWE; $root = array(); $root['return'] = 0; $uid = (int) $_FANWE['requestData']['uid']; if ($uid > 0) { if (!FS('User')->getUserExists($uid)) { $uid = 0; } } if ($uid == 0) { $uid = $_FANWE['uid']; $root['home_user'] = $_FANWE['user']; } if ($uid == 0) { $root['info'] = "请选择要查看的会员"; m_display($root); } if (!isset($root['home_user'])) { $root['home_user'] = FS("User")->getUserById($uid); unset($root['home_user']['user_name_match'], $root['home_user']['password'], $root['home_user']['active_hash'], $root['home_user']['reset_hash']); $root['home_user']['user_avatar'] = avatar($uid, 'm', $root['home_user']['server_code'], 1, true); } $page = (int) $_FANWE['requestData']['page']; $page = max(1, $page); $is_spare_flow = (int) $_FANWE['requestData']['is_spare_flow']; $img_size = 200; $scale = 2; if ($is_spare_flow == 1) { $img_size = 100; $scale = 1; } $total = FDB::resultFirst('SELECT COUNT(photo_id) FROM ' . FDB::table('share_photo') . ' WHERE uid = ' . $uid); $page_size = 20; //PAGE_SIZE; $page_total = max(1, ceil($total / $page_size)); if ($page > $page_total) { $page = $page_total; } $limit = ($page - 1) * $page_size . "," . $page_size; $photo_list = array(); $res = FDB::query('SELECT photo_id,share_id,img FROM ' . FDB::table('share_photo') . ' WHERE uid = ' . $uid . ' ORDER BY photo_id DESC LIMIT ' . $limit); while ($photo = FDB::fetch($res)) { $photo['img'] = getImgName($photo['img'], $img_size, $img_size, 1, true); $photo['height'] = round($img_size / $scale); $photo['url'] = FU('note/m', array('sid' => $photo['share_id'], 'id' => $photo['photo_id']), true); $photo_list[] = $photo; } $root['return'] = 1; $root['item'] = $photo_list; $root['page'] = array("page" => $page, "page_total" => $page_total); m_display($root); }
public function run() { global $_FANWE; $root = array(); $root['return'] = 1; $key = 'm/sharecate'; $cache_list = getCache($key); if ($cache_list !== NULL || TIME_UTC - $cache_list['cache_time'] > 600) { $cate_list = array(); $min_time = $this->getQuarterMinTime(); $max_time = getTodayTime(); FanweService::instance()->cache->loadCache('albums'); $album_cate = $_FANWE['cache']['albums']['category']; foreach ($album_cate as $k => $v) { $cate = array(); $cate['cate_id'] = $v['id']; $cate['cate_name'] = $v['name']; $cate['short_name'] = $v['name']; $cate['cate_code'] = $v['cate_code']; $cate['cate_icon'] = FS("Image")->getImageUrl($v['img'], 2); $cate['desc'] = $v['desc']; $cate['create_time'] = $v['create_time']; //获取本季分享数量 $share_count_sql = 'select count(DISTINCT s.share_id) from ' . FDB::table("share") . ' as s INNER JOIN ' . FDB::table("album_share") . ' as al on s.share_id = al.share_id where al.cid = ' . $v['id'] . " and s.day_time >= {$min_time} AND s.day_time <= {$max_time} "; $cate['share_count'] = FDB::resultFirst($share_count_sql); $cate['img_tags'] = array(); $img_size = 320; $sql = 'select s.share_id,al.title,sp.img from ' . FDB::table("share") . ' as s INNER JOIN ' . FDB::table("album_share") . ' as als ON s.share_id = als.share_id INNER JOIN ' . FDB::table("album") . ' as al ON als.album_id = al.id INNER JOIN ' . FDB::table("share_photo") . " as sp ON s.share_id = sp.share_id \r\n\t\t\t\t\tWHERE s.day_time >= {$min_time} AND s.day_time <= {$max_time} AND als.cid = " . $v['id'] . " GROUP BY s.share_id ORDER BY s.share_id desc limit 5"; $res = FDB::query($sql); while ($data = FDB::fetch($res)) { $img_data = array(); $img_data['share_id'] = $data['share_id']; $img_data['tag_name'] = $data['title']; $img_data['is_tag'] = 0; $img_data['img'] = FS("Image")->getImageUrl(getImgName($data['img'], $img_size, $img_size, 1, true), 2); $img_data['url_tag'] = urlencode($data['title']); $cate['img_tags'][] = $img_data; $img_size = 160; } $cate['txt_tags'] = array(); $cate_list[] = $cate; } $cache_list = array(); $cache_list['cate_list'] = $cate_list; $cache_list['cache_time'] = TIME_UTC; setCache($key, $cache_list); } else { $cate_list = $cache_list['cate_list']; } $root['item'] = $cate_list; m_display($root); }
public function run() { global $_FANWE; $root = array(); $root['return'] = 0; if ($_FANWE['uid'] == 0) { $root['info'] = "请先登陆"; m_display($root); } if (isset($_FILES['image_1'])) { if ($img = FS("Image")->save('image_1')) { if (FS("Image")->getIsServer()) { $server = FS("Image")->getServer(); $args = array(); $args['pic_url'] = FS("Image")->getImageUrl($img['url'], 2); $server = FS("Image")->getImageUrlToken($args, $server, 1); $body = FS("Image")->sendRequest($server, 'uploadtemp', true); if (!empty($body)) { $img = unserialize($body); $server = FS("Image")->getServer($img['server_code']); if (!empty($server)) { $args = array(); $args['pic_url'] = $img['path']; $args['types'] = array('small' => '32', 'middle' => '64', 'big' => '160'); $server = FS("Image")->getImageUrlToken($args, $server, 1); $body = FS("Image")->sendRequest($server, 'saveavatar', true); if (!empty($body)) { $avatar = unserialize($body); FS("Image")->setServerUploadCount($avatar['server_code']); FS('User')->updateAvatar($_FANWE['uid'], $avatar['server_code']); } } $root['user_avatar'] = avatar($_FANWE['uid'], 'm', $avatar['server_code'], 1, true); } else { $root['info'] = "上传图片失败"; m_display($root); } } else { FS('User')->saveAvatar($_FANWE['uid'], $img['path']); $root['user_avatar'] = avatar($_FANWE['uid'], 'm', '', 1, true); } } else { $root['info'] = "上传图片失败"; m_display($root); } } else { $root['info'] = "请上传图片"; m_display($root); } $root['return'] = 1; m_display($root); }
public function run() { global $_FANWE; $root = array(); $root['return'] = 1; $list = array(); FanweService::instance()->cache->loadCache('msearchcate'); foreach ($_FANWE['cache']['msearchcate'] as $cate) { $cate['bg'] = FS("Image")->getImageUrl($cate['bg'], 2); $list[] = $cate; } $root['item'] = $list; m_display($root); }
public function run() { global $_FANWE; $root = array(); $root['return'] = 1; $page = (int) $_FANWE['requestData']['page']; $page = max(1, $page); $total = FDB::resultFirst('SELECT COUNT(id) FROM ' . FDB::table('user_daren') . ' WHERE status = 1'); $page_size = PAGE_SIZE; $page_total = max(1, ceil($total / $page_size)); if ($page > $page_total) { $page = $page_total; } $limit = ($page - 1) * $page_size . "," . $page_size; $user_follows = array(); $res = FDB::query('SELECT u.uid,u.user_name,u.server_code,uc.fans,ud.reason,up.introduce FROM ' . FDB::table('user_daren') . ' AS ud INNER JOIN ' . FDB::table('user') . ' AS u ON u.uid = ud.uid INNER JOIN ' . FDB::table('user_count') . ' AS uc ON uc.uid = ud.uid INNER JOIN ' . FDB::table('user_profile') . ' AS up ON up.uid = ud.uid WHERE ud.status = 1 ORDER BY ud.id DESC LIMIT ' . $limit); while ($data = FDB::fetch($res)) { $data['user_avatar'] = avatar($data['uid'], 'm', $data['server_code'], 1, true); $data['desc'] = $data['introduce']; if (!empty($data['reason'])) { $data['desc'] = $data['reason']; } unset($data['server_code'], $data['introduce'], $data['reason']); if ($data['uid'] == $_FANWE['uid']) { $data['is_follow'] = -1; } else { $user_follows[$data['uid']] = 0; $data['is_follow'] = 0; } $user_list[$data['uid']] = $data; } $uids = array_keys($user_follows); $uids = implode(',', $uids); $uids = str_replace(',,', ',', $uids); if (!empty($uids)) { $res = FDB::query("SELECT uid FROM " . FDB::table('user_follow') . ' WHERE f_uid = ' . $_FANWE['uid'] . ' AND uid IN (' . $uids . ')'); while ($item = FDB::fetch($res)) { $user_list[$item['uid']]['is_follow'] = 1; } } $root['item'] = array_slice($user_list, 0); $root['page'] = array("page" => $page, "page_total" => $page_total); m_display($root); }
public function run() { global $_FANWE; $root = array(); $root['serverVersion'] = $_FANWE['MConfig']['version']; $root['filename'] = $_FANWE['site_url'] . $_FANWE['MConfig']['filename']; if (file_exists(APP_ROOT_PATH . $_FANWE['MConfig']['filename'])) { $root['hasfile'] = 1; } else { $root['hasfile'] = 0; } $root['filesize'] = filesize(APP_ROOT_PATH . $_FANWE['MConfig']['filename']); m_display($root); }
public function run() { global $_FANWE; $root = array(); $root['return'] = 0; $uid = $_FANWE['uid']; if ($uid == 0) { $root['info'] = "请先登陆"; m_display($root); } $root['home_user'] = $_FANWE['user']; $page = (int) $_FANWE['requestData']['page']; $page = max(1, $page); $uids = array(); //获取我关注的会员编号 $sql = 'SELECT uid FROM ' . FDB::table('user_follow') . ' WHERE f_uid = ' . $uid; $res = FDB::query($sql); while ($data = FDB::fetch($res)) { $uids[] = (int) $data['uid']; } if (count($uids) > 0) { $sql = 'SELECT COUNT(share_id) FROM ' . FDB::table("share") . ' WHERE uid IN (' . implode(',', $uids) . ')'; $total = FDB::resultFirst($sql); $page_size = PAGE_SIZE; $page_total = max(1, ceil($total / $page_size)); if ($page > $page_total) { $page = $page_total; } $limit = ($page - 1) * $page_size . "," . $page_size; $share_list = array(); $sql = 'SELECT * FROM ' . FDB::table("share") . ' WHERE uid IN (' . implode(',', $uids) . ') ORDER BY share_id DESC LIMIT ' . $limit; $share_list = FDB::fetchAll($sql); $share_list = mGetShareDetailList($share_list, true); } else { $page_total = 0; $share_list = array(); } $root['return'] = 1; if (count($share_list) > 0) { $root['item'] = array_slice($share_list, 0); } else { $root['item'] = array(); } $root['page'] = array("page" => $page, "page_total" => $page_total); m_display($root); }
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); }
public function run() { global $_FANWE; $root = array(); $root['return'] = 0; $uid = $_FANWE['uid']; if ($uid == 0) { $root['info'] = "请先登陆"; m_display($root); } $root['home_user'] = $_FANWE['user']; FDB::query("DELETE FROM " . FDB::table('user_notice') . " WHERE uid='{$uid}' AND type=3"); $page = (int) $_FANWE['requestData']['page']; $page = max(1, $page); $sql = 'SELECT COUNT(sc.comment_id) FROM ' . FDB::table("share") . ' AS s INNER JOIN ' . FDB::table("share_comment") . ' AS sc ON sc.share_id = s.share_id WHERE s.uid = ' . $uid; $total = FDB::resultFirst($sql); $page_size = PAGE_SIZE; $page_total = max(1, ceil($total / $page_size)); if ($page > $page_total) { $page = $page_total; } $limit = ($page - 1) * $page_size . "," . $page_size; $comment_list = array(); $sql = 'SELECT sc.*,s.content as scontent,u.user_name,u.server_code FROM ' . FDB::table("share") . ' AS s INNER JOIN ' . FDB::table("share_comment") . ' AS sc ON sc.share_id = s.share_id INNER JOIN ' . FDB::table("user") . ' AS u ON u.uid = sc.uid WHERE s.uid = ' . $uid . ' ORDER BY comment_id DESC LIMIT ' . $limit; $res = FDB::query($sql); while ($data = FDB::fetch($res)) { $data['user_avatar'] = FS("Image")->getImageUrl('.' . avatar($data['uid'], 'm', 1), 2); $data['time'] = getBeforeTimelag($data['create_time']); $data['url'] = FU('note/index', array('sid' => $data['share_id']), true); m_express(&$data, $data['content'] . $data['scontent']); $comment_list[] = $data; } $root['return'] = 1; $root['item'] = $comment_list; $root['page'] = array("page" => $page, "page_total" => $page_total); m_display($root); }
public function run() { global $_FANWE; $root = array(); $root['return'] = 0; if ($_FANWE['uid'] == 0) { exit; } $_FANWE['requestData']['uid'] = $_FANWE['uid']; if (isset($_FILES['image_1'])) { if ($img = FS("Image")->save('image_1')) { if (FS("Image")->getIsServer()) { $server = FS("Image")->getServer(); $args = array(); $args['pic_url'] = FS("Image")->getImageUrl($img['url'], 2); $server = FS("Image")->getImageUrlToken($args, $server, 1); $body = FS("Image")->sendRequest($server, 'uploadtemp', true); if (!empty($body)) { $img = unserialize($body); $info = array('path' => $img['path'], 'type' => $_FANWE['requestData']['cate_type'], 'server_code' => $img['server_code']); } } else { $info = array('path' => $img['path'], 'type' => $_FANWE['requestData']['cate_type'], 'server_code' => ''); } $info = authcode(serialize($info), 'ENCODE'); $_FANWE['requestData']['pics'][] = $info; } else { $root['info'] = "上传图片失败"; m_display($root); } } $share = FS('Share')->submit($_FANWE['requestData'], true, true); if ($share['status']) { $root['return'] = 1; $root['info'] = "发表分享成功"; } else { $root['info'] = "发表分享失败"; if (!empty($share['error_msg'])) { $root['info'] = $share['error_msg']; } } m_display($root); }
public function run() { global $_FANWE; $root = array(); $root['return'] = 0; $uid = $_FANWE['uid']; if ($uid == 0) { $root['info'] = "请先登陆"; m_display($root); } $root['home_user'] = $_FANWE['user']; FDB::query("DELETE FROM " . FDB::table('user_notice') . " WHERE uid='{$uid}' AND type=4"); $page = (int) $_FANWE['requestData']['page']; $page = max(1, $page); $sql = 'SELECT COUNT(*) FROM ' . FDB::table("share") . ' AS s LEFT JOIN ' . FDB::table("atme") . ' as a on a.share_id=s.share_id WHERE a.uid = ' . $uid . ' and s.uid <> ' . $uid . ' and s.type<>\'fav\' '; $total = FDB::resultFirst($sql); $page_size = PAGE_SIZE; $page_total = max(1, ceil($total / $page_size)); if ($page > $page_total) { $page = $page_total; } $limit = ($page - 1) * $page_size . "," . $page_size; $share_list = array(); $sql = 'SELECT s.* FROM ' . FDB::table("share") . ' AS s LEFT JOIN ' . FDB::table("atme") . ' as a on a.share_id=s.share_id WHERE a.uid = ' . $uid . ' and s.uid <> ' . $uid . ' and s.type<>\'fav\' ORDER BY s.share_id DESC LIMIT ' . $limit; $share_list = FDB::fetchAll($sql); $share_list = mGetShareDetailList($share_list, true); $root['return'] = 1; if (count($share_list) > 0) { $root['item'] = array_slice($share_list, 0); } else { $root['item'] = array(); } $root['page'] = array("page" => $page, "page_total" => $page_total); m_display($root); }
public function run() { global $_FANWE; $root = array(); $root['return'] = 1; $city_id = intval($_FANWE['requestData']['city_id']); $quan_id = intval($_FANWE['requestData']['quan_id']); $cate_id = intval($_FANWE['requestData']['cate_id']); $page = intval($_FANWE['requestData']['page']); //分页 $page = $page == 0 ? 1 : $page; $page_size = PAGE_SIZE; $limit = ($page - 1) * $page_size . "," . $page_size; $sql_count = "select count(*) from " . FDB::table("merchant_youhui"); $sql = "select id,merchant_id,title,content,merchant_logo,create_time,merchant_xpoint,merchant_ypoint,merchant_api_address,image_1 from " . FDB::table("merchant_youhui"); $now = TIME_UTC; $where = "1 = 1 and status = 1 and begin_time<" . $now . " and (end_time = 0 or end_time > " . $now . ")"; if ($city_id > 0) { $where .= " and merchant_city_id = {$city_id}"; } if ($quan_id > 0) { $where .= " and merchant_quan_id = {$quan_id}"; } if ($cate_id > 0) { $where .= " and merchant_category_id = {$cate_id}"; } $sql_count .= " where " . $where; $sql .= " where " . $where; $sql .= " limit " . $limit; //echo $sql; exit; $total = FDB::resultFirst($sql_count); $page_total = ceil($total / $page_size); $list = FDB::fetchAll($sql); $youhui_list = array(); foreach ($list as $item) { $youhui_list[] = m_youhuiItem($item); } $root['item'] = $youhui_list; $root['page'] = array("page" => $page, "page_total" => $page_total); m_display($root); }
public function run() { global $_FANWE; $root = array(); $root['return'] = 1; $uid = (int) $_FANWE['requestData']['uid']; $cid = (int) $_FANWE['requestData']['cid']; if ($uid > 0) { if (!FS('User')->getUserExists($uid)) { $uid = 0; } } if ($cid == 0) { $uid == 0; } if ($uid == 0) { $root['info'] = "请先登录"; m_display($root); } $key = 'm/useralbum' . $uid . $cid; $album_list = getCache($key); if ($album_list !== NULL || TIME_UTC - $cache_list['cache_time'] > 600) { $album_list = array(); $sql = 'select id,title from ' . FDB::table('album') . " where cid = " . $cid . " and uid = " . $uid; $res = FDB::query($sql); $indx = 0; while ($data = FDB::fetch($res)) { $album_list[$indx] = $data; $indx++; } $cache_list = array(); $cache_list['album_list'] = $album_list; $cache_list['cache_time'] = TIME_UTC; setCache($key, $cache_list); } else { $album_list = $cache_list['album_list']; } $root['item'] = $album_list; m_display($root); }
public function run() { global $_FANWE; $root = array(); $root['return'] = 1; //未登陆直接退出 if ($_FANWE['uid'] == 0) { $root['status'] = -1; m_display($root); } $share_id = (int) $_FANWE['requestData']['share_id']; //没有分享ID直接退出 if ($share_id == 0) { $root['status'] = -2; m_display($root); } $share = FS('Share')->getShareById($share_id); //没有分享直接退出 if (empty($share)) { $root['status'] = -3; m_display($root); } $check_result = FS('Share')->checkWord($_FANWE['requestData']['content'], 'content'); if ($check_result['error_code'] == 1) { $root['status'] = -4; $root['error'] = $check_result['error_msg']; m_display($root); } $comment_id = FS('Share')->saveComment($_FANWE['requestData']); $comment = FS('Share')->getShareComment($comment_id); $comment['time'] = getBeforeTimelag($comment['create_time']); $parses = m_express(&$item['content']); $comment['parse_users'] = $parses['users']; $comment['parse_events'] = $parses['events']; $comment['user_name'] = $_FANWE['user_name']; $comment['user_avatar'] = $_FANWE['user_avatar']; $root['status'] = 1; $root['item'] = $comment; m_display($root); }
public function run() { global $_FANWE; $root = array(); $root['return'] = 0; if ($_FANWE['uid'] == 0) { $root['info'] = "请先登陆"; m_display($root); } $user_name = trim($_FANWE['requestData']['user_name']); if (empty($user_name)) { $root['info'] = "请选择要发送信件的粉丝"; m_display($root); } $message = trim($_FANWE['requestData']['message']); if (empty($message)) { $root['info'] = "请输入要发送信息"; m_display($root); } //echo $user_name; exit; $user = FS('User')->getUsersByName($user_name); if (empty($user)) { $root['info'] = "请选择要发送信件的粉丝"; m_display($root); } if (!FS('User')->getIsFollowUId2($user['uid'], $_FANWE['uid'])) { $root['info'] = "只能给粉丝发送信件"; m_display($root); } $message = cutStr($message, 200); if (FS('Message')->sendMsg($_FANWE['uid'], $_FANWE['user_name'], array($user['uid']), '', $message) > 0) { $root['return'] = 1; $root['info'] = "发送信件成功"; } else { $root['info'] = "发送信件失败"; } m_display($root); }
public function run() { global $_FANWE; $root = array(); $root['return'] = 1; $email = $_FANWE['requestData']['email']; $pwd = $_FANWE['requestData']['pwd']; $uid = intval(FDB::resultFirst("select uid from " . FDB::table("user") . " where user_name='" . $email . "' and password = '******'")); $latitude = floatval($_FANWE['requestData']['latitude']); //ypoint $longitude = floatval($_FANWE['requestData']['longitude']); //xpoint if ($uid > 0 && $latitude > 0 && $longitude > 0) { $user_x_y_point = array('uid' => $uid, 'xpoint' => $longitude, 'ypoint' => $latitude, 'locate_time' => fGmtTime()); //$root['user_x_y_point'] = $user_x_y_point; $id = FDB::insert('user_x_y_point', $user_x_y_point, true); //FDB::lastSql(); $sql = "update " . FDB::table("user") . " set xpoint = {$longitude}, ypoint = {$latitude}, locate_time = " . fGmtTime() . " where uid = {$uid}"; //$root['sql'] = $sql; FDB::query($sql); } m_display($root); }
public function run() { global $_FANWE; $root = array(); $root['return'] = 1; //未登陆直接退出 if ($_FANWE['uid'] == 0) { $root['status'] = -1; m_display($root); } $share_id = (int) $_FANWE['requestData']['share_id']; //没有分享ID直接退出 if ($share_id == 0) { $root['status'] = -2; m_display($root); } $share = FS('Share')->getShareById($share_id); //没有分享直接退出 if (empty($share)) { $root['status'] = -3; m_display($root); } //不能喜欢自己发布的分享 if ($share['uid'] == $_FANWE['uid']) { $root['status'] = -4; m_display($root); } if (FS('Share')->getIsCollectByUid($share_id, $_FANWE['uid'])) { $root['is_collect'] = 0; FS('Share')->deleteShareCollectUser($share_id, $_FANWE['uid']); } else { $root['is_collect'] = 1; FS('Share')->saveFav($share); } $root['status'] = 1; m_display($root); }
public function run() { global $_FANWE; $root = array(); $root['return'] = 1; if ($_FANWE['uid'] == 0) { exit; } $uid = $_FANWE['uid']; $page = (int) $_FANWE['requestData']['page']; $page = max(1, $page); $total = FDB::resultFirst('SELECT COUNT(f_uid) FROM ' . FDB::table('user_follow') . ' WHERE uid = ' . $uid); $page_size = PAGE_SIZE; $page_total = max(1, ceil($total / $page_size)); if ($page > $page_total) { $page = $page_total; } $limit = ($page - 1) * $page_size . "," . $page_size; Cache::getInstance()->loadCache('citys'); $user_follows = array(); $res = FDB::query('SELECT u.uid,u.user_name,u.server_code,uc.fans,up.reside_province,up.reside_city,up.introduce 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 = ' . $uid . ' ORDER BY uf.create_time DESC LIMIT ' . $limit); while ($data = FDB::fetch($res)) { $data['reside_province'] = $_FANWE['cache']['citys']['all'][$data['reside_province']]['name']; $data['reside_city'] = $_FANWE['cache']['citys']['all'][$data['reside_city']]['name']; $data['user_avatar'] = avatar($data['uid'], 'm', $data['server_code'], 1, true); unset($data['server_code']); $user_list[$data['uid']] = $data; } $root['item'] = array_slice($user_list, 0); $root['page'] = array("page" => $page, "page_total" => $page_total); m_display($root); }
public function run() { global $_FANWE; $root = array(); $root['return'] = 1; if ($_FANWE['uid'] == 0) { exit; } //print_r($_FANWE['requestData']); exit; $mlid = (int) $_FANWE['requestData']['lid']; $mid = (int) $_FANWE['requestData']['mid']; if ($mlid == 0 && $mid == 0) { exit; } if ($mlid > 0) { $mlist = FS('Message')->getListByMlid($mlid, $_FANWE['uid']); if (empty($mlist)) { exit; } $act2 = $_FANWE['requestData']['act_2']; if ($act2 == 'reply') { $message = trim($_FANWE['requestData']['message']); if (!empty($message)) { $message = cutStr($message, 200); if (FS('Message')->replyMsg($mlid, $_FANWE['uid'], $_FANWE['user_name'], $message) > 0) { $mlist['num']++; } } } $root['lid'] = $mlid; $page = (int) $_FANWE['requestData']['page']; $page = max(1, $page); $total = $mlist['num']; $page_size = PAGE_SIZE; $page_total = max(1, ceil($total / $page_size)); if ($page > $page_total) { $page = $page_total; } $limit = ($page - 1) * $page_size . "," . $page_size; $root['page'] = array("page" => $page, "page_total" => $page_total); $tuser = FS('User')->getUserById($mlist['tuid']); $tuser['user_avatar'] = FS("Image")->getImageUrl('.' . avatar($tuser['uid'], 'm', 1), 2); //$root['title'] = "共有{$total}封与{$tuser['user_name']}的交流信件"; $root['title'] = "与{$tuser['user_name']}的交流"; $root['t_name'] = $tuser['user_name']; $msg_list = FS('Message')->getMsgsByMlid($mlid, $_FANWE['uid'], $limit); foreach ($msg_list as $msg) { if ($msg['uid'] == $_FANWE['uid']) { $user = $_FANWE['user']; $user['user_name'] = '我'; $msg['tuid'] = $mlist['tuid']; $msg['tuser_name'] = $tuser['user_name']; $msg['tuser_avatar'] = $tuser['user_avatar']; } else { $user = $tuser; $msg['tuid'] = $_FANWE['uid']; $msg['tuser_name'] = '我'; $msg['tuser_avatar'] = $_FANWE['user']['user_avatar']; } $msg['content'] = $msg['message']; $msg['user_name'] = $user['user_name']; $msg['user_avatar'] = $user['user_avatar']; m_express(&$msg, $msg['message']); $root['msg_list'][] = $msg; } } elseif ($mid) { $msg = FS('Message')->getSysMsgByMid($_FANWE['uid'], $mid); $msg['time'] = getBeforeTimelag($msg['dateline']); $msg['message'] = str_replace('href="/', 'href="' . $_FANWE['site_url'], $msg['message']); $root['msg'] = $msg; } m_display($root); }
public function run() { global $_FANWE; $root = array(); $root['return'] = 0; $uid = (int) $_FANWE['requestData']['uid']; if ($uid > 0) { if (!FS('User')->getUserExists($uid)) { $uid = 0; } } if ($uid == 0) { $uid = $_FANWE['uid']; $root['home_user'] = $_FANWE['user']; } if ($uid == 0) { $root['info'] = "请选择要查看的会员"; m_display($root); } if ($uid == $_FANWE['uid']) { FDB::query("DELETE FROM " . FDB::table('user_notice') . " WHERE uid='{$uid}' AND type=2"); } if (!isset($root['home_user'])) { $root['home_user'] = FS("User")->getUserById($uid); unset($root['home_user']['user_name_match'], $root['home_user']['password'], $root['home_user']['active_hash'], $root['home_user']['reset_hash']); $root['home_user']['user_avatar'] = FS("Image")->getImageUrl('.' . avatar($uid, 'm', 1), 2); } $page = (int) $_FANWE['requestData']['page']; $page = max(1, $page); $is_spare_flow = (int) $_FANWE['requestData']['is_spare_flow']; $img_width = 200; $max_height = 400; $scale = 2; if ($is_spare_flow == 1) { $img_width = 100; $scale = 1; } $sql = 'SELECT COUNT(DISTINCT share_id) FROM ' . FDB::table("user_collect") . ' WHERE c_uid = ' . $uid; $total = FDB::resultFirst($sql); $page_size = 20; //PAGE_SIZE; $page_total = max(1, ceil($total / $page_size)); if ($page > $page_total) { $page = $page_total; } $limit = ($page - 1) * $page_size . "," . $page_size; $sql = 'SELECT DISTINCT(s.share_id),s.cache_data,s.collect_count,s.comment_count,s.content,u.user_name,u.server_code FROM ' . FDB::table("user_collect") . ' AS uc INNER JOIN ' . FDB::table("share") . ' as s on s.share_id=uc.share_id INNER JOIN ' . FDB::table("user") . ' as u on u.uid=uc.uid WHERE uc.c_uid = ' . $uid . ' ORDER BY s.share_id DESC LIMIT ' . $limit; $res = FDB::query($sql); $share_list = array(); while ($data = FDB::fetch($res)) { $img_sql = 'select img,img_width,img_height from ' . FDB::table('share_photo') . " where share_id = " . $data['share_id']; $img_data = FDB::fetchFirst($img_sql); unset($data['cache_data']); $data['user_avatar'] = FS("Image")->getImageUrl('.' . avatar($data['uid'], 'm', 1), 2); $data['img'] = FS("Image")->getImageUrl(getImgName($img_data['img'], $img_width, $max_height, 2, true), 2); $data['big_img'] = FS("Image")->getImageUrl(getImgName($img_data['img'], 468, 468, 1, true), 2); $data['height'] = $img_data['img_height'] * ($img_width / $img_data['img_width']); $data['height'] = $data['height'] > $max_height ? $max_height : $data['height']; $data['height'] = round($data['height'] / $scale); $data['width'] = $img_data['img_width']; m_express(&$data, $data['content']); $share_list[] = $data; } $root['return'] = 1; $root['item'] = $share_list; $root['page'] = array("page" => $page, "page_total" => $page_total); m_display($root); }
public function run() { global $_FANWE; $root = array(); $root['return'] = 1; $uid = (int) $_FANWE['requestData']['uid']; if ($uid > 0) { if (!FS('User')->getUserExists($uid)) { $uid = 0; } } if ($uid == 0) { $uid = $_FANWE['uid']; $root['home_user'] = $_FANWE['user']; } if ($uid == 0) { $root['status'] = -1; m_display($root); } if (!isset($root['home_user'])) { $root['home_user'] = FS("User")->getUserById($uid); unset($root['home_user']['user_name_match'], $root['home_user']['password'], $root['home_user']['active_hash'], $root['home_user']['reset_hash']); $root['home_user']['user_avatar'] = FS("Image")->getImageUrl('.' . avatar($uid, 'm', 1), 2); } $page = (int) $_FANWE['requestData']['page']; $page = max(1, $page); $total = FDB::resultFirst('SELECT COUNT(f_uid) FROM ' . FDB::table('user_follow') . ' WHERE uid = ' . $uid); $page_size = PAGE_SIZE; $page_total = max(1, ceil($total / $page_size)); if ($page > $page_total) { $page = $page_total; } $limit = ($page - 1) * $page_size . "," . $page_size; Cache::getInstance()->loadCache('citys'); $user_follows = array(); $res = FDB::query('SELECT u.uid,u.user_name,u.server_code,uc.fans,up.reside_province,up.reside_city,up.introduce 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 = ' . $uid . ' ORDER BY uf.create_time DESC LIMIT ' . $limit); while ($data = FDB::fetch($res)) { $data['reside_province'] = $_FANWE['cache']['citys']['all'][$data['reside_province']]['name']; $data['reside_city'] = $_FANWE['cache']['citys']['all'][$data['reside_city']]['name']; $data['user_avatar'] = FS("Image")->getImageUrl('.' . avatar($data['uid'], 'm', 1), 2); unset($data['server_code']); if ($data['uid'] == $_FANWE['uid']) { $data['is_follow'] = -1; } else { $user_follows[$data['uid']] = 0; $data['is_follow'] = 0; } $user_list[$data['uid']] = $data; } $uids = array_keys($user_follows); $uids = implode(',', $uids); $uids = str_replace(',,', ',', $uids); if (!empty($uids)) { $res = FDB::query("SELECT uid FROM " . FDB::table('user_follow') . ' WHERE f_uid = ' . $_FANWE['uid'] . ' AND uid IN (' . $uids . ')'); while ($item = FDB::fetch($res)) { $user_list[$item['uid']]['is_follow'] = 1; } } $root['item'] = array_slice($user_list, 0); $root['page'] = array("page" => $page, "page_total" => $page_total); m_display($root); }