Ejemplo n.º 1
0
 $s = new SmartyThinkTank();
 if (!$s->is_cached('status.index.tpl', $status_id)) {
     $tweet = $td->getTweet($status_id);
     $u = new Utils();
     $id = new InstanceDAO($db);
     $i = $id->getByUsername($tweet->author_username);
     if (isset($i)) {
         $s->assign('likely_orphans', $td->getLikelyOrphansForParent($tweet->pub_date, $i->twitter_user_id, $tweet->author_username, 15));
         $s->assign('all_tweets', $td->getAllTweets($i->twitter_user_id, 15));
     }
     $cfg = new Config($i->twitter_username, $i->twitter_user_id);
     // instantiate data access objects
     $ud = new UserDAO($db);
     $all_replies = $td->getRepliesToTweet($status_id);
     $all_replies_count = count($all_replies);
     $all_retweets = $td->getRetweetsOfTweet($status_id);
     $retweet_reach = $td->getTweetReachViaRetweets($status_id);
     $public_replies = $td->getPublicRepliesToTweet($status_id);
     $public_replies_count = count($public_replies);
     $private_replies_count = $all_replies_count - $public_replies_count;
     $tweet = $td->getTweet($status_id);
     $s->assign('tweet', $tweet);
     $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);
 }
Ejemplo n.º 2
0
require_once "init.php";
$db = new Database($THINKTANK_CFG);
$conn = $db->getConnection();
$cfg = new Config();
$td = new TweetDAO($db);
$id = new InstanceDAO($db);
$s = new SmartyThinkTank();
$s->assign('cfg', $cfg);
$i = $id->getInstanceFreshestOne();
$s->assign('crawler_last_run', $i->crawler_last_run);
// show tweet with public replies
if (isset($_REQUEST['t']) && $td->isTweetByPublicInstance($_REQUEST['t'])) {
    if (!$s->is_cached('public.tpl', $_REQUEST['t'])) {
        $tweet = $td->getTweet($_REQUEST['t']);
        $public_tweet_replies = $td->getPublicRepliesToTweet($tweet->status_id);
        $public_retweets = $td->getRetweetsOfTweet($tweet->status_id, true);
        $s->assign('tweet', $tweet);
        $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':