| 
									
										
										
										
											2009-01-22 20:07:55 +01:00
										 |  |  | <?php | 
					
						
							| 
									
										
										
										
											2019-09-11 10:12:49 +03:00
										 |  |  | // 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/>.
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-22 20:07:55 +01:00
										 |  |  | /** | 
					
						
							|  |  |  |  * Base class for sections showing lists of people | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @category  Widget | 
					
						
							| 
									
										
										
										
											2019-09-11 10:12:49 +03:00
										 |  |  |  * @package   GNUsocial | 
					
						
							| 
									
										
										
										
											2009-08-25 18:19:04 -04:00
										 |  |  |  * @author    Evan Prodromou <evan@status.net> | 
					
						
							| 
									
										
										
										
											2009-08-25 18:12:20 -04:00
										 |  |  |  * @copyright 2009 StatusNet, Inc. | 
					
						
							| 
									
										
										
										
											2019-09-11 10:12:49 +03:00
										 |  |  |  * @license   https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later | 
					
						
							| 
									
										
										
										
											2009-01-22 20:07:55 +01:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-11 10:12:49 +03:00
										 |  |  | defined('GNUSOCIAL') || die(); | 
					
						
							| 
									
										
										
										
											2009-01-22 20:07:55 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * Base class for sections | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * These are the widgets that show interesting data about a person | 
					
						
							|  |  |  |  * group, or site. | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2019-09-11 10:12:49 +03:00
										 |  |  |  * @copyright 2009 StatusNet, Inc. | 
					
						
							|  |  |  |  * @license   https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later | 
					
						
							| 
									
										
										
										
											2009-01-22 20:07:55 +01:00
										 |  |  |  */ | 
					
						
							|  |  |  | class TopPostersSection extends ProfileSection | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-09-11 10:12:49 +03:00
										 |  |  |     public function getProfiles() | 
					
						
							| 
									
										
										
										
											2009-01-22 20:07:55 +01:00
										 |  |  |     { | 
					
						
							|  |  |  |         $limit = PROFILES_PER_SECTION; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-10 19:29:04 +03:00
										 |  |  |         $qry = sprintf( | 
					
						
							|  |  |  |             <<<'END' | 
					
						
							|  |  |  |             SELECT * | 
					
						
							|  |  |  |               FROM profile INNER JOIN ( | 
					
						
							|  |  |  |                 SELECT profile_id AS id, COUNT(profile_id) AS value | 
					
						
							|  |  |  |                   FROM notice | 
					
						
							|  |  |  |                   %1$sGROUP BY profile_id | 
					
						
							|  |  |  |               ) AS t1 USING (id) | 
					
						
							|  |  |  |               ORDER BY value DESC LIMIT %2$d; | 
					
						
							|  |  |  |             END, | 
					
						
							|  |  |  |             (common_config('public', 'localonly') ? 'WHERE notice.is_local = 1 ' : ''), | 
					
						
							|  |  |  |             $limit | 
					
						
							|  |  |  |         ); | 
					
						
							| 
									
										
										
										
											2009-01-22 20:07:55 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-11 10:12:49 +03:00
										 |  |  |         $profile = Memcached_DataObject::cachedQuery('Profile', $qry, 6 * 3600); | 
					
						
							| 
									
										
										
										
											2009-01-22 20:07:55 +01:00
										 |  |  |         return $profile; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-11 10:12:49 +03:00
										 |  |  |     public function title() | 
					
						
							| 
									
										
										
										
											2009-01-22 20:07:55 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2011-03-18 18:03:41 +01:00
										 |  |  |         // TRANS: Title for top posters section.
 | 
					
						
							| 
									
										
										
										
											2009-01-22 20:07:55 +01:00
										 |  |  |         return _('Top posters'); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-11 10:12:49 +03:00
										 |  |  |     public function divId() | 
					
						
							| 
									
										
										
										
											2009-01-22 20:07:55 +01:00
										 |  |  |     { | 
					
						
							|  |  |  |         return 'top_posters'; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } |