Edit file File name : function.php Content :<?php function addSliderImage($post, $file) { $title = $_POST['title']; $url = $_POST['url']; $dir_dest = '../images/slider/'; $handle = new Upload($file['image']); $imgName = null; if ($handle->uploaded) { $handle->image_resize = true; $handle->file_new_name_ext = 'jpg'; $handle->image_ratio_crop = 'C'; $handle->image_x = 1920; $handle->image_y = 800; $handle->Process($dir_dest); if ($handle->processed) { $info = getimagesize($handle->file_dst_pathname); $imgName = $handle->file_dst_name; } } $db = new DB(); $query = "INSERT INTO `slider` (title, url, image_name) VALUES ('" . mysql_real_escape_string($title) . "', '" . mysql_real_escape_string($url) . "', '" . mysql_real_escape_string($imgName) . "')"; $result = $db->readQuery($query); return $result; } function getMainSlider() { $db = new DB(); $sql = "SELECT * FROM `slider` ORDER BY sort ASC"; $result = $db->readQuery($sql); $array_res = array(); while ($row = mysql_fetch_array($result)) { $property = array( 'id' => $row['id'], 'title' => $row['title'], 'url' => $row['url'], 'image_name' => $row['image_name'], 'sort' => $row['sort'], ); array_push($array_res, $property); } return $array_res; } function getSliderImageById($id) { $query = "SELECT * FROM `slider` WHERE `id` = '$id' LIMIT 1"; $db = new DB(); $result = $db->readQuery($query); $row = mysql_fetch_assoc($result); return $row; } function editSliderImageById($post, $file, $id, $imageold) { $dir_dest = '../images/slider/'; $handle = new Upload($file['image']); $imgName = null; if ($handle->uploaded) { $handle->image_resize = true; $handle->file_new_name_body = TRUE; $handle->file_overwrite = TRUE; $handle->file_new_name_ext = FALSE; $handle->image_ratio_crop = 'C'; $handle->file_new_name_body = $imageold; $handle->image_x = 1920; $handle->image_y = 800; $handle->Process($dir_dest); if ($handle->processed) { $info = getimagesize($handle->file_dst_pathname); $imgName = $handle->file_dst_name; } } $db = new DB(); $sql = "UPDATE `slider` SET " . "`title` = '" . mysql_real_escape_string($_POST['title']) . "'," . " `url` = '" . mysql_real_escape_string($_POST['url']) . "' " . "WHERE `id` = '$id' "; $result = $db->readQuery($sql); return $result; } function getWelcomeNote() { $query = "SELECT * FROM `welcome-note` WHERE `id` = '1' LIMIT 1"; $db = new DB(); $result = $db->readQuery($query); $row = mysql_fetch_assoc($result); return $row; } function updateWelcomeNote($post) { $db = new DB(); $sql = "UPDATE `welcome-note` SET " . "`title` = '" . mysql_real_escape_string($_POST['title']) . "'," . "`url` = '" . mysql_real_escape_string($_POST['url']) . "'," . "`description` = '" . mysql_real_escape_string($_POST['description']) . "'" . "WHERE `id` = 1 "; $result = $db->readQuery($sql); return $result; } function addServices($post, $file) { $title = $_POST['title']; $shortDescription = $_POST['shortDescription']; $description = $_POST['description']; $dir_dest = '../images/services/'; $dir_dest_thumb = '../images/services/thumb/'; $handle = new Upload($file['image']); $imgName = null; if ($handle->uploaded) { $handle->image_resize = true; $handle->file_new_name_ext = 'jpg'; $handle->image_ratio_crop = 'C'; $handle->image_x = 900; $handle->image_y = 600; $handle->Process($dir_dest); if ($handle->processed) { $info = getimagesize($handle->file_dst_pathname); $imgName = $handle->file_dst_name; } $handle->image_resize = true; $handle->file_new_name_ext = 'jpg'; $handle->image_ratio_crop = 'C'; $handle->image_x = 300; $handle->image_y = 200; $handle->Process($dir_dest_thumb); if ($handle->processed) { $info = getimagesize($handle->file_dst_pathname); } } $db = new DB(); $query = "INSERT INTO `services` (title, shortDescription, description, image_name) VALUES ('" . mysql_real_escape_string($title) . "', '" . mysql_real_escape_string($shortDescription) . "', '" . mysql_real_escape_string($description) . "', '" . mysql_real_escape_string($imgName) . "')"; $result = $db->readQuery($query); return $result; } function getServices() { $db = new DB(); $sql = "SELECT * FROM `services` ORDER BY sort ASC"; $result = $db->readQuery($sql); $array_res = array(); while ($row = mysql_fetch_array($result)) { $property = array( 'id' => $row['id'], 'title' => $row['title'], 'shortDescription' => $row['shortDescription'], 'description' => $row['description'], 'image_name' => $row['image_name'], 'sort' => $row['sort'], ); array_push($array_res, $property); } return $array_res; } function getServicesById($id) { $query = "SELECT * FROM `services` WHERE `id` = '$id'"; $db = new DB(); $result = $db->readQuery($query); $row = mysql_fetch_assoc($result); return $row; } function editServicesById($post, $file, $id, $imageold) { $dir_dest = '../images/services/'; $dir_dest_thumb = '../images/services/thumb/'; $handle = new Upload($file['image']); $imgName = null; if ($handle->uploaded) { $handle->image_resize = true; $handle->file_new_name_body = TRUE; $handle->file_overwrite = TRUE; $handle->file_new_name_ext = FALSE; $handle->image_ratio_crop = 'C'; $handle->file_new_name_body = $imageold; $handle->image_x = 900; $handle->image_y = 600; $handle->Process($dir_dest); if ($handle->processed) { $info = getimagesize($handle->file_dst_pathname); $imgName = $handle->file_dst_name; } $handle->image_resize = true; $handle->file_new_name_body = TRUE; $handle->file_overwrite = TRUE; $handle->file_new_name_ext = FALSE; $handle->image_ratio_crop = 'C'; $handle->file_new_name_body = $imageold; $handle->image_x = 300; $handle->image_y = 200; $handle->Process($dir_dest_thumb); if ($handle->processed) { $info = getimagesize($handle->file_dst_pathname); $imgName = $handle->file_dst_name; } } $db = new DB(); $sql = "UPDATE `services` SET " . "`title` = '" . mysql_real_escape_string($_POST['title']) . "'," . " `description` = '" . mysql_real_escape_string($_POST['description']) . "'," . " `shortDescription` = '" . mysql_real_escape_string($_POST['shortDescription']) . "' " . "WHERE `id` = '$id' "; $result = $db->readQuery($sql); return $result; } function addServicePhoto($post, $file, $serviceId) { $caption = $_POST['caption']; $dir_dest = '../images/services/gallery/'; $dir_dest_thumb = '../images/services/gallery/thumb/'; $handle = new Upload($file['image']); $imgName = null; if ($handle->uploaded) { $handle->image_resize = true; $handle->file_new_name_ext = 'jpg'; $handle->image_ratio_crop = 'C'; $handle->image_x = 900; $handle->image_y = 350; $handle->image_text = ""; $handle->image_text_background = '#000000'; $handle->image_text_background_opacity = 50; $handle->image_text_padding = 10; $handle->image_text_x = -15; $handle->image_text_y = -15; $handle->image_text_line_spacing = 10; $handle->Process($dir_dest); if ($handle->processed) { $info = getimagesize($handle->file_dst_pathname); $imgName = $handle->file_dst_name; } $handle->image_resize = true; $handle->file_new_name_ext = 'jpg'; $handle->image_ratio_crop = 'C'; $handle->image_x = 300; $handle->image_y = 175; $handle->Process($dir_dest_thumb); if ($handle->processed) { $info = getimagesize($handle->file_dst_pathname); } } $db = new DB(); $query = "INSERT INTO `service-photos` (service_id, caption, image_name) VALUES ('" . mysql_real_escape_string($serviceId) . "', '" . mysql_real_escape_string($caption) . "', '" . mysql_real_escape_string($imgName) . "')"; $result = $db->readQuery($query); return $result; } function getServicePhotosByServiceId($serviceId) { $db = new DB(); $sql = "SELECT * FROM `service-photos` WHERE `service_id` = '$serviceId' ORDER BY sort ASC"; $result = $db->readQuery($sql); $array_res = array(); while ($row = mysql_fetch_array($result)) { $property = array( 'id' => $row['id'], 'service_id' => $row['service_id'], 'caption' => $row['caption'], 'image_name' => $row['image_name'], 'sort' => $row['sort'], ); array_push($array_res, $property); } return $array_res; } function getServicesPhotosById($id) { $db = new DB(); $sql = "SELECT * FROM `service-photos` WHERE `service_id` = '$id' ORDER BY sort ASC"; $result = $db->readQuery($sql); $array_res = array(); while ($row = mysql_fetch_array($result)) { $property = array( 'id' => $row['id'], 'service_id' => $row['service_id'], 'caption' => $row['caption'], 'image_name' => $row['image_name'], 'sort' => $row['sort'], ); array_push($array_res, $property); } return $array_res; } function getServicesPhotoById($id) { $sql = "SELECT * FROM `service-photos` WHERE `id` = '$id'"; $db = new DB(); $result = $db->readQuery($sql); $row = mysql_fetch_assoc($result); return $row; } function editServicesPhotoById($post, $file, $id, $imageold) { $dir_dest = '../images/services/gallery/'; $dir_dest_thumb = '../images/services/gallery/thumb/'; $handle = new Upload($file['image']); $imgName = null; if ($handle->uploaded) { $handle->image_resize = true; $handle->file_new_name_body = TRUE; $handle->file_overwrite = TRUE; $handle->file_new_name_ext = FALSE; $handle->image_ratio_crop = 'C'; $handle->file_new_name_body = $imageold; $handle->image_x = 900; $handle->image_y = 350; $handle->image_text = ""; $handle->image_text_background = '#000000'; $handle->image_text_background_opacity = 50; $handle->image_text_padding = 10; $handle->image_text_x = -15; $handle->image_text_y = -15; $handle->image_text_line_spacing = 10; $handle->Process($dir_dest); if ($handle->processed) { $info = getimagesize($handle->file_dst_pathname); $imgName = $handle->file_dst_name; } $handle->image_resize = true; $handle->file_new_name_body = TRUE; $handle->file_overwrite = TRUE; $handle->file_new_name_ext = FALSE; $handle->image_ratio_crop = 'C'; $handle->file_new_name_body = $imageold; $handle->image_x = 300; $handle->image_y = 175; $handle->Process($dir_dest_thumb); if ($handle->processed) { $info = getimagesize($handle->file_dst_pathname); $imgName = $handle->file_dst_name; } } $db = new DB(); $sql = "UPDATE `service-photos` SET " . "`caption` = '" . mysql_real_escape_string($_POST['caption']) . "'" . "WHERE `id` = '$id' "; $result = $db->readQuery($sql); return $result; } function addImageGallery($post, $file) { $dir_dest = '../images/gallery/'; $dir_dest_thumb = '../images/gallery/thumb/'; $handle = new Upload($file['image']); $imgName = null; if ($handle->uploaded) { $handle->image_resize = true; $handle->file_new_name_ext = 'jpg'; $handle->image_ratio_crop = 'C'; $handle->image_x = 900; $handle->image_y = 600; $handle->image_text = ""; $handle->image_text_background = '#000000'; $handle->image_text_background_opacity = 50; $handle->image_text_padding = 10; $handle->image_text_x = -15; $handle->image_text_y = -15; $handle->image_text_line_spacing = 10; $handle->Process($dir_dest); if ($handle->processed) { $info = getimagesize($handle->file_dst_pathname); $imgName = $handle->file_dst_name; } $handle->image_resize = true; $handle->file_new_name_ext = 'jpg'; $handle->image_ratio_crop = 'C'; $handle->image_x = 360; $handle->image_y = 280; $handle->Process($dir_dest_thumb); if ($handle->processed) { $info = getimagesize($handle->file_dst_pathname); } } $db = new DB(); $query = "INSERT INTO `gallery` (`caption`,`image-name`) VALUES ('" . mysql_real_escape_string($_POST['caption']) . "', '" . mysql_real_escape_string($imgName) . "')"; $result = $db->readQuery($query); return $result; } function getImageGallery() { $db = new DB(); $sql = "SELECT * FROM `gallery` ORDER BY sort ASC"; $result = $db->readQuery($sql); $array_res = array(); while ($row = mysql_fetch_array($result)) { $property = array( 'id' => $row['id'], 'caption' => $row['caption'], 'image-name' => $row['image-name'] ); array_push($array_res, $property); } return $array_res; } function getImageGalleryById($id) { $query = "SELECT * FROM `gallery` WHERE `id` = '$id' LIMIT 1"; $db = new DB(); $result = $db->readQuery($query); $row = mysql_fetch_assoc($result); return $row; } function editImageGalleryById($post, $file, $id, $imageold) { $dir_dest = '../images/gallery/'; $dir_dest_thumb = '../images/gallery/thumb/'; $handle = new Upload($file['image']); $imgName = null; if ($handle->uploaded) { $handle->image_resize = true; $handle->file_new_name_body = TRUE; $handle->file_overwrite = TRUE; $handle->file_new_name_ext = FALSE; $handle->image_ratio_crop = 'C'; $handle->file_new_name_body = $imageold; $handle->image_x = 900; $handle->image_y = 600; $handle->image_text = ""; $handle->image_text_background = '#000000'; $handle->image_text_background_opacity = 50; $handle->image_text_padding = 10; $handle->image_text_x = -15; $handle->image_text_y = -15; $handle->image_text_line_spacing = 10; $handle->Process($dir_dest); if ($handle->processed) { $info = getimagesize($handle->file_dst_pathname); $imgName = $handle->file_dst_name; } $handle->image_resize = true; $handle->file_new_name_body = TRUE; $handle->file_overwrite = TRUE; $handle->file_new_name_ext = FALSE; $handle->image_ratio_crop = 'C'; $handle->file_new_name_body = $imageold; $handle->image_x = 360; $handle->image_y = 280; $handle->Process($dir_dest_thumb); if ($handle->processed) { $info = getimagesize($handle->file_dst_pathname); $imgName = $handle->file_dst_name; } } $db = new DB(); $sql = "UPDATE `gallery` SET " . "`caption` = '" . mysql_real_escape_string($_POST['caption']) . "'" . "WHERE `id` = '$id' "; $result = $db->readQuery($sql); return $result; } function getPhotoType() { $db = new DB(); $sql = "SELECT * FROM `photo_type` "; $result = $db->readQuery($sql); $array_res = array(); while ($row = mysql_fetch_array($result)) { $type = array( 'id' => $row['id'], 'type' => $row['type'] ); array_push($array_res, $type); } return $array_res; } function getPhotoTypeByType($type) { $db = new DB(); $sql = "SELECT * FROM `photo_type` WHERE `type` = '" . $type . "' "; $result = $db->readQuery($sql); return mysql_fetch_assoc($result); } function getAboutUspageContant() { $query = "SELECT * FROM `about_us` WHERE `id` = '1' LIMIT 1"; $db = new DB(); $result = $db->readQuery($query); $row = mysql_fetch_assoc($result); return $row; } function updateAboutUspageContant($post, $file) { $dir_dest = '../images/about/'; $handle = new Upload($file['image']); $imgName = null; $db = new DB(); if ($handle->uploaded) { $handle->image_resize = true; $handle->file_new_name_body = TRUE; $handle->file_overwrite = TRUE; $handle->file_new_name_ext = FALSE; $handle->image_ratio_crop = 'C'; $handle->file_new_name_body = 'aboutus.jpg'; $handle->image_x = 1970; $handle->image_y = 747; $handle->Process($dir_dest); if ($handle->processed) { $info = getimagesize($handle->file_dst_pathname); $imgName = $handle->file_dst_name; } } $sql = "UPDATE `about_us` SET " . "`title` = '" . mysql_real_escape_string($_POST['title']) . "'," . " `description` = '" . mysql_real_escape_string($_POST['description']) . "'," . "`vision` = '" . mysql_real_escape_string($_POST['vision']) . "'," . "`mission` = '" . mysql_real_escape_string($_POST['mission']) . "', " . "`strength` = '" . mysql_real_escape_string($_POST['strength']) . "', " . "`image_name` = '" . mysql_real_escape_string($_POST[$imgName]) . "' " . "WHERE `id` = 1 "; $result = $db->readQuery($sql); return $result; } function newTourPackage($post, $file) { $title = $_POST['title']; $duration = $_POST['duration']; $price = $_POST['price']; $map = $_POST['map']; $shortDescription = $_POST['shortDescription']; $description = $_POST['description']; $dir_dest = '../images/tour-package/'; $dir_dest_thumb = '../images/tour-package/thumb/'; $handle = new Upload($file['image']); $imgName = null; if ($handle->uploaded) { $handle->image_resize = true; $handle->file_new_name_ext = 'jpg'; $handle->image_ratio_crop = 'C'; $handle->image_x = 900; $handle->image_y = 500; $handle->Process($dir_dest); if ($handle->processed) { $info = getimagesize($handle->file_dst_pathname); $imgName = $handle->file_dst_name; } $handle->image_resize = true; $handle->file_new_name_ext = 'jpg'; $handle->image_ratio_crop = 'C'; $handle->image_x = 300; $handle->image_y = 200; $handle->Process($dir_dest_thumb); if ($handle->processed) { $info = getimagesize($handle->file_dst_pathname); } } $db = new DB(); $query = "INSERT INTO `tour-packages` (title,duration, price, map, shortDescription, description, image_name) VALUES ('" . mysql_real_escape_string($title) . "','" . mysql_real_escape_string($duration) . "', '" . mysql_real_escape_string($price) . "', '" . mysql_real_escape_string($map) . "', '" . mysql_real_escape_string($shortDescription) . "', '" . mysql_real_escape_string($description) . "', '" . mysql_real_escape_string($imgName) . "')"; $result = $db->readQuery($query); return $result; } function getTourPackage() { $db = new DB(); $sql = "SELECT * FROM `tour-packages` ORDER BY sort ASC"; $result = $db->readQuery($sql); $array_res = array(); while ($row = mysql_fetch_array($result)) { $property = array( 'id' => $row['id'], 'title' => $row['title'], 'duration' => $row['duration'], 'price' => $row['price'], 'map' => $row['map'], 'shortDescription' => $row['shortDescription'], 'description' => $row['description'], 'image_name' => $row['image_name'], 'sort' => $row['sort'], ); array_push($array_res, $property); } return $array_res; } function getTourPackageById($id) { $query = "SELECT * FROM `tour-packages` WHERE `id` = '$id' LIMIT 1"; $db = new DB(); $result = $db->readQuery($query); $row = mysql_fetch_assoc($result); return $row; } function getTourPackageByTourType($tourType) { $query = "SELECT * FROM `tour-packages` WHERE `tourType` = '$tourType'"; $db = new DB(); $result = $db->readQuery($query); $array_res = array(); while ($row = mysql_fetch_array($result)) { $property = array( 'id' => $row['id'], 'title' => $row['title'], 'price' => $row['price'], 'map' => $row['map'], 'shortDescription' => $row['shortDescription'], 'description' => $row['description'], 'image_name' => $row['image_name'], 'sort' => $row['sort'], ); array_push($array_res, $property); } return $array_res; } function editTourPackagesById($post, $file, $id, $imageold) { $dir_dest = '../images/tour-package/'; $dir_dest_thumb = '../images/tour-package/thumb/'; $handle = new Upload($file['image']); $imgName = null; if ($handle->uploaded) { $handle->image_resize = true; $handle->file_new_name_body = TRUE; $handle->file_overwrite = TRUE; $handle->file_new_name_ext = FALSE; $handle->image_ratio_crop = 'C'; $handle->file_new_name_body = $imageold; $handle->image_x = 900; $handle->image_y = 500; $handle->Process($dir_dest); if ($handle->processed) { $info = getimagesize($handle->file_dst_pathname); $imgName = $handle->file_dst_name; } $handle->image_resize = true; $handle->file_new_name_ext = 'jpg'; $handle->image_ratio_crop = 'C'; $handle->image_x = 300; $handle->image_y = 200; $handle->Process($dir_dest_thumb); if ($handle->processed) { $info = getimagesize($handle->file_dst_pathname); } } $db = new DB(); $sql = "UPDATE `tour-packages` SET " . "`title` = '" . mysql_real_escape_string($_POST['title']) . "'," . "`duration` = '" . mysql_real_escape_string($_POST['duration']) . "'," . "`price` = '" . mysql_real_escape_string($_POST['price']) . "'," . "`map` = '" . mysql_real_escape_string($_POST['map']) . "'," . " `shortDescription` = '" . mysql_real_escape_string($_POST['shortDescription']) . "', " . " `description` = '" . mysql_real_escape_string($_POST['description']) . "' " . "WHERE `id` = '$id' "; $result = $db->readQuery($sql); return $result; } function addTourPackagesPhoto($post, $file, $packageId) { $caption = $_POST['caption']; $dir_dest = '../images/tour-package/gallery/'; $dir_dest_thumb = '../images/tour-package/gallery/thumb/'; $handle = new Upload($file['image']); $imgName = null; if ($handle->uploaded) { $handle->image_resize = true; $handle->file_new_name_ext = 'jpg'; $handle->image_ratio_crop = 'C'; $handle->image_x = 900; $handle->image_y = 350; $handle->image_text = ""; $handle->image_text_background = '#000000'; $handle->image_text_background_opacity = 50; $handle->image_text_padding = 10; $handle->image_text_x = -15; $handle->image_text_y = -15; $handle->image_text_line_spacing = 10; $handle->Process($dir_dest); if ($handle->processed) { $info = getimagesize($handle->file_dst_pathname); $imgName = $handle->file_dst_name; } $handle->image_resize = true; $handle->file_new_name_ext = 'jpg'; $handle->image_ratio_crop = 'C'; $handle->image_x = 300; $handle->image_y = 175; $handle->Process($dir_dest_thumb); if ($handle->processed) { $info = getimagesize($handle->file_dst_pathname); } } $db = new DB(); $query = "INSERT INTO `tour-packages-photos` (package_id, caption, image_name) VALUES ('" . mysql_real_escape_string($packageId) . "', '" . mysql_real_escape_string($caption) . "', '" . mysql_real_escape_string($imgName) . "')"; $result = $db->readQuery($query); return $result; } function getTourPackagePhotosByPackageId($packageId) { $db = new DB(); $sql = "SELECT * FROM `tour-packages-photos` WHERE `package_id` = '$packageId' ORDER BY sort ASC"; $result = $db->readQuery($sql); $array_res = array(); while ($row = mysql_fetch_array($result)) { $property = array( 'id' => $row['id'], 'package_id' => $row['package_id'], 'caption' => $row['caption'], 'image_name' => $row['image_name'], 'sort' => $row['sort'], ); array_push($array_res, $property); } return $array_res; } function getTourPackagesPhotosById($id) { $db = new DB(); $sql = "SELECT * FROM `tour-packages-photos` WHERE `package_id` = '$id' ORDER BY sort ASC"; $result = $db->readQuery($sql); $array_res = array(); while ($row = mysql_fetch_array($result)) { $property = array( 'id' => $row['id'], 'package_id' => $row['package_id'], 'caption' => $row['caption'], 'image_name' => $row['image_name'], 'sort' => $row['sort'], ); array_push($array_res, $property); } return $array_res; } function getTourPackagesPhotoById($id) { $sql = "SELECT * FROM `tour-packages-photos` WHERE `id` = '$id'"; $db = new DB(); $result = $db->readQuery($sql); $row = mysql_fetch_assoc($result); return $row; } function editTourPackagesPhotoById($post, $file, $id, $imageold) { $dir_dest = '../images/tour-package/gallery/'; $dir_dest_thumb = '../images/tour-package/gallery/thumb/'; $handle = new Upload($file['image']); $imgName = null; if ($handle->uploaded) { $handle->image_resize = true; $handle->file_new_name_body = TRUE; $handle->file_overwrite = TRUE; $handle->file_new_name_ext = FALSE; $handle->image_ratio_crop = 'C'; $handle->file_new_name_body = $imageold; $handle->image_x = 900; $handle->image_y = 350; $handle->image_text = ""; $handle->image_text_background = '#000000'; $handle->image_text_background_opacity = 50; $handle->image_text_padding = 10; $handle->image_text_x = -15; $handle->image_text_y = -15; $handle->image_text_line_spacing = 10; $handle->Process($dir_dest); if ($handle->processed) { $info = getimagesize($handle->file_dst_pathname); $imgName = $handle->file_dst_name; } $handle->image_resize = true; $handle->file_new_name_body = TRUE; $handle->file_overwrite = TRUE; $handle->file_new_name_ext = FALSE; $handle->image_ratio_crop = 'C'; $handle->file_new_name_body = $imageold; $handle->image_x = 300; $handle->image_y = 175; $handle->Process($dir_dest_thumb); if ($handle->processed) { $info = getimagesize($handle->file_dst_pathname); $imgName = $handle->file_dst_name; } } $db = new DB(); $sql = "UPDATE `tour-packages-photos` SET " . "`caption` = '" . mysql_real_escape_string($_POST['caption']) . "'" . "WHERE `id` = '$id' "; $result = $db->readQuery($sql); return $result; } function addTourType($post) { $db = new DB(); $query = "INSERT INTO `tour-type` (`type`) VALUES('" . $_POST['tourType'] . "')"; $result = $db->readQuery($query); return $result; } function getAllTourType() { $db = new DB(); $query = "SELECT * FROM `tour-type` ORDER BY sort ASC"; $result = $db->readQuery($query); $array_res = array(); while ($row = mysql_fetch_array($result)) { $type = array( 'id' => $row['id'], 'type' => $row['type'] ); array_push($array_res, $type); } return $array_res; } function getAllTourTypeById($id) { $db = new DB(); $query = "SELECT * FROM `tour-type` WHERE `id` = '$id' "; $result = $db->readQuery($query); $row = mysql_fetch_assoc($result); return $row; } function editTourTypeById($id) { $db = new DB(); $query = "UPDATE `tour-type` SET `type` = '" . mysql_real_escape_string($_POST['tourType']) . "' WHERE `id` = '$id' "; $result = $db->readQuery($query); return $result; } function addTestimonials($post, $file) { $dir_dest = '../images/testimonials/'; $dir_dest_thumb = '../images/testimonials/thumb/'; $handle = new Upload($file['image']); $imgName = null; if ($handle->uploaded) { $handle->image_resize = true; $handle->file_new_name_ext = 'jpg'; $handle->image_ratio_crop = 'L'; $handle->image_x = 94; $handle->image_y = 94; $handle->Process($dir_dest); if ($handle->processed) { $info = getimagesize($handle->file_dst_pathname); $imgName = $handle->file_dst_name; } $handle->image_resize = true; $handle->file_new_name_ext = 'jpg'; $handle->image_ratio_crop = 'L'; $handle->image_x = 94; $handle->image_y = 94; $handle->Process($dir_dest_thumb); if ($handle->processed) { $info = getimagesize($handle->file_dst_pathname); } } $db = new DB(); $query = "INSERT INTO `testimonials` (`name`,`message`,`image_name`,`status`) VALUES('" . mysql_real_escape_string($_POST['name']) . "','" . mysql_real_escape_string($_POST['message']) . "','" . mysql_real_escape_string($imgName) . "','0')"; $result = $db->readQuery($query); return $result; } function getTestimonials() { $db = new DB(); $query = "SELECT * FROM `testimonials` WHERE `status` = '1' ORDER BY sort ASC"; $result = $db->readQuery($query); $array_res = array(); while ($row = mysql_fetch_array($result)) { $comments = array( 'id' => $row['id'], 'name' => $row['name'], 'message' => $row['message'], 'status' => $row['status'], 'image_name' => $row['image_name'] ); array_push($array_res, $comments); } return $array_res; } function getTestimonialsWithInActive() { $db = new DB(); $query = "SELECT * FROM `testimonials` ORDER BY sort ASC"; $result = $db->readQuery($query); $array_res = array(); while ($row = mysql_fetch_array($result)) { $comments = array( 'id' => $row['id'], 'name' => $row['name'], 'message' => $row['message'], 'status' => $row['status'], 'image_name' => $row['image_name'] ); array_push($array_res, $comments); } return $array_res; } function editTestimonialsById($post, $file, $imageold, $id) { $dir_dest = '../images/testimonials/'; $dir_dest_thumb = '../images/testimonials/thumb/'; $handle = new Upload($file['image']); $imgName = null; if ($handle->uploaded) { $handle->image_resize = true; $handle->file_new_name_body = TRUE; $handle->file_overwrite = TRUE; $handle->file_new_name_ext = FALSE; $handle->image_ratio_crop = 'L'; $handle->file_new_name_body = $imageold; $handle->image_x = 94; $handle->image_y = 94; $handle->Process($dir_dest); if ($handle->processed) { $info = getimagesize($handle->file_dst_pathname); $imgName = $handle->file_dst_name; } $handle->image_resize = true; $handle->file_new_name_body = TRUE; $handle->file_overwrite = TRUE; $handle->file_new_name_ext = FALSE; $handle->image_ratio_crop = 'L'; $handle->file_new_name_body = $imageold; $handle->image_x = 94; $handle->image_y = 94; $handle->Process($dir_dest_thumb); if ($handle->processed) { $info = getimagesize($handle->file_dst_pathname); $imgName = $handle->file_dst_name; } } $db = new DB(); $query = "UPDATE `testimonials` SET " . "`name` = '" . mysql_real_escape_string($_POST['name']) . "'," . "`status` = '" . mysql_real_escape_string($_POST['status']) . "'," . " `message` = '" . mysql_real_escape_string($_POST['message']) . "' " . " WHERE `id` = '$id' "; $result = $db->readQuery($query); return $result; } function getTestimonialsById($id) { $db = new DB(); $query = "SELECT * FROM `testimonials` WHERE `id` = '$id' "; $result = $db->readQuery($query); $row = mysql_fetch_assoc($result); return $row; } function CheckUser($id, $username, $enPw) { $sql = "SELECT * FROM `user` WHERE `id` = '$id' AND `user_name`= '$username' AND `password`= '$enPw'"; $db = new DB(); $result = $db->readQuery($sql); return mysql_fetch_array($result); // if ($result) { // return TRUE; // } else { // return FALSE; // } } function getAllUserDetails($id) { $sql = "SELECT * FROM `user` WHERE `id` = '$id'"; $db = new DB(); $result = $db->readQuery($sql); return mysql_fetch_array($result); // if ($result) { // return TRUE; // } else { // return FALSE; // } } function checkEmail($email) { $query = "SELECT `email`,`user_name` FROM `user` WHERE `email`= '" . $email . "'"; $db = new DB(); $result = mysql_fetch_array($db->readQuery($query)); if (!$result) { return FALSE; } else { return $result; } } function GenarateCode($email) { $rand = rand(10000, 99999); $query = "UPDATE `user` SET " . "`resetcode` ='" . $rand . "' " . "WHERE `email` = '" . $email . "'"; $db = new DB(); $result = $db->readQuery($query); if ($result) { return TRUE; } else { return FALSE; } } function SelectForgetUser($email) { if ($email) { $query = "SELECT `email`,`user_name`,`resetcode` FROM `user` WHERE `email`= '" . $email . "'"; $db = new DB(); $result = $db->readQuery($query); $array_res = array(); while ($row = mysql_fetch_array($result)) { array_push($array_res, $row); } return $array_res; } } function SelectResetCode($code) { $query = "SELECT `id` FROM `user` WHERE `resetcode`= '" . $code . "'"; $db = new DB(); $result = mysql_fetch_array($db->readQuery($query)); if (!$result) { return FALSE; } else { return TRUE; } } function updatePassword($password, $code) { $enPass = md5($password); $query = "UPDATE `user` SET " . "`password` ='" . $enPass . "' " . "WHERE `resetcode` = '" . $code . "'"; $db = new DB(); $result = $db->readQuery($query); if ($result) { return TRUE; } else { return FALSE; } } function addGroupTours($post, $file) { $title = $_POST['title']; $description = $_POST['description']; $available = $_POST['available']; $url = $_POST['url']; $dir_dest = '../images/group-tours/'; $dir_dest_thumb = '../images/group-tours/thumb/'; $handle = new Upload($file['image']); $imgName = null; if ($handle->uploaded) { $handle->image_resize = true; $handle->file_new_name_ext = 'jpg'; $handle->image_ratio_crop = 'C'; $handle->image_x = 600; $handle->image_y = 400; $handle->Process($dir_dest); if ($handle->processed) { $info = getimagesize($handle->file_dst_pathname); $imgName = $handle->file_dst_name; } $handle->image_resize = true; $handle->file_new_name_ext = 'jpg'; $handle->image_ratio_crop = 'C'; $handle->image_x = 300; $handle->image_y = 200; $handle->Process($dir_dest_thumb); if ($handle->processed) { $info = getimagesize($handle->file_dst_pathname); } } $db = new DB(); $query = "INSERT INTO `group_tours` (title,description, available, url, image_name) VALUES ('" . mysql_real_escape_string($title) . "','" . mysql_real_escape_string($description) . "', '" . mysql_real_escape_string($available) . "', '" . mysql_real_escape_string($url) . "', '" . mysql_real_escape_string($imgName) . "')"; $result = $db->readQuery($query); return $result; } function getAllGroupTours() { $db = new DB(); $sql = "SELECT * FROM `group_tours` "; $result = $db->readQuery($sql); $array_res = array(); while ($row = mysql_fetch_array($result)) { $property = array( 'id' => $row['id'], 'title' => $row['title'], 'description' => $row['description'], 'available' => $row['available'], 'url' => $row['url'], 'image_name' => $row['image_name'], ); array_push($array_res, $property); } return $array_res; } function getGroupToursById($id) { $query = "SELECT * FROM `group_tours` WHERE `id` = '$id' LIMIT 1"; $db = new DB(); $result = $db->readQuery($query); $row = mysql_fetch_assoc($result); return $row; } function editGroupToursById($post, $file, $id, $imageold) { $dir_dest = '../images/group-tours/'; $dir_dest_thumb = '../images/group-tours/thumb/'; $handle = new Upload($file['image']); $imgName = null; if ($handle->uploaded) { $handle->image_resize = true; $handle->file_new_name_body = TRUE; $handle->file_overwrite = TRUE; $handle->file_new_name_ext = FALSE; $handle->image_ratio_crop = 'C'; $handle->file_new_name_body = $imageold; $handle->image_x = 600; $handle->image_y = 400; $handle->Process($dir_dest); if ($handle->processed) { $info = getimagesize($handle->file_dst_pathname); $imgName = $handle->file_dst_name; } $handle->image_resize = true; $handle->file_new_name_ext = 'jpg'; $handle->image_ratio_crop = 'C'; $handle->image_x = 300; $handle->image_y = 200; $handle->Process($dir_dest_thumb); if ($handle->processed) { $info = getimagesize($handle->file_dst_pathname); } } $db = new DB(); $sql = "UPDATE `group_tours` SET " . "`title` = '" . mysql_real_escape_string($_POST['title']) . "'," . " `description` = '" . mysql_real_escape_string($_POST['description']) . "'," . "`available` = '" . mysql_real_escape_string($_POST['available']) . "'," . "`url` = '" . mysql_real_escape_string($_POST['url']) . "' " . " WHERE `id` = '$id' "; $result = $db->readQuery($sql); return $result; } function addRentaCar($post, $file) { $name = $_POST['name']; $description = $_POST['description']; $dir_dest = '../images/rent-a-car/'; $handle = new Upload($file['image']); $imgName = null; if ($handle->uploaded) { $handle->image_resize = true; $handle->file_new_name_ext = 'jpg'; $handle->image_ratio_crop = 'C'; $handle->image_x = 600; $handle->image_y = 300; $handle->Process($dir_dest); if ($handle->processed) { $info = getimagesize($handle->file_dst_pathname); $imgName = $handle->file_dst_name; } } $db = new DB(); $query = "INSERT INTO `rent_a_car` (name,description,image_name) VALUES ('" . mysql_real_escape_string($name) . "', '" . mysql_real_escape_string($description) . "','" . mysql_real_escape_string($imgName) . "')"; $result = $db->readQuery($query); return $result; } function getRentaCars() { $db = new DB(); $sql = "SELECT * FROM `rent_a_car` ORDER BY sort ASC"; $result = $db->readQuery($sql); $array_res = array(); while ($row = mysql_fetch_array($result)) { $property = array( 'id' => $row['id'], 'name' => $row['name'], 'description' => $row['description'], 'image_name' => $row['image_name'], 'sort' => $row['sort'], ); array_push($array_res, $property); } return $array_res; } function getRentaCarsById($id) { $query = "SELECT * FROM `rent_a_car` WHERE `id` = '$id' LIMIT 1"; $db = new DB(); $result = $db->readQuery($query); $row = mysql_fetch_assoc($result); return $row; } function editRentaCarsById($_post, $file, $imageold, $id) { $dir_dest = '../images/rent-a-car/'; $handle = new Upload($file['image_name']); $imgName = null; if ($handle->uploaded) { $handle->image_resize = true; $handle->file_new_name_body = TRUE; $handle->file_overwrite = TRUE; $handle->file_new_name_ext = FALSE; $handle->image_ratio_crop = 'C'; $handle->file_new_name_body = $imageold; $handle->image_x = 600; $handle->image_y = 300; $handle->Process($dir_dest); if ($handle->processed) { $info = getimagesize($handle->file_dst_pathname); $imgName = $handle->file_dst_name; } } $sql = "UPDATE `rent_a_car` SET " . "`name` = '" . mysql_real_escape_string($_POST['name']) . "'," . " `description` = '" . mysql_real_escape_string($_POST['description']) . "'" . " WHERE `id` = '$id' "; $db = new DB(); $result = $db->readQuery($sql); return $result; } Save