$convert = ($conf->ImageMagick ? $conf->ImageMagick : "/usr/bin/convert" );
$pretty = ($conf->prettyURLs ? "" : "# ");
$ugly = ($conf->prettyURLs ? "# " : "");
+ $proxyKey = Parser::getRandomString() . Parser::getRandomString();
$sep = (DIRECTORY_SEPARATOR == "\\") ? ";" : ":";
return "
\$wgLanguageCode = \"{$conf->LanguageCode}\";
" . ($conf->Encoding ? "\$wgInputEncoding = \$wgOutputEncoding = \"{$conf->Encoding}\";" : "" ) . "
+\$wgProxyKey = $proxyKey;
";
}
$wgProxyPorts = array( 80, 81, 1080, 3128, 6588, 8000, 8080, 8888, 65506 );
$wgProxyScriptPath = "$IP/proxy_check.php";
$wgProxyMemcExpiry = 86400;
+$wgProxyKey = "W1svekXc5u6lZllTZOwnzEk1nbs";
# Client-side caching:
$wgCachePages = true; # Allow client-side caching of pages
# Fork the processes
if ( !$skip ) {
$title = Title::makeTitle( NS_SPECIAL, "Blockme" );
- $url = $title->getFullURL();
+ $iphash = md5( $wgIP . $wgProxyKey );
+ $url = wfFullUrl( $title->getPrefixedURL(), "ip=$iphash" );
+
foreach ( $wgProxyPorts as $port ) {
$params = implode( " ", array(
- escapeshellarg( $wgProxyScriptPath ),
- escapeshellarg( $wgIP ),
- escapeshellarg( $port ),
- escapeshellarg( $url )
- ));
+ escapeshellarg( $wgProxyScriptPath ),
+ escapeshellarg( $wgIP ),
+ escapeshellarg( $port ),
+ escapeshellarg( $url )
+ ));
exec( "php $params &>/dev/null &" );
}
# Set MemCached key
<?php
function wfSpecialBlockme()
{
- global $wgIP, $wgBlockOpenProxies, $wgOut;
+ global $wgIP, $wgBlockOpenProxies, $wgOut, $wgProxyKey;
- if ( !$wgBlockOpenProxies ) {
+ if ( !$wgBlockOpenProxies || $_REQUEST['ip'] != md5( $wgIP . $wgProxyKey ) ) {
$wgOut->addWikiText( wfMsg( "disabled" ) );
return;
- }
+ }
$blockerName = wfMsg( "proxyblocker" );
$reason = wfMsg( "proxyblockreason" );
$success = wfMsg( "proxyblocksuccess" );
-
+
$u = User::newFromName( $blockerName );
$id = $u->idForName();
if ( !$id ) {