add footer to html
[phancap.git] / www / index.php
1 <?php
2 /**
3  * Give information about phancap 
4  *
5  * PHP version 5
6  *
7  * @category  Tools
8  * @package   Phancap
9  * @author    Christian Weiske <cweiske@cweiske.de>
10  * @copyright 2014 Christian Weiske
11  * @license   http://www.gnu.org/licenses/agpl.html GNU AGPL v3
12  * @link      http://cweiske.de/phancap.htm
13  */
14 namespace phancap;
15 header('HTTP/1.0 500 Internal Server Error');
16
17 if (file_exists(__DIR__ . '/../src/phancap/Autoloader.php')) {
18     include_once __DIR__ . '/../src/phancap/Autoloader.php';
19     Autoloader::register();
20 } else {
21     include_once 'phancap/Autoloader.php';
22 }
23 header('HTTP/1.0 200 OK');
24
25 $options = new Options();
26 $config = new Config();
27 try {
28     $config->load();
29     $options->setConfig($config);
30 } catch (\Exception $e) {
31 }
32 ?>
33 <?xml version="1.0" encoding="utf-8"?>
34 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
35 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
36  <head>
37   <title>phancap</title>
38
39   <link rel="stylesheet" href="css/bootstrap.min.css"/>
40   <link rel="stylesheet" href="css/bootstrap-theme.min.css"/>
41   <link rel="stylesheet" href="css/phancap.css"/>
42   <meta name="viewport" content="width=device-width, initial-scale=1"/>
43  </head>
44  <body>
45   <div class="container">
46    <div class="row">
47     <div class="col-md-2"></div>
48     <div class="col-md-8">
49
50      <div class="page-header">
51       <h1>phancap</h1>
52      </div>
53
54      <div class="row">
55       <div class="col-md-6">
56        <p>
57         Web service to create website screenshots.
58        </p>
59
60       </div>
61       <div class="col-md-6">
62
63        <div class="panel panel-default">
64         <div class="panel-heading">Create screenshot</div>
65         <div class="panel-body">
66          <?php if ($config->access === false) { ?>
67           <div class="alert alert-danger">API is disabled</div>
68          <?php } else if ($config->access !== true) { ?>
69           <div class="alert alert-warning">API requires authentication</div>
70          <?php } ?>
71          <form method="get" action="./get.php" class="form-inline" role="form">
72           <div class="form-group">
73            <label for="url">URL:</label>
74            <input type="text" name="url" id="url" size="30" class="form-control"
75                   placeholder="http://example.org/" />
76           </div>
77           <button type="submit" class="btn btn-default">Go</button>
78          </form>
79         </div>
80        </div>
81
82       </div>
83      </div>
84
85
86      <h2 id="tools">Tools</h2>
87      <ul class="list-group">
88       <li class="list-group-item">
89        <a href="setup.php">Setup check</a> to test if everything is ok
90       </li>
91       <li class="list-group-item">
92        <a href="README.html">README</a>
93       </li>
94      </ul>
95
96
97      <h2 id="api">API</h2>
98      <p>
99       The API is accessible at <a href="get.php">get.php</a>.
100      </p>
101
102      <div class="panel panel-default">
103       <div class="panel-heading" style="text-align: center">
104        Available URL parameters
105       </div>
106       <table class="table table-striped table-bordered table-condensed">
107        <thead>
108         <tr>
109          <th>Name</th>
110          <th>Description</th>
111          <th>Type</th>
112          <th>Default</th>
113         </tr>
114        </thead>
115        <tbody>
116 <?php
117 foreach ($options->options as $name => $option) {
118     echo '<tr>'
119         . '<td><tt>' . $name . '</tt></td>'
120         . '<td>' . htmlspecialchars($option['title']) . '</td>'
121         . '<td>'
122         . (
123             is_array($option['type'])
124             ? ('One of: <tt>' . implode('</tt>, <tt>', $option['type']) . '</tt>')
125             : str_replace('skip', '&#160;', $option['type'])
126         )
127         . '</td>'
128         . '<td>&#160;<tt>' . $option['default'] . '</tt></td>'
129         . '</tr>';
130 }
131 ?>
132        </tbody>
133       </table>
134      </div>
135      <p>
136       Ages can be given as ISO 8601 duration specification, for example:
137      </p>
138      <dl class="dl-horizontal">
139       <dt><tt>P1Y</tt></dt><dd>1 year</dd>
140       <dt><tt>P2W</tt></dt><dd>2 weeks</dd>
141       <dt><tt>P1D</tt></dt><dd>1 day</dd>
142       <dt><tt>PT4H</tt></dt><dd>4 hours</dd>
143      </dl>
144
145     </div>
146    </div>
147   </div>
148
149   <div class="container footer">
150    <a href="http://cweiske.de/phancap.htm">phancap</a>,
151    the self-hosted website screenshot service is available under the
152    <a href="http://www.gnu.org/licenses/agpl-3.0.html">
153     <abbr title="GNU Affero General Public License">AGPL</abbr></a>.
154   </div>
155
156  </body>
157 </html>