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