Commit 40090577 by Daniel Schmidt

Merge branch 'master' of git://github.com/yiisoft/yii2 into 2103-rename-accessdeniedhttpexception

parents 7fef8cf0 a5968a6a
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
"yiisoft/yii2-codeception": "*", "yiisoft/yii2-codeception": "*",
"codeception/codeception": "*", "codeception/codeception": "*",
"codeception/specify": "*", "codeception/specify": "*",
"codeception/verify": "*",
"yiisoft/yii2-debug": "*", "yiisoft/yii2-debug": "*",
"yiisoft/yii2-gii": "*" "yiisoft/yii2-gii": "*"
}, },
......
...@@ -39,15 +39,16 @@ class ContactFormTest extends TestCase ...@@ -39,15 +39,16 @@ class ContactFormTest extends TestCase
$model->contact('admin@example.com'); $model->contact('admin@example.com');
$this->specify('email should be send', function () { $this->specify('email should be send', function () {
$this->assertFileExists($this->getMessageFile(), 'email file should exist'); expect('email file should exist', file_exists($this->getMessageFile()))->true();
}); });
$this->specify('message should contain correct data', function () use($model) { $this->specify('message should contain correct data', function () use($model) {
$emailMessage = file_get_contents($this->getMessageFile()); $emailMessage = file_get_contents($this->getMessageFile());
$this->assertContains($model->name, $emailMessage, 'email should contain user name');
$this->assertContains($model->email, $emailMessage, 'email should contain sender email'); expect('email should contain user name', $emailMessage)->contains($model->name);
$this->assertContains($model->subject, $emailMessage, 'email should contain subject'); expect('email should contain sender email', $emailMessage)->contains($model->email);
$this->assertContains($model->body, $emailMessage, 'email should contain body'); expect('email should contain subject', $emailMessage)->contains($model->subject);
expect('email should contain body', $emailMessage)->contains($model->body);
}); });
} }
......
...@@ -19,8 +19,8 @@ class LoginFormTest extends TestCase ...@@ -19,8 +19,8 @@ class LoginFormTest extends TestCase
$model->password = 'some_password'; $model->password = 'some_password';
$this->specify('user should not be able to login, when there is no identity' , function () use ($model) { $this->specify('user should not be able to login, when there is no identity' , function () use ($model) {
$this->assertFalse($model->login()); expect('model should not login user', $model->login())->false();
$this->assertTrue(Yii::$app->user->isGuest,'user should not be logged in'); expect('user should not be logged in', Yii::$app->user->isGuest)->true();
}); });
} }
...@@ -32,9 +32,9 @@ class LoginFormTest extends TestCase ...@@ -32,9 +32,9 @@ class LoginFormTest extends TestCase
$model->password = 'wrong-password'; $model->password = 'wrong-password';
$this->specify('user should not be able to login with wrong password', function () use ($model) { $this->specify('user should not be able to login with wrong password', function () use ($model) {
$this->assertFalse($model->login()); expect('model should not login user', $model->login())->false();
$this->assertArrayHasKey('password', $model->errors); expect('error message should be set', $model->errors)->hasKey('password');
$this->assertTrue(Yii::$app->user->isGuest, 'user should not be logged in'); expect('user should not be logged in', Yii::$app->user->isGuest)->true();
}); });
} }
...@@ -46,9 +46,9 @@ class LoginFormTest extends TestCase ...@@ -46,9 +46,9 @@ class LoginFormTest extends TestCase
$model->password = 'demo'; $model->password = 'demo';
$this->specify('user should be able to login with correct credentials', function() use ($model) { $this->specify('user should be able to login with correct credentials', function() use ($model) {
$this->assertTrue($model->login()); expect('model should login user', $model->login())->true();
$this->assertArrayNotHasKey('password', $model->errors); expect('error message should not be set', $model->errors)->hasntKey('password');
$this->assertFalse(Yii::$app->user->isGuest,'user should be logged in'); expect('user should be logged in', Yii::$app->user->isGuest)->false();
}); });
} }
......
...@@ -76,8 +76,7 @@ There are two ActiveRecord methods for querying data from database: ...@@ -76,8 +76,7 @@ There are two ActiveRecord methods for querying data from database:
- [[ActiveRecord::find()]] - [[ActiveRecord::find()]]
- [[ActiveRecord::findBySql()]] - [[ActiveRecord::findBySql()]]
Both methods return an [[ActiveQuery]] instance, which extends [[Query]], and thus supports Both methods return an [[ActiveQuery]] instance, which extends [[Query]], and thus supports the same set of flexible and powerful DB query methods. The following examples demonstrate some of the possibilities.
the same set of flexible and powerful DB query methods. The following examples demonstrate some of the possibilities.
```php ```php
// to retrieve all *active* customers and order them by their ID: // to retrieve all *active* customers and order them by their ID:
...@@ -119,8 +118,7 @@ Accessing Column Data ...@@ -119,8 +118,7 @@ Accessing Column Data
--------------------- ---------------------
ActiveRecord maps each column of the corresponding database table row to an attribute in the ActiveRecord ActiveRecord maps each column of the corresponding database table row to an attribute in the ActiveRecord
object. The attribute behaves like any regular object public property. The attribute's name will be the same as the corresponding column object. The attribute behaves like any regular object public property. The attribute's name will be the same as the corresponding column name, and is case-sensitive.
name, and is case-sensitive.
To read the value of a column, you can use the following syntax: To read the value of a column, you can use the following syntax:
...@@ -151,9 +149,7 @@ ActiveRecord provides the following methods to insert, update and delete data in ...@@ -151,9 +149,7 @@ ActiveRecord provides the following methods to insert, update and delete data in
- [[ActiveRecord::updateAllCounters()|updateAllCounters()]] - [[ActiveRecord::updateAllCounters()|updateAllCounters()]]
- [[ActiveRecord::deleteAll()|deleteAll()]] - [[ActiveRecord::deleteAll()|deleteAll()]]
Note that [[ActiveRecord::updateAll()|updateAll()]], [[ActiveRecord::updateAllCounters()|updateAllCounters()]] Note that [[ActiveRecord::updateAll()|updateAll()]], [[ActiveRecord::updateAllCounters()|updateAllCounters()]] and [[ActiveRecord::deleteAll()|deleteAll()]] are static methods that apply to the whole database table. The other methods only apply to the row associated with the ActiveRecord object through which the method is being called.
and [[ActiveRecord::deleteAll()|deleteAll()]] are static methods that apply to the whole database
table. The other methods only apply to the row associated with the ActiveRecord object through which the method is being called.
```php ```php
// to insert a new customer record // to insert a new customer record
...@@ -477,7 +473,7 @@ of the corresponding JOIN query. For example, ...@@ -477,7 +473,7 @@ of the corresponding JOIN query. For example,
```php ```php
// SELECT tbl_user.* FROM tbl_user LEFT JOIN tbl_item ON tbl_item.owner_id=tbl_user.id AND category_id=1 // SELECT tbl_user.* FROM tbl_user LEFT JOIN tbl_item ON tbl_item.owner_id=tbl_user.id AND category_id=1
// SELECT * FROM tbl_item WHERE owner_id IN (...) AND category_id=1 // SELECT * FROM tbl_item WHERE owner_id IN (...) AND category_id=1
$users = User::model()->joinWith('books')->all(); $users = User::find()->joinWith('books')->all();
``` ```
Note that if you use eager loading via [[ActiveQuery::with()]] or lazy loading, the on-condition will be put Note that if you use eager loading via [[ActiveQuery::with()]] or lazy loading, the on-condition will be put
...@@ -485,7 +481,7 @@ in the WHERE part of the corresponding SQL statement, because there is no JOIN q ...@@ -485,7 +481,7 @@ in the WHERE part of the corresponding SQL statement, because there is no JOIN q
```php ```php
// SELECT * FROM tbl_user WHERE id=10 // SELECT * FROM tbl_user WHERE id=10
$user = User::model(10); $user = User::find(10);
// SELECT * FROM tbl_item WHERE owner_id=10 AND category_id=1 // SELECT * FROM tbl_item WHERE owner_id=10 AND category_id=1
$books = $user->books; $books = $user->books;
``` ```
...@@ -552,7 +548,7 @@ Custom scopes ...@@ -552,7 +548,7 @@ Custom scopes
When [[find()]] or [[findBySql()]] Active Record method is being called without parameters it returns an [[ActiveQuery]] When [[find()]] or [[findBySql()]] Active Record method is being called without parameters it returns an [[ActiveQuery]]
instance. This object holds all the parameters and conditions for a future query and also allows you to customize these instance. This object holds all the parameters and conditions for a future query and also allows you to customize these
using a set of methods that are called scopes. By deafault there is a good set of such methods some of which we've using a set of methods that are called scopes. By default there is a good set of such methods some of which we've
already used above: `where`, `orderBy`, `limit` etc. already used above: `where`, `orderBy`, `limit` etc.
In many cases it is convenient to wrap extra conditions into custom scope methods. In order to do so you need two things. In many cases it is convenient to wrap extra conditions into custom scope methods. In order to do so you need two things.
...@@ -561,7 +557,7 @@ First is creating a custom query class for your model. For example, a `Comment` ...@@ -561,7 +557,7 @@ First is creating a custom query class for your model. For example, a `Comment`
```php ```php
namespace app\models; namespace app\models;
import yii\db\ActiveQuery; use yii\db\ActiveQuery;
class CommentQuery extends ActiveQuery class CommentQuery extends ActiveQuery
{ {
...@@ -663,10 +659,10 @@ TODO: FIXME: WIP, TBD, https://github.com/yiisoft/yii2/issues/226 ...@@ -663,10 +659,10 @@ TODO: FIXME: WIP, TBD, https://github.com/yiisoft/yii2/issues/226
, ,
[[afterSave()]], [[beforeDelete()]] and/or [[afterDelete()]] life cycle methods. Developer may come [[afterSave()]], [[beforeDelete()]] and/or [[afterDelete()]] life cycle methods. Developer may come
to the solution of overriding ActiveRecord [[save()]] method with database transaction wrapping or to the solution of overriding ActiveRecord [[save()]] method with database transaction wrapping or
even using transaction in controller action, which is strictly speaking doesn't seems to be a good even using transaction in controller action, which is strictly speaking doesn't seem to be a good
practice (recall skinny-controller fat-model fundamental rule). practice (recall "skinny-controller / fat-model" fundamental rule).
Here these ways are (**DO NOT** use them unless you're sure what are you actually doing). Models: Here these ways are (**DO NOT** use them unless you're sure what you are actually doing). Models:
```php ```php
class Feature extends \yii\db\ActiveRecord class Feature extends \yii\db\ActiveRecord
......
...@@ -260,7 +260,7 @@ $connection->createCommand()->createTable('tbl_post', [ ...@@ -260,7 +260,7 @@ $connection->createCommand()->createTable('tbl_post', [
'id' => 'pk', 'id' => 'pk',
'title' => 'string', 'title' => 'string',
'text' => 'text', 'text' => 'text',
]; ]);
``` ```
For the full reference check [[\yii\db\Command]]. For the full reference check [[\yii\db\Command]].
...@@ -12,7 +12,7 @@ defined('YII_DEBUG') or define('YII_DEBUG', false); ...@@ -12,7 +12,7 @@ defined('YII_DEBUG') or define('YII_DEBUG', false);
$composerAutoload = [ $composerAutoload = [
__DIR__ . '/vendor/autoload.php', // standalone with "composer install" run __DIR__ . '/vendor/autoload.php', // standalone with "composer install" run
__DIR__ . '/../../../../autoload.php', // script is installed as a composer binary __DIR__ . '/../../autoload.php', // script is installed as a composer binary
]; ];
foreach($composerAutoload as $autoload) { foreach($composerAutoload as $autoload) {
if (file_exists($autoload)) { if (file_exists($autoload)) {
...@@ -21,9 +21,9 @@ foreach($composerAutoload as $autoload) { ...@@ -21,9 +21,9 @@ foreach($composerAutoload as $autoload) {
} }
} }
$yiiDirs = [ $yiiDirs = [
__DIR__ . '/../../../framework', // in yii2-dev repo __DIR__ . '/../../framework', // in yii2-dev repo
__DIR__ . '/vendor/yiisoft/yii2', // standalone with "composer install" run __DIR__ . '/vendor/yiisoft/yii2', // standalone with "composer install" run
__DIR__ . '/../../../../yiisoft/yii2', // script is installed as a composer binary __DIR__ . '/../../yiisoft/yii2', // script is installed as a composer binary
]; ];
foreach($yiiDirs as $dir) { foreach($yiiDirs as $dir) {
if (file_exists($dir . '/Yii.php')) { if (file_exists($dir . '/Yii.php')) {
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
"minimum-stability": "dev", "minimum-stability": "dev",
"require": { "require": {
"yiisoft/yii2": "*", "yiisoft/yii2": "*",
"phpdocumentor/reflection": "1.0.2" "phpdocumentor/reflection": "dev-master | >1.0.2"
}, },
"autoload": { "autoload": {
"psr-4": { "yii\\apidoc\\": "" } "psr-4": { "yii\\apidoc\\": "" }
......
...@@ -202,7 +202,7 @@ class Nav extends Widget ...@@ -202,7 +202,7 @@ class Nav extends Widget
unset($item['url']['#']); unset($item['url']['#']);
if (count($item['url']) > 1) { if (count($item['url']) > 1) {
foreach (array_splice($item['url'], 1) as $name => $value) { foreach (array_splice($item['url'], 1) as $name => $value) {
if (!isset($this->params[$name]) || $this->params[$name] != $value) { if ($value !== null && (!isset($this->params[$name]) || $this->params[$name] != $value)) {
return false; return false;
} }
} }
......
...@@ -36,13 +36,15 @@ class RequestPanel extends Panel ...@@ -36,13 +36,15 @@ class RequestPanel extends Panel
public function save() public function save()
{ {
if (function_exists('apache_request_headers')) { $headers = Yii::$app->getRequest()->getHeaders();
$requestHeaders = apache_request_headers(); foreach ($headers as $name => $value) {
} elseif (function_exists('http_get_request_headers')) { if (is_array($value) && count($value) == 1) {
$requestHeaders = http_get_request_headers(); $requestHeaders[$name] = current($value);
} else { } else {
$requestHeaders = []; $requestHeaders[$name] = $value;
} }
}
$responseHeaders = []; $responseHeaders = [];
foreach (headers_list() as $header) { foreach (headers_list() as $header) {
if (($pos = strpos($header, ':')) !== false) { if (($pos = strpos($header, ':')) !== false) {
......
...@@ -39,6 +39,9 @@ use yii\db\ActiveQueryTrait; ...@@ -39,6 +39,9 @@ use yii\db\ActiveQueryTrait;
* $customers = Customer::find()->with('orders')->asArray()->all(); * $customers = Customer::find()->with('orders')->asArray()->all();
* ~~~ * ~~~
* *
* NOTE: elasticsearch limits the number of records returned to 10 records by default.
* If you expect to get more records you should specify limit explicitly.
*
* @author Carsten Brandt <mail@cebe.cc> * @author Carsten Brandt <mail@cebe.cc>
* @since 2.0 * @since 2.0
*/ */
......
...@@ -22,6 +22,11 @@ use yii\db\ActiveRelationTrait; ...@@ -22,6 +22,11 @@ use yii\db\ActiveRelationTrait;
* *
* If a relation involves a pivot table, it may be specified by [[via()]] method. * If a relation involves a pivot table, it may be specified by [[via()]] method.
* *
* NOTE: elasticsearch limits the number of records returned by any query to 10 records by default.
* If you expect to get more records you should specify limit explicitly in relation definition.
* This is also important for relations that use [[via()]] so that if via records are limited to 10
* the relations records can also not be more than 10.
*
* @author Carsten Brandt <mail@cebe.cc> * @author Carsten Brandt <mail@cebe.cc>
* @since 2.0 * @since 2.0
*/ */
......
...@@ -46,6 +46,9 @@ use yii\db\QueryTrait; ...@@ -46,6 +46,9 @@ use yii\db\QueryTrait;
* - [[column()]]: returns the value of the first column in the query result. * - [[column()]]: returns the value of the first column in the query result.
* - [[exists()]]: returns a value indicating whether the query result has data or not. * - [[exists()]]: returns a value indicating whether the query result has data or not.
* *
* NOTE: elasticsearch limits the number of records returned to 10 records by default.
* If you expect to get more records you should specify limit explicitly.
*
* @author Carsten Brandt <mail@cebe.cc> * @author Carsten Brandt <mail@cebe.cc>
* @since 2.0 * @since 2.0
*/ */
......
...@@ -48,6 +48,13 @@ Using the Query ...@@ -48,6 +48,13 @@ Using the Query
TBD TBD
> **NOTE:** elasticsearch limits the number of records returned by any query to 10 records by default.
> If you expect to get more records you should specify limit explicitly in relation definition.
* This is also important for relations that use [[via()]] so that if via records are limited to 10
* the relations records can also not be more than 10.
*
Using the ActiveRecord Using the ActiveRecord
---------------------- ----------------------
...@@ -113,6 +120,12 @@ It supports the same interface and features except the following limitations and ...@@ -113,6 +120,12 @@ It supports the same interface and features except the following limitations and
on how to compose `query` and `filter` parts. on how to compose `query` and `filter` parts.
- It is also possible to define relations from elasticsearch ActiveRecords to normal ActiveRecord classes and vice versa. - It is also possible to define relations from elasticsearch ActiveRecords to normal ActiveRecord classes and vice versa.
> **NOTE:** elasticsearch limits the number of records returned by any query to 10 records by default.
> If you expect to get more records you should specify limit explicitly in query **and also** relation definition.
> This is also important for relations that use via() so that if via records are limited to 10
> the relations records can also not be more than 10.
Usage example: Usage example:
```php ```php
......
...@@ -102,6 +102,8 @@ Yii Framework 2 Change Log ...@@ -102,6 +102,8 @@ Yii Framework 2 Change Log
- Enh #1839: Added support for getting file extension and basename from uploaded file (anfrantic) - Enh #1839: Added support for getting file extension and basename from uploaded file (anfrantic)
- Enh: yii\codeception\TestCase now supports loading and using fixtures via Yii fixture framework (qiangxue) - Enh: yii\codeception\TestCase now supports loading and using fixtures via Yii fixture framework (qiangxue)
- Enh: Added support to parse json request data to Request::getRestParams() (cebe) - Enh: Added support to parse json request data to Request::getRestParams() (cebe)
- Enh: Added ability to get incoming headers (dizews)
- Enh: Added `beforeRun()` and `afterRun()` to `yii\base\Action` (qiangxue)
- Chg #1519: `yii\web\User::loginRequired()` now returns the `Response` object instead of exiting the application (qiangxue) - Chg #1519: `yii\web\User::loginRequired()` now returns the `Response` object instead of exiting the application (qiangxue)
- Chg #1586: `QueryBuilder::buildLikeCondition()` will now escape special characters and use percentage characters by default (qiangxue) - Chg #1586: `QueryBuilder::buildLikeCondition()` will now escape special characters and use percentage characters by default (qiangxue)
- Chg #1610: `Html::activeCheckboxList()` and `Html::activeRadioList()` will submit an empty string if no checkbox/radio is selected (qiangxue) - Chg #1610: `Html::activeCheckboxList()` and `Html::activeRadioList()` will submit an empty string if no checkbox/radio is selected (qiangxue)
...@@ -111,6 +113,7 @@ Yii Framework 2 Change Log ...@@ -111,6 +113,7 @@ Yii Framework 2 Change Log
- Chg #1821: Changed default values for yii\db\Connection username and password to null (cebe) - Chg #1821: Changed default values for yii\db\Connection username and password to null (cebe)
- Chg #1844: `Response::sendFile()` and other file sending methods will not send the response (qiangxue) - Chg #1844: `Response::sendFile()` and other file sending methods will not send the response (qiangxue)
- Chg #1852: DbConnection::tablePrefix default value now 'tbl_' (creocoder) - Chg #1852: DbConnection::tablePrefix default value now 'tbl_' (creocoder)
- Chg #1958: `beforeSubmit` in `yii.activeform` is now executed after validation and before form submission (6pblcb)
- Chg #2025: Removed ability to declare scopes in ActiveRecord (samdark) - Chg #2025: Removed ability to declare scopes in ActiveRecord (samdark)
- Chg #2057: AutoTimestamp attributes defaults changed from `create_time` and `update_time` to `created_at` and `updated_at` (creocoder) - Chg #2057: AutoTimestamp attributes defaults changed from `create_time` and `update_time` to `created_at` and `updated_at` (creocoder)
- Chg #2063: Removed `yii\web\Request::acceptTypes` and renamed `yii\web\Request::acceptedContentTypes` to `acceptableContentTypes` (qiangxue) - Chg #2063: Removed `yii\web\Request::acceptTypes` and renamed `yii\web\Request::acceptedContentTypes` to `acceptableContentTypes` (qiangxue)
......
...@@ -127,6 +127,13 @@ ...@@ -127,6 +127,13 @@
var $form = $(this), var $form = $(this),
data = $form.data('yiiActiveForm'); data = $form.data('yiiActiveForm');
if (data.validated) { if (data.validated) {
if (data.settings.beforeSubmit !== undefined) {
if (data.settings.beforeSubmit($form) == false) {
data.validated = false;
data.submitting = false;
return false;
}
}
// continue submitting the form since validation passes // continue submitting the form since validation passes
return true; return true;
} }
...@@ -135,7 +142,6 @@ ...@@ -135,7 +142,6 @@
clearTimeout(data.settings.timer); clearTimeout(data.settings.timer);
} }
data.submitting = true; data.submitting = true;
if (!data.settings.beforeSubmit || data.settings.beforeSubmit($form)) {
validate($form, function (messages) { validate($form, function (messages) {
var errors = []; var errors = [];
$.each(data.attributes, function () { $.each(data.attributes, function () {
...@@ -166,9 +172,6 @@ ...@@ -166,9 +172,6 @@
}, function () { }, function () {
data.submitting = false; data.submitting = false;
}); });
} else {
data.submitting = false;
}
return false; return false;
}, },
......
...@@ -86,4 +86,23 @@ class Action extends Component ...@@ -86,4 +86,23 @@ class Action extends Component
} }
return call_user_func_array([$this, 'run'], $args); return call_user_func_array([$this, 'run'], $args);
} }
/**
* This method is called right before `run()` is executed.
* You may override this method to do preparation work for the action run.
* If the method returns false, it will cancel the action.
* @return boolean whether to run the action.
*/
protected function beforeRun()
{
return true;
}
/**
* This method is called right after `run()` is executed.
* You may override this method to do post-processing work for the action run.
*/
protected function afterRun()
{
}
} }
...@@ -7,7 +7,7 @@ return [ ...@@ -7,7 +7,7 @@ return [
'messagePath' => __DIR__, 'messagePath' => __DIR__,
// array, required, list of language codes that the extracted messages // array, required, list of language codes that the extracted messages
// should be translated to. For example, ['zh-CN', 'de']. // should be translated to. For example, ['zh-CN', 'de'].
'languages' => ['ar', 'da', 'de', 'es', 'fa-IR', 'fr', 'it', 'ja', 'pl', 'pt-BR', 'pt-PT', 'ro', 'ru', 'sk', 'sr', 'sr-Latn', 'uk', 'zh-CN'], 'languages' => ['ar', 'da', 'de', 'el', 'es', 'fa-IR', 'fr', 'it', 'ja', 'pl', 'pt-BR', 'pt-PT', 'ro', 'ru', 'sk', 'sr', 'sr-Latn', 'uk', 'zh-CN'],
// string, the name of the function for translating messages. // string, the name of the function for translating messages.
// Defaults to 'Yii::t'. This is used as a mark to find the messages to be // Defaults to 'Yii::t'. This is used as a mark to find the messages to be
// translated. You may use a string for single function name or an array for // translated. You may use a string for single function name or an array for
......
<?php
/**
* Message translations.
*
* This file is automatically generated by 'yii message' command.
* It contains the localizable messages extracted from source code.
* You may modify this file by translating the extracted messages.
*
* Each array element represents the translation (value) of a message (key).
* If the value is empty, the message is considered as not translated.
* Messages that no longer need translation will have their translations
* enclosed between a pair of '@@' marks.
*
* Message string can be used with plural forms format. Check i18n section
* of the guide for details.
*
* NOTE: this file must be saved in UTF-8 encoding.
*/
return array (
'Home' => 'Αρχική',
'Invalid data received for parameter "{param}".' => 'Μη έγκυρα δεδομένα για την παράμετρο "{param}".',
'Login Required' => 'Απαιτείται είσοδος',
'Missing required arguments: {params}' => 'Απουσιάζουν απαραίτητες επιλογές: {params}',
'Missing required parameters: {params}' => 'Απουσιάζουν απαραίτητες παράμετροι: {params}',
'No help for unknown command "{command}".' => 'Δεν υπάρχει τεκμηρίωση για την εντολή "{command}".',
'No help for unknown sub-command "{command}".' => 'Δεν υπάρχει τεκμηρίωση για την υπό-εντολή "{command}".',
'Showing <b>{begin, number}-{end, number}</b> of <b>{totalCount, number}</b> {totalCount, plural, one{item} other{items}}.' => 'Παρουσιάζονται <b>{begin, number}-{end, number}</b> από <b>{totalCount, number}</b>.',
'Total <b>{count, number}</b> {count, plural, one{item} other{items}}.' => 'Συνολικά <b>{count, number}</b> {count, plural, one{αντικείμενο} few{αντικείμενα} many{αντικείμενα} other{αντικείμενα}}.',
'Unable to verify your data submission.' => 'Δεν ήταν δυνατή η επαλήθευση των απεσταλμένων δεδομένων.',
'Unknown command "{command}".' => 'Άγνωστη εντολή "{command}".',
'Unknown option: --{name}' => 'Άγνωστη επιλογή : --{name}',
'View' => 'Προβολή',
'the input value' => 'η τιμή εισόδου',
'(not set)' => '(μη ορισμένο)',
'An internal server error occurred.' => 'Σφάλμα διακομιστή.',
'Are you sure to delete this item?' => 'Είστε σίγουρος για τη διαγραφή;',
'Delete' => 'Διαγραφή',
'Error' => 'Σφάλμα',
'File upload failed.' => 'Η μεταφόρτωση απέτυχε.',
'Invalid Configuration' => 'Invalid Configuration',
'No' => 'Όχι',
'No results found.' => 'Δεν βρέθηκαν αποτελέσματα.',
'Not Supported' => 'Δεν υποστηρίζεται',
'Only files with these extensions are allowed: {extensions}.' => 'Επιτρέπονται αρχεία μόνο με καταλήξεις: {extensions}.',
'Only files with these mimeTypes are allowed: {mimeTypes}.' => 'Επιτρέπονται αρχεία μόνο με MIME τύπο: {mimeTypes}.',
'Page not found.' => 'Η σελίδα δεν βρέθηκε.',
'Please fix the following errors:' => 'Παρακαλώ διορθώστε τα παρακάτω σφάλματα:',
'Please upload a file.' => 'Παρακαλώ μεταφορτώστε ένα αρχείο.',
'The file "{file}" is not an image.' => 'Το αρχείο «{file}» δεν είναι εικόνα.',
'The file "{file}" is too big. Its size cannot exceed {limit, number} {limit, plural, one{byte} other{bytes}}.' => 'Το αρχείο «{file}» είναι πολύ μεγάλο . Το μέγεθος του δεν μπορεί να είναι πάνω από {limit, number} {limit, plural, one{byte} other{bytes}}.',
'The image "{file}" is too large. The height cannot be larger than {limit, number} {limit, plural, one{pixel} other{pixels}}.' => 'Το αρχείο «{file}» είναι πολύ μεγάλο. Το ύψος δεν μπορεί να είναι μεγαλύτερο από {limit, number} {limit, plural, one{pixel} few{pixels} many{pixels} other{pixels}}.',
'The image "{file}" is too large. The width cannot be larger than {limit, number} {limit, plural, one{pixel} other{pixels}}.' => 'Το αρχείο «{file}» είναι πολύ μεγάλο. Το πλάτος δεν μπορεί να είναι μεγαλύτερο από {limit, number} {limit, plural, one{pixel} few{pixels} many{pixels} other{pixels}}.',
'The file "{file}" is too small. Its size cannot be smaller than {limit, number} {limit, plural, one{byte} other{bytes}}.' => 'Το αρχείο «{file}» είναι πολύ μικρό. Το μέγεθος του δεν μπορεί να είναι μικρότερο από {limit, number} {limit, plural, one{byte} few{bytes} many{bytes} other{bytes}}.',
'The image "{file}" is too small. The height cannot be smaller than {limit, number} {limit, plural, one{pixel} other{pixels}}.' => 'Το αρχείο «{file}» είναι πολύ μικρό. To ύψος δεν μπορεί να είναι μικρότερο από {limit, number} {limit, plural, one{pixel} few{pixels} many{pixels} other{pixels}}.',
'The image "{file}" is too small. The width cannot be smaller than {limit, number} {limit, plural, one{pixel} other{pixels}}.' => 'Το αρχείο «{file}» είναι πολύ μικρό. Το πλάτος του δεν μπορεί να είναι μικρότερο από {limit, number} {limit, plural, one{pixel} few{pixels} many{pixels} other{pixels}}.',
'The format of {attribute} is invalid.' => 'Ο τύπος του «{attribute}» δεν είναι έγκυρος.',
'The verification code is incorrect.' => 'Ο κωδικός επαλήθευσης είναι εσφαλμένος.',
'Update' => 'Ενημέρωση',
'User Error' => 'Σφάλμα χρήστη',
'User Warning' => 'Προειδοποίηση χρήστη',
'Warning' => 'Προειδοποίηση',
'Yes' => 'Ναι',
'You are not allowed to perform this action.' => 'Δεν επιτρέπεται να εκτελέσετε αυτή τη δράση.',
'You can upload at most {limit, number} {limit, plural, one{file} other{files}}.' => 'Μπορείτε να μεταφορτώσετε το πολύ {limit, number} {limit, plural, one{αρχείο} few{αρχεία} many{αρχεία} other{αρχεία}}.',
'{attribute} "{value}" has already been taken.' => '{attribute} «{value}» έχει ήδη καταχωρηθεί.',
'{attribute} cannot be blank.' => 'Το «{attribute}» δεν μπορεί να είναι κενό.',
'{attribute} is invalid.' => 'Το «{attribute}» δεν είναι έγκυρο.',
'{attribute} is not a valid URL.' => 'Το «{attribute}» δεν είναι έγκυρο URL.',
'{attribute} is not a valid email address.' => 'Η διεύθυνση email «{attribute}» δεν είναι έγκυρη .',
'{attribute} must be "{requiredValue}".' => 'Το «{attribute}» πρέπει να είναι «{requiredValue}».',
'{attribute} must be a number.' => 'Το «{attribute}» πρέπει να είναι αριθμός.',
'{attribute} must be a string.' => 'Το «{attribute}» πρέπει να είναι συμβολοσειρά.',
'{attribute} must be an integer.' => 'Το «{attribute}» πρέπει να είναι ακέραιος.',
'{attribute} must be either "{true}" or "{false}".' => 'Το «{attribute}» πρέπει να είναι «{true}» ή «{false}».',
'{attribute} must be greater than "{compareValue}".' => 'Το «{attribute}» πρέπει να είναι μεγαλύτερο από «{compareValue}».',
'{attribute} must be greater than or equal to "{compareValue}".' => 'Το «{attribute}» πρέπει να είναι μεγαλύτερο ή ίσο με «{compareValue}».',
'{attribute} must be less than "{compareValue}".' => 'Το «{attribute}» πρέπει να είναι μικρότερο από «{compareValue}».',
'{attribute} must be less than or equal to "{compareValue}".' => 'Το «{attribute}» πρέπει να είναι μικρότερο ή ίσο με «{compareValue}».',
'{attribute} must be no greater than {max}.' => 'Το «{attribute}» πρέπει να μην ξεπερνά το {max}.',
'{attribute} must be no less than {min}.' => 'Το «{attribute}» πρέπει να μην είναι λιγότερο από {min}.',
'{attribute} must be repeated exactly.' => 'Το «{attribute}» πρέπει να επαναληφθεί ακριβώς.',
'{attribute} must not be equal to "{compareValue}".' => 'Το «{attribute}» πρέπει να μην είναι ίσο με «{compareValue}».',
'{attribute} should contain at least {min, number} {min, plural, one{character} other{characters}}.' => 'Το «{attribute}» πρέπει να περιέχει το λιγότερο {min, number} {min, plural, one{χαρακτήρα} few{χαρακτήρες} many{χαρακτήρες} other{χαρακτήρες}}.',
'{attribute} should contain at most {max, number} {max, plural, one{character} other{characters}}.' => 'Το «{attribute}» πρέπει να περιέχει το πολύ {max, number} {max, plural, one{χαρακτήρα} few{χαρακτήρες} many{χαρακτήρες} other{χαρακτήρες}}.',
'{attribute} should contain {length, number} {length, plural, one{character} other{characters}}.' => 'Το «{attribute}» πρέπει να περιέχει {length, number} {length, plural, one{χαρακτήρα} few{χαρακτήρες} many{χαρακτήρες} other{χαρακτήρες}}.',
);
...@@ -17,12 +17,11 @@ ...@@ -17,12 +17,11 @@
* NOTE: this file must be saved in UTF-8 encoding. * NOTE: this file must be saved in UTF-8 encoding.
*/ */
return array ( return array (
'View' => '',
'(not set)' => '(não definido)', '(not set)' => '(não definido)',
'An internal server error occurred.' => 'Ocorreu um erro interno do servidor.', 'An internal server error occurred.' => 'Ocorreu um erro interno do servidor.',
'Are you sure to delete this item?' => 'Tem certeza de que deseja excluir este item?', 'Are you sure to delete this item?' => 'Tem certeza de que deseja excluir este item?',
'Delete' => 'Excluir', 'Delete' => 'Excluir',
'Error' => 'Error', 'Error' => 'Erro',
'File upload failed.' => 'O upload do arquivo falhou.', 'File upload failed.' => 'O upload do arquivo falhou.',
'Home' => 'Página Inicial', 'Home' => 'Página Inicial',
'Invalid data received for parameter "{param}".' => 'Dados inválidos recebidos para o parâmetro “{param}”.', 'Invalid data received for parameter "{param}".' => 'Dados inválidos recebidos para o parâmetro “{param}”.',
...@@ -33,29 +32,30 @@ return array ( ...@@ -33,29 +32,30 @@ return array (
'No help for unknown command "{command}".' => 'Não há ajuda para o comando desconhecido “{command}”.', 'No help for unknown command "{command}".' => 'Não há ajuda para o comando desconhecido “{command}”.',
'No help for unknown sub-command "{command}".' => 'Não há ajuda para o sub-comando desconhecido “{command}”.', 'No help for unknown sub-command "{command}".' => 'Não há ajuda para o sub-comando desconhecido “{command}”.',
'No results found.' => 'Nenhum resultado foi encontrado.', 'No results found.' => 'Nenhum resultado foi encontrado.',
'Only files with these extensions are allowed: {extensions}.' => 'Só são permitidos arquivos com as seguintes extensões: {extensions}.', 'Only files with these extensions are allowed: {extensions}.' => 'São permitidos somente arquivos com as seguintes extensões: {extensions}.',
'Only files with these mimeTypes are allowed: {mimeTypes}.' => 'Só são permitidos arquivos com os seguintes mimeTypes: {mimeTypes}.', 'Only files with these mimeTypes are allowed: {mimeTypes}.' => 'São permitidos somente arquivos com os seguintes mimeTypes: {mimeTypes}.',
'Page not found.' => 'Página não encontrada.', 'Page not found.' => 'Página não encontrada.',
'Please fix the following errors:' => 'Por favor, corrija os seguintes erros:', 'Please fix the following errors:' => 'Por favor, corrija os seguintes erros:',
'Please upload a file.' => 'Por favor suba um arquivo.', 'Please upload a file.' => 'Por favor, faça upload de um arquivo.',
'Showing <b>{begin, number}-{end, number}</b> of <b>{totalCount, number}</b> {totalCount, plural, one{item} other{items}}.' => 'Exibindo <b>{begin, number}-{end, number}</b> de <b>{totalCount, number}</b> {totalCount, plural, one{item} other{itens}}.', 'Showing <b>{begin, number}-{end, number}</b> of <b>{totalCount, number}</b> {totalCount, plural, one{item} other{items}}.' => 'Exibindo <b>{begin, number}-{end, number}</b> de <b>{totalCount, number}</b> {totalCount, plural, one{item} other{itens}}.',
'The file "{file}" is not an image.' => 'O arquivo “{file}” não é uma imagem.', 'The file "{file}" is not an image.' => 'O arquivo “{file}” não é uma imagem.',
'The file "{file}" is too big. Its size cannot exceed {limit, number} {limit, plural, one{byte} other{bytes}}.' => 'O arquivo “{file}” é grande demais. Seu tamanho não pode exceder {limit, number} {limit, plural, one{byte} other{bytes}}.', 'The file "{file}" is too big. Its size cannot exceed {limit, number} {limit, plural, one{byte} other{bytes}}.' => 'O arquivo “{file}” é grande demais. Seu tamanho não pode exceder {limit, number} {limit, plural, one{byte} other{bytes}}.',
'The file "{file}" is too small. Its size cannot be smaller than {limit, number} {limit, plural, one{byte} other{bytes}}.' => 'O arquivo “{file}” é pequeno demais. Seu tamanho não pode ser menor do que {limit, number} {limit, plural, one{byte} other{bytes}}.', 'The file "{file}" is too small. Its size cannot be smaller than {limit, number} {limit, plural, one{byte} other{bytes}}.' => 'O arquivo “{file}” é pequeno demais. Seu tamanho não pode ser menor que {limit, number} {limit, plural, one{byte} other{bytes}}.',
'The format of {attribute} is invalid.' => 'O formato de “{attribute}” é inválido.', 'The format of {attribute} is invalid.' => 'O formato de “{attribute}” é inválido.',
'The image "{file}" is too large. The height cannot be larger than {limit, number} {limit, plural, one{pixel} other{pixels}}.' => 'O arquivo “{file}” é grande demais. A altura não pode ser maior do que {limit, number} {limit, plural, one{pixel} other{pixels}}.', 'The image "{file}" is too large. The height cannot be larger than {limit, number} {limit, plural, one{pixel} other{pixels}}.' => 'O arquivo “{file}” é grande demais. A altura não pode ser maior que {limit, number} {limit, plural, one{pixel} other{pixels}}.',
'The image "{file}" is too large. The width cannot be larger than {limit, number} {limit, plural, one{pixel} other{pixels}}.' => 'O arquivo “{file}” é grande demais. A largura não pode ser maior do que {limit, number} {limit, plural, one{pixel} other{pixels}}.', 'The image "{file}" is too large. The width cannot be larger than {limit, number} {limit, plural, one{pixel} other{pixels}}.' => 'O arquivo “{file}” é grande demais. A largura não pode ser maior que {limit, number} {limit, plural, one{pixel} other{pixels}}.',
'The image "{file}" is too small. The height cannot be smaller than {limit, number} {limit, plural, one{pixel} other{pixels}}.' => 'O arquivo “{file}” é pequeno demais. A altura não pode ser menor do que {limit, number} {limit, plural, one{pixel} other{pixels}}.', 'The image "{file}" is too small. The height cannot be smaller than {limit, number} {limit, plural, one{pixel} other{pixels}}.' => 'O arquivo “{file}” é pequeno demais. A altura não pode ser menor que {limit, number} {limit, plural, one{pixel} other{pixels}}.',
'The image "{file}" is too small. The width cannot be smaller than {limit, number} {limit, plural, one{pixel} other{pixels}}.' => 'O arquivo “{file}” é pequeno demais. A largura não pode ser menor do que {limit, number} {limit, plural, one{pixel} other{pixels}}.', 'The image "{file}" is too small. The width cannot be smaller than {limit, number} {limit, plural, one{pixel} other{pixels}}.' => 'O arquivo “{file}” é pequeno demais. A largura não pode ser menor que {limit, number} {limit, plural, one{pixel} other{pixels}}.',
'The verification code is incorrect.' => 'O código de verificação está incorreto.', 'The verification code is incorrect.' => 'O código de verificação está incorreto.',
'Total <b>{count, number}</b> {count, plural, one{item} other{items}}.' => 'Total <b>{count, number}</b> {count, plural, one{item} other{itens}}.', 'Total <b>{count, number}</b> {count, plural, one{item} other{items}}.' => 'Total <b>{count, number}</b> {count, plural, one{item} other{itens}}.',
'Unable to verify your data submission.' => 'Não foi possível verificar a sua submissão de dados.', 'Unable to verify your data submission.' => 'Não foi possível verificar o seu envio de dados.',
'Unknown command "{command}".' => 'Comando desconhecido “{command}”.', 'Unknown command "{command}".' => 'Comando desconhecido “{command}”.',
'Unknown option: --{name}' => 'Opção desconhecida : --{name}', 'Unknown option: --{name}' => 'Opção desconhecida : --{name}',
'Update' => 'Atualizar', 'Update' => 'Alterar',
'View' => 'Exibir',
'Yes' => 'Sim', 'Yes' => 'Sim',
'You are not allowed to perform this action.' => 'Você não está autorizado a realizar essa ação.', 'You are not allowed to perform this action.' => 'Você não está autorizado a realizar essa ação.',
'You can upload at most {limit, number} {limit, plural, one{file} other{files}}.' => 'Você pode fazer o upload de no máximo {limit, number} {limit, plural, one{arquivo} other{arquivos}}.', 'You can upload at most {limit, number} {limit, plural, one{file} other{files}}.' => 'Você pode fazer o upload de, no máximo, {limit, number} {limit, plural, one{arquivo} other{arquivos}}.',
'the input value' => 'o valor de entrada', 'the input value' => 'o valor de entrada',
'{attribute} "{value}" has already been taken.' => '{attribute} “{value}” já foi utilizado.', '{attribute} "{value}" has already been taken.' => '{attribute} “{value}” já foi utilizado.',
'{attribute} cannot be blank.' => '“{attribute}” não pode ficar em branco.', '{attribute} cannot be blank.' => '“{attribute}” não pode ficar em branco.',
...@@ -64,15 +64,15 @@ return array ( ...@@ -64,15 +64,15 @@ return array (
'{attribute} is not a valid email address.' => '“{attribute}” não é um endereço de e-mail válido.', '{attribute} is not a valid email address.' => '“{attribute}” não é um endereço de e-mail válido.',
'{attribute} must be "{requiredValue}".' => '“{attribute}” deve ser “{requiredValue}”.', '{attribute} must be "{requiredValue}".' => '“{attribute}” deve ser “{requiredValue}”.',
'{attribute} must be a number.' => '“{attribute}” deve ser um número.', '{attribute} must be a number.' => '“{attribute}” deve ser um número.',
'{attribute} must be a string.' => '“{attribute}” deve ser uma string.', '{attribute} must be a string.' => '“{attribute}” deve ser um texto.',
'{attribute} must be an integer.' => '“{attribute}” deve ser um número inteiro.', '{attribute} must be an integer.' => '“{attribute}” deve ser um número inteiro.',
'{attribute} must be either "{true}" or "{false}".' => '“{attribute}” deve ser “{true}” ou “{false}”.', '{attribute} must be either "{true}" or "{false}".' => '“{attribute}” deve ser “{true}” ou “{false}”.',
'{attribute} must be greater than "{compareValue}".' => '“{attribute}” deve ser maior do que “{compareValue}”.', '{attribute} must be greater than "{compareValue}".' => '“{attribute}” deve ser maior que “{compareValue}”.',
'{attribute} must be greater than or equal to "{compareValue}".' => '“{attribute}” deve ser maior ou igual a “{compareValue}”.', '{attribute} must be greater than or equal to "{compareValue}".' => '“{attribute}” deve ser maior ou igual a “{compareValue}”.',
'{attribute} must be less than "{compareValue}".' => '“{attribute}” deve ser menor do que “{compareValue}”.', '{attribute} must be less than "{compareValue}".' => '“{attribute}” deve ser menor que “{compareValue}”.',
'{attribute} must be less than or equal to "{compareValue}".' => '“{attribute}” deve ser menor ou igual a “{compareValue}”.', '{attribute} must be less than or equal to "{compareValue}".' => '“{attribute}” deve ser menor ou igual a “{compareValue}”.',
'{attribute} must be no greater than {max}.' => '“{attribute}” não pode ser maior do que {max}.', '{attribute} must be no greater than {max}.' => '“{attribute}” não pode ser maior que {max}.',
'{attribute} must be no less than {min}.' => '“{attribute}” não pode ser menor do que {min}.', '{attribute} must be no less than {min}.' => '“{attribute}” não pode ser menor que {min}.',
'{attribute} must be repeated exactly.' => '“{attribute}” deve ser repetido exatamente.', '{attribute} must be repeated exactly.' => '“{attribute}” deve ser repetido exatamente.',
'{attribute} must not be equal to "{compareValue}".' => '“{attribute}” não deve ser igual a “{compareValue}”.', '{attribute} must not be equal to "{compareValue}".' => '“{attribute}” não deve ser igual a “{compareValue}”.',
'{attribute} should contain at least {min, number} {min, plural, one{character} other{characters}}.' => '“{attribute}” deve conter pelo menos {min, number} {min, plural, one{caractere} other{caracteres}}.', '{attribute} should contain at least {min, number} {min, plural, one{character} other{characters}}.' => '“{attribute}” deve conter pelo menos {min, number} {min, plural, one{caractere} other{caracteres}}.',
......
...@@ -151,6 +151,10 @@ class Request extends \yii\base\Request ...@@ -151,6 +151,10 @@ class Request extends \yii\base\Request
private $_cookies; private $_cookies;
/**
* @var array the headers in this collection (indexed by the header names)
*/
private $_headers;
/** /**
* Resolves the current request into a route and the associated parameters. * Resolves the current request into a route and the associated parameters.
...@@ -170,6 +174,37 @@ class Request extends \yii\base\Request ...@@ -170,6 +174,37 @@ class Request extends \yii\base\Request
} }
/** /**
* Returns the header collection.
* The header collection contains incoming HTTP headers.
* @return HeaderCollection the header collection
*/
public function getHeaders()
{
if ($this->_headers === null) {
$this->_headers = new HeaderCollection;
$headers = [];
if (function_exists('getallheaders')) {
$headers = getallheaders();
} elseif (function_exists('http_get_request_headers')) {
$headers = http_get_request_headers();
} else {
foreach ($_SERVER as $name => $value) {
if (substr($name, 0, 5) == 'HTTP_') {
$name = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))));
$this->_headers->add($name, $value);
}
}
return $this->_headers;
}
foreach ($headers as $name => $value) {
$this->_headers->add($name, $value);
}
}
return $this->_headers;
}
/**
* Returns the method of the current request (e.g. GET, POST, HEAD, PUT, PATCH, DELETE). * Returns the method of the current request (e.g. GET, POST, HEAD, PUT, PATCH, DELETE).
* @return string request method, such as GET, POST, HEAD, PUT, PATCH, DELETE. * @return string request method, such as GET, POST, HEAD, PUT, PATCH, DELETE.
* The value returned is turned into upper case. * The value returned is turned into upper case.
......
...@@ -295,7 +295,7 @@ class Menu extends Widget ...@@ -295,7 +295,7 @@ class Menu extends Widget
unset($item['url']['#']); unset($item['url']['#']);
if (count($item['url']) > 1) { if (count($item['url']) > 1) {
foreach (array_splice($item['url'], 1) as $name => $value) { foreach (array_splice($item['url'], 1) as $name => $value) {
if (!isset($this->params[$name]) || $this->params[$name] != $value) { if ($value !== null && (!isset($this->params[$name]) || $this->params[$name] != $value)) {
return false; return false;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment