@@ -11,158 +11,158 @@ |
||
11 | 11 | |
12 | 12 | class HTML2PDF_exception extends exception |
13 | 13 | { |
14 | - protected $_tag = null; |
|
15 | - protected $_html = null; |
|
16 | - protected $_other = null; |
|
17 | - protected $_image = null; |
|
18 | - protected $_messageHtml = ''; |
|
19 | - |
|
20 | - /** |
|
21 | - * generate a HTML2PDF exception |
|
22 | - * |
|
23 | - * @param int $err error number |
|
24 | - * @param mixed $other additionnal informations |
|
25 | - * @return string $html optionnal code HTML associated to the error |
|
26 | - */ |
|
27 | - final public function __construct($err = 0, $other = null, $html = '') |
|
28 | - { |
|
29 | - // read the error |
|
30 | - switch($err) |
|
31 | - { |
|
32 | - case 1: // Unsupported tag |
|
33 | - $msg = (HTML2PDF_locale::get('err01')); |
|
34 | - $msg = str_replace('[[OTHER]]', $other, $msg); |
|
35 | - $this->_tag = $other; |
|
36 | - break; |
|
37 | - |
|
38 | - case 2: // too long sentence |
|
39 | - $msg = (HTML2PDF_locale::get('err02')); |
|
40 | - $msg = str_replace('[[OTHER_0]]', $other[0], $msg); |
|
41 | - $msg = str_replace('[[OTHER_1]]', $other[1], $msg); |
|
42 | - $msg = str_replace('[[OTHER_2]]', $other[2], $msg); |
|
43 | - break; |
|
44 | - |
|
45 | - case 3: // closing tag in excess |
|
46 | - $msg = (HTML2PDF_locale::get('err03')); |
|
47 | - $msg = str_replace('[[OTHER]]', $other, $msg); |
|
48 | - $this->_tag = $other; |
|
49 | - break; |
|
50 | - |
|
51 | - case 4: // tags closed in the wrong order |
|
52 | - $msg = (HTML2PDF_locale::get('err04')); |
|
53 | - $msg = str_replace('[[OTHER]]', print_r($other, true), $msg); |
|
54 | - break; |
|
55 | - |
|
56 | - case 5: // unclosed tag |
|
57 | - $msg = (HTML2PDF_locale::get('err05')); |
|
58 | - $msg = str_replace('[[OTHER]]', print_r($other, true), $msg); |
|
59 | - break; |
|
60 | - |
|
61 | - case 6: // image can not be loaded |
|
62 | - $msg = (HTML2PDF_locale::get('err06')); |
|
63 | - $msg = str_replace('[[OTHER]]', $other, $msg); |
|
64 | - $this->_image = $other; |
|
65 | - break; |
|
66 | - |
|
67 | - case 7: // too big TD content |
|
68 | - $msg = (HTML2PDF_locale::get('err07')); |
|
69 | - break; |
|
70 | - |
|
71 | - case 8: // SVG tag not in DRAW tag |
|
72 | - $msg = (HTML2PDF_locale::get('err08')); |
|
73 | - $msg = str_replace('[[OTHER]]', $other, $msg); |
|
74 | - $this->_tag = $other; |
|
75 | - break; |
|
76 | - |
|
77 | - case 9: // deprecated |
|
78 | - $msg = (HTML2PDF_locale::get('err09')); |
|
79 | - $msg = str_replace('[[OTHER_0]]', $other[0], $msg); |
|
80 | - $msg = str_replace('[[OTHER_1]]', $other[1], $msg); |
|
81 | - $this->_tag = $other[0]; |
|
82 | - break; |
|
83 | - |
|
84 | - case 0: // specific error |
|
85 | - default: |
|
86 | - $msg = $other; |
|
87 | - break; |
|
88 | - } |
|
89 | - |
|
90 | - // create the HTML message |
|
91 | - $this->_messageHtml = '<span style="color: #AA0000; font-weight: bold;">'.HTML2PDF_locale::get('txt01', 'error: ').$err.'</span><br>'; |
|
92 | - $this->_messageHtml.= HTML2PDF_locale::get('txt02', 'file:').' '.$this->file.'<br>'; |
|
93 | - $this->_messageHtml.= HTML2PDF_locale::get('txt03', 'line:').' '.$this->line.'<br>'; |
|
94 | - $this->_messageHtml.= '<br>'; |
|
95 | - $this->_messageHtml.= $msg; |
|
96 | - |
|
97 | - // create the text message |
|
98 | - $msg = HTML2PDF_locale::get('txt01', 'error: ').$err.' : '.strip_tags($msg); |
|
99 | - |
|
100 | - // add the optionnal html content |
|
101 | - if ($html) { |
|
102 | - $this->_messageHtml.= "<br><br>HTML : ...".trim(htmlentities($html)).'...'; |
|
103 | - $this->_html = $html; |
|
104 | - $msg.= ' HTML : ...'.trim($html).'...'; |
|
105 | - } |
|
106 | - |
|
107 | - // save the other informations |
|
108 | - $this->_other = $other; |
|
109 | - |
|
110 | - // construct the exception |
|
111 | - parent::__construct($msg, $err); |
|
112 | - } |
|
113 | - |
|
114 | - /** |
|
115 | - * get the message as string |
|
116 | - * |
|
117 | - * @access public |
|
118 | - * @return string $messageHtml |
|
119 | - */ |
|
120 | - public function __toString() |
|
121 | - { |
|
122 | - return $this->_messageHtml; |
|
123 | - } |
|
124 | - |
|
125 | - /** |
|
126 | - * get the html tag name |
|
127 | - * |
|
128 | - * @access public |
|
129 | - * @return string $tagName |
|
130 | - */ |
|
131 | - public function getTAG() |
|
132 | - { |
|
133 | - return $this->_tag; |
|
134 | - } |
|
135 | - |
|
136 | - /** |
|
137 | - * get the optional html code |
|
138 | - * |
|
139 | - * @access public |
|
140 | - * @return string $html |
|
141 | - */ |
|
142 | - public function getHTML() |
|
143 | - { |
|
144 | - return $this->_html; |
|
145 | - } |
|
146 | - |
|
147 | - /** |
|
148 | - * get the optional other informations |
|
149 | - * |
|
150 | - * @access public |
|
151 | - * @return mixed $other |
|
152 | - */ |
|
153 | - public function getOTHER() |
|
154 | - { |
|
155 | - return $this->_other; |
|
156 | - } |
|
157 | - |
|
158 | - /** |
|
159 | - * get the image source |
|
160 | - * |
|
161 | - * @access public |
|
162 | - * @return string $imageSrc |
|
163 | - */ |
|
164 | - public function getIMAGE() |
|
165 | - { |
|
166 | - return $this->_image; |
|
167 | - } |
|
14 | + protected $_tag = null; |
|
15 | + protected $_html = null; |
|
16 | + protected $_other = null; |
|
17 | + protected $_image = null; |
|
18 | + protected $_messageHtml = ''; |
|
19 | + |
|
20 | + /** |
|
21 | + * generate a HTML2PDF exception |
|
22 | + * |
|
23 | + * @param int $err error number |
|
24 | + * @param mixed $other additionnal informations |
|
25 | + * @return string $html optionnal code HTML associated to the error |
|
26 | + */ |
|
27 | + final public function __construct($err = 0, $other = null, $html = '') |
|
28 | + { |
|
29 | + // read the error |
|
30 | + switch($err) |
|
31 | + { |
|
32 | + case 1: // Unsupported tag |
|
33 | + $msg = (HTML2PDF_locale::get('err01')); |
|
34 | + $msg = str_replace('[[OTHER]]', $other, $msg); |
|
35 | + $this->_tag = $other; |
|
36 | + break; |
|
37 | + |
|
38 | + case 2: // too long sentence |
|
39 | + $msg = (HTML2PDF_locale::get('err02')); |
|
40 | + $msg = str_replace('[[OTHER_0]]', $other[0], $msg); |
|
41 | + $msg = str_replace('[[OTHER_1]]', $other[1], $msg); |
|
42 | + $msg = str_replace('[[OTHER_2]]', $other[2], $msg); |
|
43 | + break; |
|
44 | + |
|
45 | + case 3: // closing tag in excess |
|
46 | + $msg = (HTML2PDF_locale::get('err03')); |
|
47 | + $msg = str_replace('[[OTHER]]', $other, $msg); |
|
48 | + $this->_tag = $other; |
|
49 | + break; |
|
50 | + |
|
51 | + case 4: // tags closed in the wrong order |
|
52 | + $msg = (HTML2PDF_locale::get('err04')); |
|
53 | + $msg = str_replace('[[OTHER]]', print_r($other, true), $msg); |
|
54 | + break; |
|
55 | + |
|
56 | + case 5: // unclosed tag |
|
57 | + $msg = (HTML2PDF_locale::get('err05')); |
|
58 | + $msg = str_replace('[[OTHER]]', print_r($other, true), $msg); |
|
59 | + break; |
|
60 | + |
|
61 | + case 6: // image can not be loaded |
|
62 | + $msg = (HTML2PDF_locale::get('err06')); |
|
63 | + $msg = str_replace('[[OTHER]]', $other, $msg); |
|
64 | + $this->_image = $other; |
|
65 | + break; |
|
66 | + |
|
67 | + case 7: // too big TD content |
|
68 | + $msg = (HTML2PDF_locale::get('err07')); |
|
69 | + break; |
|
70 | + |
|
71 | + case 8: // SVG tag not in DRAW tag |
|
72 | + $msg = (HTML2PDF_locale::get('err08')); |
|
73 | + $msg = str_replace('[[OTHER]]', $other, $msg); |
|
74 | + $this->_tag = $other; |
|
75 | + break; |
|
76 | + |
|
77 | + case 9: // deprecated |
|
78 | + $msg = (HTML2PDF_locale::get('err09')); |
|
79 | + $msg = str_replace('[[OTHER_0]]', $other[0], $msg); |
|
80 | + $msg = str_replace('[[OTHER_1]]', $other[1], $msg); |
|
81 | + $this->_tag = $other[0]; |
|
82 | + break; |
|
83 | + |
|
84 | + case 0: // specific error |
|
85 | + default: |
|
86 | + $msg = $other; |
|
87 | + break; |
|
88 | + } |
|
89 | + |
|
90 | + // create the HTML message |
|
91 | + $this->_messageHtml = '<span style="color: #AA0000; font-weight: bold;">'.HTML2PDF_locale::get('txt01', 'error: ').$err.'</span><br>'; |
|
92 | + $this->_messageHtml.= HTML2PDF_locale::get('txt02', 'file:').' '.$this->file.'<br>'; |
|
93 | + $this->_messageHtml.= HTML2PDF_locale::get('txt03', 'line:').' '.$this->line.'<br>'; |
|
94 | + $this->_messageHtml.= '<br>'; |
|
95 | + $this->_messageHtml.= $msg; |
|
96 | + |
|
97 | + // create the text message |
|
98 | + $msg = HTML2PDF_locale::get('txt01', 'error: ').$err.' : '.strip_tags($msg); |
|
99 | + |
|
100 | + // add the optionnal html content |
|
101 | + if ($html) { |
|
102 | + $this->_messageHtml.= "<br><br>HTML : ...".trim(htmlentities($html)).'...'; |
|
103 | + $this->_html = $html; |
|
104 | + $msg.= ' HTML : ...'.trim($html).'...'; |
|
105 | + } |
|
106 | + |
|
107 | + // save the other informations |
|
108 | + $this->_other = $other; |
|
109 | + |
|
110 | + // construct the exception |
|
111 | + parent::__construct($msg, $err); |
|
112 | + } |
|
113 | + |
|
114 | + /** |
|
115 | + * get the message as string |
|
116 | + * |
|
117 | + * @access public |
|
118 | + * @return string $messageHtml |
|
119 | + */ |
|
120 | + public function __toString() |
|
121 | + { |
|
122 | + return $this->_messageHtml; |
|
123 | + } |
|
124 | + |
|
125 | + /** |
|
126 | + * get the html tag name |
|
127 | + * |
|
128 | + * @access public |
|
129 | + * @return string $tagName |
|
130 | + */ |
|
131 | + public function getTAG() |
|
132 | + { |
|
133 | + return $this->_tag; |
|
134 | + } |
|
135 | + |
|
136 | + /** |
|
137 | + * get the optional html code |
|
138 | + * |
|
139 | + * @access public |
|
140 | + * @return string $html |
|
141 | + */ |
|
142 | + public function getHTML() |
|
143 | + { |
|
144 | + return $this->_html; |
|
145 | + } |
|
146 | + |
|
147 | + /** |
|
148 | + * get the optional other informations |
|
149 | + * |
|
150 | + * @access public |
|
151 | + * @return mixed $other |
|
152 | + */ |
|
153 | + public function getOTHER() |
|
154 | + { |
|
155 | + return $this->_other; |
|
156 | + } |
|
157 | + |
|
158 | + /** |
|
159 | + * get the image source |
|
160 | + * |
|
161 | + * @access public |
|
162 | + * @return string $imageSrc |
|
163 | + */ |
|
164 | + public function getIMAGE() |
|
165 | + { |
|
166 | + return $this->_image; |
|
167 | + } |
|
168 | 168 | } |
169 | 169 | \ No newline at end of file |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | final public function __construct($err = 0, $other = null, $html = '') |
28 | 28 | { |
29 | 29 | // read the error |
30 | - switch($err) |
|
30 | + switch ($err) |
|
31 | 31 | { |
32 | 32 | case 1: // Unsupported tag |
33 | 33 | $msg = (HTML2PDF_locale::get('err01')); |
@@ -89,19 +89,19 @@ discard block |
||
89 | 89 | |
90 | 90 | // create the HTML message |
91 | 91 | $this->_messageHtml = '<span style="color: #AA0000; font-weight: bold;">'.HTML2PDF_locale::get('txt01', 'error: ').$err.'</span><br>'; |
92 | - $this->_messageHtml.= HTML2PDF_locale::get('txt02', 'file:').' '.$this->file.'<br>'; |
|
93 | - $this->_messageHtml.= HTML2PDF_locale::get('txt03', 'line:').' '.$this->line.'<br>'; |
|
94 | - $this->_messageHtml.= '<br>'; |
|
95 | - $this->_messageHtml.= $msg; |
|
92 | + $this->_messageHtml .= HTML2PDF_locale::get('txt02', 'file:').' '.$this->file.'<br>'; |
|
93 | + $this->_messageHtml .= HTML2PDF_locale::get('txt03', 'line:').' '.$this->line.'<br>'; |
|
94 | + $this->_messageHtml .= '<br>'; |
|
95 | + $this->_messageHtml .= $msg; |
|
96 | 96 | |
97 | 97 | // create the text message |
98 | 98 | $msg = HTML2PDF_locale::get('txt01', 'error: ').$err.' : '.strip_tags($msg); |
99 | 99 | |
100 | 100 | // add the optionnal html content |
101 | 101 | if ($html) { |
102 | - $this->_messageHtml.= "<br><br>HTML : ...".trim(htmlentities($html)).'...'; |
|
102 | + $this->_messageHtml .= "<br><br>HTML : ...".trim(htmlentities($html)).'...'; |
|
103 | 103 | $this->_html = $html; |
104 | - $msg.= ' HTML : ...'.trim($html).'...'; |
|
104 | + $msg .= ' HTML : ...'.trim($html).'...'; |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | // save the other informations |
@@ -34,212 +34,212 @@ |
||
34 | 34 | |
35 | 35 | if (!defined('K_TCPDF_EXTERNAL_CONFIG')) { |
36 | 36 | |
37 | - define('K_TCPDF_EXTERNAL_CONFIG', true); |
|
38 | - |
|
39 | - // DOCUMENT_ROOT fix for IIS Webserver |
|
40 | - if ((!isset($_SERVER['DOCUMENT_ROOT'])) OR (empty($_SERVER['DOCUMENT_ROOT']))) { |
|
41 | - if (isset($_SERVER['SCRIPT_FILENAME'])) { |
|
42 | - $_SERVER['DOCUMENT_ROOT'] = str_replace( |
|
43 | - '\\', |
|
44 | - '/', |
|
45 | - substr($_SERVER['SCRIPT_FILENAME'], 0, 0-strlen($_SERVER['PHP_SELF'])) |
|
46 | - ); |
|
47 | - } elseif (isset($_SERVER['PATH_TRANSLATED'])) { |
|
48 | - $_SERVER['DOCUMENT_ROOT'] = str_replace( |
|
49 | - '\\', |
|
50 | - '/', |
|
51 | - substr(str_replace('\\\\', '\\', $_SERVER['PATH_TRANSLATED']), 0, 0-strlen($_SERVER['PHP_SELF'])) |
|
52 | - ); |
|
53 | - } else { |
|
54 | - // define here your DOCUMENT_ROOT path if the previous fails |
|
55 | - $_SERVER['DOCUMENT_ROOT'] = '/var/www'; |
|
56 | - } |
|
57 | - } |
|
58 | - |
|
59 | - // Automatic calculation for the following K_PATH_MAIN constant |
|
60 | - $kPathMain = str_replace('\\', '/', dirname(__FILE__)); |
|
61 | - $kPathMain = dirname($kPathMain).'/'; // remove the current directory |
|
62 | - $kPathMain.= '_tcpdf_'.HTML2PDF_USED_TCPDF_VERSION.'/'; |
|
63 | - define('K_PATH_MAIN', $kPathMain); |
|
64 | - |
|
65 | - // Automatic calculation for the following K_PATH_URL constant |
|
66 | - if (isset($_SERVER['HTTP_HOST']) AND (!empty($_SERVER['HTTP_HOST']))) { |
|
67 | - if (isset($_SERVER['HTTPS']) AND (!empty($_SERVER['HTTPS'])) AND strtolower($_SERVER['HTTPS'])!='off') { |
|
68 | - $kPathUrl = 'https://'; |
|
69 | - } else { |
|
70 | - $kPathUrl = 'http://'; |
|
71 | - } |
|
72 | - $kPathUrl .= $_SERVER['HTTP_HOST']; |
|
73 | - $kPathUrl .= str_replace('\\', '/', substr(K_PATH_MAIN, (strlen($_SERVER['DOCUMENT_ROOT']) - 1))); |
|
74 | - } |
|
75 | - |
|
76 | - /** |
|
77 | - * URL path to tcpdf installation folder (http://localhost/tcpdf/). |
|
78 | - * By default it is automatically calculated but you can also set it as a fixed string to improve performances. |
|
79 | - */ |
|
80 | - define('K_PATH_URL', $kPathUrl); |
|
81 | - |
|
82 | - /** |
|
83 | - * path for PDF fonts |
|
84 | - * use K_PATH_MAIN.'fonts/old/' for old non-UTF8 fonts |
|
85 | - */ |
|
86 | - define('K_PATH_FONTS', K_PATH_MAIN.'fonts/'); |
|
87 | - |
|
88 | - /** |
|
89 | - * cache directory for temporary files (full path) |
|
90 | - */ |
|
91 | - define('K_PATH_CACHE', K_PATH_MAIN.'cache/'); |
|
92 | - |
|
93 | - /** |
|
94 | - * cache directory for temporary files (url path) |
|
95 | - */ |
|
96 | - define('K_PATH_URL_CACHE', K_PATH_URL.'cache/'); |
|
97 | - |
|
98 | - /** |
|
99 | - *images directory |
|
100 | - */ |
|
101 | - define('K_PATH_IMAGES', K_PATH_MAIN.'images/'); |
|
102 | - |
|
103 | - /** |
|
104 | - * blank image |
|
105 | - */ |
|
106 | - define('K_BLANK_IMAGE', K_PATH_IMAGES.'_blank.png'); |
|
107 | - |
|
108 | - /** |
|
109 | - * page format |
|
110 | - */ |
|
111 | - define('PDF_PAGE_FORMAT', 'A4'); |
|
112 | - |
|
113 | - /** |
|
114 | - * page orientation (P=portrait, L=landscape) |
|
115 | - */ |
|
116 | - define('PDF_PAGE_ORIENTATION', 'P'); |
|
117 | - |
|
118 | - /** |
|
119 | - * document creator |
|
120 | - */ |
|
121 | - define('PDF_CREATOR', 'HTML2PDF - TCPDF'); |
|
122 | - |
|
123 | - /** |
|
124 | - * document author |
|
125 | - */ |
|
126 | - define('PDF_AUTHOR', 'HTML2PDF - TCPDF'); |
|
127 | - |
|
128 | - /** |
|
129 | - * header title |
|
130 | - */ |
|
131 | - define('PDF_HEADER_TITLE', null); |
|
132 | - |
|
133 | - /** |
|
134 | - * header description string |
|
135 | - */ |
|
136 | - define('PDF_HEADER_STRING', null); |
|
137 | - |
|
138 | - /** |
|
139 | - * image logo |
|
140 | - */ |
|
141 | - define('PDF_HEADER_LOGO', null); |
|
142 | - |
|
143 | - /** |
|
144 | - * header logo image width [mm] |
|
145 | - */ |
|
146 | - define('PDF_HEADER_LOGO_WIDTH', null); |
|
147 | - |
|
148 | - /** |
|
149 | - * document unit of measure [pt=point, mm=millimeter, cm=centimeter, in=inch] |
|
150 | - */ |
|
151 | - define('PDF_UNIT', 'mm'); |
|
152 | - |
|
153 | - /** |
|
154 | - * header margin |
|
155 | - */ |
|
156 | - define('PDF_MARGIN_HEADER', 0); |
|
157 | - |
|
158 | - /** |
|
159 | - * footer margin |
|
160 | - */ |
|
161 | - define('PDF_MARGIN_FOOTER', 0); |
|
162 | - |
|
163 | - /** |
|
164 | - * top margin |
|
165 | - */ |
|
166 | - define('PDF_MARGIN_TOP', 0); |
|
167 | - |
|
168 | - /** |
|
169 | - * bottom margin |
|
170 | - */ |
|
171 | - define('PDF_MARGIN_BOTTOM', 0); |
|
172 | - |
|
173 | - /** |
|
174 | - * left margin |
|
175 | - */ |
|
176 | - define('PDF_MARGIN_LEFT', 0); |
|
177 | - |
|
178 | - /** |
|
179 | - * right margin |
|
180 | - */ |
|
181 | - define('PDF_MARGIN_RIGHT', 0); |
|
182 | - |
|
183 | - /** |
|
184 | - * default main font name |
|
185 | - */ |
|
186 | - define('PDF_FONT_NAME_MAIN', 'helvetica'); |
|
187 | - |
|
188 | - /** |
|
189 | - * default main font size |
|
190 | - */ |
|
191 | - define('PDF_FONT_SIZE_MAIN', 10); |
|
192 | - |
|
193 | - /** |
|
194 | - * default data font name |
|
195 | - */ |
|
196 | - define('PDF_FONT_NAME_DATA', 'helvetica'); |
|
197 | - |
|
198 | - /** |
|
199 | - * default data font size |
|
200 | - */ |
|
201 | - define('PDF_FONT_SIZE_DATA', 8); |
|
202 | - |
|
203 | - /** |
|
204 | - * default monospaced font name |
|
205 | - */ |
|
206 | - define('PDF_FONT_MONOSPACED', 'courier'); |
|
207 | - |
|
208 | - /** |
|
209 | - * ratio used to adjust the conversion of pixels to user units |
|
210 | - */ |
|
211 | - define('PDF_IMAGE_SCALE_RATIO', 1); |
|
212 | - |
|
213 | - /** |
|
214 | - * magnification factor for titles |
|
215 | - */ |
|
216 | - define('HEAD_MAGNIFICATION', 1); |
|
217 | - |
|
218 | - /** |
|
219 | - * height of cell repect font height |
|
220 | - */ |
|
221 | - define('K_CELL_HEIGHT_RATIO', 1); |
|
222 | - |
|
223 | - /** |
|
224 | - * title magnification respect main font size |
|
225 | - */ |
|
226 | - define('K_TITLE_MAGNIFICATION', 1); |
|
227 | - |
|
228 | - /** |
|
229 | - * reduction factor for small font |
|
230 | - */ |
|
231 | - define('K_SMALL_RATIO', 2/3); |
|
232 | - |
|
233 | - /** |
|
234 | - * set to true to enable the special procedure used to avoid the overlappind of symbols on Thai language |
|
235 | - */ |
|
236 | - define('K_THAI_TOPCHARS', true); |
|
237 | - |
|
238 | - /** |
|
239 | - * if true allows to call TCPDF methods using HTML syntax |
|
240 | - * IMPORTANT: For security reason, disable this feature if you are printing user HTML content. |
|
241 | - */ |
|
242 | - define('K_TCPDF_CALLS_IN_HTML', false); |
|
37 | + define('K_TCPDF_EXTERNAL_CONFIG', true); |
|
38 | + |
|
39 | + // DOCUMENT_ROOT fix for IIS Webserver |
|
40 | + if ((!isset($_SERVER['DOCUMENT_ROOT'])) OR (empty($_SERVER['DOCUMENT_ROOT']))) { |
|
41 | + if (isset($_SERVER['SCRIPT_FILENAME'])) { |
|
42 | + $_SERVER['DOCUMENT_ROOT'] = str_replace( |
|
43 | + '\\', |
|
44 | + '/', |
|
45 | + substr($_SERVER['SCRIPT_FILENAME'], 0, 0-strlen($_SERVER['PHP_SELF'])) |
|
46 | + ); |
|
47 | + } elseif (isset($_SERVER['PATH_TRANSLATED'])) { |
|
48 | + $_SERVER['DOCUMENT_ROOT'] = str_replace( |
|
49 | + '\\', |
|
50 | + '/', |
|
51 | + substr(str_replace('\\\\', '\\', $_SERVER['PATH_TRANSLATED']), 0, 0-strlen($_SERVER['PHP_SELF'])) |
|
52 | + ); |
|
53 | + } else { |
|
54 | + // define here your DOCUMENT_ROOT path if the previous fails |
|
55 | + $_SERVER['DOCUMENT_ROOT'] = '/var/www'; |
|
56 | + } |
|
57 | + } |
|
58 | + |
|
59 | + // Automatic calculation for the following K_PATH_MAIN constant |
|
60 | + $kPathMain = str_replace('\\', '/', dirname(__FILE__)); |
|
61 | + $kPathMain = dirname($kPathMain).'/'; // remove the current directory |
|
62 | + $kPathMain.= '_tcpdf_'.HTML2PDF_USED_TCPDF_VERSION.'/'; |
|
63 | + define('K_PATH_MAIN', $kPathMain); |
|
64 | + |
|
65 | + // Automatic calculation for the following K_PATH_URL constant |
|
66 | + if (isset($_SERVER['HTTP_HOST']) AND (!empty($_SERVER['HTTP_HOST']))) { |
|
67 | + if (isset($_SERVER['HTTPS']) AND (!empty($_SERVER['HTTPS'])) AND strtolower($_SERVER['HTTPS'])!='off') { |
|
68 | + $kPathUrl = 'https://'; |
|
69 | + } else { |
|
70 | + $kPathUrl = 'http://'; |
|
71 | + } |
|
72 | + $kPathUrl .= $_SERVER['HTTP_HOST']; |
|
73 | + $kPathUrl .= str_replace('\\', '/', substr(K_PATH_MAIN, (strlen($_SERVER['DOCUMENT_ROOT']) - 1))); |
|
74 | + } |
|
75 | + |
|
76 | + /** |
|
77 | + * URL path to tcpdf installation folder (http://localhost/tcpdf/). |
|
78 | + * By default it is automatically calculated but you can also set it as a fixed string to improve performances. |
|
79 | + */ |
|
80 | + define('K_PATH_URL', $kPathUrl); |
|
81 | + |
|
82 | + /** |
|
83 | + * path for PDF fonts |
|
84 | + * use K_PATH_MAIN.'fonts/old/' for old non-UTF8 fonts |
|
85 | + */ |
|
86 | + define('K_PATH_FONTS', K_PATH_MAIN.'fonts/'); |
|
87 | + |
|
88 | + /** |
|
89 | + * cache directory for temporary files (full path) |
|
90 | + */ |
|
91 | + define('K_PATH_CACHE', K_PATH_MAIN.'cache/'); |
|
92 | + |
|
93 | + /** |
|
94 | + * cache directory for temporary files (url path) |
|
95 | + */ |
|
96 | + define('K_PATH_URL_CACHE', K_PATH_URL.'cache/'); |
|
97 | + |
|
98 | + /** |
|
99 | + *images directory |
|
100 | + */ |
|
101 | + define('K_PATH_IMAGES', K_PATH_MAIN.'images/'); |
|
102 | + |
|
103 | + /** |
|
104 | + * blank image |
|
105 | + */ |
|
106 | + define('K_BLANK_IMAGE', K_PATH_IMAGES.'_blank.png'); |
|
107 | + |
|
108 | + /** |
|
109 | + * page format |
|
110 | + */ |
|
111 | + define('PDF_PAGE_FORMAT', 'A4'); |
|
112 | + |
|
113 | + /** |
|
114 | + * page orientation (P=portrait, L=landscape) |
|
115 | + */ |
|
116 | + define('PDF_PAGE_ORIENTATION', 'P'); |
|
117 | + |
|
118 | + /** |
|
119 | + * document creator |
|
120 | + */ |
|
121 | + define('PDF_CREATOR', 'HTML2PDF - TCPDF'); |
|
122 | + |
|
123 | + /** |
|
124 | + * document author |
|
125 | + */ |
|
126 | + define('PDF_AUTHOR', 'HTML2PDF - TCPDF'); |
|
127 | + |
|
128 | + /** |
|
129 | + * header title |
|
130 | + */ |
|
131 | + define('PDF_HEADER_TITLE', null); |
|
132 | + |
|
133 | + /** |
|
134 | + * header description string |
|
135 | + */ |
|
136 | + define('PDF_HEADER_STRING', null); |
|
137 | + |
|
138 | + /** |
|
139 | + * image logo |
|
140 | + */ |
|
141 | + define('PDF_HEADER_LOGO', null); |
|
142 | + |
|
143 | + /** |
|
144 | + * header logo image width [mm] |
|
145 | + */ |
|
146 | + define('PDF_HEADER_LOGO_WIDTH', null); |
|
147 | + |
|
148 | + /** |
|
149 | + * document unit of measure [pt=point, mm=millimeter, cm=centimeter, in=inch] |
|
150 | + */ |
|
151 | + define('PDF_UNIT', 'mm'); |
|
152 | + |
|
153 | + /** |
|
154 | + * header margin |
|
155 | + */ |
|
156 | + define('PDF_MARGIN_HEADER', 0); |
|
157 | + |
|
158 | + /** |
|
159 | + * footer margin |
|
160 | + */ |
|
161 | + define('PDF_MARGIN_FOOTER', 0); |
|
162 | + |
|
163 | + /** |
|
164 | + * top margin |
|
165 | + */ |
|
166 | + define('PDF_MARGIN_TOP', 0); |
|
167 | + |
|
168 | + /** |
|
169 | + * bottom margin |
|
170 | + */ |
|
171 | + define('PDF_MARGIN_BOTTOM', 0); |
|
172 | + |
|
173 | + /** |
|
174 | + * left margin |
|
175 | + */ |
|
176 | + define('PDF_MARGIN_LEFT', 0); |
|
177 | + |
|
178 | + /** |
|
179 | + * right margin |
|
180 | + */ |
|
181 | + define('PDF_MARGIN_RIGHT', 0); |
|
182 | + |
|
183 | + /** |
|
184 | + * default main font name |
|
185 | + */ |
|
186 | + define('PDF_FONT_NAME_MAIN', 'helvetica'); |
|
187 | + |
|
188 | + /** |
|
189 | + * default main font size |
|
190 | + */ |
|
191 | + define('PDF_FONT_SIZE_MAIN', 10); |
|
192 | + |
|
193 | + /** |
|
194 | + * default data font name |
|
195 | + */ |
|
196 | + define('PDF_FONT_NAME_DATA', 'helvetica'); |
|
197 | + |
|
198 | + /** |
|
199 | + * default data font size |
|
200 | + */ |
|
201 | + define('PDF_FONT_SIZE_DATA', 8); |
|
202 | + |
|
203 | + /** |
|
204 | + * default monospaced font name |
|
205 | + */ |
|
206 | + define('PDF_FONT_MONOSPACED', 'courier'); |
|
207 | + |
|
208 | + /** |
|
209 | + * ratio used to adjust the conversion of pixels to user units |
|
210 | + */ |
|
211 | + define('PDF_IMAGE_SCALE_RATIO', 1); |
|
212 | + |
|
213 | + /** |
|
214 | + * magnification factor for titles |
|
215 | + */ |
|
216 | + define('HEAD_MAGNIFICATION', 1); |
|
217 | + |
|
218 | + /** |
|
219 | + * height of cell repect font height |
|
220 | + */ |
|
221 | + define('K_CELL_HEIGHT_RATIO', 1); |
|
222 | + |
|
223 | + /** |
|
224 | + * title magnification respect main font size |
|
225 | + */ |
|
226 | + define('K_TITLE_MAGNIFICATION', 1); |
|
227 | + |
|
228 | + /** |
|
229 | + * reduction factor for small font |
|
230 | + */ |
|
231 | + define('K_SMALL_RATIO', 2/3); |
|
232 | + |
|
233 | + /** |
|
234 | + * set to true to enable the special procedure used to avoid the overlappind of symbols on Thai language |
|
235 | + */ |
|
236 | + define('K_THAI_TOPCHARS', true); |
|
237 | + |
|
238 | + /** |
|
239 | + * if true allows to call TCPDF methods using HTML syntax |
|
240 | + * IMPORTANT: For security reason, disable this feature if you are printing user HTML content. |
|
241 | + */ |
|
242 | + define('K_TCPDF_CALLS_IN_HTML', false); |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | //============================================================+ |
@@ -32,23 +32,23 @@ discard block |
||
32 | 32 | |
33 | 33 | // If you define the constant K_TCPDF_EXTERNAL_CONFIG, the following settings will be ignored. |
34 | 34 | |
35 | -if (!defined('K_TCPDF_EXTERNAL_CONFIG')) { |
|
35 | +if ( ! defined('K_TCPDF_EXTERNAL_CONFIG')) { |
|
36 | 36 | |
37 | 37 | define('K_TCPDF_EXTERNAL_CONFIG', true); |
38 | 38 | |
39 | 39 | // DOCUMENT_ROOT fix for IIS Webserver |
40 | - if ((!isset($_SERVER['DOCUMENT_ROOT'])) OR (empty($_SERVER['DOCUMENT_ROOT']))) { |
|
40 | + if (( ! isset($_SERVER['DOCUMENT_ROOT'])) OR (empty($_SERVER['DOCUMENT_ROOT']))) { |
|
41 | 41 | if (isset($_SERVER['SCRIPT_FILENAME'])) { |
42 | 42 | $_SERVER['DOCUMENT_ROOT'] = str_replace( |
43 | 43 | '\\', |
44 | 44 | '/', |
45 | - substr($_SERVER['SCRIPT_FILENAME'], 0, 0-strlen($_SERVER['PHP_SELF'])) |
|
45 | + substr($_SERVER['SCRIPT_FILENAME'], 0, 0 - strlen($_SERVER['PHP_SELF'])) |
|
46 | 46 | ); |
47 | 47 | } elseif (isset($_SERVER['PATH_TRANSLATED'])) { |
48 | 48 | $_SERVER['DOCUMENT_ROOT'] = str_replace( |
49 | 49 | '\\', |
50 | 50 | '/', |
51 | - substr(str_replace('\\\\', '\\', $_SERVER['PATH_TRANSLATED']), 0, 0-strlen($_SERVER['PHP_SELF'])) |
|
51 | + substr(str_replace('\\\\', '\\', $_SERVER['PATH_TRANSLATED']), 0, 0 - strlen($_SERVER['PHP_SELF'])) |
|
52 | 52 | ); |
53 | 53 | } else { |
54 | 54 | // define here your DOCUMENT_ROOT path if the previous fails |
@@ -59,12 +59,12 @@ discard block |
||
59 | 59 | // Automatic calculation for the following K_PATH_MAIN constant |
60 | 60 | $kPathMain = str_replace('\\', '/', dirname(__FILE__)); |
61 | 61 | $kPathMain = dirname($kPathMain).'/'; // remove the current directory |
62 | - $kPathMain.= '_tcpdf_'.HTML2PDF_USED_TCPDF_VERSION.'/'; |
|
62 | + $kPathMain .= '_tcpdf_'.HTML2PDF_USED_TCPDF_VERSION.'/'; |
|
63 | 63 | define('K_PATH_MAIN', $kPathMain); |
64 | 64 | |
65 | 65 | // Automatic calculation for the following K_PATH_URL constant |
66 | - if (isset($_SERVER['HTTP_HOST']) AND (!empty($_SERVER['HTTP_HOST']))) { |
|
67 | - if (isset($_SERVER['HTTPS']) AND (!empty($_SERVER['HTTPS'])) AND strtolower($_SERVER['HTTPS'])!='off') { |
|
66 | + if (isset($_SERVER['HTTP_HOST']) AND ( ! empty($_SERVER['HTTP_HOST']))) { |
|
67 | + if (isset($_SERVER['HTTPS']) AND ( ! empty($_SERVER['HTTPS'])) AND strtolower($_SERVER['HTTPS']) != 'off') { |
|
68 | 68 | $kPathUrl = 'https://'; |
69 | 69 | } else { |
70 | 70 | $kPathUrl = 'http://'; |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | /** |
229 | 229 | * reduction factor for small font |
230 | 230 | */ |
231 | - define('K_SMALL_RATIO', 2/3); |
|
231 | + define('K_SMALL_RATIO', 2 / 3); |
|
232 | 232 | |
233 | 233 | /** |
234 | 234 | * set to true to enable the special procedure used to avoid the overlappind of symbols on Thai language |
@@ -22,16 +22,16 @@ discard block |
||
22 | 22 | ############################################################################### |
23 | 23 | |
24 | 24 | if (!defined('BASEPATH')) |
25 | - exit('No direct script access allowed'); |
|
25 | + exit('No direct script access allowed'); |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * Dynamically build forms for display |
29 | 29 | */ |
30 | 30 | class Global_locale{ |
31 | 31 | |
32 | - function __construct($library_name = '') { |
|
32 | + function __construct($library_name = '') { |
|
33 | 33 | |
34 | - $this->CI = & get_instance(); |
|
34 | + $this->CI = & get_instance(); |
|
35 | 35 | header("Expires: Tue, 01 Jan 2000 00:00:00 GMT"); |
36 | 36 | header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); |
37 | 37 | header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | |
44 | 44 | |
45 | - } |
|
45 | + } |
|
46 | 46 | |
47 | 47 | |
48 | 48 | } |
@@ -21,19 +21,19 @@ |
||
21 | 21 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
22 | 22 | ############################################################################### |
23 | 23 | |
24 | -if (!defined('BASEPATH')) |
|
24 | +if ( ! defined('BASEPATH')) |
|
25 | 25 | exit('No direct script access allowed'); |
26 | 26 | |
27 | 27 | /** |
28 | 28 | * Dynamically build forms for display |
29 | 29 | */ |
30 | -class Global_locale{ |
|
30 | +class Global_locale { |
|
31 | 31 | |
32 | 32 | function __construct($library_name = '') { |
33 | 33 | |
34 | 34 | $this->CI = & get_instance(); |
35 | 35 | header("Expires: Tue, 01 Jan 2000 00:00:00 GMT"); |
36 | - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); |
|
36 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
|
37 | 37 | header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); |
38 | 38 | header("Cache-Control: post-check=0, pre-check=0", false); |
39 | 39 | header("Pragma: no-cache"); |
@@ -20,8 +20,9 @@ |
||
20 | 20 | # You should have received a copy of the GNU Affero General Public License |
21 | 21 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
22 | 22 | ############################################################################### |
23 | -if (!defined('BASEPATH')) |
|
23 | +if (!defined('BASEPATH')) { |
|
24 | 24 | exit('No direct script access allowed'); |
25 | +} |
|
25 | 26 | |
26 | 27 | class Refill_coupon_form { |
27 | 28 | function __construct($library_name = '') { |
@@ -22,26 +22,26 @@ |
||
22 | 22 | ############################################################################### |
23 | 23 | |
24 | 24 | if (!defined('BASEPATH')) |
25 | - exit('No direct script access allowed'); |
|
25 | + exit('No direct script access allowed'); |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * Dynamically build forms for display |
29 | 29 | */ |
30 | 30 | class locale_Menu{ |
31 | 31 | |
32 | - function __construct($library_name = '') { |
|
32 | + function __construct($library_name = '') { |
|
33 | 33 | |
34 | - $this->CI = & get_instance(); |
|
35 | - $this->CI->load->model('db_model'); |
|
36 | - $this->CI->load->library('email'); |
|
37 | - $this->CI->load->library('session'); |
|
34 | + $this->CI = & get_instance(); |
|
35 | + $this->CI->load->model('db_model'); |
|
36 | + $this->CI->load->library('email'); |
|
37 | + $this->CI->load->library('session'); |
|
38 | 38 | $current_locale=$this->CI->session->userdata('user_language'); |
39 | 39 | putenv("LC_ALL=$current_locale"); |
40 | 40 | setlocale(LC_ALL, $current_locale); |
41 | 41 | bindtextdomain(WEBSITE_DOMAIN, FCPATH.'/application/modules/dashboard/language'); |
42 | 42 | bind_textdomain_codeset(WEBSITE_DOMAIN, 'UTF-8'); |
43 | 43 | textdomain(WEBSITE_DOMAIN); |
44 | - } |
|
44 | + } |
|
45 | 45 | |
46 | 46 | |
47 | 47 | } |
@@ -21,13 +21,13 @@ discard block |
||
21 | 21 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
22 | 22 | ############################################################################### |
23 | 23 | |
24 | -if (!defined('BASEPATH')) |
|
24 | +if ( ! defined('BASEPATH')) |
|
25 | 25 | exit('No direct script access allowed'); |
26 | 26 | |
27 | 27 | /** |
28 | 28 | * Dynamically build forms for display |
29 | 29 | */ |
30 | -class locale_Menu{ |
|
30 | +class locale_Menu { |
|
31 | 31 | |
32 | 32 | function __construct($library_name = '') { |
33 | 33 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | $this->CI->load->model('db_model'); |
36 | 36 | $this->CI->load->library('email'); |
37 | 37 | $this->CI->load->library('session'); |
38 | - $current_locale=$this->CI->session->userdata('user_language'); |
|
38 | + $current_locale = $this->CI->session->userdata('user_language'); |
|
39 | 39 | putenv("LC_ALL=$current_locale"); |
40 | 40 | setlocale(LC_ALL, $current_locale); |
41 | 41 | bindtextdomain(WEBSITE_DOMAIN, FCPATH.'/application/modules/dashboard/language'); |
@@ -20,8 +20,9 @@ |
||
20 | 20 | # You should have received a copy of the GNU Affero General Public License |
21 | 21 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
22 | 22 | ############################################################################### |
23 | -if (!defined('BASEPATH')) |
|
23 | +if (!defined('BASEPATH')) { |
|
24 | 24 | exit('No direct script access allowed'); |
25 | +} |
|
25 | 26 | |
26 | 27 | class Refill_coupon_form { |
27 | 28 | function __construct($library_name = '') { |
@@ -22,43 +22,43 @@ |
||
22 | 22 | ############################################################################### |
23 | 23 | |
24 | 24 | if (!defined('BASEPATH')) |
25 | - exit('No direct script access allowed'); |
|
25 | + exit('No direct script access allowed'); |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * Dynamically build forms for display |
29 | 29 | */ |
30 | 30 | class Locale{ |
31 | 31 | |
32 | - function __construct($library_name = '') { |
|
32 | + function __construct($library_name = '') { |
|
33 | 33 | |
34 | - $this->CI = & get_instance(); |
|
35 | - $this->CI->load->model('db_model'); |
|
36 | - $this->CI->load->library('email'); |
|
37 | - $this->CI->load->library('session'); |
|
38 | - $this->CI->load->driver('cache'); |
|
34 | + $this->CI = & get_instance(); |
|
35 | + $this->CI->load->model('db_model'); |
|
36 | + $this->CI->load->library('email'); |
|
37 | + $this->CI->load->library('session'); |
|
38 | + $this->CI->load->driver('cache'); |
|
39 | 39 | $this->set_lang(); |
40 | - } |
|
41 | - function set_lang($lang=FALSE){ |
|
40 | + } |
|
41 | + function set_lang($lang=FALSE){ |
|
42 | 42 | |
43 | - $current_locale=$this->CI->session->userdata('user_language'); |
|
44 | - if(empty($current_locale)){ |
|
45 | - $current_locale= 'en_US'; |
|
46 | - } |
|
43 | + $current_locale=$this->CI->session->userdata('user_language'); |
|
44 | + if(empty($current_locale)){ |
|
45 | + $current_locale= 'en_US'; |
|
46 | + } |
|
47 | 47 | putenv("LANG=$current_locale"); |
48 | 48 | setlocale(LC_ALL, $current_locale.".UTF-8"); |
49 | - setlocale(LC_MESSAGES,$current_locale); |
|
49 | + setlocale(LC_MESSAGES,$current_locale); |
|
50 | 50 | setlocale(LC_TIME, $current_locale); |
51 | - setlocale(LC_CTYPE,$current_locale); |
|
51 | + setlocale(LC_CTYPE,$current_locale); |
|
52 | 52 | $domain='messages'; |
53 | 53 | $uri_segment=''; |
54 | 54 | $uri_segment = $this->CI->uri->segments; |
55 | 55 | if(isset($uri_segment[1])){ |
56 | 56 | $filename = getcwd().'/application/modules/user/language/'.$lang.'/LC_MESSAGES/messages.mo'; |
57 | - bindtextdomain(WEBSITE_DOMAIN,getcwd().'/application/modules/'.$uri_segment[1].'/language/'); |
|
57 | + bindtextdomain(WEBSITE_DOMAIN,getcwd().'/application/modules/'.$uri_segment[1].'/language/'); |
|
58 | 58 | } |
59 | 59 | bind_textdomain_codeset(WEBSITE_DOMAIN, 'UTF-8'); |
60 | 60 | textdomain(WEBSITE_DOMAIN); |
61 | - return true; |
|
61 | + return true; |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 |
@@ -21,13 +21,13 @@ discard block |
||
21 | 21 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
22 | 22 | ############################################################################### |
23 | 23 | |
24 | -if (!defined('BASEPATH')) |
|
24 | +if ( ! defined('BASEPATH')) |
|
25 | 25 | exit('No direct script access allowed'); |
26 | 26 | |
27 | 27 | /** |
28 | 28 | * Dynamically build forms for display |
29 | 29 | */ |
30 | -class Locale{ |
|
30 | +class Locale { |
|
31 | 31 | |
32 | 32 | function __construct($library_name = '') { |
33 | 33 | |
@@ -38,23 +38,23 @@ discard block |
||
38 | 38 | $this->CI->load->driver('cache'); |
39 | 39 | $this->set_lang(); |
40 | 40 | } |
41 | - function set_lang($lang=FALSE){ |
|
41 | + function set_lang($lang = FALSE) { |
|
42 | 42 | |
43 | - $current_locale=$this->CI->session->userdata('user_language'); |
|
44 | - if(empty($current_locale)){ |
|
45 | - $current_locale= 'en_US'; |
|
43 | + $current_locale = $this->CI->session->userdata('user_language'); |
|
44 | + if (empty($current_locale)) { |
|
45 | + $current_locale = 'en_US'; |
|
46 | 46 | } |
47 | 47 | putenv("LANG=$current_locale"); |
48 | 48 | setlocale(LC_ALL, $current_locale.".UTF-8"); |
49 | - setlocale(LC_MESSAGES,$current_locale); |
|
49 | + setlocale(LC_MESSAGES, $current_locale); |
|
50 | 50 | setlocale(LC_TIME, $current_locale); |
51 | - setlocale(LC_CTYPE,$current_locale); |
|
52 | - $domain='messages'; |
|
53 | - $uri_segment=''; |
|
51 | + setlocale(LC_CTYPE, $current_locale); |
|
52 | + $domain = 'messages'; |
|
53 | + $uri_segment = ''; |
|
54 | 54 | $uri_segment = $this->CI->uri->segments; |
55 | - if(isset($uri_segment[1])){ |
|
55 | + if (isset($uri_segment[1])) { |
|
56 | 56 | $filename = getcwd().'/application/modules/user/language/'.$lang.'/LC_MESSAGES/messages.mo'; |
57 | - bindtextdomain(WEBSITE_DOMAIN,getcwd().'/application/modules/'.$uri_segment[1].'/language/'); |
|
57 | + bindtextdomain(WEBSITE_DOMAIN, getcwd().'/application/modules/'.$uri_segment[1].'/language/'); |
|
58 | 58 | } |
59 | 59 | bind_textdomain_codeset(WEBSITE_DOMAIN, 'UTF-8'); |
60 | 60 | textdomain(WEBSITE_DOMAIN); |
@@ -20,8 +20,9 @@ |
||
20 | 20 | # You should have received a copy of the GNU Affero General Public License |
21 | 21 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
22 | 22 | ############################################################################### |
23 | -if (!defined('BASEPATH')) |
|
23 | +if (!defined('BASEPATH')) { |
|
24 | 24 | exit('No direct script access allowed'); |
25 | +} |
|
25 | 26 | |
26 | 27 | class Refill_coupon_form { |
27 | 28 | function __construct($library_name = '') { |
@@ -25,29 +25,29 @@ discard block |
||
25 | 25 | class freeswitch_lib{ |
26 | 26 | |
27 | 27 | function event_socket_create($host='127.0.0.1', $port='8021', $password='ClueCon') { |
28 | - $fp = @fsockopen($host, $port, $errno, $errdesc); |
|
28 | + $fp = @fsockopen($host, $port, $errno, $errdesc); |
|
29 | 29 | // or die("Connection to $host failed"); |
30 | 30 | // socket_set_blocking($fp,false); |
31 | 31 | |
32 | - if ($fp) { |
|
32 | + if ($fp) { |
|
33 | 33 | socket_set_blocking($fp,false); |
34 | 34 | while (!feof($fp)) { |
35 | - $buffer = fgets($fp, 1024); |
|
36 | - usleep(100); //allow time for reponse |
|
37 | - if (trim($buffer) == "Content-Type: auth/request") { |
|
38 | - fputs($fp, "auth $password\n\n"); |
|
39 | - break; |
|
40 | - } |
|
35 | + $buffer = fgets($fp, 1024); |
|
36 | + usleep(100); //allow time for reponse |
|
37 | + if (trim($buffer) == "Content-Type: auth/request") { |
|
38 | + fputs($fp, "auth $password\n\n"); |
|
39 | + break; |
|
40 | + } |
|
41 | 41 | } |
42 | 42 | return $fp; |
43 | - } |
|
44 | - else { |
|
43 | + } |
|
44 | + else { |
|
45 | 45 | return false; |
46 | - } |
|
46 | + } |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | function event_socket_request($fp, $cmd) { |
50 | - if ($fp) { |
|
50 | + if ($fp) { |
|
51 | 51 | fputs($fp, $cmd."\n\n"); |
52 | 52 | usleep(100); //allow time for reponse |
53 | 53 | |
@@ -55,39 +55,39 @@ discard block |
||
55 | 55 | $i = 0; |
56 | 56 | $contentlength = 0; |
57 | 57 | while (!feof($fp)) { |
58 | - $buffer = fgets($fp, 4096); |
|
59 | - if ($contentlength > 0) { |
|
60 | - $response .= $buffer; |
|
61 | - } |
|
58 | + $buffer = fgets($fp, 4096); |
|
59 | + if ($contentlength > 0) { |
|
60 | + $response .= $buffer; |
|
61 | + } |
|
62 | 62 | |
63 | - if ($contentlength == 0) { //if contentlenght is already don't process again |
|
63 | + if ($contentlength == 0) { //if contentlenght is already don't process again |
|
64 | 64 | if (strlen(trim($buffer)) > 0) { //run only if buffer has content |
65 | - $temparray = explode(":", trim($buffer)); |
|
66 | - if ($temparray[0] == "Content-Length") { |
|
67 | - $contentlength = trim($temparray[1]); |
|
68 | - } |
|
65 | + $temparray = explode(":", trim($buffer)); |
|
66 | + if ($temparray[0] == "Content-Length") { |
|
67 | + $contentlength = trim($temparray[1]); |
|
68 | + } |
|
69 | + } |
|
69 | 70 | } |
70 | - } |
|
71 | 71 | |
72 | - usleep(100); //allow time for reponse |
|
72 | + usleep(100); //allow time for reponse |
|
73 | 73 | |
74 | - //optional because of script timeout //don't let while loop become endless |
|
75 | - if ($i > 10000) { break; } |
|
74 | + //optional because of script timeout //don't let while loop become endless |
|
75 | + if ($i > 10000) { break; } |
|
76 | 76 | |
77 | - if ($contentlength > 0) { //is contentlength set |
|
77 | + if ($contentlength > 0) { //is contentlength set |
|
78 | 78 | //stop reading if all content has been read. |
79 | 79 | if (strlen($response) >= $contentlength) { |
80 | 80 | break; |
81 | 81 | } |
82 | - } |
|
83 | - $i++; |
|
82 | + } |
|
83 | + $i++; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | return $response; |
87 | - } |
|
88 | - else { |
|
87 | + } |
|
88 | + else { |
|
89 | 89 | // echo "no handle"; |
90 | - } |
|
90 | + } |
|
91 | 91 | } |
92 | 92 | } |
93 | 93 | ?> |
@@ -22,16 +22,16 @@ discard block |
||
22 | 22 | ############################################################################### |
23 | 23 | |
24 | 24 | if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
25 | -class freeswitch_lib{ |
|
25 | +class freeswitch_lib { |
|
26 | 26 | |
27 | - function event_socket_create($host='127.0.0.1', $port='8021', $password='ClueCon') { |
|
27 | + function event_socket_create($host = '127.0.0.1', $port = '8021', $password = 'ClueCon') { |
|
28 | 28 | $fp = @fsockopen($host, $port, $errno, $errdesc); |
29 | 29 | // or die("Connection to $host failed"); |
30 | 30 | // socket_set_blocking($fp,false); |
31 | 31 | |
32 | 32 | if ($fp) { |
33 | - socket_set_blocking($fp,false); |
|
34 | - while (!feof($fp)) { |
|
33 | + socket_set_blocking($fp, false); |
|
34 | + while ( ! feof($fp)) { |
|
35 | 35 | $buffer = fgets($fp, 1024); |
36 | 36 | usleep(100); //allow time for reponse |
37 | 37 | if (trim($buffer) == "Content-Type: auth/request") { |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $response = ""; |
55 | 55 | $i = 0; |
56 | 56 | $contentlength = 0; |
57 | - while (!feof($fp)) { |
|
57 | + while ( ! feof($fp)) { |
|
58 | 58 | $buffer = fgets($fp, 4096); |
59 | 59 | if ($contentlength > 0) { |
60 | 60 | $response .= $buffer; |
@@ -21,7 +21,9 @@ discard block |
||
21 | 21 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
22 | 22 | ############################################################################### |
23 | 23 | |
24 | -if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
24 | +if ( ! defined('BASEPATH')) { |
|
25 | + exit('No direct script access allowed'); |
|
26 | +} |
|
25 | 27 | class freeswitch_lib{ |
26 | 28 | |
27 | 29 | function event_socket_create($host='127.0.0.1', $port='8021', $password='ClueCon') { |
@@ -40,8 +42,7 @@ discard block |
||
40 | 42 | } |
41 | 43 | } |
42 | 44 | return $fp; |
43 | - } |
|
44 | - else { |
|
45 | + } else { |
|
45 | 46 | return false; |
46 | 47 | } |
47 | 48 | } |
@@ -84,8 +85,7 @@ discard block |
||
84 | 85 | } |
85 | 86 | |
86 | 87 | return $response; |
87 | - } |
|
88 | - else { |
|
88 | + } else { |
|
89 | 89 | // echo "no handle"; |
90 | 90 | } |
91 | 91 | } |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('BASEPATH')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | |
3 | 5 | $_doctypes = array( |
4 | 6 | 'xhtml11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">', |
@@ -14,7 +14,7 @@ |
||
14 | 14 | * Purpose : Display logo based on domain name |
15 | 15 | * |
16 | 16 | */ |
17 | -$hook['pre_system'] = array( |
|
17 | +$hook['pre_system'] = array( |
|
18 | 18 | 'class' => 'Router', |
19 | 19 | 'function' => 'route', |
20 | 20 | 'filename' => 'router.php', |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('BASEPATH')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /* |
3 | 5 | | ------------------------------------------------------------------- |
4 | 6 | | AUTO-LOADER |
@@ -37,74 +37,74 @@ |
||
37 | 37 | define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b'); |
38 | 38 | define("RESELLERPROFILE_ARRAY", serialize(array( |
39 | 39 | "My Profile"=>"user/user_myprofile/", |
40 | - "Change Password"=>"user/user_change_password/", |
|
41 | - "Subscriptions"=>"user/user_subscriptions/", |
|
42 | - "Invoice"=>"user/user_invoices_list/", |
|
43 | - "Refill Report"=>"user/user_refill_report/", |
|
44 | - "Charges History"=>"user/user_charges_history/", |
|
45 | - "Packages"=>"user/user_packages/", |
|
46 | - "Company Profile"=>"user/user_invoice_config/", |
|
47 | - "CDRs"=>"user/user_cdrs/", |
|
48 | - "Emails"=>"user/user_emails/", |
|
49 | - "Alert Threshold"=>"user/user_alert_threshold/" |
|
50 | - )) |
|
40 | + "Change Password"=>"user/user_change_password/", |
|
41 | + "Subscriptions"=>"user/user_subscriptions/", |
|
42 | + "Invoice"=>"user/user_invoices_list/", |
|
43 | + "Refill Report"=>"user/user_refill_report/", |
|
44 | + "Charges History"=>"user/user_charges_history/", |
|
45 | + "Packages"=>"user/user_packages/", |
|
46 | + "Company Profile"=>"user/user_invoice_config/", |
|
47 | + "CDRs"=>"user/user_cdrs/", |
|
48 | + "Emails"=>"user/user_emails/", |
|
49 | + "Alert Threshold"=>"user/user_alert_threshold/" |
|
50 | + )) |
|
51 | 51 | ); |
52 | 52 | define("CUSTOMEREDIT_ARRAY",serialize(array( |
53 | - "Customer Profile"=>"accounts/customer_edit/", |
|
54 | - "SIP Devices"=>"accounts/customer_sipdevices/", |
|
55 | - "Opensips Device"=>"accounts/customer_opensips/", |
|
56 | - "IP Settings"=>"accounts/customer_ipmap/", |
|
57 | - "Caller ID"=>"accounts/customer_animap/", |
|
58 | - "Speed Dial"=>"accounts/customer_speeddial/", |
|
59 | - "Blocked Codes"=>"accounts/customer_blocked_prefixes/", |
|
60 | - "DID"=>"accounts/customer_dids/", |
|
61 | - "Subscription"=>"accounts/customer_subscription/", |
|
62 | - "Invoice"=>"accounts/customer_invoices/", |
|
63 | - "Refill Report"=>"accounts/customer_refillreport/", |
|
64 | - "Charges History"=>"accounts/customer_charges/", |
|
65 | - "CDRs"=>"accounts/customer_cdrs/", |
|
66 | - "Emails"=>"accounts/customer_emailhistory/", |
|
67 | - "Alert Threshold"=>"accounts/customer_alert_threshold/" |
|
68 | - ) |
|
69 | - )); |
|
53 | + "Customer Profile"=>"accounts/customer_edit/", |
|
54 | + "SIP Devices"=>"accounts/customer_sipdevices/", |
|
55 | + "Opensips Device"=>"accounts/customer_opensips/", |
|
56 | + "IP Settings"=>"accounts/customer_ipmap/", |
|
57 | + "Caller ID"=>"accounts/customer_animap/", |
|
58 | + "Speed Dial"=>"accounts/customer_speeddial/", |
|
59 | + "Blocked Codes"=>"accounts/customer_blocked_prefixes/", |
|
60 | + "DID"=>"accounts/customer_dids/", |
|
61 | + "Subscription"=>"accounts/customer_subscription/", |
|
62 | + "Invoice"=>"accounts/customer_invoices/", |
|
63 | + "Refill Report"=>"accounts/customer_refillreport/", |
|
64 | + "Charges History"=>"accounts/customer_charges/", |
|
65 | + "CDRs"=>"accounts/customer_cdrs/", |
|
66 | + "Emails"=>"accounts/customer_emailhistory/", |
|
67 | + "Alert Threshold"=>"accounts/customer_alert_threshold/" |
|
68 | + ) |
|
69 | + )); |
|
70 | 70 | |
71 | 71 | define("PROVIDEREDIT_ARRAY",serialize(array( |
72 | - "Provider Profile"=>"accounts/provider_edit/", |
|
73 | - "SIP Devices"=>"accounts/provider_sipdevices/", |
|
74 | - "Opensips Device"=>"accounts/provider_opensips/", |
|
75 | - "IP Settings"=>"accounts/provider_ipmap/", |
|
76 | - "Caller ID"=>"accounts/provider_animap/", |
|
77 | - "Speed Dial"=>"accounts/provider_speeddial/", |
|
78 | - "Blocked Codes"=>"accounts/provider_blocked_prefixes/", |
|
79 | - "DID"=>"accounts/provider_dids/", |
|
80 | - "Subscription"=>"accounts/provider_subscription/", |
|
81 | - "Invoice"=>"accounts/provider_invoices/", |
|
82 | - "Refill Report"=>"accounts/provider_refillreport/", |
|
83 | - "Charges History"=>"accounts/provider_charges/", |
|
84 | - "CDRs"=>"accounts/provider_cdrs/", |
|
85 | - "Emails"=>"accounts/provider_emailhistory/", |
|
86 | - "Alert Threshold"=>"accounts/provider_alert_threshold/" |
|
87 | - ) |
|
88 | - )); |
|
72 | + "Provider Profile"=>"accounts/provider_edit/", |
|
73 | + "SIP Devices"=>"accounts/provider_sipdevices/", |
|
74 | + "Opensips Device"=>"accounts/provider_opensips/", |
|
75 | + "IP Settings"=>"accounts/provider_ipmap/", |
|
76 | + "Caller ID"=>"accounts/provider_animap/", |
|
77 | + "Speed Dial"=>"accounts/provider_speeddial/", |
|
78 | + "Blocked Codes"=>"accounts/provider_blocked_prefixes/", |
|
79 | + "DID"=>"accounts/provider_dids/", |
|
80 | + "Subscription"=>"accounts/provider_subscription/", |
|
81 | + "Invoice"=>"accounts/provider_invoices/", |
|
82 | + "Refill Report"=>"accounts/provider_refillreport/", |
|
83 | + "Charges History"=>"accounts/provider_charges/", |
|
84 | + "CDRs"=>"accounts/provider_cdrs/", |
|
85 | + "Emails"=>"accounts/provider_emailhistory/", |
|
86 | + "Alert Threshold"=>"accounts/provider_alert_threshold/" |
|
87 | + ) |
|
88 | + )); |
|
89 | 89 | define("RESELLEREDIT_ARRAY",serialize(array("Reseller Profile"=>"accounts/reseller_edit/", |
90 | - "DID"=>"accounts/reseller_dids/", |
|
91 | - "Subscription"=>"accounts/reseller_subscription/", |
|
92 | - "Invoice"=>"accounts/reseller_invoices/", |
|
93 | - "Refill Report"=>"accounts/reseller_refillreport/", |
|
94 | - "Charges History"=>"accounts/reseller_charges/", |
|
95 | - "Packages"=>"accounts/reseller_packages/", |
|
96 | - "Company Profile"=>"accounts/reseller_invoice_config/", |
|
97 | - "CDRs"=>"accounts/reseller_cdrs/", |
|
98 | - "Emails"=>"accounts/reseller_emailhistory/", |
|
99 | - "Alert Threshold"=>"accounts/reseller_alert_threshold/" |
|
90 | + "DID"=>"accounts/reseller_dids/", |
|
91 | + "Subscription"=>"accounts/reseller_subscription/", |
|
92 | + "Invoice"=>"accounts/reseller_invoices/", |
|
93 | + "Refill Report"=>"accounts/reseller_refillreport/", |
|
94 | + "Charges History"=>"accounts/reseller_charges/", |
|
95 | + "Packages"=>"accounts/reseller_packages/", |
|
96 | + "Company Profile"=>"accounts/reseller_invoice_config/", |
|
97 | + "CDRs"=>"accounts/reseller_cdrs/", |
|
98 | + "Emails"=>"accounts/reseller_emailhistory/", |
|
99 | + "Alert Threshold"=>"accounts/reseller_alert_threshold/" |
|
100 | 100 | ))); |
101 | 101 | define("PACKAGEEDIT_ARRAY", serialize( array( |
102 | - "Package Details"=>"package/package_edit/", |
|
103 | - "Package Codes"=>"package/package_pattern_list/" |
|
104 | - ))); |
|
102 | + "Package Details"=>"package/package_edit/", |
|
103 | + "Package Codes"=>"package/package_pattern_list/" |
|
104 | + ))); |
|
105 | 105 | define("CUSTOMERPROFILE_ARRAY",serialize(array( |
106 | - "My Profile"=>"user/user_myprofile/", |
|
107 | - "Change Password"=>"user/user_change_password" |
|
106 | + "My Profile"=>"user/user_myprofile/", |
|
107 | + "Change Password"=>"user/user_change_password" |
|
108 | 108 | ))); |
109 | 109 | define("DATABASE_DIRECTORY",FCPATH.'database_backup'.DIRECTORY_SEPARATOR); |
110 | 110 | define('LOCALE_REQUEST_PARAM', 'lang'); |
@@ -27,15 +27,15 @@ discard block |
||
27 | 27 | | |
28 | 28 | */ |
29 | 29 | |
30 | -define('FOPEN_READ', 'rb'); |
|
31 | -define('FOPEN_READ_WRITE', 'r+b'); |
|
32 | -define('FOPEN_WRITE_CREATE_DESTRUCTIVE', 'wb'); // truncates existing file data, use with care |
|
33 | -define('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE', 'w+b'); // truncates existing file data, use with care |
|
34 | -define('FOPEN_WRITE_CREATE', 'ab'); |
|
35 | -define('FOPEN_READ_WRITE_CREATE', 'a+b'); |
|
36 | -define('FOPEN_WRITE_CREATE_STRICT', 'xb'); |
|
37 | -define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b'); |
|
38 | -define("RESELLERPROFILE_ARRAY", serialize(array( |
|
30 | +define('FOPEN_READ', 'rb'); |
|
31 | +define('FOPEN_READ_WRITE', 'r+b'); |
|
32 | +define('FOPEN_WRITE_CREATE_DESTRUCTIVE', 'wb'); // truncates existing file data, use with care |
|
33 | +define('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE', 'w+b'); // truncates existing file data, use with care |
|
34 | +define('FOPEN_WRITE_CREATE', 'ab'); |
|
35 | +define('FOPEN_READ_WRITE_CREATE', 'a+b'); |
|
36 | +define('FOPEN_WRITE_CREATE_STRICT', 'xb'); |
|
37 | +define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b'); |
|
38 | +define("RESELLERPROFILE_ARRAY", serialize(array( |
|
39 | 39 | "My Profile"=>"user/user_myprofile/", |
40 | 40 | "Change Password"=>"user/user_change_password/", |
41 | 41 | "Subscriptions"=>"user/user_subscriptions/", |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | "Alert Threshold"=>"user/user_alert_threshold/" |
50 | 50 | )) |
51 | 51 | ); |
52 | -define("CUSTOMEREDIT_ARRAY",serialize(array( |
|
52 | +define("CUSTOMEREDIT_ARRAY", serialize(array( |
|
53 | 53 | "Customer Profile"=>"accounts/customer_edit/", |
54 | 54 | "SIP Devices"=>"accounts/customer_sipdevices/", |
55 | 55 | "Opensips Device"=>"accounts/customer_opensips/", |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | ) |
69 | 69 | )); |
70 | 70 | |
71 | -define("PROVIDEREDIT_ARRAY",serialize(array( |
|
71 | +define("PROVIDEREDIT_ARRAY", serialize(array( |
|
72 | 72 | "Provider Profile"=>"accounts/provider_edit/", |
73 | 73 | "SIP Devices"=>"accounts/provider_sipdevices/", |
74 | 74 | "Opensips Device"=>"accounts/provider_opensips/", |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | "Alert Threshold"=>"accounts/provider_alert_threshold/" |
87 | 87 | ) |
88 | 88 | )); |
89 | -define("RESELLEREDIT_ARRAY",serialize(array("Reseller Profile"=>"accounts/reseller_edit/", |
|
89 | +define("RESELLEREDIT_ARRAY", serialize(array("Reseller Profile"=>"accounts/reseller_edit/", |
|
90 | 90 | "DID"=>"accounts/reseller_dids/", |
91 | 91 | "Subscription"=>"accounts/reseller_subscription/", |
92 | 92 | "Invoice"=>"accounts/reseller_invoices/", |
@@ -98,15 +98,15 @@ discard block |
||
98 | 98 | "Emails"=>"accounts/reseller_emailhistory/", |
99 | 99 | "Alert Threshold"=>"accounts/reseller_alert_threshold/" |
100 | 100 | ))); |
101 | -define("PACKAGEEDIT_ARRAY", serialize( array( |
|
101 | +define("PACKAGEEDIT_ARRAY", serialize(array( |
|
102 | 102 | "Package Details"=>"package/package_edit/", |
103 | 103 | "Package Codes"=>"package/package_pattern_list/" |
104 | 104 | ))); |
105 | -define("CUSTOMERPROFILE_ARRAY",serialize(array( |
|
105 | +define("CUSTOMERPROFILE_ARRAY", serialize(array( |
|
106 | 106 | "My Profile"=>"user/user_myprofile/", |
107 | 107 | "Change Password"=>"user/user_change_password" |
108 | 108 | ))); |
109 | -define("DATABASE_DIRECTORY",FCPATH.'database_backup'.DIRECTORY_SEPARATOR); |
|
109 | +define("DATABASE_DIRECTORY", FCPATH.'database_backup'.DIRECTORY_SEPARATOR); |
|
110 | 110 | define('LOCALE_REQUEST_PARAM', 'lang'); |
111 | 111 | define('WEBSITE_DOMAIN', 'messages'); |
112 | 112 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('BASEPATH')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /* |
3 | 5 | | ------------------------------------------------------------------- |
4 | 6 | | AUTO-LOADER |