示例#1
0
 public static function connection()
 {
     if (!self::$_detailed_connections) {
         return;
     }
     $id = $_GET['connection'];
     $connection = Bouncer::get('connection-' . $id);
     if (empty($connection)) {
         return;
     }
     $request = $connection['request'];
     $identity = Bouncer::getIdentity($connection['identity']);
     $result = Bouncer::analyseRequest($identity, $request);
     list($status, $score, $details) = $result;
     echo '<table class="bouncer-table">';
     if (!empty($request['headers'])) {
         echo '<tr>', '<th>', 'Request Headers', '</th>', '</tr>';
         foreach ($request['headers'] as $key => $value) {
             echo '<tr>', '<td>', $key, '</td>', '<td>', $value, '</td>', '</tr>';
         }
     }
     foreach (array('GET', 'COOKIE', 'POST') as $G) {
         if (!empty($request[$G])) {
             echo '<tr>', '<th>', $G, '</th>', '</tr>';
             foreach ($request[$G] as $key => $value) {
                 echo '<tr>', '<td>', $key, '</td>', '<td>', $value, '</td>', '</tr>';
             }
         }
     }
     echo '<tr>', '<th>', 'Score', '</th>', '</tr>';
     foreach ($details as $detail) {
         list($value, $message) = $detail;
         echo '<tr>', '<td>', $message, '</td>', '<td>', $value, '</td>', '</tr>';
     }
     echo '<tr>', '<td>', 'Total', '</td>', '<td><b>', $score, '</b></td>', '</tr>';
     echo '</table>';
 }