コード例 #1
0
function clear_jabber($id)
{
    $user = User::getKV('id', $id);
    if ($user && $user->jabber) {
        echo "clearing user {$id}'s user.jabber, was: {$user->jabber}";
        if (have_option('dry-run')) {
            echo " (SKIPPING)";
        } else {
            $original = clone $user;
            $user->jabber = null;
            try {
                $user->updateWithKeys($original);
            } catch (Exception $e) {
                echo "WARNING: user update failed (setting jabber to null): " . $e->getMessage() . "\n";
            }
        }
        echo "\n";
    } else {
        if (!$user) {
            echo "Missing user for {$id}\n";
        } else {
            echo "Cleared jabber already for {$id}\n";
        }
    }
}
コード例 #2
0
function sphinx_base()
{
    if (have_option('base')) {
        return get_option_value('base');
    } else {
        return "/usr/local/sphinx";
    }
}
コード例 #3
0
function sphinx_index_update($sn)
{
    $base = sphinx_base();
    $baseIndexes = array('notice', 'profile');
    $params = array();
    if (have_option('rotate')) {
        $params[] = '--rotate';
    }
    foreach ($baseIndexes as $index) {
        $params[] = "{$sn->dbname}_{$index}";
    }
    $params = implode(' ', $params);
    $cmd = "{$base}/bin/indexer --config {$base}/etc/sphinx.conf {$params}";
    print "{$cmd}\n";
    system($cmd);
}
コード例 #4
0
function importActivityStream($user, $doc)
{
    $feed = $doc->documentElement;
    $entries = $feed->getElementsByTagNameNS(Activity::ATOM, 'entry');
    for ($i = $entries->length - 1; $i >= 0; $i--) {
        $entry = $entries->item($i);
        $activity = new Activity($entry, $feed);
        $object = $activity->objects[0];
        if (!have_option('q', 'quiet')) {
            print $activity->content . "\n";
        }
        $html = getTweetHtml($object->link);
        $config = array('safe' => 1, 'deny_attribute' => 'class,rel,id,style,on*');
        $html = htmLawed($html, $config);
        $content = html_entity_decode(strip_tags($html), ENT_QUOTES, 'UTF-8');
        $notice = Notice::saveNew($user->id, $content, 'importtwitter', array('uri' => $object->id, 'url' => $object->link, 'rendered' => $html, 'created' => common_sql_date($activity->time), 'replies' => array(), 'groups' => array()));
    }
}
コード例 #5
0
function updateProfileURL($user)
{
    $profile = $user->getProfile();
    if (empty($profile)) {
        throw new Exception("Can't find profile for user {$user->nickname} ({$user->id})");
    }
    $orig = clone $profile;
    $profile->profileurl = common_profile_url($user->nickname);
    if (!have_option('q', 'quiet')) {
        print "Updating profile url for {$user->nickname} ({$user->id}) " . "from {$orig->profileurl} to {$profile->profileurl}...";
    }
    $result = $profile->update($orig);
    if (!$result) {
        print "FAIL.\n";
        common_log_db_error($profile, 'UPDATE', __FILE__);
        throw new Exception("Can't update profile for user {$user->nickname} ({$user->id})");
    }
    common_broadcast_profile($profile);
    print "OK.\n";
}
コード例 #6
0
function clear_jabber($id)
{
    $user = User::staticGet('id', $id);
    if ($user && $user->jabber) {
        echo "clearing user {$id}'s user.jabber, was: {$user->jabber}";
        if (have_option('dry-run')) {
            echo " (SKIPPING)";
        } else {
            $original = clone $user;
            $user->jabber = null;
            $result = $user->updateKeys($original);
        }
        echo "\n";
    } else {
        if (!$user) {
            echo "Missing user for {$id}\n";
        } else {
            echo "Cleared jabber already for {$id}\n";
        }
    }
}
コード例 #7
0
function siteStreamForOwner(User $user)
{
    // The user we auth as must be the owner of the application.
    $auth = twitterAuthForUser($user);
    if (have_option('apiroot')) {
        $stream = new TwitterSiteStream($auth, get_option_value('apiroot'));
    } else {
        $stream = new TwitterSiteStream($auth);
    }
    // Pull Twitter user IDs for all users we want to pull data for
    $userIds = array();
    $flink = new Foreign_link();
    $flink->service = TWITTER_SERVICE;
    $flink->find();
    while ($flink->fetch()) {
        if (($flink->noticesync & FOREIGN_NOTICE_RECV) == FOREIGN_NOTICE_RECV) {
            $userIds[] = $flink->foreign_id;
        }
    }
    $stream->followUsers($userIds);
    return $stream;
}
コード例 #8
0
ファイル: slap.php プロジェクト: bashrc/gnusocial-debian
print "\n\n";
echo "== Testing local verification ==\n\n";
$magic_env = new MagicEnvelope($envxml);
$activity = new Activity($magic_env->getPayload()->documentElement);
$actprofile = Profile::fromUri($activity->actor->id);
$ok = $magic_env->verify($actprofile);
if ($ok) {
    print "OK\n\n";
} else {
    print "FAIL\n\n";
}
if (have_option('--verify')) {
    $url = 'http://www.madebymonsieur.com/ostatus_discovery/magic_env/validate/';
    echo "== Testing remote verification ==\n\n";
    print "Sending for verification to {$url} ...\n";
    $client = new HTTPClient();
    $response = $client->post($url, array(), array('magic_env' => $envxml));
    print $response->getStatus() . "\n\n";
    print $response->getBody() . "\n\n";
}
if (have_option('--slap')) {
    $url = get_option_value('--slap');
    echo "== Remote salmon slap ==\n\n";
    print "Sending signed Salmon slap to {$url} ...\n";
    $ok = Salmon::post($url, $entry, $profile->getUser());
    if ($ok) {
        print "OK\n\n";
    } else {
        print "FAIL\n\n";
    }
}
コード例 #9
0
$shortoptions = 'i:n:f:a:j';
$longoptions = array('id=', 'nickname=', 'file=', 'after=', 'json');
$helptext = <<<END_OF_EXPORTACTIVITYSTREAM_HELP
exportactivitystream.php [options]
Export a StatusNet user history to a file

  -i --id       ID of user to export
  -n --nickname nickname of the user to export
  -j --json     Output JSON (default Atom)
  -a --after    Only activities after the given date

