[DATABASE] Use "<>" as an SQL non-equality sign in more cases
A follow-up to commit 644b417f6c
This commit is contained in:
parent
9ac632ca2d
commit
434f07430d
|
@ -1,23 +1,25 @@
|
|||
<?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) 2008, 2009, StatusNet, Inc.
|
||||
*
|
||||
* 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/>.
|
||||
* @copyright 2008, 2009 StatusNet, Inc.
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
|
||||
if (!defined('GNUSOCIAL')) { exit(1); }
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
define('LISTENER', 1);
|
||||
define('LISTENEE', -1);
|
||||
|
@ -26,7 +28,7 @@ define('BOTH', 0);
|
|||
// @todo XXX: Documentation missing.
|
||||
class FoafAction extends ManagedAction
|
||||
{
|
||||
function isReadOnly($args)
|
||||
public function isReadOnly($args)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -45,9 +47,13 @@ class FoafAction extends ManagedAction
|
|||
// Permanent redirect on non-canonical nickname
|
||||
|
||||
if ($nickname_arg != $this->nickname) {
|
||||
common_redirect(common_local_url('foaf',
|
||||
array('nickname' => $this->nickname)),
|
||||
301);
|
||||
common_redirect(
|
||||
common_local_url(
|
||||
'foaf',
|
||||
['nickname' => $this->nickname]
|
||||
),
|
||||
301
|
||||
);
|
||||
}
|
||||
|
||||
$this->user = User::getKV('nickname', $this->nickname);
|
||||
|
@ -152,22 +158,27 @@ class FoafAction extends ManagedAction
|
|||
// No avatar for this user!
|
||||
}
|
||||
|
||||
$person = $this->showMicrobloggingAccount($this->profile,
|
||||
common_root_url(), $this->user->getUri(),
|
||||
/*$fetchSubscriptions*/true,
|
||||
/*$isSubscriber*/false);
|
||||
$person = $this->showMicrobloggingAccount(
|
||||
$this->profile,
|
||||
common_root_url(),
|
||||
$this->user->getUri(),
|
||||
// $fetchSubscriptions
|
||||
true,
|
||||
// $isSubscriber
|
||||
false
|
||||
);
|
||||
|
||||
// Get people who subscribe to user
|
||||
|
||||
$sub = new Subscription();
|
||||
$sub->subscribed = $this->profile->id;
|
||||
$sub->whereAdd('subscriber != subscribed');
|
||||
$sub->whereAdd('subscriber <> subscribed');
|
||||
|
||||
if ($sub->find()) {
|
||||
while ($sub->fetch()) {
|
||||
$profile = Profile::getKV('id', $sub->subscriber);
|
||||
if (!$profile instanceof Profile) {
|
||||
common_debug('Got a bad subscription: '.print_r($sub,true));
|
||||
common_debug('Got a bad subscription: ' . print_r($sub, true));
|
||||
continue;
|
||||
}
|
||||
$other_uri = $profile->getUri();
|
||||
|
@ -206,11 +217,15 @@ class FoafAction extends ManagedAction
|
|||
if ($type == BOTH) {
|
||||
$this->element('knows', array('rdf:resource' => $this->user->getUri()));
|
||||
}
|
||||
$this->showMicrobloggingAccount($profile,
|
||||
($local == 'local') ? common_root_url() : null,
|
||||
$uri,
|
||||
/*$fetchSubscriptions*/false,
|
||||
/*$isSubscriber*/($type == LISTENER || $type == BOTH));
|
||||
$this->showMicrobloggingAccount(
|
||||
$profile,
|
||||
($local === 'local') ? common_root_url() : null,
|
||||
$uri,
|
||||
// $fetchSubscriptions
|
||||
false,
|
||||
// $isSubscriber
|
||||
($type == LISTENER || $type == BOTH)
|
||||
);
|
||||
if ($foaf_url) {
|
||||
$this->element('rdfs:seeAlso', array('rdf:resource' => $foaf_url));
|
||||
}
|
||||
|
@ -227,7 +242,7 @@ class FoafAction extends ManagedAction
|
|||
$this->endXML();
|
||||
}
|
||||
|
||||
function showPpd($foaf_url, $person_uri)
|
||||
public function showPpd($foaf_url, $person_uri)
|
||||
{
|
||||
$this->elementStart('PersonalProfileDocument', array('rdf:about' => $foaf_url));
|
||||
$this->element('maker', array('rdf:resource' => $person_uri));
|
||||
|
@ -248,7 +263,7 @@ class FoafAction extends ManagedAction
|
|||
* @return array if $fetchSubscribers is set, return a list of info on those
|
||||
* subscriptions.
|
||||
*/
|
||||
function showMicrobloggingAccount($profile, $service=null, $useruri=null, $fetchSubscriptions=false, $isSubscriber=false)
|
||||
public function showMicrobloggingAccount($profile, $service = null, $useruri = null, $fetchSubscriptions = false, $isSubscriber = false)
|
||||
{
|
||||
$attr = array();
|
||||
if ($useruri) {
|
||||
|
@ -274,13 +289,13 @@ class FoafAction extends ManagedAction
|
|||
// Get people user is subscribed to
|
||||
$sub = new Subscription();
|
||||
$sub->subscriber = $profile->id;
|
||||
$sub->whereAdd('subscriber != subscribed');
|
||||
$sub->whereAdd('subscriber <> subscribed');
|
||||
|
||||
if ($sub->find()) {
|
||||
while ($sub->fetch()) {
|
||||
$profile = Profile::getKV('id', $sub->subscribed);
|
||||
if (empty($profile)) {
|
||||
common_debug('Got a bad subscription: '.print_r($sub,true));
|
||||
common_debug('Got a bad subscription: ' . print_r($sub, true));
|
||||
continue;
|
||||
}
|
||||
$other_uri = $profile->getUri();
|
||||
|
@ -294,7 +309,7 @@ class FoafAction extends ManagedAction
|
|||
}
|
||||
|
||||
unset($sub);
|
||||
} else if ($isSubscriber) {
|
||||
} elseif ($isSubscriber) {
|
||||
// Just declare that they follow the user whose FOAF we're showing.
|
||||
$this->element('sioc:follows', array('rdf:resource' => $this->user->getUri() . '#acct'));
|
||||
}
|
||||
|
|
|
@ -1,42 +1,38 @@
|
|||
<?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
|
||||
*
|
||||
* List the OAuth applications that a user has registered with this instance
|
||||
*
|
||||
* 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 Settings
|
||||
* @package StatusNet
|
||||
* @package GNUsocial
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2008-2009 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
|
||||
if (!defined('GNUSOCIAL')) { exit(1); }
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
/**
|
||||
* Show a user's registered OAuth applications
|
||||
*
|
||||
* @category Settings
|
||||
* @package StatusNet
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
* @category Settings
|
||||
* @package GNUsocial
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*
|
||||
* @see SettingsAction
|
||||
*/
|
||||
|
@ -56,7 +52,7 @@ class OauthappssettingsAction extends SettingsAction
|
|||
* @return string Title of the page
|
||||
*/
|
||||
|
||||
function title()
|
||||
public function title()
|
||||
{
|
||||
// TRANS: Page title for OAuth applications
|
||||
return _('OAuth applications');
|
||||
|
@ -68,20 +64,20 @@ class OauthappssettingsAction extends SettingsAction
|
|||
* @return instructions for use
|
||||
*/
|
||||
|
||||
function getInstructions()
|
||||
public function getInstructions()
|
||||
{
|
||||
// TRANS: Page instructions for OAuth applications
|
||||
return _('Applications you have registered');
|
||||
}
|
||||
|
||||
function showContent()
|
||||
public function showContent()
|
||||
{
|
||||
$offset = ($this->page - 1) * APPS_PER_PAGE;
|
||||
$limit = APPS_PER_PAGE + 1;
|
||||
|
||||
$application = new Oauth_application();
|
||||
$application->owner = $this->scoped->getID();
|
||||
$application->whereAdd("name != 'anonymous'");
|
||||
$application->whereAdd("name <> 'anonymous'");
|
||||
$application->limit($offset, $limit);
|
||||
$application->orderBy('created DESC');
|
||||
$application->find();
|
||||
|
@ -96,13 +92,16 @@ class OauthappssettingsAction extends SettingsAction
|
|||
}
|
||||
}
|
||||
|
||||
$this->elementStart('p', array('id' => 'application_register'));
|
||||
$this->element('a',
|
||||
array('href' => common_local_url('newapplication'),
|
||||
'class' => 'more'
|
||||
),
|
||||
$this->elementStart('p', ['id' => 'application_register']);
|
||||
$this->element(
|
||||
'a',
|
||||
[
|
||||
'href' => common_local_url('newapplication'),
|
||||
'class' => 'more',
|
||||
],
|
||||
// TRANS: Link description to add a new OAuth application.
|
||||
'Register a new application');
|
||||
'Register a new application'
|
||||
);
|
||||
$this->elementEnd('p');
|
||||
|
||||
$this->pagination(
|
||||
|
@ -113,7 +112,7 @@ class OauthappssettingsAction extends SettingsAction
|
|||
);
|
||||
}
|
||||
|
||||
function showEmptyListMessage()
|
||||
public function showEmptyListMessage()
|
||||
{
|
||||
// TRANS: Empty list message on page with OAuth applications. Markup allowed
|
||||
$message = sprintf(_('You have not registered any applications yet.'));
|
||||
|
|
|
@ -1,64 +1,65 @@
|
|||
<?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) 2011, StatusNet, Inc.
|
||||
*
|
||||
* Stream of notices sorted by popularity
|
||||
*
|
||||
* 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 Popular
|
||||
* @package StatusNet
|
||||
* @package GNUsocial
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2011 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||
* @link http://status.net/
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
|
||||
if (!defined('GNUSOCIAL')) { exit(1); }
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
/**
|
||||
* Stream of notices sorted by popularity
|
||||
*
|
||||
* @category Popular
|
||||
* @package StatusNet
|
||||
* @package GNUsocial
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2011 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||
* @link http://status.net/
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
|
||||
class PopularNoticeStream extends ScopingNoticeStream
|
||||
{
|
||||
function __construct(Profile $scoped=null)
|
||||
public function __construct(Profile $scoped=null)
|
||||
{
|
||||
parent::__construct(new CachingNoticeStream(new RawPopularNoticeStream(),
|
||||
'popular',
|
||||
false),
|
||||
$scoped);
|
||||
parent::__construct(
|
||||
new CachingNoticeStream(
|
||||
new RawPopularNoticeStream(),
|
||||
'popular',
|
||||
false
|
||||
),
|
||||
$scoped
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class RawPopularNoticeStream extends NoticeStream
|
||||
{
|
||||
function getNoticeIds($offset, $limit, $since_id, $max_id)
|
||||
public function getNoticeIds($offset, $limit, $since_id, $max_id)
|
||||
{
|
||||
$weightexpr = common_sql_weight('modified', common_config('popular', 'dropoff'));
|
||||
$cutoff = sprintf("modified > '%s'",
|
||||
common_sql_date(time() - common_config('popular', 'cutoff')));
|
||||
$cutoff = sprintf(
|
||||
"modified > TIMESTAMP '%s'",
|
||||
common_sql_date(time() - common_config('popular', 'cutoff'))
|
||||
);
|
||||
|
||||
$fave = new Fave();
|
||||
$fave->selectAdd();
|
||||
|
@ -85,4 +86,3 @@ class RawPopularNoticeStream extends NoticeStream
|
|||
return $ids;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -557,7 +557,7 @@ class Activitypub_profile extends Managed_DataObject
|
|||
$user_table = common_database_tablename('user');
|
||||
$sub = new Subscription();
|
||||
$sub->subscribed = $profile->id;
|
||||
$sub->whereAdd('subscriber != subscribed');
|
||||
$sub->whereAdd('subscriber <> subscribed');
|
||||
$sub->whereAdd("subscriber IN (SELECT id FROM {$user_table} UNION SELECT profile_id AS id FROM activitypub_profile)");
|
||||
$cnt = $sub->count('distinct subscriber');
|
||||
|
||||
|
@ -585,7 +585,7 @@ class Activitypub_profile extends Managed_DataObject
|
|||
$user_table = common_database_tablename('user');
|
||||
$sub = new Subscription();
|
||||
$sub->subscriber = $profile->id;
|
||||
$sub->whereAdd('subscriber != subscribed');
|
||||
$sub->whereAdd('subscriber <> subscribed');
|
||||
$sub->whereAdd("subscribed IN (SELECT id FROM {$user_table} UNION SELECT profile_id AS id FROM activitypub_profile)");
|
||||
$cnt = $sub->count('distinct subscribed');
|
||||
|
||||
|
|
|
@ -1,19 +1,33 @@
|
|||
<?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/>.
|
||||
|
||||
if (!defined('GNUSOCIAL')) { exit(1); }
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
class RawBookmarksNoticeStream extends NoticeStream
|
||||
{
|
||||
protected $user_id;
|
||||
protected $own;
|
||||
|
||||
function __construct($user_id, $own)
|
||||
public function __construct($user_id, $own)
|
||||
{
|
||||
$this->user_id = $user_id;
|
||||
$this->own = $own;
|
||||
}
|
||||
|
||||
function getNoticeIds($offset, $limit, $since_id, $max_id)
|
||||
public function getNoticeIds($offset, $limit, $since_id, $max_id)
|
||||
{
|
||||
$notice = new Notice();
|
||||
$qry = null;
|
||||
|
@ -21,7 +35,7 @@ class RawBookmarksNoticeStream extends NoticeStream
|
|||
$qry = 'SELECT notice.* FROM notice ';
|
||||
$qry .= 'INNER JOIN bookmark ON bookmark.uri = notice.uri ';
|
||||
$qry .= 'WHERE bookmark.profile_id = ' . $this->user_id . ' ';
|
||||
$qry .= 'AND notice.is_local != ' . Notice::GATEWAY . ' ';
|
||||
$qry .= 'AND notice.is_local <> ' . Notice::GATEWAY . ' ';
|
||||
|
||||
if ($since_id != 0) {
|
||||
$qry .= 'AND notice.id > ' . $since_id . ' ';
|
||||
|
@ -62,7 +76,7 @@ class RawBookmarksNoticeStream extends NoticeStream
|
|||
|
||||
class BookmarksNoticeStream extends ScopingNoticeStream
|
||||
{
|
||||
function __construct($user_id, $own, Profile $scoped=null)
|
||||
public function __construct($user_id, $own, Profile $scoped = null)
|
||||
{
|
||||
$stream = new RawBookmarksNoticeStream($user_id, $own);
|
||||
|
||||
|
|
|
@ -1,17 +1,31 @@
|
|||
<?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/>.
|
||||
|
||||
if (!defined('GNUSOCIAL')) { exit(1); }
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
class RawEventsNoticeStream extends NoticeStream
|
||||
{
|
||||
function getNoticeIds($offset, $limit, $since_id, $max_id)
|
||||
public function getNoticeIds($offset, $limit, $since_id, $max_id)
|
||||
{
|
||||
$notice = new Notice();
|
||||
$qry = null;
|
||||
|
||||
$qry = 'SELECT notice.* FROM notice ';
|
||||
$qry .= 'INNER JOIN happening ON happening.uri = notice.uri ';
|
||||
$qry .= 'AND notice.is_local != ' . Notice::GATEWAY . ' ';
|
||||
$qry .= 'AND notice.is_local <> ' . Notice::GATEWAY . ' ';
|
||||
|
||||
if ($since_id != 0) {
|
||||
$qry .= 'AND notice.id > ' . $since_id . ' ';
|
||||
|
@ -45,7 +59,7 @@ class EventsNoticeStream extends ScopingNoticeStream
|
|||
protected $rsvp = ['Y', 'N', '?'];
|
||||
protected $target = null;
|
||||
|
||||
function __construct(Profile $target, Profile $scoped=null, array $rsvp=array())
|
||||
public function __construct(Profile $target, Profile $scoped = null, array $rsvp = [])
|
||||
{
|
||||
$stream = new RawEventsNoticeStream();
|
||||
|
||||
|
|
|
@ -1,38 +1,30 @@
|
|||
<?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.
|
||||
*
|
||||
* When a new user registers, all existing users follow them automatically.
|
||||
*
|
||||
* 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 Community
|
||||
* @package StatusNet
|
||||
* @package GNUsocial
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2010 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||
* @link http://status.net/
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
|
||||
if (!defined('STATUSNET')) {
|
||||
// This check helps protect against security problems;
|
||||
// your code file can't be executed directly from the web.
|
||||
exit(1);
|
||||
}
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
/**
|
||||
* Plugin to make all users follow each other at registration
|
||||
|
@ -40,11 +32,10 @@ if (!defined('STATUSNET')) {
|
|||
* Users can unfollow afterwards if they want.
|
||||
*
|
||||
* @category Sample
|
||||
* @package StatusNet
|
||||
* @package GNUsocial
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2010 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||
* @link http://status.net/
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
class FollowEveryonePlugin extends Plugin
|
||||
{
|
||||
|
@ -64,7 +55,7 @@ class FollowEveryonePlugin extends Plugin
|
|||
public function onEndUserRegister(Profile $profile)
|
||||
{
|
||||
$otherUser = new User();
|
||||
$otherUser->whereAdd('id != ' . $profile->id);
|
||||
$otherUser->whereAdd('id <> ' . $profile->id);
|
||||
|
||||
if ($otherUser->find()) {
|
||||
while ($otherUser->fetch()) {
|
||||
|
@ -110,7 +101,7 @@ class FollowEveryonePlugin extends Plugin
|
|||
*
|
||||
* @return boolean hook value; true means continue processing, false means stop.
|
||||
*/
|
||||
function onCheckSchema()
|
||||
public function onCheckSchema()
|
||||
{
|
||||
$schema = Schema::get();
|
||||
|
||||
|
@ -127,16 +118,17 @@ class FollowEveryonePlugin extends Plugin
|
|||
*
|
||||
* @return boolean hook value
|
||||
*/
|
||||
function onEndProfileFormData($action)
|
||||
public function onEndProfileFormData($action)
|
||||
{
|
||||
$user = common_current_user();
|
||||
|
||||
$action->elementStart('li');
|
||||
// TRANS: Checkbox label in form for profile settings.
|
||||
$action->checkbox('followeveryone', _m('Follow everyone'),
|
||||
($action->arg('followeveryone')) ?
|
||||
$action->arg('followeveryone') :
|
||||
User_followeveryone_prefs::followEveryone($user->id));
|
||||
$action->checkbox(
|
||||
'followeveryone',
|
||||
_m('Follow everyone'),
|
||||
($action->arg('followeveryone') ?? User_followeveryone_prefs::followEveryone($user->id))
|
||||
);
|
||||
$action->elementEnd('li');
|
||||
|
||||
return true;
|
||||
|
@ -149,12 +141,14 @@ class FollowEveryonePlugin extends Plugin
|
|||
*
|
||||
* @return boolean hook value
|
||||
*/
|
||||
function onEndProfileSaveForm($action)
|
||||
public function onEndProfileSaveForm($action)
|
||||
{
|
||||
$user = common_current_user();
|
||||
|
||||
User_followeveryone_prefs::savePref($user->id,
|
||||
$action->boolean('followeveryone'));
|
||||
User_followeveryone_prefs::savePref(
|
||||
$user->id,
|
||||
$action->boolean('followeveryone')
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,32 +1,31 @@
|
|||
<?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/>.
|
||||
* Plugin for sending and importing Twitter statuses
|
||||
*
|
||||
* @category Plugin
|
||||
* @package StatusNet
|
||||
* @package GNUsocial
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @author Julien C <chaumond@gmail.com>
|
||||
* @copyright 2009-2010 Control Yourself, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
* @copyright 2009-2010 StatusNet, Inc.
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
|
||||
if (!defined('GNUSOCIAL')) { exit(1); }
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
require_once __DIR__ . '/twitter.php';
|
||||
|
||||
|
@ -37,13 +36,11 @@ require_once __DIR__ . '/twitter.php';
|
|||
*
|
||||
* Depends on Favorite plugin.
|
||||
*
|
||||
* @category Plugin
|
||||
* @package StatusNet
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @author Julien C <chaumond@gmail.com>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
* @link http://twitter.com/
|
||||
* @category Plugin
|
||||
* @package GNUsocial
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @author Julien C <chaumond@gmail.com>
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
class TwitterBridgePlugin extends Plugin
|
||||
{
|
||||
|
@ -53,7 +50,7 @@ class TwitterBridgePlugin extends Plugin
|
|||
/**
|
||||
* Initializer for the plugin.
|
||||
*/
|
||||
function initialize()
|
||||
public function initialize()
|
||||
{
|
||||
// Allow the key and secret to be passed in
|
||||
// Control panel will override
|
||||
|
@ -83,7 +80,7 @@ class TwitterBridgePlugin extends Plugin
|
|||
*
|
||||
* @return boolean result
|
||||
*/
|
||||
static function hasKeys()
|
||||
public static function hasKeys()
|
||||
{
|
||||
$ckey = common_config('twitter', 'consumer_key');
|
||||
$csecret = common_config('twitter', 'consumer_secret');
|
||||
|
@ -114,14 +111,20 @@ class TwitterBridgePlugin extends Plugin
|
|||
$m->connect('panel/twitter', ['action' => 'twitteradminpanel']);
|
||||
|
||||
if (self::hasKeys()) {
|
||||
$m->connect('twitter/authorization',
|
||||
['action' => 'twitterauthorization']);
|
||||
$m->connect('settings/twitter',
|
||||
['action' => 'twittersettings']);
|
||||
$m->connect(
|
||||
'twitter/authorization',
|
||||
['action' => 'twitterauthorization']
|
||||
);
|
||||
$m->connect(
|
||||
'settings/twitter',
|
||||
['action' => 'twittersettings']
|
||||
);
|
||||
|
||||
if (common_config('twitter', 'signin')) {
|
||||
$m->connect('main/twitterlogin',
|
||||
['action' => 'twitterlogin']);
|
||||
$m->connect(
|
||||
'main/twitterlogin',
|
||||
['action' => 'twitterlogin']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -135,7 +138,7 @@ class TwitterBridgePlugin extends Plugin
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
function onEndLoginGroupNav($action)
|
||||
public function onEndLoginGroupNav($action)
|
||||
{
|
||||
$action_name = $action->trimmed('action');
|
||||
|
||||
|
@ -143,7 +146,7 @@ class TwitterBridgePlugin extends Plugin
|
|||
$action->menuItem(
|
||||
common_local_url('twitterlogin'),
|
||||
// TRANS: Menu item in login navigation.
|
||||
_m('MENU','Twitter'),
|
||||
_m('MENU', 'Twitter'),
|
||||
// TRANS: Title for menu item in login navigation.
|
||||
_m('Login or register using Twitter.'),
|
||||
'twitterlogin' === $action_name
|
||||
|
@ -160,7 +163,7 @@ class TwitterBridgePlugin extends Plugin
|
|||
*
|
||||
* @return boolean hook return
|
||||
*/
|
||||
function onEndConnectSettingsNav($action)
|
||||
public function onEndConnectSettingsNav($action)
|
||||
{
|
||||
if (self::hasKeys()) {
|
||||
$action_name = $action->trimmed('action');
|
||||
|
@ -168,7 +171,7 @@ class TwitterBridgePlugin extends Plugin
|
|||
$action->menuItem(
|
||||
common_local_url('twittersettings'),
|
||||
// TRANS: Menu item in connection settings navigation.
|
||||
_m('MENU','Twitter'),
|
||||
_m('MENU', 'Twitter'),
|
||||
// TRANS: Title for menu item in connection settings navigation.
|
||||
_m('Twitter integration options'),
|
||||
$action_name === 'twittersettings'
|
||||
|
@ -185,7 +188,7 @@ class TwitterBridgePlugin extends Plugin
|
|||
*
|
||||
* @return boolean hook return
|
||||
*/
|
||||
function onStartEnqueueNotice($notice, &$transports)
|
||||
public function onStartEnqueueNotice($notice, &$transports)
|
||||
{
|
||||
if (self::hasKeys() && $notice->isLocal() && $notice->inScope(null)) {
|
||||
// Avoid a possible loop
|
||||
|
@ -203,7 +206,7 @@ class TwitterBridgePlugin extends Plugin
|
|||
*
|
||||
* @return boolean hook return
|
||||
*/
|
||||
function onGetValidDaemons(&$daemons)
|
||||
public function onGetValidDaemons(&$daemons)
|
||||
{
|
||||
if (self::hasKeys()) {
|
||||
array_push(
|
||||
|
@ -216,7 +219,7 @@ class TwitterBridgePlugin extends Plugin
|
|||
$daemons,
|
||||
INSTALLDIR
|
||||
. '/plugins/TwitterBridge/daemons/twitterstatusfetcher.php'
|
||||
);
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -230,7 +233,7 @@ class TwitterBridgePlugin extends Plugin
|
|||
*
|
||||
* @return boolean hook return
|
||||
*/
|
||||
function onEndInitializeQueueManager($manager)
|
||||
public function onEndInitializeQueueManager($manager)
|
||||
{
|
||||
if (self::hasKeys()) {
|
||||
// Outgoing notices -> twitter
|
||||
|
@ -245,7 +248,7 @@ class TwitterBridgePlugin extends Plugin
|
|||
/**
|
||||
* If the plugin's installed, this should be accessible to admins
|
||||
*/
|
||||
function onAdminPanelCheck($name, &$isOK)
|
||||
public function onAdminPanelCheck($name, &$isOK)
|
||||
{
|
||||
if ($name == 'twitter') {
|
||||
$isOK = true;
|
||||
|
@ -262,10 +265,9 @@ class TwitterBridgePlugin extends Plugin
|
|||
* @return boolean hook value
|
||||
*/
|
||||
|
||||
function onEndAdminPanelNav($nav)
|
||||
public function onEndAdminPanelNav($nav)
|
||||
{
|
||||
if (AdminPanelAction::canAdmin('twitter')) {
|
||||
|
||||
$action_name = $nav->action->trimmed('action');
|
||||
|
||||
$nav->out->menuItem(
|
||||
|
@ -297,7 +299,8 @@ class TwitterBridgePlugin extends Plugin
|
|||
'author' => 'Zach Copley, Julien C, Jean Baptiste Favre',
|
||||
'homepage' => GNUSOCIAL_ENGINE_REPO_URL . 'tree/master/plugins/TwitterBridge',
|
||||
// TRANS: Plugin description.
|
||||
'rawdescription' => _m('The Twitter "bridge" plugin allows integration ' .
|
||||
'rawdescription' => _m(
|
||||
'The Twitter "bridge" plugin allows integration ' .
|
||||
'of a StatusNet instance with ' .
|
||||
'<a href="http://twitter.com/">Twitter</a>.'
|
||||
)
|
||||
|
@ -312,7 +315,7 @@ class TwitterBridgePlugin extends Plugin
|
|||
*
|
||||
* @return boolean hook value;
|
||||
*/
|
||||
function onTwitterBridgeAdminImportControl()
|
||||
public function onTwitterBridgeAdminImportControl()
|
||||
{
|
||||
return (bool)$this->adminImportControl;
|
||||
}
|
||||
|
@ -327,7 +330,7 @@ class TwitterBridgePlugin extends Plugin
|
|||
*
|
||||
* @return boolean hook value; true means continue processing, false means stop.
|
||||
*/
|
||||
function onCheckSchema()
|
||||
public function onCheckSchema()
|
||||
{
|
||||
$schema = Schema::get();
|
||||
|
||||
|
@ -350,12 +353,11 @@ class TwitterBridgePlugin extends Plugin
|
|||
*
|
||||
* @return boolean hook value
|
||||
*/
|
||||
function onStartDeleteOwnNotice(User $user, Notice $notice)
|
||||
public function onStartDeleteOwnNotice(User $user, Notice $notice)
|
||||
{
|
||||
$n2s = Notice_to_status::getKV('notice_id', $notice->id);
|
||||
|
||||
if ($n2s instanceof Notice_to_status) {
|
||||
|
||||
try {
|
||||
$flink = Foreign_link::getByUserID($notice->profile_id, TWITTER_SERVICE); // twitter service
|
||||
} catch (NoResultException $e) {
|
||||
|
@ -388,7 +390,7 @@ class TwitterBridgePlugin extends Plugin
|
|||
* @param Notice $notice being favored
|
||||
* @return hook return value
|
||||
*/
|
||||
function onEndFavorNotice(Profile $profile, Notice $notice)
|
||||
public function onEndFavorNotice(Profile $profile, Notice $notice)
|
||||
{
|
||||
try {
|
||||
$flink = Foreign_link::getByUserID($profile->getID(), TWITTER_SERVICE); // twitter service
|
||||
|
@ -427,7 +429,7 @@ class TwitterBridgePlugin extends Plugin
|
|||
*
|
||||
* @return hook return value
|
||||
*/
|
||||
function onEndDisfavorNotice(Profile $profile, Notice $notice)
|
||||
public function onEndDisfavorNotice(Profile $profile, Notice $notice)
|
||||
{
|
||||
try {
|
||||
$flink = Foreign_link::getByUserID($profile->getID(), TWITTER_SERVICE); // twitter service
|
||||
|
@ -458,7 +460,7 @@ class TwitterBridgePlugin extends Plugin
|
|||
return true;
|
||||
}
|
||||
|
||||
function onStartGetProfileUri($profile, &$uri)
|
||||
public function onStartGetProfileUri($profile, &$uri)
|
||||
{
|
||||
if (preg_match('!^https?://twitter.com/!', $profile->profileurl)) {
|
||||
$uri = $profile->profileurl;
|
||||
|
@ -476,7 +478,7 @@ class TwitterBridgePlugin extends Plugin
|
|||
* @return boolean hook value (true)
|
||||
*/
|
||||
|
||||
function onOtherAccountProfiles($profile, &$links)
|
||||
public function onOtherAccountProfiles($profile, &$links)
|
||||
{
|
||||
$fuser = null;
|
||||
|
||||
|
@ -496,7 +498,8 @@ class TwitterBridgePlugin extends Plugin
|
|||
|
||||
public function onEndShowHeadElements(Action $action)
|
||||
{
|
||||
if($action instanceof ShowNoticeAction) { // Showing a notice
|
||||
// Showing a notice
|
||||
if ($action instanceof ShowNoticeAction) {
|
||||
$notice = Notice::getKV('id', $action->arg('notice'));
|
||||
|
||||
try {
|
||||
|
@ -507,7 +510,7 @@ class TwitterBridgePlugin extends Plugin
|
|||
}
|
||||
|
||||
$statusId = twitter_status_id($notice);
|
||||
if($notice instanceof Notice && $notice->isLocal() && $statusId) {
|
||||
if ($notice instanceof Notice && $notice->isLocal() && $statusId) {
|
||||
$tweetUrl = 'https://twitter.com/' . $fuser->nickname . '/status/' . $statusId;
|
||||
$action->element('link', array('rel' => 'syndication', 'href' => $tweetUrl));
|
||||
}
|
||||
|
@ -529,24 +532,48 @@ class TwitterBridgePlugin extends Plugin
|
|||
case 'image/jpg':
|
||||
case 'image/png':
|
||||
case 'image/gif':
|
||||
$action->element('meta', array('name' => 'twitter:card',
|
||||
'content' => 'photo'),
|
||||
null);
|
||||
$action->element('meta', array('name' => 'twitter:url',
|
||||
'content' => common_local_url('attachment',
|
||||
array('attachment' => $action->attachment->id))),
|
||||
null );
|
||||
$action->element('meta', array('name' => 'twitter:image',
|
||||
'content' => $action->attachment->url));
|
||||
$action->element('meta', array('name' => 'twitter:title',
|
||||
'content' => $action->attachment->title));
|
||||
$action->element(
|
||||
'meta',
|
||||
[
|
||||
'name' => 'twitter:card',
|
||||
'content' => 'photo',
|
||||
],
|
||||
null
|
||||
);
|
||||
$action->element(
|
||||
'meta',
|
||||
[
|
||||
'name' => 'twitter:url',
|
||||
'content' => common_local_url(
|
||||
'attachment',
|
||||
['attachment' => $action->attachment->id]
|
||||
)
|
||||
],
|
||||
null
|
||||
);
|
||||
$action->element(
|
||||
'meta',
|
||||
[
|
||||
'name' => 'twitter:image',
|
||||
'content' => $action->attachment->url,
|
||||
]
|
||||
);
|
||||
$action->element(
|
||||
'meta',
|
||||
[
|
||||
'name' => 'twitter:title',
|
||||
'content' => $action->attachment->title,
|
||||
]
|
||||
);
|
||||
|
||||
$ns = new AttachmentNoticeSection($action);
|
||||
$notices = $ns->getNotices();
|
||||
$noticeArray = $notices->fetchAll();
|
||||
|
||||
// Should not have more than 1 notice for this attachment.
|
||||
if( count($noticeArray) != 1 ) { break; }
|
||||
if (count($noticeArray) != 1) {
|
||||
break;
|
||||
}
|
||||
$post = $noticeArray[0];
|
||||
|
||||
try {
|
||||
|
@ -572,20 +599,20 @@ class TwitterBridgePlugin extends Plugin
|
|||
*/
|
||||
public function onEndUpgrade()
|
||||
{
|
||||
printfnq("Ensuring all Twitter notices have an object_type...");
|
||||
|
||||
$notice = new Notice();
|
||||
$notice->whereAdd("source='twitter'");
|
||||
$notice->whereAdd('object_type IS NULL');
|
||||
|
||||
if ($notice->find()) {
|
||||
while ($notice->fetch()) {
|
||||
$orig = Notice::getKV('id', $notice->id);
|
||||
$notice->object_type = ActivityObject::NOTE;
|
||||
$notice->update($orig);
|
||||
}
|
||||
}
|
||||
|
||||
printfnq("DONE.\n");
|
||||
printfnq('Ensuring all Twitter notices have an object_type...');
|
||||
|
||||
$notice = new Notice();
|
||||
$notice->whereAdd("source = 'twitter'");
|
||||
$notice->whereAdd('object_type IS NULL');
|
||||
|
||||
if ($notice->find()) {
|
||||
while ($notice->fetch()) {
|
||||
$orig = Notice::getKV('id', $notice->id);
|
||||
$notice->object_type = ActivityObject::NOTE;
|
||||
$notice->update($orig);
|
||||
}
|
||||
}
|
||||
|
||||
printfnq("DONE.\n");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,44 +1,38 @@
|
|||
<?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/>.
|
||||
|
||||
/**
|
||||
* Clear all flags for a profile
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Action
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
|
||||
* @link http://status.net/
|
||||
*
|
||||
* StatusNet - the distributed open-source microblogging tool
|
||||
* Copyright (C) 2009, StatusNet, Inc.
|
||||
*
|
||||
* 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 Action
|
||||
* @package GNUsocial
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2009 StatusNet, Inc.
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
|
||||
if (!defined('STATUSNET')) {
|
||||
exit(1);
|
||||
}
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
/**
|
||||
* Action to clear flags for a profile
|
||||
*
|
||||
* @category Action
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
|
||||
* @link http://status.net/
|
||||
* @category Action
|
||||
* @package GNUsocial
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
class ClearflagAction extends ProfileFormAction
|
||||
{
|
||||
|
@ -49,7 +43,7 @@ class ClearflagAction extends ProfileFormAction
|
|||
*
|
||||
* @return boolean success flag
|
||||
*/
|
||||
function prepare(array $args = array())
|
||||
public function prepare(array $args = [])
|
||||
{
|
||||
if (!parent::prepare($args)) {
|
||||
return false;
|
||||
|
@ -73,7 +67,7 @@ class ClearflagAction extends ProfileFormAction
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
function handle()
|
||||
public function handle()
|
||||
{
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
$this->handlePost();
|
||||
|
@ -90,7 +84,7 @@ class ClearflagAction extends ProfileFormAction
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
function handlePost()
|
||||
public function handlePost()
|
||||
{
|
||||
$ufp = new User_flag_profile();
|
||||
|
||||
|
@ -102,8 +96,10 @@ class ClearflagAction extends ProfileFormAction
|
|||
if ($result == false) {
|
||||
// TRANS: Server exception given when flags could not be cleared.
|
||||
// TRANS: %s is a profile nickname.
|
||||
$msg = sprintf(_m('Could not clear flags for profile "%s".'),
|
||||
$this->profile->nickname);
|
||||
$msg = sprintf(
|
||||
_m('Could not clear flags for profile "%s".'),
|
||||
$this->profile->nickname
|
||||
);
|
||||
throw new ServerException($msg);
|
||||
}
|
||||
|
||||
|
@ -119,7 +115,7 @@ class ClearflagAction extends ProfileFormAction
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
function ajaxResults()
|
||||
public function ajaxResults()
|
||||
{
|
||||
$this->startHTML('text/xml;charset=utf-8');
|
||||
$this->elementStart('head');
|
||||
|
|
|
@ -1,21 +1,23 @@
|
|||
#!/usr/bin/env php
|
||||
<?php
|
||||
/*
|
||||
* StatusNet - a distributed open-source microblogging tool
|
||||
* Copyright (C) 2008, 2009, 2010, StatusNet, Inc.
|
||||
*
|
||||
* 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/>.
|
||||
// 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/>.
|
||||
|
||||
/**
|
||||
* @copyright 2008-2010 StatusNet, Inc.
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
|
||||
define('INSTALLDIR', dirname(__DIR__));
|
||||
|
@ -44,16 +46,16 @@ if (have_option('i', 'id')) {
|
|||
print "Can't find user with ID $id\n";
|
||||
exit(1);
|
||||
}
|
||||
} else if (have_option('n', 'nickname')) {
|
||||
} elseif (have_option('n', 'nickname')) {
|
||||
$nickname = get_option_value('n', 'nickname');
|
||||
$user = User::getKV('nickname', $nickname);
|
||||
if (empty($user)) {
|
||||
print "Can't find user with nickname '$nickname'\n";
|
||||
exit(1);
|
||||
}
|
||||
} else if (have_option('all')) {
|
||||
} elseif (have_option('all')) {
|
||||
$user = new User();
|
||||
$user->whereAdd("jabber != ''");
|
||||
$user->whereAdd("jabber <> ''");
|
||||
$user->find(true);
|
||||
if ($user->N == 0) {
|
||||
print "No users with registered Jabber addresses in database.\n";
|
||||
|
@ -83,7 +85,7 @@ function clear_jabber($id)
|
|||
}
|
||||
}
|
||||
echo "\n";
|
||||
} else if (!$user) {
|
||||
} elseif (!$user) {
|
||||
echo "Missing user for $id\n";
|
||||
} else {
|
||||
echo "Cleared jabber already for $id\n";
|
||||
|
|
|
@ -1,21 +1,23 @@
|
|||
#!/usr/bin/env php
|
||||
<?php
|
||||
/*
|
||||
* StatusNet - a distributed open-source microblogging tool
|
||||
* Copyright (C) 2009-2010, StatusNet, Inc.
|
||||
*
|
||||
* 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/>.
|
||||
// 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/>.
|
||||
|
||||
/**
|
||||
* @copyright 2009-2010 StatusNet, Inc.
|
||||
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
||||
*/
|
||||
|
||||
define('INSTALLDIR', dirname(__DIR__));
|
||||
|
@ -46,7 +48,7 @@ if (have_option('i', 'id')) {
|
|||
print "Can't find local or remote profile with ID $id\n";
|
||||
exit(1);
|
||||
}
|
||||
} else if (have_option('n', 'nickname')) {
|
||||
} elseif (have_option('n', 'nickname')) {
|
||||
$nickname = get_option_value('n', 'nickname');
|
||||
$user = User::getKV('nickname', $nickname);
|
||||
if (empty($user)) {
|
||||
|
@ -76,7 +78,7 @@ if (have_option('--all')) {
|
|||
print "Finding all notices by $profile->nickname...";
|
||||
} else {
|
||||
print "Finding notices by $profile->nickname with geolocation data...";
|
||||
$notice->whereAdd("lat != ''");
|
||||
$notice->whereAdd("lat <> ''");
|
||||
}
|
||||
$notice->find();
|
||||
|
||||
|
|
|
@ -362,7 +362,8 @@ function initNoticeReshare()
|
|||
|
||||
$notice = new Notice();
|
||||
$notice->whereAdd('repeat_of is not null');
|
||||
$notice->whereAdd('(verb != "'.ActivityVerb::SHARE.'" OR object_type != "'.ActivityObject::ACTIVITY.'")');
|
||||
$notice->whereAdd('(verb <> "' . ActivityVerb::SHARE
|
||||
. '" OR object_type <> "' . ActivityObject::ACTIVITY . '")');
|
||||
|
||||
if ($notice->find()) {
|
||||
while ($notice->fetch()) {
|
||||
|
@ -580,7 +581,7 @@ function deleteMissingLocalFileThumbnails()
|
|||
printfnq("Removing all local File_thumbnail entries without existing files...");
|
||||
|
||||
$thumbs = new File_thumbnail();
|
||||
$thumbs->whereAdd("filename IS NOT NULL AND filename != ''");
|
||||
$thumbs->whereAdd("filename IS NOT NULL AND filename <> ''");
|
||||
// Checking if there were any File_thumbnail entries without filename
|
||||
if ($thumbs->find()) {
|
||||
while ($thumbs->fetch()) {
|
||||
|
@ -603,7 +604,7 @@ function setFilehashOnLocalFiles()
|
|||
printfnq('Ensuring all local files have the filehash field set...');
|
||||
|
||||
$file = new File();
|
||||
$file->whereAdd("filename IS NOT NULL AND filename != ''"); // local files
|
||||
$file->whereAdd("filename IS NOT NULL AND filename <> ''"); // local files
|
||||
$file->whereAdd('filehash IS NULL', 'AND'); // without filehash value
|
||||
|
||||
if ($file->find()) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user