Example #1
0
function threadrelated($relatedcon)
{
    global $db, $db_iftag, $db_threadrelated, $forumset, $fid, $read, $tid, $db_modes, $db_dopen, $db_phopen, $db_share_open, $db_groups_open, $groupid, $timestamp;
    $relatedb = array();
    if (in_array($relatedcon, array('allpost', 'alldigest', 'allhits', 'allreply', 'forumpost', 'forumdigest', 'forumhits', 'forumreply'))) {
        //require_once(R_P.'require/element.class.php');
        //$element = new Element($forumset['relatednums']);
        $element = L::loadClass('element');
        $element->setDefaultNum($forumset['relatednums']);
        switch ($relatedcon) {
            case 'allpost':
                $relatedb = $element->newSubject();
                break;
            case 'alldigest':
                $relatedb = $element->digestSubject();
                break;
            case 'allhits':
                $relatedb = $element->hitSort();
                break;
            case 'allreply':
                $relatedb = $element->replySort();
                break;
            case 'forumpost':
                $relatedb = $element->newSubject($fid);
                break;
            case 'forumdigest':
                $relatedb = $element->digestSubject($fid);
                break;
            case 'forumhits':
                $relatedb = $element->hitSort($fid);
                break;
            case 'forumreply':
                $relatedb = $element->replySort($fid);
                break;
        }
    } elseif ($relatedcon == 'oinfo') {
        //继续改进
        if ($db_modes['o']['ifopen']) {
            require_once "require/app_core.php";
            $addwhere = '';
            if (!$db_dopen) {
                $addwhere .= " AND type!='diary'";
            }
            if (!$db_phopen) {
                $addwhere .= " AND type!='photo'";
            }
            if (!$db_share_open) {
                $addwhere .= " AND type!='share'";
            }
            if (!$db_groups_open) {
                $addwhere .= " AND type!='colony'";
            }
            $query = $db->query("SELECT type,descrip FROM pw_feed WHERE uid=" . S::sqlEscape($read['authorid']) . $addwhere . " ORDER BY timestamp DESC  " . S::sqlLimit(0, $forumset['relatednums']));
            while ($rt = $db->fetch_array($query)) {
                $rt['title'] = parseFeedRead($rt['descrip']);
                $rt['url'] = USER_URL . "{$read['authorid']}";
                unset($rt['type']);
                $relatedb[] = $rt;
            }
        }
    } elseif (in_array($relatedcon, array('pictags', 'hottags'))) {
        $tagid = $tagdbs = array();
        $endtime = $timestamp - 30 * 24 * 3600;
        $sql = 'WHERE t.ifcheck=1 AND t.tid !=' . S::sqlEscape($tid) . ' AND t.postdate >=' . S::sqlEscape($endtime);
        $fidout = array('0');
        $query = $db->query("SELECT fid,allowvisit,password FROM pw_forums WHERE type<>'category'");
        while ($rt = $db->fetch_array($query)) {
            $allowvisit = !$rt['allowvisit'] || $rt['allowvisit'] != str_replace(",{$groupid},", '', $rt['allowvisit']) ? true : false;
            if ($rt['password'] || !$allowvisit) {
                $fidout[] = $rt['fid'];
            }
        }
        $fidout = S::sqlImplode($fidout);
        $fidout && ($sql .= " AND fid NOT IN ({$fidout})");
        if ($db_iftag) {
            if ($read['tags'] && $relatedcon == 'pictags') {
                list($tagdb, $tpc_tag) = explode("\t", $read['tags']);
                $tagdbs = explode(' ', $tagdb);
            } elseif ($relatedcon == 'hottags') {
                //* @include_once (D_P.'data/bbscache/tagdb.php');
                extract(pwCache::getData(D_P . "data/bbscache/tagdb.php", false));
                $j = 0;
                foreach ($tagdb as $key => $val) {
                    $j++;
                    if ($j > 5) {
                        break;
                    }
                    $tagdbs[] = $key;
                }
                unset($tagdb);
            }
            if ($tagdbs) {
                $query = $db->query("SELECT tagid FROM pw_tags WHERE tagname IN(" . S::sqlImplode($tagdbs) . ')');
                while ($rt = $db->fetch_array($query)) {
                    $tagid[] = $rt['tagid'];
                }
            }
            if ($tagid) {
                $query = $db->query("SELECT t.tid,t.subject FROM pw_tagdata tg LEFT JOIN pw_threads t USING(tid) {$sql} AND tg.tagid IN(" . S::sqlImplode($tagid) . ") GROUP BY tid ORDER BY postdate DESC " . S::sqlLimit(0, $forumset['relatednums']));
                while ($rt = $db->fetch_array($query)) {
                    $rt['title'] = $rt['subject'];
                    $rt['url'] = "read.php?tid=" . $rt['tid'];
                    unset($rt['subject']);
                    unset($rt['tid']);
                    $relatedb[] = $rt;
                }
            }
        }
    } elseif (in_array($relatedcon, array('ownpost', 'owndigest', 'ownhits', 'ownreply'))) {
        $endtime = $timestamp - 15 * 24 * 3600;
        $sql = "WHERE ifcheck=1 AND tid !=" . S::sqlEscape($tid) . "AND postdate >=" . S::sqlEscape($endtime) . " AND authorid=" . S::sqlEscape($read['authorid']) . " AND fid>0 ";
        $orderby = '';
        switch ($relatedcon) {
            case 'ownpost':
                $orderby .= " ORDER BY postdate DESC";
                break;
            case 'owndigest':
                $sql .= " AND digest>0";
                $orderby .= " ORDER BY postdate DESC";
                break;
            case 'ownhits':
                $orderby .= " ORDER BY hits DESC";
                break;
            case 'ownreply':
                $orderby .= " ORDER BY replies DESC";
                break;
        }
        $query = $db->query("SELECT tid,subject FROM pw_threads FORCE INDEX(" . getForceIndex('idx_postdate') . ") {$sql} {$orderby}" . S::sqlLimit(0, $forumset['relatednums']));
        while ($rt = $db->fetch_array($query)) {
            $rt['title'] = $rt['subject'];
            $rt['url'] = "read.php?tid=" . $rt['tid'];
            unset($rt['subject']);
            unset($rt['tid']);
            $relatedb[] = $rt;
        }
    }
    return $relatedb;
}
Example #2
0
 $forceIndex = '';
 if ($author) {
     $authorarray = explode(",", $author);
     foreach ($authorarray as $value) {
         $value = addslashes(str_replace('*', '%', $value));
         $authorwhere .= " OR username LIKE " . S::sqlEscape($value);
     }
     $authorwhere = substr_replace($authorwhere, "", 0, 3);
     $authorids = array();
     $query = $db->query("SELECT uid FROM pw_members WHERE {$authorwhere}");
     while ($rt = $db->fetch_array($query)) {
         $authorids[] = $rt['uid'];
     }
     if ($authorids) {
         $sql .= " AND authorid IN(" . S::sqlImplode($authorids) . ")";
         $forceIndex = " FORCE INDEX(" . getForceIndex('idx_postdate') . ") ";
     } else {
         adminmsg('author_nofind');
     }
 }
 if ($keyword) {
     $keyword = trim($keyword);
     $keywordarray = explode(",", $keyword);
     foreach ($keywordarray as $value) {
         $value = str_replace('*', '%', $value);
         $keywhere .= " OR content LIKE " . S::sqlEscape("%{$value}%");
     }
     $keywhere = substr_replace($keywhere, "", 0, 3);
     $sql .= " AND ({$keywhere}) ";
 }
 if ($userip) {
Example #3
0
         exit('Forbidden');
     }
 }
 $sql = $forceindex = '';
 if ($fid) {
     $sql = "WHERE t.fid=" . pwEscape($fid) . " AND ifcheck=1 AND t.ifshield=0\n\t\t\t\t\t\t  AND specialsort='0' AND postdate>" . pwEscape($timestamp - 604800) . " \n\t\t\t\t\tORDER BY postdate DESC LIMIT {$Rss_listnum}";
 } else {
     $fids = $extra = '';
     $query = $db->query("SELECT fid \n\t\t\t\t\t\t\t\tFROM pw_forums \n\t\t\t\t\t\t\t\tWHERE allowvisit='' AND f_type!='hidden' AND password='' AND forumsell=''");
     while ($rt = $db->fetch_array($query)) {
         $fids .= $extra . "'" . $rt['fid'] . "'";
         $extra = ',';
     }
     if ($fids) {
         $sql = "WHERE t.fid IN({$fids}) AND ifcheck=1 AND specialsort='0' AND ifshield=0 AND postdate>" . pwEscape($timestamp - 604800) . " \n\t\t\t\t\t\tORDER BY postdate DESC \n\t\t\t\t\t\tLIMIT {$Rss_newnum}";
         $forceindex = 'FORCE INDEX (' . getForceIndex('idx_postdate') . ')';
     }
 }
 $title = $fid ? strip_tags($forum[$fid]['name']) : $db_bbsname;
 $title = decodeRssHtml($title);
 $title = xmlEscape($title);
 $channel = array('title' => $title, 'link' => $db_bbsurl, 'description' => "最新帖子", 'copyright' => "Copyright(C) {$db_bbsname}", 'generator' => "http://www.phpwind.com", 'lastBuildDate' => date('r'), 'ttl' => $ttl);
 $Rss = new Rss(array('xml' => "1.0", 'rss' => "2.0", 'encoding' => $db_charset));
 if ($sql) {
     $query = $db->query("SELECT t.tid,t.fid,t.subject,t.author,t.ifhide,t.postdate,t.anonymous,fe.forumset as forumset \n\t\t\t\t\t\t\t\tFROM pw_threads t {$forceindex} \n\t\t\t\t\t\t\t\tLEFT JOIN pw_forumsextra fe ON t.fid=fe.fid {$sql}");
     $lastPostFlag = true;
     $threaddbs = array();
     while ($threaddb = $db->fetch_array($query)) {
         $threaddbs[$threaddb[tid]] = $threaddb;
     }
     if (S::isArray($threaddbs)) {
Example #4
0
function setTidsCache($type)
{
    global $db, $fid, $timestamp, $_filename, $t;
    $useIndex = "";
    $orderby = '';
    $where = "WHERE " . ($fid ? " fid= " . pwEscape($fid) : "fid IN (" . getFidsForWap() . ")") . " AND specialsort=0 AND ifcheck=1";
    if ($type == 'digest') {
        $where .= " AND digest>0";
        $orderby = "ORDER BY topped DESC,lastpost DESC";
    } elseif ($type == 'hot') {
        $time = (int) 3600 * 24 * 30;
        if ($t == '1') {
            $time = (int) 3600 * 24;
        } elseif ($t == '2') {
            $time = (int) 3600 * 24 * 3;
        } elseif ($t == '3') {
            $time = (int) 3600 * 24 * 7;
        } elseif ($t == '4') {
            $time = (int) 3600 * 24 * 30;
        }
        $where .= " AND postdate>" . (int) ($timestamp - $time);
        $orderby = "ORDER BY replies DESC";
    } elseif ($type == 'new') {
        $useIndex = 'USE INDEX (' . getForceIndex('idx_postdate') . ')';
        $orderby = "ORDER BY postdate DESC";
    } else {
        $orderby = "ORDER BY specialsort DESC,lastpost DESC";
    }
    $limit = "LIMIT 0,500";
    $query = $db->query("SELECT tid FROM pw_threads {$useIndex} {$where} {$orderby} {$limit}");
    $result = array();
    $result['uptime'] = $timestamp;
    while ($rt = $db->fetch_array($query)) {
        $result['tids'] .= $rt['tid'] . ',';
    }
    if (is_file($_filename)) {
        include $_filename;
    }
    $tidsCache[$type] = $result;
    writeover($_filename, "<?php\r\n\$tidsCache=" . pw_var_export($tidsCache) . "\r\n?>");
    return $result['tids'];
}
Example #5
0
                if (in_array($value, $currentPostsId)) {
                    $readdb[] = $currentPosts[$value];
                } else {
                    $readdb[] = array('postdate' => 'N', 'content' => getLangInfo('bbscode', 'post_deleted'));
                }
            }
        }
    } else {
        $start_limit = ($page - 1) * $db_readperpage;
        if ($page == 1) {
            $readnum = $db_readperpage - 1;
        } else {
            $readnum = $db_readperpage;
            $start_limit--;
        }
        $query = $db->query("SELECT p.*,m.uid,m.groupid,m.userstatus FROM {$pw_posts} p  force index(" . getForceIndex('idx_tid') . ") LEFT JOIN pw_members m ON p.authorid=m.uid WHERE p.tid=" . S::sqlEscape($tid) . " AND p.ifcheck='1' ORDER BY p.postdate" . S::sqlLimit($start_limit, $readnum));
        while ($read = $db->fetch_array($query)) {
            $readdb[] = $read;
        }
    }
    $db->free_result($query);
}
$bandb = isban($readdb, $fid);
$start_limit = ($page - 1) * $db_readperpage;
foreach ($readdb as $key => $read) {
    isset($bandb[$read['authorid']]) && ($read['groupid'] = 6);
    $readdb[$key] = viewread($read, $start_limit++);
}
function viewread($read, $start_limit)
{
    global $groupid, $admincheck, $attach_url, $attachper, $winduid, $tablecolor, $tpc_author, $tpc_buy, $count, $timestamp, $db_onlinetime, $attachpath, $_G, $readcolorone, $readcolortwo, $lpic, $ltitle, $imgpath, $db_ipfrom, $db_showonline, $stylepath, $db_windpost, $db_windpic, $db_signwindcode, $fid, $tid, $pid, $pic_a, $db_shield, $db_anonymousname;
Example #6
0
 /**
  * 获取精华帖
  *
  * @param string $type 	:无用参数
  * @param string $fid
  * @param int $num
  * @param int $special
  * @return array
  */
 function digestSubject($round = 0, $num = 0, $special = 0)
 {
     !in_array($special, array(1, 2)) && ($special = 0);
     $fid = $this->_cookFid($round);
     $num = intval($num) ? intval($num) : $this->defaultnum;
     $sqladd = '';
     $fid && ($sqladd .= " AND fid IN ({$fid}) ");
     $sqladd .= $special ? ' AND digest=' . S::sqlEscape($special) : "AND digest>'0'";
     $sqladd .= $this->_getBlackList('tid', $GLOBALS['db_tidblacklist']);
     $sql = "SELECT tid,fid,author,authorid,subject,type,postdate,hits,replies,digest,lastpost FROM pw_threads FORCE INDEX (" . getForceIndex('idx_digest') . ") WHERE ifcheck=1 {$sqladd} AND ifshield != 1 AND locked != 2 ORDER BY tid DESC " . S::sqlLimit($num);
     $query = $this->db->query($sql);
     while ($rt = $this->db->fetch_array($query)) {
         $posts[] = $this->_cookSubjectData($rt);
     }
     return $posts;
 }
Example #7
0
 /**
  * get post lists
  * $type must in array('newsubject','newreply','replysort','hitsort')
  *
  * @param string $type
  * @param int $fid
  * @param int $num
  * @param int $hour
  * @return array
  */
 function getPostList($type, $fid, $num = 0, $hour = 0, $special = 0)
 {
     global $db_ptable, $timestamp, $db_tidblacklist;
     $posttype = array('newsubject', 'newreply', 'replysort', 'hitsort');
     if (!in_array($type, $posttype)) {
         return false;
     }
     !$fid && ($fid = getCommonFid());
     $num = (int) $num;
     $hour = (int) $hour;
     $special = (int) $special;
     !$num && ($num = $this->cachenum);
     $time = $hour ? strlen($hour) == 10 ? $hour : $timestamp - intval($hour) * 3600 : 0;
     $sqladd = '';
     if ($type == 'replysort' || $type == 'newsubject') {
         $forceindex = '';
         $special && ($sqladd .= 'AND t.special=' . S::sqlEscape($special));
         $sqladd .= $time ? ' AND t.postdate>' . S::sqlEscape($time) : '';
         if ($fid) {
             if (strpos($fid, ',') === false) {
                 $fid = trim($fid, "'");
                 $sqladd .= " AND t.fid=" . S::sqlEscape($fid, false);
                 if ($type == 'newsubject') {
                     $forumpost = $this->db->get_value("SELECT topic FROM pw_forumdata WHERE fid=" . S::sqlEscape($fid, false));
                     if ($forumpost < 100) {
                         $forceindex = 'FORCE INDEX(' . getForceIndex('idx_fid_ifcheck_specialsort_lastpost') . ')';
                     } else {
                         $forceindex = 'FORCE INDEX(' . getForceIndex('idx_postdate') . ')';
                     }
                 }
             } else {
                 $sqladd .= " AND t.fid IN ({$fid}) ";
                 if ($type == 'newsubject') {
                     $forceindex = 'FORCE INDEX(' . getForceIndex('idx_postdate') . ')';
                 }
             }
         }
         $sqladd .= $this->_getBlackList('t.tid', $db_tidblacklist);
     } else {
         $sqladd .= $time ? ' AND postdate>' . S::sqlEscape($time) : '';
         if ($fid) {
             if (is_numeric($fid)) {
                 $sqladd .= " AND fid ={$fid} ";
             } else {
                 $sqladd .= " AND fid IN ({$fid}) ";
             }
         }
         $sqladd .= $this->_getBlackList('tid', $db_tidblacklist);
     }
     if ($type == 'newsubject') {
         if ($this->reality == false) {
             $sql = "SELECT t.tid AS id,t.postdate AS value FROM pw_threads t {$forceindex} WHERE t.ifcheck=1 AND t.anonymous != 1 AND t.ifshield != 1 AND t.locked != 2 {$sqladd} ORDER BY t.postdate DESC " . S::sqlLimit($num);
         } else {
             if ($special == 2) {
                 $sql = "SELECT a.*,t.fid FROM pw_threads t LEFT JOIN pw_activity a ON t.tid=a.tid WHERE t.ifcheck='1' AND t.anonymous != 1 AND t.ifshield != 1 AND t.locked != 2 {$sqladd} ORDER BY t.tid DESC " . S::sqlLimit($num);
             } elseif ($special == 3) {
                 global $db_moneyname, $db_rvrcname, $db_creditname, $db_currencyname, $_CREDITDB;
                 $cType = array('money' => $db_moneyname, 'rvrc' => $db_rvrcname, 'credit' => $db_creditname, 'currency' => $db_currencyname);
                 foreach ($_CREDITDB as $k => $v) {
                     $cType[$k] = $v[0];
                 }
                 $sql = "SELECT r.tid,r.cbtype,r.catype,r.cbval,r.caval,r.timelimit,t.fid,t.author,t.authorid,t.subject,t.type,t.postdate,t.hits,t.replies ,t.lastpost FROM pw_threads t LEFT JOIN pw_reward r ON t.tid=r.tid WHERE t.ifcheck='1' AND t.anonymous != 1 AND t.ifshield != 1 AND t.locked != 2 {$sqladd} ORDER BY t.tid DESC " . S::sqlLimit($num);
             } elseif ($special == 4) {
                 $sql = "SELECT tr.tid,tr.name,tr.icon,tr.price,t.fid FROM pw_threads t LEFT JOIN pw_trade tr ON t.tid=tr.tid WHERE t.ifcheck='1' AND t.anonymous != 1 AND t.ifshield != 1 AND t.locked != 2 {$sqladd} ORDER BY t.tid DESC " . S::sqlLimit($num);
             } else {
                 $sql = "SELECT t.tid,t.fid,t.author,t.authorid,t.subject,t.type,t.postdate,t.hits,t.replies,t.lastpost FROM pw_threads t {$forceindex} WHERE ifcheck=1 AND t.anonymous != 1 AND t.ifshield != 1 AND t.locked != 2 {$sqladd} ORDER BY postdate DESC " . S::sqlLimit($num);
             }
         }
     } elseif ($type == 'newreply') {
         $pw_posts = GetPtable($db_ptable);
         $sql = "SELECT DISTINCT tid FROM {$pw_posts} FORCE INDEX(PRIMARY) WHERE ifcheck=1 {$sqladd} ORDER BY pid DESC " . S::sqlLimit($num);
         $tids = array();
         $query = $this->db->query($sql);
         while ($reply = $this->db->fetch_array($query)) {
             $tids[] = $reply['tid'];
         }
         if ($tids) {
             if ($this->reality == false) {
                 $sql = "SELECT tid AS id,postdate AS value FROM pw_threads WHERE tid IN(" . S::sqlImplode($tids) . ") AND anonymous != 1 AND ifshield != 1 AND locked != 2 ORDER BY lastpost DESC";
             } else {
                 $sql = "SELECT tid,fid,author,authorid,subject,type,postdate,hits,replies,lastpost FROM pw_threads WHERE tid IN(" . S::sqlImplode($tids) . ") AND anonymous != 1 AND ifshield != 1 AND locked != 2 ORDER BY lastpost DESC";
             }
         } else {
             return false;
         }
     } elseif ($type == 'replysort') {
         if ($this->reality == false) {
             $sql = "SELECT t.tid AS id,t.replies AS value,t.postdate AS addition FROM pw_threads t WHERE t.ifcheck='1' AND t.replies>0 AND t.ifshield != 1 AND t.locked != 2 {$sqladd} ORDER BY t.replies DESC " . S::sqlLimit($num);
         } else {
             if ($special == 2) {
                 $sql = "SELECT a.*,t.fid FROM pw_threads t LEFT JOIN pw_activity a ON t.tid=a.tid WHERE t.ifcheck='1' AND t.replies>0 AND t.ifshield != 1 AND t.locked != 2 {$sqladd} ORDER BY t.replies DESC " . S::sqlLimit($num);
             } elseif ($special == 3) {
                 global $db_moneyname, $db_rvrcname, $db_creditname, $db_currencyname, $_CREDITDB;
                 $cType = array('money' => $db_moneyname, 'rvrc' => $db_rvrcname, 'credit' => $db_creditname, 'currency' => $db_currencyname);
                 foreach ($_CREDITDB as $k => $v) {
                     $cType[$k] = $v[0];
                 }
                 $sql = "SELECT r.tid,r.cbtype,r.catype,r.cbval,r.caval,r.timelimit,t.fid,t.author,t.authorid,t.subject,t.type,t.postdate,t.hits,t.replies,t.lastpost FROM pw_threads t LEFT JOIN pw_reward r ON t.tid=r.tid WHERE t.ifcheck='1' AND t.replies>0 AND t.ifshield != 1 AND t.locked != 2 {$sqladd} ORDER BY t.replies DESC " . S::sqlLimit($num);
             } elseif ($special == 4) {
                 $sql = "SELECT tr.tid,tr.name,tr.icon,tr.price,t.fid,t.postdate FROM pw_threads t LEFT JOIN pw_trade tr ON t.tid=tr.tid WHERE t.ifcheck='1' AND t.replies>0 AND t.ifshield != 1 AND t.locked != 2 {$sqladd} ORDER BY t.replies DESC " . S::sqlLimit($num);
             } else {
                 $sql = "SELECT t.tid,t.fid,t.author,t.authorid,t.subject,t.type,t.postdate,t.hits,t.replies,t.lastpost FROM pw_threads t WHERE t.ifcheck='1' AND t.replies>0 AND t.ifshield != 1 AND t.locked != 2 {$sqladd} ORDER BY t.replies DESC " . S::sqlLimit($num);
             }
         }
     } elseif ($type == 'hitsort') {
         if ($this->reality == false) {
             $sql = "SELECT tid AS id,hits AS value,postdate AS addition FROM pw_threads WHERE ifcheck='1' AND hits>0 AND ifshield != 1 AND locked != 2 {$sqladd} ORDER BY hits DESC " . S::sqlLimit($num);
         } else {
             $sql = "SELECT tid,fid,author,authorid,subject,type,postdate,hits,replies,lastpost FROM pw_threads WHERE ifcheck='1' AND hits>0 AND ifshield != 1 AND locked != 2 {$sqladd} ORDER BY hits DESC " . S::sqlLimit($num);
         }
     }
     $posts = array();
     $query = $this->db->query($sql);
     while ($post = $this->db->fetch_array($query)) {
         if ($this->reality == false) {
             $type != 'newreply' && ($post['special'] = $special);
             $posts[] = $post;
         } else {
             $tem = array();
             $tem['url'] = 'read.php?tid=' . $post['tid'];
             $tem['authorurl'] = 'u.php?uid=' . $post['authorid'];
             if ($type == 'replysort' || $type == 'newsubject') {
                 if ($special == 2) {
                     $tem['title'] = $post['subject'];
                     $tem['value'] = $post['deadline'];
                     $tem['image'] = '';
                 } elseif ($special == 3) {
                     $tem['title'] = $post['subject'];
                     $tem['value'] = $cType[$post['cbtype']] . ":" . $post['cbval'];
                     $tem['image'] = '';
                 } elseif ($special == 4) {
                     $tem['title'] = $post['name'];
                     $tem['value'] = $post['price'];
                     $pic = geturl($post['icon'], 'show', 1);
                     if (is_array($pic)) {
                         $tem['image'] = $pic[0];
                     } else {
                         $tem['image'] = 'images/noproduct.gif';
                     }
                 } else {
                     $tem['title'] = $post['subject'];
                     $tem['value'] = $type == 'replysort' ? $post['replies'] : $post['postdate'];
                     $tem['image'] = '';
                 }
             } elseif ($type == 'hitsort') {
                 $tem['title'] = $post['subject'];
                 $tem['value'] = $post['hits'];
                 $tem['image'] = '';
             } else {
                 $tem['title'] = $post['subject'];
                 $tem['value'] = $post['postdate'];
                 $tem['image'] = '';
             }
             $tem['forumname'] = getForumName($post['fid']);
             $tem['forumurl'] = getForumUrl($post['fid']);
             list($tem['topictypename'], $tem['topictypeurl']) = getTopicType($post['type'], $post['fid']);
             $tem['addition'] = $post;
             $posts[] = $tem;
         }
     }
     return $posts;
 }
Example #8
0
 $sm_num < 1 && ($sm_num = 1000);
 if ($db_tlist) {
     $rt = $db->get_one("SELECT MAX(tid) AS mtid FROM pw_threads");
     $pw_tmsgs = GetTtable($rt['mtid']);
 } else {
     $pw_tmsgs = 'pw_tmsgs';
 }
 $fidoff = array('0');
 $query = $db->query("SELECT fid,allowvisit,password,f_type,forumsell FROM pw_forums WHERE type<>'category'");
 while ($rt = $db->fetch_array($query)) {
     if ($rt['f_type'] == 'hidden' || $rt['password'] || $rt['forumsell'] || $rt['allowvisit']) {
         $fidoff[] = $rt['fid'];
     }
 }
 $sql = $fidoff ? ' fid NOT IN(' . S::sqlImplode($fidoff) . ')' : '1';
 $query = $db->query("SELECT t.tid,t.fid,t.subject,t.postdate,t.lastpost,t.hits,t.replies,t.digest,tm.content FROM pw_threads t FORCE INDEX (" . getForceIndex('idx_postdate') . ") LEFT JOIN {$pw_tmsgs} tm ON t.tid=tm.tid WHERE {$sql} ORDER BY t.postdate DESC LIMIT {$sm_num}");
 while ($rt = $db->fetch_array($query)) {
     if ($db_htmifopen) {
         $link = "{$db_bbsurl}/read{$db_dir}tid-{$rt['tid']}{$db_ext}";
     } else {
         $link = "{$db_bbsurl}/read.php?tid={$rt['tid']}";
     }
     if ($for_google) {
         $mapinfo .= "\t<url>\r\n\t\t<loc>{$link}</loc>\r\n\t\t<lastmod>" . get_date($rt['lastpost']) . "</lastmod>\r\n\t\t<changefreq>daily</changefreq>\r\n\t\t<priority>0.5</priority>\r\n\t</url>\r\n";
     } else {
         $mapinfo .= "\t<item>\r\n\t\t<link>{$link}</link>\r\n\t\t<title>" . str_replace('&', '&amp;', $rt['subject']) . "</title>\r\n\t\t<pubDate>" . get_date($rt['postdate']) . "</pubDate>\r\n\t\t<bbs:lastDate>" . get_date($rt['lastpost']) . "</bbs:lastDate>\r\n\t\t<bbs:reply>{$rt['replies']}</bbs:reply>\r\n\t\t<bbs:hit>{$rt['hits']}</bbs:hit>\r\n\t\t<bbs:mainLen>" . strlen($rt['content']) . "</bbs:mainLen>\r\n\t\t<bbs:boardid>{$rt['fid']}</bbs:boardid>\r\n\t\t<bbs:pick>{$rt['digest']}</bbs:pick>\r\n\t</item>\r\n";
     }
 }
 $db_charset == 'gbk' && ($db_charset = 'GB2312');
 if ($for_google) {
     $mapinfo = "<urlset xmlns=\"http://www.google.com/schemas/sitemap/0.84\">\r\n" . $mapinfo . "</urlset>";