コード例 #1
0
function output_story($db, $article_id, $preview_only = FALSE)
{
    if (empty($article_id)) {
        return;
    }
    $sql = 'SELECT
			name, is_published, title, article_text,
			UNIX_TIMESTAMP(submit_date) as submit_date,
			UNIX_TIMESTAMP(publish_date) as publish_date
		FROM
			cms_articles a JOIN cms_users u ON a.user_id = u.user_id
		WHERE
			article_id = ' . $article_id;
    $result = mysql_query($sql, $db) or die(mysql_error($db));
    if ($row = mysql_fetch_assoc($result)) {
        extract($row);
        echo '<h2>' . htmlspecialchars($title) . '</h2>';
        echo '<p>By: ' . htmlspecialchars($name) . '</p>';
        echo '<p>';
        if ($is_published) {
            echo date('F j, Y', $publish_date);
        } else {
            echo 'Article is not yet published.';
        }
        echo '</p>';
        if ($preview_only) {
            echo '<p>' . nl2br(htmlspecialchars(trim_body($article_text))) . '</p>';
            echo '<p><a href="view_article.php?article_id=' . $article_id . '">Read Full Story</a></p>';
        } else {
            echo '<p>' . nl2br(htmlspecialchars($article_text)) . '</p>';
        }
    }
    mysql_free_result($result);
}
コード例 #2
0
$logic_options = tmpl_draw_select_opt("AND\nOR", "AND\nOR", $search_logic, '', '');
$sort_options = tmpl_draw_select_opt("DESC\nASC", "Descending Order\nAscending Order", $sort_order, '', '');
$TITLE_EXTRA = ': Search For ' . htmlspecialchars($srch);
ses_update_status($usr->sid, 'Searching posts');
$page_pager = '';
if ($srch) {
    if (!($c =& fetch_search_cache($srch, $start, $ppg, $search_logic, $field, $sort_order, $forum_limiter, $total))) {
        $search_data = '<br />
<table border="0" cellspacing="1" cellpadding="2" class="ContentTable">
<tr class="RowStyleA"><th colspan=2 width="100%" align="center">No Results</th></tr>
</table>';
    } else {
        $i = 0;
        $search_data = '';
        while ($r = db_rowobj($c)) {
            $body = trim_body(read_msg_body($r->foff, $r->length, $r->file_id));
            $poster_info = !empty($r->poster_id) ? '<a class="GenLink" href="/egroupware/fudforum/3814588639/index.php?t=usrinfo&amp;id=' . $r->poster_id . '&amp;' . _rsid . '">' . $r->alias . '</a>' : '' . $GLOBALS['ANON_NICK'];
            ++$i;
            $search_data .= '<tr class="' . alt_var('search_alt', 'RowStyleA', 'RowStyleB') . '"><td class="GenText" width="100%">' . $i . '. <a class="GenLink" href="/egroupware/fudforum/3814588639/index.php?t=' . d_thread_view . '&amp;goto=' . $r->id . '&amp;' . _rsid . '">' . $r->subject . '</a><br />' . $body . '</td><td class="GenText" nowrap><a class="GenLink" href="/egroupware/fudforum/3814588639/index.php?t=' . t_thread_view . '&amp;frm_id=' . $r->forum_id . '&amp;' . _rsid . '">' . $r->forum_name . '</a></td><td class="GenText" nowrap><font class="DateText">' . strftime("%a, %d %B %Y %H:%M", $r->post_stamp) . '</font> By: ' . $poster_info . '</td></tr>';
        }
        un_register_fps();
        $search_data = '<br />
<table border="0" cellspacing="1" cellpadding="2" class="ContentTable">
<tr><th width="100%">Subject</th><th>Forum</th><th nowrap>Posted On</th></tr>
' . $search_data . '
</table>';
        $page_pager = tmpl_create_pager($start, $ppg, $total, '/egroupware/fudforum/3814588639/index.php?t=search&amp;srch=' . urlencode($srch) . '&amp;field=' . $field . '&amp;' . _rsid . '&amp;search_logic=' . $search_logic . '&amp;sort_order=' . $sort_order . '&amp;forum_limiter=' . $forum_limiter);
    }
} else {
    $search_data = '';
}