Exemple #1
0
 /**
  * Отправляет пользователю уведомление об ответе на его сообщение
  *
  * @param string|array $ids
  * @param resource $connect
  * @return  integer количество отправленных уведомлений.
  */
 function ArticleNewComment($ids, $connect = NULL)
 {
     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/articles_comments.php';
     $c = new articles_comments();
     if (!($data = $c->getComments4Sending($ids, $connect))) {
         return NULL;
     }
     foreach ($data as $comment) {
         $this->subject = "Комментарии в разделе «Статьи и интервью» на сайте FL.ru";
         if (substr($comment['s_subscr'], 11, 1) == '1' && $comment['s_uid'] != $comment['uid'] && $comment['s_email'] && $comment['parent_id'] && $comment['s_banned'] == '0') {
             $body = "<a href='{$GLOBALS['host']}/users/{$comment['login']}{$this->_addUrlParams('b')}'>{$comment['uname']} {$comment['usurname']}</a> [<a href='{$GLOBALS['host']}/users/{$comment['login']}{$this->_addUrlParams('b')}'>{$comment['login']}</a>]\n                оставил(-а) <a href='{$GLOBALS['host']}/articles/?id={$comment['article_id']}{$this->_addUrlParams('b', '&')}#c_{$comment['id']}'>новый комментарий</a> \n                к вашим сообщениям/комментариям в разделе <a href='{$GLOBALS['host']}/articles/{$this->_addUrlParams('b')}'>«Статьи и интервью»</a> на сайте FL.ru. \n                <br /> --------\n                <br />" . repair_html(LenghtFormatEx($comment['msgtext'], 300)) . "\n                <br /> --------<br />";
             $this->message = $this->GetHtml($comment['s_uname'], $body, array('header' => 'default', 'footer' => 'default'), array('login' => $comment['s_login']));
             $this->recipient = $comment['s_uname'] . " " . $comment['s_usurname'] . " [" . $comment['s_login'] . "] <" . $comment['s_email'] . ">";
             $this->SmtpMail('text/html');
         }
         if (substr($comment['a_subscr'], 11, 1) == '1' && !$comment['parent_id'] && $comment['a_uid'] != $comment['from_id'] && $comment['a_email'] && $comment['a_banned'] == '0') {
             $body = "<a href='{$GLOBALS['host']}/users/{$comment['login']}{$this->_addUrlParams('b')}'>{$comment['uname']} {$comment['usurname']}</a> [<a href='{$GLOBALS['host']}/users/{$comment['login']}{$this->_addUrlParams('b')}'>{$comment['login']}</a>]\n                оставил(-а) <a href='{$GLOBALS['host']}/articles/?id={$comment['article_id']}{$this->_addUrlParams('b', '&')}#c_{$comment['id']}'>новый комментарий</a> \n                к вашим сообщениям/комментариям в разделе <a href='{$GLOBALS['host']}/articles/{$this->_addUrlParams('b')}'>«Статьи и интервью»</a> на сайте FL.ru. \n                <br /> --------\n                <br />" . repair_html(LenghtFormatEx($comment['msgtext'], 300)) . "\n                <br /> --------<br />";
             $this->message = $this->GetHtml($comment['a_uname'], $body, array('header' => 'default', 'footer' => 'default'), array('login' => $comment['a_login']));
             $this->recipient = $comment['a_uname'] . " " . $comment['a_usurname'] . " [" . $comment['a_login'] . "] <" . $comment['a_email'] . ">";
             $this->SmtpMail('text/html');
         }
     }
     return $this->sended;
 }
Exemple #2
0
         $result['success'] = true;
         $result['type'] = $type;
         //            var_dump($out);
         $result['html'] = iconv('CP1251', 'UTF-8', $out);
     }
     echo json_encode($result);
     exit;
     break;
 case 'comment':
     $id = __paramInit('int', 'id');
     if (!$id && !$uid && !isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest') {
         exit;
     }
     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/articles_comments.php';
     $comment = articles_comments::getComment($id);
     $attaches = articles_comments::getAttaches($id, true);
     $result = array();
     $result['success'] = false;
     if (hasPermissions('articles') || $uid == $comment['from_id']) {
         $comment['msgtext'] = preg_replace("/\\h/", ' ', $comment['msgtext']);
         $tidy = new tidy();
         $comment['msgtext'] = $tidy->repairString(str_replace(array(' '), array('&nbsp;'), iconv('CP1251', 'UTF-8', nl2br($comment['msgtext']))), array('show-body-only' => true, 'wrap' => '0'), 'raw');
         $comment['msgtext'] = preg_replace("/\\h/", ' ', $comment['msgtext']);
         $comment['msgtext'] = preg_replace('/\\n?<br\\s?\\/?>\\n?/', "\n", $comment['msgtext']);
         $comment['msgtext'] = html_entity_decode($comment['msgtext']);
         $result['success'] = true;
         $result['data'] = $comment;
         $result['attaches'] = $attaches;
     }
     echo json_encode($result);
     exit;
Exemple #3
0
 /**
  * Восстанавливает комментарий
  *
  * @param  integer  $type        Тип группы комментариев
  * @param  integer  $id          id комментария
  * @param  integer  $user_id     uid пользователя, комментарий которого редактируем
  * @param  integer  $moder_uid   uid пользователя, который редактирует
  * @return string                Возможная ошибка
  */
 public function Restore($type, $id, $user_id, $moder_id)
 {
     $error = '';
     switch ($type) {
         case self::T_ARTICLES:
             $comments = new articles_comments();
             $comments->RestoreComment($id, $user_id);
             break;
     }
     return $error;
 }