]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - actions/version.php
Merge branch 'testing' of gitorious.org:statusnet/mainline into 0.9.x
[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
50 class VersionAction extends Action
51 {
52     var $pluginVersions = array();
53
54     /**
55      * Return true since we're read-only.
56      *
57      * @param array $args other arguments
58      *
59      * @return boolean is read only action?
60      */
61
62     function isReadOnly($args)
63     {
64         return true;
65     }
66
67     /**
68      * Returns the page title
69      *
70      * @return string page title
71      */
72
73     function title()
74     {
75         return sprintf(_("StatusNet %s"), STATUSNET_VERSION);
76     }
77
78     /**
79      * Prepare to run
80      *
81      * Fire off an event to let plugins report their
82      * versions.
83      *
84      * @param array $args array misc. arguments
85      *
86      * @return boolean true
87      */
88
89     function prepare($args)
90     {
91         parent::prepare($args);
92
93         Event::handle('PluginVersion', array(&$this->pluginVersions));
94
95         return true;
96     }
97
98     /**
99      * Execute the action
100      *
101      * Shows a page with the version information in the
102      * content area.
103      *
104      * @param array $args ignored.
105      *
106      * @return void
107      */
108
109     function handle($args)
110     {
111         parent::handle($args);
112         $this->showPage();
113     }
114
115
116     /*
117     * Override to add hentry, and content-inner classes
118     *
119     * @return void
120     */
121     function showContentBlock()
122      {
123          $this->elementStart('div', array('id' => 'content', 'class' => 'hentry'));
124          $this->showPageTitle();
125          $this->showPageNoticeBlock();
126          $this->elementStart('div', array('id' => 'content_inner',
127                                           'class' => 'entry-content'));
128          // show the actual content (forms, lists, whatever)
129          $this->showContent();
130          $this->elementEnd('div');
131          $this->elementEnd('div');
132      }
133
134
135     /*
136     * Overrride to add entry-title class
137     *
138     * @return void
139     */
140     function showPageTitle() {
141         $this->element('h1', array('class' => 'entry-title'), $this->title());
142     }
143
144
145     /**
146      * Show version information
147      *
148      * @return void
149      */
150
151     function showContent()
152     {
153         $this->elementStart('p');
154
155         $this->raw(sprintf(_('This site is powered by %1$s version %2$s, '.
156                              'Copyright 2008-2010 StatusNet, Inc. '.
157                              'and contributors.'),
158                            XMLStringer::estring('a', array('href' => 'http://status.net/'),
159                                                 _('StatusNet')),
160                            STATUSNET_VERSION));
161         $this->elementEnd('p');
162
163         $this->element('h2', null, _('Contributors'));
164
165         $this->element('p', null, implode(', ', $this->contributors));
166
167         $this->element('h2', null, _('License'));
168
169         $this->element('p', null,
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                        _('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         $this->raw(sprintf(_('You should have received a copy of the GNU Affero General Public License '.
183                              'along with this program.  If not, see %s.'),
184                            XMLStringer::estring('a', array('href' => 'http://www.gnu.org/licenses/agpl.html'),
185                                                 'http://www.gnu.org/licenses/agpl.html')));
186         $this->elementEnd('p');
187
188         // XXX: Theme information?
189
190         if (count($this->pluginVersions)) {
191             $this->element('h2', null, _('Plugins'));
192
193             $this->elementStart('table', array('id' => 'plugins_enabled'));
194
195             $this->elementStart('thead');
196             $this->elementStart('tr');
197             $this->element('th', array('id' => 'plugin_name'), _('Name'));
198             $this->element('th', array('id' => 'plugin_version'), _('Version'));
199             $this->element('th', array('id' => 'plugin_authors'), _('Author(s)'));
200             $this->element('th', array('id' => 'plugin_description'), _('Description'));
201             $this->elementEnd('tr');
202             $this->elementEnd('thead');
203
204             $this->elementStart('tbody');
205             foreach ($this->pluginVersions as $plugin) {
206                 $this->elementStart('tr');
207                 if (array_key_exists('homepage', $plugin)) {
208                     $this->elementStart('th');
209                     $this->element('a', array('href' => $plugin['homepage']),
210                                    $plugin['name']);
211                     $this->elementEnd('th');
212                 } else {
213                     $this->element('th', null, $plugin['name']);
214                 }
215
216                 $this->element('td', null, $plugin['version']);
217
218                 if (array_key_exists('author', $plugin)) {
219                     $this->element('td', null, $plugin['author']);
220                 }
221
222                 if (array_key_exists('rawdescription', $plugin)) {
223                     $this->elementStart('td');
224                     $this->raw($plugin['rawdescription']);
225                     $this->elementEnd('td');
226                 } else if (array_key_exists('description', $plugin)) {
227                     $this->element('td', null, $plugin['description']);
228                 }
229                 $this->elementEnd('tr');
230             }
231             $this->elementEnd('tbody');
232             $this->elementEnd('table');
233         }
234
235     }
236
237     var $contributors = array('Evan Prodromou (StatusNet)',
238                               'Zach Copley (StatusNet)',
239                               'Earle Martin (StatusNet)',
240                               'Marie-Claude Doyon (StatusNet)',
241                               'Sarven Capadisli (StatusNet)',
242                               'Robin Millette (StatusNet)',
243                               'Ciaran Gultnieks',
244                               'Michael Landers',
245                               'Ori Avtalion',
246                               'Garret Buell',
247                               'Mike Cochrane',
248                               'Matthew Gregg',
249                               'Florian Biree',
250                               'Erik Stambaugh',
251                               'drry',
252                               'Gina Haeussge',
253                               'Tryggvi Björgvinsson',
254                               'Adrian Lang',
255                               'Meitar Moscovitz',
256                               'Sean Murphy',
257                               'Leslie Michael Orchard',
258                               'Eric Helgeson',
259                               'Ken Sedgwick',
260                               'Brian Hendrickson',
261                               'Tobias Diekershoff',
262                               'Dan Moore',
263                               'Fil',
264                               'Jeff Mitchell',
265                               'Brenda Wallace',
266                               'Jeffery To',
267                               'Federico Marani',
268                               'Craig Andrews',
269                               'mEDI',
270                               'Brett Taylor',
271                               'Brigitte Schuster',
272                               'Brion Vibber');
273 }