function show_photoalbum($params) { global $db; global $smarty; $res = $db->get_single("SELECT url FROM fw_tree WHERE module='photoalbum' LIMIT 1"); $support_url = $res['url']; $album_id = $params['id']; $photos_list = $db->get_all("SELECT *,(SELECT COUNT(*) FROM fw_photoalbum_images WHERE parent='{$album_id}') AS count FROM fw_photoalbum_images WHERE parent='{$album_id}' ORDER BY sort_order LIMIT " . PHOTOS_PER_PAGE_SUP); for ($i = 0; $i < sizeof($photos_list); $i++) { $photo_file = BASE_PATH . '/' . PHOTOS_FOLDER . '/' . $photos_list[$i]['id'] . '.' . $photos_list[$i]['ext']; $output = Image::image_details($photo_file); $photos_list[$i]['width'] = $output['width'] + 20; $photos_list[$i]['height'] = $output['height'] + 20; } if ($photos_list[0]['count'] > PHOTOS_PER_PAGE_SUP) { $cl = $db->get_all("SELECT *,(SELECT parent FROM fw_photoalbums WHERE id='{$album_id}') AS album FROM fw_photoalbum_cat c WHERE c.status='1' ORDER BY c.param_left"); $album_parent = $cl[0]['album']; $cl = Common::get_nodes_list($cl); foreach ($cl as $k => $v) { if ($v['id'] == $album_parent) { $album_url = $v['full_url']; } } $album_url = $support_url . $album_url . 'album_' . $album_id; $smarty->assign("album_url", $album_url); } $smarty->assign("photos_list", $photos_list); $smarty->assign("photos_per_page_sup", PHOTOS_PER_PAGE_SUP); $smarty->assign("total_photos", $photos_list[0]['count']); $output = $smarty->fetch(BASE_PATH . '/modules/photoalbum/front/templates/show_photoalbum_support.html'); return $output; }
$search_results[$a]['price'] = number_format($search_results[$a]['price'] * $cur_admin['kurs'] / $cur_site['kurs'], 2); } } } $smarty->assign("search_string", $search); if (count($search_results) > 0) { $smarty->assign("search_results", $search_results); } $smarty->assign("total_pages", $pager['total_pages']); $smarty->assign("current_page", $pager['current_page']); $smarty->assign("pages", $pager['pages']); $page_found = true; $template = 'search_products.html'; break; default: $cat_list = Common::get_nodes_list($cl); unset($url[0]); if (isset($type) && $type != 'all') { $where = " AND product_type=" . $type . " "; $smarty->assign("prod_type", $type); } else { $where = ""; } $order = 'ORDER BY sort_order ASC'; if (!isset($page)) { $page = 1; } $dirs = array("price" => "desc", "insert_date" => "desc", "name" => "desc"); if (isset($_GET['page']) or isset($_GET['order'])) { if (isset($_GET['page'])) { $page = $_GET['page'];
$smarty->assign("total_pages", $pager['total_pages']); $smarty->assign("current_page", $pager['current_page']); $smarty->assign("pages", $pager['pages']); $template = 'shop.a_orders.html'; break; case $action == 'order_details': $navigation[] = array("url" => BASE_URL . "/admin/?mod=shop&action=orders", "title" => 'Список заказов'); $id = $_GET['id']; //$order=$db->get_single("SELECT * FROM fw_orders WHERE id='$id'"); //$order=String::unformat_array($order); $total_summ = $db->get_single("SELECT SUM(price) FROM fw_products WHERE id IN (SELECT product_id FROM fw_orders_products WHERE order_id='{$id}')"); $user_info = $db->get_single("SELECT a.*,b.comments,b.status FROM fw_users as a INNER JOIN fw_orders as b\n\t\t\t\t\t\t\t\t\tON a.id=b.user AND b.id='{$id}'\n\t\t\t\t\t\t\t\t\tWHERE a.id=(SELECT user FROM fw_orders WHERE id='{$id}' LIMIT 0,1)"); $smarty->assign("user_info", $user_info); $orders = $db->get_all("SELECT a.*,\n\t\tb.product_id as product_id,\n\t\tc.parent as parent,\n\t\tc.hit as hit,\n\t\tb.product_count,\n\t\tc.price as price,\n\t\t(c.price * product_count) as total_summ,\n\t\torder_id,\n\t\tproduct_count,\n\t\tc.name \tFROM `fw_orders` as a INNER JOIN\n\t\t(fw_orders_products as b INNER JOIN fw_products as c ON b.product_id=c.id)\n\t\tON a.id=b.order_id WHERE a.id='{$id}'"); $orders = String::unformat_array($orders); $cl = Common::get_nodes_list($cat_list); for ($i = 0; $i < count($orders); $i++) { for ($k = 0; $k < count($cl); $k++) { if ($orders[$i]['parent'] == $cl[$k]['id']) { $orders[$i]['cat_title'] = $cl[$k]['full_title']; break; } } } $navigation[] = array("url" => BASE_URL . "/admin/?mod=shop&action=order_details", "title" => 'Заказ номер ' . $id); for ($i = 0; $i < count($status_value); $i++) { $status_list[$i]['value'] = $status_value[$i]; $status_list[$i]['name'] = $status_name[$i]; } if (count($orders) > 0) { foreach ($orders as $key => $val) {
$result = $db->query("SELECT COUNT(*) FROM fw_forum_threads WHERE parent='{$forum_id}'"); $pager = Common::pager($result, 10, $page); $smarty->assign("total_pages", $pager['total_pages']); $smarty->assign("current_page", $pager['current_page']); $smarty->assign("pages", $pager['pages']); $threads_list = $db->get_all("SELECT *,\n\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\tFROM fw_forum_threads t WHERE t.parent='{$forum_id}' ORDER BY top DESC,last_date DESC LIMIT " . $pager['limit']); $smarty->assign("threads_list", $threads_list); $smarty->assign("forum_id", $forum_id); $smarty->assign("post_id", $id); $template = 'forum.a_posts_list.html'; $template_mode = 'single'; break; case $action == 'move_post' && isset($_GET['move_to']) && isset($_GET['post_id']): $post_id = $_GET['post_id']; $move_to = $_GET['move_to']; $db->query("UPDATE fw_forum_posts SET parent='{$move_to}', publish_date='" . time() . "' WHERE id='{$post_id}'"); $location = $_SERVER['HTTP_REFERER']; header("Location: {$location}"); break; case $action == 'move_post': $id = $_GET['post_id']; $flist = Common::get_nodes_list($forums_list); unset($flist[0]); $smarty->assign("forums_list", $flist); $smarty->assign("post_id", $id); $template = 'forum.a_forums_list.html'; $template_mode = 'single'; break; default: $smarty->assign("forums_list", $forums_list); }
for ($i = 0; $i < sizeof($photos_list); $i++) { $output = Image::image_details(BASE_PATH . '/' . USER_PHOTOS_FOLDER . '/' . $photos_list[$i]['id'] . '.' . $photos_list[$i]['ext']); $photos_list[$i]['width'] = $output['width'] + 20; $photos_list[$i]['height'] = $output['height'] + 20; } $smarty->assign("total_pages", $pager['total_pages']); $smarty->assign("current_page", $pager['current_page']); $smarty->assign("pages", $pager['pages']); $smarty->assign("total_photos", count($photos_list)); $smarty->assign("album", $album); $smarty->assign("photos_list", $photos_list); $template = 'show_photoalbum.html'; } break; default: $all_forums = Common::get_nodes_list($all_forums); unset($url[0]); if (@preg_match("/^page_([0-9]+)\$/", $url[$n])) { list(, $page) = explode("_", $url[$n]); unset($url[$n]); unset($current_url_pages[count($current_url_pages) - 1]); } else { $page = 1; } for ($f = 0; $f < count($all_forums); $f++) { $url_to_check = implode("/", $url) . '/'; if ($all_forums[$f]['full_url'] == $url_to_check) { $forum_content = $all_forums[$f]; $page_found = true; $smiles_list = $db->get_all("SELECT * FROM fw_smiles ORDER BY sort_order LIMIT 20"); $smarty->assign("smiles_list", $smiles_list);
$navigation[] = array("url" => BASE_URL . "/admin/?mod=regions&action=add_firm", "title" => 'Добавить компанию'); //$citys_list=Common::get_nodes_list($citys_list); $metros_list = $db->get_all("SELECT * FROM fw_metros"); $metros_list = String::unformat_array($metros_list); $reg_list = Common::get_nodes_list($reg_list); $smarty->assign("reg_list", $reg_list); $smarty->assign("citys_list", $citys_list); $smarty->assign("metros_list", $metros_list); $smarty->assign("mode", "add"); $smarty->assign("city", @$_GET['city']); $template = 'regions.a_edit_firm.html'; break; case $action == 'edit_city' && isset($_GET['id']): $navigation[] = array("url" => BASE_URL . "/admin/?mod=regions&action=edit_city", "title" => 'Редактировать город'); $id = $_GET['id']; $reg_list = Common::get_nodes_list($reg_list); // unset($cat_list[0]); // SORRY for so strange separator /****************************************************************/ $city = $db->get_single("SELECT *\tFROM fw_citys AS p WHERE id='{$id}'"); $city = String::unformat_array($city); /****************************************************************/ $smarty->assign("reg_list", $reg_list); $smarty->assign("city", $city); $smarty->assign("mode", "edit"); $template = 'regions.a_edit_city.html'; break; case $action == 'edit_metro' && isset($_GET['id']): $navigation[] = array("url" => BASE_URL . "/admin/?mod=regions&action=edit_metro", "title" => 'Редактировать метро'); $id = $_GET['id']; //$reg_list=Common::get_nodes_list($reg_list);
if (isset($_GET['parent'])) { $parent = intval($_GET['parent']); $smarty->assign("parent", $parent); $template = "tree.a_edit_document.html"; $smarty->assign("mode", "add"); $nodes_list = Common::get_nodes_list($nodes_list, 'page'); unset($nodes_list[0]); $smarty->assign("nodes_list", $nodes_list); } break; case $action == 'edit_document': $navigation[] = array("url" => BASE_URL . "/admin/?mod=tree&action=edit_document", "title" => 'Редактировать документ'); if (isset($_GET['id'])) { $id = intval($_GET['id']); $result = $db->get_single("SELECT * FROM fw_documents WHERE id='" . $id . "'"); if (count($result) > 0) { $template = "tree.a_edit_document.html"; $smarty->assign("parent", $result['parent']); $smarty->assign("mode", "edit"); $smarty->assign("document", $result); $nodes_list = Common::get_nodes_list($nodes_list, 'page'); unset($nodes_list[0]); $smarty->assign("nodes_list", $nodes_list); } } break; default: $content = $db->get_all("\n SELECT\n *,\n (SELECT COUNT(id) FROM fw_documents WHERE parent=t.id) as documents\n FROM fw_tree t\n ORDER BY t.param_left ASC\n "); $content = String::unformat_array($content); $smarty->assign("content", Common::get_nodes_list($content)); }
<?php require_once 'lib/class.photoalbum.php'; require_once 'lib/class.table.php'; require_once 'lib/class.form.php'; $all_pages = $db->get_all("\n\tSELECT\n\t\ttree.*,\n\t\tdob.name as orderby_name,\n\t\tdob.orderby,\n\t\tdob.orderbysc,\n\t\t(SELECT param_left FROM fw_tree WHERE param_right>tree.param_left AND tree.param_level-param_level=1 ORDER BY param_left LIMIT 1) AS p_left,\n\t\t(SELECT param_right FROM fw_tree WHERE param_right>tree.param_left AND tree.param_level-param_level=1 ORDER BY param_left LIMIT 1) AS p_right,\n\t\t(SELECT GROUP_CONCAT(id SEPARATOR ',') FROM fw_users WHERE FIND_IN_SET(group_id, tree.access_groups)>0) as access_users_groups,\n\t\t(SELECT IF(ISNULL(access_users_groups), access_users, CONCAT(access_users,',',access_users_groups))) as access_users_list\n\tFROM\n\t\tfw_tree AS tree\n\t\tLEFT JOIN fw_documents_orderby dob\n\t\t\tON\n\t\t\t\tdob.id=tree.show_documents_orderby\n\tWHERE\n\t\ttree.module='page'\n\t\tAND\n\t\ttree.status='1'\n\tORDER BY tree.param_left\n"); $all_pages = Common::get_nodes_list($all_pages); //echo count($all_pages); if (preg_match("/^page_[0-9]+\$/", $url[$n])) { list(, $page) = explode("_", $url[$n]); $url = array_values($url); unset($url[$n]); unset($current_url_pages[count($current_url_pages) - 1]); $n = count($url) - 1; } else { $page = 1; } if (preg_match("/^item_([0-9]+)\$/", $url[$n], $a)) { $select_item = intval($a[1]); unset($url[$n]); $n--; } for ($f = 0; $f < count($all_pages); $f++) { $url_to_check = implode("/", $url) . '/'; if ($all_pages[$f]['full_url'] == $url_to_check) { $main_page_content = $all_pages[$f]; if (Common::check_node_auth($main_page_content['access_users_list'])) { $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]);