[SCRIPTS] Set PUBLICDIR in plugin scripts as well

This commit is contained in:
Alexei Sorokin 2019-09-18 17:15:00 +03:00
parent 6bfa593988
commit ad91ef66bd
35 changed files with 743 additions and 596 deletions

View File

@ -25,7 +25,8 @@
* @link http://www.gnu.org/software/social/ * @link http://www.gnu.org/software/social/
*/ */
define('INSTALLDIR', realpath(__DIR__ . '/../../..')); define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'u:af'; $shortoptions = 'u:af';
$longoptions = ['uri=', 'all', 'force']; $longoptions = ['uri=', 'all', 'force'];

View File

@ -1,3 +1,4 @@
#!/usr/bin/env php
<?php <?php
// This file is part of GNU social - https://www.gnu.org/software/social // This file is part of GNU social - https://www.gnu.org/software/social
// //
@ -19,7 +20,8 @@
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/ */
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..')); define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'i:n:a'; $shortoptions = 'i:n:a';
$longoptions = array('id=', 'nickname=', 'all'); $longoptions = array('id=', 'nickname=', 'all');

View File

@ -1,23 +1,30 @@
#!/usr/bin/env php
<?php <?php
/* // This file is part of GNU social - https://www.gnu.org/software/social
* StatusNet - the distributed open-source microblogging tool //
* Copyright (C) 2012 StatusNet, Inc. // GNU social is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GNU social is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
/**
* Description of this file.
* *
* This program is free software: you can redistribute it and/or modify * @package GNUsocial
* it under the terms of the GNU Affero General Public License as published by * @copyright 2012 StatusNet, Inc.
* the Free Software Foundation, either version 3 of the License, or * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* 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__) . '/../../..')); define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'i:n:a'; $shortoptions = 'i:n:a';
$longoptions = array('id=', 'nickname=', 'all'); $longoptions = array('id=', 'nickname=', 'all');
@ -31,15 +38,15 @@ Test user activities against the spam filter
-a --all All users -a --all All users
END_OF_TESTUSER_HELP; END_OF_TESTUSER_HELP;
require_once INSTALLDIR.'/scripts/commandline.inc'; require_once INSTALLDIR . '/scripts/commandline.inc';
function testAllUsers($filter) { function testAllUsers($filter)
{
$found = false; $found = false;
$offset = 0; $offset = 0;
$limit = 1000; $limit = 1000;
do { do {
$user = new User(); $user = new User();
$user->orderBy('created'); $user->orderBy('created');
$user->limit($offset, $limit); $user->limit($offset, $limit);
@ -56,12 +63,11 @@ function testAllUsers($filter) {
} }
$offset += $found; $offset += $found;
} }
} while ($found > 0); } while ($found > 0);
} }
function testUser($filter, $user) { function testUser($filter, $user)
{
printfnq("Testing user %s\n", $user->nickname); printfnq("Testing user %s\n", $user->nickname);
$profile = Profile::getKV('id', $user->id); $profile = Profile::getKV('id', $user->id);

View File

@ -1,23 +1,28 @@
#!/usr/bin/env php
<?php <?php
/* // This file is part of GNU social - https://www.gnu.org/software/social
* StatusNet - the distributed open-source microblogging tool //
* Copyright (C) 2012 StatusNet, Inc. // GNU social is free software: you can redistribute it and/or modify
* // it under the terms of the GNU Affero General Public License as published by
* This program is free software: you can redistribute it and/or modify // the Free Software Foundation, either version 3 of the License, or
* it under the terms of the GNU Affero General Public License as published by // (at your option) any later version.
* the Free Software Foundation, either version 3 of the License, or //
* (at your option) any later version. // GNU social is distributed in the hope that it will be useful,
* // but WITHOUT ANY WARRANTY; without even the implied warranty of
* This program is distributed in the hope that it will be useful, // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* but WITHOUT ANY WARRANTY; without even the implied warranty of // GNU Affero General Public License for more details.
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
* GNU Affero General Public License for more details. // You should have received a copy of the GNU Affero General Public License
* // along with GNU social. If not, see <http://www.gnu.org/licenses/>.
* 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/>. /**
* @package GNUsocial
* @copyright 2012 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/ */
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..')); define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'i:n:t:'; $shortoptions = 'i:n:t:';
$longoptions = array('id=', 'nickname=', 'category='); $longoptions = array('id=', 'nickname=', 'category=');
@ -34,8 +39,8 @@ END_OF_TRAINUSER_HELP;
require_once INSTALLDIR.'/scripts/commandline.inc'; require_once INSTALLDIR.'/scripts/commandline.inc';
function trainUser($filter, $user, $category) { function trainUser($filter, $user, $category)
{
printfnq("Training user %s\n", $user->nickname); printfnq("Training user %s\n", $user->nickname);
$profile = Profile::getKV('id', $user->id); $profile = Profile::getKV('id', $user->id);

View File

@ -1,24 +1,28 @@
#!/usr/bin/env php #!/usr/bin/env php
<?php <?php
/* // This file is part of GNU social - https://www.gnu.org/software/social
* StatusNet - the distributed open-source microblogging tool //
* Copyright (C) 2010, StatusNet, Inc. // GNU social is free software: you can redistribute it and/or modify
* // it under the terms of the GNU Affero General Public License as published by
* This program is free software: you can redistribute it and/or modify // the Free Software Foundation, either version 3 of the License, or
* it under the terms of the GNU Affero General Public License as published by // (at your option) any later version.
* the Free Software Foundation, either version 3 of the License, or //
* (at your option) any later version. // GNU social is distributed in the hope that it will be useful,
* // but WITHOUT ANY WARRANTY; without even the implied warranty of
* This program is distributed in the hope that it will be useful, // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* but WITHOUT ANY WARRANTY; without even the implied warranty of // GNU Affero General Public License for more details.
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
* GNU Affero General Public License for more details. // You should have received a copy of the GNU Affero General Public License
* // along with GNU social. If not, see <http://www.gnu.org/licenses/>.
* 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/>. /**
* @package GNUsocial
* @copyright 2010 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/ */
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..')); define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$helptext = <<<ENDOFHELP $helptext = <<<ENDOFHELP
USAGE: initialize_fave_tallys.php USAGE: initialize_fave_tallys.php

View File

@ -1,34 +1,30 @@
#!/usr/bin/env php
<?php <?php
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GNU social is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
/** /**
* StatusNet - the distributed open-source microblogging tool
* Copyright (C) 2010 StatusNet, Inc.
*
* Import a bookmarks file as notices
*
* PHP version 5
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* 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/>.
*
* @category Bookmark * @category Bookmark
* @package StatusNet * @package GNUsocial
* @author Evan Prodromou <evan@status.net> * @author Evan Prodromou <evan@status.net>
* @copyright 2010 StatusNet, Inc. * @copyright 2010 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
* @link http://status.net/
*/ */
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../..')); define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'i:n:f:'; $shortoptions = 'i:n:f:';
$longoptions = array('id=', 'nickname=', 'file='); $longoptions = array('id=', 'nickname=', 'file=');
@ -65,19 +61,19 @@ function getBookmarksFile()
if (!file_exists($filename)) { if (!file_exists($filename)) {
// TRANS: Exception thrown when a file upload cannot be found. // TRANS: Exception thrown when a file upload cannot be found.
// TRANS: %s is the file that could not be found. // TRANS: %s is the file that could not be found.
throw new Exception(sprintf(_m('No such file "%s".'),$filename)); throw new Exception(sprintf(_m('No such file "%s".'), $filename));
} }
if (!is_file($filename)) { if (!is_file($filename)) {
// TRANS: Exception thrown when a file upload is incorrect. // TRANS: Exception thrown when a file upload is incorrect.
// TRANS: %s is the irregular file. // TRANS: %s is the irregular file.
throw new Exception(sprintf(_m('Not a regular file: "%s".'),$filename)); throw new Exception(sprintf(_m('Not a regular file: "%s".'), $filename));
} }
if (!is_readable($filename)) { if (!is_readable($filename)) {
// TRANS: Exception thrown when a file upload is not readable. // TRANS: Exception thrown when a file upload is not readable.
// TRANS: %s is the file that could not be read. // TRANS: %s is the file that could not be read.
throw new Exception(sprintf(_m('File "%s" not readable.'),$filename)); throw new Exception(sprintf(_m('File "%s" not readable.'), $filename));
} }
// TRANS: %s is the filename that contains a backup for a user. // TRANS: %s is the filename that contains a backup for a user.
@ -95,7 +91,6 @@ try {
$qm = QueueManager::get(); $qm = QueueManager::get();
$qm->enqueue(array($user, $html), 'dlcsback'); $qm->enqueue(array($user, $html), 'dlcsback');
} catch (Exception $e) { } catch (Exception $e) {
print $e->getMessage()."\n"; print $e->getMessage()."\n";
exit(1); exit(1);

View File

@ -1,26 +1,28 @@
#!/usr/bin/env php #!/usr/bin/env php
<?php <?php
/* // This file is part of GNU social - https://www.gnu.org/software/social
* StatusNet - a distributed open-source microblogging tool //
* Copyright (C) 2011, StatusNet, Inc. // GNU social is free software: you can redistribute it and/or modify
* // it under the terms of the GNU Affero General Public License as published by
* Script to print out current version of the software // the Free Software Foundation, either version 3 of the License, or
* // (at your option) any later version.
* This program is free software: you can redistribute it and/or modify //
* it under the terms of the GNU Affero General Public License as published by // GNU social is distributed in the hope that it will be useful,
* the Free Software Foundation, either version 3 of the License, or // but WITHOUT ANY WARRANTY; without even the implied warranty of
* (at your option) any later version. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* // GNU Affero General Public License for more details.
* This program is distributed in the hope that it will be useful, //
* but WITHOUT ANY WARRANTY; without even the implied warranty of // You should have received a copy of the GNU Affero General Public License
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // along with GNU social. If not, see <http://www.gnu.org/licenses/>.
* GNU Affero General Public License for more details.
* /**
* You should have received a copy of the GNU Affero General Public License * @package GNUsocial
* along with this program. If not, see <http://www.gnu.org/licenses/>. * @copyright 2011 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/ */
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..')); define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'wt::'; $shortoptions = 'wt::';
$longoptions = array('welcome', 'template='); $longoptions = array('welcome', 'template=');
@ -46,7 +48,6 @@ if ($sendWelcome && have_option('t', 'template')) {
} }
try { try {
$confirm = DomainStatusNetworkPlugin::registerEmail($email); $confirm = DomainStatusNetworkPlugin::registerEmail($email);
if ($sendWelcome) { if ($sendWelcome) {
@ -56,7 +57,6 @@ try {
$confirmUrl = common_local_url('register', array('code' => $confirm->code)); $confirmUrl = common_local_url('register', array('code' => $confirm->code));
print $confirmUrl."\n"; print $confirmUrl."\n";
} catch (Exception $e) { } catch (Exception $e) {
print "ERROR: " . $e->getMessage() . "\n"; print "ERROR: " . $e->getMessage() . "\n";
} }

View File

@ -1,26 +1,28 @@
#!/usr/bin/env php #!/usr/bin/env php
<?php <?php
/* // This file is part of GNU social - https://www.gnu.org/software/social
* StatusNet - a distributed open-source microblogging tool //
* Copyright (C) 2011, StatusNet, Inc. // GNU social is free software: you can redistribute it and/or modify
* // it under the terms of the GNU Affero General Public License as published by
* Script to print out current version of the software // the Free Software Foundation, either version 3 of the License, or
* // (at your option) any later version.
* This program is free software: you can redistribute it and/or modify //
* it under the terms of the GNU Affero General Public License as published by // GNU social is distributed in the hope that it will be useful,
* the Free Software Foundation, either version 3 of the License, or // but WITHOUT ANY WARRANTY; without even the implied warranty of
* (at your option) any later version. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* // GNU Affero General Public License for more details.
* This program is distributed in the hope that it will be useful, //
* but WITHOUT ANY WARRANTY; without even the implied warranty of // You should have received a copy of the GNU Affero General Public License
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // along with GNU social. If not, see <http://www.gnu.org/licenses/>.
* GNU Affero General Public License for more details.
* /**
* You should have received a copy of the GNU Affero General Public License * @package GNUsocial
* along with this program. If not, see <http://www.gnu.org/licenses/>. * @copyright 2011 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/ */
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..')); define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$helptext = <<<END_OF_SITEFORDOMAIN_HELP $helptext = <<<END_OF_SITEFORDOMAIN_HELP
sitefordomain.php [options] <email address|domain> sitefordomain.php [options] <email address|domain>

View File

@ -1,26 +1,28 @@
#!/usr/bin/env php #!/usr/bin/env php
<?php <?php
/* // This file is part of GNU social - https://www.gnu.org/software/social
* StatusNet - a distributed open-source microblogging tool //
* Copyright (C) 2011, StatusNet, Inc. // GNU social is free software: you can redistribute it and/or modify
* // it under the terms of the GNU Affero General Public License as published by
* Script to print out current version of the software // the Free Software Foundation, either version 3 of the License, or
* // (at your option) any later version.
* This program is free software: you can redistribute it and/or modify //
* it under the terms of the GNU Affero General Public License as published by // GNU social is distributed in the hope that it will be useful,
* the Free Software Foundation, either version 3 of the License, or // but WITHOUT ANY WARRANTY; without even the implied warranty of
* (at your option) any later version. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* // GNU Affero General Public License for more details.
* This program is distributed in the hope that it will be useful, //
* but WITHOUT ANY WARRANTY; without even the implied warranty of // You should have received a copy of the GNU Affero General Public License
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // along with GNU social. If not, see <http://www.gnu.org/licenses/>.
* GNU Affero General Public License for more details.
* /**
* You should have received a copy of the GNU Affero General Public License * @package GNUsocial
* along with this program. If not, see <http://www.gnu.org/licenses/>. * @copyright 2011 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/ */
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..')); define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$helptext = <<<END_OF_SITEFORDOMAIN_HELP $helptext = <<<END_OF_SITEFORDOMAIN_HELP
sitefordomain.php [options] <email address|domain> sitefordomain.php [options] <email address|domain>

View File

@ -1,24 +1,28 @@
#!/usr/bin/env php #!/usr/bin/env php
<?php <?php
/* // This file is part of GNU social - https://www.gnu.org/software/social
* StatusNet - a distributed open-source microblogging tool //
* Copyright (C) 2011, StatusNet, Inc. // GNU social is free software: you can redistribute it and/or modify
* // it under the terms of the GNU Affero General Public License as published by
* This program is free software: you can redistribute it and/or modify // the Free Software Foundation, either version 3 of the License, or
* it under the terms of the GNU Affero General Public License as published by // (at your option) any later version.
* the Free Software Foundation, either version 3 of the License, or //
* (at your option) any later version. // GNU social is distributed in the hope that it will be useful,
* // but WITHOUT ANY WARRANTY; without even the implied warranty of
* This program is distributed in the hope that it will be useful, // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* but WITHOUT ANY WARRANTY; without even the implied warranty of // GNU Affero General Public License for more details.
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
* GNU Affero General Public License for more details. // You should have received a copy of the GNU Affero General Public License
* // along with GNU social. If not, see <http://www.gnu.org/licenses/>.
* 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/>. /**
* @package GNUsocial
* @copyright 2011 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/ */
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..')); define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'd'; $shortoptions = 'd';
$longoptions = array('dryrun'); $longoptions = array('dryrun');

View File

@ -1,24 +1,28 @@
#!/usr/bin/env php #!/usr/bin/env php
<?php <?php
/* // This file is part of GNU social - https://www.gnu.org/software/social
* StatusNet - a distributed open-source microblogging tool //
* Copyright (C) 2011, StatusNet, Inc. // GNU social is free software: you can redistribute it and/or modify
* // it under the terms of the GNU Affero General Public License as published by
* This program is free software: you can redistribute it and/or modify // the Free Software Foundation, either version 3 of the License, or
* it under the terms of the GNU Affero General Public License as published by // (at your option) any later version.
* the Free Software Foundation, either version 3 of the License, or //
* (at your option) any later version. // GNU social is distributed in the hope that it will be useful,
* // but WITHOUT ANY WARRANTY; without even the implied warranty of
* This program is distributed in the hope that it will be useful, // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* but WITHOUT ANY WARRANTY; without even the implied warranty of // GNU Affero General Public License for more details.
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
* GNU Affero General Public License for more details. // You should have received a copy of the GNU Affero General Public License
* // along with GNU social. If not, see <http://www.gnu.org/licenses/>.
* 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/>. /**
* @package GNUsocial
* @copyright 2011 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/ */
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..')); define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'wt::'; $shortoptions = 'wt::';
$longoptions = array('welcome', 'template='); $longoptions = array('welcome', 'template=');

View File

@ -1,24 +1,28 @@
#!/usr/bin/env php #!/usr/bin/env php
<?php <?php
/* // This file is part of GNU social - https://www.gnu.org/software/social
* StatusNet - a distributed open-source microblogging tool //
* Copyright (C) 2011, StatusNet, Inc. // GNU social is free software: you can redistribute it and/or modify
* // it under the terms of the GNU Affero General Public License as published by
* This program is free software: you can redistribute it and/or modify // the Free Software Foundation, either version 3 of the License, or
* it under the terms of the GNU Affero General Public License as published by // (at your option) any later version.
* the Free Software Foundation, either version 3 of the License, or //
* (at your option) any later version. // GNU social is distributed in the hope that it will be useful,
* // but WITHOUT ANY WARRANTY; without even the implied warranty of
* This program is distributed in the hope that it will be useful, // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* but WITHOUT ANY WARRANTY; without even the implied warranty of // GNU Affero General Public License for more details.
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
* GNU Affero General Public License for more details. // You should have received a copy of the GNU Affero General Public License
* // along with GNU social. If not, see <http://www.gnu.org/licenses/>.
* 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__) . '/../../..')); /**
* @package GNUsocial
* @copyright 2011 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 't:e:auo'; $shortoptions = 't:e:auo';
$longoptions = array('type=', 'email=', 'all', 'universe', 'onetime'); $longoptions = array('type=', 'email=', 'all', 'universe', 'onetime');
@ -61,22 +65,24 @@ $opts = array(); // special options like "onetime"
if (have_option('t', 'type')) { if (have_option('t', 'type')) {
$type = trim(get_option_value('t', 'type')); $type = trim(get_option_value('t', 'type'));
if (!in_array($type, array_keys($types)) && $type !== 'all') { if (!in_array($type, array_keys($types)) && $type !== 'all') {
print _m("Unknown reminder type: {$type}.\n"); echo _m('Unknown reminder type: ' . $type . '.' . "\n");
exit(1); exit(1);
} }
} else { } else {
show_help(); show_help();
exit(1); exit(1);
} }
if (have_option('o', 'onetime')) { if (have_option('o', 'onetime')) {
$opts['onetime'] = true; $opts['onetime'] = true;
if (!$quiet) { print "Special one-time reminder mode.\n"; } if (!$quiet) {
echo 'Special one-time reminder mode.' . "\n";
}
} }
$reminders = array(); $reminders = array();
switch($type) { switch ($type) {
case 'register': case 'register':
$reminders[] = $types['register']; $reminders[] = $types['register'];
break; break;
@ -101,19 +107,27 @@ if (have_option('u', 'universe')) {
foreach ($reminders as $reminder) { foreach ($reminders as $reminder) {
extract($reminder); extract($reminder);
$qm->enqueue(array($type, $opts), 'siterem'); $qm->enqueue(array($type, $opts), 'siterem');
if (!$quiet) { print "Sent pending {$type} reminders for {$server}.\n"; } if (!$quiet) {
echo 'Sent pending ' . $type . ' reminders for ' . $server . '.' . "\n";
}
} }
} catch (Exception $e) { } catch (Exception $e) {
// keep going // keep going
common_log(LOG_ERR, "Couldn't init {$server}.\n", __FILE__); common_log(LOG_ERR, "Couldn't init {$server}.\n", __FILE__);
if (!$quiet) { print "Couldn't init {$server}.\n"; } if (!$quiet) {
echo "Couldn't init " . $server . ".\n";
}
continue; continue;
} }
} }
if (!$quiet) { print "Done! Reminders sent to all unconfirmed addresses in the known universe.\n"; } if (!$quiet) {
echo 'Done! Reminders sent to all unconfirmed addresses in the known universe.' . "\n";
}
} }
} catch (Exception $e) { } catch (Exception $e) {
if (!$quiet) { print $e->getMessage() . "\n"; } if (!$quiet) {
echo $e->getMessage() . "\n";
}
common_log(LOG_ERR, $e->getMessage(), __FILE__); common_log(LOG_ERR, $e->getMessage(), __FILE__);
exit(1); exit(1);
} }
@ -133,20 +147,26 @@ if (have_option('u', 'universe')) {
throw new Exception("No confirmation code found for {$address}."); throw new Exception("No confirmation code found for {$address}.");
} }
$qm->enqueue(array($confirm, $opts), $utransport); $qm->enqueue(array($confirm, $opts), $utransport);
if (!$quiet) { print "Sent all pending {$type} reminder to {$address}.\n"; } if (!$quiet) {
echo 'Sent all pending ' . $type . ' reminder to ' . $address . '.' . "\n";
}
} }
} else if (have_option('a', 'all')) { } elseif (have_option('a', 'all')) {
foreach ($reminders as $reminder) { foreach ($reminders as $reminder) {
extract($reminder); extract($reminder);
$qm->enqueue(array($type, $opts), 'siterem'); $qm->enqueue(array($type, $opts), 'siterem');
if (!$quiet) { print "Sent pending {$type} reminders to all unconfirmed addresses on the site.\n"; } if (!$quiet) {
echo 'Sent pending ' . $type . ' reminders to all unconfirmed addresses on the site.' . "\n";
}
} }
} else { } else {
show_help(); show_help();
exit(1); exit(1);
} }
} catch (Exception $e) { } catch (Exception $e) {
if (!$quiet) { print $e->getMessage() . "\n"; } if (!$quiet) {
echo $e->getMessage() . "\n";
}
common_log(LOG_ERR, $e->getMessage(), __FILE__); common_log(LOG_ERR, $e->getMessage(), __FILE__);
exit(1); exit(1);
} }

View File

@ -1,23 +1,28 @@
#!/usr/bin/env php
<?php <?php
/* // This file is part of GNU social - https://www.gnu.org/software/social
* StatusNet - a distributed open-source microblogging tool //
* Copyright (C) 2010, StatusNet, Inc. // GNU social is free software: you can redistribute it and/or modify
* // it under the terms of the GNU Affero General Public License as published by
* This program is free software: you can redistribute it and/or modify // the Free Software Foundation, either version 3 of the License, or
* it under the terms of the GNU Affero General Public License as published by // (at your option) any later version.
* the Free Software Foundation, either version 3 of the License, or //
* (at your option) any later version. // GNU social is distributed in the hope that it will be useful,
* // but WITHOUT ANY WARRANTY; without even the implied warranty of
* This program is distributed in the hope that it will be useful, // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* but WITHOUT ANY WARRANTY; without even the implied warranty of // GNU Affero General Public License for more details.
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
* GNU Affero General Public License for more details. // You should have received a copy of the GNU Affero General Public License
* // along with GNU social. If not, see <http://www.gnu.org/licenses/>.
* 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/>. /**
* @package GNUsocial
* @copyright 2010 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/ */
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..')); define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'i:n:au'; $shortoptions = 'i:n:au';
$longoptions = array('id=', 'nickname=', 'all', 'universe'); $longoptions = array('id=', 'nickname=', 'all', 'universe');

View File

@ -25,9 +25,8 @@
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/ */
defined('GNUSOCIAL'); define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
define('INSTALLDIR', realpath(__DIR__ . '/../../..'));
$longoptions = ['dry-run', 'h-bug', 'broken-oembed', 'limit=']; $longoptions = ['dry-run', 'h-bug', 'broken-oembed', 'limit='];
@ -129,7 +128,6 @@ while ($fn->fetch()) {
echo " (ok, but embedding lookup failed)\n"; echo " (ok, but embedding lookup failed)\n";
} }
} }
} elseif ($broken && } elseif ($broken &&
(!$data instanceof File_embed || (!$data instanceof File_embed ||
empty($data->title) || empty($data->title) ||
@ -165,7 +163,6 @@ while ($fn->fetch()) {
$thumb->decache(); $thumb->decache();
} }
} }
} }
if (isset($fetch) && $fetch === true && !$dry) { if (isset($fetch) && $fetch === true && !$dry) {

View File

@ -25,9 +25,8 @@
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/ */
defined('GNUSOCIAL') || die(); define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
define('INSTALLDIR', realpath(__DIR__ . '/../../..'));
$shortoptions = 'u:'; $shortoptions = 'u:';
$longoptions = array('url='); $longoptions = array('url=');

View File

@ -1,24 +1,28 @@
#!/usr/bin/env php #!/usr/bin/env php
<?php <?php
/* // This file is part of GNU social - https://www.gnu.org/software/social
* StatusNet - a distributed open-source microblogging tool //
* Copyright (C) 2010, StatusNet, Inc. // GNU social is free software: you can redistribute it and/or modify
* // it under the terms of the GNU Affero General Public License as published by
* This program is free software: you can redistribute it and/or modify // the Free Software Foundation, either version 3 of the License, or
* it under the terms of the GNU Affero General Public License as published by // (at your option) any later version.
* the Free Software Foundation, either version 3 of the License, or //
* (at your option) any later version. // GNU social is distributed in the hope that it will be useful,
* // but WITHOUT ANY WARRANTY; without even the implied warranty of
* This program is distributed in the hope that it will be useful, // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* but WITHOUT ANY WARRANTY; without even the implied warranty of // GNU Affero General Public License for more details.
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
* GNU Affero General Public License for more details. // You should have received a copy of the GNU Affero General Public License
* // along with GNU social. If not, see <http://www.gnu.org/licenses/>.
* 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/>. /**
* @package GNUsocial
* @copyright 2010 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/ */
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..')); define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$helptext = <<<END_OF_HELP $helptext = <<<END_OF_HELP
pollfeed.php feeduri pollfeed.php feeduri

View File

@ -24,7 +24,8 @@
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/ */
define('INSTALLDIR', dirname(dirname(dirname(__DIR__)))); define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
if (!defined('NODEINFO_UPGRADE')) { if (!defined('NODEINFO_UPGRADE')) {
$longoptions = ['type=']; $longoptions = ['type='];

View File

@ -1,24 +1,28 @@
#!/usr/bin/env php #!/usr/bin/env php
<?php <?php
/* // This file is part of GNU social - https://www.gnu.org/software/social
* StatusNet - a distributed open-source microblogging tool //
* Copyright (C) 2010 StatusNet, Inc. // GNU social is free software: you can redistribute it and/or modify
* // it under the terms of the GNU Affero General Public License as published by
* This program is free software: you can redistribute it and/or modify // the Free Software Foundation, either version 3 of the License, or
* it under the terms of the GNU Affero General Public License as published by // (at your option) any later version.
* the Free Software Foundation, either version 3 of the License, or //
* (at your option) any later version. // GNU social is distributed in the hope that it will be useful,
* // but WITHOUT ANY WARRANTY; without even the implied warranty of
* This program is distributed in the hope that it will be useful, // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* but WITHOUT ANY WARRANTY; without even the implied warranty of // GNU Affero General Public License for more details.
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
* GNU Affero General Public License for more details. // You should have received a copy of the GNU Affero General Public License
* // along with GNU social. If not, see <http://www.gnu.org/licenses/>.
* 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/>. /**
* @package GNUsocial
* @copyright 2010 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/ */
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..')); define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$longoptions = array('dry-run'); $longoptions = array('dry-run');
@ -162,7 +166,7 @@ while ($oprofile->fetch()) {
$nick = '<deleted>'; $nick = '<deleted>';
} }
echo "group $id ($nick) hidden by $uri"; echo "group $id ($nick) hidden by $uri";
} else if (preg_match('!/user/(\d+)!', $uri, $matches)) { } elseif (preg_match('!/user/(\d+)!', $uri, $matches)) {
$id = intval($matches[1]); $id = intval($matches[1]);
$user = User::getKV('id', $id); $user = User::getKV('id', $id);
if ($user) { if ($user) {

View File

@ -1,24 +1,28 @@
#!/usr/bin/env php #!/usr/bin/env php
<?php <?php
/* // This file is part of GNU social - https://www.gnu.org/software/social
* StatusNet - a distributed open-source microblogging tool //
* Copyright (C) 2010, StatusNet, Inc. // GNU social is free software: you can redistribute it and/or modify
* // it under the terms of the GNU Affero General Public License as published by
* This program is free software: you can redistribute it and/or modify // the Free Software Foundation, either version 3 of the License, or
* it under the terms of the GNU Affero General Public License as published by // (at your option) any later version.
* the Free Software Foundation, either version 3 of the License, or //
* (at your option) any later version. // GNU social is distributed in the hope that it will be useful,
* // but WITHOUT ANY WARRANTY; without even the implied warranty of
* This program is distributed in the hope that it will be useful, // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* but WITHOUT ANY WARRANTY; without even the implied warranty of // GNU Affero General Public License for more details.
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
* GNU Affero General Public License for more details. // You should have received a copy of the GNU Affero General Public License
* // along with GNU social. If not, see <http://www.gnu.org/licenses/>.
* 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/>. /**
* @package GNUsocial
* @copyright 2010 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/ */
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..')); define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$longoptions = array('delete-inactive'); $longoptions = array('delete-inactive');
$shortoptions = 'd'; $shortoptions = 'd';
@ -65,4 +69,6 @@ while ($feedsub->fetch()) {
} }
} }
if ($delete_inactive) echo "\nDeleted $delcount inactive feeds.\n"; if ($delete_inactive) {
echo "\nDeleted $delcount inactive feeds.\n";
}

View File

@ -1,24 +1,28 @@
#!/usr/bin/env php #!/usr/bin/env php
<?php <?php
/* // This file is part of GNU social - https://www.gnu.org/software/social
* StatusNet - a distributed open-source microblogging tool //
* Copyright (C) 2010, StatusNet, Inc. // GNU social is free software: you can redistribute it and/or modify
* // it under the terms of the GNU Affero General Public License as published by
* This program is free software: you can redistribute it and/or modify // the Free Software Foundation, either version 3 of the License, or
* it under the terms of the GNU Affero General Public License as published by // (at your option) any later version.
* the Free Software Foundation, either version 3 of the License, or //
* (at your option) any later version. // GNU social is distributed in the hope that it will be useful,
* // but WITHOUT ANY WARRANTY; without even the implied warranty of
* This program is distributed in the hope that it will be useful, // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* but WITHOUT ANY WARRANTY; without even the implied warranty of // GNU Affero General Public License for more details.
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
* GNU Affero General Public License for more details. // You should have received a copy of the GNU Affero General Public License
* // along with GNU social. If not, see <http://www.gnu.org/licenses/>.
* 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/>. /**
* @package GNUsocial
* @copyright 2010 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/ */
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..')); define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$helptext = <<<END_OF_HELP $helptext = <<<END_OF_HELP
resub-feed.php resub-feed.php

View File

@ -1,24 +1,28 @@
#!/usr/bin/env php #!/usr/bin/env php
<?php <?php
/* // This file is part of GNU social - https://www.gnu.org/software/social
* StatusNet - a distributed open-source microblogging tool //
* Copyright (C) 2010, StatusNet, Inc. // GNU social is free software: you can redistribute it and/or modify
* // it under the terms of the GNU Affero General Public License as published by
* This program is free software: you can redistribute it and/or modify // the Free Software Foundation, either version 3 of the License, or
* it under the terms of the GNU Affero General Public License as published by // (at your option) any later version.
* the Free Software Foundation, either version 3 of the License, or //
* (at your option) any later version. // GNU social is distributed in the hope that it will be useful,
* // but WITHOUT ANY WARRANTY; without even the implied warranty of
* This program is distributed in the hope that it will be useful, // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* but WITHOUT ANY WARRANTY; without even the implied warranty of // GNU Affero General Public License for more details.
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
* GNU Affero General Public License for more details. // You should have received a copy of the GNU Affero General Public License
* // along with GNU social. If not, see <http://www.gnu.org/licenses/>.
* 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/>. /**
* @package GNUsocial
* @copyright 2010 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/ */
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..')); define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$longoptions = array('unsub'); $longoptions = array('unsub');
$shortoptions = 'u'; $shortoptions = 'u';

View File

@ -24,8 +24,8 @@
* Run this from INSTALLDIR/plugins/OStatus/scripts * Run this from INSTALLDIR/plugins/OStatus/scripts
*/ */
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..')); define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'd'; $shortoptions = 'd';
$longoptions = array('dry-run'); $longoptions = array('dry-run');

View File

@ -1,24 +1,28 @@
#!/usr/bin/env php #!/usr/bin/env php
<?php <?php
/* // This file is part of GNU social - https://www.gnu.org/software/social
* StatusNet - a distributed open-source microblogging tool //
* Copyright (C) 2010, StatusNet, Inc. // GNU social is free software: you can redistribute it and/or modify
* // it under the terms of the GNU Affero General Public License as published by
* This program is free software: you can redistribute it and/or modify // the Free Software Foundation, either version 3 of the License, or
* it under the terms of the GNU Affero General Public License as published by // (at your option) any later version.
* the Free Software Foundation, either version 3 of the License, or //
* (at your option) any later version. // GNU social is distributed in the hope that it will be useful,
* // but WITHOUT ANY WARRANTY; without even the implied warranty of
* This program is distributed in the hope that it will be useful, // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* but WITHOUT ANY WARRANTY; without even the implied warranty of // GNU Affero General Public License for more details.
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
* GNU Affero General Public License for more details. // You should have received a copy of the GNU Affero General Public License
* // along with GNU social. If not, see <http://www.gnu.org/licenses/>.
* 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/>. /**
* @package GNUsocial
* @copyright 2010 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/ */
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..')); define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$longoptions = array('skip=', 'count='); $longoptions = array('skip=', 'count=');

View File

@ -20,7 +20,8 @@
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/ */
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..')); define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$longoptions = array('all', 'suspicious', 'quiet'); $longoptions = array('all', 'suspicious', 'quiet');

View File

@ -1,24 +1,28 @@
#!/usr/bin/env php #!/usr/bin/env php
<?php <?php
/* // This file is part of GNU social - https://www.gnu.org/software/social
* StatusNet - a distributed open-source microblogging tool //
* Copyright (C) 2010, StatusNet, Inc. // GNU social is free software: you can redistribute it and/or modify
* // it under the terms of the GNU Affero General Public License as published by
* This program is free software: you can redistribute it and/or modify // the Free Software Foundation, either version 3 of the License, or
* it under the terms of the GNU Affero General Public License as published by // (at your option) any later version.
* the Free Software Foundation, either version 3 of the License, or //
* (at your option) any later version. // GNU social is distributed in the hope that it will be useful,
* // but WITHOUT ANY WARRANTY; without even the implied warranty of
* This program is distributed in the hope that it will be useful, // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* but WITHOUT ANY WARRANTY; without even the implied warranty of // GNU Affero General Public License for more details.
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
* GNU Affero General Public License for more details. // You should have received a copy of the GNU Affero General Public License
* // along with GNU social. If not, see <http://www.gnu.org/licenses/>.
* 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/>. /**
* @package GNUsocial
* @copyright 2010 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/ */
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..')); define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$helptext = <<<END_OF_HELP $helptext = <<<END_OF_HELP
update-profile.php [options] http://example.com/profile/url update-profile.php [options] http://example.com/profile/url
@ -64,7 +68,7 @@ try {
$feedurl = $discover->discoverFromURL($oprofile->uri); $feedurl = $discover->discoverFromURL($oprofile->uri);
$salmonuri = $discover->getAtomLink(Salmon::REL_SALMON) $salmonuri = $discover->getAtomLink(Salmon::REL_SALMON)
?: $discover->getAtomLink(Salmon::NS_REPLIES); // NS_REPLIES is deprecated ?: $discover->getAtomLink(Salmon::NS_REPLIES); // NS_REPLIES is deprecated
if (empty($salmonuri) ) { if (empty($salmonuri)) {
throw new FeedSubNoSalmonException('No salmon upstream URI was found'); throw new FeedSubNoSalmonException('No salmon upstream URI was found');
} }
} catch (FeedSubException $e) { } catch (FeedSubException $e) {

View File

@ -1,24 +1,28 @@
#!/usr/bin/env php #!/usr/bin/env php
<?php <?php
/* // This file is part of GNU social - https://www.gnu.org/software/social
* StatusNet - a distributed open-source microblogging tool //
* Copyright (C) 2011, StatusNet, Inc. // GNU social is free software: you can redistribute it and/or modify
* // it under the terms of the GNU Affero General Public License as published by
* This program is free software: you can redistribute it and/or modify // the Free Software Foundation, either version 3 of the License, or
* it under the terms of the GNU Affero General Public License as published by // (at your option) any later version.
* the Free Software Foundation, either version 3 of the License, or //
* (at your option) any later version. // GNU social is distributed in the hope that it will be useful,
* // but WITHOUT ANY WARRANTY; without even the implied warranty of
* This program is distributed in the hope that it will be useful, // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* but WITHOUT ANY WARRANTY; without even the implied warranty of // GNU Affero General Public License for more details.
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
* GNU Affero General Public License for more details. // You should have received a copy of the GNU Affero General Public License
* // along with GNU social. If not, see <http://www.gnu.org/licenses/>.
* 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/>. /**
* @package GNUsocial
* @copyright 2011 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/ */
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..')); define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'u:af'; $shortoptions = 'u:af';
$longoptions = array('uri=', 'all', 'force'); $longoptions = array('uri=', 'all', 'force');
@ -69,7 +73,7 @@ class LooseOstatusProfile extends Ostatus_profile
if (!$response->isOk()) { if (!$response->isOk()) {
// TRANS: Exception. %s is a profile URL. // TRANS: Exception. %s is a profile URL.
throw new Exception(sprintf(_('Could not reach profile page %s.'),$profile_url)); throw new Exception(sprintf(_('Could not reach profile page %s.'), $profile_url));
} }
// Check if we have a non-canonical URL // Check if we have a non-canonical URL
@ -120,7 +124,7 @@ class LooseOstatusProfile extends Ostatus_profile
} }
// TRANS: Exception. %s is a URL. // TRANS: Exception. %s is a URL.
throw new Exception(sprintf(_m('Could not find a feed URL for profile page %s.'),$finalUrl)); throw new Exception(sprintf(_m('Could not find a feed URL for profile page %s.'), $finalUrl));
} }
/** /**
@ -200,25 +204,25 @@ class LooseOstatusProfile extends Ostatus_profile
// will obscure the correct page-keyed profile later on. // will obscure the correct page-keyed profile later on.
} }
} }
throw new Exception(sprintf(_m('Could not find a valid profile for "%s".'),$addr)); throw new Exception(sprintf(_m('Could not find a valid profile for "%s".'), $addr));
} }
} }
function pullOstatusProfile($uri) { function pullOstatusProfile($uri)
{
$oprofile = null; $oprofile = null;
$validate = new Validate(); $validate = new Validate();
if ($validate->email($uri)) { if ($validate->email($uri)) {
$oprofile = LooseOstatusProfile::updateWebfinger($uri); $oprofile = LooseOstatusProfile::updateWebfinger($uri);
} else if ($validate->uri($uri)) { } elseif ($validate->uri($uri)) {
$oprofile = LooseOstatusProfile::updateProfileURL($uri); $oprofile = LooseOstatusProfile::updateProfileURL($uri);
} else { } else {
print "Sorry, we could not reach the address: $uri\n"; print "Sorry, we could not reach the address: $uri\n";
return false; return false;
} }
return $oprofile; return $oprofile;
} }
$quiet = have_option('q', 'quiet'); $quiet = have_option('q', 'quiet');
@ -227,7 +231,7 @@ $lop = new LooseOstatusProfile();
if (have_option('u', 'uri')) { if (have_option('u', 'uri')) {
$lop->uri = get_option_value('u', 'uri'); $lop->uri = get_option_value('u', 'uri');
} else if (!have_option('a', 'all')) { } elseif (!have_option('a', 'all')) {
show_help(); show_help();
exit(1); exit(1);
} }
@ -237,18 +241,26 @@ $forceUpdates = have_option('f', 'force');
$cnt = $lop->find(); $cnt = $lop->find();
if (!empty($cnt)) { if (!empty($cnt)) {
if (!$quiet) { echo "Found {$cnt} OStatus profiles:\n"; } if (!$quiet) {
echo 'Found ' . $cnt . ' OStatus profiles:' . "\n";
}
} else { } else {
if (have_option('u', 'uri')) { if (have_option('u', 'uri')) {
if (!$quiet) { echo "Couldn't find an existing OStatus profile with that URI.\n"; } if (!$quiet) {
echo "Couldn't find an existing OStatus profile with that URI.\n";
}
} else { } else {
if (!$quiet) { echo "Couldn't find any existing OStatus profiles.\n"; } if (!$quiet) {
echo "Couldn't find any existing OStatus profiles.\n";
}
} }
exit(0); exit(0);
} }
while($lop->fetch()) { while ($lop->fetch()) {
if (!$quiet) { echo "Updating OStatus profile '{$lop->uri}' ... "; } if (!$quiet) {
echo "Updating OStatus profile '" . $lop->uri . "' ... ";
}
try { try {
$oprofile = pullOstatusProfile($lop->uri); $oprofile = pullOstatusProfile($lop->uri);
@ -257,13 +269,19 @@ while($lop->fetch()) {
$lop->avatar = $oprofile->avatar; $lop->avatar = $oprofile->avatar;
$lop->update($orig); $lop->update($orig);
$lop->updateAvatar($oprofile->avatar, $forceUpdates); $lop->updateAvatar($oprofile->avatar, $forceUpdates);
if (!$quiet) { print "Done.\n"; } if (!$quiet) {
echo 'Done.' . "\n";
}
} }
} catch (Exception $e) { } catch (Exception $e) {
if (!$quiet) { print $e->getMessage() . "\n"; } if (!$quiet) {
echo $e->getMessage() . "\n";
}
common_log(LOG_WARNING, $e->getMessage(), __FILE__); common_log(LOG_WARNING, $e->getMessage(), __FILE__);
// continue on error // continue on error
} }
} }
if (!$quiet) { echo "OK.\n"; } if (!$quiet) {
echo 'OK.' . "\n";
}

View File

@ -20,11 +20,12 @@
* *
* @package Realtime * @package Realtime
* @author Mikael Nordfeldth <mmn@hethane.se> * @author Mikael Nordfeldth <mmn@hethane.se>
* @copyright 2011, StatusNet, Inc. * @copyright 2011 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/ */
define('INSTALLDIR', realpath(__DIR__ . '/../../..')); define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'u'; $shortoptions = 'u';
$longoptions = array('universe'); $longoptions = array('universe');

