Ejemplo n.º 1
0
require_once "session.php";
include "lib.php";
include "db.php";
if (isset($_GET[logout])) {
    logout();
}
$upload_dir = "img";
$items = itemList(items);
if (isset($_GET[id])) {
    $id = abs(clrInt($_GET[id]));
    delItem('items', $id);
    header('Location: admin.php');
}
if (isset($_GET[order_id])) {
    $id = clrStr($_GET[order_id]);
    delItem('orders', $id);
    header('Location: admin.php');
}
if ($_SERVER[REQUEST_METHOD] == "POST") {
    $name = clrStr($_POST['name']);
    $price = clrInt($_POST['price']);
    $photo = $_FILES['f']['name'];
    $quantity = clrInt($_POST['quantity']);
    $tmp_name = $_FILES['f']['tmp_name'];
    if (getItem($name, $price, $photo, $quantity)) {
        if (move_uploaded_file($tmp_name, "{$upload_dir}/{$photo}")) {
            header('Location: admin.php');
            echo "Товар успешно добавлен!</br>";
        }
    } else {
        echo "произошла ошибка!";
Ejemplo n.º 2
0
<?php

require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/header.php";
require "../block_funcs.php";
$bookId = $_GET['id_book'];
if (!empty($bookId)) {
    $bookTitleSearch = getList(2, array('UF_TITLE'), null, array('ID' => $bookId));
    if (empty($bookTitleSearch)) {
        LocalRedirect("/books/");
    }
    $booksSearch = getList(3, array('ID'), null, array('UF_ID_BOOK' => $bookId));
    $bookTitle = $bookTitleSearch[0]['UF_TITLE'];
    foreach ($booksSearch as $book) {
        $result = delItem(3, $book['ID']);
    }
    $result = delItem(2, $bookId);
    if ($result->isSuccess()) {
        $_SESSION['BookMessage'] = "Книга " . $bookTitle . " удалена!";
    } else {
        $_SESSION['BookMessage'] = "При удалении произошла ошибка!";
    }
}
LocalRedirect("/books/");
//require($_SERVER["DOCUMENT_ROOT"]."/bitrix/footer.php");
Ejemplo n.º 3
0
     $res = addBudget($_REQUEST);
     break;
     //添加小项
 //添加小项
 case "addItem":
     $res = addItem($_REQUEST);
     break;
     //添加大项
 //添加大项
 case "addBigItem":
     $res = addBigItem($_REQUEST);
     break;
     //删除项,不区分大项,小项
 //删除项,不区分大项,小项
 case "delItem":
     $res = delItem($_REQUEST['budgetItemId']);
     break;
     //修改项,不区分大项,小项
 //修改项,不区分大项,小项
 case "editItem":
     $res = editItem($_REQUEST);
     break;
     //修改预算
 //修改预算
 case "edit":
     $res = editBudget($_REQUEST);
     break;
     //删除预算
 //删除预算
 case "delete":
     $res = delBudget($_REQUEST["budgetId"]);
Ejemplo n.º 4
0
if (!isset($_GET['action'])) {
    $errors = array("source" => "main", "error" => "Action not set, exiting");
    throwError($errors);
}
if (!isset($_SESSION['project'])) {
    $errors = array("source" => "main", "error" => "Session not set, exiting");
    throwError($errors);
}
$action = $_GET['action'];
$project = $_SESSION['project'];
switch ($action) {
    case 'get':
        getItems();
        break;
    case 'delete':
        delItem();
        break;
    case 'update':
        updateProj();
        break;
    case 'pdf':
        genPDF($project, false);
        break;
    case 'servicedesk':
        SDticket($project);
        break;
    default:
        $errors = array("source" => "main", "error" => "Action not valid, exiting");
        throwError($errors);
}
function getItems()
Ejemplo n.º 5
0
<?php

require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/header.php";
require "../block_funcs.php";
$autorId = $_GET['id_autor'];
if (!empty($autorId)) {
    $autorNameSearch = getList(1, array('UF_NAME'), null, array('ID' => $autorId));
    if (empty($autorNameSearch)) {
        LocalRedirect("/autors/");
    }
    $autorSearch = getList(3, array('ID'), null, array('UF_ID_AUTOR' => $autorId));
    $autorName = $autorNameSearch[0]['UF_NAME'];
    if (!empty($autorSearch)) {
        $_SESSION['AutorMessage'] = "Невозможно удалить автора " . $autorName . "!";
        LocalRedirect("/autors/");
    }
    $result = delItem(1, $autorId);
    if ($result->isSuccess()) {
        $_SESSION['AutorMessage'] = "Автор " . $autorName . " удален!";
    } else {
        $_SESSION['AutorMessage'] = "При удалении произошла ошибка!";
    }
}
LocalRedirect("/autors/");
//require($_SERVER["DOCUMENT_ROOT"]."/bitrix/footer.php");
Ejemplo n.º 6
0
    $newTitle = $_POST['bookTitle'];
    if ($newTitle == $_POST['oldTitle'] || empty($newTitle)) {
        LocalRedirect("/books/");
    }
    $editItem = array('UF_TITLE' => $newTitle);
    $result = editItem(2, $_POST['bookId'], $editItem);
    if ($result->isSuccess()) {
        $_SESSION['BookMessage'] = "Название книги " . $newTitle . " изменено!";
    } else {
        $_SESSION['BookMessage'] = "При изменении названия книги произошла ошибка!";
    }
    LocalRedirect("/books/");
}
if (isset($_POST['autorDelete'])) {
    $autorSearch = getList(3, array('ID'), null, array('UF_ID_BOOK' => $_POST['bookId'], 'UF_ID_AUTOR' => $_POST['autorId']));
    $result = delItem(3, $autorSearch[0]['ID']);
    if ($result->isSuccess()) {
        $_SESSION['BookMessage'] = "Список авторов книги " . $_POST['bookTitle'] . " изменен!";
    } else {
        $_SESSION['BookMessage'] = "При изменении списка авторов произошла ошибка!";
    }
    LocalRedirect("/books/");
}
if (isset($_POST['addBookAutor'])) {
    $add = array('UF_ID_AUTOR' => $_POST['newAutor'], 'UF_ID_BOOK' => $_POST['bookId']);
    $result = addItem(3, $add);
    if ($result->isSuccess()) {
        $_SESSION['BookMessage'] = "Список авторов книги " . $_POST['bookTitle'] . " изменен!";
    } else {
        $_SESSION['BookMessage'] = "При изменении списка авторов произошла ошибка!";
    }