* Using $wgContLang->ucfirst() instead of $wgLang->ucfirst() in loadFromFile() and...
[lhc/web/wiklou.git] / includes / SpecialVersion.php
1 <?php
2 /**
3 * Give information about the version of MediaWiki, PHP, the DB and extensions
4 *
5 * @package MediaWiki
6 * @subpackage SpecialPage
7 *
8 * @author Ævar Arnfjörð Bjarmason <avarab@gmail.com>
9 * @copyright Copyright © 2005, Ævar Arnfjörð Bjarmason
10 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
11 */
12
13 /**
14 * constructor
15 */
16 function wfSpecialVersion() {
17 $version = new SpecialVersion;
18 $version->execute();
19 }
20
21 class SpecialVersion {
22 /**
23 * @var object
24 */
25 var $langObj;
26
27 /**
28 * Constructor
29 */
30 function SpecialVersion() {
31 // English motherfucker, do you speak it?
32 $this->langObj = setupLangObj( 'LanguageEn' );
33 $this->langObj->initEncoding();
34 }
35
36 function execute() {
37 global $wgOut;
38
39 $wgOut->addWikiText( $this->MediaWikiCredits() . $this->extensionCredits() . $this->wgHooks() );
40 $wgOut->addHTML( $this->IPInfo() );
41 }
42
43 function MediaWikiCredits() {
44 global $wgVersion;
45
46 $dbr =& wfGetDB( DB_SLAVE );
47
48 $ret =
49 "__NOTOC__
50 <div dir='ltr'>
51 This wiki is powered by '''[http://www.mediawiki.org/ MediaWiki]''',
52 copyright (C) 2001-2005 Magnus Manske, Brion Vibber, Lee Daniel Crocker,
53 Tim Starling, Erik Möller, and others.
54
55 MediaWiki is free software; you can redistribute it and/or modify
56 it under the terms of the GNU General Public License as published by
57 the Free Software Foundation; either version 2 of the License, or
58 (at your option) any later version.
59
60 MediaWiki is distributed in the hope that it will be useful,
61 but WITHOUT ANY WARRANTY; without even the implied warranty of
62 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
63 GNU General Public License for more details.
64
65 You should have received [{{SERVER}}{{SCRIPTPATH}}/COPYING a copy of the GNU General Public License]
66 along with this program; if not, write to the Free Software
67 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
68 or [http://www.gnu.org/copyleft/gpl.html read it online]
69
70 * [http://www.mediawiki.org/ MediaWiki]: $wgVersion
71 * [http://www.php.net/ PHP]: " . phpversion() . " (" . php_sapi_name() . ")
72 * " . $dbr->getSoftwareLink() . ": " . $dbr->getServerVersion() . "
73 </div>";
74
75 return str_replace( "\t\t", '', $ret );
76 }
77
78 function extensionCredits() {
79 global $wgExtensionCredits, $wgExtensionFunctions, $wgSkinExtensionFunction;
80
81 if ( ! count( $wgExtensionCredits ) && ! count( $wgExtensionFunctions ) && ! count( $wgSkinExtensionFunction ) )
82 return '';
83
84 $extensionTypes = array(
85 'specialpage' => 'Special pages',
86 'parserhook' => 'Parser hooks',
87 'other' => 'Other',
88 );
89
90 wfRunHooks( 'ExtensionTypes', array( &$extensionTypes ) );
91
92 $out = "\n* Extensions:\n";
93 foreach ( $extensionTypes as $type => $text ) {
94 if ( count( @$wgExtensionCredits[$type] ) ) {
95 $out .= "** $text:\n";
96 foreach ( $wgExtensionCredits[$type] as $extension ) {
97 wfSuppressWarnings();
98 $out .= $this->formatCredits(
99 $extension['name'],
100 $extension['version'],
101 $extension['author'],
102 $extension['url'],
103 $extension['description']
104 );
105 wfRestoreWarnings();
106 }
107 }
108 }
109
110 if ( count( $wgExtensionFunctions ) ) {
111 $out .= "** Extension functions:\n";
112 $out .= '***' . $this->langObj->listToText( $wgExtensionFunctions ) . "\n";
113 }
114
115 if ( count( $wgSkinExtensionFunction ) ) {
116 $out .= "** Skin extension functions:\n";
117 $out .= '***' . $this->langObj->listToText( $wgSkinExtensionFunction ) . "\n";
118 }
119
120 return $out;
121 }
122
123 function formatCredits( $name, $version = null, $author = null, $url = null, $description = null) {
124 $ret = '*** ';
125 if ( isset( $url ) )
126 $ret .= "[$url ";
127 $ret .= "''$name";
128 if ( isset( $version ) )
129 $ret .= " (version $version)";
130 $ret .= "''";
131 if ( isset( $url ) )
132 $ret .= ']';
133 if ( isset( $description ) )
134 $ret .= ', ' . $description;
135 if ( isset( $description ) && isset( $author ) )
136 $ret .= ', ';
137 if ( isset( $author ) )
138 $ret .= ' by ' . $this->langObj->listToText( (array)$author );
139
140 return htmlspecialchars( $ret ) . "\n";
141 }
142
143 function wgHooks() {
144 global $wgHooks;
145
146 $ret = "* Hooks:\n";
147
148 foreach ($wgHooks as $hook => $hooks) {
149 $ret .= "** $hook: " . $this->langObj->listToText( $hooks ) . "\n";
150 }
151
152 return $ret;
153 }
154
155 function IPInfo() {
156
157 $ip = str_replace( '--', ' - - ', htmlspecialchars( wfGetIP() ) );
158 return "<!-- visited from $ip -->\n";
159 }
160 }
161 ?>