mirror of
https://github.com/xPaw/PHP-Source-Query.git
synced 2026-05-18 13:53:35 +02:00
Added some comments, added Bzip2 check, added timeout check, small improvements.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
define( 'SQ_ENGINE', SourceQuery :: SOURCE );
|
||||
// Edit this <-
|
||||
|
||||
$Timer = MicroTime( True );
|
||||
$Timer = MicroTime( true );
|
||||
$Query = new SourceQuery( );
|
||||
|
||||
$Info = Array( );
|
||||
@@ -23,9 +23,9 @@
|
||||
$Players = $Query->GetPlayers( );
|
||||
$Rules = $Query->GetRules( );
|
||||
}
|
||||
catch( SourceQueryException $e )
|
||||
catch( Exception $e )
|
||||
{
|
||||
$Error = $e->getMessage( );
|
||||
$Exception = $e;
|
||||
}
|
||||
|
||||
$Query->Disconnect( );
|
||||
@@ -56,21 +56,25 @@
|
||||
<h1>Source Query PHP Class</h1>
|
||||
</div>
|
||||
|
||||
<?php if( isset( $Error ) ): ?>
|
||||
<div class="alert alert-info">
|
||||
<h4 class="alert-heading">Exception:</h4>
|
||||
<?php echo htmlspecialchars( $Error ); ?>
|
||||
<?php if( isset( $Exception ) ): ?>
|
||||
<div class="alert alert-error">
|
||||
<h4 class="alert-heading"><?php echo Get_Class( $Exception ); ?> at line <?php echo $Exception->getLine( ); ?></h4>
|
||||
<?php echo htmlspecialchars( $Exception->getMessage( ) ); ?>
|
||||
</div>
|
||||
|
||||
<h3>Stack trace</h3>
|
||||
<pre><?php echo $e->getTraceAsString(); ?></pre>
|
||||
<?php else: ?>
|
||||
<div class="row">
|
||||
<div class="span6">
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2">Server info</th>
|
||||
<th colspan="2">Server Info</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if( Is_Array( $Rules ) ): ?>
|
||||
<?php foreach( $Info as $InfoKey => $InfoValue ): ?>
|
||||
<tr>
|
||||
<td><?php echo htmlspecialchars( $InfoKey ); ?></td>
|
||||
@@ -88,6 +92,7 @@
|
||||
?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -99,7 +104,7 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if( !Empty( $Players ) ): ?>
|
||||
<?php if( Is_Array( $Players ) ): ?>
|
||||
<?php foreach( $Players as $Player ): ?>
|
||||
<tr>
|
||||
<td><?php echo htmlspecialchars( $Player[ 'Name' ] ); ?></td>
|
||||
@@ -123,19 +128,21 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if( Is_Array( $Rules ) ): ?>
|
||||
<?php foreach( $Rules as $Rule => $Value ): ?>
|
||||
<tr>
|
||||
<td><?php echo htmlspecialchars( $Rule ); ?></td>
|
||||
<td><?php echo htmlspecialchars( $Value ); ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<footer>
|
||||
<p class="pull-right">Generated in <span class="badge badge-success"><?php echo Number_Format( ( MicroTime( True ) - $Timer ), 4, '.', '' ); ?>s</span></p>
|
||||
<p class="pull-right">Generated in <span class="badge badge-success"><?php echo Number_Format( ( MicroTime( true ) - $Timer ), 4, '.', '' ); ?>s</span></p>
|
||||
|
||||
<p>Written by <a href="http://xpaw.ru" target="_blank">xPaw</a></p>
|
||||
<p>Code licensed under the <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/" target="_blank">CC BY-NC-SA 3.0</a></p>
|
||||
|
||||
Reference in New Issue
Block a user