X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2FSpecialAsksql.php;h=6096623e27ca74ec39897984fc530da1772c91c6;hb=60c94987aab3141a19d735fbc003d5cb646a8502;hp=a52aa1f28c8f56f4ac15fc7fc7808ada063ae2b3;hpb=13c17d0cc9cc901c74469ece3c7646f830ca9623;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/SpecialAsksql.php b/includes/SpecialAsksql.php index a52aa1f28c..6096623e27 100644 --- a/includes/SpecialAsksql.php +++ b/includes/SpecialAsksql.php @@ -1,29 +1,61 @@ - - -function wfSpecialAsksql() -{ - global $wgUser, $wgOut, $action; - - if ( ! $wgUser->isSysop() ) { +errorpage( "nosuchspecialpage", "nospecialpagetext" ); + return; + } + if( !$wgUser->isSysop() ) { $wgOut->sysopRequired(); return; } - $fields = array( "wpSqlQuery" ); - wfCleanFormFields( $fields ); - $f = new SqlQueryForm(); + + if( $wgRequest->wasPosted() ) { + $query = $wgRequest->getVal( 'wpSqlQuery' ); + $action = $wgRequest->getVal( 'action' ); + } else { + $query = ""; + $action = ""; + } + $f = new SqlQueryForm( $query); - if ( "submit" == $action ) { $f->doSubmit(); } - else { $f->showForm( "" ); } + if ( "submit" == $action ) { + $f->doSubmit(); + } else { + $f->showForm( '' ); + } } +/** + * @access private + * @package MediaWiki + * @subpackage SpecialPage + */ class SqlQueryForm { - - function showForm( $err ) - { + var $query = ''; + + function SqlQueryForm( $query ) { + $this->query = $query; + } + + function showForm( $err ) { global $wgOut, $wgUser, $wgLang; - global $wpSqlQuery; global $wgLogQueries; - $wpSqlQuery = $_REQUEST["wpSqlQuery"]; $wgOut->setPagetitle( wfMsg( "asksql" ) ); $note = wfMsg( "asksqltext" ); @@ -34,11 +66,11 @@ class SqlQueryForm { if ( "" != $err ) { $wgOut->addHTML( "
" . htmlspecialchars($err) . "\n" ); } - if ( ! $wpSqlQuery ) { $wpSqlQuery = "SELECT ... FROM ... WHERE ..."; } + if ( ! $this->query ) { $this->query = "SELECT ... FROM ... WHERE ..."; } $q = wfMsg( "sqlquery" ); $qb = wfMsg( "querybtn" ); - $action = wfLocalUrlE( $wgLang->specialPage( "Asksql" ), - "action=submit" ); + $titleObj = Title::makeTitle( NS_SPECIAL, "Asksql" ); + $action = $titleObj->escapeLocalURL( "action=submit" ); $wgOut->addHTML( "