<?php
/* ====================
  [BEGIN_COT_EXT]
  Hooks=market.edit.hide
  [END_COT_EXT]
  ==================== */

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

require_once cot_incfile('ads', 'plug');
global $db_ads, $sys;

$adsbyuser = $db->query("SELECT * FROM $db_ads WHERE item_userid>0 AND item_marketid=".$id.' AND item_expire>'.$sys['now'].' AND item_paused=0')->fetchAll();
foreach($adsbyuser as $ad) {
  $db->update($db_ads,  array('item_expire' => 0, 'item_paused' => ($ad['item_expire'] - $sys['now'])), "item_id=".(int)$ad['item_id']);
}