예제 #1
0
파일: GetItem.php 프로젝트: Hywan/moxl
 public function handle($stanza, $parent = false)
 {
     $evt = new \Event();
     $to = current(explode('/', (string) $stanza->attributes()->to));
     $from = $this->_to;
     $node = $this->_node;
     if ($stanza->pubsub->items->item) {
         $post = false;
         foreach ($stanza->pubsub->items->item as $item) {
             if (isset($item->entry) && (string) $item->entry->attributes()->xmlns == 'http://www.w3.org/2005/Atom') {
                 $p = new \modl\Postn();
                 $p->set($item, $from, false, $node);
                 $pd = new \modl\PostnDAO();
                 $pd->set($p);
                 $post = true;
                 $this->pack($p);
                 $evt->runEvent('post', $this->packet);
             } elseif (isset($item->realtime)) {
                 $this->method('ticker');
                 $this->pack(array('server' => $from, 'node' => $node, 'ticker' => $item->realtime));
                 $this->deliver();
             }
         }
         //if($post) {
         $this->pack(array('server' => $this->_to, 'node' => $this->_node));
         $this->deliver();
         //}
     } else {
         $evt->runEvent('nostream', array('from' => $from, 'node' => $node));
     }
 }
예제 #2
0
파일: Blog.php 프로젝트: Trim/movim
 function display()
 {
     /*if(!$this->get('f')) {
           return;
       }*/
     if ($this->_view == 'grouppublic') {
         $from = $this->get('s');
         $node = $this->get('n');
         $this->view->assign('mode', 'group');
         $this->view->assign('server', $from);
         $this->view->assign('node', $node);
         $pd = new \Modl\ItemDAO();
         $this->view->assign('item', $pd->getItem($from, $node));
     } else {
         $from = $this->get('f');
         $cd = new \modl\ContactDAO();
         $c = $cd->get($from, true);
         $this->view->assign('contact', $c);
         if (filter_var($from, FILTER_VALIDATE_EMAIL)) {
             $node = 'urn:xmpp:microblog:0';
         } else {
             return;
         }
         $this->view->assign('mode', 'blog');
     }
     $pd = new \modl\PostnDAO();
     if ($id = $this->get('i')) {
         $messages = $pd->getPublicItem($from, $node, $id, 10, 0);
     } else {
         $messages = $pd->getPublic($from, $node, 10, 0);
     }
     $this->view->assign('posts', $messages);
 }
예제 #3
0
파일: Syndication.php 프로젝트: Trim/movim
 function display()
 {
     ob_clean();
     if (!$this->get('f')) {
         return;
     }
     $from = $this->get('f');
     if (filter_var($from, FILTER_VALIDATE_EMAIL)) {
         $node = 'urn:xmpp:microblog:0';
     } else {
         return;
     }
     $pd = new \modl\PostnDAO();
     $cd = new \modl\ContactDAO();
     $this->view->assign('contact', $cd->get($from, true));
     $this->view->assign('uri', Route::urlize('blog', array($from)));
     if (isset($from) && isset($node)) {
         $messages = $pd->getPublic($from, $node, 10, 0);
         $this->view->assign('messages', $messages);
     }
     if (isset($messages[0])) {
         header("Content-Type: application/atom+xml; charset=UTF-8");
         $this->view->assign('date', date('c'));
     }
 }
