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