Merging fixes and enhancements into trunk

Revision: [1862]
Cleaning up scaffold views

Revision: [1861]
Added fix to scaffold when setting more than one 1 : 1 associations.

Revision: [1860]
Adding patch for Ticket #314

Revision: [1859]
Fixing Ticket #311

Revision: [1858] [1857]

git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1863 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2006-01-25 22:40:17 +00:00
parent 26d7620f1b
commit b4f6dcc474
8 changed files with 302 additions and 230 deletions

View file

@ -387,6 +387,40 @@ class Controller extends Object
return $this->_viewClass->render($action, $layout, $file);
}
/**
* Gets the referring URL of this request
*
* @param string $default Default URL to use if HTTP_REFERER cannot be read from headers
* @param boolean $local If true, restrict referring URLs to local server
* @access public
*/
function referer($default = null, $local = false)
{
$ref = env('HTTP_REFERER');
$base = FULL_BASE_URL . $this->webroot;
if ($ref != null && defined(FULL_BASE_URL))
{
if (strpos(env('HTTP_REFERER'), $base) == 0)
{
return substr($ref, strlen($base) - 1);
}
elseif (!$local)
{
return $ref;
}
}
if ($default != null)
{
return $default;
}
else
{
return '/';
}
}
/**
* Sets data for this view. Will set title if the key "title" is in given $data array.
*