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/nl/validation.php b/application/language/nl/validation.php index 3017d8fa..eedac482 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 geldig 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.", diff --git a/application/language/ru/validation.php b/application/language/ru/validation.php index 8fd15f5c..7f375023 100644 --- a/application/language/ru/validation.php +++ b/application/language/ru/validation.php @@ -38,16 +38,16 @@ "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 должно быть целым числом.", "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 +); 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 +} diff --git a/laravel/cli/tasks/test/runner.php b/laravel/cli/tasks/test/runner.php index eb1a8625..60575bf5 100644 --- a/laravel/cli/tasks/test/runner.php +++ b/laravel/cli/tasks/test/runner.php @@ -88,7 +88,8 @@ protected function test() // strings with spaces inside should be wrapped in quotes. $esc_path = escapeshellarg($path); - passthru('LARAVEL_ENV='.Request::env().' phpunit --configuration '.$esc_path, $status); + putenv('LARAVEL_ENV='.Request::env()); + passthru('phpunit --configuration '.$esc_path, $status); @unlink($path); 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 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 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')); } diff --git a/laravel/database/eloquent/model.php b/laravel/database/eloquent/model.php index 23d25b02..18968120 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; } /** @@ -441,7 +443,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 +564,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,7 +772,7 @@ public function __call($method, $parameters) } elseif (starts_with($method, 'set_')) { - $this->set_attribute(substr($method, 4), $parameters[0]); + return $this->set_attribute(substr($method, 4), $parameters[0]); } // Finally we will assume that the method is actually the beginning of a 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 +} 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)) !== ''; } 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; } /** 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 +} 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; } 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 +