Ejemplo n.º 1
0
 function index()
 {
     $var = func_get_args()[0];
     if (!empty($var)) {
         $r = StaticContent::getStaticPage($var);
         return $r['text'];
     } else {
         View::render404();
     }
 }
Ejemplo n.º 2
0
$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;
            Report::create(array('ad_id' => $adid, 'user_id' => $userid, 'message' => $report));
            $content = StaticContent::get_content('abuse-report');
            eval("\$content = \"{$content}\";");
            print "content: " . $content;
            global $admin_mail;
            mail($admin_mail, 'Abuse report', $content, "From: " . $noreply);
        }
    }
}
include "./templates/ad-report.php";
        if (User::exists(array('email' => $p_email))) {
            $success = false;
            array_push($errors, "This email has already registered in our system.");
        }
    }
    if ($success) {
        $createdon = date("Y-m-d H:i:s", time());
        $ipaddr = $_SERVER['REMOTE_ADDR'];
        $code = md5(uniqid(rand(), true));
        $last = User::create(array('name' => $p_name, 'username' => $p_username, 'email' => $p_email, 'password' => $p_password, 'telephone' => $p_telephone, 'city' => $p_city, 'region' => $p_region, 'category' => $p_category, 'webpage' => $p_webpage, 'active' => $p_active, 'createdon' => $createdon, 'ipaddr' => $ipaddr, 'code' => $code));
        if ($p_send_activation_email) {
            $userid = $last;
            $email = $p_email;
            $username = $p_username;
            $password = $p_password;
            $message = StaticContent::get_content('user-registration-email');
            eval("\$message = \"{$message}\";");
            mail($email, "Registration", $message, "From: " . $noreply);
            print $message;
        }
    }
}
include "page-header.php";
?>

<div id="wrapper">

	<?php 
