use bootstrap theme
[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         </div>
48         <button type="submit" class="btn btn-default">Go</button>
49        </form>
50       </div>
51      </div>
52
53
54      <h2 id="api">API</h2>
55      <p>
56       The API is accessible at <a href="get.php">get.php</a>.
57      </p>
58
59      <div class="panel panel-default">
60       <div class="panel-heading">Available URL parameters</div>
61       <table class="table table-striped table-bordered table-condensed">
62        <thead>
63         <tr>
64          <th>Name</th>
65          <th>Description</th>
66          <th>Type</th>
67          <th>Default</th>
68         </tr>
69        </thead>
70        <tbody>
71 <?php
72 $options = new Options();
73 $config = new Config();
74 try {
75     $config->load();
76     $options->setConfig($config);
77 } catch (\Exception $e) {}
78
79 foreach ($options->options as $name => $option) {
80     echo '<tr>'
81         . '<td><tt>' . $name . '</tt></td>'
82         . '<td>' . htmlspecialchars($option['title']) . '</td>'
83         . '<td>'
84         . (
85             is_array($option['type'])
86             ? ('One of: <tt>' . implode('</tt>, <tt>', $option['type']) . '</tt>')
87             : str_replace('skip', '&#160;', $option['type'])
88         )
89         . '</td>'
90         . '<td>&#160;<tt>' . $option['default'] . '</tt></td>'
91         . '</tr>';
92 }
93 ?>
94        </tbody>
95       </table>
96      </div>
97
98
99      <h2 id="tools">Tools</h2>
100      <ul class="list-group">
101       <li class="list-group-item">
102        <a href="setup.php">Setup check</a> to test if everything is ok
103       </li>
104      </ul>
105
106     </div>
107    </div>
108   </div>
109  </body>
110 </html>