<?php

/**
 * [BEGIN_COT_EXT]
 * Hooks=marketorders.ajax.admin_arbitrage_result
 * [END_COT_EXT]
 */

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

if($arbit['del_reviews']) {
  require_once cot_incfile('reviews', 'plug');

  $mreview = $db->query("SELECT * FROM $db_reviews WHERE item_area='market' AND item_type='review' AND item_code='".$ord['order_id']."' AND item_userid=".$ord['order_userid']." LIMIT 1")->fetch();
  $mreview_answer = ($mreview['item_id'] > 0 ? $db->query("SELECT * FROM $db_reviews WHERE item_area='market' AND item_type='review_answer' AND item_code='".$ord['order_id']."' AND item_userid=".$ord['order_seller']." LIMIT 1")->fetch() : array());

  if($mreview['item_id'] > 0) {
    $db->delete($db_reviews, 'item_id='.$mreview['item_id']);
  }
  if($mreview_answer['item_id'] > 0) {
    $db->delete($db_reviews, 'item_id='.$mreview_answer['item_id']);
  }
}

?>