From 18e58171179468c878aa7e8ca4a9ca4e1d9667cf Mon Sep 17 00:00:00 2001 From: demsey2 Date: Thu, 17 Jan 2013 14:23:20 +0000 Subject: [PATCH 001/140] URI data is not available in the before filter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit More info: http://forums.laravel.io/viewtopic.php?id=4458 --- laravel/routing/controller.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/laravel/routing/controller.php b/laravel/routing/controller.php index e81d6b5f..4e244948 100644 --- a/laravel/routing/controller.php +++ b/laravel/routing/controller.php @@ -276,7 +276,7 @@ public function execute($method, $parameters = array()) // Again, as was the case with route closures, if the controller "before" // filters return a response, it will be considered the response to the // request and the controller method will not be used. - $response = Filter::run($filters, array(), true); + $response = Filter::run($filters, $parameters, true); if (is_null($response)) { @@ -439,4 +439,4 @@ public function __get($key) } } -} \ No newline at end of file +} From 818be60551237e1c7fd2cc30891468b2180baab2 Mon Sep 17 00:00:00 2001 From: Matt Helm Date: Thu, 17 Jan 2013 16:11:18 -0500 Subject: [PATCH 002/140] Add Command alias to application configuration Signed-off-by: Matt Helm --- application/config/application.php | 1 + 1 file changed, 1 insertion(+) diff --git a/application/config/application.php b/application/config/application.php index 60735a60..8f21fd35 100755 --- a/application/config/application.php +++ b/application/config/application.php @@ -159,6 +159,7 @@ 'Blade' => 'Laravel\\Blade', 'Bundle' => 'Laravel\\Bundle', 'Cache' => 'Laravel\\Cache', + 'Command' => 'Laravel\CLI\Command', 'Config' => 'Laravel\\Config', 'Controller' => 'Laravel\\Routing\\Controller', 'Cookie' => 'Laravel\\Cookie', From 5abb778b1656222ec68708bfb7be693fa50657fb Mon Sep 17 00:00:00 2001 From: frankwong Date: Tue, 22 Jan 2013 16:04:38 -0800 Subject: [PATCH 003/140] Added class and function information to log messages based on where the log message was initiated. --- laravel/log.php | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/laravel/log.php b/laravel/log.php index 88477a69..c7a9eadc 100644 --- a/laravel/log.php +++ b/laravel/log.php @@ -56,7 +56,31 @@ public static function write($type, $message, $pretty_print = false) Event::fire('laravel.log', array($type, $message)); } - $message = static::format($type, $message); + $trace=debug_backtrace(); + + foreach($trace as $item) + { + if ($item['class'] == __CLASS__) + { + continue; + } + + $caller = $item; + + break; + } + + $function = $caller['function']; + if (isset($caller['class'])) + { + $class = $caller['class'] . '::'; + } + else + { + $class = ''; + } + + $message = static::format($type, $class . $function . ' - ' . $message); File::append(path('storage').'logs/'.date('Y-m-d').'.log', $message); } @@ -96,4 +120,4 @@ public static function __callStatic($method, $parameters) static::write($method, $parameters[0], $parameters[1]); } -} \ No newline at end of file +} From e48a2d723ba6b00131b2fbb406b3698663b97013 Mon Sep 17 00:00:00 2001 From: Matt Helm Date: Wed, 23 Jan 2013 10:19:44 -0500 Subject: [PATCH 004/140] Fix indentation and double slashes --- application/config/application.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/config/application.php b/application/config/application.php index 8f21fd35..baf75d93 100755 --- a/application/config/application.php +++ b/application/config/application.php @@ -159,7 +159,7 @@ 'Blade' => 'Laravel\\Blade', 'Bundle' => 'Laravel\\Bundle', 'Cache' => 'Laravel\\Cache', - 'Command' => 'Laravel\CLI\Command', + 'Command' => 'Laravel\\CLI\\Command', 'Config' => 'Laravel\\Config', 'Controller' => 'Laravel\\Routing\\Controller', 'Cookie' => 'Laravel\\Cookie', From 4cb904f44d24f856ec9c1040d2198ed8f009723b Mon Sep 17 00:00:00 2001 From: Matt Helm Date: Wed, 23 Jan 2013 10:23:39 -0500 Subject: [PATCH 005/140] Fix indentation and double slashes --- application/config/application.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/config/application.php b/application/config/application.php index baf75d93..01e9d106 100755 --- a/application/config/application.php +++ b/application/config/application.php @@ -159,7 +159,7 @@ 'Blade' => 'Laravel\\Blade', 'Bundle' => 'Laravel\\Bundle', 'Cache' => 'Laravel\\Cache', - 'Command' => 'Laravel\\CLI\\Command', + 'Command' => 'Laravel\\CLI\\Command', 'Config' => 'Laravel\\Config', 'Controller' => 'Laravel\\Routing\\Controller', 'Cookie' => 'Laravel\\Cookie', From 023e11e6917c6e9a287701fea3fd7433ed01d41a Mon Sep 17 00:00:00 2001 From: frankwong Date: Wed, 23 Jan 2013 20:56:48 -0800 Subject: [PATCH 006/140] Fixed bug where laravel is generating error log from outside of application classes. --- laravel/log.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/laravel/log.php b/laravel/log.php index c7a9eadc..40b9c12c 100644 --- a/laravel/log.php +++ b/laravel/log.php @@ -60,7 +60,7 @@ public static function write($type, $message, $pretty_print = false) foreach($trace as $item) { - if ($item['class'] == __CLASS__) + if (isset($item['class']) AND $item['class'] == __CLASS__) { continue; } From 720480e74f854425ce9bb6a8d905a46c4c5381b5 Mon Sep 17 00:00:00 2001 From: Flavy Date: Fri, 1 Feb 2013 01:30:20 +0200 Subject: [PATCH 007/140] Added romanian language --- application/language/ro/pagination.php | 19 +++++ application/language/ro/validation.php | 106 +++++++++++++++++++++++++ 2 files changed, 125 insertions(+) create mode 100644 application/language/ro/pagination.php create mode 100644 application/language/ro/validation.php diff --git a/application/language/ro/pagination.php b/application/language/ro/pagination.php new file mode 100644 index 00000000..6a668f20 --- /dev/null +++ b/application/language/ro/pagination.php @@ -0,0 +1,19 @@ + '« Inapoi', + 'next' => 'Inainte »', + +); \ No newline at end of file diff --git a/application/language/ro/validation.php b/application/language/ro/validation.php new file mode 100644 index 00000000..52134a49 --- /dev/null +++ b/application/language/ro/validation.php @@ -0,0 +1,106 @@ + "Campul :attribute trebuie sa fie acceptat.", + "active_url" => "Campul :attribute nu este un URL valid.", + "after" => "Campul :attribute trebuie sa fie o data dupa :date.", + "alpha" => "Campul :attribute poate contine numai litere.", + "alpha_dash" => "Campul :attribute poate contine numai litere, numere si liniute.", + "alpha_num" => "Campul :attribute poate contine numai litere si numere.", + "array" => "Campul :attribute trebuie sa aiba elemente selectate.", + "before" => "Campul :attribute trebuie sa fie o data inainte de :date.", + "between" => array( + "numeric" => "Campul :attribute trebuie sa fie intre :min si :max.", + "file" => "Campul :attribute trebuie sa fie intre :min si :max kilobytes.", + "string" => "Campul :attribute trebuie sa fie intre :min si :max caractere.", + ), + "confirmed" => "Confirmarea :attribute nu se potriveste.", + "count" => "Campul :attribute trebuie sa aiba exact :count elemente selectate.", + "countbetween" => "Campul :attribute trebuie sa aiba intre :min si :max elemente selectate.", + "countmax" => "Campul :attribute trebuie sa aiba mai putin de :max elemente selectate.", + "countmin" => "Campul :attribute trebuie sa aiba cel putin :min elemente selectate.", + "date_format" => "Campul :attribute trebuie sa fie intr-un format valid.", + "different" => "Campurile :attribute si :other trebuie sa fie diferite.", + "email" => "Formatul campului :attribute este invalid.", + "exists" => "Campul :attribute selectat este invalid.", + "image" => "Campul :attribute trebuie sa fie o imagine.", + "in" => "Campul :attribute selectat este invalid.", + "integer" => "Campul :attribute trebuie sa fie un numar intreg.", + "ip" => "Campul :attribute trebuie sa fie o adresa IP valida.", + "match" => "Formatul campului :attribute este invalid.", + "max" => array( + "numeric" => "Campul :attribute trebuie sa fie mai mic de :max.", + "file" => "Campul :attribute trebuie sa fie mai mic de :max kilobytes.", + "string" => "Campul :attribute trebuie sa fie mai mic de :max caractere.", + ), + "mimes" => "Campul :attribute trebuie sa fie un fisier de tipul: :values.", + "min" => array( + "numeric" => "Campul :attribute trebuie sa fie cel putin :min.", + "file" => "Campul :attribute trebuie sa aiba cel putin :min kilobytes.", + "string" => "Campul :attribute trebuie sa aiba cel putin :min caractere.", + ), + "not_in" => "Campul :attribute selectat este invalid.", + "numeric" => "Campul :attribute trebuie sa fie un numar.", + "required" => "Campul :attribute este obligatoriu.", + "required_with" => "Campul :attribute este obligatoriu cu :field", + "same" => "Campul :attribute si :other trebuie sa fie identice.", + "size" => array( + "numeric" => "Campul :attribute trebuie sa fie :size.", + "file" => "Campul :attribute trebuie sa aiba :size kilobyte.", + "string" => "Campul :attribute trebuie sa aiba :size caractere.", + ), + "unique" => "Campul :attribute a fost deja folosit.", + "url" => "Campul :attribute nu este intr-un format valid.", + + /* + |-------------------------------------------------------------------------- + | 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(), + +); From a2cafaa367b07bd4d7dde22f3d1aa7b7d3c52219 Mon Sep 17 00:00:00 2001 From: Pavel Puchkin Date: Fri, 1 Feb 2013 11:10:02 +1100 Subject: [PATCH 008/140] Fix bug in ANBU that cause wrong total time showing on Queries tab When query time is larger than one second 'array_sum' cannot convert it to float right. Also, it is better to fire 'laravel.query' event with raw time as an argument rather than its string representation --- laravel/database/connection.php | 2 +- laravel/profiling/template.blade.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/laravel/database/connection.php b/laravel/database/connection.php index b238aa9e..e765065d 100644 --- a/laravel/database/connection.php +++ b/laravel/database/connection.php @@ -308,7 +308,7 @@ protected function fetch($statement, $style) */ protected function log($sql, $bindings, $start) { - $time = number_format((microtime(true) - $start) * 1000, 2); + $time = (microtime(true) - $start) * 1000; Event::fire('laravel.query', array($sql, $bindings, $time)); diff --git a/laravel/profiling/template.blade.php b/laravel/profiling/template.blade.php index 9c855b43..d8b36ff7 100755 --- a/laravel/profiling/template.blade.php +++ b/laravel/profiling/template.blade.php @@ -36,7 +36,7 @@ @foreach ($queries as $query) - {{ $query[1] }}ms + {{ number_format($query[1], 2) }}ms
{{ $query[0] }}
@@ -103,7 +103,7 @@ SQL {{ count($queries) }} @if (count($queries)) - {{ array_sum(array_map(function($q) { return $q[1]; }, $queries)) }}ms + {{ number_format(array_sum(array_pluck($queries, '1')), 2) }}ms @endif From f93dfccd21372bd963f6d3ea1da486731eba8b6a Mon Sep 17 00:00:00 2001 From: Chris How Date: Sun, 3 Feb 2013 19:15:55 +0100 Subject: [PATCH 009/140] HTML::entities() now optional on label contents --- laravel/form.php | 6 ++++-- laravel/tests/cases/form.test.php | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/laravel/form.php b/laravel/form.php index 5a450b52..d14cad69 100644 --- a/laravel/form.php +++ b/laravel/form.php @@ -182,13 +182,15 @@ public static function token() * @param array $attributes * @return string */ - public static function label($name, $value, $attributes = array()) + public static function label($name, $value, $attributes = array(), $escape_html = true) { static::$labels[] = $name; $attributes = HTML::attributes($attributes); - $value = HTML::entities($value); + if ($escape_html) { + $value = HTML::entities($value); + } return ''; } diff --git a/laravel/tests/cases/form.test.php b/laravel/tests/cases/form.test.php index 5f6f7fa3..8791dfd1 100644 --- a/laravel/tests/cases/form.test.php +++ b/laravel/tests/cases/form.test.php @@ -111,9 +111,11 @@ public function testFormLabel() { $form1 = Form::label('foo', 'Foobar'); $form2 = Form::label('foo', 'Foobar', array('class' => 'control-label')); + $form3 = Form::label('foo', 'Foobar baz', null, false); $this->assertEquals('', $form1); $this->assertEquals('', $form2); + $this->assertEquals('', $form3); } /** From 87c588c6104a4e218db17f32958cf825361517b5 Mon Sep 17 00:00:00 2001 From: Chris How Date: Sun, 3 Feb 2013 19:34:13 +0100 Subject: [PATCH 010/140] Updated docs --- laravel/documentation/views/forms.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/laravel/documentation/views/forms.md b/laravel/documentation/views/forms.md index cee6287a..538fd935 100644 --- a/laravel/documentation/views/forms.md +++ b/laravel/documentation/views/forms.md @@ -83,6 +83,14 @@ #### Specifying extra HTML attributes for a label: echo Form::label('email', 'E-Mail Address', array('class' => 'awesome')); +#### Turning off HTML escaping of label contents: + + echo Form::label('confirm', 'Are you sure you want to proceed?', null, false); + +You can pass ```false``` as the optional fourth argument to disable automatic HTML escaping of the label content. + + + > **Note:** After creating a label, any form element you create with a name matching the label name will automatically receive an ID matching the label name as well. From 068ddef312071248cf54b67ad9b587109c43b4f5 Mon Sep 17 00:00:00 2001 From: Tz-Huan Huang Date: Wed, 6 Feb 2013 13:35:03 +0800 Subject: [PATCH 011/140] Update laravel/session/drivers/cookie.php --- laravel/session/drivers/cookie.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/laravel/session/drivers/cookie.php b/laravel/session/drivers/cookie.php index 63a60eec..9e75354c 100644 --- a/laravel/session/drivers/cookie.php +++ b/laravel/session/drivers/cookie.php @@ -39,7 +39,7 @@ public function save($session, $config, $exists) $payload = Crypter::encrypt(serialize($session)); - C::put(Cookie::payload, $payload, $lifetime, $path, $domain); + C::put(Cookie::payload, $payload, $lifetime, $path, $domain, $secure); } /** @@ -53,4 +53,4 @@ public function delete($id) C::forget(Cookie::payload); } -} \ No newline at end of file +} From 2144637e128f8dc2f6e4d9b062a622b4dfe29e4f Mon Sep 17 00:00:00 2001 From: Pasvaz Date: Thu, 7 Feb 2013 03:35:42 +0100 Subject: [PATCH 012/140] Handles Redis password If password is set in the config (database.php), before to issue any command it starts the Auth process, otherwise it starts with SELECT as usuale. --- laravel/redis.php | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/laravel/redis.php b/laravel/redis.php index 02267d32..516f5aac 100644 --- a/laravel/redis.php +++ b/laravel/redis.php @@ -16,6 +16,13 @@ class Redis { */ protected $port; + /** + * The database password, if present. + * + * @var string + */ + protected $password; + /** * The database number the connection selects on load. * @@ -45,10 +52,11 @@ class Redis { * @param int $database * @return void */ - public function __construct($host, $port, $database = 0) + public function __construct($host, $port, $password = null, $database = 0) { $this->host = $host; $this->port = $port; + $this->password = $password; $this->database = $database; } @@ -79,7 +87,12 @@ public static function db($name = 'default') extract($config); - static::$databases[$name] = new static($host, $port, $database); + if ( ! isset($password)) + { + $password = null; + } + + static::$databases[$name] = new static($host, $port, $password, $database); } return static::$databases[$name]; @@ -153,6 +166,11 @@ protected function connect() throw new \Exception("Error making Redis connection: {$error} - {$message}"); } + if ( $this->password ) + { + $this->auth($this->password); + } + $this->select($this->database); return $this->connection; From b48031b04ab0a94a00c85a32eae704678842969b Mon Sep 17 00:00:00 2001 From: Kelt Dockins Date: Wed, 6 Feb 2013 23:30:57 -0600 Subject: [PATCH 013/140] ioc resolves classes with optional params and accepts arguments --- laravel/ioc.php | 44 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 9 deletions(-) diff --git a/laravel/ioc.php b/laravel/ioc.php index 4347cbcb..31a1b6a5 100644 --- a/laravel/ioc.php +++ b/laravel/ioc.php @@ -172,7 +172,7 @@ protected static function build($type, $parameters = array()) return new $type; } - $dependencies = static::dependencies($constructor->getParameters()); + $dependencies = static::dependencies($constructor->getParameters(), $parameters); return $reflector->newInstanceArgs($dependencies); } @@ -181,9 +181,10 @@ protected static function build($type, $parameters = array()) * Resolve all of the dependencies from the ReflectionParameters. * * @param array $parameters + * @param array $arguments that might have been passed into our resolve * @return array */ - protected static function dependencies($parameters) + protected static function dependencies($parameters, $arguments) { $dependencies = array(); @@ -191,18 +192,43 @@ protected static function dependencies($parameters) { $dependency = $parameter->getClass(); - // If the class is null, it means the dependency is a string or some other - // primitive type, which we can not resolve since it is not a class and - // we'll just bomb out with an error since we have nowhere to go. - if (is_null($dependency)) + // If the person passed in some parameters to the class + // then we should probably use those instead of trying + // to resolve a new instance of the class + if (count($arguments) > 0) { - throw new \Exception("Unresolvable dependency resolving [$parameter]."); + $dependencies[] = array_shift($arguments); + } + else if (is_null($dependency)) + { + $dependency[] = static::resolveNonClass($parameter); + } + else + { + $dependencies[] = static::resolve($dependency->name); } - - $dependencies[] = static::resolve($dependency->name); } return (array) $dependencies; } + /** + * Resolves optional parameters for our dependency injection + * pretty much took backport straight from L4's Illuminate\Container + * + * @param ReflectionParameter + * @return default value + */ + protected static function resolveNonClass($parameter) + { + if ($parameter->isDefaultValueAvailable()) + { + return $parameter->getDefaultValue(); + } + else + { + throw new \Exception("Unresolvable dependency resolving [$parameter]."); + } + } + } \ No newline at end of file From 1ed7ec98ba7dc9a57d1b5dde55b47154797330a8 Mon Sep 17 00:00:00 2001 From: Kelt Dockins Date: Thu, 7 Feb 2013 00:13:00 -0600 Subject: [PATCH 014/140] adding unit tests for ioc changes --- laravel/tests/cases/ioc.test.php | 79 ++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/laravel/tests/cases/ioc.test.php b/laravel/tests/cases/ioc.test.php index 56918337..a93442dd 100644 --- a/laravel/tests/cases/ioc.test.php +++ b/laravel/tests/cases/ioc.test.php @@ -1,5 +1,34 @@ class_one = $class_one; + } +} + + class IoCTest extends PHPUnit_Framework_TestCase { /** @@ -71,4 +100,54 @@ public function testControllerMethodRegistersAController() $this->assertTrue(IoC::registered('controller: ioc.test')); } + /** + * Test that classes with optional parameters can resolve + */ + public function testOptionalParamClassResolves() + { + $test = IoC::resolve('TestOptionalParamClassForIoC'); + $this->assertInstanceOf('TestOptionalParamClassForIoC', $test); + } + + /** + * Test that we can resolve TestClassOneForIoC using IoC + */ + public function testClassOneForIoCResolves() + { + $test = IoC::resolve('TestClassOneForIoC'); + $this->assertInstanceOf('TestClassOneForIoC', $test); + } + + /** + * Test that we can resolve TestClassTwoForIoC + */ + public function testClassTwoForIoCResolves() + { + $test = IoC::resolve('TestClassTwoForIoC'); + $this->assertInstanceOf('TestClassTwoForIoC', $test); + } + + /** + * Test that when we resolve TestClassTwoForIoC we auto resolve + * the dependency for TestClassOneForIoC + */ + public function testClassTwoResolvesClassOneDependency() + { + $test = IoC::resolve('TestClassTwoForIoC'); + $this->assertInstanceOf('TestClassOneForIoC', $test->TestClassOneForIoC); + } + + /** + * Test that when we resolve TestClassTwoForIoC with a parameter + * that it actually uses that instead of a blank class TestClassOneForIoC + */ + public function testClassTwoResolvesClassOneWithArgument() + { + $class_one = IoC::resolve('TestClassOneForIoC'); + $class_one->test_variable = 42; + + $class_two = IoC::resolve('TestClassTwoForIoC', [$class_one]); + $this->assertEquals(42, $class_two->class_one->test_variable); + } + } \ No newline at end of file From 8e2784071890cb9e6bdeb1b985225962b76c2edc Mon Sep 17 00:00:00 2001 From: aditya Date: Fri, 8 Feb 2013 05:12:06 +0530 Subject: [PATCH 015/140] (Very) minor typo fix. --- laravel/documentation/database/eloquent.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/laravel/documentation/database/eloquent.md b/laravel/documentation/database/eloquent.md index 81a9973f..fa4916cb 100644 --- a/laravel/documentation/database/eloquent.md +++ b/laravel/documentation/database/eloquent.md @@ -284,7 +284,7 @@ ### Many-To-Many $roles = User::find(1)->roles; -If your table names don't follow conventions, simply pass the table name in the second parameter to the **has\_and\_belongs\_to\_many** method: +If your table names don't follow conventions, simply pass the table name in the second parameter to the **has\_many\_and\_belongs\_to** method: class User extends Eloquent { From 43afc7b9fac2fba5852e06bd03e82af393a14197 Mon Sep 17 00:00:00 2001 From: Dave Clayton Date: Tue, 12 Feb 2013 14:54:13 +0100 Subject: [PATCH 016/140] Made how to do AND WHERE in fluent more explicit in the docs --- laravel/documentation/database/fluent.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/laravel/documentation/database/fluent.md b/laravel/documentation/database/fluent.md index 307488ea..adede66e 100644 --- a/laravel/documentation/database/fluent.md +++ b/laravel/documentation/database/fluent.md @@ -76,6 +76,13 @@ ### where and or\_where ->or_where('email', '=', 'example@gmail.com') ->first(); +To do the equivalent of an AND where, simply chain the query with another where: + + return DB::table('users') + ->where('id', '=', 1) + ->where('activated', '=', 1) + ->first(); + Of course, you are not limited to simply checking equality. You may also use **greater-than**, **less-than**, **not-equal**, and **like**: return DB::table('users') From bc36205a99826193da0a26d564d37cfb93661c2b Mon Sep 17 00:00:00 2001 From: Kirk Bushell Date: Fri, 15 Feb 2013 09:50:32 +1100 Subject: [PATCH 017/140] Updated error class to pass the Exception for the 500 triggered event. --- application/routes.php | 5 +++-- laravel/error.php | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/application/routes.php b/application/routes.php index 2892da90..06547e0f 100644 --- a/application/routes.php +++ b/application/routes.php @@ -48,7 +48,8 @@ | | Similarly, we use an event to handle the display of 500 level errors | within the application. These errors are fired when there is an -| uncaught exception thrown in the application. +| uncaught exception thrown in the application. The exception object +| that is captured during execution is then passed to the 500 listener. | */ @@ -57,7 +58,7 @@ return Response::error('404'); }); -Event::listen('500', function() +Event::listen('500', function($exception) { return Response::error('500'); }); diff --git a/laravel/error.php b/laravel/error.php index c4c1ac6b..7de0919a 100644 --- a/laravel/error.php +++ b/laravel/error.php @@ -54,7 +54,7 @@ public static function exception($exception, $trace = true) // Using events gives the developer more freedom. else { - $response = Event::first('500'); + $response = Event::first('500', $exception); $response = Response::prepare($response); } From 9003957b285b5ba3d22faef481f5a14875fa4e2e Mon Sep 17 00:00:00 2001 From: Pavel Puchkin Date: Mon, 18 Feb 2013 15:18:10 +1100 Subject: [PATCH 018/140] One more fix about custom query grammar --- laravel/database/connection.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/laravel/database/connection.php b/laravel/database/connection.php index 938ae97f..2bde9584 100644 --- a/laravel/database/connection.php +++ b/laravel/database/connection.php @@ -75,7 +75,8 @@ protected function grammar() if (isset(\Laravel\Database::$registrar[$this->driver()])) { - return $this->grammar = \Laravel\Database::$registrar[$this->driver()]['query'](); + $resolver = \Laravel\Database::$registrar[$this->driver()]['query']; + return $this->grammar = $resolver($this); } switch ($this->driver()) From 31e21971a0fbaad823c7cb7247f71446a7b3b595 Mon Sep 17 00:00:00 2001 From: Duru Can Celasun Date: Wed, 20 Feb 2013 09:17:59 +0200 Subject: [PATCH 019/140] Add flushing support to the Redis cache driver --- laravel/cache/drivers/redis.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/laravel/cache/drivers/redis.php b/laravel/cache/drivers/redis.php index 3195566c..f0a71d07 100644 --- a/laravel/cache/drivers/redis.php +++ b/laravel/cache/drivers/redis.php @@ -87,5 +87,15 @@ public function forget($key) { $this->redis->del($key); } + + /** + * Flush the entire cache. + * + * @return void + */ + public function flush() + { + $this->redis->flushdb(); + } -} \ No newline at end of file +} From eccd8375db0b8dae8b0ad53cc416e230ae164bc9 Mon Sep 17 00:00:00 2001 From: David Mosher Date: Tue, 26 Feb 2013 09:00:52 -0800 Subject: [PATCH 020/140] Combined @imports in style.css MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removes extraneous http request from style.css --- public/laravel/css/style.css | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/public/laravel/css/style.css b/public/laravel/css/style.css index d3333c94..f073bf19 100755 --- a/public/laravel/css/style.css +++ b/public/laravel/css/style.css @@ -1,5 +1,4 @@ -@import url(http://fonts.googleapis.com/css?family=Ubuntu); -@import url(http://fonts.googleapis.com/css?family=Droid+Sans); +@import url(http://fonts.googleapis.com/css?family=Ubuntu|Droid+Sans); article, aside, details, figcaption, figure, footer, header, hgroup, nav, section { display: block; } audio, canvas, video { display: inline-block; *display: inline; *zoom: 1; } From 5929f8e537779a211c829654afe46ad9d8eaecae Mon Sep 17 00:00:00 2001 From: David Lin Date: Wed, 27 Feb 2013 08:54:57 +0800 Subject: [PATCH 021/140] Update laravel/request.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When running nginx with php-cgi (Fast-CGI):  spawn-fcgi -a 127.0.0.1 -p 10081 -C 50 -u nobody -f /usr/local/php5317/bin/php-cgi The Request::cli() method will determine the web request as run from the command line. Add ` PHP_SAPI != "cgi-fcgi" ` to resolve it. --- laravel/request.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/laravel/request.php b/laravel/request.php index 0193776e..7cf85d69 100644 --- a/laravel/request.php +++ b/laravel/request.php @@ -196,7 +196,7 @@ public static function time() */ public static function cli() { - return defined('STDIN') || (substr(PHP_SAPI, 0, 3) == 'cgi' && getenv('TERM')); + return defined('STDIN') || (PHP_SAPI != "cgi-fcgi" && substr(PHP_SAPI, 0, 3) == 'cgi' && getenv('TERM')); } /** @@ -287,4 +287,4 @@ public static function __callStatic($method, $parameters) return call_user_func_array(array(static::foundation(), $method), $parameters); } -} \ No newline at end of file +} From cf9013403b1eac6f572ec4e477d104a716371494 Mon Sep 17 00:00:00 2001 From: Pavel Puchkin Date: Tue, 12 Mar 2013 16:09:16 +1100 Subject: [PATCH 022/140] Syntax fix for PHP 5.3 (#1690) --- laravel/tests/cases/ioc.test.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/laravel/tests/cases/ioc.test.php b/laravel/tests/cases/ioc.test.php index a93442dd..c7a92031 100644 --- a/laravel/tests/cases/ioc.test.php +++ b/laravel/tests/cases/ioc.test.php @@ -146,8 +146,8 @@ public function testClassTwoResolvesClassOneWithArgument() $class_one = IoC::resolve('TestClassOneForIoC'); $class_one->test_variable = 42; - $class_two = IoC::resolve('TestClassTwoForIoC', [$class_one]); + $class_two = IoC::resolve('TestClassTwoForIoC', array($class_one)); $this->assertEquals(42, $class_two->class_one->test_variable); } -} \ No newline at end of file +} From a0c2adecdcc5a2ca2a4cce7415313295893c7056 Mon Sep 17 00:00:00 2001 From: Pavel Puchkin Date: Tue, 12 Mar 2013 16:16:45 +1100 Subject: [PATCH 023/140] One more fix - wrong property name --- laravel/tests/cases/ioc.test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/laravel/tests/cases/ioc.test.php b/laravel/tests/cases/ioc.test.php index c7a92031..61190a03 100644 --- a/laravel/tests/cases/ioc.test.php +++ b/laravel/tests/cases/ioc.test.php @@ -134,7 +134,7 @@ public function testClassTwoForIoCResolves() public function testClassTwoResolvesClassOneDependency() { $test = IoC::resolve('TestClassTwoForIoC'); - $this->assertInstanceOf('TestClassOneForIoC', $test->TestClassOneForIoC); + $this->assertInstanceOf('TestClassOneForIoC', $test->class_one); } /** From f5997b7f97d51eab49168a594caf7ca6f54b9239 Mon Sep 17 00:00:00 2001 From: Alex Date: Sat, 16 Mar 2013 21:40:33 -0500 Subject: [PATCH 024/140] Allow the renaming of the drivers remember cookie --- laravel/auth/drivers/driver.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/laravel/auth/drivers/driver.php b/laravel/auth/drivers/driver.php index b60d84e0..a3e09883 100644 --- a/laravel/auth/drivers/driver.php +++ b/laravel/auth/drivers/driver.php @@ -215,7 +215,7 @@ protected function token() */ protected function recaller() { - return $this->name().'_remember'; + return Config::get('auth.cookie', $this->name().'_remember'); } /** @@ -228,4 +228,4 @@ protected function name() return strtolower(str_replace('\\', '_', get_class($this))); } -} \ No newline at end of file +} From 7a289ac50a815fdc057eb6c2c0325c37d7d9ce55 Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 21 Mar 2013 23:13:51 -0500 Subject: [PATCH 025/140] Fix for Postgresql PDO::FETCH_ASSOC --- laravel/database/query.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/laravel/database/query.php b/laravel/database/query.php index 73e45fe6..5787a6de 100755 --- a/laravel/database/query.php +++ b/laravel/database/query.php @@ -829,7 +829,9 @@ public function insert_get_id($values, $column = 'id') } else if ($this->grammar instanceof Postgres) { - return (int) $result[0]->$column; + $row = (array) $result[0]; + + return (int) $row[$column]; } else { From 88cde2c91d3f54d41c167e4019f1ac1c4fbe517f Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Thu, 21 Mar 2013 23:22:44 -0500 Subject: [PATCH 026/140] update change log. --- laravel/documentation/changes.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/laravel/documentation/changes.md b/laravel/documentation/changes.md index 2f76114d..16b33f1d 100644 --- a/laravel/documentation/changes.md +++ b/laravel/documentation/changes.md @@ -2,6 +2,8 @@ # Laravel Change Log ## Contents +- [Laravel 3.2.14](#3.2.14) +- [Upgrading From 3.2.13](#upgrade-3.2.14) - [Laravel 3.2.13](#3.2.13) - [Upgrading From 3.2.12](#upgrade-3.2.13) - [Laravel 3.2.12](#3.2.12) @@ -51,6 +53,17 @@ ## Contents - [Laravel 3.1](#3.1) - [Upgrading From 3.0](#upgrade-3.1) + +## Laravel 3.2.14 + +- IoC can now resolve default parameters. +- Fix bug in Postgres insert_get_id when using FETCH_ASSOC. + + +### Upgrading From 3.2.13 + +- Replace the **laravel** folder. + ## Laravel 3.2.13 From 318bb360723aafa57feed87147d3f921a720ed59 Mon Sep 17 00:00:00 2001 From: Jesse O'Brien Date: Fri, 22 Mar 2013 17:04:15 -0300 Subject: [PATCH 027/140] Adding PATCH to the route register. Self-explanatory. --- laravel/routing/route.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/laravel/routing/route.php b/laravel/routing/route.php index 1ce17f1a..f2deba74 100644 --- a/laravel/routing/route.php +++ b/laravel/routing/route.php @@ -330,6 +330,18 @@ public static function put($route, $action) Router::register('PUT', $route, $action); } + /** + * Register a PATCH route with the router. + * + * @param string|array $route + * @param mixed $action + * @return void + */ + public static function patch($route, $action) + { + Router::register('PATCH', $route, $action); + } + /** * Register a DELETE route with the router. * From 944d98d16e62e5b0e7c655374819a7b88199e005 Mon Sep 17 00:00:00 2001 From: Eugen Date: Sat, 23 Mar 2013 00:58:43 +0100 Subject: [PATCH 028/140] Fix for double escaping of queries in the profiler MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sometimes the logged queries would be rendered with visible HTML entities in the profiler, due to double encoding (You know, &gt; stuff). I could not find out why it was being escaped twice, but I found an easy fix: since PHP 5.2.3 the htmlspecialchars function had a double_encoding parameter that could be set to false. Voilà! --- laravel/profiling/profiler.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/laravel/profiling/profiler.php b/laravel/profiling/profiler.php index fe4397e5..1c722681 100644 --- a/laravel/profiling/profiler.php +++ b/laravel/profiling/profiler.php @@ -146,9 +146,9 @@ public static function query($sql, $bindings, $time) foreach ($bindings as $binding) { $binding = Database::escape($binding); - + $sql = preg_replace('/\?/', $binding, $sql, 1); - $sql = htmlspecialchars($sql); + $sql = htmlspecialchars($sql, ENT_QUOTES, 'UTF-8', false); } static::$data['queries'][] = array($sql, $time); From 53a14206b1e5248a34b3d4ce4c90988c97d254ac Mon Sep 17 00:00:00 2001 From: bruston Date: Wed, 27 Mar 2013 13:07:48 +0000 Subject: [PATCH 029/140] Minor correction to controllers documentation. Signed-off-by: bruston --- laravel/documentation/controllers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/laravel/documentation/controllers.md b/laravel/documentation/controllers.md index 7bece18b..11621c8f 100644 --- a/laravel/documentation/controllers.md +++ b/laravel/documentation/controllers.md @@ -98,7 +98,7 @@ #### Attaching a filter to all except a few actions: $this->filter('before', 'auth')->except(array('add', 'posts')); -Much like the previous example, this declaration ensures that the auth filter is run on only some of this controller's actions. Instead of declaring to which actions the filter applies we are instead declaring the actions that will not require authenticated sessions. It can sometimes be safer to use the 'except' method as it's possible to add new actions to this controller and to forget to add them to only(). This could potentially lead your controller's action being unintentionally accessible by users who haven't been authenticated. +Much like the previous example, this declaration ensures that the auth filter is run on only some of this controller's actions. Instead of declaring to which actions the filter applies we are instead declaring the actions that will not require authenticated sessions. It can sometimes be safer to use the 'except' method as it's possible to add new actions to this controller and to forget to add them to only(). This could potentially lead to your controller's action being unintentionally accessible by users who haven't been authenticated. #### Attaching a filter to run on POST: From c1a8b83574869e0936182bf4bea7b6c5a8e7a2cd Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Thu, 28 Mar 2013 15:35:09 -0500 Subject: [PATCH 030/140] fix array input has. --- laravel/input.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/laravel/input.php b/laravel/input.php index d9de36cb..84424570 100644 --- a/laravel/input.php +++ b/laravel/input.php @@ -40,6 +40,8 @@ public static function all() */ public static function has($key) { + if (is_array(static::get($key))) return true; + return trim((string) static::get($key)) !== ''; } From 15414808a12cd67a2676f70f220b68360e8d7e97 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Thu, 28 Mar 2013 15:50:25 -0500 Subject: [PATCH 031/140] fix padding bug in crypter. --- laravel/crypter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/laravel/crypter.php b/laravel/crypter.php index 18dd51bd..5cbf1101 100644 --- a/laravel/crypter.php +++ b/laravel/crypter.php @@ -138,7 +138,7 @@ protected static function unpad($value) $pad = ord(substr($value, -1)); } - if ($pad and $pad < static::$block) + if ($pad and $pad <= static::$block) { // If the correct padding is present on the string, we will remove // it and return the value. Otherwise, we'll throw an exception From 4046313ecd4934e09a621ee930ee31f88262475e Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Thu, 28 Mar 2013 17:14:45 -0500 Subject: [PATCH 032/140] fix environment on tests. --- laravel/cli/tasks/test/runner.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/laravel/cli/tasks/test/runner.php b/laravel/cli/tasks/test/runner.php index 0d9fb4e6..eb1a8625 100644 --- a/laravel/cli/tasks/test/runner.php +++ b/laravel/cli/tasks/test/runner.php @@ -88,7 +88,7 @@ protected function test() // strings with spaces inside should be wrapped in quotes. $esc_path = escapeshellarg($path); - passthru('phpunit --configuration '.$esc_path, $status); + passthru('LARAVEL_ENV='.Request::env().' phpunit --configuration '.$esc_path, $status); @unlink($path); From 0d99d13298f123acf86b48967e6fe8af8ea4b721 Mon Sep 17 00:00:00 2001 From: Pavel Puchkin Date: Fri, 29 Mar 2013 11:02:26 +1100 Subject: [PATCH 033/140] Ability to flush file-based cache storage --- laravel/cache/drivers/file.php | 12 +++++++++++- laravel/cache/drivers/redis.php | 12 ++++++------ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/laravel/cache/drivers/file.php b/laravel/cache/drivers/file.php index c37520ea..31ef9a4e 100644 --- a/laravel/cache/drivers/file.php +++ b/laravel/cache/drivers/file.php @@ -97,4 +97,14 @@ public function forget($key) if (file_exists($this->path.$key)) @unlink($this->path.$key); } -} \ No newline at end of file + /** + * Flush the entire cache. + * + * @return void + */ + public function flush() + { + array_map('unlink', glob($this->path.'*')); + } + +} diff --git a/laravel/cache/drivers/redis.php b/laravel/cache/drivers/redis.php index f0a71d07..ebc1c08f 100644 --- a/laravel/cache/drivers/redis.php +++ b/laravel/cache/drivers/redis.php @@ -87,15 +87,15 @@ public function forget($key) { $this->redis->del($key); } - + /** * Flush the entire cache. - * + * * @return void */ - public function flush() - { - $this->redis->flushdb(); - } + public function flush() + { + $this->redis->flushdb(); + } } From bc6b786973326606ada43d87aaff81624ac4f80d Mon Sep 17 00:00:00 2001 From: Pavel Puchkin Date: Fri, 29 Mar 2013 12:27:09 +1100 Subject: [PATCH 034/140] Exit with non-zero if command fails, useful in scripting and CI --- laravel/cli/artisan.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/laravel/cli/artisan.php b/laravel/cli/artisan.php index e7bd130e..90f29801 100644 --- a/laravel/cli/artisan.php +++ b/laravel/cli/artisan.php @@ -43,7 +43,8 @@ } catch (\Exception $e) { - echo $e->getMessage(); + echo $e->getMessage().PHP_EOL; + exit(1); } -echo PHP_EOL; \ No newline at end of file +echo PHP_EOL; From 4086d130d1305f8ab6e9d59c9d13a5c402886506 Mon Sep 17 00:00:00 2001 From: Steven Klar Date: Tue, 2 Apr 2013 11:09:40 +0200 Subject: [PATCH 035/140] Add unregister to IoC-Contrainer Signed-off-by: Steven Klar --- laravel/documentation/ioc.md | 11 ++++++++++- laravel/ioc.php | 21 ++++++++++++++++++--- laravel/tests/cases/ioc.test.php | 14 ++++++++++++++ 3 files changed, 42 insertions(+), 4 deletions(-) diff --git a/laravel/documentation/ioc.md b/laravel/documentation/ioc.md index 7df9572b..5d44ba8b 100644 --- a/laravel/documentation/ioc.md +++ b/laravel/documentation/ioc.md @@ -46,4 +46,13 @@ ## Resolving Objects $mailer = IoC::resolve('mailer'); -> **Note:** You may also [register controllers in the container](/docs/controllers#dependency-injection). \ No newline at end of file +> **Note:** You may also [register controllers in the container](/docs/controllers#dependency-injection). + + +## Unregister an existing instance + +For test purposes sometimes you need to unregister some container. + +#### Unregister example mail class: + + IoC::unregister('mailer'); \ No newline at end of file diff --git a/laravel/ioc.php b/laravel/ioc.php index 31a1b6a5..e1075ae2 100644 --- a/laravel/ioc.php +++ b/laravel/ioc.php @@ -31,6 +31,19 @@ public static function register($name, $resolver = null, $singleton = false) static::$registry[$name] = compact('resolver', 'singleton'); } + /** + * Unregister an object + * + * @param string $name + */ + public static function unregister($name) + { + if (array_key_exists($name, static::$registry)) { + unset(static::$registry[$name]); + unset(static::$singletons[$name]); + } + } + /** * Determine if an object has been registered in the container. * @@ -141,6 +154,7 @@ public static function resolve($type, $parameters = array()) * @param string $type * @param array $parameters * @return mixed + * @throws \Exception */ protected static function build($type, $parameters = array()) { @@ -193,7 +207,7 @@ protected static function dependencies($parameters, $arguments) $dependency = $parameter->getClass(); // If the person passed in some parameters to the class - // then we should probably use those instead of trying + // then we should probably use those instead of trying // to resolve a new instance of the class if (count($arguments) > 0) { @@ -205,7 +219,7 @@ protected static function dependencies($parameters, $arguments) } else { - $dependencies[] = static::resolve($dependency->name); + $dependencies[] = static::resolve($dependency->name); } } @@ -218,6 +232,7 @@ protected static function dependencies($parameters, $arguments) * * @param ReflectionParameter * @return default value + * @throws \Exception */ protected static function resolveNonClass($parameter) { @@ -229,6 +244,6 @@ protected static function resolveNonClass($parameter) { throw new \Exception("Unresolvable dependency resolving [$parameter]."); } - } + } } \ No newline at end of file diff --git a/laravel/tests/cases/ioc.test.php b/laravel/tests/cases/ioc.test.php index 61190a03..805e1876 100644 --- a/laravel/tests/cases/ioc.test.php +++ b/laravel/tests/cases/ioc.test.php @@ -28,6 +28,7 @@ public function __construct(TestClassOneForIoC $class_one) } } +use \Laravel\IoC as IoC; class IoCTest extends PHPUnit_Framework_TestCase { @@ -150,4 +151,17 @@ public function testClassTwoResolvesClassOneWithArgument() $this->assertEquals(42, $class_two->class_one->test_variable); } + public function testCanUnregisterRegistered() + { + $testClass = 'test'; + + IoC::register($testClass, function() {}); + + $this->assertTrue(IoC::registered($testClass)); + + IoC::unregister($testClass); + + $this->assertFalse(IoC::registered($testClass)); + } + } From 785e168f5ed15908b1d15dc2071eedc1bc16e30e Mon Sep 17 00:00:00 2001 From: Robert K Date: Wed, 3 Apr 2013 12:13:21 -0300 Subject: [PATCH 036/140] Check application.ssl when setting a secure cookie Most SLL-related code in Laravel checks to see if `application.ssl` is true before doing an action requiring it. `Cookie::put()` is the only exception that I've found, to date, that doesn't test for SSL. This checks to see that the SSL is enabled when attempting to set a secure cookie. To verify, set `application.ssl` to false (without this patch) then run: Cookie::put('foo', 'bar', 0, '/', null, true); You will get an exception because of line 90 in `cookie.php`: if ($secure and ! Request::secure()) { throw new \Exception("Attempting to set secure cookie over HTTP."); } With this patch you will not get this error unless both `application.ssl` is true, and the cookie `$secure` flag is set. --- laravel/cookie.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/laravel/cookie.php b/laravel/cookie.php index 503732f1..775ff125 100644 --- a/laravel/cookie.php +++ b/laravel/cookie.php @@ -82,6 +82,10 @@ public static function put($name, $value, $expiration = 0, $path = '/', $domain $value = static::hash($value).'+'.$value; + // If the developer has explicitly disabled SLL, then we shouldn't force + // this cookie over SSL. + $secure = $secure && Config::get('application.ssl'); + // 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. From c9771d2fff0f9b9334b08abda32112eb21515a1c Mon Sep 17 00:00:00 2001 From: Anders Hammar Date: Wed, 3 Apr 2013 23:14:39 +0200 Subject: [PATCH 037/140] Add validation error message for the 'required_without' rule --- app/lang/en/validation.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/lang/en/validation.php b/app/lang/en/validation.php index a6107907..8fcda745 100644 --- a/app/lang/en/validation.php +++ b/app/lang/en/validation.php @@ -53,6 +53,7 @@ "regex" => "The :attribute format is invalid.", "required" => "The :attribute field is required.", "required_with" => "The :attribute field is required when :values is present.", + "required_without" => "The :attribute field is required when :values is not present.", "same" => "The :attribute and :other must match.", "size" => array( "numeric" => "The :attribute must be :size.", From 906d0d851e182ee832100af207a555e6919acf65 Mon Sep 17 00:00:00 2001 From: Colin Viebrock Date: Wed, 3 Apr 2013 18:26:15 -0500 Subject: [PATCH 038/140] add macros to tables --- laravel/database/schema/table.php | 39 ++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/laravel/database/schema/table.php b/laravel/database/schema/table.php index c728260c..84b64dcf 100644 --- a/laravel/database/schema/table.php +++ b/laravel/database/schema/table.php @@ -39,6 +39,25 @@ class Table { */ public $commands = array(); + /** + * The registered custom macros. + * + * @var array + */ + public static $macros = array(); + + /** + * Registers a custom macro. + * + * @param string $name + * @param Closure $macro + * @return void + */ + public static function macro($name, $macro) + { + static::$macros[$name] = $macro; + } + /** * Create a new schema table instance. * @@ -422,4 +441,22 @@ protected function column($type, $parameters = array()) return $this->columns[] = new Fluent($parameters); } -} \ No newline at end of file + /** + * Dynamically handle calls to custom macros. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function __call($method, $parameters) + { + if (isset(static::$macros[$method])) + { + array_unshift($parameters, $this); + return call_user_func_array(static::$macros[$method], $parameters); + } + + throw new \Exception("Method [$method] does not exist."); + } + +} From d46e19214bd66c54b7daec62d4bc62b70c74d031 Mon Sep 17 00:00:00 2001 From: Bernardo Rittmeyer Date: Thu, 4 Apr 2013 12:50:59 +0300 Subject: [PATCH 039/140] get_dirty() comparison is not type safe get_dirty() must compare using Not Identical (!==) on place of Not Equal (!=). For example, changing null to false don't make the model dirty. --- laravel/database/eloquent/model.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/laravel/database/eloquent/model.php b/laravel/database/eloquent/model.php index cb555de4..23d25b02 100644 --- a/laravel/database/eloquent/model.php +++ b/laravel/database/eloquent/model.php @@ -517,7 +517,7 @@ public function get_dirty() foreach ($this->attributes as $key => $value) { - if ( ! array_key_exists($key, $this->original) or $value != $this->original[$key]) + if ( ! array_key_exists($key, $this->original) or $value !== $this->original[$key]) { $dirty[$key] = $value; } @@ -795,4 +795,4 @@ public static function __callStatic($method, $parameters) return call_user_func_array(array(new $model, $method), $parameters); } -} \ No newline at end of file +} From 3cd624eac8bc5f50473087dabd5a917e95a15fbe Mon Sep 17 00:00:00 2001 From: jan Date: Fri, 5 Apr 2013 09:18:51 +0200 Subject: [PATCH 040/140] Changed Laravel\ namespace prefix in some classes calls in helpers to global, to allow aliases to work, and allow class extending. --- laravel/helpers.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/laravel/helpers.php b/laravel/helpers.php index 513e3baa..22f57a7f 100644 --- a/laravel/helpers.php +++ b/laravel/helpers.php @@ -328,7 +328,7 @@ function head($array) */ function url($url = '', $https = null) { - return Laravel\URL::to($url, $https); + return URL::to($url, $https); } /** @@ -340,7 +340,7 @@ function url($url = '', $https = null) */ function asset($url, $https = null) { - return Laravel\URL::to_asset($url, $https); + return URL::to_asset($url, $https); } /** @@ -360,7 +360,7 @@ function asset($url, $https = null) */ function action($action, $parameters = array()) { - return Laravel\URL::to_action($action, $parameters); + return URL::to_action($action, $parameters); } /** @@ -380,7 +380,7 @@ function action($action, $parameters = array()) */ function route($name, $parameters = array()) { - return Laravel\URL::to_route($name, $parameters); + return URL::to_route($name, $parameters); } /** @@ -523,7 +523,7 @@ function view($view, $data = array()) { if (is_null($view)) return ''; - return Laravel\View::make($view, $data); + return View::make($view, $data); } /** @@ -537,7 +537,7 @@ function render($view, $data = array()) { if (is_null($view)) return ''; - return Laravel\View::make($view, $data)->render(); + return View::make($view, $data)->render(); } /** @@ -551,7 +551,7 @@ function render($view, $data = array()) */ function render_each($partial, array $data, $iterator, $empty = 'raw|') { - return Laravel\View::render_each($partial, $data, $iterator, $empty); + return View::render_each($partial, $data, $iterator, $empty); } /** @@ -562,7 +562,7 @@ function render_each($partial, array $data, $iterator, $empty = 'raw|') */ function yield($section) { - return Laravel\Section::yield($section); + return Section::yield($section); } /** @@ -574,7 +574,7 @@ function yield($section) */ function get_cli_option($option, $default = null) { - foreach (Laravel\Request::foundation()->server->get('argv') as $argument) + foreach (Request::foundation()->server->get('argv') as $argument) { if (starts_with($argument, "--{$option}=")) { From e4080c02f56881a8682d913db4904ef486669b16 Mon Sep 17 00:00:00 2001 From: jan Date: Fri, 5 Apr 2013 09:48:49 +0200 Subject: [PATCH 041/140] get_cli_option() is called outside Laravel app, so namespace prefix must be left there --- laravel/helpers.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/laravel/helpers.php b/laravel/helpers.php index 22f57a7f..4d4f3003 100644 --- a/laravel/helpers.php +++ b/laravel/helpers.php @@ -574,7 +574,7 @@ function yield($section) */ function get_cli_option($option, $default = null) { - foreach (Request::foundation()->server->get('argv') as $argument) + foreach (Laravel\Request::foundation()->server->get('argv') as $argument) { if (starts_with($argument, "--{$option}=")) { From 5ddeab6051bccab0d270ea731c51b480a8731a0c Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Sat, 6 Apr 2013 20:27:00 -0500 Subject: [PATCH 042/140] pass exception to 500 event correctly. --- laravel/error.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/laravel/error.php b/laravel/error.php index 7de0919a..226d4639 100644 --- a/laravel/error.php +++ b/laravel/error.php @@ -54,7 +54,7 @@ public static function exception($exception, $trace = true) // Using events gives the developer more freedom. else { - $response = Event::first('500', $exception); + $response = Event::first('500', array($exception)); $response = Response::prepare($response); } From 26c426ab3e676a63f352c1d2fee5c742b55dbe56 Mon Sep 17 00:00:00 2001 From: Ben Corlett Date: Sun, 7 Apr 2013 20:00:44 +1000 Subject: [PATCH 043/140] Lining up translation. Surprised it triggered my OCD before @taylorotwell's. Signed-off-by: Ben Corlett --- app/lang/en/validation.php | 80 +++++++++++++++++++------------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/app/lang/en/validation.php b/app/lang/en/validation.php index 8fcda745..79ca71f2 100644 --- a/app/lang/en/validation.php +++ b/app/lang/en/validation.php @@ -13,55 +13,55 @@ | */ - "accepted" => "The :attribute must be accepted.", - "active_url" => "The :attribute is not a valid URL.", - "after" => "The :attribute must be a date after :date.", - "alpha" => "The :attribute may only contain letters.", - "alpha_dash" => "The :attribute may only contain letters, numbers, and dashes.", - "alpha_num" => "The :attribute may only contain letters and numbers.", - "before" => "The :attribute must be a date before :date.", - "between" => array( + "accepted" => "The :attribute must be accepted.", + "active_url" => "The :attribute is not a valid URL.", + "after" => "The :attribute must be a date after :date.", + "alpha" => "The :attribute may only contain letters.", + "alpha_dash" => "The :attribute may only contain letters, numbers, and dashes.", + "alpha_num" => "The :attribute may only contain letters and numbers.", + "before" => "The :attribute must be a date before :date.", + "between" => array( "numeric" => "The :attribute must be between :min - :max.", "file" => "The :attribute must be between :min - :max kilobytes.", "string" => "The :attribute must be between :min - :max characters.", ), - "confirmed" => "The :attribute confirmation does not match.", - "date" => "The :attribute is not a valid date.", - "date_format" => "The :attribute does not match the format :format.", - "different" => "The :attribute and :other must be different.", - "digits" => "The :attribute must be :digits digits.", - "digits_between" => "The :attribute must be between :min and :max digits.", - "email" => "The :attribute format is invalid.", - "exists" => "The selected :attribute is invalid.", - "image" => "The :attribute must be an image.", - "in" => "The selected :attribute is invalid.", - "integer" => "The :attribute must be an integer.", - "ip" => "The :attribute must be a valid IP address.", - "max" => array( - "numeric" => "The :attribute may not be greater than :max.", - "file" => "The :attribute may not be greater than :max kilobytes.", - "string" => "The :attribute may not be greater than :max characters.", + "confirmed" => "The :attribute confirmation does not match.", + "date" => "The :attribute is not a valid date.", + "date_format" => "The :attribute does not match the format :format.", + "different" => "The :attribute and :other must be different.", + "digits" => "The :attribute must be :digits digits.", + "digits_between" => "The :attribute must be between :min and :max digits.", + "email" => "The :attribute format is invalid.", + "exists" => "The selected :attribute is invalid.", + "image" => "The :attribute must be an image.", + "in" => "The selected :attribute is invalid.", + "integer" => "The :attribute must be an integer.", + "ip" => "The :attribute must be a valid IP address.", + "max" => array( + "numeric" => "The :attribute may not be greater than :max.", + "file" => "The :attribute may not be greater than :max kilobytes.", + "string" => "The :attribute may not be greater than :max characters.", ), - "mimes" => "The :attribute must be a file of type: :values.", - "min" => array( - "numeric" => "The :attribute must be at least :min.", - "file" => "The :attribute must be at least :min kilobytes.", - "string" => "The :attribute must be at least :min characters.", + "mimes" => "The :attribute must be a file of type: :values.", + "min" => array( + "numeric" => "The :attribute must be at least :min.", + "file" => "The :attribute must be at least :min kilobytes.", + "string" => "The :attribute must be at least :min characters.", ), "not_in" => "The selected :attribute is invalid.", - "numeric" => "The :attribute must be a number.", - "regex" => "The :attribute format is invalid.", - "required" => "The :attribute field is required.", - "required_with" => "The :attribute field is required when :values is present.", + "numeric" => "The :attribute must be a number.", + "regex" => "The :attribute format is invalid.", + "required" => "The :attribute field is required.", + "required_with" => "The :attribute field is required when :values is present.", "required_without" => "The :attribute field is required when :values is not present.", - "same" => "The :attribute and :other must match.", - "size" => array( - "numeric" => "The :attribute must be :size.", - "file" => "The :attribute must be :size kilobytes.", - "string" => "The :attribute must be :size characters.", + "same" => "The :attribute and :other must match.", + "size" => array( + "numeric" => "The :attribute must be :size.", + "file" => "The :attribute must be :size kilobytes.", + "string" => "The :attribute must be :size characters.", ), - "unique" => "The :attribute has already been taken.", - "url" => "The :attribute format is invalid.", + "unique" => "The :attribute has already been taken.", + "url" => "The :attribute format is invalid.", /* |-------------------------------------------------------------------------- From 3b601fee4a8e8a7173956c802253bb221d087278 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Mon, 8 Apr 2013 10:39:36 -0500 Subject: [PATCH 044/140] Added auth.basic filter. --- app/filters.php | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/app/filters.php b/app/filters.php index 2276b4e2..d4bb39b1 100644 --- a/app/filters.php +++ b/app/filters.php @@ -28,8 +28,8 @@ |-------------------------------------------------------------------------- | | The following filters are used to verify that the user of the current -| session is logged into this application. Also, a "guest" filter is -| responsible for performing the opposite. Both provide redirects. +| session is logged into this application. The "basic" filter easily +| integrates HTTP Basic authentication for quick, simple checking. | */ @@ -39,6 +39,22 @@ }); +Route::filter('auth.basic', function() +{ + return Auth::basic(); +}); + +/* +|-------------------------------------------------------------------------- +| Guest Filter +|-------------------------------------------------------------------------- +| +| The "guest" filter is the counterpart of the authentication filters as +| it simply checks the that current user is not logged in. A redirect +| response will be issued if they are, which you may freely change. +| +*/ + Route::filter('guest', function() { if (Auth::check()) return Redirect::to('/'); From c9d0090f72ce7fa64c671771523dc0bf436adb0f Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Mon, 8 Apr 2013 11:16:11 -0500 Subject: [PATCH 045/140] Fix typo. --- app/filters.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/filters.php b/app/filters.php index d4bb39b1..942287bf 100644 --- a/app/filters.php +++ b/app/filters.php @@ -50,7 +50,7 @@ |-------------------------------------------------------------------------- | | The "guest" filter is the counterpart of the authentication filters as -| it simply checks the that current user is not logged in. A redirect +| it simply checks that the current user is not logged in. A redirect | response will be issued if they are, which you may freely change. | */ From b2a1c9be530ec325342c64cdbc187461302be398 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Mon, 8 Apr 2013 19:48:02 -0500 Subject: [PATCH 046/140] Turn on Redis clustering by default. --- app/config/database.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/config/database.php b/app/config/database.php index c154f767..f479bf40 100644 --- a/app/config/database.php +++ b/app/config/database.php @@ -111,6 +111,8 @@ 'redis' => array( + 'cluster' => true, + 'default' => array( 'host' => '127.0.0.1', 'port' => 6379, From 44f82b18d814ff1d147af2c341f23f3c79df4233 Mon Sep 17 00:00:00 2001 From: aeberhardo Date: Tue, 9 Apr 2013 10:23:07 +0200 Subject: [PATCH 047/140] Incremented version from 3.2.13 to 3.2.14 Signed-off-by: aeberhardo --- artisan | 2 +- paths.php | 2 +- public/index.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/artisan b/artisan index 02beb785..f986e011 100644 --- a/artisan +++ b/artisan @@ -3,7 +3,7 @@ * Laravel - A PHP Framework For Web Artisans * * @package Laravel - * @version 3.2.13 + * @version 3.2.14 * @author Taylor Otwell * @link http://laravel.com */ diff --git a/paths.php b/paths.php index 37c5b1ed..b2193bb7 100644 --- a/paths.php +++ b/paths.php @@ -3,7 +3,7 @@ * Laravel - A PHP Framework For Web Artisans * * @package Laravel - * @version 3.2.13 + * @version 3.2.14 * @author Taylor Otwell * @link http://laravel.com */ diff --git a/public/index.php b/public/index.php index 5da356f2..ab225617 100644 --- a/public/index.php +++ b/public/index.php @@ -3,7 +3,7 @@ * Laravel - A PHP Framework For Web Artisans * * @package Laravel - * @version 3.2.13 + * @version 3.2.14 * @author Taylor Otwell * @link http://laravel.com */ From 87bf2402d49efb8920fbfe2e43b98dca8b812f7b Mon Sep 17 00:00:00 2001 From: aeberhardo Date: Tue, 9 Apr 2013 10:38:34 +0200 Subject: [PATCH 048/140] Fixed a typo in Contributing chapter Signed-off-by: aeberhardo --- laravel/documentation/contrib/command-line.md | 2 +- laravel/documentation/contrib/tortoisegit.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/laravel/documentation/contrib/command-line.md b/laravel/documentation/contrib/command-line.md index 0602c2e2..d5bf4b3a 100644 --- a/laravel/documentation/contrib/command-line.md +++ b/laravel/documentation/contrib/command-line.md @@ -88,7 +88,7 @@ ## Committing # git commit -s -m "I added some more stuff to the Localization documentation." -- **-s** means that you are signing-off on your commit with your name. This tells the Laravel team know that you personally agree to your code being added to the Laravel core. +- **-s** means that you are signing-off on your commit with your name. This lets the Laravel team know that you personally agree to your code being added to the Laravel core. - **-m** is the message that goes with your commit. Provide a brief explanation of what you added or changed. diff --git a/laravel/documentation/contrib/tortoisegit.md b/laravel/documentation/contrib/tortoisegit.md index 96f1d9b9..9524657f 100644 --- a/laravel/documentation/contrib/tortoisegit.md +++ b/laravel/documentation/contrib/tortoisegit.md @@ -76,7 +76,7 @@ ## Creating Branches - Right-click the Laravel directory and goto **Git Commit -> "feature/localization-docs"…** - Commit - **Message:** Provide a brief explaination of what you added or changed - - Click **Sign** - This tells the Laravel team know that you personally agree to your code being added to the Laravel core + - Click **Sign** - This lets the Laravel team know that you personally agree to your code being added to the Laravel core - **Changes made:** Check all changed/added files - Click **OK** From 343c31e5dbb3f7ebd2f764721a8b0461792b2dc6 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 9 Apr 2013 15:37:50 -0500 Subject: [PATCH 049/140] Redirect trailing slashes with 301. --- public/.htaccess | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/public/.htaccess b/public/.htaccess index 969cfdab..2a235ee4 100644 --- a/public/.htaccess +++ b/public/.htaccess @@ -1,6 +1,10 @@ Options -MultiViews RewriteEngine On + + RewriteCond %{REQUEST_FILENAME} !-d + RewriteRule ^(.+)/$ http://%{HTTP_HOST}/$1 [R=301,L] + RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] \ No newline at end of file From e1fde01e9d3f5d1dd47cb6dcffd331e7899d5119 Mon Sep 17 00:00:00 2001 From: Max Date: Fri, 12 Apr 2013 16:35:33 +0300 Subject: [PATCH 050/140] IoC::registered check fixed Returns true if the instance was registered with IoC::instance --- laravel/ioc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/laravel/ioc.php b/laravel/ioc.php index e1075ae2..de070448 100644 --- a/laravel/ioc.php +++ b/laravel/ioc.php @@ -52,7 +52,7 @@ public static function unregister($name) */ public static function registered($name) { - return array_key_exists($name, static::$registry); + return array_key_exists($name, static::$registry) || array_key_exists($name, static::$singletons); } /** @@ -246,4 +246,4 @@ protected static function resolveNonClass($parameter) } } -} \ No newline at end of file +} From 7ad0dcea2815b6df80fba75995e683897bbffee0 Mon Sep 17 00:00:00 2001 From: Brian Kiewel Date: Fri, 12 Apr 2013 13:23:39 -0700 Subject: [PATCH 051/140] Changed robots.txt to use disallow instead of allow --- public/robots.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/robots.txt b/public/robots.txt index 4206b878..9e60f970 100644 --- a/public/robots.txt +++ b/public/robots.txt @@ -1 +1,2 @@ -User-agent: * Allow: / \ No newline at end of file +User-agent: * +Disallow: From 6e5ca7331ebf511754d276cb40bc7b0eef4a463c Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Sat, 13 Apr 2013 08:30:10 -0500 Subject: [PATCH 052/140] Add "url" option to configuration. --- app/config/app.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/config/app.php b/app/config/app.php index ca18595f..52b37e45 100644 --- a/app/config/app.php +++ b/app/config/app.php @@ -15,6 +15,19 @@ 'debug' => true, +/* +|-------------------------------------------------------------------------- +| Application URL +|-------------------------------------------------------------------------- +| +| This URL is used by the console to properly generate URLs when using +| the Artisan command line tool. You should set this to the root of +| your application so that it is used when running Artisan tasks. +| +*/ + + 'url' => 'http://localhost', + /* |-------------------------------------------------------------------------- | Application Timezone From 982e51fd98dac6feed8ec7939c3434c325769f8e Mon Sep 17 00:00:00 2001 From: Brian Kiewel Date: Sat, 13 Apr 2013 09:39:38 -0700 Subject: [PATCH 053/140] Converted spaces to tabs for consistency --- public/.htaccess | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/public/.htaccess b/public/.htaccess index 2a235ee4..a3432c2a 100644 --- a/public/.htaccess +++ b/public/.htaccess @@ -1,10 +1,10 @@ - Options -MultiViews - RewriteEngine On + Options -MultiViews + RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.+)/$ http://%{HTTP_HOST}/$1 [R=301,L] - RewriteCond %{REQUEST_FILENAME} !-f - RewriteRule ^ index.php [L] + RewriteCond %{REQUEST_FILENAME} !-f + RewriteRule ^ index.php [L] \ No newline at end of file From ed89cfb13b826f8d1cdd286187911c565beff42f Mon Sep 17 00:00:00 2001 From: Jason Lewis Date: Sun, 14 Apr 2013 13:19:52 +1000 Subject: [PATCH 054/140] Use the base.path when loading the illuminate application. Signed-off-by: Jason Lewis --- bootstrap/start.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap/start.php b/bootstrap/start.php index f418a138..cd8a5b69 100644 --- a/bootstrap/start.php +++ b/bootstrap/start.php @@ -54,7 +54,7 @@ | */ -$framework = __DIR__.'/../vendor/laravel/framework/src'; +$framework = $app['path.base'].'/vendor/laravel/framework/src'; require $framework.'/Illuminate/Foundation/start.php'; From 9ba285a2ad66c9c6f57a2dc8253cb03713f680fb Mon Sep 17 00:00:00 2001 From: Authman Apatira Date: Sat, 13 Apr 2013 23:14:26 -0700 Subject: [PATCH 055/140] Return the status of $model->push(). --- laravel/database/eloquent/model.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/laravel/database/eloquent/model.php b/laravel/database/eloquent/model.php index 23d25b02..63ac9b56 100644 --- a/laravel/database/eloquent/model.php +++ b/laravel/database/eloquent/model.php @@ -335,7 +335,7 @@ public function has_many_and_belongs_to($model, $table = null, $foreign = null, */ public function push() { - $this->save(); + if (!$this->save()) return false; // To sync all of the relationships to the database, we will simply spin through // the relationships, calling the "push" method on each of the models in that @@ -349,9 +349,11 @@ public function push() foreach ($models as $model) { - $model->push(); + if (!$model->push()) return false; } } + + return true; } /** From 315bb1dd9bded5dfc2539faa7efac2d3c4215e98 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Sun, 14 Apr 2013 13:51:53 -0500 Subject: [PATCH 056/140] Add pre-update command to remove the compiled file. --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index ae7555e9..be7e44d7 100644 --- a/composer.json +++ b/composer.json @@ -13,6 +13,7 @@ ] }, "scripts": { + "pre-update-cmd": "rm bootstrap/compiled.php", "post-update-cmd": "php artisan optimize" }, "minimum-stability": "dev" From e0d6b130b878809a3fe8f3680527de1903ed6a6d Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Sun, 14 Apr 2013 13:54:33 -0500 Subject: [PATCH 057/140] Remove pre-update script. --- composer.json | 1 - 1 file changed, 1 deletion(-) diff --git a/composer.json b/composer.json index be7e44d7..ae7555e9 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,6 @@ ] }, "scripts": { - "pre-update-cmd": "rm bootstrap/compiled.php", "post-update-cmd": "php artisan optimize" }, "minimum-stability": "dev" From 997f789c47d4be159b600bbac82d358a96339821 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Mon, 15 Apr 2013 15:32:11 -0500 Subject: [PATCH 058/140] Move comment to line it up with others. --- app/config/app.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/app/config/app.php b/app/config/app.php index 52b37e45..6b065a9c 100644 --- a/app/config/app.php +++ b/app/config/app.php @@ -15,16 +15,16 @@ 'debug' => true, -/* -|-------------------------------------------------------------------------- -| Application URL -|-------------------------------------------------------------------------- -| -| This URL is used by the console to properly generate URLs when using -| the Artisan command line tool. You should set this to the root of -| your application so that it is used when running Artisan tasks. -| -*/ + /* + |-------------------------------------------------------------------------- + | Application URL + |-------------------------------------------------------------------------- + | + | This URL is used by the console to properly generate URLs when using + | the Artisan command line tool. You should set this to the root of + | your application so that it is used when running Artisan tasks. + | + */ 'url' => 'http://localhost', From 036a0bab0bd05cf2f8086363c35adc104a7cf631 Mon Sep 17 00:00:00 2001 From: "dr.dimitru" Date: Tue, 16 Apr 2013 03:28:55 +0400 Subject: [PATCH 059/140] Make view with response status and headers Add functionality to make view with response status and headers - view_with_status --- laravel/response.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/laravel/response.php b/laravel/response.php index f3508358..242deab0 100644 --- a/laravel/response.php +++ b/laravel/response.php @@ -57,6 +57,28 @@ public static function make($content, $status = 200, $headers = array()) { return new static($content, $status, $headers); } + + /** + * Create a new response instance with status code. + * + * + * // Create a response instance with a view + * return Response::view('home.no_such_page', 404); + * + * // Create a response instance with a view and data + * return Response::view('item.no_such_page', 404, array('message' => 'Nothing found'), array('header' => 'value')); + * + * + * @param string $view + * @param int $status + * @param array $data + * @param array $headers + * @return Response + */ + public static function view_with_status($view, $status, $data = array(), $headers = array()) + { + return new static(View::make($view, $data), $status, $headers); + } /** * Create a new response instance containing a view. From d9c559ba7f3e92d0623df0cd30f8f8e5ae7a7aff Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 16 Apr 2013 22:36:51 -0500 Subject: [PATCH 060/140] Tweak for session changes. --- app/config/session.php | 4 ++-- app/filters.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/config/session.php b/app/config/session.php index c4a3a093..bee609e6 100644 --- a/app/config/session.php +++ b/app/config/session.php @@ -11,12 +11,12 @@ | requests. By default we will use the light-weight cookie driver but | you may specify any of the other wonderful drivers provided here. | - | Supported: "cookie", "file", "database", "apc", + | Supported: "native", "file", "database", "apc", | "memcached", "redis", "array" | */ - 'driver' => 'cookie', + 'driver' => 'native', /* |-------------------------------------------------------------------------- diff --git a/app/filters.php b/app/filters.php index 942287bf..021e364c 100644 --- a/app/filters.php +++ b/app/filters.php @@ -73,7 +73,7 @@ Route::filter('csrf', function() { - if (Session::getToken() != Input::get('_token')) + if (Session::token() != Input::get('_token')) { throw new Illuminate\Session\TokenMismatchException; } From 452956551b701bfe40631894cf4e6c0568c5fd2f Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 17 Apr 2013 00:29:48 -0500 Subject: [PATCH 061/140] Fix comments on session. --- app/config/session.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/config/session.php b/app/config/session.php index bee609e6..4d888725 100644 --- a/app/config/session.php +++ b/app/config/session.php @@ -11,7 +11,7 @@ | requests. By default we will use the light-weight cookie driver but | you may specify any of the other wonderful drivers provided here. | - | Supported: "native", "file", "database", "apc", + | Supported: "native", "database", "apc", | "memcached", "redis", "array" | */ @@ -36,7 +36,7 @@ | Session File Location |-------------------------------------------------------------------------- | - | When using the "file" session driver, we need a location where session + | When using the native session driver, we need a location where session | files may be stored. A default has been set for you but a different | location may be specified. This is only needed for file sessions. | From 5b43ff5181b8129066124b919976544a4d7d1426 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 17 Apr 2013 16:28:05 -0500 Subject: [PATCH 062/140] Added "cookie" back in as session option. --- app/config/session.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/config/session.php b/app/config/session.php index 4d888725..9a01319e 100644 --- a/app/config/session.php +++ b/app/config/session.php @@ -11,7 +11,7 @@ | requests. By default we will use the light-weight cookie driver but | you may specify any of the other wonderful drivers provided here. | - | Supported: "native", "database", "apc", + | Supported: "native", "cookie", "database", "apc", | "memcached", "redis", "array" | */ From b16bb1ac6a425980bcc326044155fb8c87b09ff0 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Thu, 18 Apr 2013 11:00:40 -0500 Subject: [PATCH 063/140] Setup Patchwork for 1.1.*. --- bootstrap/autoload.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/bootstrap/autoload.php b/bootstrap/autoload.php index 626612a2..ef587e27 100644 --- a/bootstrap/autoload.php +++ b/bootstrap/autoload.php @@ -32,6 +32,19 @@ require $compiled; } +/* +|-------------------------------------------------------------------------- +| Setup Patchwork UTF-8 Handling +|-------------------------------------------------------------------------- +| +| The Patchwork library provides solid handling of UTF-8 strings as well +| as provides replacements for all mb_* and iconv type functions that +| are not available by default in PHP. We'll setup this stuff here. +| +*/ + +Patchwork\Utf8\Bootup::initAll(); + /* |-------------------------------------------------------------------------- | Register The Laravel Auto Loader From b042d46bfea30e97669047f8390534f9a3766417 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Fri, 19 Apr 2013 23:39:29 -0500 Subject: [PATCH 064/140] Set preferred install as "dist" out of the box. --- composer.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/composer.json b/composer.json index ae7555e9..53668d48 100644 --- a/composer.json +++ b/composer.json @@ -15,5 +15,8 @@ "scripts": { "post-update-cmd": "php artisan optimize" }, + "config": { + "preferred-install": "dist" + }, "minimum-stability": "dev" } From 763f1d5181053bcf6b714d1dc905a6e9483e6215 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 23 Apr 2013 22:27:51 -0500 Subject: [PATCH 065/140] Use Redirect::guest in "auth" filter. --- app/filters.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/filters.php b/app/filters.php index 021e364c..85f82c41 100644 --- a/app/filters.php +++ b/app/filters.php @@ -35,7 +35,7 @@ Route::filter('auth', function() { - if (Auth::guest()) return Redirect::route('login'); + if (Auth::guest()) return Redirect::guest('login'); }); From 5e2d8843d8f3e651fa5f6f5252d64fd71c26fc9b Mon Sep 17 00:00:00 2001 From: vlakoff Date: Tue, 30 Apr 2013 05:43:09 +0200 Subject: [PATCH 066/140] Fix comment on default session driver. --- app/config/session.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/config/session.php b/app/config/session.php index 9a01319e..f54b3786 100644 --- a/app/config/session.php +++ b/app/config/session.php @@ -8,7 +8,7 @@ |-------------------------------------------------------------------------- | | This option controls the default session "driver" that will be used on - | requests. By default we will use the light-weight cookie driver but + | requests. By default we will use the light-weight native driver but | you may specify any of the other wonderful drivers provided here. | | Supported: "native", "cookie", "database", "apc", From d433293e8affff8a43dc4c9b6b9ca6d7e33adb43 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 30 Apr 2013 09:57:09 -0500 Subject: [PATCH 067/140] Add required_if validation language line. --- app/lang/en/validation.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/lang/en/validation.php b/app/lang/en/validation.php index 79ca71f2..85a62aa5 100644 --- a/app/lang/en/validation.php +++ b/app/lang/en/validation.php @@ -52,6 +52,7 @@ "numeric" => "The :attribute must be a number.", "regex" => "The :attribute format is invalid.", "required" => "The :attribute field is required.", + "required_if" => "The :attribute field is required when :other is :value.", "required_with" => "The :attribute field is required when :values is present.", "required_without" => "The :attribute field is required when :values is not present.", "same" => "The :attribute and :other must match.", From c991a4cfb19d4904e41301234ae8349b193ec522 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 1 May 2013 11:18:09 -0500 Subject: [PATCH 068/140] Fix typo. Closes #1935. --- app/config/workbench.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/config/workbench.php b/app/config/workbench.php index 623cd192..56bee526 100644 --- a/app/config/workbench.php +++ b/app/config/workbench.php @@ -22,7 +22,7 @@ | | Like the option above, your e-mail address is used when generating new | workbench packages. The e-mail is placed in your composer.json file - | automatically whwen the package is created by the workbench tool. + | automatically after the package is created by the workbench tool. | */ From 9ee8da7bfdc0cb154c02e4ff829d22172824b595 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 1 May 2013 14:06:22 -0500 Subject: [PATCH 069/140] Fix session configs. Closes #1943. --- app/config/testing/session.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/config/testing/session.php b/app/config/testing/session.php index 338aebaf..a18c1b9f 100644 --- a/app/config/testing/session.php +++ b/app/config/testing/session.php @@ -8,10 +8,10 @@ |-------------------------------------------------------------------------- | | This option controls the default session "driver" that will be used on - | requets. By default, we will use the light-weight cookie driver but + | requests. By default, we will use the lightweight native driver but | you may specify any of the other wonderful drivers provided here. | - | Supported: "cookie", file", "database", "apc", + | Supported: "native", "cookie", "database", "apc", | "memcached", "redis", "array" | */ From b9cf8dfb715e7cc6b639150ea16b1ef044e60b1f Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 1 May 2013 14:19:10 -0500 Subject: [PATCH 070/140] Upgrade to latest Symfony HttpFoundation tag. Closes #1865. --- .../Component/HttpFoundation/AcceptHeader.php | 172 +++++++++++ .../HttpFoundation/AcceptHeaderItem.php | 226 ++++++++++++++ .../HttpFoundation/BinaryFileResponse.php | 278 ++++++++++++++++++ .../Component/HttpFoundation/CHANGELOG.md | 14 + .../Component/HttpFoundation/Cookie.php | 2 + .../MimeType/FileBinaryMimeTypeGuesser.php | 4 +- .../File/MimeType/MimeTypeGuesser.php | 5 +- .../HttpFoundation/File/UploadedFile.php | 13 + .../Component/HttpFoundation/HeaderBag.php | 4 +- .../Component/HttpFoundation/IpUtils.php | 111 +++++++ .../Component/HttpFoundation/JsonResponse.php | 14 +- .../Symfony/Component/HttpFoundation/LICENSE | 2 +- .../Component/HttpFoundation/ParameterBag.php | 2 + .../Component/HttpFoundation/README.md | 6 +- .../HttpFoundation/RedirectResponse.php | 4 + .../Component/HttpFoundation/Request.php | 197 +++++++++---- .../HttpFoundation/RequestMatcher.php | 87 +----- .../Component/HttpFoundation/Response.php | 71 +++-- .../HttpFoundation/ResponseHeaderBag.php | 34 ++- .../Session/Attribute/AttributeBag.php | 2 +- .../HttpFoundation/Session/Flash/FlashBag.php | 7 + .../HttpFoundation/Session/Session.php | 14 + .../Storage/Handler/MongoDbSessionHandler.php | 45 ++- .../Session/Storage/NativeSessionStorage.php | 10 +- .../Session/Storage/Proxy/AbstractProxy.php | 4 + .../HttpFoundation/StreamedResponse.php | 2 + .../Component/HttpFoundation/composer.json | 13 +- .../Component/HttpFoundation/phpunit.xml.dist | 30 ++ 28 files changed, 1154 insertions(+), 219 deletions(-) create mode 100644 laravel/vendor/Symfony/Component/HttpFoundation/AcceptHeader.php create mode 100644 laravel/vendor/Symfony/Component/HttpFoundation/AcceptHeaderItem.php create mode 100644 laravel/vendor/Symfony/Component/HttpFoundation/BinaryFileResponse.php create mode 100644 laravel/vendor/Symfony/Component/HttpFoundation/IpUtils.php create mode 100644 laravel/vendor/Symfony/Component/HttpFoundation/phpunit.xml.dist diff --git a/laravel/vendor/Symfony/Component/HttpFoundation/AcceptHeader.php b/laravel/vendor/Symfony/Component/HttpFoundation/AcceptHeader.php new file mode 100644 index 00000000..48c10c15 --- /dev/null +++ b/laravel/vendor/Symfony/Component/HttpFoundation/AcceptHeader.php @@ -0,0 +1,172 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpFoundation; + +/** + * Represents an Accept-* header. + * + * An accept header is compound with a list of items, + * sorted by descending quality. + * + * @author Jean-François Simon + */ +class AcceptHeader +{ + /** + * @var AcceptHeaderItem[] + */ + private $items = array(); + + /** + * @var bool + */ + private $sorted = true; + + /** + * Constructor. + * + * @param AcceptHeaderItem[] $items + */ + public function __construct(array $items) + { + foreach ($items as $item) { + $this->add($item); + } + } + + /** + * Builds an AcceptHeader instance from a string. + * + * @param string $headerValue + * + * @return AcceptHeader + */ + public static function fromString($headerValue) + { + $index = 0; + + return new self(array_map(function ($itemValue) use (&$index) { + $item = AcceptHeaderItem::fromString($itemValue); + $item->setIndex($index++); + + return $item; + }, preg_split('/\s*(?:,*("[^"]+"),*|,*(\'[^\']+\'),*|,+)\s*/', $headerValue, 0, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE))); + } + + /** + * Returns header value's string representation. + * + * @return string + */ + public function __toString() + { + return implode(',', $this->items); + } + + /** + * Tests if header has given value. + * + * @param string $value + * + * @return Boolean + */ + public function has($value) + { + return isset($this->items[$value]); + } + + /** + * Returns given value's item, if exists. + * + * @param string $value + * + * @return AcceptHeaderItem|null + */ + public function get($value) + { + return isset($this->items[$value]) ? $this->items[$value] : null; + } + + /** + * Adds an item. + * + * @param AcceptHeaderItem $item + * + * @return AcceptHeader + */ + public function add(AcceptHeaderItem $item) + { + $this->items[$item->getValue()] = $item; + $this->sorted = false; + + return $this; + } + + /** + * Returns all items. + * + * @return AcceptHeaderItem[] + */ + public function all() + { + $this->sort(); + + return $this->items; + } + + /** + * Filters items on their value using given regex. + * + * @param string $pattern + * + * @return AcceptHeader + */ + public function filter($pattern) + { + return new self(array_filter($this->items, function (AcceptHeaderItem $item) use ($pattern) { + return preg_match($pattern, $item->getValue()); + })); + } + + /** + * Returns first item. + * + * @return AcceptHeaderItem|null + */ + public function first() + { + $this->sort(); + + return !empty($this->items) ? reset($this->items) : null; + } + + /** + * Sorts items by descending quality + */ + private function sort() + { + if (!$this->sorted) { + uasort($this->items, function ($a, $b) { + $qA = $a->getQuality(); + $qB = $b->getQuality(); + + if ($qA === $qB) { + return $a->getIndex() > $b->getIndex() ? 1 : -1; + } + + return $qA > $qB ? -1 : 1; + }); + + $this->sorted = true; + } + } +} diff --git a/laravel/vendor/Symfony/Component/HttpFoundation/AcceptHeaderItem.php b/laravel/vendor/Symfony/Component/HttpFoundation/AcceptHeaderItem.php new file mode 100644 index 00000000..9d4c3132 --- /dev/null +++ b/laravel/vendor/Symfony/Component/HttpFoundation/AcceptHeaderItem.php @@ -0,0 +1,226 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpFoundation; + +/** + * Represents an Accept-* header item. + * + * @author Jean-François Simon + */ +class AcceptHeaderItem +{ + /** + * @var string + */ + private $value; + + /** + * @var float + */ + private $quality = 1.0; + + /** + * @var int + */ + private $index = 0; + + /** + * @var array + */ + private $attributes = array(); + + /** + * Constructor. + * + * @param string $value + * @param array $attributes + */ + public function __construct($value, array $attributes = array()) + { + $this->value = $value; + foreach ($attributes as $name => $value) { + $this->setAttribute($name, $value); + } + } + + /** + * Builds an AcceptHeaderInstance instance from a string. + * + * @param string $itemValue + * + * @return AcceptHeaderItem + */ + public static function fromString($itemValue) + { + $bits = preg_split('/\s*(?:;*("[^"]+");*|;*(\'[^\']+\');*|;+)\s*/', $itemValue, 0, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); + $value = array_shift($bits); + $attributes = array(); + + $lastNullAttribute = null; + foreach ($bits as $bit) { + if (($start = substr($bit, 0, 1)) === ($end = substr($bit, -1)) && ($start === '"' || $start === '\'')) { + $attributes[$lastNullAttribute] = substr($bit, 1, -1); + } elseif ('=' === $end) { + $lastNullAttribute = $bit = substr($bit, 0, -1); + $attributes[$bit] = null; + } else { + $parts = explode('=', $bit); + $attributes[$parts[0]] = isset($parts[1]) && strlen($parts[1]) > 0 ? $parts[1] : ''; + } + } + + return new self(($start = substr($value, 0, 1)) === ($end = substr($value, -1)) && ($start === '"' || $start === '\'') ? substr($value, 1, -1) : $value, $attributes); + } + + /** + * Returns header value's string representation. + * + * @return string + */ + public function __toString() + { + $string = $this->value.($this->quality < 1 ? ';q='.$this->quality : ''); + if (count($this->attributes) > 0) { + $string .= ';'.implode(';', array_map(function($name, $value) { + return sprintf(preg_match('/[,;=]/', $value) ? '%s="%s"' : '%s=%s', $name, $value); + }, array_keys($this->attributes), $this->attributes)); + } + + return $string; + } + + /** + * Set the item value. + * + * @param string $value + * + * @return AcceptHeaderItem + */ + public function setValue($value) + { + $this->value = $value; + + return $this; + } + + /** + * Returns the item value. + * + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * Set the item quality. + * + * @param float $quality + * + * @return AcceptHeaderItem + */ + public function setQuality($quality) + { + $this->quality = $quality; + + return $this; + } + + /** + * Returns the item quality. + * + * @return float + */ + public function getQuality() + { + return $this->quality; + } + + /** + * Set the item index. + * + * @param int $index + * + * @return AcceptHeaderItem + */ + public function setIndex($index) + { + $this->index = $index; + + return $this; + } + + /** + * Returns the item index. + * + * @return int + */ + public function getIndex() + { + return $this->index; + } + + /** + * Tests if an attribute exists. + * + * @param string $name + * + * @return Boolean + */ + public function hasAttribute($name) + { + return isset($this->attributes[$name]); + } + + /** + * Returns an attribute by its name. + * + * @param string $name + * @param mixed $default + * + * @return mixed + */ + public function getAttribute($name, $default = null) + { + return isset($this->attributes[$name]) ? $this->attributes[$name] : $default; + } + + /** + * Returns all attributes. + * + * @return array + */ + public function getAttributes() + { + return $this->attributes; + } + + /** + * Set an attribute. + * + * @param string $name + * @param string $value + * + * @return AcceptHeaderItem + */ + public function setAttribute($name, $value) + { + if ('q' === $name) { + $this->quality = (float) $value; + } else { + $this->attributes[$name] = (string) $value; + } + + return $this; + } +} diff --git a/laravel/vendor/Symfony/Component/HttpFoundation/BinaryFileResponse.php b/laravel/vendor/Symfony/Component/HttpFoundation/BinaryFileResponse.php new file mode 100644 index 00000000..cb6c8a1e --- /dev/null +++ b/laravel/vendor/Symfony/Component/HttpFoundation/BinaryFileResponse.php @@ -0,0 +1,278 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpFoundation; + +use Symfony\Component\HttpFoundation\File\File; +use Symfony\Component\HttpFoundation\File\Exception\FileException; + +/** + * BinaryFileResponse represents an HTTP response delivering a file. + * + * @author Niklas Fiekas + * @author stealth35 + * @author Igor Wiedler + * @author Jordan Alliot + * @author Sergey Linnik + */ +class BinaryFileResponse extends Response +{ + protected static $trustXSendfileTypeHeader = false; + + protected $file; + protected $offset; + protected $maxlen; + + /** + * Constructor. + * + * @param SplFileInfo|string $file The file to stream + * @param integer $status The response status code + * @param array $headers An array of response headers + * @param boolean $public Files are public by default + * @param null|string $contentDisposition The type of Content-Disposition to set automatically with the filename + * @param boolean $autoEtag Whether the ETag header should be automatically set + * @param boolean $autoLastModified Whether the Last-Modified header should be automatically set + */ + public function __construct($file, $status = 200, $headers = array(), $public = true, $contentDisposition = null, $autoEtag = false, $autoLastModified = true) + { + parent::__construct(null, $status, $headers); + + $this->setFile($file, $contentDisposition, $autoEtag, $autoLastModified); + + if ($public) { + $this->setPublic(); + } + } + + /** + * {@inheritdoc} + */ + public static function create($file = null, $status = 200, $headers = array(), $public = true, $contentDisposition = null, $autoEtag = false, $autoLastModified = true) + { + return new static($file, $status, $headers, $public, $contentDisposition, $autoEtag, $autoLastModified); + } + + /** + * Sets the file to stream. + * + * @param SplFileInfo|string $file The file to stream + * @param string $contentDisposition + * @param Boolean $autoEtag + * @param Boolean $autoLastModified + * + * @return BinaryFileResponse + * + * @throws FileException + */ + public function setFile($file, $contentDisposition = null, $autoEtag = false, $autoLastModified = true) + { + $file = new File((string) $file); + + if (!$file->isReadable()) { + throw new FileException('File must be readable.'); + } + + $this->file = $file; + + if ($autoEtag) { + $this->setAutoEtag(); + } + + if ($autoLastModified) { + $this->setAutoLastModified(); + } + + if ($contentDisposition) { + $this->setContentDisposition($contentDisposition); + } + + return $this; + } + + /** + * Gets the file. + * + * @return File The file to stream + */ + public function getFile() + { + return $this->file; + } + + /** + * Automatically sets the Last-Modified header according the file modification date. + */ + public function setAutoLastModified() + { + $this->setLastModified(\DateTime::createFromFormat('U', $this->file->getMTime())); + + return $this; + } + + /** + * Automatically sets the ETag header according to the checksum of the file. + */ + public function setAutoEtag() + { + $this->setEtag(sha1_file($this->file->getPathname())); + + return $this; + } + + /** + * Sets the Content-Disposition header with the given filename. + * + * @param string $disposition ResponseHeaderBag::DISPOSITION_INLINE or ResponseHeaderBag::DISPOSITION_ATTACHMENT + * @param string $filename Optionally use this filename instead of the real name of the file + * @param string $filenameFallback A fallback filename, containing only ASCII characters. Defaults to an automatically encoded filename + * + * @return BinaryFileResponse + */ + public function setContentDisposition($disposition, $filename = '', $filenameFallback = '') + { + if ($filename === '') { + $filename = $this->file->getFilename(); + } + + $dispositionHeader = $this->headers->makeDisposition($disposition, $filename, $filenameFallback); + $this->headers->set('Content-Disposition', $dispositionHeader); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function prepare(Request $request) + { + $this->headers->set('Content-Length', $this->file->getSize()); + $this->headers->set('Accept-Ranges', 'bytes'); + $this->headers->set('Content-Transfer-Encoding', 'binary'); + + if (!$this->headers->has('Content-Type')) { + $this->headers->set('Content-Type', $this->file->getMimeType() ?: 'application/octet-stream'); + } + + if ('HTTP/1.0' != $request->server->get('SERVER_PROTOCOL')) { + $this->setProtocolVersion('1.1'); + } + + $this->offset = 0; + $this->maxlen = -1; + + if (self::$trustXSendfileTypeHeader && $request->headers->has('X-Sendfile-Type')) { + // Use X-Sendfile, do not send any content. + $type = $request->headers->get('X-Sendfile-Type'); + $path = $this->file->getRealPath(); + if (strtolower($type) == 'x-accel-redirect') { + // Do X-Accel-Mapping substitutions. + foreach (explode(',', $request->headers->get('X-Accel-Mapping', '')) as $mapping) { + $mapping = explode('=', $mapping, 2); + + if (2 == count($mapping)) { + $location = trim($mapping[0]); + $pathPrefix = trim($mapping[1]); + + if (substr($path, 0, strlen($pathPrefix)) == $pathPrefix) { + $path = $location . substr($path, strlen($pathPrefix)); + break; + } + } + } + } + $this->headers->set($type, $path); + $this->maxlen = 0; + } elseif ($request->headers->has('Range')) { + // Process the range headers. + if (!$request->headers->has('If-Range') || $this->getEtag() == $request->headers->get('If-Range')) { + $range = $request->headers->get('Range'); + $fileSize = $this->file->getSize(); + + list($start, $end) = explode('-', substr($range, 6), 2) + array(0); + + $end = ('' === $end) ? $fileSize - 1 : (int) $end; + + if ('' === $start) { + $start = $fileSize - $end; + $end = $fileSize - 1; + } else { + $start = (int) $start; + } + + $start = max($start, 0); + $end = min($end, $fileSize - 1); + + $this->maxlen = $end < $fileSize ? $end - $start + 1 : -1; + $this->offset = $start; + + $this->setStatusCode(206); + $this->headers->set('Content-Range', sprintf('bytes %s-%s/%s', $start, $end, $fileSize)); + } + } + + return $this; + } + + /** + * Sends the file. + */ + public function sendContent() + { + if (!$this->isSuccessful()) { + parent::sendContent(); + + return; + } + + if (0 === $this->maxlen) { + return; + } + + $out = fopen('php://output', 'wb'); + $file = fopen($this->file->getPathname(), 'rb'); + + stream_copy_to_stream($file, $out, $this->maxlen, $this->offset); + + fclose($out); + fclose($file); + } + + /** + * {@inheritdoc} + * + * @throws \LogicException when the content is not null + */ + public function setContent($content) + { + if (null !== $content) { + throw new \LogicException('The content cannot be set on a BinaryFileResponse instance.'); + } + } + + /** + * {@inheritdoc} + * + * @return false + */ + public function getContent() + { + return false; + } + + /** + * Trust X-Sendfile-Type header. + */ + public static function trustXSendfileTypeHeader() + { + self::$trustXSendfileTypeHeader = true; + } +} diff --git a/laravel/vendor/Symfony/Component/HttpFoundation/CHANGELOG.md b/laravel/vendor/Symfony/Component/HttpFoundation/CHANGELOG.md index 4a00207e..318383aa 100755 --- a/laravel/vendor/Symfony/Component/HttpFoundation/CHANGELOG.md +++ b/laravel/vendor/Symfony/Component/HttpFoundation/CHANGELOG.md @@ -1,6 +1,20 @@ CHANGELOG ========= +2.2.0 +----- + + * fixed the Request::create() precedence (URI information always take precedence now) + * added Request::getTrustedProxies() + * deprecated Request::isProxyTrusted() + * [BC BREAK] JsonResponse does not turn a top level empty array to an object anymore, use an ArrayObject to enforce objects + * added a IpUtils class to check if an IP belongs to a CIDR + * added Request::getRealMethod() to get the "real" HTTP method (getMethod() returns the "intended" HTTP method) + * disabled _method request parameter support by default (call Request::enableHttpMethodParameterOverride() to + enable it, and Request::getHttpMethodParameterOverride() to check if it is supported) + * Request::splitHttpAcceptHeader() method is deprecated and will be removed in 2.3 + * Deprecated Flashbag::count() and \Countable interface, will be removed in 2.3 + 2.1.0 ----- diff --git a/laravel/vendor/Symfony/Component/HttpFoundation/Cookie.php b/laravel/vendor/Symfony/Component/HttpFoundation/Cookie.php index fe3a4cff..fdc33e36 100755 --- a/laravel/vendor/Symfony/Component/HttpFoundation/Cookie.php +++ b/laravel/vendor/Symfony/Component/HttpFoundation/Cookie.php @@ -39,6 +39,8 @@ class Cookie * @param Boolean $secure Whether the cookie should only be transmitted over a secure HTTPS connection from the client * @param Boolean $httpOnly Whether the cookie will be made accessible only through the HTTP protocol * + * @throws \InvalidArgumentException + * * @api */ public function __construct($name, $value = null, $expire = 0, $path = '/', $domain = null, $secure = false, $httpOnly = true) diff --git a/laravel/vendor/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php b/laravel/vendor/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php index 3da63dd4..f23ddd2f 100755 --- a/laravel/vendor/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php +++ b/laravel/vendor/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php @@ -45,7 +45,7 @@ public function __construct($cmd = 'file -b --mime %s 2>/dev/null') */ public static function isSupported() { - return !defined('PHP_WINDOWS_VERSION_BUILD'); + return !defined('PHP_WINDOWS_VERSION_BUILD') && function_exists('passthru') && function_exists('escapeshellarg'); } /** @@ -77,7 +77,7 @@ public function guess($path) $type = trim(ob_get_clean()); - if (!preg_match('#^([a-z0-9\-]+/[a-z0-9\-]+)#i', $type, $match)) { + if (!preg_match('#^([a-z0-9\-]+/[a-z0-9\-\.]+)#i', $type, $match)) { // it's not a type, but an error message return null; } diff --git a/laravel/vendor/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php b/laravel/vendor/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php index a8247ab4..59ddc077 100755 --- a/laravel/vendor/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php +++ b/laravel/vendor/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php @@ -11,7 +11,6 @@ namespace Symfony\Component\HttpFoundation\File\MimeType; -use Symfony\Component\HttpFoundation\File\Exception\FileException; use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException; use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException; @@ -99,7 +98,9 @@ public function register(MimeTypeGuesserInterface $guesser) * * @return string The mime type or NULL, if none could be guessed * - * @throws FileException If the file does not exist + * @throws \LogicException + * @throws FileNotFoundException + * @throws AccessDeniedException */ public function guess($path) { diff --git a/laravel/vendor/Symfony/Component/HttpFoundation/File/UploadedFile.php b/laravel/vendor/Symfony/Component/HttpFoundation/File/UploadedFile.php index d201e2dc..63c5386a 100755 --- a/laravel/vendor/Symfony/Component/HttpFoundation/File/UploadedFile.php +++ b/laravel/vendor/Symfony/Component/HttpFoundation/File/UploadedFile.php @@ -118,6 +118,19 @@ public function getClientOriginalName() return $this->originalName; } + /** + * Returns the original file extension + * + * It is extracted from the original file name that was uploaded. + * Then is should not be considered as a safe value. + * + * @return string The extension + */ + public function getClientOriginalExtension() + { + return pathinfo($this->originalName, PATHINFO_EXTENSION); + } + /** * Returns the file mime type. * diff --git a/laravel/vendor/Symfony/Component/HttpFoundation/HeaderBag.php b/laravel/vendor/Symfony/Component/HttpFoundation/HeaderBag.php index 2360e55b..b579eb99 100755 --- a/laravel/vendor/Symfony/Component/HttpFoundation/HeaderBag.php +++ b/laravel/vendor/Symfony/Component/HttpFoundation/HeaderBag.php @@ -149,7 +149,7 @@ public function get($key, $default = null, $first = true) * * @param string $key The key * @param string|array $values The value or an array of values - * @param Boolean $replace Whether to replace the actual value of not (true by default) + * @param Boolean $replace Whether to replace the actual value or not (true by default) * * @api */ @@ -223,7 +223,7 @@ public function remove($key) * @param string $key The parameter key * @param \DateTime $default The default value * - * @return null|\DateTime The filtered value + * @return null|\DateTime The parsed DateTime or the default value if the header does not exist * * @throws \RuntimeException When the HTTP header is not parseable * diff --git a/laravel/vendor/Symfony/Component/HttpFoundation/IpUtils.php b/laravel/vendor/Symfony/Component/HttpFoundation/IpUtils.php new file mode 100644 index 00000000..2e3e1aa7 --- /dev/null +++ b/laravel/vendor/Symfony/Component/HttpFoundation/IpUtils.php @@ -0,0 +1,111 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpFoundation; + +/** + * Http utility functions. + * + * @author Fabien Potencier + */ +class IpUtils +{ + /** + * This class should not be instantiated + */ + private function __construct() {} + + /** + * Validates an IPv4 or IPv6 address. + * + * @param string $requestIp + * @param string $ip + * + * @return boolean Whether the IP is valid + */ + public static function checkIp($requestIp, $ip) + { + if (false !== strpos($requestIp, ':')) { + return self::checkIp6($requestIp, $ip); + } + + return self::checkIp4($requestIp, $ip); + } + + /** + * Validates an IPv4 address. + * + * @param string $requestIp + * @param string $ip + * + * @return boolean Whether the IP is valid + */ + public static function checkIp4($requestIp, $ip) + { + if (false !== strpos($ip, '/')) { + list($address, $netmask) = explode('/', $ip, 2); + + if ($netmask < 1 || $netmask > 32) { + return false; + } + } else { + $address = $ip; + $netmask = 32; + } + + return 0 === substr_compare(sprintf('%032b', ip2long($requestIp)), sprintf('%032b', ip2long($address)), 0, $netmask); + } + + /** + * Validates an IPv6 address. + * + * @author David Soria Parra + * @see https://github.com/dsp/v6tools + * + * @param string $requestIp + * @param string $ip + * + * @return boolean Whether the IP is valid + * + * @throws \RuntimeException When IPV6 support is not enabled + */ + public static function checkIp6($requestIp, $ip) + { + if (!((extension_loaded('sockets') && defined('AF_INET6')) || @inet_pton('::1'))) { + throw new \RuntimeException('Unable to check Ipv6. Check that PHP was not compiled with option "disable-ipv6".'); + } + + if (false !== strpos($ip, '/')) { + list($address, $netmask) = explode('/', $ip, 2); + + if ($netmask < 1 || $netmask > 128) { + return false; + } + } else { + $address = $ip; + $netmask = 128; + } + + $bytesAddr = unpack("n*", inet_pton($address)); + $bytesTest = unpack("n*", inet_pton($requestIp)); + + for ($i = 1, $ceil = ceil($netmask / 16); $i <= $ceil; $i++) { + $left = $netmask - 16 * ($i-1); + $left = ($left <= 16) ? $left : 16; + $mask = ~(0xffff >> $left) & 0xffff; + if (($bytesAddr[$i] & $mask) != ($bytesTest[$i] & $mask)) { + return false; + } + } + + return true; + } +} diff --git a/laravel/vendor/Symfony/Component/HttpFoundation/JsonResponse.php b/laravel/vendor/Symfony/Component/HttpFoundation/JsonResponse.php index 29b4cc7b..b6ac8017 100755 --- a/laravel/vendor/Symfony/Component/HttpFoundation/JsonResponse.php +++ b/laravel/vendor/Symfony/Component/HttpFoundation/JsonResponse.php @@ -28,17 +28,20 @@ class JsonResponse extends Response * @param integer $status The response status code * @param array $headers An array of response headers */ - public function __construct($data = array(), $status = 200, $headers = array()) + public function __construct($data = null, $status = 200, $headers = array()) { parent::__construct('', $status, $headers); + if (null === $data) { + $data = new \ArrayObject(); + } $this->setData($data); } /** * {@inheritDoc} */ - public static function create($data = array(), $status = 200, $headers = array()) + public static function create($data = null, $status = 200, $headers = array()) { return new static($data, $status, $headers); } @@ -49,6 +52,8 @@ public static function create($data = array(), $status = 200, $headers = array() * @param string $callback * * @return JsonResponse + * + * @throws \InvalidArgumentException */ public function setCallback($callback = null) { @@ -77,11 +82,6 @@ public function setCallback($callback = null) */ public function setData($data = array()) { - // root should be JSON object, not array - if (is_array($data) && 0 === count($data)) { - $data = new \ArrayObject(); - } - // Encode <, >, ', &, and " for RFC4627-compliant JSON, which may also be embedded into HTML. $this->data = json_encode($data, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT); diff --git a/laravel/vendor/Symfony/Component/HttpFoundation/LICENSE b/laravel/vendor/Symfony/Component/HttpFoundation/LICENSE index cdffe7ae..88a57f8d 100755 --- a/laravel/vendor/Symfony/Component/HttpFoundation/LICENSE +++ b/laravel/vendor/Symfony/Component/HttpFoundation/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2012 Fabien Potencier +Copyright (c) 2004-2013 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/laravel/vendor/Symfony/Component/HttpFoundation/ParameterBag.php b/laravel/vendor/Symfony/Component/HttpFoundation/ParameterBag.php index 0273d933..c8720cdc 100755 --- a/laravel/vendor/Symfony/Component/HttpFoundation/ParameterBag.php +++ b/laravel/vendor/Symfony/Component/HttpFoundation/ParameterBag.php @@ -96,6 +96,8 @@ public function add(array $parameters = array()) * * @return mixed * + * @throws \InvalidArgumentException + * * @api */ public function get($path, $default = null, $deep = false) diff --git a/laravel/vendor/Symfony/Component/HttpFoundation/README.md b/laravel/vendor/Symfony/Component/HttpFoundation/README.md index bb6f02c4..ed49b4e1 100755 --- a/laravel/vendor/Symfony/Component/HttpFoundation/README.md +++ b/laravel/vendor/Symfony/Component/HttpFoundation/README.md @@ -31,7 +31,7 @@ Loading ------- -If you are using PHP 5.3.x you must add the following to your autoloader: +If you are not using Composer but are using PHP 5.3.x, you must add the following to your autoloader: // SessionHandlerInterface if (!interface_exists('SessionHandlerInterface')) { @@ -43,4 +43,6 @@ You can run the unit tests with the following command: - phpunit + $ cd path/to/Symfony/Component/HttpFoundation/ + $ composer.phar install --dev + $ phpunit diff --git a/laravel/vendor/Symfony/Component/HttpFoundation/RedirectResponse.php b/laravel/vendor/Symfony/Component/HttpFoundation/RedirectResponse.php index a9d98e6b..54f57216 100755 --- a/laravel/vendor/Symfony/Component/HttpFoundation/RedirectResponse.php +++ b/laravel/vendor/Symfony/Component/HttpFoundation/RedirectResponse.php @@ -29,6 +29,8 @@ class RedirectResponse extends Response * @param integer $status The status code (302 by default) * @param array $headers The headers (Location is always set to the given url) * + * @throws \InvalidArgumentException + * * @see http://tools.ietf.org/html/rfc2616#section-10.3 * * @api @@ -72,6 +74,8 @@ public function getTargetUrl() * @param string $url The URL to redirect to * * @return RedirectResponse The current response. + * + * @throws \InvalidArgumentException */ public function setTargetUrl($url) { diff --git a/laravel/vendor/Symfony/Component/HttpFoundation/Request.php b/laravel/vendor/Symfony/Component/HttpFoundation/Request.php index 18e5480c..c48082a6 100755 --- a/laravel/vendor/Symfony/Component/HttpFoundation/Request.php +++ b/laravel/vendor/Symfony/Component/HttpFoundation/Request.php @@ -30,10 +30,10 @@ */ class Request { - const HEADER_CLIENT_IP = 'client_ip'; - const HEADER_CLIENT_HOST = 'client_host'; + const HEADER_CLIENT_IP = 'client_ip'; + const HEADER_CLIENT_HOST = 'client_host'; const HEADER_CLIENT_PROTO = 'client_proto'; - const HEADER_CLIENT_PORT = 'client_port'; + const HEADER_CLIENT_PORT = 'client_port'; protected static $trustProxy = false; @@ -53,6 +53,8 @@ class Request self::HEADER_CLIENT_PORT => 'X_FORWARDED_PORT', ); + protected static $httpMethodParameterOverride = false; + /** * @var \Symfony\Component\HttpFoundation\ParameterBag * @@ -251,6 +253,9 @@ public static function createFromGlobals() /** * Creates a Request based on a given URI and configuration. * + * The information contained in the URI always take precedence + * over the other information (server and parameters). + * * @param string $uri The URI * @param string $method The HTTP method * @param array $parameters The query (GET) or request (POST) parameters @@ -265,7 +270,7 @@ public static function createFromGlobals() */ public static function create($uri, $method = 'GET', $parameters = array(), $cookies = array(), $files = array(), $server = array(), $content = null) { - $defaults = array( + $server = array_replace(array( 'SERVER_NAME' => 'localhost', 'SERVER_PORT' => 80, 'HTTP_HOST' => 'localhost', @@ -278,32 +283,38 @@ public static function create($uri, $method = 'GET', $parameters = array(), $coo 'SCRIPT_FILENAME' => '', 'SERVER_PROTOCOL' => 'HTTP/1.1', 'REQUEST_TIME' => time(), - ); + ), $server); + + $server['PATH_INFO'] = ''; + $server['REQUEST_METHOD'] = strtoupper($method); $components = parse_url($uri); if (isset($components['host'])) { - $defaults['SERVER_NAME'] = $components['host']; - $defaults['HTTP_HOST'] = $components['host']; + $server['SERVER_NAME'] = $components['host']; + $server['HTTP_HOST'] = $components['host']; } if (isset($components['scheme'])) { if ('https' === $components['scheme']) { - $defaults['HTTPS'] = 'on'; - $defaults['SERVER_PORT'] = 443; + $server['HTTPS'] = 'on'; + $server['SERVER_PORT'] = 443; + } else { + unset($server['HTTPS']); + $server['SERVER_PORT'] = 80; } } if (isset($components['port'])) { - $defaults['SERVER_PORT'] = $components['port']; - $defaults['HTTP_HOST'] = $defaults['HTTP_HOST'].':'.$components['port']; + $server['SERVER_PORT'] = $components['port']; + $server['HTTP_HOST'] = $server['HTTP_HOST'].':'.$components['port']; } if (isset($components['user'])) { - $defaults['PHP_AUTH_USER'] = $components['user']; + $server['PHP_AUTH_USER'] = $components['user']; } if (isset($components['pass'])) { - $defaults['PHP_AUTH_PW'] = $components['pass']; + $server['PHP_AUTH_PW'] = $components['pass']; } if (!isset($components['path'])) { @@ -314,7 +325,9 @@ public static function create($uri, $method = 'GET', $parameters = array(), $coo case 'POST': case 'PUT': case 'DELETE': - $defaults['CONTENT_TYPE'] = 'application/x-www-form-urlencoded'; + if (!isset($server['CONTENT_TYPE'])) { + $server['CONTENT_TYPE'] = 'application/x-www-form-urlencoded'; + } case 'PATCH': $request = $parameters; $query = array(); @@ -331,14 +344,8 @@ public static function create($uri, $method = 'GET', $parameters = array(), $coo } $queryString = http_build_query($query, '', '&'); - $uri = $components['path'].('' !== $queryString ? '?'.$queryString : ''); - - $server = array_replace($defaults, $server, array( - 'REQUEST_METHOD' => strtoupper($method), - 'PATH_INFO' => '', - 'REQUEST_URI' => $uri, - 'QUERY_STRING' => $queryString, - )); + $server['REQUEST_URI'] = $components['path'].('' !== $queryString ? '?'.$queryString : ''); + $server['QUERY_STRING'] = $queryString; return new static($query, $request, array(), $cookies, $files, $server, $content); } @@ -464,6 +471,8 @@ public function overrideGlobals() */ public static function trustProxyData() { + trigger_error('trustProxyData() is deprecated since version 2.0 and will be removed in 2.3. Use setTrustedProxies() instead.', E_USER_DEPRECATED); + self::$trustProxy = true; } @@ -482,6 +491,16 @@ public static function setTrustedProxies(array $proxies) self::$trustProxy = $proxies ? true : false; } + /** + * Gets the list of trusted proxies. + * + * @return array An array of trusted proxies. + */ + public static function getTrustedProxies() + { + return self::$trustedProxies; + } + /** * Sets the name for trusted headers. * @@ -496,6 +515,8 @@ public static function setTrustedProxies(array $proxies) * * @param string $key The header key * @param string $value The header name + * + * @throws \InvalidArgumentException */ public static function setTrustedHeaderName($key, $value) { @@ -511,6 +532,8 @@ public static function setTrustedHeaderName($key, $value) * false otherwise. * * @return boolean + * + * @deprecated Deprecated since version 2.2, to be removed in 2.3. Use getTrustedProxies instead. */ public static function isProxyTrusted() { @@ -560,6 +583,29 @@ public static function normalizeQueryString($qs) return implode('&', $parts); } + /** + * Enables support for the _method request parameter to determine the intended HTTP method. + * + * Be warned that enabling this feature might lead to CSRF issues in your code. + * Check that you are using CSRF tokens when required. + * + * The HTTP method can only be overridden when the real HTTP method is POST. + */ + public static function enableHttpMethodParameterOverride() + { + self::$httpMethodParameterOverride = true; + } + + /** + * Checks whether support for the _method request parameter is enabled. + * + * @return Boolean True when the _method request parameter is enabled, false otherwise + */ + public static function getHttpMethodParameterOverride() + { + return self::$httpMethodParameterOverride; + } + /** * Gets a "parameter" value. * @@ -657,8 +703,6 @@ public function setSession(SessionInterface $session) * * @see http://en.wikipedia.org/wiki/X-Forwarded-For * - * @deprecated The proxy argument is deprecated since version 2.0 and will be removed in 2.3. Use setTrustedProxies instead. - * * @api */ public function getClientIp() @@ -703,7 +747,7 @@ public function getScriptName() * * * http://localhost/mysite returns an empty string * * http://localhost/mysite/about returns '/about' - * * htpp://localhost/mysite/enco%20ded returns '/enco%20ded' + * * http://localhost/mysite/enco%20ded returns '/enco%20ded' * * http://localhost/mysite/about?var=1 returns '/about' * * @return string The raw path (i.e. not urldecoded) @@ -897,8 +941,7 @@ public function getSchemeAndHttpHost() */ public function getUri() { - $qs = $this->getQueryString(); - if (null !== $qs) { + if (null !== $qs = $this->getQueryString()) { $qs = '?'.$qs; } @@ -1017,26 +1060,51 @@ public function setMethod($method) } /** - * Gets the request method. + * Gets the request "intended" method. + * + * If the X-HTTP-Method-Override header is set, and if the method is a POST, + * then it is used to determine the "real" intended HTTP method. + * + * The _method request parameter can also be used to determine the HTTP method, + * but only if enableHttpMethodParameterOverride() has been called. * * The method is always an uppercased string. * * @return string The request method * * @api + * + * @see getRealMethod */ public function getMethod() { if (null === $this->method) { $this->method = strtoupper($this->server->get('REQUEST_METHOD', 'GET')); + if ('POST' === $this->method) { - $this->method = strtoupper($this->headers->get('X-HTTP-METHOD-OVERRIDE', $this->request->get('_method', $this->query->get('_method', 'POST')))); + if ($method = $this->headers->get('X-HTTP-METHOD-OVERRIDE')) { + $this->method = strtoupper($method); + } elseif (self::$httpMethodParameterOverride) { + $this->method = strtoupper($this->request->get('_method', $this->query->get('_method', 'POST'))); + } } } return $this->method; } + /** + * Gets the "real" request method. + * + * @return string The request method + * + * @see getMethod + */ + public function getRealMethod() + { + return strtoupper($this->server->get('REQUEST_METHOD', 'GET')); + } + /** * Gets the mime type associated with the format. * @@ -1216,6 +1284,8 @@ public function isMethodSafe() * @param Boolean $asResource If true, a resource will be returned * * @return string|resource The request body content or a resource to read the body stream. + * + * @throws \LogicException */ public function getContent($asResource = false) { @@ -1275,7 +1345,18 @@ public function getPreferredLanguage(array $locales = null) return $locales[0]; } - $preferredLanguages = array_values(array_intersect($preferredLanguages, $locales)); + $extendedPreferredLanguages = array(); + foreach ($preferredLanguages as $language) { + $extendedPreferredLanguages[] = $language; + if (false !== $position = strpos($language, '_')) { + $superLanguage = substr($language, 0, $position); + if (!in_array($superLanguage, $preferredLanguages)) { + $extendedPreferredLanguages[] = $superLanguage; + } + } + } + + $preferredLanguages = array_values(array_intersect($extendedPreferredLanguages, $locales)); return isset($preferredLanguages[0]) ? $preferredLanguages[0] : $locales[0]; } @@ -1293,9 +1374,9 @@ public function getLanguages() return $this->languages; } - $languages = $this->splitHttpAcceptHeader($this->headers->get('Accept-Language')); + $languages = AcceptHeader::fromString($this->headers->get('Accept-Language'))->all(); $this->languages = array(); - foreach ($languages as $lang => $q) { + foreach (array_keys($languages) as $lang) { if (strstr($lang, '-')) { $codes = explode('-', $lang); if ($codes[0] == 'i') { @@ -1335,7 +1416,7 @@ public function getCharsets() return $this->charsets; } - return $this->charsets = array_keys($this->splitHttpAcceptHeader($this->headers->get('Accept-Charset'))); + return $this->charsets = array_keys(AcceptHeader::fromString($this->headers->get('Accept-Charset'))->all()); } /** @@ -1351,14 +1432,15 @@ public function getAcceptableContentTypes() return $this->acceptableContentTypes; } - return $this->acceptableContentTypes = array_keys($this->splitHttpAcceptHeader($this->headers->get('Accept'))); + return $this->acceptableContentTypes = array_keys(AcceptHeader::fromString($this->headers->get('Accept'))->all()); } /** * Returns true if the request is a XMLHttpRequest. * * It works if your JavaScript library set an X-Requested-With HTTP header. - * It is known to work with Prototype, Mootools, jQuery. + * It is known to work with common JavaScript frameworks: + * @link http://en.wikipedia.org/wiki/List_of_Ajax_frameworks#JavaScript * * @return Boolean true if the request is an XMLHttpRequest, false otherwise * @@ -1375,40 +1457,23 @@ public function isXmlHttpRequest() * @param string $header Header to split * * @return array Array indexed by the values of the Accept-* header in preferred order + * + * @deprecated Deprecated since version 2.2, to be removed in 2.3. */ public function splitHttpAcceptHeader($header) { - if (!$header) { - return array(); - } + trigger_error('splitHttpAcceptHeader() is deprecated since version 2.2 and will be removed in 2.3.', E_USER_DEPRECATED); - $values = array(); - $groups = array(); - foreach (array_filter(explode(',', $header)) as $value) { - // Cut off any q-value that might come after a semi-colon - if (preg_match('/;\s*(q=.*$)/', $value, $match)) { - $q = substr(trim($match[1]), 2); - $value = trim(substr($value, 0, -strlen($match[0]))); - } else { - $q = 1; + $headers = array(); + foreach (AcceptHeader::fromString($header)->all() as $item) { + $key = $item->getValue(); + foreach ($item->getAttributes() as $name => $value) { + $key .= sprintf(';%s=%s', $name, $value); } - - $groups[$q][] = $value; + $headers[$key] = $item->getQuality(); } - krsort($groups); - - foreach ($groups as $q => $items) { - $q = (float) $q; - - if (0 < $q) { - foreach ($items as $value) { - $values[trim($value)] = $q; - } - } - } - - return $values; + return $headers; } /* @@ -1426,12 +1491,16 @@ protected function prepareRequestUri() if ($this->headers->has('X_ORIGINAL_URL') && false !== stripos(PHP_OS, 'WIN')) { // IIS with Microsoft Rewrite Module $requestUri = $this->headers->get('X_ORIGINAL_URL'); + $this->headers->remove('X_ORIGINAL_URL'); } elseif ($this->headers->has('X_REWRITE_URL') && false !== stripos(PHP_OS, 'WIN')) { // IIS with ISAPI_Rewrite $requestUri = $this->headers->get('X_REWRITE_URL'); + $this->headers->remove('X_REWRITE_URL'); } elseif ($this->server->get('IIS_WasUrlRewritten') == '1' && $this->server->get('UNENCODED_URL') != '') { // IIS7 with URL Rewrite: make sure we get the unencoded url (double slash problem) $requestUri = $this->server->get('UNENCODED_URL'); + $this->server->remove('UNENCODED_URL'); + $this->server->remove('IIS_WasUrlRewritten'); } elseif ($this->server->has('REQUEST_URI')) { $requestUri = $this->server->get('REQUEST_URI'); // HTTP proxy reqs setup request uri with scheme and host [and port] + the url path, only use url path @@ -1445,8 +1514,12 @@ protected function prepareRequestUri() if ('' != $this->server->get('QUERY_STRING')) { $requestUri .= '?'.$this->server->get('QUERY_STRING'); } + $this->server->remove('ORIG_PATH_INFO'); } + // normalize the request URI to ease creating sub-requests from this request + $this->server->set('REQUEST_URI', $requestUri); + return $requestUri; } diff --git a/laravel/vendor/Symfony/Component/HttpFoundation/RequestMatcher.php b/laravel/vendor/Symfony/Component/HttpFoundation/RequestMatcher.php index 7ebae28b..49b92f0e 100755 --- a/laravel/vendor/Symfony/Component/HttpFoundation/RequestMatcher.php +++ b/laravel/vendor/Symfony/Component/HttpFoundation/RequestMatcher.php @@ -143,95 +143,10 @@ public function matches(Request $request) return false; } - if (null !== $this->ip && !$this->checkIp($request->getClientIp(), $this->ip)) { + if (null !== $this->ip && !IpUtils::checkIp($request->getClientIp(), $this->ip)) { return false; } return true; } - - /** - * Validates an IP address. - * - * @param string $requestIp - * @param string $ip - * - * @return boolean True valid, false if not. - */ - protected function checkIp($requestIp, $ip) - { - // IPv6 address - if (false !== strpos($requestIp, ':')) { - return $this->checkIp6($requestIp, $ip); - } else { - return $this->checkIp4($requestIp, $ip); - } - } - - /** - * Validates an IPv4 address. - * - * @param string $requestIp - * @param string $ip - * - * @return boolean True valid, false if not. - */ - protected function checkIp4($requestIp, $ip) - { - if (false !== strpos($ip, '/')) { - list($address, $netmask) = explode('/', $ip, 2); - - if ($netmask < 1 || $netmask > 32) { - return false; - } - } else { - $address = $ip; - $netmask = 32; - } - - return 0 === substr_compare(sprintf('%032b', ip2long($requestIp)), sprintf('%032b', ip2long($address)), 0, $netmask); - } - - /** - * Validates an IPv6 address. - * - * @author David Soria Parra - * @see https://github.com/dsp/v6tools - * - * @param string $requestIp - * @param string $ip - * - * @return boolean True valid, false if not. - */ - protected function checkIp6($requestIp, $ip) - { - if (!((extension_loaded('sockets') && defined('AF_INET6')) || @inet_pton('::1'))) { - throw new \RuntimeException('Unable to check Ipv6. Check that PHP was not compiled with option "disable-ipv6".'); - } - - if (false !== strpos($ip, '/')) { - list($address, $netmask) = explode('/', $ip, 2); - - if ($netmask < 1 || $netmask > 128) { - return false; - } - } else { - $address = $ip; - $netmask = 128; - } - - $bytesAddr = unpack("n*", inet_pton($address)); - $bytesTest = unpack("n*", inet_pton($requestIp)); - - for ($i = 1, $ceil = ceil($netmask / 16); $i <= $ceil; $i++) { - $left = $netmask - 16 * ($i-1); - $left = ($left <= 16) ? $left : 16; - $mask = ~(0xffff >> $left) & 0xffff; - if (($bytesAddr[$i] & $mask) != ($bytesTest[$i] & $mask)) { - return false; - } - } - - return true; - } } diff --git a/laravel/vendor/Symfony/Component/HttpFoundation/Response.php b/laravel/vendor/Symfony/Component/HttpFoundation/Response.php index 7428b9a9..7ac4e800 100755 --- a/laravel/vendor/Symfony/Component/HttpFoundation/Response.php +++ b/laravel/vendor/Symfony/Component/HttpFoundation/Response.php @@ -131,6 +131,8 @@ class Response * @param integer $status The response status code * @param array $headers An array of response headers * + * @throws \InvalidArgumentException When the HTTP status code is not valid + * * @api */ public function __construct($content = '', $status = 200, $headers = array()) @@ -231,7 +233,7 @@ public function prepare(Request $request) $headers->remove('Content-Length'); } - if ('HEAD' === $request->getMethod()) { + if ($request->isMethod('HEAD')) { // cf. RFC2616 14.13 $length = $headers->get('Content-Length'); $this->setContent(null); @@ -251,6 +253,16 @@ public function prepare(Request $request) $this->headers->set('expires', -1); } + /** + * Check if we need to remove Cache-Control for ssl encrypted downloads when using IE < 9 + * @link http://support.microsoft.com/kb/323308 + */ + if (false !== stripos($this->headers->get('Content-Disposition'), 'attachment') && preg_match('/MSIE (.*?);/i', $request->server->get('HTTP_USER_AGENT'), $match) == 1 && true === $request->isSecure()) { + if (intval(preg_replace("/(MSIE )(.*?);/", "$2", $match[0])) < 9) { + $this->headers->remove('Cache-Control'); + } + } + return $this; } @@ -270,7 +282,7 @@ public function sendHeaders() header(sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText)); // headers - foreach ($this->headers->all() as $name => $values) { + foreach ($this->headers->allPreserveCase() as $name => $values) { foreach ($values as $value) { header($name.': '.$value, false); } @@ -336,6 +348,8 @@ public function send() * * @return Response * + * @throws \UnexpectedValueException + * * @api */ public function setContent($content) @@ -431,7 +445,7 @@ public function setStatusCode($code, $text = null) /** * Retrieves the status code for the current web response. * - * @return string Status code + * @return integer Status code * * @api */ @@ -499,7 +513,7 @@ public function isCacheable() * * Fresh responses may be served from cache without any interaction with the * origin. A response is considered fresh when it includes a Cache-Control/max-age - * indicator or Expiration header and the calculated age is less than the freshness lifetime. + * indicator or Expires header and the calculated age is less than the freshness lifetime. * * @return Boolean true if the response is fresh, false otherwise * @@ -612,8 +626,8 @@ public function setDate(\DateTime $date) */ public function getAge() { - if ($age = $this->headers->get('Age')) { - return $age; + if (null !== $age = $this->headers->get('Age')) { + return (int) $age; } return max(time() - $this->getDate()->format('U'), 0); @@ -638,21 +652,26 @@ public function expire() /** * Returns the value of the Expires header as a DateTime instance. * - * @return \DateTime A DateTime instance + * @return \DateTime|null A DateTime instance or null if the header does not exist * * @api */ public function getExpires() { - return $this->headers->getDate('Expires'); + try { + return $this->headers->getDate('Expires'); + } catch (\RuntimeException $e) { + // according to RFC 2616 invalid date formats (e.g. "0" and "-1") must be treated as in the past + return \DateTime::createFromFormat(DATE_RFC2822, 'Sat, 01 Jan 00 00:00:00 +0000'); + } } /** * Sets the Expires HTTP header with a DateTime instance. * - * If passed a null value, it removes the header. + * Passing null as value will remove the header. * - * @param \DateTime $date A \DateTime instance + * @param \DateTime|null $date A \DateTime instance or null to remove the header * * @return Response * @@ -672,7 +691,7 @@ public function setExpires(\DateTime $date = null) } /** - * Sets the number of seconds after the time specified in the response's Date + * Returns the number of seconds after the time specified in the response's Date * header when the the response should no longer be considered fresh. * * First, it checks for a s-maxage directive, then a max-age directive, and then it falls @@ -684,12 +703,12 @@ public function setExpires(\DateTime $date = null) */ public function getMaxAge() { - if ($age = $this->headers->getCacheControlDirective('s-maxage')) { - return $age; + if ($this->headers->hasCacheControlDirective('s-maxage')) { + return (int) $this->headers->getCacheControlDirective('s-maxage'); } - if ($age = $this->headers->getCacheControlDirective('max-age')) { - return $age; + if ($this->headers->hasCacheControlDirective('max-age')) { + return (int) $this->headers->getCacheControlDirective('max-age'); } if (null !== $this->getExpires()) { @@ -750,7 +769,7 @@ public function setSharedMaxAge($value) */ public function getTtl() { - if ($maxAge = $this->getMaxAge()) { + if (null !== $maxAge = $this->getMaxAge()) { return $maxAge - $this->getAge(); } @@ -796,7 +815,9 @@ public function setClientTtl($seconds) /** * Returns the Last-Modified HTTP header as a DateTime instance. * - * @return \DateTime A DateTime instance + * @return \DateTime|null A DateTime instance or null if the header does not exist + * + * @throws \RuntimeException When the HTTP header is not parseable * * @api */ @@ -808,9 +829,9 @@ public function getLastModified() /** * Sets the Last-Modified HTTP header with a DateTime instance. * - * If passed a null value, it removes the header. + * Passing null as value will remove the header. * - * @param \DateTime $date A \DateTime instance + * @param \DateTime|null $date A \DateTime instance or null to remove the header * * @return Response * @@ -832,7 +853,7 @@ public function setLastModified(\DateTime $date = null) /** * Returns the literal value of the ETag HTTP header. * - * @return string The ETag HTTP header + * @return string|null The ETag HTTP header or null if it does not exist * * @api */ @@ -844,8 +865,8 @@ public function getEtag() /** * Sets the ETag value. * - * @param string $etag The ETag unique identifier - * @param Boolean $weak Whether you want a weak ETag or not + * @param string|null $etag The ETag unique identifier or null to remove the header + * @param Boolean $weak Whether you want a weak ETag or not * * @return Response * @@ -875,6 +896,8 @@ public function setEtag($etag = null, $weak = false) * * @return Response * + * @throws \InvalidArgumentException + * * @api */ public function setCache(array $options) @@ -952,7 +975,7 @@ public function setNotModified() */ public function hasVary() { - return (Boolean) $this->headers->get('Vary'); + return null !== $this->headers->get('Vary'); } /** @@ -1108,7 +1131,7 @@ public function isOk() } /** - * Is the reponse forbidden? + * Is the response forbidden? * * @return Boolean * diff --git a/laravel/vendor/Symfony/Component/HttpFoundation/ResponseHeaderBag.php b/laravel/vendor/Symfony/Component/HttpFoundation/ResponseHeaderBag.php index c27d8116..f52f0488 100755 --- a/laravel/vendor/Symfony/Component/HttpFoundation/ResponseHeaderBag.php +++ b/laravel/vendor/Symfony/Component/HttpFoundation/ResponseHeaderBag.php @@ -36,6 +36,11 @@ class ResponseHeaderBag extends HeaderBag */ protected $cookies = array(); + /** + * @var array + */ + protected $headerNames = array(); + /** * Constructor. * @@ -48,7 +53,7 @@ public function __construct(array $headers = array()) parent::__construct($headers); if (!isset($this->headers['cache-control'])) { - $this->set('cache-control', ''); + $this->set('Cache-Control', ''); } } @@ -62,9 +67,21 @@ public function __toString() $cookies .= 'Set-Cookie: '.$cookie."\r\n"; } + ksort($this->headerNames); + return parent::__toString().$cookies; } + /** + * Returns the headers, with original capitalizations. + * + * @return array An array of headers + */ + public function allPreserveCase() + { + return array_combine($this->headerNames, $this->headers); + } + /** * {@inheritdoc} * @@ -72,10 +89,12 @@ public function __toString() */ public function replace(array $headers = array()) { + $this->headerNames = array(); + parent::replace($headers); if (!isset($this->headers['cache-control'])) { - $this->set('cache-control', ''); + $this->set('Cache-Control', ''); } } @@ -88,10 +107,14 @@ public function set($key, $values, $replace = true) { parent::set($key, $values, $replace); + $uniqueKey = strtr(strtolower($key), '_', '-'); + $this->headerNames[$uniqueKey] = $key; + // ensure the cache-control header has sensible defaults - if (in_array(strtr(strtolower($key), '_', '-'), array('cache-control', 'etag', 'last-modified', 'expires'))) { + if (in_array($uniqueKey, array('cache-control', 'etag', 'last-modified', 'expires'))) { $computed = $this->computeCacheControlValue(); $this->headers['cache-control'] = array($computed); + $this->headerNames['cache-control'] = 'Cache-Control'; $this->computedCacheControl = $this->parseCacheControl($computed); } } @@ -105,7 +128,10 @@ public function remove($key) { parent::remove($key); - if ('cache-control' === strtr(strtolower($key), '_', '-')) { + $uniqueKey = strtr(strtolower($key), '_', '-'); + unset($this->headerNames[$uniqueKey]); + + if ('cache-control' === $uniqueKey) { $this->computedCacheControl = array(); } } diff --git a/laravel/vendor/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBag.php b/laravel/vendor/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBag.php index 2f1a4222..e9d02571 100755 --- a/laravel/vendor/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBag.php +++ b/laravel/vendor/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBag.php @@ -31,7 +31,7 @@ class AttributeBag implements AttributeBagInterface, \IteratorAggregate, \Counta /** * Constructor. * - * @param string $storageKey The key used to store flashes in the session. + * @param string $storageKey The key used to store attributes in the session. */ public function __construct($storageKey = '_sf2_attributes') { diff --git a/laravel/vendor/Symfony/Component/HttpFoundation/Session/Flash/FlashBag.php b/laravel/vendor/Symfony/Component/HttpFoundation/Session/Flash/FlashBag.php index ce9308e1..5bb43bc5 100755 --- a/laravel/vendor/Symfony/Component/HttpFoundation/Session/Flash/FlashBag.php +++ b/laravel/vendor/Symfony/Component/HttpFoundation/Session/Flash/FlashBag.php @@ -177,10 +177,17 @@ public function getIterator() /** * Returns the number of flashes. * + * This method does not work. + * + * @deprecated in 2.2, removed in 2.3 + * @see https://github.com/symfony/symfony/issues/6408 + * * @return int The number of flashes */ public function count() { + trigger_error(sprintf('%s() is deprecated since 2.2 and will be removed in 2.3', __METHOD__), E_USER_DEPRECATED); + return count($this->flashes); } } diff --git a/laravel/vendor/Symfony/Component/HttpFoundation/Session/Session.php b/laravel/vendor/Symfony/Component/HttpFoundation/Session/Session.php index ee987c67..b0b3ff3d 100755 --- a/laravel/vendor/Symfony/Component/HttpFoundation/Session/Session.php +++ b/laravel/vendor/Symfony/Component/HttpFoundation/Session/Session.php @@ -259,6 +259,8 @@ public function getFlashBag() */ public function getFlashes() { + trigger_error('getFlashes() is deprecated since version 2.1 and will be removed in 2.3. Use the FlashBag instead.', E_USER_DEPRECATED); + $all = $this->getBag($this->flashName)->all(); $return = array(); @@ -282,6 +284,8 @@ public function getFlashes() */ public function setFlashes($values) { + trigger_error('setFlashes() is deprecated since version 2.1 and will be removed in 2.3. Use the FlashBag instead.', E_USER_DEPRECATED); + foreach ($values as $name => $value) { $this->getBag($this->flashName)->set($name, $value); } @@ -297,6 +301,8 @@ public function setFlashes($values) */ public function getFlash($name, $default = null) { + trigger_error('getFlash() is deprecated since version 2.1 and will be removed in 2.3. Use the FlashBag instead.', E_USER_DEPRECATED); + $return = $this->getBag($this->flashName)->get($name); return empty($return) ? $default : reset($return); @@ -310,6 +316,8 @@ public function getFlash($name, $default = null) */ public function setFlash($name, $value) { + trigger_error('setFlash() is deprecated since version 2.1 and will be removed in 2.3. Use the FlashBag instead.', E_USER_DEPRECATED); + $this->getBag($this->flashName)->set($name, $value); } @@ -322,6 +330,8 @@ public function setFlash($name, $value) */ public function hasFlash($name) { + trigger_error('hasFlash() is deprecated since version 2.1 and will be removed in 2.3. Use the FlashBag instead.', E_USER_DEPRECATED); + return $this->getBag($this->flashName)->has($name); } @@ -332,6 +342,8 @@ public function hasFlash($name) */ public function removeFlash($name) { + trigger_error('removeFlash() is deprecated since version 2.1 and will be removed in 2.3. Use the FlashBag instead.', E_USER_DEPRECATED); + $this->getBag($this->flashName)->get($name); } @@ -342,6 +354,8 @@ public function removeFlash($name) */ public function clearFlashes() { + trigger_error('clearFlashes() is deprecated since version 2.1 and will be removed in 2.3. Use the FlashBag instead.', E_USER_DEPRECATED); + return $this->getBag($this->flashName)->clear(); } } diff --git a/laravel/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php b/laravel/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php index 93a57296..69ebae95 100755 --- a/laravel/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php +++ b/laravel/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php @@ -36,6 +36,13 @@ class MongoDbSessionHandler implements \SessionHandlerInterface /** * Constructor. * + * List of available options: + * * database: The name of the database [required] + * * collection: The name of the collection [required] + * * id_field: The field name for storing the session id [default: _id] + * * data_field: The field name for storing the session data [default: data] + * * time_field: The field name for storing the timestamp [default: time] + * * @param \Mongo|\MongoClient $mongo A MongoClient or Mongo instance * @param array $options An associative array of field options * @@ -55,9 +62,9 @@ public function __construct($mongo, array $options) $this->mongo = $mongo; $this->options = array_merge(array( - 'id_field' => 'sess_id', - 'data_field' => 'sess_data', - 'time_field' => 'sess_time', + 'id_field' => '_id', + 'data_field' => 'data', + 'time_field' => 'time', ), $options); } @@ -82,10 +89,9 @@ public function close() */ public function destroy($sessionId) { - $this->getCollection()->remove( - array($this->options['id_field'] => $sessionId), - array('justOne' => true) - ); + $this->getCollection()->remove(array( + $this->options['id_field'] => $sessionId + )); return true; } @@ -95,11 +101,21 @@ public function destroy($sessionId) */ public function gc($lifetime) { - $time = new \MongoTimestamp(time() - $lifetime); + /* Note: MongoDB 2.2+ supports TTL collections, which may be used in + * place of this method by indexing the "time_field" field with an + * "expireAfterSeconds" option. Regardless of whether TTL collections + * are used, consider indexing this field to make the remove query more + * efficient. + * + * See: http://docs.mongodb.org/manual/tutorial/expire-data/ + */ + $time = new \MongoDate(time() - $lifetime); $this->getCollection()->remove(array( $this->options['time_field'] => array('$lt' => $time), )); + + return true; } /** @@ -107,16 +123,13 @@ public function gc($lifetime) */ public function write($sessionId, $data) { - $data = array( - $this->options['id_field'] => $sessionId, - $this->options['data_field'] => new \MongoBinData($data, \MongoBinData::BYTE_ARRAY), - $this->options['time_field'] => new \MongoTimestamp() - ); - $this->getCollection()->update( array($this->options['id_field'] => $sessionId), - array('$set' => $data), - array('upsert' => true) + array('$set' => array( + $this->options['data_field'] => new \MongoBinData($data, \MongoBinData::BYTE_ARRAY), + $this->options['time_field'] => new \MongoDate(), + )), + array('upsert' => true, 'multiple' => false) ); return true; diff --git a/laravel/vendor/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php b/laravel/vendor/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php index 2dc85648..4b9be5e9 100755 --- a/laravel/vendor/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php +++ b/laravel/vendor/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php @@ -27,17 +27,17 @@ class NativeSessionStorage implements SessionStorageInterface /** * Array of SessionBagInterface * - * @var array + * @var SessionBagInterface[] */ protected $bags; /** - * @var boolean + * @var Boolean */ protected $started = false; /** - * @var boolean + * @var Boolean */ protected $closed = false; @@ -332,9 +332,9 @@ public function setOptions(array $options) * Registers save handler as a PHP session handler. * * To use internal PHP session save handlers, override this method using ini_set with - * session.save_handlers and session.save_path e.g. + * session.save_handler and session.save_path e.g. * - * ini_set('session.save_handlers', 'files'); + * ini_set('session.save_handler', 'files'); * ini_set('session.save_path', /tmp'); * * @see http://php.net/session-set-save-handler diff --git a/laravel/vendor/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php b/laravel/vendor/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php index 0d4cb8b6..1f68f249 100755 --- a/laravel/vendor/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php +++ b/laravel/vendor/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php @@ -99,6 +99,8 @@ public function getId() * Sets the session ID. * * @param string $id + * + * @throws \LogicException */ public function setId($id) { @@ -123,6 +125,8 @@ public function getName() * Sets the session name. * * @param string $name + * + * @throws \LogicException */ public function setName($name) { diff --git a/laravel/vendor/Symfony/Component/HttpFoundation/StreamedResponse.php b/laravel/vendor/Symfony/Component/HttpFoundation/StreamedResponse.php index 53bdbe64..ae579bea 100755 --- a/laravel/vendor/Symfony/Component/HttpFoundation/StreamedResponse.php +++ b/laravel/vendor/Symfony/Component/HttpFoundation/StreamedResponse.php @@ -62,6 +62,8 @@ public static function create($callback = null, $status = 200, $headers = array( * Sets the PHP callback associated with this Response. * * @param mixed $callback A valid PHP callback + * + * @throws \LogicException */ public function setCallback($callback) { diff --git a/laravel/vendor/Symfony/Component/HttpFoundation/composer.json b/laravel/vendor/Symfony/Component/HttpFoundation/composer.json index e9f54948..09b87253 100755 --- a/laravel/vendor/Symfony/Component/HttpFoundation/composer.json +++ b/laravel/vendor/Symfony/Component/HttpFoundation/composer.json @@ -19,11 +19,14 @@ "php": ">=5.3.3" }, "autoload": { - "psr-0": { - "Symfony\\Component\\HttpFoundation": "", - "SessionHandlerInterface": "Symfony/Component/HttpFoundation/Resources/stubs" - } + "psr-0": { "Symfony\\Component\\HttpFoundation\\": "" }, + "classmap": [ "Symfony/Component/HttpFoundation/Resources/stubs" ] }, "target-dir": "Symfony/Component/HttpFoundation", - "minimum-stability": "dev" + "minimum-stability": "dev", + "extra": { + "branch-alias": { + "dev-master": "2.2-dev" + } + } } diff --git a/laravel/vendor/Symfony/Component/HttpFoundation/phpunit.xml.dist b/laravel/vendor/Symfony/Component/HttpFoundation/phpunit.xml.dist new file mode 100644 index 00000000..df11f72c --- /dev/null +++ b/laravel/vendor/Symfony/Component/HttpFoundation/phpunit.xml.dist @@ -0,0 +1,30 @@ + + + + + + ./Tests/ + + + + + + ./ + + ./Resources + ./Tests + ./vendor + + + + From e72b12092986c2ff70a616eebd3d2a9675ee5b92 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 1 May 2013 14:27:09 -0500 Subject: [PATCH 071/140] Fix spelling. --- app/config/session.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/config/session.php b/app/config/session.php index f54b3786..1623330c 100644 --- a/app/config/session.php +++ b/app/config/session.php @@ -8,7 +8,7 @@ |-------------------------------------------------------------------------- | | This option controls the default session "driver" that will be used on - | requests. By default we will use the light-weight native driver but + | requests. By default, we will use the lightweight native driver but | you may specify any of the other wonderful drivers provided here. | | Supported: "native", "cookie", "database", "apc", From 74cd3eb83819f8f1c7d9dcc93df42d946aa4e1cf Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Thu, 2 May 2013 15:31:21 -0500 Subject: [PATCH 072/140] Added proper code for new maintenance mode feature. --- app/config/app.php | 1 + app/start/global.php | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/app/config/app.php b/app/config/app.php index 6b065a9c..44b9f72e 100644 --- a/app/config/app.php +++ b/app/config/app.php @@ -96,6 +96,7 @@ 'Illuminate\Foundation\Providers\KeyGeneratorServiceProvider', 'Illuminate\Log\LogServiceProvider', 'Illuminate\Mail\MailServiceProvider', + 'Illuminate\Foundation\Providers\MaintenanceServiceProvider', 'Illuminate\Database\MigrationServiceProvider', 'Illuminate\Foundation\Providers\OptimizeServiceProvider', 'Illuminate\Pagination\PaginationServiceProvider', diff --git a/app/start/global.php b/app/start/global.php index f85b9bae..c19d1d63 100644 --- a/app/start/global.php +++ b/app/start/global.php @@ -53,6 +53,22 @@ Log::error($exception); }); +/* +|-------------------------------------------------------------------------- +| Maintenance Mode Handler +|-------------------------------------------------------------------------- +| +| The "down" Artisan command gives you the ability to put an application +| into maintenance mode. Here, you will define what is displayed back +| to the user if maintenace mode is in effect for this application. +| +*/ + +App::down(function() +{ + return "We'll be right back!"; +}); + /* |-------------------------------------------------------------------------- | Require The Filters File From 1e681292657b62f59927673fa861e69110c63a2e Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Thu, 2 May 2013 15:33:15 -0500 Subject: [PATCH 073/140] Tweak maintenace mode handler. --- app/start/global.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/start/global.php b/app/start/global.php index c19d1d63..339ef4b3 100644 --- a/app/start/global.php +++ b/app/start/global.php @@ -66,7 +66,7 @@ App::down(function() { - return "We'll be right back!"; + return Response::make("Be right back!", 503); }); /* From e8823e798bcbd2c9385cb26d2cc3778f4815c015 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Fri, 3 May 2013 22:26:37 -0500 Subject: [PATCH 074/140] Added clear compile pre update script. --- composer.json | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 53668d48..81c5ebf7 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,12 @@ ] }, "scripts": { - "post-update-cmd": "php artisan optimize" + "pre-update-cmd": [ + "php artisan clear-compiled" + ], + "post-update-cmd": [ + "php artisan optimize" + ] }, "config": { "preferred-install": "dist" From 852937baf4ea1a4aedfe983b495d577e2e297ea7 Mon Sep 17 00:00:00 2001 From: dotramses Date: Sat, 4 May 2013 22:28:09 +0300 Subject: [PATCH 075/140] Update migrator.php when used in a setup task. The output created didn't add a line ending. --- laravel/cli/tasks/migrate/migrator.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/laravel/cli/tasks/migrate/migrator.php b/laravel/cli/tasks/migrate/migrator.php index 5913b984..fe2ce7cb 100644 --- a/laravel/cli/tasks/migrate/migrator.php +++ b/laravel/cli/tasks/migrate/migrator.php @@ -200,7 +200,7 @@ public function install() $table->primary(array('bundle', 'name')); }); - echo "Migration table created successfully."; + echo "Migration table created successfully.".PHP_EOL; } /** @@ -275,4 +275,4 @@ protected function display($migration) return $migration['bundle'].'/'.$migration['name']; } -} \ No newline at end of file +} From 07a5edb9db4abc0010e5a8725c84f4162adbf4b3 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Sat, 4 May 2013 14:30:52 -0500 Subject: [PATCH 076/140] Fix comment. Closes #1958. --- public/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/index.php b/public/index.php index cf7f302f..630a0d06 100644 --- a/public/index.php +++ b/public/index.php @@ -53,7 +53,7 @@ | Shutdown The Application |-------------------------------------------------------------------------- | -| Once the app has finished running. We will fire off the shutdown events +| Once the app has finished running, we will fire off the shutdown events | so that any final work may be done by the application before we shut | down the process. This is the last thing to happen to the request. | From 3d533f03e6b10dd5809333341548b9890a79a3a5 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Sat, 4 May 2013 19:25:53 -0500 Subject: [PATCH 077/140] Fix method override. --- laravel/core.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/laravel/core.php b/laravel/core.php index 784f65d9..74e0689a 100644 --- a/laravel/core.php +++ b/laravel/core.php @@ -154,8 +154,12 @@ use Symfony\Component\HttpFoundation\LaravelRequest as RequestFoundation; +RequestFoundation::enableHttpMethodParameterOverride(); + Request::$foundation = RequestFoundation::createFromGlobals(); + + /* |-------------------------------------------------------------------------- | Determine The Application Environment From e12830534ed6adffdc175209155aa1132fde1268 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Sat, 4 May 2013 19:29:52 -0500 Subject: [PATCH 078/140] Tweak composer commands. Closes #1954. --- composer.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/composer.json b/composer.json index 81c5ebf7..64ca180b 100644 --- a/composer.json +++ b/composer.json @@ -13,9 +13,15 @@ ] }, "scripts": { + "pre-install-cmd": [ + "php artisan clear-compiled" + ], "pre-update-cmd": [ "php artisan clear-compiled" ], + "post-install-cmd": [ + "php artisan optimize" + ], "post-update-cmd": [ "php artisan optimize" ] From 76db206551622be1560fb68349da819807350a1b Mon Sep 17 00:00:00 2001 From: fpirsch Date: Sun, 5 May 2013 15:00:23 +0300 Subject: [PATCH 079/140] fix incorrect padding with multi-byte strings As far as encrypting and paddings are concerned, we are talking about **bytes** and not **characters**. So basic strlen/substr functions must be used instead of their mbstring version. --- laravel/crypter.php | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/laravel/crypter.php b/laravel/crypter.php index 5cbf1101..705d939b 100644 --- a/laravel/crypter.php +++ b/laravel/crypter.php @@ -116,7 +116,7 @@ protected static function iv_size() */ protected static function pad($value) { - $pad = static::$block - (Str::length($value) % static::$block); + $pad = static::$block - (strlen($value) % static::$block); return $value .= str_repeat(chr($pad), $pad); } @@ -129,14 +129,7 @@ protected static function pad($value) */ protected static function unpad($value) { - if (MB_STRING) - { - $pad = ord(mb_substr($value, -1, 1, Config::get('application.encoding'))); - } - else - { - $pad = ord(substr($value, -1)); - } + $pad = ord(substr($value, -1)); if ($pad and $pad <= static::$block) { @@ -145,12 +138,7 @@ protected static function unpad($value) // as the padding appears to have been changed. if (preg_match('/'.chr($pad).'{'.$pad.'}$/', $value)) { - if (MB_STRING) - { - return mb_substr($value, 0, Str::length($value) - $pad, Config::get('application.encoding')); - } - - return substr($value, 0, Str::length($value) - $pad); + return substr($value, 0, strlen($value) - $pad); } // If the padding characters do not match the expected padding From bd6289b1188049b0c6644b23346540ba85eefe77 Mon Sep 17 00:00:00 2001 From: Evgeny Kovalev Date: Sun, 5 May 2013 23:51:46 +0400 Subject: [PATCH 080/140] Fixes error messages. Validation allows max number. Fix for both Russian and English. NB The bug is fixed for English version V4 already. No language files for other languages for V4. Signed-off-by: Evgeny Kovalev --- application/language/en/validation.php | 6 +++--- application/language/ru/validation.php | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/application/language/en/validation.php b/application/language/en/validation.php index c07e4a0d..0d053c73 100644 --- a/application/language/en/validation.php +++ b/application/language/en/validation.php @@ -46,9 +46,9 @@ "ip" => "The :attribute must be a valid IP address.", "match" => "The :attribute format is invalid.", "max" => array( - "numeric" => "The :attribute must be less than :max.", - "file" => "The :attribute must be less than :max kilobytes.", - "string" => "The :attribute must be less than :max characters.", + "numeric" => "The :attribute may not be greater than :max.", + "file" => "The :attribute may not be greater than :max kilobytes.", + "string" => "The :attribute may not be greater than :max characters.", ), "mimes" => "The :attribute must be a file of type: :values.", "min" => array( diff --git a/application/language/ru/validation.php b/application/language/ru/validation.php index 8fd15f5c..dc6a37f1 100644 --- a/application/language/ru/validation.php +++ b/application/language/ru/validation.php @@ -45,9 +45,9 @@ "ip" => "Поле :attribute должно быть полным IP-адресом.", "match" => "Поле :attribute имеет неверный формат.", "max" => array( - "numeric" => "Поле :attribute должно быть меньше :max.", - "file" => "Поле :attribute должно быть меньше :max Килобайт.", - "string" => "Поле :attribute должно быть короче :max символов.", + "numeric" => "Поле :attribute должно быть не больше :max.", + "file" => "Поле :attribute должно быть не больше :max Килобайт.", + "string" => "Поле :attribute должно быть длиннее :max символов.", ), "mimes" => "Поле :attribute должно быть файлом одного из типов: :values.", "min" => array( @@ -101,4 +101,4 @@ 'attributes' => array(), -); \ No newline at end of file +); From accbcabfcf9050b9a45960589892cda3779e66d5 Mon Sep 17 00:00:00 2001 From: Evgeny Kovalev Date: Mon, 6 May 2013 00:01:57 +0400 Subject: [PATCH 081/140] Fixes 'greater' to 'not greater'. Signed-off-by: Evgeny Kovalev --- application/language/ru/validation.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/language/ru/validation.php b/application/language/ru/validation.php index dc6a37f1..4be4e1a9 100644 --- a/application/language/ru/validation.php +++ b/application/language/ru/validation.php @@ -47,7 +47,7 @@ "max" => array( "numeric" => "Поле :attribute должно быть не больше :max.", "file" => "Поле :attribute должно быть не больше :max Килобайт.", - "string" => "Поле :attribute должно быть длиннее :max символов.", + "string" => "Поле :attribute должно быть не длиннее :max символов.", ), "mimes" => "Поле :attribute должно быть файлом одного из типов: :values.", "min" => array( From db365ddaaeaba981a0266b4a6977e671bdd8e6ec Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Mon, 6 May 2013 09:35:34 -0500 Subject: [PATCH 082/140] Remove pre-install cmd for now. --- composer.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/composer.json b/composer.json index 64ca180b..5afd955d 100644 --- a/composer.json +++ b/composer.json @@ -13,9 +13,6 @@ ] }, "scripts": { - "pre-install-cmd": [ - "php artisan clear-compiled" - ], "pre-update-cmd": [ "php artisan clear-compiled" ], From 24f0d9a5b824d2a4a0a56611f9cb82cf9878e002 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 7 May 2013 08:19:08 -0500 Subject: [PATCH 083/140] Update HTML alias. Closes #1210. --- app/config/app.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/config/app.php b/app/config/app.php index 44b9f72e..c40885b5 100644 --- a/app/config/app.php +++ b/app/config/app.php @@ -158,7 +158,7 @@ 'File' => 'Illuminate\Support\Facades\File', 'Form' => 'Illuminate\Support\Facades\Form', 'Hash' => 'Illuminate\Support\Facades\Hash', - 'Html' => 'Illuminate\Support\Facades\Html', + 'HTML' => 'Illuminate\Support\Facades\Html', 'Input' => 'Illuminate\Support\Facades\Input', 'Lang' => 'Illuminate\Support\Facades\Lang', 'Log' => 'Illuminate\Support\Facades\Log', From 96e44d908cd261d47a936e9a38b76391fa8a6bb9 Mon Sep 17 00:00:00 2001 From: Jason Funk Date: Tue, 7 May 2013 09:16:13 -0500 Subject: [PATCH 084/140] Allow the developer to set the Content-Disposition header in Response::download() --- laravel/response.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/laravel/response.php b/laravel/response.php index f3508358..ece2c354 100644 --- a/laravel/response.php +++ b/laravel/response.php @@ -202,9 +202,14 @@ public static function download($path, $name = null, $headers = array()) // off to the HttpFoundation and let it create the header text. $response = new static(File::get($path), 200, $headers); - $d = $response->disposition($name); + // If the Content-Disposition header has already been set by the + // merge above, then do not override it with out generated one. + if (!isset($headers['Content-Disposition'])) { + $d = $response->disposition($name); + $response = $response->header('Content-Disposition', $d); + } - return $response->header('Content-Disposition', $d); + return $response; } /** From a982efb49bbf2d107e4a9d7ebc11448d557ee744 Mon Sep 17 00:00:00 2001 From: Ben Corlett Date: Wed, 8 May 2013 09:30:08 +1000 Subject: [PATCH 085/140] Updates for the rename of the `HTML` facade. See laravel/framework#1231 --- app/config/app.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/config/app.php b/app/config/app.php index c40885b5..77c9cfb4 100644 --- a/app/config/app.php +++ b/app/config/app.php @@ -158,7 +158,7 @@ 'File' => 'Illuminate\Support\Facades\File', 'Form' => 'Illuminate\Support\Facades\Form', 'Hash' => 'Illuminate\Support\Facades\Hash', - 'HTML' => 'Illuminate\Support\Facades\Html', + 'HTML' => 'Illuminate\Support\Facades\HTML', 'Input' => 'Illuminate\Support\Facades\Input', 'Lang' => 'Illuminate\Support\Facades\Lang', 'Log' => 'Illuminate\Support\Facades\Log', From 641ac8d69c91063d684555852badc45717db91bf Mon Sep 17 00:00:00 2001 From: Pavel Puchkin Date: Wed, 8 May 2013 11:39:51 +1100 Subject: [PATCH 086/140] Access foreign property in Belongs_To through a getter --- laravel/database/eloquent/relationships/belongs_to.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/laravel/database/eloquent/relationships/belongs_to.php b/laravel/database/eloquent/relationships/belongs_to.php index 0336025f..ebaca978 100644 --- a/laravel/database/eloquent/relationships/belongs_to.php +++ b/laravel/database/eloquent/relationships/belongs_to.php @@ -110,7 +110,7 @@ public function match($relationship, &$children, $parents) */ public function foreign_value() { - return $this->base->get_attribute($this->foreign); + return $this->base->{$this->foreign}; } /** @@ -126,4 +126,4 @@ public function bind($id) return $this->base; } -} \ No newline at end of file +} From 3a46721eca6562f518c65a8ecc00af8816e14da3 Mon Sep 17 00:00:00 2001 From: Pavel Puchkin Date: Wed, 8 May 2013 18:19:27 +1100 Subject: [PATCH 087/140] Even more fluent eloquent model via magic setters Now it is possible to use Eloquent's magic setters in chains. For example: $model->set_foo('foo')->take(10)->set_bar(some_function()); // ...even though setters 'foo' and 'bar' are not defined on the model --- laravel/database/eloquent/model.php | 1 + laravel/tests/cases/eloquent.test.php | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/laravel/database/eloquent/model.php b/laravel/database/eloquent/model.php index 23d25b02..b35fb1a2 100644 --- a/laravel/database/eloquent/model.php +++ b/laravel/database/eloquent/model.php @@ -770,6 +770,7 @@ public function __call($method, $parameters) elseif (starts_with($method, 'set_')) { $this->set_attribute(substr($method, 4), $parameters[0]); + return $this; } // Finally we will assume that the method is actually the beginning of a diff --git a/laravel/tests/cases/eloquent.test.php b/laravel/tests/cases/eloquent.test.php index ec08ed0f..6111eb46 100644 --- a/laravel/tests/cases/eloquent.test.php +++ b/laravel/tests/cases/eloquent.test.php @@ -133,6 +133,19 @@ public function testAttributeMagicSetterMethodChangesAttribute() Model::$accessible = null; } + /** + * Test the Model::__set method allows chaining. + * + * @group laravel + */ + public function testAttributeMagicSetterMethodAllowsChaining() + { + $model = new Model; + $this->assertInstanceOf('Model', $model->set_foo('foo')); + $model->set_bar('bar')->set_baz('baz'); + $this->assertEquals(array('foo' => 'foo', 'bar' => 'bar', 'baz' => 'baz'), $model->to_array()); + } + /** * Test the Model::__get method. * @@ -288,4 +301,4 @@ public function testConvertingToArray() } -} \ No newline at end of file +} From f2f1d4d17301cde3cb62ea1f5b4cbf6ba8172f10 Mon Sep 17 00:00:00 2001 From: Pavel Puchkin Date: Wed, 8 May 2013 20:11:44 +1000 Subject: [PATCH 088/140] Return `$this` in `set_attribute` --- laravel/database/eloquent/model.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/laravel/database/eloquent/model.php b/laravel/database/eloquent/model.php index b35fb1a2..6c0ef483 100644 --- a/laravel/database/eloquent/model.php +++ b/laravel/database/eloquent/model.php @@ -441,7 +441,7 @@ public function timestamp() } /** - *Updates the timestamp on the model and immediately saves it. + * Updates the timestamp on the model and immediately saves it. * * @return void */ @@ -562,11 +562,12 @@ public function get_attribute($key) * * @param string $key * @param mixed $value - * @return void + * @return Model */ public function set_attribute($key, $value) { $this->attributes[$key] = $value; + return $this; } /** @@ -769,8 +770,7 @@ public function __call($method, $parameters) } elseif (starts_with($method, 'set_')) { - $this->set_attribute(substr($method, 4), $parameters[0]); - return $this; + return $this->set_attribute(substr($method, 4), $parameters[0]); } // Finally we will assume that the method is actually the beginning of a From ae61b601b6451f7ad6a3ae6333c1c0d583d5cd57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Czy=C5=BCewski?= Date: Sat, 11 May 2013 14:16:41 +0300 Subject: [PATCH 089/140] Update .htaccess Change link in comment. (2.2 -> current) --- public/.htaccess | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/.htaccess b/public/.htaccess index 6e89138e..f6299414 100644 --- a/public/.htaccess +++ b/public/.htaccess @@ -1,9 +1,9 @@ # Apache configuration file -# http://httpd.apache.org/docs/2.2/mod/quickreference.html +# http://httpd.apache.org/docs/current/mod/quickreference.html # Note: ".htaccess" files are an overhead for each request. This logic should # be placed in your Apache config whenever possible. -# http://httpd.apache.org/docs/2.2/howto/htaccess.html +# http://httpd.apache.org/docs/current/howto/htaccess.html # Turning on the rewrite engine is necessary for the following rules and # features. "+FollowSymLinks" must be enabled for this to work symbolically. @@ -20,4 +20,4 @@ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L] - \ No newline at end of file + From b894cde4babc70295182f0e310811e357707041f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20van=20Dijk?= Date: Mon, 13 May 2013 12:00:09 +0200 Subject: [PATCH 090/140] Added Dutch translations for validation rules "date_format" and "required_with". --- application/language/nl/validation.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/application/language/nl/validation.php b/application/language/nl/validation.php index 3017d8fa..95f5f2a9 100644 --- a/application/language/nl/validation.php +++ b/application/language/nl/validation.php @@ -27,6 +27,7 @@ "countbetween" => ":attribute moet tussen :min en :max geselecteerde elementen bevatten.", "countmax" => ":attribute moet minder dan :max geselecteerde elementen bevatten.", "countmin" => ":attribute moet minimaal :min geselecteerde elementen bevatten.", + "date_format" => ":attribute moet een geldige datum formaat bevatten.", "different" => ":attribute en :other moeten verschillend zijn.", "email" => ":attribute is geen geldig e-mailadres.", "exists" => ":attribute bestaat niet.", @@ -49,6 +50,7 @@ "not_in" => "Het formaat van :attribute is ongeldig.", "numeric" => ":attribute moet een nummer zijn.", "required" => ":attribute is verplicht.", + "required_with" => ":attribute is verplicht i.c.m. :field", "same" => ":attribute en :other moeten overeenkomen.", "size" => array( "numeric" => ":attribute moet :size zijn.", From c7f889fe54d7c58244c575f76ff919c0f4ec15f7 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 14 May 2013 00:27:39 -0500 Subject: [PATCH 091/140] Move slash redirects to application level. --- bootstrap/start.php | 2 ++ public/.htaccess | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/bootstrap/start.php b/bootstrap/start.php index cd8a5b69..9848f9bc 100644 --- a/bootstrap/start.php +++ b/bootstrap/start.php @@ -13,6 +13,8 @@ $app = new Illuminate\Foundation\Application; +$app->redirectIfTrailingSlash(); + /* |-------------------------------------------------------------------------- | Detect The Application Environment diff --git a/public/.htaccess b/public/.htaccess index a3432c2a..1285c511 100644 --- a/public/.htaccess +++ b/public/.htaccess @@ -2,9 +2,6 @@ Options -MultiViews RewriteEngine On - RewriteCond %{REQUEST_FILENAME} !-d - RewriteRule ^(.+)/$ http://%{HTTP_HOST}/$1 [R=301,L] - RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] \ No newline at end of file From 8709c6c6b062658eab23abf18aada550fb2efde9 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 14 May 2013 00:40:22 -0500 Subject: [PATCH 092/140] Use app_path in global file. Closes #1975. --- app/start/global.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/start/global.php b/app/start/global.php index 339ef4b3..7697a6be 100644 --- a/app/start/global.php +++ b/app/start/global.php @@ -80,4 +80,4 @@ | */ -require __DIR__.'/../filters.php'; \ No newline at end of file +require app_path().'/filters.php'; \ No newline at end of file From 727b69494b4938f38c9f8dad0f83920e2cc2303b Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 14 May 2013 00:41:39 -0500 Subject: [PATCH 093/140] Check arrays on Input::had. Closes #1988. --- laravel/input.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/laravel/input.php b/laravel/input.php index 84424570..7ddb1b02 100644 --- a/laravel/input.php +++ b/laravel/input.php @@ -160,6 +160,8 @@ public static function except($keys) */ public static function had($key) { + if (is_array(static::old($key))) return true; + return trim((string) static::old($key)) !== ''; } From 5d63d5ad524688fdbf55b926e256c967e50d660e Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 14 May 2013 00:51:05 -0500 Subject: [PATCH 094/140] Consider protocoless URLs as valid. Closes. #1966. --- laravel/url.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/laravel/url.php b/laravel/url.php index b8fb1f46..1e006a94 100644 --- a/laravel/url.php +++ b/laravel/url.php @@ -355,6 +355,8 @@ public static function transpose($uri, $parameters) */ public static function valid($url) { + if (starts_with($url, '//')) return true; + return filter_var($url, FILTER_VALIDATE_URL) !== false; } From d1ae2324fdffc96004d8c3471accd9f98f4e1f33 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 14 May 2013 00:55:23 -0500 Subject: [PATCH 095/140] Fix returning check for Postgres. --- laravel/database/connection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/laravel/database/connection.php b/laravel/database/connection.php index ec1ae884..5d2c2e11 100644 --- a/laravel/database/connection.php +++ b/laravel/database/connection.php @@ -197,7 +197,7 @@ public function query($sql, $bindings = array()) // For insert statements that use the "returning" clause, which is allowed // by database systems such as Postgres, we need to actually return the // real query result so the consumer can get the ID. - elseif (stripos($sql, 'insert') === 0 and stripos($sql, 'returning') !== false) + elseif (stripos($sql, 'insert') === 0 and stripos($sql, ') returning') !== false) { return $this->fetch($statement, Config::get('database.fetch')); } From 678b92ef85ce0258eb9a6ac57bb26fca9480e430 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 14 May 2013 01:15:47 -0500 Subject: [PATCH 096/140] putenv in test runner. --- laravel/cli/tasks/test/runner.php | 1 + 1 file changed, 1 insertion(+) diff --git a/laravel/cli/tasks/test/runner.php b/laravel/cli/tasks/test/runner.php index eb1a8625..7b18b845 100644 --- a/laravel/cli/tasks/test/runner.php +++ b/laravel/cli/tasks/test/runner.php @@ -88,6 +88,7 @@ protected function test() // strings with spaces inside should be wrapped in quotes. $esc_path = escapeshellarg($path); + putenv('LARAVEL_ENV='.Request::env()); passthru('LARAVEL_ENV='.Request::env().' phpunit --configuration '.$esc_path, $status); @unlink($path); From 82686af96f1434341edbfff2dd9f74e8eb0f9e94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20van=20Dijk?= Date: Tue, 14 May 2013 08:59:59 +0200 Subject: [PATCH 097/140] Language line correction Indentation before '=>' and 'geldig' instead of 'geldige'. --- application/language/nl/validation.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/language/nl/validation.php b/application/language/nl/validation.php index 95f5f2a9..eedac482 100644 --- a/application/language/nl/validation.php +++ b/application/language/nl/validation.php @@ -27,7 +27,7 @@ "countbetween" => ":attribute moet tussen :min en :max geselecteerde elementen bevatten.", "countmax" => ":attribute moet minder dan :max geselecteerde elementen bevatten.", "countmin" => ":attribute moet minimaal :min geselecteerde elementen bevatten.", - "date_format" => ":attribute moet een geldige datum formaat bevatten.", + "date_format" => ":attribute moet een geldig datum formaat bevatten.", "different" => ":attribute en :other moeten verschillend zijn.", "email" => ":attribute is geen geldig e-mailadres.", "exists" => ":attribute bestaat niet.", From bee0153e3b3fd4202d8c19d0fa4d98b003428d40 Mon Sep 17 00:00:00 2001 From: Pavel Puchkin Date: Wed, 15 May 2013 18:04:47 +1200 Subject: [PATCH 098/140] Fix russian translation for 'exists' validation rule --- application/language/ru/validation.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/language/ru/validation.php b/application/language/ru/validation.php index 4be4e1a9..7f375023 100644 --- a/application/language/ru/validation.php +++ b/application/language/ru/validation.php @@ -38,7 +38,7 @@ "countmin" => "The :attribute must have at least :min selected elements.", "different" => "Поля :attribute и :other должны различаться.", "email" => "Поле :attribute имеет неверный формат.", - "exists" => "Выбранное значение для :attribute уже существует.", + "exists" => "Выбранное значение для :attribute не верно.", "image" => "Поле :attribute должно быть картинкой.", "in" => "Выбранное значение для :attribute не верно.", "integer" => "Поле :attribute должно быть целым числом.", From cfcd82e04aaf035476bd52fab8c5bc02ecb20a3b Mon Sep 17 00:00:00 2001 From: aeberhardo Date: Wed, 15 May 2013 19:05:04 +0200 Subject: [PATCH 099/140] Fixes variable export for Windows. Issue: https://github.com/laravel/laravel/issues/1870 Fix in commit https://github.com/laravel/laravel/commit/678b92ef85ce0258eb9a6ac57bb26fca9480e430 does not work. Signed-off-by: aeberhardo --- laravel/cli/tasks/test/runner.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/laravel/cli/tasks/test/runner.php b/laravel/cli/tasks/test/runner.php index 7b18b845..60575bf5 100644 --- a/laravel/cli/tasks/test/runner.php +++ b/laravel/cli/tasks/test/runner.php @@ -89,7 +89,7 @@ protected function test() $esc_path = escapeshellarg($path); putenv('LARAVEL_ENV='.Request::env()); - passthru('LARAVEL_ENV='.Request::env().' phpunit --configuration '.$esc_path, $status); + passthru('phpunit --configuration '.$esc_path, $status); @unlink($path); From 260b3c93df72265ee1b152576edc3aecd5f73764 Mon Sep 17 00:00:00 2001 From: Isern Palaus Date: Thu, 16 May 2013 16:23:52 +0200 Subject: [PATCH 100/140] Removed the unused setting 'session.payload'. Signed-off-by: Isern Palaus --- app/config/session.php | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/app/config/session.php b/app/config/session.php index 1623330c..e11e98cd 100644 --- a/app/config/session.php +++ b/app/config/session.php @@ -122,17 +122,4 @@ 'domain' => null, - /* - |-------------------------------------------------------------------------- - | Session Payload Cookie Name - |-------------------------------------------------------------------------- - | - | When using the "cookie" session driver, you may configure the name of - | the cookie used as the session "payload". This cookie actually has - | the encrypted session data stored within it for the application. - | - */ - - 'payload' => 'laravel_payload', - ); From 357875d6c8b7ab291b2e91aab7ca688cc7cff933 Mon Sep 17 00:00:00 2001 From: "Dmitriy A. Golev" Date: Wed, 22 May 2013 01:44:32 +0400 Subject: [PATCH 101/140] Validation in Russian update --- application/language/ru/validation.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/application/language/ru/validation.php b/application/language/ru/validation.php index 8fd15f5c..10f6a57e 100644 --- a/application/language/ru/validation.php +++ b/application/language/ru/validation.php @@ -32,10 +32,10 @@ "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 уже существует.", From 70f283606068845710f62b24dee944ee82bdbf47 Mon Sep 17 00:00:00 2001 From: "Dmitriy A. Golev" Date: Wed, 22 May 2013 01:47:48 +0400 Subject: [PATCH 102/140] Revert "Make view with response status and headers" This reverts commit 036a0bab0bd05cf2f8086363c35adc104a7cf631. --- laravel/response.php | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/laravel/response.php b/laravel/response.php index 242deab0..f3508358 100644 --- a/laravel/response.php +++ b/laravel/response.php @@ -57,28 +57,6 @@ public static function make($content, $status = 200, $headers = array()) { return new static($content, $status, $headers); } - - /** - * Create a new response instance with status code. - * - * - * // Create a response instance with a view - * return Response::view('home.no_such_page', 404); - * - * // Create a response instance with a view and data - * return Response::view('item.no_such_page', 404, array('message' => 'Nothing found'), array('header' => 'value')); - * - * - * @param string $view - * @param int $status - * @param array $data - * @param array $headers - * @return Response - */ - public static function view_with_status($view, $status, $data = array(), $headers = array()) - { - return new static(View::make($view, $data), $status, $headers); - } /** * Create a new response instance containing a view. From 3018bcce718665e28b6fcf8b48fc3ef79f9d8c65 Mon Sep 17 00:00:00 2001 From: vus520 Date: Wed, 22 May 2013 14:06:34 +0800 Subject: [PATCH 103/140] add Simplified Chinese language package --- application/language/cn/pagination.php | 19 +++++ application/language/cn/validation.php | 106 +++++++++++++++++++++++++ 2 files changed, 125 insertions(+) create mode 100644 application/language/cn/pagination.php create mode 100644 application/language/cn/validation.php diff --git a/application/language/cn/pagination.php b/application/language/cn/pagination.php new file mode 100644 index 00000000..4454230f --- /dev/null +++ b/application/language/cn/pagination.php @@ -0,0 +1,19 @@ + '« 上一页', + 'next' => '下一页 »', + +); \ No newline at end of file diff --git a/application/language/cn/validation.php b/application/language/cn/validation.php new file mode 100644 index 00000000..aed90e43 --- /dev/null +++ b/application/language/cn/validation.php @@ -0,0 +1,106 @@ + "您必须同意 :attribute 才能继续.", + "active_url" => "链接 :attribute 不合法.", + "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 项.", + "date_format" => " :attribute 不是合法的日期格式.", + "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 不能小于 :min KB.", + "string" => "字段 :attribute 不能少于 :min 字符.", + ), + "not_in" => "选择的 :attribute 不正确.", + "numeric" => " :attribute 必须的是数字.", + "required" => " :attribute 不能为空.", + "required_with" => "字段 :attribute field is required with :field", + "same" => "The :attribute and :other must match.", + "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(), + +); From 55fe0189ac771361aac67e179b039a38dbc036b8 Mon Sep 17 00:00:00 2001 From: Juukie14 Date: Thu, 23 May 2013 16:43:38 +0200 Subject: [PATCH 104/140] Conditionally Loading jQuery in profiler template --- laravel/profiling/template.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/laravel/profiling/template.blade.php b/laravel/profiling/template.blade.php index d9eab921..0b365541 100755 --- a/laravel/profiling/template.blade.php +++ b/laravel/profiling/template.blade.php @@ -119,6 +119,6 @@ - + From 79e3aab4a6978d7fe73b5e96d5d0eb7f1c62ebab Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Fri, 24 May 2013 09:24:46 -0500 Subject: [PATCH 105/140] Added sendmail path config option. --- app/config/mail.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/config/mail.php b/app/config/mail.php index 7b7dff67..2b490a8e 100644 --- a/app/config/mail.php +++ b/app/config/mail.php @@ -95,4 +95,17 @@ 'password' => null, + /* + |-------------------------------------------------------------------------- + | Sendmail System Path + |-------------------------------------------------------------------------- + | + | When using the "sendmail" driver to send e-mails, we will need to know + | the path to where Sendmail lives on this server. A default path has + | been provided here, which will work well on most of your systems. + | + */ + + 'sendmail' => '/usr/sbin/sendmail', + ); From 96a3027b311d9d398e6c518e0a7b28ef778bc846 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Fri, 24 May 2013 09:25:36 -0500 Subject: [PATCH 106/140] Updated available drivers for mail. --- app/config/mail.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/config/mail.php b/app/config/mail.php index 2b490a8e..7d8e2765 100644 --- a/app/config/mail.php +++ b/app/config/mail.php @@ -11,7 +11,7 @@ | sending of e-mail. You may specify which one you're using throughout | your application here. By default, Laravel is setup for SMTP mail. | - | Supported: "smtp", "mail" + | Supported: "smtp", "mail", "sendmail" | */ From 5060bc2adecf0d7d370d535804d53b145d7b3f22 Mon Sep 17 00:00:00 2001 From: Dayle Rees Date: Sat, 25 May 2013 18:57:39 +0100 Subject: [PATCH 107/140] New welcome page. --- app/views/hello.php | 57 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/app/views/hello.php b/app/views/hello.php index ba7c290e..05b45cb3 100644 --- a/app/views/hello.php +++ b/app/views/hello.php @@ -1 +1,56 @@ -

Hello World!

\ No newline at end of file + + + + + Laravel PHP Framework + + + + +

Thanks for choosing Laravel!

+ +

+ Now that you're up and running, it's time to start creating! + Here are some links to help you get started: +

+ + + + From af39f0c2b139dc599aa6c9da0107274019aac95c Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Sun, 26 May 2013 13:50:16 -0500 Subject: [PATCH 108/140] Just boot MbString on Patchwork. --- bootstrap/autoload.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap/autoload.php b/bootstrap/autoload.php index ef587e27..6d5c7402 100644 --- a/bootstrap/autoload.php +++ b/bootstrap/autoload.php @@ -43,7 +43,7 @@ | */ -Patchwork\Utf8\Bootup::initAll(); +Patchwork\Utf8\Bootup::initMbString(); /* |-------------------------------------------------------------------------- From 15bd1bfa635f07a719167de97664ba4f9e7ec8b4 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Sun, 26 May 2013 13:50:33 -0500 Subject: [PATCH 109/140] Fix casing. --- bootstrap/autoload.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap/autoload.php b/bootstrap/autoload.php index 6d5c7402..6b329312 100644 --- a/bootstrap/autoload.php +++ b/bootstrap/autoload.php @@ -43,7 +43,7 @@ | */ -Patchwork\Utf8\Bootup::initMbString(); +Patchwork\Utf8\Bootup::initMbstring(); /* |-------------------------------------------------------------------------- From 1cd0f1a6d7bac9c823a83f41751d52bc83a8a21c Mon Sep 17 00:00:00 2001 From: Isern Palaus Date: Mon, 27 May 2013 06:31:55 +0200 Subject: [PATCH 110/140] The default sendmail path must contain '-bs' or '-t' flags. Signed-off-by: Isern Palaus --- app/config/mail.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/config/mail.php b/app/config/mail.php index 7d8e2765..eb9e6406 100644 --- a/app/config/mail.php +++ b/app/config/mail.php @@ -106,6 +106,6 @@ | */ - 'sendmail' => '/usr/sbin/sendmail', + 'sendmail' => '/usr/sbin/sendmail -bs', ); From 8f79855808705c92e3c0370cf7b9ac3dbf416926 Mon Sep 17 00:00:00 2001 From: Kirk Bushell Date: Mon, 27 May 2013 15:43:32 +1000 Subject: [PATCH 111/140] Route updated to ensure that the root Controller alias is called, rather than the one within its own namespace. Signed-off-by: Kirk Bushell --- laravel/routing/route.php | 1 + 1 file changed, 1 insertion(+) diff --git a/laravel/routing/route.php b/laravel/routing/route.php index f2deba74..f99ad209 100644 --- a/laravel/routing/route.php +++ b/laravel/routing/route.php @@ -1,6 +1,7 @@ Date: Tue, 28 May 2013 11:05:10 +0200 Subject: [PATCH 112/140] Make artisan executable --- artisan | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 artisan diff --git a/artisan b/artisan old mode 100644 new mode 100755 From e510b028124d747d6e222676bfabbb5fdd8bf9c4 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 28 May 2013 09:37:29 -0500 Subject: [PATCH 113/140] Tweak framework readme. --- readme.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/readme.md b/readme.md index 45bd6324..a5f21749 100644 --- a/readme.md +++ b/readme.md @@ -1,8 +1,14 @@ -## Laravel 4.x +## Laravel PHP Framework -### A Framework For Web Artisans +Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable, creative experience to be truly fulfilling. Laravel attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as authentication, routing, sessions, and caching. -[Official Documentation](http://four.laravel.com) (Under Active Development) +Laravel aims to make the development process a pleasing one for the developer without sacrificing application functionality. Happy developers make the best code. To this end, we've attempted to combine the very best of what we have seen in other web frameworks, including frameworks implemented in other languages, such as Ruby on Rails, ASP.NET MVC, and Sinatra. + +Laravel is accessible, yet powerful, providing powerful tools needed for large, robust applications. A superb inversion of control container, expressive migration system, and tightly integrated unit testing support give you the tools you need to build any application with which you are tasked. + +## Official Documentation + +Documentation for the entire framework can be found on the [Laravel website](http://laravel.com/docs). ### Contributing To Laravel From b87a78fb176b5750ee210b2dcc3f6e4b55f26819 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 28 May 2013 11:28:05 -0500 Subject: [PATCH 114/140] Tweak welcome page. --- app/views/hello.php | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/app/views/hello.php b/app/views/hello.php index 05b45cb3..175f47a9 100644 --- a/app/views/hello.php +++ b/app/views/hello.php @@ -10,12 +10,17 @@ margin:0; font-family:'Lato', sans-serif; text-align:center; + color: #999; } - .logo { - display:block; - width:135px; - margin:6em auto 2em; + .welcome { + width: 300px; + height: 300px; + position: absolute; + left: 50%; + top: 50%; + margin-left: -150px; + margin-top: -150px; } a, a:visited { @@ -39,18 +44,9 @@ - -

Thanks for choosing Laravel!

- -

- Now that you're up and running, it's time to start creating! - Here are some links to help you get started: -

- - +
+ +

You have arrived.

+
From df3795b8effd35f0dbb0bf40c17c4a4438d7dacf Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 28 May 2013 15:38:38 -0500 Subject: [PATCH 115/140] Update dependency to 4.1.x. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 5afd955d..ea036aea 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "require": { - "laravel/framework": "4.0.*" + "laravel/framework": "4.1.*" }, "autoload": { "classmap": [ From 164e2d96517307c4e9ec8a16428f62135b566405 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 29 May 2013 08:58:31 -0500 Subject: [PATCH 116/140] Fix unit test example. --- app/tests/ExampleTest.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/tests/ExampleTest.php b/app/tests/ExampleTest.php index 7bebb2ed..ead53e07 100644 --- a/app/tests/ExampleTest.php +++ b/app/tests/ExampleTest.php @@ -12,8 +12,6 @@ public function testBasicExample() $crawler = $this->client->request('GET', '/'); $this->assertTrue($this->client->getResponse()->isOk()); - - $this->assertCount(1, $crawler->filter('h1:contains("Hello World!")')); } } \ No newline at end of file From c0a26f50ac9ec49fd64ec2ccdb74370ea4235500 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 29 May 2013 08:59:05 -0500 Subject: [PATCH 117/140] Fix unit test example. --- app/tests/ExampleTest.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/tests/ExampleTest.php b/app/tests/ExampleTest.php index 7bebb2ed..ead53e07 100644 --- a/app/tests/ExampleTest.php +++ b/app/tests/ExampleTest.php @@ -12,8 +12,6 @@ public function testBasicExample() $crawler = $this->client->request('GET', '/'); $this->assertTrue($this->client->getResponse()->isOk()); - - $this->assertCount(1, $crawler->filter('h1:contains("Hello World!")')); } } \ No newline at end of file From e8fa5f02b723c91e0cf4e8ffd02829c37fd8d338 Mon Sep 17 00:00:00 2001 From: Jonathan Barronville Date: Wed, 29 May 2013 16:37:27 -0400 Subject: [PATCH 118/140] Small grammar fix. :eyes: . --- public/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/index.php b/public/index.php index 630a0d06..295c10ec 100644 --- a/public/index.php +++ b/public/index.php @@ -26,7 +26,7 @@ |-------------------------------------------------------------------------- | | We need to illuminate PHP development, so let's turn on the lights. -| This bootstrap the framework and gets it ready for use, then it +| This bootstraps the framework and gets it ready for use, then it | will load up this application so that we can run it and send | the responses back to the browser and delight these users. | From d1520dc1b9dc475b149ea4f105d7ee4b0f717103 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Fri, 31 May 2013 08:29:03 -0500 Subject: [PATCH 119/140] Adding a few things to the composer.json file. --- composer.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/composer.json b/composer.json index 5afd955d..8639f3e0 100644 --- a/composer.json +++ b/composer.json @@ -1,4 +1,7 @@ { + "name": "laravel/framework", + "description": "The Laravel Framework.", + "keywords": ["framework", "laravel"], "require": { "laravel/framework": "4.0.*" }, From 9b44c33cb3d9a727a24b44f8ee87d4d9c941b705 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Fri, 31 May 2013 08:30:40 -0500 Subject: [PATCH 120/140] Fix package name. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 8639f3e0..eda916fc 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "laravel/framework", + "name": "laravel/laravel", "description": "The Laravel Framework.", "keywords": ["framework", "laravel"], "require": { From 1c0920080ec2869cb0d4ea56ff4d819ab1b82bf4 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Fri, 7 Jun 2013 08:58:40 -0500 Subject: [PATCH 121/140] Update readme.md --- readme.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index a5f21749..0f34eb2a 100644 --- a/readme.md +++ b/readme.md @@ -1,5 +1,7 @@ ## Laravel PHP Framework +[![Latest Stable Version](https://poser.pugx.org/laravel/framework/version.png)](https://packagist.org/packages/laravel/framework) [![Total Downloads](https://poser.pugx.org/laravel/framework/d/total.png)](https://packagist.org/packages/laravel/framework) + Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable, creative experience to be truly fulfilling. Laravel attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as authentication, routing, sessions, and caching. Laravel aims to make the development process a pleasing one for the developer without sacrificing application functionality. Happy developers make the best code. To this end, we've attempted to combine the very best of what we have seen in other web frameworks, including frameworks implemented in other languages, such as Ruby on Rails, ASP.NET MVC, and Sinatra. @@ -16,4 +18,4 @@ ### Contributing To Laravel ### License -The Laravel framework is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT) \ No newline at end of file +The Laravel framework is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT) From 71a5ad62820fcf6ed73f22f4b83b6bd223ded7ed Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Fri, 7 Jun 2013 08:59:40 -0500 Subject: [PATCH 122/140] Update readme.md --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 0f34eb2a..235f900c 100644 --- a/readme.md +++ b/readme.md @@ -1,6 +1,6 @@ ## Laravel PHP Framework -[![Latest Stable Version](https://poser.pugx.org/laravel/framework/version.png)](https://packagist.org/packages/laravel/framework) [![Total Downloads](https://poser.pugx.org/laravel/framework/d/total.png)](https://packagist.org/packages/laravel/framework) +[![Latest Stable Version](https://poser.pugx.org/laravel/framework/version.png)](https://packagist.org/packages/laravel/framework) [![Total Downloads](https://poser.pugx.org/laravel/framework/d/total.png)](https://packagist.org/packages/laravel/framework) [![Build Status](https://travis-ci.org/laravel/framework.png)](https://travis-ci.org/laravel/framework) Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable, creative experience to be truly fulfilling. Laravel attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as authentication, routing, sessions, and caching. From 4b35eea3a7cc55b8a058d735e2232bfb824d4712 Mon Sep 17 00:00:00 2001 From: Brian Kiewel Date: Fri, 7 Jun 2013 16:58:58 -0700 Subject: [PATCH 123/140] changed spaces to tabs --- composer.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index eda916fc..18d39933 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { - "name": "laravel/laravel", - "description": "The Laravel Framework.", - "keywords": ["framework", "laravel"], + "name": "laravel/laravel", + "description": "The Laravel Framework.", + "keywords": ["framework", "laravel"], "require": { "laravel/framework": "4.0.*" }, From e526c088005409a360bd844d0382a26b04c2f2cf Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Sat, 8 Jun 2013 13:14:10 -0500 Subject: [PATCH 124/140] Added "pretend" option to mail config. --- app/config/mail.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/app/config/mail.php b/app/config/mail.php index eb9e6406..a7151a06 100644 --- a/app/config/mail.php +++ b/app/config/mail.php @@ -108,4 +108,17 @@ 'sendmail' => '/usr/sbin/sendmail -bs', -); + /* + |-------------------------------------------------------------------------- + | Mail "Pretend" + |-------------------------------------------------------------------------- + | + | When this option is enabled, e-mail will not actually be sent over the + | web and will instead be written to your application's logs files so + | you may inspect the message. This is great for local development. + | + */ + + 'pretend' => false, + +); \ No newline at end of file From 51a013fbbf4d834216909d532d40dc4067a6810f Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Sun, 9 Jun 2013 20:07:34 -0500 Subject: [PATCH 125/140] Fix closing div tag. --- app/views/hello.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/hello.php b/app/views/hello.php index 175f47a9..e85023bc 100644 --- a/app/views/hello.php +++ b/app/views/hello.php @@ -47,6 +47,6 @@

