Esempio 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');
}
Esempio n. 2
0
<?php

// set up
require_once 'config.webapp.inc.php';
ini_set("include_path", ini_get("include_path") . ":" . $INCLUDE_PATH);
require_once $root_path . "init.php";
$db = new Database();
$conn = $db->getConnection();
$td = new TweetDAO();
$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');
}
Esempio n. 3
0
    $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);
        $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 {
Esempio n. 4
0
ini_set("include_path", ini_get("include_path") . PATH_SEPARATOR . $INCLUDE_PATH);
require_once "init.php";
$cfg = new Config();
$db = new Database($THINKTANK_CFG);
$s = new SmartyThinkTank();
$c = new Crawler();
$conn = $db->getConnection();
// instantiate data access objects
$ud = new UserDAO($db);
$fd = new FollowDAO($db);
$td = new TweetDAO($db);
$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
#include $root_path.'sql_queries.php';				# Format the SQL queries
# include smarty
require('smarty/libs/Smarty.class.php');
# get user name from u param, default to ginatrapani