@@ -83,8 +83,7 @@ discard block |
||
83 | 83 | { |
84 | 84 | $this->inherit_root = $phpbb_root_path . 'styles/' . $user->theme['template_inherit_path'] . '/template'; |
85 | 85 | } |
86 | - } |
|
87 | - else |
|
86 | + } else |
|
88 | 87 | { |
89 | 88 | trigger_error('Template path could not be found: styles/' . $user->theme['template_path'] . '/template', E_USER_ERROR); |
90 | 89 | } |
@@ -120,8 +119,7 @@ discard block |
||
120 | 119 | |
121 | 120 | $this->inherit_root = $fallback_template_path; |
122 | 121 | $this->orig_tpl_inherits_id = true; |
123 | - } |
|
124 | - else |
|
122 | + } else |
|
125 | 123 | { |
126 | 124 | $this->orig_tpl_inherits_id = false; |
127 | 125 | } |
@@ -195,8 +193,7 @@ discard block |
||
195 | 193 | } |
196 | 194 | |
197 | 195 | unset($str[$blocks[$blockcount]]); |
198 | - } |
|
199 | - else |
|
196 | + } else |
|
200 | 197 | { |
201 | 198 | // Top-level block. |
202 | 199 | unset($this->_tpldata[$blockname]); |
@@ -232,8 +229,7 @@ discard block |
||
232 | 229 | if ($filename = $this->_tpl_load($handle)) |
233 | 230 | { |
234 | 231 | ($include_once) ? include_once($filename) : include($filename); |
235 | - } |
|
236 | - else |
|
232 | + } else |
|
237 | 233 | { |
238 | 234 | eval(' ?>' . $this->compiled_code[$handle] . '<?php '); |
239 | 235 | } |
@@ -287,8 +283,7 @@ discard block |
||
287 | 283 | if (!file_exists($filename) || @filesize($filename) === 0) |
288 | 284 | { |
289 | 285 | $recompile = true; |
290 | - } |
|
291 | - else if (classSupernova::$config->load_tplcompile) |
|
286 | + } else if (classSupernova::$config->load_tplcompile) |
|
292 | 287 | { |
293 | 288 | // No way around it: we need to check inheritance here |
294 | 289 | if ($user->theme['template_inherits_id'] && !file_exists($this->files[$handle])) |
@@ -376,15 +371,13 @@ discard block |
||
376 | 371 | $this->files[$row['template_filename']] = $file; |
377 | 372 | $this->files_inherit[$row['template_filename']] = $file; |
378 | 373 | $this->files_template[$row['template_filename']] = $user->theme['template_inherits_id']; |
379 | - } |
|
380 | - else if (isset($user->theme['template_inherits_id']) && $user->theme['template_inherits_id']) |
|
374 | + } else if (isset($user->theme['template_inherits_id']) && $user->theme['template_inherits_id']) |
|
381 | 375 | { |
382 | 376 | // Ok, we have a situation. There is a file in the subtemplate, but nothing in the DB. We have to fix that. |
383 | 377 | $force_reload = true; |
384 | 378 | $this->files_template[$row['template_filename']] = $user->theme['template_inherits_id']; |
385 | 379 | } |
386 | - } |
|
387 | - else |
|
380 | + } else |
|
388 | 381 | { |
389 | 382 | $this->files_template[$row['template_filename']] = $user->theme['template_id']; |
390 | 383 | } |
@@ -394,8 +387,7 @@ discard block |
||
394 | 387 | if ($row['template_filename'] == $this->filename[$handle]) |
395 | 388 | { |
396 | 389 | $compile->_tpl_load_file($handle, true); |
397 | - } |
|
398 | - else |
|
390 | + } else |
|
399 | 391 | { |
400 | 392 | $this->files[$row['template_filename']] = $file; |
401 | 393 | $this->filename[$row['template_filename']] = $row['template_filename']; |
@@ -410,8 +402,7 @@ discard block |
||
410 | 402 | { |
411 | 403 | $this->compiled_code[$handle] = $compile->compile(trim($row['template_data'])); |
412 | 404 | $compile->compile_write($handle, $this->compiled_code[$handle]); |
413 | - } |
|
414 | - else |
|
405 | + } else |
|
415 | 406 | { |
416 | 407 | // Only bother compiling if it doesn't already exist |
417 | 408 | if (!file_exists($this->cachepath . str_replace('/', '.', $row['template_filename']) . DOT_PHP_EX)) |
@@ -422,8 +413,7 @@ discard block |
||
422 | 413 | } |
423 | 414 | } |
424 | 415 | } |
425 | - } |
|
426 | - else |
|
416 | + } else |
|
427 | 417 | { |
428 | 418 | $file = $this->root . '/' . $row['template_filename']; |
429 | 419 | |
@@ -511,8 +501,7 @@ discard block |
||
511 | 501 | // We're adding a new iteration to this block with the given |
512 | 502 | // variable assignments. |
513 | 503 | $str[$blocks[$blockcount]][] = $vararray; |
514 | - } |
|
515 | - else |
|
504 | + } else |
|
516 | 505 | { |
517 | 506 | // Top-level block. |
518 | 507 | $s_row_count = (isset($this->_tpldata[$blockname])) ? sizeof($this->_tpldata[$blockname]) : 0; |
@@ -612,8 +601,7 @@ discard block |
||
612 | 601 | $key = sizeof($this->_tpldata[$blockname]); |
613 | 602 | unset($this->_tpldata[$blockname][($key - 1)]['S_LAST_ROW']); |
614 | 603 | $vararray['S_LAST_ROW'] = true; |
615 | - } |
|
616 | - else if ($key === 0) |
|
604 | + } else if ($key === 0) |
|
617 | 605 | { |
618 | 606 | unset($this->_tpldata[$blockname][0]['S_FIRST_ROW']); |
619 | 607 | $vararray['S_FIRST_ROW'] = true; |
@@ -711,8 +699,7 @@ discard block |
||
711 | 699 | if(!$name) |
712 | 700 | { |
713 | 701 | $this->assign_vars($values); |
714 | - } |
|
715 | - else |
|
702 | + } else |
|
716 | 703 | { |
717 | 704 | $this->assign_block_vars($name, $values); |
718 | 705 | } |
@@ -756,9 +756,11 @@ |
||
756 | 756 | !empty($strings) ? doquery($query_string . implode(',', $strings)) : false; |
757 | 757 | } |
758 | 758 | |
759 | - if(isset($update_tables['counter']['page'])) // TODO REMOVE |
|
759 | + if(isset($update_tables['counter']['page'])) { |
|
760 | + // TODO REMOVE |
|
760 | 761 | { |
761 | 762 | update_security_url("SELECT DISTINCT `page` AS url FROM {{counter}}"); |
763 | + } |
|
762 | 764 | update_security_url("SELECT DISTINCT `url` AS url FROM {{counter}}"); |
763 | 765 | } |
764 | 766 | } |
@@ -66,8 +66,7 @@ discard block |
||
66 | 66 | { |
67 | 67 | return; |
68 | 68 | trigger_error("template->_tpl_load_file(): File {$this->template->files[$handle]} does not exist or is empty", E_USER_ERROR); |
69 | - } |
|
70 | - else |
|
69 | + } else |
|
71 | 70 | { |
72 | 71 | $this->template->files[$handle] = $this->template->files_inherit[$handle]; |
73 | 72 | } |
@@ -225,15 +224,13 @@ discard block |
||
225 | 224 | $var = substr($temp, 2, -1); |
226 | 225 | //$file = $this->template->_tpldata['DEFINE']['.'][$var]; |
227 | 226 | $temp = "\$this->_tpldata['DEFINE']['.']['$var']"; |
228 | - } |
|
229 | - else |
|
227 | + } else |
|
230 | 228 | { |
231 | 229 | $var = substr($temp, 1, -1); |
232 | 230 | //$file = $this->template->_rootref[$var]; |
233 | 231 | $temp = "\$this->_rootref['$var']"; |
234 | 232 | } |
235 | - } |
|
236 | - else |
|
233 | + } else |
|
237 | 234 | { |
238 | 235 | $file = $temp; |
239 | 236 | } |
@@ -381,8 +378,7 @@ discard block |
||
381 | 378 | if ($match[2] < 0) |
382 | 379 | { |
383 | 380 | $loop_start = '($_' . $tag_args . '_count ' . $match[2] . ' < 0 ? 0 : $_' . $tag_args . '_count ' . $match[2] . ')'; |
384 | - } |
|
385 | - else |
|
381 | + } else |
|
386 | 382 | { |
387 | 383 | $loop_start = '($_' . $tag_args . '_count < ' . $match[2] . ' ? $_' . $tag_args . '_count : ' . $match[2] . ')'; |
388 | 384 | } |
@@ -390,17 +386,14 @@ discard block |
||
390 | 386 | if (strlen($match[3]) < 1 || $match[3] == -1) |
391 | 387 | { |
392 | 388 | $loop_end = '$_' . $tag_args . '_count'; |
393 | - } |
|
394 | - else if ($match[3] >= 0) |
|
389 | + } else if ($match[3] >= 0) |
|
395 | 390 | { |
396 | 391 | $loop_end = '(' . ($match[3] + 1) . ' > $_' . $tag_args . '_count ? $_' . $tag_args . '_count : ' . ($match[3] + 1) . ')'; |
397 | - } |
|
398 | - else //if ($match[3] < -1) |
|
392 | + } else //if ($match[3] < -1) |
|
399 | 393 | { |
400 | 394 | $loop_end = '$_' . $tag_args . '_count' . ($match[3] + 1); |
401 | 395 | } |
402 | - } |
|
403 | - else |
|
396 | + } else |
|
404 | 397 | { |
405 | 398 | $loop_start = 0; |
406 | 399 | $loop_end = '$_' . $tag_args . '_count'; |
@@ -413,8 +406,7 @@ discard block |
||
413 | 406 | { |
414 | 407 | // We need to implode $no_nesting times from the end... |
415 | 408 | $block = array_slice($this->block_names, -$no_nesting); |
416 | - } |
|
417 | - else |
|
409 | + } else |
|
418 | 410 | { |
419 | 411 | $block = $this->block_names; |
420 | 412 | } |
@@ -424,8 +416,7 @@ discard block |
||
424 | 416 | // Block is not nested. |
425 | 417 | $tag_template_php = '$_' . $tag_args . "_count = (isset(\$this->_tpldata['$tag_args'])) ? sizeof(\$this->_tpldata['$tag_args']) : 0;"; |
426 | 418 | $varref = "\$this->_tpldata['$tag_args']"; |
427 | - } |
|
428 | - else |
|
419 | + } else |
|
429 | 420 | { |
430 | 421 | // This block is nested. |
431 | 422 | // Generate a namespace string for this block. |
@@ -573,8 +564,7 @@ discard block |
||
573 | 564 | if (preg_match('#^((?:[a-z0-9\-_]+\.)+)?(\$)?(?=[A-Za-z])([A-Za-z0-9\-_]+)#s', $token, $varrefs)) |
574 | 565 | { |
575 | 566 | $token = (!empty($varrefs[1])) ? $this->generate_block_data_ref(substr($varrefs[1], 0, -1), true, $varrefs[2]) . '[\'' . $varrefs[3] . '\']' : (($varrefs[2]) ? '$this->_tpldata[\'DEFINE\'][\'.\'][\'' . $varrefs[3] . '\']' : '$this->_rootref[\'' . $varrefs[3] . '\']'); |
576 | - } |
|
577 | - else if (preg_match('#^\.((?:[a-z0-9\-_]+\.?)+)$#s', $token, $varrefs)) |
|
567 | + } else if (preg_match('#^\.((?:[a-z0-9\-_]+\.?)+)$#s', $token, $varrefs)) |
|
578 | 568 | { |
579 | 569 | // Allow checking if loops are set with .loopname |
580 | 570 | // It is also possible to check the loop count by doing <!-- IF .loopname > 1 --> for example |
@@ -590,8 +580,7 @@ discard block |
||
590 | 580 | |
591 | 581 | // Add the block reference for the last child. |
592 | 582 | $varref .= "['" . $block . "']"; |
593 | - } |
|
594 | - else |
|
583 | + } else |
|
595 | 584 | { |
596 | 585 | $varref = '$this->_tpldata'; |
597 | 586 | |
@@ -599,8 +588,7 @@ discard block |
||
599 | 588 | $varref .= "['" . $blocks[0] . "']"; |
600 | 589 | } |
601 | 590 | $token = "sizeof($varref)"; |
602 | - } |
|
603 | - else if (!empty($token)) |
|
591 | + } else if (!empty($token)) |
|
604 | 592 | { |
605 | 593 | $token = '(' . $token . ')'; |
606 | 594 | } |
@@ -645,8 +633,7 @@ discard block |
||
645 | 633 | |
646 | 634 | // Now replace the php code |
647 | 635 | $match[4] = "'" . str_replace(array('<?php echo ', '; ?>'), array("' . ", " . '"), $match[4]) . "'"; |
648 | - } |
|
649 | - else |
|
636 | + } else |
|
650 | 637 | { |
651 | 638 | preg_match('#true|false|\.#i', $match[4], $type); |
652 | 639 | |
@@ -708,8 +695,7 @@ discard block |
||
708 | 695 | { |
709 | 696 | $negate_expr = true; |
710 | 697 | $expr_type = array_shift($tokens); |
711 | - } |
|
712 | - else |
|
698 | + } else |
|
713 | 699 | { |
714 | 700 | $expr_type = $first_token; |
715 | 701 | } |
@@ -722,8 +708,7 @@ discard block |
||
722 | 708 | $expr_end++; |
723 | 709 | $expr_arg = $tokens[$expr_end++]; |
724 | 710 | $expr = "!(($is_arg / $expr_arg) % $expr_arg)"; |
725 | - } |
|
726 | - else |
|
711 | + } else |
|
727 | 712 | { |
728 | 713 | $expr = "!($is_arg & 1)"; |
729 | 714 | } |
@@ -735,8 +720,7 @@ discard block |
||
735 | 720 | $expr_end++; |
736 | 721 | $expr_arg = $tokens[$expr_end++]; |
737 | 722 | $expr = "(($is_arg / $expr_arg) % $expr_arg)"; |
738 | - } |
|
739 | - else |
|
723 | + } else |
|
740 | 724 | { |
741 | 725 | $expr = "($is_arg & 1)"; |
742 | 726 | } |
@@ -818,12 +802,10 @@ discard block |
||
818 | 802 | $varref .= '[$_' . $blocks[$blockcount] . '_i]'; |
819 | 803 | } |
820 | 804 | return $varref; |
821 | - } |
|
822 | - else if ($include_last_iterator) |
|
805 | + } else if ($include_last_iterator) |
|
823 | 806 | { |
824 | 807 | return '$_'. $blocks[$blockcount] . '_val'; |
825 | - } |
|
826 | - else |
|
808 | + } else |
|
827 | 809 | { |
828 | 810 | return '$_'. $blocks[$blockcount - 1] . '_val[\''. $blocks[$blockcount]. '\']'; |
829 | 811 | } |
@@ -298,9 +298,11 @@ |
||
298 | 298 | $set = trim($set); |
299 | 299 | $table_name = static::$location_info[$location_type][P_TABLE_NAME]; |
300 | 300 | if ($result = $this->db->doInsert("INSERT INTO `{{{$table_name}}}` SET {$set}")) { |
301 | - if ($this->db->db_affected_rows()) // Обновляем данные только если ряд был затронут |
|
301 | + if ($this->db->db_affected_rows()) { |
|
302 | + // Обновляем данные только если ряд был затронут |
|
302 | 303 | { |
303 | 304 | $record_id = $this->db->db_insert_id(); |
305 | + } |
|
304 | 306 | // Вытаскиваем запись целиком, потому что в $set могли быть "данные по умолчанию" |
305 | 307 | $result = $this->db_get_record_by_id($location_type, $record_id); |
306 | 308 | // Очищаем второстепенные кэши - потому что вставленная запись могла повлиять на результаты запросов или локация или еще чего |