Repository navigation
Expand file tree
/
Copy pathtrans.php
More file actions
58 lines (52 loc) · 1.64 KB
/
Copy pathtrans.php
File metadata and controls
58 lines (52 loc) · 1.64 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
/**
* \file
* Get a translation from Web Dictionary
*
* Call 1: trans.php?x=1&t=[textid]&i=[textpos]
* GTr translates sentence in Text t, Pos i
* Call 2: trans.php?x=2&t=[text]&i=[dictURI]
* translates text t with dict via dict-url i
*
* @since 1.0.3
*/
require_once 'inc/session_utility.php';
$x = $_REQUEST["x"];
$i = stripTheSlashesIfNeeded($_REQUEST["i"]);
$t = stripTheSlashesIfNeeded($_REQUEST["t"]);
if ($x == 1 ) {
$sql = 'select SeText, LgGoogleTranslateURI from ' . $tbpref . 'languages, ' . $tbpref . 'sentences, ' . $tbpref . 'textitems2 where Ti2SeID = SeID and Ti2LgID = LgID and Ti2TxID = ' . $t . ' and Ti2Order = ' . $i;
$res = do_mysqli_query($sql);
$record = mysqli_fetch_assoc($res);
if ($record) {
$satz = $record['SeText'];
$trans = isset($record['LgGoogleTranslateURI']) ? $record['LgGoogleTranslateURI'] : "";
if(substr($trans, 0, 1) == '*') { $trans = substr($trans, 1);
}
} else {
my_die("No results: $sql");
}
mysqli_free_result($res);
if ($trans != '') {
/*
echo "{" . $i . "}<br />";
echo "{" . $t . "}<br />";
echo "{" . createTheDictLink($trans,$satz) . "}<br />";
*/
if (substr($trans, 0, 7) == 'ggl.php') {
$trans = str_replace('?', '?sent=1&', $trans);
}
header("Location: " . createTheDictLink($trans, $satz));
}
exit();
}
if ($x == 2 ) {
/*
echo "{" . $i . "}<br />";
echo "{" . $t . "}<br />";
echo "{" . createTheDictLink($i,$t) . "}<br />";
*/
header("Location: " . createTheDictLink($i, $t));
exit();
}
?>