User:Leucosticte/SpecialViewTable.php

setHeaders; $viewOutput = $this->getOutput; $user = $this->getUser; if ( !$user->isAllowed( 'viewtable' ) ) { throw new PermissionsError( null, array( array(           'viewtable-notallowed' ) ) ); }     $dbr = wfGetDB( DB_SLAVE ); $output = ''; $res = $dbr->query( 'SHOW TABLES' ); $tables = array; foreach ( $res as $row ) { $tables[] = $row->Tables_in_test117; }     if ( !$par or !in_array( $par, $tables ) ) { $res = $dbr->query( 'SHOW TABLES' ); foreach ( $tables as $table ) { $output .= "$table "; }     } else { $res = $dbr->select( $par, '*' ); $output = "{|class=\"wikitable\"\n|-\n!$par\n!User\n|-\n"; foreach ( $row as $key => $value ) { $count = count( $value ); $output .= "|rowspan = \"$count\" | $key\n"; foreach ( $value as $valueValue ) { $output .= "|$valueValue\n|-\n"; }     }      $output .= "|}\n";*/ $viewOutput->addWikiText( $output ); return $output; } }