コード例 #1
0
ファイル: news.php プロジェクト: nqv/eposys
} else {
    // Class Paginate
    $epsclass->load_class('class_paginate');
    if ($nid < 1) {
        $sqls = array("SELECT COUNT(id) FROM " . TBL_NEWS . " WHERE type=1", "SELECT u1.username AS poster,u2.username AS editor, n.* FROM " . TBL_NEWS . " n LEFT JOIN " . TBL_USER . " u1 ON n.poster_id=u1.id LEFT JOIN " . TBL_USER . " AS u2 ON n.edit_by=u2.id WHERE n.type=1 ORDER BY n.post_time DESC");
        $result = $epsclass->paginate->get_result($sqls, 'index.php', $p, 10);
    } else {
        $sql = "SELECT u1.username AS poster,u2.username AS editor,n.* FROM " . TBL_NEWS . " n LEFT JOIN " . TBL_USER . " u1 ON n.poster_id=u1.id LEFT JOIN " . TBL_USER . " AS u2 ON n.edit_by=u2.id WHERE n.id='" . $epsclass->db->escape($nid) . "'";
        $result = $epsclass->db->query($sql) or error('Unable To fetch news', __FILE__, __LINE__, $epsclass->db->error());
    }
    if ($epsclass->db->num_rows($result)) {
        $news = array();
        while ($cur_news = $epsclass->db->fetch_assoc($result)) {
            // Truncate
            if (eps_strlen($cur_news['content']) > $max_length && $nid < 1) {
                $cur_news['content'] = eps_truncate($cur_news['content'], $max_length);
                $cur_news['title'] = auto_gen_link('index.php?nid=' . $cur_news['id'], html_clean($cur_news['title']));
            } else {
                $cur_news['title'] = html_clean($cur_news['title']);
            }
            // BBCode
            $cur_news['content'] = $epsclass->bbcode->format($cur_news['content'], $cur_news['no_smiley']);
            // Author Or MODADMIN
            if (!empty($eps_user['id']) && ($cur_news['poster_id'] == $eps_user['id'] || IS_MODADMIN)) {
                // Edit, Delete Link
                $cur_news['action'] = gen_editlink('index.php?eps=post&amp;nid=' . $cur_news['id']);
                // Last edit by
                if (!empty($cur_news['edit_by'])) {
                    $cur_news['content'] .= '<p class="postedit">' . $eps_lang['Last_edit_by'] . ': ' . html_clean($cur_news['editor']) . ' &raquo; ' . format_time($cur_news['edit_time']) . '</p>';
                }
            }
コード例 #2
0
ファイル: punbb_topic.php プロジェクト: nqv/eposys
// Forum ID's to exclude?
$forum_nfid = '';
if (empty($forum_prefix)) {
    return;
}
$forum_sql = '';
// Was any specific forum ID's supplied?
if (!empty($forum_fid)) {
    $fids = explode(',', trim($forum_fid));
    $fids = array_map('intval', $fids);
    if (!empty($fids)) {
        $forum_sql = ' AND f.id IN(' . implode(',', $fids) . ')';
    }
}
// Any forum ID's to exclude?
if (!empty($forum_nfid)) {
    $nfids = explode(',', trim($forum_nfid));
    $nfids = array_map('intval', $nfids);
    if (!empty($nfids)) {
        $forum_sql = ' AND f.id NOT IN(' . implode(',', $nfids) . ')';
    }
}
$result = $epsclass->db->query('SELECT t.id, t.subject FROM ' . $forum_prefix . 'topics AS t INNER JOIN ' . $forum_prefix . 'forums AS f ON f.id=t.forum_id LEFT JOIN ' . $forum_prefix . 'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=3) WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.moved_to IS NULL' . $forum_sql . ' ORDER BY t.last_post DESC LIMIT ' . $show_max_topics) or error('Unable to fetch topic list', __FILE__, __LINE__, $epsclass->db->error());
echo '<ul>';
while ($cur_topic = $epsclass->db->fetch_assoc($result)) {
    if (eps_strlen($cur_topic['subject']) > $max_subject_length) {
        $cur_topic['subject'] = eps_truncate($cur_topic['subject'], $max_subject_length);
    }
    echo '<li>' . gen_link('forum/viewtopic.php?id=' . $cur_topic['id'] . '&amp;action=new', htmlspecialchars($cur_topic['subject']), htmlspecialchars($cur_topic['subject'])) . '</li>' . "\n";
}
echo '</ul>';