Changeset 109
- Timestamp:
- Sep 14, 2008, 9:10:49 PM (16 years ago)
- Location:
- devel/www
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/www/aktuality/import_zdechov_cz_aktuality.php
r108 r109 10 10 $Category = 12; 11 11 12 $Content = addslashes( to_utf8(file_get_contents($SourceURL), 'win1250'));12 $Content = addslashes(ToUTF8(file_get_contents($SourceURL), 'win1250')); 13 13 while(strpos($Content, $StartText) !== false) 14 14 { -
devel/www/aktuality/import_zdechov_cz_zapisy.php
r108 r109 9 9 $Category = 11; 10 10 11 $Content = addslashes( to_utf8(file_get_contents($SourceURL), 'win1250'));11 $Content = addslashes(ToUTF8(file_get_contents($SourceURL), 'win1250')); 12 12 while(strpos($Content, $StartText) !== false) 13 13 { -
devel/www/code.php
r98 r109 31 31 */ 32 32 33 $iso2_utf8 = array( 33 $CharTable = array( 34 'iso2' => array( 34 35 0x80=>"\xc2\x80", 35 36 0x81=>"\xc2\x81", … … 160 161 0xFE=>"\xc5\xa3", 161 162 0xFF=>"\xcb\x99" 162 ); 163 164 $win1250_utf8 = array( 163 ), 164 'win1250' => array( 165 165 0x80=>"\xc2\x80", 166 166 0x81=>"\xc2\x81", 167 0x82=>"\x 140\x9a",167 0x82=>"\xe2\x80\x9a", 168 168 0x83=>"\xc2\x83", 169 0x84=>"\x 140\x9e",170 0x85=>"\x 140\xa6",171 0x86=>"\x 140\xa0",172 0x87=>"\x 140\xa1",169 0x84=>"\xe2\x80\x9e", 170 0x85=>"\xe2\x80\xa6", 171 0x86=>"\xe2\x80\xa0", 172 0x87=>"\xe2\x80\xa1", 173 173 0x88=>"\xc2\x88", 174 0x89=>"\x 140\xb0",174 0x89=>"\xe2\x80\xb0", 175 175 0x8a=>"\xc5\xa0", 176 0x8b=>"\x 140\xb9",176 0x8b=>"\xe2\x80\xb9", 177 177 0x8c=>"\xc5\x9a", 178 178 0x8d=>"\xc5\xa4", … … 180 180 0x8f=>"\xc5\xb9", 181 181 0x90=>"\xc2\x90", 182 0x91=>"\x 140\x98",183 0x92=>"\x 140\x99",184 0x93=>"\x 140\x9c",185 0x94=>"\x 140\x9d",186 0x95=>"\x 140\xa2",187 0x96=>"\x 140\x93",188 0x97=>"\x 140\x94",189 0x98=>"\x c2\x98",190 0x99=>"\x 144\xa2",182 0x91=>"\xe2\x80\x98", 183 0x92=>"\xe2\x80\x99", 184 0x93=>"\xe2\x80\x9c", 185 0x94=>"\xe2\x80\x9d", 186 0x95=>"\xe2\x80\xa2", 187 0x96=>"\xe2\x80\x93", 188 0x97=>"\xe2\x80\x94", 189 0x98=>"\xe2\x80\x98", 190 0x99=>"\xe2\x84\xa2", 191 191 0x9a=>"\xc5\xa1", 192 0x9b=>"\x 140\xba",192 0x9b=>"\xe2\x80\xba", 193 193 0x9c=>"\xc5\x9b", 194 194 0x9d=>"\xc5\xa5", … … 291 291 0xfe=>"\xc5\xa3", 292 292 0xff=>"\xcb\x99" 293 ); 294 295 $iso1_utf8 = array( 293 ), 294 'iso1' => array( 296 295 0xA0=>"\xc2\xa0", 297 296 0xA1=>"\xc2\xa1", … … 389 388 0xFD=>"\xc3\xbd", 390 389 0xFE=>"\xc3\xbe" 391 ); 392 393 $win1257_utf8 = array( 394 0x80=>"\x142\xac", 390 ), 391 'win1257' => array( 392 0x80=>"\xe2\x82\xac", 395 393 0x81=>"\xc0\x4", 396 0x82=>"\x 140\x9a",394 0x82=>"\xe2\x80\x9a", 397 395 0x83=>"\xc0\x4", 398 0x84=>"\x 140\x9e",399 0x85=>"\x 140\xa6",400 0x86=>"\x 140\xa0",401 0x87=>"\x 140\xa1",396 0x84=>"\xe2\x80\x9e", 397 0x85=>"\xe2\x80\xa6", 398 0x86=>"\xe2\x80\xa0", 399 0x87=>"\xe2\x80\xa1", 402 400 0x88=>"\xc0\x4", 403 0x89=>"\x 140\xb0",401 0x89=>"\xe2\x80\xb0", 404 402 0x8A=>"\xc0\x4", 405 0x8B=>"\x 140\xb9",403 0x8B=>"\xe2\x80\xb9", 406 404 0x8C=>"\xc0\x4", 407 405 0x8D=>"\xc2\xa8", … … 409 407 0x8F=>"\xc2\xb8", 410 408 0x90=>"\xc0\x4", 411 0x91=>"\x 140\x98",412 0x92=>"\x 140\x99",413 0x93=>"\x 140\x9c",414 0x94=>"\x 140\x9d",415 0x95=>"\x 140\xa2",416 0x96=>"\x 140\x93",417 0x97=>"\x 140\x94",409 0x91=>"\xe2\x80\x98", 410 0x92=>"\xe2\x80\x99", 411 0x93=>"\xe2\x80\x9c", 412 0x94=>"\xe2\x80\x9d", 413 0x95=>"\xe2\x80\xa2", 414 0x96=>"\xe2\x80\x93", 415 0x97=>"\xe2\x80\x94", 418 416 0x98=>"\xc0\x4", 419 0x99=>"\x 144\xa2",417 0x99=>"\xe2\x84\xa2", 420 418 0x9A=>"\xc0\x4", 421 0x9B=>"\x 140\xba",419 0x9B=>"\xe2\x80\xba", 422 420 0x9C=>"\xc0\x4", 423 421 0x9D=>"\xc2\xaf", … … 520 518 0xFE=>"\xc5\xbe", 521 519 0xFF=>"\xcb\x99" 520 ), 522 521 ); 523 522 524 /* 525 function to convert to UTF-8 526 because characters numbered 0-127 are standard ASCII characters and are same in Unicode, 527 we have to recode only higher characters 528 function pass through the string and when it finds such character, it is replaced with 529 UTF-8 two byte representation 530 */ 531 function to_utf8($string,$charset="iso2") 523 524 function ToUTF8($String, $Charset = 'iso2') 532 525 { 533 eval("global \$".$charset."_utf8;");534 eval("\$coding=\$".$charset."_utf8;"); 535 536 for ($i = 0; $i < strlen($string); $i++)526 global $CharTable; 527 528 $Result = ''; 529 for($I = 0; $I < strlen($String); $I++) 537 530 { 538 if(ord($string[$i]) > 127) 531 if(ord($String[$I]) < 128) $Result .= $String[$I]; 532 else if(ord($String[$I]) > 127) 539 533 { 540 $ string = substr($string, 0, $i).$coding[ord($string[$i])].substr($string, ++$i);534 $Result .= $CharTable[$Charset][ord($String[$I])]; 541 535 } 542 536 } 543 return($ string);537 return($Result); 544 538 } 545 539 546 /* 547 reverse function to convert from UTF-8 548 and again it pass through the string and when the two following bytes correspond to 549 two byte combination given in translation array, these two characters are replaced with 550 one character from given coding 551 it takes the key returned by array_search() and since the key is the number of specific 552 character, we can use chr() 553 */ 554 function from_utf8($string,$charset="iso2") 540 function FromUTF8($String, $Charset = 'iso2') 555 541 { 556 eval("global \$".$charset."_utf8;"); 557 eval("\$coding=\$".$charset."_utf8;"); 558 559 for($i = 0; $i < strlen($string) - 1; $i++) 542 global $CharTable; 543 544 $Result = ''; 545 $UTFPrefix = ''; 546 for($I = 0; $I < strlen($String); $I++) 560 547 { 561 if($code = array_search($string[$i].$string[($i + 1)], $coding)) 562 $string = substr($string, 0, $i).chr($code).substr($string, $i + 2); 548 if(ord($String{$I}) & 0x80) // UTF control character 549 { 550 if(ord($String{$I}) & 0x40) // First 551 { 552 if($UTFPrefix != '') $Result .= chr(array_search($UTFPrefix, $CharTable[$Charset])); 553 $UTFPrefix = $String{$I}; 554 } 555 else $UTFPrefix .= $String{$I}; // Next 556 } else 557 { 558 if($UTFPrefix != '') $Result .= chr(array_search($UTFPrefix, $CharTable[$Charset])); 559 $UTFPrefix = ''; 560 $Result .= $String{$I}; 561 } 563 562 } 564 return $string;563 return($Result); 565 564 } 565 566 566 ?> -
devel/www/finance/bills.php
r107 r109 196 196 function HtmlToPdf($HtmlCode) 197 197 { 198 $Output = shell_exec('echo "'.addslashes( from_utf8($HtmlCode)).'"|htmldoc --no-numbered --webpage --charset 8859-2 -t pdf -');198 $Output = shell_exec('echo "'.addslashes(FromUTF8($HtmlCode)).'"|htmldoc --no-numbered --webpage --charset 8859-2 -t pdf -'); 199 199 return($Output); 200 200 } -
devel/www/user.php
r107 r109 94 94 $UserId = $this->Database->insert_id; 95 95 96 $Subject = from_utf8('Registrace nového účtu', 'iso2');96 $Subject = FromUTF8('Registrace nového účtu', 'iso2'); 97 97 $Message = 'Provedli jste registraci nového účtu na serveru <a href="http://'.$Config['Web']['Host'].$Config['Web']['RootFolder'].'">http://'.$Config['Web']['Host'].$Config['Web']['RootFolder']."</a>.<br>\nPokud jste tak neučinili, měli by jste tento email ignorovat.<br><br>\n\nVáš účet je: ".$Nick."\n<br>Pro dokončení registrace klikněte na ".'<a href="http://'.$Config['Web']['Host'].$Config['Web']['RootFolder'].'/?Action=UserRegisterConfirm&User='.$UserId.'&H='.sha1($Password).'">tento odkaz</a>.'."\n<br> \n\n<br><br>Na tento email neodpovídejte."; 98 $AdditionalHeaders = "To: ".$Nick." <".$Email.">\n"."From: ". from_utf8($Config['Web']['Title'], 'iso2')." <noreplay@zdechov.net>\n"."MIME-Version: 1.0\n"."Content-type: text/html; charset=utf-8";98 $AdditionalHeaders = "To: ".$Nick." <".$Email.">\n"."From: ".FromUTF8($Config['Web']['Title'], 'iso2')." <noreplay@zdechov.net>\n"."MIME-Version: 1.0\n"."Content-type: text/html; charset=utf-8"; 99 99 mail($Email, $Subject, $Message, $AdditionalHeaders); 100 100 $Result = USER_REGISTRATED; … … 234 234 $Subject = 'Obnova hesla'; 235 235 $Message = 'Požádali jste o zaslání nového hesla na serveru <a href="http://'.$Config['Web']['Host'].$Config['Web']['RootFolder'].'">http://'.$Config['Web']['Host'].$Config['Web']['RootFolder']."</a>.<br>\nPokud jste tak neučinili, měli by jste tento email ignorovat.<br><br>\n\nVaše nové heslo k účtu ".$Row['Name']." je: ".$NewPassword."\n<br>Pro aktivaci tohoto hesla klikněte na ".'<a href="http://'.$Config['Web']['Host'].$Config['Web']['RootFolder'].'/?Action=PasswordRecoveryConfirm&User='.$Row['Id'].'&H='.$Row['Password'].'&P='.$NewPassword.'">tento odkaz</a>.'."\n<br> Po přihlášení si prosím změňte heslo na nové.\n\n<br><br>Na tento email neodpovídejte."; 236 $AdditionalHeaders = "To: ".$Row['Name']." <".$Row['Email'].">\n"."From: ". from_utf8($Config['Web']['Title'], 'iso2')." <noreplay@zdechov.net>\n"."MIME-Version: 1.0\n"."Content-type: text/html; charset=utf-8";236 $AdditionalHeaders = "To: ".$Row['Name']." <".$Row['Email'].">\n"."From: ".FromUTF8($Config['Web']['Title'], 'iso2')." <noreplay@zdechov.net>\n"."MIME-Version: 1.0\n"."Content-type: text/html; charset=utf-8"; 237 237 mail($Row['Email'], $Subject, $Message, $AdditionalHeaders); 238 238 $Output = USER_PASSWORD_RECOVERY_SUCCESS;
Note:
See TracChangeset
for help on using the changeset viewer.