Location: PHPKode > projects > Cadence Guestbook Host > cadence/init.php

 * Cadence
 * Remotely Hosted Guestbook Script.
 * (c) 2006, Dennis Pedrie
 * www.CadenceBook.com
 * init.php
 * Cadence Guestbook is licensed under
 * a Creative Commons License.
 * More information is available by visiting
 * http://creativecommons.org/licenses/by/3.0/
 * or the LICENSE file in the Cadence Root Folder

// Initialize the script.
// This file loads all script processes.
// You can hook your application to Cadence by including this file.

//Include Config File
include "config.php";

// Define some Constants

//Check for Debug
if($CONFIG['debug'] == true) {
	$debugsql = $_GET['debugsql'];
	if($debugsql == 1) {
		$db->debug_all = true;

//Include the rest of our script.
include "class/database/". $CONFIG['db_driver'].".db.php";
include "class/post.php";
include "class/gbook.php";
include "class/queries.php";
include "class/login.php";
include "lang/lang_load.php";
include "class/Smarty.class.php";

//Set our $gbook variable, make it an int.
$book = intval($_GET['book']);

//New classes
$db = new db($CONFIG['sql_user'], $CONFIG['sql_pass'], $CONFIG['sql_dbname'], $CONFIG['sql_host']);
$post = new post;
$q = new queries;
$tpl = new Smarty;
$gbook = new gbook($book);
$login = new login;
$debug = new debug;

$tpl->caching = false;

//Check Valid Login. If they're logged in, it'll save us a query. Hurray!
if($gbook->login->checklogin()) {
	$gbook->logged = true;
	$gbook->is_book_owner = $gbook->login->is_book_owner;
	//DEPRECATED. For backwards Compatibility Only. Use $gbook->logged whenever possible.
	$logged = false;
	$logged = $gbook->logged;
else {
	if(!$gbook->check_id($book)) {
		include "class/home.php";

//Set our $act variable. Doesn't need to be cleaned.
$act = $_GET['act'];

//Make Smarty variables.
$tpl->assign_by_ref("gbook", $gbook);
$tpl->register_object("debug", $debug);
$tpl->register_object("db", $db);
$tpl->assign('jscripts',str_replace('{$hosturl}',$CONFIG['url'],file_get_contents("templates/system/js.tpl"))); //Bleh. Not as pwetty I'd like it, but it works.
$tpl->assign('tpl_path',"templates/". $gbook->style ."/");

$tpl->assign('cprt_no_remove',"<!-- POWERED BY CADENCE GUESTBOOK HOSTING SCRIPT. COPYRIGHT 2005-". date("Y") .". THIS COPYRIGHT MUST REMAIN INTACT.\n CADENCE CAN BE FOUND AT http://www.sourceforge.net/projects/cadencegb-->\n");
$tpl->assign('cprt_bottom','	   '. $gbook->title .' hosted for free by <a href="'. $gbook->hosturl .'">'. $gbook->hostname .'</a> - <a href="index.php?p=tos">TOS</a>
	   Powered by <a href="http://www.sourceforge.net/projects/cadencegb">Cadence</a> v'. $gbook->cadence_version);

Return current item: Cadence Guestbook Host