[6779] | 1 | <?php
|
---|
| 2 | /*
|
---|
| 3 | Copyright DHTMLX LTD. http://www.dhtmlx.com
|
---|
| 4 | */
|
---|
| 5 |
|
---|
| 6 |
|
---|
| 7 | require_once 'pdfGenerator.php';
|
---|
| 8 | require_once 'pdfWrapper.php';
|
---|
| 9 | require_once 'tcpdf_ext.php';
|
---|
| 10 |
|
---|
| 11 | $error_handler = set_error_handler("PDFErrorHandler");
|
---|
| 12 |
|
---|
| 13 | if (get_magic_quotes_gpc()) {
|
---|
| 14 | $xmlString = stripslashes($_POST['mycoolxmlbody']);
|
---|
| 15 | } else {
|
---|
| 16 | strstr($_SERVER['HTTP_USER_AGENT'],"MSIE")?$xmlString = utf8_encode($_POST['mycoolxmlbody']):$xmlString = $_POST['mycoolxmlbody'];
|
---|
| 17 | }
|
---|
| 18 |
|
---|
| 19 | $i = 1;
|
---|
| 20 | while( $i == 1)
|
---|
| 21 |
|
---|
| 22 | {
|
---|
| 23 | $a = stripos($xmlString,'<img');
|
---|
| 24 | if ($a === FALSE)
|
---|
| 25 | {
|
---|
| 26 | $i = 0;
|
---|
| 27 | continue;
|
---|
| 28 | }
|
---|
| 29 | $aux1 = substr($xmlString,0,$a);
|
---|
| 30 | $aux2 = substr($xmlString,$a+4);
|
---|
| 31 | //$aux3 = $aux1 . $aux2;
|
---|
| 32 | $b = strpos($aux2,'>');
|
---|
| 33 | if ($b === FALSE)
|
---|
| 34 | {
|
---|
| 35 | $i = 0;
|
---|
| 36 | continue;
|
---|
| 37 | }
|
---|
| 38 | $aux3 = substr($aux2,$b + 1);
|
---|
| 39 | $xmlString = $aux1 . $aux3;
|
---|
| 40 |
|
---|
| 41 | }
|
---|
| 42 |
|
---|
| 43 | $j = 1;
|
---|
| 44 | while( $j == 1)
|
---|
| 45 |
|
---|
| 46 | {
|
---|
| 47 | $x = stripos($xmlString,'<INPUT');
|
---|
| 48 | if ($x === FALSE || $x === 0)
|
---|
| 49 | {
|
---|
| 50 | $j = 0;
|
---|
| 51 | continue;
|
---|
| 52 | }
|
---|
| 53 | $ax1 = substr($xmlString,0,$x);
|
---|
| 54 | $ax2 = substr($xmlString,$x+7);
|
---|
| 55 |
|
---|
| 56 | $c = strpos($ax2,'value="');
|
---|
| 57 | $ax2 = substr($ax2,$c+7);
|
---|
| 58 |
|
---|
| 59 | $d = strpos($ax2,'"');
|
---|
| 60 | $y = strpos($ax2,'>');
|
---|
| 61 |
|
---|
| 62 | $e = substr($ax2,0,$d);
|
---|
| 63 |
|
---|
| 64 | if ($y === FALSE || $y === 0)
|
---|
| 65 | {
|
---|
| 66 | $j = 0;
|
---|
| 67 | continue;
|
---|
| 68 | }
|
---|
| 69 | $ax3 = substr($ax2,$y + 1);
|
---|
| 70 | $xmlString = $ax1 . $ax3;
|
---|
| 71 |
|
---|
| 72 | }
|
---|
| 73 |
|
---|
| 74 | $xml = new SimpleXMLElement($xmlString, LIBXML_NOCDATA);
|
---|
| 75 | $scPDF = new schedulerPDF();
|
---|
| 76 | $scPDF->printScheduler($xml);
|
---|
| 77 |
|
---|
| 78 |
|
---|
| 79 | function PDFErrorHandler ($errno, $errstr, $errfile, $errline) {
|
---|
| 80 | global $xmlString;
|
---|
| 81 | if ($errno < 1024) {
|
---|
| 82 | error_log($xmlString, 3, 'error_report_'.date("Y_m_d__H_i_s").'.xml');
|
---|
| 83 | exit(1);
|
---|
| 84 | }
|
---|
| 85 | }
|
---|
| 86 |
|
---|
| 87 | ?> |
---|