/**
  * Main control method
  */
 public function authControl()
 {
     $this->setViewTemplate('post.index.tpl');
     if (isset($_REQUEST['t']) && is_numeric($_REQUEST['t']) && $this->post_dao->isPostInDB($_REQUEST['t'])) {
         $post_id = $_REQUEST['t'];
         $this->addToViewCacheKey($post_id);
         $post = $this->post_dao->getPost($post_id);
         $this->addToView('post', $post);
         $this->addToView('likely_orphans', $this->post_dao->getLikelyOrphansForParent($post->pub_date, $post->author_user_id, $post->author_username, 15));
         $this->addToView('all_tweets', $this->post_dao->getAllPosts($post->author_user_id, 15));
         $all_replies = $this->post_dao->getRepliesToPost($post_id);
         $this->addToView('replies', $all_replies);
         $all_replies_count = count($all_replies);
         $this->addToView('reply_count', $all_replies_count);
         $all_retweets = $this->post_dao->getRetweetsOfPost($post_id);
         $this->addToView('retweets', $all_retweets);
         $retweet_reach = $this->post_dao->getPostReachViaRetweets($post_id);
         $this->addToView('retweet_reach', $retweet_reach);
         $public_replies = $this->post_dao->getPublicRepliesToPost($post_id);
         $public_replies_count = count($public_replies);
         $this->addToView('public_reply_count', $public_replies_count);
         $private_replies_count = $all_replies_count - $public_replies_count;
         $this->addToView('private_reply_count', $private_replies_count);
     } else {
         $this->addToView('error', 'Post not found');
     }
     return $this->generateView();
 }
 /**
  * Load view with individual post and replies and retweets
  * @param int $post_id
  */
 private function loadSinglePostThread($post_id)
 {
     $post = $this->post_dao->getPost($post_id);
     $public_tweet_replies = $this->post_dao->getPublicRepliesToPost($post->post_id);
     $public_retweets = $this->post_dao->getRetweetsOfPost($post->post_id, true);
     $this->addToView('post', $post);
     $this->addToView('replies', $public_tweet_replies);
     $this->addToView('retweets', $public_retweets);
     $rtreach = 0;
     foreach ($public_retweets as $t) {
         $rtreach += $t->author->follower_count;
     }
     $this->addToView('rtreach', $rtreach);
 }
 /**
  * Load view with individual post and replies and retweets
  * @param int $post_id
  * @param str $network
  */
 private function loadSinglePostThread($post_id, $network)
 {
     $this->setPageTitle('Public Post Replies');
     $this->post_dao->isPostByPublicInstance($_GET['t'], $network);
     $post = $this->post_dao->getPost($post_id, $network);
     if (!isset($post)) {
         $this->addErrorMessage("Post " . $post_id . " on " . ucwords($network) . " is not in ThinkUp.");
     } else {
         $plugin_option_dao = DAOFactory::GetDAO('PluginOptionDAO');
         $options = $plugin_option_dao->getOptionsHash('geoencoder', true);
         if (isset($options['distance_unit']->option_value)) {
             $distance_unit = $options['distance_unit']->option_value;
         } else {
             $distance_unit = 'km';
         }
         $public_tweet_replies = $this->post_dao->getPublicRepliesToPost($post->post_id, $network, 'default', $distance_unit);
         $public_retweets = $this->post_dao->getRetweetsOfPost($post->post_id, $network, 'default', $distance_unit, true);
         $this->addToView('post', $post);
         $this->addToView('replies', $public_tweet_replies);
         $this->addToView('retweets', $public_retweets);
         $this->addToView('unit', $distance_unit);
         $rtreach = 0;
         foreach ($public_retweets as $t) {
             $rtreach += $t->author->follower_count;
         }
         $this->addToView('rtreach', $rtreach);
     }
 }
 /**
  * Main control method
  */
 public function authControl()
 {
     $this->setViewTemplate('post.index.tpl');
     $network = isset($_GET['n']) ? $_GET['n'] : 'twitter';
     $_GET['n'] = $network;
     if ($this->shouldRefreshCache()) {
         if (isset($_GET['t']) && is_numeric($_GET['t']) && $this->post_dao->isPostInDB($_GET['t'], $network)) {
             $plugin_option_dao = DAOFactory::GetDAO('PluginOptionDAO');
             $options = $plugin_option_dao->getOptionsHash('geoencoder', true);
             if (isset($options['distance_unit']->option_value)) {
                 $distance_unit = $options['distance_unit']->option_value;
             } else {
                 $distance_unit = 'km';
             }
             $post_id = $_GET['t'];
             $post = $this->post_dao->getPost($post_id, $network);
             $this->addToView('post', $post);
             $this->addToView('unit', $distance_unit);
             // costly query
             //$this->addToView('likely_orphans', $this->post_dao->getLikelyOrphansForParent($post->pub_date,
             //$post->author_user_id,$post->author_username, 15) );
             //$this->addToView('all_tweets', $this->post_dao->getAllPosts($post->author_user_id, 15) );
             $all_replies = $this->post_dao->getRepliesToPost($post_id, $network, 'default', $distance_unit);
             $this->addToView('replies', $all_replies);
             $all_replies_by_location = $this->post_dao->getRepliesToPost($post_id, $network, 'location', $distance_unit);
             $this->addToView('replies_by_location', $all_replies_by_location);
             $all_replies_count = count($all_replies);
             $this->addToView('reply_count', $all_replies_count);
             $all_retweets = $this->post_dao->getRetweetsOfPost($post_id, $network, 'default', $distance_unit);
             $this->addToView('retweets', $all_retweets);
             $all_retweets_by_location = $this->post_dao->getRetweetsOfPost($post_id, $network, 'location', $distance_unit);
             $this->addToView('retweets_by_location', $all_retweets_by_location);
             $retweet_reach = $this->post_dao->getPostReachViaRetweets($post_id, $network);
             $this->addToView('retweet_reach', $retweet_reach);
             $public_replies = $this->post_dao->getPublicRepliesToPost($post_id, $network);
             $public_replies_count = count($public_replies);
             $this->addToView('public_reply_count', $public_replies_count);
             $private_replies_count = $all_replies_count - $public_replies_count;
             $this->addToView('private_reply_count', $private_replies_count);
         } else {
             $this->addErrorMessage('Post not found');
         }
     }
     return $this->generateView();
 }
 public function control()
 {
     /*
      * Check if the view is cached and, if it is, return the cached version before any of the application login
      * is executed.
      */
     if ($this->view_mgr->isViewCached()) {
         if ($this->view_mgr->is_cached('json.tpl', $this->getCacheKeyString())) {
             // set the json data to keep the ThinkUpController happy.
             $this->setJsonData(array());
             return $this->generateView();
         }
     }
     /*
      * Check if the API is disabled and, if it is, throw the appropriate exception.
      *
      * Docs: http://thinkupapp.com/docs/userguide/api/errors/apidisabled.html
      */
     $is_api_disabled = Config::getInstance()->getValue('is_api_disabled');
     if ($is_api_disabled) {
         throw new APIDisabledException();
     }
     // fetch the correct PostDAO and UserDAO from the DAOFactory
     $this->post_dao = DAOFactory::getDAO('PostDAO');
     $this->user_dao = DAOFactory::getDAO('UserDAO');
     /*
      * Use the information gathered from the query string to retrieve a
      * User object. This will be the standard object with which to get
      * User information from in API calls.
      */
     if ($this->user_id != null) {
         $this->user = $this->user_dao->getDetails($this->user_id, $this->network);
     } else {
         if ($this->username != null) {
             $this->user = $this->user_dao->getUserByName($this->username, $this->network);
         } else {
             $this->user = null;
         }
     }
     //Privacy checks
     if (substr($this->type, 0, 4) == 'user') {
         //user-related API call
         if (is_null($this->user)) {
             // Check why the User object is null. Could be missing required fields or not found.
             if (is_null($this->user_id) && is_null($this->username)) {
                 $m = 'A request of type ' . $this->type . ' requires a user_id or username to be specified.';
                 throw new RequiredArgumentMissingException($m);
             } else {
                 throw new UserNotFoundException();
             }
         } elseif ($this->user->is_protected) {
             //user is protected on originating network
             throw new UserNotFoundException();
         } else {
             $instance_dao = DAOFactory::getDAO('InstanceDAO');
             $instance = $instance_dao->getByUsernameOnNetwork($this->user->username, $this->user->network);
             if (isset($instance)) {
                 if (!$instance->is_public) {
                     //user is protected on ThinkUp
                     throw new UserNotFoundException();
                 }
             }
         }
     } else {
         //post-related API call
         if ($this->network == "facebook") {
             //assume all Facebook posts are private
             throw new PostNotFoundException();
         }
     }
     /*
      * This switch statement is the main part of this function. It decides
      * what type of posts will be fetched depending on the "type" GET
      * variable and use the PostDAO to fetch the appropriate posts from
      * the database.
      *
      * If a required field is missing it will create an error field to
      * output in JSON.
      */
     switch ($this->type) {
         /*
          * Gets a post.
          *
          * Required arguments: post_id
          *
          * Optional arguments: network, include_entities, include_replies, trim_user
          *
          * Docs: http://thinkupapp.com/docs/userguide/api/posts/post.html
          */
         case 'post':
             if (is_null($this->post_id)) {
                 $m = 'A request of type ' . $this->type . ' requires a post_id to be specified.';
                 throw new RequiredArgumentMissingException($m);
             } else {
                 $data = $this->post_dao->getPost($this->post_id, $this->network, $this->is_public);
             }
             break;
             /*
              * Gets all retweets to a post.
              *
              * Required arguments: post_id
              *
              * Optional arguments: network, order_by, unit, count, page, include_entities, include_replies,
              * trim_user
              *
              * Docs: http://thinkupapp.com/docs/userguide/api/posts/post_retweets.html
              */
         /*
          * Gets all retweets to a post.
          *
          * Required arguments: post_id
          *
          * Optional arguments: network, order_by, unit, count, page, include_entities, include_replies,
          * trim_user
          *
          * Docs: http://thinkupapp.com/docs/userguide/api/posts/post_retweets.html
          */
         case 'post_retweets':
             if (is_null($this->post_id)) {
                 $m = 'A request of type ' . $this->type . ' requires a post_id to be specified.';
                 throw new RequiredArgumentMissingException($m);
             } else {
                 $data = $this->post_dao->getRetweetsOfPost($this->post_id, $this->network, $this->order_by, $this->unit, $this->is_public, $this->count, $this->page);
             }
             break;
             /**
              * Gets replies to a post.
              *
              * Required arguments: post_id
              *
              * Optional arguments: network, order_by, unit, count, page, include_entities, include_replies,
              * trim_user
              *
              * Ordering can only be done by either location or follower count.
              *
              * Docs: http://thinkupapp.com/docs/userguide/api/posts/post_replies.html
              */
         /**
          * Gets replies to a post.
          *
          * Required arguments: post_id
          *
          * Optional arguments: network, order_by, unit, count, page, include_entities, include_replies,
          * trim_user
          *
          * Ordering can only be done by either location or follower count.
          *
          * Docs: http://thinkupapp.com/docs/userguide/api/posts/post_replies.html
          */
         case 'post_replies':
             if (is_null($this->post_id)) {
                 $m = 'A request of type ' . $this->type . ' requires a post_id to be specified.';
                 throw new RequiredArgumentMissingException($m);
             } else {
                 $data = $this->post_dao->getRepliesToPost($this->post_id, $this->network, $this->order_by, $this->unit, $this->is_public, $this->count, $this->page);
             }
             break;
             /*
              * Gets replies to a post within a date range.
              *
              * Required arguments: post_id, from and until
              *
              * Optional arguments: network, order_by, unit, count, page, include_entities, include_replies,
              * trim_user
              *
              * Ordering can only be done by either location or follower count.
              *
              * Docs: http://thinkupapp.com/docs/userguide/api/posts/post_replies.html
              */
         /*
          * Gets replies to a post within a date range.
          *
          * Required arguments: post_id, from and until
          *
          * Optional arguments: network, order_by, unit, count, page, include_entities, include_replies,
          * trim_user
          *
          * Ordering can only be done by either location or follower count.
          *
          * Docs: http://thinkupapp.com/docs/userguide/api/posts/post_replies.html
          */
         case 'post_replies_in_range':
             if (is_null($this->post_id) || is_null($this->from) || is_null($this->until)) {
                 $m = 'A request of type ' . $this->type . ' requires a post_id to be specified.';
                 throw new RequiredArgumentMissingException($m);
             } else {
                 $data = $this->post_dao->getRepliesToPostInRange($this->post_id, $this->network, $this->from, $this->until, $this->order_by, $this->unit, $this->is_public, $this->count, $this->page);
             }
             break;
             /*
              * Get posts related to a post (replies to it, retweets of it).
              *
              * Required arguments: post_id
              *
              * Optional arguments: network, count, page, geo_encoded_only, include_original_post, include_entities,
              * include_replies, trim_user
              *
              * Docs: http://thinkupapp.com/docs/userguide/api/posts/related_posts.html
              */
         /*
          * Get posts related to a post (replies to it, retweets of it).
          *
          * Required arguments: post_id
          *
          * Optional arguments: network, count, page, geo_encoded_only, include_original_post, include_entities,
          * include_replies, trim_user
          *
          * Docs: http://thinkupapp.com/docs/userguide/api/posts/related_posts.html
          */
         case 'related_posts':
             if (is_null($this->post_id)) {
                 $m = 'A request of type ' . $this->type . ' requires a post_id to be specified.';
                 throw new RequiredArgumentMissingException($m);
             } else {
                 $data = $this->post_dao->getRelatedPosts($this->post_id, $this->network, $this->is_public, $this->count, $this->page, $geo_encoded_only = false, $include_original_post = false);
             }
             break;
             /*
              * Gets the user's most replied to posts.
              *
              * Required arguments: user_id or username
              *
              * Optional arguments: network, count, page, include_entities, include_replies, trim_user
              *
              * Docs: http://thinkupapp.com/docs/userguide/api/posts/user_posts_most_replied_to.html
              */
         /*
          * Gets the user's most replied to posts.
          *
          * Required arguments: user_id or username
          *
          * Optional arguments: network, count, page, include_entities, include_replies, trim_user
          *
          * Docs: http://thinkupapp.com/docs/userguide/api/posts/user_posts_most_replied_to.html
          */
         case 'user_posts_most_replied_to':
             $data = $this->post_dao->getMostRepliedToPosts($this->user->user_id, $this->network, $this->count, $this->page, $this->is_public);
             break;
             /*
              * Gets the user's most retweeted posts.
              *
              * Required arguments: user_id or username
              *
              * Optional arguments: network, count, page, include_entities, include_replies, trim_user
              *
              * Docs: http://thinkupapp.com/docs/userguide/api/posts/user_posts_most_retweeted.html
              */
         /*
          * Gets the user's most retweeted posts.
          *
          * Required arguments: user_id or username
          *
          * Optional arguments: network, count, page, include_entities, include_replies, trim_user
          *
          * Docs: http://thinkupapp.com/docs/userguide/api/posts/user_posts_most_retweeted.html
          */
         case 'user_posts_most_retweeted':
             $data = $this->post_dao->getMostRetweetedPosts($this->user->user_id, $this->network, $this->count, $this->page, $this->is_public);
             break;
             /*
              * Gets posts a user has made.
              *
              * Required arguments: user_id or username
              *
              * Optional arguments: network, count, page, order_by, direction, include_entities, include_replies,
              * trim_user
              *
              * Docs: http://thinkupapp.com/docs/userguide/api/posts/user_posts.html
              */
         /*
          * Gets posts a user has made.
          *
          * Required arguments: user_id or username
          *
          * Optional arguments: network, count, page, order_by, direction, include_entities, include_replies,
          * trim_user
          *
          * Docs: http://thinkupapp.com/docs/userguide/api/posts/user_posts.html
          */
         case 'user_posts':
             $data = $this->post_dao->getAllPosts($this->user->user_id, $this->network, $this->count, $this->page, true, $this->order_by, $this->direction, $this->is_public);
             break;
             /*
              * Gets posts a user has made.
              *
              * Required arguments: user_id or username, from and until
              *
              * Optional arguments: network, order_by, direction, include_entities, include_replies,
              * trim_user
              *
              * Docs: http://thinkupapp.com/docs/userguide/api/posts/user_posts_in_range.html
              */
         /*
          * Gets posts a user has made.
          *
          * Required arguments: user_id or username, from and until
          *
          * Optional arguments: network, order_by, direction, include_entities, include_replies,
          * trim_user
          *
          * Docs: http://thinkupapp.com/docs/userguide/api/posts/user_posts_in_range.html
          */
         case 'user_posts_in_range':
             if (is_null($this->from) || is_null($this->until)) {
                 $m = 'A request of type ' . $this->type . ' requires valid from and until parameters to be ';
                 $m .= 'specified.';
                 throw new RequiredArgumentMissingException($m);
             } else {
                 $data = $this->post_dao->getPostsByUserInRange($this->user->user_id, $this->network, $this->from, $this->until, $this->order_by, $this->direction, $iterator = false, $this->is_public);
             }
             break;
             /*
              * Gets posts a user is mentioned in.
              *
              * Required arguments: user_id or username
              *
              * Optional arguments: network, count, page, include_rts, include_entities, include_replies, trim_user
              *
              * Docs: http://thinkupapp.com/docs/userguide/api/posts/user_mentions.html
              */
         /*
          * Gets posts a user is mentioned in.
          *
          * Required arguments: user_id or username
          *
          * Optional arguments: network, count, page, include_rts, include_entities, include_replies, trim_user
          *
          * Docs: http://thinkupapp.com/docs/userguide/api/posts/user_mentions.html
          */
         case 'user_mentions':
             $data = $this->post_dao->getAllMentions($this->user->username, $this->count, $this->network, $this->page, $this->is_public, $this->include_rts, $this->order_by, $this->direction);
             break;
             /*
              * Gets posts a user is mentioned in.within a date range
              *
              * Required arguments: user_id or username, from and until
              *
              * Optional arguments: network, count, page, include_rts, include_entities, include_replies, trim_user
              */
         /*
          * Gets posts a user is mentioned in.within a date range
          *
          * Required arguments: user_id or username, from and until
          *
          * Optional arguments: network, count, page, include_rts, include_entities, include_replies, trim_user
          */
         case 'user_mentions_in_range':
             if (is_null($this->from) || is_null($this->until)) {
                 $m = 'A request of type ' . $this->type . ' requires valid from and until parameters to be ';
                 $m .= 'specified.';
                 throw new RequiredArgumentMissingException($m);
             } else {
                 $data = $this->post_dao->getAllMentionsInRange($this->user->username, $this->count, $this->network, $this->from, $this->until, $this->page, $this->is_public, $this->include_rts, $this->order_by, $this->direction);
             }
             break;
             /*
              * Gets question posts a user has made.
              *
              * Required arguments: user_id or username
              *
              * Optional arguments: network, count, page, order_by, direction, include_entities, include_replies,
              * trim_user
              *
              * Docs: http://thinkupapp.com/docs/userguide/api/posts/user_questions.html
              */
         /*
          * Gets question posts a user has made.
          *
          * Required arguments: user_id or username
          *
          * Optional arguments: network, count, page, order_by, direction, include_entities, include_replies,
          * trim_user
          *
          * Docs: http://thinkupapp.com/docs/userguide/api/posts/user_questions.html
          */
         case 'user_questions':
             $data = $this->post_dao->getAllQuestionPosts($this->user->user_id, $this->network, $this->count, $this->page, $this->order_by, $this->direction, $this->is_public);
             break;
             /*
              * Gets question posts a user has made within a date range
              *
              * Required arguments: user_id or username, from and until
              *
              * Optional arguments: network, count, page, order_by, direction, include_entities, include_replies,
              * trim_user
              *
              * Docs: http://thinkupapp.com/docs/userguide/api/posts/user_questions.html
              */
         /*
          * Gets question posts a user has made within a date range
          *
          * Required arguments: user_id or username, from and until
          *
          * Optional arguments: network, count, page, order_by, direction, include_entities, include_replies,
          * trim_user
          *
          * Docs: http://thinkupapp.com/docs/userguide/api/posts/user_questions.html
          */
         case 'user_questions_in_range':
             $data = $this->post_dao->getAllQuestionPostsInRange($this->user->user_id, $this->network, $this->count, $this->from, $this->until, $this->page, $this->order_by, $this->direction, $this->is_public);
             break;
             /*
              * Gets replies to a user.
              *
              * Required arguments: user_id or username
              *
              * Optional arguments: network, count, page, order_by, direction, include_entities, include_replies,
              * trim_user
              *
              * http://thinkupapp.com/docs/userguide/api/posts/user_replies.html
              */
         /*
          * Gets replies to a user.
          *
          * Required arguments: user_id or username
          *
          * Optional arguments: network, count, page, order_by, direction, include_entities, include_replies,
          * trim_user
          *
          * http://thinkupapp.com/docs/userguide/api/posts/user_replies.html
          */
         case 'user_replies':
             $data = $this->post_dao->getAllReplies($this->user->user_id, $this->network, $this->count, $this->page, $this->order_by, $this->direction, $this->is_public);
             break;
             /*
              * Gets replies to a user within a date range.
              *
              * Required arguments: user_id or username, from and until
              *
              * Optional arguments: network, count, page, order_by, direction, include_entities, include_replies,
              * trim_user
              *
              * http://thinkupapp.com/docs/userguide/api/posts/user_replies.html
              */
         /*
          * Gets replies to a user within a date range.
          *
          * Required arguments: user_id or username, from and until
          *
          * Optional arguments: network, count, page, order_by, direction, include_entities, include_replies,
          * trim_user
          *
          * http://thinkupapp.com/docs/userguide/api/posts/user_replies.html
          */
         case 'user_replies_in_range':
             $data = $this->post_dao->getAllRepliesInRange($this->user->user_id, $this->network, $this->count, $this->from, $this->until, $this->page, $this->order_by, $this->direction, $this->is_public);
             break;
             /*
              * Generate an error because the API call type was not recognized.
              *
              * Docs: http://thinkupapp.com/docs/userguide/api/errors/apicalltypenotrecognised.html
              */
         /*
          * Generate an error because the API call type was not recognized.
          *
          * Docs: http://thinkupapp.com/docs/userguide/api/errors/apicalltypenotrecognised.html
          */
         default:
             throw new APICallTypeNotRecognizedException($this->type);
             break;
     }
     if (is_null($data)) {
         throw new PostNotFoundException();
     }
     switch ($this->network) {
         case 'twitter':
             if (is_array($data)) {
                 foreach ($data as $key => $post) {
                     $data[$key] = $this->convertPostToTweet($post);
                 }
             } else {
                 $data = $this->convertPostToTweet($data);
             }
             break;
         case 'facebook':
             // TODO: write a function here to convert to Facebook API style
             break;
         default:
             break;
     }
     // if no posts were found, $data is null. Set it to an empty array.
     if (is_null($data)) {
         $data = array();
     }
     $this->setJsonData($data);
     return $this->generateView();
 }
