コード例 #1
0
ファイル: shop.a_main.php プロジェクト: askovorodka/sqc
<?php

require_once '../lib/class.tree.php';
require_once '../lib/class.image.php';
require_once 'order_status.php';
$smarty->assign("currency", DEFAULT_CURRENCY);
/* DB TREE VARIABLES */
$table = 'fw_catalogue';
$id_name = 'id';
$field_names = array('left' => 'param_left', 'right' => 'param_right', 'level' => 'param_level');
$tree = new CDBTree($db, $table, $id_name, $field_names);
/*$id = $tree->clear();
$tree->insert($id, array("name" => "Шины", "url" => "tires"));
$tree->insert($id, array("name" => "Диски", "url" => "disk"));*/
$cat_list = $db->get_all("SELECT *,(SELECT COUNT(*) FROM fw_products WHERE parent=p.id) AS products, (SELECT COUNT(*) FROM fw_catalogue_relations WHERE cat_id=p.id) AS properties FROM fw_catalogue p ORDER BY param_left");
$cat_list = String::unformat_array($cat_list);
$type_list = $db->get_all("SELECT * FROM fw_products_types ORDER BY name");
$type_list = String::unformat_array($type_list);
$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);
$navigation[] = array("url" => BASE_URL . "/admin/?mod=shop", "title" => 'Магазин');
//UPDATE `fw_products` SET sort_order=id-2 WHERE 1
if (isset($_GET['action']) && $_GET['action'] != '') {
    $action = $_GET['action'];
} else {
    $action = '';
}
//print_r($_POST);
コード例 #2
0
ファイル: node_edit.php プロジェクト: jankichaudhari/yii-site
<?php