View File

@ -1,24 +1,28 @@
#!/usr/bin/env php #!/usr/bin/env php
<?php <?php
/* // This file is part of GNU social - https://www.gnu.org/software/social
* StatusNet - the distributed open-source microblogging tool //
* Copyright (C) 2009, StatusNet, Inc. // GNU social is free software: you can redistribute it and/or modify
* // it under the terms of the GNU Affero General Public License as published by
* This program is free software: you can redistribute it and/or modify // the Free Software Foundation, either version 3 of the License, or
* it under the terms of the GNU Affero General Public License as published by // (at your option) any later version.
* the Free Software Foundation, either version 3 of the License, or //
* (at your option) any later version. // GNU social is distributed in the hope that it will be useful,
* // but WITHOUT ANY WARRANTY; without even the implied warranty of
* This program is distributed in the hope that it will be useful, // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* but WITHOUT ANY WARRANTY; without even the implied warranty of // GNU Affero General Public License for more details.
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
* GNU Affero General Public License for more details. // You should have received a copy of the GNU Affero General Public License
* // along with GNU social. If not, see <http://www.gnu.org/licenses/>.
* 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/>. /**
* @package GNUsocial
* @copyright 2009 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/ */
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../..')); define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = "e:"; $shortoptions = "e:";
@ -46,8 +50,10 @@ if (!empty($user)) {
$confirm->address_type = 'email'; $confirm->address_type = 'email';
if ($confirm->find(true)) { if ($confirm->find(true)) {
$url = common_local_url('confirmfirstemail', $url = common_local_url(
array('code' => $confirm->code)); 'confirmfirstemail',
['code' => $confirm->code]
);
print "$url\n"; print "$url\n";
} else { } else {
@ -68,8 +74,10 @@ $confirm->address_type = 'email';
$confirm->insert(); $confirm->insert();
$url = common_local_url('confirmfirstemail', $url = common_local_url(
array('code' => $confirm->code)); 'confirmfirstemail',
['code' => $confirm->code]
);
print "$url\n"; print "$url\n";

View File

@ -1,24 +1,28 @@
#!/usr/bin/env php #!/usr/bin/env php
<?php <?php
/* // This file is part of GNU social - https://www.gnu.org/software/social
* StatusNet - a distributed open-source microblogging tool //
* Copyright (C) 2010, StatusNet, Inc. // GNU social is free software: you can redistribute it and/or modify
* // it under the terms of the GNU Affero General Public License as published by
* This program is free software: you can redistribute it and/or modify // the Free Software Foundation, either version 3 of the License, or
* it under the terms of the GNU Affero General Public License as published by // (at your option) any later version.
* the Free Software Foundation, either version 3 of the License, or //
* (at your option) any later version. // GNU social is distributed in the hope that it will be useful,
* // but WITHOUT ANY WARRANTY; without even the implied warranty of
* This program is distributed in the hope that it will be useful, // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* but WITHOUT ANY WARRANTY; without even the implied warranty of // GNU Affero General Public License for more details.
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
* GNU Affero General Public License for more details. // You should have received a copy of the GNU Affero General Public License
* // along with GNU social. If not, see <http://www.gnu.org/licenses/>.
* 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/>. /**
* @package GNUsocial
* @copyright 2010 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/ */
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..')); define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$helptext = <<<END_OF_UPDATECOUNTS_HELP $helptext = <<<END_OF_UPDATECOUNTS_HELP
updatecounts.php [options] updatecounts.php [options]

View File

@ -1,24 +1,28 @@
#!/usr/bin/env php #!/usr/bin/env php
<?php <?php
/* // This file is part of GNU social - https://www.gnu.org/software/social
* StatusNet - the distributed open-source microblogging tool //
* Copyright (C) 2009, StatusNet, Inc. // GNU social is free software: you can redistribute it and/or modify
* // it under the terms of the GNU Affero General Public License as published by
* This program is free software: you can redistribute it and/or modify // the Free Software Foundation, either version 3 of the License, or
* it under the terms of the GNU Affero General Public License as published by // (at your option) any later version.
* the Free Software Foundation, either version 3 of the License, or //
* (at your option) any later version. // GNU social is distributed in the hope that it will be useful,
* // but WITHOUT ANY WARRANTY; without even the implied warranty of
* This program is distributed in the hope that it will be useful, // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* but WITHOUT ANY WARRANTY; without even the implied warranty of // GNU Affero General Public License for more details.
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
* GNU Affero General Public License for more details. // You should have received a copy of the GNU Affero General Public License
* // along with GNU social. If not, see <http://www.gnu.org/licenses/>.
* 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/>. /**
* @package GNUsocial
* @copyright 2009 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/ */
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..')); define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$longoptions = array('base=', 'network'); $longoptions = array('base=', 'network');
@ -76,15 +80,29 @@ END;
*/ */
function sphinx_site_template($sn) function sphinx_site_template($sn)
{ {
if (common_config('db', 'type') !== 'mysql') {
$created_ts = sprintf(
'((EXTRACT(DAY %1$s) * 24 + EXTRACT(HOUR %1$s)) * 60 + ' .
'EXTRACT(MINUTE %1$s)) * 60 + FLOOR(EXTRACT(SECOND %1$s)) AS "created_ts"',
'FROM ("created" - TIMESTAMP \'1970-01-01 00:00:00\')'
);
} else {
$created_ts = "timestampdiff(SECOND, '1970-01-01', `created`) AS `created_ts`";
}
return return
sphinx_template($sn, sphinx_template(
$sn,
'profile', 'profile',
'SELECT id, UNIX_TIMESTAMP(created) as created_ts, nickname, fullname, location, bio, homepage FROM profile', 'SELECT id, ' . $created_ts . ', nickname, fullname, location, bio, homepage FROM profile',
'SELECT * FROM profile where id = $id') . 'SELECT * FROM profile WHERE id = $id'
sphinx_template($sn, ) .
sphinx_template(
$sn,
'notice', 'notice',
'SELECT id, UNIX_TIMESTAMP(created) as created_ts, content FROM notice', 'SELECT id, ' . $created_ts . ', content FROM notice',
'SELECT * FROM notice where notice.id = $id AND notice.is_local != -2'); 'SELECT * FROM notice WHERE notice.id = $id AND notice.is_local <> -2'
);
} }
function sphinx_template($sn, $table, $query, $query_info) function sphinx_template($sn, $table, $query, $query_info)

View File

@ -1,24 +1,28 @@
#!/usr/bin/env php #!/usr/bin/env php
<?php <?php
/* // This file is part of GNU social - https://www.gnu.org/software/social
* StatusNet - the distributed open-source microblogging tool //
* Copyright (C) 2009, StatusNet, Inc. // GNU social is free software: you can redistribute it and/or modify
* // it under the terms of the GNU Affero General Public License as published by
* This program is free software: you can redistribute it and/or modify // the Free Software Foundation, either version 3 of the License, or
* it under the terms of the GNU Affero General Public License as published by // (at your option) any later version.
* the Free Software Foundation, either version 3 of the License, or //
* (at your option) any later version. // GNU social is distributed in the hope that it will be useful,
* // but WITHOUT ANY WARRANTY; without even the implied warranty of
* This program is distributed in the hope that it will be useful, // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* but WITHOUT ANY WARRANTY; without even the implied warranty of // GNU Affero General Public License for more details.
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
* GNU Affero General Public License for more details. // You should have received a copy of the GNU Affero General Public License
* // along with GNU social. If not, see <http://www.gnu.org/licenses/>.
* 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/>. /**
* @package GNUsocial
* @copyright 2009 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/ */
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..')); define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$longoptions = array('base=', 'network'); $longoptions = array('base=', 'network');

View File

@ -1,33 +1,32 @@
#!/usr/bin/env php #!/usr/bin/env php
<?php <?php
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GNU social is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
/** /**
* GNU social - a federating social network * StoreRemoteMediaPlugin
*
* GNU Social - StoreRemoteMediaPlugin
*
* LICENCE: This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* 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/>.
* *
* @category Plugin * @category Plugin
* @package GNUsocial * @package GNUsocial
* @copyright 2018 Free Software Foundation http://fsf.org * @author Diogo Cordeiro <diogo@fc.up.pt>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @copyright 2018 Free Software Foundation, Inc http://www.fsf.org
* @link https://www.gnu.org/software/social/ * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/ */
// Script author: Diogo Cordeiro <diogo@fc.up.pt> define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
define('INSTALLDIR', realpath(__DIR__ . '/../../..'));
$shortoptions = 'l::a::i'; $shortoptions = 'l::a::i';
$longoptions = ['limit=', 'all', 'image']; $longoptions = ['limit=', 'all', 'image'];

View File

@ -1,31 +1,30 @@
#!/usr/bin/env php
<?php <?php
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GNU social is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
/** /**
* StatusNet, the distributed open-source microblogging tool
*
* PHP version 5
*
* LICENCE: This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* 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/>.
*
* @category Plugin * @category Plugin
* @package StatusNet * @package GNUsocial
* @author Brion Vibber <brion@status.net> * @author Brion Vibber <brion@status.net>
* @copyright 2010 StatusNet, Inc. * @copyright 2010 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
* @link http://status.net/
*/ */
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..')); define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'n:'; $shortoptions = 'n:';
$longoptions = array('nick=','import','all'); $longoptions = array('nick=','import','all');
@ -46,9 +45,9 @@ require_once INSTALLDIR.'/scripts/commandline.inc';
if (have_option('n')) { if (have_option('n')) {
$nickname = get_option_value('n'); $nickname = get_option_value('n');
} else if (have_option('nick')) { } elseif (have_option('nick')) {
$nickname = get_option_value('nickname'); $nickname = get_option_value('nickname');
} else if (have_option('all')) { } elseif (have_option('all')) {
$nickname = null; $nickname = null;
} else { } else {
show_help($helptext); show_help($helptext);
@ -115,8 +114,10 @@ foreach ($users as $id) {
throw new Exception("No user for id $id"); throw new Exception("No user for id $id");
} }
$auth = twitterAuthForUser($user); $auth = twitterAuthForUser($user);
$flink = Foreign_link::getByUserID($user->id, $flink = Foreign_link::getByUserID(
TWITTER_SERVICE); $user->id,
TWITTER_SERVICE
);
$friends->friends = $auth->friendsIds(); $friends->friends = $auth->friendsIds();
dumpMessage($flink, $friends); dumpMessage($flink, $friends);
@ -127,10 +128,10 @@ foreach ($users as $id) {
} }
} }
usort($output, function($a, $b) { usort($output, function ($a, $b) {
if ($a->message->id < $b->message->id) { if ($a->message->id < $b->message->id) {
return -1; return -1;
} else if ($a->message->id == $b->message->id) { } elseif ($a->message->id == $b->message->id) {
return 0; return 0;
} else { } else {
return 1; return 1;

View File

@ -18,11 +18,12 @@
/** /**
* @package TwitterBridge * @package TwitterBridge
* @author Evan Prodromou <evan@status.net> * @author Evan Prodromou <evan@status.net>
* @copyright 2010, StatusNet, Inc. * @copyright 2010 StatusNet, Inc.
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/ */
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..')); define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$helptext = <<<ENDOFHELP $helptext = <<<ENDOFHELP
USAGE: initialize_notice_to_status.php USAGE: initialize_notice_to_status.php

View File

@ -1,31 +1,30 @@
#!/usr/bin/env php
<?php <?php
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GNU social is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
/** /**
* StatusNet, the distributed open-source microblogging tool
*
* PHP version 5
*
* LICENCE: This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* 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/>.
*
* @category Plugin * @category Plugin
* @package StatusNet * @package GNUsocial
* @author Brion Vibber <brion@status.net> * @author Brion Vibber <brion@status.net>
* @copyright 2010 StatusNet, Inc. * @copyright 2010 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
* @link http://status.net/
*/ */
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..')); define('INSTALLDIR', dirname(__DIR__, 3));
define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'n:'; $shortoptions = 'n:';
$longoptions = array('nick=','import','all','apiroot='); $longoptions = array('nick=','import','all','apiroot=');
@ -43,13 +42,13 @@ data as it comes.
ENDOFHELP; ENDOFHELP;
require_once INSTALLDIR.'/scripts/commandline.inc'; require_once INSTALLDIR . '/scripts/commandline.inc';
require_once dirname(dirname(__FILE__)) . '/lib/jsonstreamreader.php'; require_once dirname(dirname(__FILE__)) . '/lib/jsonstreamreader.php';
require_once dirname(dirname(__FILE__)) . '/lib/twitterstreamreader.php'; require_once dirname(dirname(__FILE__)) . '/lib/twitterstreamreader.php';
if (have_option('n')) { if (have_option('n')) {
$nickname = get_option_value('n'); $nickname = get_option_value('n');
} else if (have_option('nick')) { } elseif (have_option('nick')) {
$nickname = get_option_value('nickname'); $nickname = get_option_value('nickname');
} else { } else {
show_help($helptext); show_help($helptext);
@ -119,47 +118,61 @@ if (have_option('all')) {
} }
$stream->hookEvent('raw', function($data, $context) { $stream->hookEvent('raw', function ($data, $context) {
common_log(LOG_INFO, json_encode($data) . ' for ' . json_encode($context)); common_log(LOG_INFO, json_encode($data) . ' for ' . json_encode($context));
}); });
$stream->hookEvent('friends', function($data, $context) { $stream->hookEvent('friends', function ($data, $context) {
printf("Friend list: %s\n", implode(', ', $data->friends)); printf("Friend list: %s\n", implode(', ', $data->friends));
}); });
$stream->hookEvent('favorite', function($data, $context) { $stream->hookEvent('favorite', function ($data, $context) {
printf("%s favorited %s's notice: %s\n", printf(
$data->source->screen_name, "%s favorited %s's notice: %s\n",
$data->target->screen_name, $data->source->screen_name,
$data->target_object->text); $data->target->screen_name,
$data->target_object->text
);
}); });
$stream->hookEvent('unfavorite', function($data, $context) { $stream->hookEvent('unfavorite', function ($data, $context) {
printf("%s unfavorited %s's notice: %s\n", printf(
$data->source->screen_name, "%s unfavorited %s's notice: %s\n",
$data->target->screen_name, $data->source->screen_name,
$data->target_object->text); $data->target->screen_name,
$data->target_object->text
);
}); });
$stream->hookEvent('follow', function($data, $context) { $stream->hookEvent('follow', function ($data, $context) {
printf("%s friended %s\n", printf(
$data->source->screen_name, '%s friended %s' . "\n",
$data->target->screen_name); $data->source->screen_name,
$data->target->screen_name
);
}); });
$stream->hookEvent('unfollow', function($data, $context) { $stream->hookEvent('unfollow', function ($data, $context) {
printf("%s unfriended %s\n", printf(
$data->source->screen_name, '%s unfriended %s' . "\n",
$data->target->screen_name); $data->source->screen_name,
$data->target->screen_name
);
}); });
$stream->hookEvent('delete', function($data, $context) { $stream->hookEvent('delete', function ($data, $context) {
printf("Deleted status notification: %s\n", printf(
$data->status->id); 'Deleted status notification: %s' . "\n",
$data->status->id
);
}); });
$stream->hookEvent('scrub_geo', function($data, $context) { $stream->hookEvent('scrub_geo', function ($data, $context) {
printf("Req to scrub geo data for user id %s up to status ID %s\n", printf(
$data->user_id, 'Req to scrub geo data for user id %s up to status ID %s' . "\n",
$data->up_to_status_id); $data->user_id,
$data->up_to_status_id
);
}); });
$stream->hookEvent('status', function($data, $context) { $stream->hookEvent('status', function ($data, $context) {
printf("Received status update from %s: %s\n", printf(
$data->user->screen_name, 'Received status update from %s: %s' . "\n",
$data->text); $data->user->screen_name,
$data->text
);
if (have_option('import')) { if (have_option('import')) {
$importer = new TwitterImport(); $importer = new TwitterImport();
@ -170,38 +183,40 @@ $stream->hookEvent('status', function($data, $context) {
} }
} }
}); });
$stream->hookEvent('direct_message', function($data) { $stream->hookEvent('direct_message', function ($data) {
printf("Direct message from %s to %s: %s\n", printf(
$data->sender->screen_name, 'Direct message from %s to %s: %s' . "\n",
$data->recipient->screen_name, $data->sender->screen_name,
$data->text); $data->recipient->screen_name,
$data->text
);
}); });
class TwitterManager extends IoManager class TwitterManager extends IoManager
{ {
function __construct(TwitterStreamReader $stream) public function __construct(TwitterStreamReader $stream)
{ {
$this->stream = $stream; $this->stream = $stream;
} }
function getSockets() public function getSockets()
{ {
return $this->stream->getSockets(); return $this->stream->getSockets();
} }
function handleInput($data) public function handleInput($data)
{ {
$this->stream->handleInput($data); $this->stream->handleInput($data);
return true; return true;
} }
function start() public function start()
{ {
$this->stream->connect(); $this->stream->connect();
return true; return true;
} }
function finish() public function finish()
{ {
$this->stream->close(); $this->stream->close();
return true; return true;
@ -215,7 +230,7 @@ class TwitterManager extends IoManager
class TwitterStreamMaster extends IoMaster class TwitterStreamMaster extends IoMaster
{ {
function __construct($id, $ioManager) public function __construct($id, $ioManager)
{ {
parent::__construct($id); parent::__construct($id);
$this->ioManager = $ioManager; $this->ioManager = $ioManager;
@ -224,7 +239,7 @@ class TwitterStreamMaster extends IoMaster
/** /**
* Initialize IoManagers which are appropriate to this instance. * Initialize IoManagers which are appropriate to this instance.
*/ */
function initManagers() public function initManagers()
{ {
$this->instantiate($this->ioManager); $this->instantiate($this->ioManager);
} }