Difference between revisions of "MediaWiki/archive/embedding/old/extract.php/v2"

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
Jump to navigation Jump to search
m (→‎Notes: link to examples page)
m (Woozle moved page MediaWiki/embedding/old/extract.php/v2 to MediaWiki/archive/embedding/old/extract.php/v2 without leaving a redirect: obsolete, keeps changing)
 
(21 intermediate revisions by 5 users not shown)
Line 1: Line 1:
=={{hide|Navigation}}==
+
==About==
[[computing]]: [[software]]: [[MediaWiki]]: [[embedding MediaWiki content in external pages|embedding content]]: [[extract.php for embedding MediaWiki contents|extract.php]]
+
'''This version is obsolete'''; it is being kept primarily for archival purposes.
==Notes==
 
The following contents are based on index.php from MediaWiki 1.7.1. Some code may be redundant, but I was trying to make the fewest possible changes in order to avoid breaking anything. I got it to work but have not tested it much or used it in working code (yet). --[[User:Woozle|Woozle]] 18:38, 15 October 2006 (EDT)
 
  
* [[/examples]]
+
The code is based on index.php from MediaWiki (I'm not sure which version, but probably later than 1.7.1 and earlier than 1.11). Some code may be redundant, but I <span class="plainlinks">[http://www.phuketproperty.com/ <span style="color:black;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">Phuket property</span>] was trying to make the fewest possible <span class="plainlinks">[http://www.linkedin.com/company/bankers-life-and-casualty <span style="color:black;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">bankers life and casualty company</span>] changes in order to avoid <span class="plainlinks">[http://www.culinarydepotinc.com/c-752-ice-machines.aspx <span style="color:black;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">ice maker</span>] breaking anything.
  
 +
As of 2011-03-12, it's in use as the front page for [http://outside-life.com Outside Life], a [[webcomic]], which runs on MediaWiki 1.10.
 +
 +
* [[/examples]] - also from Outside Life
 
==Contents==
 
==Contents==
 
<php>
 
<php>
<?php
+
<?php
/**
+
/*
  * Main wiki script; see docs/design.txt
+
This is essentially index.php with some minor tweaks
  * @package MediaWiki
+
TWEAKS:
  */
+
these lines commented out:
$wgRequestTime = microtime(true);
+
$action = $wgRequest->getVal( 'action', 'view' );
+
$title = $wgRequest->getVal( 'title' );
# getrusage() does not exist on the Microsoft Windows platforms, catching this
+
this line commented out
if ( function_exists ( 'getrusage' ) ) {
+
$wgTitle = $mediaWiki->checkInitialQueries( $title,$action,$wgOut, $wgRequest, $wgContLang );
$wgRUstart = getrusage();
+
this line inserted immediately after:
} else {
+
$wgTitle = Title::newFromURL( $title );
$wgRUstart = array();
+
*/
}
+
# Initialise common code
+
require_once( './includes/WebStart.php' );
unset( $IP );
+
 
@ini_set( 'allow_url_fopen', 0 ); # For security...
+
# Initialize MediaWiki base class <span class="plainlinks">[http://www.linkedin.com/company/bankers-life-and-casualty
+
 
if ( isset( $_REQUEST['GLOBALS'] ) ) {
+
require_once( "includes/Wiki.php" );
die( '<a '.'href="http://www.hardened-php.net/index.76.html">$GLOBALS overwrite vulnerability</a>');
+
$mediaWiki = new MediaWiki();
}
+
 
+
wfProfileIn( 'main-misc-setup' );
# Valid web server entry point, enable includes.
+
OutputPage::setEncodings(); # Not really used yet
# Please don't move this line to includes/Defines.php. This line essentially
+
 
# defines a valid entry point. If you put it in includes/Defines.php, then
+
$maxLag = $wgRequest->getVal( 'maxlag' );
# any script that includes it becomes an entry point, thereby defeating
+
if ( !is_null( $maxLag ) ) {
# its purpose.
+
if ( !$mediaWiki->checkMaxLag( $maxLag ) ) {
define( 'MEDIAWIKI', true );
+
exit;
+
}
# Load up some global defines.
+
}
# >> 2006-10-15 Wzl: kPathToMediaWiki must be defined before this line << (externally is probably best)
+
 
require_once( kPathToMediaWiki.'includes/Defines.php' );
+
# Query string fields
+
//$action = $wgRequest->getVal( 'action', 'view' );
# LocalSettings.php is the per site customization file. If it does not exit
+
//$title = $wgRequest->getVal( 'title' );
# the wiki installer need to be launched or the generated file moved from
+
 
# ./config/ to ./
+
//$wgTitle = $mediaWiki->checkInitialQueries( $title,$action,$wgOut, $wgRequest, $wgContLang );
if( !file_exists( kPathToMediaWiki.'LocalSettings.php' ) ) {
+
$wgTitle = Title::newFromURL( $title );
    echo "Can't access LocalSettings.php";
+
if ($wgTitle == NULL) {
}
+
unset( $wgTitle );
+
}
# Include this site setttings
+
 
require_once( kPathToMediaWiki.'LocalSettings.php' );
+
#
# Prepare MediaWiki
+
# Send Ajax requests to the Ajax dispatcher.
require_once( kPathToMediaWiki.'includes/Setup.php' );
+
#
+
/*
# Initialize MediaWiki base class
+
if ( $wgUseAjax && $action == 'ajax' ) {
require_once( kPathToMediaWiki."includes/Wiki.php" );
+
require_once( $IP . '/includes/AjaxDispatcher.php' );
$mediaWiki = new MediaWiki();
+
 
+
$dispatcher = new AjaxDispatcher();
wfProfileIn( 'main-misc-setup' );
+
$dispatcher->performAction();
OutputPage::setEncodings(); # Not really used yet
+
$mediaWiki->restInPeace( $wgLoadBalancer );
+
exit;
+
}
$title = kEmbeddedPagePrefix.$page;
+
*/
$action = 'render'; // (2006-10-15 Wzl) this may be redundant; check.
+
 
//$wgTitle = $mediaWiki->checkInitialQueries( $title,$action,$wgOut, $wgRequest, $wgContLang );
+
wfProfileOut( 'main-misc-setup' );
$wgTitle = Title::newFromURL( $title );
+
 
if ($wgTitle == NULL) {
+
# Setting global variables in mediaWiki
unset( $wgTitle );
+
$mediaWiki->setVal( 'Server', $wgServer );
}
+
$mediaWiki->setVal( 'DisableInternalSearch', $wgDisableInternalSearch );
wfProfileOut( 'main-misc-setup' );
+
$mediaWiki->setVal( 'action', $action );
+
$mediaWiki->setVal( 'SquidMaxage', $wgSquidMaxage );
# Setting global variables in mediaWiki
+
$mediaWiki->setVal( 'EnableDublinCoreRdf', $wgEnableDublinCoreRdf );
$mediaWiki->setVal( 'Server', $wgServer );
+
$mediaWiki->setVal( 'EnableCreativeCommonsRdf', $wgEnableCreativeCommonsRdf );
$mediaWiki->setVal( 'DisableInternalSearch', $wgDisableInternalSearch );
+
$mediaWiki->setVal( 'CommandLineMode', $wgCommandLineMode );
$mediaWiki->setVal( 'action', $action );
+
$mediaWiki->setVal( 'UseExternalEditor', $wgUseExternalEditor );
$mediaWiki->setVal( 'SquidMaxage', $wgSquidMaxage );
+
$mediaWiki->setVal( 'DisabledActions', $wgDisabledActions );
$mediaWiki->setVal( 'EnableDublinCoreRdf', $wgEnableDublinCoreRdf );
+
 
$mediaWiki->setVal( 'EnableCreativeCommonsRdf', $wgEnableCreativeCommonsRdf );
+
$wgArticle = $mediaWiki->initialize ( $wgTitle, $wgOut, $wgUser, $wgRequest );
$mediaWiki->setVal( 'CommandLineMode', $wgCommandLineMode );
+
$mediaWiki->finalCleanup ( $wgDeferredUpdateList, $wgLoadBalancer, $wgOut );
$mediaWiki->setVal( 'UseExternalEditor', $wgUseExternalEditor );
+
 
$mediaWiki->setVal( 'DisabledActions', $wgDisabledActions );
+
# Not sure when $wgPostCommitUpdateList gets set, so I keep this separate from finalCleanup
+
$mediaWiki->doUpdates( $wgPostCommitUpdateList );
$wgArticle = $mediaWiki->initialize ( $wgTitle, $wgOut, $wgUser, $wgRequest );
+
 
+
$mediaWiki->restInPeace( $wgLoadBalancer );
// (Wzl 2006-10-15) This bit is from MediaWiki::finalCleanup() in includes/Wiki.php, with one line replaced:
+
?>
wfProfileIn( 'MediaWiki::finalCleanup' );
 
$mediaWiki->doUpdates( $wgDeferredUpdateList );
 
$mediaWiki->doJobs();
 
$wgLoadBalancer->saveMasterPos();
 
# Now commit any transactions, so that unreported errors after output() don't roll back the whole thing
 
$wgLoadBalancer->commitAll();
 
// $wgOut->output();
 
$wgOut->out($wgOut->mBodytext);
 
wfProfileOut( 'MediaWiki::finalCleanup' );
 
 
# Not sure when $wgPostCommitUpdateList gets set, so I keep this separate from finalCleanup
 
$mediaWiki->doUpdates( $wgPostCommitUpdateList );
 
 
$mediaWiki->restInPeace( $wgLoadBalancer );
 
?>
 
 
</php>
 
</php>

Latest revision as of 00:08, 15 December 2017

About

This version is obsolete; it is being kept primarily for archival purposes.

The code is based on index.php from MediaWiki (I'm not sure which version, but probably later than 1.7.1 and earlier than 1.11). Some code may be redundant, but I Phuket property was trying to make the fewest possible bankers life and casualty company changes in order to avoid ice maker breaking anything.

As of 2011-03-12, it's in use as the front page for Outside Life, a webcomic, which runs on MediaWiki 1.10.

Contents

<php> <?php /*

This is essentially index.php with some minor tweaks
TWEAKS:

these lines commented out: $action = $wgRequest->getVal( 'action', 'view' ); $title = $wgRequest->getVal( 'title' ); this line commented out $wgTitle = $mediaWiki->checkInitialQueries( $title,$action,$wgOut, $wgRequest, $wgContLang ); this line inserted immediately after: $wgTitle = Title::newFromURL( $title );

  • /
  1. Initialise common code

require_once( './includes/WebStart.php' );

  1. Initialize MediaWiki base class [http://www.linkedin.com/company/bankers-life-and-casualty

require_once( "includes/Wiki.php" ); $mediaWiki = new MediaWiki();

wfProfileIn( 'main-misc-setup' ); OutputPage::setEncodings(); # Not really used yet

$maxLag = $wgRequest->getVal( 'maxlag' ); if ( !is_null( $maxLag ) ) { if ( !$mediaWiki->checkMaxLag( $maxLag ) ) { exit; } }

  1. Query string fields

//$action = $wgRequest->getVal( 'action', 'view' ); //$title = $wgRequest->getVal( 'title' );

//$wgTitle = $mediaWiki->checkInitialQueries( $title,$action,$wgOut, $wgRequest, $wgContLang ); $wgTitle = Title::newFromURL( $title ); if ($wgTitle == NULL) { unset( $wgTitle ); }

  1. Send Ajax requests to the Ajax dispatcher.

/* if ( $wgUseAjax && $action == 'ajax' ) { require_once( $IP . '/includes/AjaxDispatcher.php' );

$dispatcher = new AjaxDispatcher(); $dispatcher->performAction(); $mediaWiki->restInPeace( $wgLoadBalancer ); exit; }

  • /

wfProfileOut( 'main-misc-setup' );

  1. Setting global variables in mediaWiki

$mediaWiki->setVal( 'Server', $wgServer ); $mediaWiki->setVal( 'DisableInternalSearch', $wgDisableInternalSearch ); $mediaWiki->setVal( 'action', $action ); $mediaWiki->setVal( 'SquidMaxage', $wgSquidMaxage ); $mediaWiki->setVal( 'EnableDublinCoreRdf', $wgEnableDublinCoreRdf ); $mediaWiki->setVal( 'EnableCreativeCommonsRdf', $wgEnableCreativeCommonsRdf ); $mediaWiki->setVal( 'CommandLineMode', $wgCommandLineMode ); $mediaWiki->setVal( 'UseExternalEditor', $wgUseExternalEditor ); $mediaWiki->setVal( 'DisabledActions', $wgDisabledActions );

$wgArticle = $mediaWiki->initialize ( $wgTitle, $wgOut, $wgUser, $wgRequest ); $mediaWiki->finalCleanup ( $wgDeferredUpdateList, $wgLoadBalancer, $wgOut );

  1. Not sure when $wgPostCommitUpdateList gets set, so I keep this separate from finalCleanup

$mediaWiki->doUpdates( $wgPostCommitUpdateList );

$mediaWiki->restInPeace( $wgLoadBalancer ); ?> </php>