Automatically focus OpenID field on login page
[phorkie.git] / www / tool.php
1 <?php
2 /**
3  * Runs a tool on a file
4  */
5 namespace phorkie;
6 require_once 'www-header.php';
7 $repo = new Repository();
8 $repo->loadFromRequest();
9
10 if (!isset($_GET['file']) || $_GET['file'] == '') {
11     throw new Exception_Input('File name missing');
12 }
13 $file = $repo->getFileByName($_GET['file']);
14
15 if (!isset($_GET['tool']) || $_GET['tool'] == '') {
16     throw new Exception_Input('Tool name missing');
17 }
18
19 $tm = new Tool_Manager();
20 $tool = $tm->loadTool($_GET['tool']);
21
22 $res = $tool->run($file);
23
24 render(
25     'tool',
26     array(
27         'repo' => $repo,
28         'file' => $file,
29         'toolres' => $res,
30     )
31 );
32
33 ?>