Skip to content

Commit

Permalink
Merge branch '3.2/develop' of http://github.com/kohana/core into 3.2/…
Browse files Browse the repository at this point in the history
…develop
  • Loading branch information
BRMatt committed Jul 24, 2011
2 parents a7b26d7 + 650823c commit 44fcb1b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 15 deletions.
28 changes: 17 additions & 11 deletions classes/kohana/request.php
Expand Up @@ -932,23 +932,29 @@ public function param($key = NULL, $default = NULL)
*/
public function redirect($url = '', $code = 302)
{
$referrer = $this->uri();

if (strpos($referrer, '://') === FALSE)
{
$referrer = URL::site($referrer, TRUE, Kohana::$index_file);
}

if (strpos($url, '://') === FALSE)
{
// Make the URI into a URL
$url = URL::site($url, TRUE);
$url = URL::site($url, TRUE, Kohana::$index_file);
}

// Redirect
$response = $this->create_response();

// Set the response status
$response->status($code);

// Set the location header
$response->headers('Location', $url);
if (($response = $this->response()) === NULL)
{
$response = $this->create_response();
}

// Send headers
$response->send_headers();
echo $response->status($code)
->headers('Location', $url)
->headers('Referer', $referrer)
->send_headers()
->body();

// Stop execution
exit;
Expand Down
6 changes: 3 additions & 3 deletions classes/kohana/text.php
Expand Up @@ -238,14 +238,14 @@ public static function random($type = NULL, $length = 8)
*
* $str = Text::ucfirst('content-type'); // returns "Content-Type"
*
* @param string word to transform
* @param string string to transform
* @param string delemiter to use
* @return string
*/
public static function ucfirst($word, $delimiter = '-')
public static function ucfirst($string, $delimiter = '-')
{
// Put the keys back the Case-Convention expected
return implode($delimiter, array_map('ucfirst', explode($delimiter, $word)));
return implode($delimiter, array_map('ucfirst', explode($delimiter, $string)));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion guide/kohana/upgrading.md
Expand Up @@ -78,7 +78,7 @@ In Kohana 3.2, HTTP caching is enabled slightly differently;

// Apply cache to request
$request = Request::factory('foo/bar',
HTTP_Cache::factory(array(), 'memcache'));
HTTP_Cache::factory('memcache'));

// In controller, ensure response sets cache control,
// this will cache the response for one hour
Expand Down

0 comments on commit 44fcb1b

Please sign in to comment.