<?php
/* ====================
[BEGIN_COT_EXT]
Hooks=module
[END_COT_EXT]
==================== */

/**
 * Dialog System main
 * @version 2.2
 * @package DS
 * @copyright (c) Alexeev Vlad (http://cmsworks.ru/users/alexvlad)
 */

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

define('COT_DS', true);
$env['location'] = 'dialogs';

if(!$usr['id']) cot_redirect(cot_url('login'));

require_once cot_incfile('extrafields');
require_once cot_incfile('users', 'module');
require_once cot_incfile('uploads');

require_once cot_incfile('ds', 'module');
require_once cot_langfile('ds', 'module');

if($m == 'modersend' && !in_array($usr['maingrp'], $cfg['ds']['supportinfo']['modergroups'])) $m = 'list';

if (!in_array($m, array('send', 'dialog', 'ajax', 'delete', 'impotrant', 'modersend')))
{
	$m = 'list';
}

if($m == 'dialog') {
  if(cot_import('al', 'G', 'TXT') == 'support') $m = 'dialog_support';
}

require_once cot_incfile('ds', 'module', $m);