<?php

/**
 * market module
 *
 * @package market
 * @version 2.5.2
 * @author CMSWorks Team
 * @copyright Copyright (c) CMSWorks.ru, littledev.ru
 * @license BSD
 */

defined('COT_CODE') or die('Wrong URL');

$id = cot_import('id', 'G', 'INT');

$item = $db->query("SELECT m.*, u.* FROM $db_market AS m LEFT JOIN $db_users AS u ON u.user_id=m.item_userid WHERE item_id=" . (int)$id)->fetch();
if ($item['item_id'] == (int)$id)
{
	$r_url = (empty($item['item_alias'])) ?
		cot_url('market', 'c='.$item['item_cat'].'&id='.$id, '', true) : cot_url('market', 'c='.$item['item_cat'].'&al='.$item['item_alias'], '', true);

	cot_redirect($r_url);
	exit;
} else {
  cot_die_message(404, TRUE);
}