Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as PHP by an ( 14 years ago )
<?php
// по дефолту делаем значения пустыми, чтобы все случайно не встало раком
$price['from'] = '';
$price['to'] = '';
$space['from'] = '';
$space['to'] = '';

$opt['location'] = '';
$opt['type'] = '';
$opt['rent'] = '';
$opt['rooms'] = '';

// получаем цену от и до
if ( @$_REQUEST['price_from'] ) {
    $price['from_request'] = htmlspecialchars($_REQUEST['price_from']);
    $price['from'] = '"AND:ModGoods.price:>=":"'.$price['from_request'].'",';
}

if ( @$_REQUEST['price_to'] ) {
    $price['to_request'] = htmlspecialchars($_REQUEST['price_to']);
    $price['to'] = '"AND:ModGoods.price:<=":"'.$price['to_request'].'",';
}

// получаем площадь от и до
if ( @$_REQUEST['space_from'] ) {
    $space['from_request'] = htmlspecialchars($_REQUEST['space_from']);
    $space['from'] = '"AND:ModGoods.weight:>=":"'.$space['from_request'].'",';
}

if ( @$_REQUEST['space_to'] ) {
    $space['to_request'] = htmlspecialchars($_REQUEST['space_to']);
    $space['to'] = '"AND:ModGoods.weight:<=":"'.$space['to_request'].'",';
}


// получаем район
if ( @$_REQUEST['location'] ) {
    $opt['location_request'] = htmlspecialchars($_REQUEST['location']);
    $opt['location'] = '"AND:ModGoods.location:=":"'.$opt['location_request'].'",';
}

// получаем тип объекта
if ( @$_REQUEST['object_type'] ) {
    $opt['type_request'] = htmlspecialchars($_REQUEST['object_type']);
    $opt['type_request'] = str_replace('+', ' ', $opt['type_request']);
    $opt['type'] = '"AND:ModGoods.object_type:=":"'.$opt['type_request'].'",';
}


// аренда?
if ( @$_REQUEST['rent'] ) {
    $opt['rent_request'] = htmlspecialchars($_REQUEST['rent']);
    $opt['rent'] = '"AND:ModGoods.remains:=":"'.$opt['rent_request'].'",';
}

// получаем количество комнат
if ( @$_REQUEST['rooms'] ) {
    $opt['rooms_request'] = htmlspecialchars($_REQUEST['rooms']);
    $opt['rooms'] = '"AND:ModGoods.article:=":"'.$opt['rooms_request'].'",';
}

// ------------------------------------------

// собираем запрос к фильтру
$ret = '{'.$price['from'].$price['to'].$space['from'].$space['to'].$opt['location'].$opt['type'].$opt['rent'].$opt['rooms'].'"ModGoods.remains:!=":"0"'.'}';

// ------------------------------------------

return $ret;

 

Revise this Paste

Parent: 54266
Your Name: Code Language: