ENDOFHELP;
require_once INSTALLDIR.'/scripts/commandline.inc';
-require_once dirname(dirname(__FILE__)) . '/jsonstreamreader.php';
-require_once dirname(dirname(__FILE__)) . '/twitterstreamreader.php';
+require_once dirname(dirname(__FILE__)) . '/lib/jsonstreamreader.php';
+require_once dirname(dirname(__FILE__)) . '/lib/twitterstreamreader.php';
if (have_option('n')) {
$nickname = get_option_value('n');
*/
function twitterAuthForUser(User $user)
{
- $flink = Foreign_link::getByUserID($user->id,
- TWITTER_SERVICE);
- if (!$flink) {
- throw new ServerException("No Twitter config for this user.");
- }
-
+ $flink = Foreign_link::getByUserID($user->id, TWITTER_SERVICE);
$token = TwitterOAuthClient::unpackToken($flink->credentials);
if (!$token) {
throw new ServerException("No Twitter OAuth credentials for this user.");
}
-$user = User::staticGet('nickname', $nickname);
+$user = User::getKV('nickname', $nickname);
global $myuser;
$myuser = $user;
$importer = new TwitterImport();
printf("\timporting...");
$notice = $importer->importStatus($data);
- if ($notice) {
- global $myuser;
- Inbox::insertNotice($myuser->id, $notice->id);
- printf(" %s\n", $notice->id);
- } else {
+ if (!$notice instanceof Notice) {
printf(" FAIL\n");
}
}