示例#1
0
             $html .= "</tr>";
         }
         echo $html;
     } else {
         echo "no data";
     }
 } else {
     if ($_GET['itemtype'] == "featureditem") {
         $items = FeaturedItem::get_all();
         if (count($items) > 0) {
             foreach ($items as $item) {
                 $theitem = new Product();
                 $thedesc = "";
                 $thepicture = "";
                 if ($item->itemtype == "store") {
                     $theitem = Store::get_by_id($item->itemid);
                     $thedesc = $theitem->branchname;
                 } else {
                     if ($item->itemtype == "product") {
                         $theitem = Product::get_by_id($item->itemid);
                         $thedesc = $theitem->description;
                     }
                 }
                 if ($item->override == 1) {
                     $thepicture = $item->picture;
                 } else {
                     $thepicture = $theitem->picture;
                 }
                 $filename++;
                 $random = rand(0, 1);
                 file_put_contents("images/" . $filename . "x" . $random . ".jpg", base64_decode($thepicture));
示例#2
0
<?php

require_once "header.php";
if (isset($_GET['id'])) {
    $object = Store::get_by_id($_GET['id']);
} else {
    header("location: index.php?negative");
}
if (!$session->is_logged_in()) {
    header("location: index.php?negative");
} else {
    $loggeduser = User::get_by_id($session->userid);
    if ($loggeduser->enabled == DISABLED) {
        header("location: index.php?disabled");
    }
}
$pathinfo = pathinfo($_SERVER["PHP_SELF"]);
$basename = $pathinfo["basename"];
$currentFile = str_replace(".php", "", $basename);
?>

<div class="container-fluid">
<div class="row-fluid">
  <div class="span1"></div>
  <div class="span9">
    <form id="theform" class="form-horizontal" action="#" method="post" enctype="multipart/form-data">
      <fieldset>
      <legend>
        Update
      </legend>
    $object->storetypeid = $_POST['storetypeid'];
    $object->pending = $_POST['pending'];
    $object->enabled = $_POST['enabled'];
    $object->create();
    $log = new Log($session->userid, $clientip, "WEB", "CREATED USER: "******"WEB", "UPDATED STORE: " . $_POST['id']);
        $log->create();
    } else {
        if ($_POST['oper'] == 'del') {
            if ($_POST['id'] != $session->userid) {
                $log = new Log($session->userid, $clientip, "WEB", "DELETED STORE: " . $_POST['id']);
                $log->create();
                Store::get_by_id($_POST['id'])->delete();
            }
        }
    }
}
}
if (isset($_GET['sortby']) && isset($_GET['sortorder'])) {
    $sort = " ORDER BY " . $_GET['sortby'] . " " . $_GET['sortorder'] . " ";
}
if (isset($_GET['sortby']) && !isset($_GET['sortorder'])) {
    $sort = " ORDER BY " . $_GET['sortby'] . $sortorder . " ";
}
//======================================================
$sql = "SELECT * FROM " . T_FEATUREDITEMS . " WHERE " . $where . $sort . $limit;
//echo $sql."<br />";
$items = FeaturedItem::get_by_sql($sql);
$filename = 0;
$stores = array();
if (!isset($_GET['blob'])) {
    foreach ($items as $item) {
        $store = Store::get_by_id($item->itemid);
        if ($item->override == 1) {
            $store->picture = $item->picture;
        }
        $filename++;
        $random = rand(0, 1);
        file_put_contents("images/" . $filename . "xx" . $random . ".jpg", base64_decode($store->picture));
        $store->picture = HOST . "includes/webservices/images/" . $filename . "x" . $random . ".jpg";
        array_push($stores, $store);
        // if($item->override == 1)
        // {
        // 	if($item->itemtype == "store")
        // 	{
        // 		$item->picture = Store::get_by_id($item->itemid)->picture;
        // 	}
        // 	else if($item->itemtype == "product")
示例#5
0
<?php

require_once "../initialize.php";
$message = "";
if (isset($_POST['name']) && $_POST['name'] != "" && isset($_POST['address']) && $_POST['address'] != "" && isset($_POST['storeid']) && $_POST['storeid'] != "") {
    $object = Store::get_by_id($_POST['storeid']);
    $object->name = $_POST['name'];
    $object->branchname = $_POST['branchname'];
    $object->address = $_POST['address'];
    $object->longitude = $_POST['longitude'];
    $object->latitude = $_POST['latitude'];
    $object->telnum = $_POST['telnum'];
    $object->deliverynum = $_POST['deliverynum'];
    $object->email = $_POST['email'];
    $object->storetypeid = $_POST['storetypeid'];
    $object->facebookid = $_POST['facebookid'];
    $object->twitterid = $_POST['twitterid'];
    $object->pending = $_POST['pending'];
    $object->enabled = $_POST['enabled'];
    $file = new File($_FILES['picture']);
    if ($file->valid) {
        $object->picture = $file->data;
    } else {
        $object->picture = base64_decode($object->picture);
    }
    $object->update();
    $log = new Log($session->userid, $clientip, "WEB", "UPDATED STORE: " . $object->id);
    $log->create();
    $message .= "success";
} else {
    $message = "You have missed a required field.";
示例#6
0
<?php

require_once "../../includes/initialize.php";
global $session;
if (!$session->is_logged_in()) {
    redirect_to("../../index.php");
}
$page = $_GET['page'];
$limit = $_GET['rows'];
$sidx = $_GET['sidx'];
$sord = $_GET['sord'];
$object = Store::get_by_id($session->userid);
$objects_count = Store::get_by_sql("SELECT * FROM " . T_STORES);
$count = count($objects_count);
if ($count > 0 && $limit > 0) {
    $total_pages = ceil($count / $limit);
} else {
    $total_pages = 0;
}
if ($page > $total_pages) {
    $page = $total_pages;
}
$start = $limit * $page - $limit;
if ($start < 0) {
    $start = 0;
}
if (!$sidx) {
    $sidx = 1;
}
$ops = array('eq' => '=', 'ne' => '<>', 'lt' => '<', 'le' => '<=', 'gt' => '>', 'ge' => '>=', 'bw' => 'LIKE', 'bn' => 'NOT LIKE', 'in' => 'LIKE', 'ni' => 'NOT LIKE', 'ew' => 'LIKE', 'en' => 'NOT LIKE', 'cn' => 'LIKE', 'nc' => 'NOT LIKE');
if (isset($_GET['searchString']) && isset($_GET['searchField']) && isset($_GET['searchOper'])) {
示例#7
0
<?php

require_once "../initialize.php";
$message = "";
if (isset($_GET['itemid']) && isset($_GET['itemtype'])) {
    $message = "success";
    if ($_GET['itemtype'] == "user") {
        User::get_by_id($_GET['itemid'])->delete();
    } else {
        if ($_GET['itemtype'] == "store") {
            Store::get_by_id($_GET['itemid'])->delete();
        } else {
            if ($_GET['itemtype'] == "storetype") {
                StoreType::get_by_id($_GET['itemid'])->delete();
            } else {
                if ($_GET['itemtype'] == "storepic") {
                    StorePic::get_by_id($_GET['itemid'])->delete();
                } else {
                    if ($_GET['itemtype'] == "product") {
                        Product::get_by_id($_GET['itemid'])->delete();
                    } else {
                        if ($_GET['itemtype'] == "producttype") {
                            ProductType::get_by_id($_GET['itemid'])->delete();
                        } else {
                            if ($_GET['itemtype'] == "productpic") {
                                ProductPic::get_by_id($_GET['itemid'])->delete();
                            } else {
                                if ($_GET['itemtype'] == "traffic") {
                                    Traffic::get_by_id($_GET['itemid'])->delete();
                                } else {
                                    if ($_GET['itemtype'] == "review") {