<?php
// Copyright (C) Bloggie Lite Written by : Sean
// http://www.mywebland.com , http://mybloggie.mywebland.com
// You are requested to retain this copyright notice in order to use
// this software.
//This program is free software; you can redistribute it and/or
//modify it under the terms of the GNU General Public License
//as published by the Free Software Foundation; either version 2
//of the License, or (at your option) any later version.
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//GNU General Public License for more details.
//You should have received a copy of the GNU General Public License
//along with this program; if not, write to the Free Software
//Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
if ( !defined('IN_BLOGGIE') )
{
die("You are not allowed to access this page directly !");
}
// Gather info for Pagination
$sql = "SELECT post_id FROM " . POST_TBL." WHERE timestamp<='".$current_timestamp."'";
if ( !($result = $db->sql_query($sql)) ) {
$sql_error = $db->sql_error(); echo $sql_error['message'];
}
$numrow= ( $db->sql_numrows($result) ) ? $db->sql_numrows($result) : 0;
$db->sql_freeresult($result);
if ($sef_method == "xsef" ) {
if (isset($_GET['pno'])) { $pno = intval(htmlspecialchars($_GET['pno'])); } else { $pno = 0; };
$pagination = pagination( "XSEF",$site_url."/index.php"."?mode=page", $numrow , $pref_data['blog_limit'], $pno);
} else {
if (isset($path_parts[1])) { $pno = intval(htmlspecialchars($path_parts[1])); } else { $pno = 0; };
$pagination = pagination( "SEF",$site_url."/index.php", $numrow , $pref_data['blog_limit'], $pno);
}
$sql = "SELECT ".CAT_TBL.".cat_desc, ".POST_TBL.".cat_id, ".CAT_TBL.".cat_id, ".POST_TBL.".post_id, ".POST_TBL.".perm_subj, ".POST_TBL.".subject,".POST_TBL.".message, ".USER_TBL.".user,
".POST_TBL.".timestamp, ".USER_TBL.".id, ".POST_TBL.".user_id , ".POST_TBL.".comments_count, ".CAT_TBL.".cat_perma
FROM ".POST_TBL.", ".USER_TBL.", ".CAT_TBL."
WHERE ".POST_TBL.".user_id=".USER_TBL.".id AND ".CAT_TBL.".cat_id=".POST_TBL.".cat_id AND ".POST_TBL.".timestamp<='".$current_timestamp."'
Order by ".POST_TBL.".timestamp DESC, ".POST_TBL.".post_id DESC LIMIT $pno, ".$pref_data['blog_limit'] ;
if( !($result = $db->sql_query($sql)) ) {
$sql_error = $db->sql_error();
echo $sql_error['message'];
}
$result = $db->sql_query($sql) ;
while ($row = $db->sql_fetchrow($result)) {
$message=$row['message'];
$time_YYYYMMDD = time_YYYYMMDD($row['timestamp']);
$perma_link->assign_vars(array(
'READ' => "read",
'CAT' => "category",
'YYYY' => $time_YYYYMMDD['YYYY'],
'MM' => $time_YYYYMMDD['MM'],
'DD' => $time_YYYYMMDD['DD'],
'TITLE' => $row['perm_subj'],
'CAT_DESC' => $row['cat_perma'],
'POST_ID' => $row['post_id'],
'CAT_ID' => $row['cat_id'],
));
$modified_link = $perma_link->parse($link_format);
$modified_cat_link = $perma_link->parse($cat_format);
$sef_url = $site_url."/".$modified_link;
$cat_sef= $site_url."/".$modified_cat_link;
$message = nl2br($message);
$message=viewsmile($message);
$message=viewlink($message);
$message=autolink($message);
$message=viewbbcode($message);
/**
$sql = "UPDATE ".POST_TBL." SET comments_count='".comments_count($row['post_id'])."' WHERE post_id='".$row['post_id']."'";
$result = $db->sql_query($sql);
if( !($result = $db->sql_query($sql)) )
{
$sql_error = $db->sql_error();
error($lang['Error'], 'SQL Query Error : '.$sql_error['message'].' !');
}
**/
$template->assign_block_vars('blogparse', array(
'USER_NAME' => $row['user'],
'SUBJECT' => $row['subject'],
'MESSAGE' => $message,
'TIME' => time_format($row['timestamp']) ,
'DATE' => date_format($row['timestamp']) ,
'DAY' => return_day($row['timestamp']) ,
'MONTH' => return_mth($row['timestamp']) ,
'YEAR' => return_year($row['timestamp']) ,
'L_COMMENTS' => $lang['Comments'],
'PERMALINK' => $sef_url ,
'L_CATEGORY' => $lang['Category'],
'U_CATEGORY' => $cat_sef,
'CATEGORY' => $row['cat_desc'],
'U_COMMENTS' => $sef_url."#comments",
'L_POSTED_BY' => $lang['By'],
'L_TIME' => $lang['Time'],
'COMMENTS_COUNT' => $row['comments_count'],
// 'ADMIN_MENU' => "<span class=\"f10pxgrey\">[<a class=\"std\" href=\"admin.php?mode=edit&redirect=index&cat_id=".$row['cat_id']."&post_id=".$row['post_id']."\">".$lang['Edit']."</a>]
// [<a class=\"std\" href=\"admin.php?mode=del&redirect=index&post_id=".$row['post_id']."\">".$lang['Del']."</a>]</span>",
));
}
$template->assign_vars(array(
'PAGE' => $pagination,
));
$template->pparse('blog_body');
?>