describe ages
[phancap.git] / www / index.php
1 <?php
2 namespace phancap;
3 /**
4  * Check if everything is setup
5  */
6 header('HTTP/1.0 500 Internal Server Error');
7
8 if (file_exists(__DIR__ . '/../src/phancap/Autoloader.php')) {
9     include_once __DIR__ . '/../src/phancap/Autoloader.php';
10     Autoloader::register();
11 } else {
12     include_once 'phancap/Autoloader.php';
13 }
14 header('HTTP/1.0 200 OK');
15 ?>
16 <?xml version="1.0" encoding="utf-8"?>
17 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
18 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
19  <head>
20   <title>phancap</title>
21
22   <link rel="stylesheet" href="css/bootstrap.min.css"/>
23   <link rel="stylesheet" href="css/bootstrap-theme.min.css"/>
24   <link rel="stylesheet" href="css/phancap.css"/>
25   <meta name="viewport" content="width=device-width, initial-scale=1"/>
26  </head>
27  <body>
28   <div class="container">
29    <div class="row">
30     <div class="col-md-2"></div>
31     <div class="col-md-8">
32
33      <div class="page-header">
34       <h1>phancap</h1>
35      </div>
36      <p>
37       Web service to create website screenshots.
38      </p>
39
40      <div class="panel panel-default">
41       <div class="panel-heading">Create website screenshot</div>
42       <div class="panel-body">
43        <form method="get" action="./get.php" class="form-inline" role="form">
44         <div class="form-group">
45          <label for="url">URL:</label>
46          <input type="text" name="url" id="url" size="30" class="form-control"
47                 placeholder="http://example.org/" />
48         </div>
49         <button type="submit" class="btn btn-default">Go</button>
50        </form>
51       </div>
52      </div>
53
54
55      <h2 id="api">API</h2>
56      <p>
57       The API is accessible at <a href="get.php">get.php</a>.
58      </p>
59
60      <div class="panel panel-default">
61       <div class="panel-heading" style="text-align: center">Available URL parameters</div>
62       <table class="table table-striped table-bordered table-condensed">
63        <thead>
64         <tr>
65          <th>Name</th>
66          <th>Description</th>
67          <th>Type</th>
68          <th>Default</th>
69         </tr>
70        </thead>
71        <tbody>
72 <?php
73 $options = new Options();
74 $config = new Config();
75 try {
76     $config->load();
77     $options->setConfig($config);
78 } catch (\Exception $e) {}
79
80 foreach ($options->options as $name => $option) {
81     echo '<tr>'
82         . '<td><tt>' . $name . '</tt></td>'
83         . '<td>' . htmlspecialchars($option['title']) . '</td>'
84         . '<td>'
85         . (
86             is_array($option['type'])
87             ? ('One of: <tt>' . implode('</tt>, <tt>', $option['type']) . '</tt>')
88             : str_replace('skip', '&#160;', $option['type'])
89         )
90         . '</td>'
91         . '<td>&#160;<tt>' . $option['default'] . '</tt></td>'
92         . '</tr>';
93 }
94 ?>
95        </tbody>
96       </table>
97      </div>
98      <p>
99       Ages can be given as ISO 8601 duration specification, for example:
100      </p>
101      <dl class="dl-horizontal">
102       <dt><tt>P1Y</tt></dt><dd>1 year</dd>
103       <dt><tt>P2W</tt></dt><dd>2 weeks</dd>
104       <dt><tt>P1D</tt></dt><dd>1 day</dd>
105       <dt><tt>PT4H</tt></dt><dd>4 hours</dd>
106      </dl>
107
108      <h2 id="tools">Tools</h2>
109      <ul class="list-group">
110       <li class="list-group-item">
111        <a href="setup.php">Setup check</a> to test if everything is ok
112       </li>
113      </ul>
114
115     </div>
116    </div>
117   </div>
118  </body>
119 </html>