version.php 11 KB

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