Index: branches/RC/core/kernel/db/db_connection.php =================================================================== diff -u -r8929 -r8968 --- branches/RC/core/kernel/db/db_connection.php (.../db_connection.php) (revision 8929) +++ branches/RC/core/kernel/db/db_connection.php (.../db_connection.php) (revision 8968) @@ -403,17 +403,20 @@ } // set 2nd checkpoint: begin $first_cell = count($ret) == 1 && count(current($ret)) == 1 ? current(current($ret)) : null; - + if ($profileSQLs) { $debugger->profileFinish('sql_'.$queryID, null, null, $this->getAffectedRows(), $first_cell); $debugger->profilerAddTotal('sql', 'sql_'.$queryID); + } $this->Destroy(); // set 2nd checkpoint: end return $ret; } else { // set 2nd checkpoint: begin + if ($profileSQLs) { $debugger->profileFinish('sql_'.$queryID, null, null, $this->getAffectedRows()); $debugger->profilerAddTotal('sql', 'sql_'.$queryID); + } // set 2nd checkpoint: end } $this->showError($sql); Index: branches/RC/core/kernel/nparser/ntags.php =================================================================== diff -u -r8963 -r8968 --- branches/RC/core/kernel/nparser/ntags.php (.../ntags.php) (revision 8963) +++ branches/RC/core/kernel/nparser/ntags.php (.../ntags.php) (revision 8968) @@ -41,7 +41,7 @@ function AppendCode(&$o, $code) { - $o .= ''; + $o .= ''; } } @@ -174,6 +174,14 @@ } class _Tag_If extends _BlockTag { + + /** + * Permanently inverses if tag (used in ifnot tag) + * + * @var bool + */ + var $_Inversed = false; + function Open($tag) { $o = ''; @@ -187,7 +195,7 @@ $code[] = "\$_splited = \$_parser->SplitTag(array('tag'=>\"{$tag['NP']['check']}\", 'file'=>'{$tag['file']}', 'line'=>{$tag['line']}));"; $code[] = 'if ($_splited[\'prefix\'] == \'__auto__\') {$_splited[\'prefix\'] = $PrefixSpecial;}'; $code[] = '$_p_ =& $_parser->GetProcessor($_splited[\'prefix\']);'; - if (isset($tag['NP']['inverse'])) { + if (isset($tag['NP']['inverse']) || $this->_Inversed) { $code[] = "if (!\$_p_->ProcessParsedTag(\$_splited['name'], $to_pass, \$_splited['prefix'], '{$tag['file']}', {$tag['line']})) {"; } else { @@ -205,7 +213,25 @@ $tag['processed'] = true; } if ($tag['name'] == 'elseif') { - $tag['processed'] = true; // !!! TEMPORARY !!! + if (!isset($tag['NP']['check'])) { + $this->Application->handleError(E_USER_ERROR, 'Tag '.$this->Parser->TagInfo($tag, true).' called without required check attribute', $tag['file'], $tag['line']); + return ''; + } + + $to_pass = $this->Parser->CompileParamsArray($tag['NP']); + + $code[] = "\$_splited = \$_parser->SplitTag(array('tag'=>\"{$tag['NP']['check']}\", 'file'=>'{$tag['file']}', 'line'=>{$tag['line']}));"; + $code[] = 'if ($_splited[\'prefix\'] == \'__auto__\') {$_splited[\'prefix\'] = $PrefixSpecial;}'; + $code[] = '$_p_ =& $_parser->GetProcessor($_splited[\'prefix\']);'; + if (isset($tag['NP']['inverse']) || $this->_Inversed) { + $code[] = "} else if (!\$_p_->ProcessParsedTag(\$_splited['name'], $to_pass, \$_splited['prefix'], '{$tag['file']}', {$tag['line']})) {"; + } + else { + $code[] = "} else if (\$_p_->ProcessParsedTag(\$_splited['name'], $to_pass, \$_splited['prefix'], '{$tag['file']}', {$tag['line']})) {"; + } + $this->AppendCode($o, $code); + + $tag['processed'] = true; } return $o; } @@ -218,6 +244,16 @@ } } +class _Tag_IfNot extends _Tag_If { + + function _Tag_IfNot($tag) + { + parent::_BlockTag($tag); + $this->_Inversed = true; + } + +} + class _Tag_DefaultParam extends _BlockTag { function Open($tag) {