Improved entropy for report file urls.
[fa-stable.git] / reporting / includes / pdf_report.inc
index c8bd32550b1204d028fdf0305cf1ff34b2af6c35..dd0ae91826016175edd6b3d048f93bc2f1c5bbcc 100644 (file)
@@ -376,8 +376,6 @@ class FrontReport extends Cpdf
        */
        function SetCommonData($myrow, $branch, $sales_order, $bankaccount, $doctype, $contacts)
        {
-//             $this->formData = array_merge($myrow, $branch, $sales_order, 
-//                     $bank_account, array('doctype' => $doctype));
 
                $this->formData = array();
                $datnames = array( 
@@ -471,16 +469,6 @@ class FrontReport extends Cpdf
                $footerCol = $this->leftMargin + PAGE_NUM_WIDTH; 
                $footerRow = $this->bottomMargin - FOOTER_MARGIN;
 
-               // Calling this function generates a new PDF page after the first instance
-//             {
-//                     // TODO: experimenting with line drawing to highlight current period
-//                     $this->SetLineWidth(1);
-//                     $this->LineTo($this->cols[3], 33, $this->cols[3], 534);
-//                     $this->LineTo($this->cols[4], 33, $this->cols[4], 534);
-//                     $this->SetLineWidth(0.1);
-                       
-//                     $this->newPage();
-//             }
                $this->row = $this->pageHeight - $this->topMargin;
 
                // Set the color of dividing lines we'll draw
@@ -969,10 +957,7 @@ class FrontReport extends Cpdf
                        }
                        // do not use standard filenames or your sensitive company data 
                        // are world readable
-                       if ($email == 1)
-                               $fname = $dir.'/'.$this->filename;
-                       else    
-                               $fname = $dir.'/'.uniqid('').'.pdf';
+                       $fname = $dir.'/'.random_id().'.pdf';
                        $this->Output($fname, 'F');
 
                        if ($email == 1)
@@ -1026,7 +1011,7 @@ class FrontReport extends Cpdf
                                        $mail->to($to); $try++;
                                        $mail->subject($subject);
                                        $mail->text($msg . $sender);
-                                       $mail->attachment($fname);
+                                       $mail->attachment($fname, $this->filename);
                                        $emails .= " " . $contact['email'];
                                        if ($mail->send()) $sent++;
                                        } // foreach contact
@@ -1059,7 +1044,6 @@ class FrontReport extends Cpdf
                                                header('Expires: 0');
                                                header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
                                                header('Pragma: public');
-//                                             $this->Stream(basename($fname));
                                                $this->Stream($this->filename);
                                        }
                                } else { // send report to network printer