function get_reply($uid, $num = 20) { $pw_posts = GetPtable($GLOBALS['db_ptable']); $array = $tTable = $tids = array(); $query = $this->_db->query("SELECT DISTINCT tid,pid FROM {$pw_posts} WHERE authorid=" . S::sqlEscape($uid) . " AND ifcheck=1 AND fid!=0 ORDER BY postdate DESC " . S::sqlLimit($num)); while ($rt = $this->_db->fetch_array($query)) { $tids[] = $rt['tid']; $pids[$rt[tid]][] = $rt['pid']; } if ($tids) { $query = $this->_db->query("SELECT t.tid,t.subject,t.replies,t.hits,t.postdate,f.fid as forumsid,f.name as forums FROM pw_threads t LEFT JOIN pw_forums f ON t.fid=f.fid WHERE t.tid IN(" . S::sqlImplode($tids) . ") ORDER BY t.tid DESC"); while ($rt = $this->_db->fetch_array($query)) { $rt['subject'] = substrs($rt['subject'], 45); $rt['forums'] = substrs(stripWindCode($rt['forums']), 100, 'N'); list($rt['postdate']) = getLastDate($rt['postdate']); $rt['pid'] = $pids[$rt[tid]][0]; $tTable[getTtable($rt['tid'])][] = $rt['tid']; $array[$rt['tid']] = $rt; } foreach ($tTable as $pw_tmsgs => $ids) { $query = $this->_db->query("SELECT tid,content FROM {$pw_tmsgs} WHERE tid IN (" . S::sqlImplode($ids) . ')'); while ($rt = $this->_db->fetch_array($query)) { $array[$rt['tid']]['content'] = substrs(stripWindCode($rt['content']), 100, 'N'); } } } return $array; }
/** * @param $type * @param $page * @return unknown_type */ function getRecommendByType($type, $page = 1) { $result = array(); $where = " WHERE (t.fid != 0 OR t.fid IS NULL) "; if ($type) { $where .= " AND p.typeid = " . pwEscape($type); } (int) $page < 1 && ($page = 1); $start = ($page - 1) * $this->perPage; $limit = pwLimit($start, $this->perPage); $query = $this->db->query("SELECT p.*,t.replies,t.hits,t.author,t.authorid,t.lastposter,t.lastpost FROM pw_wappush p LEFT JOIN pw_threads t ON p.tid = t.tid \r\n\t\t\t\t\t{$where} ORDER BY p.id DESC {$limit}"); while ($rt = $this->db->fetch_array($query)) { $rt['index'] = ++$start; list(, $lastDate) = getLastDate($rt['lastpost']); $rt['lastpost'] = $lastDate; $result[] = $rt; } return $result; }
function get_pinglogs($tid, $pingIdArr) { if (empty($pingIdArr)) { return; } global $db, $fid, $creditnames; $pingIds = array(); $pingLogs = array(); foreach ($pingIdArr as $pid => $markInfo) { list($count, $ids, $creditCount) = explode(":", $markInfo); $pingLogs[$pid]['count'] = $count; $pingLogs[$pid]['creditCount'] = parseCreditCount($creditCount); $pingIds = array_merge($pingIds, explode(",", $ids)); } if (!count($pingIds)) { return array(); } $query = $db->query("SELECT a.*,b.uid,b.icon FROM pw_pinglog a LEFT JOIN pw_members b ON a.pinger=b.username WHERE a.id IN (" . S::sqlImplode($pingIds) . ") "); while ($rt = $db->fetch_array($query)) { $rt['pid'] = $rt['pid'] ? $rt['pid'] : 'tpc'; list($rt['pingtime'], $rt['pingdate']) = getLastDate($rt['pingdate']); $rt['record'] = $rt['record'] ? $rt['record'] : "-"; if ($rt['point'] > 0) { $rt['point'] = "+" . $rt['point']; } $tmp = showfacedesign($rt['icon'], true, 's'); $rt['icon'] = $tmp[0]; isset($creditnames[$rt['name']]) && ($rt['name'] = $creditnames[$rt['name']]); $pingLogs[$rt['pid']]['data'][$rt['id']] = $rt; } foreach ($pingLogs as $pid => $data) { if (is_array($pingLogs[$pid]['data'])) { krsort($pingLogs[$pid]['data']); } } return $pingLogs; }
function drawDiagram($img) { global $num_horiz; $axes_color = imagecolorallocate($img, 0, 0, 0); $grid_color = imagecolorallocate($img, 204, 204, 204); $caption_color = imagecolorallocate($img, 0, 0, 0); $border_color = imagecolorallocate($img, 204, 204, 204); $background_color = imagecolorallocate($img, 255, 255, 255); $host_color = imagecolorallocate($img, 241, 29, 29); $hits_color = imagecolorallocate($img, 20, 203, 80); $visitors_color = imagecolorallocate($img, 29, 59, 241); $end_date = getLastDate(); $start_date = strtotime("-28 day", $end_date); $max_data = getMaxData($start_date, $end_date); if ($max_data < 14 && $max_data != 0) { $num_horiz = $max_data; } imagefill($img, 0, 0, $background_color); imagerectangle($img, 0, 0, IMG_WIDTH - 1, IMG_HEIGHT - 1, $border_color); drawAxes($img, $axes_color); drawGrid($img, $grid_color); drawCaptions($img, $start_date, $max_data, $caption_color); drawGraphs($img, $start_date, $end_date, $max_data, $host_color, $hits_color, $visitors_color); }
/** * 数据处理 * * @param array $data * @return array */ function buildReplyData($data) { global $db_windpost; if (!S::isArray($data)) { return array(); } $uids = $tmpreplydata = array(); foreach ($data as $v) { $uids[] = $v['uid']; } $userService = L::loadClass('UserService', 'user'); $userInfo = $userService->getUserInfoWithFace($uids); foreach ($data as $value) { list($value['postdate'], $value['postdate_s']) = getLastDate($value['postdate']); $tmpreplydata[] = array_merge((array) $value, (array) $userInfo[$value['uid']]); } return $tmpreplydata; }
function get_pinglogs($tid, $pingIdArr) { if (empty($pingIdArr)) { return; } global $db, $fid; $pingIds = array(); $pingLogs = array(); foreach ($pingIdArr as $pid => $markInfo) { if (!preg_match("/^[0-9\\:\\,]*\$/", $markInfo)) { //$markInfo = update_markinfo($fid, $tid, $pid); continue; } list($count, $ids) = explode(":", $markInfo); $pingLogs[$pid]['count'] = $count; $pingIds = array_merge($pingIds, explode(",", $ids)); } if (!count($pingIds)) { return array(); } $query = $db->query("SELECT a.*,b.uid,b.icon FROM pw_pinglog a LEFT JOIN pw_members b ON a.pinger=b.username WHERE a.id IN (" . pwImplode($pingIds) . ") "); while ($rt = $db->fetch_array($query)) { $rt['pid'] = $rt['pid'] ? $rt['pid'] : 'tpc'; list($rt['pingtime'], $rt['pingdate']) = getLastDate($rt['pingdate']); $rt['record'] = $rt['record'] ? $rt['record'] : "-"; if ($rt['point'] > 0) { $rt['point'] = "+" . $rt['point']; } $tmp = showfacedesign($rt['icon'], true); $rt['icon'] = $tmp[0]; $pingLogs[$rt['pid']]['data'][$rt['id']] = $rt; } foreach ($pingLogs as $pid => $data) { if (is_array($pingLogs[$pid]['data'])) { krsort($pingLogs[$pid]['data']); } } return $pingLogs; }
function getPingLogs($tid, $pingIdArr, $page = null) { if (empty($pingIdArr)) { return array(); } global $db, $fid; static $creditnames; is_array($creditnames) or $creditnames = pwCreditNames(); $pingIds = array(); $pingLogs = array(); if ($page) { $page = intval($page); if ($page < 1) { $page = 1; } } foreach ($pingIdArr as $pid => $markInfo) { list($count, $ids, $creditCount) = explode(":", $markInfo); $pingLogs[$pid]['count'] = $count; $pingLogs[$pid]['creditCount'] = $this->parseCreditCount($creditCount); $pingIds = array_merge($pingIds, explode(",", $ids)); $page && ($pingLogs[$pid]['pages'] = numofpage($count, $page, ceil($count / 10), "apps.php?q=ajax&a=pingpage&tid={$tid}&count={$count}&pid={$pid}&fid={$fid}&", null, 'ajaxPingcp')); } if (!count($pingIds) && !$page) { return array(); } $query = $this->db->query("SELECT a.*,b.uid FROM pw_pinglog a LEFT JOIN pw_members b ON a.pinger=b.username WHERE a.id IN (" . S::sqlImplode($pingIds) . ")"); while ($rt = $this->db->fetch_array($query)) { $rt['pid'] = $rt['pid'] ? $rt['pid'] : 'tpc'; list($rt['pingtime'], $rt['pingdate']) = getLastDate($rt['pingdate']); $rt['record'] = $rt['record'] ? $rt['record'] : "-"; if ($rt['point'] > 0) { $rt['point'] = "+" . $rt['point']; } //$tmp = showfacedesign($rt['icon'],true,'s'); //$rt['icon'] = $tmp[0]; isset($creditnames[$rt['name']]) && ($rt['name'] = $creditnames[$rt['name']]); $pingLogs[$rt['pid']]['data'][$rt['id']] = $rt; } foreach ($pingLogs as $pid => $data) { if (is_array($pingLogs[$pid]['data'])) { krsort($pingLogs[$pid]['data']); } } return $pingLogs; }
function viewOneReply($tid, $pid, $ptable) { global $db, $db_waplimit, $c_page, $db_anonymousname, $pwAnonyHide, $winduid; $pw_posts = GetPtable($ptable); $sql = "SELECT pid,subject,author,authorid,content,postdate,anonymous,aid FROM {$pw_posts} WHERE pid=" . pwEscape($pid); $ct = $db->get_one($sql); if ($ct) { $ct['subject'] = str_replace(' ', '', wap_cv($ct['subject'])); $content = viewContent($ct['content']); $yxqw = ""; /*************对内容进行分页**********/ (int) $c_page < 1 && ($c_page = 1); $clen = wap_strlen($content, $db_charset); //TODO mbstring $maxp = ceil($clen / $db_waplimit); $c_nextp = $c_page + 1; $c_prep = $c_page - 1; if ($c_nextp > $maxp) { $c_nextp = $maxp; } if ($c_prep <= 0) { $c_prep = 1; } $yxqw = ""; if ($maxp > 1) { $content = wap_substr($content, $db_waplimit * ($c_page - 1), $db_waplimit, $db_charset); $content = wap_img2($content); if (empty($content)) { wap_msg("已到最后一页", "index.php?a=read&tid={$tid}"); } if ($c_page == 1) { $yxqw = "<a href='index.php?a=reply&pid=" . $pid . "&tid=" . $tid . "&c_page={$c_nextp}'>下一页</a>"; } elseif ($c_page == $maxp) { $yxqw = "<a href='index.php?a=reply&pid=" . $pid . "&tid=" . $tid . "&c_page={$c_prep}'>上一页</a> "; } else { $yxqw = "<a href='index.php?a=reply&pid=" . $pid . "&tid=" . $tid . "&c_page={$c_nextp}'>下一页</a>"; $yxqw .= "<a href='index.php?a=reply&pid=" . $pid . "&tid=" . $tid . "&c_page={$c_prep}'>上一页</a> "; } $yxqw .= " ({$c_page}/{$maxp})<br/>"; } else { $content = wap_img2($content); } $ct['content'] = $content; /*************对内容进行分页**********/ if ($ct['anonymous'] && $ct['authorid'] != $winduid && !$pwAnonyHide) { $ct['author'] = $db_anonymousname; $ct['authorid'] = 0; } list(, $ct['postdate']) = getLastDate($ct['postdate']); $ct['id'] = $id; //$ct ['author'] = $ct ['anonymous'] ? $db_anonymousname : $ct ['author']; $ct['author'] = wap_cv($ct['author']); $ct['yxqw'] = $yxqw; if ($ct['aid'] && $ct['aid'] != '') { $ct['aidimgs'] = viewAidsForHtml($tid, $pid); $ct['aidatts'] = viewDownloads($tid, $pid); } else { $ct['aidimgs'] = ''; $ct['aidatts'] = ''; } } return $ct; }
function formateDate($time) { $temp = getLastDate($time, 0); return $temp[0]; }
/** * 私用组装前台展示信息函数 * @param $arrays 消息体+关系体信息 * 注意:$tpc_author参数用于组装表情用户名前缀 * @return array */ function _buildUsersLists($arrays) { global $tpc_author; if (!$arrays) { return false; } $userIds = array(); foreach ($arrays as $v) { 0 < $v['create_uid'] ? $userIds[] = $v['create_uid'] : 0; } $tmp = $this->_retrieveUsers($userIds); require_once R_P . 'require/bbscode.php'; $groupInfos = $tmpArrays = array(); foreach ($arrays as $rid => $a) { $created_timefromat = getLastDate($a['created_time']); $modified_timefromat = getLastDate($a['modified_time']); $a['title'] = $this->_reverseString($a['title']); $tpc_author = $a['create_username']; $a['created_time_format'] = $created_timefromat[0]; $a['modified_time_format'] = $modified_timefromat[0]; $a['created_time_detail'] = get_date($a['created_time'], 'Y-m-d H:i'); $a['modified_time_detail'] = get_date($a['modified_time'], 'Y-m-d H:i'); $a['content'] = $this->_reverseString($this->_stringReplace(convert($a['content'], $this->_windpost))); $a['extra'] = $a['extra'] ? unserialize($a['extra']) : ''; $tmpArrays[$rid] = isset($tmp[$a['create_uid']]) ? $tmp[$a['create_uid']] + $a : $a; $a['typeid'] == $this->getMap($this->_groupsms_colony) ? $groupInfos[$a['mid']] = $a['extra'] : 0; } // build group if ($groupInfos && ($groups = $this->_buildColonyList($groupInfos))) { $t = array(); foreach ($tmpArrays as $rid => $v) { $t[$rid] = isset($groups[$v['mid']]) ? $groups[$v['mid']] + $v : $v; } return $t; } return $tmpArrays; }
if ($count2 = $colony['writenum']) { $smileParser = L::loadClass('smileparser', 'smile'); /* @var $smileParser PW_SmileParser */ require_once R_P . 'require/showimg.php'; $page = (int) S::getGP('page'); list($pages, $limit) = pwLimitPages($count2, $page, "{$basename}&showtype=write&cyid={$cyid}&"); $query = $db->query("SELECT w.*,m.username,m.icon,m.groupid FROM pw_cwritedata w LEFT JOIN pw_members m ON w.uid=m.uid WHERE w.cyid=" . S::sqlEscape($cyid) . " ORDER BY w.replay_time DESC {$limit}"); while ($rt = $db->fetch_array($query)) { if ($rt['groupid'] == 6 && $db_shield && $groupid != 3) { $rt['content'] = appShield('ban_write'); } $rt['content'] = $smileParser->parse($rt['content']); list($rt['postdate']) = getLastDate($rt['postdate']); list($rt['icon']) = showfacedesign($rt['icon'], 1, 'm'); $writedata[$rt['id']] = $rt; $typeid[] = $rt['id']; } } if ($typeid) { $sql = "SELECT tt.* FROM (SELECT cm.*,m.icon FROM pw_comment cm LEFT JOIN pw_members m ON cm.uid=m.uid WHERE type='groupwrite' AND typeid in (" . S::sqlImplode($typeid, false) . ") ORDER BY cm.id DESC) tt GROUP BY tt.typeid "; $query2 = $db->query($sql); while ($rt2 = $db->fetch_array($query2)) { $writedata[$rt2['typeid']]['replayuid'] = $rt2['uid']; $writedata[$rt2['typeid']]['replayusername'] = $rt2['username']; $writedata[$rt2['typeid']]['replaytitle'] = $rt2['title']; list($writedata[$rt2['typeid']]['replaypoastdate']) = getLastDate($rt2['postdate']); list($writedata[$rt2['typeid']]['replayicon']) = showfacedesign($rt2['icon'], 1, 'm'); } } require_once PrintEot('thread_write'); footer();
function buildReplyData($data) { global $db_windpost, $timestamp; if (!S::isArray($data)) { return array(); } $uids = $comment = array(); foreach ($data as $v) { $uids[] = $v['uid']; } $userService = L::loadClass('UserService', 'user'); $userInfo = $userService->getUserInfoWithFace($uids); require_once R_P . 'require/bbscode.php'; foreach ($data as $value) { $value['content'] = convert($value[content], $db_windpost); $value['postdate'] == $timestamp && ($value['postdate'] = $value['postdate'] - 1); list($value['postdate'], $value['postdate_s']) = getLastDate($value['postdate']); $comment[] = array_merge((array) $value, (array) $userInfo[$value['uid']]); } return $comment; }
function getLastThread($limit = 10) { $openforum = array(); require_once R_P . 'require/bbscode.php'; $openforum = $this->_getOpenforums(); $service = L::loadClass('threads', 'forum'); $data = $service->getLatestThreads($openforum, '', '', 0, $limit); if (!S::isArray($data)) { return array(); } foreach ($data as $v) { if ($v['ifhide']) { $v['content'] = "[内容已隐藏]"; } if ($v['anonymous']) { $v['author'] = '匿名用户'; $v['authorid'] = 0; } if ($v['locked'] == 2) { $v['content'] = "主题已被关闭"; $v['subject'] = "主题已被关闭"; } $v['content'] = $this->_replace($v['content']); //$v['content'] = convert($v['content'],'','post'); $v['content'] = substrs($v['content'], 160, 'Y'); list($v['postdate'], $v['postdate_s']) = getLastDate($v['postdate']); $arr[] = array('tid' => $v['tid'], 'fid' => $v['fid'], 'author' => $v['author'], 'authorid' => $v['authorid'], 'subject' => $v['subject'], 'postdate' => $v['postdate'], 'content' => $v['content'], 'anonymous' => $v['anonymous'], 'url' => "read.php?tid=" . $v['tid']); $uids[] = $v['authorid']; } $usersInfo = $this->_getUserInfo($uids, true); if (empty($arr)) { return array(); } foreach ($arr as $k => $value) { !is_array($usersInfo[$value['authorid']]) && ($usersInfo[$value['authorid']] = array()); $arr[$k]['icon'] = $usersInfo[$value['authorid']]['icon']; } return $arr; }
if (strpos($quote_content, 'p_w_upload') !== false) { $quote_content = str_replace('p_w_upload', $db_attachname, $quote_content); } $quote_content = preg_replace('/(\\[attachment=\\d+\\])+/', '[图片]', $quote_content); //face //title list($guidename, $forumtitle) = $pwforum->getTitle(); if (!$replytitle) { $atc_title = "Re:{$read['subject']}"; //$forumtitle = "$atc_title|$forumtitle"; } else { $atc_title = "Re:{$replytitle}"; //$forumtitle = "$atc_title|$tpcarray[subject]|$forumtitle"; } //time list($postTime) = getLastDate($atcarray['postdate']); $atc_title = substrs(str_replace(' ', ' ', $atc_title), $db_titlemax - 3); //quote if ((!$tpc_locked || $SYSTEM['replylock']) && ($admincheck || $pwforum->allowreply($winddb, $groupid))) { if (!$admincheck && !$foruminfo['allowrp'] && !$_G['allowrp']) { quickPostMessage('reply_group_right'); } require_once PrintEot('quickpost'); ajax_footer(); } if (!$isGM && $tpc_locked && !pwRights($isBM, 'replylock')) { //locked quickPostMessage('reply_lockatc'); } quickPostMessage('reply_group_right'); function quickPostMessage($message)
$visituids = array_merge(array_keys($whovisit), array_keys($tovisit)); if ($visituids) { $query = $db->query("SELECT m.uid,m.username,m.icon,m.honor,md.thisvisit FROM pw_members m LEFT JOIN pw_memberdata md ON m.uid=md.uid WHERE m.uid IN (" . pwImplode($visituids, false) . ")"); while ($rt = $db->fetch_array($query)) { list($rt['icon']) = showfacedesign($rt['icon'], 1, 'm'); if ($db_showonline && $rt['thisvisit'] + $db_onlinetime * 1.5 > $timestamp) { $rt['thisvisit'] = 1; } else { $rt['thisvisit'] = 0; } if (isset($whovisit[$rt['uid']])) { list($whovisit[$rt['uid']]) = getLastDate($whovisit[$rt['uid']], '2'); $whovisit[$rt['uid']] = array('visittime' => $whovisit[$rt['uid']]) + $rt; } if (isset($tovisit[$rt['uid']])) { list($tovisit[$rt['uid']]) = getLastDate($tovisit[$rt['uid']], '2'); $tovisit[$rt['uid']] = array('visittime' => $tovisit[$rt['uid']]) + $rt; } } } function getAppIcon($type) { switch ($type) { case 'record': $icon = 'record.png'; break; case 'diary': $icon = 'posts.png'; break; case 'photo': $icon = 'albums.png';
if ($uid && $uid != $winduid) { $userdb = $db->get_one("SELECT m.uid,m.icon,m.username,m.honor FROM pw_members m WHERE m.uid = " . pwEscape($uid)); } elseif ($username && $username != $windid) { $userdb = $db->get_one("SELECT m.uid,m.icon,m.username,m.honor FROM pw_members m WHERE m.username = "******"index.php?a=read&tid=" . $value['typeid']; $temp['subject'] = $value['content']['postfavor']['subject']; $myFavThreads[] = $temp; }
function adorn_weibo($data) { if (empty($data) || !is_array($data)) { return $data; } foreach ($data as $key => $value) { list($value['lastdate'], $value['postdate_s']) = getLastDate($value['postdate']); $data[$key] = $value; } return $data; }
/** * @param $tags * @param $nums * @return unknown_type */ function getMemberSort($tags, $nums) { if (!empty($tags) && !empty($nums)) { $sql = "SELECT m.uid, m.icon, m.username, md.lastvisit\n\t\t\t\t\tFROM pw_members m LEFT JOIN pw_memberdata md ON m.uid=md.uid\n\t\t\t\t\tWHERE m.uid IN ( " . S::sqlImplode($tags) . " ) "; $query = $this->db->query($sql); $result = array(); while ($rt = $this->db->fetch_array($query)) { $r['id'] = $rt['uid']; $r['title'] = $rt['username']; $r['url'] = USER_URL . $rt['uid']; list($userIcon) = showfacedesign($rt["icon"], 1, 'm'); $r['image'] = $userIcon; list($lastDate) = getLastDate($rt["lastvisit"]); $r['lastDate'] = $lastDate; $r['value'] = $nums[$rt['uid']]; //$this->getOnlineTime($nums [$rt ['uid']]); $result[$rt['uid']] = $r; } } return $result; }
$creditnames = pwCreditNames(); //х╗оч $foruminfo = $db->get_one('SELECT * FROM pw_forums f LEFT JOIN pw_forumsextra fe USING(fid) WHERE f.fid=' . S::sqlEscape($fid)); !$foruminfo && Showmsg('data_error'); $isGM = $isBM = $admincheck = 0; if ($groupid != 'guest') { $isGM = S::inArray($windid, $manager); $isBM = admincheck($foruminfo['forumadmin'], $foruminfo['fupadmin'], $windid); $admincheck = $isGM || $isBM ? 1 : 0; } $count = $db->get_value("SELECT COUNT(*) FROM pw_pinglog WHERE fid=" . S::sqlEscape($fid) . " AND tid=" . S::sqlEscape($tid) . " AND pid=" . S::sqlEscape($pid) . " AND ifhide=0"); $total = ceil($count / $perpage); if ($page < 2) { $page = 2; } $offset = ($page - 1) * $perpage; $ping_db = array(); $query = $db->query("SELECT a.*,b.uid,b.icon FROM pw_pinglog a LEFT JOIN pw_members b ON a.pinger=b.username WHERE a.fid=" . S::sqlEscape($fid) . " AND a.tid=" . S::sqlEscape($tid) . " AND a.pid=" . S::sqlEscape($pid) . " AND ifhide=0 ORDER BY a.pingdate DESC LIMIT {$offset},{$perpage}"); while ($rt = $db->fetch_array($query)) { list($rt['pingtime'], $rt['pingdate']) = getLastDate($rt['pingdate']); $rt['record'] = $rt['record'] ? $rt['record'] : "-"; if ($rt['point'] > 0) { $rt['point'] = "+" . $rt['point']; } $tmp = showfacedesign($rt['icon'], true); $rt['icon'] = $tmp[0]; isset($creditnames[$rt['name']]) && ($rt['name'] = $creditnames[$rt['name']]); $ping_db[] = $rt; } require_once PrintEot('ajax'); ajax_footer();
/** * 取得@我的记录列表 * * @param $userId * @param $page * @param $perpage * @param $pageUrl */ function findWritesToUserInPage($userId, $page = 1, $perpage = 20, $pageUrl) { global $db_shield, $groupid, $winduid, $windid; $count = $this->countWritesToUser($userId); if (!$count) { return array(); } $pages = numofpage($count, $page, ceil($count / $perpage), $pageUrl); $writeDb = $this->_getWriteDB(); $writedata = $writeDb->findWritesToUser($userId, $page, $perpage); if (!$writedata) { return array(); } $result = array(); foreach ($writedata as $write) { if ($write['groupid'] == 6 && $db_shield && $groupid != 3) { $write['content'] = appShield('ban_write'); } list($write['postdate']) = getLastDate($write['postdate']); list($write['icon']) = showfacedesign($write['icon'], 1, 'm'); if ($write['touid'] && $write['username']) { $write['content'] = '<a href="' . USER_URL . $write['uid'] . '">' . $write['username'] . '</a> @<a href="u.php?&uid=' . $winduid . '">' . $windid . '</a> ' . $write['content']; } $result[] = $write; } return array($this->parse($result), $pages, $count); }
function htmread($read, $start_limit) { global $imgpath, $db_ipfrom, $db_windpost, $db_windpic, $db_signwindcode, $db_shield; $lpic = L::config('lpic', 'cache_read'); $ltitle = L::config('ltitle', 'cache_read'); $_MEDALDB = L::config('_MEDALDB', 'cache_read'); $read['lou'] = $start_limit; $start_limit == $count - 1 && ($read['jupend'] = '<a name=lastatc></a>'); $read['ifsign'] < 2 && ($read['content'] = str_replace("\n", "<br>", $read['content'])); $read['groupid'] == '-1' && ($read['groupid'] = $read['memberid']); $anonymous = $read['anonymous'] ? 1 : 0; if ($read['groupid'] != '' && $anonymous == 0) { !$lpic[$read['groupid']] && ($read['groupid'] = 8); $read['lpic'] = $lpic[$read['groupid']]; $read['level'] = $ltitle[$read['groupid']]; $read['regdate'] = get_date($read['regdate'], "Y-m-d"); $read['lastlogin'] = get_date($read['lastvisit'], "Y-m-d"); $read['aurvrc'] = floor($read['rvrc'] / 10); $read['author'] = $read['username']; $read['ontime'] = (int) ($read['onlinetime'] / 3600); $tpc_author = $read['author']; list($read['face'], , $httpWidth, $httpHeight, , , , $read['facesize']) = showfacedesign($read['micon'], true, 'm'); if ($httpWidth > 120 || $httpHeight > 120 || $read['facesize'] == '') { $read['facesize'] = ' width="120" height="120"'; } list($read['posttime']) = getLastDate($read['postdate']); if ($db_ipfrom == 1) { $read['ipfrom'] = ' From:' . $read['ipfrom']; } if (L::config('md_ifopen', 'cache_read') && $read['medals']) { $medals = ''; $md_a = explode(',', $read['medals']); foreach ($md_a as $key => $value) { if ($value) { $medals .= "<img src=\"{$_MEDALDB[$value][smallimage]}\" title=\"{$_MEDALDB[$value][name]}\" /> "; } } $read['medals'] = $medals . '<br />'; } else { $read['medals'] = ''; } if ($read['ifsign'] == 1 || $read['ifsign'] == 3) { global $sign; if (!$sign[$read['author']]) { global $db_signmoney, $db_signgroup, $tdtime; if (strpos($db_signgroup, ",{$read['groupid']},") !== false && $db_signmoney) { $read['signature'] = ''; } else { if ($db_signwindcode && getstatus($read['userstatus'], PW_USERSTATUS_SIGNCHANGE)) { $read['signature'] = convert($read['signature'], $db_windpic, 2); } $read['signature'] = str_replace("\n", "<br>", $read['signature']); } $sign[$read['author']] = $read['signature']; } else { $read['signature'] = $sign[$read['author']]; } } else { $read['signature'] = ''; } } else { $read['face'] = "{$imgpath}/face/none.gif"; $read['lpic'] = '8'; $read['level'] = $read['digests'] = $read['postnum'] = $read['money'] = $read['regdate'] = $read['lastlogin'] = $read['aurvrc'] = $read['credit'] = '*'; if ($anonymous) { $read['signature'] = $read['honor'] = $read['medals'] = $read['ipfrom'] = ''; $read['author'] = $GLOBALS['db_anonymousname']; $read['authorid'] = 0; foreach (L::config('customfield', 'cache_read') as $key => $val) { $field = "field_" . (int) $val['id']; $read[$field] = '*'; } } } $read['postdate'] = get_date($read['postdate']); $read['mark'] = ''; if ($read['ifmark']) { $markdb = explode("\t", $read['ifmark']); foreach ($markdb as $key => $value) { $read['mark'] .= "<li>{$value}</li>"; } } if ($read['icon']) { $read['icon'] = "<img src=\"{$imgpath}/post/emotion/{$read['icon']}.gif\" align=left border=0>"; } else { $read['icon'] = ''; } /** * 动态判断发帖是否需要转换 */ $tpc_shield = 0; if ($read['ifshield'] || $read['groupid'] == 6 && $db_shield) { $read['subject'] = $read['icon'] = ''; $read['content'] = shield($read['ifshield'] ? $read['ifshield'] == 1 ? 'shield_article' : 'shield_del_article' : 'ban_article'); $tpc_shield = 1; } if (!$tpc_shield) { $wordsfb = L::loadClass('FilterUtil', 'filter'); if (!$wordsfb->equal($read['ifwordsfb'])) { $read['content'] = $wordsfb->convert($read['content']); } if ($read['ifconvert'] == 2) { $read['content'] = preg_replace("/\\[sell=(.+?)\\]/is", "", $read['content']); $read['content'] = preg_replace("/\\[hide=(.+?)\\]/is", "", $read['content']); $read['content'] = str_replace(array('[/hide]', '[/sell]', '[post]', '[/post]'), '', $read['content']); $read['content'] = convert($read['content'], $db_windpost); } else { strpos($read['content'], '[s:') !== false && ($read['content'] = showface($read['content'])); } if ($read['aid'] && $this->attachShow->isShow($read['ifhide'], $tid)) { $read += $this->attachShow->parseAttachs($read['pid'], $read['content'], false); } } if ($read['remindinfo']) { $remind = explode("\t", $read['remindinfo']); $remind[0] = str_replace("\n", "<br />", $remind[0]); $remind[2] && ($remind[2] = get_date($remind[2])); $read['remindinfo'] = $remind; } $this->forum->foruminfo['copyctrl'] && ($read['content'] = preg_replace("/<br>/eis", "copyctrl('{$read['colour']}')", $read['content'])); $read['alterinfo'] && ($read['content'] .= "<br><br><br><font color=gray>[ {$read['alterinfo']} ]</font>"); return $read; }
function _formatRecord($record, $gid) { list($record['lastdate'], $record['postdate_s']) = getLastDate($record['postdate']); $record['extra'] = $record['extra'] ? unserialize($record['extra']) : array(); if ($gid == '6') { $record['content'] = "<span style=\"color:black;background-color:#ffff66\">该内容已被管理员屏蔽!</span>"; } else { $record['content'] = $this->_parseContent($record['content'], $record['extra']); } return $record; }
function formatRecord($value, $gid) { list($value['lastdate'], $value['postdate_s']) = getLastDate($value['postdate']); $value['extra'] = $value['extra'] ? unserialize($value['extra']) : array(); !$value['authorid'] && ($value['authorid'] = $value['uid']); if ($gid == '6') { if (isset($value['extra']['title'])) { $value['extra']['title'] = "<span style=\"color:black;background-color:#ffff66\">该内容已被管理员屏蔽!</span>"; $value['content'] = ''; } else { $value['content'] = "<span style=\"color:black;background-color:#ffff66\">该内容已被管理员屏蔽!</span>"; } isset($value['extra']['photos']) && ($value['extra']['photos'] = array()); } else { $value['content'] = $this->parseContent($value['content'], $value['extra']); } return $value; }
if ($count) { $page = (int) GetGP('page'); $db_perpage = 10; list($pages, $limit) = pwLimitPages($count, $page, "{$basename}a={$a}&type={$type}&"); if (!$db_dopen) { $where .= " AND s.type!='diary'"; } if (!$db_phopen) { $where .= " AND s.type!='photo'"; } if (!$db_groups_open) { $where .= " AND s.type!='group'"; } $rs = $db->query("SELECT s.*,m.groupid,m.icon FROM pw_share s LEFT JOIN pw_members m ON s.uid=m.uid WHERE {$where} ORDER BY s.id DESC {$limit}"); while ($rt = $db->fetch_array($rs)) { list($rt['postdate'], $rt['posttime']) = getLastDate($rt['postdate']); $temp = unserialize($rt['content']); if ($temp['video']) { $rt['host'] = $temp['video']['host']; $rt['hash'] = $temp['video']['hash']; } $rt['link'] = $temp['link']; if (strpos($rt['link'], '{#APPS_BASEURL#}') !== false) { $baseurl = $m == 'o' ? 'mode.php?m=o&' : 'apps.php?'; $rt['link'] = str_replace('{#APPS_BASEURL#}', $baseurl, $rt['link']); } if ($rt['type'] == 'user') { $rt['image'] = $temp['user']['image']; $rt['title'] = "<a href=\"{$rt['link']}\" target=\"_blank\">" . $temp['user']['username'] . "</a>"; } elseif ($rt['type'] == 'photo') { $belong = getLangInfo('app', 'photo_belong');
function viewread($read, $start_limit) { global $db, $_G, $isGM, $pwSystem, $groupid, $attach_url, $winduid, $tablecolor, $tpc_author, $tpc_buy, $tpc_pid, $tpc_tag, $count, $orderby, $pageinverse, $timestamp, $db_onlinetime, $attachdir, $attachpath, $readcolorone, $readcolortwo, $lpic, $ltitle, $imgpath, $db_ipfrom, $db_showonline, $stylepath, $db_windpost, $db_windpic, $db_signwindcode, $fid, $tid, $pid, $db_md_ifopen, $_MEDALDB, $rewardtype, $db_shield, $db_iftag, $db_readtag, $viewpic; global $ping_logs; if ($read['istop'] == 'topped') { $read['lou'] = $read['floor']; } else { $read['lou'] = $count - $start_limit; } $read['jupend'] = $start_limit == $count - 1 ? "<a name=a></a><a name={$read['pid']}></a>" : "<a name={$read['pid']}></a>"; $tpc_buy = $read['buy']; $tpc_pid = $read['pid']; $tpc_tag = NULL; $tpc_shield = 0; $read['ifsign'] < 2 && ($read['content'] = str_replace("\n", "<br />", $read['content'])); if ($read['anonymous']) { $anonymous = !$isGM && $winduid != $read['authorid'] && !$pwSystem['anonyhide']; $read['anonymousname'] = $GLOBALS['db_anonymousname']; } else { $anonymous = false; $read['anonymousname'] = $read['username']; } $read['ipfrom'] = $db_ipfrom == 1 && $_G['viewipfrom'] ? $read['ipfrom'] : ''; $read['ip'] = $isGM || $pwSystem['viewip'] ? 'IP:' . $read['userip'] : ''; if ($read['groupid'] && !$anonymous) { $read['groupid'] == '-1' && ($read['groupid'] = $read['memberid']); !array_key_exists($read['groupid'], (array) $lpic) && ($read['groupid'] = 8); $read['lpic'] = $lpic[$read['groupid']]; $read['level'] = $ltitle[$read['groupid']]; $read['regdate'] = get_date($read['regdate'], "Y-m-d"); $read['lastlogin'] = get_date($read['lastvisit'], "Y-m-d"); $read['rvrc'] = floor($read['rvrc'] / 10); $read['author'] = $read['username']; $tpc_author = $read['author']; if (!empty($GLOBALS['showfield'])) { $customdata = $read['customdata'] ? (array) unserialize($read['customdata']) : array(); $read['customdata'] = array(); foreach ($customdata as $key => $val) { if ($val && in_array($key, $GLOBALS['showfield'])) { $read['customdata'][$key] = $val; } } } $read['ontime'] = (int) ($read['onlinetime'] / 3600); $read['groupid'] == 6 && ($read['honor'] = ''); if ($read['groupid'] != 6 && ($read['ifsign'] == 1 || $read['ifsign'] == 3)) { global $sign; if (!$sign[$read['author']]) { global $db_signmoney, $db_signgroup, $tdtime, $db_signcurtype; if ($db_signmoney && strpos($db_signgroup, ",{$read['groupid']},") !== false && (!getstatus($read['userstatus'], PW_USERSTATUS_SHOWSIGN) || !$read['starttime'] || $read[$db_signcurtype] < ($tdtime - $read['starttime']) / 86400 * $db_signmoney)) { $read['signature'] = ''; } else { if ($db_signwindcode && getstatus($read['userstatus'], PW_USERSTATUS_SIGNCHANGE)) { if ($GLOBALS['gp_right'][$read['groupid']]['imgwidth'] && $GLOBALS['gp_right'][$read['groupid']]['imgheight']) { $db_windpic['picwidth'] = $GLOBALS['gp_right'][$read['groupid']]['imgwidth']; $db_windpic['picheight'] = $GLOBALS['gp_right'][$read['groupid']]['imgheight']; } if ($GLOBALS['gp_right'][$read['groupid']]['fontsize']) { $db_windpic['size'] = $GLOBALS['gp_right'][$read['groupid']]['fontsize']; } $read['signature'] = convert($read['signature'], $db_windpic, 2); } $read['signature'] = str_replace("\n", "<br />", $read['signature']); } $sign[$read['author']] = $read['signature']; } else { $read['signature'] = $sign[$read['author']]; } } else { $read['signature'] = ''; } } else { $read['lpic'] = $lpic['2']; $read['level'] = $read['digests'] = $read['postnum'] = $read['money'] = $read['currency'] = '*'; $read['rvrc'] = $read['lastlogin'] = $read['credit'] = $read['regdate'] = '*'; $read['honor'] = $read['signature'] = $read['micon'] = $read['aliww'] = ''; if ($anonymous) { $read['oicq'] = $read['ip'] = $read['medals'] = $read['ipfrom'] = ''; $read['author'] = $GLOBALS['db_anonymousname']; $read['authorid'] = 0; foreach ($GLOBALS['customfield'] as $key => $val) { $field = "field_" . (int) $val['id']; $read[$field] = '*'; } } } list($read['face'], , $httpWidth, $httpHeight, , , , $read['facesize']) = showfacedesign($read['micon'], true, 'm'); if ($httpWidth > 120 || $httpHeight > 120 || $read['facesize'] == '') { $read['facesize'] = ' width="120" height="120"'; } list($read['posttime'], $read['postdate']) = getLastDate($read['postdate']); $read['mark'] = $read['reward'] = $read['tag'] = NULL; if ($read['ifmark']) { $ping_logs[$read['pid']] = $read['ifmark']; } if ($rewardtype != null) { if ($read['lou'] == 0 || $read['ifreward'] > 0 || $rewardtype == '0' && $winduid == $GLOBALS['authorid'] && $winduid != $read['authorid']) { $read['reward'] = Getrewhtml($read['lou'], $read['ifreward'], $read['pid']); } } if ($read['icon']) { $read['icon'] = "<img src=\"{$imgpath}/post/emotion/{$read['icon']}.gif\" align=\"left\" border=\"0\" />"; } else { $read['icon'] = ''; } if ($db_md_ifopen && $read['medals']) { $medals = $ifMedalNotExist = ''; $md_a = explode(',', $read['medals']); foreach ($md_a as $key => $value) { if ($value && $_MEDALDB[$value]) { $medals .= "<a href=\"apps.php?q=medal\" target=\"_blank\"><img src=\"{$_MEDALDB[$value][smallimage]}\" width=\"30\" height=\"30\" title=\"{$_MEDALDB[$value][name]}\" /></a>"; } else { unset($md_a[$key]); $ifMedalNotExist = 1; } } if ($ifMedalNotExist == 1) { $newMedalInfo = implode(',', $md_a); $userService = L::loadClass('UserService', 'user'); /* @var $userService PW_UserService */ $userService->update($read['authorid'], array('medals' => $newMedalInfo)); } $read['medals'] = $medals . '<br />'; } else { $read['medals'] = ''; } $read['leaveword'] && ($read['content'] .= leaveword($read['leaveword'], $read['pid'])); if ($read['ifshield'] || $read['groupid'] == 6 && $db_shield) { if ($read['ifshield'] == 2) { $read['content'] = shield('shield_del_article'); $read['subject'] = ''; $tpc_shield = 1; } else { if ($groupid == '3') { $read['subject'] = shield('shield_title'); } else { $read['content'] = shield($read['ifshield'] ? 'shield_article' : 'ban_article'); $read['subject'] = ''; $tpc_shield = 1; } } $read['icon'] = ''; } if (!$tpc_shield) { if ($read['ifwordsfb'] != $GLOBALS['db_wordsfb']) { $read['content'] = wordsConvert($read['content'], array('id' => $tpc_pid == 'tpc' ? $tid : $tpc_pid, 'type' => $tpc_pid == 'tpc' ? 'topic' : 'posts', 'code' => $read['ifwordsfb'])); } if ($read['ifconvert'] == 2) { $read['content'] = convert($read['content'], $db_windpost); } else { $tpc_tag && ($read['content'] = relatetag($read['content'], $tpc_tag)); strpos($read['content'], '[s:') !== false && ($read['content'] = showface($read['content'])); } if ($read['aid'] && $GLOBALS['attachShow']->isShow($read['ifhide'], $tid)) { $read += $GLOBALS['attachShow']->parseAttachs($read['pid'], $read['content'], $winduid == $read['authorid']); } } /** * convert the post content */ $read['alterinfo'] && ($read['content'] .= "<div id=\"alert_{$read['pid']}\" style=\"color:gray;margin-top:30px\">[ {$read['alterinfo']} ]</div>"); if ($read['remindinfo']) { $remind = explode("\t", $read['remindinfo']); $remind[0] = str_replace("\n", "<br />", $remind[0]); $remind[2] && ($remind[2] = get_date($remind[2])); $read['remindinfo'] = $remind; } if ($_GET['keyword']) { $keywords = explode("|", $_GET['keyword']); foreach ($keywords as $key => $value) { if ($value) { $read['content'] = preg_replace("/(?<=[\\s\"\\]>()]|[-�]|^)(" . preg_quote($value, '/') . ")([.,:;-?!()\\s\"<\\[]|[-�]|\$)/siU", "<u><font color=\"red\">\\1</font></u>\\2", $read['content']); } } } //$GLOBALS['foruminfo']['copyctrl'] && $read['content'] = preg_replace("/<br \/>/eis","copyctrl()",$read['content']); return $read; }
} if ($dateMonth < 10) { $dateMonth = "0" . $dateMonth; } } } $endDate = $dateYear . $dateMonth . $dateDay . "000000"; } echo "\n\nFINISHED STARTUP\n\n"; return; } else { if ($argv[0] == "update") { //This is used to update the table from the last date //data was entered until now echo "\n\nSTARTING UPDATE\n\n"; $startDate = getLastDate($dbr); if ($argv[1] != null && preg_match('@[^0-9]@', $endDate) == 0) { $now = $argv[1] . "000000"; } else { $now = wfTimestamp(TS_MW, time()); } //Grab the old stats so we can compare $oldStats = getStats($dbr); //update the new stats updateStats($dbw, $dbr, $startDate, $now); //Grab the new stats $newStats = getStats($dbr); $editedStats = array(); $createdStats = array(); $nabStats = array(); $patrolStats = array();