Beispiel #1
0
/**
 * Article Box
 */
function display_article_box($row)
{
    global $cfg, $lang, $cd, $session_status, $id, $admin_dir, $article_addition;
    // Permanent Link
    if (empty($id)) {
        $permalink = '<a href="' . $cd . '/article.php?id=' . $row['id'] . '" title="' . $lang['permalink_title_1'] . htmlspecialchars(strip_tags($row['name'])) . $lang['permalink_title_2'] . '" rel="Bookmark">Permalink</a> ';
        $read_more = '<p class="read-more"><a href="' . $cd . '/article.php?id=' . $row['id'] . '" title="' . $row['name'] . '">' . $lang['more'] . '</a></p>';
        $row['comment'] = preg_replace('/<!-- ?more ?-->.*<!-- ?\\/more ?-->/is', $read_more, $row['comment']);
        $row['comment'] = preg_replace('/<!-- ?more ?-->.*/is', $read_more, $row['comment']);
    } else {
        $permalink = '';
    }
    if (file_exists($cd . '/include/user_include/plugins/plg_isbn.inc.php')) {
        include_once $cd . '/include/user_include/plugins/plg_isbn.inc.php';
        $FKMM_isbn = new FKMM_isbn();
        $row['comment'] = $FKMM_isbn->convert_isbn($row['comment']);
    }
    // Convert Text to XHTML
    if (file_exists($cd . '/include/user_include/plugins/plg_markdown.inc.php')) {
        include_once $cd . '/include/user_include/plugins/plg_markdown.inc.php';
        $FKMM_markdown = new FKMM_markdown();
        $row['comment'] = $FKMM_markdown->convert($row['comment']);
    } else {
        $row['comment'] = xhtml_auto_markup($row['comment']);
    }
    // Convert Enclosure
    if (file_exists($cd . '/rss/include/P_BLOG_RSS.class.php')) {
        include_once $cd . '/rss/include/P_BLOG_RSS.class.php';
        $p_rss = new P_BLOG_RSS();
        $row['comment'] = $p_rss->convertEnclosure($row['comment']);
    }
    $row['comment'] = preg_replace('/src="\\./', 'src="' . $cd, $row['comment']);
    // Smiley
    $row = smiley($row);
    // Article title
    if ($row['href'] == "http://") {
        $article_title = $row['name'];
    } else {
        $article_title = '<a href="' . $row['href'] . '">' . $row['name'] . "</a>\n";
    }
    // Time format
    if ($cfg['show_date_title'] == 'yes') {
        switch ($cfg['date_style']) {
            case '1':
                $df = 'Y/m/d';
                break;
            case '2':
                $df = 'M d, Y';
                break;
            default:
                $df = 'Y-m-d';
                break;
        }
        $row['date'] = date($df . ' G:i:s', strtotime($row['date']));
        $row['mod'] = date($df . ' G:i:s', strtotime($row['mod']));
    }
    if ($row['date'] != $row['mod']) {
        $row['date'] = date('G:i:s', strtotime($row['date']));
        $mod_str = ', ' . $lang['mod'] . ' @ ' . $row['mod'];
    } else {
        $row['date'] = date('G:i:s', strtotime($row['date']));
        $mod_str = '';
    }
    // Category
    $category_title = $lang['cat_title_1'] . $row['category'] . $lang['cat_title_2'];
    $category = '<a href="' . $cd . '/category.php?k=' . urlencode($row['category']) . '" title="' . $category_title . '">' . $row['category'] . '</a>';
    // Show date time
    if ($cfg['show_date_time'] == 'yes') {
        $date_time = '<div class="date">' . $lang['post'] . ' @ ' . $row['date'] . ' ' . $mod_str . ' | ' . $category . "</div>\n";
    } else {
        $date_time = '';
    }
    // Show e-mail link
    if ($cfg['use_email_link'] == 'yes') {
        $via_email_title = $lang['via_email_title_1'] . htmlspecialchars(strip_tags($row['name'])) . $lang['via_email_title_2'];
        $email_link = '<a href="' . $cd . '/var/feedback/index.php?id=feedback&amp;a_id=' . $row['id'] . '" title="' . $via_email_title . '">Email</a>';
    } else {
        $email_link = '';
    }
    // Show comment link
    if ($cfg['use_comment_link'] == 'yes' && @file_exists('./forum/index.php')) {
        switch ($cfg['comment_style']) {
            case '2':
                $comment = post_comment();
                // "Comment" style
                break;
            case '1':
                $comment = post_comment_forum();
                // "Forum" style
                break;
            default:
                $comment = post_comment();
                break;
        }
    } else {
        $comment = '';
    }
    // Show trackbacks
    if ($cfg['trackback'] == 'on') {
        $trackback = display_trackback($row);
    } else {
        $trackback = '';
    }
    // Show "Modify or Delete" button when Admin mode.
    if ($session_status == 'on') {
        if ($row['draft'] == '1') {
            $update_target = 'draft_update';
        } else {
            $update_target = 'update';
        }
        $admin_button = <<<EOD
<form action="{$cd}/{$admin_dir}/{$update_target}.php" method="post">
<div class="submit-button">
<input type="hidden" name="id" value="{$row['id']}" />
<input type="hidden" name="mode" value="log" />
<input type="hidden" name="post_username" value="" />
<input type="hidden" name="post_password" value="" />
<input type="submit" tabindex="1" accesskey="m" value="{$lang['mod_del']}" />
</div>
</form>
EOD;
    } else {
        $admin_button = '';
    }
    // Article footer
    if (!empty($id)) {
        // When Permalink
        if ($email_link != '') {
            $email_link = <<<EOD
<div class="a-footer">
{$email_link}
</div>
EOD;
        } else {
            $email_link = '';
        }
        $article_footer = <<<EOD
{$email_link}{$article_addition}
{$trackback}
{$comment}
{$admin_button}
EOD;
    } else {
        // When Index
        $article_footer = <<<EOD
<div class="a-footer">
{$permalink}{$email_link}
{$trackback}
{$comment}{$admin_button}
</div>
EOD;
    }
    //////////////// Presentation! /////////////////
    $article_box = <<<EOD
<div class="section">
<h3 class="article-title">{$article_title}</h3>
{$date_time}<div class="comment">
{$row['comment']}
</div>
{$article_footer}
</div><!-- End .section -->

EOD;
    return $article_box;
}
Beispiel #2
0
<?php

