1
|
<?php
|
2
|
|
3
|
//
|
4
|
$conn_string = "host=localhost port=5432 dbname=pokusna user=jara password=jara";
|
5
|
$dbconn = pg_connect($conn_string) or die('fuck') ;
|
6
|
|
7
|
|
8
|
define(LaId, "cz");
|
9
|
|
10
|
|
11
|
|
12
|
function projdi_soubor($filename) {
|
13
|
$pattern = '~lang\\(("([^\\\\]*\\\\.)*[^\\\\"]*"|\'([^\\\\]*\\\\.)*[^\\\\\']*\')\\)~U';
|
14
|
//$pattern = "~lang\\('(.*)'\\)~U";
|
15
|
global $dbconn;
|
16
|
printf("<br />\n<br />\n<b>Soubor %s:</b><br />\n", $filename);
|
17
|
preg_match_all($pattern, file_get_contents($filename), $matches);
|
18
|
foreach ($matches[1] as $val) {
|
19
|
$val = substr($val, 1, strlen($val)-2);
|
20
|
printf("vkladam: %s<br />\n", $val);
|
21
|
$dotaz = "INSERT INTO translation (idf, language, translation) VALUES ('".addSlashes($val)."', '".LaId."', '".addSlashes($val)."')";
|
22
|
pg_exec($dbconn, $dotaz );
|
23
|
}
|
24
|
}
|
25
|
|
26
|
|
27
|
//MAIN//
|
28
|
|
29
|
printf("<h1>Flush ./</h2>\n");
|
30
|
foreach (glob("*.php") as $filename) {
|
31
|
projdi_soubor($filename);
|
32
|
}
|
33
|
printf("<h1>Flush ./examination/</h2>\n");
|
34
|
foreach (glob("./examination/*.php") as $filename) {
|
35
|
projdi_soubor($filename);
|
36
|
}
|
37
|
projdi_soubor("./functions/dictionary.php");
|
38
|
?>
|