Exemple #6
0
} else {
    $page = 1;
}
if ($page > 1) {
    $s->assign('prev_page', $page - 1);
}
$s->assign('cfg', $cfg);
$i = $id->getInstanceFreshestOne();
$s->assign('crawler_last_run', $i->crawler_last_run);
$s->assign('i', $_i);
// show tweet with public replies
if (isset($_REQUEST['t']) && $pd->isPostByPublicInstance($_REQUEST['t'])) {
    if (!$s->is_cached('public.tpl', $_REQUEST['t'])) {
        $post = $pd->getPost($_REQUEST['t']);
        $public_tweet_replies = $pd->getPublicRepliesToPost($post->post_id);
        $public_retweets = $pd->getRetweetsOfPost($post->post_id, true);
        $s->assign('post', $post);
        $s->assign('replies', $public_tweet_replies);
        $s->assign('retweets', $public_retweets);
        $rtreach = 0;
        foreach ($public_retweets as $t) {
            $rtreach += $t->author->follower_count;
        }
        $s->assign('rtreach', $rtreach);
        $s->assign('site_root', $THINKTANK_CFG['site_root_path']);
    }
    $s->display('public.tpl', $_REQUEST['t']);
} elseif (isset($_REQUEST['v'])) {
    $view = $_REQUEST['v'];
    switch ($view) {
        case 'timeline':
Exemple #7
0
 $u = new Utils();
 // BUG: THIS ISN'T GOING TO WORK WHEN LOOKING AT POSTS OF OTHER USERS BECAUSE THEY DON'T HAVE INSTANCES
 //$id = new InstanceDAO($db);
 //$i = $id->getByUsername($post->author_username);
 // instead, lets pull the instance object out of the session variable
 $i = unserialize($_SESSION['instance']);
 if (isset($i)) {
     $s->assign('likely_orphans', $pd->getLikelyOrphansForParent($post->pub_date, $i->network_user_id, $post->author_username, 15));
     $s->assign('all_tweets', $pd->getAllPosts($i->network_user_id, 15));
 }
 $cfg = new Config($i->network_username, $i->network_user_id);
 // instantiate data access objects
 $ud = new UserDAO($db);
 $all_replies = $pd->getRepliesToPost($post_id);
 $all_replies_count = count($all_replies);
 $all_retweets = $pd->getRetweetsOfPost($post_id);
 $retweet_reach = $pd->getPostReachViaRetweets($post_id);
 $public_replies = $pd->getPublicRepliesToPost($post_id);
 $public_replies_count = count($public_replies);
 $private_replies_count = $all_replies_count - $public_replies_count;
 $post = $pd->getPost($post_id);
 $s->assign('post', $post);
 $s->assign('replies', $all_replies);
 $s->assign('retweets', $all_retweets);
 $s->assign('retweet_reach', $retweet_reach);
 $s->assign('public_reply_count', $public_replies_count);
 $s->assign('private_reply_count', $private_replies_count);
 $s->assign('reply_count', $all_replies_count);
 $s->assign('cfg', $cfg);
 $s->assign('instance', $i);
 $s->assign('i', $i);
Exemple #8
0
 if (!$s->is_cached('status.index.tpl', $status_id)) {
     $post = $pd->getPost($status_id);
     $u = new Utils();
     // BUG: THIS ISN'T GOING TO WORK WHEN LOOKING AT POSTS OF OTHER USERS BECAUSE THEY DON'T HAVE INSTANCES
     $id = new InstanceDAO($db);
     $i = $id->getByUsername($post->author_username);
     if (isset($i)) {
         $s->assign('likely_orphans', $pd->getLikelyOrphansForParent($post->pub_date, $i->network_user_id, $post->author_username, 15));
         $s->assign('all_tweets', $pd->getAllPosts($i->network_user_id, 15));
     }
     $cfg = new Config($i->network_username, $i->network_user_id);
     // instantiate data access objects
     $ud = new UserDAO($db);
     $all_replies = $pd->getRepliesToPost($status_id);
     $all_replies_count = count($all_replies);
     $all_retweets = $pd->getRetweetsOfPost($status_id);
     $retweet_reach = $pd->getPostReachViaRetweets($status_id);
     $public_replies = $pd->getPublicRepliesToPost($status_id);
     $public_replies_count = count($public_replies);
     $private_replies_count = $all_replies_count - $public_replies_count;
     $post = $pd->getPost($status_id);
     $s->assign('post', $post);
     $s->assign('replies', $all_replies);
     $s->assign('retweets', $all_retweets);
     $s->assign('retweet_reach', $retweet_reach);
     $s->assign('public_reply_count', $public_replies_count);
     $s->assign('private_reply_count', $private_replies_count);
     $s->assign('reply_count', $all_replies_count);
     $s->assign('cfg', $cfg);
     $s->assign('instance', $i);
     $s->assign('i', $i);