Exemple #1
0
$count = 15;
if (isset($_REQUEST['page'])) {
    $page = $_REQUEST['page'];
} 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'])) {
Exemple #2
0
session_start();
if (!isset($_SESSION['user'])) {
    header("Location: /session/login.php");
}
// set up
chdir("..");
require_once 'config.webapp.inc.php';
ini_set("include_path", ini_get("include_path") . PATH_SEPARATOR . $INCLUDE_PATH);
require_once "init.php";
$db = new Database($THINKTANK_CFG);
$conn = $db->getConnection();
$td = new TweetDAO($db);
if (isset($_REQUEST['t']) && is_numeric($_REQUEST['t']) && $td->isTweetInDB($_REQUEST['t'])) {
    $status_id = $_REQUEST['t'];
    $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);
Exemple #3
0
}
// set up
chdir("..");
require_once 'init.php';
$od = DAOFactory::getDAO('OwnerDAO');
$ud = DAOFactory::getDAO('UserDAO');
$fd = DAOFactory::getDAO('FollowDAO');
$id = DAOFactory::getDAO('InstanceDAO');
$pd = DAOFactory::getDAO('PostDAO');
$s = new SmartyThinkTank();
if (isset($_REQUEST['u']) && $ud->isUserInDBByName($_REQUEST['u']) && isset($_REQUEST['i'])) {
    $user = $ud->getUserByName($_REQUEST['u']);
    $owner = $od->getByEmail($_SESSION['user']);
    $i = $id->getByUsername($_REQUEST['i']);
    if (isset($i)) {
        if (!$s->is_cached('user.index.tpl', $i->network_username . "-" . $user->username)) {
            $s->assign('instances', $id->getByOwner($owner));
            $s->assign('profile', $user);
            $s->assign('user_statuses', $pd->getAllPosts($user->user_id, 20));
            $s->assign('sources', $pd->getStatusSources($user->user_id));
            $s->assign('site_root_path', $config->getValue('site_root_path'));
            $s->assign('instance', $i);
            $exchanges = $pd->getExchangesBetweenUsers($i->network_user_id, $user->user_id);
            $s->assign('exchanges', $exchanges);
            $s->assign('total_exchanges', count($exchanges));
            $mutual_friends = $fd->getMutualFriends($user->user_id, $i->network_user_id);
            $s->assign('mutual_friends', $mutual_friends);
            $s->assign('total_mutual_friends', count($mutual_friends));
        }
        $db->closeConnection($conn);
        $s->display('user.index.tpl', $i->network_username . "-" . $user->username);
Exemple #4
0
     } else {
         $i = $id->getByUsername($username);
     }
 } else {
     $i = $id->getFreshestByOwnerId($owner->id);
     if (!isset($i) && $i == null) {
         $s->assign('msg', 'You have no Twitter accounts configured. <a href="' . $THINKTANK_CFG['site_root_path'] . 'account/?p=twitter">Set up a Twitter account here</a>');
         $s->display('message.tpl');
         $db->closeConnection($conn);
         die;
     }
 }
 // save the session instance network username to the current instance
 $_SESSION['network_username'] = $i->network_username;
 $_SESSION['instance'] = serialize($i);
 if (!$s->is_cached('index.tpl', $i->network_username . "-" . $_SESSION['user'])) {
     $cfg = new Config($i->network_username, $i->network_user_id);
     $u = new Utils();
     // instantiate data access objects
     $ud = new UserDAO($db);
     $pd = new PostDAO($db);
     $fd = new FollowDAO($db);
     // pass data to smarty
     $owner_stats = $ud->getDetails($i->network_user_id);
     $s->assign('owner_stats', $owner_stats);
     $s->assign('instance', $i);
     $s->assign('instances', $id->getByOwner($owner));
     $s->assign('cfg', $cfg);
     $total_follows_with_errors = $fd->getTotalFollowsWithErrors($cfg->twitter_user_id);
     $s->assign('total_follows_with_errors', $total_follows_with_errors);
     $total_follows_with_full_details = $fd->getTotalFollowsWithFullDetails($cfg->twitter_user_id);
Exemple #5
0
// set up
require_once 'config.webapp.inc.php';
ini_set("include_path", ini_get("include_path") . PATH_SEPARATOR . $INCLUDE_PATH);
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'])) {
Exemple #6
0
    if (!$oid->doesOwnerHaveAccess($owner, $username)) {
        echo 'Insufficient privileges. <a href="/">Back</a>.';
        $db->closeConnection($conn);
        die;
    } else {
        $i = $id->getByUsername($username);
    }
} else {
    $db->closeConnection($conn);
    die;
}
if (!isset($_REQUEST['d'])) {
    $_REQUEST['d'] = "all-tweets";
}
$s = new SmartyThinkTank();
if (!$s->is_cached('inline.view.tpl', $i->network_username . "-" . $_SESSION['user'] . "-" . $_REQUEST['d'])) {
    $cfg = new Config($i->network_username, $i->network_user_id);
    $s->assign('cfg', $cfg);
    $s->assign('i', $i);
    $u = new Utils();
    // instantiate data access objects
    $ud = new UserDAO($db);
    $pd = new PostDAO($db);
    $fd = new FollowDAO($db);
    $ld = new LinkDAO($db);
    $s->assign('display', $_REQUEST['d']);
    // pass data to smarty
    switch ($_REQUEST['d']) {
        case "tweets-all":
            $s->assign('header', 'All Posts');
            $s->assign('all_tweets', $pd->getAllPosts($i->network_user_id, 15));
Exemple #7
0
         echo 'Insufficient privileges. <a href="/">Back</a>.';
         $db->closeConnection($conn);
         die;
     } else {
         $i = $id->getByUsername($username);
     }
 } else {
     $i = $id->getFreshestByOwnerId($owner->id);
     if (!isset($i) && $i == null) {
         echo 'You have no Twitter accounts configured. <a href="' . $THINKTANK_CFG['site_root_path'] . 'account/">Set up a Twitter account here</a>';
         $db->closeConnection($conn);
         die;
     }
 }
 $s = new SmartyThinkTank();
 if (!$s->is_cached('index.tpl', $i->twitter_username . "-" . $_SESSION['user'])) {
     $cfg = new Config($i->twitter_username, $i->twitter_user_id);
     $u = new Utils();
     // instantiate data access objects
     $ud = new UserDAO($db);
     $td = new TweetDAO($db);
     $fd = new FollowDAO($db);
     // pass data to smarty
     $owner_stats = $ud->getDetails($cfg->twitter_user_id);
     $s->assign('owner_stats', $owner_stats);
     $s->assign('instance', $i);
     $s->assign('instances', $id->getByOwner($owner));
     $s->assign('cfg', $cfg);
     $total_follows_with_errors = $fd->getTotalFollowsWithErrors($cfg->twitter_user_id);
     $s->assign('total_follows_with_errors', $total_follows_with_errors);
     $total_follows_with_full_details = $fd->getTotalFollowsWithFullDetails($cfg->twitter_user_id);
Exemple #8
0
require_once 'config.webapp.inc.php';
ini_set("include_path", ini_get("include_path") . PATH_SEPARATOR . $INCLUDE_PATH);
require_once "init.php";
$db = new Database($THINKTANK_CFG);
$conn = $db->getConnection();
$ud = new UserDAO($db);
$fd = new FollowDAO($db);
$id = new InstanceDAO($db);
$td = new TweetDAO($db);
if (isset($_REQUEST['u']) && $ud->isUserInDBByName($_REQUEST['u']) && isset($_REQUEST['i'])) {
    $user = $ud->getUserByName($_REQUEST['u']);
    $i = $id->getByUsername($_REQUEST['i']);
    if (isset($i)) {
        $cfg = new Config($i->twitter_username, $i->twitter_user_id);
        $s = new SmartyThinkTank();
        if (!$s->is_cached('user.index.tpl', $i->twitter_username . "-" . $user['user_name'])) {
            $s->assign('profile', $user);
            $s->assign('user_statuses', $td->getAllTweets($user['user_id'], 20));
            $s->assign('sources', $td->getStatusSources($user['user_id']));
            $s->assign('cfg', $cfg);
            $s->assign('instance', $i);
            $exchanges = $td->getExchangesBetweenUsers($cfg->twitter_user_id, $user['user_id']);
            $s->assign('exchanges', $exchanges);
            $s->assign('total_exchanges', count($exchanges));
            $mutual_friends = $fd->getMutualFriends($user['user_id'], $i->twitter_user_id);
            $s->assign('mutual_friends', $mutual_friends);
            $s->assign('total_mutual_friends', count($mutual_friends));
        }
        $db->closeConnection($conn);
        $s->display('user.index.tpl', $i->twitter_username . "-" . $user['user_name']);
    }
Exemple #9
0
<?php

// set up
require_once 'config.webapp.inc.php';
ini_set("include_path", ini_get("include_path") . PATH_SEPARATOR . $INCLUDE_PATH);
require_once "init.php";
$db = new Database($THINKTANK_CFG);
$conn = $db->getConnection();
$td = new TweetDAO($db);
$s = new SmartyThinkTank();
// 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);
        $s->assign('tweet', $tweet);
        $s->assign('replies', $public_tweet_replies);
        $s->assign('site_root', $THINKTANK_CFG['site_root_path']);
    }
    $s->display('public.tpl', $_REQUEST['t']);
} else {
    if (!$s->is_cached('public.tpl')) {
        $s->assign('tweets', $td->getTweetsByPublicInstances());
        $s->assign('site_root', $THINKTANK_CFG['site_root_path']);
    }
    $s->display('public.tpl');
}
Exemple #10
0
        $db->closeConnection($conn);
        die;
    } else {
        $i = $id->getByUsernameOnNetwork($username, $_REQUEST['n']);
    }
} else {
    $db->closeConnection($conn);
    die;
}
if (!isset($_REQUEST['d'])) {
    $_REQUEST['d'] = "all-tweets";
}
$webapp->setActivePlugin($i->network);
$s = new SmartyThinkTank();
// instantiate data access objects
$ud = DAOFactory::getDAO('UserDAO');
$pd = DAOFactory::getDAO('PostDAO');
$fd = DAOFactory::getDAO('FollowDAO');
$ld = DAOFactory::getDAO('LinkDAO');
// pass data to smarty
$view_template = $webapp->loadRequestedTabData($_GET["d"], $i);
if (!$s->is_cached($view_template, $i->network_username . "-" . $_SESSION['user'] . "-" . $_REQUEST['d'])) {
    $s->assign('site_root_path', $config->getValue('site_root_path'));
    $s->assign('i', $i);
    $u = new Utils();
    $s->assign('display', $_REQUEST['d']);
}
# clean up
$db->closeConnection($conn);
//echo "TEMPLATE: ".$view_template;
$s->display($view_template, $i->network_username . "-" . $_SESSION['user'] . "-" . $_REQUEST['d']);