<?php
# $Id$
-#
-# Class representing a Wikipedia article and history.
-# See design.doc for an overview.
-
-# Note: edit user interface and cache support functions have been
-# moved to separate EditPage and CacheManager classes.
+/**
+ * File for articles
+ */
+/**
+ * Need the CacheManager to be loaded
+ */
require_once ( 'CacheManager.php' );
$wgArticleCurContentFields = false;
$wgArticleOldContentFields = false;
+/**
+ * Class representing a Wikipedia article and history.
+ *
+ * See design.doc for an overview.
+ * Note: edit user interface and cache support functions have been
+ * moved to separate EditPage and CacheManager classes.
+ */
class Article {
- /* private */ var $mContent, $mContentLoaded;
- /* private */ var $mUser, $mTimestamp, $mUserText;
- /* private */ var $mCounter, $mComment, $mCountAdjustment;
- /* private */ var $mMinorEdit, $mRedirectedFrom;
- /* private */ var $mTouched, $mFileCache, $mTitle;
- /* private */ var $mId, $mTable;
- /* private */ var $mForUpdate;
-
+ /**#@+
+ * @access private
+ */
+ var $mContent, $mContentLoaded;
+ var $mUser, $mTimestamp, $mUserText;
+ var $mCounter, $mComment, $mCountAdjustment;
+ var $mMinorEdit, $mRedirectedFrom;
+ var $mTouched, $mFileCache, $mTitle;
+ var $mId, $mTable;
+ var $mForUpdate;
+ /**#@-*/
+
+ /**
+ * Constructor and clear the article
+ */
function Article( &$title ) {
$this->mTitle =& $title;
$this->clear();
}
- /* private */ function clear() {
+ /**
+ * Clear the object
+ * @private
+ */
+ function clear() {
$this->mContentLoaded = false;
$this->mCurID = $this->mUser = $this->mCounter = -1; # Not loaded
$this->mRedirectedFrom = $this->mUserText =
$this->mForUpdate = false;
}
- # Get revision text associated with an old or archive row
- # $row is usually an object from wfFetchRow(), both the flags and the text field must be included
- /* static */ function getRevisionText( $row, $prefix = 'old_' ) {
+ /**
+ * Get revision text associated with an old or archive row
+ * $row is usually an object from wfFetchRow(), both the flags and the text
+ * field must be included
+ * @static
+ * @param integer $row Id of a row
+ * @param string $prefix table prefix (default 'old_')
+ * @return string $text the text requested
+ */
+ function getRevisionText( $row, $prefix = 'old_' ) {
# Get data
$textField = $prefix . 'text';
$flagsField = $prefix . 'flags';
return $text;
}
- /* static */ function compressRevisionText( &$text ) {
+ /**
+ * If $wgCompressRevisions is enabled, we will compress datas
+ * @static
+ * @param reference to a text
+ * @return string 'gzip' if it get compressed, '' overwise
+ */
+ function compressRevisionText( &$text ) {
global $wgCompressRevisions;
if( !$wgCompressRevisions ) {
return '';
return 'gzip';
}
- # Returns the text associated with a "link" type old table row
- /* static */ function followLink( $link ) {
+ /**
+ * Returns the text associated with a "link" type old table row
+ * @static
+ */
+ function followLink( $link ) {
# Split the link into fields and values
$lines = explode( '\n', $link );
$hash = '';
return $text;
}
- /* static */ function fetchFromLocation( $location, $hash ) {
+ /**
+ * @static
+ */
+ function fetchFromLocation( $location, $hash ) {
global $wgLoadBalancer;
$fname = 'fetchFromLocation';
wfProfileIn( $fname );
return $text;
}
- # Note that getContent/loadContent may follow redirects if
- # not told otherwise, and so may cause a change to mTitle.
-
- # Return the text of this revision
+ /**
+ * Note that getContent/loadContent may follow redirects if
+ * not told otherwise, and so may cause a change to mTitle.
+ *
+ * Return the text of this revision
+ */
function getContent( $noredir ) {
global $wgRequest;
}
}
- # This function returns the text of a section, specified by a number ($section).
- # A section is text under a heading like == Heading == or <h1>Heading</h1>, or
- # the first section before any such heading (section 0).
- #
- # If a section contains subsections, these are also returned.
- #
+ /**
+ * This function returns the text of a section, specified by a number ($section).
+ * A section is text under a heading like == Heading == or <h1>Heading</h1>, or
+ * the first section before any such heading (section 0).
+ *
+ * If a section contains subsections, these are also returned.
+ */
function getSection($text,$section) {
# strip NOWIKI etc. to avoid confusion (true-parameter causes HTML
}
- # Return an array of the columns of the "cur"-table
+ /**
+ * Return an array of the columns of the "cur"-table
+ */
function &getCurContentFields() {
global $wgArticleCurContentFields;
if ( !$wgArticleCurContentFields ) {
return $wgArticleCurContentFields;
}
- # Return an array of the columns of the "old"-table
+ /**
+ * Return an array of the columns of the "old"-table
+ */
function &getOldContentFields() {
global $wgArticleOldContentFields;
if ( !$wgArticleOldContentFields ) {
return $wgArticleOldContentFields;
}
- # Load the revision (including cur_text) into this object
+ /**
+ * Load the revision (including cur_text) into this object
+ */
function loadContent( $noredir = false ) {
global $wgOut, $wgMwRedir, $wgRequest;
return $this->mContent;
}
- # Gets the article text without using so many damn globals
- # Returns false on error
+ /**
+ * Gets the article text without using so many damn globals
+ * Returns false on error
+ */
function getContentWithoutUsingSoManyDamnGlobals( $oldid = 0, $noredir = false ) {
global $wgMwRedir;
return $this->mContent;
}
- # Read/write accessor to select FOR UPDATE
+ /**
+ * Read/write accessor to select FOR UPDATE
+ */
function forUpdate( $x = NULL ) {
return wfSetVar( $this->mForUpdate, $x );
}
- # Get the database which should be used for reads
+ /**
+ * Get the database which should be used for reads
+ */
function &getDB() {
if ( $this->mForUpdate ) {
return wfGetDB( DB_MASTER );
}
}
- # Get options for all SELECT statements
- # Can pass an option array, to which the class-wide options will be appended
+ /**
+ * Get options for all SELECT statements
+ * Can pass an option array, to which the class-wide options will be appended
+ */
function getSelectOptions( $options = '' ) {
if ( $this->mForUpdate ) {
if ( $options ) {
return $options;
}
+ /**
+ * Return the Article ID
+ */
function getID() {
if( $this->mTitle ) {
return $this->mTitle->getArticleID();
}
}
+ /*
+ * @todo document function
+ */
function getCount() {
if ( -1 == $this->mCounter ) {
$id = $this->getID();
return $this->mCounter;
}
- # Would the given text make this article a "good" article (i.e.,
- # suitable for including in the article count)?
+ /**
+ * Would the given text make this article a "good" article (i.e.,
+ * suitable for including in the article count)?
+ */
function isCountable( $text ) {
global $wgUseCommaCount, $wgMwRedir;
return 1;
}
- # Loads everything from cur except cur_text
- # This isn't necessary for all uses, so it's only done if needed.
- /* private */ function loadLastEdit() {
+ /**
+ * Loads everything from cur except cur_text
+ * This isn't necessary for all uses, so it's only done if needed.
+ * @private
+ */
+ function loadLastEdit() {
global $wgOut;
if ( -1 != $this->mUser ) return;
return $contribs;
}
- # This is the default action of the script: just view the page of
- # the given title.
-
+ /**
+ * This is the default action of the script: just view the page of
+ * the given title.
+ */
function view() {
global $wgUser, $wgOut, $wgLang, $wgRequest, $wgMwRedir, $wgOnlySysopsCanPatrol;
global $wgLinkCache, $IP, $wgEnableParserCache, $wgStylePath, $wgUseRCPatrol;
wfProfileOut( $fname );
}
- # Theoretically we could defer these whole insert and update
- # functions for after display, but that's taking a big leap
- # of faith, and we want to be able to report database
- # errors at some point.
-
- /* private */ function insertNewArticle( $text, $summary, $isminor, $watchthis ) {
+ /**
+ * Theoretically we could defer these whole insert and update
+ * functions for after display, but that's taking a big leap
+ * of faith, and we want to be able to report database
+ * errors at some point.
+ * @private
+ */
+ function insertNewArticle( $text, $summary, $isminor, $watchthis ) {
global $wgOut, $wgUser, $wgMwRedir;
global $wgUseSquid, $wgDeferredUpdateList, $wgInternalServer;
}
- /* Side effects: loads last edit */
+ /**
+ * Side effects: loads last edit
+ */
function getTextOfLastEditWithSectionReplacedOrAdded($section, $text, $summary = '') {
$this->loadLastEdit();
$oldtext = $this->getContent( true );
return $text;
}
+ /**
+ * @todo document this function
+ */
function updateArticle( $text, $summary, $minor, $watchthis, $forceBot = false, $sectionanchor = '' ) {
global $wgOut, $wgUser;
global $wgDBtransactions, $wgMwRedir;
return $good;
}
- # After we've either updated or inserted the article, update
- # the link tables and redirect to the new page.
-
+ /**
+ * After we've either updated or inserted the article, update
+ * the link tables and redirect to the new page.
+ */
function showArticle( $text, $subtitle , $sectionanchor = '' ) {
global $wgOut, $wgUser, $wgLinkCache;
global $wgMwRedir;
$wgOut->redirect( $this->mTitle->getFullURL( $r ).$sectionanchor );
}
- # Validate article
-
+ /**
+ * Validate article
+ * @todo document this function a bit more
+ */
function validate () {
global $wgOut, $wgUseValidation;
if( $wgUseValidation ) {
}
}
- # Mark this particular edit as patrolled
+ /**
+ * Mark this particular edit as patrolled
+ */
function markpatrolled() {
global $wgOut, $wgRequest, $wgOnlySysopsCanPatrol, $wgUseRCPatrol, $wgUser;
$wgOut->setRobotpolicy( 'noindex,follow' );
}
- # Add this page to my watchlist
-
+ /**
+ * Add or remove this page to my watchlist based on value of $add
+ */
function watch( $add = true ) {
global $wgUser, $wgOut, $wgLang;
global $wgDeferredUpdateList;
$wgOut->returnToMain( true, $this->mTitle->getPrefixedText() );
}
+ /**
+ * Stop watching a page, it act just like a call to watch(false)
+ */
function unwatch() {
$this->watch( false );
}
- # protect a page
-
+ /**
+ * protect a page
+ */
function protect( $limit = 'sysop' ) {
global $wgUser, $wgOut, $wgRequest;
}
}
- # Output protection confirmation dialog
-
+ /**
+ * Output protection confirmation dialog
+ */
function confirmProtect( $par, $reason, $limit = 'sysop' ) {
global $wgOut;
$wgOut->returnToMain( false );
}
+ /**
+ * Unprotect the pages
+ */
function unprotect() {
return $this->protect( '' );
}
- # UI entry point for page deletion
-
+ /*
+ * UI entry point for page deletion
+ */
function delete() {
global $wgUser, $wgOut, $wgMessageCache, $wgRequest;
$fname = 'Article::delete';
return $this->confirmDelete( '', $reason );
}
- # Output deletion confirmation dialog
-
+ /**
+ * Output deletion confirmation dialog
+ */
function confirmDelete( $par, $reason ) {
global $wgOut;
}
- # Perform a deletion and output success or failure messages
-
+ /**
+ * Perform a deletion and output success or failure messages
+ */
function doDelete( $reason ) {
global $wgOut, $wgUser, $wgLang;
$fname = 'Article::doDelete';
}
}
- # Back-end article deletion
- # Deletes the article with database consistency, writes logs, purges caches
- # Returns success
+ /**
+ * Back-end article deletion
+ * Deletes the article with database consistency, writes logs, purges caches
+ * Returns success
+ */
function doDeleteArticle( $reason ) {
global $wgUser, $wgLang;
global $wgUseSquid, $wgDeferredUpdateList, $wgInternalServer;
return true;
}
+ /**
+ * Revert a modification
+ */
function rollback() {
global $wgUser, $wgLang, $wgOut, $wgRequest;
$fname = 'Article::rollback';
}
- # Do standard deferred updates after page view
-
- /* private */ function viewUpdates() {
+ /**
+ * Do standard deferred updates after page view
+ * @private
+ */
+ function viewUpdates() {
global $wgDeferredUpdateList;
if ( 0 != $this->getID() ) {
global $wgDisableCounters;
array_push( $wgDeferredUpdateList, $u );
}
- # Do standard deferred updates after page edit.
- # Every 1000th edit, prune the recent changes table.
-
- /* private */ function editUpdates( $text ) {
+ /**
+ * Do standard deferred updates after page edit.
+ * Every 1000th edit, prune the recent changes table.
+ * @private
+ */
+ function editUpdates( $text ) {
global $wgDeferredUpdateList, $wgDBname, $wgMemc;
global $wgMessageCache;
}
}
- /* private */ function setOldSubtitle() {
+ /**
+ * @todo document this function
+ * @private
+ */
+ function setOldSubtitle() {
global $wgLang, $wgOut, $wgUser;
$td = $wgLang->timeanddate( $this->mTimestamp, true );
$wgOut->setSubtitle( $r );
}
- # This function is called right before saving the wikitext,
- # so we can do things like signatures and links-in-context.
-
+ /**
+ * This function is called right before saving the wikitext,
+ * so we can do things like signatures and links-in-context.
+ */
function preSaveTransform( $text ) {
global $wgParser, $wgUser;
return $wgParser->preSaveTransform( $text, $this->mTitle, $wgUser, ParserOptions::newFromUser( $wgUser ) );
$dbw->ignoreErrors( $oldignore );
}
- # The onArticle*() functions are supposed to be a kind of hooks
- # which should be called whenever any of the specified actions
- # are done.
- #
- # This is a good place to put code to clear caches, for instance.
-
- # This is called on page move and undelete, as well as edit
- /* static */ function onArticleCreate($title_obj) {
+ /**
+ * The onArticle*() functions are supposed to be a kind of hooks
+ * which should be called whenever any of the specified actions
+ * are done.
+ *
+ * This is a good place to put code to clear caches, for instance.
+ *
+ * This is called on page move and undelete, as well as edit
+ * @static
+ * @param $title_obj a title object
+ */
+ function onArticleCreate($title_obj) {
global $wgUseSquid, $wgDeferredUpdateList;
$titles = $title_obj->getBrokenLinksTo();
LinkCache::linksccClearBrokenLinksTo( $title_obj->getPrefixedDBkey() );
}
- /* static */ function onArticleDelete($title_obj) {
+ /**
+ * @static
+ */
+ function onArticleDelete($title_obj) {
LinkCache::linksccClearLinksTo( $title_obj->getArticleID() );
}
- /* static */ function onArticleEdit($title_obj) {
+ /**
+ * @static
+ */
+ function onArticleEdit($title_obj) {
LinkCache::linksccClearPage( $title_obj->getArticleID() );
}
- # Info about this page
-
+ /**
+ * Info about this page
+ */
function info() {
global $wgUser, $wgTitle, $wgOut, $wgLang, $wgAllowPageInfo;
$fname = 'Article::info';
<?php
-# Blocks and bans object
-#
-#TODO: This could be used everywhere, but it isn't.
-#
-# All the functions in this class assume the object is either explicitly
-# loaded or filled. It is not load-on-demand. There are no accessors.
-#
-# To use delete(), you only need to fill $mAddress
-
-# Globals used: $wgBlockCache, $wgAutoblockExpiry
+/**
+ * Blocks and bans object
+ */
+/**
+ * Some globals
+ */
define ( 'EB_KEEP_EXPIRED', 1 );
define ( 'EB_FOR_UPDATE', 2 );
+/**
+ * The block class
+ * All the functions in this class assume the object is either explicitly
+ * loaded or filled. It is not load-on-demand. There are no accessors.
+ *
+ * To use delete(), you only need to fill $mAddress
+ * Globals used: $wgBlockCache, $wgAutoblockExpiry
+ * @todo This could be used everywhere, but it isn't.
+ */
class Block
{
/* public*/ var $mAddress, $mUser, $mBy, $mReason, $mTimestamp, $mAuto, $mId, $mExpiry;
<?php
+/**
+ * Contain the blockcache class
+ */
-# Object for fast lookup of IP blocks
-# Represents a memcached value, and in some sense, the entire ipblocks table
-
+/**
+ * Object for fast lookup of IP blocks
+ * Represents a memcached value, and in some sense, the entire ipblocks table
+ */
class BlockCache
{
var $mData = false, $mMemcKey;
<?php
+/**
+ * Contain the CacheManager class
+ */
-# Handles talking to the file cache, putting stuff in and taking it back out.
-# Mostly called from Article.php, also from DatabaseFunctions.php for the
-# emergency abort/fallback to cache.
-
-# Global options that affect this module:
-# $wgCachePages
-# $wgCacheEpoch
-# $wgUseFileCache
-# $wgFileCacheDirectory
-# $wgUseGzip
-
+/**
+ * We need the title class
+ */
require_once( 'Title.php' );
+/**
+ * Handles talking to the file cache, putting stuff in and taking it back out.
+ * Mostly called from Article.php, also from DatabaseFunctions.php for the
+ * emergency abort/fallback to cache.
+ *
+ * Global options that affect this module:
+ * $wgCachePages
+ * $wgCacheEpoch
+ * $wgUseFileCache
+ * $wgFileCacheDirectory
+ * $wgUseGzip
+ */
class CacheManager {
var $mTitle, $mFileCache;
<?php
-
-/*
- Special handling for category description pages
- Modelled after ImagePage.php
+/**
+ * Special handling for category description pages
+ * Modelled after ImagePage.php
+ *
*/
+/**
+ *
+ */
class CategoryPage extends Article {
-
function view() {
-
if ( NS_CATEGORY == $this->mTitle->getNamespace() ) {
$this->openShowCategory();
}
}
}
- function openShowCategory()
- {
+ function openShowCategory() {
# For overloading
}
# languages due to sorting issues, so they might want to turn it
# off.
- function closeShowCategory()
- {
+ function closeShowCategory() {
global $wgOut;
$msg = wfMsg('usenewcategorypage');
if ( '0' == @$msg[0] )
<?php
-/* Credits.php -- formats credits for articles
+/**
+ * Credits.php -- formats credits for articles
* Copyright 2004, Evan Prodromou <evan@wikitravel.org>.
*
* This program is free software; you can redistribute it and/or modify
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * @author <evan@wikitravel.org>
*/
-/* This is largely cadged from PageHistory::history */
-
-function showCreditsPage($article)
-{
+/**
+ * This is largely cadged from PageHistory::history
+ */
+function showCreditsPage($article) {
global $wgOut;
$fname = 'showCreditsPage';
return $s;
}
-function getAuthorCredits($article) {
-
+/**
+ *
+ */
+function getAuthorCredits($article) {
global $wgLang;
$last_author = $article->getUser();
return wfMsg('lastmodifiedby', $d, $author_credit);
}
+/**
+ *
+ */
function getContributorCredits($article, $cnt, $showIfMax) {
global $wgLang, $wgAllowRealName;
return (empty($creds)) ? '' : wfMsg('othercontribs', $creds);
}
+/**
+ *
+ */
function creditLink($user_name, $link_text = '') {
global $wgUser, $wgLang;
$skin = $wgUser->getSkin();
(empty($link_text)) ? $user_name : $link_text);
}
+/**
+ *
+ */
function creditOthersLink($article) {
global $wgUser, $wgLang;
$skin = $wgUser->getSkin();
<?php
# $Id$
-# This file deals with MySQL interface functions
-# and query specifics/optimisations
-#
+/**
+ * This file deals with MySQL interface functions
+ * and query specifics/optimisations
+ */
+
+/**
+ * Depends on the CacheManager
+ */
require_once( 'CacheManager.php' );
define( 'LIST_COMMA', 0 );
# Maximum time to wait before retry
define( 'DEADLOCK_DELAY_MAX', 1500000 );
+/**
+ * Database abstraction object
+ * @category database
+ */
class Database {
#------------------------------------------------------------------------------
}
}
+/**
+ * Database abstraction object for mySQL
+ * @category database
+ */
class DatabaseMysql extends Database {
# Inherit all
}
-#------------------------------------------------------------------------------
-# Result wrapper for grabbing data queried by someone else
-#------------------------------------------------------------------------------
+/**
+ * Result wrapper for grabbing data queried by someone else
+ * @category database
+ */
class ResultWrapper {
var $db, $result;
# Global functions
#------------------------------------------------------------------------------
-/* Standard fail function, called by default when a connection cannot be established
- Displays the file cache if possible */
+/**
+ * Standard fail function, called by default when a connection cannot be
+ * established.
+ * Displays the file cache if possible
+ */
function wfEmergencyAbort( &$conn, $error ) {
global $wgTitle, $wgUseFileCache, $title, $wgInputEncoding, $wgSiteNotice, $wgOutputEncoding;
<?php
# $Id$
-# Backwards compatibility wrapper for Database.php
+/**
+ * Backwards compatibility wrapper for Database.php
+ *
+ * Note: $wgDatabase has ceased to exist. Destroy all references.
+ */
-# Note: $wgDatabase has ceased to exist. Destroy all references.
-
-# Usually aborts on failure
-# If errors are explicitly ignored, returns success
+/**
+ * Usually aborts on failure
+ * If errors are explicitly ignored, returns success
+ */
function wfQuery( $sql, $db, $fname = '' )
{
global $wgOut;
<?php
# $Id$
-#
-# DO NOT USE !!! Unless you want to help developping it.
-#
-# This file is an attempt to port the mysql database layer to postgreSQL. The
-# only thing done so far is s/mysql/pg/ and dieing if function haven't been
-# ported.
-#
-# As said brion 07/06/2004 :
-# "table definitions need to be changed. fulltext index needs to work differently
-# things that use the last insert id need to be changed. Probably other things
-# need to be changed. various semantics may be different."
-#
-# Hashar
+/**
+ * DO NOT USE !!! Unless you want to help developping it.
+ *
+ * This file is an attempt to port the mysql database layer to postgreSQL. The
+ * only thing done so far is s/mysql/pg/ and dieing if function haven't been
+ * ported.
+ *
+ * As said brion 07/06/2004 :
+ * "table definitions need to be changed. fulltext index needs to work differently
+ * things that use the last insert id need to be changed. Probably other things
+ * need to be changed. various semantics may be different."
+ *
+ * Hashar
+ *
+ */
+
+/**
+ * Depends on database
+ */
require_once( 'Database.php' );
+/**
+ *
+ */
class DatabasePgsql extends Database {
var $mInsertId = NULL;
var $mLastResult = NULL;
return new DatabasePgsql( $server, $user, $password, $dbName, $failFunction, $flags, $tablePrefix );
}
- # Usually aborts on failure
- # If the failFunction is set to a non-zero integer, returns success
- function open( $server, $user, $password, $dbName )
- {
+ /**
+ * Usually aborts on failure
+ * If the failFunction is set to a non-zero integer, returns success
+ */
+ function open( $server, $user, $password, $dbName ) {
# Test for PostgreSQL support, to avoid suppressed fatal error
if ( !function_exists( 'pg_connect' ) ) {
die( "PostgreSQL functions missing, have you compiled PHP with the --with-pgsql option?\n" );
return $this->mConn;
}
- # Closes a database connection, if it is open
- # Returns success, true if already closed
- function close()
- {
+ /**
+ * Closes a database connection, if it is open
+ * Returns success, true if already closed
+ */
+ function close() {
$this->mOpened = false;
if ( $this->mConn ) {
return pg_close( $this->mConn );
wfDebugDieBacktrace( "Unable to free PostgreSQL result\n" );
}
}
+
function fetchObject( $res ) {
@$row = pg_fetch_object( $res );
# FIXME: HACK HACK HACK HACK debug
function numFields( $res ) { return pg_num_fields( $res ); }
function fieldName( $res, $n ) { return pg_field_name( $res, $n ); }
- # This must be called after nextSequenceVal
+ /**
+ * This must be called after nextSequenceVal
+ */
function insertId() {
return $this->mInsertId;
}
return pg_affected_rows( $this->mLastResult );
}
- # Returns information about an index
- # If errors are explicitly ignored, returns NULL on failure
- function indexInfo( $table, $index, $fname = 'Database::indexExists' )
- {
+ /**
+ * Returns information about an index
+ * If errors are explicitly ignored, returns NULL on failure
+ */
+ function indexInfo( $table, $index, $fname = 'Database::indexExists' ) {
$sql = "SELECT indexname FROM pg_indexes WHERE tablename='$table'";
$res = $this->query( $sql, $fname );
if ( !$res ) {
return false;
}
- function fieldInfo( $table, $field )
- {
+ function fieldInfo( $table, $field ) {
wfDebugDieBacktrace( 'Database::fieldInfo() error : mysql_fetch_field() not implemented for postgre' );
/*
$res = $this->query( "SELECT * FROM '$table' LIMIT 1" );
return pg_escape_string( $s );
}
- # Return the next in a sequence, save the value for retrieval via insertId()
+ /**
+ * Return the next in a sequence, save the value for retrieval via insertId()
+ */
function nextSequenceValue( $seqName ) {
$value = $this->getField(''," nextval('" . $seqName . "')");
$this->mInsertId = $value;
return $value;
}
- # USE INDEX clause
- # PostgreSQL doesn't have them and returns ""
+ /**
+ * USE INDEX clause
+ * PostgreSQL doesn't have them and returns ""
+ */
function useIndexClause( $index ) {
return '';
}
}
}
-# Just an alias.
+/**
+ * Just an alias.
+ */
class DatabasePostgreSQL extends DatabasePgsql {
}
<?php
+/**
+ * Contain things
+ * @todo document
+ */
+
+/**
+ *
+ */
define('DF_ALL', -1);
define('DF_NONE', 0);
define('DF_MDY', 1);
define('DF_MD', 8);
define('DF_LAST', 8);
-# To do: preferences, OutputPage
-
+/**
+ * @todo preferences, OutputPage
+ */
class DateFormatter
{
var $mSource, $mTarget;
<?php
-
# $Id$
# DO NOT EDIT THIS FILE!
-# To customize your installation, edit "LocalSettings.php".
-#
-# Note that since all these string interpolations are expanded
-# before LocalSettings is included, if you localize something
-# like $wgScriptPath, you must also localize everything that
-# depends on it.
-
+/**
+ * To customize your installation, edit "LocalSettings.php".
+ *
+ * Note that since all these string interpolations are expanded
+ * before LocalSettings is included, if you localize something
+ * like $wgScriptPath, you must also localize everything that
+ * depends on it.
+*/
# This is not a valid entry point, perform no further processing unless MEDIAWIKI is defined
if( defined( 'MEDIAWIKI' ) ) {
<?php
-# A few constants that might be needed during LocalSettings.php
+/**
+ * A few constants that might be needed during LocalSettings.php
+ */
+
+/**#@+
+ * @global integer
+ */
define( 'DBO_DEBUG', 1 );
define( 'DBO_NOBUFFER', 2 );
define( 'DBO_IGNORE', 4 );
define( 'DBO_TRX', 8 );
define( 'DBO_DEFAULT', 16 );
+/**#@- */
-# Virtual namespaces; these don't appear in the page database:
+/**#@+
+ * Virtual namespaces; these don't appear in the page database
+ * @global integer
+ */
define('NS_MEDIA', -2);
define('NS_SPECIAL', -1);
+/**#@- */
-# Real namespaces:
+/**#@+
+ * Real namespaces
+ * @global integer
+ */
define('NS_MAIN', 0);
define('NS_TALK', 1);
define('NS_USER', 2);
define('NS_HELP_TALK', 13);
define('NS_CATEGORY', 14);
define('NS_CATEGORY_TALK', 15);
+/**#@- */
-# Fix the code and remove these...
+/**#@+
+ * Fix the code and remove these...
+ * @global integer
+ * @todo Globals that need to be removed after code cleaning
+ */
define('NS_WP', NS_PROJECT);
define('NS_WP_TALK', NS_PROJECT_TALK);
define('NS_WIKIPEDIA', NS_PROJECT);
define('NS_WIKIPEDIA_TALK', NS_PROJECT_TALK);
-
+/**#@- */
?>
<?php
-# See diff.doc
+/**
+ * See diff.doc
+ */
+/**
+ * @todo document
+ */
class DifferenceEngine {
/* private */ var $mOldid, $mNewid;
/* private */ var $mOldtitle, $mNewtitle, $mPagetitle;
define('USE_ASSERTS', function_exists('assert'));
+/**
+ * @todo document
+ */
class _DiffOp {
var $type;
var $orig;
}
}
+/**
+ * @todo document
+ */
class _DiffOp_Copy extends _DiffOp {
var $type = 'copy';
}
}
+/**
+ * @todo document
+ */
class _DiffOp_Delete extends _DiffOp {
var $type = 'delete';
}
}
+/**
+ * @todo document
+ */
class _DiffOp_Add extends _DiffOp {
var $type = 'add';
}
}
+/**
+ * @todo document
+ */
class _DiffOp_Change extends _DiffOp {
var $type = 'change';
/**
* Class representing a 'diff' between two sequences of strings.
+ * @todo document
*/
class Diff
{
/**
* FIXME: bad name.
+ * @todo document
*/
-class MappedDiff
-extends Diff
+class MappedDiff extends Diff
{
/**
* Constructor.
* This class formats the diff in classic diff format.
* It is intended that this class be customized via inheritance,
* to obtain fancier outputs.
+ * @todo document
*/
class DiffFormatter
{
define('NBSP', ' '); // iso-8859-x non-breaking space.
+/**
+ * @todo document
+ */
class _HWLDF_WordAccumulator {
function _HWLDF_WordAccumulator () {
$this->_lines = array();
}
}
+/**
+ * @todo document
+ */
class WordLevelDiff extends MappedDiff
{
function WordLevelDiff ($orig_lines, $closing_lines) {
/**
* Wikipedia Table style diff formatter.
- *
+ * @todo document
*/
class TableDiffFormatter extends DiffFormatter
{
<?php
# $Id$
-
-# Splitting edit page/HTML interface from Article...
-# The actual database and text munging is still in Article,
-# but it should get easier to call those from alternate
-# interfaces.
-
+/**
+ * Contain the EditPage class
+ */
+
+/**
+ * Splitting edit page/HTML interface from Article...
+ * The actual database and text munging is still in Article,
+ * but it should get easier to call those from alternate
+ * interfaces.
+ */
class EditPage {
var $mArticle;
var $mTitle;
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# http://www.gnu.org/copyleft/gpl.html
+/**
+ * Contain class to build rss / atom ... feeds
+ */
+
+/**
+ * Available feeds objects
+ */
$wgFeedClasses = array(
'rss' => 'RSSFeed',
'atom' => 'AtomFeed',
);
+/**
+ * @todo document
+ */
class FeedItem {
var $Title = 'Wiki';
var $Description = '';
}
}
+/**
+ * @todo document
+ */
class ChannelFeed extends FeedItem {
/* Abstract functions, override! */
function outHeader() {
}
}
+/**
+ * Generate a RSS feed
+ * @todo document
+ */
class RSSFeed extends ChannelFeed {
function formatTime( $ts ) {
}
}
+/**
+ * Generate an Atom feed
+ * @todo document
+ */
class AtomFeed extends ChannelFeed {
function formatTime( $ts ) {
// need to use RFC 822 time format at least for rss2.0
<?php
+/**
+ * This is the MySQL fulltext search stoplist, copied from the
+ * source file "myisam/ft_static.c" in the MySQL source distribution.
+ * If you use a new version of MySQL, this might have to be changed.
+ *
+ * The list is used to strip out stopwords from search queries to avoid
+ * nulling out the combined search results when using MySQL 3.x.
+ */
-# This is the MySQL fulltext search stoplist, copied from the
-# source file "myisam/ft_static.c" in the MySQL source distribution.
-# If you use a new version of MySQL, this might have to be changed.
-#
-# The list is used to strip out stopwords from search queries to avoid
-# nulling out the combined search results when using MySQL 3.x.
-
+/**
+ * Words are separated by spaces (could be any character) so when doing search,
+ * we search for a word with a space appended at the end and in front of a word.
+ * @global string Provide a list of english words for MySQL 3.x
+ * @private
+ */
global $wgFulltextStoplist;
-/* private */ $wgFulltextStoplist = " a a's able about above according accordingly across actually after afterwards again against ain't all allow allows almost alone along already also although always am among amongst an and another any anybody anyhow anyone anything anyway anyways anywhere apart appear appreciate appropriate are aren't around as aside ask asking associated at available away awfully b be became because become becomes becoming been before beforehand behind being believe below beside besides best better between beyond both brief but by c c'mon c's came can can't cannot cant cause causes certain certainly changes clearly co com come comes concerning consequently consider considering contain containing contains corresponding could couldn't course currently d definitely described despite did didn't different do does doesn't doing don't done down downwards during e each edu eg eight either else elsewhere enough entirely especially et etc even ever every everybody everyone everything everywhere ex exactly example except f far few fifth first five followed following follows for former formerly forth four from further furthermore g get gets getting given gives go goes going gone got gotten greetings h had hadn't happens hardly has hasn't have haven't having he he's hello help hence her here here's hereafter hereby herein hereupon hers herself hi him himself his hither hopefully how howbeit however i i'd i'll i'm i've ie if ignored immediate in inasmuch inc indeed indicate indicated indicates inner insofar instead into inward is isn't it it'd it'll it's its itself j just k keep keeps kept know knows known l last lately later latter latterly least less lest let let's like liked likely little look looking looks ltd m mainly many may maybe me mean meanwhile merely might more moreover most mostly much must my myself n name namely nd near nearly necessary need needs neither never nevertheless new next nine no nobody non none noone nor normally not nothing novel now nowhere o obviously of off often oh ok okay old on once one ones only onto or other others otherwise ought our ours ourselves out outside over overall own p particular particularly per perhaps placed please plus possible presumably probably provides q que quite qv r rather rd re really reasonably regarding regardless regards relatively respectively right s said same saw say saying says second secondly see seeing seem seemed seeming seems seen self selves sensible sent serious seriously seven several shall she should shouldn't since six so some somebody somehow someone something sometime sometimes somewhat somewhere soon sorry specified specify specifying still sub such sup sure t t's take taken tell tends th than thank thanks thanx that that's thats the their theirs them themselves then thence there there's thereafter thereby therefore therein theres thereupon these they they'd they'll they're they've think third this thorough thoroughly those though three through throughout thru thus to together too took toward towards tried tries truly try trying twice two u un under unfortunately unless unlikely until unto up upon us use used useful uses using usually v value various very via viz vs w want wants was wasn't way we we'd we'll we're we've welcome well went were weren't what what's whatever when whence whenever where where's whereafter whereas whereby wherein whereupon wherever whether which while whither who who's whoever whole whom whose why will willing wish with within without won't wonder would would wouldn't x y yes yet you you'd you'll you're you've your yours yourself yourselves z zero ";
-
-# Words are separated by spaces (could be any character) so when doing search,
-# we search for a word with a space appended at the end and in front of a word.
+$wgFulltextStoplist = " a a's able about above according accordingly across actually after afterwards again against ain't all allow allows almost alone along already also although always am among amongst an and another any anybody anyhow anyone anything anyway anyways anywhere apart appear appreciate appropriate are aren't around as aside ask asking associated at available away awfully b be became because become becomes becoming been before beforehand behind being believe below beside besides best better between beyond both brief but by c c'mon c's came can can't cannot cant cause causes certain certainly changes clearly co com come comes concerning consequently consider considering contain containing contains corresponding could couldn't course currently d definitely described despite did didn't different do does doesn't doing don't done down downwards during e each edu eg eight either else elsewhere enough entirely especially et etc even ever every everybody everyone everything everywhere ex exactly example except f far few fifth first five followed following follows for former formerly forth four from further furthermore g get gets getting given gives go goes going gone got gotten greetings h had hadn't happens hardly has hasn't have haven't having he he's hello help hence her here here's hereafter hereby herein hereupon hers herself hi him himself his hither hopefully how howbeit however i i'd i'll i'm i've ie if ignored immediate in inasmuch inc indeed indicate indicated indicates inner insofar instead into inward is isn't it it'd it'll it's its itself j just k keep keeps kept know knows known l last lately later latter latterly least less lest let let's like liked likely little look looking looks ltd m mainly many may maybe me mean meanwhile merely might more moreover most mostly much must my myself n name namely nd near nearly necessary need needs neither never nevertheless new next nine no nobody non none noone nor normally not nothing novel now nowhere o obviously of off often oh ok okay old on once one ones only onto or other others otherwise ought our ours ourselves out outside over overall own p particular particularly per perhaps placed please plus possible presumably probably provides q que quite qv r rather rd re really reasonably regarding regardless regards relatively respectively right s said same saw say saying says second secondly see seeing seem seemed seeming seems seen self selves sensible sent serious seriously seven several shall she should shouldn't since six so some somebody somehow someone something sometime sometimes somewhat somewhere soon sorry specified specify specifying still sub such sup sure t t's take taken tell tends th than thank thanks thanx that that's thats the their theirs them themselves then thence there there's thereafter thereby therefore therein theres thereupon these they they'd they'll they're they've think third this thorough thoroughly those though three through throughout thru thus to together too took toward towards tried tries truly try trying twice two u un under unfortunately unless unlikely until unto up upon us use used useful uses using usually v value various very via viz vs w want wants was wasn't way we we'd we'll we're we've welcome well went were weren't what what's whatever when whence whenever where where's whereafter whereas whereby wherein whereupon wherever whether which while whither who who's whoever whole whom whose why will willing wish with within without won't wonder would would wouldn't x y yes yet you you'd you'll you're you've your yours yourself yourselves z zero ";
+/**
+ */
class FulltextStoplist {
- /* static */ function inList( $word )
+ /**
+ * @static
+ */
+ function inList( $word )
{
global $wgFulltextStoplist;
# FIXME: this will fail badly in many circumstances
<?php
-# Global functions used everywhere
# $Id$
+/**
+ * Global functions used everywhere
+ */
+
+/**
+ * Some globals and requires needed
+ */
+
$wgNumberOfArticles = -1; # Unset
$wgTotalViews = -1;
$wgTotalEdits = -1;
require_once( 'UpdateClasses.php' );
require_once( 'LogPage.php' );
-/*
+/**
* Compatibility functions
- */
-
-# PHP <4.3.x is not actively supported; 4.1.x and 4.2.x might or might not work.
-# <4.1.x will not work, as we use a number of features introduced in 4.1.0
-# such as the new autoglobals.
-
+ * PHP <4.3.x is not actively supported; 4.1.x and 4.2.x might or might not work.
+ * <4.1.x will not work, as we use a number of features introduced in 4.1.0
+ * such as the new autoglobals.
+*/
if( !function_exists('iconv') ) {
# iconv support is not in the default configuration and so may not be present.
# Assume will only ever use utf-8 and iso-8859-1.
}
}
-# html_entity_decode exists in PHP 4.3.0+ but is FATALLY BROKEN even then,
-# with no UTF-8 support.
+/**
+ * html_entity_decode exists in PHP 4.3.0+ but is FATALLY BROKEN even then,
+ * with no UTF-8 support.
+ */
function do_html_entity_decode( $string, $quote_style=ENT_COMPAT, $charset='ISO-8859-1' ) {
static $trans;
if( !isset( $trans ) ) {
$wgRandomSeeded = false;
-# Seed Mersenne Twister
-# Only necessary in PHP < 4.2.0
+/**
+ * Seed Mersenne Twister
+ * Only necessary in PHP < 4.2.0
+ */
function wfSeedRandom()
{
global $wgRandomSeeded;
}
}
-# Generates a URL from a URL-encoded title and a query string
-# Title::getLocalURL() is preferred in most cases
-#
+/**
+ * Generates a URL from a URL-encoded title and a query string
+ * Title::getLocalURL() is preferred in most cases
+ */
function wfLocalUrl( $a, $q = '' )
{
global $wgServer, $wgScript, $wgArticlePath;
return $a;
}
+/**
+ * @todo document
+ */
function wfLocalUrlE( $a, $q = '' )
{
return htmlspecialchars( wfLocalUrl( $a, $q ) );
# die( "Call to obsolete function wfLocalUrlE()" );
}
-# We want / and : to be included as literal characters in our title URLs.
-# %2F in the page titles seems to fatally break for some reason.
-#
+/**
+ * We want / and : to be included as literal characters in our title URLs.
+ * %2F in the page titles seems to fatally break for some reason.
+*/
function wfUrlencode ( $s )
{
$s = urlencode( $s );
return $s;
}
-# Return the UTF-8 sequence for a given Unicode code point.
-# Currently doesn't work for values outside the Basic Multilingual Plane.
-#
+/**
+ * Return the UTF-8 sequence for a given Unicode code point.
+ * Currently doesn't work for values outside the Basic Multilingual Plane.
+*/
function wfUtf8Sequence( $codepoint ) {
if($codepoint < 0x80) return chr($codepoint);
if($codepoint < 0x800) return chr($codepoint >> 6 & 0x3f | 0xc0) .
return "&#$codepoint;";
}
-# Converts numeric character entities to UTF-8
+/**
+ * Converts numeric character entities to UTF-8
+ */
function wfMungeToUtf8( $string ) {
global $wgInputEncoding; # This is debatable
#$string = iconv($wgInputEncoding, "UTF-8", $string);
return $string;
}
-# Converts a single UTF-8 character into the corresponding HTML character entity
-# (for use with preg_replace_callback)
+/**
+ * Converts a single UTF-8 character into the corresponding HTML character
+ * entity (for use with preg_replace_callback)
+ */
function wfUtf8Entity( $matches ) {
$char = $matches[0];
# Find the length
return "&#$z;";
}
-# Converts all multi-byte characters in a UTF-8 string into the appropriate character entity
+/**
+ * Converts all multi-byte characters in a UTF-8 string into the appropriate
+ * character entity
+ */
function wfUtf8ToHTML($string) {
return preg_replace_callback( '/[\\xc0-\\xfd][\\x80-\\xbf]*/', 'wfUtf8Entity', $string );
}
+/**
+ * @todo document
+ */
function wfDebug( $text, $logonly = false )
{
global $wgOut, $wgDebugLogFile, $wgDebugComments, $wgProfileOnly, $wgDebugRawPage;
}
}
-# Log for database errors
+/**
+ * Log for database errors
+ */
function wfLogDBError( $text ) {
global $wgDBerrorLog;
if ( $wgDBerrorLog ) {
}
}
+/**
+ * @todo document
+ */
function logProfilingData()
{
global $wgRequestTime, $wgDebugLogFile, $wgDebugRawPage, $wgRequest;
}
}
-# Check if the wiki read-only lock file is present. This can be used to lock off
-# editing functions, but doesn't guarantee that the database will not be modified.
+/**
+ * Check if the wiki read-only lock file is present. This can be used to lock
+ * off editing functions, but doesn't guarantee that the database will not be
+ * modified.
+ */
function wfReadOnly() {
global $wgReadOnlyFile;
$wgReplacementKeys = array( '$1', '$2', '$3', '$4', '$5', '$6', '$7', '$8', '$9' );
-# Get a message from anywhere
+/**
+ * Get a message from anywhere
+ */
function wfMsg( $key ) {
global $wgRequest;
if ( $wgRequest->getVal( 'debugmsg' ) ) {
return wfMsgReal( $key, $args, true );
}
-# Get a message from the language file
+/**
+ * Get a message from the language file
+ */
function wfMsgNoDB( $key ) {
$args = func_get_args();
if ( count( $args ) ) {
return wfMsgReal( $key, $args, false );
}
-# Really get a message
+/**
+ * Really get a message
+ */
function wfMsgReal( $key, $args, $useDB ) {
global $wgReplacementKeys, $wgMessageCache, $wgLang;
return $message;
}
-# Just like exit() but makes a note of it.
-# Commits open transactions except if the error parameter is set
+/**
+ * Just like exit() but makes a note of it.
+ * Commits open transactions except if the error parameter is set
+ */
function wfAbruptExit( $error = false ){
global $wgLoadBalancer;
static $called = false;
exit();
}
+/**
+ * @todo document
+ */
function wfErrorExit() {
wfAbruptExit( true );
}
-# This is meant as a debugging aid to track down where bad data comes from.
-# Shouldn't be used in production code except maybe in "shouldn't happen" areas.
-#
+/**
+ * This is meant as a debugging aid to track down where bad data comes from.
+ * Shouldn't be used in production code except maybe in "shouldn't happen" areas.
+ */
function wfDebugDieBacktrace( $msg = '' ) {
global $wgCommandLineMode;
return false;
}
-# Yay, more global functions!
+/**
+ * Yay, more global functions!
+ */
function wfCheckLimits( $deflimit = 50, $optionname = 'rclimit' ) {
global $wgRequest;
return $wgRequest->getLimitOffset( $deflimit, $optionname );
}
-# Escapes the given text so that it may be output using addWikiText()
-# without any linking, formatting, etc. making its way through. This
-# is achieved by substituting certain characters with HTML entities.
-# As required by the callers, <nowiki> is not used. It currently does
-# not filter out characters which have special meaning only at the
-# start of a line, such as "*".
+/**
+ * Escapes the given text so that it may be output using addWikiText()
+ * without any linking, formatting, etc. making its way through. This
+ * is achieved by substituting certain characters with HTML entities.
+ * As required by the callers, <nowiki> is not used. It currently does
+ * not filter out characters which have special meaning only at the
+ * start of a line, such as "*".
+ */
function wfEscapeWikiText( $text )
{
$text = str_replace(
return (float)$st[0] + (float)$st[1];
}
-# Changes the first character to an HTML entity
+/**
+ * Changes the first character to an HTML entity
+ */
function wfHtmlEscapeFirst( $text ) {
$ord = ord($text);
$newText = substr($text, 1);
return "&#$ord;$newText";
}
-# Sets dest to source and returns the original value of dest
-# If source is NULL, it just returns the value, it doesn't set the variable
+/**
+ * Sets dest to source and returns the original value of dest
+ * If source is NULL, it just returns the value, it doesn't set the variable
+ */
function wfSetVar( &$dest, $source )
{
$temp = $dest;
return $temp;
}
-# As for wfSetVar except setting a bit
+/**
+ * As for wfSetVar except setting a bit
+ */
function wfSetBit( &$dest, $bit, $state = true ) {
$temp = (bool)($dest & $bit );
if ( !is_null( $state ) ) {
return $temp;
}
-# This function takes two arrays as input, and returns a CGI-style string, e.g.
-# "days=7&limit=100". Options in the first array override options in the second.
-# Options set to "" will not be output.
+/**
+ * This function takes two arrays as input, and returns a CGI-style string, e.g.
+ * "days=7&limit=100". Options in the first array override options in the second.
+ * Options set to "" will not be output.
+ */
function wfArrayToCGI( $array1, $array2 = NULL )
{
if ( !is_null( $array2 ) ) {
return $cgi;
}
-# This is obsolete, use SquidUpdate::purge()
+/**
+ * This is obsolete, use SquidUpdate::purge()
+ * @deprecated
+ */
function wfPurgeSquidServers ($urlArr) {
SquidUpdate::purge( $urlArr );
}
-# Windows-compatible version of escapeshellarg()
-# Windows doesn't recognise single-quotes in the shell, but the escapeshellarg()
-# function puts single quotes in regardless of OS
+/**
+ * Windows-compatible version of escapeshellarg()
+ * Windows doesn't recognise single-quotes in the shell, but the escapeshellarg()
+ * function puts single quotes in regardless of OS
+ */
function wfEscapeShellArg( )
{
$args = func_get_args();
return $retVal;
}
-# wfMerge attempts to merge differences between three texts.
-# Returns true for a clean merge and false for failure or a conflict.
-
+/**
+ * wfMerge attempts to merge differences between three texts.
+ * Returns true for a clean merge and false for failure or a conflict.
+ */
function wfMerge( $old, $mine, $yours, &$result ){
global $wgDiff3;
return ! $conflict;
}
+/**
+ * @todo document
+ */
function wfVarDump( $var )
{
global $wgOut;
}
}
-# Provide a simple HTTP error.
+/**
+ * Provide a simple HTTP error.
+ */
function wfHttpError( $code, $label, $desc ) {
global $wgOut;
$wgOut->disable();
}
}
-# Converts an Accept-* header into an array mapping string values to quality factors
+/**
+ * Converts an Accept-* header into an array mapping string values to quality
+ * factors
+ */
function wfAcceptToPrefs( $accept, $def = '*/*' ) {
# No arg means accept anything (per HTTP spec)
if( !$accept ) {
return $prefs;
}
-/* private */ function mimeTypeMatch( $type, $avail ) {
+/**
+ * @todo document
+ * @private
+ */
+function mimeTypeMatch( $type, $avail ) {
if( array_key_exists($type, $avail) ) {
return $type;
} else {
}
}
-# FIXME: doesn't handle params like 'text/plain; charset=UTF-8'
-# XXX: generalize to negotiate other stuff
+/**
+ * @todo FIXME: doesn't handle params like 'text/plain; charset=UTF-8'
+ * XXX: generalize to negotiate other stuff
+ */
function wfNegotiateType( $cprefs, $sprefs ) {
$combine = array();
return $besttype;
}
-# Array lookup
-# Returns an array where the values in the first array are replaced by the
-# values in the second array with the corresponding keys
+/**
+ * Array lookup
+ * Returns an array where the values in the first array are replaced by the
+ * values in the second array with the corresponding keys
+ */
function wfArrayLookup( $a, $b )
{
return array_flip( array_intersect( array_flip( $a ), array_keys( $b ) ) );
}
-# Ideally we'd be using actual time fields in the db
+/**
+ * Ideally we'd be using actual time fields in the db
+ * @todo fixme
+ */
function wfTimestamp2Unix( $ts ) {
return gmmktime( ( (int)substr( $ts, 8, 2) ),
(int)substr( $ts, 10, 2 ), (int)substr( $ts, 12, 2 ),
return gmdate( 'YmdHis' );
}
-# Sorting hack for MySQL 3, which doesn't use index sorts for DESC
+/**
+ * Sorting hack for MySQL 3, which doesn't use index sorts for DESC
+ */
function wfInvertTimestamp( $ts ) {
return strtr(
$ts,
);
}
-# Reference-counted warning suppression
+/**
+ * Reference-counted warning suppression
+ */
function wfSuppressWarnings( $end = false ) {
static $suppressCount = 0;
static $originalLevel = false;
}
}
-# Restore error level to previous value
+/**
+ * Restore error level to previous value
+ */
function wfRestoreWarnings() {
wfSuppressWarnings( true );
}
define('TS_MW',1); # Mediawiki concatenated string timestamp (yyyymmddhhmmss)
define('TS_DB',2); # Standard database timestamp (yyyy-mm-dd hh:mm:ss)
+/**
+ * @todo document
+ */
function wfTimestamp($outputtype=TS_UNIX,$ts=0) {
if (preg_match("/^(\d{4})\-(\d\d)\-(\d\d) (\d\d):(\d\d):(\d\d)$/",$ts,$da)) {
# TS_DB
}
}
+/**
+ * @todo document
+ */
function wfIsWindows() {
if (substr(php_uname(), 0, 7) == 'Windows') {
return true;
<?php
+/**
+ *
+ */
-# Pure virtual parent
+/**
+ * Pure virtual parent
+ */
class HistoryBlob
{
function setMeta() {}
function getItem() {}
}
-# The real object
+/**
+ * The real object
+ */
class ConcatenatedGzipHistoryBlob
{
/* private */ var $mVersion = 0, $mCompressed = false, $mItems = array();
<?php
-# Class to represent an image
-# Provides methods to retrieve paths (physical, logical, URL),
-# to generate thumbnails or for uploading.
-
+/**
+ *
+ */
+
+/**
+ * Class to represent an image
+ *
+ * Provides methods to retrieve paths (physical, logical, URL),
+ * to generate thumbnails or for uploading.
+ */
class Image
{
/* private */
return $width."px-".$this->name;
}
- //**********************************************************************
- // Create a thumbnail of the image having the specified width.
- // The thumbnail will not be created if the width is larger than the
- // image's width. Let the browser do the scaling in this case.
- // The thumbnail is stored on disk and is only computed if the thumbnail
- // file does not exist OR if it is older than the image.
- // Returns the URL.
+ /**
+ * Create a thumbnail of the image having the specified width.
+ * The thumbnail will not be created if the width is larger than the
+ * image's width. Let the browser do the scaling in this case.
+ * The thumbnail is stored on disk and is only computed if the thumbnail
+ * file does not exist OR if it is older than the image.
+ * Returns the URL.
+ */
function createThumb( $width ) {
global $wgUploadDirectory;
global $wgImageMagickConvertCommand;
return $thumbUrl;
} // END OF function createThumb
- //**********************************************************************
- // Return the image history of this image, line by line.
- // starts with current version, then old versions.
- // uses $this->historyLine to check which line to return:
- // 0 return line for current version
- // 1 query for old versions, return first one
- // 2, ... return next old version from above query
+ /**
+ * Return the image history of this image, line by line.
+ * starts with current version, then old versions.
+ * uses $this->historyLine to check which line to return:
+ * 0 return line for current version
+ * 1 query for old versions, return first one
+ * 2, ... return next old version from above query
+ */
function nextHistoryLine()
{
$fname = 'Image::nextHistoryLine()';
<?php
+/**
+ *
+ */
-/*
- Special handling for image description pages
-*/
-
+/**
+ *
+ */
require_once( 'Image.php' );
+/**
+ * Special handling for image description pages
+ */
class ImagePage extends Article {
/* private */ var $img; // Image object this page is shown for. Initilaized in openShowImage, not
# For overloading
}
- # If the page we've just displayed is in the "Image" namespace,
- # we follow it with an upload history of the image and its usage.
-
+ /**
+ * If the page we've just displayed is in the "Image" namespace,
+ * we follow it with an upload history of the image and its usage.
+ */
function imageHistory()
{
global $wgUser, $wgOut;
<?
-
-/* This file is obsolete... 2003-08-21 */
-
+/**
+ * This file is obsolete... 2003-08-21
+ * @deprecated
+ */
?>
<?php
-# Cache for article titles (prefixed DB keys) and ids linked from one source
+/**
+ * Cache for article titles (prefixed DB keys) and ids linked from one source
+ */
+/**
+ *
+ */
# These are used in incrementalSetup()
define ('LINKCACHE_GOOD', 0);
define ('LINKCACHE_BAD', 1);
define ('LINKCACHE_IMAGE', 2);
+/**
+ *
+ */
class LinkCache {
// Increment $mClassVer whenever old serialized versions of this class
// becomes incompatible with the new version.
return $wgDBname.':lc:title:'.$title;
}
- function LinkCache()
- {
+ function LinkCache() {
$this->mActive = true;
$this->mPreFilled = false;
$this->mForUpdate = false;
$this->mOldBadLinks = array();
}
- # General accessor to get/set whether SELECT FOR UPDATE should be used
+ /**
+ * General accessor to get/set whether SELECT FOR UPDATE should be used
+ */
function forUpdate( $update = NULL ) {
return wfSetVar( $this->mForUpdate, $update );
}
- function getGoodLinkID( $title )
- {
+ function getGoodLinkID( $title ) {
if ( array_key_exists( $title, $this->mGoodLinks ) ) {
return $this->mGoodLinks[$title];
} else {
}
}
- function isBadLink( $title )
- {
+ function isBadLink( $title ) {
return array_key_exists( $title, $this->mBadLinks );
}
- function addGoodLink( $id, $title )
- {
+ function addGoodLink( $id, $title ) {
if ( $this->mActive ) {
$this->mGoodLinks[$title] = $id;
}
}
- function addBadLink( $title )
- {
+ function addBadLink( $title ) {
if ( $this->mActive && ( ! $this->isBadLink( $title ) ) ) {
$this->mBadLinks[$title] = 1;
}
}
- function addImageLink( $title )
- {
+ function addImageLink( $title ) {
if ( $this->mActive ) { $this->mImageLinks[$title] = 1; }
}
- function addImageLinkObj( $nt )
- {
+ function addImageLinkObj( $nt ) {
if ( $this->mActive ) { $this->mImageLinks[$nt->getDBkey()] = 1; }
}
$this->addCategoryLink( $nt->getDBkey(), $sortkey );
}
- function clearBadLink( $title )
- {
+ function clearBadLink( $title ) {
unset( $this->mBadLinks[$title] );
$this->clearLink( $title );
}
- function clearLink( $title )
- {
+ function clearLink( $title ) {
global $wgMemc, $wgLinkCacheMemcached;
if( $wgLinkCacheMemcached )
$wgMemc->delete( $this->getKey( $title ) );
function getImageLinks() { return $this->mImageLinks; }
function getCategoryLinks() { return $this->mCategoryLinks; }
- function addLink( $title )
- {
+ function addLink( $title ) {
$nt = Title::newFromDBkey( $title );
if( $nt ) {
return $this->addLinkObj( $nt );
}
}
- function addLinkObj( &$nt )
- {
+ function addLinkObj( &$nt ) {
global $wgMemc, $wgLinkCacheMemcached;
$title = $nt->getPrefixedDBkey();
if ( $this->isBadLink( $title ) ) { return 0; }
return $id;
}
- function preFill( &$fromtitle )
- {
+ function preFill( &$fromtitle ) {
global $wgEnablePersistentLC;
$fname = 'LinkCache::preFill';
wfProfileOut( $fname );
}
- function getGoodAdditions()
- {
+ function getGoodAdditions() {
return array_diff( $this->mGoodLinks, $this->mOldGoodLinks );
}
- function getBadAdditions()
- {
+ function getBadAdditions() {
#wfDebug( "mOldBadLinks: " . implode( ', ', array_keys( $this->mOldBadLinks ) ) . "\n" );
#wfDebug( "mBadLinks: " . implode( ', ', array_keys( $this->mBadLinks ) ) . "\n" );
return array_values( array_diff( array_keys( $this->mBadLinks ), array_keys( $this->mOldBadLinks ) ) );
}
- function getImageAdditions()
- {
+ function getImageAdditions() {
return array_diff_assoc( $this->mImageLinks, $this->mOldImageLinks );
}
- function getGoodDeletions()
- {
+ function getGoodDeletions() {
return array_diff( $this->mOldGoodLinks, $this->mGoodLinks );
}
- function getBadDeletions()
- {
+ function getBadDeletions() {
return array_values( array_diff( array_keys( $this->mOldBadLinks ), array_keys( $this->mBadLinks ) ));
}
- function getImageDeletions()
- {
+ function getImageDeletions() {
return array_diff_assoc( $this->mOldImageLinks, $this->mImageLinks );
}
- # Parameters: $which is one of the LINKCACHE_xxx constants, $del and $add are
- # the incremental update arrays which will be filled. Returns whether or not it's
- # worth doing the incremental version. For example, if [[List of mathematical topics]]
- # was blanked, it would take a long, long time to do incrementally.
- function incrementalSetup( $which, &$del, &$add )
- {
+ /**
+ * Parameters:
+ * @param $which is one of the LINKCACHE_xxx constants
+ * @param $del,$add are the incremental update arrays which will be filled.
+ *
+ * @return Returns whether or not it's worth doing the incremental version.
+ *
+ * For example, if [[List of mathematical topics]] was blanked,
+ * it would take a long, long time to do incrementally.
+ */
+ function incrementalSetup( $which, &$del, &$add ) {
if ( ! $this->mPreFilled ) {
return false;
}
return true;
}
- # Clears cache but leaves old preFill copies alone
- function clear()
- {
+ /**
+ * Clears cache but leaves old preFill copies alone
+ */
+ function clear() {
$this->mGoodLinks = array();
$this->mBadLinks = array();
$this->mImageLinks = array();
}
- /* private */ function fillFromLinkscc( $id ){
+ /**
+ * @access private
+ */
+ function fillFromLinkscc( $id ){
$fname = 'LinkCache::fillFromLinkscc';
$id = IntVal( $id );
}
- /* private */ function saveToLinkscc( $pid ){
+ /**
+ * @access private
+ */
+ function saveToLinkscc( $pid ){
global $wgCompressedPersistentLC;
if( $wgCompressedPersistentLC and function_exists( 'gzcompress' ) ) {
$ser = gzcompress( serialize( $this ), 3 );
$db->replace( 'linkscc', array( 'lcc_pageid' ), array( 'lcc_pageid' => $pid, 'lcc_cacheobj' => $ser ) );
}
- # Delete linkscc rows which link to here
- # $pid is a page id
- /* static */ function linksccClearLinksTo( $pid ){
+ /**
+ * Delete linkscc rows which link to here
+ * @param $pid is a page id
+ * @static
+ */
+ function linksccClearLinksTo( $pid ){
global $wgEnablePersistentLC;
if ( $wgEnablePersistentLC ) {
$fname = 'LinkCache::linksccClearLinksTo';
}
- # Delete linkscc rows with broken links to here
- # $title is a prefixed db title, for example like Title->getPrefixedDBkey() returns.
- /* static */ function linksccClearBrokenLinksTo( $title ){
+ /**
+ * Delete linkscc rows with broken links to here
+ * @param $title is a prefixed db title for example like Title->getPrefixedDBkey() returns.
+ * @static
+ */
+ function linksccClearBrokenLinksTo( $title ){
global $wgEnablePersistentLC;
$fname = 'LinkCache::linksccClearBrokenLinksTo';
}
}
- # $pid is a page id
- /* static */ function linksccClearPage( $pid ){
+ /**
+ * @param $pid is a page id
+ * @static
+ */
+ function linksccClearPage( $pid ){
global $wgEnablePersistentLC;
if ( $wgEnablePersistentLC ) {
$pid = intval( $pid );
<?php
-# See deferred.doc
+/**
+ * See deferred.doc
+ */
+/**
+ * @todo document
+ */
class LinksUpdate {
/* private */ var $mId, $mTitle;
<?php
-# Database load balancing object
+/**
+ *
+ */
+/**
+ * Depends on the database object
+ */
require_once( 'Database.php' );
# Valid database indexes
define( 'MASTER_WAIT_TIMEOUT', 15 ); # Time to wait for a slave to synchronise
+/**
+ * Database load balancing object
+ * @todo document
+ */
class LoadBalancer {
/* private */ var $mServers, $mConnections, $mLoads;
/* private */ var $mFailFunction;
}
}
- # Given an array of non-normalised probabilities, this function will select
- # an element and return the appropriate key
+ /**
+ * Given an array of non-normalised probabilities, this function will select
+ * an element and return the appropriate key
+ */
function pickRandom( $weights )
{
if ( !is_array( $weights ) || count( $weights ) == 0 ) {
return $i;
}
- # Set the master wait position
- # If a DB_SLAVE connection has been opened already, waits
- # Otherwise sets a variable telling it to wait if such a connection is opened
+ /**
+ * Set the master wait position
+ * If a DB_SLAVE connection has been opened already, waits
+ * Otherwise sets a variable telling it to wait if such a connection is opened
+ */
function waitFor( $file, $pos ) {
$fname = 'LoadBalancer::waitFor';
wfProfileIn( $fname );
wfProfileOut( $fname );
}
- # Wait for a given slave to catch up to the master pos stored in $this
+ /**
+ * Wait for a given slave to catch up to the master pos stored in $this
+ */
function doWait( $index ) {
global $wgMemc;
return $retVal;
}
- # Get a connection by index
+ /**
+ * Get a connection by index
+ */
function &getConnection( $i, $fail = true )
{
$fname = 'LoadBalancer::getConnection';
return $this->mConnections[$i];
}
- # Open a connection to the server given by the specified index
- # Index must be an actual index into the array
- /* private */ function openConnection( $i, $fail = false ) {
+ /**
+ * Open a connection to the server given by the specified index
+ * Index must be an actual index into the array
+ * @private
+ */
+ function openConnection( $i, $fail = false ) {
$fname = 'LoadBalancer::openConnection';
wfProfileIn( $fname );
wfProfileOut( $fname );
}
- # Test if the specified index represents an open connection
- /* private */ function isOpen( $index ) {
+ /**
+ * Test if the specified index represents an open connection
+ * @private
+ */
+ function isOpen( $index ) {
if( !is_integer( $index ) ) {
return false;
}
}
}
- # Really opens a connection
- /* private */ function reallyOpenConnection( &$server ) {
+ /**
+ * Really opens a connection
+ * @private
+ */
+ function reallyOpenConnection( &$server ) {
extract( $server );
# Get class for this database type
$class = 'Database' . ucfirst( $type );
return array_key_exists( $i, $this->mServers );
}
- # Get the number of defined servers (not the number of open connections)
+ /**
+ * Get the number of defined servers (not the number of open connections)
+ */
function getServerCount() {
return count( $this->mServers );
}
- # Save master pos to the session and to memcached, if the session exists
+ /**
+ * Save master pos to the session and to memcached, if the session exists
+ */
function saveMasterPos() {
global $wgSessionStarted;
if ( $wgSessionStarted && count( $this->mServers ) > 1 ) {
}
}
- # Loads the master pos from the session, waits for it if necessary
+ /**
+ * Loads the master pos from the session, waits for it if necessary
+ */
function loadMasterPos() {
if ( isset( $_SESSION['master_log_file'] ) && isset( $_SESSION['master_pos'] ) ) {
$this->waitFor( $_SESSION['master_log_file'], $_SESSION['master_pos'] );
}
}
- # Close all open connections
+ /**
+ * Close all open connections
+ */
function closeAll() {
foreach( $this->mConnections as $i => $conn ) {
if ( $this->isOpen( $i ) ) {
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# http://www.gnu.org/copyleft/gpl.html
-# Class to simplify the use of log pages.
-# The logs are now kept in a table which is easier to manage and trim
-# than ever-growing wiki pages.
+/**
+ * Contain log classes
+ */
+/**
+ * Class to simplify the use of log pages.
+ * The logs are now kept in a table which is easier to manage and trim
+ * than ever-growing wiki pages.
+ */
class LogPage {
/* private */ var $type, $action, $comment;
var $updateRecentChanges = true;
return true;
}
- /* static */ function validTypes() {
+ /**
+ * @static
+ */
+ function validTypes() {
static $types = array( '', 'block', 'protect', 'rights', 'delete', 'upload' );
return $types;
}
- /* static */ function validActions( $type ) {
+ /**
+ * @static
+ */
+ function validActions( $type ) {
static $actions = array(
'' => NULL,
'block' => array( 'block', 'unblock' ),
return $actions[$type];
}
- /* static */ function isLogType( $type ) {
+ /**
+ * @static
+ */
+ function isLogType( $type ) {
return in_array( $type, LogPage::validTypes() );
}
- /* static */ function logName( $type ) {
+ /**
+ * @static
+ */
+ function logName( $type ) {
static $typeText = array(
'' => 'log',
'block' => 'blocklogpage',
return str_replace( '_', ' ', wfMsg( $typeText[$type] ) );
}
- /* static */ function logHeader( $type ) {
+ /**
+ * @static
+ */
+ function logHeader( $type ) {
static $headerText = array(
'' => 'alllogstext',
'block' => 'blocklogtext',
return wfMsg( $headerText[$type] );
}
- /* static */ function actionText( $type, $action, $titleLink = NULL ) {
+ /**
+ * @static
+ */
+ function actionText( $type, $action, $titleLink = NULL ) {
static $actions = array(
'block/block' => 'blocklogentry',
'block/unblock' => 'blocklogentry',
<?php
+/**
+ * File for magic words
+ */
-# This class encapsulates "magic words" such as #redirect, __NOTOC__, etc.
-# Usage:
-# if (MagicWord::get( MAG_REDIRECT )->match( $text ) )
-#
-# Possible future improvements:
-# * Simultaneous searching for a number of magic words
-# * $wgMagicWords in shared memory
-#
-# Please avoid reading the data out of one of these objects and then writing
-# special case code. If possible, add another match()-like function here.
+/**
+ * private
+ */
+$wgMagicFound = false;
-/*private*/ $wgMagicFound = false;
define('MAG_REDIRECT', 0);
define('MAG_NOTOC', 1);
MAG_NAMESPACE
);
+/**
+ * This class encapsulates "magic words" such as #redirect, __NOTOC__, etc.
+ * Usage:
+ * if (MagicWord::get( MAG_REDIRECT )->match( $text ) )
+ *
+ * Possible future improvements:
+ * * Simultaneous searching for a number of magic words
+ * * $wgMagicWords in shared memory
+ *
+ * Please avoid reading the data out of one of these objects and then writing
+ * special case code. If possible, add another match()-like function here.
+ */
class MagicWord {
/*private*/ var $mId, $mSynonyms, $mCaseSensitive, $mRegex;
/*private*/ var $mRegexStart, $mBaseRegex, $mVariableRegex;
$this->mModified = false;
}
- # Factory: creates an object representing an ID
- /*static*/ function &get( $id ) {
+ /**
+ * Factory: creates an object representing an ID
+ * @static
+ */
+ function &get( $id ) {
global $wgMagicWords;
if ( !is_array( $wgMagicWords ) ) {
$wgLang->getMagic( $this );
}
- # Preliminary initialisation
- /* private */ function initRegex() {
+ /**
+ * Preliminary initialisation
+ * @private
+ */
+ function initRegex() {
$variableClass = Title::legalChars();
$escSyn = array_map( 'preg_quote', $this->mSynonyms );
$this->mBaseRegex = implode( '|', $escSyn );
"/^({$this->mBaseRegex})$/{$case}" );
}
- # Gets a regex representing matching the word
+ /**
+ * Gets a regex representing matching the word
+ */
function getRegex() {
if ($this->mRegex == '' ) {
$this->initRegex();
return $this->mRegex;
}
- # Gets a regex matching the word, if it is at the
- # string start
+ /**
+ * Gets a regex matching the word, if it is at the string start
+ */
function getRegexStart() {
if ($this->mRegex == '' ) {
$this->initRegex();
return $this->mRegexStart;
}
- # regex without the slashes and what not
+ /**
+ * regex without the slashes and what not
+ */
function getBaseRegex() {
if ($this->mRegex == '') {
$this->initRegex();
return $this->mBaseRegex;
}
- # Returns true if the text contains the word
+ /**
+ * Returns true if the text contains the word
+ * @return bool
+ */
function match( $text ) {
return preg_match( $this->getRegex(), $text );
}
- # Returns true if the text starts with the word
+ /**
+ * Returns true if the text starts with the word
+ * @return bool
+ */
function matchStart( $text ) {
return preg_match( $this->getRegexStart(), $text );
}
- # Returns NULL if there's no match, the value of $1 otherwise
- # The return code is the matched string, if there's no variable
- # part in the regex and the matched variable part ($1) if there
- # is one.
+ /**
+ * Returns NULL if there's no match, the value of $1 otherwise
+ * The return code is the matched string, if there's no variable
+ * part in the regex and the matched variable part ($1) if there
+ * is one.
+ */
function matchVariableStartToEnd( $text ) {
$matchcount = preg_match( $this->getVariableStartToEndRegex(), $text, $matches );
if ( $matchcount == 0 ) {
}
- # Returns true if the text matches the word, and alters the
- # input string, removing all instances of the word
+ /**
+ * Returns true if the text matches the word, and alters the
+ * input string, removing all instances of the word
+ */
function matchAndRemove( &$text ) {
global $wgMagicFound;
$wgMagicFound = false;
}
- # Replaces the word with something else
+ /**
+ * Replaces the word with something else
+ */
function replace( $replacement, $subject ) {
$res = preg_replace( $this->getRegex(), $replacement, $subject );
$this->mModified = !($res === $subject);
return $res;
}
- # Variable handling: {{SUBST:xxx}} style words
- # Calls back a function to determine what to replace xxx with
- # Input word must contain $1
+ /**
+ * Variable handling: {{SUBST:xxx}} style words
+ * Calls back a function to determine what to replace xxx with
+ * Input word must contain $1
+ */
function substituteCallback( $text, $callback ) {
$regex = $this->getVariableRegex();
$res = preg_replace_callback( $this->getVariableRegex(), $callback, $text );
return $res;
}
- # Matches the word, where $1 is a wildcard
+ /**
+ * Matches the word, where $1 is a wildcard
+ */
function getVariableRegex() {
if ( $this->mVariableRegex == '' ) {
$this->initRegex();
return $this->mVariableRegex;
}
- # Matches the entire string, where $1 is a wildcard
+ /**
+ * Matches the entire string, where $1 is a wildcard
+ */
function getVariableStartToEndRegex() {
if ( $this->mVariableStartToEndRegex == '' ) {
$this->initRegex();
return $this->mVariableStartToEndRegex;
}
- # Accesses the synonym list directly
+ /**
+ * Accesses the synonym list directly
+ */
function getSynonym( $i ) {
return $this->mSynonyms[$i];
}
- # Returns true if the last call to replace() or substituteCallback()
- # returned a modified text, otherwise false.
+ /**
+ * Returns true if the last call to replace() or substituteCallback()
+ * returned a modified text, otherwise false.
+ */
function getWasModified(){
return $this->mModified;
}
- # $magicarr is an associative array of (magic word ID => replacement)
- # This method uses the php feature to do several replacements at the same time,
- # thereby gaining some efficiency. The result is placed in the out variable
- # $result. The return value is true if something was replaced.
-
- /* static */ function replaceMultiple( $magicarr, $subject, &$result ){
+ /**
+ * $magicarr is an associative array of (magic word ID => replacement)
+ * This method uses the php feature to do several replacements at the same time,
+ * thereby gaining some efficiency. The result is placed in the out variable
+ * $result. The return value is true if something was replaced.
+ * @static
+ **/
+ function replaceMultiple( $magicarr, $subject, &$result ){
$search = array();
$replace = array();
foreach( $magicarr as $id => $replacement ){
return !($result === $subject);
}
- # Adds all the synonyms of this MagicWord to an array, to allow quick lookup in a list of magic words
+ /**
+ * Adds all the synonyms of this MagicWord to an array, to allow quick
+ * lookup in a list of magic words
+ */
function addToArray( &$array, $value ) {
foreach ( $this->mSynonyms as $syn ) {
$array[$syn] = $value;
}
}
-# Used in matchAndRemove()
-/*private*/ function pregRemoveAndRecord( $match ) {
+/**
+ * Used in matchAndRemove()
+ * @private
+ **/
+function pregRemoveAndRecord( $match ) {
global $wgMagicFound;
$wgMagicFound = true;
return '';
<?php
-#
-# Takes LaTeX fragments, sends them to a helper program (texvc) for rendering
-# to rasterized PNG and HTML and MathML approximations. An appropriate
-# rendering form is picked and returned.
-#
-# by Tomasz Wegrzanowski, with additions by Brion Vibber (2003, 2004)
-#
+/**
+ * Contain everything related to <math> </math> parsing
+ */
+/**
+ * Takes LaTeX fragments, sends them to a helper program (texvc) for rendering
+ * to rasterized PNG and HTML and MathML approximations. An appropriate
+ * rendering form is picked and returned.
+ *
+ * by Tomasz Wegrzanowski, with additions by Brion Vibber (2003, 2004)
+ */
class MathRenderer {
var $mode = MW_MATH_MODERN;
var $tex = '';
return false;
}
- # Select among PNG, HTML, or MathML output depending on
+ /**
+ * Select among PNG, HTML, or MathML output depending on
+ */
function _doRender() {
if( $this->mode == MW_MATH_MATHML && $this->mathml != '' ) {
return "<math xmlns='http://www.w3.org/1998/Math/MathML'>{$this->mathml}</math>";
<?php
+/**
+ * This file gets included if $wgSessionsInMemcache is set in the config.
+ * It redirects session handling functions to store their data in memcached
+ * instead of the local filesystem. Depending on circumstances, it may also
+ * be necessary to change the cookie settings to work across hostnames.
+ * See: http://www.php.net/manual/en/function.session-set-save-handler.php
+ */
-/*
- This file gets included if $wgSessionsInMemcache is set in the config.
- It redirects session handling functions to store their data in memcached
- instead of the local filesystem. Depending on circumstances, it may also
- be necessary to change the cookie settings to work across hostnames.
-
- See: http://www.php.net/manual/en/function.session-set-save-handler.php
-*/
-
-
+/**
+ * @todo document
+ */
function memsess_key( $id ) {
global $wgDBname;
return "$wgDBname:session:$id";
}
+/**
+ * @todo document
+ */
function memsess_open( $save_path, $session_name ) {
# NOP, $wgMemc should be set up already
return true;
}
+/**
+ * @todo document
+ */
function memsess_close() {
# NOP
return true;
}
+/**
+ * @todo document
+ */
function memsess_read( $id ) {
global $wgMemc;
$data = $wgMemc->get( memsess_key( $id ) );
return $data;
}
+/**
+ * @todo document
+ */
function memsess_write( $id, $data ) {
global $wgMemc;
$wgMemc->set( memsess_key( $id ), $data, 3600 );
return true;
}
+/**
+ * @todo document
+ */
function memsess_destroy( $id ) {
global $wgMemc;
$wgMemc->delete( memsess_key( $id ) );
return true;
}
+/**
+ * @todo document
+ */
function memsess_gc( $maxlifetime ) {
# NOP: Memcached performs garbage collection.
return true;
<?php
+/**
+ *
+ */
-# Message cache
-# Performs various useful MediaWiki namespace-related functions
-
+/**
+ *
+ */
define( 'MSG_LOAD_TIMEOUT', 60);
define( 'MSG_LOCK_TIMEOUT', 10);
define( 'MSG_WAIT_TIMEOUT', 10);
+/**
+ * Message cache
+ * Performs various useful MediaWiki namespace-related functions
+ */
class MessageCache
{
var $mCache, $mUseCache, $mDisable, $mExpiry;
wfProfileOut( $fname );
}
- # Loads messages either from memcached or the database, if not disabled
- # On error, quietly switches to a fallback mode
- # Returns false for a reportable error, true otherwise
+ /**
+ * Loads messages either from memcached or the database, if not disabled
+ * On error, quietly switches to a fallback mode
+ * Returns false for a reportable error, true otherwise
+ */
function load() {
global $wgAllMessagesEn;
return $success;
}
- # Loads all cacheable messages from the database
- function loadFromDB()
- {
+ /**
+ * Loads all cacheable messages from the database
+ */
+ function loadFromDB() {
$fname = 'MessageCache::loadFromDB';
$dbr =& wfGetDB( DB_SLAVE );
$res = $dbr->select( 'cur',
$dbr->freeResult( $res );
}
- # Not really needed anymore
+ /**
+ * Not really needed anymore
+ */
function getKeys() {
global $wgAllMessagesEn, $wgLang;
if ( !$this->mKeys ) {
return $this->mKeys;
}
- # Obsolete
+ /**
+ * Obsolete
+ */
function isCacheable( $key ) {
return true;
/*
$this->unlock();
}
- # Returns success
- # Represents a write lock on the messages key
+ /**
+ * Returns success
+ * Represents a write lock on the messages key
+ */
function lock() {
if ( !$this->mUseCache ) {
return true;
}
}
- # Clear all stored messages. Mainly used after a mass rebuild.
+ /**
+ * Clear all stored messages. Mainly used after a mass rebuild.
+ */
function clear() {
if( $this->mUseCache ) {
$this->mMemc->delete( $this->mMemcKey );
<?php
-/* Metadata.php -- provides DublinCore and CreativeCommons metadata
+/**
+ * Metadata.php -- provides DublinCore and CreativeCommons metadata
* Copyright 2004, Evan Prodromou <evan@wikitravel.org>.
*
* This program is free software; you can redistribute it and/or modify
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * @author Evan Prodromou <evan@wikitravel.org>
*/
+/**
+ *
+ */
define('RDF_TYPE_PREFS', "application/rdf+xml,text/xml;q=0.7,application/xml;q=0.5,text/rdf;q=0.1");
function wfDublinCoreRdf($article) {
ccEpilogue();
}
-/* private */ function rdfSetup() {
+/**
+ * @private
+ */
+function rdfSetup() {
global $wgOut, $wgRdfMimeType, $_SERVER;
$rdftype = wfNegotiateType(wfAcceptToPrefs($_SERVER['HTTP_ACCEPT']), wfAcceptToPrefs(RDF_TYPE_PREFS));
}
}
-/* private */ function dcPrologue($url) {
+/**
+ * @private
+ */
+function dcPrologue($url) {
global $wgOutputEncoding;
$url = htmlspecialchars( $url );
";
}
-/* private */ function dcEpilogue() {
+/**
+ * @private
+ */
+function dcEpilogue() {
print "
</rdf:Description>
</rdf:RDF>
";
}
-/* private */ function dcBasics($article) {
+/**
+ * @private
+ */
+function dcBasics($article) {
global $wgLanguageCode, $wgSitename;
dcElement('title', $article->mTitle->getText());
dcRights($article);
}
-/* private */ function ccPrologue() {
+/**
+ * @private
+ */
+function ccPrologue() {
global $wgOutputEncoding;
echo "<" . "?xml version='1.0' encoding='{$wgOutputEncoding}' ?" . ">
";
}
-/* private */ function ccSubPrologue($type, $url) {
+/**
+ * @private
+ */
+function ccSubPrologue($type, $url) {
$url = htmlspecialchars( $url );
echo " <cc:{$type} rdf:about=\"{$url}\">\n";
}
-/* private */ function ccSubEpilogue($type) {
+/**
+ * @private
+ */
+function ccSubEpilogue($type) {
echo " </cc:{$type}>\n";
}
-/* private */ function ccLicense($terms) {
+/**
+ * @private
+ */
+function ccLicense($terms) {
foreach ($terms as $term) {
switch ($term) {
}
}
-/* private */ function ccTerm($term, $name) {
+/**
+ * @private
+ */
+function ccTerm($term, $name) {
print " <cc:{$term} rdf:resource=\"http://web.resource.org/cc/{$name}\" />\n";
}
-/* private */ function ccEpilogue() {
+/**
+ * @private
+ */
+function ccEpilogue() {
echo "</rdf:RDF>\n";
}
-/* private */ function dcElement($name, $value) {
+/**
+ * @private
+ */
+function dcElement($name, $value) {
$value = htmlspecialchars( $value );
print " <dc:{$name}>{$value}</dc:{$name}>\n";
}
-/* private */ function dcDate($timestamp) {
+/**
+ * @private
+ */
+function dcDate($timestamp) {
return substr($timestamp, 0, 4) . '-'
. substr($timestamp, 4, 2) . '-'
. substr($timestamp, 6, 2);
}
-/* private */ function dcReallyFullUrl($title) {
+/**
+ * @private
+ */
+function dcReallyFullUrl($title) {
return $title->getFullURL();
}
-/* private */ function dcPageOrString($name, $page, $str) {
+/**
+ * @private
+ */
+function dcPageOrString($name, $page, $str) {
$nt = Title::newFromText($page);
if (!$nt || $nt->getArticleID() == 0) {
}
}
-/* private */ function dcPage($name, $title) {
+/**
+ * @private
+ */
+function dcPage($name, $title) {
dcUrl($name, dcReallyFullUrl($title));
}
-/* private */ function dcUrl($name, $url) {
+/**
+ * @private
+ */
+function dcUrl($name, $url) {
$url = htmlspecialchars( $url );
print " <dc:{$name} rdf:resource=\"{$url}\" />\n";
}
-/* private */ function dcPerson($name, $id, $user_name='', $user_real_name='') {
+/**
+ * @private
+ */
+function dcPerson($name, $id, $user_name='', $user_real_name='') {
global $wgLang;
if ($id == 0) {
}
}
-/* Takes an arg, for future enhancement with different rights for
- different pages. */
-
-/* private */ function dcRights($article) {
+/**
+ * Takes an arg, for future enhancement with different rights for
+ * different pages.
+ * @private
+ */
+function dcRights($article) {
global $wgRightsPage, $wgRightsUrl, $wgRightsText;
}
}
-/* private */ function ccGetTerms($url) {
+/**
+ * @private
+ */
+function ccGetTerms($url) {
global $wgLicenseTerms;
if (isset($wgLicenseTerms)) {
}
}
-/* private */ function getKnownLicenses() {
+/**
+ * @private
+ */
+function getKnownLicenses() {
$ccLicenses = array('by', 'by-nd', 'by-nd-nc', 'by-nc',
'by-nc-sa', 'by-sa');
<?php
-
-# This is not a valid entry point, perform no further processing unless MEDIAWIKI is defined
+/**
+ * Provide things related to namespaces
+ */
+
+/**
+ * This is not a valid entry point, perform no further processing unless MEDIAWIKI is defined
+ */
if( defined( 'MEDIAWIKI' ) ) {
-# This is a utility class with only static functions
-# for dealing with namespaces that encodes all the
-# "magic" behaviors of them based on index. The textual
-# names of the namespaces are handled by Language.php.
-
-# Definitions of the NS_ constants are in Defines.php
-
-# These are synonyms for the names given in the language file
-# Users and translators should not change them
-/* private */ $wgCanonicalNamespaceNames = array(
+
+/**
+ * Definitions of the NS_ constants are in Defines.php
+ * @private
+ */
+$wgCanonicalNamespaceNames = array(
NS_MEDIA => 'Media',
NS_SPECIAL => 'Special',
NS_TALK => 'Talk',
$wgCanonicalNamespaceNames=$wgCanonicalNamespaceNames+$wgExtraNamespaces;
}
+/**
+ * This is a utility class with only static functions
+ * for dealing with namespaces that encodes all the
+ * "magic" behaviors of them based on index. The textual
+ * names of the namespaces are handled by Language.php.
+ *
+ * These are synonyms for the names given in the language file
+ * Users and translators should not change them
+*/
class Namespace {
- /* These functions are deprecated */
+ /**#@+
+ * These functions are deprecated
+ * @deprecated
+ */
function getSpecial() { return NS_SPECIAL; }
function getUser() { return NS_USER; }
function getWikipedia() { return NS_PROJECT; }
function getImage() { return NS_IMAGE; }
function getMedia() { return NS_MEDIA; }
function getCategory() { return NS_CATEGORY; }
+ /**#@-*/
- function isMovable( $index )
- {
+ /**
+ * Check if the given namespace might be moved
+ * @return bool
+ */
+ function isMovable( $index ) {
if ( $index < NS_MAIN || $index == NS_IMAGE || $index == NS_CATEGORY ) {
return false;
}
return true;
}
- function isTalk( $index )
- {
+ /**
+ * Check if the give namespace is a talk page
+ * @return bool
+ */
+ function isTalk( $index ) {
global $wgExtraNamespaces;
return ( $index == NS_TALK || $index == NS_USER_TALK ||
$index == NS_PROJECT_TALK || $index == NS_IMAGE_TALK ||
}
- # Get the talk namespace corresponding to the given index
- #
- function getTalk( $index )
- {
+ /**
+ * Get the talk namespace corresponding to the given index
+ */
+ function getTalk( $index ) {
if ( Namespace::isTalk( $index ) ) {
return $index;
} else {
}
}
- function getSubject( $index )
- {
+ function getSubject( $index ) {
if ( Namespace::isTalk( $index ) ) {
return $index - 1;
} else {
}
}
- # Returns the canonical (English Wikipedia) name for a given index
- function &getCanonicalName( $index )
- {
+ /**
+ * Returns the canonical (English Wikipedia) name for a given index
+ */
+ function &getCanonicalName( $index ) {
global $wgCanonicalNamespaceNames;
return $wgCanonicalNamespaceNames[$index];
}
- # Returns the index for a given canonical name, or NULL
- # The input *must* be converted to lower case first
- function &getCanonicalIndex( $name )
- {
+ /**
+ * Returns the index for a given canonical name, or NULL
+ * The input *must* be converted to lower case first
+ */
+ function &getCanonicalIndex( $name ) {
global $wgCanonicalNamespaceNames;
static $xNamespaces = false;
if ( $xNamespaces === false ) {
# with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# http://www.gnu.org/copyleft/gpl.html
-
-# Simple generic object store
-# interface is intended to be more or less compatible with
-# the PHP memcached client.
-#
-# backends for local hash array and SQL table included:
-# $bag = new HashBagOStuff();
-# $bag = new MysqlBagOStuff($tablename); # connect to db first
-
-class /* abstract */ BagOStuff {
+/**
+ *
+ */
+
+/**
+ * Simple generic object store
+ *
+ * interface is intended to be more or less compatible with
+ * the PHP memcached client.
+ *
+ * backends for local hash array and SQL table included:
+ * $bag = new HashBagOStuff();
+ * $bag = new MysqlBagOStuff($tablename); # connect to db first
+ *
+ * @abstract
+ */
+class BagOStuff {
var $debugmode;
function BagOStuff() {
}
-/* Functional versions! */
+/**
+ * Functional versions!
+ * @todo document
+ */
class HashBagOStuff extends BagOStuff {
/*
This is a test of the interface, mainly. It stores
key (exptime)
);
*/
-class /* abstract */ SqlBagOStuff extends BagOStuff {
+
+/**
+ * @todo document
+ * @abstract
+ */
+class SqlBagOStuff extends BagOStuff {
var $table;
function SqlBagOStuff($tablename = 'objectcache') {
}
}
+/**
+ * @todo document
+ */
class MediaWikiBagOStuff extends SqlBagOStuff {
var $tableInitialised = false;
}
}
+/**
+ * @todo document
+ */
class TurckBagOStuff extends BagOStuff {
function get($key) {
return mmcache_get( $key );
<?php
+/**
+ *
+ */
-# This is not a valid entry point, perform no further processing unless MEDIAWIKI is defined
+/**
+ * This is not a valid entry point, perform no further processing unless MEDIAWIKI is defined
+ */
if( defined( 'MEDIAWIKI' ) ) {
# See design.doc
define( 'RLH_FOR_UPDATE', 1 );
+/**
+ * @todo document
+ */
class OutputPage {
var $mHeaders, $mCookies, $mMetatags, $mKeywords;
var $mLinktags, $mPagetitle, $mBodytext, $mDebugtext;
$haveMeta = true;
}
- # checkLastModified tells the client to use the client-cached page if
- # possible. If sucessful, the OutputPage is disabled so that
- # any future call to OutputPage->output() have no effect. The method
- # returns true iff cache-ok headers was sent.
+ /**
+ * checkLastModified tells the client to use the client-cached page if
+ * possible. If sucessful, the OutputPage is disabled so that
+ * any future call to OutputPage->output() have no effect. The method
+ * returns true iff cache-ok headers was sent.
+ */
function checkLastModified ( $timestamp )
{
global $wgLang, $wgCachePages, $wgUser;
return wfSetVar( $this->mParserOptions, $options );
}
- # Convert wikitext to HTML and add it to the buffer
- #
+ /**
+ * Convert wikitext to HTML and add it to the buffer
+ */
function addWikiText( $text, $linestart = true )
{
global $wgParser, $wgTitle;
$this->addHTML( $parserOutput->getText() );
}
- # Add wikitext to the buffer, assuming that this is the primary text for a page view
- # Saves the text into the parser cache if possible
- #
+ /**
+ * Add wikitext to the buffer, assuming that this is the primary text for a page view
+ * Saves the text into the parser cache if possible
+ */
function addPrimaryWikiText( $text, $cacheArticle ) {
global $wgParser, $wgParserCache, $wgUser, $wgTitle;
}
}
- # Set the maximum cache time on the Squid in seconds
+ /**
+ * Set the maximum cache time on the Squid in seconds
+ */
function setSquidMaxage( $maxage ) {
$this->mSquidMaxage = $maxage;
}
- # Use enableClientCache(false) to force it to send nocache headers
+ /**
+ * Use enableClientCache(false) to force it to send nocache headers
+ */
function enableClientCache( $state ) {
return wfSetVar( $this->mEnableClientCache, $state );
}
}
}
- # Finally, all the text has been munged and accumulated into
- # the object, let's actually output it:
- #
+ /**
+ * Finally, all the text has been munged and accumulated into
+ * the object, let's actually output it:
+ */
function output()
{
global $wgUser, $wgLang, $wgDebugComments, $wgCookieExpiration;
# flush();
}
- function out( $ins )
- {
+ function out( $ins ) {
global $wgInputEncoding, $wgOutputEncoding, $wgLang;
if ( 0 == strcmp( $wgInputEncoding, $wgOutputEncoding ) ) {
$outs = $ins;
print $outs;
}
- function setEncodings()
- {
+ function setEncodings() {
global $wgInputEncoding, $wgOutputEncoding;
global $wgUser, $wgLang;
$wgOutputEncoding = $wgInputEncoding;
}
- # Returns a HTML comment with the elapsed time since request.
- # This method has no side effects.
- function reportTime()
- {
+ /**
+ * Returns a HTML comment with the elapsed time since request.
+ * This method has no side effects.
+ */
+ function reportTime() {
global $wgRequestTime;
$now = wfTime();
return $com;
}
- # Note: these arguments are keys into wfMsg(), not text!
- #
- function errorpage( $title, $msg )
- {
+ /**
+ * Note: these arguments are keys into wfMsg(), not text!
+ */
+ function errorpage( $title, $msg ) {
global $wgTitle;
$this->mDebugtext .= 'Original title: ' .
wfErrorExit();
}
- function sysopRequired()
- {
+ function sysopRequired() {
global $wgUser;
$this->setPageTitle( wfMsg( 'sysoptitle' ) );
$this->returnToMain();
}
- function developerRequired()
- {
+ function developerRequired() {
global $wgUser;
$this->setPageTitle( wfMsg( 'developertitle' ) );
$this->returnToMain();
}
- function loginToUse()
- {
+ function loginToUse() {
global $wgUser, $wgTitle, $wgLang;
$this->setPageTitle( wfMsg( 'loginreqtitle' ) );
$this->returnToMain(); # Flip back to the main page after 10 seconds.
}
- function databaseError( $fname, $sql, $error, $errno )
- {
+ function databaseError( $fname, $sql, $error, $errno ) {
global $wgUser, $wgCommandLineMode;
$this->setPageTitle( wfMsgNoDB( 'databaseerror' ) );
wfErrorExit();
}
- function readOnlyPage( $source = null, $protected = false )
- {
+ function readOnlyPage( $source = null, $protected = false ) {
global $wgUser, $wgReadOnlyFile;
$this->setRobotpolicy( 'noindex,nofollow' );
$this->returnToMain( false );
}
- function fatalError( $message )
- {
+ function fatalError( $message ) {
$this->setPageTitle( wfMsg( "internalerror" ) );
$this->setRobotpolicy( "noindex,nofollow" );
$this->setArticleRelated( false );
wfErrorExit();
}
- function unexpectedValueError( $name, $val )
- {
+ function unexpectedValueError( $name, $val ) {
$this->fatalError( wfMsg( 'unexpected', $name, $val ) );
}
- function fileCopyError( $old, $new )
- {
+ function fileCopyError( $old, $new ) {
$this->fatalError( wfMsg( 'filecopyerror', $old, $new ) );
}
- function fileRenameError( $old, $new )
- {
+ function fileRenameError( $old, $new ) {
$this->fatalError( wfMsg( 'filerenameerror', $old, $new ) );
}
- function fileDeleteError( $name )
- {
+ function fileDeleteError( $name ) {
$this->fatalError( wfMsg( 'filedeleteerror', $name ) );
}
- function fileNotFoundError( $name )
- {
+ function fileNotFoundError( $name ) {
$this->fatalError( wfMsg( 'filenotfound', $name ) );
}
- // return from error messages or notes
- // auto: automatically redirect the user after 10 seconds
- // returnto: page title to return to. Default is Main Page.
- function returnToMain( $auto = true, $returnto = NULL )
- {
+ /**
+ * return from error messages or notes
+ * @param $auto automatically redirect the user after 10 seconds
+ * @param $returnto page title to return to. Default is Main Page.
+ */
+ function returnToMain( $auto = true, $returnto = NULL ) {
global $wgUser, $wgOut, $wgRequest;
if ( $returnto == NULL ) {
$wgOut->addHTML( "\n<p>$r</p>\n" );
}
- # This function takes the existing and broken links for the page
- # and uses the first 10 of them for META keywords
- function addMetaTags ()
- {
+ /**
+ * This function takes the existing and broken links for the page
+ * and uses the first 10 of them for META keywords
+ */
+ function addMetaTags () {
global $wgLinkCache , $wgOut ;
$good = array_keys ( $wgLinkCache->mGoodLinks ) ;
$bad = array_keys ( $wgLinkCache->mBadLinks ) ;
$wgOut->addMeta ( 'KEYWORDS' , $a ) ;
}
- /* private */ function headElement()
- {
+ /**
+ * @private
+ */
+ function headElement() {
global $wgDocType, $wgDTD, $wgLanguageCode, $wgOutputEncoding, $wgMimeType;
global $wgUser, $wgLang, $wgRequest;
return $ret;
}
- # Run any necessary pre-output transformations on the buffer text
- function transformBuffer( $options = 0 )
- {
+ /**
+ * Run any necessary pre-output transformations on the buffer text
+ */
+ function transformBuffer( $options = 0 ) {
$this->replaceLinkHolders( $this->mBodytext, $options );
}
- # Replace <!--LINK--> link placeholders with actual links, in the buffer
- # Placeholders created in Skin::makeLinkObj()
- # Returns an array of links found, indexed by PDBK:
- # 0 - broken
- # 1 - normal link
- # 2 - stub
- # $options is a bit field, RLH_FOR_UPDATE to select for update
+ /**
+ * Replace <!--LINK--> link placeholders with actual links, in the buffer
+ * Placeholders created in Skin::makeLinkObj()
+ * Returns an array of links found, indexed by PDBK:
+ * 0 - broken
+ * 1 - normal link
+ * 2 - stub
+ * $options is a bit field, RLH_FOR_UPDATE to select for update
+ */
function replaceLinkHolders( &$text, $options = 0 ) {
global $wgUser, $wgLinkCache, $wgUseOldExistenceCheck;
<?php
-
-/* Page history
- Split off from Article.php and Skin.php, 2003-12-22
-*/
-
+/**
+ * Page history
+ *
+ * Split off from Article.php and Skin.php, 2003-12-22
+ */
+
+/**
+ * @todo document
+ */
class PageHistory {
var $mArticle, $mTitle, $mSkin;
var $lastline, $lastdate;
# This shares a lot of issues (and code) with Recent Changes
- function history()
- {
+ function history() {
global $wgUser, $wgOut, $wgLang;
# If page hasn't changed, client can cache this
wfProfileOut( $fname );
}
- function beginHistoryList()
- {
+ function beginHistoryList() {
global $wgTitle;
$this->lastdate = $this->lastline = '';
$s = '<p>' . wfMsg( 'histlegend' ) . '</p>';
return $s;
}
- function endHistoryList( $skip = false )
- {
+ function endHistoryList( $skip = false ) {
$last = wfMsg( 'last' );
$s = $skip ? '' : preg_replace( "/!OLDID![0-9]+!/", $last, $this->lastline );
return $s;
}
- function historyLine( $ts, $u, $ut, $ns, $ttl, $oid, $c, $isminor, $counter = '' )
- {
+ function historyLine( $ts, $u, $ut, $ns, $ttl, $oid, $c, $isminor, $counter = '' ) {
global $wgLang;
$artname = Title::makeName( $ns, $ttl );
// require_once('Tokenizer.php');
-# PHP Parser
-#
-# Processes wiki markup
-#
-# There are two main entry points into the Parser class:
-# parse()
-# produces HTML output
-# preSaveTransform().
-# produces altered wiki markup.
-#
-# Globals used:
-# objects: $wgLang, $wgDateFormatter, $wgLinkCache, $wgCurParser
-#
-# NOT $wgArticle, $wgUser or $wgTitle. Keep them away!
-#
-# settings:
-# $wgUseTex*, $wgUseDynamicDates*, $wgInterwikiMagic*,
-# $wgNamespacesWithSubpages, $wgLanguageCode, $wgAllowExternalImages*,
-# $wgLocaltimezone
-#
-# * only within ParserOptions
-#
-#----------------------------------------
-# Variable substitution O(N^2) attack
-#-----------------------------------------
-# Without countermeasures, it would be possible to attack the parser by saving
-# a page filled with a large number of inclusions of large pages. The size of
-# the generated page would be proportional to the square of the input size.
-# Hence, we limit the number of inclusions of any given page, thus bringing any
-# attack back to O(N).
+/**
+ * PHP Parser
+ *
+ * Processes wiki markup
+ *
+ * There are two main entry points into the Parser class:
+ * parse()
+ * produces HTML output
+ * preSaveTransform().
+ * produces altered wiki markup.
+ *
+ * Globals used:
+ * objects: $wgLang, $wgDateFormatter, $wgLinkCache, $wgCurParser
+ *
+ * NOT $wgArticle, $wgUser or $wgTitle. Keep them away!
+ *
+ * settings:
+ * $wgUseTex*, $wgUseDynamicDates*, $wgInterwikiMagic*,
+ * $wgNamespacesWithSubpages, $wgLanguageCode, $wgAllowExternalImages*,
+ * $wgLocaltimezone
+ *
+ * * only within ParserOptions
+ *
+ */
+
+/**
+ * Variable substitution O(N^2) attack
+ *
+* Without countermeasures, it would be possible to attack the parser by saving
+* a page filled with a large number of inclusions of large pages. The size of
+* the generated page would be proportional to the square of the input size.
+* Hence, we limit the number of inclusions of any given page, thus bringing any
+* attack back to O(N).
+*/
define( 'MAX_INCLUDE_REPEAT', 100 );
define( 'MAX_INCLUDE_SIZE', 1000000 ); // 1 Million
'('.EXT_IMAGE_FNAME_CLASS.'+)\\.((?i)'.EXT_IMAGE_EXTENSIONS.')$/S' # Filename
);
+/**
+ * @todo document
+ */
class Parser
{
# Persistent:
}
}
+/**
+ * @todo document
+ */
class ParserOutput
{
var $mText, $mLanguageLinks, $mCategoryLinks, $mContainsOldMagic;
}
+/**
+ * Set options of the Parser
+ * @todo document
+ */
class ParserOptions
{
# All variables are private
return $wgCurParser->variableSubstitution( $matches );
}
-# Return the total number of articles
+/**
+ * Return the total number of articles
+ */
function wfNumberOfArticles() {
global $wgNumberOfArticles;
return $wgNumberOfArticles;
}
-# Get various statistics from the database
-/* private */ function wfLoadSiteStats() {
+/**
+ * Get various statistics from the database
+ * @private
+ */
+function wfLoadSiteStats() {
global $wgNumberOfArticles, $wgTotalViews, $wgTotalEdits;
$fname = 'wfLoadSiteStats';
<?php
+/**
+ *
+ */
+/**
+ *
+ */
class ParserCache
{
function getKey( &$article, &$user ) {
<?
-# This should one day become the XML->(X)HTML parser
-# Based on work by Jan Hidders and Magnus Manske
+/**
+ * This should one day become the XML->(X)HTML parser
+ * Based on work by Jan Hidders and Magnus Manske
+ */
-// the base class for an element
+/**
+ * the base class for an element
+ */
class element {
var $name = '';
var $attrs = array();
}
-# Here's the class that generates a nice tree
+/**
+ * Here's the class that generates a nice tree
+ * package parserxml
+ */
class xml2php {
function &scanFile( $filename ) {
<?php
-# This file is only included if profiling is enabled
-function wfProfileIn( $functionname )
-{
+/**
+ * This file is only included if profiling is enabled
+ */
+
+/**
+ * @param $functioname name of the function we will profile
+ */
+function wfProfileIn( $functionname ) {
global $wgProfiler;
$wgProfiler->profileIn( $functionname );
}
-function wfProfileOut( $functionname = 'missing' )
-{
+/**
+ * @param $functioname name of the function we have profiled
+ */
+function wfProfileOut( $functionname = 'missing' ) {
global $wgProfiler;
$wgProfiler->profileOut( $functionname );
}
return $wgProfiler->getOutput( $start, $elapsed );
}
-function wfProfileClose()
-{
+function wfProfileClose() {
global $wgProfiler;
$wgProfiler->close();
}
}
}
+/**
+ * @todo document
+ */
class Profiler
{
var $mStack = array(), $mWorkStack = array(), $mCollated = array();
}
*/
- function profileIn( $functionname )
- {
+ function profileIn( $functionname ) {
global $wgDebugFunctionEntry;
if ( $wgDebugFunctionEntry && function_exists( 'wfDebug' ) ) {
wfDebug( str_repeat( ' ', count( $this->mWorkStack ) ) . 'Entering '.$functionname."\n" );
array_push( $this->mWorkStack, array($functionname, count( $this->mWorkStack ), microtime(), memory_get_usage() ) );
}
- function profileOut( $functionname )
- {
+ function profileOut( $functionname ) {
$memory = memory_get_usage();
global $wgDebugProfiling, $wgDebugFunctionEntry;
}
}
- function close()
- {
+ function close() {
while ( count( $this->mWorkStack ) ) {
$this->profileOut( 'close' );
}
}
- function getOutput()
- {
+ function getOutput() {
global $wgDebugFunctionEntry;
$wgDebugFunctionEntry = false;
}
- /* static */ function logToDB($name, $timeSum, $eventCount)
- {
+ /**
+ * @static
+ */
+ function logToDB($name, $timeSum, $eventCount) {
$dbw =& wfGetDB( DB_MASTER );
$profiling = $dbw->tableName( 'profiling' );
<?php
+/**
+ * Contain a class for special pages
+ */
+/**
+ *
+ */
require_once ( 'Feed.php' );
-# This is a class for doing query pages; since they're almost all the same,
-# we factor out some of the functionality into a superclass, and let
-# subclasses derive from it.
-
+/**
+ * This is a class for doing query pages; since they're almost all the same,
+ * we factor out some of the functionality into a superclass, and let
+ * subclasses derive from it.
+ *
+ */
class QueryPage {
- # Subclasses return their name here. Make sure the name is also
- # specified in SpecialPage.php and in Language.php as a language message param.
-
+
+ /**
+ * Subclasses return their name here. Make sure the name is also
+ * specified in SpecialPage.php and in Language.php as a language message
+ * param.
+ */
function getName() {
return '';
}
- # Subclasses return an SQL query here.
- #
- # Note that the query itself should return the following four columns:
- # 'type' (your special page's name), 'namespace', 'title', and 'value'
- # *in that order*. 'value' is used for sorting.
- #
- # These may be stored in the querycache table for expensive queries,
- # and that cached data will be returned sometimes, so the presence of
- # extra fields can't be relied upon. The cached 'value' column will be
- # an integer; non-numeric values are useful only for sorting the initial
- # query.
- #
- # Don't include an ORDER or LIMIT clause, this will be added.
-
+ /**
+ * Subclasses return an SQL query here.
+ *
+ * Note that the query itself should return the following four columns:
+ * 'type' (your special page's name), 'namespace', 'title', and 'value'
+ * *in that order*. 'value' is used for sorting.
+ *
+ * These may be stored in the querycache table for expensive queries,
+ * and that cached data will be returned sometimes, so the presence of
+ * extra fields can't be relied upon. The cached 'value' column will be
+ * an integer; non-numeric values are useful only for sorting the initial
+ * query.
+ *
+ * Don't include an ORDER or LIMIT clause, this will be added.
+ */
function getSQL() {
return "SELECT 'sample' as type, 0 as namespace, 'Sample result' as title, 42 as value";
}
- # Override to sort by increasing values
+ /**
+ * Override to sort by increasing values
+ */
function sortDescending() {
return true;
}
($this->sortDescending() ? 'DESC' : '');
}
- # Is this query expensive (for some definition of expensive)? Then we
- # don't let it run in miser mode. $wgDisableQueryPages causes all query
- # pages to be declared expensive. Some query pages are always expensive.
+ /**
+ * Is this query expensive (for some definition of expensive)? Then we
+ * don't let it run in miser mode. $wgDisableQueryPages causes all query
+ * pages to be declared expensive. Some query pages are always expensive.
+ */
function isExpensive( ) {
global $wgDisableQueryPages;
return $wgDisableQueryPages;
}
- # Formats the results of the query for display. The skin is the current
- # skin; you can use it for making links. The result is a single row of
- # result data. You should be able to grab SQL results off of it.
-
+ /**
+ * Formats the results of the query for display. The skin is the current
+ * skin; you can use it for making links. The result is a single row of
+ * result data. You should be able to grab SQL results off of it.
+ */
function formatResult( $skin, $result ) {
return '';
}
- # The content returned by this function will be output before any result
-
+ /**
+ * The content returned by this function will be output before any result
+ */
function getPageHeader( ) {
return '';
}
- # This is the actual workhorse. It does everything needed to make a
- # real, honest-to-gosh query page.
-
+ /**
+ * This is the actual workhorse. It does everything needed to make a
+ * real, honest-to-gosh query page.
+ *
+ * @param $offset database query offset
+ * @param $limit database query limit
+ */
function doQuery( $offset, $limit ) {
global $wgUser, $wgOut, $wgLang, $wgRequest;
global $wgMiserMode;
$wgOut->addHTML( "<p>{$sl}</p>\n" );
}
- # Similar to above, but packaging in a syndicated feed instead of a web page
+ /**
+ * Similar to above, but packaging in a syndicated feed instead of a web page
+ */
function doFeed( $class = '' ) {
global $wgFeedClasses;
global $wgOut, $wgLanguageCode, $wgLang;
}
}
- # Override for custom handling. If the titles/links are ok, just do feedItemDesc()
+ /**
+ * Override for custom handling. If the titles/links are ok, just do
+ * feedItemDesc()
+ */
function feedResult( $row ) {
if( !isset( $row->title ) ) {
return NULL;
}
}
-# This is a subclass for very simple queries that are just looking for page
-# titles that match some criteria. It formats each result item as a link to
-# that page.
-
+/**
+ * This is a subclass for very simple queries that are just looking for page
+ * titles that match some criteria. It formats each result item as a link to
+ * that page.
+ */
class PageQueryPage extends QueryPage {
function formatResult( $skin, $result ) {
<?php
-# Copyright (C) 2004 Gabriel Wicke <gw@wikidev.net>
-# http://www.aulinx.de/
-# Based on PageHistory and SpecialExport
-#
-# License: GPL (http://www.gnu.org/copyleft/gpl.html)
+/**
+ * Copyright (C) 2004 Gabriel Wicke <gw@wikidev.net>
+ * http://www.aulinx.de/
+ * Based on PageHistory and SpecialExport
+ *
+ * License: GPL (http://www.gnu.org/copyleft/gpl.html)
+ *
+ * @author Gabriel Wicke <gw@wikidev.net>
+ */
+/**
+ * @todo document
+ */
class RawPage {
function RawPage( $article ) {
$this->mContentType = $ctype;
}
}
+
function view() {
global $wgUser, $wgOut;
header( "Content-type: ".$this->mContentType.'; charset='.$this->mCharset );
<?php
-# Utility class for creating new RC entries
+/**
+ *
+ */
+/**
+ * Various globals
+ */
define( 'RC_EDIT', 0);
define( 'RC_NEW', 1);
define( 'RC_MOVE', 2);
define( 'RC_MOVE_OVER_REDIRECT', 4);
-/*
-mAttributes:
- rc_id id of the row in the recentchanges table
- rc_timestamp time the entry was made
- rc_cur_time timestamp on the cur row
- rc_namespace namespace #
- rc_title non-prefixed db key
- rc_type is new entry, used to determine whether updating is necessary
- rc_minor is minor
- rc_cur_id id of associated cur entry
- rc_user user id who made the entry
- rc_user_text user name who made the entry
- rc_comment edit summary
- rc_this_oldid old_id associated with this entry (or zero)
- rc_last_oldid old_id associated with the entry before this one (or zero)
- rc_bot is bot, hidden
- rc_ip IP address of the user in dotted quad notation
- rc_new obsolete, use rc_type==RC_NEW
- rc_patrolled boolean whether or not someone has marked this edit as patrolled
-
-mExtra:
- prefixedDBkey prefixed db key, used by external app via msg queue
- lastTimestamp timestamp of previous entry, used in WHERE clause during update
- lang the interwiki prefix, automatically set in save()
-*/
-
+/**
+ * Utility class for creating new RC entries
+ * mAttributes:
+ * rc_id id of the row in the recentchanges table
+ * rc_timestamp time the entry was made
+ * rc_cur_time timestamp on the cur row
+ * rc_namespace namespace #
+ * rc_title non-prefixed db key
+ * rc_type is new entry, used to determine whether updating is necessary
+ * rc_minor is minor
+ * rc_cur_id id of associated cur entry
+ * rc_user user id who made the entry
+ * rc_user_text user name who made the entry
+ * rc_comment edit summary
+ * rc_this_oldid old_id associated with this entry (or zero)
+ * rc_last_oldid old_id associated with the entry before this one (or zero)
+ * rc_bot is bot, hidden
+ * rc_ip IP address of the user in dotted quad notation
+ * rc_new obsolete, use rc_type==RC_NEW
+ * rc_patrolled boolean whether or not someone has marked this edit as patrolled
+ *
+ * mExtra:
+ * prefixedDBkey prefixed db key, used by external app via msg queue
+ * lastTimestamp timestamp of previous entry, used in WHERE clause during update
+ * lang the interwiki prefix, automatically set in save()
+ *
+ * @todo document functions and variables
+ */
class RecentChange
{
var $mAttribs = array(), $mExtra = array();
}
- # Gets the end part of the diff URL assoicated with this object
- # Blank if no diff link should be displayed
+ /**
+ * Gets the end part of the diff URL assoicated with this object
+ * Blank if no diff link should be displayed
+ */
function diffLinkTrail( $forceCur )
{
if ( $this->mAttribs['rc_type'] == RC_EDIT ) {
<?php
-# See search.doc
-
+/**
+ * Contain site class
+ * See search.doc
+ */
+
+/**
+ *
+ */
define( 'MW_SEARCH_OK', true );
define( 'MW_SEARCH_BAD_QUERY', false );
+/**
+ * @todo document
+ */
class SearchEngine {
/* private */ var $rawText, $filteredText, $searchTerms;
/* private */ var $titleCond, $textCond;
$this->db =& wfGetDB( DB_SLAVE );
}
- # Return a partial WHERE clause to limit the search to the given namespaces
+ /**
+ * Return a partial WHERE clause to limit the search to the given namespaces
+ */
function queryNamespaces() {
$namespaces = implode( ',', $this->namespacesToSearch );
if ($namespaces == '') {
return "AND cur_namespace IN (" . $namespaces . ')';
}
- # Return a partial WHERE clause to include or exclude redirects from results
+ /**
+ * Return a partial WHERE clause to include or exclude redirects from results
+ */
function searchRedirects() {
if ( $this->doSearchRedirects ) {
return '';
}
}
- /* private */ function initNamespaceCheckbox( $i )
- {
+ /**
+ * @access private
+ */ function initNamespaceCheckbox( $i ) {
global $wgUser, $wgNamespacesToBeSearchedDefault;
if ($wgUser->getID()) {
}
}
- # Display the "power search" footer. Does not actually perform the search,
- # that is done by showResults()
+ /**
+ * Display the "power search" footer. Does not actually perform the search,
+ * that is done by showResults()
+ */
function powersearch() {
global $wgUser, $wgOut, $wgLang, $wgTitle, $wgRequest;
$sk =& $wgUser->getSkin();
$wgOut->setRobotpolicy( 'noindex,nofollow' );
}
- # Perform the search and construct the results page
+ /**
+ * Perform the search and construct the results page
+ */
function showResults() {
global $wgUser, $wgTitle, $wgOut, $wgLang;
global $wgDisableTextSearch, $wgInputEncoding;
}
}
- /* static */ function doFuzzyTitleSearch( $search, $namespace ){
+ /**
+ * @static
+ */
+ function doFuzzyTitleSearch( $search, $namespace ){
global $wgLang, $wgOut;
$this->setupPage();
return false;
}
- /* static */ function fuzzyTitles( $sstr, $namespace = NS_MAIN ){
+ /**
+ * @static
+ */
+ function fuzzyTitles( $sstr, $namespace = NS_MAIN ){
$span = 0.10; // weed on title length before doing levenshtein.
$tolerance = 0.35; // allowed percentage of erronous characters
$slen = strlen($sstr);
return $result;
}
- /* static */ function getTitlesByLength($aLength, $aNamespace = 0){
+ /**
+ * static
+ */
+ function getTitlesByLength($aLength, $aNamespace = 0){
global $wgMemc, $wgDBname;
$fname = 'SearchEngin::getTitlesByLength';
}
}
-/* private static */ function SearchEngine_pcmp($a, $b){ return $a[0] - $b[0]; }
+/**
+ * @access private
+ * @static
+ */
+function SearchEngine_pcmp($a, $b){ return $a[0] - $b[0]; }
?>
<?php
# $Id$
-# See deferred.doc
+/**
+ * See deferred.doc
+ */
+/**
+ *
+ */
class SearchUpdate {
/* private */ var $mId = 0, $mNamespace, $mTitle, $mText;
/* private */ var $mTitleWords;
- function SearchUpdate( $id, $title, $text = false )
- {
+ function SearchUpdate( $id, $title, $text = false ) {
$nt = Title::newFromText( $title );
if( $nt ) {
$this->mId = $id;
}
}
- function doUpdate()
- {
+ function doUpdate() {
global $wgDBminWordLen, $wgLang, $wgDisableSearchUpdate;
if( $wgDisableSearchUpdate || !$this->mId ) {
<?php
-
-# This file is not a valid entry point, perform no further processing unless MEDIAWIKI is defined
+/**
+ * Include most things that's need to customize the site
+ */
+
+/**
+ * This file is not a valid entry point, perform no further processing unless
+ * MEDIAWIKI is defined
+ */
if( defined( 'MEDIAWIKI' ) ) {
# The main wiki script and things like database
# Set up Memcached
#
require_once( 'memcached-client.php' );
+
+ /**
+ *
+ */
class MemCachedClientforWiki extends memcached {
function _debugprint( $text ) {
wfDebug( "memcached: $text\n" );
$wgMemc = new TurckBagOStuff;
$messageMemc = &$wgMemc;
} else {
- # No shared memory
- #
+ /**
+ * No shared memory
+ */
class FakeMemCachedClient {
function add ($key, $val, $exp = 0) { return true; }
function decr ($key, $amt=1) { return null; }
<?php
+/**
+ *This file is used to configure the live Wikimedia wikis. The file that
+ * includes it contains passwords and other sensitive data, and there's
+ * currently no public equivalent.
+ */
-# This file is used to configure the live Wikimedia wikis. The file that includes
-# it contains passwords and other sensitive data, and there's currently no public
-# equivalent.
-
+/**
+ *
+ */
class SiteConfiguration {
var $suffixes, $wikis, $settings;
var $localDatabases;
}
}
- # Work out the site and language name from a database name
+ /**
+ * Work out the site and language name from a database name
+ * @param $db
+ */
function siteFromDB( $db ) {
$site = NULL;
$lang = NULL;
<?php
# $Id$
-# See deferred.doc
+/**
+ * See deferred.doc
+ */
+/**
+ *
+ */
class SiteStatsUpdate {
var $mViews, $mEdits, $mGood;
- function SiteStatsUpdate( $views, $edits, $good )
- {
+ function SiteStatsUpdate( $views, $edits, $good ) {
$this->mViews = $views;
$this->mEdits = $edits;
$this->mGood = $good;
}
- function doUpdate()
- {
+ function doUpdate() {
$a = array();
if ( $this->mViews < 0 ) { $m = '-1'; }
<?php
-# This is not a valid entry point, perform no further processing unless MEDIAWIKI is defined
+/**
+ *
+ */
+
+/**
+ * This is not a valid entry point, perform no further processing unless MEDIAWIKI is defined
+ */
if( defined( "MEDIAWIKI" ) ) {
# See skin.doc
require_once( 'RecentChange.php' );
+/**
+ * @todo document
+ */
class RCCacheEntry extends RecentChange
{
var $secureName, $link;
} ;
-# The main skin class that provide methods and properties for all other skins
-# including PHPTal skins.
-# This base class is also the "Standard" skin.
-
+/**
+ * The main skin class that provide methods and properties for all other skins
+ * including PHPTal skins.
+ * This base class is also the "Standard" skin.
+ */
class Skin {
-
- /* private */ var $lastdate, $lastline;
+ /**#@+
+ * @access private
+ */
+ var $lastdate, $lastline;
var $linktrail ; # linktrail regexp
var $rc_cache ; # Cache for Enhanced Recent Changes
var $rcCacheIndex ; # Recent Changes Cache Counter for visibility toggle
var $rcMoveIndex;
var $postParseLinkColour = true;
+ /**#@-*/
function Skin() {
global $wgUseOldExistenceCheck;
return 'standard';
}
- # Get/set accessor for delayed link colouring
+ /**
+ * Get/set accessor for delayed link colouring
+ */
function postParseLinkColour( $setting = NULL ) {
return wfSetVar( $this->postParseLinkColour, $setting );
}
return $s."\n";
}
- # placeholder, returns generated js in monobook
+ /**
+ * placeholder, returns generated js in monobook
+ */
function getUserJs() { return; }
- # Return html code that include User stylesheets
+ /**
+ * Return html code that include User stylesheets
+ */
function getUserStyles() {
global $wgOut, $wgStylePath, $wgLang;
$s = "<style type='text/css'>\n";
return $s;
}
- # Some styles that are set by user through the user settings interface.
+ /**
+ * Some styles that are set by user through the user settings interface.
+ */
function doGetUserStyles() {
global $wgUser, $wgLang;
return $s;
}
- function getBodyOptions()
- {
+ function getBodyOptions() {
global $wgUser, $wgTitle, $wgNamespaceBackgrounds, $wgOut, $wgRequest;
extract( $wgRequest->getValues( 'oldid', 'redirect', 'diff' ) );
return $a;
}
- function getExternalLinkAttributes( $link, $text, $class='' )
- {
+ function getExternalLinkAttributes( $link, $text, $class='' ) {
global $wgUser, $wgOut, $wgLang;
$link = urldecode( $link );
return $r;
}
- function getInternalLinkAttributes( $link, $text, $broken = false )
- {
+ function getInternalLinkAttributes( $link, $text, $broken = false ) {
global $wgUser, $wgOut;
$link = urldecode( $link );
return $r;
}
- function getInternalLinkAttributesObj( &$nt, $text, $broken = false )
- {
+ /**
+ * @param bool $broken
+ */
+ function getInternalLinkAttributesObj( &$nt, $text, $broken = false ) {
global $wgUser, $wgOut;
if ( $broken == 'stub' ) {
return $r;
}
- # URL to the logo
+ /**
+ * URL to the logo
+ */
function getLogo() {
global $wgLogo;
return $wgLogo;
}
- # This will be called immediately after the <body> tag. Split into
- # two functions to make it easier to subclass.
- #
- function beforeContent()
- {
+ /**
+ * This will be called immediately after the <body> tag. Split into
+ * two functions to make it easier to subclass.
+ */
+ function beforeContent() {
global $wgUser, $wgOut;
return $this->doBeforeContent();
}
- function doBeforeContent()
- {
+ function doBeforeContent() {
global $wgUser, $wgOut, $wgTitle, $wgLang, $wgSiteNotice;
$fname = 'Skin::doBeforeContent';
wfProfileIn( $fname );
return $s;
}
- # After all the page content is transformed into HTML, it makes
- # a final pass through here for things like table backgrounds.
- #
+ /**
+ * After all the page content is transformed into HTML, it makes
+ * a final pass through here for things like table backgrounds.
+ * @todo probably deprecated [AV]
+ */
function transformContent( $text ) {
return $text;
}
- # Note: This function MUST call getArticleID() on the link,
- # otherwise the cache won't get updated properly. See LINKCACHE.DOC.
- #
+ /**
+ * Note: This function MUST call getArticleID() on the link,
+ * otherwise the cache won't get updated properly. See LINKCACHE.DOC.
+ */
function makeLink( $title, $text = '', $query = '', $trail = '' ) {
wfProfileIn( 'Skin::makeLink' );
$nt = Title::newFromText( $title );
}
}
- # Pass a title object, not a title string
+ /**
+ * Pass a title object, not a title string
+ */
function makeLinkObj( &$nt, $text= '', $query = '', $trail = '', $prefix = '' ) {
global $wgOut, $wgUser;
$fname = 'Skin::makeLinkObj';
return $retVal;
}
- # Pass a title object, not a title string
+ /**
+ * Pass a title object, not a title string
+ */
function makeKnownLinkObj( &$nt, $text = '', $query = '', $trail = '', $prefix = '' , $aprops = '' ) {
global $wgOut, $wgTitle, $wgInputEncoding;
return $r;
}
- # Pass a title object, not a title string
+ /**
+ * Pass a title object, not a title string
+ */
function makeBrokenLinkObj( &$nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
global $wgOut, $wgUser;
return $s;
}
- # Pass a title object, not a title string
+ /**
+ * Pass a title object, not a title string
+ */
function makeStubLinkObj( &$nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
global $wgOut, $wgUser;
return str_replace("\n", ' ',$prefix.$s.$postfix);
}
- # Make HTML for a thumbnail including image, border and caption
- # $img is an Image object
+ /**
+ * Make HTML for a thumbnail including image, border and caption
+ * $img is an Image object
+ */
function makeThumbLinkObj( $img, $label = '', $align = 'right', $boxwidth = 180, $boxheight=false, $framed=false , $manual_thumb = "" ) {
global $wgStylePath, $wgLang;
# $image = Title::makeTitleSafe( NS_IMAGE, $name );
return $s;
}
- # Returns text for the end of RC
- # If enhanced RC is in use, returns pretty much all the text
+ /**
+ * Returns text for the end of RC
+ * If enhanced RC is in use, returns pretty much all the text
+ */
function endRecentChangesList() {
$s = $this->recentChangesBlock() ;
if( $this->rclistOpen ) {
return $s;
}
- # Enhanced RC ungrouped line
+ /**
+ * Enhanced RC ungrouped line
+ */
function recentChangesBlockLine ( $rcObj ) {
global $wgStylePath, $wgLang ;
return $r ;
}
- # Enhanced RC group
+ /**
+ * Enhanced RC group
+ */
function recentChangesBlockGroup ( $block ) {
global $wgStylePath, $wgLang ;
return $r ;
}
- # If enhanced RC is in use, this function takes the previously cached
- # RC lines, arranges them, and outputs the HTML
+ /**
+ * If enhanced RC is in use, this function takes the previously cached
+ * RC lines, arranges them, and outputs the HTML
+ */
function recentChangesBlock () {
global $wgStylePath ;
if ( count ( $this->rc_cache ) == 0 ) return '' ;
return '<div>'.$blockOut.'</div>' ;
}
- # Called in a loop over all displayed RC entries
- # Either returns the line, or caches it for later use
+ /**
+ * Called in a loop over all displayed RC entries
+ * Either returns the line, or caches it for later use
+ */
function recentChangesLine( &$rc, $watched = false ) {
global $wgUser ;
$usenew = $wgUser->getOption( 'usenewrc' );
return $s;
}
- /* This function is called by all recent changes variants, by the page history,
- and by the user contributions list. It is responsible for formatting edit
- comments. It escapes any HTML in the comment, but adds some CSS to format
- auto-generated comments (from section editing) and formats [[wikilinks]].
-
- The &$title parameter must be a title OBJECT. It is used to generate a
- direct link to the section in the autocomment.
- Main author: Erik Moeller (moeller@scireview.de)
- */
- # Note: there's not always a title to pass to this function.
- # Since you can't set a default parameter for a reference, I've turned it
- # temporarily to a value pass. Should be adjusted further. --brion
+ /**
+ * This function is called by all recent changes variants, by the page history,
+ * and by the user contributions list. It is responsible for formatting edit
+ * comments. It escapes any HTML in the comment, but adds some CSS to format
+ * auto-generated comments (from section editing) and formats [[wikilinks]].
+ *
+ * The &$title parameter must be a title OBJECT. It is used to generate a
+ * direct link to the section in the autocomment.
+ * @author Erik Moeller <moeller@scireview.de>
+ *
+ * Note: there's not always a title to pass to this function.
+ * Since you can't set a default parameter for a reference, I've turned it
+ * temporarily to a value pass. Should be adjusted further. --brion
+ */
function formatComment($comment, $title = NULL) {
global $wgLang;
$comment = htmlspecialchars( $comment );
return str_repeat( "</div>\n", $level>0 ? $level : 0 );
}
- # parameter level defines if we are on an indentation level
+ /**
+ * parameter level defines if we are on an indentation level
+ */
function tocLine( $anchor, $tocline, $level ) {
$link = '<a href="#'.$anchor.'">'.$tocline.'</a><br />';
if($level) {
$toc."</td></tr></table>\n";
}
- # These two do not check for permissions: check $wgTitle->userCanEdit before calling them
+ /**
+ * These two do not check for permissions: check $wgTitle->userCanEdit
+ * before calling them
+ */
function editSectionScript( $section, $head ) {
global $wgTitle, $wgRequest;
if( $wgRequest->getInt( 'oldid' ) && ( $wgRequest->getVal( 'diff' ) != '0' ) ) {
}
- // This function is called by EditPage.php and shows a bulletin board style
- // toolbar for common editing functions. It can be disabled in the user preferences.
- // The necsesary JavaScript code can be found in style/wikibits.js.
+ /**
+ * This function is called by EditPage.php and shows a bulletin board style
+ * toolbar for common editing functions. It can be disabled in the user
+ * preferences.
+ * The necsesary JavaScript code can be found in style/wikibits.js.
+ */
function getEditToolbar() {
global $wgStylePath, $wgLang, $wgMimeType;
- // toolarray an array of arrays which each include the filename of
- // the button image (without path), the opening tag, the closing tag,
- // and optionally a sample text that is inserted between the two when no
- // selection is highlighted.
- // The tip text is shown when the user moves the mouse over the button.
-
- // Already here are accesskeys (key), which are not used yet until someone
- // can figure out a way to make them work in IE. However, we should make
- // sure these keys are not defined on the edit page.
+ /**
+ * toolarray an array of arrays which each include the filename of
+ * the button image (without path), the opening tag, the closing tag,
+ * and optionally a sample text that is inserted between the two when no
+ * selection is highlighted.
+ * The tip text is shown when the user moves the mouse over the button.
+ *
+ * Already here are accesskeys (key), which are not used yet until someone
+ * can figure out a way to make them work in IE. However, we should make
+ * sure these keys are not defined on the edit page.
+ */
$toolarray=array(
array( 'image'=>'button_bold.png',
'open' => "\'\'\'",
return $toolbar;
}
- /* public */ function suppressUrlExpansion() {
+ /**
+ * @access public
+ */
+ function suppressUrlExpansion() {
return false;
}
}
<?php
-# Generic PHPTal (http://phptal.sourceforge.net/) skin
-# Based on Brion's smarty skin
-# Copyright (C) Gabriel Wicke -- http://www.aulinx.de/
-#
-# Todo: Needs some serious refactoring into functions that correspond
-# to the computations individual esi snippets need. Most importantly no body
-# parsing for most of those of course.
-#
-# Set this in LocalSettings to enable phptal:
-# set_include_path(get_include_path() . ":" . $IP.'/PHPTAL-NP-0.7.0/libs');
-# $wgUsePHPTal = true;
-#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# http://www.gnu.org/copyleft/gpl.html
-
-# This is not a valid entry point, perform no further processing unless MEDIAWIKI is defined
+/**
+ * Generic PHPTal (http://phptal.sourceforge.net/) skin
+ * Based on Brion's smarty skin
+ * Copyright (C) Gabriel Wicke -- http://www.aulinx.de/
+ *
+ * Todo: Needs some serious refactoring into functions that correspond
+ * to the computations individual esi snippets need. Most importantly no body
+ * parsing for most of those of course.
+ *
+ * Set this in LocalSettings to enable phptal:
+ * set_include_path(get_include_path() . ":" . $IP.'/PHPTAL-NP-0.7.0/libs');
+ * $wgUsePHPTal = true;
+ *
+ */
+
+/**
+ * This is not a valid entry point, perform no further processing unless
+ * MEDIAWIKI is defined
+ */
if( defined( 'MEDIAWIKI' ) ) {
require_once 'GlobalFunctions.php';
global $IP;
require_once $IP.'/PHPTAL-NP-0.7.0/libs/PHPTAL.php';
+/**
+ *
+ */
class MediaWiki_I18N extends PHPTAL_I18N {
var $_context = array();
}
}
+/**
+ *
+ */
class SkinPHPTal extends Skin {
var $template;
$this->template = 'MonoBook';
}
- # initialize various variables and generate the template
+ /**
+ * initialize various variables and generate the template
+ */
function outputPage( &$out ) {
global $wgTitle, $wgArticle, $wgUser, $wgLang, $wgOut;
global $wgScript, $wgStylePath, $wgLanguageCode, $wgUseNewInterlanguage;
}
- # build array of urls for personal toolbar
+ /**
+ * build array of urls for personal toolbar
+ */
function buildPersonalUrls() {
/* set up the default links for the personal toolbar */
global $wgShowIPinHeader;
return $personal_urls;
}
- # an array of edit links by default used for the tabs
+ /**
+ * an array of edit links by default used for the tabs
+ */
function buildContentActionUrls () {
global $wgTitle, $wgUser, $wgRequest, $wgUseValidation;
$action = $wgRequest->getText( 'action' );
return $content_actions;
}
- # build array of common navigation links
+ /**
+ * build array of common navigation links
+ */
function buildNavUrls () {
global $wgTitle, $wgUser, $wgRequest;
global $wgSiteSupportPage, $wgDisableUploads;
return $nav_urls;
}
- # Generate strings used for xml 'id' names
+ /**
+ * Generate strings used for xml 'id' names
+ */
function getNameSpaceKey () {
global $wgTitle;
switch ($wgTitle->getNamespace()) {
}
- /* private */ function setupUserCssJs () {
+ /**
+ * @access private
+ */
+ function setupUserCssJs () {
global $wgRequest, $wgTitle;
$action = $wgRequest->getText('action');
# generated css
}
}
- # returns css with user-specific options
+ /**
+ * returns css with user-specific options
+ */
function getUserStylesheet() {
global $wgUser, $wgRequest, $wgTitle, $wgLang, $wgSquidMaxage, $wgStylePath;
$action = $wgRequest->getText('action');
return $s;
}
+ /**
+ *
+ */
function getUserJs() {
global $wgUser, $wgStylePath;
$s = '/* generated javascript */';
<?php
+/**
+ * Provide functions to generate a special page
+ */
- function wfSpecialAllmessages()
- {
- global $wgOut, $wgAllMessagesEn, $wgRequest, $wgMessageCache, $wgTitle;
-
- $fname = "wfSpecialAllMessages";
- wfProfileIn( $fname );
-
- wfProfileIn( "$fname-setup");
- $ot = $wgRequest->getText( 'ot' );
- $mwMsg =& MagicWord::get( MAG_MSG );
-
- $navText = wfMsg( 'allmessagestext', $mwMsg->getSynonym( 0 ) );
- $first = true;
- $sortedArray = $wgAllMessagesEn;
- ksort( $sortedArray );
- $messages = array();
- $wgMessageCache->disableTransform();
- foreach ( $sortedArray as $key => $enMsg ) {
- $messages[$key]['enmsg'] = $enMsg;
- $messages[$key]['statmsg'] = wfMsgNoDb( $key );
- $messages[$key]['msg'] = wfMsg ( $key );
- }
- wfProfileOut( "$fname-setup" );
-
- wfProfileIn( "$fname-output" );
- if ($ot == 'php') {
- $navText .= makePhp($messages);
- $wgOut->addHTML('PHP | <a href="'.$wgTitle->escapeLocalUrl('ot=html').'">HTML</a><pre>'.htmlspecialchars($navText).'</pre>');
- } else {
- $wgOut->addHTML( '<a href="'.$wgTitle->escapeLocalUrl('ot=php').'">PHP</a> | HTML' );
- $wgOut->addWikiText( $navText );
- $wgOut->addHTML( makeHTMLText( $messages ) );
- }
- wfProfileOut( "$fname-output" );
-
- wfProfileOut( $fname );
+/**
+ *
+ */
+function wfSpecialAllmessages() {
+ global $wgOut, $wgAllMessagesEn, $wgRequest, $wgMessageCache, $wgTitle;
+
+ $fname = "wfSpecialAllMessages";
+ wfProfileIn( $fname );
+
+ wfProfileIn( "$fname-setup");
+ $ot = $wgRequest->getText( 'ot' );
+ $mwMsg =& MagicWord::get( MAG_MSG );
+
+ $navText = wfMsg( 'allmessagestext', $mwMsg->getSynonym( 0 ) );
+ $first = true;
+ $sortedArray = $wgAllMessagesEn;
+ ksort( $sortedArray );
+ $messages = array();
+ $wgMessageCache->disableTransform();
+ foreach ( $sortedArray as $key => $enMsg ) {
+ $messages[$key]['enmsg'] = $enMsg;
+ $messages[$key]['statmsg'] = wfMsgNoDb( $key );
+ $messages[$key]['msg'] = wfMsg ( $key );
+ }
+ wfProfileOut( "$fname-setup" );
+
+ wfProfileIn( "$fname-output" );
+ if ($ot == 'php') {
+ $navText .= makePhp($messages);
+ $wgOut->addHTML('PHP | <a href="'.$wgTitle->escapeLocalUrl('ot=html').'">HTML</a><pre>'.htmlspecialchars($navText).'</pre>');
+ } else {
+ $wgOut->addHTML( '<a href="'.$wgTitle->escapeLocalUrl('ot=php').'">PHP</a> | HTML' );
+ $wgOut->addWikiText( $navText );
+ $wgOut->addHTML( makeHTMLText( $messages ) );
}
+ wfProfileOut( "$fname-output" );
- function makePhp($messages) {
- global $wgLanguageCode;
- $txt = "\n\n".'$wgAllMessages'.ucfirst($wgLanguageCode).' = array('."\n";
- foreach( $messages as $key => $m ) {
- if(strtolower($wgLanguageCode) != 'en' and $m['msg'] == $m['enmsg'] ) {
- if (strstr($m['msg'],"\n")) {
- $txt.='/* ';
- $comment=' */';
- } else {
- $txt .= '#';
- $comment = '';
- }
- } elseif ($m['msg'] == '<'.$key.'>'){
- $m['msg'] = '';
- $comment = ' #empty';
+ wfProfileOut( $fname );
+}
+
+/**
+ *
+ */
+function makePhp($messages) {
+ global $wgLanguageCode;
+ $txt = "\n\n".'$wgAllMessages'.ucfirst($wgLanguageCode).' = array('."\n";
+ foreach( $messages as $key => $m ) {
+ if(strtolower($wgLanguageCode) != 'en' and $m['msg'] == $m['enmsg'] ) {
+ if (strstr($m['msg'],"\n")) {
+ $txt.='/* ';
+ $comment=' */';
} else {
+ $txt .= '#';
$comment = '';
}
- $txt .= "'".$key."' => \"".str_replace('"','\"',$m['msg'])."\",$comment\n";
+ } elseif ($m['msg'] == '<'.$key.'>'){
+ $m['msg'] = '';
+ $comment = ' #empty';
+ } else {
+ $comment = '';
}
- $txt .= ');';
- return $txt;
+ $txt .= "'".$key."' => \"".str_replace('"','\"',$m['msg'])."\",$comment\n";
}
+ $txt .= ');';
+ return $txt;
+}
- function makeHTMLText( $messages ) {
- global $wgLang, $wgUser;
- $fname = "makeHTMLText";
- wfProfileIn( $fname );
-
- $sk =& $wgUser->getSkin();
- $talk = $wgLang->getNsText( NS_TALK );
- $mwnspace = $wgLang->getNsText( NS_MEDIAWIKI );
- $mwtalk = $wgLang->getNsText( NS_MEDIAWIKI_TALK );
- $txt = "
+/**
+ *
+ */
+function makeHTMLText( $messages ) {
+ global $wgLang, $wgUser;
+ $fname = "makeHTMLText";
+ wfProfileIn( $fname );
+
+ $sk =& $wgUser->getSkin();
+ $talk = $wgLang->getNsText( NS_TALK );
+ $mwnspace = $wgLang->getNsText( NS_MEDIAWIKI );
+ $mwtalk = $wgLang->getNsText( NS_MEDIAWIKI_TALK );
+ $txt = "
- <table border='1' cellspacing='0' width='100%'>
- <tr bgcolor='#b2b2ff'>
- <th>Name</th>
- <th>Default text</th>
- <th>Current text</th>
- </tr>";
-
- wfProfileIn( "$fname-check" );
- # This is a nasty hack to avoid doing independent existence checks
- # without sending the links and table through the slow wiki parser.
- $pageExists = array(
- NS_MEDIAWIKI => array(),
- NS_MEDIAWIKI_TALK => array()
- );
- $sql = "SELECT cur_namespace,cur_title FROM cur WHERE cur_namespace IN (" . NS_MEDIAWIKI . ", " . NS_MEDIAWIKI_TALK . ")";
- $dbr =& wfGetDB( DB_SLAVE );
- $res = $dbr->query( $sql );
- while( $s = $dbr->fetchObject( $res ) ) {
- $pageExists[$s->cur_namespace][$s->cur_title] = true;
- }
- $dbr->freeResult( $res );
- wfProfileOut( "$fname-check" );
+ <table border='1' cellspacing='0' width='100%'>
+ <tr bgcolor='#b2b2ff'>
+ <th>Name</th>
+ <th>Default text</th>
+ <th>Current text</th>
+ </tr>";
+
+ wfProfileIn( "$fname-check" );
+ # This is a nasty hack to avoid doing independent existence checks
+ # without sending the links and table through the slow wiki parser.
+ $pageExists = array(
+ NS_MEDIAWIKI => array(),
+ NS_MEDIAWIKI_TALK => array()
+ );
+ $sql = "SELECT cur_namespace,cur_title FROM cur WHERE cur_namespace IN (" . NS_MEDIAWIKI . ", " . NS_MEDIAWIKI_TALK . ")";
+ $dbr =& wfGetDB( DB_SLAVE );
+ $res = $dbr->query( $sql );
+ while( $s = $dbr->fetchObject( $res ) ) {
+ $pageExists[$s->cur_namespace][$s->cur_title] = true;
+ }
+ $dbr->freeResult( $res );
+ wfProfileOut( "$fname-check" );
- wfProfileIn( "$fname-output" );
- foreach( $messages as $key => $m ) {
- $title = $wgLang->ucfirst( $key );
- $titleObj =& Title::makeTitle( NS_MEDIAWIKI, $title );
- $talkPage =& Title::makeTitle( NS_MEDIAWIKI_TALK, $title );
+ wfProfileIn( "$fname-output" );
+ foreach( $messages as $key => $m ) {
+ $title = $wgLang->ucfirst( $key );
+ $titleObj =& Title::makeTitle( NS_MEDIAWIKI, $title );
+ $talkPage =& Title::makeTitle( NS_MEDIAWIKI_TALK, $title );
- $colorIt = ($m['statmsg'] == $m['msg']) ? " bgcolor=\"#f0f0ff\"" : " bgcolor=\"#ffe2e2\"";
- $message = htmlspecialchars( $m['statmsg'] );
- $mw = htmlspecialchars( $m['msg'] );
-
- #$pageLink = $sk->makeLinkObj( $titleObj, htmlspecialchars( $key ) );
- #$talkLink = $sk->makeLinkObj( $talkPage, htmlspecialchars( $talk ) );
- if( isset( $pageExists[NS_MEDIAWIKI][$title] ) ) {
- $pageLink = $sk->makeKnownLinkObj( $titleObj, htmlspecialchars( $key ) );
- } else {
- $pageLink = $sk->makeBrokenLinkObj( $titleObj, htmlspecialchars( $key ) );
- }
- if( isset( $pageExists[NS_MEDIAWIKI_TALK][$title] ) ) {
- $talkLink = $sk->makeKnownLinkObj( $talkPage, htmlspecialchars( $talk ) );
- } else {
- $talkLink = $sk->makeBrokenLinkObj( $talkPage, htmlspecialchars( $talk ) );
- }
-
- $txt .=
- "<tr$colorIt><td>
- $pageLink<br />
- $talkLink
- </td><td>
- $message
- </td><td>
- $mw
- </td></tr>";
+ $colorIt = ($m['statmsg'] == $m['msg']) ? " bgcolor=\"#f0f0ff\"" : " bgcolor=\"#ffe2e2\"";
+ $message = htmlspecialchars( $m['statmsg'] );
+ $mw = htmlspecialchars( $m['msg'] );
+
+ #$pageLink = $sk->makeLinkObj( $titleObj, htmlspecialchars( $key ) );
+ #$talkLink = $sk->makeLinkObj( $talkPage, htmlspecialchars( $talk ) );
+ if( isset( $pageExists[NS_MEDIAWIKI][$title] ) ) {
+ $pageLink = $sk->makeKnownLinkObj( $titleObj, htmlspecialchars( $key ) );
+ } else {
+ $pageLink = $sk->makeBrokenLinkObj( $titleObj, htmlspecialchars( $key ) );
+ }
+ if( isset( $pageExists[NS_MEDIAWIKI_TALK][$title] ) ) {
+ $talkLink = $sk->makeKnownLinkObj( $talkPage, htmlspecialchars( $talk ) );
+ } else {
+ $talkLink = $sk->makeBrokenLinkObj( $talkPage, htmlspecialchars( $talk ) );
}
- $txt .= "</table>";
- wfProfileOut( "$fname-output" );
- wfProfileOut( $fname );
- return $txt;
+ $txt .=
+ "<tr$colorIt><td>
+ $pageLink<br />
+ $talkLink
+ </td><td>
+ $message
+ </td><td>
+ $mw
+ </td></tr>";
}
+ $txt .= "</table>";
+ wfProfileOut( "$fname-output" );
+
+ wfProfileOut( $fname );
+ return $txt;
+}
?>
<?php
-
-function wfSpecialAllpages( $par=NULL )
-{
+/**
+ *
+ */
+
+/**
+ *
+ */
+function wfSpecialAllpages( $par=NULL ) {
global $indexMaxperpage, $toplevelMaxperpage, $wgRequest, $wgOut, $wgLang;
$indexMaxperpage = 480;
$toplevelMaxperpage = 50;
}
}
-function namespaceForm ( $namespace = 0, $from = "" )
-{
+function namespaceForm ( $namespace = 0, $from = '' ) {
global $wgLang, $wgScript;
$t = Title::makeTitle( NS_SPECIAL, "Allpages" );
return $out;
}
-function indexShowToplevel ( $namespace = 0 )
-{
+function indexShowToplevel ( $namespace = 0 ) {
global $wgOut, $indexMaxperpage, $toplevelMaxperpage, $wgLang, $wgRequest, $wgUser;
$sk = $wgUser->getSkin();
$fname = "indexShowToplevel";
$wgOut->addHtml( $out2 . $out );
}
-function indexShowline( $inpoint, $outpoint, $namespace = 0 )
-{
+function indexShowline( $inpoint, $outpoint, $namespace = 0 ) {
global $wgOut, $wgLang, $wgUser;
$sk = $wgUser->getSkin();
$dbr =& wfGetDB( DB_SLAVE );
return '<tr><td align="right">'.$out.'</td></tr>';
}
-function indexShowChunk( $from, $namespace = 0 )
-{
+function indexShowChunk( $from, $namespace = 0 ) {
global $wgOut, $wgUser, $indexMaxperpage, $wgLang;
$sk = $wgUser->getSkin();
$maxPlusOne = $indexMaxperpage + 1;
<?php
-
-require_once( "QueryPage.php" );
-
+/**
+ *
+ */
+
+/**
+ *
+ */
+require_once( 'QueryPage.php' );
+
+/**
+ *
+ */
class AncientPagesPage extends QueryPage {
function getName() {
}
}
-function wfSpecialAncientpages()
-{
+function wfSpecialAncientpages() {
list( $limit, $offset ) = wfCheckLimits();
$app = new AncientPagesPage();
<?php
-#
-# If enabled through $wgAllowSysopQueries = true, this class
-# let users with sysop right the possibility to make sql queries
-# against the cur table.
-# Heavy queries could slow down the database specially for the
-# biggest wikis.
-
-function wfSpecialAsksql()
-{
+/**
+ * If enabled through $wgAllowSysopQueries = true, this class
+ * let users with sysop right the possibility to make sql queries
+ * against the cur table.
+ * Heavy queries could slow down the database specially for the
+ * biggest wikis.
+ *
+ */
+
+/**
+ *
+ */
+function wfSpecialAsksql() {
global $wgUser, $wgOut, $wgRequest, $wgAllowSysopQueries;
if( !$wgAllowSysopQueries ) {
if ( "submit" == $action ) {
$f->doSubmit();
} else {
- $f->showForm( "" );
+ $f->showForm( '' );
}
}
+/**
+ * @access private
+ */
class SqlQueryForm {
- var $query = "";
+ var $query = '';
function SqlQueryForm( $query ) {
$this->query = $query;
}
- function showForm( $err )
- {
+ function showForm( $err ) {
global $wgOut, $wgUser, $wgLang;
global $wgLogQueries;
}
- function doSubmit()
- {
+ function doSubmit() {
global $wgOut, $wgUser, $wgServer, $wgScript, $wgArticlePath, $wgLang;
global $wgDBserver, $wgDBsqluser, $wgDBsqlpassword, $wgDBname, $wgSqlTimeout;
<?php
-
-function wfSpecialBlockip()
-{
+/**
+ * Constructor for Special:Blockip page
+ *
+ */
+
+/**
+ * Constructor
+ */
+function wfSpecialBlockip() {
global $wgUser, $wgOut, $wgRequest;
if ( ! $wgUser->isSysop() ) {
else { $ipb->showForm( "" ); }
}
+/**
+ * Form object
+ *
+ */
class IPBlockForm {
var $BlockAddress, $BlockExpiry, $BlockReason;
}
- function doSubmit()
- {
+ function doSubmit() {
global $wgOut, $wgUser, $wgLang;
global $wgSysopUserBans, $wgSysopRangeBans;
$wgOut->redirect( $titleObj->getFullURL( "action=success&ip={$this->BlockAddress}" ) );
}
- function showSuccess()
- {
+ function showSuccess() {
global $wgOut, $wgUser;
$wgOut->setPagetitle( wfMsg( "blockip" ) );
<?php
+/**
+ *
+ */
+
+/**
+ *
+ */
function wfSpecialBlockme()
{
global $wgIP, $wgBlockOpenProxies, $wgOut, $wgProxyKey;
<?php
+/**
+ * ISBNs in wiki pages will create links to this page, with the ISBN passed
+ * in via the query string.
+ *
+ *
+ */
-# ISBNs in wiki pages will create links to this page, with
-# the ISBN passed in via the query string.
-
-function wfSpecialBooksources( $par )
-{
+/**
+ * Constructor
+ */
+function wfSpecialBooksources( $par ) {
global $wgRequest;
$isbn = $par;
$bsl->show();
}
+/**
+ *
+ */
class BookSourceList {
var $mIsbn;
<?php
+/**
+ *
+ */
+/**
+ *
+ */
require_once('QueryPage.php');
+/**
+ *
+ */
class BrokenRedirectsPage extends PageQueryPage {
function getName() {
}
}
+/**
+ * constructor
+ */
function wfSpecialBrokenRedirects() {
list( $limit, $offset ) = wfCheckLimits();
<?php
+/**
+ *
+ */
+/**
+ *
+ */
require_once("QueryPage.php");
+/**
+ *
+ */
class CategoriesPage extends QueryPage {
function getName() {
}
}
-function wfSpecialCategories()
-{
+/**
+ *
+ */
+function wfSpecialCategories() {
list( $limit, $offset ) = wfCheckLimits();
$cap = new CategoriesPage();
<?php
-
-function wfSpecialContributions( $par = "" )
-{
+/**
+ *
+ */
+
+/**
+ *
+ */
+function wfSpecialContributions( $par = '' ) {
global $wgUser, $wgOut, $wgLang, $wgRequest;
$fname = "wfSpecialContributions";
$sysop = $wgUser->isSysop();
}
-/*
-
-Generates each row in the contributions list.
-
-Contributions which are marked "top" are currently on top of the history.
-For these contributions, a [rollback] link is shown for users with sysop
-privileges. The rollback link restores the most recent version that was not
-written by the target user.
-
-If the contributions page is called with the parameter &bot=1, all rollback
-links also get that parameter. It causes the edit itself and the rollback
-to be marked as "bot" edits. Bot edits are hidden by default from recent
-changes, so this allows sysops to combat a busy vandal without bothering
-other users.
-
-TODO: This would probably look a lot nicer in a table.
-
-*/
-function ucListEdit( $sk, $ns, $t, $ts, $topmark, $comment, $isminor, $isnew, $target, $oldid )
-{
+/**
+ * Generates each row in the contributions list.
+ *
+ * Contributions which are marked "top" are currently on top of the history.
+ * For these contributions, a [rollback] link is shown for users with sysop
+ * privileges. The rollback link restores the most recent version that was not
+ * written by the target user.
+ *
+ * If the contributions page is called with the parameter &bot=1, all rollback
+ * links also get that parameter. It causes the edit itself and the rollback
+ * to be marked as "bot" edits. Bot edits are hidden by default from recent
+ * changes, so this allows sysops to combat a busy vandal without bothering
+ * other users.
+ *
+ * @todo This would probably look a lot nicer in a table.
+ */
+function ucListEdit( $sk, $ns, $t, $ts, $topmark, $comment, $isminor, $isnew, $target, $oldid ) {
global $wgLang, $wgOut, $wgUser, $wgRequest;
$page = Title::makeName( $ns, $t );
$link = $sk->makeKnownLink( $page, "" );
$wgOut->addHTML( "<li>{$d} {$histlink} {$mflag} {$link} {$comment}{$topmarktext}{$oldtext}</li>\n" );
}
-function ucCountLink( $lim, $d )
-{
+/**
+ *
+ */
+function ucCountLink( $lim, $d ) {
global $wgUser, $wgLang, $wgRequest;
$target = $wgRequest->getText( 'target' );
return $s;
}
-function ucDaysLink( $lim, $d )
-{
+/**
+ *
+ */
+function ucDaysLink( $lim, $d ) {
global $wgUser, $wgLang, $wgRequest;
$target = $wgRequest->getText( 'target' );
<?php
+/**
+ *
+ */
+/**
+ *
+ */
require_once( "QueryPage.php" );
+/**
+ *
+ */
class DeadendPagesPage extends PageQueryPage {
function getName( ) {
return "Deadendpages";
}
- # LEFT JOIN is expensive
-
+ /**
+ * LEFT JOIN is expensive
+ *
+ * @return true
+ */
function isExpensive( ) {
return 1;
}
+ /**
+ * @return false
+ */
function sortDescending() {
return false;
}
-
+
+ /**
+ * @return string an sqlquery
+ */
function getSQL() {
$dbr =& wfGetDB( DB_SLAVE );
extract( $dbr->tableNames( 'cur', 'links' ) );
}
}
+/**
+ * Constructor
+ */
function wfSpecialDeadendpages() {
list( $limit, $offset ) = wfCheckLimits();
<?php
-
-function wfSpecialDebug()
-{
+/**
+ * Let developpers receive the full phpinfo output
+ */
+
+/**
+ *
+ */
+function wfSpecialDebug() {
global $wgUser, $wgOut;
if ( ! $wgUser->isDeveloper() ) {
}
phpinfo();
}
-
<?php
+/**
+ *
+ */
+/**
+ *
+ */
require_once('QueryPage.php');
+/**
+ *
+ */
class DisambiguationsPage extends PageQueryPage {
function getName() {
}
}
+/**
+ * Constructor
+ */
function wfSpecialDisambiguations() {
list( $limit, $offset ) = wfCheckLimits();
<?php
+/**
+ *
+ */
+/**
+ *
+ */
require_once('QueryPage.php');
+/**
+ *
+ */
class DoubleRedirectsPage extends PageQueryPage {
function getName() {
}
}
+/**
+ * constructor
+ */
function wfSpecialDoubleRedirects() {
list( $limit, $offset ) = wfCheckLimits();
<?php
+/**
+ *
+ */
+/**
+ *
+ */
require_once('UserMailer.php');
function wfSpecialEmailuser( $par ) {
else { $f->showForm( "" ); }
}
+/**
+ * @todo document
+ */
class EmailUserForm {
var $mAddress;
var $target;
var $text, $subject;
- function EmailUserForm( $addr, $target )
- {
+ function EmailUserForm( $addr, $target ) {
global $wgRequest;
$this->mAddress = $addr;
$this->target = $target;
$this->subject = $wgRequest->getText( 'wpSubject' );
}
- function showForm( $err )
- {
+ function showForm( $err ) {
global $wgOut, $wgUser, $wgLang;
$wgOut->setPagetitle( wfMsg( "emailpage" ) );
}
- function doSubmit()
- {
+ function doSubmit() {
global $wgOut, $wgUser, $wgLang, $wgOutputEncoding;
$from = wfQuotedPrintable( $wgUser->getName() ) . " <" . $wgUser->getEmail() . ">";
$wgOut->addHTML( wfMsg( "usermailererror" ) . $mailResult);
}
- function showSuccess()
- {
+ function showSuccess() {
global $wgOut, $wgUser;
$wgOut->setPagetitle( wfMsg( "emailsent" ) );
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# http://www.gnu.org/copyleft/gpl.html
-function wfSpecialExport( $page = "" ) {
+/**
+ *
+ */
+
+/**
+ *
+ */
+function wfSpecialExport( $page = '' ) {
global $wgOut, $wgLang, $wgRequest;
if( $wgRequest->getVal( 'action' ) == 'submit') {
$curonly = true;
}
- if( $page != "" ) {
+ if( $page != '' ) {
header( "Content-type: application/xml; charset=utf-8" );
$pages = explode( "\n", $page );
$xml = pages2xml( $pages, $curonly );
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# http://www.gnu.org/copyleft/gpl.html
-function wfSpecialGeo( $page = "" ) {
+/**
+ *
+ */
+
+/**
+ *
+ */
+function wfSpecialGeo( $page = '' ) {
global $wgOut, $wgLang, $wgRequest;
$coordinates = $wgRequest->getText( 'coordinates' ) ;
$coordinates = explode ( ":" , $coordinates ) ;
<?php
-
-function wfSpecialImagelist()
-{
+/**
+ *
+ */
+
+/**
+ *
+ */
+function wfSpecialImagelist() {
global $wgUser, $wgOut, $wgLang, $wgRequest;
$sort = $wgRequest->getVal( 'sort' );
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# http://www.gnu.org/copyleft/gpl.html
-function wfSpecialImport( $page = "" ) {
+/**
+ *
+ */
+
+/**
+ * Constructor
+ */
+function wfSpecialImport( $page = '' ) {
global $wgOut, $wgLang, $wgRequest, $wgTitle;
global $wgImportSources;
$dbw->deadlockLoop( array( &$revision, 'importOldRevision' ) );
}
+/**
+ *
+ */
class WikiRevision {
var $title = NULL;
var $timestamp = "20010115000000";
}
}
+/**
+ *
+ */
class WikiImporter {
var $mSource = NULL;
var $mError = "";
<?php
-
-function wfSpecialIpblocklist()
-{
+/**
+ *
+ */
+
+/**
+ *
+ */
+function wfSpecialIpblocklist() {
global $wgUser, $wgOut, $wgRequest;
$ip = $wgRequest->getVal( 'wpUnblockAddress', $wgRequest->getVal( 'ip' ) );
}
}
+/**
+ *
+ */
class IPUnblockForm {
var $ip, $reason;
}
- function doSubmit()
- {
+ function doSubmit() {
global $wgOut, $wgUser, $wgLang;
$block = new Block();
$wgOut->redirect( $success );
}
- function showList( $msg )
- {
+ function showList( $msg ) {
global $wgOut;
$wgOut->setPagetitle( wfMsg( "ipblocklist" ) );
}
}
-# Callback function to output a block
+/**
+ * Callback function to output a block
+ */
function wfAddRow( $block, $tag ) {
global $wgOut, $wgUser, $wgLang;
<?php
-#
-# This class is used to get a list of users flagged with "sysop"
-# right.
+/**
+ *
+ */
+/**
+ *
+ */
require_once("QueryPage.php");
+/**
+ * This class is used to get a list of users flagged with "sysop" right.
+ *
+ */
class ListAdminsPage extends PageQueryPage {
function getName() {
}
}
+/**
+ * constructor
+ */
function wfSpecialListadmins() {
list( $limit, $offset ) = wfCheckLimits();
<?php
-#
-# This class is used to get a list of user. The ones with specials
-# rights (sysop, bureaucrat, developer) will have them displayed
-# next to their names.
+/**
+ *
+ */
+/**
+ *
+ */
require_once("QueryPage.php");
+/**
+ * This class is used to get a list of user. The ones with specials
+ * rights (sysop, bureaucrat, developer) will have them displayed
+ * next to their names.
+ *
+ */
class ListUsersPage extends QueryPage {
function getName() {
}
}
+/**
+ * constructor
+ */
function wfSpecialListusers() {
global $wgUser, $wgOut, $wgLang;
<?php
+/**
+ *
+ */
+/**
+ * Constructor
+ */
function wfSpecialLockdb()
{
global $wgUser, $wgOut, $wgRequest;
else { $f->showForm( "" ); }
}
+/**
+ *
+ */
class DBLockForm {
- var $reason = "";
+ var $reason = '';
function DBLockForm() {
global $wgRequest;
}
- function doSubmit()
- {
+ function doSubmit() {
global $wgOut, $wgUser, $wgLang, $wgRequest;
global $wgReadOnlyFile;
$wgOut->redirect( $titleObj->getFullURL( "action=success" ) );
}
- function showSuccess()
- {
+ function showSuccess() {
global $wgOut, $wgUser;
$wgOut->setPagetitle( wfMsg( "lockdb" ) );
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# http://www.gnu.org/copyleft/gpl.html
+/**
+ *
+ */
+
+/**
+ * constructor
+ */
function wfSpecialLog( $par = '' ) {
global $wgRequest;
$logReader =& new LogReader( $wgRequest );
$logViewer->show();
}
+/**
+ *
+ */
class LogReader {
var $db, $joinClauses, $whereClauses;
var $type = '', $user = '', $title = null;
}
}
+/**
+ *
+ */
class LogViewer {
var $reader, $skin;
}
-?>
\ No newline at end of file
+?>
<?php
+/**
+ *
+ */
+/**
+ *
+ */
require_once( "QueryPage.php" );
+/**
+ *
+ */
class LonelyPagesPage extends PageQueryPage {
function getName() {
}
}
+/**
+ * Constructor
+ */
function wfSpecialLonelypages() {
list( $limit, $offset ) = wfCheckLimits();
<?php
+/**
+ *
+ */
+/**
+ *
+ */
require_once( "QueryPage.php" );
+/**
+ *
+ */
class LongPagesPage extends QueryPage {
function getName() {
}
}
+/**
+ * constructor
+ */
function wfSpecialLongpages()
{
list( $limit, $offset ) = wfCheckLimits();
<?php
+/**
+ *
+ */
-# shortcut to get the current language "special" namespace name
+/**
+ * shortcut to get the current language "special" namespace name
+ */
function sns() {
global $wgLang ;
$ns = $wgLang->getNamespaces() ;
}
-# Entry point
+/**
+ * Entry point
+ */
function wfSpecialMaintenance( $par=NULL ) {
global $wgUser, $wgOut, $wgLang, $wgTitle, $wgRequest, $wgLanguageCode;
global $wgMiserMode;
$wgOut->addHTML ( $r ) ;
}
-# Generate a maintenance page link
+/**
+ * Generate a maintenance page link
+ */
function getMPL ( $x ) {
global $wgUser , $wgLang;
$sk = $wgUser->getSkin() ;
}
-# Disambiguations, DoubleRedirects and BrokenRedirects are now using the
-# QueryPage class. Code is in a Special*.php file.
+/**#@+
+ * Disambiguations, DoubleRedirects and BrokenRedirects are now using the
+ * QueryPage class. Code is in a Special*.php file.
+ *
+ * @deprecated
+ */
function wfSpecialDoubleRedirects() {
global $wgOut;
$t = Title::makeTitle( NS_SPECIAL, "DoubleRedirects" );
$t = Title::makeTitle( NS_SPECIAL, "Disambiguations" );
$wgOut->redirect ($t->getFullURL());
}
+/**#@-*/
-# This doesn't really work anymore, because self-links are now displayed as
-# unlinked bold text, and are not entered into the link table.
+/**
+ * This doesn't really work anymore, because self-links are now displayed as
+ * unlinked bold text, and are not entered into the link table.
+ *
+ * @deprecated
+ */
function wfSpecialSelfLinks() {
global $wgUser, $wgOut, $wgLang, $wgTitle;
$fname = 'wfSpecialSelfLinks';
$wgOut->addHTML( "<p>{$sl}\n" );
}
-
+/**
+ *
+ */
function wfSpecialMispeelings () {
global $wgUser, $wgOut, $wgLang, $wgTitle;
$sk = $wgUser->getSkin();
$wgOut->addHTML( "<p>{$sl}\n" );
}
-
+/**
+ *
+ */
function wfSpecialMissingLanguageLinks() {
global $wgUser, $wgOut, $wgLang, $wgTitle, $wgRequest;
<?php
+/**
+ *
+ */
+
+/**
+ *
+ */
require_once( "LinksUpdate.php" );
-function wfSpecialMakesysop()
-{
+/**
+ * Constructor
+ */
+function wfSpecialMakesysop() {
global $wgUser, $wgOut, $wgRequest;
if ( 0 == $wgUser->getID() or $wgUser->isBlocked() ) {
if ( $f->mSubmit ) {
$f->doSubmit();
} else {
- $f->showForm( "" );
+ $f->showForm( '' );
}
}
+/**
+ *
+ */
class MakesysopForm {
var $mTarget, $mAction, $mRights, $mUser, $mSubmit;
- function MakesysopForm( &$request )
- {
+ function MakesysopForm( &$request ) {
$this->mAction = $request->getText( 'action' );
$this->mRights = $request->getVal( 'wpRights' );
$this->mUser = $request->getText( 'wpMakesysopUser' );
$this->mBuro = $request->getBool( 'wpSetBureaucrat' );
}
- function showForm( $err = "")
- {
+ function showForm( $err = '') {
global $wgOut, $wgUser, $wgLang;
if ( $wgUser->isDeveloper() ) {
}
- function doSubmit()
- {
+ function doSubmit() {
global $wgOut, $wgUser, $wgLang;
global $wgDBname, $wgMemc, $wgLocalDatabases;
}
}
- function showSuccess()
- {
+ function showSuccess() {
global $wgOut, $wgUser;
$wgOut->setPagetitle( wfMsg( "makesysoptitle" ) );
}
- function showFail()
- {
+ function showFail() {
global $wgOut, $wgUser;
$wgOut->setPagetitle( wfMsg( "makesysoptitle" ) );
<?php
+/**
+ *
+ */
+
+/**
+ *
+ */
require_once( "LinksUpdate.php" );
-function wfSpecialMovepage()
-{
+/**
+ * Constructor
+ */
+function wfSpecialMovepage() {
global $wgUser, $wgOut, $wgRequest, $action, $wgOnlySysopMayMove;
# check rights. We don't want newbies to move pages to prevents possible attack
else { $f->showForm( '' ); }
}
+/**
+ *
+ */
class MovePageForm {
var $oldTitle, $newTitle; # Text input
$this->newTitle = $wgRequest->getText( 'wpNewTitle' );
}
- function showForm( $err )
- {
+ function showForm( $err ) {
global $wgOut, $wgUser, $wgLang;
$wgOut->setPagetitle( wfMsg( 'movepage' ) );
}
- function doSubmit()
- {
+ function doSubmit() {
global $wgOut, $wgUser, $wgLang;
global $wgDeferredUpdateList, $wgMessageCache;
global $wgUseSquid, $wgRequest;
$wgOut->redirect( $success );
}
- function showSuccess()
- {
+ function showSuccess() {
global $wgOut, $wgUser, $wgRequest;
$wgOut->setPagetitle( wfMsg( 'movepage' ) );
<?php
-# Suggestion from mailing list: lists pages in order
-# least recently reviewed.
-#
+/**
+ * Suggestion from mailing list: lists pages in order
+ * least recently reviewed.
+ *
+ * @todo code it !
+ */
-function wfSpecialNeglectedpages()
-{
+/**
+ *
+ */
+function wfSpecialNeglectedpages() {
global $wgUser, $wgOut;
$wgOut->addHTML( "<p>(TODO: neglected pages)" );
<?php
+/**
+ *
+ */
+/**
+ *
+ */
require_once( "QueryPage.php" );
+/**
+ *
+ */
class NewPagesPage extends QueryPage {
function getName() {
}
}
+/**
+ * constructor
+ */
function wfSpecialNewpages()
{
global $wgRequest;
<?php
-# SpecialPage: handling special pages and lists thereof
-
-# $wgSpecialPages is a list of all SpecialPage objects. These objects are either instances of
-# SpecialPage or a sub-class thereof. They have an execute() method, which sends the HTML for the
-# special page to $wgOut. The parent class has an execute() method which distributes the call to
-# the historical global functions. Additionally, execute() also checks if the user has the
-# necessary access privileges and bails out if not.
-
-# To add a special page at run-time, use SpecialPage::addPage().
-# DO NOT manipulate this array at run-time.
+/**
+ * SpecialPage: handling special pages and lists thereof
+ * $wgSpecialPages is a list of all SpecialPage objects. These objects are
+ * either instances of SpecialPage or a sub-class thereof. They have an
+ * execute() method, which sends the HTML for the special page to $wgOut.
+ * The parent class has an execute() method which distributes the call to
+ * the historical global functions. Additionally, execute() also checks if the
+ * user has the necessary access privileges and bails out if not.
+ *
+ * To add a special page at run-time, use SpecialPage::addPage().
+ * DO NOT manipulate this array at run-time.
+ */
+/**
+ *
+ */
global $wgSpecialPages;
-/* private */ $wgSpecialPages = array(
+/**
+ * @access private
+ */
+$wgSpecialPages = array(
'DoubleRedirects' => new UnlistedSpecialPage ( 'DoubleRedirects' ),
'BrokenRedirects' => new UnlistedSpecialPage ( 'BrokenRedirects' ),
'Disambiguations' => new UnlistedSpecialPage ( 'Disambiguations' ),
"Unusedimages" => new SpecialPage( "Unusedimages" )
);
global $wgDisableCounters;
-if( !$wgDisableCounters )
-{
+if( !$wgDisableCounters ) {
$wgSpecialPages["Popularpages"] = new SpecialPage( "Popularpages" );
}
$wgSpecialPages = array_merge($wgSpecialPages, array (
"Unlockdb" => new SpecialPage( "Unlockdb", "developer" )
));
-# Parent special page class, also static functions for handling the special page list
+/**
+ * Parent special page class, also static functions for handling the special
+ * page list
+ */
class SpecialPage
{
/* private */ var $mName; # The name of the class, used in the URL. Also used for the default
}
}
-# Shortcut to construct a special page which is unlisted by default
+/**
+ * Shortcut to construct a special page which is unlisted by default
+ */
class UnlistedSpecialPage extends SpecialPage
{
function UnlistedSpecialPage( $name, $restriction = "", $function = false, $file = "default" ) {
<?php
+/**
+ *
+ */
+/**
+ *
+ */
require_once( "QueryPage.php" );
+/**
+ *
+ */
class PopularPagesPage extends QueryPage {
function getName() {
}
}
-function wfSpecialPopularpages()
-{
+/**
+ * Constructor
+ */
+function wfSpecialPopularpages() {
list( $limit, $offset ) = wfCheckLimits();
$ppp = new PopularPagesPage();
<?php
-function wfSpecialPreferences()
-{
+/**
+ *
+ */
+
+/**
+ *
+ */
+function wfSpecialPreferences() {
global $wgRequest;
$form = new PreferencesForm( $wgRequest );
$form->execute();
}
+/**
+ *
+ */
class PreferencesForm {
var $mQuickbar, $mOldpass, $mNewpass, $mRetypePass, $mStubs;
var $mRows, $mCols, $mSkin, $mMath, $mDate, $mUserEmail, $mEmailFlag, $mNick;
<?php
# $Id$
-function wfSpecialRandompage()
-{
+/**
+ *
+ */
+
+/**
+ * Constructor
+ */
+function wfSpecialRandompage() {
global $wgOut, $wgTitle, $wgArticle, $wgExtraRandompageSQL;
- $fname = "wfSpecialRandompage";
+ $fname = 'wfSpecialRandompage';
$rand = mt_rand() / mt_getrandmax();
# interpolation and sprintf() can muck up with locale-specific decimal separator
<?php
+/**
+ *
+ */
+/**
+ *
+ */
require_once( 'Feed.php' );
-function wfSpecialRecentchanges( $par )
-{
+/**
+ * Constructor
+ */
+function wfSpecialRecentchanges( $par ) {
global $wgUser, $wgOut, $wgLang, $wgTitle, $wgMemc, $wgDBname;
global $wgRequest, $wgSitename, $wgLanguageCode;
global $wgFeedClasses;
}
}
-function rcCountLink( $lim, $d, $page='Recentchanges', $more='' )
-{
+/**
+ *
+ */
+function rcCountLink( $lim, $d, $page='Recentchanges', $more='' ) {
global $wgUser, $wgLang;
$sk = $wgUser->getSkin();
$s = $sk->makeKnownLink( $wgLang->specialPage( $page ),
return $s;
}
-function rcDaysLink( $lim, $d, $page='Recentchanges', $more='' )
-{
+/**
+ *
+ */
+function rcDaysLink( $lim, $d, $page='Recentchanges', $more='' ) {
global $wgUser, $wgLang;
$sk = $wgUser->getSkin();
$s = $sk->makeKnownLink( $wgLang->specialPage( $page ),
return $s;
}
+/**
+ *
+ */
function rcDayLimitLinks( $days, $limit, $page='Recentchanges', $more='', $doall = false, $minorLink = '',
- $botLink = '', $liuLink = '', $patrLink = '' )
-{
+ $botLink = '', $liuLink = '', $patrLink = '' ) {
if ($more != '') $more .= '&';
$cl = rcCountLink( 50, $days, $page, $more ) . ' | ' .
rcCountLink( 100, $days, $page, $more ) . ' | ' .
return $note;
}
-# Obsolete? Isn't called from anywhere and $mlink isn't defined
-function rcLimitLinks( $page='Recentchanges', $more='', $doall = false )
-{
+/**
+ * Obsolete? Isn't called from anywhere and $mlink isn't defined
+ */
+function rcLimitLinks( $page='Recentchanges', $more='', $doall = false ) {
if ($more != '') $more .= '&';
$cl = rcCountLink( 50, 0, $page, $more ) . ' | ' .
rcCountLink( 100, 0, $page, $more ) . ' | ' .
<?php
+/**
+ *
+ */
+
+/**
+ *
+ */
require_once( "SpecialRecentchanges.php" );
-function wfSpecialRecentchangeslinked( $par = NULL )
-{
+/**
+ * constructor
+ */
+function wfSpecialRecentchangeslinked( $par = NULL ) {
global $wgUser, $wgOut, $wgLang, $wgTitle, $wgRequest;
$fname = "wfSpecialRecentchangeslinked";
<?php
-# Token special page for marking search requests properly in the skin.
-#
# Copyright (C) 2004 Brion Vibber <brion@pobox.com>
# http://www.mediawiki.org/
#
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# http://www.gnu.org/copyleft/gpl.html
+/**
+ * Token special page for marking search requests properly in the skin.
+ */
+
+/**
+ * constructor
+ */
function wfSpecialSearch( $par ) {
global $wgOutput;
require_once( 'SearchEngine.php' );
# Hey, it could be worse. It could be /bin/true on Solaris!
-?>
\ No newline at end of file
+?>
<?php
-#
-# SpecialShortpages extends QueryPage. It is used to return the shortest
-# pages in the database.
-#
+/**
+ *
+ */
+/**
+ *
+ */
require_once("QueryPage.php");
+/**
+ * SpecialShortpages extends QueryPage. It is used to return the shortest
+ * pages in the database.
+ */
class ShortPagesPage extends QueryPage {
function getName() {
}
}
+/**
+ * constructor
+ */
function wfSpecialShortpages() {
list( $limit, $offset ) = wfCheckLimits();
<?php
-
-function wfSpecialSpecialpages()
-{
+/**
+ *
+ */
+
+/**
+ *
+ */
+function wfSpecialSpecialpages() {
global $wgLang, $wgOut, $wgUser;
$wgOut->setRobotpolicy( "index,nofollow" );
}
}
-# sub function generating the list of pages
-# $pages : the list of pages
-# $heading : header to be used
-# $sk : skin object ???
-
-function wfSpecialSpecialpages_gen($pages,$heading,$sk)
-{
+/**
+ * sub function generating the list of pages
+ * @param $pages the list of pages
+ * @param $heading header to be used
+ * @param $sk skin object ???
+ */
+function wfSpecialSpecialpages_gen($pages,$heading,$sk) {
global $wgLang, $wgOut, $wgAllowSysopQueries;
$wgOut->addHTML( "<h2>" . wfMsg( $heading ) . "</h2>\n<ul>" );
<?php
-
-function wfSpecialStatistics()
-{
+/**
+ *
+ */
+
+/**
+ * constructor
+ */
+function wfSpecialStatistics() {
global $wgUser, $wgOut, $wgLang;
$fname = "wfSpecialStatistics";
<?php
+/**
+ *
+ */
+/**
+ *
+ */
require_once( "QueryPage.php" );
+/**
+ *
+ */
class UncategorizedPagesPage extends PageQueryPage {
function getName() {
}
}
+/**
+ * constructor
+ */
function wfSpecialUncategorizedpages() {
list( $limit, $offset ) = wfCheckLimits();
<?php
+/**
+ *
+ */
-function wfSpecialUndelete( $par )
-{
+/**
+ *
+ */
+function wfSpecialUndelete( $par ) {
global $wgRequest;
$form = new UndeleteForm( $wgRequest, $par );
$form->execute();
}
+/**
+ *
+ */
class PageArchive {
var $title;
}
}
+/**
+ *
+ */
class UndeleteForm {
var $mAction, $mTarget, $mTimestamp, $mRestore, $mTargetObj;
<?php
+/**
+ *
+ */
-function wfSpecialUnlockdb()
-{
+/**
+ *
+ */
+function wfSpecialUnlockdb() {
global $wgUser, $wgOut, $wgRequest;
if ( ! $wgUser->isDeveloper() ) {
else { $f->showForm( "" ); }
}
+/**
+ *
+ */
class DBUnlockForm {
function showForm( $err )
{
}
- function doSubmit()
- {
+ function doSubmit() {
global $wgOut, $wgUser, $wgLang;
global $wgRequest, $wgReadOnlyFile;
$wgOut->redirect( $success );
}
- function showSuccess()
- {
+ function showSuccess() {
global $wgOut, $wgUser;
global $ip;
<?php
+/**
+ *
+ */
+/**
+ *
+ */
function wfSpecialUnusedimages() {
global $wgUser, $wgOut, $wgLang, $wgTitle;
$fname = "wfSpecialUnusedimages";
<?php
+/**
+ *
+ */
+/**
+ *
+ */
require_once( "Image.php" );
-function wfSpecialUpload()
-{
+/**
+ * Constructor
+ */
+function wfSpecialUpload() {
global $wgRequest;
$form = new UploadForm( $wgRequest );
$form->execute();
}
+/**
+ *
+ */
class UploadForm {
var $mUploadAffirm, $mUploadFile, $mUploadDescription, $mIgnoreWarning;
var $mUploadSaveName, $mUploadTempName, $mUploadSize, $mUploadOldVersion;
}
- function processUpload()
- {
+ function processUpload() {
global $wgUser, $wgOut, $wgLang;
global $wgUploadDirectory;
global $wgSavedFile, $wgUploadOldVersion;
return in_array( strtolower( $ext ), $list );
}
- function saveUploadedFile( $saveName, $tempName )
- {
+ function saveUploadedFile( $saveName, $tempName ) {
global $wgSavedFile, $wgUploadOldVersion;
global $wgUploadDirectory, $wgOut;
chmod( $wgSavedFile, 0644 );
}
- function unsaveUploadedFile()
- {
+ function unsaveUploadedFile() {
global $wgUploadDirectory, $wgOut, $wgRequest;
$wgSavedFile = $_SESSION['wsUploadFiles'][$this->mSessionKey];
}
}
- function uploadError( $error )
- {
+ function uploadError( $error ) {
global $wgOut;
$sub = wfMsg( "uploadwarning" );
$wgOut->addHTML( "<h2>{$sub}</h2>\n" );
$wgOut->addHTML( "<h4 style='error'>{$error}</h4>\n" );
}
- function uploadWarning( $warning )
- {
+ function uploadWarning( $warning ) {
global $wgOut, $wgUser, $wgLang, $wgUploadDirectory, $wgRequest;
global $wgSavedFile, $wgUploadOldVersion;
global $wgUseCopyrightUpload;
</td><td align='left'>{$reup}</td></tr></table></form>\n" );
}
- function mainUploadForm( $msg )
- {
+ function mainUploadForm( $msg ) {
global $wgOut, $wgUser, $wgLang, $wgUploadDirectory, $wgRequest;
global $wgUseCopyrightUpload;
<?php
+/**
+ *
+ */
+/**
+ *
+ */
require_once('UserMailer.php');
-function wfSpecialUserlogin()
-{
+/**
+ * consutrctor
+ */
+function wfSpecialUserlogin() {
global $wgCommandLineMode;
global $wgRequest;
if( !$wgCommandLineMode && !isset( $_COOKIE[ini_get("session.name")] ) ) {
$form->execute();
}
+/**
+ *
+ */
class LoginForm {
var $mName, $mPassword, $mRetype, $mReturnto, $mCookieCheck, $mPosted;
var $mAction, $mCreateaccount, $mCreateaccountMail, $mMailmypassword;
$this->mainLoginForm( "" );
}
- /* private */ function addNewAccountMailPassword()
- {
+ /**
+ * @access private
+ */
+ function addNewAccountMailPassword() {
global $wgOut;
if ("" == $this->mEmail) {
}
- /* private */ function addNewAccount()
- {
+ /**
+ * @access private
+ */
+ function addNewAccount() {
global $wgUser, $wgOut;
global $wgDeferredUpdateList;
}
- /* private */ function addNewAccountInternal()
- {
+ /**
+ * @access private
+ */
+ function addNewAccountInternal() {
global $wgUser, $wgOut;
global $wgMaxNameChars;
global $wgMemc, $wgAccountCreationThrottle, $wgDBname, $wgIP;
return $u;
}
-
-
- /* private */ function processLogin()
- {
+ /**
+ * @access private
+ */
+ function processLogin() {
global $wgUser;
global $wgDeferredUpdateList;
}
}
- /* private */ function mailPassword()
- {
+ /**
+ * @access private
+ */
+ function mailPassword() {
global $wgUser, $wgDeferredUpdateList, $wgOutputEncoding;
global $wgCookiePath, $wgCookieDomain, $wgDBname;
}
- /* private */ function mailPasswordInternal( $u )
- {
+ /**
+ * @access private
+ */
+ function mailPasswordInternal( $u ) {
global $wgDeferredUpdateList, $wgOutputEncoding;
global $wgPasswordSender, $wgDBname, $wgIP;
global $wgCookiePath, $wgCookieDomain;
}
-
-
-
- /* private */ function successfulLogin( $msg )
- {
+ /**
+ * @access private
+ */
+ function successfulLogin( $msg ) {
global $wgUser;
global $wgDeferredUpdateList;
global $wgOut;
$wgOut->returnToMain();
}
- function userNotPrivilegedMessage()
- {
+ function userNotPrivilegedMessage() {
global $wgOut, $wgUser, $wgLang;
$wgOut->setPageTitle( wfMsg( "whitelistacctitle" ) );
$wgOut->returnToMain( false );
}
- /* private */ function mainLoginForm( $err )
- {
+ /**
+ * @access private
+ */
+ function mainLoginForm( $err ) {
global $wgUser, $wgOut, $wgLang;
global $wgDBname, $wgAllowRealName;
$wgOut->addHTML( $endText );
}
- /* private */ function hasSessionCookie()
- {
+ /**
+ * @access private
+ */
+ function hasSessionCookie() {
global $wgDisableCookieCheck;
return ( $wgDisableCookieCheck ) ? true : ( "" != $_COOKIE[session_name()] );
}
- /* private */ function cookieRedirectCheck( $type )
- {
+ /**
+ * @access private
+ */
+ function cookieRedirectCheck( $type ) {
global $wgOut, $wgLang;
$titleObj = Title::makeTitle( NS_SPECIAL, "Userlogin" );
return $wgOut->redirect( $check );
}
- /* private */ function onCookieRedirectCheck( $type ) {
+ /**
+ * @access private
+ */
+ function onCookieRedirectCheck( $type ) {
global $wgUser;
if ( !$this->hasSessionCookie() ) {
}
}
- /* private */ function throttleHit( $limit ) {
+ /**
+ * @access private
+ */
+ function throttleHit( $limit ) {
global $wgOut;
$wgOut->addWikiText( wfMsg( 'acct_creation_throttle_hit', $limit ) );
<?php
+/**
+ *
+ */
-function wfSpecialUserlogout()
-{
+/**
+ * constructor
+ */
+function wfSpecialUserlogout() {
global $wgUser, $wgOut, $returnto;
$wgUser->logout();
$wgOut->mCookies = array();
- $wgOut->setRobotpolicy( "noindex,nofollow" );
- $wgOut->addHTML( wfMsg( "logouttext" ) );
+ $wgOut->setRobotpolicy( 'noindex,nofollow' );
+ $wgOut->addHTML( wfMsg( 'logouttext' ) );
$wgOut->returnToMain();
}
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# http://www.gnu.org/copyleft/gpl.html
+/**
+ *
+ */
+
+/**
+ *
+ */
class Validation {
function find_this_version( $article_title , &$article_time , &$id , &$tab ) {
}
-function wfSpecialValidate( $page = "" ) {
+/**
+ * constructor
+ */
+function wfSpecialValidate( $page = '' ) {
global $wgOut, $wgRequest, $wgUseValidation;
if( !$wgUseValidation ) {
<?php
+/**
+ *
+ */
-function wfSpecialVersion()
-{
+/**
+ * constructor
+ */
+function wfSpecialVersion() {
global $wgUser, $wgOut, $wgVersion;
$fname = "wfSpecialVersion";
"[http://www.mysql.com/ MySQL]" => mysql_get_server_info()
);
- $out = "";
+ $out = '';
foreach( $versions as $module => $ver ) {
$out .= ":$module: $ver\n";
}
<?php
+/**
+ *
+ */
-function wfSpecialVote()
-{
+/**
+ * @todo code this feature !
+ */
+function wfSpecialVote() {
global $wgUser, $wgOut;
- $wgOut->addHTML( "<p>(TODO: Vote)" );
+ $wgOut->addHTML( '<p>(TODO: Vote)' );
}
?>
<?php
+/**
+ *
+ */
-require_once ( "QueryPage.php" ) ;
+/**
+ *
+ */
+require_once ( 'QueryPage.php' ) ;
+/**
+ *
+ */
class WantedPagesPage extends QueryPage {
function getName() {
- return "Wantedpages";
+ return 'Wantedpages';
}
function isExpensive() {
}
}
-function wfSpecialWantedpages()
-{
+/**
+ * constructor
+ */
+function wfSpecialWantedpages() {
list( $limit, $offset ) = wfCheckLimits();
$wpp = new WantedPagesPage();
<?php
+/**
+ *
+ */
+
+/**
+ *
+ */
require_once( "SpecialRecentchanges.php" );
require_once( "WatchedItem.php" );
-function wfSpecialWatchlist()
-{
+/**
+ * constructor
+ */
+function wfSpecialWatchlist() {
global $wgUser, $wgOut, $wgLang, $wgTitle, $wgMemc, $wgRequest;
global $wgUseWatchlistCache, $wgWLCacheTimeout, $wgDBname;
$fname = "wfSpecialWatchlist";
<?php
-
-function wfSpecialWhatlinkshere($par = NULL)
-{
+/**
+ *
+ */
+
+/**
+ *
+ */
+function wfSpecialWhatlinkshere($par = NULL) {
global $wgUser, $wgOut, $wgRequest;
$fname = "wfSpecialWhatlinkshere";
}
}
-function wfShowIndirectLinks( $level, $lid, $limit )
-{
+/**
+ *
+ */
+function wfShowIndirectLinks( $level, $lid, $limit ) {
global $wgOut, $wgUser;
$fname = "wfShowIndirectLinks";
<?php
-# See deferred.doc
+/**
+ * See deferred.doc
+ */
+/**
+ *
+ */
class SquidUpdate {
var $urlArr, $mMaxTitles;
<?php
-# See title.doc
-
+/**
+ * See title.doc
+ *
+ */
+
+/**
+ *
+ */
$wgTitleInterwikiCache = array();
-
-# Title class
-#
-# * Represents a title, which may contain an interwiki designation or namespace
-# * Can fetch various kinds of data from the database, albeit inefficiently.
-#
-
define ( 'GAID_FOR_UPDATE', 1 );
+/**
+ * Title class
+ * - Represents a title, which may contain an interwiki designation or namespace
+ * - Can fetch various kinds of data from the database, albeit inefficiently.
+ *
+ * @todo migrate comments to phpdoc format
+*/
class Title {
# All member variables should be considered private
# Please use the accessor functions
<?php
+/**
+ *
+ */
+
+/**
+ *
+ */
class Tokenizer {
/* private */ var $mText, # Text to be processed by the tokenizer
$mPos, # current position of tokenizer in text
$mQueuedToken; # Tokens that were already found, but not
# returned yet.
- /* private */ function Tokenizer()
- {
+ /**
+ * Constructor
+ * @access private
+ */
+ function Tokenizer() {
global $wgLang;
$this->mPos=0;
$this->linkPrefixExtension = $wgLang->linkPrefixExtension();
}
- # factory function
- function newFromString( $s )
- {
+ /**
+ * factory function
+ */
+ function newFromString( $s ) {
$fname = 'Tokenizer::newFromString';
wfProfileIn( $fname );
}
- // Return the next token, but do not increase the pointer. The next call
- // to previewToken or nextToken will return the same token again.
- // Actually, the pointer is increased, but the token is queued. The next
- // call to previewToken or nextToken will check the queue and return
- // the stored token.
- function previewToken()
- {
+ /**
+ * Return the next token, but do not increase the pointer. The next call
+ * to previewToken or nextToken will return the same token again.
+ * Actually, the pointer is increased, but the token is queued. The next
+ * call to previewToken or nextToken will check the queue and return
+ * the stored token.
+ */
+ function previewToken() {
$fname = 'Tokenizer::previewToken';
wfProfileIn( $fname );
}
- // get the next token
- // proceeds character by character through the text, looking for characters needing
- // special attention. Those are currently: I, R, ', [, ], newline
- //
- // TODO: handling of French blanks not yet implemented
- function nextToken()
- {
+ /**
+ * Get the next token.
+ *
+ * proceeds character by character through the text, looking for characters needing
+ * special attention. Those are currently: I, R, ', [, ], newline
+ *
+ * @todo handling of French blanks not yet implemented
+ */
+ function nextToken() {
$fname = 'Tokenizer::nextToken';
wfProfileIn( $fname );
return $token;
}
- // function continues
- // checks whether the mText continues with $cont from mPos+1
- /* private */ function continues( $cont )
- {
+ /**
+ * function continues
+ *
+ * checks whether the mText continues with $cont from mPos+1
+ *
+ * @access private
+ */
+ function continues( $cont ) {
// If string is not long enough to contain $cont, return false
if ( $this->mTextLength < $this->mPos + strlen( $cont ) )
return false;
return true;
}
- // function preceeded
- // checks whether the mText is preceeded by $prec at position mPos
- /* private */ function preceeded( $prec )
- {
+ /**
+ * function preceeded
+ *
+ * checks whether the mText is preceeded by $prec at position mPos
+ *
+ * @access private
+ */
+ function preceeded( $prec ) {
$len = strlen( $prec );
// if $prec is longer than the text up to mPos, return false
if ( $this->mPos < $len )
return ( 0 == strcmp( $prec, substr($this->mText, $this->mPos-$len, $len) ) );
}
- function readAllUntil( $border )
- {
+ /**
+ *
+ */
+ function readAllUntil( $border ) {
$n = strpos( $this->mText, $border, $this->mPos );
if ( $n === false )
return '';
<?php
-# See deferred.doc
+/**
+ * See deferred.doc
+ *
+ */
+
+/**
+ *
+ */
require_once( 'UserUpdate.php' );
require_once( 'ViewCountUpdate.php' );
require_once( 'SiteStatsUpdate.php' );
<?php
-# See user.doc
-
+/**
+ * See user.doc
+ *
+ */
+
+/**
+ *
+ */
require_once( 'WatchedItem.php' );
+/**
+ *
+ */
class User {
/* private */ var $mId, $mName, $mPassword, $mEmail, $mNewtalk;
/* private */ var $mRights, $mOptions;
$this->loadDefaults();
}
- # Static factory method
- #
+ /**
+ * Static factory method
+ * @static
+ */
function newFromName( $name ) {
$u = new User();
return $u;
}
- /* static */ function whoIs( $id ) {
+ /**
+ * @static
+ */
+ function whoIs( $id ) {
$dbr =& wfGetDB( DB_SLAVE );
return $dbr->getField( 'user', 'user_name', array( 'user_id' => $id ) );
}
- /* static */ function whoIsReal( $id ) {
+ /**
+ * @static
+ */
+ function whoIsReal( $id ) {
$dbr =& wfGetDB( DB_SLAVE );
return $dbr->getField( 'user', 'user_real_name', array( 'user_id' => $id ) );
}
- /* static */ function idFromName( $name ) {
+ /**
+ * @static
+ */
+ function idFromName( $name ) {
$fname = "User::idFromName";
$nt = Title::newFromText( $name );
}
}
- # does the string match an anonymous user IP address?
- /* static */ function isIP( $name ) {
+ /**
+ * does the string match an anonymous user IP address?
+ * @static
+ */
+ function isIP( $name ) {
return preg_match("/^\d{1,3}\.\d{1,3}.\d{1,3}\.\d{1,3}$/",$name);
-
}
- /* static */ function randomPassword() {
+ /**
+ * static
+ */
+ function randomPassword() {
$pwchars = 'ABCDEFGHJKLMNPQRSTUVWXYZabcdefghjkmnpqrstuvwxyz';
$l = strlen( $pwchars ) - 1;
return $np;
}
+ /**
+ *
+ */
function loadDefaults() {
global $wgLang, $wgIP;
global $wgNamespacesToBeSearchedDefault;
$this->mHash = false;
}
- /* private */ function getBlockedStatus()
- {
+ /**
+ * @access private
+ */
+ function getBlockedStatus() {
global $wgIP, $wgBlockCache, $wgProxyList;
if ( -1 != $this->mBlockedby ) { return; }
}
}
- function isBlocked()
- {
+ function isBlocked() {
$this->getBlockedStatus();
if ( 0 === $this->mBlockedby ) { return false; }
return true;
@session_start();
}
- /* static */ function loadFromSession()
- {
+ /**
+ * @static
+ */
+ function loadFromSession() {
global $wgMemc, $wgDBname;
if ( isset( $_SESSION['wsUserID'] ) ) {
return new User(); # Can't log in from session
}
- function loadFromDatabase()
- {
+ /**
+ *
+ */
+ function loadFromDatabase() {
global $wgCommandLineMode;
$fname = "User::loadFromDatabase";
if ( $this->mDataLoaded || $wgCommandLineMode ) {
return in_array( 'bot', $this->mRights );
}
- # Load a skin if it doesn't exist or return it
- # FIXME : need to check the old failback system [AV]
+ /**
+ * Load a skin if it doesn't exist or return it
+ * @todo FIXME : need to check the old failback system [AV]
+ */
function &getSkin() {
global $IP, $wgUsePHPTal;
if ( ! isset( $this->mSkin ) ) {
}
- /* private */ function encodeOptions() {
+ /**
+ * @access private
+ */
+ function encodeOptions() {
$a = array();
foreach ( $this->mOptions as $oname => $oval ) {
array_push( $a, $oname.'='.$oval );
return $s;
}
- /* private */ function decodeOptions( $str ) {
+ /**
+ * @access private
+ */
+ function decodeOptions( $str ) {
$a = explode( "\n", $str );
foreach ( $a as $s ) {
if ( preg_match( "/^(.[^=]*)=(.*)$/", $s, $m ) ) {
$wgMemc->delete( "$wgDBname:user:id:$this->mId" );
}
- # Checks if a user with the given name exists, returns the ID
- #
+ /**
+ * Checks if a user with the given name exists, returns the ID
+ */
function idForName() {
$fname = 'User::idForName';
}
- function spreadBlock()
- {
+ function spreadBlock() {
global $wgIP;
# If the (non-anonymous) user is blocked, this function will block any IP address
# that they successfully log on from.
}
- function getPageRenderingHash(){
+ function getPageRenderingHash() {
if( $this->mHash ){
return $this->mHash;
}
return $allowed;
}
- # Set mDataLoaded, return previous value
- # Use this to prevent DB access in command-line scripts or similar situations
- function setLoaded( $loaded )
- {
+ /**
+ * Set mDataLoaded, return previous value
+ * Use this to prevent DB access in command-line scripts or similar situations
+ */
+ function setLoaded( $loaded ) {
return wfSetVar( $this->mDataLoaded, $loaded );
}
return Title::makeTitle( NS_USER, $this->mName );
}
- /* static */ function getMaxID() {
+ /**
+ * @static
+ */
+ function getMaxID() {
$dbr =& wfGetDB( DB_SLAVE );
return $dbr->selectField( 'user', 'max(user_id)', false );
}
return $this->mId > User::getMaxID() * 0.99 && !$this->isSysop() && !$this->isBot() || $this->getID() == 0;
}
- # Check to see if the given clear-text password is one of the accepted passwords
+ /**
+ * Check to see if the given clear-text password is one of the accepted passwords
+ */
function checkPassword( $password ) {
$this->loadFromDatabase();
$ep = $this->encryptPassword( $password );
<?php
+/**
+ * Provide mail capabilities
+ *
+ */
-# This function will perform a direct (authenticated) login to
-# a SMTP Server to use for mail relaying if 'wgSMTP' specifies an
-# array of parameters. It requires PEAR:Mail to do that.
-# Otherwise it just uses the standard PHP 'mail' function.
-function userMailer( $to, $from, $subject, $body )
-{
+/**
+ * This function will perform a direct (authenticated) login to
+ * a SMTP Server to use for mail relaying if 'wgSMTP' specifies an
+ * array of parameters. It requires PEAR:Mail to do that.
+ * Otherwise it just uses the standard PHP 'mail' function.
+ *
+ * @param string $to recipient's email
+ * @param string $from sender's email
+ * @param string $subject email's subject
+ * @param string $body email's text
+ */
+function userMailer( $to, $from, $subject, $body ) {
global $wgUser, $wgSMTP, $wgOutputEncoding, $wgErrorString;
$qto = wfQuotedPrintable( $to );
}
}
+/**
+ *
+ */
function mailErrorHandler( $code, $string ) {
global $wgErrorString;
$wgErrorString = preg_replace( "/^mail\(\): /", "", $string );
}
-
?>
<?php
-# See deferred.doc
+/**
+ * See deferred.doc
+ *
+ */
+/**
+ *
+ */
class UserTalkUpdate {
/* private */ var $mAction, $mNamespace, $mTitle;
- function UserTalkUpdate( $action, $ns, $title )
- {
+ function UserTalkUpdate( $action, $ns, $title ) {
$this->mAction = $action;
$this->mNamespace = $ns;
$this->mTitle = str_replace( '_', ' ', $title );
}
- function doUpdate()
- {
-
+ function doUpdate() {
global $wgUser, $wgLang, $wgMemc, $wgDBname;
$fname = 'UserTalkUpdate::doUpdate';
<?php
-# See deferred.doc
+/**
+ * See deferred.doc
+ *
+ */
+/**
+ *
+ */
class UserUpdate {
-
+ /**
+ *
+ */
function UserUpdate() { }
- function doUpdate()
- {
+ /**
+ *
+ */
+ function doUpdate() {
global $wgUser;
$wgUser->saveSettings();
}
<?php
-# Simple 1:1 upper/lowercase switching arrays for utf-8 text
-# Won't get context-sensitive things yet
-
-# Hack for bugs in ucfirst() and company
-
-# These are pulled from memcached if possible, as this is faster than filling
-# up a big array manually. See also languages/LanguageUtf8.php
+/**
+ * Simple 1:1 upper/lowercase switching arrays for utf-8 text
+ * Won't get context-sensitive things yet
+ *
+ * Hack for bugs in ucfirst() and company
+ *
+ * These are pulled from memcached if possible, as this is faster than filling
+ * up a big array manually. See also languages/LanguageUtf8.php
+ */
+/*
+ * Translation array to get upper case character
+ */
$wikiUpperChars = array(
'a' => 'A',
'b' => 'B',
'\xf0\x90\x91\x8d' => '\xf0\x90\x90\xa5'
);
+/*
+ * Translation array to get lower case character
+ */
$wikiLowerChars = array (
'A' => 'a',
'B' => 'b',
<?php
# $Id$
-# See deferred.doc
+/**
+ * See deferred.doc
+ */
+
+/**
+ *
+ */
class ViewCountUpdate {
var $mPageID;
- function ViewCountUpdate( $pageid )
- {
+ /**
+ *
+ */
+ function ViewCountUpdate( $pageid ) {
$this->mPageID = $pageid;
}
- function doUpdate()
- {
+ /**
+ *
+ */
+ function doUpdate() {
global $wgDisableCounters;
if ( $wgDisableCounters ) { return; }
$db =& wfGetDB( DB_MASTER );
<?php
+/**
+ *
+ */
+/**
+ *
+ */
class WatchedItem {
var $mTitle, $mUser;
return $wl;
}
- # Returns the memcached key for this item
+ /**
+ * Returns the memcached key for this item
+ */
function watchKey() {
global $wgDBname;
return "$wgDBname:watchlist:user:$this->id:page:$this->ns:$this->ti";
}
- # Is mTitle being watched by mUser?
+ /**
+ * Is mTitle being watched by mUser?
+ */
function isWatched()
{
# Pages and their talk pages are considered equivalent for watching;
return $iswatched;
}
- function addWatch()
- {
+ function addWatch() {
$fname = "WatchedItem::addWatch";
# REPLACE instead of INSERT because occasionally someone
# accidentally reloads a watch-add operation.
return true;
}
- function removeWatch()
- {
+ function removeWatch() {
$fname = 'WatchedItem::removeWatch';
$dbw =& wfGetDB( DB_MASTER );
}
}
- /* static */ function duplicateEntries( $ot, $nt ) {
+ /**
+ * @static
+ */
+ function duplicateEntries( $ot, $nt ) {
$fname = "WatchedItem::duplicateEntries";
global $wgMemc, $wgDBname;
$oldnamespace = $ot->getNamespace() & ~1;
<?php
-# Deal with importing all those nasssty globals and things
-#
+/**
+ * Deal with importing all those nasssty globals and things
+ */
+
# Copyright (C) 2003 Brion Vibber <brion@pobox.com>
# http://www.mediawiki.org/
#
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# http://www.gnu.org/copyleft/gpl.html
-# Hypothetically, we could use a WebRequest object to fake a
-# self-contained request (FauxRequest).
-
+/**
+ * Hypothetically, we could use a WebRequest object to fake a
+ * self-contained request (FauxRequest).
+ */
class WebRequest {
function WebRequest() {
$this->checkMagicQuotes();
return $wgServer . $this->getRequestURL();
}
- # Take an arbitrary query and rewrite the present URL to include it
+ /**
+ * Take an arbitrary query and rewrite the present URL to include it
+ */
function appendQuery( $query ) {
global $wgTitle;
$basequery = '';
}
}
+/**
+ *
+ */
class FauxRequest extends WebRequest {
var $data = null;
var $wasPosted = false;
<?php
+/**
+ * Script to kill a MySQL thread after a specified timeout
+ */
-# Script to kill a MySQL thread after a specified timeout
-
+/**
+ *
+ */
$wgCommandLineMode = true;
unset( $IP );
<?php
+/**
+ * Command line script to check for an open proxy at a specified location
+ */
-# Command line script to check for an open proxy at a specified location
-
-# Exit if there are not enough parameters, or if it's not command line mode
-
+/**
+ *
+ */
$output = '';
+
+/**
+ * Exit if there are not enough parameters, or if it's not command line mode
+ */
if ( ( isset( $_REQUEST ) && array_key_exists( 'argv', $_REQUEST ) ) || count( $argv ) < 4 ) {
$output .= "Incorrect parameters\n";
} else {
-
- # Get parameters
+ /**
+ * Get parameters
+ */
$ip = $argv[1];
$port = $argv[2];
$url = $argv[3];