function uploadFile($controller, $realestate_id)
{
    $extras = new Extras();
    $itm = new Photo();
    $itm->realestate_id = $realestate_id;
    $backUrl = $extras->encryptQuery1(KEY_SALT, 'realestate_id', $realestate_id, 'photo_realestate_view.php');
    $itm->created_at = time();
    $itm->updated_at = time();
    $desired_dir = IMAGE_UPLOAD_DIR;
    $errors = array();
    $count = count($_FILES["file"]["name"]);
    for ($key = 0; $key < $count; $key++) {
        $file_name = $_FILES['file']['name'][$key];
        $file_size = $_FILES['file']['size'][$key];
        $file_tmp = $_FILES['file']['tmp_name'][$key];
        $file_type = $_FILES['file']['type'][$key];
        if ($file_size > 2097152) {
            $errors[] = 'File size must be less than 2 MB';
        }
        $date = date_create();
        $timestamp = time();
        $temp = explode(".", $_FILES["file"]["name"][0]);
        $extension = end($temp);
        $new_file_name = $desired_dir . "/" . "large_" . $timestamp . "." . $extension;
        if ($key == 1) {
            $new_file_name = $desired_dir . "/" . "thumb_" . $timestamp . "." . $extension;
        }
        if (empty($errors) == true) {
            if (is_dir($desired_dir) == false) {
                // Create directory if it does not exist
                mkdir("{$desired_dir}", 0700);
            }
            if (is_dir($file_name) == false) {
                // rename the file if another one exist
                move_uploaded_file($file_tmp, $new_file_name);
            } else {
                $new_dir = $new_file_name . time();
                rename($file_tmp, $new_dir);
            }
            if ($key == 0) {
                $itm->photo_url = ROOT_URL . $new_file_name;
            }
            if ($key == 1) {
                $itm->thumb_url = ROOT_URL . $new_file_name;
            }
        } else {
            print_r($errors);
        }
    }
    $controller->insertPhoto($itm);
    echo "<script type='text/javascript'>location.href='{$backUrl}.php';</script>";
}
 function process($parameters)
 {
     $payments = new Payments();
     if (!$payments->checkLogin()) {
         $this->redirect('error');
     }
     //if empty parameter, add there current user
     if (isset($parameters[0])) {
         $userId = $parameters[0];
     } else {
         $userId = $_SESSION['id_user'];
     }
     if ($userId != $_SESSION['id_user'] && !$payments->checkIfIsAdminOfUser($_SESSION['id_user'], $userId)) {
         $this->redirect('error');
     }
     $data = $payments->getUserData($userId);
     //actualize old payments
     $resultMessages = $payments->actualizePayments($data['payments']);
     //create new payments
     $payments->makeNewPayments($data['user'], $data['tariff'], $this->language);
     $this->messages = array_merge($this->messages, $resultMessages);
     //get new data for user view
     $data = $payments->getUserData($userId);
     $data['payments'] = $payments->enhanceUserPayments($data['payments'], $this->language);
     $extras = new Extras();
     $this->data['blankExtras'] = $extras->getBlankExtras($userId);
     //display non-active user
     if (!$data['user']['active']) {
         $this->messages[] = ['s' => 'info', 'cs' => 'Neaktivní uživatel - nové faktury se negenerují', 'en' => 'Inactive user - new invoices are not generated'];
     }
     $this->data['admin'] = $payments->checkIfIsAdminOfUser($_SESSION['id_user'], $userId);
     $this->data['tariff'] = $data['tariff'];
     $this->data['user'] = $data['user'];
     $this->data['payments'] = $data['payments'];
     $this->header['title'] = ['cs' => 'Přehled plateb', 'en' => 'Payments overview'];
     //TODO add nice sliding JS invoice detail directly into view
     //TODO hide table in view when empty (no data)
     $this->view = 'payments';
 }
Exemple #3
0
        <table class="table">
          <thead>
              <tr>
                  <th>#</th>
                  <th>Name</th>
                  <th>Icon</th>
                  <th>Action</th>
              </tr>

          </thead>
          <tbody>
              <?php 
if ($categories != null) {
    $ind = $begin + 1;
    foreach ($categories as $category) {
        $extras = new Extras();
        $updateUrl = $extras->encryptQuery1(KEY_SALT, 'category_id', $category->category_id, 'category_update.php');
        $deleteUrl = $extras->encryptQuery1(KEY_SALT, 'category_id', $category->category_id, 'categories.php');
        echo "<tr>";
        echo "<td>{$ind}</td>";
        echo "<td>{$category->category}</td>";
        echo "<td><img src='{$category->category_icon}' width='40' height='40' /></td>";
        echo "<td>\n                                    <a class='btn btn-primary btn-xs' href=\"{$updateUrl}\"><span class='glyphicon glyphicon-pencil'></span></a>\n                                    <button class='btn btn-primary btn-xs' data-toggle='modal' data-target='#modal_{$category->category_id}'><span class='glyphicon glyphicon-remove'></span></button>\n                                </td>";
        echo "</tr>";
        echo "<div class='modal fade' id='modal_{$category->category_id}' tabindex='-1' role='dialog' aria-labelledby='myModalLabel' aria-hidden='true'>\n\n                                      <div class='modal-dialog'>\n                                          <div class='modal-content'>\n                                              <div class='modal-header'>\n                                                    <button type='button' class='close' data-dismiss='modal' aria-hidden='true'>&times;</button>\n                                                    <h4 class='modal-title' id='myModalLabel'>Deleting Category</h4>\n                                              </div>\n                                              <div class='modal-body'>\n                                                    <p>Deleting this is not irreversible. Do you wish to continue?\n                                              </div>\n                                              <div class='modal-footer'>\n                                                  <button type='button' class='btn btn-default' data-dismiss='modal'>Close</button>\n                                                  <a type='button' class='btn btn-primary' href='{$deleteUrl}'>Delete</a>\n                                              </div>\n                                          </div>\n                                      </div>\n                                </div>";
        ++$ind;
    }
}
?>

          </tbody>
