]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - actions/version.php
Merge remote-tracking branch 'upstream/master' into social-master
[quix0rs-gnu-social.git] / actions / version.php
1 <?php
2 /**
3  * StatusNet - the distributed open-source microblogging tool
4  * Copyright (C) 2008-2011, StatusNet, Inc.
5  *
6  * Show version information for this software and plugins
7  *
8  * PHP version 5
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU Affero General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Affero General Public License for more details.
19  *
20  * You should have received a copy of the GNU Affero General Public License
21  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
22  *
23  * @category Info
24  * @package  GNUsocial
25  * @author   Evan Prodromou <evan@status.net>
26  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPLv3
27  * @link     http://status.net/
28  */
29
30 if (!defined('GNUSOCIAL')) { exit(1); }
31
32 /**
33  * Version info page
34  *
35  * A page that shows version information for this site. Helpful for
36  * debugging, for giving credit to authors, and for linking to more
37  * complete documentation for admins.
38  *
39  * @category Info
40  * @package  GNUsocial
41  * @author   Evan Prodromou <evan@status.net>
42  * @author   Craig Andrews <candrews@integralblue.com>
43  * @copyright 2009-2011 Free Software Foundation, Inc http://www.fsf.org
44  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPLv3
45  * @link     http://status.net/
46  */
47 class VersionAction extends Action
48 {
49     var $pluginVersions = array();
50
51     /**
52      * Return true since we're read-only.
53      *
54      * @param array $args other arguments
55      *
56      * @return boolean is read only action?
57      */
58     function isReadOnly(array $args=array())
59     {
60         return true;
61     }
62
63     /**
64      * Returns the page title
65      *
66      * @return string page title
67      */
68     function title()
69     {
70         // TRANS: Title for version page. %1$s is the engine name, %2$s is the engine version.
71         return sprintf(_('%1$s %2$s'), GNUSOCIAL_ENGINE, GNUSOCIAL_VERSION);
72     }
73
74     /**
75      * Prepare to run
76      *
77      * Fire off an event to let plugins report their
78      * versions.
79      *
80      * @param array $args array misc. arguments
81      *
82      * @return boolean true
83      */
84     protected function prepare(array $args=array())
85     {
86         parent::prepare($args);
87
88         Event::handle('PluginVersion', array(&$this->pluginVersions));
89
90         return true;
91     }
92
93     /**
94      * Execute the action
95      *
96      * Shows a page with the version information in the
97      * content area.
98      *
99      * @param array $args ignored.
100      *
101      * @return void
102      */
103     protected function handle()
104     {
105         parent::handle();
106         $this->showPage();
107     }
108
109
110     /*
111     * Override to add h-entry, and content-inner classes
112     *
113     * @return void
114     */
115     function showContentBlock()
116      {
117          $this->elementStart('div', array('id' => 'content', 'class' => 'h-entry'));
118          $this->showPageTitle();
119          $this->showPageNoticeBlock();
120          $this->elementStart('div', array('id' => 'content_inner',
121                                           'class' => 'e-content'));
122          // show the actual content (forms, lists, whatever)
123          $this->showContent();
124          $this->elementEnd('div');
125          $this->elementEnd('div');
126      }
127
128     /*
129     * Overrride to add entry-title class
130     *
131     * @return void
132     */
133     function showPageTitle() {
134         $this->element('h1', array('class' => 'entry-title'), $this->title());
135     }
136
137
138     /**
139      * Show version information
140      *
141      * @return void
142      */
143     function showContent()
144     {
145         $this->elementStart('p');
146
147         // TRANS: Content part of engine version page.
148         // TRANS: %1$s is the engine name (GNU social) and %2$s is the GNU social version.
149         $this->raw(sprintf(_('This site is powered by %1$s version %2$s, '.
150                              'Copyright 2008-2013 StatusNet, Inc. '.
151                              'and contributors.'),
152                            XMLStringer::estring('a', array('href' => GNUSOCIAL_ENGINE_URL),
153                                                 // TRANS: Engine name.
154                                                 GNUSOCIAL_ENGINE),
155                            GNUSOCIAL_VERSION));
156         $this->elementEnd('p');
157
158         // TRANS: Header for engine software contributors section on the version page.
159         $this->element('h2', null, _('Contributors'));
160
161         sort($this->contributors);
162         $this->element('p', null, implode(', ', $this->contributors));
163
164         // TRANS: Header for engine software license section on the version page.
165         $this->element('h2', null, _('License'));
166
167         $this->element('p', null,
168                        // TRANS: Content part of engine software version page. %1s is engine name
169                        sprintf(_('%1$s is free software: you can redistribute it and/or modify '.
170                          'it under the terms of the GNU Affero General Public License as published by '.
171                          'the Free Software Foundation, either version 3 of the License, or '.
172                          '(at your option) any later version.'), GNUSOCIAL_ENGINE));
173
174         $this->element('p', null,
175                        // TRANS: Content part of engine software version page.
176                        _('This program is distributed in the hope that it will be useful, '.
177                          'but WITHOUT ANY WARRANTY; without even the implied warranty of '.
178                          'MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the '.
179                          'GNU Affero General Public License for more details.'));
180
181         $this->elementStart('p');
182         // TRANS: Content part of engine version page.
183         // TRANS: %s is a link to the AGPL license with link description "http://www.gnu.org/licenses/agpl.html".
184         $this->raw(sprintf(_('You should have received a copy of the GNU Affero General Public License '.
185                              'along with this program.  If not, see %s.'),
186                            XMLStringer::estring('a', array('href' => 'http://www.gnu.org/licenses/agpl.html'),
187                                                 'http://www.gnu.org/licenses/agpl.html')));
188         $this->elementEnd('p');
189
190         // XXX: Theme information?
191
192         if (count($this->pluginVersions)) {
193             // TRANS: Header for engine plugins section on the version page.
194             $this->element('h2', null, _('Plugins'));
195
196             $this->elementStart('table', array('id' => 'plugins_enabled'));
197
198             $this->elementStart('thead');
199             $this->elementStart('tr');
200             // TRANS: Column header for plugins table on version page.
201             $this->element('th', array('id' => 'plugin_name'), _m('HEADER','Name'));
202             // TRANS: Column header for plugins table on version page.
203             $this->element('th', array('id' => 'plugin_version'), _m('HEADER','Version'));
204             // TRANS: Column header for plugins table on version page.
205             $this->element('th', array('id' => 'plugin_authors'), _m('HEADER','Author(s)'));
206             // TRANS: Column header for plugins table on version page.
207             $this->element('th', array('id' => 'plugin_description'), _m('HEADER','Description'));
208             $this->elementEnd('tr');
209             $this->elementEnd('thead');
210
211             $this->elementStart('tbody');
212             foreach ($this->pluginVersions as $plugin) {
213                 $this->elementStart('tr');
214                 if (array_key_exists('homepage', $plugin)) {
215                     $this->elementStart('th');
216                     $this->element('a', array('href' => $plugin['homepage']),
217                                    $plugin['name']);
218                     $this->elementEnd('th');
219                 } else {
220                     $this->element('th', null, $plugin['name']);
221                 }
222
223                 $this->element('td', null, $plugin['version']);
224
225                 if (array_key_exists('author', $plugin)) {
226                     $this->element('td', null, $plugin['author']);
227                 }
228
229                 if (array_key_exists('rawdescription', $plugin)) {
230                     $this->elementStart('td');
231                     $this->raw($plugin['rawdescription']);
232                     $this->elementEnd('td');
233                 } else if (array_key_exists('description', $plugin)) {
234                     $this->element('td', null, $plugin['description']);
235                 }
236                 $this->elementEnd('tr');
237             }
238             $this->elementEnd('tbody');
239             $this->elementEnd('table');
240         }
241
242     }
243
244     var $contributors = array('Evan Prodromou (StatusNet)',
245                               'Zach Copley (StatusNet)',
246                               'Earle Martin (StatusNet)',
247                               'Marie-Claude Doyon (StatusNet)',
248                               'Sarven Capadisli (StatusNet)',
249                               'Robin Millette (StatusNet)',
250                               'Ciaran Gultnieks',
251                               'Michael Landers',
252                               'Ori Avtalion',
253                               'Garret Buell',
254                               'Mike Cochrane',
255                               'Matthew Gregg',
256                               'Florian Biree',
257                               'Erik Stambaugh',
258                               'drry',
259                               'Gina Haeussge',
260                               'Tryggvi Björgvinsson',
261                               'Adrian Lang',
262                               'Meitar Moscovitz',
263                               'Sean Murphy',
264                               'Leslie Michael Orchard',
265                               'Eric Helgeson',
266                               'Ken Sedgwick',
267                               'Brian Hendrickson',
268                               'Tobias Diekershoff',
269                               'Dan Moore',
270                               'Fil',
271                               'Jeff Mitchell',
272                               'Brenda Wallace',
273                               'Jeffery To',
274                               'Federico Marani',
275                               'Craig Andrews',
276                               'mEDI',
277                               'Brett Taylor',
278                               'Brigitte Schuster',
279                               'Brion Vibber (StatusNet)',
280                               'Siebrand Mazeland',
281                               'Samantha Doherty (StatusNet)',
282                               'Mikael Nordfeldth (FSF)');
283 }