END_OF_EXPORTACTIVITYSTREAM_HELP;
require_once INSTALLDIR . '/scripts/commandline.inc';
try {
    $user = getUser();
    if (have_option('a', 'after')) {
        $afterStr = get_option_value('a', 'after');
        $after = strtotime($afterStr);
        $actstr = new UserActivityStream($user, true, UserActivityStream::OUTPUT_RAW, $after);
    } else {
        $actstr = new UserActivityStream($user, true, UserActivityStream::OUTPUT_RAW);
    }
    if (have_option('j', 'json')) {
        $actstr->writeJSON(STDOUT);
    } else {
        print $actstr->getString();
    }
} catch (Exception $e) {
    print $e->getMessage() . "\n";
    exit(1);
}
コード例 #10
0
                        if ($e > $st && $e <= $jt) {
                            printfv("{$i} Making a new group join\n");
                            newJoin($n, $g);
                        } else {
                            printfv("No event for {$i}!");
                        }
                    }
                }
            }
        }
    }
}
$usercount = have_option('u', 'users') ? get_option_value('u', 'users') : 100;
$groupcount = have_option('g', 'groups') ? get_option_value('g', 'groups') : 20;
$noticeavg = have_option('n', 'notices') ? get_option_value('n', 'notices') : 100;
$subsavg = have_option('b', 'subscriptions') ? get_option_value('b', 'subscriptions') : max($usercount / 20, 10);
$joinsavg = have_option('j', 'joins') ? get_option_value('j', 'joins') : 5;
$tagmax = have_option('t', 'tags') ? get_option_value('t', 'tags') : 10000;
$userprefix = have_option('x', 'prefix') ? get_option_value('x', 'prefix') : 'testuser';
$groupprefix = have_option('z', 'groupprefix') ? get_option_value('z', 'groupprefix') : 'testgroup';
$wordsfile = have_option('w', 'words') ? get_option_value('w', 'words') : '/usr/share/dict/words';
if (is_readable($wordsfile)) {
    $words = file($wordsfile);
} else {
    $words = null;
}
try {
    main($usercount, $groupcount, $noticeavg, $subsavg, $joinsavg, $tagmax);
} catch (Exception $e) {
    printfv("Got an exception: " . $e->getMessage());
}
コード例 #11
0
ファイル: settag.php プロジェクト: microcosmx/experiments
    exit(0);
}
$tag = $args[1];
$i = array_search($tag, $tags);
if ($i !== false) {
    if (have_option('d', 'delete')) {
        // Delete
        unset($tags[$i]);
        $result = $sn->setTags($tags);
        if (!$result) {
            print "Couldn't update.\n";
            exit(-1);
        }
    } else {
        print "Already set.\n";
        exit(-1);
    }
} else {
    if (have_option('d', 'delete')) {
        // Delete
        print "No such tag.\n";
        exit(-1);
    } else {
        $tags[] = $tag;
        $result = $sn->setTags($tags);
        if (!$result) {
            print "Couldn't update.\n";
            exit(-1);
        }
    }
}
コード例 #12
0
ファイル: createsim.php プロジェクト: microcosmx/experiments
    $from->free();
    $to->free();
}
function main($usercount, $noticeavg, $subsavg, $tagmax)
{
    global $config;
    $config['site']['dupelimit'] = -1;
    $n = 1;
    newUser(0);
    // # registrations + # notices + # subs
    $events = $usercount + $usercount * ($noticeavg + $subsavg);
    for ($i = 0; $i < $events; $i++) {
        $e = rand(0, 1 + $noticeavg + $subsavg);
        if ($e == 0) {
            newUser($n);
            $n++;
        } else {
            if ($e < $noticeavg + 1) {
                newNotice($n, $tagmax);
            } else {
                newSub($n);
            }
        }
    }
}
$usercount = have_option('u', 'users') ? get_option_value('u', 'users') : 100;
$noticeavg = have_option('n', 'notices') ? get_option_value('n', 'notices') : 100;
$subsavg = have_option('b', 'subscriptions') ? get_option_value('b', 'subscriptions') : max($usercount / 20, 10);
$tagmax = have_option('t', 'tags') ? get_option_value('t', 'tags') : 10000;
$userprefix = have_option('x', 'prefix') ? get_option_value('x', 'prefix') : 'testuser';
main($usercount, $noticeavg, $subsavg, $tagmax);
コード例 #13
0
$longoptions = array('oauth_token=', 'token_secret=');
$helptext = <<<END_OF_VERIFY_HELP
  verifycreds.php [options]
  Use an access token to verify credentials thru the api

    -o --oauth_token       access token
    -s --token_secret      access token secret

END_OF_VERIFY_HELP;
$token = null;
$token_secret = null;
require_once INSTALLDIR . '/scripts/commandline.inc';
if (have_option('o', 'oauth_token')) {
    $token = get_option_value('oauth_token');
}
if (have_option('s', 'token_secret')) {
    $token_secret = get_option_value('s', 'token_secret');
}
if (empty($token)) {
    print "Please specify an access token.\n";
    exit(1);
}
if (empty($token_secret)) {
    print "Please specify an access token secret.\n";
    exit(1);
}
$ini = parse_ini_file("oauth.ini");
$test_consumer = new OAuthConsumer($ini['consumer_key'], $ini['consumer_secret']);
$endpoint = $ini['apiroot'] . '/account/verify_credentials.xml';
print "{$endpoint}\n";
$at = new OAuthToken($token, $token_secret);
コード例 #14
0
                        Subscription::start($profile, $friend_profile);
                        common_log(LOG_INFO, $this->name() . ' - Subscribed ' . "{$friend_profile->nickname} to {$profile->nickname}.");
                    } catch (Exception $e) {
                        common_debug($this->name() . ' - Tried and failed subscribing ' . "{$friend_profile->nickname} to {$profile->nickname} - " . $e->getMessage());
                    }
                }
            }
        }
        return true;
    }
}
$id = null;
$debug = null;
if (have_option('i')) {
    $id = get_option_value('i');
} else {
    if (have_option('--id')) {
        $id = get_option_value('--id');
    } else {
        if (count($args) > 0) {
            $id = $args[0];
        } else {
            $id = null;
        }
    }
}
if (have_option('d') || have_option('debug')) {
    $debug = true;
}
$syncer = new SyncTwitterFriendsDaemon($id, 60, 2, $debug);
$syncer->runOnce();
コード例 #15
0
Pull an Atom feed and run items in it as though they were live PuSH updates.
Mainly intended for testing funky feed formats.

     --skip=N   Ignore the first N items in the feed.
     --count=N  Only process up to N items from the feed, after skipping.


