<?php
$time_start = microtime(TRUE);
define('IN_HBS',TRUE);
require 'inc/include.php';
if(!file_exists('inc/cfg.php')) {
$vars['show_install'] = true;
$vars['error'] = 'Your blog is either not installed or missing the configuration file. If you haven\'t installed Horizon Blogging Software, please click 'Install Now' below. If you are missing inc/cfg.php, please go <a href="http://www.edgedrive.com/community">here</a> and go to the help forum.';
show_page('error',$vars,'default');
exit;
}
$cfg = getConfig();
$vars['config'] = $cfg;
$vars['title'] = $cfg['hzn_title'];
show_page('header',$vars,$cfg['template']);
db();
$sql = "SELECT * FROM " . $mysql["db_prefix"] . "main ORDER BY timestamp DESC LIMIT 5";
$result = mysql_query($sql) or die(show_page('error',array('show_install' => FALSE , 'error' => "Horizon Blogging Software could'nt connect to the main MySQL table. Please make sure settings in inc/cfg.php are correct. If you cannot fix the problem, please go to the Edge Drive Community by clicking <a href='http://www.edgedrive.com/community'>here</a>. Once there, be sure to include the error which is stated below.", 'sql_error' => $sql . "<br />" . mysql_error()),$cfg['template']));
if (!(mysql_num_rows($result)>0))
{
echo 'There are no posts in this blog.';
}
while($row = mysql_fetch_array($result)) {
$date = date("l F d Y", $row['timestamp']);
$title = stripslashes($row['title']);
$entry = stripslashes($row['entry']);
$category = $row['category'];
$id = stripslashes($row['id']);
$num_rows = countComments($id);
if (strlen($title) > 46 || strstr($title, "<br />") || strstr($title, "\n")) {
$title = substr($title,0,46) . "...";
$title = str_replace("<br />", "", $title);
$title = str_replace("\n", " ", $title);
}
$vars['title'] = $title;
$vars['id'] = $id;
$vars['category'] = $category;
$vars['entry'] = $entry;
$vars['num_rows'] = $num_rows;
$vars['date'] = $date;
show_page('post',$vars,$cfg['template']);
}
$vars['version'] = getVersion();
show_page('footer',$vars,$cfg['template']);
$time_end = microtime(TRUE);
$time = $time_end - $time_start;
echo $time;
?>