Changeset 745
- Timestamp:
- Jan 10, 2014, 6:02:59 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Translation/Form.php
r743 r745 49 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 52 53 //search for same text with other entry 54 foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 55 if($TextItem['Visible'] == 1) 56 if (($LineAJ[$TextItem['Column']] <> '') and 57 ($LineAJ[$TextItem['Column']] == $Line[$TextItem['Column']]) and 58 (strlen($LineAJ[$TextItem['Column']]) < 20) 59 ) 60 { 61 $sql = 'SELECT '.$Columns.' Tran.`Entry` FROM `'.$Table.'` as Tran'; 62 $join = ' JOIN `'.$Table.'` as `Orig` ON `Orig`.`Language` = 0 AND `Tran`.`Entry` = `Orig`.`Entry` AND `Tran`.`VersionEnd` = `Orig`.`VersionEnd` '; 63 $where = ' WHERE '.'( `Tran`.'.$Language.' ) AND '.' `Orig`.`'.$TextItem['Column'].'` = "'.$LineAJ[$TextItem['Column']].'" ORDER BY `Tran`.`ModifyTime` DESC LIMIT 1'; 64 $DbResult = $this->Database->query($sql.$join.$where); 65 while ($LineSearch = $DbResult->fetch_assoc()) { 66 $Line[$TextItem['Column']] = $LineSearch[$TextItem['Column']]; 67 } 68 } 51 69 52 70 53 $sql = 'SELECT '.$Columns.' Tran.`Entry` FROM `'.$Table.'` as Tran'; … … 85 68 } 86 69 } 87 88 70 89 71 } else { … … 248 230 } 249 231 $Output .= '</table></div>'; 250 if($this->System->User->Licence(LICENCE_USER)) $Output .= '</form>'; 232 if($this->System->User->Licence(LICENCE_USER)) { 233 $Output .= '</form>'; 234 235 $Output .= '<table class="BaseTable">'. 236 '<tr><th>Translátor:</th><th>Nepřeložené</th><th>Přeložené</th>'; 237 foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 238 if($TextItem['Visible'] == 1) 239 if ($LineAJ[$TextItem['Column']] <> '') 240 $Output .= '<tr><td>'.$TextItem['Column'].'</td><td>'.$LineAJ[$TextItem['Column']].'</td><td>'.GetTranslateGoogle($LineAJ[$TextItem['Column']]).'</td></tr>'; 241 242 243 $Output .= '</table>'; 244 } 251 245 } 252 246 } -
trunk/includes/Version.php
r744 r745 6 6 // and system will need database update. 7 7 8 $Revision = 74 4; // Subversion revision8 $Revision = 745; // Subversion revision 9 9 $DatabaseRevision = 732; // Database structure revision 10 10 $ReleaseTime = '2014-01-08'; -
trunk/includes/global.php
r743 r745 140 140 $month = $month - $year * 12; 141 141 return($year.'r '.$month.'m '.$Days.'d'); 142 } 143 144 145 function GetTranslateGoogle($text) { 146 147 // $text = 'Balthule\'s letter is dire. This Cult of the Dark Strand is a thorn in my side that must be removed. I have been dealing with some of the Dark Strand scum northeast of here at Ordil\'Aran. One of their number possesses a soul gem that I believe holds the secret to the cult\'s power.$b$bBring it to me, and I will be able to decipher the secrets held within.'; 148 // $text = htmlspecialchars($text); 149 $text = urlencode($text); 150 // $text = str_replace('&','',$text); 151 // $text = str_replace(' ','%20',$text); 152 // $text = str_replace('$B','$B%20',$text); 153 $url = 'http://translate.google.cz/?sl=en&tl=cs&text='.$text; 154 155 156 error_reporting(E_ALL ^ E_WARNING); 157 if (($handle = @fopen($url, "r")) === FALSE) return false; 158 159 $data = stream_get_contents($handle); 160 $data = substr($data, strpos($data,'result_box')); 161 $data = substr($data, strpos($data,'>')+1); 162 $data = substr($data, 0, strpos($data,'</div>')); 163 while (strpos($data,'>') !== false and strpos($data,'<') !== false) 164 { 165 $partbefore = substr($data, 0, strpos($data,'<')); 166 // echo $partbefore; 167 $partafter = substr($data, strpos($data,'>')+1); 168 // echo $partafter; 169 $data = $partbefore.' '.$partafter; 170 } 171 172 $data = str_replace('$ ','$',$data); 173 $data = str_replace('| ','|',$data); 174 175 return $data; 142 176 } 143 177 … … 583 617 584 618 //find word only if is 3 characters and more, and if starts by upper char, and search only once 585 if (( strlen($ArrStr[$i]) > 3)and ((!$FirstBig) or (ctype_upper(substr($ArrStr[$i],0,1)))) and (array_search($ArrStr[$i], $ArrStr) == $i)) {619 if (((strlen($ArrStr[$i]) > 3) or (strlen($Text) < 10)) and ((!$FirstBig) or (ctype_upper(substr($ArrStr[$i],0,1)))) and (array_search($ArrStr[$i], $ArrStr) == $i)) { 586 620 $where .= '(`O`.`'.$Column.'` LIKE "'.addslashes($ArrStr[$i]).'%") OR '; 587 621 $SqlOK = true; … … 601 635 if ($SqlOK) { 602 636 $orderby = ' ORDER BY LENGTH(Orig) DESC '; 637 // echo $sqlall. $orderby; 603 638 $DbResult = $System->Database->query($sqlall.$orderby); 604 639 // echo ($sql.'|'.$where.'|'.$groupby);
Note:
See TracChangeset
for help on using the changeset viewer.