<?php

/* ====================
  [BEGIN_COT_EXT]
  Hooks=ds.send.first
  [END_COT_EXT]
  ==================== */

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

require_once cot_incfile('market', 'module');

$market = cot_import('market', 'G', 'INT');
if(!$market) $market = cot_import('market', 'P', 'INT');

if($market > 0) {
  $market = $db->query("SELECT * FROM $db_market WHERE item_id=".$market.' AND item_state=0 LIMIT 1')->fetch();
  if($market['item_id'] > 0) {
    $id = $market['item_userid'];
    $to = $id;
    $sendurl = cot_url('ds', 'm=send&a=send&market='.$market['item_id']);
  }
} else {
  $market = array();
}