<?php
require_once "_includes/_bootstrap.php";
BugTracker::clearBug();
$timer->start('Smarty');
include (SMARTY_DIR . 'Smarty.class.php');
$smarty = new Smarty();
$smarty->assign_by_ref('link', $LinkGenerator);
// recognize template directory
$hash = md5(CONF_SKIN_DEFAULT
); $row = $cache->load('template_object_' . $hash);
if ($row === false)
{
$log->debug("Loading skin info and saving it to cache: " . CONF_SKIN_DEFAULT);
$select = $db->select()
->from(DB_PREFIX
. 'skins', array('id', 'editable')) ->where('name = ?', CONF_SKIN_DEFAULT);
$row = $select->query()->fetch();
if ($row['editable'])
{
$row['cat'] = "_skiny_users";
} else
{
$row['cat'] = "_skiny";
}
$cache->save($row, 'template_object_' . $hash, array('template')); }
Zend_Registry::set("DEFAULT_SKIN_ID", (int)$row['id']);
$cat = $row['cat'];
$smarty->assign("skinyDir", $cat);
$smarty->template_dir = $cat . "/" . CONF_SKIN_DEFAULT . "/html";
$smarty->compile_dir = $cat . "/" . CONF_SKIN_DEFAULT . "/cache";
$timer->stop('Smarty');
// check if shop is off
if (isset($_GET['check']) && $_GET["check"] == "true") {
$session->off = true;
}
if (CONF_OFF
== 1 and
!isset($session->off)) {
$smarty->display("off.tpl");
$log->info("Shop is closed. Exiting...");
}
if (!isset($_GET['cat_id']) and
!isset($_GET['prod_id'])) {
$session->cat_id = '';
}
$timer->start('currency.inc');
include ('currency.inc');
$timer->stop('currency.inc');
$timer->start('languages.inc');
include ('languages.inc');
$timer->stop('languages.inc');
$timer->start('user_functions.inc');
include ('user_functions.inc');
$timer->stop('user_functions.inc');
setCurrency();
$smarty->assign("lang", $session->lang);
// set main_page breadcrumb
Zend_Registry::get('breadcrumbs')->append(MAIN_PAGE, $LinkGenerator->
getIndexLink());
if ($session->userObject)
{
if (!$session->userObject->checkNotDeleted())
{
$_GET['logout'] = true;
}
}
$total = $cache->load('price_list_count_'.$session->lang);
if($total === false)
{
$total = $db->select()->from(TABLE_PRODUCTS
, array(new Zend_Db_Expr
('count(*) AS total'))) ->joinInner(TABLE_PRODUCT_TRANSLATIONS
, $db->quoteInto('product_id=pid AND lang=?', $session->lang), array()) ->query()->fetch();
$cache->save($total, 'price_list_count_'.$session->lang, array('product')); }
if($total['total']<=2000)
{
$smarty->assign('show_pdf', 1);
}
$timer->start('baner.inc');
include ('baner.inc');
$timer->stop('baner.inc');
$timer->start('bestsellers.inc');
include ('bestsellers.inc');
$timer->stop('bestsellers.inc');
$timer->start('search.inc');
if (isset($_GET['adv_search']) || isset($_REQUEST['search'])) include ('search.inc');
$timer->stop('search.inc');
$timer->start('login.inc');
include ('login.inc');
$timer->stop('login.inc');
$timer->start('product_list.inc');
include ('product_list.inc');
$timer->stop('product_list.inc');
$timer->start('product.inc');
include ('product.inc');
$timer->stop('product.inc');
$timer->start('subsc.inc');
if (isset($_REQUEST['subsc']) || (isset($_GET['action']) and
isset($_POST['email'])) || isset($_GET['verifyorder']) || isset($_GET['verify_code'])) include ('subsc.inc');
$timer->stop('subsc.inc');
$timer->start('panel.inc');
if (($_GET['panel'] == true || isset($_POST["end"])) && isset($session->user)) include ('panel.inc');
$timer->stop('panel.inc');
$timer->start('basket.inc');
include ('newbasket.inc');
$timer->stop('basket.inc');
$timer->start('change_pass.inc');
if ($_GET['change_pass'] == true)
include ('change_pass.inc');
$timer->stop('change_pass.inc');
$timer->start('bottombar.inc');
include ('bottombar.inc');
$timer->stop('bottombar.inc');
$timer->start('add_ins.inc');
include ('add_ins.inc');
$timer->stop('add_ins.inc');
$timer->start('last_added.inc');
include ('last_added.inc');
$timer->stop('last_added.inc');
$timer->start('poll.inc');
include ('poll.inc');
$timer->stop('poll.inc');
$timer->start('manufactur.inc');
include ('manufactur.inc');
$timer->stop('manufactur.inc');
$timer->start('mail_to_friend.inc');
if (isset($_GET['mail_to_friend'])) include ('mail_to_friend.inc');
$timer->stop('mail_to_friend.inc');
$timer->start('box.inc');
include ('box.inc');
$timer->stop('box.inc');
$timer->start('contact.inc');
include ('contact.inc');
$timer->stop('contact.inc');
$timer->start('podd.inc');
include ('podd.inc');
$timer->stop('podd.inc');
$timer->start('payment.inc');
if (isset($_GET['paymentname'])) include ('payment.inc');
$timer->stop('payment.inc');
$timer->start('counter.inc');
include ('counter.inc');
$timer->stop('counter.inc');
$timer->start('links.inc');
if ($_GET['links'] == 'show' || isset($_GET['link_id']) && ValidId
($_GET['link_id'])) include ('links.inc');
$timer->stop('links.inc');
$timer->start('address.inc');
if (isset($session->user) && $_GET['changeaddress'] == "true" and
($_GET['type'] == 1 or $_GET['type'] == 2))
include ('address.inc');
$timer->stop('address.inc');
$timer->start('wishlist.inc');
if ($_POST['wishlist'] == 1 and ValidId($_POST['pid']))
include ('wishlist.inc');
$timer->stop('wishlist.inc');
// main.php included only if $_GET is empty
$timer->start('main.inc');
$smartyPage = $smarty->get_template_vars('main_page');
include ('main.inc');
$timer->stop('main.inc');
$timer->start('menu.inc');
include ('menu.inc');
$timer->stop('menu.inc');
$smarty->assign('description', $description);
{
$smarty->assign('error', $error);
}
{
$smarty->assign('notify', $notify);
}
$smarty->assign("mainUrl", $LinkGenerator->getIndexLink());
$smarty->assign('color', 'red');
// $db->closeConnection();
// assign positioning variables
if (empty($HeadConf[$session->lang]['title'])) {
$adm_title = "";
} else
{
$adm_title = es($HeadConf[$session->lang]['title']);
}
if (isset($add_adm_title)) {
$adm_title .= $add_adm_title;
}
define("ADM_TITLE", $adm_title); define("ADM_KEYWORDS", es
($HeadConf[$session->lang]['keywords'])); define("ADM_DESCRIBTION", es
($HeadConf[$session->lang]['description']));
if(is_array($breadcrumbs) && $_GET['cat_id']>0
) {
$title = Zend_Registry::get('category_title');
}
else
{
$breadcrumbs = Zend_Registry::get('breadcrumbs');
$length = $breadcrumbs->count()-1;
if($length>0)
{
$crumb = $breadcrumbs->offsetGet($length);
$title = $crumb['name'];
}
else
{
$title = ADM_TITLE;
}
}
$smarty->assign("page_title", $title);
// assign breadcrumbs
$bc = Zend_Registry::get('breadcrumbs');
foreach((array)Zend_Registry
::get('breadcrumbs') as $b) {
$b['name'] = mb_truncate($b['name'], 25, ' ... ', false, true);
$bc[] = $b;
}
$smarty->assign('breadcrumbs', $bc);
// -- ----------------------------------------------------------
// zamias t $smarty->display('index.tpl') dajemy:
// -- ----------------------------------------------------------
$timer->start('smarty compiler');
$log->debug("Smarty is compiling the template");
$smarty->display('index.tpl');
/*
$btm_output = $smarty->fetch('index.tpl');
$btm_includ='./_var/btm.tpl';
if(file_exists($btm_includ)){
$btm_dopis=file_get_contents($btm_includ);
$btm_c = 0;
$btm_output=preg_replace('/((<\/body>)?(\s)*(<\/html>)?(\s)*)$/',$btm_dopis.'\1', $btm_output, 1 , $btm_c);
if($btm_c==0)$btm_output=$btm_output.$btn_dopis;
}
echo $btm_output;
*/
// -- ----------------------------------------------------------
$timer->stop('smarty compiler');
$timer->stop();
$log->debug("Process has successfully ended in: " . $timer->get() . " s.");
$log->debug("Time Limit: " . ini_get('max_execution_time') . " s."); $log->debug("Memory Peak Usage: " . memory_get_peak_usage() . " b");
$log->debug("Memory Limit: " . ini_get('memory_limit')); $log->info("Exiting...");
?>