phpBMS

Ticket #334: pdf.patch

File pdf.patch, 17.1 KB (added by Andreas Tangemann <a.tangemann@…>, 3 years ago)
  • fpdf/fpdf.php

     
    11621162                $this->_out('endobj'); 
    11631163        } 
    11641164        $mqr=get_magic_quotes_runtime(); 
    1165         set_magic_quotes_runtime(0); 
     1165        @set_magic_quotes_runtime(0); 
    11661166        foreach($this->FontFiles as $file=>$info) 
    11671167        { 
    11681168                //Font file embedding 
     
    12001200                $this->_putstream($font); 
    12011201                $this->_out('endobj'); 
    12021202        } 
    1203         set_magic_quotes_runtime($mqr); 
     1203        @set_magic_quotes_runtime($mqr); 
    12041204        foreach($this->fonts as $k=>$font) 
    12051205        { 
    12061206                //Font objects 
  • modules/base/report/notes_summary.php

     
    103103                $pdf->MultiCell($tempwidth-.5,.14,$therecord["content"],$border_debug,1,"L"); 
    104104                $pdf->Line($leftmargin+.25,$pdf->GetY(),$paperwidth-$rightmargin-.25,$pdf->GetY()); 
    105105                $pdf->SetY($pdf->GetY()+.25); 
     106                $filename = 'Notes_Summary_'.$therecord["id"].".pdf"; 
    106107        }// end fetch_array while loop 
    107108 
    108         $pdf->Output(); 
     109        $pdf->Output($filename, 'D'); 
    109110        exit(); 
    110111?> 
     112 No newline at end of file 
  • modules/bms/report/aritems_clientstatement.php

     
    480480 
    481481        function output($to = "screen"){ 
    482482 
    483                 $this->pdf->Output(); 
     483                $filename = 'clientstatement_'.date('Ymd').'.pdf'; 
     484                $this->pdf->output($filename, 'D'); 
    484485 
    485486        }//end method 
    486487 
  • modules/bms/report/clients_folderlabels.php

     
    8686 
    8787                return $pdf; 
    8888        } 
     89        $filename = 'Folderlabels_clients_'; 
    8990 
    9091        require("report/general_labels.php"); 
    9192?> 
     93 No newline at end of file 
  • modules/bms/report/clients_mailinglabels.php

     
    9292 
    9393                return $pdf; 
    9494        } 
     95        $filename = 'Mailinglabels_clients_'; 
    9596 
    9697        require("../../../report/general_labels.php"); 
    9798?> 
     99 No newline at end of file 
  • modules/bms/report/clients_notesummary.php

     
    161161                        $pdf->SetFont("Arial","",8); 
    162162                        $pdf->MultiCell($tempwidth-.375,.14,$therecord["content"],1,1,"L"); 
    163163                        $pdf->SetY($pdf->GetY()+.25); 
     164                        $filename = 'Client_Notes_'.$clientrecord["thename"]; 
    164165                }// end fetch_array while loop 
    165166        } 
    166167 
    167         $pdf->Output(); 
     168        $pdf->Output($filename.'.pdf', 'D'); 
    168169        exit(); 
    169170?> 
     171 No newline at end of file 
  • modules/bms/report/clients_shippinglabels.php

     
    9797                return $pdf; 
    9898        } 
    9999 
     100        $filename = 'Shippinglabels_clients_'; 
    100101        require("../../../report/general_labels.php"); 
    101102?> 
     103 No newline at end of file 
  • modules/bms/report/invoices_pdf_class.php

     
    608608                        switch($destination){ 
    609609 
    610610                                case "screen": 
    611                                         $this->pdf->Output(); 
     611                                        $this->pdf->Output($userinfo, 'D'); 
    612612                                        break; 
    613613 
    614614                                case "email": 
  • modules/bms/report/invoices_pdfinvoice.php

     
    4545        session_cache_limiter('private'); 
    4646 
    4747        //set encoding to latin1 (fpdf doesnt like utf8) 
    48         $sqlEncoding = "latin1";         
     48        $sqlEncoding = "latin1"; 
    4949        require_once("../../../include/session.php"); 
    50          
     50 
    5151        include("modules/bms/report/invoices_pdf_class.php"); 
    52          
     52 
    5353        $report = new invoicePDF($db, 'P', 'in', 'Letter'); 
    5454        $report->setupFromPrintScreen(); 
    5555        $report->generate(); 
    56         $report->output(); 
    57          
     56        $filename = 'Invoices_'.$report->invoicerecord["company"].'_'.$report->invoicerecord["id"].'.pdf'; 
     57        $report->output('screen', $filename); 
     58 
    5859}//end if 
    5960 
    6061?> 
     62 No newline at end of file 
  • modules/bms/report/invoices_pdfpackinglist.php

     
    3838*/ 
    3939 
    4040        if(!isset($_SESSION["userinfo"]["id"])){ 
    41          
     41 
    4242                //IE needs caching to be set to private in order to display PDFS 
    4343                session_cache_limiter('private'); 
    44          
     44 
    4545                //set encoding to latin1 (fpdf doesnt like utf8) 
    46                 $sqlEncoding = "latin1";         
     46                $sqlEncoding = "latin1"; 
    4747                require_once("../../../include/session.php"); 
    48          
     48 
    4949        }//end if 
    50          
     50 
    5151        if(!class_exists("invoicePDF")) 
    5252                include("invoices_pdf_class.php"); 
    53          
     53 
    5454        class  packinglistPDF extends invoicePDF{ 
    55          
     55 
    5656                var $title = "Packing List"; 
    5757                var $showShipNameInShipTo = false; 
    58                                  
     58 
    5959                function packinglistPDF($db, $orientation='P', $unit='mm', $format='Letter'){ 
    60          
     60 
    6161                        $this->invoicePDF($db, $orientation, $unit, $format); 
    62                          
     62 
    6363                }//end method 
    64          
    6564 
     65 
    6666                function initialize(){ 
    6767                        //This function will set column headings, sizes and formatting 
    6868 
    6969                        $pdf = &$this->pdf; 
    70                          
     70 
    7171                        $topinfo = array(); 
    7272                        $topinfo[] = new pdfColumn("Order ID", "id", 0.75); 
    7373                        $topinfo[] = new pdfColumn("Order Date", "orderdate", 1, "date"); 
    7474                        $topinfo[] = new pdfColumn("Client PO", "ponumber", 0); 
    75                          
     75 
    7676                        $size = 0; 
    7777                        foreach($topinfo as $column) 
    7878                                $size += $column->size; 
    79                                  
     79 
    8080                        $topinfo[2]->size = $pdf->paperwidth - $pdf->leftmargin - $pdf->rightmargin - $size; 
    8181 
    82                         $this->topinfo = $topinfo;                       
    83                          
     82                        $this->topinfo = $topinfo; 
     83 
    8484                        $lineitems = array(); 
    8585                        $lineitems[] = new pdfColumn("Product / (Part Number)", "parts", 0); 
    8686                        $lineitems[] = new pdfColumn("Prepackaged", "isprepackaged", 0.75, "boolean", "C"); 
     
    8888                        $lineitems[] = new pdfColumn("Unit Weight", "unitweight", 0.75, "real", "R"); 
    8989                        $lineitems[] = new pdfColumn("Qty", "quantity", 0.5, "real","R"); 
    9090                        $lineitems[] = new pdfColumn("Weight Ext.", "extended", 0.75, "real", "R"); 
    91                                                  
     91 
    9292                        $size = 0; 
    9393                        foreach($lineitems as $column) 
    9494                                $size += $column->size; 
    95                                  
     95 
    9696                        $lineitems[0]->size = $pdf->paperwidth - $pdf->leftmargin - $pdf->rightmargin - $size; 
    97                          
     97 
    9898                        $this->lineitems = $lineitems; 
    99                          
     99 
    100100                        $totalsinfo = array(); 
    101101                        $totalsinfo[] = new pdfColumn("Shipping Method", "shippingname", 0); 
    102102                        $totalsinfo[] = new pdfColumn("Estimated Boxes", "estimatedboxes", 1, NULL, "C"); 
    103103                        $totalsinfo[] = new pdfColumn("Total Weight", "totalweight", 1, "real", "R"); 
    104104                        $totalsinfo[] = new pdfColumn("Shipping", "shipping", 1, "currency", "R"); 
    105                                                                          
     105 
    106106                        $size = 0; 
    107107                        foreach($totalsinfo as $column) 
    108108                                $size += $column->size; 
    109                                  
     109 
    110110                        $totalsinfo[0]->size = $pdf->paperwidth - $pdf->leftmargin - $pdf->rightmargin - $size; 
    111111 
    112112                        $this->totalsinfo = $totalsinfo; 
    113113 
    114114                }//end method 
    115115 
    116                          
     116 
    117117                function _addNotes(){ 
    118                  
     118 
    119119                        $pdf = &$this->pdf; 
    120                  
     120 
    121121                        $height = 1; 
    122122                        $nextPos = $pdf->GetY() + $height + 0.125; 
    123                  
     123 
    124124                        $pdf->Rect($pdf->GetX(), $pdf->GetY(), $pdf->paperwidth - $pdf->leftmargin - $pdf->rightmargin, $height); 
    125125                        $pdf->setStyle("header"); 
    126126                        $pdf->Cell($pdf->paperwidth - $pdf->leftmargin - $pdf->rightmargin, 0.18, "Special Instructions", 1, 2, "L", 1); 
    127                                                  
     127 
    128128                        $pdf->setStyle("normal"); 
    129129                        $pdf->SetXY($pdf->GetX() + .06125, $pdf->GetY() + .06125); 
    130130                        $pdf->MultiCell($pdf->paperwidth - $pdf->leftmargin - $pdf->rightmargin - 0.125, 0.18, $this->invoicerecord["specialinstructions"]); 
    131                          
     131 
    132132                        $pdf->SetXY($pdf->leftmargin, $nextPos); 
    133                  
     133 
    134134                }//end method 
    135                  
    136                  
     135 
     136 
    137137                function _getLineItems(){ 
    138                  
     138 
    139139                        $querystatement = " 
    140140                        SELECT 
    141141                                lineitems.*, 
     
    153153                                displayorder"; 
    154154 
    155155                        $queryresult = $this->db->query($querystatement); 
    156                          
     156 
    157157                        //determine estimated total boxes 
    158158                        $this->invoicerecord["estimatedboxes"] = 0; 
    159159                        while($therecord = $this->db->fetchArray($queryresult)){ 
    160                          
     160 
    161161                                if($therecord["isprepackaged"]) 
    162162                                        $this->invoicerecord["estimatedboxes"] += $therecord["quantity"]; 
    163163                                else 
    164164                                        $this->invoicerecord["estimatedboxes"] += $therecord["quantity"] * $therecord["packagesperitem"]; 
    165                                  
     165 
    166166                        }//endwhile 
    167                          
     167 
    168168                        $this->db->seek($queryresult, 0); 
    169                          
     169 
    170170                        return $queryresult; 
    171                  
     171 
    172172                }//end method 
    173                  
     173 
    174174                function _addTotals(){ 
    175175 
    176176                        $pdf = &$this->pdf; 
    177                                                          
     177 
    178178                        $height = .5; 
    179179                        $nextPos = $pdf->GetY() + $height + 0.125; 
    180                  
     180 
    181181                        $pdf->Rect($pdf->GetX(), $pdf->GetY(), $pdf->paperwidth - $pdf->leftmargin - $pdf->rightmargin, $height); 
    182                          
     182 
    183183                        $pdf->setStyle("header"); 
    184184                        foreach($this->totalsinfo as $column) 
    185185                                $pdf->Cell($column->size, 0.18, $column->title, 1, 0, $column->align, 1); 
    186                          
     186 
    187187                        $pdf->setStyle("normal"); 
    188188                        $pdf->SetFont("Arial", "B", 10); 
    189189                        $pdf->SetXY($pdf->leftmargin, $pdf->GetY() + 0.18 + 0.0625); 
    190                          
     190 
    191191                        foreach($this->totalsinfo as $column){ 
    192                          
     192 
    193193                                if($column->format != "") 
    194194                                        $value = formatVariable($this->invoicerecord[$column->fieldname], $column->format); 
    195195                                else 
    196                                         $value = $this->invoicerecord[$column->fieldname];                               
    197                          
     196                                        $value = $this->invoicerecord[$column->fieldname]; 
     197 
    198198                                $pdf->Cell($column->size, 0.18, $value, $pdf->borderDebug, 0, $column->align); 
    199199 
    200200                        }//end foreach 
    201                                          
     201 
    202202                }//end method 
    203203 
    204204        }//end class 
     
    207207        //PROCESSING 
    208208        //============================================================================= 
    209209        if(!isset($noOutput)){ 
    210                          
     210 
    211211                $report = new packinglistPDF($db, 'P', 'in', 'Letter'); 
    212                  
     212 
    213213                $report->setupFromPrintScreen(); 
    214214                $report->generate(); 
    215                 $report->output(); 
    216                  
     215                $filename = 'Packing_List_'.$report->invoicerecord["company"].'_'.$report->invoicerecord["id"].'.pdf'; 
     216                $report->output('screen', $filename); 
     217 
    217218        }//end if 
    218219?> 
     220 No newline at end of file 
  • modules/bms/report/invoices_pdfquote.php

     
    4242        session_cache_limiter('private'); 
    4343 
    4444        //set encoding to latin1 (fpdf doesnt like utf8) 
    45         $sqlEncoding = "latin1";         
     45        $sqlEncoding = "latin1"; 
    4646        require_once("../../../include/session.php"); 
    4747 
    4848}//end if 
     
    5757        function quotePDF($db, $orientation='P', $unit='mm', $format='Letter'){ 
    5858 
    5959                $this->invoicePDF($db, $orientation, $unit, $format); 
    60                  
     60 
    6161        }//end method 
    62          
     62 
    6363        function initialize(){ 
    6464                parent::initialize(); 
    65                  
     65 
    6666                unset($this->totalsinfo[5]); 
    67                                  
     67 
    6868        }//end method 
    6969 
    7070}//end class 
     
    7272//PROCESSING 
    7373//============================================================================= 
    7474if(!isset($noOutput)){ 
    75                  
     75 
    7676        $report = new quotePDF($db, 'P', 'in', 'Letter'); 
    7777        $report->showShipNameInShipTo = false; 
    78          
     78 
    7979        $report->setupFromPrintScreen(); 
    8080        $report->generate(); 
    81         $report->output(); 
    82          
     81        $filename = 'Quote_'.$report->invoicerecord["company"].'_'.$report->invoicerecord["id"].'.pdf'; 
     82        $report->output('screen', $filename); 
     83 
    8384}//end if 
    8485 
    8586 
  • modules/bms/report/invoices_pdfworkorder.php

     
    3737 +-------------------------------------------------------------------------+ 
    3838*/ 
    3939        if(!isset($_SESSION["userinfo"]["id"])){ 
    40          
     40 
    4141                //IE needs caching to be set to private in order to display PDFS 
    4242                session_cache_limiter('private'); 
    4343 
    4444                //set encoding to latin1 (fpdf doesnt like utf8) 
    45                 $sqlEncoding = "latin1";         
     45                $sqlEncoding = "latin1"; 
    4646                require_once("../../../include/session.php"); 
    47          
     47 
    4848        }//end if 
    49          
     49 
    5050        if(!class_exists("invoicePDF")) 
    5151                include("invoices_pdf_class.php"); 
    52          
     52 
    5353        class  workorderPDF extends invoicePDF{ 
    54          
     54 
    5555                var $title = "Work Order"; 
    5656                var $lineitemBoxHeight = 3.75; 
    57                  
     57 
    5858                function workorderPDF($db, $orientation='P', $unit='mm', $format='Letter'){ 
    59          
     59 
    6060                        $this->invoicePDF($db, $orientation, $unit, $format); 
    61                          
     61 
    6262                }//end method 
    63          
    64          
     63 
     64 
    6565                function _addNotes(){ 
    66                  
     66 
    6767                        $pdf = &$this->pdf; 
    68                  
     68 
    6969                        $height = 1; 
    7070                        $nextPos = $pdf->GetY() + $height + 0.125; 
    71                  
     71 
    7272                        $pdf->Rect($pdf->GetX(), $pdf->GetY(), $pdf->paperwidth - $pdf->leftmargin - $pdf->rightmargin, $height); 
    7373                        $pdf->setStyle("header"); 
    7474                        $pdf->Cell($pdf->paperwidth - $pdf->leftmargin - $pdf->rightmargin, 0.18, "Special Instructions", 1, 2, "L", 1); 
    75                                                  
     75 
    7676                        $pdf->setStyle("normal"); 
    7777                        $pdf->SetXY($pdf->GetX() + .06125, $pdf->GetY() + .06125); 
    7878                        $pdf->MultiCell($pdf->paperwidth - $pdf->leftmargin - $pdf->rightmargin - 0.125, 0.18, $this->invoicerecord["specialinstructions"]); 
    79                          
     79 
    8080                        $pdf->SetXY($pdf->leftmargin, $nextPos); 
    81                  
     81 
    8282                }//end method 
    83                  
     83 
    8484                function _addPaymentDetails(){ 
    8585 
    8686                        $pdf = &$this->pdf; 
     
    8989                        $columns[] = new pdfColumn("Payment Method", "paymentname", 0); 
    9090 
    9191                        switch($this->invoicerecord["paymenttype"]){ 
    92                          
     92 
    9393                                case "draft": 
    9494                                        $columns[0]->size = 1.5; 
    9595                                        $columns[] = new pdfColumn("Check Number", "checkno", 1); 
     
    101101                                        $columns[] = new pdfColumn("Number", "ccnumber", 1.5); 
    102102                                        $columns[] = new pdfColumn("Exp.", "ccexpiration", 1); 
    103103                                        $columns[] = new pdfColumn("Verification/Pin", "ccverification", 1); 
    104                                         break;                                   
    105                          
     104                                        break; 
     105 
    106106                        }//end switch 
    107                                                  
     107 
    108108                        $size = 0; 
    109109                        foreach($columns as $column) 
    110110                                $size += $column->size; 
    111                                                          
     111 
    112112                        $i = count($columns) -1; 
    113                                  
     113 
    114114                        $columns[$i]->size += $pdf->paperwidth - $pdf->leftmargin - $pdf->rightmargin - $size; 
    115                          
     115 
    116116                        $height = 0.5; 
    117117                        $nextPos = $pdf->GetY() + $height + 0.125; 
    118                  
     118 
    119119                        $pdf->Rect($pdf->GetX(), $pdf->GetY(), $pdf->paperwidth - $pdf->leftmargin - $pdf->rightmargin, $height); 
    120                          
     120 
    121121                        $pdf->setStyle("header"); 
    122122 
    123123                        foreach($columns as $column) 
    124124                                $pdf->Cell($column->size, 0.18, $column->title, 1, 0, $column->align, 1); 
    125                                  
     125 
    126126                        $pdf->SetXY($pdf->leftmargin, $pdf->GetY() + 0.18 + 0.0625); 
    127                          
     127 
    128128                        $pdf->setStyle("normal"); 
    129129                        $pdf->SetFont("Arial", "B", 10); 
    130130                        foreach($columns as $column) 
    131131                                $pdf->Cell($column->size, 0.18, $this->invoicerecord[$column->fieldname], $pdf->borderDebug, 0, $column->align); 
    132132 
    133133                }//end method 
    134                  
     134 
    135135        }//end class 
    136136 
    137137 
    138138//PROCESSING 
    139139//============================================================================= 
    140140if(!isset($noOutput)){ 
    141                  
     141 
    142142        $report = new workorderPDF($db, 'P', 'in', 'Letter'); 
    143          
     143 
    144144        $report->setupFromPrintScreen(); 
    145145        $report->generate(); 
    146         $report->output(); 
    147          
     146        $filename = 'Work_Order'.$report->invoicerecord["company"].'_'.$report->invoicerecord["id"].'.pdf'; 
     147        $report->output('screen', $filename); 
     148 
    148149}//end if 
    149150 
    150151?> 
  • modules/bms/report/invoices_shippinglabels.php

     
    110110 
    111111                return $pdf; 
    112112        } 
    113  
     113        $filename = 'Shippinglabels_invoice_'; 
    114114        session_cache_limiter('private'); 
    115115        require_once("../../../include/session.php"); 
    116116        require_once("../../../fpdf/fpdf.php"); 
  • modules/bms/report/receipts_pdf.php

     
    631631                        switch($destination){ 
    632632 
    633633                                case "screen": 
    634                                         $this->pdf->Output(); 
     634                                        $this->pdf->Output($userinfo, 'D'); 
    635635                                        break; 
    636636 
    637637                                case "email": 
     
    702702        $report = new receiptPDF($db, 'P', 'in', 'Letter'); 
    703703        $report->setupFromPrintScreen(); 
    704704        $report->generate(); 
    705         $report->output(); 
     705        $filename = 'Receipts_'.$report->receiptrecord["company"].'_'.$report->receiptrecord["id"].'.pdf'; 
     706        $report->output('screen', $filename); 
    706707 
    707708}//end if 
    708709 
  • report/general_labels.php

     
    115115 
    116116                        $they+=$labelheight; 
    117117                        $rowcount++; 
     118                        $filename .=$therecord["company"].'.pdf'; 
    118119                }// end fetch_array while loop 
    119120 
    120                 $pdf->Output(); 
     121                $pdf->Output($filename, 'D'); 
    121122                exit(); 
    122123        } else { 
    123124 
     
    138139                </p> 
    139140                <p align="right"> 
    140141                        <input name="command" type="submit" class="Buttons" id="print" value="print" /> 
    141                         <input name="cancel" type="button" class="Buttons" id="cancel" value="canel" onclick="window.close();" /> 
     142                        <input name="cancel" type="button" class="Buttons" id="cancel" value="cancel" onclick="window.close();" /> 
    142143                </p> 
    143144</div> 
    144145</form> 
phpBMS vulnerability assesment provided by Orvant Inc. Copyright © 2010 Kreotek, LLC. All Rights reserved.