예제 #4
0
파일: Blog.php 프로젝트: vijo/movim
 function load()
 {
     if ($this->_view == 'node') {
         $this->_from = $this->get('s');
         $this->_node = $this->get('n');
         if (!$this->validateServerNode($this->_from, $this->_node)) {
             return;
         }
         $pd = new \Modl\ItemDAO();
         $this->_item = $pd->getItem($this->_from, $this->_node);
         $this->_mode = 'group';
         $this->url = Route::urlize('node', array($this->_from, $this->_node));
     } else {
         $this->_from = $this->get('f');
         $cd = new \modl\ContactDAO();
         $this->_contact = $cd->get($this->_from, true);
         if (filter_var($this->_from, FILTER_VALIDATE_EMAIL)) {
             $this->_node = 'urn:xmpp:microblog:0';
         } else {
             return;
         }
         $this->_mode = 'blog';
         $this->url = Route::urlize('blog', $this->_from);
     }
     $pd = new \modl\PostnDAO();
     if ($this->_id = $this->get('i')) {
         if (Validator::int()->between(0, 100)->validate($this->_id)) {
             $this->_messages = $pd->getNodeUnfiltered($this->_from, $this->_node, $this->_id * $this->_paging, $this->_paging + 1);
             $this->_page = $this->_id + 1;
         } elseif (Validator::string()->length(5, 100)->validate($this->_id)) {
             $this->_messages = $pd->getPublicItem($this->_from, $this->_node, $this->_id);
             if (is_object($this->_messages[0])) {
                 $this->title = $this->_messages[0]->title;
                 $description = stripTags($this->_messages[0]->contentcleaned);
                 if (!empty($description)) {
                     $this->description = $description;
                 }
                 $attachements = $this->_messages[0]->getAttachements();
                 if ($attachements && array_key_exists('pictures', $attachements)) {
                     $this->image = urldecode($attachements['pictures'][0]['href']);
                 }
             }
             if ($this->_view == 'node') {
                 $this->url = Route::urlize('node', array($this->_from, $this->_node, $this->_id));
             } else {
                 $this->url = Route::urlize('blog', array($this->_from, $this->_id));
             }
         }
     } else {
         $this->_page = 1;
         $this->_messages = $pd->getNodeUnfiltered($this->_from, $this->_node, 0, $this->_paging + 1);
     }
     if (count($this->_messages) == $this->_paging + 1) {
         array_pop($this->_messages);
     }
 }
예제 #5
0
파일: GetItemsId.php 프로젝트: movim/moxl
 public function handle($stanza, $parent = false)
 {
     $evt = new Event();
     $pd = new \modl\PostnDAO();
     foreach (array_reverse($stanza->query->xpath('item')) as $item) {
         $id = (string) $item->attributes()->name;
         if (!$pd->exists($this->_to, $this->_node, $id)) {
             $gi = new GetItem();
             $gi->setTo($this->_to)->setNode($this->_node)->setId($id)->request();
         }
     }
     $this->pack(['server' => $this->_to, 'node' => $this->_node]);
     $this->deliver();
 }
예제 #6
0
파일: GetItems.php 프로젝트: Hywan/moxl
 public function handle($stanza, $parent = false)
 {
     $pd = new \modl\PostnDAO();
     foreach ($stanza->pubsub->items->item as $item) {
         if (isset($item->entry) && (string) $item->entry->attributes()->xmlns == 'http://www.w3.org/2005/Atom') {
             if ($this->_since == null || strtotime($this->_since) < strtotime($item->entry->published)) {
                 $p = new \modl\Postn();
                 $p->set($item, $this->_to, false, $this->_node);
                 $pd->set($p);
             }
         }
     }
     $this->pack(array('server' => $this->_to, 'node' => $this->_node));
     $this->deliver();
 }
예제 #7
0
 function display()
 {
     $cd = new \modl\ContactDAO();
     $stats = $cd->getStatistics();
     $pd = new \modl\PostnDAO();
     $pstats = array_slice($pd->getStatistics(), 0, 7);
     $md = new \modl\MessageDAO();
     $mstats = array_slice($md->getStatistics(), 0, 7);
     $this->view->assign('stats', $stats[0]);
     $this->view->assign('pstats', $pstats);
     $this->view->assign('mstats', $mstats);
     $this->view->assign('clearrosterlink', $this->call('ajaxClearRosterLink'));
     $this->view->assign('clearmessage', $this->call('ajaxClearMessage'));
     $this->view->assign('clearpost', $this->call('ajaxClearPost'));
 }
예제 #8
0
파일: CommentsGet.php 프로젝트: Hywan/moxl
 public function handle($stanza, $parent = false)
 {
     $evt = new \Event();
     $node = (string) $stanza->pubsub->items->attributes()->node;
     list($xmlns, $parent) = explode("/", $node);
     if ($stanza->pubsub->items->item) {
         foreach ($stanza->pubsub->items->item as $item) {
             $p = new \modl\Postn();
             $p->set($item, $this->_to, false, $node);
             $pd = new \modl\PostnDAO();
             $pd->set($p);
         }
     }
     $this->pack(array('server' => $this->_to, 'node' => $this->_node, 'id' => $this->_id));
     $this->deliver();
 }
