Improvements to the extensions test script output
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 20 Jan 2010 06:59:34 +0000 (23:59 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 20 Jan 2010 16:33:00 +0000 (09:33 -0700)
horde/lib/Test.php
horde/templates/test/extensions.inc
horde/test.php

index b904e22..f8cd4f8 100644 (file)
@@ -698,12 +698,11 @@ class Horde_Test
     public function getPhpVersionInformation()
     {
         $output = new stdClass;
-        $url = urlencode($_SERVER['PHP_SELF']);
         $vers_check = true;
 
-        $testscript = 'test.php';
-        $output->phpinfo = $testscript . '?mode=phpinfo&amp;url=' . $url;
-        $output->extensions = $testscript . '?mode=extensions&amp;url=' . $url;
+        $testscript = Horde::selfUrl(true);
+        $output->phpinfo = $testscript->copy()->add('mode', 'phpinfo');
+        $output->extensions = $testscript->copy()->add('mode', 'extensions');
         $output->version = PHP_VERSION;
         $output->major = $this->_phpver['major'];
         if (isset($this->_phpver['minor'])) {
index c6954d0..afba01f 100644 (file)
@@ -1,41 +1,66 @@
 <html>
 <head>
-<title>PHP Extensions</title>
-<style type="text/css">
+ <title>PHP Extensions</title>
+ <style type="text/css">
 body { font-family: Geneva,Arial,Helvetica,sans-serif; font-size: 90% }
 td { font-family: Geneva,Arial,Helvetica,sans-serif }h1 { font-size: 110%; color: black; font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; }
-</style>
+ </style>
 </head>
 <body>
-<a href="<?php echo isset($_GET['url']) ? htmlspecialchars($_GET['url']) : 'test.php' ?>?mode=test">&lt;&lt; Back to test.php</a>
-<br />
-<table width="100%" cellspacing="0"><tr><td colspan="2"><table>
-<tr><td>php version:</td><td><strong><?php echo PHP_VERSION ?></strong></td></tr>
-<tr><td>server api:</td><td><strong><?php echo PHP_SAPI ?></strong></td></tr>
-<tr><td>loaded extensions:</td><td><strong><?php $extensions = @get_loaded_extensions(); echo count($extensions); ?></strong></td></tr>
-<tr><td>system:</td><td><strong><?php echo @php_uname() ?></strong></td></tr>
-</table><br /></td></tr>
-<tr class="black">
-<td><strong>activated extensions:</strong></td>
-<td><strong><?php echo isset($_GET['ext']) ? htmlspecialchars($_GET['ext']) : '' ?> function list:</strong></td>
-</tr>
-<tr><td valign="top" width="50%"><table width="100%">
+ <a href="<?php echo $self_url->copy()->add('mode', 'test') ?>">&lt;&lt; Back to test.php</a>
+ <br />
+ <table width="100%" cellspacing="0">
+  <tr>
+   <td colspan="2">
+    <table>
+     <tr>
+      <td>php version:</td><td><strong><?php echo PHP_VERSION ?></strong></td>
+     </tr>
+     <tr>
+      <td>server api:</td><td><strong><?php echo PHP_SAPI ?></strong></td>
+     </tr>
+     <tr>
+      <td>loaded extensions:</td><td><strong><?php $extensions = @get_loaded_extensions(); echo count($extensions); ?></strong></td>
+     </tr>
+     <tr>
+      <td>system:</td><td><strong><?php echo @php_uname() ?></strong></td>
+     </tr>
+    </table>
+
+    <br />
+   </td>
+   </tr>
+   <tr class="black">
+    <td><strong>activated extensions:</strong></td>
+    <td><?php if ($ext_get): ?><strong><?php echo htmlspecialchars($ext_get) ?> function list:</strong><?php endif; ?></td>
+   </tr>
+   <tr>
+    <td valign="top" width="50%">
+     <table width="100%">
 <?php
     @sort($extensions);
-    foreach ($extensions as $extension) {
-        echo '<tr><td width="30%">' . $extension . '</td><td><a href="?mode=extensions&amp;ext=' . $extension . '&amp;url=' . urlencode(isset($_GET['url']) ? $_GET['url'] : '') . '">function list</a></td></tr>';
+    foreach ($extensions as $ext) {
+        echo '<tr><td width="30%">' . $ext. '</td><td><a href="' . $self_url->copy()->add(array('ext' => $ext, 'mode' => 'extensions')) . '">function list</a></td></tr>';
     }
 ?>
-</table></td><td valign="top" width="50%"><table>
+     </table>
+    </td>
+    <td valign="top" width="50%">
+     <table>
 <?php
-    if (isset($_GET['ext'])) {
-        $functions = @get_extension_funcs($_GET['ext']);
+    if ($ext_get) {
+        $functions = @get_extension_funcs($ext_get);
         if (is_array($functions)) {
             sort($functions);
-            foreach ($functions as $function) {
-                echo "<tr><td><a href=\"http://www.php.net/manual/function." . str_replace('_', '-', $function) . ".php\" target=\"_blank\">$function</a></td></tr>\n";
+            foreach ($functions as $func) {
+                echo '<tr><td><a href="http://www.php.net/manual/function.' . str_replace('_', '-', $func) . '.php" target="_blank">' . $func . '</a></td></tr>';
             }
         }
     }
 ?>
-</table></td></tr></table></body></html>
+     </table>
+    </td>
+   </tr>
+  </table>
+ </body>
+</html>
index 19643da..e32e36c 100644 (file)
@@ -74,6 +74,7 @@ $self_url = $url->copy()->add('app', $app);
 switch (Horde_Util::getGet('mode')) {
 case 'extensions':
     echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">';
+    $ext_get = Horde_Util::getGet('ext');
     require $test_templates . '/extensions.inc';
     exit;