You have arrived.

-
+
From b7c147c77a44133e36893fbe5c88051ba392b113 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Sun, 9 Jun 2013 20:22:08 -0500 Subject: [PATCH 126/140] Update encrypter comment. --- app/config/app.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/config/app.php b/app/config/app.php index 77c9cfb4..d63f31c7 100644 --- a/app/config/app.php +++ b/app/config/app.php @@ -60,8 +60,8 @@ |-------------------------------------------------------------------------- | | This key is used by the Illuminate encrypter service and should be set - | to a random, long string, otherwise these encrypted values will not - | be safe. Make sure to change it before deploying any application! + | to a random, 32 character string, otherwise these encrypted strings + | will not be safe. Please do this before deploying an application! | */ From f583a9d23fcc2175e2a2245e2417fc3baedf9c93 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Sun, 9 Jun 2013 20:24:38 -0500 Subject: [PATCH 127/140] Added post create-project command to generate key. --- composer.json | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 18d39933..0162a474 100644 --- a/composer.json +++ b/composer.json @@ -16,14 +16,17 @@ ] }, "scripts": { - "pre-update-cmd": [ - "php artisan clear-compiled" - ], "post-install-cmd": [ "php artisan optimize" ], + "pre-update-cmd": [ + "php artisan clear-compiled" + ], "post-update-cmd": [ "php artisan optimize" + ], + "post-create-project-cmd": [ + "php artisan key:generate" ] }, "config": { From 0587fa28fff830df915061e99fb5bb49b79abca0 Mon Sep 17 00:00:00 2001 From: Brian Kiewel Date: Sun, 9 Jun 2013 20:52:43 -0700 Subject: [PATCH 128/140] changed google font url to be protocol relative --- app/views/hello.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/hello.php b/app/views/hello.php index 175f47a9..e472512c 100644 --- a/app/views/hello.php +++ b/app/views/hello.php @@ -4,7 +4,7 @@ Laravel PHP Framework