<?php 
/*#################################################################*\
|# Licence Number 0DT7-0122-0NW1-0210
|# -------------------------------------------------------------   #|
|# Copyright (c)2010 PHP Link Directory.                           #|
|# http://www.phplinkdirectory.com                                 #|
\*#################################################################*/
	
/**
# ################################################################################
# Project:   PHP Link Directory
#
# **********************************************************************
# Copyright (C) 2004-2009 NetCreated, Inc. (http://www.netcreated.com/)
#
# This software is for use only to those who have purchased a license.
# A license must be purchased for EACH installation of the software.
#
# By using the software you agree to the terms:
#
#    - You may not redistribute, sell or otherwise share this software
#      in whole or in part without the consent of the the ownership
#      of PHP Link Directory. Please contact david@david-duval.com
#      if you need more information.
#
#    - You agree to retain a link back to http://www.phplinkdirectory.com/
#      on all pages of your directory in you purchased the $25 version
#      of the software.
#
# License holders are entitled to upgrades to the 3.4 branch of the software
# as they are made available at http://www.phplinkdirectory.com/
#
# In some cases, license holders may be required to agree to changes
# in the software license before receiving updates to the software.
# **********************************************************************
#
# For questions, help, comments, discussion, etc., please join the
# PHP Link Directory Forum http://www.phplinkdirectory.com/forum/
#
# @link           http://www.phplinkdirectory.com/
# @copyright      2004-2009 NetCreated, Inc. (http://www.netcreated.com/)
# @projectManager David DuVal <david@david-duval.com>
# @package        PHPLinkDirectory
# @version        4.0.0
# ################################################################################
*/

require_once 'init.php';
if (!empty ($_SESSION['phpld']['user']['id'])){
   $tpl->assign('load_Javascript',  'true');
}
if (!empty($_SESSION['inplace_pageerror'])) {
    $tpl->assign('inplace_pageerror', $_SESSION['inplace_pageerror']);
    //unset($_SESSION['inplace_arterror']);
}

$path   = array ();
$path[] = array ('ID' => '0', 'TITLE' => _L(SITE_NAME)    , 'TITLE_URL' => DOC_ROOT, 'DESCRIPTION' => SITE_DESC);

$data = $db->CacheGetRow("SELECT * FROM `{$tables['page']['name']}` WHERE `SEO_NAME` = ".$db->qstr($_REQUEST['name'].".html"));

$tpl->assign($data);
if(empty($data))
{
httpstatus('404');
}

$path[] = array ('ID' => '0', 'TITLE' => $data['NAME'], 'TITLE_URL' => ''    , 'DESCRIPTION' => '');
$tpl->assign('path', $path);
$tpl->assign('MetaKeywords'   , (!empty ($data['META_KEYWORDS'])    ? trim ($data['META_KEYWORDS'])    : trim ($MetaKeywords)));
$tpl->assign('MetaDescription', (!empty ($data['META_DESCRIPTION']) ? trim ($data['META_DESCRIPTION']) : trim ($MetaDescription)));
// Get status of the page
if (($data['STATUS'] != 2) && !(isset($_SESSION['phpld']['user']['id']) && (get_user_level($_SESSION['phpld']['user']['id']) == 1 || get_user_level($_SESSION['phpld']['user']['id']) == 3 )))
   $tpl->assign('error', 'This page it is not active.');

// Get privacy of page
if ($data['PRIVACY'] == 1 AND !isset($_SESSION['phpld']['user']['id']))
   http_custom_redirect(DOC_ROOT .'/login.php');
  
   
//Clean whitespace
$tpl->load_filter('output', 'trimwhitespace');

//Make output
echo $tpl->fetch('page.tpl', $id);
?>
