Ejemplo n.º 1
0
 static function unformat_array($array)
 {
     while (list($key, $value) = each($array)) {
         if (is_array($array[$key])) {
             $array[$key] = String::unformat_array($array[$key]);
         } else {
             $array[$key] = String::unformat($array[$key]);
         }
     }
     return $array;
 }
Ejemplo n.º 2
0
        $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;
}
Ejemplo n.º 3
0
     $page_found = true;
     $profile = $db->get_single("SELECT *,(SELECT COUNT(*) FROM fw_orders WHERE user=u.id) AS orders FROM fw_users u WHERE u.id='" . $_SESSION['fw_user']['id'] . "'");
     $profile = String::unformat_array($profile, 'front');
     $orders_list = $db->get_all("SELECT a.id,a.user,a.insert_date,a.status,\n\t\t\t\t\t\t\t\t\tb.product_id,b.order_id,b.product_count,\n\t\t\t\t\t\t\t\t\tc.name,c.small_description,c.price,c.article FROM fw_products\n\t\t\t\t\t\t\t\t\tas c INNER JOIN (fw_orders as a INNER JOIN fw_orders_products as b\n\t\t\t\t\t\t\t\t\tON b.order_id=a.id) ON c.id=b.product_id\n\t\t\t\t\t\t\t\t\tWHERE a.user='******'fw_user']['id'] . "'");
     $search = array("'<FONT[^>]*?>'", "'</FONT>'", "'<font[^>]*?>'", "'</font>'");
     $replace = new Replace();
     if (count($orders_list)) {
         foreach ($orders_list as $key => $val) {
             $price = $orders_list[$key]['price'];
             $orders_list[$key]['price'] = number_format($orders_list[$key]['price'] * $cur_admin['kurs'] / $cur_site['kurs'], 2);
             $orders_list[$key]['price2'] = number_format($price * $cur_admin['kurs'] / $cur_site2['kurs'], 2);
             $orders_list[$key]['small_description'] = $replace->getReplace($search, "", $orders_list[$key]['small_description']);
         }
     }
     if (count($orders_list) > 0) {
         $orders_list = String::unformat_array($orders_list, 'front');
         $smarty->assign("orders_list", $orders_list);
     }
     $template = 'cabinet_orders.html';
     break;
 default:
     $userId = $check_auth = Common::check_auth_shop('user');
     $user = $users->get_user($userId);
     if (count($url) == 1) {
         $page_found = true;
     }
     $orders = $shop->getUserOrders($userId);
     $smarty->assign("profile", $user);
     $smarty->assign("orders", $orders);
     $main = $smarty->fetch($templates_path . '/cabinet_main_new.html');
     $smarty->assign("main", $main);
Ejemplo n.º 4
0
    $main_template = BASE_PATH . '/templates/404.html';
    //$navigation[]=array("url"=>"/","title"=>"пїЅпїЅпїЅпїЅпїЅпїЅ 404. пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ");
}
$temp = '';
//print_r($navigation);
for ($i = 0; $i < count($navigation); $i++) {
    $_SESSION['nav'][$i] = $navigation[$i]['title'];
    $temp .= $navigation[$i]['url'] . "/";
    $navigation[$i]['url'] = $temp;
}
//костыль
if (count($navigation) > 1) {
    unset($navigation[count($navigation) - 1]);
}
//print_r($navigation);
$navigation = String::unformat_array($navigation, 'front');
$smarty->assign("navigation", $navigation);
$smarty->assign("base_url", BASE_URL);
$smarty->assign("template", $template);
if (isset($css)) {
    $smarty->assign("css", $css);
}
if (isset($js)) {
    $smarty->assign("js", $js);
}
$smarty->assign("db_connections", $_SESSION['db_connections']);
$smarty->assign("pgt", $pgt);
if (isset($page) or $set_pages_url) {
    $current_url = implode("/", $current_url_pages);
    $current_url = preg_replace("/&sort=([a-z]+)/i", "", $current_url);
    $current_url = preg_replace("/&order=([a-z]+)/i", "", $current_url);
Ejemplo n.º 5
0
 case $action == 'edit_post':
     $id = $_GET['post_id'];
     $post = $db->get_single("SELECT text,id,author,parent,\n\t\t\t\t\t\t\t\t\t\t\t\t\t(SELECT title FROM fw_forum_threads WHERE id=p.parent) AS title,\n\t\t\t\t\t\t\t\t\t\t\t\t\t(SELECT id FROM fw_forum_threads WHERE id=p.parent) AS thread_id,\n\t\t\t\t\t\t\t\t\t\t\t\t\t(SELECT parent FROM fw_forum_threads WHERE id=p.parent) AS thread_parent\n\t\t\t\t\t\t\t\t\t\t\t\t\tFROM fw_forum_posts p WHERE p.id='{$id}'");
     if ($_SESSION['fw_user']['id'] != $post['author']) {
         Common::check_priv("{$priv}");
     } else {
         $smarty->assign("no_move", true);
     }
     if ($_GET['is_thread'] == 'yes') {
         $smarty->assign("is_thread", 'yes');
         $forums_list = Common::get_nodes_list($forums_list);
         unset($forums_list[0]);
         $smarty->assign("forums_list", $forums_list);
     }
     $post['text'] = add_forum_tags($post['text']);
     $post = String::unformat_array($post);
     $smarty->assign("post", $post);
     $template = 'forum.a_edit_post.html';
     $template_mode = 'single';
     break;
 case $action == 'create_new_thread':
     $id = $_GET['post_id'];
     $smarty->assign("forums_list", Common::get_nodes_list($forums_list));
     $smarty->assign("post_id", $id);
     $template = 'forum.a_create_thread.html';
     $template_mode = 'single';
     break;
 case $action == 'move_post' && isset($_GET['forum_id']):
     $id = $_GET['post_id'];
     $forum_id = $_GET['forum_id'];
     if (isset($_GET['page']) && $_GET['page'] != '') {
Ejemplo n.º 6
0
    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);
        }
}
Ejemplo n.º 7
0
     unset($url[$n]);
     unset($current_url_pages[count($current_url_pages) - 1]);
     $n = count($url) - 1;
     $smarty->assign("type", $type);
 } else {
     unset($type);
 }
 if (isset($type) && $type == 'all') {
     unset($type);
 }
 $cur_site = $db->get_single("SELECT kurs,znak FROM fw_currency WHERE id=" . CURRENCY_SITE);
 $cur_site = String::unformat_array($cur_site);
 $cur_site2 = $db->get_single("SELECT kurs,znak FROM fw_currency WHERE id=" . CURRENCY_SITE2);
 $cur_site2 = String::unformat_array($cur_site2);
 $cur_admin = $db->get_single("SELECT kurs,znak FROM fw_currency WHERE id=" . CURRENCY_ADMIN);
 $cur_admin = String::unformat_array($cur_admin);
 $smarty->assign("currency_site", $cur_site);
 $smarty->assign("currency_site2", $cur_site2);
 $shop = new Shop($db);
 /*-----------------РАЗЛИЧНЫЕ ДЕЙСТВИЯ-----------------*/
 if (isset($_POST['submit_rating'])) {
     $id = $_POST['id'];
     $comment = String::secure_user_input($_POST['nm_text']);
     $comment = Common::strip_forum_tags($comment);
     $author = $_SESSION['fw_user']['id'];
     if ($comment != '') {
         $db->query("INSERT INTO fw_products_comments(product_id,author,text,insert_date) VALUES('{$id}','{$author}','{$comment}','" . time() . "')");
     }
     if (isset($_POST['rating'])) {
         $rating = $_POST['rating'];
         $check_rating = explode(",", $_COOKIE['fw_rating']);
Ejemplo n.º 8
0
<?php

$cur_site = $db->get_single("SELECT kurs,znak FROM fw_currency WHERE id=" . CURRENCY_SITE);
$cur_site = String::unformat_array($cur_site);
$smarty->assign("currency_site", $cur_site);
$cur_admin = $db->get_single("SELECT kurs,znak FROM fw_currency WHERE id=" . CURRENCY_ADMIN);
$cur_admin = String::unformat_array($cur_admin);
$count_cat = $db->get_single("SELECT COUNT(*) AS count FROM fw_tree");
$count_documents = $db->get_single("SELECT COUNT(*) AS count FROM fw_tree WHERE module='page'");
$count_users = $db->get_single("SELECT COUNT(*) AS count FROM fw_users");
$last_orders = $db->get_all("SELECT a.id,a.user,\n\t\t\t\t\t\t\t a.insert_date as order_date,\n\t\t\t\t\t\t\t (SELECT login FROM fw_users as b WHERE b.id=a.user) as user_name,\n\t\t\t\t\t\t\t (SELECT SUM((SELECT price FROM fw_products WHERE id=c.product_id) * c.product_count) \n\t\t\t\t\t\t\t FROM fw_orders_products as c WHERE c.order_id=a.id) as total_summ \n\t\t\t\t\t\t\t FROM fw_orders as a ORDER BY a.insert_date LIMIT 0,5");
$last_orders = String::unformat_array($last_orders);
if (count($last_orders) > 0) {
    for ($i = 0; $i < count($last_orders); $i++) {
        $last_orders[$i]['total_summ'] = number_format($last_orders[$i]['total_summ'] * $cur_admin['kurs'] / $cur_site['kurs'], 2);
    }
}
$last_faq = $db->get_all("SELECT a.id,a.author, a.insert_date as insert_date,a.message FROM fw_guestbook as a ORDER BY insert_date LIMIT 0,5");
$last_faq = String::unformat_array($last_faq);
$forum_enabled = $db->get_single("SELECT id FROM fw_modules WHERE name='forum'");
if (strlen(trim($forum_enabled['id'])) > 0) {
    $last_forum = $db->get_all("SELECT a.id, a.parent, a.author, a.publish_date, a.publish_date as date, a.text, b.id as thread_id, b.parent, b.title,\n\t\t\t\t\t\t\tc.url, c.name\n\t\t\t\t\t\t\tFROM fw_forum_posts as a INNER JOIN (fw_forum_threads as b INNER JOIN fw_forums as c ON b.parent=c.id) ON a.parent=b.id WHERE a.status='1' ORDER BY a.publish_date LIMIT 0,5");
    $last_forum = String::unformat_array($last_forum);
    $smarty->assign("last_forum", $last_forum);
}
$smarty->assign("last_orders", $last_orders);
$smarty->assign("last_faq", $last_faq);
$smarty->assign("count_cat", $count_cat['count']);
$smarty->assign("count_documents", $count_documents['count']);
$smarty->assign("count_users", $count_users['count']);
Ejemplo n.º 9
0
    case $action == 'add':
        $navigation[] = array("url" => BASE_URL . "/admin/?mod=questions&action=add", "title" => 'ƒобавить вопрос');
        $smarty->assign("mode", "add");
        $template = 'questions.a_edit.html';
        break;
    case $action == 'edit' && isset($_GET['id']):
        $id = $_GET['id'];
        $navigation[] = array("url" => BASE_URL . "/admin/?mod=questions", "title" => '–едактировать вопрос');
        $questions = $db->get_single("SELECT * FROM fw_questions WHERE id='{$id}'");
        $questions = String::unformat_array($questions);
        $smarty->assign("questions", $questions);
        $smarty->assign("mode", "edit");
        $template = 'questions.a_edit.html';
        break;
    default:
        if (isset($_GET['page'])) {
            $page = $_GET['page'];
        } else {
            $page = 1;
        }
        $result = $db->query("SELECT COUNT(*) FROM fw_questions");
        $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']);
        $questions_list = $db->get_all("SELECT *, (SELECT count(id) FROM fw_answers WHERE question_id=fw_questions.id) as count_answers FROM fw_questions ORDER BY id DESC LIMIT " . $pager['limit']);
        $questions_list = String::unformat_array($questions_list);
        if (count($questions_list) > 0) {
            $smarty->assign("questions_list", $questions_list);
        }
}
Ejemplo n.º 10
0
     }
     if (isset($_GET['cat'])) {
         if (isset($_SESSION['fw_product_added']) && $_SESSION['fw_product_added'] == '1') {
             $_SESSION['fw_product_added'] = '0';
             $smarty->assign("product_added", '1');
         }
         if (isset($_GET['page'])) {
             $page = $_GET['page'];
         } else {
             $page = 1;
         }
         $result = $db->query("SELECT COUNT(*) FROM fw_products");
         $pager = Common::pager($result, PRODUCTS_PER_PAGE, $page);
         $cat = $_GET['cat'];
         $products_list = $db->get_all("SELECT * FROM fw_products WHERE parent='{$cat}' AND status='1' LIMIT " . $pager['limit']);
         $products_list = String::unformat_array($products_list);
         $smarty->assign("products_list", $products_list);
         $smarty->assign("cat", $cat);
         $smarty->assign("total_pages", $pager['total_pages']);
         $smarty->assign("current_page", $pager['current_page']);
         $smarty->assign("pages", $pager['pages']);
     } else {
         $smarty->assign("cat_list", $cat_list);
     }
     $template = 'mini_catalogue.html';
     $template_mode = 'single';
     break;
 case $action == 'delete_additional_product' && isset($_GET['id']) & isset($_GET['from']):
     $id = $_GET['id'];
     $from = $_GET['from'];
     $product = $db->get_single("SELECT additional_products FROM fw_products WHERE id='{$from}'");
