<?php
/**
 * @package linea21.core
 * @subpackage public
 * @author linea21 <info@linea21.com>
 * @version $id SVN
 * @access public
 * @license http://opensource.org/licenses/gpl-3.0.html
 */
function optimize($buffer) {
  $title = implode(' - ', $GLOBALS['current_title']);

  $buffer=trim(str_replace('##TITLE##', $title, $buffer));
  return trim(str_replace('##BREADCRUMB##', getBreadcrumb(), $buffer));
}
session_start(); // necessary for adding a new entry in yellowpages
ob_start('optimize');
include_once('../config/define.php');

// check if session is not expired
$l21auth->isActive();

distInclude(THEME_PUBLIC_PATH.SQL.'.inc.php', THEME_PUBLIC_DIST);
include_once('../admin/'.SQL.'.inc.php');
distInclude(THEME_PUBLIC_PATH.'filters.php', THEME_PUBLIC_DIST);
distInclude(THEME_PUBLIC_PATH.'display.php', THEME_PUBLIC_DIST);
ActiveItem();
securityCheck();
IncludeLang();


if(isset($Dbg)) {
  $debug_line->setEndTime();
  $debug_line = $Dbg->add('... loading Main templates from <b>'.THEME_PUBLIC_PATH.'</b>');
  $debug_line->setStartTime();
}

// update workgroups ID if needed - only if workgroup section and user logged-in
if(isset($_REQUEST['rub']) && isset($_SESSION['authenticated']) && $_REQUEST['rub'] == $GLOBALS['links'][U_L]['workgroup']['linkvalue']) $GLOBALS['l21auth']->updateCookieWorkshop();

// we include comment functions
include_once(override('../comment/display.php'));
include_once(THEME_PUBLIC_PATH."index.php");

if(isset($Dbg)) {
  $debug_line->setEndTime();
}

$GLOBALS['sql_object'] -> DBClose();
ob_end_flush();
?>