Skip to content

Commit 122f3ab

Browse files
committed
Merge pull request #2 from laravel/master
merge
2 parents f742cc3 + 6a1d203 commit 122f3ab

File tree

15 files changed

+60
-40
lines changed

15 files changed

+60
-40
lines changed

application/language/en/validation.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@
4646
"ip" => "The :attribute must be a valid IP address.",
4747
"match" => "The :attribute format is invalid.",
4848
"max" => array(
49-
"numeric" => "The :attribute must be less than :max.",
50-
"file" => "The :attribute must be less than :max kilobytes.",
51-
"string" => "The :attribute must be less than :max characters.",
49+
"numeric" => "The :attribute may not be greater than :max.",
50+
"file" => "The :attribute may not be greater than :max kilobytes.",
51+
"string" => "The :attribute may not be greater than :max characters.",
5252
),
5353
"mimes" => "The :attribute must be a file of type: :values.",
5454
"min" => array(

application/language/nl/validation.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"countbetween" => ":attribute moet tussen :min en :max geselecteerde elementen bevatten.",
2828
"countmax" => ":attribute moet minder dan :max geselecteerde elementen bevatten.",
2929
"countmin" => ":attribute moet minimaal :min geselecteerde elementen bevatten.",
30+
"date_format" => ":attribute moet een geldig datum formaat bevatten.",
3031
"different" => ":attribute en :other moeten verschillend zijn.",
3132
"email" => ":attribute is geen geldig e-mailadres.",
3233
"exists" => ":attribute bestaat niet.",
@@ -49,6 +50,7 @@
4950
"not_in" => "Het formaat van :attribute is ongeldig.",
5051
"numeric" => ":attribute moet een nummer zijn.",
5152
"required" => ":attribute is verplicht.",
53+
"required_with" => ":attribute is verplicht i.c.m. :field",
5254
"same" => ":attribute en :other moeten overeenkomen.",
5355
"size" => array(
5456
"numeric" => ":attribute moet :size zijn.",

application/language/ru/validation.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,16 @@
3838
"countmin" => "The :attribute must have at least :min selected elements.",
3939
"different" => "Поля :attribute и :other должны различаться.",
4040
"email" => "Поле :attribute имеет неверный формат.",
41-
"exists" => "Выбранное значение для :attribute уже существует.",
41+
"exists" => "Выбранное значение для :attribute не верно.",
4242
"image" => "Поле :attribute должно быть картинкой.",
4343
"in" => "Выбранное значение для :attribute не верно.",
4444
"integer" => "Поле :attribute должно быть целым числом.",
4545
"ip" => "Поле :attribute должно быть полным IP-адресом.",
4646
"match" => "Поле :attribute имеет неверный формат.",
4747
"max" => array(
48-
"numeric" => "Поле :attribute должно быть меньше :max.",
49-
"file" => "Поле :attribute должно быть меньше :max Килобайт.",
50-
"string" => "Поле :attribute должно быть короче :max символов.",
48+
"numeric" => "Поле :attribute должно быть не больше :max.",
49+
"file" => "Поле :attribute должно быть не больше :max Килобайт.",
50+
"string" => "Поле :attribute должно быть не длиннее :max символов.",
5151
),
5252
"mimes" => "Поле :attribute должно быть файлом одного из типов: :values.",
5353
"min" => array(
@@ -101,4 +101,4 @@
101101

102102
'attributes' => array(),
103103

104-
);
104+
);

laravel/cli/tasks/migrate/migrator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ public function install()
200200
$table->primary(array('bundle', 'name'));
201201
});
202202

203-
echo "Migration table created successfully.";
203+
echo "Migration table created successfully.".PHP_EOL;
204204
}
205205

