[DATABASE] Use "<>" as an SQL non-equality sign
"!=" is not SQL compliant.
This commit is contained in:
parent
471576d6e8
commit
644b417f6c
|
@ -549,8 +549,8 @@ class Profile extends Managed_DataObject
|
|||
$tags = new Profile_tag();
|
||||
|
||||
$tags->joinAdd(array('tagger', 'user:id'));
|
||||
$tags->whereAdd('tagged = '.$this->id);
|
||||
$tags->whereAdd('tagger != '.$this->id);
|
||||
$tags->whereAdd('tagged = ' . $this->id);
|
||||
$tags->whereAdd('tagger <> ' . $this->id);
|
||||
|
||||
$tags->limit(0, 1);
|
||||
$tags->fetch();
|
||||
|
@ -669,7 +669,7 @@ class Profile extends Managed_DataObject
|
|||
'AND profile_tag.tagger = subscription.subscribed) ' .
|
||||
'WHERE subscription.subscribed = %d ' .
|
||||
"AND profile_tag.tag = '%s' " .
|
||||
'AND subscription.subscribed != subscription.subscriber ' .
|
||||
'AND subscription.subscribed <> subscription.subscriber ' .
|
||||
'ORDER BY subscription.created DESC ';
|
||||
|
||||
if ($offset) {
|
||||
|
@ -693,7 +693,7 @@ class Profile extends Managed_DataObject
|
|||
'AND profile_tag.tagger = subscription.subscriber) ' .
|
||||
'WHERE subscription.subscriber = %d ' .
|
||||
"AND profile_tag.tag = '%s' " .
|
||||
'AND subscription.subscribed != subscription.subscriber ' .
|
||||
'AND subscription.subscribed <> subscription.subscriber ' .
|
||||
'ORDER BY subscription.created DESC ';
|
||||
|
||||
$qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
|
||||
|
@ -766,8 +766,8 @@ class Profile extends Managed_DataObject
|
|||
|
||||
$sub = new Subscription();
|
||||
$sub->subscribed = $this->id;
|
||||
$sub->whereAdd('subscriber != subscribed');
|
||||
$cnt = (int) $sub->count('distinct subscriber');
|
||||
$sub->whereAdd('subscriber <> subscribed');
|
||||
$cnt = (int) $sub->count('DISTINCT subscriber');
|
||||
|
||||
if (!empty($c)) {
|
||||
$c->set(Cache::key('profile:subscriber_count:'.$this->id), $cnt);
|
||||
|
|
|
@ -406,7 +406,7 @@ class Subscription extends Managed_DataObject
|
|||
$sub = new Subscription();
|
||||
$sub->$by_type = $profile_id;
|
||||
$sub->selectAdd($get_type);
|
||||
$sub->whereAdd("{$get_type} != {$profile_id}");
|
||||
$sub->whereAdd($get_type . ' <> ' . $profile_id);
|
||||
$sub->orderBy('created DESC');
|
||||
$sub->limit($queryoffset, $querylimit);
|
||||
|
||||
|
|
|
@ -1,53 +1,52 @@
|
|||
<?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
|
||||
*
|
||||
* 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
|
||||
* @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();
|
||||
|
||||
/**
|
||||
* Public stream
|
||||
*
|
||||
* @category Stream
|
||||
* @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 PublicNoticeStream extends ModeratedNoticeStream
|
||||
{
|
||||
function __construct(Profile $scoped=null)
|
||||
public function __construct(Profile $scoped = null)
|
||||
{
|
||||
parent::__construct(new CachingNoticeStream(new RawPublicNoticeStream(),
|
||||
'public'),
|
||||
$scoped);
|
||||
parent::__construct(
|
||||
new CachingNoticeStream(
|
||||
new RawPublicNoticeStream(),
|
||||
'public'
|
||||
),
|
||||
$scoped
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,16 +54,15 @@ class PublicNoticeStream extends ModeratedNoticeStream
|
|||
* Raw public stream
|
||||
*
|
||||
* @category Stream
|
||||
* @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 RawPublicNoticeStream extends FullNoticeStream
|
||||
{
|
||||
function getNoticeIds($offset, $limit, $since_id, $max_id)
|
||||
public function getNoticeIds($offset, $limit, $since_id, $max_id)
|
||||
{
|
||||
$notice = new Notice();
|
||||
|
||||
|
@ -79,7 +77,7 @@ class RawPublicNoticeStream extends FullNoticeStream
|
|||
|
||||
// This feed always gives only local activities.
|
||||
$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::addWhereMaxId($notice, $max_id);
|
||||
|
@ -95,7 +93,7 @@ class RawPublicNoticeStream extends FullNoticeStream
|
|||
}
|
||||
|
||||
$notice->free();
|
||||
$notice = NULL;
|
||||
$notice = null;
|
||||
|
||||
return $ids;
|
||||
}
|
||||
|
|
|
@ -1,53 +1,52 @@
|
|||
<?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
|
||||
*
|
||||
* 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
|
||||
* @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 mentions of me
|
||||
*
|
||||
* @category Stream
|
||||
* @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 ReplyNoticeStream extends ScopingNoticeStream
|
||||
{
|
||||
function __construct($userId, Profile $scoped=null)
|
||||
public function __construct($userId, Profile $scoped = null)
|
||||
{
|
||||
parent::__construct(new CachingNoticeStream(new RawReplyNoticeStream($userId),
|
||||
'reply:stream:' . $userId),
|
||||
$scoped);
|
||||
parent::__construct(
|
||||
new CachingNoticeStream(
|
||||
new RawReplyNoticeStream($userId),
|
||||
'reply:stream:' . $userId
|
||||
),
|
||||
$scoped
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,24 +54,23 @@ class ReplyNoticeStream extends ScopingNoticeStream
|
|||
* Raw stream of mentions of me
|
||||
*
|
||||
* @category Stream
|
||||
* @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 RawReplyNoticeStream extends NoticeStream
|
||||
{
|
||||
protected $userId;
|
||||
|
||||
function __construct($userId)
|
||||
public function __construct($userId)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->userId = $userId;
|
||||
}
|
||||
|
||||
function getNoticeIds($offset, $limit, $since_id, $max_id)
|
||||
public function getNoticeIds($offset, $limit, $since_id, $max_id)
|
||||
{
|
||||
$reply = new Reply();
|
||||
|
||||
|
@ -94,14 +92,16 @@ class RawReplyNoticeStream extends NoticeStream
|
|||
$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)) {
|
||||
// exclude verbs in selectVerbs with values that equate to false
|
||||
$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');
|
||||
|
||||
|
|
|
@ -1,59 +1,58 @@
|
|||
<?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
|
||||
*
|
||||
* 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
|
||||
* @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 by a profile
|
||||
*
|
||||
* @category General
|
||||
* @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 ProfileNoticeStream extends ScopingNoticeStream
|
||||
{
|
||||
protected $target;
|
||||
|
||||
function __construct(Profile $target, Profile $scoped=null)
|
||||
public function __construct(Profile $target, Profile $scoped = null)
|
||||
{
|
||||
$this->target = $target;
|
||||
parent::__construct(new CachingNoticeStream(new RawProfileNoticeStream($target),
|
||||
'profile:notice_ids:' . $target->getID()),
|
||||
$scoped);
|
||||
parent::__construct(
|
||||
new CachingNoticeStream(
|
||||
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()) {
|
||||
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()) {
|
||||
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)) {
|
||||
// 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 this is a silenced user
|
||||
if ($this->target->hasRole(Profile_role::SILENCED)
|
||||
// and we are either not logged in
|
||||
&& (!$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
|
||||
|| (!$this->scoped->sameAs($this->target) && !$this->scoped->hasRight(Right::REVIEWSPAM))
|
||||
)) {
|
||||
if ($this->target->hasRole(Profile_role::SILENCED) &&
|
||||
// and we are either not logged in
|
||||
(!$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
|
||||
(!$this->scoped->sameAs($this->target) && !$this->scoped->hasRight(Right::REVIEWSPAM)))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -100,11 +98,10 @@ class ProfileNoticeStream extends ScopingNoticeStream
|
|||
* Raw stream of notices by a profile
|
||||
*
|
||||
* @category General
|
||||
* @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 RawProfileNoticeStream extends NoticeStream
|
||||
|
@ -112,13 +109,13 @@ class RawProfileNoticeStream extends NoticeStream
|
|||
protected $target;
|
||||
protected $selectVerbs = array(); // select all verbs
|
||||
|
||||
function __construct(Profile $target)
|
||||
public function __construct(Profile $target)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->target = $target;
|
||||
}
|
||||
|
||||
function getNoticeIds($offset, $limit, $since_id, $max_id)
|
||||
public function getNoticeIds($offset, $limit, $since_id, $max_id)
|
||||
{
|
||||
$notice = new Notice();
|
||||
|
||||
|
@ -127,7 +124,7 @@ class RawProfileNoticeStream extends NoticeStream
|
|||
$notice->selectAdd();
|
||||
$notice->selectAdd('id');
|
||||
|
||||
$notice->whereAdd('scope != ' . Notice::MESSAGE_SCOPE);
|
||||
$notice->whereAdd('scope <> ' . Notice::MESSAGE_SCOPE);
|
||||
|
||||
Notice::addWhereSinceId($notice, $since_id);
|
||||
Notice::addWhereMaxId($notice, $max_id);
|
||||
|
|
|
@ -95,7 +95,7 @@ class MySQLSearch extends SearchEngine
|
|||
return true;
|
||||
} elseif ($this->table === 'notice') {
|
||||
// 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(
|
||||
'MATCH (%2$s.content) AGAINST (\'%1$s\' IN BOOLEAN MODE)',
|
||||
|
|
|
@ -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();
|
||||
|
||||
// 10x8
|
||||
|
||||
|
@ -36,12 +38,12 @@ class GalleryAction extends ProfileAction
|
|||
parent::handle();
|
||||
}
|
||||
|
||||
function showContent()
|
||||
public function showContent()
|
||||
{
|
||||
$this->showTagsDropdown();
|
||||
}
|
||||
|
||||
function showTagsDropdown()
|
||||
public function showTagsDropdown()
|
||||
{
|
||||
$tag = $this->trimmed('tag');
|
||||
|
||||
|
@ -59,13 +61,17 @@ class GalleryAction extends ProfileAction
|
|||
$this->elementStart('ul');
|
||||
$this->elementStart('li', array('id' => 'filter_tags_all',
|
||||
'class' => 'child_1'));
|
||||
$this->element('a',
|
||||
array('href' =>
|
||||
common_local_url($this->trimmed('action'),
|
||||
array('nickname' =>
|
||||
$this->target->getNickname()))),
|
||||
// TRANS: List element on gallery action page to show all tags.
|
||||
_m('TAGS','All'));
|
||||
$this->element(
|
||||
'a',
|
||||
[
|
||||
'href' => common_local_url(
|
||||
$this->trimmed('action'),
|
||||
['nickname' => $this->target->getNickname()]
|
||||
),
|
||||
],
|
||||
// TRANS: List element on gallery action page to show all tags.
|
||||
_m('TAGS', 'All')
|
||||
);
|
||||
$this->elementEnd('li');
|
||||
$this->elementStart('li', array('id'=>'filter_tags_item'));
|
||||
$this->elementStart('form', array('name' => 'bytag',
|
||||
|
@ -76,12 +82,18 @@ class GalleryAction extends ProfileAction
|
|||
// TRANS: Fieldset legend on gallery action page.
|
||||
$this->element('legend', null, _('Select tag to filter'));
|
||||
// TRANS: Dropdown field label on gallery action page for a list containing tags.
|
||||
$this->dropdown('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->dropdown(
|
||||
'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());
|
||||
// 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('form');
|
||||
$this->elementEnd('li');
|
||||
|
@ -92,7 +104,7 @@ class GalleryAction extends ProfileAction
|
|||
}
|
||||
|
||||
// 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->query('SELECT DISTINCT(tag) ' .
|
||||
|
@ -100,7 +112,7 @@ class GalleryAction extends ProfileAction
|
|||
'WHERE tagger = ' . $this->target->id . ' ' .
|
||||
'AND ' . $usr . ' = ' . $this->target->id . ' ' .
|
||||
'AND ' . $lst . ' = tagged ' .
|
||||
'AND tagger != tagged');
|
||||
'AND tagger <> tagged');
|
||||
$tags = array();
|
||||
while ($profile_tag->fetch()) {
|
||||
$tags[] = $profile_tag->tag;
|
||||
|
@ -109,12 +121,12 @@ class GalleryAction extends ProfileAction
|
|||
return $tags;
|
||||
}
|
||||
|
||||
function getAllTags()
|
||||
public function getAllTags()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
function showProfileBlock()
|
||||
public function showProfileBlock()
|
||||
{
|
||||
$block = new AccountProfileBlock($this, $this->target);
|
||||
$block->show();
|
||||
|
|
|
@ -1,48 +1,43 @@
|
|||
<?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
|
||||
*
|
||||
* 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
|
||||
* @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();
|
||||
|
||||
/**
|
||||
* Notice stream for favorites
|
||||
*
|
||||
* @category Stream
|
||||
* @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 FaveNoticeStream extends ScopingNoticeStream
|
||||
{
|
||||
function __construct(Profile $target, Profile $scoped=null)
|
||||
public function __construct(Profile $target, Profile $scoped = null)
|
||||
{
|
||||
$stream = new RawFaveNoticeStream($target, $scoped);
|
||||
if ($target->sameAs($scoped)) {
|
||||
|
@ -58,11 +53,10 @@ class FaveNoticeStream extends ScopingNoticeStream
|
|||
* Raw notice stream for favorites
|
||||
*
|
||||
* @category Stream
|
||||
* @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 RawFaveNoticeStream extends NoticeStream
|
||||
{
|
||||
|
@ -71,7 +65,7 @@ class RawFaveNoticeStream extends NoticeStream
|
|||
|
||||
protected $selectVerbs = array();
|
||||
|
||||
function __construct(Profile $target, Profile $scoped=null)
|
||||
public function __construct(Profile $target, Profile $scoped = null)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
|
@ -92,7 +86,7 @@ class RawFaveNoticeStream extends NoticeStream
|
|||
* @param <type> $max_id
|
||||
* @return <type>
|
||||
*/
|
||||
function getNoticeIds($offset, $limit, $since_id, $max_id)
|
||||
public function getNoticeIds($offset, $limit, $since_id, $max_id)
|
||||
{
|
||||
$fav = new Fave();
|
||||
$qry = null;
|
||||
|
@ -101,10 +95,10 @@ class RawFaveNoticeStream extends NoticeStream
|
|||
$qry = 'SELECT fave.* FROM fave ';
|
||||
$qry .= 'WHERE fave.user_id = ' . $this->user_id . ' ';
|
||||
} else {
|
||||
$qry = 'SELECT fave.* FROM fave ';
|
||||
$qry .= 'INNER JOIN notice ON fave.notice_id = notice.id ';
|
||||
$qry .= 'WHERE fave.user_id = ' . $this->user_id . ' ';
|
||||
$qry .= 'AND notice.is_local != ' . Notice::GATEWAY . ' ';
|
||||
$qry = 'SELECT fave.* FROM fave ';
|
||||
$qry .= 'INNER JOIN notice ON fave.notice_id = notice.id ';
|
||||
$qry .= 'WHERE fave.user_id = ' . $this->user_id . ' ';
|
||||
$qry .= 'AND notice.is_local <> ' . Notice::GATEWAY . ' ';
|
||||
}
|
||||
|
||||
if ($since_id != 0) {
|
||||
|
@ -137,4 +131,3 @@ class RawFaveNoticeStream extends NoticeStream
|
|||
return $ids;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user