User:Andrew-chaight

00001 <?php 00033 // So extensions (and other code) can check whether they're running in API mode 00034 define( 'MW_API', true ); 00035 00036 // Bail if PHP is too low 00037 if ( !function_exists( 'version_compare' ) || version_compare( phpversion, '5.3.2' ) < 0 ) { 00038    // We need to use dirname( __FILE__ ) here cause __DIR__ is PHP5.3+ 00039    require dirname( __FILE__ ). '/includes/PHPVersionError.php'; 00040    wfPHPVersionError( 'api.php' ); 00041 } 00042 00043 // Initialise common code. 00044 require __DIR__. '/includes/WebStart.php'; 00045 00046 wfProfileIn( 'api.php' ); 00047 $starttime = microtime( true ); 00048 00049 // URL safety checks 00050 if ( !$wgRequest->checkUrlExtension ) { 00051    return; 00052 } 00053 00054 // Verify that the API has not been disabled 00055 if ( !$wgEnableAPI ) { 00056    header( $_SERVER['SERVER_PROTOCOL'] . ' 500 MediaWiki configuration Error', true, 500 ); 00057    echo 'MediaWiki API is not enabled for this site. Add the following line to your LocalSettings.php' 00058        . ' $wgEnableAPI=true; '; 00059    die( 1 ); 00060 } 00061 00062 // Set a dummy $wgTitle, because $wgTitle == null breaks various things 00063 // In a perfect world this wouldn't be necessary 00064 $wgTitle = Title::makeTitle( NS_MAIN, 'API' ); 00065 00066 /* Construct an ApiMain with the arguments passed via the URL. What we get back 00067 * is some form of an ApiMain, possibly even one that produces an error message, 00068 * but we don't care here, as that is handled by the ctor. 00069 */ 00070 $processor = new ApiMain( RequestContext::getMain, $wgEnableWriteAPI ); 00071 00072 // Last chance hook before executing the API 00073 wfRunHooks( 'ApiBeforeMain', array( &$processor ) ); 00074 00075 // Process data & print results 00076 $processor->execute; 00077 00078 // Execute any deferred updates 00079 DeferredUpdates::doUpdates; 00080 00081 // Log what the user did, for book-keeping purposes. 00082 $endtime = microtime( true ); 00083 wfProfileOut( 'api.php' ); 00084 wfLogProfilingData; 00085 00086 // Log the request 00087 if ( $wgAPIRequestLog ) { 00088    $items = array( 00089         wfTimestamp( TS_MW ), 00090         $endtime - $starttime, 00091         $wgRequest->getIP, 00092         $_SERVER['HTTP_USER_AGENT'] 00093     ); 00094    $items[] = $wgRequest->wasPosted ? 'POST' : 'GET'; 00095    $module = $processor->getModule; 00096    if ( $module->mustBePosted ) { 00097        $items[] = "action=". $wgRequest->getVal( 'action' ); 00098    } else { 00099        $items[] = wfArrayToCgi( $wgRequest->getValues ); 00100    } 00101     wfErrorLog( implode( ',', $items ) . "\n", $wgAPIRequestLog ); 00102    wfDebug( "Logged API request to $wgAPIRequestLog\n" ); 00103 } 00104 00105 // Shut down the database. foo->bar syntax is not supported in PHP4: we won't ever actually 00106 // get here to worry about whether this should be = or =&, but the file has to parse properly. 00107 $lb = wfGetLBFactory; 00108 $lb->shutdown; 19ed9ee56462e44d61a093ea57e964cf0af05c0e *httpd-2.4.7.tar.bz2 my $uid=''; my $passwd='';

while (my $line = <>) { chomp $line; if ( $line =~ /uid:\s*(.+)/) { $uid = $1 } if ( $line =~ /userpassword:\s*(\{\w+\}.+)/) { $passwd = $1; $passwd =~ s/^\{crypt\}//i; # Apache stores crypt without a magic string }

if (length($line)==0) {

if (length $uid and length $passwd) { print $uid, ':', $passwd, "\n"; } # output if we have something to print

$uid = ''; $passwd = '';

} # if newline } # while something to read

if (length $uid and length $passwd) { print $uid, ':', $passwd, "\n"; } % pgpk -a KEYS
 * 1) handle last entry if there isn't a newline before EOF

% pgpv httpd-2.2.0.tar.gz.asc // Tell squids to cache $this->getMain->setCacheMode( 'public' ); // Set the squid & private cache time in seconds $this->getMain->setCacheMaxAge( 300 ); // Title parameter. public function getAllowedParams { return array(		'title' => array ( ApiBase::PARAM_TYPE => 'string', ApiBase::PARAM_REQUIRED => true ),	); } $pageObj = $this->getTitleOrPageId( $params ); $titleObj = $pageObj->getTitle; if ( $titleObj->isExternal ) { $this->dieUsageMsg( array( 'invalidtitle', $params['title'] ) ); }