Changeset 160 for trunk/dictionary.php
- Timestamp:
- Mar 18, 2009, 7:52:32 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dictionary.php
r85 r160 2 2 3 3 include('includes/global.php'); 4 5 6 function GetTranslatNames($Text) { 7 global $Database; 8 9 echo('Přeložené názvy věci, postav, a herních objektů k tomuto překladu 10 <div style="overflow: auto; width: 100%; height: 345px;"><table width="98%" class="BaseTable">'); 11 echo('<tr><th>Originál</th>'.'<th>Překlad</th>'); 12 $Tables = array('gameobject' => 'Name', 'creature' => 'name', 'item' => 'Name'); 13 foreach($Tables as $Table => $Column) { 14 15 $sql = 'SELECT *,(SELECT Name FROM '.$Table.' as T WHERE O.entry = T.entry AND Language <> 0 LIMIT 1) as tran 16 FROM '.$Table.' as O WHERE '; 17 $groupby = ' GROUP BY '.$Column; 18 19 $ArrStr = explode(' ', $Text); 20 $where = 'Language = 0 AND 21 EXISTS(SELECT 1 FROM '.$Table.' AS sub WHERE (sub.Language <> 0) AND (sub.entry = O.entry)) 22 AND ('; 23 for($i = 0; $i < count($ArrStr); $i++) 24 { 25 if (strpos($ArrStr[$i],'\'s') > 0) $ArrStr[$i] = substr($ArrStr[$i],0,strlen($ArrStr[$i])-4); 26 if (strlen($ArrStr[$i]) > 4) 27 $where .= 'O.'.$Column.' LIKE "%'.addslashes($ArrStr[$i]).'%" OR '; 28 } 29 $where = substr($where,0,strlen($where)-4); 30 $where .= ')'; 31 echo ('</tr>'); 32 33 $ID = $Database->SQLCommand($sql.$where.$groupby); 34 while($Line = mysql_fetch_assoc($ID)) { 35 echo('<tr> 36 <td>'.$Line[$Column].'</td> 37 <td>'.$Line['tran'].'</td> 38 '); 39 echo('</tr>'); 40 } 41 } 42 echo('</table></div>'); 43 } 44 4 45 5 46 echo('<?xml version="1.0" encoding="'.$Config['Web']['Charset'].'"?> … … 8 49 <head> 9 50 <meta http-equiv="content-type" content="text/html; charset=utf-8" /> 10 <link rel="stylesheet" href="'.$Config['Web']['BaseURL'].'style .css" type="text/css" media="all" />51 <link rel="stylesheet" href="'.$Config['Web']['BaseURL'].'style/style.css" type="text/css" media="all" /> 11 52 <script type="text/javascript" src="'.$Config['Web']['BaseURL'].'global.js"></script> 12 53 <link rel="SHORTCUT ICON" href="'.$Config['Web']['BaseURL'].'images/favicon.ico" /> … … 15 56 <body style="margin: 0px; font-family: Verdana, Arial, Sans-Serif;">'); 16 57 58 59 60 if (array_key_exists('group',$_GET)) { 61 62 if(array_key_exists('group', $_GET)) $GroupId = $_GET['group']; else $GroupId = 1; 63 $Table = $TranslationTree[$GroupId]['TablePrefix']; 64 if(array_key_exists('action', $_GET)) $Action = $_GET['action']; else $Action = ''; 65 66 if(array_key_exists('ID', $_GET)) { 67 $TextID = $_GET['ID']; 68 69 $Line = mysql_fetch_assoc($Database->SQLCommand('SELECT * FROM '.$Table.' Where ID = '.$TextID)); 70 if(!$Line) die('Překlad nenalezen.'); 71 72 $Text = ''; 73 foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 74 $Text .= ' '.$Line[$TextItem['Column']]; 75 GetTranslatNames($Text); 76 } 77 78 } else { 17 79 if(array_key_exists('insert', $_GET)) 18 80 { … … 67 129 $sql = "SELECT * FROM `dictionary`"; 68 130 } 69 echo('<table border="1" cellpadding="2" cellspacing="0" width="100%">131 echo('<table width="98%" class="BaseTable"> 70 132 <tr><th>Eng</th> 71 133 <th>Cze</th> … … 76 138 echo('<tr> 77 139 <td>'.$Line['AJWord'].'</td> 78 <t h>'.$Line['CZWord'].'</th>140 <td><strong>'.$Line['CZWord'].'</strong></td> 79 141 <td>'.$Line['description'].'</td></tr>'); 80 142 } … … 83 145 echo('</div></td></tr>'); 84 146 85 echo('</table></form></body></html>'); 147 echo('</table></form>'); 148 149 } 150 151 echo ('</body></html>'); 86 152 87 153 ?>
Note:
See TracChangeset
for help on using the changeset viewer.