aboutsummaryrefslogtreecommitdiff
path: root/www/tool.php
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2012-04-13 19:56:24 +0200
committerChristian Weiske <cweiske@cweiske.de>2012-04-13 19:56:24 +0200
commitd9f6b83ed6d8a4546e4119c64b639adda057d25e (patch)
tree80e8a3077c149929072a70d71d523fd3fce929e2 /www/tool.php
parent09b7728bd2beca1270922a38d79498e3c4fa0456 (diff)
downloadphorkie-d9f6b83ed6d8a4546e4119c64b639adda057d25e.tar.gz
phorkie-d9f6b83ed6d8a4546e4119c64b639adda057d25e.zip
first tool supported: xmllint
Diffstat (limited to 'www/tool.php')
-rw-r--r--www/tool.php33
1 files changed, 33 insertions, 0 deletions
diff --git a/www/tool.php b/www/tool.php
new file mode 100644
index 0000000..d42954c
--- /dev/null
+++ b/www/tool.php
@@ -0,0 +1,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,
+ )
+);
+
+?> \ No newline at end of file