Commit c2a255c7 authored by Taylor Otwell's avatar Taylor Otwell

Merge branch 'develop' into staging

parents 9e0ff85b 4eac00a0
# Pull request guidelines
[GitHub pull requests](https://help.github.com/articles/using-pull-requests) are a great way for everyone in the community to contribute to the Laravel codebase. Found a bug? Just fix it in your fork and submit a pull request. This will then be reviewed, and, if found as good, merged into the main repository.
In order to keep the codebase clean, stable and at high quality, even with so many people contributing, some guidelines are necessary for high-quality pull requests:
- **Branch:** Unless they are immediate documentation fixes relevant for old versions, pull requests should be sent to the `develop` branch only. Make sure to select that branch as target when creating the pull request (GitHub will not automatically select it.)
- **Documentation:** If you are adding a new feature or changing the API in any relevant way, this should be documented. The documentation files can be found directly in the core repository.
- **Unit tests:** To keep old bugs from re-appearing and generally hold quality at a high level, the Laravel core is thoroughly unit-tested. Thus, when you create a pull request, it is expected that you unit test any new code you add. For any bug you fix, you should also add regression tests to make sure the bug will never appear again. If you are unsure about how to write tests, the core team or other contributors will gladly help.
\ No newline at end of file
......@@ -96,6 +96,8 @@ return array(
'sheep',
'species',
'moose',
'chassis',
'traffic',
),
/*
......@@ -185,4 +187,4 @@ return array(
),
);
\ No newline at end of file
);
......@@ -24,7 +24,7 @@ return array(
"alpha" => "Полето :attribute трябва да съдържа само букви.",
"alpha_dash" => "Полето :attribute трябва да съдържа само букви, цифри, долна черта и тире.",
"alpha_num" => "Полето :attribute трябва да съдържа само букви и цифри.",
"array" => "The :attribute must have selected elements.",
"array" => "Полето :attribute трябва да има избрани елементи.",
"before" => "Полето :attribute трябва да бъде дата преди :date.",
"between" => array(
"numeric" => "Полето :attribute трябва да бъде между :min и :max.",
......@@ -32,10 +32,10 @@ return array(
"string" => "Полето :attribute трябва да бъде между :min и :max знака.",
),
"confirmed" => "Полето :attribute не е потвърдено.",
"count" => "The :attribute must have exactly :count selected elements.",
"countbetween" => "The :attribute must have between :min and :max selected elements.",
"countmax" => "The :attribute must have less than :max selected elements.",
"countmin" => "The :attribute must have at least :min selected elements.",
"count" => "Полето :attribute трябва да има точно :count избрани елементи.",
"countbetween" => "Полето :attribute трябва да има от :min до :max избрани елементи.",
"countmax" => "Полето :attribute трябва да има по-малко от :max избрани елементи.",
"countmin" => "Полето :attribute трябва да има минимум :min избрани елементи.",
"different" => "Полетата :attribute и :other трябва да са различни.",
"email" => "Полето :attribute е с невалиден формат.",
"exists" => "Избраната стойност на :attribute вече съществува.",
......
......@@ -22,8 +22,8 @@ return array(
"active_url" => ":attribute ist keine gültige URL.",
"after" => ":attribute muss ein Datum nach dem :date sein.",
"alpha" => ":attribute darf nur Buchstaben beinhalten.",
"alpha_dash" => ":attribute sollte nur aus Buchstaben, Nummern und Bindestrichen bestehen.",
"alpha_num" => ":attribute sollte nur aus Buchstaben und Nummern bestehen.",
"alpha_dash" => ":attribute darf nur aus Buchstaben, Nummern und Bindestrichen bestehen.",
"alpha_num" => ":attribute darf nur aus Buchstaben und Nummern bestehen.",
"array" => ":attribute muss ausgewählte Elemente haben.",
"before" => ":attribute muss ein Datum vor dem :date sein.",
"between" => array(
......@@ -57,7 +57,7 @@ return array(
),
"not_in" => "Der gewählte Wert für :attribute ist ungültig.",
"numeric" => ":attribute muss eine Zahl sein.",
"required" => ":attribute muss aufgefüllt sein.",
"required" => ":attribute muss ausgefüllt sein.",
"same" => ":attribute und :other müssen übereinstimmen.",
"size" => array(
"numeric" => ":attribute muss gleich :size sein.",
......
<?php
return array(
/*
|--------------------------------------------------------------------------
| Pagination Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used by the paginator library to build
| the pagination links. You're free to change them to anything you want.
| If you come up with something more exciting, let us know.
|
*/
'previous' => '&laquo; Προηγούμενο',
'next' => 'Επόμενο &raquo;',
);
\ No newline at end of file
<?php
return array(
/*
|--------------------------------------------------------------------------
| Validation Language Lines
|--------------------------------------------------------------------------
|
| The following language lines contain the default error messages used
| by the validator class. Some of the rules contain multiple versions,
| such as the size (max, min, between) rules. These versions are used
| for different input types such as strings and files.
|
| These language lines may be easily changed to provide custom error
| messages in your application. Error messages for custom validation
| rules may also be added to this file.
|
*/
"accepted" => "Το πεδίο :attribute πρέπει να εγκριθεί.",
"active_url" => "Το πεδίο :attribute δεν ειναι σωστό URL.",
"after" => "Το πεδίο :attribute πρέπει η ημερομηνία να ειναι μετά :date.",
"alpha" => "Το πεδίο :attribute μπορεί να περιλαμβάνει μόνο γράμματα.",
"alpha_dash" => "Το πεδίο :attribute μπορεί να περιλαμβάνει μόνο γράμματα, αριθμούς και παύλες.",
"alpha_num" => "Το πεδίο :attribute μπορεί να περιλαμβάνει μόνο γράμματα και αριθμούς.",
"array" => "Το πεδίο :attribute πρέπει να περιλαμβάνει επιλεγμένα αντικείμενα.",
"before" => "Το πεδίο :attribute πρέπει η ημερομηνία να ειναι πριν από :date.",
"between" => array(
"numeric" => "Το πεδίο :attribute πρέπει να έχει τιμές μεταξύ :min - :max.",
"file" => "Το πεδίο :attribute πρέπει να ειναι ανάμεσα σε :min - :max kb.",
"string" => "Το πεδίο :attribute πρέπει να περιλαμβάνει :min - :max χαρακτήρες.",
),
"confirmed" => "Το πεδίο :attribute δεν πέρασε τον έλεγχο.",
"count" => "Το πεδίο :attribute πρέπει να έχει ακριβώς :count επιλεγμένα αντικείμενα.",
"countbetween" => "Το πεδίο :attribute πρέπει να είναι ανάμεσα σε :min και :max επιλεγμένα αντικείμενα.",
"countmax" => "Το πεδίο :attribute πρέπει να έχει λιγότερα από :max επιλεγμένα αντικείμενα.",
"countmin" => "Το πεδίο :attribute πρέπει να έχει τουλάχιστον :min επιλεγμένα αντικείμενα.",
"different" => "Τα πεδία :attribute και :other πρέπει να ειναι διαφορετικά.",
"email" => "Στο πεδίο :attribute η μορφοποίηση ειναι άκυρη.",
"exists" => "Το επιλεγμένο πεδίο :attribute είναι άκυρο.",
"image" => "Το πεδίο :attribute πρέπει να είναι εικόνα.",
"in" => "Το επιλεγμένο πεδίο :attribute είναι άκυρο.",
"integer" => "Το πεδίο :attribute πρέπει να ειναι αριθμός.",
"ip" => "Το πεδίο :attribute πρέπει να ειναι μια έγκυρη διεύθυνση IP.",
"match" => "Το φορμάτ του πεδίου :attribute είναι άκυρο.",
"max" => array(
"numeric" => "Το πεδίο :attribute πρέπει να είναι μικρότερο από :max.",
"file" => "Το πεδίο :attribute πρέπει να είναι μικρότερο από :max kb.",
"string" => "Το πεδίο :attribute πρέπει να έχει λιγότερους από :max χαρακτήρες.",
),
"mimes" => "Το πεδίο :attribute πρέπει να ειναι αρχείο με τύπο: :values.",
"min" => array(
"numeric" => "Το πεδίο :attribute πρέπει να είναι τουλάχιστον :min.",
"file" => "Το πεδίο :attribute πρέπει να είναι μικρότερο από :max kb.",
"string" => "Το πεδίο :attribute πρέπει να έχει λιγότερους από :max χαρακτήρες.",
),
"not_in" => "Το επιλεγμένο πεδίο :attribute είναι άκυρο.",
"numeric" => "Το πεδίο :attribute πρέπει να είναι αριθμός.",
"required" => "Το πεδίο :attribute είναι απαραίτητο.",
"same" => "Τα πεδία :attribute και :other πρέπει να είναι ίδια.",
"size" => array(
"numeric" => "Το πεδίο :attribute πρέπει να ειναι :size.",
"file" => "Το πεδίο :attribute πρέπει να έχει μέγεθος :size kb.",
"string" => "Το πεδίο :attribute πρέπει να είναι :size χαρακτήρες.",
),
"unique" => "Το πεδίο :attribute έχει ήδη ανατεθεί.",
"url" => "Το πεδίο :attribute είναι άκυρο.",
/*
|--------------------------------------------------------------------------
| Custom Validation Language Lines
|--------------------------------------------------------------------------
|
| Here you may specify custom validation messages for attributes using the
| convention "attribute_rule" to name the lines. This helps keep your
| custom validation clean and tidy.
|
| So, say you want to use a custom validation message when validating that
| the "email" attribute is unique. Just add "email_unique" to this array
| with your custom message. The Validator will handle the rest!
|
*/
'custom' => array(),
/*
|--------------------------------------------------------------------------
| Validation Attributes
|--------------------------------------------------------------------------
|
| The following language lines are used to swap attribute place-holders
| with something more reader friendly such as "E-Mail Address" instead
| of "email". Your users will thank you.
|
| The Validator class will automatically search this array of lines it
| is attempting to replace the :attribute place-holder in messages.
| It's pretty slick. We think you'll like it.
|
*/
'attributes' => array(),
);
\ No newline at end of file
<?php
return array(
/*
|--------------------------------------------------------------------------
| Pagination Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used by the paginator library to build
| the pagination links. You're free to change them to anything you want.
| If you come up with something more exciting, let us know.
|
*/
'previous' => '&laquo; Προηγούμενο',
'next' => 'Επόμενο &raquo;',
);
\ No newline at end of file
<?php
return array(
/*
|--------------------------------------------------------------------------
| Validation Language Lines
|--------------------------------------------------------------------------
|
| The following language lines contain the default error messages used
| by the validator class. Some of the rules contain multiple versions,
| such as the size (max, min, between) rules. These versions are used
| for different input types such as strings and files.
|
| These language lines may be easily changed to provide custom error
| messages in your application. Error messages for custom validation
| rules may also be added to this file.
|
*/
"accepted" => "Το πεδίο :attribute πρέπει να εγκριθεί.",
"active_url" => "Το πεδίο :attribute δεν ειναι σωστό URL.",
"after" => "Το πεδίο :attribute πρέπει η ημερομηνία να ειναι μετά :date.",
"alpha" => "Το πεδίο :attribute μπορεί να περιλαμβάνει μόνο γράμματα.",
"alpha_dash" => "Το πεδίο :attribute μπορεί να περιλαμβάνει μόνο γράμματα, αριθμούς και παύλες.",
"alpha_num" => "Το πεδίο :attribute μπορεί να περιλαμβάνει μόνο γράμματα και αριθμούς.",
"array" => "Το πεδίο :attribute πρέπει να περιλαμβάνει επιλεγμένα αντικείμενα.",
"before" => "Το πεδίο :attribute πρέπει η ημερομηνία να ειναι πριν από :date.",
"between" => array(
"numeric" => "Το πεδίο :attribute πρέπει να έχει τιμές μεταξύ :min - :max.",
"file" => "Το πεδίο :attribute πρέπει να ειναι ανάμεσα σε :min - :max kb.",
"string" => "Το πεδίο :attribute πρέπει να περιλαμβάνει :min - :max χαρακτήρες.",
),
"confirmed" => "Το πεδίο :attribute δεν πέρασε τον έλεγχο.",
"count" => "Το πεδίο :attribute πρέπει να έχει ακριβώς :count επιλεγμένα αντικείμενα.",
"countbetween" => "Το πεδίο :attribute πρέπει να είναι ανάμεσα σε :min και :max επιλεγμένα αντικείμενα.",
"countmax" => "Το πεδίο :attribute πρέπει να έχει λιγότερα από :max επιλεγμένα αντικείμενα.",
"countmin" => "Το πεδίο :attribute πρέπει να έχει τουλάχιστον :min επιλεγμένα αντικείμενα.",
"different" => "Τα πεδία :attribute και :other πρέπει να ειναι διαφορετικά.",
"email" => "Στο πεδίο :attribute η μορφοποίηση ειναι άκυρη.",
"exists" => "Το επιλεγμένο πεδίο :attribute είναι άκυρο.",
"image" => "Το πεδίο :attribute πρέπει να είναι εικόνα.",
"in" => "Το επιλεγμένο πεδίο :attribute είναι άκυρο.",
"integer" => "Το πεδίο :attribute πρέπει να ειναι αριθμός.",
"ip" => "Το πεδίο :attribute πρέπει να ειναι μια έγκυρη διεύθυνση IP.",
"match" => "Το φορμάτ του πεδίου :attribute είναι άκυρο.",
"max" => array(
"numeric" => "Το πεδίο :attribute πρέπει να είναι μικρότερο από :max.",
"file" => "Το πεδίο :attribute πρέπει να είναι μικρότερο από :max kb.",
"string" => "Το πεδίο :attribute πρέπει να έχει λιγότερους από :max χαρακτήρες.",
),
"mimes" => "Το πεδίο :attribute πρέπει να ειναι αρχείο με τύπο: :values.",
"min" => array(
"numeric" => "Το πεδίο :attribute πρέπει να είναι τουλάχιστον :min.",
"file" => "Το πεδίο :attribute πρέπει να είναι μικρότερο από :max kb.",
"string" => "Το πεδίο :attribute πρέπει να έχει λιγότερους από :max χαρακτήρες.",
),
"not_in" => "Το επιλεγμένο πεδίο :attribute είναι άκυρο.",
"numeric" => "Το πεδίο :attribute πρέπει να είναι αριθμός.",
"required" => "Το πεδίο :attribute είναι απαραίτητο.",
"same" => "Τα πεδία :attribute και :other πρέπει να είναι ίδια.",
"size" => array(
"numeric" => "Το πεδίο :attribute πρέπει να ειναι :size.",
"file" => "Το πεδίο :attribute πρέπει να έχει μέγεθος :size kb.",
"string" => "Το πεδίο :attribute πρέπει να είναι :size χαρακτήρες.",
),
"unique" => "Το πεδίο :attribute έχει ήδη ανατεθεί.",
"url" => "Το πεδίο :attribute είναι άκυρο.",
/*
|--------------------------------------------------------------------------
| Custom Validation Language Lines
|--------------------------------------------------------------------------
|
| Here you may specify custom validation messages for attributes using the
| convention "attribute_rule" to name the lines. This helps keep your
| custom validation clean and tidy.
|
| So, say you want to use a custom validation message when validating that
| the "email" attribute is unique. Just add "email_unique" to this array
| with your custom message. The Validator will handle the rest!
|
*/
'custom' => array(),
/*
|--------------------------------------------------------------------------
| Validation Attributes
|--------------------------------------------------------------------------
|
| The following language lines are used to swap attribute place-holders
| with something more reader friendly such as "E-Mail Address" instead
| of "email". Your users will thank you.
|
| The Validator class will automatically search this array of lines it
| is attempting to replace the :attribute place-holder in messages.
| It's pretty slick. We think you'll like it.
|
*/
'attributes' => array(),
);
\ No newline at end of file
......@@ -10,41 +10,41 @@ return array(
*/
"accepted" => "Het :attribute moet geaccepteerd zijn.",
"active_url" => "Het :attribute is geen geldig URL.",
"active_url" => "Het :attribute is geen geldige URL.",
"after" => "Het :attribute moet een datum na :date zijn.",
"alpha" => "Het :attribute mag alleen letters bevatten.",
"alpha_dash" => "Het :attribute mag alleen letters, nummers, onderstreep(_) en strepen(-) bevatten.",
"alpha_num" => "Het :attribute mag alleen letters en nummers",
"array" => "The :attribute must have selected elements.",
"alpha_num" => "Het :attribute mag alleen letters en nummers bevatten.",
"array" => "Het :attribute moet geselecteerde elementen bevatten.",
"before" => "Het :attribute moet een datum voor :date zijn.",
"between" => array(
"numeric" => "Het :attribute moet tussen :min en :max zijn.",
"file" => "Het :attribute moet tussen :min en :max kilobytes zijn.",
"string" => "Het :attribute moet tussen :min en :max tekens zijn.",
"string" => "Het :attribute moet tussen :min en :max karakters zijn.",
),
"confirmed" => "Het :attribute bevestiging komt niet overeen.",
"count" => "The :attribute must have exactly :count selected elements.",
"countbetween" => "The :attribute must have between :min and :max selected elements.",
"countmax" => "The :attribute must have less than :max selected elements.",
"countmin" => "The :attribute must have at least :min selected elements.",
"count" => "Het :attribute moet precies :count geselecteerde elementen bevatten.",
"countbetween" => "Het :attribute moet tussen :min en :max geselecteerde elementen bevatten.",
"countmax" => "Het :attribute moet minder dan :max geselecteerde elementen bevatten.",
"countmin" => "Het :attribute moet minimaal :min geselecteerde elementen bevatten.",
"different" => "Het :attribute en :other moeten verschillend zijn.",
"email" => "Het :attribute formaat is ongeldig.",
"exists" => "Het gekozen :attribute is al ingebruik.",
"image" => "Het :attribute moet een afbeelding zijn.",
"in" => "Het gekozen :attribute is ongeldig.",
"integer" => "Het :attribute moet een getal zijn.",
"ip" => "Het :attribute moet een geldig IP adres bevatten.",
"ip" => "Het :attribute moet een geldig IP-adres zijn.",
"match" => "Het :attribute formaat is ongeldig.",
"max" => array(
"numeric" => "Het :attribute moet minder dan :max zijn.",
"file" => "Het :attribute moet minder dan :max kilobytes zijn.",
"string" => "Het :attribute moet minder dan :max tekens zijn.",
"string" => "Het :attribute moet minder dan :max karakters zijn.",
),
"mimes" => "Het :attribute moet een bestand zijn van het bestandstype :values.",
"min" => array(
"numeric" => "Het :attribute moet minimaal :min zijn.",
"file" => "Het :attribute moet minimaal :min kilobytes zijn.",
"string" => "Het :attribute moet minimaal :min characters zijn.",
"string" => "Het :attribute moet minimaal :min karakters zijn.",
),
"not_in" => "Het :attribute formaat is ongeldig.",
"numeric" => "Het :attribute moet een nummer zijn.",
......
<?php
return array(
/*
|--------------------------------------------------------------------------
| Pagination Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used by the paginator library to build
| the pagination links. You're free to change them to anything you want.
| If you come up with something more exciting, let us know.
|
*/
'previous' => '&laquo; Anterior',
'next' => 'Próxima &raquo;',
);
\ No newline at end of file
<?php
return array(
/*
|--------------------------------------------------------------------------
| Validation Language Lines
|--------------------------------------------------------------------------
|
| The following language lines contain the default error messages used
| by the validator class. Some of the rules contain multiple versions,
| such as the size (max, min, between) rules. These versions are used
| for different input types such as strings and files.
|
| These language lines may be easily changed to provide custom error
| messages in your application. Error messages for custom validation
| rules may also be added to this file.
|
*/
"accepted" => "O :attribute deve ser aceito.",
"active_url" => "O :attribute não é uma URL válida.",
"after" => "O :attribute deve ser uma data após :date.",
"alpha" => "O :attribute só pode conter letras.",
"alpha_dash" => "O :attribute só pode conter letras, números e traços.",
"alpha_num" => "O :attribute só pode conter letras e números.",
"before" => "O :attribute deve ser uma data anterior à :date.",
"between" => array(
"numeric" => "O :attribute deve estar entre :min - :max.",
"file" => "O :attribute deve estar entre :min - :max kilobytes.",
"string" => "O :attribute deve estar entre :min - :max caracteres.",
),
"confirmed" => "O :attribute confirmação não coincide.",
"different" => "O :attribute e :other devem ser diferentes.",
"email" => "O :attribute não é um e-mail válido",
"exists" => "O :attribute selecionado é inválido.",
"image" => "O :attribute deve ser uma imagem.",
"in" => "O :attribute selecionado é inválido.",
"integer" => "O :attribute deve ser um inteiro",
"ip" => "O :attribute deve ser um endereço IP válido.",
"match" => "O formato :attribute é inválido.",
"max" => array(
"numeric" => "O :attribute deve ser inferior a :max.",
"file" => "O :attribute deve ser inferior a :max kilobytes.",
"string" => "O :attribute deve ser inferior a :max caracteres.",
),
"mimes" => "O :attribute deve ser um arquivo do tipo: :values.",
"min" => array(
"numeric" => "O :attribute deve conter pelo menos :min.",
"file" => "O :attribute deve conter pelo menos :min kilobytes.",
"string" => "O :attribute deve conter pelo menos :min caracteres.",
),
"not_in" => "O :attribute selecionado é inválido.",
"numeric" => "O :attribute deve ser um número.",
"required" => "O campo :attribute deve ser preenchido.",
"same" => "O :attribute e :other devem ser iguais",
"size" => array(
"numeric" => "O :attribute deve ser :size.",
"file" => "O :attribute deve ter :size kilobyte.",
"string" => "O :attribute deve ter :size caracteres.",
),
"unique" => "O :attribute já existe",
"url" => "O formato :attribute é inválido.",
/*
|--------------------------------------------------------------------------
| Custom Validation Language Lines
|--------------------------------------------------------------------------
|
| Here you may specify custom validation messages for attributes using the
| convention "attribute_rule" to name the lines. This helps keep your
| custom validation clean and tidy.
|
| So, say you want to use a custom validation message when validating that
| the "email" attribute is unique. Just add "email_unique" to this array
| with your custom message. The Validator will handle the rest!
|
*/
'custom' => array(),
/*
|--------------------------------------------------------------------------
| Validation Attributes
|--------------------------------------------------------------------------
|
| The following language lines are used to swap attribute place-holders
| with something more reader friendly such as "E-Mail Address" instead
| of "email". Your users will thank you.
|
| The Validator class will automatically search this array of lines it
| is attempting to replace the :attribute place-holder in messages.
| It's pretty slick. We think you'll like it.
|
*/
'attributes' => array(),
);
\ No newline at end of file
......@@ -50,7 +50,7 @@ class Eloquent extends Driver {
$password_field = Config::get('auth.password', 'password');
if ( ! is_null($user) and Hash::check($password, $user->get_attribute($password_field)))
if ( ! is_null($user) and Hash::check($password, $user->{$password_field}))
{
return $this->login($user->id, array_get($arguments, 'remember'));
}
......
......@@ -68,7 +68,7 @@ class Blade {
// Once the view has been compiled, we can simply set the path to the
// compiled view on the view instance and call the typical "get"
// method on the view to evaluate the compiled PHP view.
return $view->get();
return ltrim($view->get());
});
}
......
......@@ -125,7 +125,7 @@ class Command {
// the requested method may be executed.
if (file_exists($path = Bundle::path($bundle).'tasks/'.$task.EXT))
{
require $path;
require_once $path;
$task = static::format($bundle, $task);
......
......@@ -73,7 +73,7 @@ abstract class Provider {
// zip that was put in the storage directory.
if ($remote === false)
{
throw new \Exception("Error downloading bundle [{$bundle}].");
throw new \Exception("Error downloading the requested bundle.");
}
return $remote;
......
......@@ -86,9 +86,9 @@ class Runner extends Task {
// fix the spaced directories problem when using the command line
// strings with spaces inside should be wrapped in quotes.
$path = escapeshellarg($path);
$esc_path = escapeshellarg($path);
passthru('phpunit --configuration '.$path, $status);
passthru('phpunit --configuration '.$esc_path, $status);
@unlink($path);
......
......@@ -44,9 +44,14 @@ class Cookie {
*/
public static function get($name, $default = null)
{
if (isset(static::$jar[$name])) return static::$jar[$name]['value'];
if (isset(static::$jar[$name])) return static::parse(static::$jar[$name]['value']);
return array_get(Request::foundation()->cookies->all(), $name, $default);
if ( ! is_null($value = Request::foundation()->cookies->get($name)))
{
return static::parse($value);
}
return value($default);
}
/**
......@@ -75,6 +80,8 @@ class Cookie {
$expiration = time() + ($expiration * 60);
}
$value = static::hash($value).'+'.$value;
// If the secure option is set to true, yet the request is not over HTTPS
// we'll throw an exception to let the developer know that they are
// attempting to send a secure cookie over the insecure HTTP.
......@@ -120,4 +127,46 @@ class Cookie {
return static::put($name, null, -2000, $path, $domain, $secure);
}
/**
* Hash the given cookie value.
*
* @param string $value
* @return string
*/
public static function hash($value)
{
return hash_hmac('sha1', $value, Config::get('application.key'));
}
/**
* Parse a hash fingerprinted cookie value.
*
* @param string $value
* @return string
*/
protected static function parse($value)
{
$segments = explode('+', $value);
// First we will make sure the cookie actually has enough segments to even
// be valid as being set by the application. If it does not we will go
// ahead and throw exceptions now since there the cookie is invalid.
if ( ! (count($segments) >= 2))
{
return null;
}
$value = implode('+', array_slice($segments, 1));
// Now we will check if the SHA-1 hash present in the first segment matches
// the ShA-1 hash of the rest of the cookie value, since the hash should
// have been set when the cookie was first created by the application.
if ($segments[0] == static::hash($value))
{
return $value;
}
return null;
}
}
......@@ -452,6 +452,16 @@ abstract class Model {
if ( ! $this->exists) $this->created_at = $this->updated_at;
}
/**
*Updates the timestamp on the model and immediately saves it.
*
* @return void
*/
public function touch(){
$this->timestamp();
$this->save();
}
/**
* Get a new fluent query builder instance for the model.
*
......
......@@ -45,6 +45,7 @@
## Laravel 3.2.8
- Fix double slash bug in URLs when using languages and no "index.php".
- Fix possible security issue in Auth "remember me" cookies.
<a name="upgrade-3.2.8"></a>
### Upgrading From 3.2.7
......
......@@ -132,6 +132,18 @@ Need to maintain creation and update timestamps on your database records? With E
Next, add **created_at** and **updated_at** date columns to your table. Now, whenever you save the model, the creation and update timestamps will be set automatically. You're welcome.
In some cases it may be useful to update the **updated_at** date column without actually modifying any data within the model. Simply use the **touch** method, which will also automatically save the changes immediately:
$comment = Comment::find(1);
$comment->touch();
You can also use the **timestamp** function to update the **updated_at** date column without saving the model immediately. Note that if you are actually modifying the model's data this is handled behind the scenes:
$comment = Comment::find(1);
$comment->timestamp();
//do something else here, but not modifying the $comment model data
$comment->save();
> **Note:** You can change the default timezone of your application in the **application/config/application.php** file.
<a name="relationships"></a>
......
......@@ -119,6 +119,8 @@ The "mailto" method on the HTML class obfuscates the given e-mail address so it
echo HTML::ol(array('Get Peanut Butter', 'Get Chocolate', 'Feast'));
echo HTML::ul(array('Ubuntu', 'Snow Leopard', 'Windows'));
echo HTML::dl(array('Ubuntu' => 'An operating system by Canonical', 'Windows' => 'An operating system by Microsoft'));
<a name="custom-macros"></a>
## Custom Macros
......
......@@ -80,29 +80,31 @@ Sometimes you may need to create a Paginator instance manually, without using th
All pagination link elements can be style using CSS classes. Here is an example of the HTML elements generated by the links method:
<div class="pagination">
<a href="foo" class="previous_page">Previous</a>
<ul>
<li class="previous_page"><a href="foo">Previous</a></li>
<a href="foo">1</a>
<a href="foo">2</a>
<li><a href="foo">1</a></li>
<li><a href="foo">2</a></li>
<span class="dots">...</span>
<li class="dots disabled"><a href="#">...</a></li>
<a href="foo">11</a>
<a href="foo">12</a>
<li><a href="foo">11</a></li>
<li><a href="foo">12</a></li>
<span class="current">13</span>
<li class="active"><a href="#">13</li>
<a href="foo">14</a>
<a href="foo">15</a>
<li><a href="foo">14</a></li>
<li><a href="foo">15</a></li>
<span class="dots">...</span>
<li class="dots disabled"><a href="#">...</a></li>
<a href="foo">25</a>
<a href="foo">26</a>
<li><a href="foo">25</a></li>
<li><a href="foo">26</a></li>
<a href="foo" class="next_page">Next</a>
<li class="next_page"><a href="foo">Next</a></li>
</ul>
</div>
When you are on the first page of results, the "Previous" link will be disabled. Likewise, the "Next" link will be disabled when you are on the last page of results. The generated HTML will look like this:
<span class="disabled prev_page">Previous</span>
<li class="disabled previous_page"><a href="#">Previous</a></li>
......@@ -347,6 +347,28 @@ class HTML {
return '<'.$type.static::attributes($attributes).'>'.$html.'</'.$type.'>';
}
/**
* Generate a definition list.
*
* @param array $list
* @param array $attributes
* @return string
*/
public static function dl($list, $attributes = array())
{
$html = '';
if (count($list) == 0) return $html;
foreach ($list as $term => $description)
{
$html .= '<dt>'.static::entities($term).'</dt>';
$html .= '<dd>'.static::entities($description).'</dd>';
}
return '<dl'.static::attributes($attributes).'>'.$html.'</dl>';
}
/**
* Build a list of HTML attributes from an array.
......
......@@ -102,13 +102,14 @@ class Input {
/**
* Get the JSON payload for the request.
*
* @param bool $as_array
* @return object
*/
public static function json()
public static function json($as_array = false)
{
if ( ! is_null(static::$json)) return static::$json;
return static::$json = json_decode(Request::foundation()->getContent());
return static::$json = json_decode(Request::foundation()->getContent(), $as_array);
}
/**
......
......@@ -65,7 +65,7 @@ class Paginator {
*
* @var string
*/
protected $dots = '<span class="dots">...</span>';
protected $dots = '<li class="dots disabled"><a href="#">...</a></li>';
/**
* Create a new Paginator instance.
......@@ -183,7 +183,7 @@ class Paginator {
$links = $this->slider($adjacent);
}
$content = $this->previous().' '.$links.' '.$this->next();
$content = '<ul>' . $this->previous() . $links . $this->next() . '</ul>';
return '<div class="pagination">'.$content.'</div>';
}
......@@ -300,7 +300,7 @@ class Paginator {
// the "first" element should be a span instead of a link.
if ($disabled($this->page, $this->last))
{
return HTML::span($text, array('class' => "{$class} disabled"));
return '<li'.HTML::attributes(array('class'=>"{$class} disabled")).'><a href="#">'.$text.'</a></li>';
}
else
{
......@@ -349,7 +349,7 @@ class Paginator {
{
if ($this->page == $page)
{
$pages[] = HTML::span($page, array('class' => 'current'));
$pages[] = '<li class="active"><a href="#">'.$page.'</a></li>';
}
else
{
......@@ -372,7 +372,7 @@ class Paginator {
{
$query = '?page='.$page.$this->appendage($this->appends);
return HTML::link(URI::current().$query, $text, compact('class'), Request::secure());
return '<li'.HTML::attributes(array('class' => $class)).'>'. HTML::link(URI::current().$query, $text, array(), Request::secure()).'</li>';
}
/**
......
......@@ -27,7 +27,7 @@ class Profiler {
// We only want to send the profiler toolbar if the request is not an AJAX
// request, as sending it on AJAX requests could mess up JSON driven API
// type applications, so we will not send anything in those scenarios.
if ( ! Request::ajax())
if ( ! Request::ajax() and Config::get('application.profiler') )
{
static::$data['memory'] = get_file_size(memory_get_usage(true));
static::$data['memory_peak'] = get_file_size(memory_get_peak_usage(true));
......
......@@ -8,7 +8,7 @@ return array(
|--------------------------------------------------------------------------
|
| This array contains the singular and plural forms of words. It's used by
| the "singular" and "plural" methods on the Str class to convert a given
| the "singular" and "plural" methods in the Str class to convert a given
| word from singular to plural and vice versa.
|
| Note that the regular expressions are only for inflecting English words.
......@@ -95,6 +95,9 @@ return array(
'series',
'sheep',
'species',
'moose',
'chassis',
'traffic',
),
/*
......@@ -184,4 +187,4 @@ return array(
),
);
\ No newline at end of file
);
......@@ -269,7 +269,7 @@ class AuthTest extends PHPUnit_Framework_TestCase {
$this->assertTrue(isset(Cookie::$jar['laravel_auth_drivers_fluent_remember']));
$cookie = Cookie::$jar['laravel_auth_drivers_fluent_remember']['value'];
$cookie = Cookie::get('laravel_auth_drivers_fluent_remember');
$cookie = explode('|', Crypter::decrypt($cookie));
$this->assertEquals(1, $cookie[0]);
$this->assertEquals('foo', Cookie::$jar['laravel_auth_drivers_fluent_remember']['path']);
......
......@@ -67,7 +67,7 @@ class CookieTest extends \PHPUnit_Framework_TestCase {
*/
public function testHasMethodIndicatesIfCookieInSet()
{
Cookie::$jar['foo'] = array('value' => 'bar');
Cookie::$jar['foo'] = array('value' => Cookie::hash('bar').'+bar');
$this->assertTrue(Cookie::has('foo'));
$this->assertFalse(Cookie::has('bar'));
......@@ -82,7 +82,7 @@ class CookieTest extends \PHPUnit_Framework_TestCase {
*/
public function testGetMethodCanReturnValueOfCookies()
{
Cookie::$jar['foo'] = array('value' => 'bar');
Cookie::$jar['foo'] = array('value' => Cookie::hash('bar').'+bar');
$this->assertEquals('bar', Cookie::get('foo'));
Cookie::put('bar', 'baz');
......@@ -97,7 +97,7 @@ class CookieTest extends \PHPUnit_Framework_TestCase {
public function testForeverShouldUseATonOfMinutes()
{
Cookie::forever('foo', 'bar');
$this->assertEquals('bar', Cookie::$jar['foo']['value']);
$this->assertEquals(Cookie::hash('bar').'+bar', Cookie::$jar['foo']['value']);
// Shouldn't be able to test this cause while we indicate -2000 seconds
// cookie expiration store timestamp.
......
......@@ -372,7 +372,7 @@ class SessionTest extends PHPUnit_Framework_TestCase {
$cookie = Cookie::$jar[Config::get('session.cookie')];
$this->assertEquals('foo', $cookie['value']);
$this->assertEquals(Cookie::hash('foo').'+foo', $cookie['value']);
// Shouldn't be able to test this cause session.lifetime store number of minutes
// while cookie expiration store timestamp when it going to expired.
// $this->assertEquals(Config::get('session.lifetime'), $cookie['expiration']);
......
......@@ -96,6 +96,8 @@ class StrTest extends PHPUnit_Framework_TestCase {
$this->assertEquals('Users', Str::plural('User'));
$this->assertEquals('user', Str::plural('user', 1));
$this->assertEquals('users', Str::plural('user', 2));
$this->assertEquals('chassis', Str::plural('chassis', 2));
$this->assertEquals('traffic', Str::plural('traffic', 2));
}
/**
......@@ -130,4 +132,4 @@ class StrTest extends PHPUnit_Framework_TestCase {
$this->assertEquals(40, strlen(Str::random(40)));
}
}
\ No newline at end of file
}
<phpunit colors="true"
bootstrap="/Users/taylor/Code/Laravel/framework/laravel/tests/phpunit.php"
backupGlobals="false">
<testsuites>
<testsuite name="Test Suite">
<directory suffix=".test.php">/Users/taylor/Code/Laravel/framework/laravel/tests/cases</directory>
</testsuite>
</testsuites>
</phpunit>
\ No newline at end of file
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