source: client_files/Generate/search_var.php

Last change on this file was 61, checked in by george, 16 years ago
  • Přidáno: Export překladů do českého WoW Addonu.
  • Upraveno: Export souborů se nyní ukládá samostatně do složek dle jmen uživatelů.
  • Přidáno: Zobrazování chyb dle konfigurace.
File size: 3.5 KB
Line 
1<?php
2 session_start();
3 include('../../includes/config.php');
4 include('../../includes/databaseconection.php');
5 include('../../includes/global_function.php');
6
7 //připojení do databáze
8 $Database = new Database($Config['Database']['Host'], $Config['Database']['User'], $Config['Database']['Password']);
9 $Database->SQLCommand('SET NAMES '.$Config['Database']['Charset']);
10 $Database->SelectDatabase($Config['Database']['Database']);
11
12 if (Licence(2)) { // echo 'Přístup povolen';
13 } else { die('Přístup zamítnut!'); }
14
15 function set_name($text)
16 {
17 global $buffer;
18 $text = substr($text, strpos($text, '$g')+2, strlen($text)-strpos($text, '$g'));
19 $text = substr($text, 0, strpos($text, ';'));
20 $men = substr($text, 0, strpos($text, ':'));
21 $women = substr($text, strpos($text, ':')+1, strlen($text)-strpos($text, ':')+1);
22 if (isset($buffer[$men]) == false and ($men <> '') and ($women <> '') and (strlen($men) < 10) and (strlen($women) < 10))
23 {
24 $buffer[$men] = $women;
25 // echo $men.' '.$women.'<br />';
26 }
27 }
28
29
30 $sql = "SELECT `Language` , `Details` , `Objectives` , `OfferRewardText` , `RequestItemsText` , `EndText` , `ObjectiveText1` , `ObjectiveText2` , `ObjectiveText3` , `ObjectiveText4` FROM `quests` WHERE `Details` LIKE '%\$G%' OR `Objectives` LIKE '%\$G%' OR `OfferRewardText` LIKE '%\$G%' OR `RequestItemsText` LIKE '%\$G%' OR `EndText` LIKE '%\$G%' OR `ObjectiveText1` LIKE '%\$G%' OR `ObjectiveText2` LIKE '%\$G%' OR `ObjectiveText3` LIKE '%\$G%' OR `ObjectiveText4` LIKE '%\$G%' OR `Details` LIKE '%\$g%' OR `Objectives` LIKE '%\$g%' OR `OfferRewardText` LIKE '%\$g%' OR `RequestItemsText` LIKE '%\$g%' OR `EndText` LIKE '%\$g%' OR `ObjectiveText1` LIKE '%\$g%' OR `ObjectiveText2` LIKE '%\$g%' OR `ObjectiveText3` LIKE '%\$g%' OR `ObjectiveText4` LIKE '%\$g%'";
31
32 // echo $sql.'<br /><br />';
33 $ID = $Database->SQLCommand($sql);
34 while ($Line = mysql_fetch_array($ID))
35 {
36 // $language = $Line['Language'];
37 $text = strtolower($Line['Details']);
38 set_name($text);
39 $text = strtolower($Line['Objectives']);
40 set_name($text);
41 $text = strtolower($Line['OfferRewardText']);
42 set_name($text);
43 $text = strtolower($Line['RequestItemsText']);
44 set_name($text);
45 $text = strtolower($Line['EndText']);
46 set_name($text);
47
48 }
49
50 $sql = 'SELECT ';
51 for ($i=0;$i<8 ;++$i )
52 {
53 for ($j=0;$j<2 ;++$j )
54 {
55 $sql = $sql."text".$i."_$j,";
56 }
57 }
58 $sql = substr($sql, 0, strlen($sql)-1);
59 $sql = $sql." FROM npc WHERE ";
60 for ($i=0;$i<8 ;++$i )
61 {
62 for ($j=0;$j<2 ;++$j )
63 {
64 $sql = $sql."text".$i."_$j LIKE '%\$G%' OR ";
65 }
66 }
67 for ($i=0;$i<8 ;++$i )
68 {
69 for ($j=0;$j<2 ;++$j )
70 {
71 $sql = $sql."text".$i."_$j LIKE '%\$g%' OR ";
72 }
73 }
74 $sql = substr($sql, 0, strlen($sql) - 3);
75
76
77 $ID = $Database->SQLCommand($sql);
78 while ($Line = mysql_fetch_array($ID))
79 {
80 // $language = $Line['Language'];
81
82 for ($i = 0; $i < 8 ;++$i )
83 {
84 for ($j = 0; $j < 2 ;++$j )
85 {
86 $text = strtolower($Line["text".$i."_$j"]);
87 set_name($text);
88 }
89 }
90 }
91
92 echo '$var_g = array(<br />';
93 foreach ($buffer as $key => $value)
94 {
95 // echo $key.'-'.$value.'<br />';
96 echo " array('$key','$value'),<br />";
97 }
98 echo ');';
99
100?>
Note: See TracBrowser for help on using the repository browser.