public function __construct() { //initialise the views object $this->view = new View(); //initialise the language object $this->language = new Language(); //form search if (!is_null(filter_input(INPUT_POST, 'submit_form')) || !is_null(filter_input(INPUT_POST, 'projectSubmit')) || !is_null(filter_input(INPUT_POST, 'sortSubmit'))) { $type = trim(filter_input(INPUT_POST, 'type')); $_SESSION[$type] = array(); $_SESSION[$type]["location"] = trim(filter_input(INPUT_POST, "location_" . $type)); $_SESSION[$type]["rooms"] = trim(filter_input(INPUT_POST, 'rooms')); $_SESSION[$type]["sleeps"] = trim(filter_input(INPUT_POST, 'sleeps')); $_SESSION[$type]["has_internet"] = trim(filter_input(INPUT_POST, 'has_internet')); $_SESSION[$type]["has_longstay"] = trim(filter_input(INPUT_POST, 'has_longstay')); $_SESSION[$type]["has_safe"] = trim(filter_input(INPUT_POST, 'has_safe')); $_SESSION[$type]["has_smoking"] = trim(filter_input(INPUT_POST, 'has_smoking')); $_SESSION[$type]["has_animals"] = trim(filter_input(INPUT_POST, 'has_animals')); $_SESSION[$type]["has_bbq"] = trim(filter_input(INPUT_POST, 'has_bbq')); $_SESSION[$type]["has_pool"] = trim(filter_input(INPUT_POST, 'has_pool')); $_SESSION[$type]["project_id"] = trim(filter_input(INPUT_POST, 'project_id')); $_SESSION[$type]["order"] = trim(filter_input(INPUT_POST, 'order')); $_SESSION["type"] = $type; if ($_SESSION["type"] == "rentals") { Url::redirect($_SESSION['site_lang'] . '/location.php'); } elseif ($_SESSION["type"] == "sales") { Url::redirect($_SESSION['site_lang'] . '/vente.php'); } else { Url::redirect($_SESSION['site_lang']); } } }
public function __construct() { parent::__construct(); //file lang $this->language->load('gestion'); //instance db object $this->_model_t = new \models\testimonials(); $this->_model_f = new \models\form_search(); // Language if (isset($_SESSION['site_lang'])) { if (!is_null(filter_input(INPUT_POST, 'languageEN')) && filter_input(INPUT_POST, 'languageEN') == 1) { $_SESSION['site_lang'] = 'en'; if (filter_input(INPUT_POST, 'lang_var') == "index") { Url::redirect($_SESSION['site_lang'] . "/gestion.php"); } } else { if (!is_null(filter_input(INPUT_POST, 'languageFR')) && filter_input(INPUT_POST, 'languageFR') == 2) { $_SESSION['site_lang'] = 'fr'; if (filter_input(INPUT_POST, 'lang_var') == "index") { Url::redirect($_SESSION['site_lang'] . "/gestion.php"); } } else { if (!is_null(filter_input(INPUT_POST, 'languageES')) && filter_input(INPUT_POST, 'languageES') == 3) { $_SESSION['site_lang'] = 'es'; if (filter_input(INPUT_POST, 'lang_var') == "index") { Url::redirect($_SESSION['site_lang'] . "/gestion.php"); } } } } } else { $_SESSION['site_lang'] = 'en'; Url::redirect($_SESSION['site_lang'] . "/gestion.php"); } }
public function logout() { session_unset(); session_destroy(); session_write_close(); setcookie(session_name(), '', 0, '/'); url::redirect('admin/login'); }
public function __construct() { $this->_model = new \models\pick(); $session = \helpers\session::id(); if (!$this->_model->get_session($session)) { url::redirect('login'); } else { $this->user_id = $this->_model->get_session($session); } }
public function __construct() { $this->_model = new \models\admin\archive(); $session = \helpers\session::id(); if (!$this->_model->get_session($session)) { url::redirect('admin/login'); } $this->_acl = new \helpers\acl(); $this->_rights = $this->_acl->is_allow(); if (json_decode($this->_rights[0]->pages)->{'archive'}->acl_level == 0) { url::redirect('admin/login'); } }
public function controlAccesoArchivo() { if (!session::get("autenticado")) { url::redirect(ARCHIVOLOGIN); } if (!$this->verificarAcceso(session::get("usuario"), "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'])) { $data["error"] = "NO TIENE PERMISO PARA ACCEDER A ESTA PAGINA"; view::archivotemplate('header', $data); view::render('error/404', $data); view::archivotemplate('footer', $data); exit; } }
public function index() { //SEO $data['title'] = Language::show('title', 'contact', $_SESSION['site_lang']); $data['meta_description'] = Language::show('meta_description', 'contact', $_SESSION['site_lang']); $data['meta_keywords'] = ''; $data['sitename_before'] = "Y"; //title for de hover in navbar $data['title_page'] = "contact"; //contacts $data['contacts'] = $this->_model->fetchContacts($_SESSION['site_lang']); // Envio de correo if (!is_null(filter_input(INPUT_POST, 'submit'))) { $name = filter_input(INPUT_POST, 'name'); $email_contact = filter_input(INPUT_POST, 'email_contact'); $email_client = filter_input(INPUT_POST, 'email_client'); $phone = filter_input(INPUT_POST, 'phone'); $comment = filter_input(INPUT_POST, 'message'); if ($name == '' || !isset($name) || $email_client == '' || !isset($email_client) || $comment == '' || !isset($comment)) { $error = ""; Url::redirect($_SESSION['site_lang'] . "/contact.php?error=1"); } if (!$error) { $mail = new \helpers\phpmailer\mail(); $mail->CharSet = 'UTF-8'; $mail->setFrom($email_client); $mail->addAddress($email_contact); $mail->addAddress(EMAIL_PIERRE); $mail->addAddress(EMAIL_INFO); $subject = "Govacationmaya Contact"; $subject .= date("Y-m-d"); $mail->subject($subject); $message = "Language: " . $_SESSION['site_lang'] . "<br><br>"; $message .= "Name: " . $name . "<br>"; $message .= "Email: " . $email_client . "<br>"; $message .= "Phone: " . $phone . "<br>"; $message .= "Comment: " . $comment; $mail->body($message); if (!$mail->send()) { Url::redirect($_SESSION['site_lang'] . "/contact.php?error=2"); } else { Url::redirect($_SESSION['site_lang'] . "/contact.php?send=1"); } } } //tender views View::rendertemplate('header', $data); View::render('contact/contact', $data, $error); View::rendertemplate('footer', $data); }
public function login() { \helpers\Session::init(); if (!isset($_POST['submit'])) { header("Location: ."); } else { $pass = $_POST['pass']; $uname = htmlspecialchars($_POST['username']); $auth_data = $this->login->get_admin_auth_by_uname($uname); $admin = true; if (!$auth_data->userName) { $auth_data = $this->login->get_trip_auth_by_uname($uname); $admin = false; } if ($auth_data->userName) { if ($auth_data->pass == $this->password_model->get_hash($pass, $auth_data->salt)) { if (!$admin) { \helpers\Session::set('tripId', $auth_data->tripId); $trip_info = $this->trip->get_trip_information($auth_data->tripId); $issueId = $trip_info->issueId; $seasonId = $trip_info->seasonId; $issue = $this->tripBoard->trip_issue_information($issueId); $season = $this->tripBoard->season_information($seasonId); \helpers\Session::set('season', $season[0]->name); \helpers\Session::set('issue', $issue[0]->issueName); \helpers\Session::set('issueId', $issue[0]->issueId); \helpers\Session::set('nickname', $trip_info->nickname); //children - DHvix4j2bf //RUSHGM - ww5oJeFtZz //mickeyds - mW56oQQ4eD } \helpers\Session::set('username', $auth_data->userName); \helpers\Session::set('admin', $admin); if ($admin) { \helpers\url::redirect('exec'); } else { \helpers\url::redirect('welcome'); } } else { header('Location: .?error'); } } else { header('Location: .?error'); } } }
public function submit() { if (!isset($_POST['submit'])) { \helpers\url::redirect('apply'); } $inputData = array(); foreach ($_POST as $key => $input) { if ($key == "dob") { $dobArray = explode("/", $input); $inputData[$key] = $dobArray[2] . "-" . $dobArray[0] . "-" . $dobArray[1]; } else { $inputData[$key] = $input; } } if ($inputData['issue1'] == $inputData['issue2'] || $inputData['issue1'] == $inputData['issue3'] || $inputData['issue2'] == $inputData['issue3']) { \helpers\url::redirect('apply?failure=issue'); } if ($this->apply_model->addApplication($inputData)) { \helpers\url::redirect('apply?success'); } else { \helpers\url::redirect('apply?failure=stunum'); } }
public function index() { //SEO $data['title'] = Language::show('title', 'testimonials', $_SESSION['site_lang']); $data['meta_description'] = Language::show('meta_description', 'testimonials', $_SESSION['site_lang']); $data['meta_keywords'] = Language::show('meta_keywords', 'testimonials', $_SESSION['site_lang']); $data['sitename_before'] = "N"; //title for de hover in navbar $data['title_page'] = "testimonials"; //column result $data['testimonials'] = $this->_model->fetchTestimonials('Y', $_SESSION['site_lang']); $data['result'] = filter_input(INPUT_GET, 'result'); //envio de testimonios if (!is_null(filter_input(INPUT_POST, 'submit'))) { $name = filter_input(INPUT_POST, 'name'); $message = filter_input(INPUT_POST, 'message'); $property = filter_input(INPUT_POST, 'property'); $residence = filter_input(INPUT_POST, 'residence'); $langSelect = filter_input(INPUT_POST, 'langSelect'); $typeSelect = filter_input(INPUT_POST, 'typeSelect'); $date = date("M Y"); if ($name == '' || !isset($name) || $message == '' || !isset($message) || $langSelect == '' || !isset($langSelect) || $typeSelect == '' || !isset($typeSelect) || $property == '' || !isset($property) || $residence == '' || !isset($residence)) { $error = ""; Url::redirect($_SESSION['site_lang'] . "/testimonials.php?error=1"); } if (!$error) { $dataTestimonial = array('type' => $typeSelect, 'lang' => $langSelect, 'comment' => $message, 'name' => $name, 'property' => $property, 'residence' => $residence, 'date' => $date, 'online' => 'N'); $this->_model->insert_testimonial($dataTestimonial); Url::redirect($_SESSION['site_lang'] . "/testimonials.php?send=1"); } } //render views View::rendertemplate('header', $data); View::render('testimonials/testimonials', $data); View::rendertemplate('footer', $data); }
public function addmedia($parameter) { $media_type = $parameter[0]; $this->data['media_type'] = $media_type; $this->data['album_categories'] = $this->category_model->get(array('category_slug' => 'album')); $category = $this->category_model->getColRow('category_title', $media_type); $this->data['title'] = 'Add ' . ucfirst($media_type); if (isset($_POST['title']) && !empty($_POST['title'])) { $title = $_POST['title']; $artist = $_POST['artist']; $description = $_POST['description']; $youtubelink = $_POST['youtubelink']; $category_id = $_POST['category']; // $status_id = $status->status_id; $slug = \helpers\url::generateSafeSlug($title); if (isset($youtubelink) && $youtubelink != '') { $exp = explode('=', $youtubelink); if (count($exp) > 1) { $youtubelink = $exp[1]; } } $insert_array = array('album_item_album_id' => \helpers\session::get('user')->user_album_id, 'album_item_category_id' => $category->category_id, 'album_item_user_id' => \helpers\session::get('user')->user_id, 'album_item_title' => $title, 'album_item_artist' => $artist, 'album_item_description' => $description, 'album_item_youtubelink' => $youtubelink, 'album_item_created' => time(), 'album_item_alias' => $slug); $insert_array = \helpers\gump::xss_clean($insert_array); $insert_array = \helpers\gump::sanitize($insert_array); $insert_id = $this->albumitem_model->create($insert_array); if ($insert_id > 0) { $message = 'ok'; } else { $message = 'no'; } //check if item is a video // $category_type = $this->category_model->find($_POST['category']); if ($media_type == 'video' && isset($youtubelink) && $youtubelink != '') { $youtube_url = "https://i.ytimg.com/vi/" . $youtubelink . "/maxresdefault.jpg"; if (!file_exists($youtube_url)) { $youtube_url = "https://i.ytimg.com/vi/" . $youtubelink . "/hqdefault.jpg"; } //resize youtube image into uploads folder \helpers\upload::setName(time()); \helpers\upload::resizeUrl($youtube_url, UPLOAD_PATH, '480px'); $image_name = \helpers\upload::getFileName('images'); $update_data = array('album_item_file' => $image_name); $where_array = array('album_item_id' => $insert_id); $this->albumitem_model->update($update_data, $where_array); } //UPLOAD ATTACHMENT if ($_FILES["image"]["tmp_name"] != '') { //upload image into uploads folder \helpers\upload::setName(uniqid()); \helpers\upload::resizeUpload($_FILES["image"], UPLOAD_PATH, '480px'); $image_name = \helpers\upload::getFileName('images'); $update_data = array('album_item_file' => $image_name); $where_array = array('album_item_id' => $insert_id); $this->albumitem_model->update($update_data, $where_array); } } if ($message == 'ok') { \helpers\session::set('success', 'record edited'); $url = 'user/' . $media_type; \helpers\url::redirect($url); } else { if ($message == 'no') { $this->data['error'] = 'Operation Fails!'; } } View::rendertemplate('header', $this->data); View::rendertemplate('mobile-menu', $this->data); View::render('user/user.media', $this->data); View::rendertemplate('footer', $this->data); }
public function delete($id) { $datos = array("usuario_id" => $id); $this->_model->deleteUsuario($datos); $this->_componente->borrarPermisosUsuario($id); session::set("estado", "Usuario Eliminado"); url::redirect($this->_archivo["raiz"]["componente_enlace"]); }
public function delete($id) { $data["title"] = $this->_archivo["borrar"]["componente_nombre"]; $datos = array("articulo_id" => $id); $this->_model->deleteArticulo($datos); session::set("estado", "Articulo Eliminado"); url::redirect($this->_archivo["raiz"]["componente_enlace"]); }
public function delete($id) { $data["title"] = $this->_archivo["borrar"]["componente_nombre"]; $this->_model->deleteCategoria(array("documento_tipo_id" => $id)); session::set("estado", "Categoria Eliminada"); url::redirect($this->_archivo["raiz"]["componente_enlace"]); }
public function delete($id) { $datos = array("grupo_id" => $id); $this->_model->deleteGrupo($datos); session::set("estado", "Grupo Eliminado"); url::redirect($this->_archivo["raiz"]["componente_enlace"]); }
public function grupo() { $data["title"] = $this->_archivo["grupo"]["componente_nombre"]; $data["raiz"] = $this->_archivo["raiz"]["componente_enlace"]; $data["url"] = $this->_archivo["grupo"]["componente_url"]; if (null != filter_input(INPUT_POST, "submit")) { $nombre = filter_input(INPUT_POST, "nombre"); $fecha = filter_input(INPUT_POST, "fecha"); if ($nombre === "") { $error[] = "Nombre de grupo requerido."; } if (!$error) { $grupo_datos = array('menu_grupo_nombre' => $nombre, 'menu_grupo_fecha' => $fecha); $this->_model->crearGrupo($grupo_datos); session::set("estado", "Clase Creada"); url::redirect($this->_archivo["raiz"]["componente_enlace"]); } } view::admintemplate("header", $data); view::render($this->_archivo["grupo"]["componente_enlace"], $data, $error); view::admintemplate("footer", $data); }
public function add() { if (json_decode($this->_rights[0]->pages)->{'root'}->acl_level <= 1) { url::redirect('admin/login'); } $data['pages'] = json_decode($this->_rights[0]->pages); $data['title'] = 'Добавить админа'; $data['breadcrumbs'] = array(); $data['breadcrumb'][] = array('text' => 'Главная', 'href' => '/admin/'); $data['breadcrumb'][] = array('text' => 'Админы', 'href' => '/admin/root/'); if (json_decode($this->_rights[0]->pages)->{'root'}->acl_level == 3) { $data['url'] = '/admin/root/add'; $data['url_title'] = 'Новый админ'; } $data['acl_list'] = $this->_sec_groups->get_permissions(); if (isset($_POST['submit'])) { print_r($_POST); $login = trim(stripslashes(strip_tags($_POST['login']))); if ($login == '') { $error[] = 'Логин обязателен'; } $password = trim(stripslashes(strip_tags($_POST['password']))); if ($password == '') { $password = $data['admin']->passwd; } else { $password = \helpers\password::make($password); } $acl = trim(stripslashes(strip_tags($_POST['acl']))); if ($acl == '') { $error[] = 'Необходимо выбрать группу доступа'; } if (!$error) { $data = array('login' => $login, 'passwd' => $password, 'acl' => $acl); $this->_model->insert_admin($data); url::redirect('admin/root'); } } view::rendertemplate('header', $data); view::rendertemplate('admin_menu', $data); view::render('admin/root_add_form', $data, $error); view::rendertemplate('footer'); }
public function add() { $data['pages'] = json_decode($this->_rights[0]->pages); $data['title'] = 'Добавить рабочего'; $data['breadcrumbs'] = array(); $data['breadcrumb'][] = array('text' => 'Главная', 'href' => '/admin/'); $data['breadcrumb'][] = array('text' => 'Рабочие', 'href' => '/admin/workers/'); if (json_decode($this->_rights[0]->pages)->{'workers'}->acl_level == 3) { $data['url'] = '/admin/workers/add'; $data['url_title'] = 'Новый рабочий'; } $data['worker'] = $this->_model->get_worker($id); $data['cities'] = $this->_model->show_cities(); $data['statuses'] = $this->_model->show_statuses(); $data['salaries'] = $this->_model->show_salaries(); if (isset($_POST['submit'])) { $name = trim(stripslashes(strip_tags($_POST['name']))); if ($name == '') { $error[] = 'Имя рабочего обязательно'; } $login = trim(stripslashes(strip_tags($_POST['login']))); if ($login == '') { $error[] = 'Логин обязателен'; } $email = trim(stripslashes(strip_tags($_POST['email']))); $phone1 = preg_replace('/\\D+/', '', trim(stripslashes(strip_tags($_POST['phone1'])))); if ($phone1 == '') { $error[] = 'Необходимо указать как минимум один телефон'; } $phone2 = preg_replace('/\\D+/', '', trim(stripslashes(strip_tags($_POST['phone2'])))); $phone3 = preg_replace('/\\D+/', '', trim(stripslashes(strip_tags($_POST['phone3'])))); $phone4 = preg_replace('/\\D+/', '', trim(stripslashes(strip_tags($_POST['phone4'])))); $icq = trim(stripslashes(strip_tags($_POST['icq']))); $skype = trim(stripslashes(strip_tags($_POST['skype']))); $privat_card1 = trim(stripslashes(strip_tags($_POST['privat_card1']))); $privat_card2 = trim(stripslashes(strip_tags($_POST['privat_card2']))); $card_owner1 = trim(stripcslashes(strip_tags($_POST['card_owner1']))); $card_owner2 = trim(stripcslashes(strip_tags($_POST['card_owner2']))); $passwd = \helpers\password::make(trim($_POST['pass'])); if ($passwd == '') { $error[] = 'Пароль является обязательным'; } $comment = trim(stripslashes(strip_tags($_POST['comment']))); $salary = trim(stripslashes(strip_tags($_POST['salary']))); if ($salary == '') { $error[] = 'Необходимо указать зарплату'; } $city = trim(stripslashes(strip_tags($_POST['city']))); if ($city == '') { $error[] = 'Укажите город в котором будет работать сотрудник'; } $status = trim(stripslashes(strip_tags($_POST['status']))); if ($status == '') { $error[] = 'Укажите статус работника'; } $date = date("Y-m-d H:i:s"); if (!$error) { $data = array('name' => $name, 'login' => $login, 'email' => $email, 'phone1' => $phone1, 'phone2' => $phone2, 'phone3' => $phone3, 'phone4' => $phone4, 'icq' => $icq, 'skype' => $skype, 'privat_card1' => $privat_card1, 'privat_card2' => $privat_card2, 'card_owner1' => $card_owner1, 'card_owner2' => $card_owner2, 'passwd' => $passwd, 'comment' => $comment, 'salary_id' => $salary, 'city_id' => $city, 'status_id' => $status, 'works_from' => $date); $this->_model->insert_worker($data); url::redirect('admin/workers'); } } view::rendertemplate('header', $data); view::rendertemplate('admin_menu', $data); view::render('admin/worker_add_form', $data, $error); view::rendertemplate('footer'); }
public function logout() { session::destroy("autenticado"); session::destroy("usuario"); url::redirect(ADMINLOGIN); }
public function add() { if (json_decode($this->_rights[0]->pages)->{'cities'}->acl_level <= 1) { url::redirect('admin/login'); } $data['pages'] = json_decode($this->_rights[0]->pages); $data['rights'] = json_decode($this->_rights[0]->rights); $data['title'] = "Добавить город"; $data['breadcrumbs'] = array(); $data['breadcrumb'][] = array('text' => 'Главная', 'href' => '/admin/'); $data['breadcrumb'][] = array('text' => 'Города', 'href' => '/admin/cities/'); $data['statuses'] = $this->_model->show_statuses(); if (json_decode($this->_rights[0]->pages)->{'cities'}->acl_level == 3) { $data['url'] = '/admin/cities/add'; $data['url_title'] = 'Новый город'; } if (isset($_POST['submit'])) { $city = trim(stripslashes(strip_tags($_POST['city']))); if ($city == '') { $error[] = 'Укажите город'; } $status = trim(stripslashes(strip_tags($_POST['status']))); if ($status == '') { $error[] = 'Укажите статус города'; } $comment = trim(stripslashes(strip_tags($_POST['comment']))); if (!$error) { $data = array('city' => $city, 'status_id' => $status, 'comment' => $comment); $where = array('id' => $id); $this->_model->insert_city($data); url::redirect('admin/cities'); } } view::rendertemplate('header', $data); view::rendertemplate('admin_menu', $data); view::render('admin/city_add_form', $data, $error); view::rendertemplate('footer'); }
public function detailActivities($url) { //title for de hover in navbar $data['title_page'] = "activity"; //URL $urlExplode = explode("/", $url); $item_id = $urlExplode[0]; //detail $data['item_result'] = $this->_model->fetchActivitiesDetails($item_id, "Y", $_SESSION['site_lang']); //SEO $data['title'] = $data['item_result'][0]->name; $data['meta_description'] = strip_tags($data['item_result'][0]->description); $data['meta_keywords'] = $data['item_result'][0]->name; $data['sitename_before'] = "Y"; //Comments $data['comments'] = $this->_model_c->fetchActivityComments($item_id, 0, 0, 'Y'); $data['replys'] = $this->_model_c->fetchActivityReply(0, 0, 'Y'); // send of comment if (!is_null(filter_input(INPUT_POST, 'submitComment'))) { $name = filter_input(INPUT_POST, 'name'); $email = filter_input(INPUT_POST, 'email'); $comment = filter_input(INPUT_POST, 'comment'); $date = date("Y-m-d H:i:s"); if ($name == '' || !isset($name) || $email == '' || !isset($email) || $comment == '' || !isset($comment)) { $error = ""; Url::redirect("?error=1", true); } if (!$error) { $mail = new \helpers\phpmailer\mail(); $mail->CharSet = 'UTF-8'; $mail->setFrom($email); $mail->addAddress(EMAIL_PIERRE); $mail->addAddress(EMAIL_INFO); $subject = "Govacationmaya Activity Comment " . $data['title'] . " "; $subject .= date("Y-m-d"); $mail->subject($subject); $message = "Language: " . $_SESSION['site_lang'] . "<br><br>"; $message .= "Name: " . $name . "<br>"; $message .= "Email: " . $email . "<br>"; $message .= "Comment: " . $comment; $mail->body($message); // insert table $dataComments = array('activity_id' => $item_id, 'name' => $name, 'email' => $email, 'comment' => $comment, 'date_submit' => $date, 'online' => 'N'); $this->_model_c->insert_comments('activity_comment', $dataComments); if (!$mail->send()) { Url::redirect("?error=2", true); } else { Url::redirect("?send=1", true); } } } // send of reply if (!is_null(filter_input(INPUT_POST, 'submitReply'))) { $name = filter_input(INPUT_POST, 'name'); $email = filter_input(INPUT_POST, 'email'); $comment = filter_input(INPUT_POST, 'comment'); $date = date("Y-m-d H:i:s"); $id_reply = filter_input(INPUT_POST, 'id_reply'); $email_reply = filter_input(INPUT_POST, 'email_reply'); if ($name == '' || !isset($name) || $email == '' || !isset($email) || $comment == '' || !isset($comment)) { $error = ""; Url::redirect("?error=1", true); } if (!$error) { $mail = new \helpers\phpmailer\mail(); $mail->CharSet = 'UTF-8'; $mail->setFrom($email); $mail->addAddress($email_reply); $mail->addAddress(EMAIL_PIERRE); $mail->addAddress(EMAIL_INFO); $subject = "Govacationmaya Activity Reply Comment " . $data['title'] . " "; $subject .= date("Y-m-d"); $mail->subject($subject); $message = "Language: " . $_SESSION['site_lang'] . "<br><br>"; $message .= "Name: " . $name . "<br>"; $message .= "Email: " . $email . "<br>"; $message .= "Reply: " . $comment; $mail->body($message); // insert table $dataComments = array('activity_comment_id' => $id_reply, 'name' => $name, 'email' => $email, 'comment' => $comment, 'date_submit' => $date, 'online' => 'Y'); $this->_model_c->insert_comments('activity_reply', $dataComments); if (!$mail->send()) { Url::redirect("?error=2", true); } else { Url::redirect("?send=1", true); } } } //column lateral $data['search_results_detail_activities'] = $this->_model->fetchActivities($_SESSION['site_lang'], "Y", "rank", 0, 0); //URL change lang $data['lang_var'] = "detail"; //tender views View::rendertemplate('header', $data); View::render('activity/activity', $data); View::rendertemplate('footer', $data); }
public function ajaxLogout() { Session::set('idU', ''); Session::set('Credentials', ''); \Helpers\url::redirect('usuaris'); }
public function detailVente($url) { //send of mail if (!is_null(filter_input(INPUT_POST, 'submit'))) { $name = filter_input(INPUT_POST, 'name'); $email = filter_input(INPUT_POST, 'email'); $phone = filter_input(INPUT_POST, 'phone'); $comment = filter_input(INPUT_POST, 'comment'); if ($name == '' || !isset($name) || $email == '' || !isset($email) || $comment == '' || !isset($comment)) { $error = ""; Url::redirect("?error=1", true); } if (!$error) { $mail = new \helpers\phpmailer\mail(); $mail->CharSet = 'UTF-8'; $mail->setFrom($email); $mail->addAddress(EMAIL_PIERRE); $mail->addAddress(EMAIL_INFO); $subject = "Govacationmaya Contact Rentals "; $subject .= date("Y-m-d"); $mail->subject($subject); $message = "Language: " . $_SESSION['site_lang'] . "<br><br>"; $message .= "Name: " . $name . "<br>"; $message .= "Email: " . $email . "<br>"; $message .= "Phone: " . $phone . "<br>"; $message .= "Comment: " . $comment; $mail->body($message); if (!$mail->send()) { Url::redirect("?error=2", true); } else { Url::redirect("?send=1", true); } } } //URL $urlExplode = explode("/", $url); if ($urlExplode[0] == "print") { $item_id = $urlExplode[1]; } else { $item_id = $urlExplode[0]; } //detail $data['item_id'] = $item_id; $data['item_result'] = $this->_model->fetchSalesDetails($item_id, "Y", $_SESSION['site_lang']); //title for de hover in navbar $data['title_page'] = "vente"; //type of search in form, default selected: rentals $data['searchtype'] = 'rentals'; //URL change lang $data['lang_var'] = "detail"; //change tipe text to capital letter switch ($data['item_result'][0]->type) { case 'condo': $data['item_result'][0]->type = 'Condo'; break; case 'house': $data['item_result'][0]->type = 'House'; break; case 'hotel': $data['item_result'][0]->type = 'Hotel'; break; case 'lot': $data['item_result'][0]->type = 'Lot'; break; case 'commercial': $data['item_result'][0]->type = 'Commercial business'; break; case 'other': $data['item_result'][0]->type = 'Hotel'; break; } switch ($data['item_result'][0]->bathrooms_details) { case 'private': $data['item_result'][0]->bathrooms_details = 'Private'; break; case 'shared': $data['item_result'][0]->bathrooms_details = 'Shared'; break; case 'both': $data['item_result'][0]->bathrooms_details = 'Private and Shared'; break; } switch ($data['item_result'][0]->pool_type) { case 'private': $data['item_result'][0]->pool_type = 'Private'; break; case 'shared': $data['item_result'][0]->pool_type = 'Shared'; break; } //SEO $data['title'] = "Sales - " . $data['item_result'][0]->name . " " . $data['item_result'][0]->location; $data['meta_description'] = strip_tags($data['item_result'][0]->highlights); $data['meta_keywords'] = $data['item_result'][0]->name . ", " . $data['item_result'][0]->location . ", " . $data['item_result'][0]->type; $data['sitename_before'] = "Y"; //Comments $data['comments'] = $this->_model_c->fetchSalesComments($item_id, 0, 0, 'Y'); $data['replys'] = $this->_model_c->fetchSalesReply(0, 0, 'Y'); // send of comment if (!is_null(filter_input(INPUT_POST, 'submitComment'))) { $name = filter_input(INPUT_POST, 'name'); $email = filter_input(INPUT_POST, 'email'); $comment = filter_input(INPUT_POST, 'comment'); $date = date("Y-m-d H:i:s"); if ($name == '' || !isset($name) || $email == '' || !isset($email) || $comment == '' || !isset($comment)) { $error = ""; Url::redirect("?error=1", true); } if (!$error) { $mail = new \helpers\phpmailer\mail(); $mail->CharSet = 'UTF-8'; $mail->setFrom($email); $mail->addAddress(EMAIL_PIERRE); $mail->addAddress(EMAIL_INFO); $subject = "Govacationmaya Sale Comment " . $data['title'] . " "; $subject .= date("Y-m-d"); $mail->subject($subject); $message = "Language: " . $_SESSION['site_lang'] . "<br><br>"; $message .= "Name: " . $name . "<br>"; $message .= "Email: " . $email . "<br>"; $message .= "Comment: " . $comment; $mail->body($message); // insert table $dataComments = array('sales_id' => $item_id, 'name' => $name, 'email' => $email, 'comment' => $comment, 'date_submit' => $date, 'online' => 'N'); $this->_model_c->insert_comments('sale_comment', $dataComments); if (!$mail->send()) { Url::redirect("?error=2", true); } else { Url::redirect("?send=1", true); } } } // send of reply if (!is_null(filter_input(INPUT_POST, 'submitReply'))) { $name = filter_input(INPUT_POST, 'name'); $email = filter_input(INPUT_POST, 'email'); $comment = filter_input(INPUT_POST, 'comment'); $date = date("Y-m-d H:i:s"); $id_reply = filter_input(INPUT_POST, 'id_reply'); $email_reply = filter_input(INPUT_POST, 'email_reply'); if ($name == '' || !isset($name) || $email == '' || !isset($email) || $comment == '' || !isset($comment)) { $error = ""; Url::redirect("?error=1", true); } if (!$error) { $mail = new \helpers\phpmailer\mail(); $mail->CharSet = 'UTF-8'; $mail->setFrom($email); $mail->addAddress($email_reply); $mail->addAddress(EMAIL_PIERRE); $mail->addAddress(EMAIL_INFO); $subject = "Govacationmaya Sale Reply Comment " . $data['title'] . " "; $subject .= date("Y-m-d"); $mail->subject($subject); $message = "Language: " . $_SESSION['site_lang'] . "<br><br>"; $message .= "Name: " . $name . "<br>"; $message .= "Email: " . $email . "<br>"; $message .= "Reply: " . $comment; $mail->body($message); // insert table $dataComments = array('sale_comment_id' => $id_reply, 'name' => $name, 'email' => $email, 'comment' => $comment, 'date_submit' => $date, 'online' => 'Y'); $this->_model_c->insert_comments('sale_reply', $dataComments); if (!$mail->send()) { Url::redirect("?error=2", true); } else { Url::redirect("?send=1", true); } } } //images if ($data['item_result']) { $data['images_result'] = $this->_model->fetchSalesPhotos($item_id, 0, 0); // Images for a property $array = array(); $i = 0; foreach ($data['images_result'] as $images_row) { $array[$i] = $this->_model->fetchSalesPhotoDetails($images_row->photo_id); $i++; } $data['images_details_result'] = $array; if ($urlExplode[0] == "print") { View::rendertemplate('header_print', $data); View::render('sales/sales_print', $data); View::rendertemplate('footer_print', $data); } else { View::rendertemplate('header', $data); View::render('sales/sales', $data); View::rendertemplate('footer', $data); } } else { // not found rental header("HTTP/1.0 404 Not Found"); $data['title'] = '404'; $data['error'] = 'No routes found.'; View::rendertemplate('header', $data); View::render('error/404', $data); View::rendertemplate('footer', $data); } }
public function edit($id) { $data['title'] = 'Просмотр данных заказа'; $data['breadcrumbs'] = array(); $data['breadcrumb'][] = array('text' => 'Заказы', 'href' => '/'); $data['order'] = $this->_model->get_order($id, $this->user_id); $data['comment'] = $this->_model->get_comment($id, $this->user_id, "1"); $data['statuses'] = $this->_model->show_statuses(); $data['formula'] = $this->_model->salary_formula($data['order'][0]->salary_id); if (!empty($_POST)) { if (!isset($_POST['status'])) { $error[] = 'Ошибка, данные формы не отправленны'; } $data['current_sort'] = $this->_model->show_status_order($data['order'][0]->status_id); $data['expected_sort'] = $this->_model->show_status_order(trim($_POST['status'])); if ($data['expected_sort'] < $data['current_sort']) { $error[] = 'Статус заказа не может быть ниже чем уже имеющийся'; } else { if ($data['expected_sort'] > $data['current_sort']) { $status = trim($_POST['status']); $update_status = true; if ($status == 2) { $problem_viewed = 1; } else { $problem_viewed = 0; } } else { $status = $data['order'][0]->status_id; } } if ($data['order'][0]->profit > 0) { $profit = $data['order'][0]->profit; } /* }else{ if(preg_match('/[0-9]+(?:\.[0-9]*)?/',trim($_POST['profit']))){ $profit = trim($_POST['profit']); }else{ $profit = $data['order'][0]->profit; } } */ if ($data['order'][0]->total > 0) { $total = $data['order'][0]->total; } else { if (preg_match('/[0-9]+(?:\\.[0-9]*)?/', trim($_POST['total']))) { $total = trim($_POST['total']); // if ($data['order'][0]->salary_id == 1) { if ($total > 0 && $total <= 199) { $profit = $total * 0.5; } elseif ($total >= 200 && $total <= 250) { $profit = $total - 100; } elseif ($total >= 251 && $total <= 399) { $profit = $total * 0.6; } else { $profit = $total * 0.5; } } elseif ($data['order'][0]->salary_id == 2) { $profit = $total * 0.5; } elseif ($data['order'][0]->salary_id == 3) { $profit = $total * 0.6; } elseif ($data['order'][0]->salary_id == 4) { $profit = $total * 0.7; } // } else { $total = $data['order'][0]->total; } } $comment = trim(stripslashes(strip_tags(trim($_POST['worker_comment'])))); $where = array('id' => $id, 'worker_id' => $this->user_id); if (!$error) { //update order $data = array('status_id' => $status, 'problem_viewed' => $problem_viewed, 'profit' => round($profit, 2), 'total' => $total); $this->_model->update_order($data, $where); //update status if ($update_status) { $status_log['creation_date'] = date("Y-m-d H:i:s"); $where = array('order_id' => $id, 'status_id' => $status); $this->_model->update_status_log($status_log, $where); } //insert comment if ($comment) { //$old_comment = $this->_model->get_comment($id, $this->user_id); //if($old_comment && $old_comment->status == 1){ //} $data = array('order_id' => $id, 'worker_id' => $this->user_id, 'comment' => $comment, 'status' => '1', 'creation_date' => date("Y-m-d H:i:s")); $this->_model->insert_order_comment($data); } else { if ($this->_model->get_comment($id, $this->user_id, "1")) { $where = array('order_id' => $id, 'worker_id' => $this->user_id); $data = array('status' => '0'); $this->_model->update_order_comment($data, $where); } } if (\helpers\session::get('url')) { url::redirect(\helpers\session::get('url')); } else { url::redirect(''); } } } view::rendertemplate('header', $data); view::rendertemplate('user_menu', $data); view::render('order_edit_form', $data, $error); view::rendertemplate('footer'); }
public function delete($param) { $id = $param[0]; $delete = $this->site_model->deleteId($id); if ($delete > 0) { \helpers\session::set('success', 'Record Deleted!'); \helpers\url::redirect('site/settings'); } else { // $this->data['error'] = 'Operation Fails!'; \helpers\session::set('error', 'Operation Fails!'); } }
public function add() { if (json_decode($this->_rights[0]->pages)->{'orders'}->acl_level != 3) { url::redirect('admin/login'); } $data['pages'] = json_decode($this->_rights[0]->pages); $data['rights'] = json_decode($this->_rights[0]->rights); $data['title'] = 'Новый заказ'; $data['breadcrumbs'] = array(); $data['breadcrumb'][] = array('text' => 'Главная', 'href' => '/admin/'); $data['breadcrumb'][] = array('text' => 'Заказы', 'href' => '/admin/orders/'); $data['cities'] = $this->_model->show_cities(); $data['workers'] = $this->_model->show_workers(); $data['statuses'] = $this->_model->show_statuses(); $data['url'] = '/admin/orders/add'; $data['url_title'] = 'Новый заказ'; if (isset($_POST['submit'])) { //print_r($_POST); if ($data['rights']->contact_name == 1) { $output['client_name'] = trim(stripslashes(strip_tags($_POST['contact_name']))); } if ($data['rights']->order_description == 1) { if (!isset($_POST['order_description']) || empty($_POST['order_description'])) { $error[] = 'Описание заказа не может быть пустым'; } else { $output['description'] = trim(stripslashes(strip_tags($_POST['order_description']))); } } if ($data['rights']->order_description_hidden == 1) { $output['description_hidden'] = trim(stripslashes(strip_tags($_POST['order_description_hidden']))); } if ($data['rights']->status == 1) { if (!isset($_POST['status']) || empty($_POST['status'])) { $error[] = 'Статус заказа не может быть пустым'; } else { $output['status_id'] = trim(stripslashes(strip_tags($_POST['status']))); } } if ($data['rights']->phone1 == 1) { if (!isset($_POST['phone1']) || empty($_POST['phone1'])) { $error[] = 'Необходимо указать как минимум один телефон'; } else { $output['phone1'] = preg_replace('/\\D+/', '', trim(stripslashes(strip_tags($_POST['phone1'])))); } } if ($data['rights']->phone2 == 1) { $output['phone2'] = preg_replace('/\\D+/', '', trim(stripslashes(strip_tags($_POST['phone2'])))); } if ($data['rights']->phone3 == 1) { $output['phone3'] = preg_replace('/\\D+/', '', trim(stripslashes(strip_tags($_POST['phone3'])))); } if ($data['rights']->worker == 1) { if (!isset($_POST['worker']) || empty($_POST['worker'])) { $error[] = 'Назначьте рабочего'; } else { $output['worker_id'] = trim(stripslashes(strip_tags($_POST['worker']))); } } if ($data['rights']->city == 1) { if (!isset($_POST['city']) || empty($_POST['city'])) { $error[] = 'Выберите город'; } else { $output['city_id'] = trim(stripslashes(strip_tags($_POST['city']))); } } if ($data['rights']->profit == 1) { $output['profit'] = trim(stripslashes(strip_tags($_POST['profit']))); } if ($data['rights']->total == 1) { $output['total'] = trim(stripslashes(strip_tags($_POST['total']))); } if ($data['rights']->spare == 1) { $output['spare'] = trim(stripslashes(strip_tags($_POST['spare']))); } if ($data['rights']->advert == 1) { $output['advert'] = trim(stripslashes(strip_tags($_POST['advert']))); } if ($data['rights']->check == 1) { $output['check_order'] = trim(stripslashes(strip_tags($_POST['check']))); } if (!$error) { $order_id = $this->_model->insert_order($output); $this->_model->insert_status_log($order_id, $output['status_id']); if (\helpers\session::get('url')) { url::redirect(\helpers\session::get('url')); } else { url::redirect('admin/orders'); } } } view::rendertemplate('header', $data); view::rendertemplate('admin_menu', $data); view::render('admin/order_add_form', $data, $error); view::rendertemplate('footer'); }
public function add() { $data['pages'] = json_decode($this->_rights[0]->pages); $data['title'] = 'Новое правило доступа'; $data['breadcrumbs'] = array(); $data['breadcrumb'][] = array('text' => 'Главная', 'href' => '/admin/'); $data['breadcrumb'][] = array('text' => 'Настройки доступа', 'href' => '/admin/permissions/'); $data['url'] = '/admin/permissions/add'; $data['url_title'] = 'Новые правила доступа'; if (!empty($_POST)) { if (isset($_POST['orders'])) { $pages['orders'] = $_POST['orders']; } else { $error[] = "Необходимо выбрать уровень доступа для - Заказы"; } if (isset($_POST['workers'])) { $pages['workers'] = $_POST['workers']; } else { $error[] = "Необходимо выбрать уровень доступа для - Рабочие"; } if (isset($_POST['cities'])) { $pages['cities'] = $_POST['cities']; } else { $error[] = "Необходимо выбрать уровень доступа для - Города"; } if (isset($_POST['archive'])) { $pages['archive'] = $_POST['archive']; } else { $error[] = "Необходимо выбрать уровень доступа для - Архив"; } if (isset($_POST['permissions'])) { $pages['permissions'] = $_POST['permissions']; } else { $error[] = "Необходимо выбрать уровень доступа для - Права доступа"; } if (isset($_POST['messages'])) { $pages['messages'] = $_POST['messages']; } else { $error[] = "Необходимо выбрать уровень доступа для - Сообщения"; } if (isset($_POST['name']) && $_POST['name'] != "") { $permission['acl_name'] = $_POST['name']; } else { $error[] = "Укажите имя"; } if (isset($_POST['contact_name'])) { $output['contact_name'] = $_POST['contact_name']; } else { $error[] = "Необходимо выбрать уровень доступа для - Контактное лицо"; } if (isset($_POST['phone1'])) { $output['phone1'] = $_POST['phone1']; } else { $error[] = "Необходимо выбрать уровень доступа для - Телефон 1"; } if (isset($_POST['phone2'])) { $output['phone2'] = $_POST['phone2']; } else { $error[] = "Необходимо выбрать уровень доступа для - Телефон 2"; } if (isset($_POST['phone3'])) { $output['phone3'] = $_POST['phone3']; } else { $error[] = "Необходимо выбрать уровень доступа для - Телефон 3"; } if (isset($_POST['creation-date'])) { $output['creation-date'] = $_POST['creation-date']; } else { $error[] = "Необходимо выбрать уровень доступа для - Дата создания"; } if (isset($_POST['certain-date'])) { $output['certain-date'] = $_POST['certain-date']; } else { $error[] = "Необходимо выбрать уровень доступа для - Заказ на"; } if (isset($_POST['performed-date'])) { $output['performed-date'] = $_POST['performed-date']; } else { $error[] = "Необходимо выбрать уровень доступа для - Дата выполнения"; } if (isset($_POST['payed-date'])) { $output['payed-date'] = $_POST['payed-date']; } else { $error[] = "Необходимо выбрать уровень доступа для - Дата оплаты"; } if (isset($_POST['city'])) { $output['city'] = $_POST['city']; } else { $error[] = "Необходимо выбрать уровень доступа для - Город"; } if (isset($_POST['worker'])) { $output['worker'] = $_POST['worker']; } else { $error[] = "Необходимо выбрать уровень доступа для - Сотрудник"; } if (isset($_POST['total'])) { $output['total'] = $_POST['total']; } else { $error[] = "Необходимо выбрать уровень доступа для - Сумма заказа"; } if (isset($_POST['profit'])) { $output['profit'] = $_POST['profit']; } else { $error[] = "Необходимо выбрать уровень доступа для - Зароботок"; } if (isset($_POST['status'])) { $output['status'] = $_POST['status']; } else { $error[] = "Необходимо выбрать уровень доступа для - Статус"; } if (isset($_POST['advert'])) { $output['advert'] = $_POST['advert']; } else { $error[] = "Необходимо выбрать уровень доступа для - Метка"; } if (isset($_POST['check'])) { $output['check'] = $_POST['check']; } else { $error[] = "Необходимо выбрать уровень доступа для - Проверить?"; } if (isset($_POST['spare'])) { $output['spare'] = $_POST['spare']; } else { $error[] = "Необходимо выбрать уровень доступа для - За запчасти"; } if (isset($_POST['order_description'])) { $output['order_description'] = $_POST['order_description']; } else { $error[] = "Необходимо выбрать уровень доступа для - Описание проблемы"; } if (isset($_POST['order_description_hidden'])) { $output['order_description_hidden'] = $_POST['order_description_hidden']; } else { $error[] = "Необходимо выбрать уровень доступа для - Комментарий(скрытый)"; } if (isset($_POST['accounter_comment'])) { $output['accounter_comment'] = $_POST['accounter_comment']; } else { $error[] = "Необходимо выбрать уровень доступа для - Комментарий бухгалтера"; } if (isset($_POST['checker_comment'])) { $output['checker_comment'] = $_POST['checker_comment']; } else { $error[] = "Необходимо выбрать уровень доступа для - Комментарий проверяющего"; } if (!$error) { $permission['pages'] = json_encode($pages); $permission['rights'] = json_encode($output); $this->_model->insert_permission($permission); if (\helpers\session::get('url')) { url::redirect(\helpers\session::get('url')); } else { url::redirect('admin/permissions'); } } } view::rendertemplate('header', $data); view::rendertemplate('admin_menu', $data); view::render('admin/permissions_add_form', $data, $error); view::rendertemplate('footer'); }