예제 #1
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>";
예제 #2
0
function getCategories()
{
    $controllerCategory = new ControllerCategory();
    return $controllerCategory->getCategories();
}