# memcached settings
# See docs/memcached.doc
#
-$wgUseMemCached = false; # Will be set to false in Setup.php, if the server isn't working
+$wgMemCachedDebug = false; # Will be set to false in Setup.php, if the server isn't working
+$wgUseMemCached = false;
$wgMemCachedServers = array( "127.0.0.1:11000" );
$wgMemCachedDebug = false;
+$wgSessionsInMemcached = false;
+$wgLinkCacheMemcached = false; # Not fully tested
# Language settings
#
$wgCookieExpiration = 2592000;
+# Set to set an explicit domain on the login cookies
+# eg, "justthis.domain.org" or ".any.subdomain.net"
+$wgCookieDomain = "";
+$wgCookiePath = "/";
+
$wgAllowExternalImages = true;
$wgMiserMode = false; # Disable database-intensive features
$wgUseTeX = false;
$wgDisableCounters = false;
$wgDisableTextSearch = false;
$wgDisableSearchUpdate = false; # If you've disabled search semi-permanently, this also disables updates to the table. If you ever re-enable, be sure to rebuild the search table.
-$wgDisableUploads = false;
+$wgDisableUploads = true; # Uploads have to be specially set up to be secure
$wgDisableAnonTalk = false;
# We can serve pages compressed in order to save bandwidth,
$now = wfTimestampNow();
$won = wfInvertTimestamp( $now );
+ $size = IntVal( $size );
if ( $wgUseCopyrightUpload )
{
if ( 0 == wfNumRows( $res ) ) {
$sql = "INSERT INTO image (img_name,img_size,img_timestamp," .
"img_description,img_user,img_user_text) VALUES ('" .
- wfStrencode( $name ) . "',{$size},'{$now}','" .
+ wfStrencode( $name ) . "',$size,'{$now}','" .
wfStrencode( $desc ) . "', '" . $wgUser->getID() .
"', '" . wfStrencode( $wgUser->getName() ) . "')";
wfQuery( $sql, DB_WRITE, $fname );
wfFreeResult( $res );
return $messages;
}
+
+function wfQuotedPrintable( $string, $charset = "" )
+{
+ # Probably incomplete; see RFC 2045
+ if( empty( $charset ) ) {
+ global $wgInputEncoding;
+ $charset = $wgInputEncoding;
+ }
+ $charset = strtoupper( $charset );
+ $charset = str_replace( "ISO-8859", "ISO8859", $charset ); // ?
+
+ $illegal = '\x00-\x08\x0b\x0c\x0e-\x1f\x7f-\xff=';
+ $replace = $illegal . '\t ?_';
+ if( !preg_match( "/[$illegal]/", $string ) ) return $string;
+ $out = "=?$charset?Q?";
+ $out .= preg_replace( "/([$replace])/e", 'sprintf("=%02X",ord("$1"))', $string );
+ $out .= "?=";
+ return $out;
+}
+
+
?>
$this->clearLink( $title );
}
- function clearLink( $title ) {
- global $wgMemc;
- $wgMemc->delete( $this->getKey( $title ) );
+ function clearLink( $title )
+ {
+ global $wgMemc, $wgLinkCacheMemcached;
+ if( $wgLinkCacheMemcached )
+ $wgMemc->delete( $this->getKey( $title ) );
}
function suspend() { $this->mActive = false; }
wfProfileOut( $fname );
return 0;
}
+
+ $id = FALSE;
+ if( $wgLinkCacheMemcached )
+ $id = $wgMemc->get( $key = $this->getKey( $title ) );
- $id = $wgMemc->get( $key = $this->getKey( $title ) );
if( $id === FALSE ) {
$sql = "SELECT cur_id FROM cur WHERE cur_namespace=" .
"{$ns} AND cur_title='" . wfStrencode( $t ) . "'";
$s = wfFetchObject( $res );
$id = $s->cur_id;
}
- $wgMemc->add( $key, $id, time()+3600 );
+ if( $wgLinkCacheMemcached )
+ $wgMemc->add( $key, $id, time()+3600 );
}
if ( 0 == $id ) { $this->addBadLink( $title ); }
else { $this->addGoodLink( $id, $title ); }
--- /dev/null
+<?
+
+/*
+ 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
+*/
+
+
+function memsess_key( $id ) {
+ global $wgDBname;
+ return "$wgDBname:session:$id";
+}
+
+function memsess_open( $save_path, $session_name ) {
+ # NOP, $wgMemc should be set up already
+ return true;
+}
+
+function memsess_close() {
+ # NOP
+ return true;
+}
+
+function memsess_read( $id ) {
+ global $wgMemc;
+ $data = $wgMemc->get( memsess_key( $id ) );
+ if( $data === FALSE ) return "";
+ return $data;
+}
+
+function memsess_write( $id, $data ) {
+ global $wgMemc;
+ $wgMemc->set( memsess_key( $id ), $data, 3600 );
+ return true;
+}
+
+function memsess_destroy( $id ) {
+ global $wgMemc;
+ $wgMemc->delete( memsess_key( $id ) );
+ return true;
+}
+
+function memsess_gc( $maxlifetime ) {
+ # NOP: Memcached performs garbage collection.
+ return true;
+}
+
+session_set_save_handler( "memsess_open", "memsess_close", "memsess_read", "memsess_write", "memsess_destroy", "memsess_gc" );
+
+?>
}
$wgLang = new $wgLangClass();
+if( !$wgCommandLineMode ) {
+ if( $wgSessionsInMemcached ) {
+ include_once( "$IP/MemcachedSessions.php" );
+ }
+ session_set_cookie_params( 0, $wgCookiePath, $wgCookieDomain );
+ session_cache_limiter( "private, must-revalidate" );
+ session_start();
+ session_register( "wsUserID" );
+ session_register( "wsUserName" );
+ session_register( "wsUserPassword" );
+ session_register( "wsUploadFiles" );
+}
+
$wgUser = User::loadFromSession();
$wgDeferredUpdateList = array();
$wgLinkCache = new LinkCache();
LIMIT {$indexMaxperpage}";
$res = wfQuery( $sql, DB_READ, "indexShowChunk" );
- # FIXME: Dynamic column widths, backlink to main list,
- # side links to next and previous
+# FIXME: Dynamic column widths, backlink to main list,
+# side links to next and previous
$n = 0;
- $out = "<table border=\"0\">\n";
+ $out = "<table border=\"0\">\n<tr>";
while( $s = wfFetchObject( $res ) ) {
- $out .= "<td width=\"33%\">" .
- $sk->makeKnownLink( $s->cur_title ) .
- "</td>";
+ $t = Title::makeTitle( 0, $s->cur_title );
+ if( $t ) {
+ $link = $sk->makeKnownLinkObj( $t );
+ } else {
+ $link = "[[" . htmlspecialchars( $s->cur_title ) . "]]";
+ }
+ $out .= "<td width=\"33%\">$link</td>";
$n = ++$n % 3;
if( $n == 0 ) {
$out .= "</tr>\n<tr>";
$out .= "</tr>\n";
}
$out .= "</table>";
- #return $out;
+#return $out;
$wgOut->addHtml( $out );
}
{
global $wgOut, $wgUser, $wgLang, $wgOutputEncoding;
global $wpSubject, $wpText, $target;
+
+ $from = wfQuotedPrintable( $wgUser->getName() ) . " <" . $wgUser->getEmail() . ">";
+ $to = wfQuotedPrintable( $this->mAddress );
- $from = $wgUser->getName() . " <" . $wgUser->getEmail() . ">";
$headers =
"MIME-Version: 1.0\r\n" .
"Content-type: text/plain; charset={$wgOutputEncoding}\r\n" .
"Content-transfer-encoding: 8bit\r\n" .
"From: {$from}\r\n" .
"Reply-To: {$from}\r\n" .
- "To: {$this->mAddress}\r\n" .
- "X-Mailer: Pediawiki interuser e-mailer";
- mail( $this->mAddress, $wpSubject, $wpText, $headers );
+ "To: {$to}\r\n" .
+ "X-Mailer: MediaWiki interuser e-mailer";
+ mail( $this->mAddress, wfQuotedPrintable( $wpSubject ), $wpText, $headers );
+
$success = wfLocalUrl( $wgLang->specialPage( "Emailuser" ),
"target={$target}&action=success" );
wfQuery( $sql, DB_WRITE, $fname );
- # Touch the log?
-
- $wgOut->addWikiText(str_replace("$1", $target, wfMsg("undeletedtext")));
+ # Touch the log?
+ $log = new LogPage( wfMsg( "dellogpage" ), wfMsg( "dellogpagetext" ) );
+ $log->addEntry( wfMsg( "undeletedarticle", $target ), "" );
+
+ $wgout->addwikitext(str_replace("$1", $target, wfmsg("undeletedtext")));
return 0;
}
?>