/**
 * RSS-2.0 generator
 *
 * @author  P_BLOG Project
 * @since   2005-11-28 09:59:34 updated: 2005-12-16 10:37:56
 */
$cd = '..';
require_once $cd . '/include/config.inc.php';
require_once './include/fnc_rss.inc.php';
require_once './include/P_BLOG_RSS.class.php';
$p_rss = new P_BLOG_RSS();
if (!mysql_query(isset($sql))) {
    // Permalink
    if (isset($_GET['id'])) {
        $id = intval($_GET['id']);
        $sql = 'SELECT' . " `id`, `href`, `name`," . " DATE_FORMAT(`date`,'%Y-%m-%dT%T') as `date`, `comment`, `category`" . " FROM `{$log_table}` WHERE (`draft` = '0') AND (`id` = '{$id}')";
        $res = mysql_query($sql);
        $item = '';
        if ($row = mysql_fetch_array($res)) {
            $row = convert_to_utf8($row);
            $link = 'http://' . $_SERVER['HTTP_HOST'] . $cfg['root_path'] . 'article.php?id=' . $row['id'];
            $title = htmlspecialchars($row['name']);
            if (file_exists($cd . '/include/user_include/plugins/plg_markdown.inc.php')) {
                include_once $cd . '/include/user_include/plugins/plg_markdown.inc.php';
                $FKMM_markdown = new FKMM_markdown();
                $row['comment'] = $FKMM_markdown->convert($row['comment']);
            }
            $item .= $p_rss->getItems($link, $title, $row);
        }