X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2FQueryPage.php;h=56ed2aa85d2cfd22b3dd02b0568cb1293b852296;hb=facfb655f76ec06a8a8bf571d9c43fb57650e1c8;hp=92a9911e9982191342386234f6756bbb98b09132;hpb=2e4b591ef603e9643f0d60c7ca22b633732d2bd9;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/QueryPage.php b/includes/QueryPage.php index 92a9911e99..56ed2aa85d 100644 --- a/includes/QueryPage.php +++ b/includes/QueryPage.php @@ -1,6 +1,6 @@ sortDescending() ? "DESC" : "") + return ' ORDER BY value ' . + ($this->sortDescending() ? 'DESC' : '') . wfLimitResult($limit,$offset); } function getOrder() { - return " ORDER BY value " . - ($this->sortDescending() ? "DESC" : ""); + return ' ORDER BY value ' . + ($this->sortDescending() ? 'DESC' : ''); } # Is this query expensive (for some definition of expensive)? Then we @@ -62,7 +62,13 @@ class QueryPage { # result data. You should be able to grab SQL results off of it. function formatResult( $skin, $result ) { - return ""; + return ''; + } + + # The content returned by this function will be output before any result + + function getPageHeader( ) { + return ''; } # This is the actual workhorse. It does everything needed to make a @@ -73,7 +79,7 @@ class QueryPage { global $wgMiserMode; $sname = $this->getName(); - $fname = get_class($this) . "::doQuery"; + $fname = get_class($this) . '::doQuery'; $sql = $this->getSQL(); $dbr =& wfGetDB( DB_SLAVE ); $dbw =& wfGetDB( DB_MASTER ); @@ -83,7 +89,7 @@ class QueryPage { $res = false; if ( $this->isExpensive() ) { - $recache = $wgRequest->getBool( "recache" ); + $recache = $wgRequest->getBool( 'recache' ); if( $recache ) { # Clear out any old cached data $dbw->delete( 'querycache', array( 'qc_type' => $sname ), $fname ); @@ -99,13 +105,13 @@ class QueryPage { if ( $first ) { $first = false; } else { - $insertSql .= ","; + $insertSql .= ','; } - $insertSql .= "(" . - $dbw->addQuotes( $row->type ) . "," . - $dbw->addQuotes( $row->namespace ) . "," . - $dbw->addQuotes( $row->title ) . "," . - $dbw->addQuotes( $row->value ) . ")"; + $insertSql .= '(' . + $dbw->addQuotes( $row->type ) . ',' . + $dbw->addQuotes( $row->namespace ) . ',' . + $dbw->addQuotes( $row->title ) . ',' . + $dbw->addQuotes( $row->value ) . ')'; } # Save results into the querycache table on the master @@ -138,6 +144,8 @@ class QueryPage { $sk = $wgUser->getSkin( ); + + $wgOut->addHTML( $this->getPageHeader() ); $top = wfShowingResults( $offset, $num); $wgOut->addHTML( "
{$top}\n" ); @@ -152,7 +160,7 @@ class QueryPage { # Only read at most $num rows, because $res may contain the whole 1000 for ( $i = 0; $i < $num && $obj = $dbr->fetchObject( $res ); $i++ ) { $format = $this->formatResult( $sk, $obj ); - $attr = ( !is_null ( $obj->usepatrol ) && $obj->usepatrol && + $attr = ( isset ( $obj->usepatrol ) && $obj->usepatrol && $obj->patrolled == 0 ) ? ' class="not_patrolled"' : ''; $s .= "