diff --git a/actions/apigrouplistall.php b/actions/apigrouplistall.php
index 90f8eed8fa..556306f0bf 100644
--- a/actions/apigrouplistall.php
+++ b/actions/apigrouplistall.php
@@ -1,55 +1,45 @@
.
+
/**
- * StatusNet, the distributed open-source microblogging tool
- *
* Show the newest groups
*
- * 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 .
- *
* @category API
- * @package StatusNet
+ * @package GNUsocial
* @author Craig Andrews
* @author Evan Prodromou
* @author Jeffery To
* @author Zach Copley
* @copyright 2009 StatusNet, Inc.
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
- * @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('STATUSNET')) {
- exit(1);
-}
+defined('GNUSOCIAL') || die();
/**
* Returns of the lastest 20 groups for the site
*
- * @category API
- * @package StatusNet
- * @author Craig Andrews
- * @author Evan Prodromou
- * @author Jeffery To
- * @author Zach Copley
- * @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 StatusNet, Inc.
+ * @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
+ * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class ApiGroupListAllAction extends ApiPrivateAuthAction
{
- var $groups = null;
+ public $groups = null;
/**
* Take arguments for running
@@ -58,7 +48,7 @@ class ApiGroupListAllAction extends ApiPrivateAuthAction
*
* @return boolean success flag
*/
- function prepare(array $args = array())
+ public function prepare(array $args = [])
{
parent::prepare($args);
@@ -77,7 +67,7 @@ class ApiGroupListAllAction extends ApiPrivateAuthAction
*
* @return void
*/
- function handle()
+ public function handle()
{
parent::handle();
@@ -90,7 +80,7 @@ class ApiGroupListAllAction extends ApiPrivateAuthAction
// TRANS: Message is used as a subtitle when listing the latest 20 groups. %s is a site name.
$subtitle = sprintf(_("groups on %s"), $sitename);
- switch($this->format) {
+ switch ($this->format) {
case 'xml':
$this->showXmlGroups($this->groups);
break;
@@ -128,21 +118,20 @@ class ApiGroupListAllAction extends ApiPrivateAuthAction
*
* @return array groups
*/
- function getGroups()
+ public function getGroups()
{
- $qry = 'SELECT user_group.* '.
- 'from user_group join local_group on user_group.id = local_group.group_id '.
- 'order by created desc ';
- $offset = intval($this->page - 1) * intval($this->count);
- $limit = intval($this->count);
- if (common_config('db', 'type') == 'pgsql') {
- $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
- } else {
- $qry .= ' LIMIT ' . $offset . ', ' . $limit;
- }
$group = new User_group();
- $group->query($qry);
+ $offset = intval($this->page - 1) * intval($this->count);
+ $limit = intval($this->count);
+
+ $group->query(
+ 'SELECT user_group.* '.
+ 'FROM user_group INNER JOIN local_group ' .
+ 'ON user_group.id = local_group.group_id '.
+ 'ORDER BY created DESC ' .
+ 'LIMIT ' . $limit . ' OFFSET ' . $offset
+ );
$groups = array();
while ($group->fetch()) {
@@ -159,7 +148,7 @@ class ApiGroupListAllAction extends ApiPrivateAuthAction
*
* @return boolean true
*/
- function isReadOnly($args)
+ public function isReadOnly($args)
{
return true;
}
@@ -169,7 +158,7 @@ class ApiGroupListAllAction extends ApiPrivateAuthAction
*
* @return string datestamp of the site's latest group
*/
- function lastModified()
+ public function lastModified()
{
if (!empty($this->groups) && (count($this->groups) > 0)) {
return strtotime($this->groups[0]->created);
@@ -186,10 +175,9 @@ class ApiGroupListAllAction extends ApiPrivateAuthAction
*
* @return string etag
*/
- function etag()
+ public function etag()
{
if (!empty($this->groups) && (count($this->groups) > 0)) {
-
$last = count($this->groups) - 1;
return '"' . implode(
diff --git a/actions/selftag.php b/actions/selftag.php
index 2fb3b49078..1cf549b8ea 100644
--- a/actions/selftag.php
+++ b/actions/selftag.php
@@ -1,53 +1,45 @@
.
+
/**
- * StatusNet, the distributed open-source microblogging tool
- *
* Action for showing profiles self-tagged with a given tag
*
- * 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 .
- *
* @category Action
- * @package StatusNet
+ * @package GNUsocial
* @author Evan Prodromou
* @author Zach Copley
* @copyright 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('STATUSNET') && !defined('LACONICA')) {
- exit(1);
-}
+defined('GNUSOCIAL') || die();
/**
* This class outputs a paginated list of profiles self-tagged with a given tag
*
- * @category Output
- * @package StatusNet
- * @author Evan Prodromou
- * @author Zach Copley
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link http://status.net/
+ * @category Output
+ * @copyright 2009 StatusNet, Inc.
+ * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*
- * @see Action
+ * @see Action
*/
class SelftagAction extends Action
{
- var $tag = null;
- var $page = null;
+ public $tag = null;
+ public $page = null;
/**
* For initializing members of the class.
@@ -57,7 +49,7 @@ class SelftagAction extends Action
* @return boolean true
* @throws ClientException
*/
- function prepare(array $args = [])
+ public function prepare(array $args = [])
{
parent::prepare($args);
@@ -66,8 +58,10 @@ class SelftagAction extends Action
if (!common_valid_profile_tag($this->tag)) {
// TRANS: Client error displayed when trying to list a profile with an invalid list.
// TRANS: %s is the invalid list name.
- $this->clientError(sprintf(_('Not a valid list: %s.'),
- $this->tag));
+ $this->clientError(sprintf(
+ _('Not a valid list: %s.'),
+ $this->tag
+ ));
return null;
}
@@ -83,7 +77,7 @@ class SelftagAction extends Action
*
* @return void is read only action?
*/
- function handle()
+ public function handle()
{
parent::handle();
$this->showPage();
@@ -94,19 +88,13 @@ class SelftagAction extends Action
* people tag and page, initalizes a ProfileList widget, and displays
* it to the user.
*/
- function showContent()
+ public function showContent()
{
$profile = new Profile();
$offset = ($this->page - 1) * PROFILES_PER_PAGE;
$limit = PROFILES_PER_PAGE + 1;
- if (common_config('db', 'type') == 'pgsql') {
- $lim = ' LIMIT ' . $limit . ' OFFSET ' . $offset;
- } else {
- $lim = ' LIMIT ' . $offset . ', ' . $limit;
- }
-
// XXX: memcached this
$qry = 'SELECT profile.* ' .
@@ -125,18 +113,21 @@ class SelftagAction extends Action
' OR profile_list.private = false) ';
}
- $qry .= 'ORDER BY profile_tag.modified DESC%s';
+ $qry .= 'ORDER BY profile_tag.modified DESC ' .
+ 'LIMIT ' . $limit . ' OFFSET ' . $offset;
- $profile->query(sprintf($qry, $this->tag, $lim));
+ $profile->query(sprintf($qry, $this->tag));
$ptl = new SelfTagProfileList($profile, $this); // pass the ammunition
$cnt = $ptl->show();
- $this->pagination($this->page > 1,
- $cnt > PROFILES_PER_PAGE,
- $this->page,
- 'selftag',
- array('tag' => $this->tag));
+ $this->pagination(
+ $this->page > 1,
+ $cnt > PROFILES_PER_PAGE,
+ $this->page,
+ 'selftag',
+ ['tag' => $this->tag]
+ );
}
/**
@@ -144,18 +135,21 @@ class SelftagAction extends Action
*
* @return string page title
*/
- function title()
+ public function title()
{
// TRANS: Page title for page showing self tags.
// TRANS: %1$s is a tag, %2$d is a page number.
- return sprintf(_('Users self-tagged with %1$s, page %2$d'),
- $this->tag, $this->page);
+ return sprintf(
+ _('Users self-tagged with %1$s, page %2$d'),
+ $this->tag,
+ $this->page
+ );
}
}
class SelfTagProfileList extends ProfileList
{
- function newListItem(Profile $target)
+ public function newListItem(Profile $target)
{
return new SelfTagProfileListItem($target, $this->action);
}
@@ -163,7 +157,7 @@ class SelfTagProfileList extends ProfileList
class SelfTagProfileListItem extends ProfileListItem
{
- function linkAttributes()
+ public function linkAttributes()
{
$aAttrs = parent::linkAttributes();
@@ -174,7 +168,7 @@ class SelfTagProfileListItem extends ProfileListItem
return $aAttrs;
}
- function homepageAttributes()
+ public function homepageAttributes()
{
$aAttrs = parent::linkAttributes();
@@ -185,7 +179,7 @@ class SelfTagProfileListItem extends ProfileListItem
return $aAttrs;
}
- function showTags()
+ public function showTags()
{
$selftags = new SelfTagsWidget($this->out, $this->profile, $this->profile);
$selftags->show();
diff --git a/classes/User.php b/classes/User.php
index 40e0d71874..49415d4d59 100644
--- a/classes/User.php
+++ b/classes/User.php
@@ -848,11 +848,7 @@ class User extends Managed_DataObject
'ORDER BY u.created DESC ';
if ($offset > 0) {
- if (common_config('db','type') == 'pgsql') {
- $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
- } else {
- $qry .= ' LIMIT ' . $offset . ', ' . $limit;
- }
+ $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
}
$apps = new Oauth_application_user();
diff --git a/lib/groups/groupsbymemberssection.php b/lib/groups/groupsbymemberssection.php
index 9b1bac2154..ef04468b17 100644
--- a/lib/groups/groupsbymemberssection.php
+++ b/lib/groups/groupsbymemberssection.php
@@ -1,77 +1,60 @@
.
+
/**
- * StatusNet, the distributed open-source microblogging tool
- *
* Groups with the most members section
*
- * 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 .
- *
* @category Widget
- * @package StatusNet
+ * @package GNUsocial
* @author Evan Prodromou
* @copyright 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('STATUSNET') && !defined('LACONICA')) {
- exit(1);
-}
+defined('GNUSOCIAL') || die();
/**
* Groups with the most members section
*
- * @category Widget
- * @package StatusNet
- * @author Evan Prodromou
- * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link http://status.net/
+ * @copyright 2019 Free Software Foundation, Inc http://www.fsf.org
+ * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class GroupsByMembersSection extends GroupSection
{
- function getGroups()
+ public function getGroups()
{
- $qry = 'SELECT user_group.*, count(*) as value ' .
- 'FROM user_group JOIN group_member '.
- 'ON user_group.id = group_member.group_id ' .
- 'GROUP BY user_group.id,user_group.nickname,user_group.fullname,user_group.homepage,user_group.description,user_group.location,user_group.original_logo,user_group.homepage_logo,user_group.stream_logo,user_group.mini_logo,user_group.created,user_group.modified ' .
- 'ORDER BY value DESC ';
-
$limit = GROUPS_PER_SECTION;
- $offset = 0;
- if (common_config('db','type') == 'pgsql') {
- $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
- } else {
- $qry .= ' LIMIT ' . $offset . ', ' . $limit;
- }
+ $qry = 'SELECT user_group.*, COUNT(*) AS value ' .
+ 'FROM user_group INNER JOIN group_member '.
+ 'ON user_group.id = group_member.group_id ' .
+ 'GROUP BY user_group.id, user_group.nickname, user_group.fullname, user_group.homepage, user_group.description, user_group.location, user_group.original_logo, user_group.homepage_logo, user_group.stream_logo, user_group.mini_logo, user_group.created, user_group.modified ' .
+ 'ORDER BY value DESC LIMIT ' . $limit;
- $group = Memcached_DataObject::cachedQuery('User_group',
- $qry,
- 3600);
+ $group = Memcached_DataObject::cachedQuery('User_group', $qry, 3600);
return $group;
}
- function title()
+ public function title()
{
// TRANS: Title for groups with the most members section.
return _('Popular groups');
}
- function divId()
+ public function divId()
{
return 'top_groups_by_member';
}
diff --git a/lib/groups/groupsbypostssection.php b/lib/groups/groupsbypostssection.php
index d0fadcb450..e2a75eedec 100644
--- a/lib/groups/groupsbypostssection.php
+++ b/lib/groups/groupsbypostssection.php
@@ -44,20 +44,13 @@ class GroupsByPostsSection extends GroupSection
{
function getGroups()
{
+ $limit = GROUPS_PER_SECTION;
+
$qry = 'SELECT user_group.*, count(*) as value ' .
'FROM user_group JOIN group_inbox '.
'ON user_group.id = group_inbox.group_id ' .
'GROUP BY user_group.id,user_group.nickname,user_group.fullname,user_group.homepage,user_group.description,user_group.location,user_group.original_logo,user_group.homepage_logo,user_group.stream_logo,user_group.mini_logo,user_group.created,user_group.modified ' .
- 'ORDER BY value DESC ';
-
- $limit = GROUPS_PER_SECTION;
- $offset = 0;
-
- if (common_config('db','type') == 'pgsql') {
- $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
- } else {
- $qry .= ' LIMIT ' . $offset . ', ' . $limit;
- }
+ 'ORDER BY value DESC LIMIT ' . $limit;
$group = Memcached_DataObject::cachedQuery('User_group',
$qry,
diff --git a/lib/profile/peopletagsbysubssection.php b/lib/profile/peopletagsbysubssection.php
index 761f88851f..a1c737208a 100644
--- a/lib/profile/peopletagsbysubssection.php
+++ b/lib/profile/peopletagsbysubssection.php
@@ -1,65 +1,49 @@
.
+
/**
- * StatusNet, the distributed open-source microblogging tool
- *
* Peopletags with the most subscribers section
*
- * 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 .
- *
* @category Widget
- * @package StatusNet
+ * @package GNUsocial
* @author Evan Prodromou
* @copyright 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('STATUSNET') && !defined('LACONICA')) {
- exit(1);
-}
+defined('GNUSOCIAL') || die();
/**
* Peopletags with the most subscribers section
*
- * @category Widget
- * @package StatusNet
- * @author Evan Prodromou
- * @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 StatusNet, Inc.
+ * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class PeopletagsBySubsSection extends PeopletagSection
{
function getPeopletags()
{
- $qry = 'SELECT profile_list.*, subscriber_count as value ' .
- 'FROM profile_list WHERE profile_list.private = false ' .
- 'ORDER BY value DESC ';
-
$limit = PEOPLETAGS_PER_SECTION;
- $offset = 0;
- if (common_config('db','type') == 'pgsql') {
- $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
- } else {
- $qry .= ' LIMIT ' . $offset . ', ' . $limit;
- }
+ $qry = 'SELECT profile_list.*, subscriber_count AS value ' .
+ 'FROM profile_list WHERE profile_list.private = FALSE ' .
+ 'ORDER BY value DESC ' .
+ 'LIMIT ' . $limit;
- $peopletag = Memcached_DataObject::cachedQuery('Profile_list',
- $qry,
- 3600);
+ $peopletag = Memcached_DataObject::cachedQuery('Profile_list', $qry, 3600);
return $peopletag;
}
diff --git a/lib/ui/topposterssection.php b/lib/ui/topposterssection.php
index c621504215..65ce7a2223 100644
--- a/lib/ui/topposterssection.php
+++ b/lib/ui/topposterssection.php
@@ -1,35 +1,30 @@
.
+
/**
- * StatusNet, the distributed open-source microblogging tool
- *
* Base class for sections showing lists of people
*
- * 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 .
- *
* @category Widget
- * @package StatusNet
+ * @package GNUsocial
* @author Evan Prodromou
* @copyright 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('STATUSNET') && !defined('LACONICA')) {
- exit(1);
-}
+defined('GNUSOCIAL') || die();
/**
* Base class for sections
@@ -37,44 +32,32 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
* These are the widgets that show interesting data about a person
* group, or site.
*
- * @category Widget
- * @package StatusNet
- * @author Evan Prodromou
- * @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 StatusNet, Inc.
+ * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class TopPostersSection extends ProfileSection
{
- function getProfiles()
+ public function getProfiles()
{
- $qry = 'SELECT profile.*, count(*) as value ' .
- 'FROM profile JOIN notice ON profile.id = notice.profile_id ' .
- (common_config('public', 'localonly') ? 'WHERE is_local = 1 ' : '') .
- 'GROUP BY profile.id,nickname,fullname,profileurl,homepage,bio,location,profile.created,profile.modified,textsearch ' .
- 'ORDER BY value DESC ';
-
$limit = PROFILES_PER_SECTION;
- $offset = 0;
- if (common_config('db','type') == 'pgsql') {
- $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
- } else {
- $qry .= ' LIMIT ' . $offset . ', ' . $limit;
- }
+ $qry = 'SELECT profile.*, COUNT(*) AS value ' .
+ 'FROM profile JOIN notice ON profile.id = notice.profile_id ' .
+ (common_config('public', 'localonly') ? 'WHERE is_local = 1 ' : '') .
+ 'GROUP BY profile.id, nickname, fullname, profileurl, homepage, bio, location, profile.created, profile.modified ' .
+ 'ORDER BY value DESC LIMIT ' . $limit;
- $profile = Memcached_DataObject::cachedQuery('Profile',
- $qry,
- 6 * 3600);
+ $profile = Memcached_DataObject::cachedQuery('Profile', $qry, 6 * 3600);
return $profile;
}
- function title()
+ public function title()
{
// TRANS: Title for top posters section.
return _('Top posters');
}
- function divId()
+ public function divId()
{
return 'top_posters';
}
diff --git a/plugins/ExtendedProfile/actions/userautocomplete.php b/plugins/ExtendedProfile/actions/userautocomplete.php
index 46257fc595..a2109516cb 100644
--- a/plugins/ExtendedProfile/actions/userautocomplete.php
+++ b/plugins/ExtendedProfile/actions/userautocomplete.php
@@ -1,36 +1,30 @@
.
+
/**
- * StatusNet, the distributed open-source microblogging tool
- *
* Action for showing Twitter-like JSON search results
*
- * 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 .
- *
* @category Search
- * @package StatusNet
+ * @package GNUsocial
* @author Zach Copley
* @copyright 2011 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('STATUSNET')) {
- exit(1);
-}
-
+defined('GNUSOCIAL') || die();
class UserautocompleteAction extends Action
{
@@ -44,7 +38,7 @@ class UserautocompleteAction extends Action
* @return boolean true if nothing goes wrong
* @throws ClientException
*/
- public function prepare(array $args = array())
+ public function prepare(array $args = [])
{
parent::prepare($args);
$this->query = $this->trimmed('term');
@@ -87,7 +81,7 @@ class UserautocompleteAction extends Action
. ' AND LEFT(LOWER(profile.nickname), '
. strlen($this->query)
. ') = \'%s\' '
- . ' LIMIT 0, 10';
+ . ' LIMIT 10';
$profile->query(sprintf($sql, $this->query));
}
diff --git a/plugins/GroupFavorited/actions/groupfavorited.php b/plugins/GroupFavorited/actions/groupfavorited.php
index 3799f3a2f6..0141c6a79e 100644
--- a/plugins/GroupFavorited/actions/groupfavorited.php
+++ b/plugins/GroupFavorited/actions/groupfavorited.php
@@ -62,33 +62,22 @@ class GroupFavoritedAction extends ShowgroupAction
$groupId = (int)$this->group->id;
$weightexpr = common_sql_weight('fave.modified', common_config('popular', 'dropoff'));
$cutoff = sprintf(
- "fave.modified > '%s'",
+ "fave.modified > TIMESTAMP '%s'",
common_sql_date(time() - common_config('popular', 'cutoff'))
);
- $qry = 'SELECT notice.*, ' .
- $weightexpr . ' as weight ' .
- 'FROM notice ' .
- "JOIN group_inbox ON notice.id = group_inbox.notice_id " .
- 'JOIN fave ON notice.id = fave.notice_id ' .
- "WHERE $cutoff AND group_id = $groupId " .
- 'GROUP BY id,profile_id,uri,content,rendered,url,created,notice.modified,reply_to,is_local,source,notice.conversation ' .
- 'ORDER BY weight DESC';
-
$offset = ($this->page - 1) * NOTICES_PER_PAGE;
$limit = NOTICES_PER_PAGE + 1;
- if (common_config('db', 'type') == 'pgsql') {
- $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
- } else {
- $qry .= ' LIMIT ' . $offset . ', ' . $limit;
- }
+ $qry = 'SELECT notice.*, ' . $weightexpr . ' AS weight ' .
+ 'FROM notice ' .
+ 'INNER JOIN group_inbox ON notice.id = group_inbox.notice_id ' .
+ 'INNER JOIN fave ON notice.id = fave.notice_id ' .
+ 'WHERE ' . $cutoff . ' AND group_id = ' . $groupId . ' ' .
+ 'GROUP BY id, profile_id, uri, content, rendered, url, created, notice.modified, reply_to, is_local, source, notice.conversation ' .
+ 'ORDER BY weight DESC LIMIT ' . $limit . ' OFFSET ' . $offset;
- $notice = Memcached_DataObject::cachedQuery(
- 'Notice',
- $qry,
- 600
- );
+ $notice = Memcached_DataObject::cachedQuery('Notice', $qry, 600);
$nl = new NoticeList($notice, $this);
diff --git a/plugins/SlicedFavorites/actions/favoritedslice.php b/plugins/SlicedFavorites/actions/favoritedslice.php
index 31e93cd396..3e8339a313 100644
--- a/plugins/SlicedFavorites/actions/favoritedslice.php
+++ b/plugins/SlicedFavorites/actions/favoritedslice.php
@@ -1,40 +1,36 @@
.
+
/**
- * StatusNet, the distributed open-source microblogging tool
- *
* List of popular notices
*
- * 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 .
- *
* @category Public
- * @package StatusNet
+ * @package GNUsocial
* @author Zach Copley
* @author Evan Prodromou
* @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('STATUSNET') && !defined('LACONICA')) {
- exit(1);
-}
+defined('GNUSOCIAL') || die();
class FavoritedSliceAction extends FavoritedAction
{
- private $includeUsers = array(), $excludeUsers = array();
+ private $includeUsers = [];
+ private $excludeUsers = [];
/**
* Take arguments for running
@@ -45,7 +41,7 @@ class FavoritedSliceAction extends FavoritedAction
*
* @todo move queries from showContent() to here
*/
- function prepare(array $args = array())
+ public function prepare(array $args = [])
{
parent::prepare($args);
@@ -72,7 +68,7 @@ class FavoritedSliceAction extends FavoritedAction
*
* @return void
*/
- function showContent()
+ public function showContent()
{
$slice = $this->sliceWhereClause();
if (!$slice) {
@@ -80,28 +76,21 @@ class FavoritedSliceAction extends FavoritedAction
}
$weightexpr = common_sql_weight('fave.modified', common_config('popular', 'dropoff'));
- $cutoff = sprintf("fave.modified > '%s'",
- common_sql_date(time() - common_config('popular', 'cutoff')));
-
- $qry = 'SELECT notice.*, '.
- $weightexpr . ' as weight ' .
- 'FROM notice JOIN fave ON notice.id = fave.notice_id ' .
- "WHERE $cutoff AND $slice " .
- 'GROUP BY id,profile_id,uri,content,rendered,url,created,notice.modified,reply_to,is_local,source,notice.conversation ' .
- 'ORDER BY weight DESC';
+ $cutoff = sprintf(
+ "fave.modified > TIMESTAMP '%s'",
+ common_sql_date(time() - common_config('popular', 'cutoff'))
+ );
$offset = ($this->page - 1) * NOTICES_PER_PAGE;
$limit = NOTICES_PER_PAGE + 1;
- if (common_config('db', 'type') == 'pgsql') {
- $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
- } else {
- $qry .= ' LIMIT ' . $offset . ', ' . $limit;
- }
+ $qry = 'SELECT notice.*, ' . $weightexpr . ' AS weight ' .
+ 'FROM notice INNER JOIN fave ON notice.id = fave.notice_id ' .
+ 'WHERE ' . $cutoff . ' AND ' . $slice . ' ' .
+ 'GROUP BY id, profile_id, uri, content, rendered, url, created, notice.modified, reply_to, is_local, source, notice.conversation ' .
+ 'ORDER BY weight DESC LIMIT ' . $limit . ' OFFSET ' . $offset;
- $notice = Memcached_DataObject::cachedQuery('Notice',
- $qry,
- 600);
+ $notice = Memcached_DataObject::cachedQuery('Notice', $qry, 600);
$nl = new NoticeList($notice, $this);
@@ -111,8 +100,12 @@ class FavoritedSliceAction extends FavoritedAction
$this->showEmptyList();
}
- $this->pagination($this->page > 1, $cnt > NOTICES_PER_PAGE,
- $this->page, 'favorited');
+ $this->pagination(
+ $this->page > 1,
+ $cnt > NOTICES_PER_PAGE,
+ $this->page,
+ 'favorited'
+ );
}
private function sliceWhereClause()
@@ -122,11 +115,11 @@ class FavoritedSliceAction extends FavoritedAction
if (count($include) == 1) {
return "profile_id = " . intval($include[0]);
- } else if (count($include) > 1) {
+ } elseif (count($include) > 1) {
return "profile_id IN (" . implode(',', $include) . ")";
- } else if (count($exclude) == 1) {
+ } elseif (count($exclude) === 1) {
return "profile_id != " . intval($exclude[0]);
- } else if (count($exclude) > 1) {
+ } elseif (count($exclude) > 1) {
return "profile_id NOT IN (" . implode(',', $exclude) . ")";
} else {
return false;
diff --git a/plugins/TagCloud/lib/grouptagcloudsection.php b/plugins/TagCloud/lib/grouptagcloudsection.php
index 5ed14560ce..d83ded10b5 100644
--- a/plugins/TagCloud/lib/grouptagcloudsection.php
+++ b/plugins/TagCloud/lib/grouptagcloudsection.php
@@ -1,35 +1,30 @@
.
+
/**
- * StatusNet, the distributed open-source microblogging tool
- *
* Personal tag cloud section
*
- * 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 .
- *
* @category Widget
- * @package StatusNet
+ * @package GNUsocial
* @author Evan Prodromou
* @copyright 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('STATUSNET') && !defined('LACONICA')) {
- exit(1);
-}
+defined('GNUSOCIAL') || die();
/**
* Group tag cloud section
@@ -42,22 +37,22 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
*/
class GroupTagCloudSection extends TagCloudSection
{
- var $group = null;
+ public $group = null;
- function __construct($out=null, $group=null)
+ public function __construct($out = null, $group = null)
{
parent::__construct($out);
$this->group = $group;
}
- function title()
+ public function title()
{
// TRANS: Title for group tag cloud section.
// TRANS: %s is a group name.
return _('Tags');
}
- function getTags()
+ public function getTags()
{
$weightexpr = common_sql_weight('notice_tag.created', common_config('tag', 'dropoff'));
// @fixme should we use the cutoff too? Doesn't help with indexing per-group.
@@ -75,31 +70,22 @@ class GroupTagCloudSection extends TagCloudSection
}
$namestring = implode(',', $quoted);
-
- $qry = 'SELECT notice_tag.tag, '.
- $weightexpr . ' as weight ' .
- 'FROM notice_tag JOIN notice ' .
- 'ON notice_tag.notice_id = notice.id ' .
- 'JOIN group_inbox on group_inbox.notice_id = notice.id ' .
- 'WHERE group_inbox.group_id = %d ' .
- 'AND notice_tag.tag not in (%s) '.
- 'GROUP BY notice_tag.tag ' .
- 'ORDER BY weight DESC ';
-
$limit = TAGS_PER_SECTION;
- $offset = 0;
- if (common_config('db','type') == 'pgsql') {
- $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
- } else {
- $qry .= ' LIMIT ' . $offset . ', ' . $limit;
- }
+ $qry = 'SELECT notice_tag.tag, ' . $weightexpr . ' AS weight ' .
+ 'FROM notice_tag INNER JOIN notice ' .
+ 'ON notice_tag.notice_id = notice.id ' .
+ 'INNER JOIN group_inbox ON group_inbox.notice_id = notice.id ' .
+ 'WHERE group_inbox.group_id = %d ' .
+ 'AND notice_tag.tag NOT IN (%s) '.
+ 'GROUP BY notice_tag.tag ' .
+ 'ORDER BY weight DESC LIMIT ' . $limit;
- $tag = Memcached_DataObject::cachedQuery('Notice_tag',
- sprintf($qry,
- $this->group->id,
- $namestring),
- 3600);
+ $tag = Memcached_DataObject::cachedQuery(
+ 'Notice_tag',
+ sprintf($qry, $this->group->id, $namestring),
+ 3600
+ );
return $tag;
}
}
diff --git a/plugins/TagCloud/lib/inboxtagcloudsection.php b/plugins/TagCloud/lib/inboxtagcloudsection.php
index 4268ee4854..ba89bd5b7f 100644
--- a/plugins/TagCloud/lib/inboxtagcloudsection.php
+++ b/plugins/TagCloud/lib/inboxtagcloudsection.php
@@ -1,42 +1,36 @@
.
+
/**
- * StatusNet, the distributed open-source microblogging tool
- *
* Personal tag cloud section
*
- * 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 .
- *
* @category Widget
- * @package StatusNet
+ * @package GNUsocial
* @author Evan Prodromou
* @copyright 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();
/**
* Personal tag cloud section
*
- * @category Widget
- * @package StatusNet
- * @author Evan Prodromou
- * @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 StatusNet, Inc.
+ * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class InboxTagCloudSection extends TagCloudSection
{
@@ -44,19 +38,19 @@ class InboxTagCloudSection extends TagCloudSection
protected $target = null;
- function __construct($out=null, Profile $target)
+ public function __construct($out = null, Profile $target)
{
parent::__construct($out);
$this->target = $target;
}
- function title()
+ public function title()
{
// TRANS: Title for inbox tag cloud section.
return _m('TITLE', 'Trends');
}
- function getTags()
+ public function getTags()
{
// FIXME: Get the Profile::current() value some other way
// to avoid confusion between background stuff and session.
@@ -70,22 +64,15 @@ class InboxTagCloudSection extends TagCloudSection
$weightexpr = common_sql_weight('notice_tag.created', common_config('tag', 'dropoff'));
// @fixme should we use the cutoff too? Doesn't help with indexing per-user.
+ $limit = TAGS_PER_SECTION;
+
$qry = 'SELECT notice_tag.tag, '.
$weightexpr . ' as weight ' .
'FROM notice_tag JOIN notice ' .
'ON notice_tag.notice_id = notice.id ' .
'WHERE notice.id in (' . implode(',', $ids) . ')'.
'GROUP BY notice_tag.tag ' .
- 'ORDER BY weight DESC ';
-
- $limit = TAGS_PER_SECTION;
- $offset = 0;
-
- if (common_config('db','type') == 'pgsql') {
- $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
- } else {
- $qry .= ' LIMIT ' . $offset . ', ' . $limit;
- }
+ 'ORDER BY weight DESC LIMIT ' . $limit;
$t = new Notice_tag();
@@ -101,7 +88,7 @@ class InboxTagCloudSection extends TagCloudSection
return new ArrayWrapper($tag);
}
- function showMore()
+ public function showMore()
{
}
}
diff --git a/plugins/TagCloud/lib/personaltagcloudsection.php b/plugins/TagCloud/lib/personaltagcloudsection.php
index e46aa2d662..f99a7d3825 100644
--- a/plugins/TagCloud/lib/personaltagcloudsection.php
+++ b/plugins/TagCloud/lib/personaltagcloudsection.php
@@ -1,85 +1,72 @@
.
+
/**
- * StatusNet, the distributed open-source microblogging tool
- *
* Personal tag cloud section
*
- * 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 .
- *
* @category Widget
- * @package StatusNet
+ * @package GNUsocial
* @author Evan Prodromou
* @copyright 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();
/**
* Personal tag cloud section
*
- * @category Widget
- * @package StatusNet
- * @author Evan Prodromou
- * @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 StatusNet, Inc.
+ * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class PersonalTagCloudSection extends TagCloudSection
{
protected $profile = null;
- function __construct(HTMLOutputter $out, Profile $profile)
+ public function __construct(HTMLOutputter $out, Profile $profile)
{
parent::__construct($out);
$this->profile = $profile;
}
- function title()
+ public function title()
{
// TRANS: Title for personal tag cloud section.
- return _m('TITLE','Tags');
+ return _m('TITLE', 'Tags');
}
- function getTags()
+ public function getTags()
{
$weightexpr = common_sql_weight('notice_tag.created', common_config('tag', 'dropoff'));
// @fixme should we use the cutoff too? Doesn't help with indexing per-user.
- $qry = 'SELECT notice_tag.tag, '.
- $weightexpr . ' as weight ' .
- 'FROM notice_tag JOIN notice ' .
- 'ON notice_tag.notice_id = notice.id ' .
- 'WHERE notice.profile_id = %d ' .
- 'GROUP BY notice_tag.tag ' .
- 'ORDER BY weight DESC ';
-
$limit = TAGS_PER_SECTION;
- $offset = 0;
- if (common_config('db','type') == 'pgsql') {
- $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
- } else {
- $qry .= ' LIMIT ' . $offset . ', ' . $limit;
- }
+ $qry = 'SELECT notice_tag.tag, ' . $weightexpr . ' AS weight ' .
+ 'FROM notice_tag INNER JOIN notice ' .
+ 'ON notice_tag.notice_id = notice.id ' .
+ 'WHERE notice.profile_id = %d ' .
+ 'GROUP BY notice_tag.tag ' .
+ 'ORDER BY weight DESC LIMIT ' . $limit;
- $tag = Memcached_DataObject::cachedQuery('Notice_tag',
- sprintf($qry,
- $this->profile->getID()),
- 3600);
+ $tag = Memcached_DataObject::cachedQuery(
+ 'Notice_tag',
+ sprintf($qry, $this->profile->getID()),
+ 3600
+ );
return $tag;
}
}
diff --git a/plugins/TagCloud/lib/publictagcloudsection.php b/plugins/TagCloud/lib/publictagcloudsection.php
index bf88091a90..d7fd597baa 100644
--- a/plugins/TagCloud/lib/publictagcloudsection.php
+++ b/plugins/TagCloud/lib/publictagcloudsection.php
@@ -1,59 +1,51 @@
.
+
/**
- * StatusNet, the distributed open-source microblogging tool
- *
* Public tag cloud section
*
- * 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 .
- *
* @category Widget
- * @package StatusNet
+ * @package GNUsocial
* @author Evan Prodromou
* @copyright 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('STATUSNET') && !defined('LACONICA')) {
- exit(1);
-}
+defined('GNUSOCIAL') || die();
/**
* Public tag cloud section
*
- * @category Widget
- * @package StatusNet
- * @author Evan Prodromou
- * @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 StatusNet, Inc.
+ * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class PublicTagCloudSection extends TagCloudSection
{
- function __construct($out=null)
+ public function __construct($out = null)
{
parent::__construct($out);
}
- function title()
+ public function title()
{
// TRANS: Title for inbox tag cloud section.
return _m('TITLE', 'Trends');
}
- function getTags()
+ public function getTags()
{
$profile = Profile::current();
@@ -66,7 +58,6 @@ class PublicTagCloudSection extends TagCloudSection
$tag = Memcached_DataObject::cacheGet($keypart);
if ($tag === false) {
-
$stream = new PublicNoticeStream($profile);
$ids = $stream->getNoticeIds(0, 500, null, null);
@@ -77,22 +68,14 @@ class PublicTagCloudSection extends TagCloudSection
$weightexpr = common_sql_weight('notice_tag.created', common_config('tag', 'dropoff'));
// @fixme should we use the cutoff too? Doesn't help with indexing per-user.
- $qry = 'SELECT notice_tag.tag, '.
- $weightexpr . ' as weight ' .
+ $limit = TAGS_PER_SECTION;
+
+ $qry = 'SELECT notice_tag.tag, ' . $weightexpr . ' AS weight ' .
'FROM notice_tag JOIN notice ' .
'ON notice_tag.notice_id = notice.id ' .
'WHERE notice.id in (' . implode(',', $ids) . ') '.
'GROUP BY notice_tag.tag ' .
- 'ORDER BY weight DESC ';
-
- $limit = TAGS_PER_SECTION;
- $offset = 0;
-
- if (common_config('db','type') == 'pgsql') {
- $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
- } else {
- $qry .= ' LIMIT ' . $offset . ', ' . $limit;
- }
+ 'ORDER BY weight DESC LIMIT ' . $limit;
$t = new Notice_tag();
@@ -111,7 +94,7 @@ class PublicTagCloudSection extends TagCloudSection
return new ArrayWrapper($tag);
}
- function showMore()
+ public function showMore()
{
}
}
diff --git a/plugins/TagCloud/lib/subpeopletagcloudsection.php b/plugins/TagCloud/lib/subpeopletagcloudsection.php
index b23a82240d..59ad1949b1 100644
--- a/plugins/TagCloud/lib/subpeopletagcloudsection.php
+++ b/plugins/TagCloud/lib/subpeopletagcloudsection.php
@@ -1,77 +1,64 @@
.
+
/**
- * StatusNet, the distributed open-source microblogging tool
- *
* Personal tag cloud section
*
- * 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 .
- *
* @category Widget
- * @package StatusNet
+ * @package GNUsocial
* @author Evan Prodromou
* @copyright 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('STATUSNET') && !defined('LACONICA')) {
- exit(1);
-}
+defined('GNUSOCIAL') || die();
/**
* Personal tag cloud section
*
- * @category Widget
- * @package StatusNet
- * @author Evan Prodromou
- * @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 StatusNet, Inc.
+ * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class SubPeopleTagCloudSection extends TagCloudSection
{
- function getTags()
+ public function getTags()
{
$qry = $this->query();
- $limit = TAGS_PER_SECTION;
- $offset = 0;
+ $qry .= ' LIMIT ' . TAGS_PER_SECTION;
- if (common_config('db','type') == 'pgsql') {
- $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
- } else {
- $qry .= ' LIMIT ' . $offset . ', ' . $limit;
- }
-
- $profile_tag = Memcached_DataObject::cachedQuery('Profile_tag',
- sprintf($qry,
- $this->out->user->id));
+ $profile_tag = Memcached_DataObject::cachedQuery(
+ 'Profile_tag',
+ sprintf($qry, $this->out->user->id)
+ );
return $profile_tag;
}
- function tagUrl($tag) {
+ public function tagUrl($tag)
+ {
return common_local_url('peopletag', array('tag' => $tag));
}
- function showTag($tag, $weight, $relative) {
+ public function showTag($tag, $weight, $relative)
+ {
$rel = 'tag-cloud-';
- $rel .= 1+intval(7 * $relative * $weight - 0.01);
+ $rel .= 1 + (int) (7 * $relative * $weight - 0.01);
$this->out->elementStart('li', $rel);
$this->out->element('a', array('href' => $this->tagUrl($tag)), $tag);
$this->out->elementEnd('li');
}
}
-