function get_cardtopic($uid, $num = 1) { require_once R_P . 'require/functions.php'; $_sql_where = ''; if ($notInFid = getSpecialFid()) { $_sql_where = ' AND fid NOT IN(' . $notInFid . ')'; } $rt = $this->_db->get_one("SELECT tid,subject,postdate FROM pw_threads WHERE authorid=" . S::sqlEscape($uid) . $_sql_where . ' ORDER BY tid DESC LIMIT 1'); if (empty($rt)) { return array(); } $pw_tmsgs = getTtable($rt['tid']); $r2 = $this->_db->get_one("SELECT aid,content FROM {$pw_tmsgs} WHERE tid=" . S::sqlEscape($rt['tid'])); $rt['subject'] = substrs(stripWindCode($rt['subject']), 100, N); $rt['content'] = substrs(stripWindCode($r2['content']), 100, N); $rt['postdate_s'] = get_date($rt['postdate']); if ($r2['aid']) { $attachs = L::loadDB('attachs', 'forum'); $rt['attimages'] = array(); $atts = $attachs->getByTid($rt['tid'], 0, 4, 'img'); foreach ($atts as $key => $val) { $a_url = geturl($val['attachurl'], 'show', $val['ifthumb']); if ($a_url != 'nopic') { $rt['attimages'][] = is_array($a_url) ? $a_url[0] : $a_url; } } } return $rt; }
$basename = $baseUrl . 'q='.$q.'&space=1&u=$u&'; } */ $spaceurl = $baseUrl; $a = ''; $userdb = $db->get_one("SELECT index_privacy FROM pw_ouserdata WHERE uid=" . pwEscape($u)); list($isU, $privacy) = pwUserPrivacy($u, $userdb); if ($groupid == 3 || $isU == 2 || $isU != 2 && $privacy['index']) { $SpaceShow = 1; } if (!$SpaceShow) { Showmsg('mode_o_index_right'); } } include_once D_P . 'data/bbscache/forum_cache.php'; $fids = trim(getSpecialFid() . ",'0'", ','); $shortcutforum = pwGetShortcut(); $force = $where = ''; $article = array(); $ordertype = 'postdate'; if ($a == 'friend') { $thisbase = $basename . 'a=friend&'; if ($friends = getFriends($winduid)) { $uids = array_keys($friends); !empty($fids) && ($where .= "fid NOT IN({$fids}) AND "); $where .= "authorid IN(" . pwImplode($uids) . ") AND ifcheck=1 AND ifhide=0 AND anonymous=0"; $where .= " AND postdate>" . pwEscape($timglimit); } else { //require_once(M_P.'require/header.php'); //require_once PrintEot('m_article'); //footer();
function getActivityNumberAndLastestTimestampByUid($uid) { $allActivityIdsIHaveParticipated = $this->getAllParticipatedActivityIdsByUid($uid); $fids = trim(getSpecialFid() . ",'0'", ','); !empty($fids) && ($where .= ($where ? ' AND ' : '') . "dv.fid NOT IN({$fids})"); $where .= ($where ? ' AND ' : '') . "(tr.authorid = " . S::sqlEscape($uid) . ($allActivityIdsIHaveParticipated ? ' OR tr.tid IN (' . S::sqlImplode($allActivityIdsIHaveParticipated) . ')' : '') . ')'; $where && ($where = " WHERE " . $where); $activitynum = $this->db->get_value("SELECT COUNT(*) FROM pw_threads tr LEFT JOIN pw_activitydefaultvalue dv USING (tid) {$where}"); $activity_lastpost = $this->db->get_value("SELECT postdate FROM pw_threads tr LEFT JOIN pw_activitydefaultvalue dv USING (tid) {$where} ORDER BY postdate DESC LIMIT 1"); return array($activitynum, $activity_lastpost); }