@@ -27,18 +27,15 @@ discard block |
||
27 | 27 | if ($this->params['loja'] != $lojaSession) |
28 | 28 | { |
29 | 29 | $loja = $this->params['loja']; |
30 | - } |
|
31 | - else |
|
30 | + } else |
|
32 | 31 | { |
33 | 32 | $loja = $lojaSession; |
34 | 33 | } |
35 | - } |
|
36 | - else |
|
34 | + } else |
|
37 | 35 | { |
38 | 36 | $loja = $lojaSession; |
39 | 37 | } |
40 | - } |
|
41 | - else |
|
38 | + } else |
|
42 | 39 | { |
43 | 40 | $loja = $this->params['loja']; |
44 | 41 | } |
@@ -47,8 +44,7 @@ discard block |
||
47 | 44 | { |
48 | 45 | echo 'Loja não existe'; |
49 | 46 | exit; |
50 | - } |
|
51 | - else |
|
47 | + } else |
|
52 | 48 | { |
53 | 49 | $this->loadModel('Usuario'); |
54 | 50 |
@@ -29,8 +29,9 @@ |
||
29 | 29 | |
30 | 30 | $dados['usuario_id'] = $this->instancia; |
31 | 31 | |
32 | - if (isset($dados['id'])) |
|
33 | - $this->PluggtoConfiguracoes->id = $dados['id']; |
|
32 | + if (isset($dados['id'])) { |
|
33 | + $this->PluggtoConfiguracoes->id = $dados['id']; |
|
34 | + } |
|
34 | 35 | |
35 | 36 | if (!$this->PluggtoConfiguracoes->save($dados)) |
36 | 37 | { |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | if($resposta >= 1){ |
91 | 91 | return true; |
92 | - }else{ |
|
92 | + } else{ |
|
93 | 93 | return false; |
94 | 94 | } |
95 | 95 | } |
@@ -190,8 +190,9 @@ discard block |
||
190 | 190 | |
191 | 191 | $layout_loja = $this->request->data['layout_loja']; |
192 | 192 | |
193 | - if (!empty($template['name']) && isset($template['name'])) |
|
194 | - $layout_loja = $this->uploadZipTemplate($template); |
|
193 | + if (!empty($template['name']) && isset($template['name'])) { |
|
194 | + $layout_loja = $this->uploadZipTemplate($template); |
|
195 | + } |
|
195 | 196 | |
196 | 197 | $data = array( |
197 | 198 | 'estoque_minimo' => $estoque_minimo, |
@@ -61,8 +61,7 @@ discard block |
||
61 | 61 | if ( !is_file( $this->origem ) ) |
62 | 62 | { |
63 | 63 | $this->erro = 'Erro: Arquivo de imagem não encontrado!'; |
64 | - } |
|
65 | - else |
|
64 | + } else |
|
66 | 65 | { |
67 | 66 | // dados do arquivo |
68 | 67 | $this->dadosArquivo(); |
@@ -71,8 +70,7 @@ discard block |
||
71 | 70 | if (!$this->eImagem()) |
72 | 71 | { |
73 | 72 | $this->erro = 'Erro: Arquivo '.$this->origem.' não é uma imagem!'; |
74 | - } |
|
75 | - else |
|
73 | + } else |
|
76 | 74 | { |
77 | 75 | // pega dimensões |
78 | 76 | $this->dimensoes(); |
@@ -150,8 +148,7 @@ discard block |
||
150 | 148 | if ( !in_array( $this->extensao, $this->extensoes_validas ) ) |
151 | 149 | { |
152 | 150 | return false; |
153 | - } |
|
154 | - else |
|
151 | + } else |
|
155 | 152 | { |
156 | 153 | return true; |
157 | 154 | } |
@@ -327,8 +324,7 @@ discard block |
||
327 | 324 | if ( $this->largura > $this->altura ) |
328 | 325 | { |
329 | 326 | $this->nova_altura = ( ( $this->altura * $this->nova_largura ) / $this->largura ); |
330 | - } |
|
331 | - elseif ( $this->largura <= $this->altura ) |
|
327 | + } elseif ( $this->largura <= $this->altura ) |
|
332 | 328 | { |
333 | 329 | $this->nova_largura = ( ( $this->largura * $this->nova_altura ) / $this->altura ); |
334 | 330 | } // fim do if verifica altura largura |
@@ -471,8 +467,7 @@ discard block |
||
471 | 467 | if ( $truetype === true ) |
472 | 468 | { |
473 | 469 | imagettftext( $this->img, $tamanho, 0, $x, $y, $cortexto, $fonte, $texto ); |
474 | - } |
|
475 | - else |
|
470 | + } else |
|
476 | 471 | { |
477 | 472 | imagestring( $this->img, $tamanho, $x, $y, $texto, $cortexto ); |
478 | 473 | } |
@@ -512,8 +507,7 @@ discard block |
||
512 | 507 | $this->erro = 'Arquivo de marca d\'água inválido.'; |
513 | 508 | return false; |
514 | 509 | } |
515 | - } |
|
516 | - else |
|
510 | + } else |
|
517 | 511 | { |
518 | 512 | return false; |
519 | 513 | } |
@@ -626,8 +620,7 @@ discard block |
||
626 | 620 | if ( !isset( $extensao_destino ) ) |
627 | 621 | { |
628 | 622 | $extensao_destino = $this->extensao; |
629 | - } |
|
630 | - else |
|
623 | + } else |
|
631 | 624 | { |
632 | 625 | if ( !in_array( $extensao_destino, $this->extensoes_validas ) ) |
633 | 626 | { |
@@ -644,8 +637,7 @@ discard block |
||
644 | 637 | if ( $destino ) |
645 | 638 | { |
646 | 639 | imagejpeg( $this->img, $destino, $qualidade ); |
647 | - } |
|
648 | - else |
|
640 | + } else |
|
649 | 641 | { |
650 | 642 | header( "Content-type: image/jpeg" ); |
651 | 643 | imagejpeg( $this->img, NULL, $qualidade ); |
@@ -657,8 +649,7 @@ discard block |
||
657 | 649 | if ( $destino ) |
658 | 650 | { |
659 | 651 | imagepng( $this->img, $destino ); |
660 | - } |
|
661 | - else |
|
652 | + } else |
|
662 | 653 | { |
663 | 654 | header( "Content-type: image/png" ); |
664 | 655 | imagepng( $this->img ); |
@@ -670,8 +661,7 @@ discard block |
||
670 | 661 | if ( $destino ) |
671 | 662 | { |
672 | 663 | imagegif( $this->img, $destino ); |
673 | - } |
|
674 | - else |
|
664 | + } else |
|
675 | 665 | { |
676 | 666 | header( "Content-type: image/gif" ); |
677 | 667 | imagegif( $this->img ); |
@@ -703,24 +693,32 @@ discard block |
||
703 | 693 | |
704 | 694 | function imagecreatefrombmp($filename) { |
705 | 695 | //Ouverture du fichier en mode binaire |
706 | - if (! $f1 = fopen($filename,"rb")) return FALSE; |
|
696 | + if (! $f1 = fopen($filename,"rb")) { |
|
697 | + return FALSE; |
|
698 | + } |
|
707 | 699 | |
708 | 700 | //1 : Chargement des ent?tes FICHIER |
709 | 701 | $FILE = unpack("vfile_type/Vfile_size/Vreserved/Vbitmap_offset", fread($f1,14)); |
710 | - if ($FILE['file_type'] != 19778) return FALSE; |
|
702 | + if ($FILE['file_type'] != 19778) { |
|
703 | + return FALSE; |
|
704 | + } |
|
711 | 705 | |
712 | 706 | //2 : Chargement des ent?tes BMP |
713 | 707 | $BMP = unpack('Vheader_size/Vwidth/Vheight/vplanes/vbits_per_pixel'. |
714 | 708 | '/Vcompression/Vsize_bitmap/Vhoriz_resolution'. |
715 | 709 | '/Vvert_resolution/Vcolors_used/Vcolors_important', fread($f1,40)); |
716 | 710 | $BMP['colors'] = pow(2,$BMP['bits_per_pixel']); |
717 | - if ($BMP['size_bitmap'] == 0) $BMP['size_bitmap'] = $FILE['file_size'] - $FILE['bitmap_offset']; |
|
711 | + if ($BMP['size_bitmap'] == 0) { |
|
712 | + $BMP['size_bitmap'] = $FILE['file_size'] - $FILE['bitmap_offset']; |
|
713 | + } |
|
718 | 714 | $BMP['bytes_per_pixel'] = $BMP['bits_per_pixel']/8; |
719 | 715 | $BMP['bytes_per_pixel2'] = ceil($BMP['bytes_per_pixel']); |
720 | 716 | $BMP['decal'] = ($BMP['width']*$BMP['bytes_per_pixel']/4); |
721 | 717 | $BMP['decal'] -= floor($BMP['width']*$BMP['bytes_per_pixel']/4); |
722 | 718 | $BMP['decal'] = 4-(4*$BMP['decal']); |
723 | - if ($BMP['decal'] == 4) $BMP['decal'] = 0; |
|
719 | + if ($BMP['decal'] == 4) { |
|
720 | + $BMP['decal'] = 0; |
|
721 | + } |
|
724 | 722 | |
725 | 723 | //3 : Chargement des couleurs de la palette |
726 | 724 | $PALETTE = array(); |
@@ -741,39 +739,49 @@ discard block |
||
741 | 739 | $X=0; |
742 | 740 | while ($X < $BMP['width']) |
743 | 741 | { |
744 | - if ($BMP['bits_per_pixel'] == 24) |
|
745 | - $COLOR = @unpack("V",substr($IMG,$P,3).$VIDE); |
|
746 | - elseif ($BMP['bits_per_pixel'] == 16) |
|
742 | + if ($BMP['bits_per_pixel'] == 24) { |
|
743 | + $COLOR = @unpack("V",substr($IMG,$P,3).$VIDE); |
|
744 | + } elseif ($BMP['bits_per_pixel'] == 16) |
|
747 | 745 | { |
748 | 746 | $COLOR = @unpack("n",substr($IMG,$P,2)); |
749 | 747 | $COLOR[1] = $PALETTE[$COLOR[1]+1]; |
750 | - } |
|
751 | - elseif ($BMP['bits_per_pixel'] == 8) |
|
748 | + } elseif ($BMP['bits_per_pixel'] == 8) |
|
752 | 749 | { |
753 | 750 | $COLOR = @unpack("n",$VIDE.substr($IMG,$P,1)); |
754 | 751 | $COLOR[1] = $PALETTE[$COLOR[1]+1]; |
755 | - } |
|
756 | - elseif ($BMP['bits_per_pixel'] == 4) |
|
752 | + } elseif ($BMP['bits_per_pixel'] == 4) |
|
757 | 753 | { |
758 | 754 | $COLOR = @unpack("n",$VIDE.substr($IMG,floor($P),1)); |
759 | - if (($P*2)%2 == 0) $COLOR[1] = ($COLOR[1] >> 4) ; else $COLOR[1] = ($COLOR[1] & 0x0F); |
|
755 | + if (($P*2)%2 == 0) { |
|
756 | + $COLOR[1] = ($COLOR[1] >> 4) ; |
|
757 | + } else { |
|
758 | + $COLOR[1] = ($COLOR[1] & 0x0F); |
|
759 | + } |
|
760 | 760 | $COLOR[1] = $PALETTE[$COLOR[1]+1]; |
761 | - } |
|
762 | - elseif ($BMP['bits_per_pixel'] == 1) |
|
761 | + } elseif ($BMP['bits_per_pixel'] == 1) |
|
763 | 762 | { |
764 | 763 | $COLOR = @unpack("n",$VIDE.substr($IMG,floor($P),1)); |
765 | - if (($P*8)%8 == 0) $COLOR[1] = $COLOR[1] >>7; |
|
766 | - elseif (($P*8)%8 == 1) $COLOR[1] = ($COLOR[1] & 0x40)>>6; |
|
767 | - elseif (($P*8)%8 == 2) $COLOR[1] = ($COLOR[1] & 0x20)>>5; |
|
768 | - elseif (($P*8)%8 == 3) $COLOR[1] = ($COLOR[1] & 0x10)>>4; |
|
769 | - elseif (($P*8)%8 == 4) $COLOR[1] = ($COLOR[1] & 0x8)>>3; |
|
770 | - elseif (($P*8)%8 == 5) $COLOR[1] = ($COLOR[1] & 0x4)>>2; |
|
771 | - elseif (($P*8)%8 == 6) $COLOR[1] = ($COLOR[1] & 0x2)>>1; |
|
772 | - elseif (($P*8)%8 == 7) $COLOR[1] = ($COLOR[1] & 0x1); |
|
764 | + if (($P*8)%8 == 0) { |
|
765 | + $COLOR[1] = $COLOR[1] >>7; |
|
766 | + } elseif (($P*8)%8 == 1) { |
|
767 | + $COLOR[1] = ($COLOR[1] & 0x40)>>6; |
|
768 | + } elseif (($P*8)%8 == 2) { |
|
769 | + $COLOR[1] = ($COLOR[1] & 0x20)>>5; |
|
770 | + } elseif (($P*8)%8 == 3) { |
|
771 | + $COLOR[1] = ($COLOR[1] & 0x10)>>4; |
|
772 | + } elseif (($P*8)%8 == 4) { |
|
773 | + $COLOR[1] = ($COLOR[1] & 0x8)>>3; |
|
774 | + } elseif (($P*8)%8 == 5) { |
|
775 | + $COLOR[1] = ($COLOR[1] & 0x4)>>2; |
|
776 | + } elseif (($P*8)%8 == 6) { |
|
777 | + $COLOR[1] = ($COLOR[1] & 0x2)>>1; |
|
778 | + } elseif (($P*8)%8 == 7) { |
|
779 | + $COLOR[1] = ($COLOR[1] & 0x1); |
|
780 | + } |
|
773 | 781 | $COLOR[1] = $PALETTE[$COLOR[1]+1]; |
782 | + } else { |
|
783 | + return FALSE; |
|
774 | 784 | } |
775 | - else |
|
776 | - return FALSE; |
|
777 | 785 | imagesetpixel($res,$X,$Y,$COLOR[1]); |
778 | 786 | $X++; |
779 | 787 | $P += $BMP['bytes_per_pixel']; |