require_once '../inx/global.inc.php';
require_once '../inx/dbtree.inc.php';
include "menu.php";
$db = new CDatabase("wsv3_test", "localhost", "wsv3_db_user", "CHe9adru+*=!a!uC7ubRad!TRu#raN");
$tree = new CDBTree($db, 'category', 'cat_id');
if (!$_GET["action"]) {
    $node_id = $_GET["node_id"];
    $sql = "SELECT cat_title FROM category WHERE cat_id = {$node_id} LIMIT 1";
    $result = mysql_query($sql);
    while ($row = mysql_fetch_array($result)) {
        $node_title = $row["cat_title"];
    }
    $formData1 = array('title' => array('type' => 'text', 'label' => 'Title', 'value' => $node_title, 'required' => 2, 'attributes' => array('class' => 'addr')));
    $formData2 = array('new_id' => array('type' => 'select', 'label' => 'Category', 'value' => $node_id, 'options' => display_tree_select(1, $node_id, 'data'), 'required' => 2, 'attributes' => array('class' => 'addr')));
    // start new form object
    $form = new Form();
    $form->addForm("form", "get", $PHP_SELF);
    $form->addHtml("<div id=\"standard_form\">\n");
    $form->addField("hidden", "action", "", "edit");
    $form->addField("hidden", "id", "", $node_id);
    $form->addHtml("<fieldset>\n");
    $form->addLegend('Edit Node');
    $form->addData($formData1, $_GET);
    $form->addHtml($form->addDiv($form->makeField("submit", "", "", "Save Changes", array('class' => 'submit'))));
    $form->addHtml("</fieldset>\n");
    $form->addHtml("</div>\n");
    $form2 = new Form();
    $form2->addForm("form", "get", $PHP_SELF);
    $form2->addHtml("<div id=\"standard_form\">\n");
コード例 #3
0
ファイル: tree.php プロジェクト: jankichaudhari/yii-site
<?php

require_once '../inx/global.inc.php';
require_once '../inx/dbtree.inc.php';
include "menu.php";
$db = new CDatabase("wsv3_test", "localhost", "wsv3_db_user", "CHe9adru+*=!a!uC7ubRad!TRu#raN");
$tree = new CDBTree($db, 'category', 'cat_id');
// add a node
// need to make sure no duplicates are created
if ($_GET["action"] == "add_node") {
    if (!$_GET["node_id"] || !$_GET["node_title"]) {
        echo "error";
        exit;
    }
    $tree->insert($_GET["node_id"], array('cat_title' => $_GET["node_title"]));
    header("Location:?");
}
/*
// delete a node
// do not allow top levels to be deleted
if ($_GET["action"] == "delete_node") {
	if (!$_GET["node_id"]) {
		echo "error";
		exit;
		}
	$tree->delete($_GET["node_id"]);
	header("Location:?");
	}
*/
$sql = 'SELECT cat_id,cat_title, cat_left, cat_right, cat_level 
FROM category 
コード例 #4
0
ファイル: forum.a_main.php プロジェクト: askovorodka/sqc
<?php

require_once '../lib/class.tree.php';
/* DB TREE VARIABLES */
$table = 'fw_forums';
$id_name = 'id';
$field_names = array('left' => 'param_left', 'right' => 'param_right', 'level' => 'param_level');
$tree = new CDBTree($db, $table, $id_name, $field_names);
$forums_list = $db->get_all("SELECT * FROM fw_forums ORDER BY param_left");
$forums_list = String::unformat_array($forums_list);
$navigation[] = array("url" => BASE_URL . "/admin/?mod=shop", "title" => '‘орум');
if (isset($_GET['action']) && $_GET['action'] != '') {
    $action = $_GET['action'];
} else {
    $action = '';
}
function add_forum_tags($text)
{
    $text = preg_replace("/<b>/i", "[B]", $text);
    $text = preg_replace("/<\\/b>/i", "[/B]", $text);
    $text = preg_replace("/<i>/i", "[I]", $text);
    $text = preg_replace("/<\\/i>/i", "[/I]", $text);
    $text = preg_replace("/<u>/i", "[U]", $text);
    $text = preg_replace("/<\\/u>/i", "[/U]", $text);
    $text = preg_replace("/<div class=forum_quote>/i", "[QUOTE]", $text);
    $text = preg_replace("/<\\/div>/i", "[/QUOTE]", $text);
    $text = preg_replace("/<br>/i", "\n", $text);
    $text = preg_replace("/<a href=([^>]*)>([^<]*?)<\\/a>/i", "[URL=\\1]\\2[/URL]", $text);
    $text = preg_replace("/<img src=([^>]*)>/i", "[IMG]\\1[/IMG]", $text);
    return $text;
}
コード例 #5
0
ファイル: regions.a_main.php プロジェクト: askovorodka/sqc
<?php

require_once '../lib/class.tree.php';
require_once '../lib/class.image.php';
/* DB TREE VARIABLES */
$table = 'fw_regions';
$id_name = 'id';
$field_names = array('left' => 'param_left', 'right' => 'param_right', 'level' => 'param_level');
$tree = new CDBTree($db, $table, $id_name, $field_names);
$reg_list = $db->get_all("SELECT *, (SELECT COUNT(*) FROM fw_citys WHERE reg_id=p.id) as citys FROM fw_regions p ORDER BY param_left");
$reg_list = String::unformat_array($reg_list);
$citys_list = $db->get_all("SELECT * FROM fw_citys p ORDER BY name");
$citys_list = String::unformat_array($citys_list);
$navigation[] = array("url" => BASE_URL . "/admin/?mod=regions", "title" => 'Регионы');
//UPDATE `fw_products` SET sort_order=id-2 WHERE 1
if (isset($_GET['action']) && $_GET['action'] != '') {
    $action = $_GET['action'];
} else {
    $action = '';
}
/*------------------------- ВЫПОЛНЯЕМ РАЗЛИЧНЫЕ ДЕЙСТВИЯ ---------------------*/
if (isset($_POST['action']) && $_POST['action'] == "resort_order") {
    if (isset($_POST['product']) && isset($_POST['product_prev']) && isset($_POST['parent_cat'])) {
        foreach ($_POST['product'] as $k => $v) {
            if ($_POST['product_prev'][$k] != $_POST['product'][$k]) {
                if ($_POST['product_prev'][$k] > $_POST['product'][$k]) {
                    $db->query("UPDATE fw_products SET sort_order='" . $_POST['product'][$k] . "' WHERE id='" . $k . "'", 1);
                    $db->query("UPDATE fw_products SET sort_order=sort_order+1 WHERE parent='" . $_POST['parent_cat'] . "' AND sort_order>='" . $_POST['product'][$k] . "' AND id!='" . $k . "'", 1);
                    $db->query("UPDATE fw_products SET sort_order=sort_order-1 WHERE parent='" . $_POST['parent_cat'] . "' AND sort_order>'" . $_POST['product_prev'][$k] . "'", 1);
                } else {
                    $db->query("UPDATE fw_products SET sort_order=sort_order-1 WHERE parent='" . $_POST['parent_cat'] . "' AND id!='" . $k . "' AND sort_order BETWEEN " . $_POST['product_prev'][$k] . " AND " . $_POST['product'][$k], 1);
コード例 #6
0
ファイル: tree.a_main.php プロジェクト: askovorodka/sqc
<?php

require_once '../lib/class.tree.php';
require_once '../lib/class.image.php';
/* DB TREE VARIABLES */
$table = 'fw_tree';
$id_name = 'id';
$field_names = array('left' => 'param_left', 'right' => 'param_right', 'level' => 'param_level');
$tree = new CDBTree($db, $table, $id_name, $field_names);
$nodes_list = $db->get_all("SELECT * FROM fw_tree ORDER BY param_left");
$nodes_list = String::unformat_array($nodes_list);
$navigation[] = array("url" => BASE_URL . "/admin/?mod=tree", "title" => 'Дерево сайта');
if (isset($_GET['action']) && $_GET['action'] != '') {
    $action = $_GET['action'];
} else {
    $action = '';
}
/*------------------------- ВЫПОЛНЯЕМ РАЗЛИЧНЫЕ ДЕЙСТВИЯ ---------------------*/
if (isset($_POST['submit_add_file'])) {
    Common::check_priv("{$priv}");
    $check = true;
    $title = String::secure_format($_POST['add_file_title']);
    $file_name = $_FILES['add_new_file']['name'];
    $tmp = $_FILES['add_new_file']['tmp_name'];
    $trusted_formats = array('jpg', 'jpeg', 'gif', 'png', 'pdf', 'doc', 'xls');
    $check_file_name = explode(".", $file_name);
    $ext = strtolower($check_file_name[count($check_file_name) - 1]);
    if (!in_array($ext, $trusted_formats)) {
        $smarty->assign("error", "Разрешены картинки форматов jpg, jpeg, gif, xls, doc, pdf и png");
        $check = false;
    }