<?php

/******************************************************************************
 *
 *	PROJECT: Flynax Classifieds Software
 *	VERSION: 4.0
 *	LISENSE: http://www.flynax.com/license-agreement.html
 *	PRODUCT: General Classifieds
 *	
 *	FILE: RECENTLY_ADDED.INC.PHP
 *
 *	This script is a commercial software and any kind of using it must be 
 *	coordinate with Flynax Owners Team and be agree to Flynax License Agreement
 *
 *	This block may not be removed from this file or any other files with out 
 *	permission of Flynax respective owners.
 *
 *	Copyrights Flynax Classifieds Software | 2012
 *	http://www.flynax.com/
 *
 ******************************************************************************/

$rlXajax -> registerFunction( array( 'loadRecentlyAdded', $rlListings, 'ajaxloadRecentlyAdded' ) );

/* get requested type */
foreach ($rlListingTypes -> types as $type)
{
	$default_type = !$default_type ? $type['Key'] : $default_type;
	if ( isset($_GET[$type['Key']]) )
	{
		$requested_type = $type['Key'];
		break;
	}
}

$default = $_SESSION['recently_added_type'] ? $_SESSION['recently_added_type'] : $default_type;
$requested_type = $requested_type ? $requested_type : $default;
$_SESSION['recently_added_type'] = $requested_type;
$rlSmarty -> assign_by_ref('requested_type', $requested_type);

$pInfo['current'] = (int)$_GET['pg'];

/* get listings */
$listings = $rlListings -> getRecentlyAdded($pInfo['current'], $config['listings_per_page'], $requested_type);
$rlSmarty -> assign_by_ref('listings', $listings);

$pInfo['calc'] = $rlListings -> calc;
$rlSmarty -> assign_by_ref( 'pInfo', $pInfo );

$rlHook -> load('listingsBottom');