@@ -21,7 +21,7 @@ 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 | /** |
@@ -30,19 +30,19 @@ discard block |
||
30 | 30 | class email_lib { |
31 | 31 | |
32 | 32 | protected $CI; // codeigniter |
33 | - public $email=''; |
|
34 | - public $smtp=''; |
|
35 | - public $smtp_host=''; |
|
36 | - public $smtp_user=''; |
|
37 | - public $smtp_pass=''; |
|
38 | - public $smtp_port=''; |
|
39 | - public $message=''; |
|
40 | - public $from=''; |
|
41 | - public $to=''; |
|
42 | - public $subject=''; |
|
43 | - public $company_name=''; |
|
44 | - public $company_website=''; |
|
45 | - public $account_id=''; |
|
33 | + public $email = ''; |
|
34 | + public $smtp = ''; |
|
35 | + public $smtp_host = ''; |
|
36 | + public $smtp_user = ''; |
|
37 | + public $smtp_pass = ''; |
|
38 | + public $smtp_port = ''; |
|
39 | + public $message = ''; |
|
40 | + public $from = ''; |
|
41 | + public $to = ''; |
|
42 | + public $subject = ''; |
|
43 | + public $company_name = ''; |
|
44 | + public $company_website = ''; |
|
45 | + public $account_id = ''; |
|
46 | 46 | |
47 | 47 | function __construct($library_name = '') { |
48 | 48 | |
@@ -57,13 +57,13 @@ discard block |
||
57 | 57 | $where = array('group_title' =>'email'); |
58 | 58 | $query = $this->CI->db_model->getSelect("*", "system", $where); |
59 | 59 | $query = $query->result_array(); |
60 | - foreach($query as $key=>$val){ |
|
60 | + foreach ($query as $key=>$val) { |
|
61 | 61 | $tempvar = strtolower($val['name']); |
62 | - $this->$tempvar=$val['value']; |
|
62 | + $this->$tempvar = $val['value']; |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 | |
66 | - function get_template( $type) |
|
66 | + function get_template($type) |
|
67 | 67 | { |
68 | 68 | $where = array('name' => $type); |
69 | 69 | $query = $this->CI->db_model->getSelect("*", "default_templates", $where); |
@@ -77,14 +77,14 @@ discard block |
||
77 | 77 | $where = array('id' => $accountid); |
78 | 78 | $query = $this->CI->db_model->getSelect("*", "accounts", $where); |
79 | 79 | $query = $query->result_array(); |
80 | - if(isset($query[0]['email']) && $query[0]['email']!=''){ |
|
81 | - $query[0]['currency_name']=$this->CI->common->get_field_name('currency', 'currency', $query[0]['currency_id']); |
|
82 | - $query[0]['timezone_name']=$this->CI->common->get_field_name('gmtzone', 'timezone', $query[0]['timezone_id']); |
|
83 | - $query[0]['country_name']=$this->CI->common->get_field_name('country', 'countrycode', $query[0]['country_id']); |
|
84 | - $this->to=$query[0]['email']; |
|
80 | + if (isset($query[0]['email']) && $query[0]['email'] != '') { |
|
81 | + $query[0]['currency_name'] = $this->CI->common->get_field_name('currency', 'currency', $query[0]['currency_id']); |
|
82 | + $query[0]['timezone_name'] = $this->CI->common->get_field_name('gmtzone', 'timezone', $query[0]['timezone_id']); |
|
83 | + $query[0]['country_name'] = $this->CI->common->get_field_name('country', 'countrycode', $query[0]['country_id']); |
|
84 | + $this->to = $query[0]['email']; |
|
85 | 85 | $this->account_id = $query[0]['id']; |
86 | 86 | unset($query[0]['id']); |
87 | - $query[0]['username']=$query[0]['number']; |
|
87 | + $query[0]['username'] = $query[0]['number']; |
|
88 | 88 | unset($query[0]['number']); |
89 | 89 | return $query[0]; |
90 | 90 | } |
@@ -94,13 +94,13 @@ discard block |
||
94 | 94 | /** |
95 | 95 | * @param string $detail_type |
96 | 96 | */ |
97 | - function get_info($id,$detail_type) |
|
97 | + function get_info($id, $detail_type) |
|
98 | 98 | { |
99 | 99 | $where = array('id' => $id); |
100 | 100 | $query = $this->CI->db_model->getSelect("*", $detail_type, $where); |
101 | 101 | $query = $query->result_array(); |
102 | - if(isset($query[0]['accountid'])){ |
|
103 | - $query=$this->get_account_info($query [0]['accountid']); |
|
102 | + if (isset($query[0]['accountid'])) { |
|
103 | + $query = $this->get_account_info($query [0]['accountid']); |
|
104 | 104 | return $query[0]; |
105 | 105 | } |
106 | 106 | return false; |
@@ -111,47 +111,47 @@ discard block |
||
111 | 111 | $where = array(); |
112 | 112 | $query = $this->CI->db_model->getSelect("*", "invoice_conf", $where); |
113 | 113 | $query = $query->result(); |
114 | - if(isset($query[0]->emailaddress) && $query[0]->emailaddress!=''){ |
|
115 | - $this->company_website=$query[0]->website; |
|
116 | - $this->from=$query[0]->emailaddress; |
|
117 | - $this->company_name=$query[0]->company_name; |
|
114 | + if (isset($query[0]->emailaddress) && $query[0]->emailaddress != '') { |
|
115 | + $this->company_website = $query[0]->website; |
|
116 | + $this->from = $query[0]->emailaddress; |
|
117 | + $this->company_name = $query[0]->company_name; |
|
118 | 118 | return true; |
119 | 119 | } |
120 | 120 | return false; |
121 | 121 | } |
122 | 122 | |
123 | - function build_template($template_type,$detail,$detail_type='') { |
|
124 | - if(!is_array($template_type)) |
|
123 | + function build_template($template_type, $detail, $detail_type = '') { |
|
124 | + if ( ! is_array($template_type)) |
|
125 | 125 | $this->get_template($template_type); |
126 | - else{ |
|
127 | - $this->message=$template_type['message']; |
|
128 | - $this->subject=$template_type['subject']; |
|
129 | - $template_type=''; |
|
126 | + else { |
|
127 | + $this->message = $template_type['message']; |
|
128 | + $this->subject = $template_type['subject']; |
|
129 | + $template_type = ''; |
|
130 | 130 | } |
131 | - if(is_array($detail)) |
|
131 | + if (is_array($detail)) |
|
132 | 132 | { |
133 | - $templateinfo=$detail; |
|
134 | - if(isset($detail['email'])){ |
|
135 | - $this->to=$detail['email']; |
|
133 | + $templateinfo = $detail; |
|
134 | + if (isset($detail['email'])) { |
|
135 | + $this->to = $detail['email']; |
|
136 | 136 | } |
137 | 137 | /***** |
138 | 138 | ASTPP 3.0 |
139 | 139 | Email test |
140 | 140 | ****/ |
141 | - if(isset($templateinfo['number'])){ |
|
142 | - $templateinfo['username']=$templateinfo['number']; |
|
141 | + if (isset($templateinfo['number'])) { |
|
142 | + $templateinfo['username'] = $templateinfo['number']; |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | /*************/ |
146 | - $this->account_id=$templateinfo['accountid']; |
|
146 | + $this->account_id = $templateinfo['accountid']; |
|
147 | 147 | unset($templateinfo['number']); |
148 | - } else if(!is_array($detail) && $detail_type=='') { |
|
149 | - $templateinfo=$this->get_account_info($detail); |
|
148 | + } else if ( ! is_array($detail) && $detail_type == '') { |
|
149 | + $templateinfo = $this->get_account_info($detail); |
|
150 | 150 | } else { |
151 | - $templateinfo=$this->get_info($detail,$detail_type); |
|
151 | + $templateinfo = $this->get_info($detail, $detail_type); |
|
152 | 152 | } |
153 | 153 | |
154 | - if($this->get_admin_details() && is_array($templateinfo) && isset($templateinfo['first_name']) && $templateinfo['first_name']!=''){ |
|
154 | + if ($this->get_admin_details() && is_array($templateinfo) && isset($templateinfo['first_name']) && $templateinfo['first_name'] != '') { |
|
155 | 155 | $this->message = html_entity_decode($this->message); |
156 | 156 | $this->message = str_replace("#COMPANY_EMAIL#", $this->from, $this->message); |
157 | 157 | $this->message = str_replace("#COMPANY_NAME#", $this->company_name, $this->message); |
@@ -200,33 +200,33 @@ discard block |
||
200 | 200 | 'status'=>'1', |
201 | 201 | 'attachment'=>$attachment |
202 | 202 | ); |
203 | - $this->CI->db->insert('mail_details',$send_mail_details); |
|
203 | + $this->CI->db->insert('mail_details', $send_mail_details); |
|
204 | 204 | return $this->CI->db->insert_id(); |
205 | 205 | } |
206 | 206 | function update_mail_history($id) |
207 | 207 | { |
208 | 208 | $this->CI->db->where(array('id' => $id)); |
209 | 209 | $send_mail_details = array('status'=>'0'); |
210 | - $this->CI->db->update('mail_details',$send_mail_details); |
|
210 | + $this->CI->db->update('mail_details', $send_mail_details); |
|
211 | 211 | } |
212 | 212 | function set_email_paramenters($details) |
213 | 213 | { |
214 | - if(!is_array($details)){ |
|
214 | + if ( ! is_array($details)) { |
|
215 | 215 | $this->get_admin_details(); |
216 | 216 | $where = array('id'=>$details); |
217 | 217 | $query = $this->CI->db_model->getSelect("*", "mail_details", $where); |
218 | 218 | $query = $query->result_array(); |
219 | - $details=$query[0]; |
|
219 | + $details = $query[0]; |
|
220 | 220 | } |
221 | - $this->message=$details['body']; |
|
222 | - $this->from=$details['from']; |
|
223 | - $this->to=$details['to']; |
|
224 | - $this->subject=$details['subject']; |
|
225 | - $this->account_id=$details['accountid']; |
|
221 | + $this->message = $details['body']; |
|
222 | + $this->from = $details['from']; |
|
223 | + $this->to = $details['to']; |
|
224 | + $this->subject = $details['subject']; |
|
225 | + $this->account_id = $details['accountid']; |
|
226 | 226 | } |
227 | 227 | function get_smtp_details() |
228 | 228 | { |
229 | - if($this->smtp_port=='' || $this->smtp_host=='' || $this->smtp_user=='' || $this->smtp_pass=='')exit; |
|
229 | + if ($this->smtp_port == '' || $this->smtp_host == '' || $this->smtp_user == '' || $this->smtp_pass == '')exit; |
|
230 | 230 | $config['protocol'] = "smtp"; |
231 | 231 | $config['smtp_host'] = $this->smtp_host; |
232 | 232 | $config['smtp_port'] = $this->smtp_port; |
@@ -238,21 +238,21 @@ discard block |
||
238 | 238 | $this->CI->email->initialize($config); |
239 | 239 | } |
240 | 240 | |
241 | - function send_email($template_type,$details,$detail_type='',$attachment='',$resend=0,$mass_mail=0,$brodcast=0) { |
|
241 | + function send_email($template_type, $details, $detail_type = '', $attachment = '', $resend = 0, $mass_mail = 0, $brodcast = 0) { |
|
242 | 242 | $this->get_email_settings(); |
243 | - if(!$this->email){ |
|
244 | - if(!$resend){ |
|
245 | - $this->build_template($template_type,$details,$detail_type); |
|
246 | - }else{ |
|
243 | + if ( ! $this->email) { |
|
244 | + if ( ! $resend) { |
|
245 | + $this->build_template($template_type, $details, $detail_type); |
|
246 | + } else { |
|
247 | 247 | $this->set_email_paramenters($details); |
248 | 248 | } |
249 | 249 | |
250 | - if(!$brodcast) |
|
251 | - $history_id=$this->mail_history($attachment); |
|
250 | + if ( ! $brodcast) |
|
251 | + $history_id = $this->mail_history($attachment); |
|
252 | 252 | else |
253 | - $history_id=$details['history_id']; |
|
254 | - if(isset($this->from) && $this->from!='' && isset($this->to) && $this->to!='' && !$mass_mail){ |
|
255 | - if(!$this->smtp){ |
|
253 | + $history_id = $details['history_id']; |
|
254 | + if (isset($this->from) && $this->from != '' && isset($this->to) && $this->to != '' && ! $mass_mail) { |
|
255 | + if ( ! $this->smtp) { |
|
256 | 256 | $this->get_smtp_details(); |
257 | 257 | } |
258 | 258 | $this->CI->email->from($this->from, $this->company_name); |
@@ -262,11 +262,11 @@ discard block |
||
262 | 262 | eval("\$message = \"".$this->message."\";"); |
263 | 263 | $this->CI->email->message($this->message); |
264 | 264 | |
265 | - if($attachment!="") |
|
265 | + if ($attachment != "") |
|
266 | 266 | { |
267 | - $attac_exp=explode(",",$attachment); |
|
268 | - foreach($attac_exp as $key=>$value){ |
|
269 | - if($value != ''){ |
|
267 | + $attac_exp = explode(",", $attachment); |
|
268 | + foreach ($attac_exp as $key=>$value) { |
|
269 | + if ($value != '') { |
|
270 | 270 | $this->CI->email->attach(getcwd()."/attachments/".$value); |
271 | 271 | } |
272 | 272 | } |
@@ -281,22 +281,22 @@ discard block |
||
281 | 281 | ASTPP 3.0 |
282 | 282 | Add For Signup Module |
283 | 283 | **/ |
284 | - function send_mail($template_type,$details,$detail_type='',$attachment='',$resend=0,$mass_mail=0,$brodcast=0) { |
|
284 | + function send_mail($template_type, $details, $detail_type = '', $attachment = '', $resend = 0, $mass_mail = 0, $brodcast = 0) { |
|
285 | 285 | $this->get_email_settings(); |
286 | - if(!$this->email){ |
|
286 | + if ( ! $this->email) { |
|
287 | 287 | |
288 | - if(!$resend){ |
|
289 | - $this->build_template($template_type,$details,$detail_type); |
|
290 | - }else{ |
|
288 | + if ( ! $resend) { |
|
289 | + $this->build_template($template_type, $details, $detail_type); |
|
290 | + } else { |
|
291 | 291 | $this->set_email_paramenters($details); |
292 | 292 | } |
293 | 293 | |
294 | - if(!$brodcast) |
|
295 | - $history_id=$this->mail_history($attachment); |
|
294 | + if ( ! $brodcast) |
|
295 | + $history_id = $this->mail_history($attachment); |
|
296 | 296 | else |
297 | - $history_id=$details['history_id']; |
|
298 | - if(isset($this->from) && $this->from!='' && isset($this->to) && $this->to!='' && !$mass_mail){ |
|
299 | - if(!$this->smtp){ |
|
297 | + $history_id = $details['history_id']; |
|
298 | + if (isset($this->from) && $this->from != '' && isset($this->to) && $this->to != '' && ! $mass_mail) { |
|
299 | + if ( ! $this->smtp) { |
|
300 | 300 | $this->get_smtp_details(); |
301 | 301 | } |
302 | 302 | $this->CI->email->from($this->from, $this->company_name); |
@@ -20,7 +20,7 @@ discard block |
||
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 | class Permission { |
@@ -30,31 +30,31 @@ discard block |
||
30 | 30 | $this->CI->load->library('session'); |
31 | 31 | } |
32 | 32 | |
33 | - function get_module_access($user_type){ |
|
33 | + function get_module_access($user_type) { |
|
34 | 34 | $where = array("userlevelid"=>$user_type); |
35 | - $modules_arr = $this->CI->db_model->getSelect("module_permissions","userlevels",$where); |
|
36 | - if($modules_arr->num_rows > 0){ |
|
35 | + $modules_arr = $this->CI->db_model->getSelect("module_permissions", "userlevels", $where); |
|
36 | + if ($modules_arr->num_rows > 0) { |
|
37 | 37 | $modules_arr = $modules_arr->result_array(); |
38 | 38 | $modules_arr = $modules_arr[0]['module_permissions']; |
39 | 39 | |
40 | - $menu_arr = $this->CI->db_model->select("*","menu_modules","id IN ($modules_arr)","priority","asc","","",""); |
|
40 | + $menu_arr = $this->CI->db_model->select("*", "menu_modules", "id IN ($modules_arr)", "priority", "asc", "", "", ""); |
|
41 | 41 | $menu_list = array(); |
42 | 42 | $permited_modules = array(); |
43 | 43 | $modules_seq_arr = array(); |
44 | - $modules_seq_arr = explode(",",$modules_arr); |
|
45 | - $label_arr=array(); |
|
46 | - foreach($menu_arr->result_array() as $menu_key =>$menu_value){ |
|
47 | - if(!isset($label_arr[$menu_value['menu_label']]) && $menu_value['menu_label'] != 'Configuration'){ |
|
48 | - $label_arr[$menu_value['menu_label']]=$menu_value['menu_label']; |
|
49 | - $menu_value["menu_image"] = ($menu_value["menu_image"] == "")?"Home.png":$menu_value["menu_image"]; |
|
44 | + $modules_seq_arr = explode(",", $modules_arr); |
|
45 | + $label_arr = array(); |
|
46 | + foreach ($menu_arr->result_array() as $menu_key =>$menu_value) { |
|
47 | + if ( ! isset($label_arr[$menu_value['menu_label']]) && $menu_value['menu_label'] != 'Configuration') { |
|
48 | + $label_arr[$menu_value['menu_label']] = $menu_value['menu_label']; |
|
49 | + $menu_value["menu_image"] = ($menu_value["menu_image"] == "") ? "Home.png" : $menu_value["menu_image"]; |
|
50 | 50 | $menu_list[$menu_value["menu_title"]][$menu_value["menu_subtitle"]][] = array("menu_label" =>trim($menu_value["menu_label"]), |
51 | - "module_url"=>trim($menu_value["module_url"]),"module"=>trim($menu_value["module_name"]), |
|
51 | + "module_url"=>trim($menu_value["module_url"]), "module"=>trim($menu_value["module_name"]), |
|
52 | 52 | "menu_image"=>trim($menu_value["menu_image"])); |
53 | 53 | } |
54 | 54 | $permited_modules[] = trim($menu_value["module_name"]); |
55 | 55 | } |
56 | - $this->CI->session->set_userdata('permited_modules',serialize($permited_modules)); |
|
57 | - $this->CI->session->set_userdata('menuinfo',serialize($menu_list)); |
|
56 | + $this->CI->session->set_userdata('permited_modules', serialize($permited_modules)); |
|
57 | + $this->CI->session->set_userdata('menuinfo', serialize($menu_list)); |
|
58 | 58 | return true; |
59 | 59 | } |
60 | 60 | } |
@@ -180,12 +180,12 @@ discard block |
||
180 | 180 | /** |
181 | 181 | * Matrix index to get width from $capacity array. |
182 | 182 | */ |
183 | - define('QRCAP_WIDTH', 0); |
|
183 | + define('QRCAP_WIDTH', 0); |
|
184 | 184 | |
185 | 185 | /** |
186 | 186 | * Matrix index to get number of words from $capacity array. |
187 | 187 | */ |
188 | - define('QRCAP_WORDS', 1); |
|
188 | + define('QRCAP_WORDS', 1); |
|
189 | 189 | |
190 | 190 | /** |
191 | 191 | * Matrix index to get remainder from $capacity array. |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | /** |
196 | 196 | * Matrix index to get error correction level from $capacity array. |
197 | 197 | */ |
198 | - define('QRCAP_EC', 3); |
|
198 | + define('QRCAP_EC', 3); |
|
199 | 199 | |
200 | 200 | // ----------------------------------------------------- |
201 | 201 | |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | /** |
205 | 205 | * Number of header bits for structured mode |
206 | 206 | */ |
207 | - define('STRUCTURE_HEADER_BITS', 20); |
|
207 | + define('STRUCTURE_HEADER_BITS', 20); |
|
208 | 208 | |
209 | 209 | /** |
210 | 210 | * Max number of symbols for structured mode |
@@ -218,12 +218,12 @@ discard block |
||
218 | 218 | /** |
219 | 219 | * Down point base value for case 1 mask pattern (concatenation of same color in a line or a column) |
220 | 220 | */ |
221 | - define('N1', 3); |
|
221 | + define('N1', 3); |
|
222 | 222 | |
223 | 223 | /** |
224 | 224 | * Down point base value for case 2 mask pattern (module block of same color) |
225 | 225 | */ |
226 | - define('N2', 3); |
|
226 | + define('N2', 3); |
|
227 | 227 | |
228 | 228 | /** |
229 | 229 | * Down point base value for case 3 mask pattern (1:1:3:1:1(dark:bright:dark:bright:dark)pattern in a line or a column) |
@@ -260,18 +260,18 @@ discard block |
||
260 | 260 | |
261 | 261 | // #*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*# |
262 | 262 | |
263 | -if (!class_exists('QRcode', false)) { |
|
263 | +if ( ! class_exists('QRcode', false)) { |
|
264 | 264 | |
265 | 265 | // for compaibility with PHP4 |
266 | - if (!function_exists('str_split')) { |
|
266 | + if ( ! function_exists('str_split')) { |
|
267 | 267 | /** |
268 | 268 | * Convert a string to an array (needed for PHP4 compatibility) |
269 | 269 | * @param string $string The input string. |
270 | 270 | * @param int $split_length Maximum length of the chunk. |
271 | 271 | * @return string[] the optional split_length parameter is specified, the returned array will be broken down into chunks with each being split_length in length, otherwise each chunk will be one character in length. FALSE is returned if split_length is less than 1. If the split_length length exceeds the length of string , the entire string is returned as the first (and only) array element. |
272 | 272 | */ |
273 | - function str_split($string, $split_length=1) { |
|
274 | - if ((strlen($string) > $split_length) OR (!$split_length)) { |
|
273 | + function str_split($string, $split_length = 1) { |
|
274 | + if ((strlen($string) > $split_length) OR ( ! $split_length)) { |
|
275 | 275 | do { |
276 | 276 | $c = strlen($string); |
277 | 277 | $parts[] = substr($string, 0, $split_length); |
@@ -533,9 +533,9 @@ |
||
533 | 533 | * @param string $file |
534 | 534 | * @param string $s |
535 | 535 | */ |
536 | -function SaveToFile($file, $s, $mode='t') { |
|
536 | +function SaveToFile($file, $s, $mode = 't') { |
|
537 | 537 | $f = fopen($file, 'w'.$mode); |
538 | - if(!$f) { |
|
538 | + if ( ! $f) { |
|
539 | 539 | die('Can\'t write to file '.$file); |
540 | 540 | } |
541 | 541 | fwrite($f, $s, strlen($s)); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | static public function load($code) |
39 | 39 | { |
40 | - if (self::$_directory===null) { |
|
40 | + if (self::$_directory === null) { |
|
41 | 41 | self::$_directory = dirname(dirname(__FILE__)).'/locale/'; |
42 | 42 | } |
43 | 43 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | $code = strtolower($code); |
46 | 46 | |
47 | 47 | // must be [a-z-0-9] |
48 | - if (!preg_match('/^([a-z0-9]+)$/isU', $code)) { |
|
48 | + if ( ! preg_match('/^([a-z0-9]+)$/isU', $code)) { |
|
49 | 49 | throw new HTML2PDF_exception(0, 'invalid language code ['.self::$_code.']'); |
50 | 50 | } |
51 | 51 | |
@@ -56,16 +56,16 @@ discard block |
||
56 | 56 | $file = self::$_directory.self::$_code.'.csv'; |
57 | 57 | |
58 | 58 | // the file must exist |
59 | - if (!is_file($file)) { |
|
59 | + if ( ! is_file($file)) { |
|
60 | 60 | throw new HTML2PDF_exception(0, 'language code ['.self::$_code.'] unknown. You can create the translation file ['.$file.'] and send it to the webmaster of html2pdf in order to integrate it into a future release'); |
61 | 61 | } |
62 | 62 | |
63 | 63 | // load the file |
64 | 64 | self::$_list = array(); |
65 | 65 | $handle = fopen($file, 'r'); |
66 | - while (!feof($handle)) { |
|
66 | + while ( ! feof($handle)) { |
|
67 | 67 | $line = fgetcsv($handle); |
68 | - if (count($line)!=2) continue; |
|
68 | + if (count($line) != 2) continue; |
|
69 | 69 | self::$_list[trim($line[0])] = trim($line[1]); |
70 | 70 | } |
71 | 71 | fclose($handle); |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * @param string $key |
90 | 90 | * @return string |
91 | 91 | */ |
92 | - static public function get($key, $default='######') |
|
92 | + static public function get($key, $default = '######') |
|
93 | 93 | { |
94 | 94 | return (isset(self::$_list[$key]) ? self::$_list[$key] : $default); |
95 | 95 | } |
@@ -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 |
@@ -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 |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | { |
485 | 485 | // prepare |
486 | 486 | $tagName = strtolower($tagName); |
487 | - $id = isset($param['id']) ? strtolower(trim($param['id'])) : null; if ( ! $id) $id = null; |
|
487 | + $id = isset($param['id']) ? strtolower(trim($param['id'])) : null; if ( ! $id) $id = null; |
|
488 | 488 | $name = isset($param['name']) ? strtolower(trim($param['name'])) : null; if ( ! $name) $name = null; |
489 | 489 | |
490 | 490 | // read the class attribute |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | { |
555 | 555 | // prepare the informations |
556 | 556 | $tagName = strtolower($tagName); |
557 | - $id = isset($param['id']) ? strtolower(trim($param['id'])) : null; if ( ! $id) $id = null; |
|
557 | + $id = isset($param['id']) ? strtolower(trim($param['id'])) : null; if ( ! $id) $id = null; |
|
558 | 558 | $name = isset($param['name']) ? strtolower(trim($param['name'])) : null; if ( ! $name) $name = null; |
559 | 559 | |
560 | 560 | // get the class names to use |
@@ -131,63 +131,63 @@ discard block |
||
131 | 131 | <li> |
132 | 132 | |
133 | 133 | <?php |
134 | - $acc_info=$this->session->userdata('accountinfo'); |
|
135 | - if($this->session->userdata('userlevel_logintype') != '0'){?> |
|
136 | - <a href="<?php echo base_url();?>dashboard/" class=""> <? } else{?> |
|
137 | - <a href="<?php echo base_url();?>user/user/" class=""> |
|
134 | + $acc_info = $this->session->userdata('accountinfo'); |
|
135 | + if ($this->session->userdata('userlevel_logintype') != '0') {?> |
|
136 | + <a href="<?php echo base_url(); ?>dashboard/" class=""> <? } else {?> |
|
137 | + <a href="<?php echo base_url(); ?>user/user/" class=""> |
|
138 | 138 | <? } |
139 | - if($this->session->userdata('logintype')!=2){ |
|
140 | - $result=(array)$this->db->get_where('accounts',array("id"=>$acc_info['id']),1)->first_row(); |
|
141 | - $variable =$result['posttoexternal']==1 ? 'Credit' : gettext('Bal'); |
|
142 | - $amount=$result['posttoexternal']==1 ? $result['credit_limit'] :$result['balance']; |
|
143 | - $value= $this->common_model->calculate_currency($amount,'','',true); |
|
144 | - if($value >0){ |
|
145 | - $color='#397A13'; |
|
139 | + if ($this->session->userdata('logintype') != 2) { |
|
140 | + $result = (array)$this->db->get_where('accounts', array("id"=>$acc_info['id']), 1)->first_row(); |
|
141 | + $variable = $result['posttoexternal'] == 1 ? 'Credit' : gettext('Bal'); |
|
142 | + $amount = $result['posttoexternal'] == 1 ? $result['credit_limit'] : $result['balance']; |
|
143 | + $value = $this->common_model->calculate_currency($amount, '', '', true); |
|
144 | + if ($value > 0) { |
|
145 | + $color = '#397A13'; |
|
146 | 146 | } |
147 | - if($value < 0){ |
|
148 | - $color='#EE0E43'; |
|
147 | + if ($value < 0) { |
|
148 | + $color = '#EE0E43'; |
|
149 | 149 | } |
150 | - if($value == 0){ |
|
151 | - $color='#1A1919'; |
|
150 | + if ($value == 0) { |
|
151 | + $color = '#1A1919'; |
|
152 | 152 | } |
153 | 153 | $balance_str = '<span style="color:'.$color.'; font-size: 10px;"><b>('.$variable.' : '.$value.')</b></span>'; |
154 | - }else{ |
|
154 | + } else { |
|
155 | 155 | $balance_str = ''; |
156 | 156 | } |
157 | 157 | |
158 | - $logged_user=$acc_info['first_name']." ".$acc_info['last_name']; |
|
158 | + $logged_user = $acc_info['first_name']." ".$acc_info['last_name']; |
|
159 | 159 | ?> |
160 | 160 | <span> |
161 | 161 | <span class="profile_name"> |
162 | 162 | <?= $logged_user?> |
163 | 163 | </span> |
164 | - <label class="profile_label no-margin"><?php echo $balance_str;?> |
|
164 | + <label class="profile_label no-margin"><?php echo $balance_str; ?> |
|
165 | 165 | </label> |
166 | 166 | </span> |
167 | 167 | </a> |
168 | 168 | <ul class="dropdown-box"> |
169 | - <? if($this->session->userdata('userlevel_logintype') != '0' && $this->session->userdata('userlevel_logintype') != '3'){?> |
|
170 | - <li><a href="<?php echo base_url();?>dashboard/"><i class="fa fa-home"></i> <?php echo gettext('Dashboard'); ?></a></li> |
|
171 | - <? } else{?> |
|
172 | - <li><a href="<?php echo base_url();?>user/user/"><i class="fa fa-home"></i> <?php echo gettext('Dashboard'); ?></a></li> |
|
169 | + <? if ($this->session->userdata('userlevel_logintype') != '0' && $this->session->userdata('userlevel_logintype') != '3') {?> |
|
170 | + <li><a href="<?php echo base_url(); ?>dashboard/"><i class="fa fa-home"></i> <?php echo gettext('Dashboard'); ?></a></li> |
|
171 | + <? } else {?> |
|
172 | + <li><a href="<?php echo base_url(); ?>user/user/"><i class="fa fa-home"></i> <?php echo gettext('Dashboard'); ?></a></li> |
|
173 | 173 | <? }?> |
174 | 174 | |
175 | -<? if($this->session->userdata('userlevel_logintype') != '-1'){ |
|
175 | +<? if ($this->session->userdata('userlevel_logintype') != '-1') { |
|
176 | 176 | ?> |
177 | - <li><a href="<?php echo base_url();?>user/user_myprofile/"><i class= "fa fa-user"></i> |
|
177 | + <li><a href="<?php echo base_url(); ?>user/user_myprofile/"><i class= "fa fa-user"></i> |
|
178 | 178 | <?php echo gettext('My Profile'); ?></a></li> |
179 | 179 | <? |
180 | 180 | }?> |
181 | 181 | |
182 | - <? if($this->session->userdata('userlevel_logintype') == '-1'){?> |
|
182 | + <? if ($this->session->userdata('userlevel_logintype') == '-1') {?> |
|
183 | 183 | <li style="-moz-border-radius: 5px 5px 5px 5px;-webkit-border-radius: 5px 5px 5px 5px;border-radius: 5px 5px 5px 5px;"><a href="http://bugs.astppbilling.org/" target="_blank"><i class= "fa fa-bug"></i> <?php echo gettext('Report a Bug'); ?></a></li> |
184 | 184 | <?}?> |
185 | - <? if($this->session->userdata('userlevel_logintype') == '-1'){?> |
|
185 | + <? if ($this->session->userdata('userlevel_logintype') == '-1') {?> |
|
186 | 186 | <li><a href="https://astppdoc.atlassian.net/wiki/display/ASTPP/Welcome+to+ASTPP" target="_blank"><i class="fa fa-file-text"></i> Documentation</a></li> |
187 | 187 | <li><a href="http://www.astppbilling.org/sip-dialer" target="_blank"><i class="fa fa-mobile fa-lg" aria-hidden="true"></i> Get App</a></li> |
188 | 188 | <?}?> |
189 | 189 | |
190 | - <li><a href="<?php echo base_url();?>logout"><i class="fa fa-power-off"></i> Log out</a></li> |
|
190 | + <li><a href="<?php echo base_url(); ?>logout"><i class="fa fa-power-off"></i> Log out</a></li> |
|
191 | 191 | </ul> |
192 | 192 | </li> |
193 | 193 | </ul> |
@@ -203,49 +203,49 @@ discard block |
||
203 | 203 | |
204 | 204 | <?php |
205 | 205 | $menu_info = unserialize($this->session->userdata("menuinfo")); |
206 | - foreach($menu_info as $menu_key => $menu_values){ |
|
206 | + foreach ($menu_info as $menu_key => $menu_values) { |
|
207 | 207 | ?> |
208 | 208 | |
209 | 209 | <?php |
210 | - if(common_model::$global_config['system_config']['opensips']== 0 && $menu_key !='SIP Devices'){ |
|
210 | + if (common_model::$global_config['system_config']['opensips'] == 0 && $menu_key != 'SIP Devices') { |
|
211 | 211 | echo '<li><a href="">'.gettext($menu_key).'<b class="caret"></b></a>'; |
212 | 212 | } |
213 | - if(common_model::$global_config['system_config']['opensips']== 1 && $menu_key != 'Opensips'){ |
|
213 | + if (common_model::$global_config['system_config']['opensips'] == 1 && $menu_key != 'Opensips') { |
|
214 | 214 | echo '<li><a href="">'.gettext($menu_key).'<b class="caret"></b></a>'; |
215 | 215 | } |
216 | 216 | ?> |
217 | 217 | |
218 | 218 | <ul class="dropdown-menu"> |
219 | - <? foreach($menu_values as $sub_menu_key => $sub_menu_values){?> |
|
219 | + <? foreach ($menu_values as $sub_menu_key => $sub_menu_values) {?> |
|
220 | 220 | |
221 | - <? if($sub_menu_key === 0){ ?> |
|
222 | - <? foreach($sub_menu_values as $sub_key => $sub_menu_lables){ |
|
223 | - if((common_model::$global_config['system_config']['paypal_status']== 1 && strtolower($sub_menu_lables["menu_label"]) =='recharge') ||(common_model::$global_config['system_config']['opensips']== 1 && $sub_menu_lables["menu_label"] =='Opensips')|| |
|
224 | - (common_model::$global_config['system_config']['opensips']== 0 && $sub_menu_lables["menu_label"] =='SIP Devices') || |
|
225 | - (($acc_info['type'] == '3' || $acc_info['type'] == '0') && $acc_info['allow_ip_management'] == '1' && strtolower($sub_menu_lables["menu_label"]) == 'ip settings')){ |
|
226 | - }else{?> |
|
227 | - <li><a href="<?php echo base_url().$sub_menu_lables["module_url"];?>"><?php echo gettext($sub_menu_lables["menu_label"]);?></a></li> |
|
221 | + <? if ($sub_menu_key === 0) { ?> |
|
222 | + <? foreach ($sub_menu_values as $sub_key => $sub_menu_lables) { |
|
223 | + if ((common_model::$global_config['system_config']['paypal_status'] == 1 && strtolower($sub_menu_lables["menu_label"]) == 'recharge') || (common_model::$global_config['system_config']['opensips'] == 1 && $sub_menu_lables["menu_label"] == 'Opensips') || |
|
224 | + (common_model::$global_config['system_config']['opensips'] == 0 && $sub_menu_lables["menu_label"] == 'SIP Devices') || |
|
225 | + (($acc_info['type'] == '3' || $acc_info['type'] == '0') && $acc_info['allow_ip_management'] == '1' && strtolower($sub_menu_lables["menu_label"]) == 'ip settings')) { |
|
226 | + } else {?> |
|
227 | + <li><a href="<?php echo base_url().$sub_menu_lables["module_url"]; ?>"><?php echo gettext($sub_menu_lables["menu_label"]); ?></a></li> |
|
228 | 228 | <?}?> |
229 | 229 | <?} ?> |
230 | - <?php }else{ |
|
231 | - if(common_model::$global_config['system_config']['opensips']==0 && $menu_key !='System Configuration'){ ?> |
|
232 | - <li><a href=""><span><?=$sub_menu_key;?></span><i class="fa fa-caret-right pull-right"></i></a> |
|
233 | - <? } if(common_model::$global_config['system_config']['opensips']==1) {?> |
|
234 | - <li><a href=""><span><?=$sub_menu_key;?></span><i class="fa fa-caret-right pull-right"></i></a> |
|
235 | - <?php }if(($acc_info['type']==3 || $acc_info['type']== 0) && $acc_info['allow_ip_management']== 1 && strtolower($sub_menu_lables["menu_label"]) !='ip settings'){ ?> |
|
236 | - <li><a href=""><span><?=$sub_menu_key;?></span><i class="fa fa-caret-right pull-right"></i></a> |
|
230 | + <?php } else { |
|
231 | + if (common_model::$global_config['system_config']['opensips'] == 0 && $menu_key != 'System Configuration') { ?> |
|
232 | + <li><a href=""><span><?=$sub_menu_key; ?></span><i class="fa fa-caret-right pull-right"></i></a> |
|
233 | + <? } if (common_model::$global_config['system_config']['opensips'] == 1) {?> |
|
234 | + <li><a href=""><span><?=$sub_menu_key; ?></span><i class="fa fa-caret-right pull-right"></i></a> |
|
235 | + <?php }if (($acc_info['type'] == 3 || $acc_info['type'] == 0) && $acc_info['allow_ip_management'] == 1 && strtolower($sub_menu_lables["menu_label"]) != 'ip settings') { ?> |
|
236 | + <li><a href=""><span><?=$sub_menu_key; ?></span><i class="fa fa-caret-right pull-right"></i></a> |
|
237 | 237 | <? } |
238 | 238 | ?> |
239 | 239 | <div class="col-4"><div class="col-md-6 no-padding"> |
240 | 240 | <ul class="col-12 padding-x-8"> |
241 | - <? foreach($sub_menu_values as $sub_menu_lables){ |
|
242 | - if($sub_menu_lables['menu_label'] != 'Configuration'){ |
|
243 | - if(common_model::$global_config['system_config']['opensips']==0 && $sub_menu_lables["menu_label"] !='SIP Devices'){ |
|
241 | + <? foreach ($sub_menu_values as $sub_menu_lables) { |
|
242 | + if ($sub_menu_lables['menu_label'] != 'Configuration') { |
|
243 | + if (common_model::$global_config['system_config']['opensips'] == 0 && $sub_menu_lables["menu_label"] != 'SIP Devices') { |
|
244 | 244 | ?> |
245 | - <li><a href="<?php echo base_url().$sub_menu_lables["module_url"];?>"><?php echo gettext($sub_menu_lables["menu_label"]);?></a></li> |
|
245 | + <li><a href="<?php echo base_url().$sub_menu_lables["module_url"]; ?>"><?php echo gettext($sub_menu_lables["menu_label"]); ?></a></li> |
|
246 | 246 | <? } |
247 | - if(common_model::$global_config['system_config']['opensips']== 1 && $sub_menu_key !='opensips'){ ?> |
|
248 | - <li><a href="<?php echo base_url().$sub_menu_lables["module_url"];?>"><?=$sub_menu_lables["menu_label"];?></a></li> |
|
247 | + if (common_model::$global_config['system_config']['opensips'] == 1 && $sub_menu_key != 'opensips') { ?> |
|
248 | + <li><a href="<?php echo base_url().$sub_menu_lables["module_url"]; ?>"><?=$sub_menu_lables["menu_label"]; ?></a></li> |
|
249 | 249 | <? } |
250 | 250 | } |
251 | 251 | } ?> |