예제 #9
0
파일: GetItemsId.php 프로젝트: Hywan/moxl
 public function handle($stanza, $parent = false)
 {
     $evt = new \Event();
     $pd = new \modl\PostnDAO();
     $get = false;
     foreach ($stanza->query->item as $item) {
         $id = (string) $item->attributes()->name;
         if (!$pd->exist($id)) {
             $get = true;
             $gi = new GetItem();
             $gi->setTo($this->_to)->setNode($this->_node)->setId($id)->request();
         }
     }
     if ($get == false) {
         $this->pack(array('server' => $this->_to, 'node' => $this->_node));
         $this->deliver();
     }
 }
예제 #10
0
파일: Post.php 프로젝트: Hywan/moxl
 public function handle($stanza, $parent = false)
 {
     $from = (string) $parent->attributes()->from;
     if ($stanza->items->item && isset($stanza->items->item->entry) && (string) $stanza->items->item->entry->attributes()->xmlns == 'http://www.w3.org/2005/Atom') {
         if ($parent->delay) {
             $delay = gmdate('Y-m-d H:i:s', strtotime((string) $parent->delay->attributes()->stamp));
         } else {
             $delay = false;
         }
         $p = new \modl\Postn();
         $p->set($stanza->items, $from, $delay);
         // We limit the very old posts (2 months old)
         if (strtotime($p->published) > mktime(0, 0, 0, gmdate("m") - 2, gmdate("d"), gmdate("Y")) && $p->nodeid != $this->testid) {
             $pd = new \modl\PostnDAO();
             $pd->set($p, $from);
             $this->pack($p);
             $this->deliver();
         }
     } elseif ($stanza->items->retract) {
         $pd = new \modl\PostnDAO();
         $pd->delete($stanza->items->retract->attributes()->id);
         $this->method('retract');
         $this->pack(array('server' => $from, 'node' => $stanza->attributes()->node));
         $this->deliver();
     } elseif (isset($stanza->items->item->realtime)) {
         $this->method('ticker');
         $this->pack(array('server' => $from, 'node' => $stanza->items->attributes()->node, 'ticker' => $stanza->items->item->realtime));
         $this->deliver();
     } elseif ($stanza->items->item && isset($stanza->items->item->attributes()->id) && !filter_var($from, FILTER_VALIDATE_EMAIL)) {
         // In this case we only get the header, so we request the full content
         $p = new \modl\PostnDAO();
         $id = (string) $stanza->items->item->attributes()->id;
         $here = $p->exist($id);
         if (!$here && $id != $this->testid) {
             $d = new GetItem();
             $d->setTo($from)->setNode((string) $stanza->items->attributes()->node)->setId($id)->request();
         }
     }
 }
예제 #11
0
파일: Blog.php 프로젝트: Nyco/movim
 function display()
 {
     if (!$this->get('f')) {
         return;
     }
     $from = $this->get('f');
     if (filter_var($from, FILTER_VALIDATE_EMAIL)) {
         $node = 'urn:xmpp:microblog:0';
     } else {
         return;
     }
     $cd = new \modl\ContactDAO();
     $c = $cd->get($from, true);
     $this->view->assign('contact', $c);
     $pd = new \modl\PostnDAO();
     if ($id = $this->get('i')) {
         $messages = $pd->getPublicItem($from, $node, $id, 10, 0);
     } else {
         $messages = $pd->getPublic($from, $node, 10, 0);
     }
     $this->view->assign('posts', $messages);
 }
예제 #12
0
 public function handle($stanza, $parent = false)
 {
     $p = new \modl\Postn();
     $p->origin = $this->_to;
     $p->node = $this->_node;
     $p->nodeid = $this->_atom->id;
     $p->aname = $this->_atom->name;
     $p->aid = $this->_atom->jid;
     $p->contentraw = $this->_atom->content;
     $p->published = gmdate('Y-m-d H:i:s');
     $p->updated = gmdate('Y-m-d H:i:s');
     $pd = new \modl\PostnDAO();
     $pd->set($p);
     $this->pack(['server' => $this->_to, 'node' => $this->_node, 'id' => $this->_parentid]);
     $this->deliver();
 }
예제 #13
0
파일: Post.php 프로젝트: vijo/movim
 function prepareEmpty()
 {
     $view = $this->tpl();
     $nd = new \modl\PostnDAO();
     $view = $this->tpl();
     $view->assign('posts', $nd->getLastPublished(0, 10));
     return $view->draw('_post_empty', true);
 }
