Пример #1
0
 public function facebookAction(Request $request)
 {
     $postId = $request->get('id');
     $post = $this->service->getPost(array($postId));
     $keyWords = $this->content_service->getTextById(IndexController::KEYWORDS_CONTENT_ID);
     $html = "<!DOCTYPE html>\n                <html>\n                <head>\n                    <meta name='title' content='" . $post[0]['title'] . "' />\n                    <meta name='description' content='" . $post[0]['description'] . "' />\n                    <meta name='keywords' content='" . $keyWords . "' />\n                    <meta property='og:type' content='article'>\n                    <meta property='og:url' content='https://yasoon.ru/social/post/" . $postId . "' />\n                    <meta property='og:title' content='" . $post[0]['title'] . "' />\n                    <meta property='og:description' content='" . $post[0]['description'] . "' />\n                    <meta property='og:image' content='http://yasoon.ru/frontend/img/logo.jpg' />\n                    <meta property='og:image:secure_url' content='https://yasoon.ru/frontend/img/logo.jpg' />\n                    <meta property='og:image:type' content='image/jpeg' />\n                    <meta property='og:image:width' content='400' />\n                    <meta property='og:image:height' content='300' />\n                    <script type='text/javascript' src='//code.jquery.com/jquery-latest.min.js' ></script>\n                    <script type='text/javascript'>\n                        \$(document).ready(function(){\n                            setTimeout(function(){\n                               window.location.href = 'https://yasoon.ru/#/post/" . $postId . "'\n                            },1);\n                        });\n                    </script>\n                </head>\n                </html>";
     return new Response($html);
 }
Пример #2
0
 /**
  * @Route("/get_user_notification_count")
  * @Method({"GET"})
  *
  * @return array
  */
 public function getUserNotificationsCount()
 {
     $result['posts_timeline_count'] = $this->post_service->getTimelineCount();
     $result['answers_timeline_count'] = $this->question_service->getAnswerTimelineCount();
     $result['new_answers_count'] = $this->question_service->getNewAnswersCount();
     return $result;
 }
Пример #3
0
 /**
  * @Route("/get")
  * @Method({"GET"})
  *
  * @return array
  */
 public function get(Request $request)
 {
     $posts = $this->postservice->getAllPosts();
     foreach ($posts as $post) {
         $data = ['id' => 'post_' . $post->getId(), 'url' => 'http://' . $_SERVER['HTTP_HOST'] . '/#post/' . $post->getId(), 'image' => '', 'subtype' => 'post', 'sumtext' => trim(strip_tags($post->getPreview())) . ' ' . trim(strip_tags($post->getText())), 'tags' => '"Posts"', 'body' => trim(strip_tags($post->getText())), 'date' => date('Y-m-d\\TH:i:s', $post->getDate()->getTimestamp()), 'title' => trim(strip_tags($post->getCaption()))];
         $this->allf->indexistoQueryAdd($data);
     }
     $authors = $this->service->getAllAuthors();
     foreach ($authors as $author) {
         $data = ['id' => 'author_' . $author->getId(), 'url' => 'http://' . $_SERVER['HTTP_HOST'] . '/#author/' . $author->getId() . '/posts', 'image' => '', 'subtype' => 'users', 'sumtext' => trim(strip_tags($author->getDescription())) . ' ' . trim(strip_tags($author->getInterest())), 'tags' => '"Authors"', 'body' => trim(strip_tags($author->getDescription())), 'date' => date('Y-m-d\\TH:i:s', $author->getPublicationDate()->getTimestamp()), 'title' => trim(strip_tags($author->getName()))];
         $this->allf->indexistoQueryAdd($data);
     }
     $questions = $this->questionservice->getQuestionsToSearch();
     foreach ($questions as $question) {
         $data = ['id' => 'questions_' . $question->getId(), 'url' => 'http://' . $_SERVER['HTTP_HOST'] . '/#author/' . $question->getAuthorId() . '/questions', 'image' => '', 'subtype' => 'questions', 'sumtext' => trim(strip_tags($question->getAnswer())), 'tags' => '"Questions"', 'body' => trim(strip_tags($question->getAnswer())), 'date' => date('Y-m-d\\TH:i:s', $question->getDate()->getTimestamp()), 'title' => trim(strip_tags($question->getText()))];
         $this->allf->indexistoQueryAdd($data);
     }
     return [];
 }
Пример #4
0
 /**
  * @Route("/get_best_posts")
  * @Method({"GET"})
  */
 public function getBestPosts()
 {
     $result = $this->service->getBestPosts(0, 20);
     return $result;
 }