-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupload.script.php
More file actions
53 lines (46 loc) · 1.37 KB
/
upload.script.php
File metadata and controls
53 lines (46 loc) · 1.37 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
<?php
require_once __DIR__.'/header.php';
if(empty($_POST['locale'])) exit;
$locale = $mysqli->real_escape_string($_POST['locale']);
$output = new healDocument();
$output->te('Locale: '.$locale)->el('br');
if($locale) {
if($_FILES['file']['tmp_name']) {
$tmp_name = $_FILES['file']['tmp_name'];
$output->te('File: '.$_FILES['file']['name'])->el('br');
$file = fopen($tmp_name, 'r');
$count = 1;
while(!feof($file)) {
$line = trim(fgets($file));
if(trim($line)) {
$linearray = explode(" => \"",$line);
if(sizeof($linearray)==2) {
$msgid = $mysqli->real_escape_string($linearray[0]);
$str = trim(substr(trim($linearray[1]),0,-1));
$sql = "SELECT `id` FROM `msgid` WHERE `msgid`='$msgid'";
$query = $mysqli->query($sql);
if($rs = $query->fetch_object()) {
if(!empty($str)) {
$str = $mysqli->real_escape_string($str);
$sql = "INSERT INTO `msgstr` (`msgid_id`,`locale`,`str`) VALUES ('$rs->id','$locale','$str')
ON DUPLICATE KEY UPDATE `str`='$str'";
$mysqli->query($sql);
}
}
else {
if($msgid) {
$output->te('Unknown msgid found:'.$count.' '.$msgid)->el('br');
}
}
}
else {
$output->te('Separator invalid:'.$count.' '.$line)->el('br');
}
}
$count++;
}
fclose($file);
}
}
$output->te('Done')->el('br');
Ufo::output('output',(string) $output);