<?php /** * 根据type返回推荐信息,json格式 **/ $action = $_REQUEST['action'] ? jointFlushStr($_REQUEST['action']) : 'read'; $ids = $_REQUEST['ids'] ? jointFlushStr($_REQUEST['ids']) : ''; $uid = $_G['uid']; if ($action == 'read') { $ids = trim($ids, ','); $sql = "UPDATE `pre_jf_message` SET has_read=1 where user={$uid} AND id in({$ids})"; DB::query($sql); echo 'read'; } else { $ids = trim($ids, ','); $sql = "DELETE FROM `pre_jf_message` where user={$uid} AND id in({$ids})"; DB::query($sql); echo 'delete'; }
<?php /** * 根据type返回推荐信息,json格式 **/ $action = $_REQUEST['action'] ? jointFlushStr($_REQUEST['action']) : 'delete'; $tid = $_REQUEST['tid'] ? jointFlushStr($_REQUEST['tid']) : '0'; $uid = $_G['uid']; if ($action == 'delete') { $sql = "DELETE FROM `pre_forum_thread` WHERE tid={$tid} AND authorid={$uid}"; DB::query($sql); header("Location:/jointapp.php?app=appdiscuz&mod=mythread"); } else { echo 'unknow'; }
<?php /** * 20150928 * 用户参与的主题 */ $uid = is_numeric($_GET['uid']) ? jointFlushStr($_GET['uid']) : 1; if ($uid) { $user = getUserInfo($uid); // 查询我的回帖,并且不是我发的 $sql = "SELECT td.*,t.pid,f.name \r\n\tFROM pre_forum_post t \r\n\tLEFT JOIN pre_forum_thread td ON t.tid=td.tid\r\n\tLEFT JOIN pre_forum_forum f ON t.fid=f.fid \r\n\tWHERE t.authorid={$uid} AND t.invisible>-1 AND t.position>1 {$att_where} GROUP BY t.tid ORDER BY t.pid DESC LIMIT 0,40"; $re = DB::query($sql); $threads = array(); while ($data = mysql_fetch_assoc($re)) { $data['date'] = date("Y-m-d", $data['dateline']); $data['head'] = jointGetPhoto($data['authorid'], 1); $data['author'] = jointGetJfNiceByUsername($data['author']); $threads[] = $data; } } $uhome = $user['username']; include template('jointapp/upost');
<?php /** * 根据type返回推荐信息,json格式 **/ $action = $_REQUEST['action'] ? jointFlushStr($_REQUEST['action']) : 'follow'; $type = $_REQUEST['type'] ? jointFlushStr($_REQUEST['type']) : 'user'; $uid = jointFlushStr($_REQUEST['uid']); if ($action == 'follow') { $login_user = $_G['uid']; $time = time(); $sql_tmp = "INSERT INTO pre_jf_follow SET user_id={$login_user},relation_id={$uid},type='{$type}',time={$time};"; $data_tmp = DB::query($sql_tmp); setUserMessage($uid, 4, jointGetJfNiceByUsername($_G['username']), $_G['uid']); echo 'create'; } else { $login_user = $_G['uid']; $sql_tmp = "DELETE FROM pre_jf_follow WHERE user_id={$login_user} AND relation_id={$uid} AND type='{$type}'"; $data_tmp = DB::query($sql_tmp); echo 'delete'; }
<?php /** * 根据type返回推荐信息,json格式 **/ $type = jointFlushStr($_REQUEST['type']); // 得到所有的推荐数据 $arr = jointGetRecommenList($type); // 取出来有用的信息 $usearr = array(); foreach ($arr as $k => $v) { $data = array(); $data['title'] = $v['title']; $data['ctime'] = $v['oth_2']; $data['url'] = $cfg_siteurl . $v['url']; $usearr[] = $data; } $usestr = array_to_json($usearr); print_r($usestr); exit; function array_to_json($array) { if (!is_array($array)) { return false; } $associative = count(array_diff(array_keys($array), array_keys(array_keys($array)))); if ($associative) { $construct = array(); foreach ($array as $key => $value) { // We first copy each key/value pair into a staging array, // formatting each key and value properly as we go.
<?php /** * 20141202 * 查询我的主题,暂不分页 */ $email = $_G['member']['email']; $uid = $_G['uid']; $joint_fid = jointFlushStr($_GET['joint_fid']); $joint_type = jointFlushStr($_GET['joint_type']); $where = ''; if ($joint_fid == $cfg_support_d_fid[0]['fid'] || $joint_fid == $cfg_support_b_fid[0]['fid']) { // 如果是平台客服,则只显示平台客服的浏览记录 $where = " AND t.fid={$joint_fid} "; } elseif ($joint_type == 'b') { // 如果是B的论坛,则只显示B论坛的浏览记录 $in = ''; foreach ($cfg_nav_b as $k => $v) { $in .= $v['id'] . ','; } $in = trim($in, ','); $where = " AND t.fid in({$in}) "; } else { // 如果是B的论坛,则只显示B论坛的浏览记录 $in = ''; foreach ($cfg_nav_d as $k => $v) { $in .= $v['id'] . ','; } $in = trim($in, ','); $where = " AND t.fid in({$in}) "; }
<?php /** * 20141202 * 查询我的回复主题,暂不分页 */ // 判断 如果是论坛互动,就不显示平台客服的列表了,如果是品台客服,就只显示平台客服的列表 //$joint_type = jointFlushStr($_GET['joint_type']); $joint_type = 'd'; $joint_fid = jointFlushStr($_GET['joint_fid']); $uid = $_G['uid']; $user = getUserInfo($uid); if ($uid) { // 查询我的回帖,并且不是我发的 $sql = "SELECT td.*,t.pid,f.name \r\n\tFROM pre_forum_post t \r\n\tLEFT JOIN pre_forum_thread td ON t.tid=td.tid\r\n\tLEFT JOIN pre_forum_forum f ON t.fid=f.fid \r\n\tWHERE t.authorid={$uid} AND t.invisible>-1 AND t.position>1 {$att_where} GROUP BY t.tid ORDER BY t.pid DESC LIMIT 0,40"; $re = DB::query($sql); $threads = array(); while ($data = mysql_fetch_assoc($re)) { $data['date'] = date("Y-m-d H:i", $data['dateline']); $data['dateline'] = $data['date']; $data['head'] = jointGetPhoto($data['authorid'], 1); $data['author'] = jointGetJfNiceByUsername($data['author']); $threads[] = $data; } } // 20141230 去通知表查,主题是否有新的通知 pre_home_notification $tids = ''; foreach ($threads as $k => $v) { $tids .= $v['pid'] . ','; } $tids = trim($tids, ',');