<?php
/* ====================
[BEGIN_COT_EXT]
Hooks=usertags.main
[END_COT_EXT]
==================== */

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

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

$temp_array['DS_DIALOG_URL'] = '';
$temp_array['DS_DIALOG_ID'] = 0;
$temp_array['DS_DIALOG'] = 0;

$temp_array['DSBLOCK'] = 0;

if(is_array($user_data)){
  if($user_data['user_dsblock'] > 0) $temp_array['DSBLOCK'] = 1;

  if($usr['id'] != $user_data['user_id']) {
    require_once cot_incfile('ds', 'module');
    global $usr, $db_ds_dialog;
    $temp_array['DS_DIALOG_ID'] = ($usr['id'] > 0 ? cot_chat_id($usr['id'], $user_data['user_id']) : 0);
    $temp_array['DS_DIALOG_URL'] = ($temp_array['DS_DIALOG_ID'] > 0 ? cot_url('ds', 'm=dialog&id='.$temp_array['DS_DIALOG_ID']) : cot_url('ds', 'm=send&to='.$user_data['user_id']));
    $temp_array['DS_DIALOG'] = ($usr['id'] > 0 && $temp_array['DS_DIALOG_ID']) ? 1 : 0;
  }
}