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>";
}
예제 #2
0
                  <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'>";
        echo "<div class='modal-header'>";
예제 #3
0
require_once 'header.php';
$controller = new ControllerStore();
$controllerReview = new ControllerReview();
$controllerUser = new ControllerUser();
if (!empty($_SERVER['QUERY_STRING'])) {
    $extras = new Extras();
    $store_id = $extras->decryptQuery1(KEY_SALT, $_SERVER['QUERY_STRING']);
    $review_delete = $extras->decryptQuery2(KEY_SALT, $_SERVER['QUERY_STRING']);
    $reviews = $controllerReview->getReviewsByStoreId($store_id);
    $store = $controller->getStoreByStoreId($store_id);
    if ($review_delete != null) {
        $store_id = $review_delete[0];
        $review_id = $review_delete[1];
        $controllerReview->deleteReview($review_id, 1);
        $viewUrl = $extras->encryptQuery1(KEY_SALT, 'store_id', $store_id, 'store_reviews_view.php');
        echo "<script type='text/javascript'>location.href='{$viewUrl}';</script>";
    }
    if ($store_id == null) {
        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">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
예제 #4
0
          <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;
    }
}
?>
예제 #5
0
              </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 {
            echo "<td><a href='{$featuredUrl}'>Yes</a></td>";
예제 #6
0
?>
                  
              </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 -->
        echo "<div class='modal fade' id='modal_{$photo_store->photo_id}' tabindex='-1' role='dialog' aria-labelledby='myModalLabel' aria-hidden='true'>";
                  <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>";
        //<!-- Modal -->
        echo "<div class='modal fade' id='modal_{$user->authentication_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 User</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>";
                  <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>";
        }
        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_{$realestate->realestate_id}'><span class='glyphicon glyphicon-remove'></span></button>\n                                    <a class='btn btn-primary btn-xs' href='{$viewUrl}'><span class='glyphicon glyphicon-th'></span></a>\n                                    \n                                </td>";
        <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>
          
        </table>
예제 #10
0
          <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>
          
?>
                  
              </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 -->
        echo "<div class='modal fade' id='modal_{$photo_realestate->photo_id}' tabindex='-1' role='dialog' aria-labelledby='myModalLabel' aria-hidden='true'>";