$od = new OwnerDAO($db); $owner = $od->getByEmail($_SESSION['user']); $id = new InstanceDAO($db); $s = new SmartyThinkTank(); 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 { $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);