Changeset 880 for trunk/Modules/Translation
- Timestamp:
- Apr 7, 2020, 10:15:48 PM (5 years ago)
- Location:
- trunk/Modules/Translation
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Translation/Comparison.php
r859 r880 12 12 $ArrStr2 = explode(' ', $String2); 13 13 14 for ($i = 0; $i < count($ArrStr1); $i++)14 for ($i = 0; $i < count($ArrStr1); $i++) 15 15 { 16 if (isset($ArrStr2[$i]))16 if (isset($ArrStr2[$i])) 17 17 { 18 if ($ArrStr1[$i] == $ArrStr2[$i])18 if ($ArrStr1[$i] == $ArrStr2[$i]) 19 19 { 20 20 $Result .= $ArrStr1[$i].' '; … … 22 22 { 23 23 $find = false; 24 for ($j = 0; $j < count($ArrStr2); $j++)24 for ($j = 0; $j < count($ArrStr2); $j++) 25 25 { 26 if (($ArrStr1[$i] == $ArrStr2[$j]) and ($find == false))26 if (($ArrStr1[$i] == $ArrStr2[$j]) and ($find == false)) 27 27 { 28 28 $Result .= $ArrStr1[$i].' '; … … 30 30 } 31 31 } 32 if ($find == false)32 if ($find == false) 33 33 $Result .= '<span class="edit">'.$ArrStr1[$i].' </span>'; 34 34 } 35 35 } else $Result .= '<span class="edit">'.$ArrStr1[$i].' </span>'; 36 36 } 37 return ($Result);37 return $Result; 38 38 } 39 39 … … 44 44 $Output = ''; 45 45 46 if ($this->System->User->Licence(LICENCE_USER))46 if ($this->System->User->Licence(LICENCE_USER)) 47 47 { 48 48 $Output = 'Text je porovnáván vždy ku předešlému (vlevo). Změny jsou zvýrazněny <span class="edit">barvou.</span><br /><br />'; … … 51 51 $Table = $TranslationTree[$GroupId]['TablePrefix']; 52 52 53 if (array_key_exists('entry', $_GET))53 if (array_key_exists('entry', $_GET)) 54 54 { 55 55 $Textentry = $_GET['entry']; 56 if ((array_key_exists('ID1', $_GET)) and ($_GET['ID1'] <> -1)) //porovnání pouze 2 textů56 if ((array_key_exists('ID1', $_GET)) and ($_GET['ID1'] <> -1)) //porovnání pouze 2 textů 57 57 { 58 58 $TextID1 = $_GET['ID1']; … … 66 66 ' LEFT JOIN `Language` ON `Language`.`Id` = `'.$Table.'`.`Language` '. 67 67 'WHERE `Entry` = '.$Textentry.' '.$WhereID.' ORDER BY `Language`'); 68 while ($Line[] = $DataID->fetch_assoc());68 while ($Line[] = $DataID->fetch_assoc()); 69 69 array_pop($Line); 70 70 … … 74 74 '<table class="BaseTable">'. 75 75 '<tr><th>Přeložil</th>'; 76 foreach ($Line as $Index => $LineItem)76 foreach ($Line as $Index => $LineItem) 77 77 $Output .= '<th>'.$LineItem['UserName'].'</th>'; 78 78 $Output .= '</tr>'. 79 79 '<tr>'. 80 80 '<th>ID textu</th>'; 81 foreach ($Line as $Index => $LineItem)81 foreach ($Line as $Index => $LineItem) 82 82 $Output .= '<td><a href="form.php?group='.$GroupId.'&ID='.$LineItem['ID'].'">'.$LineItem['ID'].'</a></td>'; 83 83 $Output .= '</tr>'. 84 84 '<tr><th>Převzato</th>'; 85 foreach ($Line as $Index => $LineItem)85 foreach ($Line as $Index => $LineItem) 86 86 $Output .= '<td><a href="form.php?group='.$GroupId.'&ID='.$LineItem['Take'].'">'.$LineItem['Take'].'</a></td>'; 87 87 $Output .= '</tr>'. 88 88 '<tr><th>'.T('Language').'</th>'; 89 foreach ($Line as $Index => $LineItem)89 foreach ($Line as $Index => $LineItem) 90 90 $Output .= '<td>'.T($LineItem['LanguageName']).'</td>'; 91 91 $Output .= '</tr>'. 92 92 '<tr><th>'.T('Version').'</th>'; 93 foreach ($Line as $Index => $LineItem)93 foreach ($Line as $Index => $LineItem) 94 94 $Output .= '<td>'.GetVersionWOW($LineItem['VersionStart']).' - '.GetVersionWOW($LineItem['VersionEnd']).'</td>'; 95 95 $Output .= '</tr>'; 96 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)96 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 97 97 { 98 98 $writethis = false; 99 for ($i = 0; $i < count($Line); $i++)99 for ($i = 0; $i < count($Line); $i++) 100 100 { 101 if ($Line[$i][$TextItem['Column']] <> '') $writethis = true;101 if ($Line[$i][$TextItem['Column']] <> '') $writethis = true; 102 102 } 103 if ($writethis)103 if ($writethis) 104 104 { 105 105 $Output .= '<tr><th>'.$TextItem['Name'].'</th>'; 106 for ($i = 0; $i < count($Line); $i++)106 for ($i = 0; $i < count($Line); $i++) 107 107 { 108 if ($i > 0)108 if ($i > 0) 109 109 { 110 110 $Output .= '<td>'; … … 120 120 } else $Output .= ShowMessage('Porovnávat můžou pouze překladatelé!', MESSAGE_CRITICAL); 121 121 122 return ($Output);122 return $Output; 123 123 } 124 124 } -
trunk/Modules/Translation/Form.php
r859 r880 10 10 $this->Title = T('Translation'); 11 11 $Action = ''; 12 if (array_key_exists('action', $_GET)) $Action = $_GET['action'];13 14 if ($Action == 'delete') $Output = $this->Delete();12 if (array_key_exists('action', $_GET)) $Action = $_GET['action']; 13 14 if ($Action == 'delete') $Output = $this->Delete(); 15 15 else $Output = $this->ShowForm(); 16 return ($Output);16 return $Output; 17 17 } 18 18 … … 26 26 $this->GroupId = $GroupId; 27 27 $Table = $TranslationTree[$GroupId]['TablePrefix']; 28 if (array_key_exists('action', $_GET)) $Action = $_GET['action'];28 if (array_key_exists('action', $_GET)) $Action = $_GET['action']; 29 29 else $Action = ''; 30 30 31 if (array_key_exists('ID', $_GET))31 if (array_key_exists('ID', $_GET)) 32 32 { 33 33 $TextID = $_GET['ID'] * 1; … … 36 36 $DbResult = $this->Database->query('SELECT * FROM `'.$Table.'` WHERE `ID` = '.$TextID); 37 37 $Line = $DbResult->fetch_assoc(); 38 if (!$Line)38 if (!$Line) 39 39 { 40 40 $Output .= ShowMessage('Překlad nenalezen.', MESSAGE_CRITICAL); … … 47 47 else $Language = '`Language` != '.$this->System->Config['OriginalLanguage']; 48 48 $Columns = ''; 49 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)49 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 50 50 $Columns .= ' `Orig`.`'.$TextItem['Column'].'` as `Orig_'.$TextItem['Column'].'`, `Tran`.`'.$TextItem['Column'].'` as `'.$TextItem['Column'].'`,'; 51 51 … … 56 56 $DbResult = $this->Database->query($sql.$join.$where); 57 57 while ($LineSearch = $DbResult->fetch_assoc()) { 58 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)59 if ($TextItem['Visible'] == 1)58 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 59 if ($TextItem['Visible'] == 1) 60 60 if (($LineAJ[$TextItem['Column']] <> '') and 61 61 ($LineSearch[$TextItem['Column']] <> '') and … … 74 74 $LineAJ = $DbResult->fetch_assoc(); 75 75 } 76 if (!$LineAJ)76 if (!$LineAJ) 77 77 { 78 78 $Output .= ShowMessage('Anglický originál k překladu nenalezen.', MESSAGE_CRITICAL); … … 80 80 { 81 81 82 if ($Line['User'] != '')82 if ($Line['User'] != '') 83 83 { 84 84 $IDUser = $this->Database->query('SELECT * FROM `User` WHERE `ID` = '.$Line['User']); … … 89 89 $Output .= T('Group').': <strong>'.$TranslationTree[$GroupId]['Name'].'</strong><br />'; 90 90 91 if (($Line['Language'] <> 0) and ($LineUser['Name'] <> ''))91 if (($Line['Language'] <> 0) and ($LineUser['Name'] <> '')) 92 92 $Output .= T('Translated by').': <a href="'.$this->System->Link('/user/?user='.$Line['User']).'"><strong>'.$LineUser['Name'].'</strong></a> dne '.HumanDate($Line['ModifyTime']).'<br />'; 93 if (($Line['Take'] <> 0) and ($Line['Take'] <> $Line['ID']))93 if (($Line['Take'] <> 0) and ($Line['Take'] <> $Line['ID'])) 94 94 { 95 95 $DbResult = $this->Database->query('SELECT `Language`,`VersionStart`,`VersionEnd` FROM `'.$Table.'` WHERE `ID` = '.$Line['Take']); … … 105 105 } 106 106 $Output .= 'Text: '; 107 if ($Line['Language'] <> 0)108 { 109 if ($Line['Complete'] == 1) $Output .= ' <b>'.T('Completed').'</b>';107 if ($Line['Language'] <> 0) 108 { 109 if ($Line['Complete'] == 1) $Output .= ' <b>'.T('Completed').'</b>'; 110 110 else $Output .= ' <b>'.T('Stored in unfinished').'</b> '; 111 111 } else $Output .= ' <b>'.T('Original version').'</b> '; … … 120 120 $Version = $DbResult->fetch_row(); 121 121 $Version = $Version[0]; 122 if ($Version > 0)122 if ($Version > 0) 123 123 { 124 124 $Output .= '<form action="comparison.php" method="get"><a href="'.$this->System->Link('/TranslationList.php?group='. … … 128 128 <input type="hidden" name="ID2" value="'.$TextID.'" />'; 129 129 130 if ($this->System->User->Licence(LICENCE_USER)) { // allow to compare only to user130 if ($this->System->User->Licence(LICENCE_USER)) { // allow to compare only to user 131 131 $Output .= '<select onchange="this.form.submit();" name="ID1"> 132 132 <option value="-1">'.T('Select text for comparison').'</option> 133 133 <option value="-1">'.T('Show/compare all').'</option>'; 134 134 $DataID = $this->Database->query('SELECT *, (SELECT `User`.`Name` AS `UserName` FROM `User` WHERE `User`.`ID` = `'.$Table.'`.`User`) AS `UserName` FROM `'.$Table.'` WHERE (`Entry` = '.$Line['Entry'].') AND (`ID` <> '.$Line['ID'].')'); 135 while ($Version = $DataID->fetch_array())135 while ($Version = $DataID->fetch_array()) 136 136 { 137 if ($Version['ID'] == $Line['Take']) $Output .= '<option value="'.137 if ($Version['ID'] == $Line['Take']) $Output .= '<option value="'. 138 138 $Version['ID'].'">'.$Version['ID'].' - '.$Version['User'].' ('.T('taken over').')</option>'; 139 139 else 140 140 { 141 if ($Version['Language'] == 0) $Version['UserName'] = T('Original');141 if ($Version['Language'] == 0) $Version['UserName'] = T('Original'); 142 142 $Output .= '<option value="'.$Version['ID'].'">'.$Version['ID'].' - '. 143 143 $Version['UserName'].' ('.GetVersionWOW($Version['VersionStart']).' - '. … … 155 155 156 156 // Special characters: $B - New line, $N - Name, $C - profession 157 if ($this->System->User->Licence(LICENCE_USER))157 if ($this->System->User->Licence(LICENCE_USER)) 158 158 { 159 159 $Output .= '<form action="'.$this->System->Link('/save.php?group='.$GroupId).'" method="post"><div>'; 160 160 // TODO: Remove fixed group id condition 161 // if (($GroupId < 4) or ($GroupId == 10) or ($GroupId == 11))161 // if (($GroupId < 4) or ($GroupId == 10) or ($GroupId == 11)) 162 162 $Output .= '<a href="'.$this->System->Link('/dictionary/?action=group&group='. 163 163 $GroupId.'&ID='.$LineAJ['ID']).'" target="_blank" title="Zobrazit přeložené názvy věci, postav, a herních objektů k tomuto překladu">'.T('Search in names').'</a>'; … … 169 169 } 170 170 171 if ($TranslationTree[$GroupId]['WowheadName'] != '')171 if ($TranslationTree[$GroupId]['WowheadName'] != '') 172 172 $WowheadLink = '<a href="http://www.wowhead.com/?'.$TranslationTree[$GroupId]['WowheadName']. 173 173 '='.$LineAJ['Entry'].'">'.$LineAJ['Entry'].'</a>'; … … 187 187 <td>'.T('Original').'</td> 188 188 <td>'; 189 if ($Line['Language'] <> 0) $Language = $Line['Language'];190 else if ($this->System->User->Id != 0)189 if ($Line['Language'] <> 0) $Language = $Line['Language']; 190 else if ($this->System->User->Id != 0) 191 191 { 192 192 $Language = $this->System->User->Language; 193 193 } else $Language = 0; 194 if ($this->System->User->Licence(LICENCE_USER)) $Output .= WriteLanguages($Language);194 if ($this->System->User->Licence(LICENCE_USER)) $Output .= WriteLanguages($Language); 195 195 else { 196 196 $DbResult3 = $this->Database->select('Language', '`Id`, `Name`', '(`Enabled` = 1) AND (`Id`='.$Language.')'); 197 if ($DbResult3->num_rows > 0)197 if ($DbResult3->num_rows > 0) 198 198 { 199 199 $Language = $DbResult3->fetch_assoc(); … … 209 209 '<script>'; 210 210 $Output .= '$(document).ready(function() {'; 211 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)211 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 212 212 $Output .= '$("#'.$TextItem['Column'].'").load("'.$this->System->Link('/LoadNames.php?ID='.$LineAJ['ID'].'&Column='.$TextItem['Column'].'&GroupId='.$GroupId).'");'; 213 213 … … 215 215 '</script>'; 216 216 217 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)218 if ($TextItem['Visible'] == 1)217 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 218 if ($TextItem['Visible'] == 1) 219 219 { 220 if (($LineAJ[$TextItem['Column']] <> '') or ($Line[$TextItem['Column']] <> ''))220 if (($LineAJ[$TextItem['Column']] <> '') or ($Line[$TextItem['Column']] <> '')) 221 221 { 222 if (($TextItem['Name'] == 'Text') and (($Table == 'global_strings') or ($Table == 'glue_strings')))222 if (($TextItem['Name'] == 'Text') and (($Table == 'global_strings') or ($Table == 'glue_strings'))) 223 223 $Output .= '<tr><th>'.$LineAJ['ShortCut'].'</th>'; 224 224 else $Output .= '<tr><th>'.T($TextItem['Name']).'</th>'; 225 225 $Output .= '<td id="'.$TextItem['Column'].'">'.str_replace("\n", '<br/>', htmlspecialchars($LineAJ[$TextItem['Column']])).'</td> 226 226 <td>'; 227 if ($this->System->User->Licence(LICENCE_USER))227 if ($this->System->User->Licence(LICENCE_USER)) 228 228 $Output .= '<textarea rows="8" cols="40" onkeydown="ResizeTextArea(this)" class="textedit" id="'.$TextItem['Column'].'" name="'.$TextItem['Column'].'">'; 229 229 $Output .= htmlspecialchars($Line[$TextItem['Column']]); 230 if ($this->System->User->Licence(LICENCE_USER)) $Output .= '</textarea></td></tr>';230 if ($this->System->User->Licence(LICENCE_USER)) $Output .= '</textarea></td></tr>'; 231 231 } 232 232 } else … … 235 235 } 236 236 $Output .= '</table></div>'; 237 if ($this->System->User->Licence(LICENCE_USER)) {237 if ($this->System->User->Licence(LICENCE_USER)) { 238 238 $Output .= '</form>'; 239 239 240 if (isset($this->System->Config['Web']['EnableGoogleTranslate']) and240 if (isset($this->System->Config['Web']['EnableGoogleTranslate']) and 241 241 $this->System->Config['Web']['EnableGoogleTranslate']) 242 242 { 243 243 $Output .= '<br/><table class="BaseTable">'. 244 244 '<tr><th>'.T('Google translator').':</th><th>'.T('Not translated').'</th><th>'.T('Translated').'</th>'; 245 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)246 if ($TextItem['Visible'] == 1)245 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 246 if ($TextItem['Visible'] == 1) 247 247 if ($LineAJ[$TextItem['Column']] <> '') 248 248 $Output .= '<tr><td>'.$TextItem['Column'].'</td>'. … … 256 256 } 257 257 } else $Output = ShowMessage('Nebylo zadáno ID.', MESSAGE_CRITICAL); 258 return ($Output);258 return $Output; 259 259 } 260 260 … … 263 263 $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree(); 264 264 265 if ($this->System->User->Licence(LICENCE_MODERATOR))265 if ($this->System->User->Licence(LICENCE_MODERATOR)) 266 266 { 267 267 $GroupId = LoadGroupIdParameter(); … … 273 273 $this->System->ModuleManager->Modules['Log']->WriteLog('Překlad byl smazán! <a href="'.$this->System->Link('/form.php?group='.$this->GroupId.'&ID='.$TextID).'">'.$TextID.'</a>', LOG_TYPE_MODERATOR); 274 274 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 275 return ($Output);275 return $Output; 276 276 } 277 277 } -
trunk/Modules/Translation/LoadNames.php
r859 r880 18 18 } 19 19 // } 20 return ($Text);20 return $Text; 21 21 } 22 22 function ReplaceNotTranslated($orig,$tran,$Text,$ID,$Group) … … 26 26 $Text = str_replace(' '.$orig,' <span title="Kliknutím přeložíš" class="needtran"><a class="needtran" target="_NEW2" href="'. 27 27 $this->System->Link('/form.php?group='.$Group.'&ID='.$ID).'">'.$orig_replace.'</a></span>',$Text); 28 return ($Text);28 return $Text; 29 29 } 30 30 … … 44 44 $Text = str_replace('$r','<span Title="Znamená rasu hráče, překladu zachovej na stejné pozici." class="edit">$R</span>',$Text); 45 45 $Text = str_replace('$g','<span Title="Vybere oslovení podle pohlaví hráče, překladu zachovej na stejné pozici." class="edit">$G</span>',$Text); 46 foreach ($names as $Line) {46 foreach ($names as $Line) { 47 47 if (($_GET['ID'] <> $Line[0]) or ($Line[1] <> $_GET['GroupId'])) 48 48 if ($Line[3] <> '') { … … 61 61 62 62 $Output = ''; 63 if (array_key_exists('GroupId', $_GET)) $GroupId = $_GET['GroupId'];64 else return (ShowMessage(T('GroupId not specified'), MESSAGE_CRITICAL));65 if (!array_key_exists('ID', $_GET)) return(ShowMessage(T('ID not specified'), MESSAGE_CRITICAL));66 if (!array_key_exists('Column', $_GET)) return(ShowMessage(T('Column not specified'), MESSAGE_CRITICAL));63 if (array_key_exists('GroupId', $_GET)) $GroupId = $_GET['GroupId']; 64 else return ShowMessage(T('GroupId not specified'), MESSAGE_CRITICAL); 65 if (!array_key_exists('ID', $_GET)) return ShowMessage(T('ID not specified'), MESSAGE_CRITICAL); 66 if (!array_key_exists('Column', $_GET)) return ShowMessage(T('Column not specified'), MESSAGE_CRITICAL); 67 67 $Table = $TranslationTree[$GroupId]['TablePrefix']; 68 68 $DbResult = $this->System->Database->query('SELECT * FROM `'.$Table.'` WHERE `ID` = '.$_GET['ID'].' LIMIT 1'); … … 73 73 $names = array(); 74 74 if ($this->System->User->Licence(LICENCE_USER)) 75 if (($GroupId < 4) or ($GroupId == 10) or ($GroupId == 11))75 if (($GroupId < 4) or ($GroupId == 10) or ($GroupId == 11)) 76 76 { 77 77 //<span class="edit">barvou.</span> 78 78 $names = GetTranslatNames($Text, 0, GetTranslatNamesArray()); 79 79 } else { 80 if (($GroupId == 13)) {80 if (($GroupId == 13)) { 81 81 $names = GetTranslatNames($Text, 0, array('Dictionary' => 'Text', 82 82 'TextGlobalString' => 'Text', 'TextArea' => 'Name', … … 87 87 } 88 88 //$LineAJ[$Column] 89 return ($this->ColorNames(htmlspecialchars($Text),$names));89 return $this->ColorNames(htmlspecialchars($Text),$names); 90 90 } 91 91 … … 93 93 { 94 94 $this->RawPage = true; 95 return (str_replace("\n", '<br/>', $this->LoadNames()));95 return str_replace("\n", '<br/>', $this->LoadNames()); 96 96 } 97 97 } -
trunk/Modules/Translation/Progress.php
r847 r880 8 8 9 9 $BuildNumber = GetBuildNumber($_SESSION['StatVersion']); 10 if (is_numeric($_SESSION['language'])) $LanguageFilter = 'AND (`Language`='.$_SESSION['language'].')';10 if (is_numeric($_SESSION['language'])) $LanguageFilter = 'AND (`Language`='.$_SESSION['language'].')'; 11 11 else $LanguageFilter = ' AND (`Language`!='.$this->System->Config['OriginalLanguage'].')'; 12 12 … … 14 14 $Query = ''; 15 15 $DbResult = $this->Database->query($GroupListQuery); 16 if ($DbResult->num_rows > 0)16 if ($DbResult->num_rows > 0) 17 17 { 18 while ($DbRow = $DbResult->fetch_assoc())18 while ($DbRow = $DbResult->fetch_assoc()) 19 19 { 20 20 $Query .= 'SELECT (SELECT COUNT(DISTINCT(`Entry`)) FROM ('. … … 50 50 $Total = 0; 51 51 $DbResult = $this->Database->query('SELECT *, ROUND(`Translated` / `Total` * 100, 2) AS `Percent` FROM ('.$Query.') AS `C3` '.$Order['SQL'].$PageList['SQLLimit']); 52 while ($Group = $DbResult->fetch_assoc())52 while ($Group = $DbResult->fetch_assoc()) 53 53 { 54 54 $Output .= '<tr><td>'.T($Group['Name']).'</td><td>'.$Group['Translated'].'</td><td>'.$Group['Total'].'</td><td>'.ProgressBar(150, $Group['Percent']).'</td></tr>'; … … 56 56 $Total += $Group['Total']; 57 57 } 58 if ($Total <> 0) $TotalCount = round($Translated / $Total * 100, 2);58 if ($Total <> 0) $TotalCount = round($Translated / $Total * 100, 2); 59 59 else $TotalCount = 0; 60 60 $Output .= '<tr><td><strong>'.T('Total').'</strong></td><td><strong>'.$Translated.'</strong></td><td><strong>'.$Total.'</strong></td><td><strong>'.ProgressBar(150, $TotalCount).'</strong></td></tr>'. 61 61 '</table>'; 62 62 } 63 return ($Output);63 return $Output; 64 64 } 65 65 … … 69 69 $LanguageList = GetLanguageList(); 70 70 71 if (array_key_exists('Version', $_GET)) $_SESSION['StatVersion'] = $_GET['Version'];72 if (!array_key_exists('StatVersion', $_SESSION))71 if (array_key_exists('Version', $_GET)) $_SESSION['StatVersion'] = $_GET['Version']; 72 if (!array_key_exists('StatVersion', $_SESSION)) 73 73 { 74 if ($this->System->User->Licence(LICENCE_USER) and ($this->System->User->PreferredVersionGame != ''))74 if ($this->System->User->Licence(LICENCE_USER) and ($this->System->User->PreferredVersionGame != '')) 75 75 { 76 76 $_SESSION['StatVersion'] = $this->System->User->PreferredVersionGame; … … 80 80 } 81 81 82 if (!isset($_SESSION['language']))82 if (!isset($_SESSION['language'])) 83 83 { 84 if ($this->System->User->Licence(LICENCE_USER))84 if ($this->System->User->Licence(LICENCE_USER)) 85 85 { 86 86 $_SESSION['language'] = $this->System->User->Language; … … 89 89 } 90 90 } 91 if (array_key_exists('language', $_GET))91 if (array_key_exists('language', $_GET)) 92 92 { 93 if ($_GET['language'] == '') {93 if ($_GET['language'] == '') { 94 94 $_SESSION['language'] = ''; 95 95 } else { … … 97 97 } 98 98 } 99 if (!array_key_exists($_SESSION['language'], $LanguageList)) $_SESSION['language'] = '';99 if (!array_key_exists($_SESSION['language'], $LanguageList)) $_SESSION['language'] = ''; 100 100 101 101 // Show client version selection 102 102 $Output = T('Client version:').' '; 103 103 $DbResult = $this->Database->query('SELECT `Version`, `Title` FROM `ClientVersion` WHERE `Imported`=1 ORDER BY `Version`'); 104 while ($DbRow = $DbResult->fetch_assoc())104 while ($DbRow = $DbResult->fetch_assoc()) 105 105 $Output .= '<a href="?Version='.$DbRow['Version'].'" title="'.$DbRow['Title'].'">'.$DbRow['Version'].'</a> '; 106 106 $Output .= '<br/>'; … … 109 109 $Output .= T('Language:').' '; 110 110 $Lang = '<a href="?language=">'.T('All').'</a>'; 111 if ($_SESSION['language'] == '') $Output .= '<strong>'.$Lang.'</strong> ';111 if ($_SESSION['language'] == '') $Output .= '<strong>'.$Lang.'</strong> '; 112 112 else $Output .= $Lang; 113 foreach ($LanguageList as $Language)114 if ($Language['Enabled'] == 1)113 foreach ($LanguageList as $Language) 114 if ($Language['Enabled'] == 1) 115 115 { 116 116 $Lang = ' <a href="?language='.$Language['Id'].'">'.T($Language['Name']).'</a>'; 117 if ($Language['Id'] == $_SESSION['language']) $Output .= '<strong>'.$Lang.'</strong> ';117 if ($Language['Id'] == $_SESSION['language']) $Output .= '<strong>'.$Lang.'</strong> '; 118 118 else $Output .= $Lang; 119 119 } 120 120 121 if (is_numeric($_SESSION['language'])) $LanguageName = $LanguageList[$_SESSION['language']]['Name'];121 if (is_numeric($_SESSION['language'])) $LanguageName = $LanguageList[$_SESSION['language']]['Name']; 122 122 else $LanguageName = T('All'); 123 123 $Output .= '<br/><br/><h3>'.sprintf(T('Statistics of translation completion of language %s for version %s'), T($LanguageName), $_SESSION['StatVersion']).'</h3><br/>'; 124 124 $Output .= $this->ShowStatTable(); 125 125 126 return ($Output);126 return $Output; 127 127 } 128 128 } -
trunk/Modules/Translation/Save.php
r859 r880 11 11 // Get source text record from database by ID 12 12 $DbResult = $this->Database->query('SELECT * FROM `'.$Table.'` WHERE `ID`='.$TextID); 13 if ($DbResult->num_rows > 0)13 if ($DbResult->num_rows > 0) 14 14 { 15 15 $SourceText = $DbResult->fetch_assoc(); … … 19 19 'AND (`Language` = '.$this->System->Config['OriginalLanguage'].') AND (`VersionStart` = '.$SourceText['VersionStart'].') '. 20 20 'AND (`VersionEnd` = '.$SourceText['VersionEnd'].')'); 21 if ($DbResult->num_rows > 0)21 if ($DbResult->num_rows > 0) 22 22 { 23 23 $EnglishText = $DbResult->fetch_assoc(); … … 25 25 // Get all similar english texts 26 26 $Filter = array(); 27 foreach ($Group['Items'] as $GroupItem)27 foreach ($Group['Items'] as $GroupItem) 28 28 { 29 if (($GroupItem['Visible'] == 1) and ($EnglishText[$GroupItem['Column']] != ''))29 if (($GroupItem['Visible'] == 1) and ($EnglishText[$GroupItem['Column']] != '')) 30 30 $Filter[] = '(`'.$GroupItem['Column'].'` = "'.addslashes($EnglishText[$GroupItem['Column']]).'")'; 31 31 } 32 if (count($Filter) > 0) $Filter = ' AND ('.implode(' OR ', $Filter).')';32 if (count($Filter) > 0) $Filter = ' AND ('.implode(' OR ', $Filter).')'; 33 33 else $Filter = ' AND 0'; 34 34 35 35 $Query = 'SELECT * FROM `'.$Table.'` WHERE (`Language` = '.$this->System->Config['OriginalLanguage'].')'.$Filter; 36 36 $DbResult = $this->Database->query($Query); 37 while ($EnglishFound = $DbResult->fetch_assoc())37 while ($EnglishFound = $DbResult->fetch_assoc()) 38 38 { 39 39 // Get user translation paired to found english item entry … … 41 41 ') AND (`Entry` = '.$EnglishFound['Entry'].') AND (`VersionStart` = '.$EnglishFound['VersionStart']. 42 42 ') AND (`VersionEnd` = '.$EnglishFound['VersionEnd'].')'); 43 if ($DbResult2->num_rows > 0)43 if ($DbResult2->num_rows > 0) 44 44 { 45 45 // Update existed user translation … … 47 47 $Modified = false; 48 48 $Values = '`Language` = '.$Language; 49 if ($Language != $ExistedText['Language']) $Modified = true;49 if ($Language != $ExistedText['Language']) $Modified = true; 50 50 51 51 $Completable = true; 52 52 $CompleteParts = $ExistedText['CompleteParts']; 53 foreach ($Group['Items'] as $GroupItem)54 { 55 if ($GroupItem['Visible'] == 1)56 { 57 if ($EnglishFound[$GroupItem['Column']] == $EnglishText[$GroupItem['Column']])53 foreach ($Group['Items'] as $GroupItem) 54 { 55 if ($GroupItem['Visible'] == 1) 56 { 57 if ($EnglishFound[$GroupItem['Column']] == $EnglishText[$GroupItem['Column']]) 58 58 { 59 if (array_key_exists($GroupItem['Column'], $_POST))59 if (array_key_exists($GroupItem['Column'], $_POST)) 60 60 { 61 if ($_POST[$GroupItem['Column']] != $ExistedText[$GroupItem['Column']])61 if ($_POST[$GroupItem['Column']] != $ExistedText[$GroupItem['Column']]) 62 62 $Modified = true; 63 63 … … 66 66 } 67 67 } 68 if ((($CompleteParts & (1 << ($GroupItem['Sequence'] - 1))) == 0) and68 if ((($CompleteParts & (1 << ($GroupItem['Sequence'] - 1))) == 0) and 69 69 ($EnglishFound[$GroupItem['Column']] != '')) $Completable = false; 70 70 } 71 71 } 72 if ($Completable) $NewComplete = 1; // All parts of text are completed. Make entire text as completed72 if ($Completable) $NewComplete = 1; // All parts of text are completed. Make entire text as completed 73 73 else $NewComplete = 0; 74 74 75 75 // Update completion status for edited translation item 76 if ($SourceText['ID'] == $ExistedText['ID'])76 if ($SourceText['ID'] == $ExistedText['ID']) 77 77 { 78 78 $NewComplete = $Complete; // Our original user text, set complete according user choice 79 if ($Complete == 1)80 { 81 foreach ($Group['Items'] as $GroupItem)82 if ($GroupItem['Visible'] == 1) $CompleteParts |= (1 << ($GroupItem['Sequence'] - 1));79 if ($Complete == 1) 80 { 81 foreach ($Group['Items'] as $GroupItem) 82 if ($GroupItem['Visible'] == 1) $CompleteParts |= (1 << ($GroupItem['Sequence'] - 1)); 83 83 } 84 84 } 85 85 $Values .= ', `Complete`='.$NewComplete.', `CompleteParts` = '.$CompleteParts; 86 if (($NewComplete != $ExistedText['Complete']) or ($CompleteParts != $ExistedText['CompleteParts']))86 if (($NewComplete != $ExistedText['Complete']) or ($CompleteParts != $ExistedText['CompleteParts'])) 87 87 $Modified = true; 88 88 89 89 $Values .= ', `ModifyTime` = NOW()'; 90 if ($Modified)90 if ($Modified) 91 91 { 92 92 // Update user translation … … 114 114 $CompleteParts = 0; 115 115 $Completable = true; 116 foreach ($Group['Items'] as $GroupItem)116 foreach ($Group['Items'] as $GroupItem) 117 117 { 118 118 $Columns .= ', `'.$GroupItem['Column'].'`'; 119 if ($GroupItem['Visible'] == 1)120 { 121 if ($EnglishFound[$GroupItem['Column']] == $EnglishText[$GroupItem['Column']])119 if ($GroupItem['Visible'] == 1) 120 { 121 if ($EnglishFound[$GroupItem['Column']] == $EnglishText[$GroupItem['Column']]) 122 122 { 123 123 // Read form user data 124 if (array_key_exists($GroupItem['Column'], $_POST))124 if (array_key_exists($GroupItem['Column'], $_POST)) 125 125 { 126 126 $Values .= ', "'.$_POST[$GroupItem['Column']].'"'; … … 128 128 } else $Values .= ', "'.addslashes($EnglishFound[$GroupItem['Column']]).'"'; 129 129 } else $Values .= ', "'.addslashes($EnglishFound[$GroupItem['Column']]).'"'; 130 if ((($CompleteParts & (1 << ($GroupItem['Sequence'] - 1))) == 0) and ($EnglishFound[$GroupItem['Column']] != '')) $Completable = false;130 if ((($CompleteParts & (1 << ($GroupItem['Sequence'] - 1))) == 0) and ($EnglishFound[$GroupItem['Column']] != '')) $Completable = false; 131 131 } else 132 132 { … … 135 135 } 136 136 } 137 if ($Completable) $NewComplete = 1; // All parts of text are completed. Make entire text as completed137 if ($Completable) $NewComplete = 1; // All parts of text are completed. Make entire text as completed 138 138 else $NewComplete = 0; 139 139 // Update completion status for edited translation item 140 if ($SourceText['ID'] == $EnglishFound['ID'])140 if ($SourceText['ID'] == $EnglishFound['ID']) 141 141 { 142 142 $TakeID = $TextID; 143 143 $NewComplete = $Complete; // Our original user text, set complete according user choice 144 if ($Complete == 1)145 { 146 foreach ($Group['Items'] as $GroupItem)147 if ($GroupItem['Visible'] == 1) $CompleteParts |= (1 << ($GroupItem['Sequence'] - 1));144 if ($Complete == 1) 145 { 146 foreach ($Group['Items'] as $GroupItem) 147 if ($GroupItem['Visible'] == 1) $CompleteParts |= (1 << ($GroupItem['Sequence'] - 1)); 148 148 } 149 149 } … … 171 171 } else $Output .= ShowMessage('Anglický originál k překladu nenalezen.', MESSAGE_CRITICAL); 172 172 } else $Output .= ShowMessage('Zadaná položka nenalezena.', MESSAGE_CRITICAL); 173 return ($Output);173 return $Output; 174 174 } 175 175 … … 183 183 unset($Message); 184 184 $this->System->ModuleManager->Modules['FrontPage']->HandleLoginForm(); 185 if (isset($Message)) $Output .= ShowMessage($Message, $MessageType);185 if (isset($Message)) $Output .= ShowMessage($Message, $MessageType); 186 186 187 187 $GroupId = LoadGroupIdParameter(); 188 188 $Group = $TranslationTree[$GroupId]; 189 189 $Table = $Group['TablePrefix']; 190 if ($this->System->User->Licence(LICENCE_USER))191 { 192 if (array_key_exists('ID', $_POST) and is_numeric($_POST['ID']))190 if ($this->System->User->Licence(LICENCE_USER)) 191 { 192 if (array_key_exists('ID', $_POST) and is_numeric($_POST['ID'])) 193 193 { 194 194 $Entry = $_POST['entry'] * 1; 195 195 $TextID = $_POST['ID'] * 1; 196 196 $Language = $_POST['Language'] * 1; 197 if (array_key_exists('End', $_POST)) $Complete = 1;197 if (array_key_exists('End', $_POST)) $Complete = 1; 198 198 else $Complete = 0; 199 199 … … 207 207 { 208 208 // User automatically logged out. Show login dialog and allow to save retry. 209 if (array_key_exists('ID', $_POST) and array_key_exists('entry', $_POST) and array_key_exists('Language', $_POST) and array_key_exists('user', $_POST))209 if (array_key_exists('ID', $_POST) and array_key_exists('entry', $_POST) and array_key_exists('Language', $_POST) and array_key_exists('user', $_POST)) 210 210 { 211 211 $Output .= 'Byli jste automaticky odhlášeni. Pro <strong>Uložení překladu</strong> se musíte přihlásit zde:<br /><br />'. … … 216 216 '<input type="hidden" name="Language" value="'.$_POST['Language'].'" />'; 217 217 218 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)218 foreach ($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 219 219 { 220 if (array_key_exists($TextItem['Column'], $_POST)) $Value = $_POST[$TextItem['Column']]; else $Value = '';220 if (array_key_exists($TextItem['Column'], $_POST)) $Value = $_POST[$TextItem['Column']]; else $Value = ''; 221 221 $Output .= '<input id="'.$TextItem['Column'].'" name="'.$TextItem['Column'].'" type="hidden" value="'.htmlspecialchars($Value).'" />'; 222 222 } … … 232 232 } else $Output = ShowMessage('Nezadány požadované údaje.', MESSAGE_CRITICAL); 233 233 } 234 return ($Output);234 return $Output; 235 235 } 236 236 … … 246 246 $redirecting = $DbResult->fetch_assoc(); 247 247 248 switch ($redirecting['Redirecting'])248 switch ($redirecting['Redirecting']) 249 249 { 250 250 case 1: … … 254 254 break; 255 255 case 2: 256 if ($next <> '')256 if ($next <> '') 257 257 $Output .= '<script type="text/javascript" language="JavaScript" charset="utf-8">'. 258 258 'setTimeout("parent.location.href=\''.htmlspecialchars_decode($next).'\'", 1500)'. … … 260 260 break; 261 261 case 3: 262 if ($prev <> '')262 if ($prev <> '') 263 263 $Output .= '<script type="text/javascript" language="JavaScript" charset="utf-8">'. 264 264 'setTimeout("parent.location.href=\''.htmlspecialchars_decode($prev).'\'", 1500)'. … … 269 269 $Output .= sprintf(T('You can be redirected automatically from this page. You can set where you want to be transfered here: %s'), '<a href="'. 270 270 $this->System->Link('/options/').'" title="'.T('User settings').'">'.T('Options').'</a>'); 271 return ($Output);271 return $Output; 272 272 } 273 273 } -
trunk/Modules/Translation/Translation.php
r861 r880 47 47 'Icon' => '', 48 48 )); 49 if (array_key_exists('Search', $this->System->ModuleManager->Modules))49 if (array_key_exists('Search', $this->System->ModuleManager->Modules)) 50 50 { 51 51 $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree(); 52 foreach ($TranslationTree as $Group)52 foreach ($TranslationTree as $Group) 53 53 { 54 54 $Table = $Group['TablePrefix']; 55 55 56 56 $Columns = array('ID', 'Entry'); 57 foreach ($Group['Items'] as $Item)57 foreach ($Group['Items'] as $Item) 58 58 { 59 if ($Item['Column'] != '') $Columns[] = $Item['Column'];59 if ($Item['Column'] != '') $Columns[] = $Item['Column']; 60 60 } 61 61 … … 74 74 $DbResult = $this->Database->query('SELECT UNIX_TIMESTAMP(`Date`) AS `Date`, `User`.`Name` AS `UserName`, `Text` FROM `Log` '. 75 75 'JOIN `User` ON `User`.`ID` = `Log`.`User` WHERE `Type` = 1 ORDER BY `Date` DESC LIMIT 100'); 76 while ($DbRow = $DbResult->fetch_assoc())76 while ($DbRow = $DbResult->fetch_assoc()) 77 77 { 78 78 $Items[] = array … … 92 92 'Items' => $Items, 93 93 )); 94 return ($Output);94 return $Output; 95 95 } 96 96 … … 105 105 $UnionItems = array(); 106 106 $DbResult = $this->Database->query($GroupListQuery); 107 if ($DbResult->num_rows > 0)108 { 109 while ($DbRow = $DbResult->fetch_assoc())107 if ($DbResult->num_rows > 0) 108 { 109 while ($DbRow = $DbResult->fetch_assoc()) 110 110 { 111 111 $UnionItems[] = 'SELECT `T`.`ID`, `T`.`Take`, `T`.`User`, `T`.`ModifyTime`, `T`.`Group`, `T`.`GroupName` '. … … 122 122 $DbResult = $this->Database->query($Query); 123 123 $Output .= '<table class="MiniTable"><tr><th>'.T('Date').'</th><th>'.T('Who').'</th><th>'.T('New').'</th><th>'.T('Source').'</th><th>'.T('Group').'</th></tr>'; 124 while ($DbRow = $DbResult->fetch_assoc())124 while ($DbRow = $DbResult->fetch_assoc()) 125 125 { 126 126 $Output .= '<tr><td>'.HumanDate($DbRow['ModifyTime']).'</td>'. … … 133 133 } 134 134 $Output .= '</div>'; 135 return ($Output);135 return $Output; 136 136 } 137 137 138 138 function GetTranslationTree() 139 139 { 140 if (isset($this->TranslationTree)) return($this->TranslationTree);140 if (isset($this->TranslationTree)) return $this->TranslationTree; 141 141 else { 142 142 $Result = array(); 143 143 $Groups = array(); 144 144 $DbResult = $this->System->Database->query('SELECT *, UNIX_TIMESTAMP(`LastImport`) AS `LastImportTime` FROM `Group`'); 145 while ($DbRow = $DbResult->fetch_assoc())145 while ($DbRow = $DbResult->fetch_assoc()) 146 146 $Groups[T($DbRow['Name'])] = $DbRow; 147 147 ksort($Groups); 148 foreach ($Groups as $Group)148 foreach ($Groups as $Group) 149 149 { 150 150 $Group['Items'] = array(); … … 153 153 } 154 154 $DbResult = $this->System->Database->query('SELECT * FROM `GroupItem` ORDER BY `Group`, `Sequence`'); 155 while ($DbRow = $DbResult->fetch_assoc())155 while ($DbRow = $DbResult->fetch_assoc()) 156 156 { 157 157 $Result[$DbRow['Group']]['Items'][] = $DbRow; 158 158 } 159 159 $this->TranslationTree = $Result; 160 return ($Result);160 return $Result; 161 161 } 162 162 } … … 168 168 $Output = '<strong>'.T('Translate groups').':</strong><br /><div id="TranslationMenu">'; 169 169 $DbResult = $this->System->Database->select('Group', '`Id`, `Name`', '1 ORDER BY `Name`'); 170 while ($Group = $DbResult->fetch_assoc())170 while ($Group = $DbResult->fetch_assoc()) 171 171 { 172 172 $Groups[T($Group['Name'])] = $Group; 173 173 } 174 174 ksort($Groups); 175 foreach ($Groups as $Group)175 foreach ($Groups as $Group) 176 176 { 177 177 $Output .= '<div id="menuitem-group'.$Group['Id'].'" onmouseover="show(\'group'.$Group['Id'].'\')" onmouseout="hide(\'group'.$Group['Id'].'\')">'. … … 183 183 ' <a title="Přeložené texty, můžete zde hlasovat, nebo opravovat překlady" href="'. 184 184 $this->System->Link('/TranslationList.php?group='.$Group['Id'].'&state=2&user=0&entry=&text=').'">'.T('Translated').'</a><br />'; 185 if (isset($this->System->User) and $this->System->User->Licence(LICENCE_USER))185 if (isset($this->System->User) and $this->System->User->Licence(LICENCE_USER)) 186 186 { 187 187 $Output .= ' <a title="'.T('Unfinished translations').'" href="'.$this->System->Link('/TranslationList.php?group='.$Group['Id'].'&state=3').'">'.T('Unfinished').'</a><br />'. … … 196 196 } 197 197 $Output .= '</div>'; 198 return ($Output);198 return $Output; 199 199 } 200 200 } -
trunk/Modules/Translation/TranslationList.php
r859 r880 47 47 ); 48 48 foreach ($StateTypes as $index => $StateType) { 49 if ($Filter['State'] == $index) $Selected = ' selected="selected"';49 if ($Filter['State'] == $index) $Selected = ' selected="selected"'; 50 50 else $Selected = ''; 51 51 $Output .= '<option value="'.$index.'"'.$Selected.'>'.$StateType.'</option>'; … … 54 54 55 55 // Translation group 56 if ($GroupId == 0)56 if ($GroupId == 0) 57 57 { 58 58 $Filter['Group'] = GetParameter('group', 0, true, true); 59 if ($Filter['Group'] != 0)59 if ($Filter['Group'] != 0) 60 60 { 61 if (isset($TranslationTree[$Filter['Group']]) == false)61 if (isset($TranslationTree[$Filter['Group']]) == false) 62 62 ErrorMessage('Překladová skupina dle zadaného Id neexistuje.'); 63 63 $Table = $TranslationTree[$Filter['Group']]['TablePrefix']; … … 70 70 71 71 $Output .= '<td><select name="group" style="width: 80px">'; 72 if ($Filter['Group'] == 0) $Selected = ' selected="selected"';72 if ($Filter['Group'] == 0) $Selected = ' selected="selected"'; 73 73 else $Selected = ''; 74 74 $Output .= '<option value="0"'.$Selected.'>'.T('All').'</option>'; 75 75 $DbResult = $this->Database->query('SELECT `Id`,`Name` FROM `Group`'); 76 while ($Group = $DbResult->fetch_assoc())76 while ($Group = $DbResult->fetch_assoc()) 77 77 $Groups[T($Group['Name'])] = $Group; 78 78 ksort($Groups); 79 foreach ($Groups as $Group)80 { 81 if ($Group['Id'] == $Filter['Group']) $Selected = ' selected="selected"';79 foreach ($Groups as $Group) 80 { 81 if ($Group['Id'] == $Filter['Group']) $Selected = ' selected="selected"'; 82 82 else $Selected = ''; 83 83 $Output .= '<option value="'.$Group['Id'].'"'.$Selected.'>'.T($Group['Name']).'</option>'; … … 89 89 else 90 90 $Filter['Version'] = GetParameter('version', 0, true, true); 91 if ($Filter['Version'] != 0)91 if ($Filter['Version'] != 0) 92 92 { 93 93 $DbResult = $this->Database->query('SELECT `Id`, `BuildNumber`,`Version` FROM `ClientVersion` WHERE (`Imported` = 1) AND (`Id` ='.$Filter['Version'].')'); 94 if ($DbResult->num_rows > 0)94 if ($DbResult->num_rows > 0) 95 95 { 96 96 $DbRow = $DbResult->fetch_assoc(); … … 99 99 } 100 100 $Output .= '<td><select name="version">'; 101 if ($Filter['Version'] == 0) $Selected = ' selected="selected"';101 if ($Filter['Version'] == 0) $Selected = ' selected="selected"'; 102 102 else $Selected = ''; 103 103 $Output .= '<option value="0"'.$Selected.'>'.T('All').'</option>'; 104 104 $DbResult = $this->Database->query('SELECT `Id`, `BuildNumber`,`Version` FROM `ClientVersion` WHERE `Imported` = 1 ORDER BY `BuildNumber` DESC'); 105 while ($Version = $DbResult->fetch_assoc())106 { 107 if ($Version['Id'] == $Filter['Version']) $Selected = ' selected="selected"';105 while ($Version = $DbResult->fetch_assoc()) 106 { 107 if ($Version['Id'] == $Filter['Version']) $Selected = ' selected="selected"'; 108 108 else $Selected = ''; 109 109 $Output .= '<option value="'.$Version['Id'].'"'.$Selected.'>'.$Version['Version'].'</option>'; 110 110 } 111 111 $Output .= '</select></td>'; 112 if ($Filter['Version'] != 0) $VersionFilter = ' AND (`VersionStart` <= '.$Filter['BuildNumber'].') AND (`VersionEnd` >= '.$Filter['BuildNumber'].')';112 if ($Filter['Version'] != 0) $VersionFilter = ' AND (`VersionStart` <= '.$Filter['BuildNumber'].') AND (`VersionEnd` >= '.$Filter['BuildNumber'].')'; 113 113 else $VersionFilter = ''; 114 114 //else $Filter['SQL'] .= ' AND '; DISTINCT(Entry) … … 117 117 $Filter['Language'] = GetParameter('lang', 0, true, true); 118 118 $Output .= '<td><select name="lang">'; 119 if ($Filter['Language'] == 0) $Selected = ' selected="selected"';119 if ($Filter['Language'] == 0) $Selected = ' selected="selected"'; 120 120 else $Selected = ''; 121 121 $Output .= '<option value="0"'.$Selected.'>'.T('All').'</option>'; 122 122 $DbResult = $this->Database->query('SELECT `Id`, `Name` FROM `Language` WHERE `Enabled` = 1 ORDER BY `Name`'); 123 while ($Language = $DbResult->fetch_assoc())124 { 125 if ($Language['Id'] == $Filter['Language']) $Selected = ' selected="selected"';123 while ($Language = $DbResult->fetch_assoc()) 124 { 125 if ($Language['Id'] == $Filter['Language']) $Selected = ' selected="selected"'; 126 126 else $Selected = ''; 127 127 $Output .= '<option value="'.$Language['Id'].'"'.$Selected.'>'.T($Language['Name']).'</option>'; … … 130 130 $LanguageFilter = ''; 131 131 $LanguageFilterSub = ''; 132 if ($Filter['Language'] != 0) {132 if ($Filter['Language'] != 0) { 133 133 $LanguageFilter = ' AND (`T`.`Language` = '.$Filter['Language'].')'; 134 134 $LanguageFilterSub = ' AND (`Sub`.`Language` = '.$Filter['Language'].')'; … … 138 138 $Filter['User'] = GetParameter('user', 0, true, true); 139 139 $Output .= '<td><select name="user" style="width: 80px">'; 140 if ($Filter['User'] == 0) $Selected = ' selected="selected"';140 if ($Filter['User'] == 0) $Selected = ' selected="selected"'; 141 141 else $Selected = ''; 142 142 $Output .= '<option value="0"'.$Selected.'>'.T('All').'</option>'; 143 143 $DbResult = $this->Database->query('SELECT `Id`, `Name` FROM `User` ORDER BY `Name`'); 144 while ($User = $DbResult->fetch_assoc())145 { 146 if ($User['Id'] == $Filter['User']) $Selected = ' selected="selected"';144 while ($User = $DbResult->fetch_assoc()) 145 { 146 if ($User['Id'] == $Filter['User']) $Selected = ' selected="selected"'; 147 147 else $Selected = ''; 148 148 $Output .= '<option value="'.$User['Id'].'"'.$Selected.'>'.$User['Name'].'</option>'; 149 149 } 150 150 $Output .= '</select></td>'; 151 if ($Filter['User'] != 0) $UserFilter = ' AND (`User` = '.$Filter['User'].')';151 if ($Filter['User'] != 0) $UserFilter = ' AND (`User` = '.$Filter['User'].')'; 152 152 else $UserFilter = ''; 153 153 … … 155 155 $Filter['Text'] = GetParameter('text', '', false, true); 156 156 $Output .= '<td><input name="text" type="text" style="width: 60px;" value="'.htmlentities($Filter['Text']).'"></td>'; 157 if ($Filter['Text'] != '')157 if ($Filter['Text'] != '') 158 158 { 159 159 $Items = array('(`T`.`ID` LIKE "%'.$Filter['Text'].'%")', '(`T`.`Entry` LIKE "%'.$Filter['Text'].'%")'); 160 if ($Filter['Group'] != 0)161 foreach ($TranslationTree[$Filter['Group']]['Items'] as $GroupItem)162 if ($GroupItem['Visible'] == 1)160 if ($Filter['Group'] != 0) 161 foreach ($TranslationTree[$Filter['Group']]['Items'] as $GroupItem) 162 if ($GroupItem['Visible'] == 1) 163 163 $Items[] = '(`T`.`'.$GroupItem['Column'].'` LIKE "%'.$Filter['Text'].'%")'; 164 164 $Filter['SQL'] .= ' AND ('.implode(' OR ', $Items).')'; … … 168 168 $Filter['Entry'] = GetParameter('entry', '', false, true); 169 169 $Output .= '<td><input name="entry" type="text" style="width: 60px;" value="'.htmlentities($Filter['Entry']).'"></td>'; 170 if ($Filter['Entry'] != '')170 if ($Filter['Entry'] != '') 171 171 { 172 172 $Filter['SQL'] .= ' AND (`Entry` = "'.$Filter['Entry'].'")'; 173 173 } 174 174 175 if ($Filter['Group'] != 0)175 if ($Filter['Group'] != 0) 176 176 { 177 177 $WithoutAlter = ' AND NOT EXISTS(SELECT 1 FROM `'.$Table.'` AS `Sub` WHERE '. … … 179 179 ' AND (`Sub`.`Entry` = `T`.`Entry`) AND (`Sub`.`ID` != `T`.`ID`) AND (`Sub`.`Complete` = 1) AND '. 180 180 '(`Sub`.`VersionStart` = `T`.`VersionStart`) AND (`Sub`.`VersionEnd` = `T`.`VersionEnd`) LIMIT 1 ) '; 181 foreach ($TranslationTree[$Filter['Group']]['Items'] as $GroupItem)182 if ($GroupItem['Visible'] == 1) {181 foreach ($TranslationTree[$Filter['Group']]['Items'] as $GroupItem) 182 if ($GroupItem['Visible'] == 1) { 183 183 $ItemsVar[] = 'LENGTH(`T`.`'.$GroupItem['Column'].'`) - LENGTH( REPLACE( `T`.`'.$GroupItem['Column'].'`, \'$\', \'\' ) ) '. 184 184 ' < ('. … … 188 188 ')'; 189 189 } 190 if ($Filter['State'] == CompletionState::All) {190 if ($Filter['State'] == CompletionState::All) { 191 191 $Filter['SQL'] .= $UserFilter.$VersionFilter; 192 192 } else 193 if ($Filter['State'] == CompletionState::NotTranslated) {193 if ($Filter['State'] == CompletionState::NotTranslated) { 194 194 $Filter['SQL'] .= $VersionFilter.' AND (`T`.`Language` = '.$this->System->Config['OriginalLanguage'].') '. 195 195 'AND NOT EXISTS(SELECT 1 FROM `'.$Table.'` AS `Sub` WHERE '. … … 198 198 '(`Sub`.`VersionStart` = `T`.`VersionStart`) AND (`Sub`.`VersionEnd` = `T`.`VersionEnd`))'; 199 199 } else 200 if ($Filter['State'] == CompletionState::Translated) {200 if ($Filter['State'] == CompletionState::Translated) { 201 201 $Filter['SQL'] .= $UserFilter.$LanguageFilter.$VersionFilter.' AND (`T`.`Complete` = 1)'; 202 202 } else 203 if ($Filter['State'] == CompletionState::NotFinished) {203 if ($Filter['State'] == CompletionState::NotFinished) { 204 204 $Filter['SQL'] .= $UserFilter.$LanguageFilter.$VersionFilter.' AND (`T`.`Language` != '.$this->System->Config['OriginalLanguage']. 205 205 ') AND (`T`.`Complete` = 0)'; 206 206 } else 207 if ($Filter['State'] == CompletionState::Original) {207 if ($Filter['State'] == CompletionState::Original) { 208 208 $Filter['SQL'] .= $VersionFilter.' AND (`T`.`Language` = '.$this->System->Config['OriginalLanguage'].')'; 209 209 } else 210 if ($Filter['State'] == CompletionState::NotFinishedNotTranslated) {210 if ($Filter['State'] == CompletionState::NotFinishedNotTranslated) { 211 211 $Filter['SQL'] .= $UserFilter.$VersionFilter.$WithoutAlter. 212 212 ' AND (`T`.`Language` != '.$this->System->Config['OriginalLanguage']. 213 213 ') AND (`T`.`Complete` = 0)'; 214 214 } else 215 if ($Filter['State'] == CompletionState::Missing1) {215 if ($Filter['State'] == CompletionState::Missing1) { 216 216 $Filter['SQL'] .= $UserFilter.$VersionFilter.' AND (`T`.`Complete` = 1) AND `T`.`Language` != '.$this->System->Config['OriginalLanguage']; 217 217 $Filter['SQL'] .= ' AND ('.implode(' OR ', $ItemsVar).') '; 218 218 } else 219 if ($Filter['State'] == CompletionState::Missing2) {219 if ($Filter['State'] == CompletionState::Missing2) { 220 220 $Filter['SQL'] .= $UserFilter.$VersionFilter.' AND (`T`.`Complete` = 1) AND `T`.`Language` != '.$this->System->Config['OriginalLanguage']; 221 221 $Filter['SQL'] .= ' '. $WithoutAlter; … … 226 226 /* 227 227 // Ownership 228 if (array_key_exists('owner', $_GET) and is_numeric($_GET['owner'])) $Filter['Owner'] = $_GET['owner'];228 if (array_key_exists('owner', $_GET) and is_numeric($_GET['owner'])) $Filter['Owner'] = $_GET['owner']; 229 229 else $Filter['Owner'] = 0; 230 230 $Output .= ' <td><select name="owner">'; 231 if ($Filter['Owner'] == 0) $Selected = ' selected="selected"';231 if ($Filter['Owner'] == 0) $Selected = ' selected="selected"'; 232 232 else $Selected = ''; 233 233 $Output .= '<option value="0"'.$Selected.'>Všech</option>'; 234 if ($Filter['Owner'] == 1) $Selected = ' selected="selected"';234 if ($Filter['Owner'] == 1) $Selected = ' selected="selected"'; 235 235 else $Selected = ''; 236 236 $Output .= '<option value="1"'.$Selected.'>Překladatelův tým</option>'; 237 if ($Filter['Owner'] == 2) $Selected = ' selected="selected"';237 if ($Filter['Owner'] == 2) $Selected = ' selected="selected"'; 238 238 else $Selected = ''; 239 239 $Output .= '<option value="2"'.$Selected.'>Překladatele</option>'; 240 240 $Output .= '</select></td>'; 241 if (($Filter['Owner'] == 2) AND ($Filter['User'] != 0)) $Filter['SQL'] .= ' AND (`User` = '.$Filter['User'].')';241 if (($Filter['Owner'] == 2) AND ($Filter['User'] != 0)) $Filter['SQL'] .= ' AND (`User` = '.$Filter['User'].')'; 242 242 */ 243 243 … … 246 246 $Output .= '</form><br/>'; 247 247 $Filter['Output'] = $Output; 248 return ($Filter);248 return $Filter; 249 249 } 250 250 … … 289 289 290 290 $DbResult = $this->Database->query($Query.' '.$Order['SQL'].' '.$PageList['SQLLimit']); 291 while ($Line = $DbResult->fetch_assoc())291 while ($Line = $DbResult->fetch_assoc()) 292 292 { 293 293 $Output .= '<tr><td><a href="'.$this->System->Link('/form.php?group='.$Filter['Group'].'&ID='.$Line['ID']).'">'.$Line['ID'].'</a></td>'. … … 305 305 $Output .= '</table>'. 306 306 $PageList['Output']; 307 return ($Output);307 return $Output; 308 308 } 309 309 … … 316 316 $Output .= '<table class="BaseTable"><tr><th>'.T('Group').'</th><th>'.T('Count').'</th></tr>'; 317 317 $Total = 0; 318 foreach ($TranslationTree as $Group)319 if ($Group['TablePrefix'] != '')318 foreach ($TranslationTree as $Group) 319 if ($Group['TablePrefix'] != '') 320 320 { 321 321 $Filter = $this->ShowFilter($Group['Id']); … … 328 328 $Output .= '<tr><td><strong>'.T('Total').'</strong></td><td><strong>'.$Total.'</strong></td></tr>'. 329 329 '</table>'; 330 return ($Output);330 return $Output; 331 331 } 332 332 … … 336 336 337 337 $GroupId = GetParameter('group', 0, true); 338 if ($GroupId == 0) $Output = ShowMessage('Skupina nenalezena', MESSAGE_CRITICAL);338 if ($GroupId == 0) $Output = ShowMessage('Skupina nenalezena', MESSAGE_CRITICAL); 339 339 else { 340 340 $Table = $TranslationTree[$GroupId]['TablePrefix']; … … 351 351 '<td>'.T('Texts marked as unfinished').'</td></tr>'; 352 352 353 if ($this->System->User->Licence(LICENCE_USER))353 if ($this->System->User->Licence(LICENCE_USER)) 354 354 { 355 355 $Output .= '<tr><td><a title="'.T('Unfinished texts').'" href="?group='.$GroupId.'&state=3&user='.$this->System->User->Id.'">'.T('My unfinished').'</a></td> … … 373 373 $Output .= '</table>'; 374 374 } 375 return ($Output);375 return $Output; 376 376 } 377 377 … … 380 380 $this->Title = T('Translation groups'); 381 381 $Action = GetParameter('action', ''); 382 if ($Action == 'filter') $Output = $this->ShowMenu();382 if ($Action == 'filter') $Output = $this->ShowMenu(); 383 383 else 384 384 { 385 385 $Filter = $this->ShowFilter(); 386 if ($Filter['Group'] > 0) $Output = $this->ShowTranslationList($Filter);386 if ($Filter['Group'] > 0) $Output = $this->ShowTranslationList($Filter); 387 387 else $Output = $this->ShowGroupList($Filter); 388 388 } 389 return ($Output);389 return $Output; 390 390 } 391 391 } … … 409 409 array('Name' => 'LastVersion', 'Title' => T('Version of last import')), 410 410 ); 411 if ($this->System->User->Licence(LICENCE_ADMIN))411 if ($this->System->User->Licence(LICENCE_ADMIN)) 412 412 $TableColumns[] = array('Name' => '', 'Title' => T('Actions')); 413 413 … … 416 416 417 417 $DbResult = $this->Database->query('SELECT * FROM `Group`'.$Order['SQL'].$PageList['SQLLimit']); 418 while ($Group = $DbResult->fetch_assoc())418 while ($Group = $DbResult->fetch_assoc()) 419 419 { 420 420 $Output .= '<tr><td><a href="'.$this->System->Link('/TranslationList.php?group='.$Group['Id'].'&action=filter').'">'.T($Group['Name']).'</a></td>'. 421 421 '<td>'.$Group['SourceType'].'</td><td>'; 422 if ($Group['MangosTable'] != '') $Output .= $Group['MangosTable'].'.sql ';423 if ($Group['DBCFileName'] != '') $Output .= $Group['DBCFileName'].'.dbc ';424 if ($Group['LuaFileName'] != '') $Output .= $Group['LuaFileName'].'.lua ';422 if ($Group['MangosTable'] != '') $Output .= $Group['MangosTable'].'.sql '; 423 if ($Group['DBCFileName'] != '') $Output .= $Group['DBCFileName'].'.dbc '; 424 if ($Group['LuaFileName'] != '') $Output .= $Group['LuaFileName'].'.lua '; 425 425 $Output .= '</td>'; 426 if ($this->System->User->Licence(LICENCE_ADMIN))426 if ($this->System->User->Licence(LICENCE_ADMIN)) 427 427 $Output .= '<td><a title="Změny po posledním importu u vybrané překladové skupiny" href="'.$this->System->Link('/log/?group='. 428 428 $Group['Id'].'&type=11').'">'.HumanDate($Group['LastImport']).'</a></td>'; … … 430 430 $Output .= '<td><a href="'.$this->System->Link('/client-version/?action=item&id='. 431 431 GetVersionWOWId($Group['LastVersion'])).'">'.GetVersionWOW($Group['LastVersion']).'</a></td>'; 432 if ($this->System->User->Licence(LICENCE_ADMIN))432 if ($this->System->User->Licence(LICENCE_ADMIN)) 433 433 $Output .= '<td><a href="?action=groupdelete&id='.$Group['Id'].'">'.T('Remove').'</a></td>'; 434 434 $Output .= '</tr>'; … … 436 436 $Output .= '</table>'. 437 437 '<br /><a title="'.T('Changelog of changes after import').'" href="'.$this->System->Link('/log/?type=11').'">'.T('Changelog of text modification during import').'</a><br/>'; 438 if ($this->System->User->Licence(LICENCE_ADMIN)) $Output .= '<a href="?action=groupadd">'.T('Add translation group').'</a>';439 return ($Output);438 if ($this->System->User->Licence(LICENCE_ADMIN)) $Output .= '<a href="?action=groupadd">'.T('Add translation group').'</a>'; 439 return $Output; 440 440 } 441 441 442 442 function ShowGroupAdd() 443 443 { 444 if ($this->System->User->Licence(LICENCE_ADMIN))444 if ($this->System->User->Licence(LICENCE_ADMIN)) 445 445 { 446 446 $Output = '<h3>Vložení nové překladové skupiny</h3>'. … … 452 452 '</table></form>'; 453 453 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 454 return ($Output);454 return $Output; 455 455 } 456 456 457 457 function ShowGroupAddFinish() 458 458 { 459 if ($this->System->User->Licence(LICENCE_ADMIN))459 if ($this->System->User->Licence(LICENCE_ADMIN)) 460 460 { 461 461 $TableName = 'Text'.$_POST['TablePrefix']; 462 462 $DbResult = $this->System->Database->select('Group', 'Id', 'TablePrefix="'.$TableName.'"'); 463 if ($DbResult->num_rows == 0)463 if ($DbResult->num_rows == 0) 464 464 { 465 465 … … 500 500 $Output .= $this->ShowList(); 501 501 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 502 return ($Output);502 return $Output; 503 503 } 504 504 505 505 function ShowGroupDelete() 506 506 { 507 if ($this->System->User->Licence(LICENCE_ADMIN))507 if ($this->System->User->Licence(LICENCE_ADMIN)) 508 508 { 509 509 $DbResult = $this->System->Database->select('Group', '*', '`Id`='.$_GET['id']); 510 if ($DbResult->num_rows == 1)510 if ($DbResult->num_rows == 1) 511 511 { 512 512 $Group = $DbResult->fetch_assoc(); … … 518 518 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 519 519 $Output .= $this->ShowList(); 520 return ($Output);520 return $Output; 521 521 } 522 522 … … 525 525 $this->Title = T('Translation groups'); 526 526 $Action = GetParameter('action', ''); 527 if ($Action == 'groupadd') $Output = $this->ShowGroupAdd();528 else if ($Action == 'groupdelete') $Output = $this->ShowGroupDelete();529 else if ($Action == 'groupaddfinish') $Output = $this->ShowGroupAddFinish();527 if ($Action == 'groupadd') $Output = $this->ShowGroupAdd(); 528 else if ($Action == 'groupdelete') $Output = $this->ShowGroupDelete(); 529 else if ($Action == 'groupaddfinish') $Output = $this->ShowGroupAddFinish(); 530 530 else $Output = $this->ShowList(); 531 return ($Output);531 return $Output; 532 532 } 533 533 } -
trunk/Modules/Translation/UserLevel.php
r859 r880 11 11 $Diakrit = array("á","č","ď","é","ě","í","ľ","ň","ó","ř","š","ť","ú", 12 12 "ů","ý","ž","Á","Č","Ď","É","Ě","Í","Ľ","Ň","Ó","Ř","Š","Ť","Ú","Ů","Ý","Ž"); 13 for ($i = 0; $i < count($Diakrit); $i = $i + 1)13 for ($i = 0; $i < count($Diakrit); $i = $i + 1) 14 14 { 15 if (strpos($Word, $Diakrit[$i]) <> false)15 if (strpos($Word, $Diakrit[$i]) <> false) 16 16 $Result = true; 17 17 } 18 return ($Result);18 return $Result; 19 19 } 20 20 … … 26 26 27 27 $xp = 0; 28 foreach ($TranslationTree as $Group)28 foreach ($TranslationTree as $Group) 29 29 { 30 if ($Group['TablePrefix'] != '')30 if ($Group['TablePrefix'] != '') 31 31 { 32 32 $GroupBy = 'GROUP BY '; 33 33 $TakeColumns = ''; 34 foreach ($TranslationTree[$Group['Id']]['Items'] as $Index => $TextItem)34 foreach ($TranslationTree[$Group['Id']]['Items'] as $Index => $TextItem) 35 35 { 36 36 $GroupBy .= '`T`.`'.$TextItem['Column'].'`, '; … … 42 42 'LEFT JOIN `'.$Group['TablePrefix'].'` AS `T2` ON `T2`.`ID` = `T`.`Take` '. 43 43 'WHERE (`T`.`User` = '.$UserId.') AND (`T`.`Complete` = 1) AND (`T`.`Take` IS NOT NULL) '.$GroupBy); 44 while ($Line = $IDtran->fetch_array())44 while ($Line = $IDtran->fetch_array()) 45 45 { 46 46 $xp_translation = 0; 47 47 $translated = true; 48 foreach ($TranslationTree[$Group['Id']]['Items'] as $Index => $TextItem)48 foreach ($TranslationTree[$Group['Id']]['Items'] as $Index => $TextItem) 49 49 { 50 if (($Line[$TextItem['Column']] <> $Line[$TextItem['Column'].'_Take']) and50 if (($Line[$TextItem['Column']] <> $Line[$TextItem['Column'].'_Take']) and 51 51 (strlen($Line[$TextItem['Column']]) > (strlen($Line[$TextItem['Column'].'_Take']) * 0.5))) 52 52 { 53 53 $TextArr = explode(' ', $Line[$TextItem['Column']]); 54 foreach ($TextArr as $Word)54 foreach ($TextArr as $Word) 55 55 { 56 if (CheckDiakrit($Word)) $indikator = $from_diakrit;56 if (CheckDiakrit($Word)) $indikator = $from_diakrit; 57 57 else $indikator = 1; 58 58 $xp_translation = $xp_translation + ($indikator * $xp_from_word); … … 65 65 } 66 66 } 67 if ($translated) $xp = $xp + $xp_translation; // XP addition for entire translation if complete translated67 if ($translated) $xp = $xp + $xp_translation; // XP addition for entire translation if complete translated 68 68 } 69 69 } 70 70 } 71 return ($xp);71 return $xp; 72 72 } 73 73 … … 79 79 // Main code for users 80 80 $DbResult = $System->Database->query('SELECT `ID`, `Name` FROM `User` WHERE `Id` = '.$UserId); 81 if ($DbResult->num_rows > 0)81 if ($DbResult->num_rows > 0) 82 82 { 83 while ($LineUser = $DbResult->fetch_array())83 while ($LineUser = $DbResult->fetch_array()) 84 84 { 85 85 // Build TranslatedCount query 86 86 $TranslatedCount = '('; 87 if (count($TranslationTree) > 0)87 if (count($TranslationTree) > 0) 88 88 { 89 foreach ($TranslationTree as $Group)90 if ($Group['TablePrefix'] != '')89 foreach ($TranslationTree as $Group) 90 if ($Group['TablePrefix'] != '') 91 91 { 92 92 $Count = '(SELECT COUNT(*) FROM `'.$Group['TablePrefix'].'` WHERE (`Complete` = 1) AND (`Language` <> '.
Note:
See TracChangeset
for help on using the changeset viewer.