<?php /** * Classified-ads-script * * @copyright Copyright (c) Szilard Szabo * @license GPL v3 * @package Frontend */ include "./admin/include/common.php"; $r_id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; $exists = Ad::exists($r_id, array("active" => 1)); if ($exists) { $ad = Ad::get_one($r_id); if (isset($_POST['send']) && User::is_logged_in()) { $success = true; $errors = array(); $p_message = strip_tags($_POST['message']); if ($p_message == '') { $success = false; array_push($errors, "Please enter your message."); } if ($p_message != '' && !preg_match('/^[\\s\\S]{0,200}$/u', $p_message)) { $success = false; array_push($errors, "The message must be no more than 200 character long."); } if ($success) { $userid = USER::get_id(); $username = USER::get_name(); $adid = $r_id; $report = $p_message;
<?php /** * Classified-ads-script * * @copyright Copyright (c) Szilard Szabo * @license GPL v3 * @package Frontend */ include "./admin/include/common.php"; $g_id = isset($_GET['id']) ? (int) $_GET['id'] : 0; $g_code = isset($_GET['code']) ? trim(strip_tags($_GET['code'])) : ''; $ad = Ad::get_one($g_id, array('code' => $g_code, 'active' => 1)); $ad_exists = isset($ad['id']); if ($ad_exists && isset($_POST['extension'])) { $success = true; $errors = array(); $p_extension = (int) $_POST['extension']; if ($p_extension < 1) { $success = false; array_push($errors, "Please enter extension."); } if ($p_extension != '' && !preg_match('/^[0-9]{0,10}$/', $p_extension)) { $success = false; array_push($errors, "The format of extension is incorrect."); } if ($success) { Ad::update($g_id, array('extend' => $p_extension), $g_code); } } include "./templates/ad-extension.php";
array_push($errors, "No region selected."); } if ($p_region != '' && !preg_match('/^[0-9]{0,10}$/', $p_region)) { $success = false; array_push($errors, "The region is incorrect."); } if ('' != $p_webpage && 0 !== strpos($p_webpage, 'http://')) { $p_webpage = 'http://' . $p_webpage; } if ($p_webpage != '' && !preg_match('/^((http|https):\\/\\/)?[a-z0-9]+([\\-\\.]{1}[a-z0-9]+)*\\.[a-z]{2,5}((:[0-9]{1,5})?\\/.*)?$/i', $p_webpage)) { $success = false; array_push($errors, "The format of webpage address is incorrect."); } if (isset($p_picture) && isset($p_picture['name']) && $p_picture['name'] != '') { list($postedon_year, $postedon_month, $postedon_day) = explode('-', $ad['postedon']); $picture_path = "{$upload_path}/{$postedon_year}/{$postedon_month}/{$postedon_day}/picture"; $thumb_path = "{$upload_path}/{$postedon_year}/{$postedon_month}/{$postedon_day}/thumb"; include "./admin/include/picture-upload.php"; } else { $p_picture = ''; } if ($success) { $fields = array('name' => $p_name, 'telephone' => $p_telephone, 'title' => $p_title, 'description' => $p_description, 'category' => $p_category, 'price' => $p_price, 'city' => $p_city, 'region' => $p_region, 'webpage' => $p_webpage, $g_code); if ($p_picture != '' || $p_del_picture > 0) { $fields['picture'] = $p_picture; } Ad::update($g_id, $fields); $ad = Ad::get_one($g_id); } } include "./templates/ad-modification.php";
<?php /** * Classified-ads-script * * @copyright Copyright (c) Szilard Szabo * @license GPL v3 * @package Frontend */ include "./admin/include/common.php"; $g_id = $_GET['id']; $ad = Ad::get_one($g_id, array("active" => 1)); $exists = isset($ad['id']); include "./templates/ad-print.php";