|
Lines 489-500
if ($update && !$this->parts[$part]['inl
Link Here
|
| 489 |
[<a href="translator.php?<?php echo $this->dirCGI ?>">Back to Translation List</a>] |
489 |
[<a href="translator.php?<?php echo $this->dirCGI ?>">Back to Translation List</a>] |
| 490 |
<p> |
490 |
<p> |
| 491 |
<?php |
491 |
<?php |
|
|
492 |
if (!isset($this->parts[$part])) |
| 493 |
{ |
| 494 |
die("Unknown part in edit param!"); |
| 495 |
} |
| 496 |
|
| 497 |
if (!preg_match('/^\w+$/',$lang)) |
| 498 |
{ |
| 499 |
die("Not allowed characters in lang param!"); |
| 500 |
} |
| 501 |
|
| 492 |
$param = $this->parts[$part]; |
502 |
$param = $this->parts[$part]; |
| 493 |
$file = sprintf($this->fmt,$lang,$param['file']); |
503 |
$file = sprintf($this->fmt,$lang,$param['file']); |
| 494 |
|
504 |
|
| 495 |
mkdir($this->dir.'/locale/'.$lang, 0777); |
|
|
| 496 |
chmod($this->dir.'/locale/'.$lang, 0777); |
| 497 |
|
| 498 |
include($file); |
505 |
include($file); |
| 499 |
eval('$data = $'.$part.';'); |
506 |
eval('$data = $'.$part.';'); |
| 500 |
eval('$'.$part.'=array();'); |
507 |
eval('$'.$part.'=array();'); |
|
Lines 518-524
if ($update && !$this->parts[$part]['inl
Link Here
|
| 518 |
|
525 |
|
| 519 |
if (!$fh = fopen($file,'w')) |
526 |
if (!$fh = fopen($file,'w')) |
| 520 |
{ |
527 |
{ |
| 521 |
echo "Cannot write results to file: $file" . |
528 |
echo "Cannot write results to file: $file<br>\n"; |
|
|
529 |
echo "Sorry for inconvinience, if possible keep this page open and inform admin. When the problem is fixed you could just reload this page and post the data once again.<br>\n"; |
| 522 |
exit; |
530 |
exit; |
| 523 |
} |
531 |
} |
| 524 |
|
532 |
|
|
Lines 572-580
if ($update && !$this->parts[$part]['inl
Link Here
|
| 572 |
else |
580 |
else |
| 573 |
{ |
581 |
{ |
| 574 |
$value = str_replace("\r\n","\n", $value); |
582 |
$value = str_replace("\r\n","\n", $value); |
| 575 |
fwrite( $fh, "\$".$part."['".$label."'] = <<<_P\n"); |
583 |
fwrite( $fh, "\$".$part."['".$label."'] = <<<_SBHD\n"); |
|
|
584 |
|
| 585 |
// Do not allow here doc to be included in the string, |
| 586 |
// otherwise any php code would be executed. |
| 587 |
if (strstr($value,"_SBHD")) |
| 588 |
{ |
| 589 |
die("Value must not contain _SBHD pattern!"); |
| 590 |
} |
| 591 |
|
| 576 |
fwrite( $fh, $value); |
592 |
fwrite( $fh, $value); |
| 577 |
fwrite( $fh, "\n_P;\n\n"); |
593 |
fwrite( $fh, "\n_SBHD;\n\n"); |
| 578 |
} |
594 |
} |
| 579 |
} |
595 |
} |
| 580 |
} |
596 |
} |