Ejemplo n.º 1
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');
}
Ejemplo n.º 2
0
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();
$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']);
Ejemplo n.º 3
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($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
Ejemplo n.º 4
0
echo $_GET["pid"];
echo "<br />";
$pid = $_GET["pid"];
$oid = $_GET["oid"];
$template = $_GET["t"];
$cache_key = $_GET["ck"];
foreach ($oid as $o) {
    echo $o;
    echo "<br />";
}
// 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";
$cfg = new Config();
$db = new Database($TWITALYTIC_CFG);
$conn = $db->getConnection();
$td = new TweetDAO($db);
foreach ($oid as $o) {
    echo "<br />";
    if (isset($_GET["fp"])) {
        $td->assignParent($pid, $o, $_GET["fp"]);
    } else {
        $td->assignParent($pid, $o);
    }
}
$db->closeConnection($conn);
$s = new SmartyTwitalytic();
$s->clear_cache($template, $cache_key);
echo 'Assignment complete.<br /><a href="' . $TWITALYTIC_CFG['site_root_path'] . '?u=' . $_GET['u'] . '#replies">Back home</a>.';
Ejemplo n.º 5
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($TWITALYTIC_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 SmartyTwitalytic();
    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);
        $public_replies = $td->getPublicRepliesToTweet($status_id);
Ejemplo n.º 6
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();
$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);
Ejemplo n.º 7
0
<?php

// set up
chdir("..");
$root_path = realpath('./../include') . "/";
require_once $root_path . "init.php";
$cfg = new Config();
$db = new Database();
$s = new SmartyTwitalytic();
$c = new Crawler();
$conn = $db->getConnection();
// instantiate data access objects
$ud = new UserDAO();
$fd = new FollowDAO();
$td = new TweetDAO();
$c->init();
//TODO error checking here, is tweet in db, etc
$status_id = $_REQUEST['t'];
$s->assign('tweet', $td->getTweet($status_id));
$s->assign('replies', $td->getPublicRepliesToTweet($status_id));
$s->assign('cfg', $cfg);
# clean up
$db->closeConnection($conn);
echo $s->fetch('replies.public.tpl');
/*
$root_path			=  "../uar/includes/";
include $root_path.'environment.php';				# Determine relevant paths
include $root_path.'status_messages.php';			# Turn error code into message
include $root_path.'validate_data.php';				# Validate application data
include $root_path.'api_config.php';				# Configuring the API connection
include $root_path.'database.php';					# Connection to the database
Ejemplo n.º 8
0
    $oid = new OwnerInstanceDAO($db);
    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 SmartyTwitalytic();
if (!$s->is_cached('inline.view.tpl', $i->twitter_username . "-" . $_SESSION['user'] . "-" . $_REQUEST['d'])) {
    $cfg = new Config($i->twitter_username, $i->twitter_user_id);
    $s->assign('cfg', $cfg);
    $s->assign('i', $i);
    $u = new Utils();
    // instantiate data access objects
    $ud = new UserDAO($db);
    $td = new TweetDAO($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 Tweets');
Ejemplo n.º 9
0
    $oid = new OwnerInstanceDAO();
    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 SmartyTwitalytic();
if (!$s->is_cached('inline.view.tpl', $i->twitter_username . "-" . $_SESSION['user'] . "-" . $_REQUEST['d'])) {
    $cfg = new Config($i->twitter_username, $i->twitter_user_id);
    $s->assign('cfg', $cfg);
    $s->assign('i', $i);
    $u = new Utils();
    // instantiate data access objects
    $ud = new UserDAO();
    $td = new TweetDAO();
    $fd = new FollowDAO();
    $s->assign('display', $_REQUEST['d']);
    // pass data to smarty
    switch ($_REQUEST['d']) {
        case "tweets-all":
            $s->assign('header', 'All Tweets');
            $s->assign('all_tweets', $td->getAllTweets($cfg->twitter_user_id, 15));
Ejemplo n.º 10
0
     if (!$oid->doesOwnerHaveAccess($owner, $username)) {
         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="' . $TWITALYTIC_CFG['site_root_path'] . 'account/">Set up a Twitter account here</a>';
         $db->closeConnection($conn);
         die;
     }
 }
 $s = new SmartyTwitalytic();
 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);