$page_found = true; $news_list = $db->get_all("SELECT * FROM fw_news WHERE status='1' ORDER BY publish_date DESC LIMIT " . NEWS_PER_PAGE_FRONT); $smarty->assign("news_list", $news_list); $template = 'news_list.html'; break; case $url[$n] == 'archive' && count($url) == 2 || $url[$n - 1] == 'archive' && preg_match("/^page_([0-9]+)\$/", $url[$n]) && count($url) == 3: $page_found = true; $navigation[] = array("url" => "archive", "title" => "јрхив новостей"); if (preg_match("/^page_([0-9]+)\$/", $url[$n])) { list(, $page) = explode("_", $url[$n]); $url = array_values($url); } else { $page = 1; } $result = $db->query("SELECT COUNT(*) FROM fw_news WHERE status='1'"); $pager = Common::pager($result, NEWS_PER_PAGE_FRONT_ARCHIVE, $page); $smarty->assign("total_pages", $pager['total_pages']); $smarty->assign("current_page", $pager['current_page']); $smarty->assign("pages", $pager['pages']); $smarty->assign("mode", "archive"); $news_list = $db->get_all("SELECT * FROM fw_news WHERE {$where} ORDER BY publish_date DESC " . $limit_all); $page_title = $node_content['name'] . ' - ' . 'јрхив'; $smarty->assign("news_list", $news_list); $template = 'news_list.html'; break; case preg_match("/^([0-9]+)\$/", $url[$n]) && $url[$n - 1] == 'archive' && count($url) == 3: $navigation[] = array("url" => "archive", "title" => "јрхив"); $id = $url[$n]; $result = $db->get_single("SELECT * FROM fw_news WHERE id='{$id}' AND status='1'"); if ($result['id'] > 0) { // ----парсинг контекта дл¤ вставки фотоальбома, таблицы и формы -- //
header("Location: {$location}"); } switch (TRUE) { case $action == 'index': $smarty->assign("noindex_list", file_get_contents(BASE_PATH . '/modules/search/noindex.txt')); $navigation[] = array("url" => BASE_URL . "/admin/?mod=edit_conf&action=search", "title" => 'Поисковый индекс'); $template = 'search.a_index.html'; break; case $action == 'full_statistics': $navigation[] = array("url" => BASE_URL . "/admin/?mod=search", "title" => 'Статистика запросов'); $navigation[] = array("url" => BASE_URL . "/admin/?mod=search&action=full_statistics", "title" => 'Полная статистика'); if (isset($_GET['page'])) { $page = $_GET['page']; } else { $page = 1; } $result = $db->query("SELECT COUNT(*) FROM fw_search_statistics"); $pager = Common::pager($result, 50, $page); $smarty->assign("total_pages", $pager['total_pages']); $smarty->assign("current_page", $pager['current_page']); $smarty->assign("pages", $pager['pages']); $statistics = $db->get_all("SELECT * FROM fw_search_statistics ORDER BY number DESC LIMIT " . $pager['limit']); $smarty->assign("statistics", $statistics); $template = 'search.a_statistics_full.html'; break; default: $navigation[] = array("url" => BASE_URL . "/admin/?mod=search", "title" => 'Статистика запросов'); $statistics = $db->get_all("SELECT * FROM fw_search_statistics ORDER BY number DESC LIMIT 10"); $smarty->assign("statistics", $statistics); $template = 'search.a_statistics.html'; }
$is_admin = false; } if (isset($_SESSION['fw_user']['priv']) && $_SESSION['fw_user']['priv'] <= 9) { $smarty->assign("allowed_user", true); } } if (PRODUCT_RATING == 'on') { $check_rating = explode(",", @$_COOKIE['fw_rating']); if (in_array($product_content['id'], $check_rating)) { $smarty->assign("rating_done", "true"); } $smarty->assign("rating", "on"); } if (PRODUCT_COMMENTS == 'on') { $result = $db->query("SELECT COUNT(*) FROM fw_products_comments WHERE product_id='" . $product_content['id'] . "'"); $pager = Common::pager($result, PRODUCT_COMMENTS_PER_PAGE, $page); $smarty->assign("total_pages", $pager['total_pages']); $smarty->assign("current_page", $pager['current_page']); $smarty->assign("pages", $pager['pages']); $comments_list = $db->get_all("SELECT *,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(SELECT name FROM fw_users WHERE id=c.author) AS author\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t FROM fw_products_comments c WHERE c.product_id='" . $product_content['id'] . "' ORDER BY insert_date DESC LIMIT " . $pager['limit']); $smarty->assign("comments_list", $comments_list); $smarty->assign("comments", "on"); } if ($cat_list[$f]['full_title'] != '/') { $nav_titles = explode("/", $cat_list[$f]['full_title']); $nav_urls = explode("/", $cat_list[$f]['full_url']); unset($nav_titles[count($nav_titles) - 1]); unset($nav_urls[count($nav_urls) - 1]); for ($l = 0; $l < count($nav_titles); $l++) { $navigation[] = array("url" => $nav_urls[$l], "title" => trim($nav_titles[$l])); }
$page = 1; } if (isset($_GET['groups']) && intval($_GET['groups']) > 0) { $cond = " AND group_id='" . intval($_GET['groups']) . "' "; } else { $cond = ""; } if (isset($_GET['char']) && strlen(trim($_GET['char'])) > 0) { if ($cond == "") { $cond2 = " AND UPPER(name) LIKE '" . $_GET['char'] . "%' "; } else { $cond2 = " AND UPPER(name) LIKE '" . $_GET['char'] . "%' "; } } else { $cond2 = ""; } $cond3 = " where login <> 'root' "; $result = $db->query("SELECT COUNT(*) FROM fw_users {$cond3} {$cond} {$cond2} "); $pager = Common::pager($result, USERS_PER_PAGE, $page); $groups = $db->get_all("SELECT * FROM fw_users_groups"); $smarty->assign("total_pages", $pager['total_pages']); $smarty->assign("current_page", $pager['current_page']); $smarty->assign("pages", $pager['pages']); $smarty->assign("groups", $groups); $users = $db->get_all("SELECT *, (SELECT name FROM fw_users_groups WHERE id=fw_users.group_id) as priv FROM fw_users {$cond3} {$cond} {$cond2} ORDER BY priv,reg_date DESC LIMIT " . $pager['limit']); $users = String::unformat_array($users); $char_list = $db->get_all("SELECT UPPER(MID(name,1,1)) as STR, ASCII(UPPER(MID(name,1,1))) as STR_CODE FROM fw_users GROUP BY STR"); $char_list = String::unformat_array($char_list); $smarty->assign("users_list", $users); $smarty->assign("char_list", $char_list); }
$smarty->assign("message", $message); $template = 'guestbook.a_edit_message.html'; $template_mode = 'single'; break; case $action == 'edit_msg' && isset($_GET['id']): $id = $_GET['id']; $navigation[] = array("url" => BASE_URL . "/admin/?mod=guestbook", "title" => '–едактировать сообщение'); $guestbook = $db->get_single("SELECT * FROM fw_guestbook WHERE id='{$id}'"); $guestbook = String::unformat_array($guestbook); $smarty->assign("guestbook", $guestbook); $smarty->assign("mode", "edit"); $template = 'guestbook.a_edit.html'; break; default: if (isset($_GET['page'])) { $page = $_GET['page']; } else { $page = 1; } $result = $db->query("SELECT COUNT(*) FROM fw_guestbook"); $pager = Common::pager($result, GB_MESSAGES_PER_PAGE, $page); $smarty->assign("total_pages", $pager['total_pages']); $smarty->assign("current_page", $pager['current_page']); $smarty->assign("pages", $pager['pages']); $guestbook_list = $db->get_all("SELECT * FROM fw_guestbook ORDER BY insert_date DESC LIMIT " . $pager['limit']); $guestbook_list = String::unformat_array($guestbook_list); if (count($guestbook_list) > 0) { $smarty->assign("guestbook_list", $guestbook_list); } break; }
$forums_list[] = $all_forums[$i]; } } if ($forum_content['param_level'] > 0) { $result = $db->query("SELECT COUNT(*) FROM fw_forum_threads WHERE parent='" . $forum_content['id'] . "'"); $pager = Common::pager($result, THREADS_PER_PAGE, $page); $smarty->assign("total_pages", $pager['total_pages']); $smarty->assign("current_page", $pager['current_page']); $smarty->assign("pages", $pager['pages']); if (isset($_SESSION['fw_user'])) { $threads_list = $db->get_all("SELECT *,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(SELECT author FROM fw_forum_posts WHERE parent=t.id ORDER BY publish_date LIMIT 1) AS author,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(SELECT login FROM fw_users WHERE id=author LIMIT 1) AS author_login,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(SELECT id FROM fw_users WHERE id=author LIMIT 1) AS author_id,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(SELECT name FROM fw_users WHERE id=author LIMIT 1) AS author_name,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(SELECT COUNT(*)-1 FROM fw_forum_posts WHERE parent=t.id) AS count,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(SELECT COUNT(*) FROM fw_forum_posts WHERE parent=t.id) AS pcount,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(SELECT id FROM fw_forum_posts WHERE parent=t.id AND publish_date>(SELECT view_time FROM fw_forum_vp WHERE thread_id=t.id AND user_id='" . $_SESSION['fw_user']['id'] . "' LIMIT 1) LIMIT 1) AS last_view,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(SELECT id FROM fw_forum_posts WHERE parent=t.id AND publish_date>'" . $_SESSION['fw_user']['reg_date'] . "' AND publish_date>'{$limit_time}' AND author<>'" . $_SESSION['fw_user']['id'] . "' AND parent NOT IN(SELECT thread_id FROM fw_forum_vp WHERE forum_id='" . $forum_content['id'] . "') LIMIT 1) AS last_reg,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(SELECT publish_date FROM fw_forum_posts WHERE parent=t.id ORDER BY publish_date DESC LIMIT 1) AS last_date,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(SELECT author FROM fw_forum_posts WHERE parent=t.id ORDER BY publish_date DESC LIMIT 1) AS last_author_id,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(SELECT name FROM fw_users WHERE id=last_author_id) AS last_author\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM fw_forum_threads t WHERE t.parent='" . $forum_content['id'] . "' AND status>='{$status}' ORDER BY top DESC,last_date DESC LIMIT " . $pager['limit']); } else { $threads_list = $db->get_all("SELECT *,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(SELECT author FROM fw_forum_posts WHERE parent=t.id ORDER BY publish_date LIMIT 1) AS author,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(SELECT login FROM fw_users WHERE id=author LIMIT 1) AS author_login,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(SELECT id FROM fw_users WHERE id=author LIMIT 1) AS author_id,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(SELECT name FROM fw_users WHERE id=author LIMIT 1) AS author_name,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(SELECT COUNT(*)-1 FROM fw_forum_posts WHERE parent=t.id) AS count,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(SELECT COUNT(*) FROM fw_forum_posts WHERE parent=t.id) AS pcount,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(SELECT publish_date FROM fw_forum_posts WHERE parent=t.id ORDER BY publish_date DESC LIMIT 1) AS last_date,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(SELECT author FROM fw_forum_posts WHERE parent=t.id ORDER BY publish_date DESC LIMIT 1) AS last_author_id,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(SELECT name FROM fw_users WHERE id=last_author_id) AS last_author\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM fw_forum_threads t WHERE t.parent='" . $forum_content['id'] . "' AND status>='{$status}' ORDER BY top DESC,last_date DESC LIMIT " . $pager['limit']); } for ($i = 0; $i < sizeof($threads_list); $i++) { $tpager = Common::pager($threads_list[$i]['pcount'], POSTS_PER_PAGE, 1); $threads_list[$i]['pages'] = $tpager['pages']; $threads_list[$i]['total_pages'] = $tpager['total_pages']; } $smarty->assign("threads_list", $threads_list); $smarty->assign("forum_content", $forum_content); } else { $smarty->assign("main_forum", true); } if (isset($forums_list)) { if (isset($_SESSION['fw_user'])) { for ($l = 0; $l < sizeof($forums_list); $l++) { $forums_list[$l]['id_list'] = $forums_list[$l]['id'] . ','; for ($i = 0; $i < sizeof($all_forums); $i++) { if ($all_forums[$i]['param_left'] > $forums_list[$l]['param_left'] && $all_forums[$i]['param_right'] < $forums_list[$l]['param_right']) { $forums_list[$l]['id_list'] .= $all_forums[$i]['id'] . ',';
$smarty->assign("cat_list", $photoalbum_cat_list); if ($cat_content['title'] != '') { $page_title = $cat_content['title']; } else { if ($cat_content['name'] != '/') { $page_title = $cat_content['name']; } } if ($cat_content['meta_keywords'] != '') { $meta_keywords = $cat_content['meta_keywords']; } if ($cat_content['meta_description'] != '') { $meta_description = $cat_content['meta_description']; } $result = $db->query("SELECT COUNT(*) FROM fw_photoalbums WHERE parent='" . $cat_content['id'] . "' AND status='1'"); $pager = Common::pager($result, ALBUMS_PER_PAGE, $page); $smarty->assign("total_pages", $pager['total_pages']); $smarty->assign("current_page", $pager['current_page']); $smarty->assign("pages", $pager['pages']); $albums_list = $db->get_all("SELECT *,(SELECT CONCAT(id,'.',ext) FROM fw_photoalbum_images WHERE parent=a.id ORDER BY sort_order LIMIT 1) AS image,(SELECT COUNT(*) FROM fw_photoalbum_images WHERE parent=a.id) AS photos FROM fw_photoalbums a WHERE a.parent='" . $cat_content['id'] . "' AND status='1' ORDER BY insert_date DESC LIMIT " . $pager['limit']); if ($cat_list[$f]['full_title'] != '/') { $nav_titles = explode("/", $cat_list[$f]['full_title']); $nav_urls = explode("/", $cat_list[$f]['full_url']); unset($nav_titles[count($nav_titles) - 1]); unset($nav_urls[count($nav_urls) - 1]); for ($l = 0; $l < count($nav_titles); $l++) { $navigation[] = array("url" => $nav_urls[$l], "title" => trim($nav_titles[$l])); } } $smarty->assign("albums_list", $albums_list); $template = 'photoalbum_main.html';
$nav_titles = explode("/", $all_pages[$f]['full_title']); $nav_urls = explode("/", $all_pages[$f]['full_url']); unset($nav_titles[count($nav_titles) - 1]); unset($nav_urls[count($nav_urls) - 1]); for ($l = 0; $l < count($nav_titles); $l++) { $navigation[] = array("url" => $nav_urls[$l], "title" => trim($nav_titles[$l])); } $page_content = $main_page_content; $main_template = $page_content['template']; $smarty->assign("page_content", $page_content); $navigation[count($navigation) - 1] = array("url" => $main_page_content['url'], "title" => $page_content['name']); if ($page_content['show_documents'] == "1") { $limit = ""; if ($page_content['show_documents_number'] > 0) { $result = $db->query("SELECT COUNT(*) FROM fw_documents d WHERE d.parent='" . $main_page_content['id'] . "' AND d.status='1'"); $pager = Common::pager($result, $page_content['show_documents_number'], $page); $limit = "LIMIT " . $pager['limit']; $smarty->assign("total_pages", $pager['total_pages']); $smarty->assign("current_page", $pager['current_page']); $smarty->assign("pages", $pager['pages']); } if ($main_page_content['orderby'] != '') { $orderby = $main_page_content['orderby'] . " " . $main_page_content['orderbysc']; } else { $orderby = "d.sort_order"; } $documents_list = $db->get_all("\n\t\t\t\t\tSELECT\n\t\t\t\t\t\td.*,\n\t\t\t\t\t\t(SELECT url FROM fw_tree WHERE id=d.parent) as url\n\t\t\t\t\tFROM fw_documents d\n\t\t\t\t\tWHERE\n\t\t\t\t\t\td.parent='" . $main_page_content['id'] . "'\n\t\t\t\t\t\tAND\n\t\t\t\t\t\td.status='1'\n\t\t\t\t\tORDER BY {$orderby}\n\t\t\t\t\t{$limit}\n\t\t\t\t"); if (count($documents_list)) { $smarty->assign("documents_list", $documents_list); if (is_file($templates_path . "/" . $main_page_content['documents_template'])) { $documents_template = $main_page_content['documents_template'];
case $action == 'edit' && isset($_GET['id']): $id = $_GET['id']; $navigation[] = array("url" => BASE_URL . "/admin/?mod=news", "title" => 'Редактировать новость'); $news = $db->get_single("SELECT * FROM fw_news WHERE id='{$id}'"); $news = String::unformat_array($news); $smarty->assign("news", $news); $smarty->assign("mode", "edit"); $template = 'news.a_edit.html'; break; default: if (isset($_GET['page'])) { $page = $_GET['page']; } else { $page = 1; } if (isset($_GET['year']) && intval($_GET['year']) > 0) { $cond = " WHERE YEAR(FROM_UNIXTIME(publish_date))='" . $_GET['year'] . "' "; } else { $cond = ""; } $result = $db->query("SELECT COUNT(*) FROM fw_news {$cond}"); $pager = Common::pager($result, NEWS_PER_PAGE, $page); $smarty->assign("total_pages", $pager['total_pages']); $smarty->assign("current_page", $pager['current_page']); $smarty->assign("pages", $pager['pages']); $news_list = $db->get_all("SELECT * FROM fw_news {$cond} ORDER BY publish_date DESC LIMIT " . $pager['limit']); $news_list = String::unformat_array($news_list); if (count($news_list) > 0) { $smarty->assign("news_list", $news_list); } }
} $smarty->assign("curdate", $banner['start_date']); $smarty->assign("curdate2", $banner['end_date']); $smarty->assign("banner", $banner); $cc = $db->get_all("SELECT url FROM fw_banners_cat WHERE banner_id='{$id}'"); $cat_checked = array(); foreach ($cc as $k => $v) { $cat_checked[] = $v['url']; } $cl = Common::generate_main_menu(); $smarty->assign("cat_checkboxes", $cl); $smarty->assign("cat_checked", $cat_checked); $smarty->assign("mode", "edit"); $template = 'banners.a_edit.html'; break; default: if (isset($_GET['page'])) { $page = $_GET['page']; } else { $page = 1; } $result = $db->query("SELECT COUNT(*) FROM fw_banners"); $pager = Common::pager($result, BANNERS_PER_PAGE, $page); $smarty->assign("total_pages", $pager['total_pages']); $smarty->assign("current_page", $pager['current_page']); $smarty->assign("pages", $pager['pages']); $banners_list = $db->get_all("SELECT * FROM fw_banners LIMIT " . $pager['limit']); if (count($banners_list) > 0) { $smarty->assign("banners_list", $banners_list); } }
case $action == 'add': $navigation[] = array("url" => BASE_URL . "/admin/?mod=otr&action=add", "title" => 'ƒобавить решение'); $smarty->assign("mode", "add"); $template = 'otr.a_edit.html'; break; case $action == 'edit' && isset($_GET['id']): $id = $_GET['id']; $navigation[] = array("url" => BASE_URL . "/admin/?mod=otr", "title" => '–едактировать решение'); $otr = $db->get_single("SELECT * FROM fw_otr WHERE id='{$id}'"); $otr = String::unformat_array($otr); $smarty->assign("otr", $otr); $smarty->assign("mode", "edit"); $template = 'otr.a_edit.html'; break; default: if (isset($_GET['page'])) { $page = $_GET['page']; } else { $page = 1; } $result = $db->query("SELECT COUNT(*) FROM fw_otr"); $pager = Common::pager($result, OTR_PER_PAGE, $page); $smarty->assign("total_pages", $pager['total_pages']); $smarty->assign("current_page", $pager['current_page']); $smarty->assign("pages", $pager['pages']); $otr_list = $db->get_all("SELECT * FROM fw_otr ORDER BY title ASC LIMIT " . $pager['limit']); $otr_list = String::unformat_array($otr_list); if (count($otr_list) > 0) { $smarty->assign("otr_list", $otr_list); } }
case $action == 'add': $navigation[] = array("url" => BASE_URL . "/admin/?mod=polls&action=add", "title" => 'ƒобавить опрос'); $smarty->assign("mode", "add"); $template = 'polls.a_edit_poll.html'; break; case $action == 'edit' && isset($_GET['id']): $navigation[] = array("url" => BASE_URL . "/admin/?mod=polls&action=edit", "title" => '–едактировать опрос'); $id = $_GET['id']; $poll = $db->get_single("SELECT * FROM fw_polls WHERE id='{$id}'"); $answers = $db->get_all("SELECT * FROM fw_polls_answers WHERE parent='{$id}' ORDER BY sort_order"); $poll['answers'] = $answers; $poll = String::unformat_array($poll); $smarty->assign("poll", $poll); $smarty->assign("mode", "edit"); $template = 'polls.a_edit_poll.html'; break; default: if (isset($_GET['page'])) { $page = $_GET['page']; } else { $page = 1; } $result = $db->query("SELECT COUNT(*) FROM fw_polls"); $pager = Common::pager($result, POLLS_PER_PAGE, $page); $smarty->assign("total_pages", $pager['total_pages']); $smarty->assign("current_page", $pager['current_page']); $smarty->assign("pages", $pager['pages']); $polls_list = $db->get_all("SELECT * FROM fw_polls ORDER BY publish_date DESC LIMIT " . $pager['limit']); $polls_list = String::unformat_array($polls_list); $smarty->assign("polls_list", $polls_list); }