<?php
/**
* view.php gives detail for a certain url
*
* It uses index_view.tpl and body_view.tpl as it's main templates
*
* @author hide@address.com
* @version 1.0
* @package TaggingManager
*/
if(!file_exists( "./config.php" ) ) {
die( 'Please rename config.new to config.php and fill in the data' );
}
$root_path = './';
/**
* Including the configfile: contains all important data
*/
include_once($root_path.'config.php');
if($db_name=='') die( 'Please fill in the correct mysql data in config.php' );
/**
* Including the dbconn: contains db-class
*/
require_once($root_path.'includes/dbconn.php');
/**
* Including all functions
*/
require_once($root_path.'includes/functions.php');
/**
* Including template engine
*/
require_once($root_path.'includes/template.php');
/**
* Including metadata
*/
require_once($root_path.'includes/metadata.php');
/**
* Including userinformation
*/
require_once($root_path.'includes/user.php');
isset($_GET['id']) ? $id=$_GET['id'] : $id = null;
//start templatebuilding
$tpl = & new Template();
if (isset($_COOKIE["user"]) AND isset($_COOKIE["secret"])) {
$myUser = new User;
$myUser->userName = $_COOKIE["user"];
$myUser->userPassword = $_COOKIE["secret"];
$myUser->verifyPassword();
$tpl->set('user_id', $myUser->user_id);
$tpl->set('username', $myUser->userName);
}
$link = new Link($id);
$tpl->set('linktitle', $link->title);
$tpl->set('url', $link->url);
$tpl->set('location', $location);
$bdy = & new Template();
$bdy->set('url', $link->url);
$bdy->set('link_title', $link->title);
$bdy->set('meta_id', $link->meta_id);
$bdy->set('link_description', $link->description);
$bdy->set('link_snipset', $link->snipset);
$bdy->set('link_taxonomy', $link->taxonomy);
$bdy->set('link_id', $link->meta_id);
$bdy->set('location', $location);
$bdy->set('link_datum', $link->datum);
$bdy->set('link_author', $link->author);
$tagList = tagList($link->meta_id); //this is an array with all the tags for this url
$bdy->set('link_taglist', $tagList);
if (isset($_COOKIE["user"]) AND isset($_COOKIE["secret"])) {
$myUser = new User;
$myUser->userName = $_COOKIE["user"];
$myUser->userPassword = $_COOKIE["secret"];
$myUser->verifyPassword();
$bdy->set('user_id', $myUser->user_id);
}
$body = $bdy->fetch($root_path.'template/'.$template.'/body_view.tpl',$language);
$tpl->set('body', $body);
echo $tpl->fetch($root_path.'template/'.$template.'/index_view.tpl',$language);
?>