//chk mod (verify if price > 0)
if($plan_info['price'] > '0') {
//end chk mod
$valid = true;
if ( $rlListings -> create( $plan_info, $data, $category_fields ) )
{
$listing_id = $rlListings -> id;
$_SESSION['add_listing']['listing_id'] = $listing_id;
$rlHook -> load('afterListingCreate');
/* tmp category controller */
if ( $_SESSION['add_listing']['tmp_id'] == $_SESSION['add_listing']['tmp_category_id'] )
{
$rlDb -> query("UPDATE `". RL_DBPREFIX ."tmp_categories` SET `Account_ID` = '{$account_info['ID']}' WHERE `ID` = '{$_SESSION['add_listing']['tmp_category_id']}' LIMIT 1");
}
else
{
$rlDb -> query("DELETE FROM `". RL_DBPREFIX ."tmp_categories` WHERE `ID` = '{$_SESSION['add_listing']['tmp_category_id']}' LIMIT 1");
}
}
//chk mod
} else {
$listings = $rlDb -> getAll("SELECT `list`.`ID`, DATEDIFF(NOW(), `list`.`Pay_date`) AS `days_published` FROM `mpt_listings` AS `list` INNER JOIN `mpt_listing_plans` AS `plan` ON `list`.`Plan_ID` = `plan`.`ID` WHERE `list`.`Account_ID` = '".$account_info['ID']."' AND `plan`.`Price` = '0' AND (DATEDIFF(NOW(), `list`.`Pay_date`) <= '365') AND `list`.`Status` = 'Active' ");
//var_dump($listings);
if(empty($listings)) {
$valid = true;
if ( $rlListings -> create( $plan_info, $data, $category_fields ) )
{
$listing_id = $rlListings -> id;
$_SESSION['add_listing']['listing_id'] = $listing_id;
$rlHook -> load('afterListingCreate');
/* tmp category controller */
if ( $_SESSION['add_listing']['tmp_id'] == $_SESSION['add_listing']['tmp_category_id'] )
{
$rlDb -> query("UPDATE `". RL_DBPREFIX ."tmp_categories` SET `Account_ID` = '{$account_info['ID']}' WHERE `ID` = '{$_SESSION['add_listing']['tmp_category_id']}' LIMIT 1");
}
else
{
$rlDb -> query("DELETE FROM `". RL_DBPREFIX ."tmp_categories` WHERE `ID` = '{$_SESSION['add_listing']['tmp_category_id']}' LIMIT 1");
}
}
} else {
$valid = false;
$errors[] = $lang['free_plan_validation'];
$rlSmarty -> assign_by_ref('errors', $errors);
}
}
//end chk mod
}
//chk mod (validation)
if($valid) {
//end chk mod
/* redirect to related controller */
$redirect = SEO_BASE;
$redirect .= $config['mod_rewrite'] ? $page_info['Path'] .'/'. $category['Path'] .'/'. $next_step['path'] .'.html' : '?page='. $page_info['Path'] .'&id='. $category['ID'] .'&step=' .$next_step['path'];
$reefless -> redirect( null, $redirect );
//chk mod (validation)
}
//end chk mod