Ejemplo n.º 1
0
<?php

require_once 'header.php';
$controller = new ControllerCategory();
$extras = new Extras();
$category_id = $extras->decryptQuery1(KEY_SALT, $_SERVER['QUERY_STRING']);
if ($category_id != null) {
    $category = $controller->getCategoryByCategoryId($category_id);
    if (isset($_POST['submit'])) {
        $itm = new Category();
        $itm->category_id = $category_id;
        $itm->category = trim(strip_tags($_POST['category']));
        $itm->created_at = time();
        $itm->updated_at = time();
        $itm->category_icon = $_POST['category_icon'];
        $count = count($_FILES["file"]["name"]);
        if (!empty($_FILES["file"]["name"][0])) {
            uploadFile($controller, $itm);
        } else {
            $controller->updateCategory($itm);
            echo "<script type='text/javascript'>location.href='categories.php';</script>";
        }
    }
} else {
    echo "<script type='text/javascript'>location.href='403.php';</script>";
}
function uploadFile($controller, $itm)
{
    $extras = new Extras();
    $desired_dir = Constants::IMAGE_UPLOAD_DIR;
    $errors = array();
Ejemplo n.º 2
0
function getCategoriesFromDealId($deal_id)
{
    $controllerCategory = new ControllerCategory();
    return $controllerCategory->getCategoriesByDealId($deal_id);
}
Ejemplo n.º 3
0
<?php

require_once 'header.php';
$controller = new ControllerStore();
$controllerCategory = new ControllerCategory();
$categories = $controllerCategory->getCategories();
$extras = new Extras();
$store_id = $extras->decryptQuery1(KEY_SALT, $_SERVER['QUERY_STRING']);
if ($store_id != null) {
    $store = $controller->getStoreByStoreId($store_id);
    if (isset($_POST['submit'])) {
        $itm = $store;
        $itm->store_name = htmlspecialchars(trim(strip_tags($_POST['store_name'])), ENT_QUOTES);
        $itm->store_address = htmlspecialchars(trim(strip_tags($_POST['store_address'])), ENT_QUOTES);
        $store_desc = preg_replace('~[\\r\\n]+~', '', $_POST['store_desc']);
        $itm->store_desc = htmlspecialchars(trim(strip_tags($store_desc)));
        $itm->lat = trim(strip_tags($_POST['lat']));
        $itm->lon = htmlspecialchars(trim(strip_tags($_POST['lon'])), ENT_QUOTES);
        $itm->created_at = time();
        $itm->website = $extras->removeHttp(htmlspecialchars(trim(strip_tags($_POST['website'])), ENT_QUOTES));
        $itm->phone_no = htmlspecialchars(trim(strip_tags($_POST['phone_no'])), ENT_QUOTES);
        $itm->email = trim(strip_tags($_POST['email']));
        $itm->sms_no = trim(strip_tags($_POST['sms_no']));
        $itm->category_id = trim(strip_tags($_POST['category_id']));
        $itm->updated_at = time();
        $itm->featured = trim(strip_tags($_POST['featured']));
        $controller->updateStore($itm);
        echo "<script type='text/javascript'>location.href='stores.php';</script>";
    }
} else {
    echo "<script type='text/javascript'>location.href='403.php';</script>";
Ejemplo n.º 4
0
<?php

require_once 'header.php';
$controller = new ControllerCategory();
$categories = $controller->getCategories();
if (!empty($_SERVER['QUERY_STRING'])) {
    $extras = new Extras();
    $category_id = $extras->decryptQuery1(KEY_SALT, $_SERVER['QUERY_STRING']);
    if ($category_id != null) {
        $controller->deleteCategory($category_id, 1);
        echo "<script type='text/javascript'>location.href='categories.php';</script>";
    }
    // else {
    //   echo "<script type='text/javascript'>location.href='403.php';</script>";
    // }
}
$begin = 0;
$page = 1;
$count = count($categories);
$pages = intval($count / Constants::NO_OF_ITEMS_PER_PAGE);
$search_criteria = "";
if (isset($_POST['button_search'])) {
    $search_criteria = trim(strip_tags($_POST['search']));
    $categories = $controller->getCategoriesBySearching($search_criteria);
} else {
    if ($count % Constants::NO_OF_ITEMS_PER_PAGE != 0) {
        $pages += 1;
    }
    if (!empty($_GET['page'])) {
        $page = $_GET['page'];
        $begin = ($page - 1) * Constants::NO_OF_ITEMS_PER_PAGE;