206206
/**
@@ -275,4 +275,4 @@ protected function display($migration)
275275
return $migration['bundle'].'/'.$migration['name'];
276276
}
277277

278-
}
278+
}

laravel/cli/tasks/test/runner.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ protected function test()
8888
// strings with spaces inside should be wrapped in quotes.
8989
$esc_path = escapeshellarg($path);
9090

91-
passthru('LARAVEL_ENV='.Request::env().' phpunit --configuration '.$esc_path, $status);
91+
putenv('LARAVEL_ENV='.Request::env());
92+
passthru('phpunit --configuration '.$esc_path, $status);
9293

9394
@unlink($path);
9495

laravel/core.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,12 @@
154154

155155
use Symfony\Component\HttpFoundation\LaravelRequest as RequestFoundation;
156156

157+
RequestFoundation::enableHttpMethodParameterOverride();
158+
157159
Request::$foundation = RequestFoundation::createFromGlobals();
158160

161+
162+
159163
/*
160164
|--------------------------------------------------------------------------
161165
| Determine The Application Environment

laravel/crypter.php

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ protected static function iv_size()
116116
*/
117117
protected static function pad($value)
118118
{
119-
$pad = static::$block - (Str::length($value) % static::$block);
119+
$pad = static::$block - (strlen($value) % static::$block);
120120

121121
return $value .= str_repeat(chr($pad), $pad);
122122
}
@@ -129,14 +129,7 @@ protected static function pad($value)
129129
*/
130130
protected static function unpad($value)
131131
{
132-
if (MB_STRING)
133-
{
134-
$pad = ord(mb_substr($value, -1, 1, Config::get('application.encoding')));
135-
}
136-
else
137-
{
138-
$pad = ord(substr($value, -1));
139-
}
132+
$pad = ord(substr($value, -1));
140133

141134
if ($pad and $pad <= static::$block)
142135
{
@@ -145,12 +138,7 @@ protected static function unpad($value)
145138
// as the padding appears to have been changed.
146139
if (preg_match('/'.chr($pad).'{'.$pad.'}$/', $value))
147140
{
148-
if (MB_STRING)
149-
{
150-
return mb_substr($value, 0, Str::length($value) - $pad, Config::get('application.encoding'));
151-
}
152-
153-
return substr($value, 0, Str::length($value) - $pad);
141+
return substr($value, 0, strlen($value) - $pad);
154142
}
155143

156144
// If the padding characters do not match the expected padding

laravel/database/connection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ public function query($sql, $bindings = array())
197197
// For insert statements that use the "returning" clause, which is allowed
198198
// by database systems such as Postgres, we need to actually return the
199199
// real query result so the consumer can get the ID.
200-
elseif (stripos($sql, 'insert') === 0 and stripos($sql, 'returning') !== false)
200+
elseif (stripos($sql, 'insert') === 0 and stripos($sql, ') returning') !== false)
201201
{
202202
return $this->fetch($statement, Config::get('database.fetch'));
203203
}

laravel/database/eloquent/model.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ public function has_many_and_belongs_to($model, $table = null, $foreign = null,
335335
*/
336336
public function push()
337337
{
338-
$this->save();
338+
if (!$this->save()) return false;
339339

340340
// To sync all of the relationships to the database, we will simply spin through
341341
// the relationships, calling the "push" method on each of the models in that
@@ -349,9 +349,11 @@ public function push()
349349

350350
foreach ($models as $model)
351351
{
352-
$model->push();
352+
if (!$model->push()) return false;
353353
}
354354
}
355+
356+
return true;
355357
}
356358

357359
/**
@@ -441,7 +443,7 @@ public function timestamp()
441443
}
442444

443445
/**
444-
*Updates the timestamp on the model and immediately saves it.
446+
* Updates the timestamp on the model and immediately saves it.
445447
*
446448
* @return void
447449
*/
@@ -562,11 +564,12 @@ public function get_attribute($key)
562564
*
563565
* @param string $key
564566
* @param mixed $value
565-
* @return void
567+
* @return Model
566568
*/
567569
public function set_attribute($key, $value)
568570
{
569571
$this->attributes[$key] = $value;
572+
return $this;
570573
}
571574

572575
/**
@@ -769,7 +772,7 @@ public function __call($method, $parameters)
769772
}
770773
elseif (starts_with($method, 'set_'))
771774
{
772-
$this->set_attribute(substr($method, 4), $parameters[0]);
775+
return $this->set_attribute(substr($method, 4), $parameters[0]);
773776
}
774777

775778
// Finally we will assume that the method is actually the beginning of a

laravel/database/eloquent/relationships/belongs_to.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public function match($relationship, &$children, $parents)
110110
*/
111111
public function foreign_value()
112112
{
113-
return $this->base->get_attribute($this->foreign);
113+
return $this->base->{$this->foreign};
114114
}
115115

116116
/**
@@ -126,4 +126,4 @@ public function bind($id)
126126
return $this->base;
127127
}
128128

129-
}
129+
}

laravel/input.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ public static function except($keys)
160160
*/
161161
public static function had($key)
162162
{
163+
if (is_array(static::old($key))) return true;
164+
163165
return trim((string) static::old($key)) !== '';
164166
}
165167

laravel/response.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,14 @@ public static function download($path, $name = null, $headers = array())
202202
// off to the HttpFoundation and let it create the header text.
203203
$response = new static(File::get($path), 200, $headers);
204204

205-
$d = $response->disposition($name);
205+
// If the Content-Disposition header has already been set by the
206+
// merge above, then do not override it with out generated one.
207+
if (!isset($headers['Content-Disposition'])) {
208+
$d = $response->disposition($name);
209+
$response = $response->header('Content-Disposition', $d);
210+
}
206211

207-
return $response->header('Content-Disposition', $d);
212+
return $response;
208213
}
209214

210215
/**

laravel/tests/cases/eloquent.test.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,19 @@ public function testAttributeMagicSetterMethodChangesAttribute()
133133
Model::$accessible = null;
134134
}
135135

136+
/**
137+
* Test the Model::__set method allows chaining.
138+
*
139+
* @group laravel
140+
*/
141+
public function testAttributeMagicSetterMethodAllowsChaining()
142+
{
143+
$model = new Model;
144+
$this->assertInstanceOf('Model', $model->set_foo('foo'));
145+
$model->set_bar('bar')->set_baz('baz');
146+
$this->assertEquals(array('foo' => 'foo', 'bar' => 'bar', 'baz' => 'baz'), $model->to_array());
147+
}
148+
136149
/**
137150
* Test the Model::__get method.
138151
*
@@ -288,4 +301,4 @@ public function testConvertingToArray()
288301

289302
}
290303

291-
}
304+
}

laravel/url.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,8 @@ public static function transpose($uri, $parameters)
355355
*/
356356
public static function valid($url)
357357
{
358+
if (starts_with($url, '//')) return true;
359+
358360
return filter_var($url, FILTER_VALIDATE_URL) !== false;
359361
}
360362

public/.htaccess

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Apache configuration file
2-
# http://httpd.apache.org/docs/2.2/mod/quickreference.html
2+
# http://httpd.apache.org/docs/current/mod/quickreference.html
33

44
# Note: ".htaccess" files are an overhead for each request. This logic should
55
# be placed in your Apache config whenever possible.
6-
# http://httpd.apache.org/docs/2.2/howto/htaccess.html
6+
# http://httpd.apache.org/docs/current/howto/htaccess.html
77

88
# Turning on the rewrite engine is necessary for the following rules and
99
# features. "+FollowSymLinks" must be enabled for this to work symbolically.
@@ -20,4 +20,4 @@
2020
RewriteCond %{REQUEST_FILENAME} !-f
2121
RewriteCond %{REQUEST_FILENAME} !-d
2222
RewriteRule ^(.*)$ index.php/$1 [L]
23-
</IfModule>
23+
</IfModule>

0 commit comments

Comments
 (0)