attempt to fix ini_set error by using set_include_path Patch by robertoz
[mediawiki.git] / includes / SpecialVersion.php
blob31e16dee80afc954d1c60dd82868d1e11de895c0
1 <?php
2 /**#@+
3 * Give information about the version of MediaWiki, PHP, the DB and extensions
5 * @package MediaWiki
6 * @subpackage SpecialPage
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
13 /**
14 * constructor
16 function wfSpecialVersion() {
17 $version = new SpecialVersion;
18 $version->execute();
21 class SpecialVersion {
22 /**
23 * @var object
24 * @access private
26 var $langObj;
28 /**
29 * Constructor
31 function SpecialVersion() {
32 // English motherfucker, do you speak it?
33 $this->langObj = setupLangObj( 'LanguageEn' );
34 $this->langObj->initEncoding();
37 /**
38 * main()
40 function execute() {
41 global $wgOut;
43 $wgOut->addWikiText(
44 $this->MediaWikiCredits() .
45 $this->extensionCredits() .
46 $this->wgHooks()
48 $wgOut->addHTML( $this->IPInfo() );
51 /**#@+
52 * @access private
55 /**
56 * @static
58 function MediaWikiCredits() {
59 global $wgVersion;
61 $dbr =& wfGetDB( DB_SLAVE );
63 $ret =
64 "__NOTOC__
65 <div dir='ltr'>
66 This wiki is powered by '''[http://www.mediawiki.org/ MediaWiki]''',
67 copyright (C) 2001-2005 Magnus Manske, Brion Vibber, Lee Daniel Crocker,
68 Tim Starling, Erik Möller, and others.
70 MediaWiki is free software; you can redistribute it and/or modify
71 it under the terms of the GNU General Public License as published by
72 the Free Software Foundation; either version 2 of the License, or
73 (at your option) any later version.
75 MediaWiki is distributed in the hope that it will be useful,
76 but WITHOUT ANY WARRANTY; without even the implied warranty of
77 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
78 GNU General Public License for more details.
80 You should have received [{{SERVER}}{{SCRIPTPATH}}/COPYING a copy of the GNU General Public License]
81 along with this program; if not, write to the Free Software
82 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
83 or [http://www.gnu.org/copyleft/gpl.html read it online]
85 * [http://www.mediawiki.org/ MediaWiki]: $wgVersion
86 * [http://www.php.net/ PHP]: " . phpversion() . " (" . php_sapi_name() . ")
87 * " . $dbr->getSoftwareLink() . ": " . $dbr->getServerVersion() . "
88 </div>";
90 return str_replace( "\t\t", '', $ret );
93 function extensionCredits() {
94 global $wgExtensionCredits, $wgExtensionFunctions, $wgSkinExtensionFunction;
96 if ( ! count( $wgExtensionCredits ) && ! count( $wgExtensionFunctions ) && ! count( $wgSkinExtensionFunction ) )
97 return '';
99 $extensionTypes = array(
100 'specialpage' => 'Special pages',
101 'parserhook' => 'Parser hooks',
102 'variable' => 'Variables',
103 'other' => 'Other',
105 wfRunHooks( 'SpecialVersionExtensionTypes', array( &$this, &$extensionTypes ) );
107 $out = "\n* Extensions:\n";
108 foreach ( $extensionTypes as $type => $text ) {
109 if ( count( @$wgExtensionCredits[$type] ) ) {
110 $out .= "** $text:\n";
112 usort( $wgExtensionCredits[$type], array( $this, 'compare' ) );
114 foreach ( $wgExtensionCredits[$type] as $extension ) {
115 wfSuppressWarnings();
116 $out .= $this->formatCredits(
117 $extension['name'],
118 $extension['version'],
119 $extension['author'],
120 $extension['url'],
121 $extension['description']
123 wfRestoreWarnings();
128 if ( count( $wgExtensionFunctions ) ) {
129 $out .= "** Extension functions:\n";
130 $out .= '***' . $this->langObj->listToText( $wgExtensionFunctions ) . "\n";
133 if ( count( $wgSkinExtensionFunction ) ) {
134 $out .= "** Skin extension functions:\n";
135 $out .= '***' . $this->langObj->listToText( $wgSkinExtensionFunction ) . "\n";
138 return $out;
141 function compare( $a, $b ) {
142 if ( $a['name'] === $b['name'] )
143 return 0;
144 else
145 return $this->langObj->lc( $a['name'] ) > $this->langObj->lc( $b['name'] ) ? 1 : -1;
148 function formatCredits( $name, $version = null, $author = null, $url = null, $description = null) {
149 $ret = '*** ';
150 if ( isset( $url ) )
151 $ret .= "[$url ";
152 $ret .= "''$name";
153 if ( isset( $version ) )
154 $ret .= " (version $version)";
155 $ret .= "''";
156 if ( isset( $url ) )
157 $ret .= ']';
158 if ( isset( $description ) )
159 $ret .= ', ' . $description;
160 if ( isset( $description ) && isset( $author ) )
161 $ret .= ', ';
162 if ( isset( $author ) )
163 $ret .= ' by ' . $this->langObj->listToText( (array)$author );
165 return "$ret\n";
168 function wgHooks() {
169 global $wgHooks;
171 $myWgHooks = $wgHooks;
172 ksort( $myWgHooks );
174 $ret = "* Hooks:\n";
175 foreach ($myWgHooks as $hook => $hooks)
176 $ret .= "** $hook:" . $this->langObj->listToText( $hooks ) . "\n";
178 return $ret;
182 * @static
184 function IPInfo() {
185 $ip = str_replace( '--', ' - ', htmlspecialchars( wfGetIP() ) );
186 return "<!-- visited from $ip -->\n";
189 /**#@-*/
192 /**#@-*/