<?php

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

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

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

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

if($prjoffer > 0) {
  $prjoffer = $db->query("SELECT * FROM $db_projects_offers as o LEFT JOIN $db_projects as p ON p.item_id=o.offer_pid
    WHERE offer_id=".$prjoffer.' AND item_userid='.$usr['id'].' LIMIT 1')->fetch();
  if($prjoffer['offer_id'] > 0) {
    $id = $prjoffer['offer_userid'];
    $to = $id;
    $sendurl = cot_url('ds', 'm=send&a=send&offer='.$prjoffer['offer_id']);
  }
} else {
  $prjoffer = array();
}