show(); } /* smarty init */ $smarty = new Smarty(); $smarty->compile_dir = 'templates_c'; $smarty->template_dir = 'templates'; $smarty->cache_dir = 'cache'; $smarty->config_dir = 'configs'; $tags = new Tags($smarty); /* print_r($_POST); print_r($_GET); */ /* язик */ $language = new Language(); $l = $language->get_language($url); define('l', $l['l_id']); define('lg', ($l['l_pre'] ? $l['l_pre'].'/' : '')); $url = $l['url_id']; /* зареганые пользовтели */ @session_start(); if (!empty($_SESSION)) extract($_SESSION); $users = new Users(); if (isset($logout)) $users->logout(); $user = $users->login($login, $pwd); if ($user['u_login'] && $user['u_pwd']) { if ($dologin) { header("location: ".$_SERVER['HTTP_REFERER']); exit; } define('SECURE', 1); $users->add_stat($user['u_login']); $smarty->assign($user); $user_form = $smarty->fetch(lg."user_info_form.html"); } else { if ($login || $pwd || $dologin) { header("location: ".HOME.lg."login-fail.html"); exit; } define('SECURE', 0); $user_form = $smarty->fetch(lg."user_login_form.html"); } /* поиск */ if (isset($search) && $search) { $search = trim($search); $categories = new Categories(); $res = $categories->search($search); $smarty->assign('lines', $res); $smarty->assign('search', $search); } $search_form = $smarty->fetch(lg."search_form.html"); /* ADD USER */ $REG_USER = new manageUsers($smarty); if (isset($user_add) && isset($_SESSION['captcha_keystring']) && $_SESSION['captcha_keystring'] == $_POST['keystring']) { if ($REG_USER->saveUser($r)) { header('Location: '.HOME.lg.PAGE_REG_MAIL_VALIDATE); exit; } } elseif (isset($code)) { $REG_USER->validateUserEmail($code); } /* Shoping cart */ $CART = new Cart($smarty); if (isset($cart_action)) { switch ($cart_action) { case 'add': $CART->add($product); header('Location: '.HOME.lg.'cart.html'); exit; break; case 'order': $CART->order($c); header('Location: '.HOME.lg.'thanks.html'); exit; break; case 'recalculate': $CART->recalculate_card($prod); header('Location: '.HOME.lg.'cart.html'); exit; break; } } /* таги */ if (isset($tag) && $tag) { $index = $tags->get_index($id, $from_d, $from_m, $from_y, $to_d, $to_m, $to_y, PER_PAGE); $smarty->assign('index', $index['index']); $smarty->assign('pages', $index['pages']); $smarty->assign('tags_filter', $tags->filter($tag, $from_d, $from_m, $from_y, $to_d, $to_m, $to_y)); } /* навигация сайта */ $menu = new Menu($smarty); if (!isset($url)) $m_item = $menu->get_home(); else $m_item = $menu->get_info_url($url); $m_item['tags'] = $menu->tags_to_links($m_item['tags']); // таги в линки if (in_array($m_item['type_'], array('0')) && !isset($search) && !isset($tag)) // если раздел то у него должен быть индекс статей { $index = $menu->get_index($m_item['id'], $m_item['url_id'], $page, PER_PAGE); $smarty->assign('index', $index['index']); $smarty->assign('pages', $index['pages']); //$tags = new Tags($smarty); $smarty->assign('tags_filter', $tags->filter($tag, $from_d, $from_m, $from_y, $to_d, $to_m, $to_y)); } elseif (in_array($m_item['type_'], array('3')) && !isset($search) && !isset($tag)) // галерея { if (!isset($image)) $image = 0; $image_block = $menu->get_image($m_item['id'], $m_item['url_id'], $image, 1); $smarty->assign('photo', $image_block); /* if ($image) { $image_block = $menu->get_image($m_item['id'], $m_item['url_id'], $image); $smarty->assign('photo', $image_block); } else { $index = $menu->get_gallery($m_item['id'], $m_item['url_id'], $page, PER_PAGE); $smarty->assign('index', $index['index']); $smarty->assign('pages', $index['pages']); } */ } if (MENU) { $sub_menu = explode(',', $menu->get_sub_menus(MENU, $m_item['id'])); if (in_array($m_item['id'], $sub_menu)) { $n = $menu->view_menu($m_item['id']); } else { $n = $menu->view_menu(MENU); } } else $n = $menu->view_menu($m_item['id']); //print_r($n); $menu->view_menu_tree(MENU_LEVEL); // не отоброжать ети елементі //$menu->menu_tree; $smarty->assign('menu', $menu->build_menu()); $smarty->assign('n1', $menu->n(1, '', 1)); // отоброжать $smarty->assign('n2', $menu->n(2)); $smarty->assign('n3', $menu->n(3)); $smarty->assign('tree', $menu->tree($m_item['id'])); $smarty->assign($m_item); $smarty->assign('home', HOME); $smarty->assign('user_form', $user_form); $smarty->assign('search_form', $search_form); ////// poll // include "/home/cscgrou/public_html/manutd.org.ua/poll/poll_cookie.php"; // include_once "/home/cscgrou/public_html/manutd.org.ua/poll/booth.php"; //$php_poll->set_template_set(""); // $poll = $php_poll->poll_process("newest"); // $smarty->assign('poll', $poll); /////////////////// $smarty->assign('description', str_replace("%SITEMAP%", $menu->sitemap(0, 1), $m_item['description'])); $smarty->assign('search_result', $search_result); if ($search) $html = $smarty->fetch(lg.'search_result.html'); else { $comments = new Comments($smarty); $comments->buildComments($m_item['id']); $smarty->assign('comments', $comments->viewComments($m_item['id'])); $html = $smarty->fetch(lg.$menu->get_template($m_item['template_id'])); } header('Content-Type: text/html; charset=utf-8'); $macros = new Macros($smarty); $macros->apply($html); //echo ""; ?>