<?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 (!file_exists('config.php')) {
die("Bloggie Lite not installed, To install click <a href=\"install/wizard.php\">install</a> !");
}
$bloggie_root_path = "";
define('IN_BLOGGIE', true);
include_once($bloggie_root_path.'init.php');
if ( defined('INSTALLED') && file_exists('install')) {
die("Please delete the \"install\" folder before start blogging for security reason!");
}
$style = $pref_data['default_style'] ;
$perma_link = new link_modifier;
$template = new Template('./templates/'.$style.'/');
include_once($bloggie_root_path.'language/'.$pref_data['language']);
include_once($bloggie_root_path.'includes/functions-pluggable.php');
$timezone = $pref_data['gmt'];
$sef_method = $pref_data['sef_method'];
$site_url = $pref_data['bloggie_path'];
define('COMMENT_COOKIE', md5($user_ip));
$cookie_domain=parse_url($site_url);
if(!strpos("-".$cookie_domain['host'], ".")) {
$cookie_host= false;
} else {
define('DOMAIN_COOKIE', ".".$cookie_domain['host']);
}
if ( !defined('DOMAIN_COOKIE') ) define('DOMAIN_COOKIE', $cookie_host);
if(!isset($_COOKIE[COMMENT_COOKIE])) {
setcookie(COMMENT_COOKIE, $user_ip, time() + 600, '/', DOMAIN_COOKIE );
}
define("PATH_COOKIE", preg_replace("|http://[^/]+|is","", $site_url."/" ));
define('USER_COOKIE', 'USER_'.md5($pref_data['cookie_name']));
define('PASS_COOKIE', 'PASS_'.md5($pref_data['cookie_name']));
if (!isset($mode)) $title = $pref_data['blog_name'] ;
$font_family = $pref_data['font_family'] ;
$template->set_filenames(array(
'header' => 'header.tpl',
'blog_body' => 'blog_body.tpl',
'read' => 'read.tpl',
'simplefooter' => 'simplefooter.tpl',
'footer' => 'footer.tpl',
'chk_com_form' => 'chk_com_form.tpl',
'code' => 'admin/commentcode.tpl',
));
if ($timezone > 0 ) { $sign = "+" ;} else { $sign = "" ;}
$template->assign_vars(array(
'CHAR_SET' => $pref_data['encoding'],
'CONTENT_DIRECTION' => $content_direction,
'STYLE' => $style,
'TIME' => 'Time [GMT '.$sign.$timezone.'] : '.gmtdate('d M , H:i:s', time(), $timezone ),
'BLOG_NAME' => $pref_data['blog_name'],
'SYNDICATION' => $lang['Syndication'],
'RSS_URL' => "./rss/rss.php",
'RSS2_URL' => "./rss/rss2.php" ,
'FONT_FAMILY' => $font_family ,
'BLOGGIE_URL' => $site_url ,
'PINGBACK_SVR' => "./pingserver/pingsvr.php",
'TITLE' => $title,
'HOME' => $site_url."/index.php" ,
));
execute('header');
execute('nav_bar');
$path_parts = read_url();
if (isset($_GET['mode']) || $sef_method=="xsef") {
if (isset($_GET['mode'])) $mode = htmlspecialchars($_GET['mode']);
$link_format ="index.php?mode=read&post_id={POST_ID}";
$cat_format ="index.php?mode=category&cat_id={CAT_ID}";
$archives_format ="index.php?mode=archives&mth={MTH}&yr={YR}";
$pno = ( isset($_GET['pno']) ) ? intval($_GET['pno']) : 0;
}
elseif (isset($path_parts) && !empty($path_parts)){
$mode = (alphabet_check($path_parts[0])) ? htmlspecialchars(($path_parts[0])) : "";
$link_format =$pref_data['link_format'];
$cat_format ="index.php/{CAT}/{CAT_DESC}";
$archives_format ="index.php/{ARC}/{YR}/{MTH}";
} else {
$path_parts = "";
}
$link_vars = get_permalink_info($path_parts);
$template->pparse('header');
execute('content_top');
$current_timestamp = current_timestamp($timezone);
if (isset($mode)) {
switch ($mode) {
case "read":
$template->pparse('code');
$template->pparse('chk_com_form');
include $bloggie_root_path.'read.php';
break;
case "archives" :
include $bloggie_root_path.'viewmode.php';
break;
case "category" :
include $bloggie_root_path.'viewmode.php';
break;
case "page" :
include($bloggie_root_path.'blog_body.php');
break;
default: include($bloggie_root_path.'blog_body.php'); break;
}
}
elseif (!isset($mode)) include($bloggie_root_path.'blog_body.php');
execute('sidemenu');
//$template->pparse('sidemenu');
execute('content_top');
$template->pparse('footer');
unset($func_list);
?>