[DATABASE] Use "<>" as an SQL non-equality sign

"!=" is not SQL compliant.
This commit is contained in:
Alexei Sorokin 2019-09-11 13:27:36 +03:00 committed by Diogo Peralta Cordeiro
parent 37e5983aca
commit e807e3bf08
8 changed files with 192 additions and 192 deletions

View File

@ -549,8 +549,8 @@ class Profile extends Managed_DataObject
$tags = new Profile_tag(); $tags = new Profile_tag();
$tags->joinAdd(array('tagger', 'user:id')); $tags->joinAdd(array('tagger', 'user:id'));
$tags->whereAdd('tagged = '.$this->id); $tags->whereAdd('tagged = ' . $this->id);
$tags->whereAdd('tagger != '.$this->id); $tags->whereAdd('tagger <> ' . $this->id);
$tags->limit(0, 1); $tags->limit(0, 1);
$tags->fetch(); $tags->fetch();
@ -669,7 +669,7 @@ class Profile extends Managed_DataObject
'AND profile_tag.tagger = subscription.subscribed) ' . 'AND profile_tag.tagger = subscription.subscribed) ' .
'WHERE subscription.subscribed = %d ' . 'WHERE subscription.subscribed = %d ' .
"AND profile_tag.tag = '%s' " . "AND profile_tag.tag = '%s' " .
'AND subscription.subscribed != subscription.subscriber ' . 'AND subscription.subscribed <> subscription.subscriber ' .
'ORDER BY subscription.created DESC '; 'ORDER BY subscription.created DESC ';
if ($offset) { if ($offset) {
@ -693,7 +693,7 @@ class Profile extends Managed_DataObject
'AND profile_tag.tagger = subscription.subscriber) ' . 'AND profile_tag.tagger = subscription.subscriber) ' .
'WHERE subscription.subscriber = %d ' . 'WHERE subscription.subscriber = %d ' .
"AND profile_tag.tag = '%s' " . "AND profile_tag.tag = '%s' " .
'AND subscription.subscribed != subscription.subscriber ' . 'AND subscription.subscribed <> subscription.subscriber ' .
'ORDER BY subscription.created DESC '; 'ORDER BY subscription.created DESC ';
$qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset; $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
@ -766,8 +766,8 @@ class Profile extends Managed_DataObject
$sub = new Subscription(); $sub = new Subscription();
$sub->subscribed = $this->id; $sub->subscribed = $this->id;
$sub->whereAdd('subscriber != subscribed'); $sub->whereAdd('subscriber <> subscribed');
$cnt = (int) $sub->count('distinct subscriber'); $cnt = (int) $sub->count('DISTINCT subscriber');
if (!empty($c)) { if (!empty($c)) {
$c->set(Cache::key('profile:subscriber_count:'.$this->id), $cnt); $c->set(Cache::key('profile:subscriber_count:'.$this->id), $cnt);

View File

@ -406,7 +406,7 @@ class Subscription extends Managed_DataObject
$sub = new Subscription(); $sub = new Subscription();
$sub->$by_type = $profile_id; $sub->$by_type = $profile_id;
$sub->selectAdd($get_type); $sub->selectAdd($get_type);
$sub->whereAdd("{$get_type} != {$profile_id}"); $sub->whereAdd($get_type . ' <> ' . $profile_id);
$sub->orderBy('created DESC'); $sub->orderBy('created DESC');
$sub->limit($queryoffset, $querylimit); $sub->limit($queryoffset, $querylimit);

View File

@ -1,53 +1,52 @@
<?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) 2011, StatusNet, Inc.
*
* Public stream * Public stream
*
* 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 Stream * @category Stream
* @package StatusNet * @package GNUsocial
* @author Evan Prodromou <evan@status.net> * @author Evan Prodromou <evan@status.net>
* @copyright 2011 StatusNet, Inc. * @copyright 2011 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/
*/ */
if (!defined('GNUSOCIAL')) { exit(1); } defined('GNUSOCIAL') || die();
/** /**
* Public stream * Public stream
* *
* @category Stream * @category Stream
* @package StatusNet * @package GNUsocial
* @author Evan Prodromou <evan@status.net> * @author Evan Prodromou <evan@status.net>
* @copyright 2011 StatusNet, Inc. * @copyright 2011 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/
*/ */
class PublicNoticeStream extends ModeratedNoticeStream class PublicNoticeStream extends ModeratedNoticeStream
{ {
function __construct(Profile $scoped=null) public function __construct(Profile $scoped = null)
{ {
parent::__construct(new CachingNoticeStream(new RawPublicNoticeStream(), parent::__construct(
'public'), new CachingNoticeStream(
$scoped); new RawPublicNoticeStream(),
'public'
),
$scoped
);
} }
} }
@ -55,16 +54,15 @@ class PublicNoticeStream extends ModeratedNoticeStream
* Raw public stream * Raw public stream
* *
* @category Stream * @category Stream
* @package StatusNet * @package GNUsocial
* @author Evan Prodromou <evan@status.net> * @author Evan Prodromou <evan@status.net>
* @copyright 2011 StatusNet, Inc. * @copyright 2011 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/
*/ */
class RawPublicNoticeStream extends FullNoticeStream class RawPublicNoticeStream extends FullNoticeStream
{ {
function getNoticeIds($offset, $limit, $since_id, $max_id) public function getNoticeIds($offset, $limit, $since_id, $max_id)
{ {
$notice = new Notice(); $notice = new Notice();
@ -79,7 +77,7 @@ class RawPublicNoticeStream extends FullNoticeStream
// This feed always gives only local activities. // This feed always gives only local activities.
$notice->whereAdd('is_local = ' . Notice::LOCAL_PUBLIC); $notice->whereAdd('is_local = ' . Notice::LOCAL_PUBLIC);
$notice->whereAdd('scope != ' . Notice::MESSAGE_SCOPE); $notice->whereAdd('scope <> ' . Notice::MESSAGE_SCOPE);
Notice::addWhereSinceId($notice, $since_id); Notice::addWhereSinceId($notice, $since_id);
Notice::addWhereMaxId($notice, $max_id); Notice::addWhereMaxId($notice, $max_id);
@ -95,7 +93,7 @@ class RawPublicNoticeStream extends FullNoticeStream
} }
$notice->free(); $notice->free();
$notice = NULL; $notice = null;
return $ids; return $ids;
} }

View File

@ -1,53 +1,52 @@
<?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) 2011, StatusNet, Inc.
*
* Stream of mentions of me * Stream of mentions of me
*
* 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 Stream * @category Stream
* @package StatusNet * @package GNUsocial
* @author Evan Prodromou <evan@status.net> * @author Evan Prodromou <evan@status.net>
* @copyright 2011 StatusNet, Inc. * @copyright 2011 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/
*/ */
if (!defined('GNUSOCIAL')) { exit(1); } defined('GNUSOCIAL') || die();
/** /**
* Stream of mentions of me * Stream of mentions of me
* *
* @category Stream * @category Stream
* @package StatusNet * @package GNUsocial
* @author Evan Prodromou <evan@status.net> * @author Evan Prodromou <evan@status.net>
* @copyright 2011 StatusNet, Inc. * @copyright 2011 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/
*/ */
class ReplyNoticeStream extends ScopingNoticeStream class ReplyNoticeStream extends ScopingNoticeStream
{ {
function __construct($userId, Profile $scoped=null) public function __construct($userId, Profile $scoped = null)
{ {
parent::__construct(new CachingNoticeStream(new RawReplyNoticeStream($userId), parent::__construct(
'reply:stream:' . $userId), new CachingNoticeStream(
$scoped); new RawReplyNoticeStream($userId),
'reply:stream:' . $userId
),
$scoped
);
} }
} }
@ -55,24 +54,23 @@ class ReplyNoticeStream extends ScopingNoticeStream
* Raw stream of mentions of me * Raw stream of mentions of me
* *
* @category Stream * @category Stream
* @package StatusNet * @package GNUsocial
* @author Evan Prodromou <evan@status.net> * @author Evan Prodromou <evan@status.net>
* @copyright 2011 StatusNet, Inc. * @copyright 2011 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/
*/ */
class RawReplyNoticeStream extends NoticeStream class RawReplyNoticeStream extends NoticeStream
{ {
protected $userId; protected $userId;
function __construct($userId) public function __construct($userId)
{ {
parent::__construct(); parent::__construct();
$this->userId = $userId; $this->userId = $userId;
} }
function getNoticeIds($offset, $limit, $since_id, $max_id) public function getNoticeIds($offset, $limit, $since_id, $max_id)
{ {
$reply = new Reply(); $reply = new Reply();
@ -94,14 +92,16 @@ class RawReplyNoticeStream extends NoticeStream
$reply->whereAddIn('notice.verb', $filter, 'string'); $reply->whereAddIn('notice.verb', $filter, 'string');
} }
$filter = array_keys(array_filter($this->selectVerbs, function ($v) { return !$v; })); $filter = array_keys(array_filter($this->selectVerbs, function ($v) {
return !$v;
}));
if (!empty($filter)) { if (!empty($filter)) {
// exclude verbs in selectVerbs with values that equate to false // exclude verbs in selectVerbs with values that equate to false
$reply->whereAddIn('!notice.verb', $filter, 'string'); $reply->whereAddIn('!notice.verb', $filter, 'string');
} }
} }
$reply->whereAdd('notice.scope != ' . NOTICE::MESSAGE_SCOPE); $reply->whereAdd('notice.scope <> ' . NOTICE::MESSAGE_SCOPE);
$reply->orderBy('reply.modified DESC, reply.notice_id DESC'); $reply->orderBy('reply.modified DESC, reply.notice_id DESC');

View File

@ -1,59 +1,58 @@
<?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) 2011, StatusNet, Inc.
*
* Stream of notices by a profile * Stream of notices by a profile
* *
* 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 Stream * @category Stream
* @package StatusNet * @package GNUsocial
* @author Evan Prodromou <evan@status.net> * @author Evan Prodromou <evan@status.net>
* @copyright 2011 StatusNet, Inc. * @copyright 2011 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/
*/ */
if (!defined('GNUSOCIAL')) { exit(1); } defined('GNUSOCIAL') || die();
/** /**
* Stream of notices by a profile * Stream of notices by a profile
* *
* @category General * @category General
* @package StatusNet * @package GNUsocial
* @author Evan Prodromou <evan@status.net> * @author Evan Prodromou <evan@status.net>
* @copyright 2011 StatusNet, Inc. * @copyright 2011 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/
*/ */
class ProfileNoticeStream extends ScopingNoticeStream class ProfileNoticeStream extends ScopingNoticeStream
{ {
protected $target; protected $target;
function __construct(Profile $target, Profile $scoped=null) public function __construct(Profile $target, Profile $scoped = null)
{ {
$this->target = $target; $this->target = $target;
parent::__construct(new CachingNoticeStream(new RawProfileNoticeStream($target), parent::__construct(
'profile:notice_ids:' . $target->getID()), new CachingNoticeStream(
$scoped); new RawProfileNoticeStream($target),
'profile:notice_ids:' . $target->getID()
),
$scoped
);
} }
function getNoticeIds($offset, $limit, $since_id=null, $max_id=null) public function getNoticeIds($offset, $limit, $since_id = null, $max_id = null)
{ {
if ($this->impossibleStream()) { if ($this->impossibleStream()) {
return array(); return array();
@ -62,7 +61,7 @@ class ProfileNoticeStream extends ScopingNoticeStream
} }
} }
function getNotices($offset, $limit, $since_id=null, $max_id=null) public function getNotices($offset, $limit, $since_id = null, $max_id = null)
{ {
if ($this->impossibleStream()) { if ($this->impossibleStream()) {
throw new PrivateStreamException($this->target, $this->scoped); throw new PrivateStreamException($this->target, $this->scoped);
@ -71,7 +70,7 @@ class ProfileNoticeStream extends ScopingNoticeStream
} }
} }
function impossibleStream() public function impossibleStream()
{ {
if (!$this->target->readableBy($this->scoped)) { if (!$this->target->readableBy($this->scoped)) {
// cannot read because it's a private stream and either noone's logged in or they are not subscribers // cannot read because it's a private stream and either noone's logged in or they are not subscribers
@ -82,12 +81,11 @@ class ProfileNoticeStream extends ScopingNoticeStream
if (common_config('notice', 'hidespam')) { if (common_config('notice', 'hidespam')) {
// if this is a silenced user // if this is a silenced user
if ($this->target->hasRole(Profile_role::SILENCED) if ($this->target->hasRole(Profile_role::SILENCED) &&
// and we are either not logged in // and we are either not logged in
&& (!$this->scoped instanceof Profile (!$this->scoped instanceof Profile ||
// or if we are, we are not logged in as the target, and we don't have right to review spam // or if we are, we are not logged in as the target, and we don't have right to review spam
|| (!$this->scoped->sameAs($this->target) && !$this->scoped->hasRight(Right::REVIEWSPAM)) (!$this->scoped->sameAs($this->target) && !$this->scoped->hasRight(Right::REVIEWSPAM)))) {
)) {
return true; return true;
} }
} }
@ -100,11 +98,10 @@ class ProfileNoticeStream extends ScopingNoticeStream
* Raw stream of notices by a profile * Raw stream of notices by a profile
* *
* @category General * @category General
* @package StatusNet * @package GNUsocial
* @author Evan Prodromou <evan@status.net> * @author Evan Prodromou <evan@status.net>
* @copyright 2011 StatusNet, Inc. * @copyright 2011 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/
*/ */
class RawProfileNoticeStream extends NoticeStream class RawProfileNoticeStream extends NoticeStream
@ -112,13 +109,13 @@ class RawProfileNoticeStream extends NoticeStream
protected $target; protected $target;
protected $selectVerbs = array(); // select all verbs protected $selectVerbs = array(); // select all verbs
function __construct(Profile $target) public function __construct(Profile $target)
{ {
parent::__construct(); parent::__construct();
$this->target = $target; $this->target = $target;
} }
function getNoticeIds($offset, $limit, $since_id, $max_id) public function getNoticeIds($offset, $limit, $since_id, $max_id)
{ {
$notice = new Notice(); $notice = new Notice();
@ -127,7 +124,7 @@ class RawProfileNoticeStream extends NoticeStream
$notice->selectAdd(); $notice->selectAdd();
$notice->selectAdd('id'); $notice->selectAdd('id');
$notice->whereAdd('scope != ' . Notice::MESSAGE_SCOPE); $notice->whereAdd('scope <> ' . Notice::MESSAGE_SCOPE);
Notice::addWhereSinceId($notice, $since_id); Notice::addWhereSinceId($notice, $since_id);
Notice::addWhereMaxId($notice, $max_id); Notice::addWhereMaxId($notice, $max_id);

View File

@ -95,7 +95,7 @@ class MySQLSearch extends SearchEngine
return true; return true;
} elseif ($this->table === 'notice') { } elseif ($this->table === 'notice') {
// Don't show imported notices // Don't show imported notices
$this->target->whereAdd('notice.is_local != ' . Notice::GATEWAY); $this->target->whereAdd('notice.is_local <> ' . Notice::GATEWAY);
$this->target->whereAdd(sprintf( $this->target->whereAdd(sprintf(
'MATCH (%2$s.content) AGAINST (\'%1$s\' IN BOOLEAN MODE)', 'MATCH (%2$s.content) AGAINST (\'%1$s\' IN BOOLEAN MODE)',

View File

@ -1,23 +1,25 @@
<?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 2008, 2009 StatusNet, Inc.
* Copyright (C) 2008, 2009, StatusNet, Inc. * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*
* 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/>.
*/ */
if (!defined('GNUSOCIAL')) { exit(1); } defined('GNUSOCIAL') || die();
// 10x8 // 10x8
@ -36,12 +38,12 @@ class GalleryAction extends ProfileAction
parent::handle(); parent::handle();
} }
function showContent() public function showContent()
{ {
$this->showTagsDropdown(); $this->showTagsDropdown();
} }
function showTagsDropdown() public function showTagsDropdown()
{ {
$tag = $this->trimmed('tag'); $tag = $this->trimmed('tag');
@ -59,13 +61,17 @@ class GalleryAction extends ProfileAction
$this->elementStart('ul'); $this->elementStart('ul');
$this->elementStart('li', array('id' => 'filter_tags_all', $this->elementStart('li', array('id' => 'filter_tags_all',
'class' => 'child_1')); 'class' => 'child_1'));
$this->element('a', $this->element(
array('href' => 'a',
common_local_url($this->trimmed('action'), [
array('nickname' => 'href' => common_local_url(
$this->target->getNickname()))), $this->trimmed('action'),
// TRANS: List element on gallery action page to show all tags. ['nickname' => $this->target->getNickname()]
_m('TAGS','All')); ),
],
// TRANS: List element on gallery action page to show all tags.
_m('TAGS', 'All')
);
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementStart('li', array('id'=>'filter_tags_item')); $this->elementStart('li', array('id'=>'filter_tags_item'));
$this->elementStart('form', array('name' => 'bytag', $this->elementStart('form', array('name' => 'bytag',
@ -76,12 +82,18 @@ class GalleryAction extends ProfileAction
// TRANS: Fieldset legend on gallery action page. // TRANS: Fieldset legend on gallery action page.
$this->element('legend', null, _('Select tag to filter')); $this->element('legend', null, _('Select tag to filter'));
// TRANS: Dropdown field label on gallery action page for a list containing tags. // TRANS: Dropdown field label on gallery action page for a list containing tags.
$this->dropdown('tag', _('Tag'), $content, $this->dropdown(
// TRANS: Dropdown field title on gallery action page for a list containing tags. 'tag',
_('Choose a tag to narrow list.'), false, $tag); _('Tag'),
$content,
// TRANS: Dropdown field title on gallery action page for a list containing tags.
_('Choose a tag to narrow list.'),
false,
$tag
);
$this->hidden('nickname', $this->target->getNickname()); $this->hidden('nickname', $this->target->getNickname());
// TRANS: Submit button text on gallery action page. // TRANS: Submit button text on gallery action page.
$this->submit('submit', _m('BUTTON','Go')); $this->submit('submit', _m('BUTTON', 'Go'));
$this->elementEnd('fieldset'); $this->elementEnd('fieldset');
$this->elementEnd('form'); $this->elementEnd('form');
$this->elementEnd('li'); $this->elementEnd('li');
@ -92,7 +104,7 @@ class GalleryAction extends ProfileAction
} }
// Get list of tags we tagged other users with // Get list of tags we tagged other users with
function getTags($lst, $usr) public function getTags($lst, $usr)
{ {
$profile_tag = new Notice_tag(); $profile_tag = new Notice_tag();
$profile_tag->query('SELECT DISTINCT(tag) ' . $profile_tag->query('SELECT DISTINCT(tag) ' .
@ -100,7 +112,7 @@ class GalleryAction extends ProfileAction
'WHERE tagger = ' . $this->target->id . ' ' . 'WHERE tagger = ' . $this->target->id . ' ' .
'AND ' . $usr . ' = ' . $this->target->id . ' ' . 'AND ' . $usr . ' = ' . $this->target->id . ' ' .
'AND ' . $lst . ' = tagged ' . 'AND ' . $lst . ' = tagged ' .
'AND tagger != tagged'); 'AND tagger <> tagged');
$tags = array(); $tags = array();
while ($profile_tag->fetch()) { while ($profile_tag->fetch()) {
$tags[] = $profile_tag->tag; $tags[] = $profile_tag->tag;
@ -109,12 +121,12 @@ class GalleryAction extends ProfileAction
return $tags; return $tags;
} }
function getAllTags() public function getAllTags()
{ {
return array(); return array();
} }
function showProfileBlock() public function showProfileBlock()
{ {
$block = new AccountProfileBlock($this, $this->target); $block = new AccountProfileBlock($this, $this->target);
$block->show(); $block->show();

View File

@ -1,48 +1,43 @@
<?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) 2011, StatusNet, Inc.
*
* Notice stream for favorites * Notice stream for favorites
*
* 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 Stream * @category Stream
* @package StatusNet * @package GNUsocial
* @author Evan Prodromou <evan@status.net> * @author Evan Prodromou <evan@status.net>
* @copyright 2011 StatusNet, Inc. * @copyright 2011 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/
*/ */
if (!defined('GNUSOCIAL')) { exit(1); } defined('GNUSOCIAL') || die();
/** /**
* Notice stream for favorites * Notice stream for favorites
* *
* @category Stream * @category Stream
* @package StatusNet * @package GNUsocial
* @author Evan Prodromou <evan@status.net> * @author Evan Prodromou <evan@status.net>
* @copyright 2011 StatusNet, Inc. * @copyright 2011 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/
*/ */
class FaveNoticeStream extends ScopingNoticeStream class FaveNoticeStream extends ScopingNoticeStream
{ {
function __construct(Profile $target, Profile $scoped=null) public function __construct(Profile $target, Profile $scoped = null)
{ {
$stream = new RawFaveNoticeStream($target, $scoped); $stream = new RawFaveNoticeStream($target, $scoped);
if ($target->sameAs($scoped)) { if ($target->sameAs($scoped)) {
@ -58,11 +53,10 @@ class FaveNoticeStream extends ScopingNoticeStream
* Raw notice stream for favorites * Raw notice stream for favorites
* *
* @category Stream * @category Stream
* @package StatusNet * @package GNUsocial
* @author Evan Prodromou <evan@status.net> * @author Evan Prodromou <evan@status.net>
* @copyright 2011 StatusNet, Inc. * @copyright 2011 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/
*/ */
class RawFaveNoticeStream extends NoticeStream class RawFaveNoticeStream extends NoticeStream
{ {
@ -71,7 +65,7 @@ class RawFaveNoticeStream extends NoticeStream
protected $selectVerbs = array(); protected $selectVerbs = array();
function __construct(Profile $target, Profile $scoped=null) public function __construct(Profile $target, Profile $scoped = null)
{ {
parent::__construct(); parent::__construct();
@ -92,7 +86,7 @@ class RawFaveNoticeStream extends NoticeStream
* @param <type> $max_id * @param <type> $max_id
* @return <type> * @return <type>
*/ */
function getNoticeIds($offset, $limit, $since_id, $max_id) public function getNoticeIds($offset, $limit, $since_id, $max_id)
{ {
$fav = new Fave(); $fav = new Fave();
$qry = null; $qry = null;
@ -101,10 +95,10 @@ class RawFaveNoticeStream extends NoticeStream
$qry = 'SELECT fave.* FROM fave '; $qry = 'SELECT fave.* FROM fave ';
$qry .= 'WHERE fave.user_id = ' . $this->user_id . ' '; $qry .= 'WHERE fave.user_id = ' . $this->user_id . ' ';
} else { } else {
$qry = 'SELECT fave.* FROM fave '; $qry = 'SELECT fave.* FROM fave ';
$qry .= 'INNER JOIN notice ON fave.notice_id = notice.id '; $qry .= 'INNER JOIN notice ON fave.notice_id = notice.id ';
$qry .= 'WHERE fave.user_id = ' . $this->user_id . ' '; $qry .= 'WHERE fave.user_id = ' . $this->user_id . ' ';
$qry .= 'AND notice.is_local != ' . Notice::GATEWAY . ' '; $qry .= 'AND notice.is_local <> ' . Notice::GATEWAY . ' ';
} }
if ($since_id != 0) { if ($since_id != 0) {
@ -137,4 +131,3 @@ class RawFaveNoticeStream extends NoticeStream
return $ids; return $ids;
} }
} }