Added private templates via the __shared directory.

This commit is contained in:
Josh Sherman 2010-10-20 01:06:11 -04:00
parent 67de8cdf47
commit 5ea7756803
3 changed files with 21 additions and 9 deletions

View file

@ -49,16 +49,25 @@ class Controller extends Object
{
parent::__construct();
// Catches requests to PICKLES core files and passes them through
if (isset($_REQUEST['request']) && preg_match('/^__pickles\/(css|js)\/.+$/', $_REQUEST['request']))
if (isset($_REQUEST['request']))
{
// Checks that the file exists
$file = str_replace('__pickles', PICKLES_PATH, $_REQUEST['request']);
if (file_exists($file))
// Catches requests to PICKLES core files and passes them through
if (preg_match('/^__pickles\/(css|js)\/.+$/', $_REQUEST['request']))
{
// Sets the pass thru flag and dumps the data
$this->passthru = true;
exit(file_get_contents($file));
// Checks that the file exists
$file = str_replace('__pickles', PICKLES_PATH, $_REQUEST['request']);
if (file_exists($file))
{
// Sets the pass thru flag and dumps the data
$this->passthru = true;
exit(file_get_contents($file));
}
}
// Catches requests to the __shared directory
if (preg_match('/^__shared/', $_REQUEST['request']))
{
header('Location: /');
exit;
}
}

View file

@ -120,7 +120,10 @@ abstract class Display_Common extends Object
if ($template != null)
{
$template_name = $type . '_template';
$this->$template_name = SITE_TEMPLATE_PATH . $template . ($this->extension != false ? '.' . $this->extension : '');
$template_path = SITE_TEMPLATE_PATH . ($type == 'parent' ? '__shared/' : '');
$template_file = $template_path . $template . ($this->extension != false ? '.' . $this->extension : '');
$this->$template_name = $template_file;
}
}