<?php

require_once 'header.php';
$controller = new ControllerRealEstate();
$controllerAgent = new ControllerAgent();
$controllerPropertyType = new ControllerPropertyType();
$agents = $controllerAgent->getAgents();
$propertytypes = $controllerPropertyType->getPropertyTypes();
$extras = new Extras();
if (isset($_POST['submit'])) {
    $itm = new RealEstate();
    $itm->address = htmlspecialchars(trim(strip_tags($_POST['address'])), ENT_QUOTES);
    $itm->baths = htmlspecialchars(trim(strip_tags($_POST['baths'])), ENT_QUOTES);
    $itm->beds = trim(strip_tags($_POST['beds']));
    $itm->built_in = trim(strip_tags($_POST['built_in']));
    $itm->country = htmlspecialchars(trim(strip_tags($_POST['country'])), ENT_QUOTES);
    $itm->created_at = time();
    $itm->desc1 = $extras->removeHttp(htmlspecialchars(trim(strip_tags($_POST['desc1'])), ENT_QUOTES));
    $itm->featured = htmlspecialchars(trim(strip_tags($_POST['featured'])), ENT_QUOTES);
    $itm->lat = trim(strip_tags($_POST['lat']));
    $itm->lon = trim(strip_tags($_POST['lon']));
    $itm->lot_size = trim(strip_tags($_POST['lot_size']));
    $itm->price = htmlspecialchars(trim(strip_tags($_POST['price'])), ENT_QUOTES);
    $itm->price_per_sqft = htmlspecialchars(trim(strip_tags($_POST['price_per_sqft'])), ENT_QUOTES);
    $itm->property_type = trim(strip_tags($_POST['property_type']));
    $itm->rooms = trim(strip_tags($_POST['rooms']));
    $itm->sqft = trim(strip_tags($_POST['sqft']));
    $itm->status = trim(strip_tags($_POST['status']));
    $itm->updated_at = time();
    $itm->is_deleted = 0;
    $itm->agent_id = trim(strip_tags($_POST['agent_id']));
Exemple #5
0
function getParamsFromUser()
{
    $extras = new Extras();
    return $extras->decryptParams(KEY_SALT, $_SERVER['QUERY_STRING']);
}
<?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();
          <thead>
              <tr>
                  <th>#</th>
                  <th>Name</th>
                  <th>Registered Via:</th>
                  <th>Access Role</th>
                  
              </tr>

          </thead>
          <tbody>
              <?php 
if ($users != null) {
    $ind = 1;
    foreach ($users as $user) {
        $extras = new Extras();
        $featuredUrl = $extras->encryptQuery2(KEY_SALT, 'user_id', $user->user_id, 'user_id', $user->deny_access, 'users.php');
        echo "<tr>";
        echo "<td>{$ind}</td>";
        echo "<td>{$user->full_name}</td>";
        $registered_via = @"Web";
        if ($user->facebook_id > 0) {
            $registered_via = @"Facebook";
        }
        if ($user->twitter_id > 0) {
            $registered_via = @"Twitter";
        }
        echo "<td>{$registered_via}</td>";
        if ($user->deny_access == 1) {
            echo "<td><a href='{$featuredUrl}'>Allow</a></td>";
        } else {
<?php

require_once 'header.php';
$controller = new ControllerRealEstate();
$controllerAgent = new ControllerAgent();
$controllerPropertyType = new ControllerPropertyType();
$agents = $controllerAgent->getAgents();
$propertytypes = $controllerPropertyType->getPropertyTypes();
$extras = new Extras();
$realestate_id = $extras->decryptQuery1(KEY_SALT, $_SERVER['QUERY_STRING']);
if ($realestate_id != null) {
    $realestate = $controller->getRealEstateByRealEstateId($realestate_id);
    if (isset($_POST['submit'])) {
        $itm = $realestate;
        $itm->address = htmlspecialchars(trim(strip_tags($_POST['address'])), ENT_QUOTES);
        $itm->baths = htmlspecialchars(trim(strip_tags($_POST['baths'])), ENT_QUOTES);
        $itm->beds = trim(strip_tags($_POST['beds']));
        $itm->built_in = trim(strip_tags($_POST['built_in']));
        $itm->country = htmlspecialchars(trim(strip_tags($_POST['country'])), ENT_QUOTES);
        $itm->desc1 = $extras->removeHttp(htmlspecialchars(trim(strip_tags($_POST['desc1'])), ENT_QUOTES));
        $itm->featured = htmlspecialchars(trim(strip_tags($_POST['featured'])), ENT_QUOTES);
        $itm->lat = trim(strip_tags($_POST['lat']));
        $itm->lon = trim(strip_tags($_POST['lon']));
        $itm->lot_size = trim(strip_tags($_POST['lot_size']));
        $itm->price = htmlspecialchars(trim(strip_tags($_POST['price'])), ENT_QUOTES);
        $itm->price_per_sqft = htmlspecialchars(trim(strip_tags($_POST['price_per_sqft'])), ENT_QUOTES);
        $itm->property_type = trim(strip_tags($_POST['property_type']));
        $itm->rooms = trim(strip_tags($_POST['rooms']));
        $itm->sqft = trim(strip_tags($_POST['sqft']));
        $itm->status = trim(strip_tags($_POST['status']));
        $itm->updated_at = time();
          <thead>
              <tr>
                  <th>#</th>
                  <th>Name</th>
                  <th>Username</th>
                  <th>Access Role</th>
                  <th>Action</th>
              </tr>

          </thead>
          <tbody>
              <?php 
if ($users != null) {
    $ind = 1;
    foreach ($users as $user) {
        $extras = new Extras();
        $featuredUrl = $extras->encryptQuery2(KEY_SALT, 'authentication_id', $user->authentication_id, 'authentication_id', $user->deny_access, 'admin_access.php');
        $updateUrl = $extras->encryptQuery1(KEY_SALT, 'authentication_id', $user->authentication_id, 'access_user_update.php');
        $deleteUrl = $extras->encryptQuery1(KEY_SALT, 'authentication_id', $user->authentication_id, 'admin_access.php');
        $deleteUrl = $extras->encryptQuery2(KEY_SALT, 'authentication_id', $user->authentication_id, 'deleted', "deleted", 'admin_access.php');
        echo "<tr>";
        echo "<td>{$ind}</td>";
        echo "<td>{$user->name}</td>";
        echo "<td>{$user->username}</td>";
        if ($user->deny_access == 1) {
            echo "<td><a href='{$featuredUrl}'>Allow</a></td>";
        } else {
            echo "<td><a href='{$featuredUrl}'>Deny</a></td>";
        }
        echo "<td>\n                                    <a class='btn btn-primary btn-xs' href='{$updateUrl}'><span class='glyphicon glyphicon-pencil'></span></a>\n                                    <button  class='btn btn-primary btn-xs' data-toggle='modal' data-target='#modal_{$user->authentication_id}'><span class='glyphicon glyphicon-remove'></span></button>\n                                </td>";
        echo "</tr>";
                  <th>is Featured?</th>
                  <th>Action</th>
              </tr>

          </thead>
          <tbody>
              <?php 
if ($realestates != null) {
    $ind = 1;
    foreach ($realestates as $realestate) {
        $featured = "no";
        if ($realestate->featured == 1) {
            $featured = "yes";
        }
        $no_of_photos = $controllerPhoto->getNoOfPhotosByRealEstateId($realestate->realestate_id);
        $extras = new Extras();
        $updateUrl = $extras->encryptQuery1(KEY_SALT, 'realestate_id', $realestate->realestate_id, 'realestate_update.php');
        $deleteUrl = $extras->encryptQuery1(KEY_SALT, 'realestate_id', $realestate->realestate_id, 'realestates.php');
        $featuredUrl = $extras->encryptQuery2(KEY_SALT, 'realestate_id', $realestate->realestate_id, 'featured', $featured, 'realestates.php');
        $viewUrl = $extras->encryptQuery1(KEY_SALT, 'realestate_id', $realestate->realestate_id, 'photo_realestate_view.php');
        $photoUrl = $extras->encryptQuery1(KEY_SALT, 'realestate_id', $realestate->realestate_id, 'photo_realestate_insert.php');
        echo "<tr>";
        echo "<td>{$realestate->realestate_id}</td>";
        echo "<td>{$realestate->price}</td>";
        echo "<td>{$realestate->address}</td>";
        echo "<td>{$no_of_photos} Photo(s)</td>";
        if ($realestate->featured == 1) {
            echo "<td><a href='{$featuredUrl}'>No</a></td>";
        } else {
            echo "<td><a href='{$featuredUrl}'>Yes</a></td>";
        }
        <!-- Table -->
        <table class="table">
          <thead>
              <tr>
                  <th>#</th>
                  <th>Name</th>
                  <th>Action</th>
              </tr>

          </thead>
          <tbody>
              <?php 
if ($propertytypes != null) {
    $ind = 1;
    foreach ($propertytypes as $propertytype) {
        $extras = new Extras();
        $updateUrl = $extras->encryptQuery1(KEY_SALT, 'propertytype_id', $propertytype->propertytype_id, 'propertytype_update.php');
        $deleteUrl = $extras->encryptQuery1(KEY_SALT, 'propertytype_id', $propertytype->propertytype_id, 'propertytypes.php');
        echo "<tr>";
        echo "<td>{$ind}</td>";
        echo "<td>{$propertytype->property_type}</td>";
        echo "<td>\n                                    <a class='btn btn-primary btn-xs' href='{$updateUrl}'><span class='glyphicon glyphicon-pencil'></span></a>\n                                    <button class='btn btn-primary btn-xs' data-toggle='modal' data-target='#modal_{$propertytype->propertytype_id}'><span class='glyphicon glyphicon-remove'></span></button>\n                                </td>";
        echo "</tr>";
        echo "<div class='modal fade' id='modal_{$propertytype->propertytype_id}' tabindex='-1' role='dialog' aria-labelledby='myModalLabel' aria-hidden='true'>\n\n                                      <div class='modal-dialog'>\n                                          <div class='modal-content'>\n                                              <div class='modal-header'>\n                                                    <button type='button' class='close' data-dismiss='modal' aria-hidden='true'>&times;</button>\n                                                    <h4 class='modal-title' id='myModalLabel'>Deleting Property Type</h4>\n                                              </div>\n                                              <div class='modal-body'>\n                                                    <p>Deleting this is not irreversible. Do you wish to continue?\n                                              </div>\n                                              <div class='modal-footer'>\n                                                  <button type='button' class='btn btn-default' data-dismiss='modal'>Close</button>\n                                                  <a type='button' class='btn btn-primary' href='{$deleteUrl}'>Delete</a>\n                                              </div>\n                                          </div>\n                                      </div>\n                                </div>";
        ++$ind;
    }
}
?>

          </tbody>
          
<?php

require_once 'header.php';
$controller = new ControllerStore();
$controllerCategory = new ControllerCategory();
$categories = $controllerCategory->getCategories();
$extras = new Extras();
if (isset($_POST['submit'])) {
    $itm = new 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->insertStore($itm);
    echo "<script type='text/javascript'>location.href='stores.php';</script>";
}
?>


<!DOCTYPE html>
<html lang="en"><head>
<?php

require_once 'header.php';
$controller = new ControllerPropertyType();
$extras = new Extras();
$propertytype_id = $extras->decryptQuery1(KEY_SALT, $_SERVER['QUERY_STRING']);
if ($propertytype_id != null) {
    $propertytype = $controller->getPropertyTypeByPropertyTypeId($propertytype_id);
    if (isset($_POST['submit'])) {
        $propertytype_found = $controller->getPropertyTypeByPropertyType(trim($_POST['property_type']));
        if ($propertytype_found == null) {
            $itm = new PropertyType();
            $itm->property_type = htmlspecialchars(trim(strip_tags($_POST['property_type'])), ENT_QUOTES);
            $itm->created_at = time();
            $itm->updated_at = time();
            $itm->propertytype_id = $propertytype_id;
            $controller->updatePropertyType($itm);
            echo "<script type='text/javascript'>location.href='propertytypes.php';</script>";
        } else {
            echo "<script>alert('Cannot update because property type exist already.');</script>";
        }
    }
} else {
    echo "<script type='text/javascript'>location.href='403.php';</script>";
}
?>


<!DOCTYPE html>
<html lang="en"><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
 function process($parameters)
 {
     $extras = new Extras();
     $fakturoid = new FakturoidWrapper();
     $action = $extras->sanitize($parameters[0]);
     switch ($action) {
         case 'add':
             $paymentId = $extras->sanitize($_POST['paymentId']);
             $price = $extras->sanitize($_POST['price']);
             $description = $extras->sanitize($_POST['description']);
             $result = $extras->checkAddValues($paymentId, $price, $description);
             if ($result['s'] == 'success') {
                 $status = $extras->getStatusOfPayment($paymentId);
                 //allow add extra only when new payment will be generated
                 if (!in_array($status, ['unpaid', 'refund', 'timeout'])) {
                     $this->messages[] = ['s' => 'error', 'cs' => 'Bohužel, položka nebyla přidána; platba se právě platí nebo je již zaplacená', 'en' => 'Sorry, we cannot add an extra; payment is processing'];
                 } else {
                     $invoiceFakturoidId = $fakturoid->getFakturoidInvoiceIdFromPaymentId($paymentId);
                     $extraFakturoidId = $fakturoid->addExtra($invoiceFakturoidId, $price, $description);
                     $result = $extras->addExtra($paymentId, $price, $description, $extraFakturoidId);
                     $this->messages[] = $result;
                 }
             }
             $this->redirect('checkUsers');
             break;
         case 'addBlank':
             $userId = $extras->sanitize($_POST['userId']);
             $price = $extras->sanitize($_POST['price']);
             $description = $extras->sanitize($_POST['description']);
             $result = $extras->checkAddBlankValues($userId, $price, $description);
             if ($result['s'] == 'success') {
                 $this->messages[] = $extras->addBlankExtra($userId, $price, $description);
             } else {
                 $this->messages[] = $result;
             }
             $this->redirect('checkUsers');
             break;
         case 'delete':
             $extraId = $parameters[1];
             $status = $extras->getStatusOfPaymentFromExtraId($extraId);
             //allow add extra only when new payment will be generated or is blank
             if (!in_array($status, ['unpaid', 'refund', 'timeout', null])) {
                 $this->messages[] = ['s' => 'error', 'cs' => 'Bohužel, položka nebyla zrušena; platba se právě platí nebo je již zaplacená', 'en' => 'Sorry, we cannot cancel an extra; payment is processing'];
             } else {
                 $extraFakturoidId = $fakturoid->getExtraFakturoidId($extraId);
                 $invoiceFakturoidId = $fakturoid->getInvoiceFakturoidIdFromExtraId($extraId);
                 $fakturoid->deleteExtra($invoiceFakturoidId, $extraFakturoidId);
                 $result = $extras->deleteExtra($extraId);
                 $this->messages[] = $result;
             }
             $this->redirect('checkUsers');
             break;
         default:
             $this->redirect('error');
     }
 }
 public function insertar_info($user, $pass)
 {
     $pw = Extras::Encr($pass);
     //Nuestro password fue enviado a encriptar a la funcion de arriba
     $sql = Extras::Script_db("call nombre_de_nuestro_store_procedure");
     //Esto enviara a nuestro funcion estatica una llamada de store procedure
     $sql_2 = Extras::Script_db("SELECT*FROM name_dbase");
     //Un query normal para base de datos
     //Aqui llamaremos todos los archivos de la db
     while ($res = mysqli_fetch_array($sql)) {
         $this->name[] = $res;
         // se vaya almacenando en un array
     }
     return $this->name;
     // Enviamos los datos.
 }
Exemple #16
0
                  <th>Action</th>
              </tr>

          </thead>
          <tbody>
              <?php 
if ($stores != null) {
    $ind = $begin + 1;
    foreach ($stores as $store) {
        $featured = "no";
        if ($store->featured == 1) {
            $featured = "yes";
        }
        $no_of_photos = $controllerPhoto->getNoOfPhotosByStoreId($store->store_id);
        $rating = $controllerRating->getRatingByStoreId($store->store_id);
        $extras = new Extras();
        $updateUrl = $extras->encryptQuery1(KEY_SALT, 'store_id', $store->store_id, 'store_update.php');
        $deleteUrl = $extras->encryptQuery1(KEY_SALT, 'store_id', $store->store_id, 'stores.php');
        $featuredUrl = $extras->encryptQuery2(KEY_SALT, 'store_id', $store->store_id, 'featured', $featured, 'stores.php');
        $viewUrl = $extras->encryptQuery1(KEY_SALT, 'store_id', $store->store_id, 'photo_store_view.php');
        $photoUrl = $extras->encryptQuery1(KEY_SALT, 'store_id', $store->store_id, 'photo_store_insert.php');
        $reviewUrl = $extras->encryptQuery1(KEY_SALT, 'store_id', $store->store_id, 'store_reviews_view.php');
        echo "<tr>";
        echo "<td>{$ind}</td>";
        echo "<td>{$store->store_name}</td>";
        echo "<td>{$store->store_address}</td>";
        echo "<td>{$no_of_photos} Foto(s)</td>";
        echo "<td>{$rating}</td>";
        if ($store->featured == 1) {
            echo "<td><a href='{$featuredUrl}'>No</a></td>";
        } else {
Exemple #17
0
        <table class="table">
          <thead>
              <tr>
                  <th>#</th>
                  <th>Event</th>
                  <th>Date</th>
                  <th>Action</th>
              </tr>

          </thead>
          <tbody>
              <?php 
if ($news != null) {
    $ind = 1;
    foreach ($news as $m_news) {
        $extras = new Extras();
        $updateUrl = $extras->encryptQuery1(KEY_SALT, 'news_id', $m_news->news_id, 'news_update.php');
        $deleteUrl = $extras->encryptQuery1(KEY_SALT, 'news_id', $m_news->news_id, 'news.php');
        $datetime = date("M d, Y h:i", $m_news->created_at);
        echo "<tr>";
        echo "<td>{$ind}</td>";
        echo "<td>{$m_news->news_title}</td>";
        echo "<td>{$datetime}</td>";
        echo "<td>\n                                    <a class='btn btn-primary btn-xs' href='{$updateUrl}'><span class='glyphicon glyphicon-pencil'></span></a>\n                                    <button  class='btn btn-primary btn-xs' data-toggle='modal' data-target='#modal_{$m_news->news_id}'><span class='glyphicon glyphicon-remove'></span></button>\n                                    \n                                </td>";
        echo "</tr>";
        //<!-- Modal -->
        echo "<div class='modal fade' id='modal_{$m_news->news_id}' tabindex='-1' role='dialog' aria-labelledby='myModalLabel' aria-hidden='true'>\n\n                                      <div class='modal-dialog'>\n                                          <div class='modal-content'>\n                                              <div class='modal-header'>\n                                                    <button type='button' class='close' data-dismiss='modal' aria-hidden='true'>&times;</button>\n                                                    <h4 class='modal-title' id='myModalLabel'>Deleting News</h4>\n                                              </div>\n                                              <div class='modal-body'>\n                                                    <p>Deleting this is not irreversible. Do you wish to continue?\n                                              </div>\n                                              <div class='modal-footer'>\n                                                  <button type='button' class='btn btn-default' data-dismiss='modal'>Close</button>\n                                                  <a type='button' class='btn btn-primary' href='{$deleteUrl}'>Delete</a>\n                                              </div>\n                                          </div>\n                                      </div>\n                                </div>";
        ++$ind;
    }
}
?>
 /**
  * showTables
  *
  * @param mixed   $io Description.
  *
  * @access public
  *
  * @return mixed Value.
  */
 public function showTables($io = true)
 {
     $bdd = self::dbConnect();
     $sql = 'SHOW TABLES';
     $response = $bdd->prepare($sql);
     $response->execute();
     while ($row = $response->fetch()) {
         $tables[] = $row[0];
     }
     if ($io) {
         echo 'There is ' . Extras::pluralize("table", count($tables)) . ' into the ' . self::DATABASE . ' database:<br />' . implode('<br />', $tables) . '<br />';
     }
     return implode(', ', $tables);
 }
<?php

require_once 'header.php';
$controller = new ControllerAgent();
$controllerUser = new ControllerUser();
$users = $controllerUser->getUsers();
$extras = new Extras();
$agent_id = $extras->decryptQuery1(KEY_SALT, $_SERVER['QUERY_STRING']);
if ($agent_id != null) {
    $agent = $controller->getAgentByAgentId($agent_id);
    if (isset($_POST['submit'])) {
        $itm = new Agent();
        $itm->address = trim(strip_tags($_POST['address']));
        $itm->contact_no = trim(strip_tags($_POST['contact_no']));
        $itm->country = trim(strip_tags($_POST['country']));
        $itm->created_at = time();
        $itm->email = trim(strip_tags($_POST['email']));
        $itm->name = trim(strip_tags($_POST['name']));
        $itm->sms = trim(strip_tags($_POST['sms']));
        $itm->updated_at = time();
        $itm->zipcode = trim(strip_tags($_POST['zipcode']));
        $itm->photo_url = trim(strip_tags($_POST['photo_url']));
        $itm->thumb_url = trim(strip_tags($_POST['thumb_url']));
        $itm->twitter = trim(strip_tags($_POST['twitter']));
        $itm->fb = trim(strip_tags($_POST['fb']));
        $itm->linkedin = trim(strip_tags($_POST['linkedin']));
        $itm->company = trim(strip_tags($_POST['company']));
        $itm->user_id = trim(strip_tags($_POST['user_id']));
        $itm->agent_id = $agent_id;
        $count = count($_FILES["file"]["name"]);
        if (!empty($_FILES["file"]["name"][0]) && !empty($_FILES["file"]["name"][1])) {
echo "<a href='{$insertUrl}' class='btn btn-default btn-sm'><span class='glyphicon glyphicon-plus'></span></a>";
?>
                  
              </form>
          </div>
        </div>

        <div class="panel-body">
                  <div class="row">

                        <?php 
if ($photos_store != null) {
    $ind = 1;
    $count = count($photos_store);
    foreach ($photos_store as $photo_store) {
        $extras = new Extras();
        $updateUrl = $extras->encryptQuery1(KEY_SALT, 'photo_id', $photo_store->photo_id, 'photo_store_update.php');
        $deleteUrl = $extras->encryptQuery2(KEY_SALT, 'store_id', $photo_store->store_id, 'photo_id', $photo_store->photo_id, 'photo_store_view.php');
        echo "<div class='col-sm-6 col-md-4'>";
        echo "<div class='thumbnail'>";
        echo "<img src='{$photo_store->thumb_url}' alt='...' style = 'display:block; height:150px; margin-left:auto; margin-right:auto; max-width:100%;'>";
        echo "<div class='caption'>";
        echo "<p>";
        echo "<a href='{$updateUrl}' class='btn btn-primary btn-xs' role='button'>Edit</a> ";
        echo "<button  class='btn btn-primary btn-xs' data-toggle='modal' data-target='#modal_{$photo_store->photo_id}'>Large Image</button> ";
        echo "<button  class='btn btn-primary btn-xs' data-toggle='modal' data-target='#delete_modal_{$photo_store->photo_id}'>Delete</button>";
        echo "</p>";
        echo "</div>";
        echo "</div>";
        echo "</div>";
        //<!-- Modal -->
<?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>";
Exemple #22
0
    private function createPayment($user, $tariff, $beginningDate, $lang)
    {
        $userId = $user['id_user'];
        $tariffId = $tariff['id_tariff'];
        $tariffName = $this->getTariffName($tariffId, 'cs');
        //invoice is in czech only
        $priceCZK = $tariff['priceCZK'];
        $fakturoid = new FakturoidWrapper();
        $fakturoidInvoice = $fakturoid->createInvoice($user, $tariff['priceCZK'], $tariffName, $beginningDate, $lang);
        if (!$fakturoidInvoice) {
            return ['s' => 'error', 'cs' => 'Nepovedlo se spojení s fakturoid.cz. Zkuste to prosím za pár minut', 'en' => 'We are unable to connect to fakturoid.cz. Try again in a few minutes'];
        }
        $fakturoidInvoiceId = $fakturoidInvoice->id;
        $fakturoidInvoiceNumber = $fakturoidInvoice->number;
        $now = date('Y-m-d H-i-s');
        Db::queryModify('
			INSERT INTO `payments` (
				`id_payer`, 
				`payment_first_date`, 
				`status`, 
				`time_generated`, 
				`tariff_id`,
				`price_CZK`, 
				`invoice_fakturoid_id`, 
				`invoice_fakturoid_number`
		  	) VALUES (?, ?, ?, ?, ?, ?, ?, ?)', [$userId, date('Y-m-d', $beginningDate), 'unpaid', $now, $tariffId, $priceCZK, $fakturoidInvoiceId, $fakturoidInvoiceNumber]);
        //add blank extras
        $extras = new Extras();
        $blankExtras = $extras->getBlankExtras($user['id_user']);
        if (!empty($blankExtras)) {
            foreach ($blankExtras as $extra) {
                $extraId = $extra['id_extra'];
                $price = $extra['priceCZK'];
                $description = $extra['description'];
                $fakturoidExtraId = $fakturoid->addExtra($fakturoidInvoiceId, $extra['priceCZK'], $extra['description']);
                $paymentId = $this->getPaymentIdFromFakturoidInvoiceId($fakturoidInvoiceId);
                $extras->assignBlankExtra($paymentId, $price, $description, $fakturoidExtraId, $extraId);
            }
        }
        //send email to user
        $subject = NAME . ' Paralelní Polis - nová faktura';
        $link = ROOT . '/cs/payments';
        $message = 'Ahoj,<br/>
<br/>
vystavili jsem ti fakturu za členství / pronájem v Paper Hub v Paralelní Polis.<br/>
<a href="' . $link . '">' . $link . '</a><br/>
Platbu uhradíš jednoduše na odkazu výše.<br/> 
<br/>
Díky za rychlou platbu!<br/>
Paper Hub';
        $this->sendEmail(EMAIL, $user['email'], $subject, $message);
        //and send copy of email to hub manager
        //TODO refractor
        $this->sendEmail(EMAIL, EMAIL_HUB_MANAGER, NAME . ' - Poslána výzva o nové faktuře na email ' . $user['email'], $message);
        return ['s' => 'success'];
    }
Exemple #23
0
		            <!-- Table -->
		            <table class="table">
		                <thead>
		                    <tr>
		                        <th>#</th>
		                        <th>Category</th>
		                        <th>Action</th>
		                    </tr>
		                </thead>
			            <tbody>
			                <?php 
if ($arrayCategories != null) {
    $ind = 1;
    foreach ($arrayCategories as $category) {
        $extras = new Extras();
        $params = array();
        $params[0] = array('category_id', $category->category_id);
        $updateUrl = $extras->encryptParams(KEY_SALT, $params, 'category_update.php');
        $params = array();
        $params[0] = array('category_id', $category->category_id);
        $params[1] = array('action_delete', 1);
        $deleteUrl = $extras->encryptParams(KEY_SALT, $params, 'categories.php');
        echo "<tr>";
        echo "<td>{$ind}</td>";
        echo "<td>{$category->category}</td>";
        echo "<td>\n\t\t\t\t\t                            <a class='btn btn-primary btn-xs' href='{$updateUrl}'><span class='glyphicon glyphicon-pencil'></span></a>\n\t\t                                    \t<button class='btn btn-primary btn-xs' data-toggle='modal' data-target='#modal_{$category->category_id}'><span class='glyphicon glyphicon-remove'></span></button>\n\t\t\t                            \t</td>";
        echo "</tr>";
        ++$ind;
        echo "<div class='modal fade' id='modal_{$category->category_id}' tabindex='-1' role='dialog' aria-labelledby='myModalLabel' aria-hidden='true'>\n\t\t                                    \t<div class='modal-dialog'>\n\t\t                                          \t<div class='modal-content'>\n\t\t                                              \t<div class='modal-header'>\n\t\t                                                    <button type='button' class='close' data-dismiss='modal' aria-hidden='true'>&times;</button>\n\t\t                                                    <h4 class='modal-title' id='myModalLabel'>Deleting Category</h4>\n\t\t                                              \t</div>\n\t\t                                              \t<div class='modal-body'>\n\t\t                                                \t<p>Deleting this is not irreversible. Do you wish to continue?\n\t\t                                              \t</div>\n\t\t                                              \t<div class='modal-footer'>\n\t\t                                                \t<button type='button' class='btn btn-default' data-dismiss='modal'>Close</button>\n\t\t                                                \t<a type='button' class='btn btn-primary' href='{$deleteUrl}'>Delete</a>\n\t\t                                              \t</div>\n\t\t                                          \t</div>\n\t\t                                      </div>\n\t\t                                </div>";
    }
Exemple #24
0
		            <!-- Table -->
		            <table class="table">
		                <thead>
		                    <tr>
		                        <th>#</th>
		                        <th>Title</th>
		                        <th>Status</th>
		                        <th>Action</th>
		                    </tr>
		                </thead>
			            <tbody>
			                <?php 
if ($deals != null) {
    $ind = 1;
    foreach ($deals as $deal) {
        $extras = new Extras();
        $params = array();
        $params[0] = array('deal_id', $deal->deal_id);
        $updateUrl = $extras->encryptParams(KEY_SALT, $params, 'deal_update.php');
        $params = array();
        $params[0] = array('deal_id', $deal->deal_id);
        $params[1] = array('action_delete', 1);
        $deleteUrl = $extras->encryptParams(KEY_SALT, $params, 'approved_deals.php');
        $controllerDeal = new ControllerDeal();
        $isExpired = $controllerDeal->checkIfDealIsExpired($deal->deal_id);
        $val = "<span class='label label-danger'>Expired</span>";
        if (!$isExpired) {
            $val = "<span class='label label-success'>&nbsp;Active&nbsp;</span>";
        }
        echo "<tr>";
        echo "<td>{$ind}</td>";
	border-left: 5px solid <?php 
    esc_attr_e($options[$slug . '-border']);
    ?>
;
	border-right: 5px solid transparent;
	color: <?php 
    esc_attr_e($options[$slug . '-text']);
    ?>
;
	line-height: 1.4em;
	padding-left: 5px;
	padding-bottom: 2px;
}

<?php 
    Extras::add_map_display_css($slug);
    if ('1' === $options['color_widgets']) {
        ?>
	<?php 
        Widgets::add_widget_display_css($slug);
    }
    ?>
.tribe-events-category-<?php 
    echo $slug;
    ?>
 h2.tribe-events-list-event-title.entry-title a,
.tribe-events-category-<?php 
    echo $slug;
    ?>
 h2.tribe-events-list-event-title a
{
Exemple #26
0
            <table class="table">
                <thead>
                    <tr>
                        <th>#</th>
                        <th>Name</th>
                        <th>Registered Via:</th>
                        <th>Access Role</th>
                  
                    </tr>
                </thead>
                <tbody>
                    <?php 
if ($users != null) {
    $ind = 1;
    foreach ($users as $user) {
        $extras = new Extras();
        $params = array();
        $params[0] = array('user_id', $user->user_id);
        $params[1] = array('deny_access', $user->deny_access);
        $deleteUrl = $extras->encryptParams(KEY_SALT, $params, 'users.php');
        echo "<tr>";
        echo "<td>{$ind}</td>";
        echo "<td>{$user->full_name}</td>";
        $registered_via = @"----";
        if ($user->facebook_id > 0) {
            $registered_via = @"Facebook";
        }
        if ($user->twitter_id > 0) {
            $registered_via = @"Twitter";
        }
        if ($user->google_id > 0) {
              <tr>
                  <th>#</th>
                  <th>Name</th>
                  <th>Address</th>
                  <th>Contact No</th>
                  <th>Photos</th>
                  <th>Action</th>
              </tr>

          </thead>
          <tbody>
              <?php 
if ($agents != null) {
    $ind = 1;
    foreach ($agents as $agent) {
        $extras = new Extras();
        $updateUrl = $extras->encryptQuery1(KEY_SALT, 'agent_id', $agent->agent_id, 'agent_update.php');
        $deleteUrl = $extras->encryptQuery1(KEY_SALT, 'agent_id', $agent->agent_id, 'agents.php');
        echo "<tr>";
        echo "<td>{$ind}</td>";
        echo "<td>{$agent->name}</td>";
        echo "<td>{$agent->address}</td>";
        echo "<td>\n                                      <button class='btn btn-primary btn-xs' data-toggle='modal' data-target='#modal_photo_thumb_{$agent->agent_id}'>Thumb</button>\n                                      <button class='btn btn-primary btn-xs' data-toggle='modal' data-target='#modal_photo_large_{$agent->agent_id}'>Large</button>\n                                </td>";
        echo "<td>{$agent->contact_no}</td>";
        echo "<td>\n                                    <a class='btn btn-primary btn-xs' href=\"{$updateUrl}\"><span class='glyphicon glyphicon-pencil'></span></a>\n                                    <button class='btn btn-primary btn-xs' data-toggle='modal' data-target='#modal_{$agent->agent_id}'><span class='glyphicon glyphicon-remove'></span></button>\n                                </td>";
        echo "</tr>";
        echo "<div class='modal fade' id='modal_{$agent->agent_id}' tabindex='-1' role='dialog' aria-labelledby='myModalLabel' aria-hidden='true'>\n\n                                      <div class='modal-dialog'>\n                                          <div class='modal-content'>\n                                              <div class='modal-header'>\n                                                    <button type='button' class='close' data-dismiss='modal' aria-hidden='true'>&times;</button>\n                                                    <h4 class='modal-title' id='myModalLabel'>Deleting Agent</h4>\n                                              </div>\n                                              <div class='modal-body'>\n                                                    <p>Deleting this is not irreversible. Do you wish to continue?\n                                              </div>\n                                              <div class='modal-footer'>\n                                                  <button type='button' class='btn btn-default' data-dismiss='modal'>Close</button>\n                                                  <a type='button' class='btn btn-primary' href='{$deleteUrl}'>Delete</a>\n                                              </div>\n                                          </div>\n                                      </div>\n                                </div>";
        //<!-- Modal -->
        echo "<div class='modal fade' id='modal_photo_thumb_{$agent->agent_id}' tabindex='-1' role='dialog' aria-labelledby='myModalLabel' aria-hidden='true'>";
        echo "<div class='modal-dialog'>";
        echo "<div class='modal-content'>";
        <table class="table">
          <thead>
              <tr>
                  <th>#</th>
                  <th >Name</th>
                  <th width="50%">Comment</th>
                  <th>Action</th>
              </tr>

          </thead>
          <tbody>
              <?php 
if ($reviews != null) {
    $ind = 1;
    foreach ($reviews as $review) {
        $extras = new Extras();
        $deleteUrl = $extras->encryptQuery2(KEY_SALT, 'review_id', $review->store_id, 'photo_id', $review->review_id, 'store_reviews_view.php');
        $user = $controllerUser->getUserByUserId($review->user_id);
        echo "<tr>";
        echo "<td>{$ind}</td>";
        echo "<td>{$user->full_name}</td>";
        echo "<td>{$review->review}</td>";
        echo "<td>\n                                    <button  class='btn btn-primary btn-xs' data-toggle='modal' data-target='#modal_{$review->review_id}'><span class='glyphicon glyphicon-remove'></span></button>\n                                    \n                                </td>";
        echo "</tr>";
        //<!-- Modal -->
        echo "<div class='modal fade' id='modal_{$review->review_id}' tabindex='-1' role='dialog' aria-labelledby='myModalLabel' aria-hidden='true'>\n\n                                      <div class='modal-dialog'>\n                                          <div class='modal-content'>\n                                              <div class='modal-header'>\n                                                    <button type='button' class='close' data-dismiss='modal' aria-hidden='true'>&times;</button>\n                                                    <h4 class='modal-title' id='myModalLabel'>Deleting Review</h4>\n                                              </div>\n                                              <div class='modal-body'>\n                                                    <p>Deleting this is not irreversible. Do you wish to continue?\n                                              </div>\n                                              <div class='modal-footer'>\n                                                  <button type='button' class='btn btn-default' data-dismiss='modal'>Close</button>\n                                                  <a type='button' class='btn btn-primary' href='{$deleteUrl}'>Delete</a>\n                                              </div>\n                                          </div>\n                                      </div>\n                                </div>";
        ++$ind;
    }
}
?>
<?php

require_once 'header.php';
$controller = new ControllerAuthentication();
$extras = new Extras();
$authentication_id = $extras->decryptQuery1(KEY_SALT, $_SERVER['QUERY_STRING']);
$user = $controller->getAccessUserByAuthenticationId($authentication_id);
if ($authentication_id != null) {
    if (isset($_POST['submit'])) {
        $itm = new Authentication();
        $itm->authentication_id = $user->authentication_id;
        $itm->name = trim(strip_tags($_POST['name']));
        $itm->username = $user->username;
        $pass = trim(strip_tags($_POST['password']));
        $password_confirm = trim(strip_tags($_POST['password_confirm']));
        $password_current = trim(strip_tags($_POST['password_current']));
        $itm->password = md5($pass);
        if (strlen($pass) < 8) {
            echo "<script >alert('Password field must be atleast 8 alphanumeric characters.');</script>";
        } else {
            if ($user->password != md5($password_current)) {
                echo "<script >alert('Current password does not match.');</script>";
            } else {
                if ($pass != $password_confirm) {
                    echo "<script >alert('Password does not match.');</script>";
                } else {
                    $controller->updateAccessUser($itm);
                    echo "<script type='text/javascript'>location.href='admin_access.php';</script>";
                }
            }
        }
echo "<a href='{$insertUrl}' class='btn btn-default btn-sm'><span class='glyphicon glyphicon-plus'></span></a>";
?>
                  
              </form>
          </div>
        </div>

        <div class="panel-body">
                  <div class="row">

                        <?php 
if ($photos_realestate != null) {
    $ind = 1;
    $count = count($photos_realestate);
    foreach ($photos_realestate as $photo_realestate) {
        $extras = new Extras();
        $updateUrl = $extras->encryptQuery1(KEY_SALT, 'photo_id', $photo_realestate->photo_id, 'photo_realestate_update.php');
        $deleteUrl = $extras->encryptQuery2(KEY_SALT, 'realestate_id', $photo_realestate->realestate_id, 'photo_id', $photo_realestate->photo_id, 'photo_realestate_view.php');
        echo "<div class='col-sm-6 col-md-4'>";
        echo "<div class='thumbnail'>";
        echo "<img src='{$photo_realestate->thumb_url}' alt='...' style = 'display:block; height:150px; margin-left:auto; margin-right:auto; max-width:100%;'>";
        echo "<div class='caption'>";
        echo "<p>";
        echo "<a href='{$updateUrl}' class='btn btn-primary btn-xs' role='button'>Edit</a> ";
        echo "<button  class='btn btn-primary btn-xs' data-toggle='modal' data-target='#modal_{$photo_realestate->photo_id}'>Large Photo</button> ";
        echo "<button  class='btn btn-primary btn-xs' data-toggle='modal' data-target='#delete_modal_{$photo_realestate->photo_id}'>Delete</button>";
        echo "</p>";
        echo "</div>";
        echo "</div>";
        echo "</div>";
        //<!-- Modal -->