Author Servous License GPL **************************************************/ // function for rendering the posts function sRenderPost($id, $category_id, $category, $date_created, $date_modified, $topic, $text) { global $conf_web_root, $conf_mysql_prefix, $conf_comments_act, $conf_trackback_act, $conf_date; // define variables $id = intval($id); $category = sStripSlashes($category); $date_created = $date_created; $date_modified = $date_modified; if(strlen($topic) > 0) { $topic = sStripSlashes($topic); } else { $topic = '-{ ' . lang('no topic') . ' }-'; } $text = sStripSlashes($text); // fetch comments for current post $query_comments = "SELECT id FROM " . $conf_mysql_prefix . "comments WHERE blog_id='" . $id . "'"; $q_comments = mysql_query($query_comments); $n_comments = mysql_num_rows($q_comments); // fetch trackbacks for current post $query_trackbacks = "SELECT id FROM " . $conf_mysql_prefix . "trackbacks WHERE blog_id='" . $id . "'"; $q_trackbacks = mysql_query($query_trackbacks); $n_trackbacks = mysql_num_rows($q_trackbacks); echo "\t\t\t" . '' . "\n"; echo "\t\t\t" . '
' . "\n"; echo "\t\t\t\t" . '

' . htmlspecialchars($topic) . '

' . "\n"; echo "\t\t\t\t" . '
' . "\n"; // echo category if not 'Uncategorized' if($category_id != 1) { echo "\t\t\t\t\t" . '' . lang('Category') . ': ' . htmlspecialchars($category) . '
' . "\n"; } echo "\t\t\t\t\t" . '
' . lang('Posted') . ': ' . sDateTime($date_created, $conf_date); // echo out 'last modified' date if post has been modified if($date_modified != $date_created) { echo ', ' . lang('Edited') . ': ' . sDateTime($date_modified, $conf_date) . "\n"; } echo '

' . "\n"; if(!array_key_exists('id', $_GET) && !array_key_exists('id', $_POST) && preg_match('/(?:\r\n)\[more(?:=(.*?))?\](?:\r\n)/i', $text, $matches)) { if(array_key_exists('1', $matches)) { $read_more = htmlspecialchars($matches[1]); } else { $read_more = lang('Read more'); } echo "\t\t\t\t\t" . bbcode(substr($text, 0, strpos($text, '[more'))) . "\n" . '' . $read_more . '' . "\n"; } else { if(array_key_exists('id', $_POST)) { $pattern = array( '/\[more(?:=(.*?))?\]/i' ); $replace = array( '[b][MORE] \1[/b]' ); } else { $pattern = array( '/(?:\r\n)\[more(?:=(.*?))?\](?:\r\n)/i' ); $replace = array( null ); } ΓΈ$text = preg_replace( '##i', '
', $text); ', $text) echo "\t\t\t\t\t" . bbcode(preg_replace($pattern, $replace, $text)) . "\n"; } echo "\t\t\t\t" . '
' . "\n"; echo "\t\t\t\t" . '
'; if($id != 0) { // permalink echo '' . lang('Permalink') . ' '; // comments if enabled if(!isset($conf_comments_act) || $conf_comments_act == 1) { echo '' . lang('Comments') . ' (' . $n_comments . ') '; } // trackbacks if enabled if(!isset($conf_trackback_act) || $conf_trackback_act == 1) { echo '' . lang('Trackbacks') . ' (' . $n_trackbacks . ') '; } // administrator functions if(array_key_exists("Username", $_SESSION) && $_SESSION['Username'] != '') { echo '' . lang('Delete') . ' ' . lang('Edit') . ''; } } else { echo "\t\t\t\t" . ' ' . "\n"; } echo '
' . "\n"; echo "\t\t\t" . '
' . "\n"; echo "\t\t\t" . '' . "\n\n"; } ?>