<?php
require_once('havalite/hava_mobile.php');
session_start();
$_ENV['saveComment'] = true;
if(isset($_POST['name'])) $name = $_POST['name']; else $name = NULL;
if(isset($_POST['email'])) $email = $_POST['email']; else $email = NULL;
if(isset($_POST['website'])) $website = $_POST['website']; else $website= '';
if(isset($_POST['comment'])) $comment = $_POST['comment']; else $comment = NULL;
if(isset($_GET['limit'])) $limit = $_GET['limit'];
if(isset($_GET['preview'])) $preview = $_GET['preview'];
if(isset($_GET['img'])) $img = $_GET['img'];
if(isset($_GET['comments'])) $comments = $_GET['comments']; // required for RSS Feeds
//----------------------------------
if(isset($_GET['p'])) $p = $_GET['p']; // post id
if(isset($_GET['cat'])) $cat = $_GET['cat']; // cat id or name
if(isset($_GET['s'])) $s = $_GET['s']; // search
if(isset($_GET['arch'])) $arch = $_GET['arch']; // archive
// try another theme --------------------
if(isset($_GET['theme'])){
$templateUrl = 'havalite/themes/'.$_GET['theme'].'/';
}
if(isset($_GET['feed'])){
require('havalite/hava_connect.php');
//if($feed == "rss") $feed = "rss2";
$rssPath = 'hava_feed.php';
if(file_exists($rssPath)){
header("Content-Type: application/rss+xml; charset=UTF-8");
include($rssPath);
}
}
else{
require('hava_filter.php');
if($mobileDetect and hava_options('mobile') == 'yes') {
$mobilePath = $templateUrl.'mobile.php';
if(file_exists($mobilePath)){
include($mobilePath);
}
}
else{
$the_begin;
if($_ENV['saveComment']){
save_comment($p, $name, $email, $comment, $website);
}
// header
$headerPath = $templateUrl.'header.php';
// index
$indexPath = $templateUrl.'index.php';
// sidebar
$sidebarPath = $templateUrl.'sidebar.php';
// footer
$footerPath = $templateUrl.'footer.php';
if(file_exists($headerPath)){
ob_start("callback_header");
include($headerPath);
ob_end_flush();
}
if(file_exists($indexPath)){
echo '<span id="the_content"></span>';
include($indexPath);
echo $the_content;
}
//if(file_exists($sidebarPath)){ echo '<span id="the_sidebar">'; include($sidebarPath); echo '</span>'; }
if(file_exists($footerPath)){
echo '<span id="the_footer">'.$the_footer.'</span>';
include($footerPath);
}
}
}
function callback_header($buffer) {
global $the_head;
$jquery = hava_jQuery();
return (eregi_replace('<body', $jquery.$the_head.'<body', $buffer));
}
function load($file){
if(isset($file)){
global $templateUrl, $p, $cat, $s, $arch;
$file = $templateUrl.$file;
if(file_exists($file)){
include($file);
}
}
}
?>