Esempio n. 1
0
}
if (isset($_GET['enabled'])) {
    $where .= " AND " . C_STORETYPE_ENABLED . equallike($_GET['enabled'], "int");
}
//======================================================
if (isset($_GET['limit'])) {
    $limit = " LIMIT " . $_GET['limit'] . " ";
}
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 . " ";
}
//======================================================
$items = StoreType::get_by_sql("SELECT * FROM " . T_STORETYPES . " WHERE " . $where . $sort . $limit);
$filename = 0;
if (!isset($_GET['blob'])) {
    foreach ($items as $item) {
        $filename++;
        $random = rand(0, 1);
        file_put_contents("images/" . $filename . "x" . $random . ".jpg", base64_decode($item->picture));
        $item->picture = HOST . "includes/webservices/images/" . $filename . "x" . $random . ".jpg";
    }
}
echo str_replace('\\/', '/', json_encode($items));
//echo json_encode($items, JSON_UNESCAPED_SLASHES);
function equallike($field, $type)
{
    $string = "";
    if ($type == "string") {
Esempio n. 2
0
        <div class="control-group">
          <label class="control-label" for="deliverynum">Delivery #</label>
          <div class="controls">
            <input value="<?php 
echo $object->deliverynum;
?>
" id="deliverynum" name="deliverynum" type="text" placeholder="delivery #" class="input-xlarge">
          </div>
        </div>

        <div class="control-group">
          <label class="control-label" for="name">* Store Type</label>
          <div class="controls">
            <select name="storetypeid" id="storetypeid">
              <?php 
$storetypes = StoreType::get_all();
if (count($storetypes) > 0) {
    foreach ($storetypes as $storetype) {
        echo "<option " . ($object->storetypeid == $storetype->id ? "selected" : "") . " value='" . $storetype->id . "'>" . $storetype->name . "</option>";
    }
} else {
    echo "<option value='0'>no store types yet</option>";
}
?>
            </select>
          </div>
        </div>

        <div class="control-group">
          <label class="control-label" for="facebookid">Facebook ID</label>
          <div class="controls">
Esempio n. 3
0
             $html .= "<tr>";
             $html .= "  <td><img src='" . $item->picture . "' height='40' width='40'/></td>";
             $html .= "  <td>" . $item->name . "</td>";
             $html .= "  <td>" . $item->branchname . "</td>";
             $html .= "  <td><a class='btn btn-primary' href='updatestore.php?id=" . $item->id . "'>Update</a></td>";
             $html .= "  <td><button class='btn btn-danger btndelete'>Delete <span hidden>" . $item->id . "</span></button></td>";
             $html .= "</tr>";
         }
         $filename = 0;
         echo $html;
     } else {
         echo "no data";
     }
 } else {
     if ($_GET['itemtype'] == "storetype") {
         $items = StoreType::search($input);
         if (count($items) > 0) {
             foreach ($items as $item) {
                 $filename++;
                 $random = rand(0, 1);
                 file_put_contents("images/" . $filename . "x" . $random . ".jpg", base64_decode($item->picture));
                 $item->picture = HOST . "includes/webservices/images/" . $filename . "x" . $random . ".jpg";
                 $html .= "<tr>";
                 $html .= "  <td><img src='" . $item->picture . "' height='40' width='40'/></td>";
                 $html .= "  <td>" . $item->name . "</td>";
                 $html .= "  <td><a class='btn btn-primary' href='updatestoretype.php?id=" . $item->id . "'>Update</a></td>";
                 $html .= "  <td><button class='btn btn-danger btndelete'>Delete <span hidden>" . $item->id . "</span></button></td>";
                 $html .= "</tr>";
             }
             $filename = 0;
             echo $html;
Esempio n. 4
0
<?php

require_once "../initialize.php";
$message = "";
if (isset($_POST['name']) && $_POST['name'] != "" && isset($_POST['storetypeid']) && $_POST['storetypeid'] != "") {
    $object = StoreType::get_by_id($_POST['storetypeid']);
    $object->name = $_POST['name'];
    $object->description = $_POST['description'];
    $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 TYPE: " . $object->id);
    $log->create();
    $message .= "success";
} else {
    $message = "You have missed a required field.";
}
echo $message;
Esempio n. 5
0
<?php

require_once "../initialize.php";
$message = "";
if (isset($_POST['name']) && $_POST['name'] != "") {
    $storetype = new StoreType();
    $storetype->name = $_POST['name'];
    $storetype->description = $_POST['description'];
    $storetype->pending = $_POST['pending'];
    $storetype->enabled = $_POST['enabled'];
    if (isset($_FILES['picture'])) {
        $file = new File($_FILES['picture']);
        $storetype->picture = $file->data;
    }
    $storetype->create();
    $log = new Log($session->userid, $clientip, "WEB", "CREATED STORE TYPE: " . $storetype->id);
    $log->create();
    $message .= "success";
} else {
    $message = "You have missed a required field.";
}
echo $message;
Esempio n. 6
0
<?php

require_once "header.php";
if (isset($_GET['id'])) {
    $object = StoreType::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>
Esempio n. 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") {