Changeset 819 for trunk/includes
- Timestamp:
- Feb 23, 2015, 12:56:12 AM (10 years ago)
- Location:
- trunk/includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/Version.php
r818 r819 6 6 // and system will need database update. 7 7 8 $Revision = 81 8; // Subversion revision8 $Revision = 819; // Subversion revision 9 9 $DatabaseRevision = 811; // Database structure revision 10 10 $ReleaseTime = '2015-02-22'; -
trunk/includes/global.php
r816 r819 11 11 include_once(dirname(__FILE__).'/AppModule.php'); 12 12 include_once(dirname(__FILE__).'/Locale.php'); 13 include_once(dirname(__FILE__).'/UTF8.php'); 13 14 require_once(dirname(__FILE__).'/../HTML/BBCodeParser2.php'); 14 15 … … 145 146 } 146 147 147 148 function GetTranslateGoogle($text,$withouttitle = false){148 function GetTranslateGoogle($text, $withouttitle = false) 149 { 149 150 global $System; 151 150 152 // $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.'; 151 153 // $text = htmlspecialchars($text); 152 154 153 $text = str_replace('$B','$B ', $text);155 $text = str_replace('$B','$B ', $text); 154 156 $text = urlencode($text); 155 157 // $text = strtolower($text); 156 158 // $text = str_replace('&','',$text); 157 159 // $text = str_replace(' ','%20',$text); 158 if ($System->User->Language == 2)159 $lang = 'sk';160 else $lang = 'cs';160 $DbResult = $System->Database->select('Language', 'Code', 'Id='.$System->User->Language); 161 $DbRow = $DbResult->fetch_assoc(); 162 $lang = $DbRow['Code']; 161 163 $url = 'http://translate.google.cz/?sl=en&tl='.$lang.'&text='.$text; 162 164 163 164 165 error_reporting(E_ALL ^ E_WARNING); 165 if (($handle = @fopen($url, "r")) === FALSE) return false;166 if (($handle = @fopen($url, "r")) === FALSE) return(false); 166 167 167 168 $data = stream_get_contents($handle); 168 $data = substr($data, strpos($data, 'result_box'));169 $data = substr($data, strpos($data, '>')+1);170 $data = substr($data, 0, strpos($data, '</div>'));169 $data = substr($data, strpos($data, 'result_box')); 170 $data = substr($data, strpos($data, '>') + 1); 171 $data = substr($data, 0, strpos($data, '</div>')); 171 172 172 173 if ($withouttitle) 173 while ((strpos($data, '>') !== false and strpos($data,'<') !== false) and (strpos($data,'>') > strpos($data,'<')))174 { 175 $partbefore = substr($data, 0, strpos($data, '<'));174 while ((strpos($data, '>') !== false and (strpos($data, '<') !== false)) and (strpos($data, '>') > strpos($data, '<'))) 175 { 176 $partbefore = substr($data, 0, strpos($data, '<')); 176 177 // echo $partbefore; 177 $partafter = substr($data, strpos($data, '>')+1);178 $partafter = substr($data, strpos($data, '>') + 1); 178 179 // echo $partafter; 179 180 $data = $partbefore.' '.$partafter; 180 181 } 181 182 182 $data = utf8_encode($data); 183 184 $data = str_replace('$ ','$',$data); 185 $data = str_replace('$b $b','$b$b',$data); 186 $data = str_replace('| ','|',$data); 187 188 return $data; 183 $Encoding = new Encoding(); 184 $data = $Encoding->ToUTF8($data); 185 //$data = utf8_encode($data); 186 187 $data = str_replace('$ ', '$',$data); 188 $data = str_replace('$b $b', '$b$b', $data); 189 $data = str_replace('| ', '|', $data); 190 191 return($data); 189 192 } 190 193
Note:
See TracChangeset
for help on using the changeset viewer.