X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;ds=sidebyside;f=includes%2FSpecialAsksql.php;h=6096623e27ca74ec39897984fc530da1772c91c6;hb=60c94987aab3141a19d735fbc003d5cb646a8502;hp=062e1c1a28168a7e73c3be19de1e995c0f23fda5;hpb=ba780a4674c0d6f7d1bdcc6fbe7ff3dc91298248;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/SpecialAsksql.php b/includes/SpecialAsksql.php index 062e1c1a28..6096623e27 100644 --- a/includes/SpecialAsksql.php +++ b/includes/SpecialAsksql.php @@ -1,27 +1,60 @@ - - -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; $wgOut->setPagetitle( wfMsg( "asksql" ) ); @@ -33,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( "