diff --git a/Nette/Application/UI/Presenter.php b/Nette/Application/UI/Presenter.php index 62be921043..193882f451 100644 --- a/Nette/Application/UI/Presenter.php +++ b/Nette/Application/UI/Presenter.php @@ -1346,7 +1346,8 @@ public function getApplication() /** - * @return Nette\Http\Session + * @param string + * @return Nette\Http\Session|Nette\Http\SessionSection */ public function getSession($namespace = NULL) { diff --git a/Nette/Database/Helpers.php b/Nette/Database/Helpers.php index 526b8f4ca3..89a4e46683 100644 --- a/Nette/Database/Helpers.php +++ b/Nette/Database/Helpers.php @@ -80,7 +80,7 @@ public static function dumpResult(Statement $statement) public static function dumpSql($sql) { static $keywords1 = 'SELECT|(?:ON\s+DUPLICATE\s+KEY)?UPDATE|INSERT(?:\s+INTO)?|REPLACE(?:\s+INTO)?|DELETE|CALL|UNION|FROM|WHERE|HAVING|GROUP\s+BY|ORDER\s+BY|LIMIT|OFFSET|SET|VALUES|LEFT\s+JOIN|INNER\s+JOIN|TRUNCATE'; - static $keywords2 = 'ALL|DISTINCT|DISTINCTROW|IGNORE|AS|USING|ON|AND|OR|IN|IS|NOT|NULL|LIKE|RLIKE|REGEXP|TRUE|FALSE'; + static $keywords2 = 'ALL|DISTINCT|DISTINCTROW|IGNORE|AS|USING|ON|AND|OR|IN|IS|NOT|NULL|[RI]?LIKE|REGEXP|TRUE|FALSE'; // insert new lines $sql = " $sql "; diff --git a/Nette/Database/Table/Selection.php b/Nette/Database/Table/Selection.php index 2cf47a9cd5..7950708f37 100644 --- a/Nette/Database/Table/Selection.php +++ b/Nette/Database/Table/Selection.php @@ -561,7 +561,7 @@ public function accessColumn($key, $selectColumn = TRUE) if ($key === NULL) { $this->accessedColumns = FALSE; - $currentKey = key($this->data); + $currentKey = key((array) $this->data); } elseif ($this->accessedColumns !== FALSE) { $this->accessedColumns[$key] = $selectColumn; } diff --git a/Nette/Database/Table/SqlBuilder.php b/Nette/Database/Table/SqlBuilder.php index 3c8ac20a1e..63cbb64da6 100644 --- a/Nette/Database/Table/SqlBuilder.php +++ b/Nette/Database/Table/SqlBuilder.php @@ -153,7 +153,7 @@ public function addWhere($condition, $parameters = array()) $replace = NULL; $placeholderNum = 0; foreach ($args as $arg) { - preg_match('#(?:.*?\?.*?){' . $placeholderNum . '}(((?:&|\||^|~|\+|-|\*|/|%|\(|,|<|>|=|(?<=\W|^)(?:REGEXP|ALL|AND|ANY|BETWEEN|EXISTS|IN|R?LIKE|OR|NOT|SOME))\s*)?(?:\(\?\)|\?))#s', $condition, $match, PREG_OFFSET_CAPTURE); + preg_match('#(?:.*?\?.*?){' . $placeholderNum . '}(((?:&|\||^|~|\+|-|\*|/|%|\(|,|<|>|=|(?<=\W|^)(?:REGEXP|ALL|AND|ANY|BETWEEN|EXISTS|IN|[IR]?LIKE|OR|NOT|SOME|INTERVAL))\s*)?(?:\(\?\)|\?))#s', $condition, $match, PREG_OFFSET_CAPTURE); $hasOperator = ($match[1][0] === '?' && $match[1][1] === 0) ? TRUE : !empty($match[2][0]); if ($arg === NULL) { diff --git a/Nette/Diagnostics/Debugger.php b/Nette/Diagnostics/Debugger.php index 89a64c4b0d..f58cdeda82 100644 --- a/Nette/Diagnostics/Debugger.php +++ b/Nette/Diagnostics/Debugger.php @@ -501,7 +501,7 @@ public static function _errorHandler($severity, $message, $file, $line, $context ); $message = 'PHP ' . (isset($types[$severity]) ? $types[$severity] : 'Unknown error') . ": $message"; - $count = & self::$errorPanel->data["$message|$file|$line"]; + $count = & self::$errorPanel->data["$file|$line|$message"]; if ($count++) { // repeated error return NULL; diff --git a/Nette/Diagnostics/templates/bar.errors.panel.phtml b/Nette/Diagnostics/templates/bar.errors.panel.phtml index c522695908..156eb02691 100644 --- a/Nette/Diagnostics/templates/bar.errors.panel.phtml +++ b/Nette/Diagnostics/templates/bar.errors.panel.phtml @@ -16,7 +16,7 @@ use Nette;
- $count): list($message, $file, $line) = explode('|', $item) ?> + $count): list($file, $line, $message) = explode('|', $item, 3) ?> diff --git a/Nette/Diagnostics/templates/bar.errors.tab.phtml b/Nette/Diagnostics/templates/bar.errors.tab.phtml index 4eb5b15f77..8d7740b78c 100644 --- a/Nette/Diagnostics/templates/bar.errors.tab.phtml +++ b/Nette/Diagnostics/templates/bar.errors.tab.phtml @@ -12,4 +12,4 @@ namespace Nette\Diagnostics; use Nette; ?> errors +/> 1 ? ' errors' : ' error' ?> diff --git a/Nette/Forms/Controls/BaseControl.php b/Nette/Forms/Controls/BaseControl.php index b385b450f2..e498c944b0 100644 --- a/Nette/Forms/Controls/BaseControl.php +++ b/Nette/Forms/Controls/BaseControl.php @@ -551,6 +551,16 @@ public static function validateEqual(IControl $control, $arg) } + /** + * Is control's value not equal with second parameter? + * @return bool + */ + public static function validateNotEqual(IControl $control, $arg) + { + return !static::validateEqual($control, $arg); + } + + /** * Filled validator: is control filled? * @return bool @@ -561,6 +571,16 @@ public static function validateFilled(IControl $control) } + /** + * Is control not filled? + * @return bool + */ + public static function validateBlank(IControl $control) + { + return !$control->isFilled(); + } + + /** * Valid validator: is control valid? * @return bool diff --git a/Nette/Forms/Form.php b/Nette/Forms/Form.php index ff9e66782c..fd276203e6 100644 --- a/Nette/Forms/Form.php +++ b/Nette/Forms/Form.php @@ -36,7 +36,10 @@ class Form extends Container /** validator */ const EQUAL = ':equal', IS_IN = ':equal', + NOT_EQUAL = ':notEqual', FILLED = ':filled', + BLANK = ':blank', + REQUIRED = self::FILLED, VALID = ':valid'; // CSRF protection @@ -249,7 +252,7 @@ public function addGroup($caption = NULL, $setAsCurrent = TRUE) /** * Removes fieldset group from form. - * @param string|FormGroup + * @param string|ControlGroup * @return void */ public function removeGroup($name) @@ -275,7 +278,7 @@ public function removeGroup($name) /** * Returns all defined groups. - * @return FormGroup[] + * @return ControlGroup[] */ public function getGroups() { diff --git a/Nette/Templating/Helpers.php b/Nette/Templating/Helpers.php index 78fdd2ee6e..127df2901e 100644 --- a/Nette/Templating/Helpers.php +++ b/Nette/Templating/Helpers.php @@ -118,7 +118,7 @@ public static function escapeCss($s) /** - * Escapes string for use inside JavaScript template. + * Escapes variables for use inside