/**
  * Main Feed / Login Page
  */
 public function indexAction()
 {
     $request = $this->getRequest();
     $Connections = new Application_Model_Connections();
     $limit = Zend_Registry::get('config')->get('sidebar_max_users');
     // put addPost form on the front page
     $this->_helper->addPostFormLoader();
     if (Zend_Auth::getInstance()->hasIdentity()) {
         $this->view->sidebar_myprofile = true;
     } else {
         $this->view->sidebar_login = true;
     }
     // attach sidebar box
     Zend_Registry::get('hooks')->attach('hook_view_sidebar', 2, function () {
         echo Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer')->view->render('/_sidebar/myprofile.phtml');
         echo Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer')->view->render('/_sidebar/loginregister.phtml');
     });
     // load initial posts
     $Posts = new Application_Model_Posts();
     // Add coment form
     $add_comment_form = new Application_Form_AddComment();
     $this->view->add_comment_form = $add_comment_form;
     // offset infinite scroll
     if ($this->view->post_page_number) {
         $Posts->page_number = $this->view->post_page_number;
     }
     $data = $Posts->getPosts();
     $this->view->posts_data = $data;
     $this->view->profile_type = 'feed';
     // continue to load posts with ajax
     if (count($data) >= Zend_Registry::get('config')->get('limit_posts')) {
         $this->view->php_loadPostURL = $this->_helper->url->url(array('controller' => 'posts', 'action' => 'load'), 'default', true);
     }
     // auto show image (shares)
     $image_uid = $request->getParam('showimage', 0);
     if ($image_uid) {
         if (!Zend_Auth::getInstance()->hasIdentity()) {
             $this->redirect('');
         }
         $Images = new Application_Model_Images();
         $image = $Images->getImageByUID($image_uid);
         if (isset($image)) {
             $this->view->auto_show_image = $image['id'];
             $this->view->auto_show_image_file_name = $image['file_name'];
         } else {
             Application_Plugin_Alerts::error($this->view->translate('Resource does not exists'), 'on');
             $this->redirect('');
         }
     }
 }