Ejemplo n.º 11
0
        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));
}
Ejemplo n.º 12
0
    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);
        }
}
Ejemplo n.º 13
0
     $smarty->assign("current_page", $pager['current_page']);
     $smarty->assign("pages", $pager['pages']);
     $smarty->assign("total_photos", count($photos_list));
     $smarty->assign("photos_list", String::unformat_array($photos_list, 'front'));
     $smarty->assign("album_id", $album_id);
     $mode = 'album';
 } else {
     if (isset($_GET['page']) && $_GET['page'] != '') {
         $page = $_GET['page'];
     } else {
         $page = 1;
     }
     $result = $db->query("SELECT COUNT(*) FROM fw_photoalbums");
     $pager = Common::pager($result, ALBUMS_PER_PAGE, $page);
     $albums_list = $db->get_all("SELECT *,(SELECT COUNT(*) FROM fw_photoalbum_images WHERE parent=a.id) AS photos FROM fw_photoalbums a LIMIT " . $pager['limit']);
     $albums_list = String::unformat_array($albums_list);
     $cl = Common::get_nodes_list($cat_list);
     for ($i = 0; $i < count($albums_list); $i++) {
         for ($k = 0; $k < count($cl); $k++) {
             if ($albums_list[$i]['parent'] == $cl[$k]['id']) {
                 $albums_list[$i]['cat_title'] = $cl[$k]['full_title'];
                 break;
             }
         }
     }
     $smarty->assign("total_pages", $pager['total_pages']);
     $smarty->assign("cat_list", $cl);
     $smarty->assign("current_page", $pager['current_page']);
     $smarty->assign("pages", $pager['pages']);
     $smarty->assign("albums_list", $albums_list);
     $mode = 'albums_list';
Ejemplo n.º 14
0
     $navigation[] = array("url" => BASE_URL . "/admin/?mod=subscribe&action=templates", "title" => 'Шаблоны писем');
     $smarty->assign("templates_list", $db->get_all("SELECT id,name FROM fw_subscribe_templates"));
     $template = 'subscribe.a_templates.html';
     break;
 case $action == 'add_template':
     $navigation[] = array("url" => BASE_URL . "/admin/?mod=subscribe&action=templates", "title" => 'Шаблоны писем');
     $navigation[] = array("url" => BASE_URL . "/admin/?mod=subscribe&action=add_template", "title" => 'Добавить шаблон');
     $smarty->assign("mode", "add");
     $template = 'subscribe.a_edit_template.html';
     break;
 case $action == 'edit_template':
     $navigation[] = array("url" => BASE_URL . "/admin/?mod=subscribe&action=templates", "title" => 'Шаблоны писем');
     $navigation[] = array("url" => BASE_URL . "/admin/?mod=subscribe&action=edit_template", "title" => 'Редактировать шаблон');
     $id = $_GET['id'];
     $t = $db->get_single("SELECT * FROM fw_subscribe_templates WHERE id='{$id}'");
     $smarty->assign("t", String::unformat_array($t));
     $smarty->assign("mode", "edit");
     $template = 'subscribe.a_edit_template.html';
     break;
 case $action == 'users':
     $navigation[] = array("url" => BASE_URL . "/admin/?mod=subscribe&action=users", "title" => 'Подписчики');
     if (isset($_GET['page'])) {
         $page = $_GET['page'];
     } else {
         $page = 1;
     }
     $result = $db->query("SELECT COUNT(*) FROM fw_subscribe_list");
     $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']);
Ejemplo n.º 15
0
     $navigation[] = array("url" => BASE_URL . "/admin/?mod=shop&action=currency", "title" => 'Курсы валют');
     $cur_list = $db->get_all("SELECT * FROM fw_currency");
     $cur_list = String::unformat_array($cur_list);
     $smarty->assign("cur_list", $cur_list);
     $template = 'shop.a_cur_list.html';
     break;
 case $action == 'add_cur':
     $navigation[] = array("url" => BASE_URL . "/admin/?mod=shop", "title" => 'Курс валют');
     $smarty->assign("mode", "add");
     $template = 'shop.a_cur_edit.html';
     break;
 case $action == 'edit_cur' && isset($_GET['id']):
     $navigation[] = array("url" => BASE_URL . "/admin/?mod=shop", "title" => 'Редактирование валюты');
     $id = $_GET['id'];
     $cur = $db->get_single("SELECT * FROM fw_currency WHERE id='{$id}'");
     $cur = String::unformat_array($cur);
     $smarty->assign("mode", "edit");
     $smarty->assign("cur", $cur);
     $template = 'shop.a_cur_edit.html';
     break;
 default:
     $count_cat = $db->get_single("SELECT COUNT(*) AS count FROM fw_catalogue");
     $count_products = $db->get_single("SELECT COUNT(*) AS count FROM fw_products");
     $count_orders = $db->get_single("SELECT COUNT(*) AS count FROM fw_orders");
     $total_price = $db->get_single("SELECT SUM(total_price) AS total FROM fw_orders");
     if ($total_price['total'] == '') {
         $total_price = '0.00';
     } else {
         $total_price = $total_price['total'];
     }
     $smarty->assign("count_cat", $count_cat['count']);
Ejemplo n.º 16
0
     $all_forums = Common::get_nodes_list($all_forums);
     for ($i = 0; $i < sizeof($pre_threads); $i++) {
         foreach ($all_forums as $k => $v) {
             if ($v['id'] == $pre_threads[$i]['parent']) {
                 $pre_threads[$i]['full_url'] = $v['full_url'] . 'thread_' . $pre_threads[$i]['id'];
             }
         }
     }
     $smarty->assign("pre_threads", $pre_threads);
     $template = 'premoderation.html';
     break;
 case count($url) == 3 && $url[$n - 1] == 'info' && preg_match("/^[0-9]*\$/", $url[$n]):
     $navigation[] = array("url" => 'info', "title" => 'Информация о пользователе');
     $id = $url[$n];
     $info = $db->get_single("SELECT * FROM fw_users WHERE id='{$id}'");
     $info = String::unformat_array($info);
     $smarty->assign("info", $info);
     $pp = $db->get_all("SELECT th.* FROM fw_forum_posts AS po LEFT JOIN fw_forum_threads AS th ON po.parent=th.id AND th.status='1' AND po.status='1' WHERE th.parent='10' AND po.author='" . $info['id'] . "' AND po.publish_date=(SELECT publish_date FROM fw_forum_posts WHERE parent=po.parent AND status='1' ORDER BY publish_date LIMIT 1)");
     $all_forums = Common::get_nodes_list($all_forums);
     for ($i = 0; $i < sizeof($pp); $i++) {
         foreach ($all_forums as $k => $v) {
             if ($v['id'] == $pp[$i]['parent']) {
                 $pp[$i]['full_url'] = $v['full_url'] . 'thread_' . $pp[$i]['id'];
             }
         }
     }
     $smarty->assign("pp", $pp);
     $page_found = true;
     $template = 'user_info.html';
     break;
 case count($url) == 4 && $url[$n - 2] == 'info' && $url[$n] == 'albums' && preg_match("/^[0-9]*\$/", $url[$n - 1]):
Ejemplo n.º 17
0
            $dumper = new dumper();
            if (isset($_POST['file']) && $_POST['file'] != '') {
                $dumper->restore($_POST['file']);
            }
            $smarty->assign("file_date", $dumper->file_date);
            $smarty->assign("q_number", $dumper->q_number);
            $smarty->assign("t_number", $dumper->t_number);
            $smarty->assign("r_number", $dumper->r_number);
            $smarty->assign("action", "restore");
        }
        if ($_SESSION['fw_user']['priv'] == '0') {
            foreach (glob(BASE_PATH . "/backup/" . DB_NAME . "_*.*") as $filename) {
                $filename = explode("/", $filename);
                $files_list[] = $filename[count($filename) - 1];
            }
            if (isset($files_list)) {
                $smarty->assign("files_list", $files_list);
            }
        }
        $smarty->assign("db_name", DB_NAME);
        $template = 'edit_conf.a_backup.html';
        break;
    default:
        $navigation[] = array("url" => BASE_URL . "/admin/?mod=edit_conf", "title" => 'Редактировать настройки');
        $conf_list = $db->get_all("SELECT * FROM fw_conf where `section` = 'shop' and `conf_key` in ('MAIL_FROM', 'SEND_ORDER_TO') ORDER BY section,name");
        $conf_list = String::unformat_array($conf_list);
        $cur_list = $db->get_all("SELECT * FROM fw_currency WHERE status=1");
        $cur_list = String::unformat_array($cur_list);
        $smarty->assign("conf_list", $conf_list);
        $smarty->assign("cur_list", $cur_list);
}
Ejemplo n.º 18
0
             setcookie('fw_rating', $cookie_content, time() + 315360000, '/', '');
         }
     }
     $location = @$_SERVER['HTTP_REFERER'];
     header("Location: {$location}");
 }
 /*--------------------ÎÒÎÁÐÀÆÅÍÈÅ---------------------*/
 //Common::dumper($_SESSION['fw_basket']);
 if (!isset($_SESSION['fw_basket'])) {
     $_SESSION['fw_basket'] = array();
 }
 switch (TRUE) {
     case preg_match("/^([0-9]+)\$/", $url[$n]) && $url[$n - 1] == 'edit_url':
         $item = $db->get_single("SELECT * FROM fw_ferms_urls WHERE id='" . $url[$n] . "'");
         if (count($item) > 0) {
             $item = String::unformat_array($item);
         }
         $smarty->assign("item", $item);
         $smarty->assign("mode", "edit");
         $item = $db->get_single("SELECT name FROM fw_ferms WHERE id='" . $item['ferm_id'] . "'");
         $smarty->assign("ferm_name", $item['name']);
         $page_found = true;
         $template = 'ferms.f_url_add.html';
         break;
     case preg_match("/^([0-9]+)\$/", $url[$n]) && $url[$n - 1] == 'del_url':
         $db->query("DELETE FROM fw_ferms_urls WHERE id='" . $url[$n] . "'");
         $location = $_SERVER['HTTP_REFERER'];
         header("Location: {$location}");
         die;
         break;
     case preg_match("/^([0-9]+)\$/", $url[$n]) && $url[$n - 1] == 'add_url':
Ejemplo n.º 19
0
             if (trim($firms[$i]['site']) != "") {
                 $val .= "Сайт:&nbsp;<a target=_blank href='" . $firms[$i]['site'] . "'>" . $firms[$i]['site'] . "</a><br>";
             }
             $val .= "</td></tr>";
             $val .= "</table>";
         }
     } else {
         $val = "Фирмы для данного метро не загружены";
     }
     $_RESULT = array("status" => $status, "val" => $val, "val2" => $val2);
     $switch_off_smarty = true;
     echo "<b>REQUEST_URI:</b> " . $_SERVER['REQUEST_URI'] . "<br>";
     echo "<b>Loader used:</b> " . $JsHttpRequest->LOADER;
     break;
 default:
     $reg_list = String::unformat_array($cl);
     $moskow = $db->get_single("SELECT * FROM fw_citys WHERE name='Москва'");
     if ($moskow['id'] > 0) {
         $i = count($reg_list);
         $reg_list[$i]['id'] = 'moskow';
         $reg_list[$i]['name'] = $moskow['name'];
     }
     unset($url[0]);
     for ($j = count($reg_list) - 1; $j = 0; $j--) {
         $floor[] = $reg_list[$j];
     }
     $smarty->assign("reg_list", $reg_list);
     $smarty->assign("regions", 1);
     $smarty->assign("base_url", BASE_URL);
     $template = 'regions.f_main.html';
     $page_found = true;
