@@ -59,7 +59,7 @@ |
||
59 | 59 | // Get configurations (using module model object) |
60 | 60 | $oModuleModel = getModel('module'); |
61 | 61 | $config = $oModuleModel->getModuleConfig('spamfilter'); |
62 | - Context::set('config',$config); |
|
62 | + Context::set('config', $config); |
|
63 | 63 | |
64 | 64 | $this->setTemplateFile('config_block'); |
65 | 65 | } |
@@ -30,7 +30,7 @@ |
||
30 | 30 | |
31 | 31 | // Get configurations (using module model object) |
32 | 32 | $config = $oModuleModel->getModuleConfig('message'); |
33 | - Context::set('config',$config); |
|
33 | + Context::set('config', $config); |
|
34 | 34 | |
35 | 35 | // Set a template file |
36 | 36 | $this->setTemplatePath($this->module_path.'tpl'); |
@@ -333,8 +333,7 @@ discard block |
||
333 | 333 | '<!--BeforeComment(%d,%d)--><div class="comment_%d_%d xe_content">%s</div><!--AfterComment(%d,%d)-->', $this->comment_srl, $memberSrl, $this->comment_srl, $memberSrl, $content, $this->comment_srl, $memberSrl |
334 | 334 | ); |
335 | 335 | // xe_content class name should be specified although content access is not necessary. |
336 | - } |
|
337 | - else |
|
336 | + } else |
|
338 | 337 | { |
339 | 338 | if($add_xe_content_class) |
340 | 339 | { |
@@ -569,7 +568,9 @@ discard block |
||
569 | 568 | } |
570 | 569 | } |
571 | 570 | |
572 | - if(!preg_match("!<img!is", $content)) return; |
|
571 | + if(!preg_match("!<img!is", $content)) { |
|
572 | + return; |
|
573 | + } |
|
573 | 574 | } |
574 | 575 | |
575 | 576 | // get thumbail generation info on the doc module configuration. |
@@ -589,8 +590,7 @@ discard block |
||
589 | 590 | if(filesize($thumbnail_file) < 1) |
590 | 591 | { |
591 | 592 | return FALSE; |
592 | - } |
|
593 | - else |
|
593 | + } else |
|
594 | 594 | { |
595 | 595 | return $thumbnail_url; |
596 | 596 | } |
@@ -608,7 +608,9 @@ discard block |
||
608 | 608 | $first_image = null; |
609 | 609 | foreach($file_list as $file) |
610 | 610 | { |
611 | - if($file->direct_download !== 'Y') continue; |
|
611 | + if($file->direct_download !== 'Y') { |
|
612 | + continue; |
|
613 | + } |
|
612 | 614 | |
613 | 615 | if($file->cover_image === 'Y' && file_exists($file->uploaded_filename)) |
614 | 616 | { |
@@ -616,7 +618,9 @@ discard block |
||
616 | 618 | break; |
617 | 619 | } |
618 | 620 | |
619 | - if($first_image) continue; |
|
621 | + if($first_image) { |
|
622 | + continue; |
|
623 | + } |
|
620 | 624 | |
621 | 625 | if(preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename)) |
622 | 626 | { |
@@ -644,7 +648,9 @@ discard block |
||
644 | 648 | foreach($matches as $target_image) |
645 | 649 | { |
646 | 650 | $target_src = trim($target_image[1]); |
647 | - if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue; |
|
651 | + if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) { |
|
652 | + continue; |
|
653 | + } |
|
648 | 654 | |
649 | 655 | if(!preg_match('/^(http|https):\/\//i',$target_src)) |
650 | 656 | { |
@@ -655,7 +661,9 @@ discard block |
||
655 | 661 | |
656 | 662 | $tmp_file = _XE_PATH_ . 'files/cache/tmp/' . $random->createSecureSalt(32, 'hex'); |
657 | 663 | FileHandler::getRemoteFile($target_src, $tmp_file); |
658 | - if(!file_exists($tmp_file)) continue; |
|
664 | + if(!file_exists($tmp_file)) { |
|
665 | + continue; |
|
666 | + } |
|
659 | 667 | |
660 | 668 | $imageinfo = getimagesize($tmp_file); |
661 | 669 | list($_w, $_h) = $imageinfo; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | */ |
50 | 50 | function _loadFromDB() |
51 | 51 | { |
52 | - if(!$this->comment_srl) |
|
52 | + if (!$this->comment_srl) |
|
53 | 53 | { |
54 | 54 | return; |
55 | 55 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | */ |
68 | 68 | function setAttribute($attribute) |
69 | 69 | { |
70 | - if(!$attribute->comment_srl) |
|
70 | + if (!$attribute->comment_srl) |
|
71 | 71 | { |
72 | 72 | $this->comment_srl = NULL; |
73 | 73 | return; |
@@ -77,9 +77,9 @@ discard block |
||
77 | 77 | $this->adds($attribute); |
78 | 78 | |
79 | 79 | // define vars on the object for backward compatibility of skins |
80 | - if(count($attribute)) |
|
80 | + if (count($attribute)) |
|
81 | 81 | { |
82 | - foreach($attribute as $key => $val) |
|
82 | + foreach ($attribute as $key => $val) |
|
83 | 83 | { |
84 | 84 | $this->{$key} = $val; |
85 | 85 | } |
@@ -93,29 +93,29 @@ discard block |
||
93 | 93 | |
94 | 94 | function isGranted() |
95 | 95 | { |
96 | - if($_SESSION['own_comment'][$this->comment_srl]) |
|
96 | + if ($_SESSION['own_comment'][$this->comment_srl]) |
|
97 | 97 | { |
98 | 98 | return TRUE; |
99 | 99 | } |
100 | 100 | |
101 | - if(!Context::get('is_logged')) |
|
101 | + if (!Context::get('is_logged')) |
|
102 | 102 | { |
103 | 103 | return FALSE; |
104 | 104 | } |
105 | 105 | |
106 | 106 | $logged_info = Context::get('logged_info'); |
107 | - if($logged_info->is_admin == 'Y') |
|
107 | + if ($logged_info->is_admin == 'Y') |
|
108 | 108 | { |
109 | 109 | return TRUE; |
110 | 110 | } |
111 | 111 | |
112 | 112 | $grant = Context::get('grant'); |
113 | - if($grant->manager) |
|
113 | + if ($grant->manager) |
|
114 | 114 | { |
115 | 115 | return TRUE; |
116 | 116 | } |
117 | 117 | |
118 | - if($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl') * -1 == $logged_info->member_srl)) |
|
118 | + if ($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl') * -1 == $logged_info->member_srl)) |
|
119 | 119 | { |
120 | 120 | return TRUE; |
121 | 121 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | |
137 | 137 | function isEditable() |
138 | 138 | { |
139 | - if($this->isGranted() || !$this->get('member_srl')) |
|
139 | + if ($this->isGranted() || !$this->get('member_srl')) |
|
140 | 140 | { |
141 | 141 | return TRUE; |
142 | 142 | } |
@@ -150,12 +150,12 @@ discard block |
||
150 | 150 | |
151 | 151 | function isAccessible() |
152 | 152 | { |
153 | - if($_SESSION['accessibled_comment'][$this->comment_srl]) |
|
153 | + if ($_SESSION['accessibled_comment'][$this->comment_srl]) |
|
154 | 154 | { |
155 | 155 | return TRUE; |
156 | 156 | } |
157 | 157 | |
158 | - if($this->isGranted() || !$this->isSecret()) |
|
158 | + if ($this->isGranted() || !$this->isSecret()) |
|
159 | 159 | { |
160 | 160 | $this->setAccessible(); |
161 | 161 | return TRUE; |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | |
164 | 164 | $oDocumentModel = getModel('document'); |
165 | 165 | $oDocument = $oDocumentModel->getDocument($this->get('document_srl')); |
166 | - if($oDocument->isGranted()) |
|
166 | + if ($oDocument->isGranted()) |
|
167 | 167 | { |
168 | 168 | $this->setAccessible(); |
169 | 169 | return TRUE; |
@@ -184,20 +184,20 @@ discard block |
||
184 | 184 | function notify($type, $content) |
185 | 185 | { |
186 | 186 | // return if not useNotify |
187 | - if(!$this->useNotify()) |
|
187 | + if (!$this->useNotify()) |
|
188 | 188 | { |
189 | 189 | return; |
190 | 190 | } |
191 | 191 | |
192 | 192 | // pass if the author is not logged-in user |
193 | - if(!$this->get('member_srl')) |
|
193 | + if (!$this->get('member_srl')) |
|
194 | 194 | { |
195 | 195 | return; |
196 | 196 | } |
197 | 197 | |
198 | 198 | // return if the currently logged-in user is an author of the comment. |
199 | 199 | $logged_info = Context::get('logged_info'); |
200 | - if($logged_info->member_srl == $this->get('member_srl')) |
|
200 | + if ($logged_info->member_srl == $this->get('member_srl')) |
|
201 | 201 | { |
202 | 202 | return; |
203 | 203 | } |
@@ -207,9 +207,9 @@ discard block |
||
207 | 207 | $oDocument = $oDocumentModel->getDocument($this->get('document_srl')); |
208 | 208 | |
209 | 209 | // Variables |
210 | - if($type) |
|
210 | + if ($type) |
|
211 | 211 | { |
212 | - $title = "[" . $type . "] "; |
|
212 | + $title = "[".$type."] "; |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | $title .= cut_str(strip_tags($content), 30, '...'); |
@@ -224,17 +224,17 @@ discard block |
||
224 | 224 | |
225 | 225 | function getIpAddress() |
226 | 226 | { |
227 | - if($this->isGranted()) |
|
227 | + if ($this->isGranted()) |
|
228 | 228 | { |
229 | 229 | return $this->get('ipaddress'); |
230 | 230 | } |
231 | 231 | |
232 | - return '*' . strstr($this->get('ipaddress'), '.'); |
|
232 | + return '*'.strstr($this->get('ipaddress'), '.'); |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | function isExistsHomepage() |
236 | 236 | { |
237 | - if(trim($this->get('homepage'))) |
|
237 | + if (trim($this->get('homepage'))) |
|
238 | 238 | { |
239 | 239 | return TRUE; |
240 | 240 | } |
@@ -245,14 +245,14 @@ discard block |
||
245 | 245 | function getHomepageUrl() |
246 | 246 | { |
247 | 247 | $url = trim($this->get('homepage')); |
248 | - if(!$url) |
|
248 | + if (!$url) |
|
249 | 249 | { |
250 | 250 | return; |
251 | 251 | } |
252 | 252 | |
253 | - if(strncasecmp('http://', $url, 7) !== 0) |
|
253 | + if (strncasecmp('http://', $url, 7) !== 0) |
|
254 | 254 | { |
255 | - $url = "http://" . $url; |
|
255 | + $url = "http://".$url; |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | return htmlspecialchars($url, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
@@ -284,14 +284,14 @@ discard block |
||
284 | 284 | */ |
285 | 285 | function getContentText($strlen = 0) |
286 | 286 | { |
287 | - if($this->isSecret() && !$this->isAccessible()) |
|
287 | + if ($this->isSecret() && !$this->isAccessible()) |
|
288 | 288 | { |
289 | 289 | return Context::getLang('msg_is_secret'); |
290 | 290 | } |
291 | 291 | |
292 | 292 | $content = $this->get('content'); |
293 | 293 | |
294 | - if($strlen) |
|
294 | + if ($strlen) |
|
295 | 295 | { |
296 | 296 | return cut_str(strip_tags($content), $strlen, '...'); |
297 | 297 | } |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | */ |
306 | 306 | function getContent($add_popup_menu = TRUE, $add_content_info = TRUE, $add_xe_content_class = TRUE) |
307 | 307 | { |
308 | - if($this->isSecret() && !$this->isAccessible()) |
|
308 | + if ($this->isSecret() && !$this->isAccessible()) |
|
309 | 309 | { |
310 | 310 | return Context::getLang('msg_is_secret'); |
311 | 311 | } |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | stripEmbedTagForAdmin($content, $this->get('member_srl')); |
315 | 315 | |
316 | 316 | // when displaying the comment on the pop-up menu |
317 | - if($add_popup_menu && Context::get('is_logged')) |
|
317 | + if ($add_popup_menu && Context::get('is_logged')) |
|
318 | 318 | { |
319 | 319 | $content = sprintf( |
320 | 320 | '%s<div class="comment_popup_menu"><a href="#popup_menu_area" class="comment_%d" onclick="return false">%s</a></div>', $content, $this->comment_srl, Context::getLang('cmd_comment_do') |
@@ -322,10 +322,10 @@ discard block |
||
322 | 322 | } |
323 | 323 | |
324 | 324 | // if additional information which can access contents is set |
325 | - if($add_content_info) |
|
325 | + if ($add_content_info) |
|
326 | 326 | { |
327 | 327 | $memberSrl = $this->get('member_srl'); |
328 | - if($memberSrl < 0) |
|
328 | + if ($memberSrl < 0) |
|
329 | 329 | { |
330 | 330 | $memberSrl = 0; |
331 | 331 | } |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | } |
337 | 337 | else |
338 | 338 | { |
339 | - if($add_xe_content_class) |
|
339 | + if ($add_xe_content_class) |
|
340 | 340 | { |
341 | 341 | $content = sprintf('<div class="xe_content">%s</div>', $content); |
342 | 342 | } |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | |
397 | 397 | function getRegdateGM() |
398 | 398 | { |
399 | - return $this->getRegdate('D, d M Y H:i:s') . ' ' . $GLOBALS['_time_zone']; |
|
399 | + return $this->getRegdate('D, d M Y H:i:s').' '.$GLOBALS['_time_zone']; |
|
400 | 400 | } |
401 | 401 | |
402 | 402 | function getUpdate($format = 'Y.m.d H:i:s') |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | |
407 | 407 | function getPermanentUrl() |
408 | 408 | { |
409 | - return getFullUrl('', 'mid', $this->getCommentMid(), 'document_srl', $this->get('document_srl')) . '#comment_' . $this->get('comment_srl'); |
|
409 | + return getFullUrl('', 'mid', $this->getCommentMid(), 'document_srl', $this->get('document_srl')).'#comment_'.$this->get('comment_srl'); |
|
410 | 410 | } |
411 | 411 | |
412 | 412 | function getUpdateTime() |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | |
428 | 428 | function hasUploadedFiles() |
429 | 429 | { |
430 | - if(($this->isSecret() && !$this->isAccessible()) && !$this->isGranted()) |
|
430 | + if (($this->isSecret() && !$this->isAccessible()) && !$this->isGranted()) |
|
431 | 431 | { |
432 | 432 | return FALSE; |
433 | 433 | } |
@@ -436,12 +436,12 @@ discard block |
||
436 | 436 | |
437 | 437 | function getUploadedFiles() |
438 | 438 | { |
439 | - if(($this->isSecret() && !$this->isAccessible()) && !$this->isGranted()) |
|
439 | + if (($this->isSecret() && !$this->isAccessible()) && !$this->isGranted()) |
|
440 | 440 | { |
441 | 441 | return; |
442 | 442 | } |
443 | 443 | |
444 | - if(!$this->get('uploaded_count')) |
|
444 | + if (!$this->get('uploaded_count')) |
|
445 | 445 | { |
446 | 446 | return; |
447 | 447 | } |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | function getEditor() |
459 | 459 | { |
460 | 460 | $module_srl = $this->get('module_srl'); |
461 | - if(!$module_srl) |
|
461 | + if (!$module_srl) |
|
462 | 462 | { |
463 | 463 | $module_srl = Context::get('module_srl'); |
464 | 464 | } |
@@ -472,13 +472,13 @@ discard block |
||
472 | 472 | */ |
473 | 473 | function getProfileImage() |
474 | 474 | { |
475 | - if(!$this->isExists() || !$this->get('member_srl')) |
|
475 | + if (!$this->isExists() || !$this->get('member_srl')) |
|
476 | 476 | { |
477 | 477 | return; |
478 | 478 | } |
479 | 479 | $oMemberModel = getModel('member'); |
480 | 480 | $profile_info = $oMemberModel->getProfileImage($this->get('member_srl')); |
481 | - if(!$profile_info) |
|
481 | + if (!$profile_info) |
|
482 | 482 | { |
483 | 483 | return; |
484 | 484 | } |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | function getSignature() |
494 | 494 | { |
495 | 495 | // pass if the posting not exists. |
496 | - if(!$this->isExists() || !$this->get('member_srl')) |
|
496 | + if (!$this->isExists() || !$this->get('member_srl')) |
|
497 | 497 | { |
498 | 498 | return; |
499 | 499 | } |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | $signature = $oMemberModel->getSignature($this->get('member_srl')); |
504 | 504 | |
505 | 505 | // check if max height of the signiture is specified on the member module |
506 | - if(!isset($GLOBALS['__member_signature_max_height'])) |
|
506 | + if (!isset($GLOBALS['__member_signature_max_height'])) |
|
507 | 507 | { |
508 | 508 | $oModuleModel = getModel('module'); |
509 | 509 | $member_config = $oModuleModel->getModuleConfig('member'); |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | |
513 | 513 | $max_signature_height = $GLOBALS['__member_signature_max_height']; |
514 | 514 | |
515 | - if($max_signature_height) |
|
515 | + if ($max_signature_height) |
|
516 | 516 | { |
517 | 517 | $signature = sprintf('<div style="max-height:%dpx;overflow:auto;overflow-x:hidden;height:expression(this.scrollHeight > %d ? \'%dpx\': \'auto\')">%s</div>', $max_signature_height, $max_signature_height, $max_signature_height, $signature); |
518 | 518 | } |
@@ -522,12 +522,12 @@ discard block |
||
522 | 522 | |
523 | 523 | function thumbnailExists($width = 80, $height = 0, $type = '') |
524 | 524 | { |
525 | - if(!$this->comment_srl) |
|
525 | + if (!$this->comment_srl) |
|
526 | 526 | { |
527 | 527 | return FALSE; |
528 | 528 | } |
529 | 529 | |
530 | - if(!$this->getThumbnail($width, $height, $type)) |
|
530 | + if (!$this->getThumbnail($width, $height, $type)) |
|
531 | 531 | { |
532 | 532 | return FALSE; |
533 | 533 | } |
@@ -538,42 +538,42 @@ discard block |
||
538 | 538 | function getThumbnail($width = 80, $height = 0, $thumbnail_type = '') |
539 | 539 | { |
540 | 540 | // return false if no doc exists |
541 | - if(!$this->comment_srl) |
|
541 | + if (!$this->comment_srl) |
|
542 | 542 | { |
543 | 543 | return; |
544 | 544 | } |
545 | 545 | |
546 | - if($this->isSecret() && !$this->isGranted()) |
|
546 | + if ($this->isSecret() && !$this->isGranted()) |
|
547 | 547 | { |
548 | 548 | return; |
549 | 549 | } |
550 | 550 | |
551 | 551 | // If signiture height setting is omitted, create a square |
552 | - if(!$height) |
|
552 | + if (!$height) |
|
553 | 553 | { |
554 | 554 | $height = $width; |
555 | 555 | } |
556 | 556 | |
557 | 557 | $content = $this->get('content'); |
558 | - if(!$this->hasUploadedFiles()) |
|
558 | + if (!$this->hasUploadedFiles()) |
|
559 | 559 | { |
560 | - if(!$content) |
|
560 | + if (!$content) |
|
561 | 561 | { |
562 | 562 | $args = new stdClass(); |
563 | 563 | $args->comment_srl = $this->comment_srl; |
564 | 564 | $output = executeQuery('document.getComment', $args, array('content')); |
565 | - if($output->toBool() && $output->data) |
|
565 | + if ($output->toBool() && $output->data) |
|
566 | 566 | { |
567 | 567 | $content = $output->data->content; |
568 | 568 | $this->add('content', $content); |
569 | 569 | } |
570 | 570 | } |
571 | 571 | |
572 | - if(!preg_match("!<img!is", $content)) return; |
|
572 | + if (!preg_match("!<img!is", $content)) return; |
|
573 | 573 | } |
574 | 574 | |
575 | 575 | // get thumbail generation info on the doc module configuration. |
576 | - if(!in_array($thumbnail_type, array('crop', 'ratio'))) |
|
576 | + if (!in_array($thumbnail_type, array('crop', 'ratio'))) |
|
577 | 577 | { |
578 | 578 | $thumbnail_type = 'crop'; |
579 | 579 | } |
@@ -582,12 +582,12 @@ discard block |
||
582 | 582 | $thumbnail_path = sprintf('files/thumbnails/%s', getNumberingPath($this->comment_srl, 3)); |
583 | 583 | $thumbnail_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, $width, $height, $thumbnail_type); |
584 | 584 | $thumbnail_lockfile = sprintf('%s%dx%d.%s.lock', $thumbnail_path, $width, $height, $thumbnail_type); |
585 | - $thumbnail_url = Context::getRequestUri() . $thumbnail_file; |
|
585 | + $thumbnail_url = Context::getRequestUri().$thumbnail_file; |
|
586 | 586 | |
587 | 587 | // return false if a size of existing thumbnail file is 0. otherwise return the file path |
588 | - if(file_exists($thumbnail_file) || file_exists($thumbnail_lockfile)) |
|
588 | + if (file_exists($thumbnail_file) || file_exists($thumbnail_lockfile)) |
|
589 | 589 | { |
590 | - if(filesize($thumbnail_file) < 1) |
|
590 | + if (filesize($thumbnail_file) < 1) |
|
591 | 591 | { |
592 | 592 | return FALSE; |
593 | 593 | } |
@@ -605,33 +605,33 @@ discard block |
||
605 | 605 | $is_tmp_file = FALSE; |
606 | 606 | |
607 | 607 | // find an image file among attached files |
608 | - if($this->hasUploadedFiles()) |
|
608 | + if ($this->hasUploadedFiles()) |
|
609 | 609 | { |
610 | 610 | $file_list = $this->getUploadedFiles(); |
611 | 611 | |
612 | 612 | $first_image = null; |
613 | - foreach($file_list as $file) |
|
613 | + foreach ($file_list as $file) |
|
614 | 614 | { |
615 | - if($file->direct_download !== 'Y') continue; |
|
615 | + if ($file->direct_download !== 'Y') continue; |
|
616 | 616 | |
617 | - if($file->cover_image === 'Y' && file_exists($file->uploaded_filename)) |
|
617 | + if ($file->cover_image === 'Y' && file_exists($file->uploaded_filename)) |
|
618 | 618 | { |
619 | 619 | $source_file = $file->uploaded_filename; |
620 | 620 | break; |
621 | 621 | } |
622 | 622 | |
623 | - if($first_image) continue; |
|
623 | + if ($first_image) continue; |
|
624 | 624 | |
625 | - if(preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename)) |
|
625 | + if (preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename)) |
|
626 | 626 | { |
627 | - if(file_exists($file->uploaded_filename)) |
|
627 | + if (file_exists($file->uploaded_filename)) |
|
628 | 628 | { |
629 | 629 | $first_image = $file->uploaded_filename; |
630 | 630 | } |
631 | 631 | } |
632 | 632 | } |
633 | 633 | |
634 | - if(!$source_file && $first_image) |
|
634 | + if (!$source_file && $first_image) |
|
635 | 635 | { |
636 | 636 | $source_file = $first_image; |
637 | 637 | } |
@@ -639,31 +639,31 @@ discard block |
||
639 | 639 | |
640 | 640 | // get an image file from the doc content if no file attached. |
641 | 641 | $is_tmp_file = false; |
642 | - if(!$source_file) |
|
642 | + if (!$source_file) |
|
643 | 643 | { |
644 | 644 | $random = new Password(); |
645 | 645 | |
646 | 646 | preg_match_all("!<img[^>]*src=(?:\"|\')([^\"\']*?)(?:\"|\')!is", $content, $matches, PREG_SET_ORDER); |
647 | 647 | |
648 | - foreach($matches as $target_image) |
|
648 | + foreach ($matches as $target_image) |
|
649 | 649 | { |
650 | 650 | $target_src = trim($target_image[1]); |
651 | - if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue; |
|
651 | + if (preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue; |
|
652 | 652 | |
653 | - if(!preg_match('/^(http|https):\/\//i',$target_src)) |
|
653 | + if (!preg_match('/^(http|https):\/\//i', $target_src)) |
|
654 | 654 | { |
655 | 655 | $target_src = Context::getRequestUri().$target_src; |
656 | 656 | } |
657 | 657 | |
658 | 658 | $target_src = htmlspecialchars_decode($target_src); |
659 | 659 | |
660 | - $tmp_file = _XE_PATH_ . 'files/cache/tmp/' . $random->createSecureSalt(32, 'hex'); |
|
660 | + $tmp_file = _XE_PATH_.'files/cache/tmp/'.$random->createSecureSalt(32, 'hex'); |
|
661 | 661 | FileHandler::getRemoteFile($target_src, $tmp_file); |
662 | - if(!file_exists($tmp_file)) continue; |
|
662 | + if (!file_exists($tmp_file)) continue; |
|
663 | 663 | |
664 | 664 | $imageinfo = getimagesize($tmp_file); |
665 | 665 | list($_w, $_h) = $imageinfo; |
666 | - if($imageinfo === false || ($_w < ($width * 0.3) && $_h < ($height * 0.3))) { |
|
666 | + if ($imageinfo === false || ($_w < ($width * 0.3) && $_h < ($height * 0.3))) { |
|
667 | 667 | FileHandler::removeFile($tmp_file); |
668 | 668 | continue; |
669 | 669 | } |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | $output = FileHandler::createImageFile($source_file, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type); |
678 | 678 | |
679 | 679 | // Remove source file if it was temporary |
680 | - if($is_tmp_file) |
|
680 | + if ($is_tmp_file) |
|
681 | 681 | { |
682 | 682 | FileHandler::removeFile($source_file); |
683 | 683 | } |
@@ -686,14 +686,14 @@ discard block |
||
686 | 686 | FileHandler::removeFile($thumbnail_lockfile); |
687 | 687 | |
688 | 688 | // Return the thumbnail path if it was successfully generated |
689 | - if($output) |
|
689 | + if ($output) |
|
690 | 690 | { |
691 | 691 | return $thumbnail_url; |
692 | 692 | } |
693 | 693 | // Create an empty file if thumbnail generation failed |
694 | 694 | else |
695 | 695 | { |
696 | - FileHandler::writeFile($thumbnail_file, '','w'); |
|
696 | + FileHandler::writeFile($thumbnail_file, '', 'w'); |
|
697 | 697 | } |
698 | 698 | |
699 | 699 | return; |
@@ -19,11 +19,11 @@ |
||
19 | 19 | { |
20 | 20 | $event = $subject->getLastEvent(); |
21 | 21 | |
22 | - switch($event['name']) |
|
22 | + switch ($event['name']) |
|
23 | 23 | { |
24 | 24 | case 'receivedHeaders': |
25 | 25 | $this->fp = @fopen($this->filename, 'wb'); |
26 | - if(!$this->fp) |
|
26 | + if (!$this->fp) |
|
27 | 27 | { |
28 | 28 | throw new Exception("Cannot open target file '{$filename}'"); |
29 | 29 | } |
@@ -8,12 +8,12 @@ discard block |
||
8 | 8 | { |
9 | 9 | // If member_srl < 0, then return text only in the body |
10 | 10 | $member_srl = $matches[3]; |
11 | - if($member_srl < 0) |
|
11 | + if ($member_srl < 0) |
|
12 | 12 | { |
13 | 13 | return $matches[5]; |
14 | 14 | } |
15 | 15 | // If member_srl=o(not a member), return the entire body |
16 | - if(!$member_srl) |
|
16 | + if (!$member_srl) |
|
17 | 17 | { |
18 | 18 | return $matches[0]; |
19 | 19 | } |
@@ -22,22 +22,22 @@ discard block |
||
22 | 22 | $nick_name = $matches[5]; |
23 | 23 | |
24 | 24 | // Initialize global variable for cache |
25 | - if(!isset($GLOBALS['_transImageNameList'][$member_srl])) |
|
25 | + if (!isset($GLOBALS['_transImageNameList'][$member_srl])) |
|
26 | 26 | { |
27 | 27 | $GLOBALS['_transImageNameList'][$member_srl] = new stdClass(); |
28 | 28 | } |
29 | 29 | $_tmp = &$GLOBALS['_transImageNameList'][$member_srl]; |
30 | 30 | |
31 | 31 | // If pre-defined data in the global variables, return it |
32 | - if(!$_tmp->cached) |
|
32 | + if (!$_tmp->cached) |
|
33 | 33 | { |
34 | 34 | $_tmp->cached = true; |
35 | 35 | $image_name_file = sprintf('files/member_extra_info/image_name/%s%d.gif', getNumberingPath($member_srl), $member_srl); |
36 | 36 | $image_mark_file = sprintf('files/member_extra_info/image_mark/%s%d.gif', getNumberingPath($member_srl), $member_srl); |
37 | 37 | |
38 | - if(file_exists(_XE_PATH_ . $image_name_file)) |
|
38 | + if (file_exists(_XE_PATH_.$image_name_file)) |
|
39 | 39 | { |
40 | - $_tmp->image_name_file = $image_name_file . '?' . date('YmdHis', filemtime(_XE_PATH_ . $image_name_file)); |
|
40 | + $_tmp->image_name_file = $image_name_file.'?'.date('YmdHis', filemtime(_XE_PATH_.$image_name_file)); |
|
41 | 41 | $image_name_file = $_tmp->image_name_file; |
42 | 42 | } |
43 | 43 | else |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | $image_name_file = ''; |
46 | 46 | } |
47 | 47 | |
48 | - if(file_exists(_XE_PATH_ . $image_mark_file)) |
|
48 | + if (file_exists(_XE_PATH_.$image_mark_file)) |
|
49 | 49 | { |
50 | - $_tmp->image_mark_file = $image_mark_file . '?' . date('YmdHis', filemtime(_XE_PATH_ . $image_mark_file)); |
|
50 | + $_tmp->image_mark_file = $image_mark_file.'?'.date('YmdHis', filemtime(_XE_PATH_.$image_mark_file)); |
|
51 | 51 | $image_mark_file = $_tmp->image_mark_file; |
52 | 52 | } |
53 | 53 | else |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | } |
68 | 68 | |
69 | 69 | // If image name and mark doesn't exist, set the original information |
70 | - if(!$image_name_file && !$image_mark_file && !$group_image) |
|
70 | + if (!$image_name_file && !$image_mark_file && !$group_image) |
|
71 | 71 | { |
72 | 72 | return $matches[0]; |
73 | 73 | } |
@@ -76,21 +76,21 @@ discard block |
||
76 | 76 | |
77 | 77 | $config = $oMemberModel->getMemberConfig(); |
78 | 78 | |
79 | - if($config->image_name == 'Y' && $image_name_file) |
|
79 | + if ($config->image_name == 'Y' && $image_name_file) |
|
80 | 80 | { |
81 | 81 | $nick_name = sprintf('<img src="%s%s" alt="id: %s" title="id: %s" style="border:0;vertical-align:middle;margin-right:3px" />', Context::getRequestUri(), $image_name_file, strip_tags($nick_name), strip_tags($nick_name)); |
82 | 82 | } |
83 | - if($config->image_mark == 'Y' && $image_mark_file) |
|
83 | + if ($config->image_mark == 'Y' && $image_mark_file) |
|
84 | 84 | { |
85 | 85 | $nick_name = sprintf('<img src="%s%s" alt="id: %s" title="id : %s" style="border:0;vertical-align:middle;margin-right:3px"/>%s', Context::getRequestUri(), $image_mark_file, strip_tags($nick_name), strip_tags($nick_name), $nick_name); |
86 | 86 | } |
87 | 87 | |
88 | - if($group_image) |
|
88 | + if ($group_image) |
|
89 | 89 | { |
90 | 90 | $nick_name = sprintf('<img src="%s" style="border:0;max-height:16px;vertical-align:middle;margin-right:3px" alt="%s" title="%s" />%s', $group_image->src, $group_image->title, $group_image->description, $nick_name); |
91 | 91 | } |
92 | 92 | |
93 | - return preg_replace('/' . preg_quote($matches[5], '/') . '<\/' . $matches[6] . '>$/', '', $matches[0]) . $nick_name . '</' . $matches[6] . '>'; |
|
93 | + return preg_replace('/'.preg_quote($matches[5], '/').'<\/'.$matches[6].'>$/', '', $matches[0]).$nick_name.'</'.$matches[6].'>'; |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /* End of file member_extra_info.lib.php */ |
@@ -39,8 +39,7 @@ discard block |
||
39 | 39 | { |
40 | 40 | $_tmp->image_name_file = $image_name_file . '?' . date('YmdHis', filemtime(_XE_PATH_ . $image_name_file)); |
41 | 41 | $image_name_file = $_tmp->image_name_file; |
42 | - } |
|
43 | - else |
|
42 | + } else |
|
44 | 43 | { |
45 | 44 | $image_name_file = ''; |
46 | 45 | } |
@@ -49,8 +48,7 @@ discard block |
||
49 | 48 | { |
50 | 49 | $_tmp->image_mark_file = $image_mark_file . '?' . date('YmdHis', filemtime(_XE_PATH_ . $image_mark_file)); |
51 | 50 | $image_mark_file = $_tmp->image_mark_file; |
52 | - } |
|
53 | - else |
|
51 | + } else |
|
54 | 52 | { |
55 | 53 | $image_mark_file = ''; |
56 | 54 | } |
@@ -58,8 +56,7 @@ discard block |
||
58 | 56 | $site_module_info = Context::get('site_module_info'); |
59 | 57 | $group_image = $oMemberModel->getGroupImageMark($member_srl, $site_module_info->site_srl); |
60 | 58 | $_tmp->group_image = $group_image; |
61 | - } |
|
62 | - else |
|
59 | + } else |
|
63 | 60 | { |
64 | 61 | $group_image = $_tmp->group_image; |
65 | 62 | $image_name_file = $_tmp->image_name_file; |
@@ -48,11 +48,11 @@ discard block |
||
48 | 48 | */ |
49 | 49 | function LimitTag($index) |
50 | 50 | { |
51 | - if($index->page && $index->page->attrs && $index->page_count && $index->page_count->attrs) |
|
51 | + if ($index->page && $index->page->attrs && $index->page_count && $index->page_count->attrs) |
|
52 | 52 | { |
53 | - if(!isset($index->page->attrs->default)) |
|
53 | + if (!isset($index->page->attrs->default)) |
|
54 | 54 | $index->page->attrs->default = 1; |
55 | - if(!isset($index->page_count->attrs->default)) |
|
55 | + if (!isset($index->page_count->attrs->default)) |
|
56 | 56 | $index->page_count->attrs->default = 10; |
57 | 57 | $this->page = new QueryArgument($index->page); |
58 | 58 | $this->page_count = new QueryArgument($index->page_count); |
@@ -60,12 +60,12 @@ discard block |
||
60 | 60 | $this->arguments[] = $this->page_count; |
61 | 61 | } |
62 | 62 | |
63 | - if(!isset($index->list_count->attrs->default)) |
|
63 | + if (!isset($index->list_count->attrs->default)) |
|
64 | 64 | $index->list_count->attrs->default = 0; |
65 | 65 | $this->list_count = new QueryArgument($index->list_count); |
66 | 66 | $this->arguments[] = $this->list_count; |
67 | 67 | |
68 | - if(isset($index->offset) && isset($index->offset->attrs)) |
|
68 | + if (isset($index->offset) && isset($index->offset->attrs)) |
|
69 | 69 | { |
70 | 70 | $this->offset = new QueryArgument($index->offset); |
71 | 71 | $this->arguments[] = $this->offset; |
@@ -74,11 +74,11 @@ discard block |
||
74 | 74 | |
75 | 75 | function toString() |
76 | 76 | { |
77 | - if($this->page) |
|
77 | + if ($this->page) |
|
78 | 78 | { |
79 | 79 | return sprintf('new Limit(${\'%s_argument\'}, ${\'%s_argument\'}, ${\'%s_argument\'})', $this->list_count->getArgumentName(), $this->page->getArgumentName(), $this->page_count->getArgumentName()); |
80 | 80 | } |
81 | - elseif($this->offset) |
|
81 | + elseif ($this->offset) |
|
82 | 82 | { |
83 | 83 | return sprintf('new Limit(${\'%s_argument\'}, NULL, NULL, ${\'%s_argument\'})', $this->list_count->getArgumentName(), $this->offset->getArgumentName()); |
84 | 84 | } |
@@ -50,18 +50,21 @@ discard block |
||
50 | 50 | { |
51 | 51 | if($index->page && $index->page->attrs && $index->page_count && $index->page_count->attrs) |
52 | 52 | { |
53 | - if(!isset($index->page->attrs->default)) |
|
54 | - $index->page->attrs->default = 1; |
|
55 | - if(!isset($index->page_count->attrs->default)) |
|
56 | - $index->page_count->attrs->default = 10; |
|
53 | + if(!isset($index->page->attrs->default)) { |
|
54 | + $index->page->attrs->default = 1; |
|
55 | + } |
|
56 | + if(!isset($index->page_count->attrs->default)) { |
|
57 | + $index->page_count->attrs->default = 10; |
|
58 | + } |
|
57 | 59 | $this->page = new QueryArgument($index->page); |
58 | 60 | $this->page_count = new QueryArgument($index->page_count); |
59 | 61 | $this->arguments[] = $this->page; |
60 | 62 | $this->arguments[] = $this->page_count; |
61 | 63 | } |
62 | 64 | |
63 | - if(!isset($index->list_count->attrs->default)) |
|
64 | - $index->list_count->attrs->default = 0; |
|
65 | + if(!isset($index->list_count->attrs->default)) { |
|
66 | + $index->list_count->attrs->default = 0; |
|
67 | + } |
|
65 | 68 | $this->list_count = new QueryArgument($index->list_count); |
66 | 69 | $this->arguments[] = $this->list_count; |
67 | 70 | |
@@ -77,12 +80,10 @@ discard block |
||
77 | 80 | if($this->page) |
78 | 81 | { |
79 | 82 | return sprintf('new Limit(${\'%s_argument\'}, ${\'%s_argument\'}, ${\'%s_argument\'})', $this->list_count->getArgumentName(), $this->page->getArgumentName(), $this->page_count->getArgumentName()); |
80 | - } |
|
81 | - elseif($this->offset) |
|
83 | + } elseif($this->offset) |
|
82 | 84 | { |
83 | 85 | return sprintf('new Limit(${\'%s_argument\'}, NULL, NULL, ${\'%s_argument\'})', $this->list_count->getArgumentName(), $this->offset->getArgumentName()); |
84 | - } |
|
85 | - else |
|
86 | + } else |
|
86 | 87 | { |
87 | 88 | return sprintf('new Limit(${\'%s_argument\'})', $this->list_count->getArgumentName()); |
88 | 89 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | function Limit($list_count, $page = NULL, $page_count = NULL, $offset = NULL) |
45 | 45 | { |
46 | 46 | $this->list_count = $list_count; |
47 | - if($page) |
|
47 | + if ($page) |
|
48 | 48 | { |
49 | 49 | $list_count_value = $list_count->getValue(); |
50 | 50 | $page_value = $page->getValue(); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $this->page_count = $page_count; |
53 | 53 | $this->page = $page; |
54 | 54 | } |
55 | - elseif($offset) |
|
55 | + elseif ($offset) |
|
56 | 56 | { |
57 | 57 | $this->start = $offset->getValue(); |
58 | 58 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | */ |
65 | 65 | function isPageHandler() |
66 | 66 | { |
67 | - if($this->page) |
|
67 | + if ($this->page) |
|
68 | 68 | { |
69 | 69 | return true; |
70 | 70 | } |
@@ -86,9 +86,9 @@ discard block |
||
86 | 86 | |
87 | 87 | function toString() |
88 | 88 | { |
89 | - if($this->page || $this->start) |
|
89 | + if ($this->page || $this->start) |
|
90 | 90 | { |
91 | - return $this->start . ' , ' . $this->list_count->getValue(); |
|
91 | + return $this->start.' , '.$this->list_count->getValue(); |
|
92 | 92 | } |
93 | 93 | else |
94 | 94 | { |
@@ -51,8 +51,7 @@ discard block |
||
51 | 51 | $this->start = ($page_value - 1) * $list_count_value; |
52 | 52 | $this->page_count = $page_count; |
53 | 53 | $this->page = $page; |
54 | - } |
|
55 | - elseif($offset) |
|
54 | + } elseif($offset) |
|
56 | 55 | { |
57 | 56 | $this->start = $offset->getValue(); |
58 | 57 | } |
@@ -67,8 +66,7 @@ discard block |
||
67 | 66 | if($this->page) |
68 | 67 | { |
69 | 68 | return true; |
70 | - } |
|
71 | - else |
|
69 | + } else |
|
72 | 70 | { |
73 | 71 | return false; |
74 | 72 | } |
@@ -89,8 +87,7 @@ discard block |
||
89 | 87 | if($this->page || $this->start) |
90 | 88 | { |
91 | 89 | return $this->start . ' , ' . $this->list_count->getValue(); |
92 | - } |
|
93 | - else |
|
90 | + } else |
|
94 | 91 | { |
95 | 92 | return $this->list_count->getValue(); |
96 | 93 | } |
@@ -23,7 +23,9 @@ discard block |
||
23 | 23 | function DBMysqli($auto_connect = TRUE) |
24 | 24 | { |
25 | 25 | $this->_setDBInfo(); |
26 | - if($auto_connect) $this->_connect(); |
|
26 | + if($auto_connect) { |
|
27 | + $this->_connect(); |
|
28 | + } |
|
27 | 29 | } |
28 | 30 | |
29 | 31 | /** |
@@ -51,8 +53,7 @@ discard block |
||
51 | 53 | , $connection["db_password"] |
52 | 54 | , $connection["db_database"] |
53 | 55 | , $connection["db_port"]); |
54 | - } |
|
55 | - else |
|
56 | + } else |
|
56 | 57 | { |
57 | 58 | $result = @mysqli_connect($connection["db_hostname"] |
58 | 59 | , $connection["db_userid"] |
@@ -209,8 +210,7 @@ discard block |
||
209 | 210 | $params[] = $v; |
210 | 211 | $types .= $type; |
211 | 212 | } |
212 | - } |
|
213 | - else |
|
213 | + } else |
|
214 | 214 | { |
215 | 215 | $params[] = $value; |
216 | 216 | $types .= $type; |
@@ -249,10 +249,12 @@ discard block |
||
249 | 249 | $longtext_exists = false; |
250 | 250 | foreach($fields as $field) |
251 | 251 | { |
252 | - if(isset($resultArray[$field->name])) // When joined tables are used and the same column name appears twice, we should add it separately, otherwise bind_result fails |
|
252 | + if(isset($resultArray[$field->name])) { |
|
253 | + // When joined tables are used and the same column name appears twice, we should add it separately, otherwise bind_result fails |
|
253 | 254 | { |
254 | 255 | $field->name = 'repeat_' . $field->name; |
255 | 256 | } |
257 | + } |
|
256 | 258 | |
257 | 259 | // Array passed needs to contain references, not values |
258 | 260 | $row[$field->name] = ""; |
@@ -301,8 +303,7 @@ discard block |
||
301 | 303 | { |
302 | 304 | $output[$arrayIndexEndValue--] = $row; |
303 | 305 | } |
304 | - } |
|
305 | - else |
|
306 | + } else |
|
306 | 307 | { |
307 | 308 | $output = $rows; |
308 | 309 | } |
@@ -312,8 +313,7 @@ discard block |
||
312 | 313 | if(isset($arrayIndexEndValue)) |
313 | 314 | { |
314 | 315 | return $output; |
315 | - } |
|
316 | - else |
|
316 | + } else |
|
317 | 317 | { |
318 | 318 | return $output[0]; |
319 | 319 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | function DBMysqli($auto_connect = TRUE) |
24 | 24 | { |
25 | 25 | $this->_setDBInfo(); |
26 | - if($auto_connect) $this->_connect(); |
|
26 | + if ($auto_connect) $this->_connect(); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | function __connect($connection) |
45 | 45 | { |
46 | 46 | // Attempt to connect |
47 | - if($connection["db_port"]) |
|
47 | + if ($connection["db_port"]) |
|
48 | 48 | { |
49 | 49 | $result = @mysqli_connect($connection["db_hostname"] |
50 | 50 | , $connection["db_userid"] |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | , $connection["db_database"]); |
61 | 61 | } |
62 | 62 | $error = mysqli_connect_errno(); |
63 | - if($error) |
|
63 | + if ($error) |
|
64 | 64 | { |
65 | 65 | $this->setError($error, mysqli_connect_error()); |
66 | 66 | return; |
@@ -87,11 +87,11 @@ discard block |
||
87 | 87 | */ |
88 | 88 | function addQuotes($string) |
89 | 89 | { |
90 | - if(version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc()) |
|
90 | + if (version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc()) |
|
91 | 91 | { |
92 | 92 | $string = stripslashes(str_replace("\\", "\\\\", $string)); |
93 | 93 | } |
94 | - if(!is_numeric($string)) |
|
94 | + if (!is_numeric($string)) |
|
95 | 95 | { |
96 | 96 | $connection = $this->_getConnection('master'); |
97 | 97 | $string = mysqli_escape_string($connection, $string); |
@@ -108,23 +108,23 @@ discard block |
||
108 | 108 | */ |
109 | 109 | function __query($query, $connection) |
110 | 110 | { |
111 | - if($this->use_prepared_statements == 'Y') |
|
111 | + if ($this->use_prepared_statements == 'Y') |
|
112 | 112 | { |
113 | 113 | // 1. Prepare query |
114 | 114 | $stmt = mysqli_prepare($connection, $query); |
115 | - if($stmt) |
|
115 | + if ($stmt) |
|
116 | 116 | { |
117 | 117 | $types = ''; |
118 | 118 | $params = array(); |
119 | 119 | $this->_prepareQueryParameters($types, $params); |
120 | 120 | |
121 | - if(!empty($params)) |
|
121 | + if (!empty($params)) |
|
122 | 122 | { |
123 | 123 | $args[0] = $stmt; |
124 | 124 | $args[1] = $types; |
125 | 125 | |
126 | 126 | $i = 2; |
127 | - foreach($params as $key => $param) |
|
127 | + foreach ($params as $key => $param) |
|
128 | 128 | { |
129 | 129 | $copy[$key] = $param; |
130 | 130 | $args[$i++] = &$copy[$key]; |
@@ -132,18 +132,18 @@ discard block |
||
132 | 132 | |
133 | 133 | // 2. Bind parameters |
134 | 134 | $status = call_user_func_array('mysqli_stmt_bind_param', $args); |
135 | - if(!$status) |
|
135 | + if (!$status) |
|
136 | 136 | { |
137 | - $this->setError(-1, "Invalid arguments: $query" . mysqli_error($connection)); |
|
137 | + $this->setError(-1, "Invalid arguments: $query".mysqli_error($connection)); |
|
138 | 138 | } |
139 | 139 | } |
140 | 140 | |
141 | 141 | // 3. Execute query |
142 | 142 | $status = mysqli_stmt_execute($stmt); |
143 | 143 | |
144 | - if(!$status) |
|
144 | + if (!$status) |
|
145 | 145 | { |
146 | - $this->setError(-1, "Prepared statement failed: $query" . mysqli_error($connection)); |
|
146 | + $this->setError(-1, "Prepared statement failed: $query".mysqli_error($connection)); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | // Return stmt for other processing - like retrieving resultset (_fetch) |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $result = mysqli_query($connection, $query); |
156 | 156 | // Error Check |
157 | 157 | $error = mysqli_error($connection); |
158 | - if($error) |
|
158 | + if ($error) |
|
159 | 159 | { |
160 | 160 | $this->setError(mysqli_errno($connection), $error); |
161 | 161 | } |
@@ -174,23 +174,23 @@ discard block |
||
174 | 174 | { |
175 | 175 | $types = ''; |
176 | 176 | $params = array(); |
177 | - if(!$this->param) |
|
177 | + if (!$this->param) |
|
178 | 178 | { |
179 | 179 | return; |
180 | 180 | } |
181 | 181 | |
182 | - foreach($this->param as $k => $o) |
|
182 | + foreach ($this->param as $k => $o) |
|
183 | 183 | { |
184 | 184 | $value = $o->getUnescapedValue(); |
185 | 185 | $type = $o->getType(); |
186 | 186 | |
187 | 187 | // Skip column names -> this should be concatenated to query string |
188 | - if($o->isColumnName()) |
|
188 | + if ($o->isColumnName()) |
|
189 | 189 | { |
190 | 190 | continue; |
191 | 191 | } |
192 | 192 | |
193 | - switch($type) |
|
193 | + switch ($type) |
|
194 | 194 | { |
195 | 195 | case 'number' : |
196 | 196 | $type = 'i'; |
@@ -202,9 +202,9 @@ discard block |
||
202 | 202 | $type = 's'; |
203 | 203 | } |
204 | 204 | |
205 | - if(is_array($value)) |
|
205 | + if (is_array($value)) |
|
206 | 206 | { |
207 | - foreach($value as $v) |
|
207 | + foreach ($value as $v) |
|
208 | 208 | { |
209 | 209 | $params[] = $v; |
210 | 210 | $types .= $type; |
@@ -226,12 +226,12 @@ discard block |
||
226 | 226 | */ |
227 | 227 | function _fetch($result, $arrayIndexEndValue = NULL) |
228 | 228 | { |
229 | - if($this->use_prepared_statements != 'Y') |
|
229 | + if ($this->use_prepared_statements != 'Y') |
|
230 | 230 | { |
231 | 231 | return parent::_fetch($result, $arrayIndexEndValue); |
232 | 232 | } |
233 | 233 | $output = array(); |
234 | - if(!$this->isConnected() || $this->isError() || !$result) |
|
234 | + if (!$this->isConnected() || $this->isError() || !$result) |
|
235 | 235 | { |
236 | 236 | return $output; |
237 | 237 | } |
@@ -247,25 +247,25 @@ discard block |
||
247 | 247 | * MYSQLI_TYPE for longtext is 252 |
248 | 248 | */ |
249 | 249 | $longtext_exists = false; |
250 | - foreach($fields as $field) |
|
250 | + foreach ($fields as $field) |
|
251 | 251 | { |
252 | - if(isset($resultArray[$field->name])) // When joined tables are used and the same column name appears twice, we should add it separately, otherwise bind_result fails |
|
252 | + if (isset($resultArray[$field->name])) // When joined tables are used and the same column name appears twice, we should add it separately, otherwise bind_result fails |
|
253 | 253 | { |
254 | - $field->name = 'repeat_' . $field->name; |
|
254 | + $field->name = 'repeat_'.$field->name; |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | // Array passed needs to contain references, not values |
258 | 258 | $row[$field->name] = ""; |
259 | 259 | $resultArray[$field->name] = &$row[$field->name]; |
260 | 260 | |
261 | - if($field->type == 252) |
|
261 | + if ($field->type == 252) |
|
262 | 262 | { |
263 | 263 | $longtext_exists = true; |
264 | 264 | } |
265 | 265 | } |
266 | 266 | $resultArray = array_merge(array($stmt), $resultArray); |
267 | 267 | |
268 | - if($longtext_exists) |
|
268 | + if ($longtext_exists) |
|
269 | 269 | { |
270 | 270 | mysqli_stmt_store_result($stmt); |
271 | 271 | } |
@@ -273,17 +273,17 @@ discard block |
||
273 | 273 | call_user_func_array('mysqli_stmt_bind_result', $resultArray); |
274 | 274 | |
275 | 275 | $rows = array(); |
276 | - while(mysqli_stmt_fetch($stmt)) |
|
276 | + while (mysqli_stmt_fetch($stmt)) |
|
277 | 277 | { |
278 | 278 | $resultObject = new stdClass(); |
279 | 279 | |
280 | - foreach($resultArray as $key => $value) |
|
280 | + foreach ($resultArray as $key => $value) |
|
281 | 281 | { |
282 | - if($key === 0) |
|
282 | + if ($key === 0) |
|
283 | 283 | { |
284 | 284 | continue; // Skip stmt object |
285 | 285 | } |
286 | - if(strpos($key, 'repeat_')) |
|
286 | + if (strpos($key, 'repeat_')) |
|
287 | 287 | { |
288 | 288 | $key = substr($key, 6); |
289 | 289 | } |
@@ -295,9 +295,9 @@ discard block |
||
295 | 295 | |
296 | 296 | mysqli_stmt_close($stmt); |
297 | 297 | |
298 | - if($arrayIndexEndValue) |
|
298 | + if ($arrayIndexEndValue) |
|
299 | 299 | { |
300 | - foreach($rows as $row) |
|
300 | + foreach ($rows as $row) |
|
301 | 301 | { |
302 | 302 | $output[$arrayIndexEndValue--] = $row; |
303 | 303 | } |
@@ -307,9 +307,9 @@ discard block |
||
307 | 307 | $output = $rows; |
308 | 308 | } |
309 | 309 | |
310 | - if(count($output) == 1) |
|
310 | + if (count($output) == 1) |
|
311 | 311 | { |
312 | - if(isset($arrayIndexEndValue)) |
|
312 | + if (isset($arrayIndexEndValue)) |
|
313 | 313 | { |
314 | 314 | return $output; |
315 | 315 | } |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | */ |
331 | 331 | function _executeInsertAct($queryObject, $with_values = false) |
332 | 332 | { |
333 | - if($this->use_prepared_statements != 'Y') |
|
333 | + if ($this->use_prepared_statements != 'Y') |
|
334 | 334 | { |
335 | 335 | return parent::_executeInsertAct($queryObject); |
336 | 336 | } |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | */ |
349 | 349 | function _executeUpdateAct($queryObject, $with_values = false) |
350 | 350 | { |
351 | - if($this->use_prepared_statements != 'Y') |
|
351 | + if ($this->use_prepared_statements != 'Y') |
|
352 | 352 | { |
353 | 353 | return parent::_executeUpdateAct($queryObject); |
354 | 354 | } |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | */ |
367 | 367 | function _executeDeleteAct($queryObject, $with_values = false) |
368 | 368 | { |
369 | - if($this->use_prepared_statements != 'Y') |
|
369 | + if ($this->use_prepared_statements != 'Y') |
|
370 | 370 | { |
371 | 371 | return parent::_executeDeleteAct($queryObject); |
372 | 372 | } |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | */ |
388 | 388 | function _executeSelectAct($queryObject, $connection = null, $with_values = false) |
389 | 389 | { |
390 | - if($this->use_prepared_statements != 'Y') |
|
390 | + if ($this->use_prepared_statements != 'Y') |
|
391 | 391 | { |
392 | 392 | return parent::_executeSelectAct($queryObject, $connection); |
393 | 393 | } |
@@ -23,7 +23,9 @@ discard block |
||
23 | 23 | function DBMysqli_innodb($auto_connect = TRUE) |
24 | 24 | { |
25 | 25 | $this->_setDBInfo(); |
26 | - if($auto_connect) $this->_connect(); |
|
26 | + if($auto_connect) { |
|
27 | + $this->_connect(); |
|
28 | + } |
|
27 | 29 | } |
28 | 30 | |
29 | 31 | /** |
@@ -51,8 +53,7 @@ discard block |
||
51 | 53 | , $connection["db_password"] |
52 | 54 | , $connection["db_database"] |
53 | 55 | , $connection["db_port"]); |
54 | - } |
|
55 | - else |
|
56 | + } else |
|
56 | 57 | { |
57 | 58 | $result = @mysqli_connect($connection["db_hostname"] |
58 | 59 | , $connection["db_userid"] |
@@ -92,8 +93,7 @@ discard block |
||
92 | 93 | if(!$transactionLevel) |
93 | 94 | { |
94 | 95 | $this->_query("begin"); |
95 | - } |
|
96 | - else |
|
96 | + } else |
|
97 | 97 | { |
98 | 98 | $this->_query("SAVEPOINT SP" . $transactionLevel, $connection); |
99 | 99 | } |
@@ -114,8 +114,7 @@ discard block |
||
114 | 114 | if($point) |
115 | 115 | { |
116 | 116 | $this->_query("ROLLBACK TO SP" . $point, $connection); |
117 | - } |
|
118 | - else |
|
117 | + } else |
|
119 | 118 | { |
120 | 119 | mysqli_rollback($connection); |
121 | 120 | $this->setQueryLog( array("query"=>"rollback") ); |
@@ -267,8 +266,7 @@ discard block |
||
267 | 266 | $params[] = $v; |
268 | 267 | $types .= $type; |
269 | 268 | } |
270 | - } |
|
271 | - else |
|
269 | + } else |
|
272 | 270 | { |
273 | 271 | $params[] = $value; |
274 | 272 | $types .= $type; |
@@ -307,10 +305,12 @@ discard block |
||
307 | 305 | $longtext_exists = false; |
308 | 306 | foreach($fields as $field) |
309 | 307 | { |
310 | - if(isset($resultArray[$field->name])) // When joined tables are used and the same column name appears twice, we should add it separately, otherwise bind_result fails |
|
308 | + if(isset($resultArray[$field->name])) { |
|
309 | + // When joined tables are used and the same column name appears twice, we should add it separately, otherwise bind_result fails |
|
311 | 310 | { |
312 | 311 | $field->name = 'repeat_' . $field->name; |
313 | 312 | } |
313 | + } |
|
314 | 314 | |
315 | 315 | // Array passed needs to contain references, not values |
316 | 316 | $row[$field->name] = ""; |
@@ -359,8 +359,7 @@ discard block |
||
359 | 359 | { |
360 | 360 | $output[$arrayIndexEndValue--] = $row; |
361 | 361 | } |
362 | - } |
|
363 | - else |
|
362 | + } else |
|
364 | 363 | { |
365 | 364 | $output = $rows; |
366 | 365 | } |
@@ -370,8 +369,7 @@ discard block |
||
370 | 369 | if(isset($arrayIndexEndValue)) |
371 | 370 | { |
372 | 371 | return $output; |
373 | - } |
|
374 | - else |
|
372 | + } else |
|
375 | 373 | { |
376 | 374 | return $output[0]; |
377 | 375 | } |
@@ -512,8 +510,7 @@ discard block |
||
512 | 510 | if(!is_array($xml_obj->table->column)) |
513 | 511 | { |
514 | 512 | $columns[] = $xml_obj->table->column; |
515 | - } |
|
516 | - else |
|
513 | + } else |
|
517 | 514 | { |
518 | 515 | $columns = $xml_obj->table->column; |
519 | 516 | } |
@@ -535,12 +532,10 @@ discard block |
||
535 | 532 | if($primary_key) |
536 | 533 | { |
537 | 534 | $primary_list[] = $name; |
538 | - } |
|
539 | - else if($unique) |
|
535 | + } else if($unique) |
|
540 | 536 | { |
541 | 537 | $unique_list[$unique][] = $name; |
542 | - } |
|
543 | - else if($index) |
|
538 | + } else if($index) |
|
544 | 539 | { |
545 | 540 | $index_list[$index][] = $name; |
546 | 541 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | function DBMysqli_innodb($auto_connect = TRUE) |
24 | 24 | { |
25 | 25 | $this->_setDBInfo(); |
26 | - if($auto_connect) $this->_connect(); |
|
26 | + if ($auto_connect) $this->_connect(); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | function __connect($connection) |
45 | 45 | { |
46 | 46 | // Attempt to connect |
47 | - if($connection["db_port"]) |
|
47 | + if ($connection["db_port"]) |
|
48 | 48 | { |
49 | 49 | $result = @mysqli_connect($connection["db_hostname"] |
50 | 50 | , $connection["db_userid"] |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | , $connection["db_database"]); |
61 | 61 | } |
62 | 62 | $error = mysqli_connect_errno(); |
63 | - if($error) |
|
63 | + if ($error) |
|
64 | 64 | { |
65 | 65 | $this->setError($error, mysqli_connect_error()); |
66 | 66 | return; |
@@ -89,13 +89,13 @@ discard block |
||
89 | 89 | { |
90 | 90 | $connection = $this->_getConnection('master'); |
91 | 91 | |
92 | - if(!$transactionLevel) |
|
92 | + if (!$transactionLevel) |
|
93 | 93 | { |
94 | 94 | $this->_query("begin"); |
95 | 95 | } |
96 | 96 | else |
97 | 97 | { |
98 | - $this->_query("SAVEPOINT SP" . $transactionLevel, $connection); |
|
98 | + $this->_query("SAVEPOINT SP".$transactionLevel, $connection); |
|
99 | 99 | } |
100 | 100 | return true; |
101 | 101 | } |
@@ -111,14 +111,14 @@ discard block |
||
111 | 111 | |
112 | 112 | $point = $transactionLevel - 1; |
113 | 113 | |
114 | - if($point) |
|
114 | + if ($point) |
|
115 | 115 | { |
116 | - $this->_query("ROLLBACK TO SP" . $point, $connection); |
|
116 | + $this->_query("ROLLBACK TO SP".$point, $connection); |
|
117 | 117 | } |
118 | 118 | else |
119 | 119 | { |
120 | 120 | mysqli_rollback($connection); |
121 | - $this->setQueryLog( array("query"=>"rollback") ); |
|
121 | + $this->setQueryLog(array("query"=>"rollback")); |
|
122 | 122 | } |
123 | 123 | return true; |
124 | 124 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | { |
133 | 133 | $connection = $this->_getConnection('master'); |
134 | 134 | mysqli_commit($connection); |
135 | - $this->setQueryLog( array("query"=>"commit") ); |
|
135 | + $this->setQueryLog(array("query"=>"commit")); |
|
136 | 136 | return true; |
137 | 137 | } |
138 | 138 | |
@@ -145,11 +145,11 @@ discard block |
||
145 | 145 | */ |
146 | 146 | function addQuotes($string) |
147 | 147 | { |
148 | - if(version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc()) |
|
148 | + if (version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc()) |
|
149 | 149 | { |
150 | 150 | $string = stripslashes(str_replace("\\", "\\\\", $string)); |
151 | 151 | } |
152 | - if(!is_numeric($string)) |
|
152 | + if (!is_numeric($string)) |
|
153 | 153 | { |
154 | 154 | $connection = $this->_getConnection('master'); |
155 | 155 | $string = mysqli_escape_string($connection, $string); |
@@ -166,23 +166,23 @@ discard block |
||
166 | 166 | */ |
167 | 167 | function __query($query, $connection) |
168 | 168 | { |
169 | - if($this->use_prepared_statements == 'Y') |
|
169 | + if ($this->use_prepared_statements == 'Y') |
|
170 | 170 | { |
171 | 171 | // 1. Prepare query |
172 | 172 | $stmt = mysqli_prepare($connection, $query); |
173 | - if($stmt) |
|
173 | + if ($stmt) |
|
174 | 174 | { |
175 | 175 | $types = ''; |
176 | 176 | $params = array(); |
177 | 177 | $this->_prepareQueryParameters($types, $params); |
178 | 178 | |
179 | - if(!empty($params)) |
|
179 | + if (!empty($params)) |
|
180 | 180 | { |
181 | 181 | $args[0] = $stmt; |
182 | 182 | $args[1] = $types; |
183 | 183 | |
184 | 184 | $i = 2; |
185 | - foreach($params as $key => $param) |
|
185 | + foreach ($params as $key => $param) |
|
186 | 186 | { |
187 | 187 | $copy[$key] = $param; |
188 | 188 | $args[$i++] = &$copy[$key]; |
@@ -190,18 +190,18 @@ discard block |
||
190 | 190 | |
191 | 191 | // 2. Bind parameters |
192 | 192 | $status = call_user_func_array('mysqli_stmt_bind_param', $args); |
193 | - if(!$status) |
|
193 | + if (!$status) |
|
194 | 194 | { |
195 | - $this->setError(-1, "Invalid arguments: $query" . mysqli_error($connection)); |
|
195 | + $this->setError(-1, "Invalid arguments: $query".mysqli_error($connection)); |
|
196 | 196 | } |
197 | 197 | } |
198 | 198 | |
199 | 199 | // 3. Execute query |
200 | 200 | $status = mysqli_stmt_execute($stmt); |
201 | 201 | |
202 | - if(!$status) |
|
202 | + if (!$status) |
|
203 | 203 | { |
204 | - $this->setError(-1, "Prepared statement failed: $query" . mysqli_error($connection)); |
|
204 | + $this->setError(-1, "Prepared statement failed: $query".mysqli_error($connection)); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | // Return stmt for other processing - like retrieving resultset (_fetch) |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | $result = mysqli_query($connection, $query); |
214 | 214 | // Error Check |
215 | 215 | $error = mysqli_error($connection); |
216 | - if($error) |
|
216 | + if ($error) |
|
217 | 217 | { |
218 | 218 | $this->setError(mysqli_errno($connection), $error); |
219 | 219 | } |
@@ -232,23 +232,23 @@ discard block |
||
232 | 232 | { |
233 | 233 | $types = ''; |
234 | 234 | $params = array(); |
235 | - if(!$this->param) |
|
235 | + if (!$this->param) |
|
236 | 236 | { |
237 | 237 | return; |
238 | 238 | } |
239 | 239 | |
240 | - foreach($this->param as $k => $o) |
|
240 | + foreach ($this->param as $k => $o) |
|
241 | 241 | { |
242 | 242 | $value = $o->getUnescapedValue(); |
243 | 243 | $type = $o->getType(); |
244 | 244 | |
245 | 245 | // Skip column names -> this should be concatenated to query string |
246 | - if($o->isColumnName()) |
|
246 | + if ($o->isColumnName()) |
|
247 | 247 | { |
248 | 248 | continue; |
249 | 249 | } |
250 | 250 | |
251 | - switch($type) |
|
251 | + switch ($type) |
|
252 | 252 | { |
253 | 253 | case 'number' : |
254 | 254 | $type = 'i'; |
@@ -260,9 +260,9 @@ discard block |
||
260 | 260 | $type = 's'; |
261 | 261 | } |
262 | 262 | |
263 | - if(is_array($value)) |
|
263 | + if (is_array($value)) |
|
264 | 264 | { |
265 | - foreach($value as $v) |
|
265 | + foreach ($value as $v) |
|
266 | 266 | { |
267 | 267 | $params[] = $v; |
268 | 268 | $types .= $type; |
@@ -284,12 +284,12 @@ discard block |
||
284 | 284 | */ |
285 | 285 | function _fetch($result, $arrayIndexEndValue = NULL) |
286 | 286 | { |
287 | - if($this->use_prepared_statements != 'Y') |
|
287 | + if ($this->use_prepared_statements != 'Y') |
|
288 | 288 | { |
289 | 289 | return parent::_fetch($result, $arrayIndexEndValue); |
290 | 290 | } |
291 | 291 | $output = array(); |
292 | - if(!$this->isConnected() || $this->isError() || !$result) |
|
292 | + if (!$this->isConnected() || $this->isError() || !$result) |
|
293 | 293 | { |
294 | 294 | return $output; |
295 | 295 | } |
@@ -305,25 +305,25 @@ discard block |
||
305 | 305 | * MYSQLI_TYPE for longtext is 252 |
306 | 306 | */ |
307 | 307 | $longtext_exists = false; |
308 | - foreach($fields as $field) |
|
308 | + foreach ($fields as $field) |
|
309 | 309 | { |
310 | - if(isset($resultArray[$field->name])) // When joined tables are used and the same column name appears twice, we should add it separately, otherwise bind_result fails |
|
310 | + if (isset($resultArray[$field->name])) // When joined tables are used and the same column name appears twice, we should add it separately, otherwise bind_result fails |
|
311 | 311 | { |
312 | - $field->name = 'repeat_' . $field->name; |
|
312 | + $field->name = 'repeat_'.$field->name; |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | // Array passed needs to contain references, not values |
316 | 316 | $row[$field->name] = ""; |
317 | 317 | $resultArray[$field->name] = &$row[$field->name]; |
318 | 318 | |
319 | - if($field->type == 252) |
|
319 | + if ($field->type == 252) |
|
320 | 320 | { |
321 | 321 | $longtext_exists = true; |
322 | 322 | } |
323 | 323 | } |
324 | 324 | $resultArray = array_merge(array($stmt), $resultArray); |
325 | 325 | |
326 | - if($longtext_exists) |
|
326 | + if ($longtext_exists) |
|
327 | 327 | { |
328 | 328 | mysqli_stmt_store_result($stmt); |
329 | 329 | } |
@@ -331,17 +331,17 @@ discard block |
||
331 | 331 | call_user_func_array('mysqli_stmt_bind_result', $resultArray); |
332 | 332 | |
333 | 333 | $rows = array(); |
334 | - while(mysqli_stmt_fetch($stmt)) |
|
334 | + while (mysqli_stmt_fetch($stmt)) |
|
335 | 335 | { |
336 | 336 | $resultObject = new stdClass(); |
337 | 337 | |
338 | - foreach($resultArray as $key => $value) |
|
338 | + foreach ($resultArray as $key => $value) |
|
339 | 339 | { |
340 | - if($key === 0) |
|
340 | + if ($key === 0) |
|
341 | 341 | { |
342 | 342 | continue; // Skip stmt object |
343 | 343 | } |
344 | - if(strpos($key, 'repeat_')) |
|
344 | + if (strpos($key, 'repeat_')) |
|
345 | 345 | { |
346 | 346 | $key = substr($key, 6); |
347 | 347 | } |
@@ -353,9 +353,9 @@ discard block |
||
353 | 353 | |
354 | 354 | mysqli_stmt_close($stmt); |
355 | 355 | |
356 | - if($arrayIndexEndValue) |
|
356 | + if ($arrayIndexEndValue) |
|
357 | 357 | { |
358 | - foreach($rows as $row) |
|
358 | + foreach ($rows as $row) |
|
359 | 359 | { |
360 | 360 | $output[$arrayIndexEndValue--] = $row; |
361 | 361 | } |
@@ -365,9 +365,9 @@ discard block |
||
365 | 365 | $output = $rows; |
366 | 366 | } |
367 | 367 | |
368 | - if(count($output) == 1) |
|
368 | + if (count($output) == 1) |
|
369 | 369 | { |
370 | - if(isset($arrayIndexEndValue)) |
|
370 | + if (isset($arrayIndexEndValue)) |
|
371 | 371 | { |
372 | 372 | return $output; |
373 | 373 | } |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | */ |
389 | 389 | function _executeInsertAct($queryObject, $with_values = false) |
390 | 390 | { |
391 | - if($this->use_prepared_statements != 'Y') |
|
391 | + if ($this->use_prepared_statements != 'Y') |
|
392 | 392 | { |
393 | 393 | return parent::_executeInsertAct($queryObject); |
394 | 394 | } |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | */ |
407 | 407 | function _executeUpdateAct($queryObject, $with_values = false) |
408 | 408 | { |
409 | - if($this->use_prepared_statements != 'Y') |
|
409 | + if ($this->use_prepared_statements != 'Y') |
|
410 | 410 | { |
411 | 411 | return parent::_executeUpdateAct($queryObject); |
412 | 412 | } |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | */ |
425 | 425 | function _executeDeleteAct($queryObject, $with_values = false) |
426 | 426 | { |
427 | - if($this->use_prepared_statements != 'Y') |
|
427 | + if ($this->use_prepared_statements != 'Y') |
|
428 | 428 | { |
429 | 429 | return parent::_executeDeleteAct($queryObject); |
430 | 430 | } |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | */ |
446 | 446 | function _executeSelectAct($queryObject, $connection = null, $with_values = false) |
447 | 447 | { |
448 | - if($this->use_prepared_statements != 'Y') |
|
448 | + if ($this->use_prepared_statements != 'Y') |
|
449 | 449 | { |
450 | 450 | return parent::_executeSelectAct($queryObject, $connection); |
451 | 451 | } |
@@ -503,13 +503,13 @@ discard block |
||
503 | 503 | $xml_obj = $oXml->parse($xml_doc); |
504 | 504 | // Create a table schema |
505 | 505 | $table_name = $xml_obj->table->attrs->name; |
506 | - if($this->isTableExists($table_name)) |
|
506 | + if ($this->isTableExists($table_name)) |
|
507 | 507 | { |
508 | 508 | return; |
509 | 509 | } |
510 | - $table_name = $this->prefix . $table_name; |
|
510 | + $table_name = $this->prefix.$table_name; |
|
511 | 511 | |
512 | - if(!is_array($xml_obj->table->column)) |
|
512 | + if (!is_array($xml_obj->table->column)) |
|
513 | 513 | { |
514 | 514 | $columns[] = $xml_obj->table->column; |
515 | 515 | } |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | $columns = $xml_obj->table->column; |
519 | 519 | } |
520 | 520 | |
521 | - foreach($columns as $column) |
|
521 | + foreach ($columns as $column) |
|
522 | 522 | { |
523 | 523 | $name = $column->attrs->name; |
524 | 524 | $type = $column->attrs->type; |
@@ -530,47 +530,47 @@ discard block |
||
530 | 530 | $default = $column->attrs->default; |
531 | 531 | $auto_increment = $column->attrs->auto_increment; |
532 | 532 | |
533 | - $column_schema[] = sprintf('`%s` %s%s %s %s %s', $name, $this->column_type[$type], $size ? '(' . $size . ')' : '', isset($default) ? "default '" . $default . "'" : '', $notnull ? 'not null' : '', $auto_increment ? 'auto_increment' : ''); |
|
533 | + $column_schema[] = sprintf('`%s` %s%s %s %s %s', $name, $this->column_type[$type], $size ? '('.$size.')' : '', isset($default) ? "default '".$default."'" : '', $notnull ? 'not null' : '', $auto_increment ? 'auto_increment' : ''); |
|
534 | 534 | |
535 | - if($primary_key) |
|
535 | + if ($primary_key) |
|
536 | 536 | { |
537 | 537 | $primary_list[] = $name; |
538 | 538 | } |
539 | - else if($unique) |
|
539 | + else if ($unique) |
|
540 | 540 | { |
541 | 541 | $unique_list[$unique][] = $name; |
542 | 542 | } |
543 | - else if($index) |
|
543 | + else if ($index) |
|
544 | 544 | { |
545 | 545 | $index_list[$index][] = $name; |
546 | 546 | } |
547 | 547 | } |
548 | 548 | |
549 | - if(count($primary_list)) |
|
549 | + if (count($primary_list)) |
|
550 | 550 | { |
551 | - $column_schema[] = sprintf("primary key (%s)", '`' . implode($primary_list, '`,`') . '`'); |
|
551 | + $column_schema[] = sprintf("primary key (%s)", '`'.implode($primary_list, '`,`').'`'); |
|
552 | 552 | } |
553 | 553 | |
554 | - if(count($unique_list)) |
|
554 | + if (count($unique_list)) |
|
555 | 555 | { |
556 | - foreach($unique_list as $key => $val) |
|
556 | + foreach ($unique_list as $key => $val) |
|
557 | 557 | { |
558 | - $column_schema[] = sprintf("unique %s (%s)", $key, '`' . implode($val, '`,`') . '`'); |
|
558 | + $column_schema[] = sprintf("unique %s (%s)", $key, '`'.implode($val, '`,`').'`'); |
|
559 | 559 | } |
560 | 560 | } |
561 | 561 | |
562 | - if(count($index_list)) |
|
562 | + if (count($index_list)) |
|
563 | 563 | { |
564 | - foreach($index_list as $key => $val) |
|
564 | + foreach ($index_list as $key => $val) |
|
565 | 565 | { |
566 | - $column_schema[] = sprintf("index %s (%s)", $key, '`' . implode($val, '`,`') . '`'); |
|
566 | + $column_schema[] = sprintf("index %s (%s)", $key, '`'.implode($val, '`,`').'`'); |
|
567 | 567 | } |
568 | 568 | } |
569 | 569 | |
570 | 570 | $schema = sprintf('create table `%s` (%s%s) %s;', $this->addQuotes($table_name), "\n", implode($column_schema, ",\n"), "ENGINE = INNODB CHARACTER SET utf8 COLLATE utf8_general_ci"); |
571 | 571 | |
572 | 572 | $output = $this->_query($schema); |
573 | - if(!$output) |
|
573 | + if (!$output) |
|
574 | 574 | { |
575 | 575 | return false; |
576 | 576 | } |
@@ -131,7 +131,7 @@ |
||
131 | 131 | * opt : notnull, default, size\n |
132 | 132 | * index : primary key, index, unique\n |
133 | 133 | * @param string $xml_doc xml schema contents |
134 | - * @return void|object |
|
134 | + * @return null|false |
|
135 | 135 | */ |
136 | 136 | function _createTable($xml_doc) |
137 | 137 | { |