예제 #14
0
 function ajaxPublish($form)
 {
     RPC::call('Publish.disableSend');
     if ($form->title->value != '') {
         $p = new PostPublish();
         $p->setFrom($this->user->getLogin())->setTo($form->to->value)->setTitle(htmlspecialchars($form->title->value))->setNode($form->node->value);
         //->setLocation($geo)
         //->enableComments()
         // Still usefull ? Check line 44
         if ($form->node->value == 'urn:xmpp:microblog:0') {
             $p->enableComments();
         }
         $content = $content_xhtml = '';
         if ($form->content->value != '') {
             $content = $form->content->value;
             $content_xhtml = Markdown::defaultTransform($content);
         }
         if ($form->id->value != '') {
             $p->setId($form->id->value);
             $pd = new \modl\PostnDAO();
             $post = $pd->getItem($form->id->value);
             if (isset($post)) {
                 $p->setPublished(strtotime($post->published));
             }
         }
         if (Validator::stringType()->notEmpty()->alnum(',')->validate($form->tags->value)) {
             $p->setTags(array_unique(array_filter(array_map(function ($value) {
                 return trim(strtolower($value));
             }, explode(',', $form->tags->value)))));
         }
         if ($form->embed->value != '' && filter_var($form->embed->value, FILTER_VALIDATE_URL)) {
             try {
                 $embed = Embed\Embed::create($form->embed->value);
                 $p->setLink($form->embed->value);
                 if (in_array($embed->type, array('photo', 'rich'))) {
                     $key = key($embed->images);
                     $p->setImage($embed->images[0]['value'], $embed->title, $embed->images[0]['mime']);
                 }
                 if ($embed->type !== 'photo') {
                     $content_xhtml .= $this->prepareEmbed($embed);
                 }
             } catch (Exception $e) {
                 error_log($e->getMessage());
             }
         }
         if ($content != '') {
             $p->setContent(htmlspecialchars($content));
         }
         if ($content_xhtml != '') {
             $p->setContentXhtml($content_xhtml);
         }
         $p->request();
     } else {
         RPC::call('Publish.enableSend');
         Notification::append(false, $this->__('publish.no_title'));
     }
 }
예제 #15
0
파일: Blog.php 프로젝트: Anon215/movim
 function load()
 {
     if ($this->_view == 'node') {
         $this->_from = $this->get('s');
         $this->_node = $this->get('n');
         if (!$this->validateServerNode($this->_from, $this->_node)) {
             return;
         }
         $pd = new \Modl\ItemDAO();
         $this->_item = $pd->getItem($this->_from, $this->_node);
         $this->_mode = 'group';
         $this->url = Route::urlize('node', array($this->_from, $this->_node));
     } elseif ($this->_view == 'tag' && $this->validateTag($this->get('t'))) {
         $this->_mode = 'tag';
         $this->_tag = $this->get('t');
         $this->title = '#' . $this->_tag;
     } else {
         $this->_from = $this->get('f');
         $cd = new \modl\ContactDAO();
         $this->_contact = $cd->get($this->_from, true);
         if (filter_var($this->_from, FILTER_VALIDATE_EMAIL)) {
             $this->_node = 'urn:xmpp:microblog:0';
         } else {
             return;
         }
         $this->_mode = 'blog';
         $this->url = Route::urlize('blog', $this->_from);
     }
     $pd = new \modl\PostnDAO();
     if ($this->_id = $this->get('i')) {
         if (Validator::stringType()->between('1', '100')->validate($this->_id)) {
             if (isset($this->_tag)) {
                 $this->_messages = $pd->getPublicTag($this->get('t'), $this->_id * $this->_paging, $this->_paging + 1);
             } else {
                 $this->_messages = $pd->getNodeUnfiltered($this->_from, $this->_node, $this->_id * $this->_paging, $this->_paging + 1);
             }
             $this->_page = $this->_id + 1;
         } elseif (Validator::stringType()->length(5, 100)->validate($this->_id)) {
             $this->_messages[0] = $pd->getPublicItem($this->_from, $this->_node, $this->_id);
             if (is_object($this->_messages[0])) {
                 $this->title = $this->_messages[0]->title;
                 $description = stripTags($this->_messages[0]->contentcleaned);
                 if (!empty($description)) {
                     $this->description = truncate($description, 100);
                 }
                 $attachments = $this->_messages[0]->getAttachments();
                 if ($attachments && array_key_exists('pictures', $attachments)) {
                     $this->image = urldecode($attachments['pictures'][0]['href']);
                 }
             }
             if ($this->_view == 'node') {
                 $this->url = Route::urlize('node', array($this->_from, $this->_node, $this->_id));
             } else {
                 $this->url = Route::urlize('blog', array($this->_from, $this->_id));
             }
         }
     } else {
         $this->_page = 1;
         if (isset($this->_tag)) {
             $this->_messages = $pd->getPublicTag($this->get('t'), 0, $this->_paging + 1);
         } else {
             $this->_messages = $pd->getNodeUnfiltered($this->_from, $this->_node, 0, $this->_paging + 1);
         }
     }
     if (count($this->_messages) == $this->_paging + 1) {
         array_pop($this->_messages);
     }
     if ($this->_node == 'urn:xmpp:microblog:0') {
         $this->user = new User($this->_from);
         $cssurl = $this->user->getDumpedConfig('cssurl');
         if (isset($cssurl) && $cssurl != '' && Validator::url()->validate($cssurl)) {
             $this->addrawcss($cssurl);
         }
     }
 }
