r2169 - add some comments for future reference
[racktables] / index.php
index 7bd304a..da9c9c7 100644 (file)
--- a/index.php
+++ b/index.php
@@ -1,7 +1,15 @@
 <?php
 
 require 'inc/init.php';
-authorize();
+// no ctx override is necessary
+fixContext();
+if (!permitted())
+{
+       renderAccessDenied();
+       die;
+}
+// Only store the tab name after clearance is got. Any failure is unhandleable.
+setcookie ('RTLT-' . $pageno, $tabno, time() + getConfigVar ('COOKIE_TTL'));
 
 echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'."\n";
 echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">'."\n";
@@ -20,23 +28,9 @@ foreach (array ('F', 'A', 'U', 'T', 'Th', 'Tw', 'Thw') as $statecode)
        echo "}\n\n";
 }
 ?>
-.validation-error {
-       border:1px solid red;
-}
-
-.validation-success {
-       border:1px solid green;
-}
        </style>
        <script language='javascript' type='text/javascript' src='js/live_validation.js'></script>
-       <script type="text/javascript">
-       function init() {
-               document.add_new_range.range.setAttribute('match', "^\\d\\d?\\d?\\.\\d\\d?\\d?\\.\\d\\d?\\d?\\.\\d\\d?\\d?\\/\\d\\d?$");
-
-               Validate.init();
-       }
-       window.onload=init;
-       </script>
+       <script language='javascript' type='text/javascript' src='js/codepress/codepress.js'></script>
        </head>
 <body>
  <table border=0 cellpadding=0 cellspacing=0 width='100%' height='100%' class=maintable>
@@ -82,8 +76,11 @@ if (isset ($tabhandler[$pageno][$tabno]))
                        case 'uint0':
                                assertUIntArg ($page[$pageno]['bypass'], 'index', TRUE);
                                break;
+                       case 'inet4':
+                               assertIPv4Arg ($page[$pageno]['bypass'], 'index');
+                               break;
                        default:
-                               showError ("Dispatching error for bypass parameter");
+                               showError ('Dispatching error for bypass parameter', __FILE__);
                                break;
                }
                $tabhandler[$pageno][$tabno] ($_REQUEST[$page[$pageno]['bypass']]);
@@ -94,7 +91,7 @@ if (isset ($tabhandler[$pageno][$tabno]))
 elseif (isset ($page[$pageno]['handler']))
        $page[$pageno]['handler'] ($tabno);
 else
-       showError ("Failed to find handler for page '${pageno}', tab '${tabno}'");
+       showError ("Failed to find handler for page '${pageno}', tab '${tabno}'", __FILE__);
 ?>
        </td>
        </tr>