Ejemplo n.º 1
0
Archivo: Blog.php Proyecto: 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);
 }
Ejemplo n.º 2
0
Archivo: Blog.php Proyecto: 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);
     }
 }
Ejemplo n.º 3
0
Archivo: Blog.php Proyecto: 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);
 }
Ejemplo n.º 4
0
 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);
         }
     }
 }