$wgOut->setArticleRelated( false );
$wgOut->setRobotpolicy( "noindex,follow" );
- $par = NULL;
- list($t, $par) = split( "/", $wgTitle->getDBkey(), 2 );
+ $bits = split( "/", $wgTitle->getDBkey(), 2 );
+ $t = $bits[0];
+ if( empty( $bits[1] ) ) {
+ $par = NULL;
+ } else {
+ $par = $bits[1];
+ }
if ( array_key_exists( $t, $validSP ) ||
( $wgUser->isSysop() && array_key_exists( $t, $sysopSP ) ) ||
exit();
}
+function wfDebugDieBacktrace( $msg = "" ) {
+ $msg .= "\n<p>Backtrace:</p>\n<ul>\n";
+ $backtrace = debug_backtrace();
+ foreach( $backtrace as $call ) {
+ $f = split( DIRECTORY_SEPARATOR, $call['file'] );
+ $file = $f[count($f)-1];
+ $msg .= "<li>" . $file . " line " . $call['line'] . ", in ";
+ if( !empty( $call['class'] ) ) $msg .= $call['class'] . "::";
+ $msg .= $call['function'] . "()</li>\n";
+ }
+ die( $msg );
+}
+
function wfNumberOfArticles()
{
global $wgNumberOfArticles;
function wfCheckLimits( $deflimit = 50, $optionname = "rclimit" ) {
global $wgUser;
- $limit = (int)$_REQUEST['limit'];
+ if( isset( $_REQUEST['limit'] ) ) {
+ $limit = IntVal( $_REQUEST['limit'] );
+ } else {
+ $limit = 0;
+ }
if( $limit < 0 ) $limit = 0;
if( ( $limit == 0 ) && ( $optionname != "" ) ) {
$limit = (int)$wgUser->getOption( $optionname );
if( $limit <= 0 ) $limit = $deflimit;
if( $limit > 5000 ) $limit = 5000; # We have *some* limits...
- $offset = (int)$_REQUEST['offset'];
- $offset = (int)$offset;
+ if( isset( $_REQUEST['offset'] ) ) {
+ $offset = IntVal( $_REQUEST['offset'] );
+ } else {
+ $offset = 0;
+ }
if( $offset < 0 ) $offset = 0;
if( $offset > 65000 ) $offset = 65000; # do we need a max? what?
{
# Cleared with clearState():
var $mOutput, $mAutonumber, $mLastSection, $mDTopen, $mStripState;
+ var $mContainsOldMagic = 0;
# Temporary:
var $mOptions, $mTitle;
$lastToken = array_pop( $tokenStack );
while ( $lastToken["type"] != "[[" )
{
- $linkText = $lastToken["text"] . $linkText;
+ if( !empty( $lastToken["text"] ) ) {
+ $linkText = $lastToken["text"] . $linkText;
+ }
$lastToken = array_pop( $tokenStack );
}
$txt = $linkText ."]]";
- $prefix = $lastToken["text"];
+ if( isset( $lastToken["text"] ) ) {
+ $prefix = $lastToken["text"];
+ } else {
+ $prefix = "";
+ }
$nextToken = $tokenizer->previewToken();
if ( $nextToken["type"] == "text" )
{
$nottalk = !Namespace::isTalk( $this->mTitle->getNamespace() );
wfProfileOut( "$fname-setup" );
-
+ $s = "";
+
if ( preg_match( $e1, $line, $m ) ) { # page with normal text or alt
$text = $m[2];
$trail = $m[3];
# Ugh .. the TOC should have neat indentation levels which can be
# passed to the skin functions. These are determined here
+ $toclevel = 0;
+ $toc = "";
+ $full = "";
+ $head = array();
foreach($matches[3] as $headline) {
if($level) { $prevlevel=$level;}
$level=$matches[1][$c];
}
// Create the anchor for linking from the TOC to the section
-
$anchor=$canonized_headline;
if($refcount[$c]>1) {$anchor.="_".$refcount[$c];}
if($st) {
$full="<a name=\"top\"></a>".$full.$toc;
}
- $full.=$head[$i];
+ if( !empty( $head[$i] ) ) {
+ $full .= $head[$i];
+ }
$i++;
}
$num = str_replace( " ", "", $num );
if ( "" == $num ) {
- $text .= "ISBN $blank$x";
+ $text = "ISBN $blank$x";
} else {
$titleObj = Title::makeTitle( NS_SPECIAL, "Booksources" );
- $text .= "<a href=\"" .
+ $text = "<a href=\"" .
$titleObj->escapeLocalUrl( "isbn={$num}" ) .
"\" class=\"internal\">ISBN $isbn</a>";
$text .= $x;
if ( $rc_type == RC_LOG ) {
$link = $rcObj->timestamp ;
} else {
- $link = $this->makeKnownLink( $rcObj->getTitle(), $rcObj->timestamp , "{$curIdEq}&$o" ) ;
+ $link = $this->makeKnownLinkObj( $rcObj->getTitle(), $rcObj->timestamp , "{$curIdEq}&$o" ) ;
}
$link = "<tt>{$link}</tt>" ;
{
global $wgUploadPath ;
if ( count ( $this->rc_cache ) == 0 ) return "" ;
- #$k = array_keys ( $this->rc_cache ) ;
+ $blockOut = "";
foreach ( $this->rc_cache AS $secureName => $block ) {
if ( count ( $block ) < 2 ) {
- $r .= $this->recentChangesBlockLine ( array_shift ( $block ) ) ;
+ $blockOut .= $this->recentChangesBlockLine ( array_shift ( $block ) ) ;
} else {
- $r .= $this->recentChangesBlockGroup ( $block ) ;
+ $blockOut .= $this->recentChangesBlockGroup ( $block ) ;
}
}
- return "<div align=left>{$r}</div>" ;
+ return "<div align=left>{$blockOut}</div>" ;
}
# Called in a loop over all displayed RC entries
$secureName = $title->getPrefixedDBkey();
if ( $rc_type == RC_MOVE ) {
# Use an @ character to prevent collision with page names
- $this->rc_cache["@@" . ($rcMoveIndex++)] = array($rc);
+ $this->rc_cache["@@" . ($this->rcMoveIndex++)] = array($rc);
} else {
if ( !isset ( $this->rc_cache[$secureName] ) ) $this->rc_cache[$secureName] = array() ;
array_push ( $this->rc_cache[$secureName] , $rc ) ;
}
}
+ if( is_object( $text ) ) {
+ wfDebugDieBacktrace( "Called with object instead of string." );
+ }
$text = strtr( $text, $trans );
$text = wfMungeToUtf8( $text );
unset( $IP );
ini_set( "allow_url_fopen", 0 ); # For security...
if(!file_exists("LocalSettings.php")) {
- die( "You'll have to <a href='$wgScriptPath/config/index.php'>set the wiki up</a> first!" );
+ die( "You'll have to <a href='config/index.php'>set the wiki up</a> first!" );
}
include_once( "./LocalSettings.php" );
OutputPage::setEncodings(); # Not really used yet
# Query string fields
-#
-#global $action, $title, $search, $go, $target, $printable;
-#global $returnto, $diff, $oldid, $curid;
+if( empty( $_REQUEST['action'] ) ) {
+ $action = "view";
+} else {
+ $action = $_REQUEST['action'];
+}
-$action = $_REQUEST['action'];
if( isset( $_SERVER['PATH_INFO'] ) ) {
$title = substr( $_SERVER['PATH_INFO'], 1 );
-} else {
+} elseif( !empty( $_REQUEST['title'] ) ) {
$title = $_REQUEST['title'];
+} else {
+ $title = "";
}
# Placeholders in case of DB error