/** * define page title and load template files */ public function index() { $data['title'] = 'Welcome'; View::rendertemplate('header', $data); View::render('welcome/welcome', $data); View::rendertemplate('footer', $data); }
public function index() { //tipo de busqueda para el form $searchtype = 'sales'; //check searchtype session, load data if not empty for form if (!empty($_SESSION[$searchtype])) { $data['project_id'] = $_SESSION[$searchtype]["project_id"]; } // SEO $data['title'] = Language::show('title', 'gestion', $_SESSION['site_lang']); $data['meta_description'] = Language::show('meta_description', 'gestion', $_SESSION['site_lang']); $data['meta_keywords'] = Language::show('meta_keywords', 'gestion', $_SESSION['site_lang']); $data['sitename_before'] = "N"; //form $data['projects_row'] = $this->_model_f->fetchProjects($_SESSION['site_lang']); $data['locations_rentals_result_row'] = $this->_model_f->fetchLocations($_SESSION['site_lang'], 'rentals', $data['project_id']); $data['locations_sales_result_row'] = $this->_model_f->fetchLocations($_SESSION['site_lang'], 'sales'); //type of search in form, default selected: sales $data['searchtype'] = 'rentals'; //title for de hover in navbar $data['title_page'] = "gestion"; // URL change lang $data['lang_var'] = "index"; // Testimonials $data['testimonials'] = $this->_model_t->fetchTestimonials('Y', $_SESSION['site_lang'], 3, 5); //render views View::rendertemplate('header', $data); View::render('gestion/gestion', $data); View::rendertemplate('footer', $data); //remove search type form unset($_SESSION[$searchtype]); }
public function index() { //seo $data['title'] = Language::show('title', 'welcome', $_SESSION['site_lang']); $data['meta_description'] = Language::show('meta_description', 'welcome', $_SESSION['site_lang']); $data['meta_keywords'] = Language::show('meta_keywords', 'welcome', $_SESSION['site_lang']); $data['sitename_before'] = "Y"; //columns rentals and sales $data['rentals_row'] = $this->_model->fetchFeaturedRentals($_SESSION['site_lang']); $data['sales_row'] = $this->_model->fetchFeaturedSales($_SESSION['site_lang']); //form $data['projects_row'] = $this->_model_f->fetchProjects($_SESSION['site_lang']); $data['locations_rentals_result_row'] = $this->_model_f->fetchLocations($_SESSION['site_lang'], 'rentals', $_SESSION['rentals']["project_id"]); $data['locations_sales_result_row'] = $this->_model_f->fetchLocations($_SESSION['site_lang'], 'sales'); //type of search in form, default selected: rentals $data['searchtype'] = "rentals"; //title for hover in navbar $data['title_page'] = "welcome"; //testimonials $data['testimonials'] = $this->_model_t->fetchTestimonials('Y', $_SESSION['site_lang'], 0, 5); //render views View::rendertemplate('header', $data); View::render('welcome/welcome', $data); View::rendertemplate('footer', $data); }
public function index() { $data['title'] = "Подобрать"; $data['breadcrumbs'] = array(); $data['breadcrumb'][] = array('text' => 'Заказы', 'href' => '/'); $data['statuses'] = $this->_model->show_statuses(); if (isset($_GET['submit'])) { //?start-date=03.02.2015&end-date=17.02.2015&city=1&worker=2&status=1 $pick_data[':user_id'] = $this->user_id; if (preg_match("/^\\d{2}\\.\\d{2}\\.\\d{4}\$/", $_GET['start-date'])) { $start_date = date("Y-m-d", strtotime($_GET['start-date'])); $pick_data[':start_date'] = $start_date . " 00:00:00"; } if (preg_match("/^\\d{2}\\.\\d{2}\\.\\d{4}\$/", $_GET['end-date'])) { $end_date = date("Y-m-d", strtotime($_GET['end-date'])); $pick_data[':end_date'] = $end_date . " 23:59:59"; } if (preg_match('/^\\d+$/', $_GET['status'])) { $status = $_GET['status']; $pick_data[':status'] = $status; } if ($pick_data) { $data['orders'] = $this->_model->pick_orders($pick_data); \helpers\session::set('url', substr($_SERVER['REQUEST_URI'], 1)); } } view::rendertemplate('header', $data); view::rendertemplate('user_menu', $data); view::render('pick', $data, $error); view::rendertemplate('footer'); }
/** * load a 404 page with the error message */ public function index() { header("HTTP/1.0 404 Not Found"); $data['title'] = '404'; $data['error'] = $this->_error; View::rendertemplate('header', $data); View::render('error/404', $data); View::rendertemplate('footer', $data); }
public function index() { $data['title'] = 'ЧаВо'; $data['breadcrumbs'] = array(); $data['faq'] = $this->_model->get_faq(); view::rendertemplate('header', $data); view::rendertemplate('user_menu', $data); view::render('faq', $data, $error); view::rendertemplate('footer'); }
public function index() { $data['pages'] = json_decode($this->_rights[0]->pages); $data['title'] = 'Архив'; $data['orders'] = $this->_model->get_archive(); $data['cities'] = $this->_model->show_cities(); $data['workers'] = $this->_model->show_workers(); $data['statuses'] = $this->_model->show_statuses(); view::rendertemplate('header', $data); view::rendertemplate('admin_menu', $data); view::render('admin/archive', $data, $error); view::rendertemplate('footer'); }
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 index() { $data['pages'] = json_decode($this->_rights[0]->pages); $data['rights'] = json_decode($this->_rights[0]->rights); $data['acl'] = $this->_rights[0]->acl; $data['title'] = "Подобрать"; $data['breadcrumbs'] = array(); $data['breadcrumb'][] = array('text' => 'Главная', 'href' => '/admin/'); $data['breadcrumb'][] = array('text' => 'Заказы', 'href' => '/admin/orders/'); //$data['orders'] = $this->_model->pick_orders($); $data['cities'] = $this->_model->show_cities(); $data['workers'] = $this->_model->show_workers(); $data['statuses'] = $this->_model->show_statuses(); if (isset($_GET['submit'])) { //?start-date=03.02.2015&end-date=17.02.2015&city=1&worker=2&status=1 $pick_data = array(); if (preg_match("/^\\d{2}\\.\\d{2}\\.\\d{4}\$/", $_GET['start-date'])) { $start_date = date("Y-m-d", strtotime($_GET['start-date'])); $pick_data[':start_date'] = $start_date . " 00:00:00"; } if (preg_match("/^\\d{2}\\.\\d{2}\\.\\d{4}\$/", $_GET['end-date'])) { $end_date = date("Y-m-d", strtotime($_GET['end-date'])); $pick_data[':end_date'] = $end_date . " 23:59:59"; } if (preg_match('/^\\d+$/', $_GET['city'])) { $city = $_GET['city']; $pick_data[':city'] = $city; } if (preg_match('/^\\d+$/', $_GET['worker'])) { $pick_data[':worker'] = $_GET['worker']; } if (preg_match('/^\\d+$/', $_GET['status'])) { $status = $_GET['status']; $pick_data[':status'] = $status; } $data['orders_stat'] = $this->_model->orders_stat($pick_data); $data['orders'] = $this->_model->pick_orders($pick_data); \helpers\session::set('url', substr($_SERVER['REQUEST_URI'], 1)); } view::rendertemplate('header', $data); view::rendertemplate('admin_menu', $data); view::render('admin/pick', $data, $error); view::rendertemplate('footer'); }
public function login() { $session = \helpers\session::id(); if ($this->_model->get_session($session)) { url::redirect(''); } $data['title'] = 'Вход'; if (!empty($_POST)) { //print_r($_POST); //exit; if (!isset($_POST['captcha']) || empty($_POST['captcha'])) { $error[] = 'Введите данные с каринки'; } else { $captcha = new \helpers\raincaptcha(); if (!$captcha->checkAnswer($_POST['captcha'])) { $error[] = 'Некорректные цифры с картинки'; } } if (!isset($_POST['login']) || empty($_POST['login'])) { $error[] = 'Введите логин'; } else { $username = $_POST['login']; } if (!isset($_POST['password']) || empty($_POST['password'])) { $error[] = 'Введите пароль'; } else { $password = $_POST['password']; } if (\helpers\password::verify($password, $this->_model->getLogin($username)) == 0) { $error[] = 'Неверные логин или пароль'; } if (!$error) { $data = array('session' => $session); $where = array('login' => $username); $this->_model->setSession($data, $where); url::redirect(''); } } view::rendertemplate('header', $data); view::render('login', $data, $error); view::rendertemplate('footer'); }
public function index() { $data['title'] = 'Поиск'; $data['breadcrumbs'] = array(); $data['breadcrumb'][] = array('text' => 'Заказы', 'href' => '/'); if (isset($_GET['keyword'])) { //$keyword = preg_replace('/\D+/', '', trim(stripslashes(strip_tags(urldecode($_GET['keyword']))))); $keyword = str_replace('-', '', trim(stripslashes(strip_tags(urldecode($_GET['keyword']))))); $data['search'] = $this->_model->search($keyword, $this->user_id); if (!empty($_GET['keyword'])) { \helpers\session::set('url', substr($_SERVER['REQUEST_URI'], 1)); } else { \helpers\session::pull('url'); } } view::rendertemplate('header', $data); view::rendertemplate('user_menu', $data); view::render('search', $data, $error); view::rendertemplate('footer'); }
public function login() { $session = \helpers\session::id(); if ($this->_model->get_session($session)) { url::redirect('admin'); } $data['title'] = 'Админка'; if (!empty($_POST)) { $username = $_POST['login']; $password = $_POST['password']; if (\helpers\password::verify($password, $this->_model->getLogin($username)) == 0) { $error[] = 'Неверные логин или пароль'; } else { $data = array('session' => $session); $where = array('login' => $username); $this->_model->setSession($data, $where); url::redirect('admin'); } } view::rendertemplate('header', $data); view::render('admin/login', $data, $error); view::rendertemplate('footer'); }
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 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 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 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 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 detailRentals($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'); $sleeps = filter_input(INPUT_POST, 'sleeps'); $date_arrival = filter_input(INPUT_POST, 'date_arrival'); $date_departure = filter_input(INPUT_POST, 'date_departure'); $comment = filter_input(INPUT_POST, 'comment'); if ($name == '' || !isset($name) || $email == '' || !isset($email) || $date_arrival == '' || !isset($date_arrival) || $date_departure == '' || !isset($date_departure) || $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 .= "People: " . $sleeps . "<br>"; $message .= "Arrival date: " . $date_arrival . "<br>"; $message .= "Departure date: " . $date_departure . "<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->fetchRentalsDetails($item_id, "Y", $_SESSION['site_lang']); //title for de hover in navbar $data['title_page'] = "location"; //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'] = "Rentals - " . $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'] = "N"; //Comments $data['comments'] = $this->_model_c->fetchRentalsComments($item_id, 0, 0, 'Y'); $data['replys'] = $this->_model_c->fetchRentalsReply(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 Rental 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('rentals_id' => $item_id, 'name' => $name, 'email' => $email, 'comment' => $comment, 'date_submit' => $date, 'online' => 'N'); $this->_model_c->insert_comments('rental_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 Rental 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('rental_comment_id' => $id_reply, 'name' => $name, 'email' => $email, 'comment' => $comment, 'date_submit' => $date, 'online' => 'Y'); $this->_model_c->insert_comments('rental_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->fetchRentalsPhotos($item_id, 0, 0); // Images for a property $array = array(); $i = 0; foreach ($data['images_result'] as $images_row) { $array[$i] = $this->_model->fetchRentalsPhotoDetails($images_row->photo_id); $i++; } $data['images_details_result'] = $array; if ($urlExplode[0] == "print") { View::rendertemplate('header_print', $data); View::render('rentals/rentals_print', $data); View::rendertemplate('footer_print', $data); } else { View::rendertemplate('header', $data); View::render('rentals/rentals', $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 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'); }
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'); }