Example #1
0
function act()
{
    if (eval(__MAGIC__)) {
        return $___RET_VALUE;
    }
    eval(import_module('sys', 'player', 'logger', 'input'));
    if ($mode == 'special' && $command == 'skill424_special' && $subcmd == 'wdebug') {
        wdebug();
        return;
    }
    $chprocess();
}
// Order by ID
$sql_order .= !empty($sql_order) ? ", `t1`.`id` ASC" : " ORDER BY `t1`.`id` ASC";
// Create Search Query
$search_query = "SELECT SQL_CACHE " . $idx->selectColumns("`t1`.") . " FROM `" . $idx->getTable() . "` `t1`" . " JOIN (SELECT `t1`.`id`";
// Join Geopoints
$geo_join = '';
if (!empty(Settings::getInstance()->MODULES['REW_IDX_MAPPING']) && !empty($polygons)) {
    $search_query .= ", `t2`.`Point`";
    $geo_join = " JOIN `" . REWIDX_TABLE_GEOPOINTS . "` `t2`" . " ON `t1`.`" . $idx->field('ListingMLS') . "` = `t2`.`ListingMLS`" . " AND `t1`.`" . $idx->field('ListingType') . "` = `t2`.`ListingType`";
}
$search_query .= " FROM `" . $idx->getTable() . "` `t1`" . $geo_join . (!empty($search_where) ? ' WHERE ' . $search_where : '') . ") p USING(`id`)" . $sql_order;
// Prepare Search Query with order and limit
$search_query_exec = str_replace(') p USING(`id`)', $sql_order . $sql_limit . ') p USING(`id`)', $search_query);
include_once $_SERVER['DOCUMENT_ROOT'] . '/wdebug.php';
# Debugging output to dbg.htm
wdebug($search_query_exec);
// Execute Search Query
$search_results = $db_idx->query($search_query_exec);
// Store Search Query
$_SESSION['last_search'] = $search_query;
/**
 * Save Recently Viewed Search
 */
$backend_user = Auth::get();
if ($user->isValid() && $backend_user->isValid()) {
    // Refined Search
    if (!empty($_REQUEST['refine']) || !empty($_REQUEST['quick_search'])) {
        // Searchable IDX Fields
        $search_fields = search_fields($idx);
        $search_fields = array_keys($search_fields);
        $search_fields = array_merge(array('map', 'refine', 'search_location'), $search_fields);