source: client_files/generate_SQL_LocalizationStrings.php

Last change on this file was 40, checked in by george, 16 years ago
  • Upraveno: Změna kódování znaků souborů na UTF-8.
File size: 2.9 KB
Line 
1<?php
2
3 session_start();
4 include('../includes/config.php');
5 include('../includes/databaseconection.php');
6 include('../includes/global_function.php');
7
8 //připojení do databáze
9 $Database = new Database($Config['Database']['Host'], $Config['Database']['User'], $Config['Database']['Password']);
10 $Database->SQLCommand('SET NAMES '.$Config['Database']['Charset']);
11 $Database->SelectDatabase($Config['Database']['Database']);
12
13 if (Licence(2)) { // echo 'Přístup povolen';
14 } else { die('Přístup zamítnut!'); }
15
16 //Const
17 $SeparatorString = '"';
18 $SlashString = chr(92);
19 $File = '_language_files/LocalizationStrings.lua';
20 $save_filename = '_sql/LocalizationStrings.sql';
21
22 function Read()
23 { // BEGIN function Read
24 global $SeparatorString,$Buffer,$SlashString;
25 $Separator = $SeparatorString;
26
27 $result_string = substr($Buffer,0,strpos($Buffer,$Separator)); //načtení stringu
28 $last_char = substr($result_string,strlen($result_string)-1,1); //načtení předcházejícího znaku před separatorem
29 $Buffer = substr($Buffer,strlen($result_string)+1,strlen($Buffer)-strlen($result_string)); //mazání
30
31 while ($last_char == $SlashString) { //NFIRM", "Abandon \"%s\"?", "đ×ĐéđŚđ
32 $length_del = substr($Buffer,0,strpos($Buffer,$Separator));
33 $result_string .= $SeparatorString.substr($Buffer,0,strpos($Buffer,$Separator));
34 $last_char = substr($result_string,strlen($result_string)-1,1); //načtení předcházejícího znaku před separatorem
35 $Buffer = substr($Buffer,strlen($length_del)+1,strlen($Buffer)-strlen($result_string)); //mazání
36 }
37
38 return $result_string;
39
40 } // END function Read
41
42
43 $fcontents = file ($File);
44 $Buffer = '';
45
46 while (list ($line_num, $line) = each ($fcontents)) {
47 $Buffer .= $line;
48 }
49
50 $sql = "";
51 while ($Buffer <> '') {
52 Read();
53 $id_text = Read();
54 Read();
55 $aj_text = Read();
56 Read();
57 $ru_text = Read();
58 $sql .= "INSERT INTO `client_text` ( `text` , `id_text` , `File` , `Language`) VALUES ( \"$aj_text\", \"$id_text\", '0', '0' );
59 ";
60 }
61 $file_handle = fopen($save_filename, 'w');
62 $write_result = fwrite($file_handle, $sql);
63 fclose($file_handle);
64
65 echo '<b>hotovo</b>';
66
67/*
68
69local f=function(name, en, ru) RuWoW_interface[name]=ru; RuWoW_interface_entoname[en]=name; end; RuWoW_interface={ };RuWoW_interface_entoname={ };
70f("ABANDON_PET", "Are you sure you want to permanently abandon your pet?", "đĺĐő Đâđ-đÁĐÇđÁđŻĐő, ĐçĐéđż ĐůđżĐéđŞĐéđÁ đŻđ-đ-ĐüđÁđ-đ+đ- đŞđĚđ-đ-đ-đŞĐéĐîĐüĐĆ đżĐé Đüđ-đżđÁđ-đż đŹđŞĐéđżđ-Đćđ-?");
71f("ABANDON_QUEST_CONFIRM", "Abandon \"%s\"?", "đ×ĐéđŚđ-đĚđ-ĐéĐîĐüĐĆ đżĐé \"%s\"?");
72
73
74
75*/
76?>
77
Note: See TracBrowser for help on using the repository browser.