@@ -141,24 +141,24 @@ discard block |
||
141 | 141 | */ |
142 | 142 | function &getInstance($db_type = NULL) |
143 | 143 | { |
144 | - if(!$db_type) |
|
144 | + if (!$db_type) |
|
145 | 145 | { |
146 | 146 | $db_type = Context::getDBType(); |
147 | 147 | } |
148 | - if(!$db_type && Context::isInstalled()) |
|
148 | + if (!$db_type && Context::isInstalled()) |
|
149 | 149 | { |
150 | 150 | return new Object(-1, 'msg_db_not_setted'); |
151 | 151 | } |
152 | 152 | |
153 | - if(!isset($GLOBALS['__DB__'])) |
|
153 | + if (!isset($GLOBALS['__DB__'])) |
|
154 | 154 | { |
155 | 155 | $GLOBALS['__DB__'] = array(); |
156 | 156 | } |
157 | - if(!isset($GLOBALS['__DB__'][$db_type])) |
|
157 | + if (!isset($GLOBALS['__DB__'][$db_type])) |
|
158 | 158 | { |
159 | 159 | $class_name = 'DB' . ucfirst($db_type); |
160 | 160 | $class_file = _XE_PATH_ . "classes/db/$class_name.class.php"; |
161 | - if(!file_exists($class_file)) |
|
161 | + if (!file_exists($class_file)) |
|
162 | 162 | { |
163 | 163 | return new Object(-1, 'msg_db_not_setted'); |
164 | 164 | } |
@@ -212,18 +212,18 @@ discard block |
||
212 | 212 | { |
213 | 213 | is_a($this, 'DB') ? $self = $this : $self = self::getInstance(); |
214 | 214 | |
215 | - if(!$self->supported_list) |
|
215 | + if (!$self->supported_list) |
|
216 | 216 | { |
217 | 217 | $oDB = new DB(); |
218 | 218 | $self->supported_list = $oDB->_getSupportedList(); |
219 | 219 | } |
220 | 220 | |
221 | 221 | $enableList = array(); |
222 | - if(is_array($self->supported_list)) |
|
222 | + if (is_array($self->supported_list)) |
|
223 | 223 | { |
224 | - foreach($self->supported_list AS $key => $value) |
|
224 | + foreach ($self->supported_list AS $key => $value) |
|
225 | 225 | { |
226 | - if($value->enable) |
|
226 | + if ($value->enable) |
|
227 | 227 | { |
228 | 228 | $enableList[] = $value; |
229 | 229 | } |
@@ -241,18 +241,18 @@ discard block |
||
241 | 241 | { |
242 | 242 | is_a($this, 'DB') ? $self = $this : $self = self::getInstance(); |
243 | 243 | |
244 | - if(!$self->supported_list) |
|
244 | + if (!$self->supported_list) |
|
245 | 245 | { |
246 | 246 | $oDB = new DB(); |
247 | 247 | $self->supported_list = $oDB->_getSupportedList(); |
248 | 248 | } |
249 | 249 | |
250 | 250 | $disableList = array(); |
251 | - if(is_array($self->supported_list)) |
|
251 | + if (is_array($self->supported_list)) |
|
252 | 252 | { |
253 | - foreach($self->supported_list AS $key => $value) |
|
253 | + foreach ($self->supported_list AS $key => $value) |
|
254 | 254 | { |
255 | - if(!$value->enable) |
|
255 | + if (!$value->enable) |
|
256 | 256 | { |
257 | 257 | $disableList[] = $value; |
258 | 258 | } |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | function _getSupportedList() |
270 | 270 | { |
271 | 271 | static $get_supported_list = ''; |
272 | - if(is_array($get_supported_list)) |
|
272 | + if (is_array($get_supported_list)) |
|
273 | 273 | { |
274 | 274 | $this->supported_list = $get_supported_list; |
275 | 275 | return $this->supported_list; |
@@ -280,13 +280,13 @@ discard block |
||
280 | 280 | $supported_list = FileHandler::readDir($db_classes_path, $filter, TRUE); |
281 | 281 | |
282 | 282 | // after creating instance of class, check is supported |
283 | - for($i = 0; $i < count($supported_list); $i++) |
|
283 | + for ($i = 0; $i < count($supported_list); $i++) |
|
284 | 284 | { |
285 | 285 | $db_type = $supported_list[$i]; |
286 | 286 | |
287 | 287 | $class_name = sprintf("DB%s%s", strtoupper(substr($db_type, 0, 1)), strtolower(substr($db_type, 1))); |
288 | 288 | $class_file = sprintf(_XE_PATH_ . "classes/db/%s.class.php", $class_name); |
289 | - if(!file_exists($class_file)) |
|
289 | + if (!file_exists($class_file)) |
|
290 | 290 | { |
291 | 291 | continue; |
292 | 292 | } |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | require_once($class_file); |
296 | 296 | $oDB = new $class_name(); |
297 | 297 | |
298 | - if(!$oDB) |
|
298 | + if (!$oDB) |
|
299 | 299 | { |
300 | 300 | continue; |
301 | 301 | } |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | */ |
320 | 320 | function _sortDBMS($a, $b) |
321 | 321 | { |
322 | - if(!isset($this->priority_dbms[$a->db_type])) |
|
322 | + if (!isset($this->priority_dbms[$a->db_type])) |
|
323 | 323 | { |
324 | 324 | $priority_a = 0; |
325 | 325 | } |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | $priority_a = $this->priority_dbms[$a->db_type]; |
329 | 329 | } |
330 | 330 | |
331 | - if(!isset($this->priority_dbms[$b->db_type])) |
|
331 | + if (!isset($this->priority_dbms[$b->db_type])) |
|
332 | 332 | { |
333 | 333 | $priority_b = 0; |
334 | 334 | } |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | $priority_b = $this->priority_dbms[$b->db_type]; |
338 | 338 | } |
339 | 339 | |
340 | - if($priority_a == $priority_b) |
|
340 | + if ($priority_a == $priority_b) |
|
341 | 341 | { |
342 | 342 | return 0; |
343 | 343 | } |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | */ |
364 | 364 | function isConnected($type = 'master', $indx = 0) |
365 | 365 | { |
366 | - if($type == 'master') |
|
366 | + if ($type == 'master') |
|
367 | 367 | { |
368 | 368 | return $this->master_db["is_connected"] ? TRUE : FALSE; |
369 | 369 | } |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | */ |
393 | 393 | function actFinish() |
394 | 394 | { |
395 | - if(!$this->query) |
|
395 | + if (!$this->query) |
|
396 | 396 | { |
397 | 397 | return; |
398 | 398 | } |
@@ -413,37 +413,37 @@ discard block |
||
413 | 413 | |
414 | 414 | $bt = version_compare(PHP_VERSION, '5.3.6', '>=') ? debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS) : debug_backtrace(); |
415 | 415 | |
416 | - foreach($bt as $no => $call) |
|
416 | + foreach ($bt as $no => $call) |
|
417 | 417 | { |
418 | - if($call['function'] == 'executeQuery' || $call['function'] == 'executeQueryArray') |
|
418 | + if ($call['function'] == 'executeQuery' || $call['function'] == 'executeQueryArray') |
|
419 | 419 | { |
420 | 420 | $call_no = $no; |
421 | 421 | $call_no++; |
422 | - $log['called_file'] = $bt[$call_no]['file'].':'.$bt[$call_no]['line']; |
|
423 | - $log['called_file'] = str_replace(_XE_PATH_ , '', $log['called_file']); |
|
422 | + $log['called_file'] = $bt[$call_no]['file'] . ':' . $bt[$call_no]['line']; |
|
423 | + $log['called_file'] = str_replace(_XE_PATH_, '', $log['called_file']); |
|
424 | 424 | $call_no++; |
425 | - $log['called_method'] = $bt[$call_no]['class'].$bt[$call_no]['type'].$bt[$call_no]['function']; |
|
425 | + $log['called_method'] = $bt[$call_no]['class'] . $bt[$call_no]['type'] . $bt[$call_no]['function']; |
|
426 | 426 | break; |
427 | 427 | } |
428 | 428 | } |
429 | 429 | |
430 | 430 | // leave error log if an error occured (if __DEBUG_DB_OUTPUT__ is defined) |
431 | - if($this->isError()) |
|
431 | + if ($this->isError()) |
|
432 | 432 | { |
433 | 433 | $log['result'] = 'Failed'; |
434 | 434 | $log['errno'] = $this->errno; |
435 | 435 | $log['errstr'] = $this->errstr; |
436 | 436 | |
437 | - if(__DEBUG_DB_OUTPUT__ == 1) |
|
437 | + if (__DEBUG_DB_OUTPUT__ == 1) |
|
438 | 438 | { |
439 | 439 | $debug_file = _XE_PATH_ . "files/_debug_db_query.php"; |
440 | 440 | $buff = array(); |
441 | - if(!file_exists($debug_file)) |
|
441 | + if (!file_exists($debug_file)) |
|
442 | 442 | { |
443 | 443 | $buff[] = '<?php exit(); ?' . '>'; |
444 | 444 | } |
445 | 445 | $buff[] = print_r($log, TRUE); |
446 | - @file_put_contents($log_file, implode("\n", $buff) . "\n\n", FILE_APPEND|LOCK_EX); |
|
446 | + @file_put_contents($log_file, implode("\n", $buff) . "\n\n", FILE_APPEND | LOCK_EX); |
|
447 | 447 | } |
448 | 448 | } |
449 | 449 | else |
@@ -514,11 +514,11 @@ discard block |
||
514 | 514 | { |
515 | 515 | static $cache_file = array(); |
516 | 516 | |
517 | - if(!$query_id) |
|
517 | + if (!$query_id) |
|
518 | 518 | { |
519 | 519 | return new Object(-1, 'msg_invalid_queryid'); |
520 | 520 | } |
521 | - if(!$this->db_type) |
|
521 | + if (!$this->db_type) |
|
522 | 522 | { |
523 | 523 | return; |
524 | 524 | } |
@@ -527,20 +527,20 @@ discard block |
||
527 | 527 | |
528 | 528 | $this->query_id = $query_id; |
529 | 529 | |
530 | - if(!isset($cache_file[$query_id]) || !file_exists($cache_file[$query_id])) |
|
530 | + if (!isset($cache_file[$query_id]) || !file_exists($cache_file[$query_id])) |
|
531 | 531 | { |
532 | 532 | $id_args = explode('.', $query_id); |
533 | - if(count($id_args) == 2) |
|
533 | + if (count($id_args) == 2) |
|
534 | 534 | { |
535 | 535 | $target = 'modules'; |
536 | 536 | $module = $id_args[0]; |
537 | 537 | $id = $id_args[1]; |
538 | 538 | } |
539 | - elseif(count($id_args) == 3) |
|
539 | + elseif (count($id_args) == 3) |
|
540 | 540 | { |
541 | 541 | $target = $id_args[0]; |
542 | 542 | $typeList = array('addons' => 1, 'widgets' => 1); |
543 | - if(!isset($typeList[$target])) |
|
543 | + if (!isset($typeList[$target])) |
|
544 | 544 | { |
545 | 545 | $this->actDBClassFinish(); |
546 | 546 | return; |
@@ -548,14 +548,14 @@ discard block |
||
548 | 548 | $module = $id_args[1]; |
549 | 549 | $id = $id_args[2]; |
550 | 550 | } |
551 | - if(!$target || !$module || !$id) |
|
551 | + if (!$target || !$module || !$id) |
|
552 | 552 | { |
553 | 553 | $this->actDBClassFinish(); |
554 | 554 | return new Object(-1, 'msg_invalid_queryid'); |
555 | 555 | } |
556 | 556 | |
557 | 557 | $xml_file = sprintf('%s%s/%s/queries/%s.xml', _XE_PATH_, $target, $module, $id); |
558 | - if(!file_exists($xml_file)) |
|
558 | + if (!file_exists($xml_file)) |
|
559 | 559 | { |
560 | 560 | $this->actDBClassFinish(); |
561 | 561 | return new Object(-1, 'msg_invalid_queryid'); |
@@ -583,13 +583,13 @@ discard block |
||
583 | 583 | $cache_file = sprintf('%s%s%s.%s.%s.cache.php', _XE_PATH_, $this->cache_file, $query_id, __ZBXE_VERSION__, $this->db_type); |
584 | 584 | |
585 | 585 | $cache_time = -1; |
586 | - if(file_exists($cache_file)) |
|
586 | + if (file_exists($cache_file)) |
|
587 | 587 | { |
588 | 588 | $cache_time = filemtime($cache_file); |
589 | 589 | } |
590 | 590 | |
591 | 591 | // if there is no cache file or is not new, find original xml query file and parse it |
592 | - if($cache_time < filemtime($xml_file) || $cache_time < filemtime(_XE_PATH_ . 'classes/db/DB.class.php') || $cache_time < filemtime(_XE_PATH_ . 'classes/xml/XmlQueryParser.class.php')) |
|
592 | + if ($cache_time < filemtime($xml_file) || $cache_time < filemtime(_XE_PATH_ . 'classes/db/DB.class.php') || $cache_time < filemtime(_XE_PATH_ . 'classes/xml/XmlQueryParser.class.php')) |
|
593 | 593 | { |
594 | 594 | $oParser = new XmlQueryParser(); |
595 | 595 | $oParser->parse($query_id, $xml_file, $cache_file); |
@@ -610,27 +610,27 @@ discard block |
||
610 | 610 | { |
611 | 611 | global $lang; |
612 | 612 | |
613 | - if(!in_array($type, array('master','slave'))) $type = 'slave'; |
|
613 | + if (!in_array($type, array('master', 'slave'))) $type = 'slave'; |
|
614 | 614 | |
615 | - if(!file_exists($cache_file)) |
|
615 | + if (!file_exists($cache_file)) |
|
616 | 616 | { |
617 | 617 | return new Object(-1, 'msg_invalid_queryid'); |
618 | 618 | } |
619 | 619 | |
620 | - if($source_args) |
|
620 | + if ($source_args) |
|
621 | 621 | { |
622 | 622 | $args = clone $source_args; |
623 | 623 | } |
624 | 624 | |
625 | 625 | $output = include($cache_file); |
626 | 626 | |
627 | - if((is_a($output, 'Object') || is_subclass_of($output, 'Object')) && !$output->toBool()) |
|
627 | + if ((is_a($output, 'Object') || is_subclass_of($output, 'Object')) && !$output->toBool()) |
|
628 | 628 | { |
629 | 629 | return $output; |
630 | 630 | } |
631 | 631 | |
632 | 632 | // execute appropriate query |
633 | - switch($output->getAction()) |
|
633 | + switch ($output->getAction()) |
|
634 | 634 | { |
635 | 635 | case 'insert' : |
636 | 636 | case 'insert-select' : |
@@ -653,11 +653,11 @@ discard block |
||
653 | 653 | break; |
654 | 654 | } |
655 | 655 | |
656 | - if($this->isError()) |
|
656 | + if ($this->isError()) |
|
657 | 657 | { |
658 | 658 | $output = $this->getError(); |
659 | 659 | } |
660 | - else if(!is_a($output, 'Object') && !is_subclass_of($output, 'Object')) |
|
660 | + else if (!is_a($output, 'Object') && !is_subclass_of($output, 'Object')) |
|
661 | 661 | { |
662 | 662 | $output = new Object(); |
663 | 663 | } |
@@ -803,7 +803,7 @@ discard block |
||
803 | 803 | */ |
804 | 804 | function dropTable($table_name) |
805 | 805 | { |
806 | - if(!$table_name) |
|
806 | + if (!$table_name) |
|
807 | 807 | { |
808 | 808 | return; |
809 | 809 | } |
@@ -820,54 +820,54 @@ discard block |
||
820 | 820 | function getSelectSql($query, $with_values = TRUE) |
821 | 821 | { |
822 | 822 | $select = $query->getSelectString($with_values); |
823 | - if($select == '') |
|
823 | + if ($select == '') |
|
824 | 824 | { |
825 | 825 | return new Object(-1, "Invalid query"); |
826 | 826 | } |
827 | 827 | $select = 'SELECT ' . $select; |
828 | 828 | |
829 | 829 | $from = $query->getFromString($with_values); |
830 | - if($from == '') |
|
830 | + if ($from == '') |
|
831 | 831 | { |
832 | 832 | return new Object(-1, "Invalid query"); |
833 | 833 | } |
834 | 834 | $from = ' FROM ' . $from; |
835 | 835 | |
836 | 836 | $where = $query->getWhereString($with_values); |
837 | - if($where != '') |
|
837 | + if ($where != '') |
|
838 | 838 | { |
839 | 839 | $where = ' WHERE ' . $where; |
840 | 840 | } |
841 | 841 | |
842 | 842 | $tableObjects = $query->getTables(); |
843 | 843 | $index_hint_list = ''; |
844 | - foreach($tableObjects as $tableObject) |
|
844 | + foreach ($tableObjects as $tableObject) |
|
845 | 845 | { |
846 | - if(is_a($tableObject, 'CubridTableWithHint')) |
|
846 | + if (is_a($tableObject, 'CubridTableWithHint')) |
|
847 | 847 | { |
848 | 848 | $index_hint_list .= $tableObject->getIndexHintString() . ', '; |
849 | 849 | } |
850 | 850 | } |
851 | 851 | $index_hint_list = substr($index_hint_list, 0, -2); |
852 | - if($index_hint_list != '') |
|
852 | + if ($index_hint_list != '') |
|
853 | 853 | { |
854 | 854 | $index_hint_list = 'USING INDEX ' . $index_hint_list; |
855 | 855 | } |
856 | 856 | |
857 | 857 | $groupBy = $query->getGroupByString(); |
858 | - if($groupBy != '') |
|
858 | + if ($groupBy != '') |
|
859 | 859 | { |
860 | 860 | $groupBy = ' GROUP BY ' . $groupBy; |
861 | 861 | } |
862 | 862 | |
863 | 863 | $orderBy = $query->getOrderByString(); |
864 | - if($orderBy != '') |
|
864 | + if ($orderBy != '') |
|
865 | 865 | { |
866 | 866 | $orderBy = ' ORDER BY ' . $orderBy; |
867 | 867 | } |
868 | 868 | |
869 | 869 | $limit = $query->getLimitString(); |
870 | - if($limit != '') |
|
870 | + if ($limit != '') |
|
871 | 871 | { |
872 | 872 | $limit = ' LIMIT ' . $limit; |
873 | 873 | } |
@@ -890,7 +890,7 @@ discard block |
||
890 | 890 | { |
891 | 891 | $new_update_columns = array(); |
892 | 892 | $click_count_columns = $queryObject->getClickCountColumns(); |
893 | - foreach($click_count_columns as $click_count_column) |
|
893 | + foreach ($click_count_columns as $click_count_column) |
|
894 | 894 | { |
895 | 895 | $click_count_column_name = $click_count_column->column_name; |
896 | 896 | |
@@ -922,14 +922,14 @@ discard block |
||
922 | 922 | $sql .= $tables[0]->getAlias(); |
923 | 923 | |
924 | 924 | $from = $query->getFromString($with_values); |
925 | - if($from == '') |
|
925 | + if ($from == '') |
|
926 | 926 | { |
927 | 927 | return new Object(-1, "Invalid query"); |
928 | 928 | } |
929 | 929 | $sql .= ' FROM ' . $from; |
930 | 930 | |
931 | 931 | $where = $query->getWhereString($with_values); |
932 | - if($where != '') |
|
932 | + if ($where != '') |
|
933 | 933 | { |
934 | 934 | $sql .= ' WHERE ' . $where; |
935 | 935 | } |
@@ -947,19 +947,19 @@ discard block |
||
947 | 947 | function getUpdateSql($query, $with_values = TRUE, $with_priority = FALSE) |
948 | 948 | { |
949 | 949 | $columnsList = $query->getUpdateString($with_values); |
950 | - if($columnsList == '') |
|
950 | + if ($columnsList == '') |
|
951 | 951 | { |
952 | 952 | return new Object(-1, "Invalid query"); |
953 | 953 | } |
954 | 954 | |
955 | 955 | $tables = $query->getFromString($with_values); |
956 | - if($tables == '') |
|
956 | + if ($tables == '') |
|
957 | 957 | { |
958 | 958 | return new Object(-1, "Invalid query"); |
959 | 959 | } |
960 | 960 | |
961 | 961 | $where = $query->getWhereString($with_values); |
962 | - if($where != '') |
|
962 | + if ($where != '') |
|
963 | 963 | { |
964 | 964 | $where = ' WHERE ' . $where; |
965 | 965 | } |
@@ -1004,9 +1004,9 @@ discard block |
||
1004 | 1004 | */ |
1005 | 1005 | function _getConnection($type = 'master', $indx = NULL) |
1006 | 1006 | { |
1007 | - if($type == 'master') |
|
1007 | + if ($type == 'master') |
|
1008 | 1008 | { |
1009 | - if(!$this->master_db['is_connected']) |
|
1009 | + if (!$this->master_db['is_connected']) |
|
1010 | 1010 | { |
1011 | 1011 | $this->_connect($type); |
1012 | 1012 | } |
@@ -1014,12 +1014,12 @@ discard block |
||
1014 | 1014 | return $this->master_db["resource"]; |
1015 | 1015 | } |
1016 | 1016 | |
1017 | - if($indx === NULL) |
|
1017 | + if ($indx === NULL) |
|
1018 | 1018 | { |
1019 | 1019 | $indx = $this->_getSlaveConnectionStringIndex($type); |
1020 | 1020 | } |
1021 | 1021 | |
1022 | - if(!$this->slave_db[$indx]['is_connected']) |
|
1022 | + if (!$this->slave_db[$indx]['is_connected']) |
|
1023 | 1023 | { |
1024 | 1024 | $this->_connect($type, $indx); |
1025 | 1025 | } |
@@ -1034,11 +1034,11 @@ discard block |
||
1034 | 1034 | */ |
1035 | 1035 | function _dbInfoExists() |
1036 | 1036 | { |
1037 | - if(!$this->master_db) |
|
1037 | + if (!$this->master_db) |
|
1038 | 1038 | { |
1039 | 1039 | return FALSE; |
1040 | 1040 | } |
1041 | - if(count($this->slave_db) === 0) |
|
1041 | + if (count($this->slave_db) === 0) |
|
1042 | 1042 | { |
1043 | 1043 | return FALSE; |
1044 | 1044 | } |
@@ -1064,12 +1064,12 @@ discard block |
||
1064 | 1064 | */ |
1065 | 1065 | function close($type = 'master', $indx = 0) |
1066 | 1066 | { |
1067 | - if(!$this->isConnected($type, $indx)) |
|
1067 | + if (!$this->isConnected($type, $indx)) |
|
1068 | 1068 | { |
1069 | 1069 | return; |
1070 | 1070 | } |
1071 | 1071 | |
1072 | - if($type == 'master') |
|
1072 | + if ($type == 'master') |
|
1073 | 1073 | { |
1074 | 1074 | $connection = &$this->master_db; |
1075 | 1075 | } |
@@ -1100,12 +1100,12 @@ discard block |
||
1100 | 1100 | */ |
1101 | 1101 | function begin() |
1102 | 1102 | { |
1103 | - if(!$this->isConnected()) |
|
1103 | + if (!$this->isConnected()) |
|
1104 | 1104 | { |
1105 | 1105 | return; |
1106 | 1106 | } |
1107 | 1107 | |
1108 | - if($this->_begin($this->transactionNestedLevel)) |
|
1108 | + if ($this->_begin($this->transactionNestedLevel)) |
|
1109 | 1109 | { |
1110 | 1110 | $this->transaction_started = TRUE; |
1111 | 1111 | $this->transactionNestedLevel++; |
@@ -1128,15 +1128,15 @@ discard block |
||
1128 | 1128 | */ |
1129 | 1129 | function rollback() |
1130 | 1130 | { |
1131 | - if(!$this->isConnected() || !$this->transaction_started) |
|
1131 | + if (!$this->isConnected() || !$this->transaction_started) |
|
1132 | 1132 | { |
1133 | 1133 | return; |
1134 | 1134 | } |
1135 | - if($this->_rollback($this->transactionNestedLevel)) |
|
1135 | + if ($this->_rollback($this->transactionNestedLevel)) |
|
1136 | 1136 | { |
1137 | 1137 | $this->transactionNestedLevel--; |
1138 | 1138 | |
1139 | - if(!$this->transactionNestedLevel) |
|
1139 | + if (!$this->transactionNestedLevel) |
|
1140 | 1140 | { |
1141 | 1141 | $this->transaction_started = FALSE; |
1142 | 1142 | } |
@@ -1160,11 +1160,11 @@ discard block |
||
1160 | 1160 | */ |
1161 | 1161 | function commit($force = FALSE) |
1162 | 1162 | { |
1163 | - if(!$force && (!$this->isConnected() || !$this->transaction_started)) |
|
1163 | + if (!$force && (!$this->isConnected() || !$this->transaction_started)) |
|
1164 | 1164 | { |
1165 | 1165 | return; |
1166 | 1166 | } |
1167 | - if($this->transactionNestedLevel == 1 && $this->_commit()) |
|
1167 | + if ($this->transactionNestedLevel == 1 && $this->_commit()) |
|
1168 | 1168 | { |
1169 | 1169 | $this->transaction_started = FALSE; |
1170 | 1170 | $this->transactionNestedLevel = 0; |
@@ -1196,7 +1196,7 @@ discard block |
||
1196 | 1196 | */ |
1197 | 1197 | function _query($query, $connection = NULL) |
1198 | 1198 | { |
1199 | - if($connection == NULL) |
|
1199 | + if ($connection == NULL) |
|
1200 | 1200 | { |
1201 | 1201 | $connection = $this->_getConnection('master'); |
1202 | 1202 | } |
@@ -1221,7 +1221,7 @@ discard block |
||
1221 | 1221 | { |
1222 | 1222 | $db_info = Context::getDBInfo(); |
1223 | 1223 | $this->master_db = $db_info->master_db; |
1224 | - if($db_info->master_db["db_hostname"] == $db_info->slave_db[0]["db_hostname"] |
|
1224 | + if ($db_info->master_db["db_hostname"] == $db_info->slave_db[0]["db_hostname"] |
|
1225 | 1225 | && $db_info->master_db["db_port"] == $db_info->slave_db[0]["db_port"] |
1226 | 1226 | && $db_info->master_db["db_userid"] == $db_info->slave_db[0]["db_userid"] |
1227 | 1227 | && $db_info->master_db["db_password"] == $db_info->slave_db[0]["db_password"] |
@@ -1269,18 +1269,18 @@ discard block |
||
1269 | 1269 | */ |
1270 | 1270 | function _connect($type = 'master', $indx = 0) |
1271 | 1271 | { |
1272 | - if($this->isConnected($type, $indx)) |
|
1272 | + if ($this->isConnected($type, $indx)) |
|
1273 | 1273 | { |
1274 | 1274 | return; |
1275 | 1275 | } |
1276 | 1276 | |
1277 | 1277 | // Ignore if no DB information exists |
1278 | - if(!$this->_dbInfoExists()) |
|
1278 | + if (!$this->_dbInfoExists()) |
|
1279 | 1279 | { |
1280 | 1280 | return; |
1281 | 1281 | } |
1282 | 1282 | |
1283 | - if($type == 'master') |
|
1283 | + if ($type == 'master') |
|
1284 | 1284 | { |
1285 | 1285 | $connection = &$this->master_db; |
1286 | 1286 | } |
@@ -1290,7 +1290,7 @@ discard block |
||
1290 | 1290 | } |
1291 | 1291 | |
1292 | 1292 | $result = $this->__connect($connection); |
1293 | - if($result === NULL || $result === FALSE) |
|
1293 | + if ($result === NULL || $result === FALSE) |
|
1294 | 1294 | { |
1295 | 1295 | $connection["is_connected"] = FALSE; |
1296 | 1296 | return; |
@@ -1326,7 +1326,7 @@ discard block |
||
1326 | 1326 | */ |
1327 | 1327 | function actDBClassFinish() |
1328 | 1328 | { |
1329 | - if(!$this->query) |
|
1329 | + if (!$this->query) |
|
1330 | 1330 | { |
1331 | 1331 | return; |
1332 | 1332 | } |
@@ -1349,7 +1349,7 @@ discard block |
||
1349 | 1349 | function &getParser($force = FALSE) |
1350 | 1350 | { |
1351 | 1351 | static $dbParser = NULL; |
1352 | - if(!$dbParser || $force) |
|
1352 | + if (!$dbParser || $force) |
|
1353 | 1353 | { |
1354 | 1354 | $oDB = DB::getInstance(); |
1355 | 1355 | $dbParser = $oDB->getParser(); |