<?php

/**
 * [BEGIN_COT_EXT]
 * Hooks=certificates.edit.update.error
 * [END_COT_EXT]
 */

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

if($id > 0 && !$filefound) {
  $remove_files = cot_import('remove_files', 'P', 'ARR');

  if(count($remove_files) == 0) {
    require_once cot_incfile('mavatars', 'plug');

  	$mavatar = new mavatar('certificates', '', $id, 'edit');
    $mavatars_tags = $mavatar->tags();

    foreach($mavatars_tags as $mavtg) {
      if(cot_mavatar_is_photo($mavtg['FILEEXT'])) {
        $filefound = true;
      }
    }
  }
}