<?php 

$diary = mysql_fetch_assoc(mysql_query("
                  SELECT n.*, 
                    (SELECT COUNT(*) FROM notes_komm AS k WHERE k.id_notes = n.id) AS comments,
                    (SELECT COUNT(*) FROM notes_count AS c WHERE c.id_notes = n.id) AS view,
                    (SELECT COUNT(*) FROM notes_like AS l WHERE l.id_notes = n.id AND l.like = '1') AS 'like',
                    (SELECT COUNT(*) FROM notes_like AS l WHERE l.id_notes = n.id AND l.like = '0') AS 'dlike'
                  FROM notes AS n WHERE n.id = " . (int) $maps['diary_id']));

$diary_name = $classDiary->get_name($diary['name'], $diary['msg']);

// Права доступа
$token = $classDiary->is_access($diary, $user_id, 'private');

if (!$token) {
    header('Location: ?f=access&s='. $maps['s'] .'&q='. $maps['search'] .'&r='. $maps['r'] .'&u='. $maps['u'] .'&id='. $maps['diary_id'] .'&act=alert');
    exit;
}

$ank = user::get_user($diary['id_user']);

$set['title'] = __('Поделиться записью/Дневники');
require H.'sys/inc/thead.php';
title();
aut();
err();
?>
<ol class="breadcrumb">
  <li><a href="/index.php"><i class="ic ic-home"></i></a></li>
  <li><a href="?"><?= __('Дневники')?></a></li>
  <li><?= __('Поделиться записью')?></li>
</ol>

<div class="alert alert-info">
  <?= $ank['icon']?> <?= $ank['link']?> <?= $ank['online']?> | 
  <a href="?f=diary&amp;s=<?= $maps['s']?>&amp;q=<?= $maps['search']?>&amp;r=<?= $maps['r']?>&amp;u=<?= $maps['u']?>&amp;zsort=<?= $maps['zsort']?>&amp;id=<?= $diary['id']?>">
    <?= $diary_name?>
  </a>
</div>

<div class="list-post" id="page-up">
  <div class="list-post-item">
    <script type="text/javascript" src="//yastatic.net/share/share.js" charset="utf-8"></script>
    Поделиться в соц. сетях
    <div id="ya_share"></div>
    <script>
    new Ya.share({
      element: 'ya_share',
      elementStyle: {
          'type' : 'none',
          'border': false,
          'quickServices': ['odnoklassniki', 'vkontakte', 'twitter', 'facebook', 'moimir']
      },
      link: 'http://<?= text($_SERVER['HTTP_HOST'])?><?= text($_SERVER['PHP_SELF'])?>?f=diary&amp;id=<?= $diary['id']?>',
      title: 'Дневник - <?= text($ank['nick'])?> - <?= $diary_name?>',
      description: '<?= text($ank['nick'])?> запись в дневнике <?= $diary_name?>',
      serviceSpecific: {
          twitter: {
              title: '#<?= $diary_name?>'
         }
      },
      theme: 'counter',
  });
  </script>
  </div>
</div>