<?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 = Traffic::get_by_id($session->userid);
$objects_count = Traffic::get_by_sql("SELECT * FROM " . T_TRAFFICS);
$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'])) {
Example #2
0
<?php

require_once "header.php";
if (isset($_GET['id'])) {
    $object = Traffic::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>
Example #3
0
     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") {
                             Review::get_by_id($_GET['itemid'])->delete();
                         } else {
                             if ($_GET['itemtype'] == "featureditem") {
                                 FeaturedItem::get_by_id($_GET['itemid'])->delete();
                             } else {
                                 $message = "unknown parameter passed";
                             }
                         }
                     }
                 }
             }
         }
     }
    $object->userid = $_POST['userid'];
    $object->storeid = $_POST['storeid'];
    $object->status = $_POST['status'];
    $object->comment = $_POST['comment'];
    $object->pending = $_POST['pending'];
    $object->enabled = $_POST['enabled'];
    $object->create();
    $log = new Log($session->userid, $clientip, "WEB", "CREATED TRAFFIC: " . $_POST['id']);
    $log->create();
} else {
    if ($_POST['oper'] == 'edit') {
        $object = Traffic::get_by_id($_POST['id']);
        $object->userid = $_POST['userid'];
        $object->storeid = $_POST['storeid'];
        $object->status = $_POST['status'];
        $object->comment = $_POST['comment'];
        $object->pending = $_POST['pending'];
        $object->enabled = $_POST['enabled'];
        $object->update();
        $log = new Log($session->userid, $clientip, "WEB", "UPDATED TRAFFIC: " . $_POST['id']);
        $log->create();
    } else {
        if ($_POST['oper'] == 'del') {
            if ($_POST['id'] != $session->userid) {
                $log = new Log($session->userid, $clientip, "WEB", "DELETED TRAFFIC: " . $_POST['id']);
                $log->create();
                Traffic::get_by_id($_POST['id'])->delete();
            }
        }
    }
}
Example #5
0
<?php

require_once "../initialize.php";
$message = "";
if (isset($_POST['trafficid']) && $_POST['trafficid'] != "" && isset($_POST['status']) && $_POST['status'] != "" && isset($_POST['userid']) && $_POST['userid'] != "" && isset($_POST['storeid']) && $_POST['storeid'] != "") {
    $object = Traffic::get_by_id($_POST['trafficid']);
    $object->userid = $_POST['userid'];
    $object->storeid = $_POST['storeid'];
    $object->status = $_POST['status'];
    $object->longitude = $_POST['longitude'];
    $object->latitude = $_POST['latitude'];
    $object->comment = $_POST['comment'];
    $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 TRAFFIC: " . $object->id);
    $log->create();
    $message .= "success";
} else {
    $message = "You have missed a required field.";
}
echo $message;