예제 #16
0
파일: Post.php 프로젝트: Anon215/movim
 function prepareEmpty()
 {
     $view = $this->tpl();
     $nd = new \modl\PostnDAO();
     $cd = new modl\ContactDAO();
     $view = $this->tpl();
     $view->assign('presencestxt', getPresencesTxt());
     $view->assign('top', $cd->getTop(6));
     $view->assign('blogs', $nd->getLastBlogPublic(0, 6));
     $view->assign('posts', $nd->getLastPublished(0, 4));
     $view->assign('me', $cd->get($this->user->getLogin()), true);
     $view->assign('jid', $this->user->getLogin());
     return $view->draw('_post_empty', true);
 }
예제 #17
0
 function display()
 {
     ob_clean();
     $pd = new \modl\PostnDAO();
     $cd = new \modl\ContactDAO();
     $id = new \Modl\ItemDAO();
     if (!$this->get('s')) {
         return;
     }
     $from = $this->get('s');
     $item = $contact = null;
     if (filter_var($from, FILTER_VALIDATE_EMAIL)) {
         $node = 'urn:xmpp:microblog:0';
         $contact = $cd->get($from);
     } elseif (!$this->get('n')) {
         return;
     } else {
         $node = $this->get('n');
         $item = $id->getItem($from, $node);
     }
     $messages = $pd->getPublic($from, $node, 0, 20);
     header("Content-Type: application/atom+xml; charset=UTF-8");
     $dom = new \DOMDocument('1.0', 'UTF-8');
     $dom->formatOutput = true;
     $feed = $dom->createElementNS('http://www.w3.org/2005/Atom', 'feed');
     $dom->appendChild($feed);
     $feed->appendChild($dom->createElement('updated', date('c')));
     $feed->appendChild($self = $dom->createElement('link'));
     $self->setAttribute('rel', 'self');
     if ($contact != null) {
         $feed->appendChild($dom->createElement('title', __('feed.title', $contact->getTrueName())));
         $feed->appendChild($author = $dom->createElement('author'));
         $author->appendChild($dom->createElement('name', $contact->getTrueName()));
         $author->appendChild($dom->createElement('uri', Route::urlize('blog', [$from])));
         $feed->appendChild($dom->createElement('logo', $contact->getPhoto('l')));
         $self->setAttribute('href', Route::urlize('feed', [$from]));
     }
     if ($item != null) {
         if ($item->name) {
             $feed->appendChild($dom->createElement('title', $item->name));
         } else {
             $feed->appendChild($dom->createElement('title', $item->node));
         }
         if ($item->description) {
             $feed->appendChild($dom->createElement('subtitle', $item->description));
         } else {
             $feed->appendChild($dom->createElement('subtitle', $item->server));
         }
         $self->setAttribute('href', Route::urlize('feed', [$from, $node]));
     }
     $feed->appendChild($generator = $dom->createElement('generator', 'Movim'));
     $generator->setAttribute('uri', 'https://movim.eu');
     $generator->setAttribute('version', APP_VERSION);
     foreach ($messages as $message) {
         $feed->appendChild($entry = $dom->createElement('entry'));
         if ($message->title) {
             $entry->appendChild($dom->createElement('title', $message->title));
         } else {
             $entry->appendChild($dom->createElement('title', __('post.default_title')));
         }
         $entry->appendChild($dom->createElement('id', $message->getUUID()));
         $entry->appendChild($dom->createElement('updated', date('c', strtotime($message->updated))));
         $entry->appendChild($content = $dom->createElement('content'));
         $content->appendChild($div = $dom->createElementNS('http://www.w3.org/1999/xhtml', 'div'));
         $content->setAttribute('type', 'xhtml');
         $f = $dom->createDocumentFragment();
         $f->appendXML($message->contentcleaned);
         $div->appendChild($f);
         $attachments = $message->getAttachments();
         if (isset($attachments['pictures'])) {
             foreach ($attachments['pictures'] as $value) {
                 $entry->appendChild($link = $dom->createElement('link'));
                 $link->setAttribute('rel', 'enclosure');
                 $link->setAttribute('type', $value['type']);
                 $link->setAttribute('href', $value['href']);
             }
         }
         if (isset($attachments['files'])) {
             foreach ($attachments['files'] as $value) {
                 $entry->appendChild($link = $dom->createElement('link'));
                 $link->setAttribute('rel', 'enclosure');
                 $link->setAttribute('type', $value['type']);
                 $link->setAttribute('href', $value['href']);
             }
         }
         if (isset($attachments['links'])) {
             foreach ($attachments['links'] as $value) {
                 $entry->appendChild($link = $dom->createElement('link'));
                 $link->setAttribute('rel', 'alternate');
                 $link->setAttribute('href', $value['href']);
             }
         }
         $entry->appendChild($link = $dom->createElement('link'));
         $link->setAttribute('rel', 'alternate');
         $link->setAttribute('type', 'text/html');
         $link->setAttribute('href', $message->getPublicUrl());
     }
     echo $dom->saveXML();
     exit;
 }
