Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions library/Rain/Tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class Tpl {
'sandbox' => true,
'remove_comments' => false,
'registered_tags' => array(),
'nfs' => false,
);

// tags registered by the developers
Expand Down
25 changes: 25 additions & 0 deletions library/Rain/Tpl/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,15 @@ public function compileFile(
$parsedTemplateFilepath
) {

//Copy on TMP file used for NFS
if ($this->config['nfs'])
{
$tmpFile = uniqid();
copy($templateFilepath, '/tmp/'.$tmpFile);
$templateFilepath = '/tmp/'.$tmpFile;
}


// open the template
$fp = fopen($templateFilepath, "r");

Expand Down Expand Up @@ -160,6 +169,10 @@ public function compileFile(

// close the file
fclose($fp);

//Delete TMP file
if ($this->config['nfs'])
unlink($templateFilepath);
}

/**
Expand All @@ -173,6 +186,14 @@ public function compileFile(
*/
public function compileString($templateName, $templateBasedir, $templateFilepath, $parsedTemplateFilepath, $code) {

//Copy on TMP file used for NFS
if ($this->config['nfs'])
{
$tmpFile = uniqid();
copy($templateFilepath, '/tmp/'.$tmpFile);
$templateFilepath = '/tmp/'.$tmpFile;
}

// open the template
$fp = fopen($parsedTemplateFilepath, "w");

Expand Down Expand Up @@ -215,6 +236,10 @@ public function compileString($templateName, $templateBasedir, $templateFilepath

// close the file
fclose($fp);

//Delete TMP file
if ($this->config['nfs'])
unlink($templateFilepath);
}

/**
Expand Down