@@ -536,8 +536,9 @@ |
||
536 | 536 | } |
537 | 537 | } else { |
538 | 538 | $store_path = api_get_path(SYS_CODE_PATH).'default_course_document/images/'.api_get_current_access_url_id().'_pdf_watermark.png'; // course path |
539 | - if (file_exists($store_path)) |
|
540 | - $web_path = api_get_path(WEB_CODE_PATH).'default_course_document/images/'.api_get_current_access_url_id().'_pdf_watermark.png'; |
|
539 | + if (file_exists($store_path)) { |
|
540 | + $web_path = api_get_path(WEB_CODE_PATH).'default_course_document/images/'.api_get_current_access_url_id().'_pdf_watermark.png'; |
|
541 | + } |
|
541 | 542 | } |
542 | 543 | return $web_path; |
543 | 544 | } |
@@ -240,14 +240,16 @@ |
||
240 | 240 | return $streamData; |
241 | 241 | |
242 | 242 | |
243 | - }else{ |
|
243 | + } else{ |
|
244 | 244 | |
245 | 245 | $numBlocks = $this->props[$this->wrkbook]['size'] / BIG_BLOCK_SIZE; |
246 | 246 | if ($this->props[$this->wrkbook]['size'] % BIG_BLOCK_SIZE != 0) { |
247 | 247 | $numBlocks++; |
248 | 248 | } |
249 | 249 | |
250 | - if ($numBlocks == 0) return ''; |
|
250 | + if ($numBlocks == 0) { |
|
251 | + return ''; |
|
252 | + } |
|
251 | 253 | |
252 | 254 | //echo "numBlocks = $numBlocks\n"; |
253 | 255 | //byte[] streamData = new byte[numBlocks * BIG_BLOCK_SIZE]; |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | if ($spos + $len < $limitpos) { |
506 | 506 | $retstr = substr($this->data, $spos, $len); |
507 | 507 | $spos += $len; |
508 | - }else{ |
|
508 | + } else{ |
|
509 | 509 | // found countinue |
510 | 510 | $retstr = substr($this->data, $spos, $limitpos - $spos); |
511 | 511 | $bytesRead = $limitpos - $spos; |
@@ -527,12 +527,12 @@ discard block |
||
527 | 527 | $retstr .= substr($this->data, $spos, $len); |
528 | 528 | $charsLeft -= $len; |
529 | 529 | $asciiEncoding = true; |
530 | - }elseif (!$asciiEncoding && ($option != 0)){ |
|
530 | + } elseif (!$asciiEncoding && ($option != 0)){ |
|
531 | 531 | $len = min($charsLeft * 2, $limitpos - $spos); // min($charsLeft, $conlength); |
532 | 532 | $retstr .= substr($this->data, $spos, $len); |
533 | 533 | $charsLeft -= $len/2; |
534 | 534 | $asciiEncoding = false; |
535 | - }elseif (!$asciiEncoding && ($option == 0)) { |
|
535 | + } elseif (!$asciiEncoding && ($option == 0)) { |
|
536 | 536 | // Bummer - the string starts off as Unicode, but after the |
537 | 537 | // continuation it is in straightforward ASCII encoding |
538 | 538 | $len = min($charsLeft, $limitpos - $spos); // min($charsLeft, $conlength); |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | } |
542 | 542 | $charsLeft -= $len; |
543 | 543 | $asciiEncoding = false; |
544 | - }else{ |
|
544 | + } else{ |
|
545 | 545 | $newstr = ''; |
546 | 546 | for ($j = 0; $j < strlen($retstr); $j++) { |
547 | 547 | $newstr = $retstr[$j].chr(0); |
@@ -619,22 +619,24 @@ discard block |
||
619 | 619 | 'type' => 'date', |
620 | 620 | 'format' => $this->dateFormats[$indexCode] |
621 | 621 | ); |
622 | - }elseif (array_key_exists($indexCode, $this->numberFormats)) { |
|
622 | + } elseif (array_key_exists($indexCode, $this->numberFormats)) { |
|
623 | 623 | //echo "isnumber ".$this->numberFormats[$indexCode]; |
624 | 624 | $this->formatRecords['xfrecords'][] = array( |
625 | 625 | 'type' => 'number', |
626 | 626 | 'format' => $this->numberFormats[$indexCode] |
627 | 627 | ); |
628 | - }else{ |
|
628 | + } else{ |
|
629 | 629 | $isdate = FALSE; |
630 | 630 | if ($indexCode > 0){ |
631 | - if (isset($this->formatRecords[$indexCode])) |
|
632 | - $formatstr = $this->formatRecords[$indexCode]; |
|
631 | + if (isset($this->formatRecords[$indexCode])) { |
|
632 | + $formatstr = $this->formatRecords[$indexCode]; |
|
633 | + } |
|
633 | 634 | //echo '.other.'; |
634 | 635 | //echo "\ndate-time=$formatstr=\n"; |
635 | - if ($formatstr) |
|
636 | - if (preg_match("/[^hmsday\/\-:\s]/i", $formatstr) == 0) { // found day and time format |
|
636 | + if ($formatstr) { |
|
637 | + if (preg_match("/[^hmsday\/\-:\s]/i", $formatstr) == 0) { // found day and time format |
|
637 | 638 | $isdate = TRUE; |
639 | + } |
|
638 | 640 | $formatstr = str_replace('mm', 'i', $formatstr); |
639 | 641 | $formatstr = str_replace('h', 'H', $formatstr); |
640 | 642 | //echo "\ndate-time $formatstr \n"; |
@@ -646,7 +648,7 @@ discard block |
||
646 | 648 | 'type' => 'date', |
647 | 649 | 'format' => $formatstr, |
648 | 650 | ); |
649 | - }else{ |
|
651 | + } else{ |
|
650 | 652 | $this->formatRecords['xfrecords'][] = array( |
651 | 653 | 'type' => 'other', |
652 | 654 | 'format' => '', |
@@ -674,7 +676,7 @@ discard block |
||
674 | 676 | } else { |
675 | 677 | $rec_name = $this->_encodeUTF16(substr($this->data, $pos+12, $rec_length*2)); |
676 | 678 | } |
677 | - }elseif ($version == SPREADSHEET_EXCEL_READER_BIFF7){ |
|
679 | + } elseif ($version == SPREADSHEET_EXCEL_READER_BIFF7){ |
|
678 | 680 | $rec_name = substr($this->data, $pos+11, $rec_length); |
679 | 681 | } |
680 | 682 | $this->boundsheets[] = array('name'=>$rec_name, |
@@ -733,7 +735,9 @@ discard block |
||
733 | 735 | //echo "mem= ".memory_get_usage()."\n"; |
734 | 736 | // $r = &$this->file->nextRecord(); |
735 | 737 | $lowcode = ord($this->data[$spos]); |
736 | - if ($lowcode == SPREADSHEET_EXCEL_READER_TYPE_EOF) break; |
|
738 | + if ($lowcode == SPREADSHEET_EXCEL_READER_TYPE_EOF) { |
|
739 | + break; |
|
740 | + } |
|
737 | 741 | $code = $lowcode | ord($this->data[$spos+1])<<8; |
738 | 742 | $length = ord($this->data[$spos+2]) | ord($this->data[$spos+3])<<8; |
739 | 743 | $spos += 4; |
@@ -783,7 +787,7 @@ discard block |
||
783 | 787 | //echo $numValue." "; |
784 | 788 | if ($this->isDate($spos)) { |
785 | 789 | list($string, $raw) = $this->createDate($numValue); |
786 | - }else{ |
|
790 | + } else{ |
|
787 | 791 | $raw = $numValue; |
788 | 792 | if (isset($this->_columnsFormat[$column + 1])){ |
789 | 793 | $this->curformat = $this->_columnsFormat[$column + 1]; |
@@ -813,7 +817,7 @@ discard block |
||
813 | 817 | $numValue = $this->_GetIEEE754($this->_GetInt4d($this->data, $tmppos + 2)); |
814 | 818 | if ($this->isDate($tmppos-4)) { |
815 | 819 | list($string, $raw) = $this->createDate($numValue); |
816 | - }else{ |
|
820 | + } else{ |
|
817 | 821 | $raw = $numValue; |
818 | 822 | if (isset($this->_columnsFormat[$colFirst + $i + 1])){ |
819 | 823 | $this->curformat = $this->_columnsFormat[$colFirst + $i + 1]; |
@@ -837,7 +841,7 @@ discard block |
||
837 | 841 | if ($this->isDate($spos)) { |
838 | 842 | list($string, $raw) = $this->createDate($tmp['double']); |
839 | 843 | // $this->addcell(DateRecord($r, 1)); |
840 | - }else{ |
|
844 | + } else{ |
|
841 | 845 | //$raw = $tmp['']; |
842 | 846 | if (isset($this->_columnsFormat[$column + 1])){ |
843 | 847 | $this->curformat = $this->_columnsFormat[$column + 1]; |
@@ -869,7 +873,7 @@ discard block |
||
869 | 873 | if ($this->isDate($spos)) { |
870 | 874 | list($string, $raw) = $this->createDate($tmp['double']); |
871 | 875 | // $this->addcell(DateRecord($r, 1)); |
872 | - }else{ |
|
876 | + } else{ |
|
873 | 877 | //$raw = $tmp['']; |
874 | 878 | if (isset($this->_columnsFormat[$column + 1])){ |
875 | 879 | $this->curformat = $this->_columnsFormat[$column + 1]; |
@@ -913,10 +917,12 @@ discard block |
||
913 | 917 | $spos += $length; |
914 | 918 | } |
915 | 919 | |
916 | - if (!isset($this->sheets[$this->sn]['numRows'])) |
|
917 | - $this->sheets[$this->sn]['numRows'] = $this->sheets[$this->sn]['maxrow']; |
|
918 | - if (!isset($this->sheets[$this->sn]['numCols'])) |
|
919 | - $this->sheets[$this->sn]['numCols'] = $this->sheets[$this->sn]['maxcol']; |
|
920 | + if (!isset($this->sheets[$this->sn]['numRows'])) { |
|
921 | + $this->sheets[$this->sn]['numRows'] = $this->sheets[$this->sn]['maxrow']; |
|
922 | + } |
|
923 | + if (!isset($this->sheets[$this->sn]['numCols'])) { |
|
924 | + $this->sheets[$this->sn]['numCols'] = $this->sheets[$this->sn]['maxcol']; |
|
925 | + } |
|
920 | 926 | |
921 | 927 | } |
922 | 928 | |
@@ -943,7 +949,7 @@ discard block |
||
943 | 949 | if (($xfindex == 0x9) || ($xfindex == 0xa)){ |
944 | 950 | $this->multiplier = 100; |
945 | 951 | } |
946 | - }else{ |
|
952 | + } else{ |
|
947 | 953 | $this->curformat = $this->_defaultFormat; |
948 | 954 | $this->rectype = 'unknown'; |
949 | 955 | } |
@@ -993,7 +999,9 @@ discard block |
||
993 | 999 | $mantissalow1 = ($rknumlow & 0x80000000) >> 31; |
994 | 1000 | $mantissalow2 = ($rknumlow & 0x7fffffff); |
995 | 1001 | $value = $mantissa / pow( 2 , (20- ($exp - 1023))); |
996 | - if ($mantissalow1 != 0) $value += 1 / pow (2 , (21 - ($exp - 1023))); |
|
1002 | + if ($mantissalow1 != 0) { |
|
1003 | + $value += 1 / pow (2 , (21 - ($exp - 1023))); |
|
1004 | + } |
|
997 | 1005 | $value += $mantissalow2 / pow (2 , (52 - ($exp - 1023))); |
998 | 1006 | //echo "Sign = $sign, Exp = $exp, mantissahighx = $mantissa, mantissalow1 = $mantissalow1, mantissalow2 = $mantissalow2<br>\n"; |
999 | 1007 | if ($sign) {$value = -1 * $value;} |
@@ -1006,10 +1014,12 @@ discard block |
||
1006 | 1014 | $this->sheets[$this->sn]['maxrow'] = max($this->sheets[$this->sn]['maxrow'], $row + $this->_rowoffset); |
1007 | 1015 | $this->sheets[$this->sn]['maxcol'] = max($this->sheets[$this->sn]['maxcol'], $col + $this->_coloffset); |
1008 | 1016 | $this->sheets[$this->sn]['cells'][$row + $this->_rowoffset][$col + $this->_coloffset] = $string; |
1009 | - if ($raw) |
|
1010 | - $this->sheets[$this->sn]['cellsInfo'][$row + $this->_rowoffset][$col + $this->_coloffset]['raw'] = $raw; |
|
1011 | - if (isset($this->rectype)) |
|
1012 | - $this->sheets[$this->sn]['cellsInfo'][$row + $this->_rowoffset][$col + $this->_coloffset]['type'] = $this->rectype; |
|
1017 | + if ($raw) { |
|
1018 | + $this->sheets[$this->sn]['cellsInfo'][$row + $this->_rowoffset][$col + $this->_coloffset]['raw'] = $raw; |
|
1019 | + } |
|
1020 | + if (isset($this->rectype)) { |
|
1021 | + $this->sheets[$this->sn]['cellsInfo'][$row + $this->_rowoffset][$col + $this->_coloffset]['type'] = $this->rectype; |
|
1022 | + } |
|
1013 | 1023 | |
1014 | 1024 | } |
1015 | 1025 |
@@ -347,15 +347,22 @@ |
||
347 | 347 | $args = array(); |
348 | 348 | if (!empty($v['args'])) { |
349 | 349 | foreach ($v['args'] as $arg) { |
350 | - if (is_null($arg)) $args[] = 'null'; |
|
351 | - elseif (is_array($arg)) $args[] = 'Array'; |
|
352 | - elseif (is_object($arg)) $args[] = 'Object('.get_class($arg).')'; |
|
353 | - elseif (is_bool($arg)) $args[] = $arg ? 'true' : 'false'; |
|
354 | - elseif (is_int($arg) || is_double($arg)) $args[] = $arg; |
|
355 | - else { |
|
350 | + if (is_null($arg)) { |
|
351 | + $args[] = 'null'; |
|
352 | + } elseif (is_array($arg)) { |
|
353 | + $args[] = 'Array'; |
|
354 | + } elseif (is_object($arg)) { |
|
355 | + $args[] = 'Object('.get_class($arg).')'; |
|
356 | + } elseif (is_bool($arg)) { |
|
357 | + $args[] = $arg ? 'true' : 'false'; |
|
358 | + } elseif (is_int($arg) || is_double($arg)) { |
|
359 | + $args[] = $arg; |
|
360 | + } else { |
|
356 | 361 | $arg = (string)$arg; |
357 | 362 | $str = htmlspecialchars(substr($arg, 0, 16)); |
358 | - if (strlen($arg) > 16) $str .= '…'; |
|
363 | + if (strlen($arg) > 16) { |
|
364 | + $str .= '…'; |
|
365 | + } |
|
359 | 366 | $args[] = "'" . $str . "'"; |
360 | 367 | } |
361 | 368 | } |
@@ -380,7 +380,9 @@ |
||
380 | 380 | // check if user is allowed to see the block |
381 | 381 | if (method_exists($obj_block, 'is_block_visible_for_user')) { |
382 | 382 | $is_block_visible_for_user = $obj_block->is_block_visible_for_user($user_id); |
383 | - if (!$is_block_visible_for_user) continue; |
|
383 | + if (!$is_block_visible_for_user) { |
|
384 | + continue; |
|
385 | + } |
|
384 | 386 | } |
385 | 387 | |
386 | 388 | echo '<tr>'; |
@@ -2097,7 +2097,9 @@ |
||
2097 | 2097 | FROM $tbl_course course |
2098 | 2098 | WHERE course.code IN (".implode(',',$courses_code).")"; |
2099 | 2099 | |
2100 | - if (!in_array($direction, array('ASC','DESC'))) $direction = 'ASC'; |
|
2100 | + if (!in_array($direction, array('ASC','DESC'))) { |
|
2101 | + $direction = 'ASC'; |
|
2102 | + } |
|
2101 | 2103 | |
2102 | 2104 | $column = intval($column); |
2103 | 2105 | $from = intval($from); |
@@ -346,9 +346,10 @@ |
||
346 | 346 | function DOMPDF_autoload($class) { |
347 | 347 | $filename = DOMPDF_INC_DIR . "/" . mb_strtolower($class) . ".cls.php"; |
348 | 348 | |
349 | - if ( is_file($filename) ) |
|
350 | - require_once($filename); |
|
351 | -} |
|
349 | + if ( is_file($filename) ) { |
|
350 | + require_once($filename); |
|
351 | + } |
|
352 | + } |
|
352 | 353 | |
353 | 354 | if ( function_exists("spl_autoload_register") ) { |
354 | 355 |
@@ -96,8 +96,9 @@ discard block |
||
96 | 96 | |
97 | 97 | $opts = array(); |
98 | 98 | |
99 | - if ( $_SERVER["argc"] == 1 ) |
|
100 | - return $opts; |
|
99 | + if ( $_SERVER["argc"] == 1 ) { |
|
100 | + return $opts; |
|
101 | + } |
|
101 | 102 | |
102 | 103 | $i = 1; |
103 | 104 | while ($i < $_SERVER["argc"]) { |
@@ -116,29 +117,33 @@ discard block |
||
116 | 117 | break; |
117 | 118 | |
118 | 119 | case "-p": |
119 | - if ( !isset($_SERVER["argv"][$i+1]) ) |
|
120 | - die("-p switch requires a size parameter\n"); |
|
120 | + if ( !isset($_SERVER["argv"][$i+1]) ) { |
|
121 | + die("-p switch requires a size parameter\n"); |
|
122 | + } |
|
121 | 123 | $opts["p"] = $_SERVER["argv"][$i+1]; |
122 | 124 | $i += 2; |
123 | 125 | break; |
124 | 126 | |
125 | 127 | case "-o": |
126 | - if ( !isset($_SERVER["argv"][$i+1]) ) |
|
127 | - die("-o switch requires an orientation parameter\n"); |
|
128 | + if ( !isset($_SERVER["argv"][$i+1]) ) { |
|
129 | + die("-o switch requires an orientation parameter\n"); |
|
130 | + } |
|
128 | 131 | $opts["o"] = $_SERVER["argv"][$i+1]; |
129 | 132 | $i += 2; |
130 | 133 | break; |
131 | 134 | |
132 | 135 | case "-b": |
133 | - if ( !isset($_SERVER["argv"][$i+1]) ) |
|
134 | - die("-b switch requires a path parameter\n"); |
|
136 | + if ( !isset($_SERVER["argv"][$i+1]) ) { |
|
137 | + die("-b switch requires a path parameter\n"); |
|
138 | + } |
|
135 | 139 | $opts["b"] = $_SERVER["argv"][$i+1]; |
136 | 140 | $i += 2; |
137 | 141 | break; |
138 | 142 | |
139 | 143 | case "-f": |
140 | - if ( !isset($_SERVER["argv"][$i+1]) ) |
|
141 | - die("-f switch requires a filename parameter\n"); |
|
144 | + if ( !isset($_SERVER["argv"][$i+1]) ) { |
|
145 | + die("-f switch requires a filename parameter\n"); |
|
146 | + } |
|
142 | 147 | $opts["f"] = $_SERVER["argv"][$i+1]; |
143 | 148 | $i += 2; |
144 | 149 | break; |
@@ -154,8 +159,9 @@ discard block |
||
154 | 159 | break; |
155 | 160 | |
156 | 161 | case "-t": |
157 | - if ( !isset($_SERVER['argv'][$i + 1]) ) |
|
158 | - die("-t switch requires a comma separated list of types\n"); |
|
162 | + if ( !isset($_SERVER['argv'][$i + 1]) ) { |
|
163 | + die("-t switch requires a comma separated list of types\n"); |
|
164 | + } |
|
159 | 165 | $opts["t"] = $_SERVER['argv'][$i+1]; |
160 | 166 | $i += 2; |
161 | 167 | break; |
@@ -191,36 +197,42 @@ discard block |
||
191 | 197 | if ( isset($opts["l"]) ) { |
192 | 198 | echo "\nUnderstood paper sizes:\n"; |
193 | 199 | |
194 | - foreach (array_keys(CPDF_Adapter::$PAPER_SIZES) as $size) |
|
195 | - echo " " . mb_strtoupper($size) . "\n"; |
|
200 | + foreach (array_keys(CPDF_Adapter::$PAPER_SIZES) as $size) { |
|
201 | + echo " " . mb_strtoupper($size) . "\n"; |
|
202 | + } |
|
196 | 203 | exit; |
197 | 204 | } |
198 | 205 | $file = $opts["filename"]; |
199 | 206 | |
200 | - if ( isset($opts["p"]) ) |
|
201 | - $paper = $opts["p"]; |
|
202 | - else |
|
203 | - $paper = DOMPDF_DEFAULT_PAPER_SIZE; |
|
204 | - |
|
205 | - if ( isset($opts["o"]) ) |
|
206 | - $orientation = $opts["o"]; |
|
207 | - else |
|
208 | - $orientation = "portrait"; |
|
209 | - |
|
210 | - if ( isset($opts["b"]) ) |
|
211 | - $base_path = $opts["b"]; |
|
212 | - |
|
213 | - if ( isset($opts["f"]) ) |
|
214 | - $outfile = $opts["f"]; |
|
215 | - else { |
|
216 | - if ( $file === "-" ) |
|
217 | - $outfile = "dompdf_out.pdf"; |
|
218 | - else |
|
219 | - $outfile = str_ireplace(array(".html", ".htm", ".php"), "", $file) . ".pdf"; |
|
207 | + if ( isset($opts["p"]) ) { |
|
208 | + $paper = $opts["p"]; |
|
209 | + } else { |
|
210 | + $paper = DOMPDF_DEFAULT_PAPER_SIZE; |
|
220 | 211 | } |
221 | 212 | |
222 | - if ( isset($opts["v"]) ) |
|
223 | - $_dompdf_show_warnings = true; |
|
213 | + if ( isset($opts["o"]) ) { |
|
214 | + $orientation = $opts["o"]; |
|
215 | + } else { |
|
216 | + $orientation = "portrait"; |
|
217 | + } |
|
218 | + |
|
219 | + if ( isset($opts["b"]) ) { |
|
220 | + $base_path = $opts["b"]; |
|
221 | + } |
|
222 | + |
|
223 | + if ( isset($opts["f"]) ) { |
|
224 | + $outfile = $opts["f"]; |
|
225 | + } else { |
|
226 | + if ( $file === "-" ) { |
|
227 | + $outfile = "dompdf_out.pdf"; |
|
228 | + } else { |
|
229 | + $outfile = str_ireplace(array(".html", ".htm", ".php"), "", $file) . ".pdf"; |
|
230 | + } |
|
231 | + } |
|
232 | + |
|
233 | + if ( isset($opts["v"]) ) { |
|
234 | + $_dompdf_show_warnings = true; |
|
235 | + } |
|
224 | 236 | |
225 | 237 | if ( isset($opts["d"]) ) { |
226 | 238 | $_dompdf_show_warnings = true; |
@@ -230,8 +242,9 @@ discard block |
||
230 | 242 | if ( isset($opts['t']) ) { |
231 | 243 | $arr = split(',',$opts['t']); |
232 | 244 | $types = array(); |
233 | - foreach ($arr as $type) |
|
234 | - $types[ trim($type) ] = 1; |
|
245 | + foreach ($arr as $type) { |
|
246 | + $types[ trim($type) ] = 1; |
|
247 | + } |
|
235 | 248 | $_DOMPDF_DEBUG_TYPES = $types; |
236 | 249 | } |
237 | 250 | |
@@ -241,23 +254,27 @@ discard block |
||
241 | 254 | |
242 | 255 | default: |
243 | 256 | |
244 | - if ( isset($_GET["input_file"]) ) |
|
245 | - $file = basename(rawurldecode($_GET["input_file"])); |
|
246 | - else |
|
247 | - throw new DOMPDF_Exception("An input file is required (i.e. input_file _GET variable)."); |
|
257 | + if ( isset($_GET["input_file"]) ) { |
|
258 | + $file = basename(rawurldecode($_GET["input_file"])); |
|
259 | + } else { |
|
260 | + throw new DOMPDF_Exception("An input file is required (i.e. input_file _GET variable)."); |
|
261 | + } |
|
248 | 262 | |
249 | - if ( isset($_GET["paper"]) ) |
|
250 | - $paper = rawurldecode($_GET["paper"]); |
|
251 | - else |
|
252 | - $paper = DOMPDF_DEFAULT_PAPER_SIZE; |
|
263 | + if ( isset($_GET["paper"]) ) { |
|
264 | + $paper = rawurldecode($_GET["paper"]); |
|
265 | + } else { |
|
266 | + $paper = DOMPDF_DEFAULT_PAPER_SIZE; |
|
267 | + } |
|
253 | 268 | |
254 | - if ( isset($_GET["orientation"]) ) |
|
255 | - $orientation = rawurldecode($_GET["orientation"]); |
|
256 | - else |
|
257 | - $orientation = "portrait"; |
|
269 | + if ( isset($_GET["orientation"]) ) { |
|
270 | + $orientation = rawurldecode($_GET["orientation"]); |
|
271 | + } else { |
|
272 | + $orientation = "portrait"; |
|
273 | + } |
|
258 | 274 | |
259 | - if ( isset($_GET["base_path"]) ) |
|
260 | - $base_path = rawurldecode($_GET["base_path"]); |
|
275 | + if ( isset($_GET["base_path"]) ) { |
|
276 | + $base_path = rawurldecode($_GET["base_path"]); |
|
277 | + } |
|
261 | 278 | |
262 | 279 | |
263 | 280 | $outfile = "dompdf_out.pdf"; # Don't allow them to set the output file |
@@ -265,8 +282,9 @@ discard block |
||
265 | 282 | $file = $base_path . $file; # Set the input file |
266 | 283 | |
267 | 284 | /* Check to see if the input file and base path = www/test */ |
268 | - if($base_path !== "www/test/") |
|
269 | - throw new DOMPDF_Exception("Access to dompdf.php via non-cli SAPI has been deprecated due to security concerns. Please use the dompdf class directly."); |
|
285 | + if($base_path !== "www/test/") { |
|
286 | + throw new DOMPDF_Exception("Access to dompdf.php via non-cli SAPI has been deprecated due to security concerns. Please use the dompdf class directly."); |
|
287 | + } |
|
270 | 288 | |
271 | 289 | break; |
272 | 290 | } |
@@ -275,13 +293,15 @@ discard block |
||
275 | 293 | |
276 | 294 | if ( $file === "-" ) { |
277 | 295 | $str = ""; |
278 | - while ( !feof(STDIN) ) |
|
279 | - $str .= fread(STDIN, 4096); |
|
296 | + while ( !feof(STDIN) ) { |
|
297 | + $str .= fread(STDIN, 4096); |
|
298 | + } |
|
280 | 299 | |
281 | 300 | $dompdf->load_html($str); |
282 | 301 | |
283 | -} else |
|
302 | +} else { |
|
284 | 303 | $dompdf->load_html_file($file); |
304 | +} |
|
285 | 305 | |
286 | 306 | if ( isset($base_path) ) { |
287 | 307 | $dompdf->set_base_path($base_path); |
@@ -293,8 +313,9 @@ discard block |
||
293 | 313 | |
294 | 314 | if ( $_dompdf_show_warnings ) { |
295 | 315 | global $_dompdf_warnings; |
296 | - foreach ($_dompdf_warnings as $msg) |
|
297 | - echo $msg . "\n"; |
|
316 | + foreach ($_dompdf_warnings as $msg) { |
|
317 | + echo $msg . "\n"; |
|
318 | + } |
|
298 | 319 | echo $dompdf->get_canvas()->get_cpdf()->messages; |
299 | 320 | flush(); |
300 | 321 | } |
@@ -302,17 +323,22 @@ discard block |
||
302 | 323 | if ( $save_file ) { |
303 | 324 | // if ( !is_writable($outfile) ) |
304 | 325 | // throw new DOMPDF_Exception("'$outfile' is not writable."); |
305 | - if ( strtolower(DOMPDF_PDF_BACKEND) === "gd" ) |
|
306 | - $outfile = str_replace(".pdf", ".png", $outfile); |
|
326 | + if ( strtolower(DOMPDF_PDF_BACKEND) === "gd" ) { |
|
327 | + $outfile = str_replace(".pdf", ".png", $outfile); |
|
328 | + } |
|
307 | 329 | |
308 | 330 | list($proto, $host, $path, $file) = explode_url($outfile); |
309 | - if ( $proto != "" ) // i.e. not file:// |
|
310 | - $outfile = $file; // just save it locally, FIXME? could save it like wget: ./host/basepath/file |
|
331 | + if ( $proto != "" ) { |
|
332 | + // i.e. not file:// |
|
333 | + $outfile = $file; |
|
334 | + } |
|
335 | + // just save it locally, FIXME? could save it like wget: ./host/basepath/file |
|
311 | 336 | |
312 | 337 | $outfile = realpath(dirname($outfile)) . DIRECTORY_SEPARATOR . basename($outfile); |
313 | 338 | |
314 | - if ( strpos($outfile, DOMPDF_CHROOT) !== 0 ) |
|
315 | - throw new DOMPDF_Exception("Permission denied."); |
|
339 | + if ( strpos($outfile, DOMPDF_CHROOT) !== 0 ) { |
|
340 | + throw new DOMPDF_Exception("Permission denied."); |
|
341 | + } |
|
316 | 342 | |
317 | 343 | file_put_contents($outfile, $dompdf->output( array("compress" => 0) )); |
318 | 344 | exit(0); |
@@ -3,8 +3,9 @@ discard block |
||
3 | 3 | require_once("../dompdf_config.inc.php"); |
4 | 4 | if ( isset( $_POST["html"] ) ) { |
5 | 5 | |
6 | - if ( get_magic_quotes_gpc() ) |
|
7 | - $_POST["html"] = stripslashes($_POST["html"]); |
|
6 | + if ( get_magic_quotes_gpc() ) { |
|
7 | + $_POST["html"] = stripslashes($_POST["html"]); |
|
8 | + } |
|
8 | 9 | |
9 | 10 | $dompdf = new DOMPDF(); |
10 | 11 | $dompdf->load_html($_POST["html"]); |
@@ -68,8 +69,9 @@ discard block |
||
68 | 69 | <p>Paper size and orientaion: |
69 | 70 | <select name="paper"> |
70 | 71 | <?php |
71 | -foreach ( array_keys(CPDF_Adapter::$PAPER_SIZES) as $size ) |
|
72 | +foreach ( array_keys(CPDF_Adapter::$PAPER_SIZES) as $size ) { |
|
72 | 73 | echo "<option ". ($size == "letter" ? "selected " : "" ) . "value=\"$size\">$size</option>\n"; |
74 | +} |
|
73 | 75 | ?> |
74 | 76 | </select> |
75 | 77 | <select name="orientation"> |