phpBMS

root/trunk/phpbms/fpdf/pdf_context.php

Revision 693, 2.4 KB (checked in by brieb, 2 years ago)
  • Introduced administratively changeable settings to indvidual reports
  • Modified all reports to work with new settings system
  • Altered invoice and line item total reports to accept parameters from reportsettings: You can now bypass the grouping/column dialog by providing the infrmation administratively
  • Altered all sales order PDF reports to accept parameters from reportsettings: You can now administratively change certain aspects of the print outs, including what parts of the top of the report to show, and what to title the report
  • Altered label reports to accept parameters from reportsettings: printed data as well

as label measurements and layout are now defined by administratively

  • Altered export and tableprint reports to accept parameters from reportsettings: You can specify individual columns and from table instead of just the defaults (all fields, main table only)
  • Added var_dump-esque 'debug' function for development purposes to common functions
  • Integrated FPDI functionality with sales order PDF reports: It is now possible to use a PDF saved in the files table as a background template for your invoices (e.g. watermarks)
  • Property svn:executable set to *
Line 
1<?php
2//
3//  FPDI - Version 1.3.1
4//
5//    Copyright 2004-2009 Setasign - Jan Slabon
6//
7//  Licensed under the Apache License, Version 2.0 (the "License");
8//  you may not use this file except in compliance with the License.
9//  You may obtain a copy of the License at
10//
11//      http://www.apache.org/licenses/LICENSE-2.0
12//
13//  Unless required by applicable law or agreed to in writing, software
14//  distributed under the License is distributed on an "AS IS" BASIS,
15//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16//  See the License for the specific language governing permissions and
17//  limitations under the License.
18//
19
20class pdf_context {
21
22    /**
23     * Modi
24     *
25     * @var integer 0 = file | 1 = string
26     */
27    var $_mode = 0;
28   
29        var $file;
30        var $buffer;
31        var $offset;
32        var $length;
33
34        var $stack;
35
36        // Constructor
37
38        function pdf_context(&$f) {
39                $this->file =& $f;
40                if (is_string($this->file))
41                    $this->_mode = 1;
42                $this->reset();
43        }
44
45        // Optionally move the file
46        // pointer to a new location
47        // and reset the buffered data
48
49        function reset($pos = null, $l = 100) {
50            if ($this->_mode == 0) {
51                if (!is_null ($pos)) {
52                        fseek ($this->file, $pos);
53                }
54   
55                $this->buffer = $l > 0 ? fread($this->file, $l) : '';
56                $this->length = strlen($this->buffer);
57                if ($this->length < $l)
58                $this->increase_length($l - $this->length);
59            } else {
60                $this->buffer = $this->file;
61                $this->length = strlen($this->buffer);
62            }
63                $this->offset = 0;
64                $this->stack = array();
65        }
66
67        // Make sure that there is at least one
68        // character beyond the current offset in
69        // the buffer to prevent the tokenizer
70        // from attempting to access data that does
71        // not exist
72
73        function ensure_content() {
74                if ($this->offset >= $this->length - 1) {
75                        return $this->increase_length();
76                } else {
77                        return true;
78                }
79        }
80
81        // Forcefully read more data into the buffer
82
83        function increase_length($l=100) {
84                if ($this->_mode == 0 && feof($this->file)) {
85                        return false;
86                } else if ($this->_mode == 0) {
87                    $totalLength = $this->length + $l;
88                    do {
89                $this->buffer .= fread($this->file, $totalLength-$this->length);
90            } while ((($this->length = strlen($this->buffer)) != $totalLength) && !feof($this->file));
91                       
92                        return true;
93                } else {
94                return false;
95                }
96        }
97}
Note: See TracBrowser for help on using the browser.
phpBMS vulnerability assesment provided by Orvant Inc. Copyright © 2010 Kreotek, LLC. All Rights reserved.