<?php
defined('COT_CODE') or die('Wrong URL');

$return['success'] = false;

require_once cot_incfile('mavatars', 'plug');

$ext = cot_import('ext', 'P', 'TXT');
$code = cot_import('code', 'P', 'TXT');
$id = cot_import('file_id', 'P', 'INT');

if($id > 0) {
  $mavatar = new mavatar($ext, '', $code, (empty($code) ? 'edit' : ''));
  $return['tags'] = $mavatar->tags();
  foreach($mavatar->tags() as $mav) {
    if($mav['ID'] == $id) {
      $mavatar->delete_mavatar_byid($id);
      $return['success'] = true;
      break;
    }
  }
}

?>