END_OF_HELP;
require_once INSTALLDIR . '/scripts/commandline.inc';
if (empty($args[0]) || !Validate::uri($args[0])) {
    print "{$helptext}";
    exit(1);
}
$feedurl = $args[0];
$skip = have_option('skip') ? intval(get_option_value('skip')) : 0;
$count = have_option('count') ? intval(get_option_value('count')) : 0;
$sub = FeedSub::staticGet('topic', $feedurl);
if (!$sub) {
    print "Feed {$feedurl} is not subscribed.\n";
    exit(1);
}
$xml = file_get_contents($feedurl);
if ($xml === false) {
    print "Bad fetch.\n";
    exit(1);
}
$feed = new DOMDocument();
if (!$feed->loadXML($xml)) {
    print "Bad XML.\n";
    exit(1);
}
コード例 #16
0
function updateGroupUri($group)
{
    if (!have_option('q', 'quiet')) {
        print "Updating URI for group '" . $group->nickname . "' (" . $group->id . ")...";
    }
    if (empty($group->uri)) {
        // Using clone here was screwing up the group->find() iteration
        $orig = User_group::staticGet('id', $group->id);
        $group->uri = $group->getUri();
        if (have_option('dry_run')) {
            echo " would have set {$group->uri} ";
        } else {
            if (!$group->update($orig)) {
                throw new Exception("Can't update uri for group " . $group->nickname . ".");
            }
            echo " set {$group->uri} ";
        }
    } else {
        print " already set, keeping {$group->uri} ";
    }
    if (have_option('v', 'verbose')) {
        print "DONE.";
    }
    if (!have_option('q', 'quiet') || have_option('v', 'verbose')) {
        print "\n";
    }
}
コード例 #17
0
$longoptions = array('dry-run');
$helptext = <<<END_OF_HELP
rm_bad_feedsubs.php [options]
Deletes feedsub records that are in the inconsistent state of "subscribe"
and are older than one hour. If the hub hasn't answered back in an hour
the hub is probably either broken or doesn't exist.'

      Options:

    -d --dry-run look but don't mess with it


