@@ -76,6 +76,12 @@ discard block |
||
76 | 76 | // prepare EMail-From |
77 | 77 | $emailheaders = 'From: "' . $emailaddr . '" <' . $emailaddr . '>'; |
78 | 78 | |
79 | +/** |
|
80 | + * @param string $module |
|
81 | + * @param integer $eventid |
|
82 | + * @param integer $objectid2 |
|
83 | + * @param string $logtext |
|
84 | + */ |
|
79 | 85 | function logentry($module, $eventid, $userid, $objectid1, $objectid2, $logtext, $details) |
80 | 86 | { |
81 | 87 | sql( |
@@ -148,6 +154,9 @@ discard block |
||
148 | 154 | return $start; |
149 | 155 | } |
150 | 156 | |
157 | +/** |
|
158 | + * @return string |
|
159 | + */ |
|
151 | 160 | function escape_javascript($text) |
152 | 161 | { |
153 | 162 | return str_replace('\'', '\\\'', str_replace('"', '"', $text)); |
@@ -159,6 +168,9 @@ discard block |
||
159 | 168 | sql_error(); |
160 | 169 | } |
161 | 170 | |
171 | +/** |
|
172 | + * @param string $sql |
|
173 | + */ |
|
162 | 174 | function sqlValue($sql, $default) |
163 | 175 | { |
164 | 176 | $rs = sql($sql); |
@@ -187,11 +199,21 @@ discard block |
||
187 | 199 | } |
188 | 200 | } |
189 | 201 | |
202 | +/** |
|
203 | + * @param string $name |
|
204 | + * @param string $default |
|
205 | + * |
|
206 | + * @return string |
|
207 | + */ |
|
190 | 208 | function getSysConfig($name, $default) |
191 | 209 | { |
192 | 210 | return sqlValue('SELECT `value` FROM `sysconfig` WHERE `name`=\'' . sql_escape($name) . '\'', $default); |
193 | 211 | } |
194 | 212 | |
213 | +/** |
|
214 | + * @param string $name |
|
215 | + * @param string $value |
|
216 | + */ |
|
195 | 217 | function setSysConfig($name, $value) |
196 | 218 | { |
197 | 219 | if (sqlValue('SELECT COUNT(*) FROM sysconfig WHERE name=\'' . sql_escape($name) . '\'', 0) == 1) { |
@@ -516,6 +538,9 @@ discard block |
||
516 | 538 | die('sql_error'); |
517 | 539 | } |
518 | 540 | |
541 | +/** |
|
542 | + * @param string $warnmessage |
|
543 | + */ |
|
519 | 544 | function sql_warn($warnmessage) |
520 | 545 | { |
521 | 546 | global $sql_errormail; |
@@ -549,6 +574,9 @@ discard block |
||
549 | 574 | return mysql_fetch_row($rs); |
550 | 575 | } |
551 | 576 | |
577 | +/** |
|
578 | + * @param resource $rs |
|
579 | + */ |
|
552 | 580 | function sql_fetch_column($rs) |
553 | 581 | { |
554 | 582 | $col = []; |
@@ -758,6 +786,9 @@ discard block |
||
758 | 786 | ]; |
759 | 787 | } |
760 | 788 | |
789 | +/** |
|
790 | + * @param string $filename |
|
791 | + */ |
|
761 | 792 | function fetch_email_template($filename, $language, $domain) |
762 | 793 | { |
763 | 794 | global $opt, $rootpath; |
@@ -323,6 +323,9 @@ discard block |
||
323 | 323 | //set no_eval true to prevent this contents from php-parsing. |
324 | 324 | //Important when replacing something that the user has posted |
325 | 325 | //in HTML code and could contain \<\? php-Code \?\> |
326 | +/** |
|
327 | + * @param string $name |
|
328 | + */ |
|
326 | 329 | function tpl_set_var($name, $value, $no_eval = true) |
327 | 330 | { |
328 | 331 | global $vars, $no_eval_vars; |
@@ -543,6 +546,9 @@ discard block |
||
543 | 546 | } |
544 | 547 | |
545 | 548 | //redirect to another site to display, i.e. to view a cache after logging |
549 | +/** |
|
550 | + * @param string $page |
|
551 | + */ |
|
546 | 552 | function tpl_redirect($page) |
547 | 553 | { |
548 | 554 | global $absolute_server_URI; |
@@ -562,6 +568,9 @@ discard block |
||
562 | 568 | //process the template replacements |
563 | 569 | //no_eval_replace - if true, variables will be replaced that are |
564 | 570 | // marked as "no_eval" |
571 | +/** |
|
572 | + * @param string $str |
|
573 | + */ |
|
565 | 574 | function tpl_do_replace($str) |
566 | 575 | { |
567 | 576 | global $vars, $no_eval_vars; |
@@ -589,6 +598,10 @@ discard block |
||
589 | 598 | return $str; |
590 | 599 | } |
591 | 600 | |
601 | +/** |
|
602 | + * @param string $tplnameError |
|
603 | + * @param string $msg |
|
604 | + */ |
|
592 | 605 | function tpl_errorMsg($tplnameError, $msg) |
593 | 606 | { |
594 | 607 | global $tplname; |
@@ -617,6 +630,9 @@ discard block |
||
617 | 630 | textdomain('messages'); |
618 | 631 | } |
619 | 632 | |
633 | +/** |
|
634 | + * @param string $sCode |
|
635 | + */ |
|
620 | 636 | function tpl_do_translation($sCode) |
621 | 637 | { |
622 | 638 | global $opt, $style, $tplname; |
@@ -645,6 +661,9 @@ discard block |
||
645 | 661 | return $sResultCode; |
646 | 662 | } |
647 | 663 | |
664 | +/** |
|
665 | + * @param string $sCode |
|
666 | + */ |
|
648 | 667 | function gettext_do_html($sCode) |
649 | 668 | { |
650 | 669 | $sResultCode = ''; |
@@ -674,6 +693,9 @@ discard block |
||
674 | 693 | return $sResultCode; |
675 | 694 | } |
676 | 695 | |
696 | +/** |
|
697 | + * @return string |
|
698 | + */ |
|
677 | 699 | function t($str) |
678 | 700 | { |
679 | 701 | global $translate; |
@@ -149,6 +149,9 @@ |
||
149 | 149 | <?php |
150 | 150 | } |
151 | 151 | |
152 | +/** |
|
153 | + * @param string $sql |
|
154 | + */ |
|
152 | 155 | function sqldbg_execute($sql, $bSlave) |
153 | 156 | { |
154 | 157 | global $dblink; |
@@ -341,6 +341,9 @@ discard block |
||
341 | 341 | return $result; |
342 | 342 | } |
343 | 343 | |
344 | +/** |
|
345 | + * @param string $sql |
|
346 | + */ |
|
344 | 347 | function sqlf($sql) |
345 | 348 | { |
346 | 349 | global $db; |
@@ -354,6 +357,9 @@ discard block |
||
354 | 357 | return $result; |
355 | 358 | } |
356 | 359 | |
360 | +/** |
|
361 | + * @param string $sql |
|
362 | + */ |
|
357 | 363 | function sqlf_slave($sql) |
358 | 364 | { |
359 | 365 | global $db; |
@@ -367,6 +373,9 @@ discard block |
||
367 | 373 | return $result; |
368 | 374 | } |
369 | 375 | |
376 | +/** |
|
377 | + * @param string $sql |
|
378 | + */ |
|
370 | 379 | function sqll($sql) |
371 | 380 | { |
372 | 381 | global $db; |
@@ -380,6 +389,10 @@ discard block |
||
380 | 389 | return $result; |
381 | 390 | } |
382 | 391 | |
392 | +/** |
|
393 | + * @param string $sql |
|
394 | + * @param integer $default |
|
395 | + */ |
|
383 | 396 | function sqlf_value($sql, $default) |
384 | 397 | { |
385 | 398 | global $db; |
@@ -394,6 +407,10 @@ discard block |
||
394 | 407 | return $result; |
395 | 408 | } |
396 | 409 | |
410 | +/** |
|
411 | + * @param string $sql |
|
412 | + * @param integer $default |
|
413 | + */ |
|
397 | 414 | function sqll_value($sql, $default) |
398 | 415 | { |
399 | 416 | global $db; |
@@ -474,6 +491,9 @@ discard block |
||
474 | 491 | return sql_value_internal(true, $sql, $default, $args); |
475 | 492 | } |
476 | 493 | |
494 | +/** |
|
495 | + * @param boolean $bQuerySlave |
|
496 | + */ |
|
477 | 497 | function sql_value_internal($bQuerySlave, $sql, $default) |
478 | 498 | { |
479 | 499 | $args = func_get_args(); |
@@ -576,6 +596,9 @@ discard block |
||
576 | 596 | return $retval; |
577 | 597 | } |
578 | 598 | |
599 | +/** |
|
600 | + * @param resource $rs |
|
601 | + */ |
|
579 | 602 | function sql_fetch_column($rs) |
580 | 603 | { |
581 | 604 | global $opt; |
@@ -625,11 +648,17 @@ discard block |
||
625 | 648 | return mysql_insert_id($db['dblink_slave']); |
626 | 649 | } |
627 | 650 | |
651 | +/** |
|
652 | + * @param resource $rs |
|
653 | + */ |
|
628 | 654 | function sql_num_rows($rs) |
629 | 655 | { |
630 | 656 | return mysql_num_rows($rs); |
631 | 657 | } |
632 | 658 | |
659 | +/** |
|
660 | + * @param string $table |
|
661 | + */ |
|
633 | 662 | function sql_temp_table($table) |
634 | 663 | { |
635 | 664 | global $db, $opt; |
@@ -659,6 +688,9 @@ discard block |
||
659 | 688 | $db['temptables'][$table] = $table; |
660 | 689 | } |
661 | 690 | |
691 | +/** |
|
692 | + * @param string $table |
|
693 | + */ |
|
662 | 694 | function sql_temp_table_slave($table) |
663 | 695 | { |
664 | 696 | global $db, $opt; |
@@ -679,6 +711,9 @@ discard block |
||
679 | 711 | $db['temptables_slave'][$table] = $table; |
680 | 712 | } |
681 | 713 | |
714 | +/** |
|
715 | + * @param string $table |
|
716 | + */ |
|
682 | 717 | function sql_drop_temp_table($table) |
683 | 718 | { |
684 | 719 | global $db, $opt; |
@@ -715,6 +750,9 @@ discard block |
||
715 | 750 | $db['temptables'][$newname] = $newname; |
716 | 751 | } |
717 | 752 | |
753 | +/** |
|
754 | + * @param string $table |
|
755 | + */ |
|
718 | 756 | function sql_drop_temp_table_slave($table) |
719 | 757 | { |
720 | 758 | global $db, $opt; |
@@ -1079,6 +1117,9 @@ discard block |
||
1079 | 1117 | } |
1080 | 1118 | } |
1081 | 1119 | |
1120 | +/** |
|
1121 | + * @param string $warnmessage |
|
1122 | + */ |
|
1082 | 1123 | function sql_warn($warnmessage) |
1083 | 1124 | { |
1084 | 1125 | global $opt; |
@@ -1105,6 +1146,9 @@ discard block |
||
1105 | 1146 | } |
1106 | 1147 | } |
1107 | 1148 | |
1149 | +/** |
|
1150 | + * @param resource $rs |
|
1151 | + */ |
|
1108 | 1152 | function sql_export_recordset($f, $rs, $table, $truncate = true) |
1109 | 1153 | { |
1110 | 1154 | fwrite($f, "SET NAMES 'utf8';\n"); |
@@ -1135,6 +1179,9 @@ discard block |
||
1135 | 1179 | } |
1136 | 1180 | } |
1137 | 1181 | |
1182 | +/** |
|
1183 | + * @param resource $f |
|
1184 | + */ |
|
1138 | 1185 | function sql_export_table($f, $table) |
1139 | 1186 | { |
1140 | 1187 | $primary = array(); |
@@ -1156,6 +1203,10 @@ discard block |
||
1156 | 1203 | sql_free_result($rs); |
1157 | 1204 | } |
1158 | 1205 | |
1206 | +/** |
|
1207 | + * @param string $filename |
|
1208 | + * @param string[] $tables |
|
1209 | + */ |
|
1159 | 1210 | function sql_export_tables_to_file($filename, $tables) |
1160 | 1211 | { |
1161 | 1212 | $f = fopen($filename, 'w'); |
@@ -1183,6 +1234,9 @@ discard block |
||
1183 | 1234 | fclose($f); |
1184 | 1235 | } |
1185 | 1236 | |
1237 | +/** |
|
1238 | + * @param resource $f |
|
1239 | + */ |
|
1186 | 1240 | function sql_export_structure($f, $table) |
1187 | 1241 | { |
1188 | 1242 | $rs = sql("SHOW CREATE TABLE `&1`", $table); |
@@ -1198,6 +1252,9 @@ discard block |
||
1198 | 1252 | fwrite($f, $sTableSql . " ;\n"); |
1199 | 1253 | } |
1200 | 1254 | |
1255 | +/** |
|
1256 | + * @param string $filename |
|
1257 | + */ |
|
1201 | 1258 | function sql_export_structure_to_file($filename, $table) |
1202 | 1259 | { |
1203 | 1260 | $f = fopen($filename, 'w'); |
@@ -1271,6 +1328,9 @@ discard block |
||
1271 | 1328 | } |
1272 | 1329 | |
1273 | 1330 | // test if a function or procedure exists |
1331 | +/** |
|
1332 | + * @param string $type |
|
1333 | + */ |
|
1274 | 1334 | function sql_fp_exists($type, $name) |
1275 | 1335 | { |
1276 | 1336 | global $opt; |
@@ -58,6 +58,9 @@ |
||
58 | 58 | // |
59 | 59 | // If $wrap is > 0, longer lines will be wrapped to new lines. |
60 | 60 | |
61 | +/** |
|
62 | + * @param integer $wrap |
|
63 | + */ |
|
61 | 64 | function html2plaintext($text, $texthtml0, $wrap) |
62 | 65 | { |
63 | 66 | global $opt, $smiley; |
@@ -106,6 +106,10 @@ |
||
106 | 106 | // throttle admin error mails; |
107 | 107 | // currently used only for SQL errors and warnings |
108 | 108 | |
109 | +/** |
|
110 | + * @param string $errortype |
|
111 | + * @param string $message |
|
112 | + */ |
|
109 | 113 | function admin_errormail($to, $errortype, $message, $headers) |
110 | 114 | { |
111 | 115 | global $opt; |
@@ -26,6 +26,9 @@ discard block |
||
26 | 26 | * Returns: if $file specified - true if OK |
27 | 27 | if $file not specified - image data |
28 | 28 | */ |
29 | +/** |
|
30 | + * @param resource $img |
|
31 | + */ |
|
29 | 32 | function imagebmp($img,$file="",$RLE=0) |
30 | 33 | { |
31 | 34 | |
@@ -463,6 +466,9 @@ discard block |
||
463 | 466 | |
464 | 467 | |
465 | 468 | |
469 | +/** |
|
470 | + * @param integer $byte |
|
471 | + */ |
|
466 | 472 | function RetBits($byte,$start,$len) |
467 | 473 | { |
468 | 474 | $bin=decbin8($byte); |
@@ -474,6 +480,10 @@ discard block |
||
474 | 480 | |
475 | 481 | |
476 | 482 | $CurrentBit=0; |
483 | +/** |
|
484 | + * @param resource $f |
|
485 | + * @param integer $count |
|
486 | + */ |
|
477 | 487 | function freadbits($f,$count) |
478 | 488 | { |
479 | 489 | global $CurrentBit,$SMode; |
@@ -505,6 +515,10 @@ discard block |
||
505 | 515 | { |
506 | 516 | return chr($n & 255).chr(($n >> 8) & 255).chr(($n >> 16) & 255).chr(($n >> 24) & 255); |
507 | 517 | } |
518 | + |
|
519 | + /** |
|
520 | + * @param integer $n |
|
521 | + */ |
|
508 | 522 | function int_to_word($n) |
509 | 523 | { |
510 | 524 | return chr($n & 255).chr(($n >> 8) & 255); |
@@ -516,6 +530,9 @@ discard block |
||
516 | 530 | return decbinx($d,8); |
517 | 531 | }; |
518 | 532 | |
533 | +/** |
|
534 | + * @param integer $n |
|
535 | + */ |
|
519 | 536 | function decbinx($d,$n) |
520 | 537 | { |
521 | 538 | $bin=decbin($d); |
@@ -36,7 +36,9 @@ discard block |
||
36 | 36 | $IsTransparent=$Transparent!=-1; |
37 | 37 | |
38 | 38 | |
39 | -if($IsTransparent) $ColorCount--; |
|
39 | +if($IsTransparent) { |
|
40 | + $ColorCount--; |
|
41 | +} |
|
40 | 42 | |
41 | 43 | if($ColorCount==0) {$ColorCount=0; $BitCount=24;}; |
42 | 44 | if(($ColorCount>0)and($ColorCount<=2)) {$ColorCount=2; $BitCount=1;}; |
@@ -49,7 +51,9 @@ discard block |
||
49 | 51 | |
50 | 52 | $Zbytek=(4-($Width/(8/$BitCount))%4)%4; |
51 | 53 | |
52 | - if($BitCount<24) $palsize=pow(2,$BitCount)*4; |
|
54 | + if($BitCount<24) { |
|
55 | + $palsize=pow(2,$BitCount)*4; |
|
56 | + } |
|
53 | 57 | |
54 | 58 | $size=(floor($Width/(8/$BitCount))+$Zbytek)*$Height+54; |
55 | 59 | $size+=$palsize; |
@@ -76,14 +80,16 @@ discard block |
||
76 | 80 | |
77 | 81 | $CC=$ColorCount; |
78 | 82 | $sl1=strlen($ret); |
79 | - if($CC==0) $CC=256; |
|
80 | - if($BitCount<24) |
|
81 | - { |
|
83 | + if($CC==0) { |
|
84 | + $CC=256; |
|
85 | + } |
|
86 | + if($BitCount<24) { |
|
82 | 87 | $ColorTotal=imagecolorstotal($img); |
83 | - if($IsTransparent) $ColorTotal--; |
|
88 | + if($IsTransparent) { |
|
89 | + $ColorTotal--; |
|
90 | + } |
|
84 | 91 | |
85 | - for($p=0;$p<$ColorTotal;$p++) |
|
86 | - { |
|
92 | + for($p=0;$p<$ColorTotal;$p++) { |
|
87 | 93 | $color=imagecolorsforindex($img,$p); |
88 | 94 | $ret.=inttobyte($color["blue"]); |
89 | 95 | $ret.=inttobyte($color["green"]); |
@@ -92,8 +98,7 @@ discard block |
||
92 | 98 | }; |
93 | 99 | |
94 | 100 | $CT=$ColorTotal; |
95 | - for($p=$ColorTotal;$p<$CC;$p++) |
|
96 | - { |
|
101 | + for($p=$ColorTotal;$p<$CC;$p++) { |
|
97 | 102 | $ret.=inttobyte(0); |
98 | 103 | $ret.=inttobyte(0); |
99 | 104 | $ret.=inttobyte(0); |
@@ -102,75 +107,63 @@ discard block |
||
102 | 107 | }; |
103 | 108 | |
104 | 109 | |
105 | -if($BitCount<=8) |
|
106 | -{ |
|
110 | +if($BitCount<=8) { |
|
107 | 111 | |
108 | - for($y=$Height-1;$y>=0;$y--) |
|
109 | - { |
|
112 | + for($y=$Height-1;$y>=0;$y--) { |
|
110 | 113 | $bWrite=""; |
111 | - for($x=0;$x<$Width;$x++) |
|
112 | - { |
|
114 | + for($x=0;$x<$Width;$x++) { |
|
113 | 115 | $color=imagecolorat($img,$x,$y); |
114 | 116 | $bWrite.=decbinx($color,$BitCount); |
115 | - if(strlen($bWrite)==8) |
|
116 | - { |
|
117 | + if(strlen($bWrite)==8) { |
|
117 | 118 | $retd.=inttobyte(bindec($bWrite)); |
118 | 119 | $bWrite=""; |
119 | 120 | }; |
120 | 121 | }; |
121 | 122 | |
122 | - if((strlen($bWrite)<8)and(strlen($bWrite)!=0)) |
|
123 | - { |
|
123 | + if((strlen($bWrite)<8)and(strlen($bWrite)!=0)) { |
|
124 | 124 | $sl=strlen($bWrite); |
125 | - for($t=0;$t<8-$sl;$t++) |
|
126 | - $sl.="0"; |
|
125 | + for($t=0;$t<8-$sl;$t++) { |
|
126 | + $sl.="0"; |
|
127 | + } |
|
127 | 128 | $retd.=inttobyte(bindec($bWrite)); |
128 | 129 | }; |
129 | - for($z=0;$z<$Zbytek;$z++) |
|
130 | - $retd.=inttobyte(0); |
|
130 | + for($z=0;$z<$Zbytek;$z++) { |
|
131 | + $retd.=inttobyte(0); |
|
132 | + } |
|
131 | 133 | }; |
132 | 134 | }; |
133 | 135 | |
134 | -if(($RLE==1)and($BitCount==8)) |
|
135 | -{ |
|
136 | - for($t=0;$t<strlen($retd);$t+=4) |
|
137 | - { |
|
138 | - if($t!=0) |
|
139 | - if(($t)%$Width==0) |
|
136 | +if(($RLE==1)and($BitCount==8)) { |
|
137 | + for($t=0;$t<strlen($retd);$t+=4) { |
|
138 | + if($t!=0) { |
|
139 | + if(($t)%$Width==0) |
|
140 | 140 | $ret.=chr(0).chr(0); |
141 | + } |
|
141 | 142 | |
142 | - if(($t+5)%$Width==0) |
|
143 | - { |
|
143 | + if(($t+5)%$Width==0) { |
|
144 | 144 | $ret.=chr(0).chr(5).substr($retd,$t,5).chr(0); |
145 | 145 | $t+=1; |
146 | 146 | } |
147 | - if(($t+6)%$Width==0) |
|
148 | - { |
|
147 | + if(($t+6)%$Width==0) { |
|
149 | 148 | $ret.=chr(0).chr(6).substr($retd,$t,6); |
150 | 149 | $t+=2; |
151 | - } |
|
152 | - else |
|
153 | - { |
|
150 | + } else { |
|
154 | 151 | $ret.=chr(0).chr(4).substr($retd,$t,4); |
155 | 152 | }; |
156 | 153 | }; |
157 | 154 | $ret.=chr(0).chr(1); |
158 | -} |
|
159 | -else |
|
160 | -{ |
|
155 | +} else { |
|
161 | 156 | $ret.=$retd; |
162 | 157 | }; |
163 | 158 | |
164 | 159 | |
165 | - if($BitCount==24) |
|
166 | - { |
|
167 | - for($z=0;$z<$Zbytek;$z++) |
|
168 | - $Dopl.=chr(0); |
|
160 | + if($BitCount==24) { |
|
161 | + for($z=0;$z<$Zbytek;$z++) { |
|
162 | + $Dopl.=chr(0); |
|
163 | + } |
|
169 | 164 | |
170 | - for($y=$Height-1;$y>=0;$y--) |
|
171 | - { |
|
172 | - for($x=0;$x<$Width;$x++) |
|
173 | - { |
|
165 | + for($y=$Height-1;$y>=0;$y--) { |
|
166 | + for($x=0;$x<$Width;$x++) { |
|
174 | 167 | $color=imagecolorsforindex($img,ImageColorAt($img,$x,$y)); |
175 | 168 | $ret.=chr($color["blue"]).chr($color["green"]).chr($color["red"]); |
176 | 169 | } |
@@ -179,15 +172,12 @@ discard block |
||
179 | 172 | |
180 | 173 | }; |
181 | 174 | |
182 | - if($file!="") |
|
183 | - { |
|
175 | + if($file!="") { |
|
184 | 176 | $r=($f=fopen($file,"w")); |
185 | 177 | $r=$r and fwrite($f,$ret); |
186 | 178 | $r=$r and fclose($f); |
187 | 179 | return $r; |
188 | - } |
|
189 | - else |
|
190 | - { |
|
180 | + } else { |
|
191 | 181 | echo $ret; |
192 | 182 | }; |
193 | 183 | }; |
@@ -211,8 +201,7 @@ discard block |
||
211 | 201 | $f=fopen($file,"r"); |
212 | 202 | $Header=fread($f,2); |
213 | 203 | |
214 | -if($Header=="BM") |
|
215 | -{ |
|
204 | +if($Header=="BM") { |
|
216 | 205 | $Size=freaddword($f); |
217 | 206 | $Reserved1=freadword($f); |
218 | 207 | $Reserved2=freadword($f); |
@@ -230,12 +219,10 @@ discard block |
||
230 | 219 | $NumberOfPalettesUsed=freaddword($f); |
231 | 220 | $NumberOfImportantColors=freaddword($f); |
232 | 221 | |
233 | -if($biBitCount<24) |
|
234 | - { |
|
222 | +if($biBitCount<24) { |
|
235 | 223 | $img=imagecreate($Width,$Height); |
236 | 224 | $Colors=pow(2,$biBitCount); |
237 | - for($p=0;$p<$Colors;$p++) |
|
238 | - { |
|
225 | + for($p=0;$p<$Colors;$p++) { |
|
239 | 226 | $B=freadbyte($f); |
240 | 227 | $G=freadbyte($f); |
241 | 228 | $R=freadbyte($f); |
@@ -246,35 +233,34 @@ discard block |
||
246 | 233 | |
247 | 234 | |
248 | 235 | |
249 | -if($RLECompression==0) |
|
250 | -{ |
|
236 | +if($RLECompression==0) { |
|
251 | 237 | $Zbytek=(4-ceil(($Width/(8/$biBitCount)))%4)%4; |
252 | 238 | |
253 | -for($y=$Height-1;$y>=0;$y--) |
|
254 | - { |
|
239 | +for($y=$Height-1;$y>=0;$y--) { |
|
255 | 240 | $CurrentBit=0; |
256 | - for($x=0;$x<$Width;$x++) |
|
257 | - { |
|
241 | + for($x=0;$x<$Width;$x++) { |
|
258 | 242 | $C=freadbits($f,$biBitCount); |
259 | 243 | imagesetpixel($img,$x,$y,$Palette[$C]); |
260 | 244 | }; |
261 | 245 | if($CurrentBit!=0) {freadbyte($f);}; |
262 | - for($g=0;$g<$Zbytek;$g++) |
|
263 | - freadbyte($f); |
|
246 | + for($g=0;$g<$Zbytek;$g++) { |
|
247 | + freadbyte($f); |
|
248 | + } |
|
264 | 249 | }; |
265 | 250 | |
266 | 251 | }; |
267 | 252 | }; |
268 | 253 | |
269 | 254 | |
270 | -if($RLECompression==1) //$BI_RLE8 |
|
255 | +if($RLECompression==1) { |
|
256 | + //$BI_RLE8 |
|
271 | 257 | { |
272 | 258 | $y=$Height; |
259 | +} |
|
273 | 260 | |
274 | 261 | $pocetb=0; |
275 | 262 | |
276 | -while(true) |
|
277 | -{ |
|
263 | +while(true) { |
|
278 | 264 | $y--; |
279 | 265 | $prefix=freadbyte($f); |
280 | 266 | $suffix=freadbyte($f); |
@@ -282,33 +268,38 @@ discard block |
||
282 | 268 | |
283 | 269 | $echoit=false; |
284 | 270 | |
285 | -if($echoit)echo "Prefix: $prefix Suffix: $suffix<BR>"; |
|
286 | -if(($prefix==0)and($suffix==1)) break; |
|
287 | -if(feof($f)) break; |
|
271 | +if($echoit) { |
|
272 | + echo "Prefix: $prefix Suffix: $suffix<BR>"; |
|
273 | +} |
|
274 | +if(($prefix==0)and($suffix==1)) { |
|
275 | + break; |
|
276 | +} |
|
277 | +if(feof($f)) { |
|
278 | + break; |
|
279 | +} |
|
288 | 280 | |
289 | -while(!(($prefix==0)and($suffix==0))) |
|
290 | -{ |
|
291 | - if($prefix==0) |
|
292 | - { |
|
281 | +while(!(($prefix==0)and($suffix==0))) { |
|
282 | + if($prefix==0) { |
|
293 | 283 | $pocet=$suffix; |
294 | 284 | $Data.=fread($f,$pocet); |
295 | 285 | $pocetb+=$pocet; |
296 | 286 | if($pocetb%2==1) {freadbyte($f); $pocetb++;}; |
297 | 287 | }; |
298 | - if($prefix>0) |
|
299 | - { |
|
288 | + if($prefix>0) { |
|
300 | 289 | $pocet=$prefix; |
301 | - for($r=0;$r<$pocet;$r++) |
|
302 | - $Data.=chr($suffix); |
|
290 | + for($r=0;$r<$pocet;$r++) { |
|
291 | + $Data.=chr($suffix); |
|
292 | + } |
|
303 | 293 | }; |
304 | 294 | $prefix=freadbyte($f); |
305 | 295 | $suffix=freadbyte($f); |
306 | 296 | $pocetb+=2; |
307 | - if($echoit) echo "Prefix: $prefix Suffix: $suffix<BR>"; |
|
308 | -}; |
|
297 | + if($echoit) { |
|
298 | + echo "Prefix: $prefix Suffix: $suffix<BR>"; |
|
299 | + } |
|
300 | + }; |
|
309 | 301 | |
310 | -for($x=0;$x<strlen($Data);$x++) |
|
311 | - { |
|
302 | +for($x=0;$x<strlen($Data);$x++) { |
|
312 | 303 | imagesetpixel($img,$x,$y,$Palette[ord($Data[$x])]); |
313 | 304 | }; |
314 | 305 | $Data=""; |
@@ -318,15 +309,16 @@ discard block |
||
318 | 309 | }; |
319 | 310 | |
320 | 311 | |
321 | -if($RLECompression==2) //$BI_RLE4 |
|
312 | +if($RLECompression==2) { |
|
313 | + //$BI_RLE4 |
|
322 | 314 | { |
323 | 315 | $y=$Height; |
316 | +} |
|
324 | 317 | $pocetb=0; |
325 | 318 | |
326 | 319 | /*while(!feof($f)) |
327 | 320 | echo freadbyte($f)."_".freadbyte($f)."<BR>";*/ |
328 | -while(true) |
|
329 | -{ |
|
321 | +while(true) { |
|
330 | 322 | //break; |
331 | 323 | $y--; |
332 | 324 | $prefix=freadbyte($f); |
@@ -335,35 +327,37 @@ discard block |
||
335 | 327 | |
336 | 328 | $echoit=false; |
337 | 329 | |
338 | -if($echoit)echo "Prefix: $prefix Suffix: $suffix<BR>"; |
|
339 | -if(($prefix==0)and($suffix==1)) break; |
|
340 | -if(feof($f)) break; |
|
330 | +if($echoit) { |
|
331 | + echo "Prefix: $prefix Suffix: $suffix<BR>"; |
|
332 | +} |
|
333 | +if(($prefix==0)and($suffix==1)) { |
|
334 | + break; |
|
335 | +} |
|
336 | +if(feof($f)) { |
|
337 | + break; |
|
338 | +} |
|
341 | 339 | |
342 | -while(!(($prefix==0)and($suffix==0))) |
|
343 | -{ |
|
344 | - if($prefix==0) |
|
345 | - { |
|
340 | +while(!(($prefix==0)and($suffix==0))) { |
|
341 | + if($prefix==0) { |
|
346 | 342 | $pocet=$suffix; |
347 | 343 | |
348 | 344 | $CurrentBit=0; |
349 | - for($h=0;$h<$pocet;$h++) |
|
350 | - $Data.=chr(freadbits($f,4)); |
|
351 | - if($CurrentBit!=0) freadbits($f,4); |
|
345 | + for($h=0;$h<$pocet;$h++) { |
|
346 | + $Data.=chr(freadbits($f,4)); |
|
347 | + } |
|
348 | + if($CurrentBit!=0) { |
|
349 | + freadbits($f,4); |
|
350 | + } |
|
352 | 351 | $pocetb+=ceil(($pocet/2)); |
353 | 352 | if($pocetb%2==1) {freadbyte($f); $pocetb++;}; |
354 | 353 | }; |
355 | - if($prefix>0) |
|
356 | - { |
|
354 | + if($prefix>0) { |
|
357 | 355 | $pocet=$prefix; |
358 | 356 | $i=0; |
359 | - for($r=0;$r<$pocet;$r++) |
|
360 | - { |
|
361 | - if($i%2==0) |
|
362 | - { |
|
357 | + for($r=0;$r<$pocet;$r++) { |
|
358 | + if($i%2==0) { |
|
363 | 359 | $Data.=chr($suffix%16); |
364 | - } |
|
365 | - else |
|
366 | - { |
|
360 | + } else { |
|
367 | 361 | $Data.=chr(floor($suffix/16)); |
368 | 362 | }; |
369 | 363 | $i++; |
@@ -372,11 +366,12 @@ discard block |
||
372 | 366 | $prefix=freadbyte($f); |
373 | 367 | $suffix=freadbyte($f); |
374 | 368 | $pocetb+=2; |
375 | - if($echoit) echo "Prefix: $prefix Suffix: $suffix<BR>"; |
|
376 | -}; |
|
369 | + if($echoit) { |
|
370 | + echo "Prefix: $prefix Suffix: $suffix<BR>"; |
|
371 | + } |
|
372 | + }; |
|
377 | 373 | |
378 | -for($x=0;$x<strlen($Data);$x++) |
|
379 | - { |
|
374 | +for($x=0;$x<strlen($Data);$x++) { |
|
380 | 375 | imagesetpixel($img,$x,$y,$Palette[ord($Data[$x])]); |
381 | 376 | }; |
382 | 377 | $Data=""; |
@@ -386,24 +381,24 @@ discard block |
||
386 | 381 | }; |
387 | 382 | |
388 | 383 | |
389 | - if($biBitCount==24) |
|
390 | -{ |
|
384 | + if($biBitCount==24) { |
|
391 | 385 | $img=imagecreatetruecolor($Width,$Height); |
392 | 386 | $Zbytek=$Width%4; |
393 | 387 | |
394 | - for($y=$Height-1;$y>=0;$y--) |
|
395 | - { |
|
396 | - for($x=0;$x<$Width;$x++) |
|
397 | - { |
|
388 | + for($y=$Height-1;$y>=0;$y--) { |
|
389 | + for($x=0;$x<$Width;$x++) { |
|
398 | 390 | $B=freadbyte($f); |
399 | 391 | $G=freadbyte($f); |
400 | 392 | $R=freadbyte($f); |
401 | 393 | $color=imagecolorexact($img,$R,$G,$B); |
402 | - if($color==-1) $color=imagecolorallocate($img,$R,$G,$B); |
|
394 | + if($color==-1) { |
|
395 | + $color=imagecolorallocate($img,$R,$G,$B); |
|
396 | + } |
|
403 | 397 | imagesetpixel($img,$x,$y,$color); |
404 | 398 | } |
405 | - for($z=0;$z<$Zbytek;$z++) |
|
406 | - freadbyte($f); |
|
399 | + for($z=0;$z<$Zbytek;$z++) { |
|
400 | + freadbyte($f); |
|
401 | + } |
|
407 | 402 | }; |
408 | 403 | }; |
409 | 404 | return $img; |
@@ -480,12 +475,9 @@ discard block |
||
480 | 475 | $Byte=freadbyte($f); |
481 | 476 | $LastCBit=$CurrentBit; |
482 | 477 | $CurrentBit+=$count; |
483 | - if($CurrentBit==8) |
|
484 | - { |
|
478 | + if($CurrentBit==8) { |
|
485 | 479 | $CurrentBit=0; |
486 | - } |
|
487 | - else |
|
488 | - { |
|
480 | + } else { |
|
489 | 481 | fseek($f,ftell($f)-1); |
490 | 482 | }; |
491 | 483 | return RetBits($Byte,$LastCBit,$count); |
@@ -494,10 +486,16 @@ discard block |
||
494 | 486 | |
495 | 487 | |
496 | 488 | function RGBToHex($Red,$Green,$Blue) |
497 | - { |
|
498 | - $hRed=dechex($Red);if(strlen($hRed)==1) $hRed="0$hRed"; |
|
499 | - $hGreen=dechex($Green);if(strlen($hGreen)==1) $hGreen="0$hGreen"; |
|
500 | - $hBlue=dechex($Blue);if(strlen($hBlue)==1) $hBlue="0$hBlue"; |
|
489 | +{ |
|
490 | + $hRed=dechex($Red);if(strlen($hRed)==1) { |
|
491 | + $hRed="0$hRed"; |
|
492 | + } |
|
493 | + $hGreen=dechex($Green);if(strlen($hGreen)==1) { |
|
494 | + $hGreen="0$hGreen"; |
|
495 | + } |
|
496 | + $hBlue=dechex($Blue);if(strlen($hBlue)==1) { |
|
497 | + $hBlue="0$hBlue"; |
|
498 | + } |
|
501 | 499 | return($hRed.$hGreen.$hBlue); |
502 | 500 | }; |
503 | 501 | |
@@ -520,8 +518,9 @@ discard block |
||
520 | 518 | { |
521 | 519 | $bin=decbin($d); |
522 | 520 | $sbin=strlen($bin); |
523 | -for($j=0;$j<$n-$sbin;$j++) |
|
521 | +for($j=0;$j<$n-$sbin;$j++) { |
|
524 | 522 | $bin="0$bin"; |
523 | +} |
|
525 | 524 | return $bin; |
526 | 525 | }; |
527 | 526 |
@@ -23,6 +23,10 @@ |
||
23 | 23 | return self::getAttrbutesListArrayInternal($cacheId, false, $firstLetterUppercase); |
24 | 24 | } |
25 | 25 | |
26 | + /** |
|
27 | + * @param boolean $bOnlySelectable |
|
28 | + * @param boolean $firstLetterUppercase |
|
29 | + */ |
|
26 | 30 | public static function getAttrbutesListArrayInternal($cacheId, $bOnlySelectable, $firstLetterUppercase) |
27 | 31 | { |
28 | 32 | global $opt; |
@@ -411,9 +411,9 @@ |
||
411 | 411 | } |
412 | 412 | |
413 | 413 | /** |
414 | - * @param $cacheId |
|
415 | - * @param $start |
|
416 | - * @param $count |
|
414 | + * @param integer $cacheId |
|
415 | + * @param integer $start |
|
416 | + * @param integer $count |
|
417 | 417 | * @param bool $deleted |
418 | 418 | * @param bool $protect_old_coords |
419 | 419 | * |