blob: 747686e597c834f2683c0bd8a1520e9613a6e5a5 (
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
header("Content-Type: application/json");
if (isset($_GET['t'])) {
if ($_GET['t'] === "en") {
$target = "en";
} else {
$target = "mt";
}
} else {
die();
}
if (isset($_GET['u'])) {
$text = $_GET['u'];
if (strlen($text) > 500) {
die();
}
$text = str_replace("\"", "''", $text);
} else {
die();
}
$raw = json_decode(exec("cd /mnt/metranslator-api && node index.js api {$target} \"{$text}\""), true);
$last = exec("cd /mnt/metranslator-api && git log -1 --pretty=format:'%an'");
$raw["system"]["version"] = $raw["system"]["version"] . "-" . substr(file_get_contents("/mnt/metranslator-api/.git/refs/heads/trunk"), 0, 8);
$raw["system"]["last_author"] = $last;
$raw["call"] = "cd /mnt/metranslator-api && node index.js api {$target} \"{$text}\"";
die(json_encode($raw));
|