https://bugzilla.wikimedia.org/show_bug.cgi?id=25563
Roan Kattouw <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #7773|0 |1 is obsolete| | --- Comment #11 from Roan Kattouw <[email protected]> 2011-11-20 13:30:52 UTC --- Comment on attachment 7773 --> https://bugzilla.wikimedia.org/attachment.cgi?id=7773 modifications in the HttpFunctions.php File to access a secure mediawiki-repository. >--- HttpFunctions.php 2009-01-08 07:56:11.000000000 +0100 >+++ HttpFunctions_new.php 2010-11-01 11:47:57.000000000 +0100 >@@ -78,6 +78,65 @@ > } > } > >+ global $wgAuthenticatedRepository, >$wgAuthenticatedRepositoryUser, $wgAuthenticatedRepositoryPassword, >$wgShowAuthenticatedRepositoryError; >+ $text = ''; >+ if ( $wgAuthenticatedRepository ) { >+ require_once >'extensions/Snoopy-1.2.4/Snoopy.class.php'; >+ $index = ''; >+ $login = ''; >+ >+ $wikiPath = ""; >+ if (!preg_match('/(.*)\/index.php\/(.*)\?(.*)/', >$url, $matches)) { >+ echo "nicht gefunden"; >+ } else { >+ $wikiPath = $matches[1]; >+ } >+ >+ $apiPath = "$wikiPath/api.php"; >+ $indexPath = "$wikiPath/index.php"; >+ $title = $wgTitle->mPrefixedText; >+ >+ $snoopy = new Snoopy; >+ >+ $request_vars = array('action' => 'login', 'lgname' >=> $wgAuthenticatedRepositoryUser, 'lgpassword' => >$wgAuthenticatedRepositoryPassword, 'format' => 'php'); >+ if(!$snoopy->submit($apiPath, $request_vars)) >+ die("Snoopy error: {$snoopy->error}"); >+ >+ // We're only really interested in the cookies >+ $snoopy->setcookies(); >+ $token = unserialize($snoopy->results); >+ $error = true; >+ $token2 = array(); >+ >+ if ( $token['login']['result'] == 'NeedToken') { >+ $request_vars = array('action' => 'login', 'lgname' >=> $wgAuthenticatedRepositoryUser, 'lgpassword' => >$wgAuthenticatedRepositoryPassword, 'lgtoken' => $token['login']['token'], >'format' => 'php'); >+ if(!$snoopy->submit($apiPath, $request_vars)) >+ die("Snoopy error: {$snoopy->error}"); >+ $token2 = unserialize($snoopy->results); >+ } >+ else if ( ($token['login']['result'] == 'NoName') ) { >+ wfDebug( __METHOD__ . ": Wrong or no User for >wgAuthenticatedRepositoryUser in the LocalSetting. \n" ); >+ if ( $wgShowAuthenticatedRepositoryError ) $text = "Wrong or no >User for <i>wgAuthenticatedRepositoryUser</i> in the LocalSetting.<br/>"; >+ } >+ >+ >+ if ( ($token2['login']['result'] == 'Success') or >($token['login']['result'] == 'Success') ) { >+ $request_vars = array('action' => 'raw', >'title'=>$title, 'lgtoken' => $token['login']['token'], 'format' => 'php'); >+ if(!$snoopy->submit($indexPath, $request_vars)) >+ die("Snoopy error: {$snoopy->error}"); >+ $text = $snoopy->results; >+ } >+ else if ( ($token2['login']['result'] == 'WrongPass') or >($token2['login']['result'] == 'WrongPluginPass') or >($token2['login']['result'] == 'EmptyPass') ) { >+ wfDebug( __METHOD__ . ": Wrong or no Password for >wgAuthenticatedRepositoryPassword in the LocalSetting." ); >+ if ( $wgShowAuthenticatedRepositoryError ) $text = "Wrong or no >Password for <i>wgAuthenticatedRepositoryPassword</i> in the >LocalSetting.<br/>"; >+ } >+ else if ( ($token2['login']['result'] == 'NotExists') ) { >+ wfDebug( __METHOD__ . ": Wrong or no User for >wgAuthenticatedRepositoryUser in the LocalSetting. \n" ); >+ if ( $wgShowAuthenticatedRepositoryError ) $text = "Wrong or no >User for <i>wgAuthenticatedRepositoryUser</i> in the LocalSetting.<br/>"; >+ } >+ } >+ else >+ { > ob_start(); > curl_exec( $c ); > $text = ob_get_contents(); >@@ -97,6 +156,7 @@ > $text = false; > } > curl_close( $c ); >+ } > } else { > # Otherwise use file_get_contents... > # This doesn't have local fetch capabilities... -- Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug. You are on the CC list for the bug. _______________________________________________ Wikibugs-l mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikibugs-l
