Пример #1
0
 private function listRecentStatuses($user)
 {
     $profile = new ProfileModel($this->registry, $user);
     $profile->toTags('p_');
     $this->registry->getObject('template')->getPage()->addTag('referer', isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '');
     // post status / public message box
     if ($this->registry->getObject('authenticate')->isLoggedIn() == true) {
         if (isset($_POST) && count($_POST) > 0) {
             $this->addStatus($user);
         }
         $loggedInUser = $this->registry->getObject('authenticate')->getUser()->getUserID();
         if ($loggedInUser == $user) {
             $this->registry->getObject('template')->addTemplateBit('status_update', 'profile_status_update.php');
         } else {
             require_once 'relation.php';
             $relationships = new RelationsGet($this->registry);
             $connections = $relationships->getNetwork($user, false);
             if (in_array($loggedInUser, $connections)) {
                 $this->registry->getObject('template')->addTemplateBit('status_update', 'profile_status_post.php');
             } else {
                 $this->registry->getObject('template')->getPage()->addTag('status_update', '');
             }
         }
     } else {
         $this->registry->getObject('template')->getPage()->addTag('status_update', '');
     }
     $this->registry->getObject('template')->buildFromTemplate('header.php', 'profile_status_list.php', 'footer.php');
     $updates = array();
     $ids = array();
     $status_ids = array();
     $sql = "SELECT t.type_reference, t.type_name, s.*,pa.username as poster_user, pa.name as poster_name, i.image, v.video_id, l.URL, l.description FROM status_types t, profile p, profile pa, statuses s LEFT JOIN statuses_images i ON s.ID=i.id LEFT JOIN statuses_videos v ON s.ID=v.id LEFT JOIN statuses_links l ON s.ID=l.id WHERE t.ID=s.type AND p.user_id=s.profile AND pa.user_id=s.poster AND p.user_id=" . $user . " ORDER BY s.ID DESC LIMIT 20";
     $this->registry->getObject('db')->executeQuery($sql);
     if ($this->registry->getObject('db')->numRows() > 0) {
         while ($row = $this->registry->getObject('db')->getRows()) {
             $updates[] = $row;
             $ids[$row['ID']] = $row;
             $status_ids[] = $row['ID'];
         }
     }
     require_once 'streamController.php';
     $stream = new StreamController($this->registry, false);
     $stream->commentary($status_ids);
     $cache = $this->registry->getObject('db')->cacheData($updates);
     $this->registry->getObject('template')->getPage()->addTag('updates', array('DATA', $cache));
     foreach ($ids as $id => $data) {
         $this->registry->getObject('template')->addTemplateBit('update-' . $id, 'profile_update_' . $data['type_reference'] . '.php', $data);
     }
     //var_dump($this->registry->getObject('template')->getPage()->getTags());
     //var_dump($cache);
 }