aboutsummaryrefslogtreecommitdiff
path: root/www/tool.php
blob: 647d6a7517b2c9a56f74a223489616b012372669 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
/**
 * Runs a tool on a file
 */
namespace phorkie;
require_once 'www-header.php';
$repo = new Repository();
$repo->loadFromRequest();

if (!isset($_GET['file']) || $_GET['file'] == '') {
    throw new Exception_Input('File name missing');
}
$file = $repo->getFileByName($_GET['file']);

if (!isset($_GET['tool']) || $_GET['tool'] == '') {
    throw new Exception_Input('Tool name missing');
}

$tm = new Tool_Manager();
$tool = $tm->loadTool($_GET['tool']);

$res = $tool->run($file);

render(
    'tool',
    array(
        'repo' => $repo,
        'file' => $file,
        'toolres' => $res,
    )
);

?>