<?php include 'class/includes.php'; $service = Service::getInstance(); $view = new Savant3(); $view->setPath('template', array(TPL_PATH)); $view->stylesheet = 'content.css'; $view->pushToQueue('header.tpl.php'); $error = ''; $content = ''; //echo $_GET['name']; if (preg_match('/^([A-Za-z]{1,20})$/', $_GET['name'])) { //([A-Za-z]{1,20}) $content = $service->get_content_by_name($_GET['name']); if (!is_null($content) && is_array($content)) { $view->post_breadcrumb = $content['title']; $content = $content['text']; } else { $error = LANG_ER_NO_DATA; } } elseif (chkid($_GET['id'])) { $id = $_GET['id']; try { $content_list = $service->get_content_list($id); if (count($content_list) == 1) { $view->post_breadcrumb = $content_list[0]['title']; $content = $content_list[0]['text']; } else { $error = LANG_ER_NO_DATA; } } catch (Exception $e) {
if (ctype_digit($_POST['page']) && $_POST['page'] > 0) { $page = $_POST['page']; } else { $page = 1; } list($view->ad_list, $total_ads_found) = $service->get_ad_list_by_search($city_id, $cat_id, $search_term, $field_list, $page); $view->page = $page; $view->total_pages = (int) ceil($total_ads_found / (int) CONF_PAGE_LIMIT); //$view->search_term=$search_term;//for search paging $view->field_list = $field_list; //for search paging $view->city = $service->get_city_by_id($city_id); if ($cat_id != null) { $view->category_path = $service->get_category_path($cat_id); $view->category = $service->get_category_by_id($cat_id); } $view->post_breadcrumb = LANG_SEARCH_POST_BREADCUMB; $view->title = LANG_SEARCH_POST_BREADCUMB; $view->pushToQueue('header.tpl.php'); $view->pushToQueue('breadcrumbs.tpl.php'); $view->pushToQueue('search.tpl.php'); $view->pushToQueue('ad_list.tpl.php'); $view->pushToQueue('search_paging.tpl.php'); $view->pushToQueue('footer.tpl.php'); } else { $view->pushToQueue('header.tpl.php'); $view->error_message = LANG_ER_WRONG_FORMAT; $view->pushToQueue('error_message.tpl.php'); $view->pushToQueue('footer.tpl.php'); } $view->displayQueue();
<?php include 'class/includes.php'; $service = Service::getInstance(); $view = new Savant3(); $view->setPath('template', array(TPL_PATH)); session_start(); $view->pushToQueue('header.tpl.php'); if (chkid($_COOKIE['city_id'])) { $city_id = $_COOKIE['city_id']; $view->city = $service->get_city_by_id($city_id); } $view->post_breadcrumb = LANG_FOOTER_CONTACT_US; $view->pushToQueue('breadcrumbs.tpl.php'); $view->pushToQueue('search.tpl.php'); if (isset($_POST['action']) && $_POST['action'] == 'submit') { //validation $error = false; $error_list = array(); $text = $_POST['text']; if (!isset($text) || trim($text) == '') { $error = true; $error_list['textempty'] = LANG_POST_EM_EMPTY_TEXT; } else { if (mb_strlen($text, CONF_ENC) > AD_TEXT_LIMIT) { $error = true; $error_list['textlimit'] = sprintf(LANG_POST_EM_AD_IS_BIG, AD_TEXT_LIMIT); } } include 'securimage/securimage.php'; //check captcha!
setcookie('city_id', $city_id, time() + 60 * 60 * 24 * 365 * 10, '/'); } elseif (isset($_COOKIE['city_id'])) { $city_id = $_COOKIE['city_id']; } if (preg_match('/^([A-Za-z0-9_-]{1,20})$/', $_GET['cat_name'])) { $cat_id = $service->get_cat_id_by_name($_GET['cat_name']); $view->category = $service->get_category_by_id($cat_id); } if (isset($city_id)) { $view->city = $service->get_city_by_id($city_id); } if (!isset($city_id) || isset($_GET['action']) && $_GET['action'] == 'cities') { //cities $view->city_list = $service->get_city_list(); $view->stylesheet = 'category_list.css'; $view->pushToQueue('header.tpl.php'); $view->pushToQueue('city_list.tpl.php'); $view->keywords = LANG_KEYWORDS_CITIES; } elseif (!isset($cat_id)) { //list of categories MAIN SCREEN!!! $view->category_list = $service->get_category_list_with_ad_count($city_id); $view->stylesheet = 'category_list.css'; $view->pushToQueue('header.tpl.php'); $view->pushToQueue('breadcrumbs.tpl.php'); $view->pushToQueue('search.tpl.php'); $view->city_list = $service->get_city_list(); $view->pushToQueue('category_list.tpl.php'); $view->pushToQueue('city_list_compact.tpl.php'); } else { //view category $view->category_path = $service->get_category_path($cat_id);
$view->setPath('template', array(TPL_PATH)); $view->stylesheet = 'post.css'; if (preg_match('/^([A-Za-z_-]{1,20})$/', $_GET['city_name'])) { $city_id = $service->get_city_id_by_name($_GET['city_name']); $view->city = $service->get_city_by_id($city_id); } if (preg_match('/^([A-Za-z0-9_-]{1,20})$/', $_GET['cat_name'])) { $cat_id = $service->get_cat_id_by_name($_GET['cat_name']); $view->category = $service->get_category_by_id($cat_id); } if (isset($city_id) && ctype_digit($city_id)) { setcookie('city_id', $city_id, time() + 60 * 60 * 24 * 365 * 10, '/'); } else { } $view->title = LANG_POST_BC; $view->pushToQueue('header.tpl.php'); if (isset($_POST['action']) && $_POST['action'] == 'submit' && (chkid($city_id) || isset($_COOKIE['city_id']) && ctype_digit($_COOKIE['city_id']))) { $error = false; $error_messages = array(); $anonymize = htmlentities(text_only(trim($_POST['anonymize'])), ENT_QUOTES, CONF_ENC, false); $subject = htmlentities(text_only(trim($_POST['subject'])), ENT_QUOTES, CONF_ENC, false); //$str = mb_convert_encoding($str, ‘UTF-8', ‘UTF-8'); $location = htmlentities(text_only(trim($_POST['location'])), ENT_QUOTES, CONF_ENC, false); $text = $_POST['text']; $text = $purifier->purify($text); // $text=htmlentities($text,ENT_QUOTES,'UTF-8'); $email = htmlentities(text_only(trim($_POST['email'])), ENT_QUOTES, CONF_ENC, false); $cat_id = htmlentities(text_only(trim($_POST['cat_id'])), ENT_QUOTES, CONF_ENC, false); $city_id = htmlentities(text_only(trim($_COOKIE['city_id'])), ENT_QUOTES, CONF_ENC, false); //change to vars from dir $code = md5(uniqid(rand(), true));
if (!$error) { $text = $_POST['text']; $text = text_only($text); $email = $_POST['email']; //echo '!'.$text; $ad = $service->get_ad_by_id($_POST['ad_id']); $data = array('text' => $text, 'email' => $email, 'subject' => $ad['subject'], 'ad_id' => $ad['id'], 'user_id' => $ad['user_id']); $ms = send_email_reply_to_ad($data); if ($ms) { echo 'success'; } else { $error = true; $error_messages['general_error'] = LANG_ER_ERROR; } // echo $_POST['text'].$_POST['email']; //echo LANG_AD_SM_SUCCESS; } if ($error) { $view->error_list = $error_messages; $view->pushToQueue('ad_send_message_error_message_list.tpl.php'); // echo '<div id="post-ad-form-error-messages-box">'; // foreach ($error_messages as $key=>$value) { // echo '<span class="error_message" >'.$value.'</span><br/>'; // } // echo '</div>'; } $view->displayQueue(); } else { die('fail'); //$view->pushToQueue('ad_send_message.tpl.php'); }
<?php include 'class/includes.php'; $service = Service::getInstance(); session_start(); $view = new Savant3(); $view->setPath('template', array(TPL_PATH)); $view->pushToQueue('header.tpl.php'); if (isset($_GET['code']) && ctype_alnum($_GET['code']) && isset($_GET['id']) && ctype_digit($_GET['id'])) { if (isset($_GET['action']) && ctype_alpha($_GET['action'])) { $action = $_GET['action']; } else { $action = null; } $code = $_GET['code']; $id = $_GET['id']; $ad = $service->get_ad_by_id($id); if (!empty($ad) && is_array($ad) && $ad['code'] == $code && $ad['active'] == 1) { $city_id = $ad['city_id']; $cat_id = $ad['cat_id']; switch ($action) { case 'edit': case 'submit': if ($action == 'submit') { //do validation and save $error = false; $error_list = array(); $subject = htmlentities(text_only(trim($_POST['subject'])), ENT_QUOTES, CONF_ENC, false); //$str = mb_convert_encoding($str, ‘UTF-8', ‘UTF-8'); $location = htmlentities(text_only(trim($_POST['location'])), ENT_QUOTES, CONF_ENC, false); $text = $_POST['text'];
<?php include 'class/includes.php'; $service = Service::getInstance(); $view = new Savant3(); $view->setPath('template', array(TPL_PATH)); if (preg_match('/^([A-Za-z_-]{1,20})$/', $_GET['city_name'])) { $city_id = $service->get_city_id_by_name($_GET['city_name']); setcookie('city_id', $city_id, time() + 60 * 60 * 24 * 365 * 10, '/'); } if (preg_match('/^([A-Za-z0-9_-]{1,20})$/', $_GET['cat_name'])) { $cat_id = $service->get_cat_id_by_name($_GET['cat_name']); $view->category = $service->get_category_by_id($cat_id); } if (chkid($cat_id) && chkid($city_id)) { $view->category = $service->get_category_by_id($cat_id); $view->city = $service->get_city_by_id($city_id); $view->ad_list = $service->get_ad_list_for_rss($city_id, $cat_id); header("Content-Type: application/xml; charset=utf-8\r\n"); echo '<?xml version="1.0" encoding="' . CONF_ENC . '" ?>'; $view->pushToQueue('rss.tpl.php'); $view->displayQueue(); } else { header('Status:404'); //echo '!'; }
<?php // sleep(2); include 'class/includes.php'; $error_list = array(); $ad_id = htmlentities(text_only(trim($_POST['ad_id']), ENT_QUOTES, CONF_ENC, false)); //$location=htmlentities(text_only(trim($_POST['location'])),ENT_QUOTES,CONF_ENC,false); $friend_email = text_only(trim($_POST['friend_email'])); $user_email = text_only(trim($_POST['user_email'])); $action = htmlentities(text_only(trim($_POST['action']), ENT_QUOTES, CONF_ENC, false)); $view = new Savant3(); $view->setPath('template', array(TPL_PATH)); if ($action == 'load') { $view->value_list = array('ad_id' => $ad_id, 'action' => 'submit'); $view->pushToQueue('ad_email_friend.tpl.php'); } elseif ($action == 'submit') { if (empty($friend_email)) { $error_list[] = LANG_AD_EF_F_EMAIL_EMPTY; } elseif (!isemail($friend_email)) { $error_list[] = LANG_AD_EF_F_EMAIL_WRONG_FORMAT; } if (!empty($user_email) && !isemail($user_email)) { $error_list[] = LANG_AD_EF_EMAIL_WRONG_FORMAT; } if (!chkid($ad_id)) { $error_list[] = 'a'; } if (empty($error_list)) { // if (ad_email_friend($ad_id,$friend_email,$user_email)) { // $view->message=LANG_AD_EF_SUCCESS; // $view->pushToQueue('message.tpl.php');