END_OF_HELP;
require_once INSTALLDIR . '/scripts/commandline.inc';
$dry = false;
if (have_option('d') || have_option('dry-run')) {
    $dry = true;
}
echo "Looking for feed subscriptions with dirty no good huburis...\n";
$feedsub = new FeedSub();
$feedsub->sub_state = 'subscribe';
$feedsub->whereAdd('created < DATE_SUB(NOW(), INTERVAL 1 HOUR)');
$feedsub->find();
$cnt = 0;
while ($feedsub->fetch()) {
    echo "----------------------------------------------------------------------------------------\n";
    echo '           feed: ' . $feedsub->uri . "\n" . '        hub uri: ' . $feedsub->huburi . "\n" . ' subscribe date: ' . date('r', strtotime($feedsub->created)) . "\n";
    if (!$dry) {
        $feedsub->delete();
        echo "                 (DELETED)\n";
    } else {
コード例 #18
0
ファイル: sendemailsummary.php プロジェクト: Grasia/bolotweet
 */
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../..'));
$shortoptions = 'i:n:au';
$longoptions = array('id=', 'nickname=', 'all', 'universe');
$helptext = <<<END_OF_SENDEMAILSUMMARY_HELP
sendemailsummary.php [options]
Send an email summary of the inbox to users

 -i --id       ID of user to send summary to
 -n --nickname nickname of the user to send summary to
 -a --all      send summary to all users
 -u --universe send summary to all users on all sites

END_OF_SENDEMAILSUMMARY_HELP;
require_once INSTALLDIR . '/scripts/commandline.inc';
if (have_option('u', 'universe')) {
    $sn = new Status_network();
    if ($sn->find()) {
        while ($sn->fetch()) {
            $server = $sn->getServerName();
            StatusNet::init($server);
            // Different queue manager, maybe!
            $qm = QueueManager::get();
            $qm->enqueue(1, 'sitesum');
        }
    }
} else {
    $qm = QueueManager::get();
    // enqueue summary for user or all users
    try {
        $user = getUser();
コード例 #19
0
    }
    echo "After:\n";
    showProfileInfo($oprofile);
    return true;
}
$ok = true;
$validate = new Validate();
if (have_option('all')) {
    $oprofile = new Ostatus_profile();
    $oprofile->find();
    echo "Found {$oprofile->N} profiles:\n\n";
    while ($oprofile->fetch()) {
        $ok = fixProfile($oprofile->uri) && $ok;
    }
} else {
    if (have_option('suspicious')) {
        $oprofile = new Ostatus_profile();
        $oprofile->joinAdd(array('profile_id', 'profile:id'));
        $oprofile->whereAdd("nickname rlike '^[0-9]\$'");
        $oprofile->find();
        echo "Found {$oprofile->N} matching profiles:\n\n";
        while ($oprofile->fetch()) {
            $ok = fixProfile($oprofile->uri) && $ok;
        }
    } else {
        if (!empty($args[0]) && $validate->uri($args[0])) {
            $uri = $args[0];
            $ok = fixProfile($uri);
        } else {
            print "{$helptext}";
            $ok = false;
コード例 #20
0
ファイル: command.php プロジェクト: microcosmx/experiments
    $id = get_option_value('i', 'id');
    $user = User::staticGet('id', $id);
    if (empty($user)) {
        print "Can't find user with ID {$id}\n";
        exit(1);
    }
} else {
    if (have_option('n', 'nickname')) {
        $nickname = get_option_value('n', 'nickname');
        $user = User::staticGet('nickname', $nickname);
        if (empty($user)) {
            print "Can't find user with nickname '{$nickname}'\n";
            exit(1);
        }
    } else {
        if (have_option('o', 'owner')) {
            $user = User::siteOwner();
            if (empty($user)) {
                print "Site has no owner.\n";
                exit(1);
            }
        } else {
            print "You must provide either an ID or a nickname.\n\n";
            print $helptext;
            exit(1);
        }
    }
}
// @todo refactor the interactive console in console.php and use
// that to optionally make an interactive test console here too.
// Would be good to help people test commands when XMPP or email
コード例 #21
0
ファイル: moveuser.php プロジェクト: microcosmx/experiments
  -y --yes      do not wait for confirmation

Remote user identity must be a Webfinger (nickname@example.com) or 
an HTTP or HTTPS URL (http://example.com/social/site/user/nickname).

END_OF_MOVEUSER_HELP;
require_once INSTALLDIR . '/scripts/commandline.inc';
try {
    $user = getUser();
    $remote = get_option_value('r', 'remote');
    if (empty($remote)) {
        show_help();
        exit(1);
    }
    $password = get_option_value('w', 'password');
    if (!have_option('y', 'yes')) {
        print "WARNING: EXPERIMENTAL FEATURE! Moving accounts will delete data from the source site.\n";
        print "\n";
        print "About to PERMANENTLY move user '{$user->nickname}' to {$remote}. Are you sure? [y/N] ";
        $response = fgets(STDIN);
        if (strtolower(trim($response)) != 'y') {
            print "Aborting.\n";
            exit(0);
        }
    }
    $qm = QueueManager::get();
    $qm->enqueue(array($user, $remote, $password), 'acctmove');
} catch (Exception $e) {
    print $e->getMessage() . "\n";
    exit(1);
}
コード例 #22
0
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
$longoptions = array('dry-run');
$helptext = <<<END_OF_USERROLE_HELP
fixup_shadow.php [options]
Patches up stray ostatus_profile entries with corrupted shadow entries
for local users and groups.

     --dry-run  look but don't touch

END_OF_USERROLE_HELP;
require_once INSTALLDIR . '/scripts/commandline.inc';
$dry = have_option('dry-run');
// Look for user.uri matches... These may not match up with the current
// URL schema if the site has changed names.
echo "Checking for bogus ostatus_profile entries matching user.uri...\n";
$user = new User();
$oprofile = new Ostatus_profile();
$user->joinAdd($oprofile, 'INNER', 'oprofile', 'uri');
$user->find();
$count = $user->N;
echo "Found {$count}...\n";
while ($user->fetch()) {
    $uri = $user->uri;
    echo "user {$user->id} ({$user->nickname}) hidden by {$uri}";
    if ($dry) {
        echo " - skipping\n";
    } else {
コード例 #23
0
ファイル: gcfeeds.php プロジェクト: bashrc/gnusocial-debian
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
$longoptions = array('delete-inactive');
$shortoptions = 'd';
$helptext = <<<END_OF_HELP
gcfeeds.php [options]
Clean up feeds that no longer have subscribers.

    -d --delete-inactive    Delete inactive feeds from feedsub table.

END_OF_HELP;
require_once INSTALLDIR . '/scripts/commandline.inc';
$delete_inactive = have_option('d', 'delete-inactive');
$delcount = 0;
$feedsub = new FeedSub();
$feedsub->find();
while ($feedsub->fetch()) {
    try {
        echo $feedsub->getUri() . " ({$feedsub->sub_state})";
        if ($feedsub->garbageCollect()) {
            if ($delete_inactive) {
                $delcount++;
                $feedsub->delete();
                echo " DELETED";
            }
            echo " INACTIVE\n";
        } else {
            echo " ACTIVE\n";
コード例 #24
0
function updateLocation($user)
{
    $profile = $user->getProfile();
    if (empty($profile)) {
        throw new Exception("User has no profile: " . $user->nickname);
    }
    if (empty($profile->location)) {
        if (have_option('v', 'verbose')) {
            print "No location string for '" . $user->nickname . "'\n";
        }
        return;
    }
    if (!empty($profile->location_id) && !have_option('f', 'force')) {
        if (have_option('v', 'verbose')) {
            print "Location ID already set for '" . $user->nickname . "'\n";
        }
        return;
    }
    $loc = Location::fromName($profile->location);
    if (empty($loc)) {
        if (have_option('v', 'verbose')) {
            print "No structured location for string '" . $profile->location . "' for user '" . $user->nickname . "'\n";
        }
        return;
    } else {
        $orig = clone $profile;
        $profile->lat = $loc->lat;
        $profile->lon = $loc->lon;
        $profile->location_id = $loc->location_id;
        $profile->location_ns = $loc->location_ns;
        $result = $profile->update($orig);
        if (!$result) {
            common_log_db_error($profile, 'UPDATE', __FILE__);
        }
        if (!have_option('q', 'quiet')) {
            print "Location ID " . $profile->location_id . " set for user " . $user->nickname . "\n";
        }
    }
    $profile->free();
    unset($loc);
    unset($profile);
    return;
}
コード例 #25
0
ファイル: enviarEmail.php プロジェクト: Grasia/bolotweet
             }
             $profile = $user->getProfile();
             if (empty($profile)) {
                 print "User with ID {$id} has no profile\n";
                 exit(1);
             }
         }
     }
     $members = array($profile);
 } else {
     if (have_option('G', 'group-id') || have_option('g', 'group')) {
         if (have_option('G', 'group-id')) {
             $gid = get_option_value('G', 'group-id');
             $group = User_group::staticGet('id', $gid);
         } else {
             if (have_option('g', 'group')) {
                 $gnick = get_option_value('g', 'group');
                 $group = User_group::staticGet('nickname', $gnick);
             }
         }
         if (empty($group)) {
             print "No such local group: {$gnick}\n\n";
             exit(1);
         }
         $nMiembros = $group->getMemberCount();
         if ($nMiembros == 0) {
             print "El grupo {$gnick} no tiene usuarios.";
             exit(1);
         } else {
             $profile = $group->getMembers();
             while ($profile->fetch()) {
コード例 #26
0
 *
 * @param Foreign_link $flink
 * @param mixed $data
 */
function dumpMessage($flink, $data)
{
    $msg = prepMessage($flink, $data);
    print json_encode($msg) . "\r\n";
}
function prepMessage($flink, $data)
{
    $msg->for_user = $flink->foreign_id;
    $msg->message = $data;
    return $msg;
}
if (have_option('all')) {
    $users = array();
    $flink = new Foreign_link();
    $flink->service = TWITTER_SERVICE;
    $flink->find();
    while ($flink->fetch()) {
        if (($flink->noticesync & FOREIGN_NOTICE_RECV) == FOREIGN_NOTICE_RECV) {
            $users[] = $flink->user_id;
        }
    }
} else {
    $user = User::getKV('nickname', $nickname);
    $users = array($user->id);
}
$output = array();
foreach ($users as $id) {
コード例 #27
0
    -s --oauth_token_secret access token secret
    -u --update             status update


END_OF_VERIFY_HELP;
$token = null;
$token_secret = null;
$update = null;
require_once INSTALLDIR . '/scripts/commandline.inc';
if (have_option('t', 'oauth_token')) {
    $token = get_option_value('t', 'oauth_token');
}
if (have_option('s', 'oauth_token_secret')) {
    $token_secret = get_option_value('s', 'oauth_token_secret');
}
if (have_option('u', 'update')) {
    $update = get_option_value('u', 'update');
}
if (empty($token)) {
    print "Please specify an access token.\n";
    exit(1);
}
if (empty($token_secret)) {
    print "Please specify an access token secret.\n";
    exit(1);
}
if (empty($update)) {
    print "You forgot to update your status!\n";
    exit(1);
}
$ini = parse_ini_file("oauth.ini");
コード例 #28
0
$lop = new LooseOstatusProfile();
if (have_option('u', 'uri')) {
    $lop->uri = get_option_value('u', 'uri');
} else {
    if (!have_option('a', 'all')) {
        show_help();
        exit(1);
    }
}
$cnt = $lop->find();
if (!empty($cnt)) {
    if (!$quiet) {
        echo "Found {$cnt} OStatus profiles:\n";
    }
} else {
    if (have_option('u', 'uri')) {
        if (!$quiet) {
            echo "Couldn't find an existing OStatus profile with that URI.\n";
        }
    } else {
        if (!$quiet) {
            echo "Couldn't find any existing OStatus profiles.\n";
        }
    }
    exit(0);
}
while ($lop->fetch()) {
    if (!$quiet) {
        echo "Updating OStatus profile '{$lop->uri}' ... ";
    }
    try {
コード例 #29
0
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
$shortoptions = 'wt::';
$longoptions = array('welcome', 'template=');
$helptext = <<<END_OF_INSTALLFOREMAIL_HELP

installforemail.php [options] <email address>
Create a new account and, if necessary, a new network for the given email address

-w --welcome   Send a welcome email
-t --template= Use this email template

END_OF_INSTALLFOREMAIL_HELP;
require_once INSTALLDIR . '/scripts/commandline.inc';
$email = $args[0];
$sendWelcome = have_option('w', 'welcome');
if ($sendWelcome && have_option('t', 'template')) {
    $template = get_option_value('t', 'template');
}
try {
    $confirm = DomainStatusNetworkPlugin::registerEmail($email);
    if ($sendWelcome) {
        EmailRegistrationPlugin::sendConfirmEmail($confirm, $template);
    }
    $confirmUrl = common_local_url('register', array('code' => $confirm->code));
    print $confirmUrl . "\n";
} catch (Exception $e) {
    print "ERROR: " . $e->getMessage() . "\n";
}
コード例 #30
0
    -t --oauth_token        authorized request token
    -s --oauth_token_secret authorized request token secret
    -v --oauth_verifier     authorized request token verifier


END_OF_ETOKENS_HELP;
require_once INSTALLDIR . '/scripts/commandline.inc';
$token = $secret = $verifier = null;
if (have_option('t', 'oauth_token')) {
    $token = get_option_value('t', 'oauth_token');
}
if (have_option('s', 'oauth_token_secret')) {
    $secret = get_option_value('s', 'oauth_token_secret');
}
if (have_option('v', 'oauth_verifier')) {
    $verifier = get_option_value('v', 'oauth_verifier');
}
if (empty($token)) {
    print "Please specify the request token (--help for help).\n";
    exit(1);
}
if (empty($secret)) {
    print "Please specify the request token secret (--help for help).\n";
    exit(1);
}
if (empty($verifier)) {
    print "Please specify the request token verifier (--help for help).\n";
    exit(1);
}
$rtok = new OAuthToken($token, $secret);