示例#1
0
    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($TWITALYTIC_CFG);
$conn = $db->getConnection();
$id = new InstanceDAO($db);
$od = new OwnerDAO($db);
$cfg = new Config($db);
$s = new SmartyTwitalytic();
$s->caching = 0;
$owner = $od->getByEmail($_SESSION['user']);
$owner_instances = $id->getByOwner($owner);
$to = new TwitterOAuth($cfg->oauth_consumer_key, $cfg->oauth_consumer_secret);
/* Request tokens from twitter */
$tok = $to->getRequestToken();
$token = $tok['oauth_token'];
$_SESSION['oauth_request_token_secret'] = $tok['oauth_token_secret'];
/* Build the authorization URL */
$oauthorize_link = $to->getAuthorizeURL($token);
$s->assign('owner_instances', $owner_instances);
$s->assign('owner', $owner);
$s->assign('cfg', $cfg);
$s->assign('oauthorize_link', $oauthorize_link);
# clean up
$db->closeConnection($conn);
$s->display('account.index.tpl');
示例#2
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($TWITALYTIC_CFG);
$conn = $db->getConnection();
$td = new TweetDAO($db);
$s = new SmartyTwitalytic();
// 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', $TWITALYTIC_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', $TWITALYTIC_CFG['site_root_path']);
    }
    $s->display('public.tpl');
}
示例#3
0
$db = new Database($TWITALYTIC_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 SmartyTwitalytic();
        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']);
    }
} else {
    echo 'This user is not in the system.<br /><a href="' . $TWITALYTIC_CFG['site_root_path'] . '">back home</a>';
}
示例#4
0
        $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);
        $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('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);
    }
    # clean up
    $db->closeConnection($conn);
    $s->display('status.index.tpl', $status_id);
} else {
    echo 'This update is not in the system.<br /><a href="' . $cfg->site_root_path . '">back home</a>';
}
示例#5
0
}
// 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($TWITALYTIC_CFG);
$conn = $db->getConnection();
$od = new OwnerDAO($db);
$owner = $od->getByEmail($_SESSION['user']);
$td = new TweetDAO($db);
$id = new InstanceDAO($db);
if (isset($_REQUEST['u']) && $id->isUserConfigured($_REQUEST['u'])) {
    $username = $_REQUEST['u'];
    $oid = new OwnerInstanceDAO($db);
    if (!$oid->doesOwnerHaveAccess($owner, $username)) {
        echo 'Insufficient privileges. <a href="/">Back</a>.';
        $db->closeConnection($conn);
        die;
    } else {
        $tweets = $td->getAllTweetsByUsername($username);
    }
} else {
    echo 'No access';
    $db->closeConnection($conn);
    die;
}
$s = new SmartyTwitalytic();
$s->assign('tweets', $tweets);
$s->display('status.export.tpl', $username);
示例#6
0
            $s->assign('people', $fd->getMostFollowedFollowees($cfg->twitter_user_id, 15));
            break;
        case "friends-former":
            $s->assign('header', 'Former Friends');
            $s->assign('people', $fd->getFormerFollowees($cfg->twitter_user_id, 15));
            break;
        case "friends-notmutual":
            $s->assign('header', 'Not Mutual Friends');
            $s->assign('people', $fd->getFriendsNotFollowingBack($cfg->twitter_user_id));
            break;
        case "links-friends":
            $s->assign('header', 'Links From Friends');
            $s->assign('description', 'Links your friends tweeted.');
            $s->assign('links', $ld->getLinksByFriends($cfg->twitter_user_id));
            break;
        case "links-favorites":
            $s->assign('header', 'Links From Favorites');
            $s->assign('description', 'Links in tweets you favorited.');
            //$s->assign('links', $ld->getLinksByFriends($cfg->twitter_user_id));
            break;
        case "links-photos":
            $s->assign('header', 'Photos');
            $s->assign('description', 'Photos your friends have tweeted.');
            $s->assign('links', $ld->getPhotosByFriends($cfg->twitter_user_id));
            break;
    }
}
# clean up
$db->closeConnection($conn);
$s->display('inline.view.tpl', $i->twitter_username . "-" . $_SESSION['user'] . "-" . $_REQUEST['d']);
示例#7
0
     $percent_followers_loaded = $percent_followers_loaded > 100 ? 100 : $percent_followers_loaded;
     $percent_tweets_loaded = $u->getPercentage($owner_stats['tweet_count'], $i->total_tweets_in_system);
     $percent_tweets_loaded = $percent_tweets_loaded > 100 ? 100 : $percent_tweets_loaded;
     $percent_friends_loaded = $u->getPercentage($owner_stats['friend_count'], $total_friends_loaded);
     $percent_friends_loaded = $percent_friends_loaded > 100 ? 100 : $percent_friends_loaded;
     $percent_followers_suspended = round($u->getPercentage($total_follows_with_full_details, $total_follows_with_errors), 2);
     $percent_followers_protected = round($u->getPercentage($total_follows_with_full_details, $total_follows_protected), 2);
     $s->assign('percent_followers_loaded', $percent_followers_loaded);
     $s->assign('percent_tweets_loaded', $percent_tweets_loaded);
     $s->assign('percent_friends_loaded', $percent_friends_loaded);
     $s->assign('percent_followers_suspended', $percent_followers_suspended);
     $s->assign('percent_followers_protected', $percent_followers_protected);
 }
 # clean up
 $db->closeConnection($conn);
 $s->display('index.tpl', $i->twitter_username . "-" . $_SESSION['user']);
 /*  People you've gotten the most replies from in the last XXX months (use date of oldest reply)
 
 	select 
 		author_username, count(author_user_id) as total_replies 
 	from
 		reply
 	group by
 		author_user_id
 	order by 
 		total_replies desc
 	limit 5;
 	
 	
 	People you reply to the most since (date of oldest tweet)