Ver código fonte

[Contribs] Add a web interface for looking up error codes.

Add a PHP script to act as a web interface for looking up error codes.
tags/v0.9.4
Stefan Hajnoczi 16 anos atrás
pai
commit
ce298a9628
1 arquivos alterados com 65 adições e 0 exclusões
  1. 65
    0
      contrib/errcode/errcode.php

+ 65
- 0
contrib/errcode/errcode.php Ver arquivo

@@ -0,0 +1,65 @@
1
+<?
2
+// The path to the errcode.py script.
3
+$ERRCODE_PATH = './errcode.py';
4
+?>
5
+
6
+<html>
7
+    <head>
8
+        <title>gPXE Error Code Lookup</title>
9
+        <style>
10
+            body, pre, div, form, p, h2, b, tt {
11
+                padding: 0;
12
+                border: 0;
13
+                margin: 0;
14
+            }
15
+            body {
16
+                padding: 0.5em;
17
+                width: 750px;
18
+                font-family: sans-serif;
19
+            }
20
+            pre {
21
+                margin: 0.2em;
22
+                padding: 0.1em;
23
+                background-color: #ddd;
24
+            }
25
+            form {
26
+                margin: 0.2em;
27
+            }
28
+            div {
29
+                margin: 0.2em;
30
+                padding: 0.4em;
31
+                border: 1px dashed black;
32
+            }
33
+        </style>
34
+    </head>
35
+    <body>
36
+<?
37
+if (!empty($_REQUEST['e']) && preg_match('/^(0x)?[0-9a-f]{8}$/', $_REQUEST['e'])) {
38
+?>
39
+        <pre>
40
+<?
41
+    system($ERRCODE_PATH . " " . $_REQUEST['e']);
42
+?>
43
+        </pre>
44
+<?
45
+}
46
+?>
47
+        <form action="" method="post">
48
+            <label for="e">Error code:</label>
49
+            <input type="text" name="e" id="e" value="0x12345678"></input>
50
+            <input type="submit" value="Lookup"></input>
51
+        </form>
52
+
53
+        <div>
54
+            <h2>Hint:</h2>
55
+            <p>
56
+            Firefox users can right-click on the <b>Error code</b>
57
+            text box and select <b>Add a Keyword for this Search...</b>.
58
+            Set <b>name</b> to <tt>gPXE Error Code Lookup</tt> and
59
+            <b>keyword</b> to <tt>gxpe</tt>  Then you can look up error
60
+            codes by typing something like the following in your address
61
+            bar: <tt>gpxe 0x3c018003</tt>
62
+            <p>
63
+        </div>
64
+    </body>
65
+</html>

Carregando…
Cancelar
Salvar