<?php

/**
 * [BEGIN_COT_EXT]
 * Hooks=ds.ajax.send.done
 * [END_COT_EXT]
 */

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

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

$mavatar = new mavatar('ds', $chatid, $pm['id'], 'edit');
$mavatar->update();
$mavatar->upload();

$mavatars_tags = $mavatar->tags();

$mavtgs = array();
$mavtgs['MAVATAR'] = array();
$mavtgs['MAVATARCOUNT'] = 0;

foreach($mavatars_tags as $mavtg) {
  $mavtg['FILEEXTICON'] = 'doc';
  if(cot_mavatar_is_photo($mavtg['FILEEXT'])) {
    $mavtg['FILEEXTICON'] = 'image';
  } elseif(cot_mavatar_is_audio($mavtg['FILEEXT'])) {
    $mavtg['FILEEXTICON'] = 'audio';
  } elseif($mavtg['FILEEXT'] == 'zip' || $mavtg['FILEEXT'] == 'rar') {
    $mavtg['FILEEXTICON'] = 'zip';
  }
  $mavtgs['MAVATAR'][] = $mavtg;
  $mavtgs['MAVATARCOUNT']++;
}

$t->assign('DS_MAVATARS', $mavtgs);