Ejemplo n.º 20
0
<?php

require_once 'http://' . $_SERVER['HTTP_HOST'] . "/lib/class.db.php";
require_once 'http://' . $_SERVER['HTTP_HOST'] . "/lib/JsHttpRequest/Php.php";
require_once 'http://' . $_SERVER['HTTP_HOST'] . '/conf/globals.php';
$db = new db(DB_NAME, DB_HOST, DB_USER, DB_PASS);
switch ($_REQUEST["action"]) {
    case "get_citys":
        $val = "";
        $status = 1;
        $firms = $db->get_all("SELECT * FROM fw_firms WHERE status=1 ORDER BY name");
        /*if (count($products)>0){
           	$val = "<select onChange=void(sel(this,'http://".$_SERVER['HTTP_HOST']."')); name=product style='width : 222px;'><option selected>выберите товар";
           }
         	else{  		$val = "<select name=product style='width : 222px;' disabled><option selected>товары не найдены";  	}
           for($i=0; $i<count($products);$i++){    	$val .= "<option value='". $products[$i]['name'] ."'>". $products[$i]['name'] ."</option>";    }
           $val .= "</select>";*/
        $firms = String::unformat_array($firms);
        $val = count($firms);
        $JsHttpRequest =& new Subsys_JsHttpRequest_Php("windows-1251");
        $_RESULT = array("status" => $status, "val" => $val);
        $switch_off_smarty = true;
        break;
}
//$db->close_connect();
Ejemplo n.º 21
0
 $photo = new Photoalbum();
 $cat_content['text'] = $photo->pregReplace($cat_content['text'], BASE_PATH, PHOTOS_FOLDER, PHOTOS_PER_PAGE_SUP);
 $table = new Table();
 $cat_content['text'] = $table->pregReplace($cat_content['text'], BASE_PATH);
 $form = new Form();
 $cat_content['text'] = $form->pregReplace($cat_content['text'], BASE_PATH);
 $text = $cat_content['text'];
 $smarty->assign("text", $text);
 $result = $db->query("SELECT COUNT(*) FROM fw_products WHERE parent='" . $cat_content['id'] . "' {$where} {$order}");
 $pager = Common::pager($result, PRODUCTS_PER_PAGE_FRONT, $page);
 $smarty->assign("total_pages", $pager['total_pages']);
 $smarty->assign("current_page", $pager['current_page']);
 $smarty->assign("pages", $pager['pages']);
 $products_list = $db->get_all("\n\t\t\t\tSELECT *,\n\t\t\t\t\t\t(SELECT id FROM fw_products_images i WHERE i.parent=p.id ORDER BY sort_order ASC LIMIT 1) AS image,\n\t\t\t\t\t\t(SELECT ext FROM fw_products_images WHERE parent=p.id ORDER BY insert_date DESC LIMIT 1) AS ext,\n\t\t\t\t\t\t(SELECT name FROM fw_products_types WHERE id=p.product_type LIMIT 0,1) AS type_name,\n\t\t\t\t\t\t(SELECT id FROM fw_products_types WHERE id=p.product_type LIMIT 0,1) AS type_id,\n\t\t\t\t\t\t(SELECT\n\t\t\t\t\t\t\tGROUP_CONCAT(CONCAT_WS('||#||',\n\t\t\t\t\t\t\t\tcp.id,\n\t\t\t\t\t\t\t\tcp.name,\n\t\t\t\t\t\t\t\tcp.type,\n\t\t\t\t\t\t\t\tcp.elements,\n\t\t\t\t\t\t\t\tcp.status,\n\t\t\t\t\t\t\t\t(SELECT value FROM fw_products_properties AS pp WHERE pp.product_id = p.id AND pp.property_id = cr.property_id LIMIT 1)\n\t\t\t\t\t\t\t) ORDER BY cr.sort_order SEPARATOR '##|##')\n\t\t\t\t\t\tFROM fw_catalogue_relations AS cr\n\t\t\t\t\t\tLEFT JOIN fw_catalogue_properties AS cp ON cp.id=cr.property_id\n\t\t\t\t\t\tWHERE cr.cat_id = p.parent) as properties\n\t\t\t\t\tFROM fw_products AS p\n\t\t\t\t\tWHERE\n\t\t\t\t\t\tp.parent='" . $cat_content['id'] . "'\n\t\t\t\t\t\tAND\n\t\t\t\t\t\tp.status='1' {$where}\n\t\t\t\t\t\t{$order} LIMIT " . $pager['limit']);
 $rel = $db->get_all("SELECT * FROM fw_cats_types_relations as a INNER JOIN fw_products_types as b ON a.type_id=b.id WHERE a.cat_id=" . $cat_content['id'] . " ORDER BY b.name");
 $rel = String::unformat_array($rel);
 $smarty->assign("rel", $rel);
 foreach ($products_list as $v => $key) {
     $tmp = explode("##|##", $key['properties']);
     $products_list[$v]['properties'] = array();
     foreach ($tmp as $val => $k) {
         if (substr_count($k, "||#||") > 0) {
             $tmp2 = explode("||#||", $k);
             $products_list[$v]['properties'][] = $tmp2;
             if (substr_count($products_list[$v]['properties'][$val][3], "\n") > 0) {
                 $products_list[$v]['properties'][$val][3] = explode("\n", $products_list[$v]['properties'][$val][3]);
             }
         }
     }
     //					}
 }
Ejemplo n.º 22
0
    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);
}