예제 #18
0
파일: PostDelete.php 프로젝트: movim/moxl
 public function error($stanza)
 {
     $pd = new \modl\PostnDAO();
     $pd->delete($this->_id);
 }
예제 #19
0
파일: Publish.php 프로젝트: Anon215/movim
 function ajaxPublish($form)
 {
     RPC::call('Publish.disableSend');
     if ($form->title->value != '') {
         $p = new PostPublish();
         $p->setFrom($this->user->getLogin())->setTo($form->to->value)->setTitle(htmlspecialchars($form->title->value))->setNode($form->node->value);
         //->setLocation($geo)
         // Still usefull ? Check line 44
         //if($form->node->value == 'urn:xmpp:microblog:0') {
         $p->enableComments();
         //}
         $content = $content_xhtml = '';
         if ($form->content->value != '') {
             $content = $form->content->value;
             $content_xhtml = addHFR(Markdown::defaultTransform($content));
         }
         if ($form->id->value != '') {
             $p->setId($form->id->value);
             $pd = new \modl\PostnDAO();
             $post = $pd->get($form->to->value, $form->node->value, $form->id->value);
             if (isset($post)) {
                 $p->setPublished(strtotime($post->published));
             }
         }
         if (Validator::stringType()->notEmpty()->validate($form->tags->value)) {
             $p->setTags(array_unique(array_filter(array_map(function ($value) {
                 if (Validator::stringType()->notEmpty()->validate($value)) {
                     preg_match('/([^\\s[:punct:]]|_|-){3,30}/', trim($value), $matches);
                     if (isset($matches[0])) {
                         return strtolower($matches[0]);
                     }
                 }
             }, explode(',', $form->tags->value)))));
         }
         if (Validator::notEmpty()->url()->validate($form->embed->value)) {
             try {
                 $embed = Embed\Embed::create($form->embed->value);
                 $p->setLink($form->embed->value);
                 if (in_array($embed->type, array('photo', 'rich'))) {
                     $p->setImage($embed->images[0]['value'], $embed->title, $embed->images[0]['mime']);
                 }
                 if ($embed->type !== 'photo') {
                     $content_xhtml .= $this->prepareEmbed($embed);
                 }
             } catch (Exception $e) {
                 error_log($e->getMessage());
             }
         }
         if ($form->open->value === true) {
             $p->isOpen();
         }
         if ($content != '') {
             $p->setContent(htmlspecialchars($content));
         }
         if ($content_xhtml != '') {
             $p->setContentXhtml($content_xhtml);
         }
         if ($form->reply->value) {
             $pd = new \modl\PostnDAO();
             $post = $pd->get($form->replyorigin->value, $form->replynode->value, $form->replynodeid->value);
             $p->setReply($post->getRef());
         }
         $p->request();
     } else {
         RPC::call('Publish.enableSend');
         Notification::append(false, $this->__('publish.no_title'));
     }
 }