include "page-left.php";
?>
            $last = Ad::create(array('user_id' => User::get_id(), 'name' => $p_name, 'email' => $p_email, 'telephone' => $p_telephone, 'title' => $p_title, 'description' => $p_description, 'picture' => $p_picture, 'category' => $p_category, 'price' => $p_price, 'city' => $p_city, 'region' => $p_region, 'expiry' => $expiry, 'webpage' => $p_webpage, 'code' => $code, 'ipaddr' => $ipaddr, 'postedon' => $postedon, 'lastmodified' => $postedon));
            if (User::is_logged_in()) {
                Ad::activate($last);
            } else {
                if (!($user_exists = User::exists(0, array('email' => $p_email)))) {
                    $p_em = explode('@', $p_email);
                    $username = substr($p_em[0], 0, 6);
                    $active = 0;
                    $createdon = date("Y-m-d H:i:s", time());
                    $password = substr($code, 0, 6);
                    $userid = User::create(array('email' => $p_email, 'username' => $username, 'password' => $password, 'name' => $p_name, 'active' => $active, 'createdon' => $createdon, 'ipaddr' => $ipaddr, 'code' => $code));
                    $registration_message = StaticContent::get_content('user-registration-email');
                    eval("\$registration_message = \"{$registration_message}\";");
                } else {
                    $user = User::get_one(0, array('email' => $p_email));
                    $username = $user['username'];
                }
                $ad_activation_message = StaticContent::get_content('ad-activation-email');
                eval("\$ad_activation_message = \"{$ad_activation_message}\";");
                mail($p_email, "Ad activation (Id: {$last})", $ad_activation_message, "From: " . $noreply);
                debug($ad_activation_message);
                if (!$user_exists) {
                    mail($p_email, "Registration", $registration_message, "From: " . $noreply);
                    debug($registration_message);
                }
            }
        }
    }
}
$curr_page = "post-an-ad";
include "./templates/ad-placement.php";
    header('Location: index.php');
}
if (isset($_POST['send'])) {
    $p_email = trim(strip_tags($_POST['email']));
    $success = true;
    $errors = array();
    if ($p_email == '') {
        $success = false;
        array_push($errors, "Pleas enter your email");
    }
    if ($p_email != '' && !preg_match('/^[\\.\\+_a-z0-9-]+@([0-9a-z][0-9a-z-]*[0-9a-z]\\.)+[a-z]{2}[mtgvu]?$/i', $p_email)) {
        $success = false;
        array_push($errors, "Your email is formated incorrectly.");
    }
    if ($success) {
        $user = User::get_all(array('email' => $p_email), '', 1);
        $exists = isset($user[0]['id']);
        if (!$exists) {
            $success = false;
            array_push($errors, "Your email has not been registered in our system.");
        } else {
            $user = $user[0];
            $username = $user['username'];
            $password = $user['password'];
            $message = StaticContent::get_content('user-lost-pasword-email');
            eval("\$message = \"{$message}\";");
            mail($p_email, "Password reminder", $message, "From: " . $noreply);
        }
    }
}
include "./templates/user-lost-password.php";
        array_push($errors, "Invalid title!");
    }
    if ($p_title == '') {
        $success = false;
        array_push($errors, "The title field is required !");
    }
    if ($p_slug != '' && !preg_match('/^[a-zA-Z0-9_-]*$/', $p_slug)) {
        $success = false;
        array_push($errors, "Invalid slug!");
    }
    if ($p_slug == '') {
        $success = false;
        array_push($errors, "The slug field is required !");
    }
    if ($success) {
        $last = StaticContent::create(array('title' => $p_title, 'slug' => $p_slug, 'content' => $p_content));
    }
}
if (isset($_POST['static_slug_generate'])) {
    $p_title = trim($_POST['title']);
    $success = false;
    $errors = array();
    if ($p_title == '' || $p_title != '' && !preg_match('/^[\\w- ]*$/u', $p_title)) {
        $success = false;
        array_push($errors, "Invalid title!");
    } else {
        $p_slug = slug($p_title);
    }
}
include "page-header.php";
?>
Ejemplo n.º 7
0
 */
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,500}$/u', $p_message)) {
            $success = false;
            array_push($errors, "The message must be no more than 500 character long.");
        }
        if ($success) {
            $userid = USER::get_id();
            $username = USER::get_name();
            $adid = $r_id;
            $response = $p_message;
            Response::create(array('ad_id' => $adid, 'user_id' => $userid, 'message' => $response));
            $content = StaticContent::get_content('ad-response-email');
            eval("\$content = \"{$content}\";");
            mail($ad['email'], 'Response to your ad', $content, "From: " . $noreply);
        }
    }
}
include "./templates/ad-respond.php";
Ejemplo n.º 8
0
include "{$docroot}/db-expiry.php";
include "{$docroot}/db-static-content.php";
include "{$docroot}/db-user.php";
include "{$docroot}/db-user-banned.php";
include "{$docroot}/db-response.php";
include "{$docroot}/db-ad-review.php";
include "{$docroot}/db-favourite.php";
include "{$docroot}/db-user-review.php";
include "{$docroot}/db-report.php";
$db = new db();
if (!$db->connect()) {
    exit(mysql_error());
}
$categories = Category::get_tree();
$regions = Region::get_tree();
$statics = StaticContent::get_all(array(), 'id>6');
//counters
$today = date("Y-m-d", time());
$ct_fresh = Ad::count(array('active' => 1), "lastmodified>='{$today}'");
$ct_all = Ad::count(array('active' => 1));
$ct_expirys = Ad::count(array('active' => 1, "DATEDIFF(expiry,'{$today}')" => 0));
//menu and breadcumb
$menu = User::get_menu();
$current_script_name = basename($_SERVER['SCRIPT_NAME']);
if (strpos($current_script_name, '-') > 0) {
    $current_page = explode('-', $current_script_name, 2);
    if (isset($current_page[2])) {
        $current_page[1] .= '-' . $current_page[2];
    }
    //php 5.3.5 bug?? workaround
    $subpage_name = explode('.', $current_page[1]);
<?php

/**
 * Classified-ads-script
 * 
 * @copyright  Copyright (c) Szilard Szabo
 * @license    GPL v3
 * @package    Frontend
 */
include "./admin/include/common.php";
$slug = strip_tags($_GET['slug']);
$StaticContent = '';
if (StaticContent::count(array('slug' => $slug)) > 0) {
    $StaticContent = nl2br(StaticContent::get_content($slug));
}
include "./templates/static-content.php";
Ejemplo n.º 10
0
    if ($p_sender_email == '') {
        $success = false;
        array_push($errors, "Please enter your email.");
    }
    if ($p_sender_email != '' && !preg_match('/^[\\.\\+_a-z0-9-]+@([0-9a-z][0-9a-z-]*[0-9a-z]\\.)+[a-z]{2}[mtgvu]?$/i', $p_sender_email)) {
        $success = false;
        array_push($errors, "Your email is not valid.");
    }
    if ($p_recipient_email == '') {
        $success = false;
        array_push($errors, "Please enter the recipient email.");
    }
    if ($p_recipient_email != '' && !preg_match('/^[\\.\\+_a-z0-9-]+@([0-9a-z][0-9a-z-]*[0-9a-z]\\.)+[a-z]{2}[mtgvu]?$/i', $p_recipient_email)) {
        $success = false;
        array_push($errors, "The recipient email is not valid.");
    }
    if ($success) {
        $recipient = "{$p_recipient_name} ({$p_recipient_email})";
        if ($p_recipient_name == '') {
            $recipient = $p_recipient_email;
        }
        $sender = "{$p_sender_name} ({$p_sender_email})";
        if ($p_sender_name == '') {
            $felado = $p_sender_email;
        }
        $message = StaticContent::get_content('ad-sending-email');
        eval("\$message = \"{$message}\";");
        mail($p_recipient_email, "Forwarded ad", $message, "From: " . $noreply);
    }
}
include "./templates/ad-sending.php";
    if ($p_title == '') {
        $success = false;
        array_push($errors, "The title field is required !");
    }
    if ($p_slug != '' && !preg_match('/^[a-zA-Z0-9_-]*$/', $p_slug)) {
        $success = false;
        array_push($errors, "Invalid slug!");
    }
    if ($p_slug == '') {
        $success = false;
        array_push($errors, "The slug field is required !");
    }
    if ($success) {
        $update = array('title' => $p_title, 'slug' => $p_slug, 'content' => $p_content);
        StaticContent::update($g_id, $update);
        $static = StaticContent::get_one($g_id);
    }
}
include "page-header.php";
?>

<div id="wrapper">

	<?php 
include "page-left.php";
?>

	<div id="content">
			
		<form name="form_static_edit" id="form_static_edit" method="post" enctype='application/x-www-form-urlencoded' accept-charset="UTF-8" class="form">