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 $db->closeConnection($conn); $s->display('account.index.tpl');
} // 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); $s->assign('total_follows_with_full_details', $total_follows_with_full_details); $total_follows_protected = $fd->getTotalFollowsProtected($cfg->twitter_user_id); $s->assign('total_follows_protected', $total_follows_protected); //TODO: Get friends with full details and also friends with errors, same as with followers $total_friends_loaded = $fd->getTotalFriends($cfg->twitter_user_id); $s->assign('total_friends', $total_friends_loaded); $total_friends_with_errors = $fd->getTotalFriendsWithErrors($cfg->twitter_user_id); $s->assign('total_friends_with_errors', $total_friends_with_errors); $total_friends_protected = $fd->getTotalFriendsProtected($cfg->twitter_user_id); $s->assign('total_friends_protected', $total_friends_protected); //Percentages
$successmsg = "Your password has been updated."; } } $s = new SmartyThinkTank(); $s->caching = 0; $cfg = new Config(); $id = new InstanceDAO($db); $od = new OwnerDAO($db); $oid = new OwnerInstanceDAO($db); $owner = $od->getByEmail($_SESSION['user']); $s->assign('cfg', $cfg); $s->assign('owner', $owner); if ($owner->is_admin) { $owners = $od->getAllOwners(); foreach ($owners as $o) { $instances = $id->getByOwner($o, true); $o->setInstances($instances); } $s->assign('owners', $owners); } /* Begin plugin-specific configuration handling */ $cmi = $webapp->getConfigMenu(); $s->assign('config_menu', $cmi); if (!isset($_GET['m']) && isset($_GET['p'])) { $active_plugin = $_GET['p']; } else { if (isset($_GET['m']) && $_GET['m'] == 'manage') { $pld = new PluginDAO($db); $installed_plugins = $pld->getInstalledPlugins($THINKTANK_CFG["source_root_path"]); $s->assign('installed_plugins', $installed_plugins); } else {
$errormsg = "New passwords did not match. Your password has not been changed."; } elseif (strlen($_POST['pass1']) < 5) { $errormsg = "New password must be at least 5 characters. Your password has not been changed."; } else { $cryptpass = $session->pwdcrypt($_POST['pass1']); $od->updatePassword($_SESSION['user'], $cryptpass); $successmsg = "Your password has been updated."; } } $id = new InstanceDAO($db); $od = new OwnerDAO($db); $cfg = new Config(); $s = new SmartyThinkTank(); $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); if ($owner->is_admin) { $owners = $od->getAllOwners(); foreach ($owners as $o) { $instances = $id->getByOwner($o, true); $o->setInstances($instances); } $s->assign('owners', $owners); }
$s = new SmartyThinkTank(); $s->caching = 0; $cfg = new Config(); $id = new InstanceDAO($db); $od = new OwnerDAO($db); $oid = new OwnerInstanceDAO($db); $owner = $od->getByEmail($_SESSION['user']); $s->assign('cfg', $cfg); $s->assign('owner', $owner); // grab instance from session variable $i = unserialize($_SESSION['instance']); $s->assign('instance', $i); if ($owner->is_admin) { $owners = $od->getAllOwners(); foreach ($owners as $o) { $instances = $id->getByOwner($o, true); $o->setInstances($instances); } $s->assign('owners', $owners); } $s->assign('instances', $id->getByOwner($owner)); /* Begin plugin-specific configuration handling */ $cmi = $webapp->getConfigMenu(); $s->assign('config_menu', $cmi); if (!isset($_GET['m']) && isset($_GET['p'])) { $active_plugin = $_GET['p']; } else { if (isset($_GET['m']) && $_GET['m'] == 'manage') { $pld = new PluginDAO($db); $installed_plugins = $pld->getInstalledPlugins($THINKTANK_CFG["source_root_path"]); $s->assign('installed_plugins', $installed_plugins);