comments.php
См. документацию.
1 <?php
2 
3 /**
4  * @file
5  * @brief окно
6  */
7 
8 isset($user) or require $_SERVER['DOCUMENT_ROOT'] . '/page/404.php';
9 
10 if (Wrong\Start\Env::$e->HTTP_HOST != 'wrong-mvc.com') {
11  exit('<script>location.href="//wrong-mvc.com/comments";</script>');
12 }
13 
14 ?>
15 <div class="modal fade" id="<?= $basename ?>" tabindex="-1" data-backdrop="static" data-keyboard="false">
16  <div class="modal-dialog modal-xl modal-dialog-centered modal-dialog-scrollable w-100 mw-100 h-100 p-0 m-0 position-fixed" style="max-width: 100%;max-height:100%;" role="document">
17  <div class="modal-content w-100 h-100 rounded-0 border-0">
18  <div class="border-0 modal-header position-absolute rounded-0 w-100 pb-0" style="z-index:1;">
19  <button title="Закрыть" type="button" class="close" data-dismiss="modal" aria-label="Close">
20  <span aria-hidden="true">&times;</span>
21  </button>
22  </div>
23  <div class="modal-body p-0 <?= $user->id ? 'pt-5' : '' ?>"></div>
24  </div>
25  </div>
26  <script>
27  $('#<?= $basename ?> .modal-body').load('/comments #content', () => {
28  AnyComment = window.AnyComment || [];
29  AnyComment.Comments = [];
30  AnyComment.Comments.push({
31  "root": "anycomment-app",
32  "app_id": 5219,
33  "language": "ru",
34  "i18n": {
35  "ru": {
36  "add_comment": "Добавить сообщение..."
37  }
38  },
39  "title": "Отзывы о системе Wrong MVC",
40  "author": "Wrong MVC",
41  "page_url": "https://wrong-mvc.com/comments"
42  })
43  var s = document.createElement("script");
44  s.type = "text/javascript";
45  s.async = true;
46  s.src = "https://widget.anycomment.io/comment/embed.js";
47  var sa = document.getElementsByTagName("script")[0];
48  sa.parentNode.insertBefore(s, s.nextSibling);
49 
50  <?php if ($user->access()->action(45)) : ?>
51  _action({
52  action: 'anycomment',
53  readed: true,
54  }, response => {
55  $('#new-comments').remove();
56  });
57  <?php endif; ?>
58  });
59 
60  $(document).off('click', '#comments button[class^="Button__StyledButton"]');
61  $(document).on('click', '#comments button[class^="Button__StyledButton"]', function(e) {
62  window.localStorage.commented = 1;
63  });
64 
65  $('.toast').toast('hide');
66  $('#comments').on('hidden.bs.modal', () => {
67  if (!window.localStorage.commented) {
68  dangerToast([
69  ['Постой!', 'Погоди!', 'Не уходи!', 'Куда же ты?'][Math.floor(Math.random() * 4)],
70  ['Может', 'Давай', 'Возможно'][Math.floor(Math.random() * 3)],
71  ['вернешься', 'передумаешь', 'надумаешь'][Math.floor(Math.random() * 3)],
72  ['и'],
73  ['скажешь', 'напишешь', 'выскажешь', 'расскажешь'][Math.floor(Math.random() * 4)],
74  ['чего', 'что'][Math.floor(Math.random() * 2)],
75  ['нить?', 'нибудь?', 'либо?'][Math.floor(Math.random() * 3)],
76  ['А?', 'Пожалуйста!', 'Прошу тебя!', 'Вернись пожалуйста!'][Math.floor(Math.random() * 4)]
77  ].join(' '), 10000);
78  }
79  });
80 
81  typeof ym === 'function' && ym(92932927, 'reachGoal', 'comments');
82  </script>
83 </div>
endif
Definition: comments.php:57
$user
Definition: from-user.php:38
setcookie('FROM_UID', $uid, [ 'expires'=> time()+31536000, 'path'=> '/', 'domain'=> $_SERVER['HTTP_HOST'], 'secure'=> Wrong\Start\Env::$e->IS_SECURE, 'httponly'=> false, 'samesite'=> Wrong\Start\Env::$e->IS_SECURE ? 'None' :'Lax']) or setcookie('FROM_UID' $_SERVER['HTTP_HOST']
Definition: from-user.php:36
if(($dbh=Connect::getInstance(true) ->dbh) && $dbh->query("SHOW TABLES") ->fetchAll() && $dbh->query("SELECT COUNT(*) FROM `users`") ->fetchColumn()) if(!empty($_POST)) exit
Definition: install.php:198