commit c47bf701ea6db980d67c03df7b8aed576fcf88fd
parent e483253a29ad96e3e864efbebd0b006fd7cdae38
Author: Claudio Alessi <smoppy@gmail.com>
Date: Wed, 26 Jun 2019 11:14:17 +0200
Provide specified variable names into the view.
Diffstat:
1 file changed, 7 insertions(+), 0 deletions(-)
diff --git a/bored.php b/bored.php
@@ -495,6 +495,13 @@ function viewinc($incname, $viewdata = []) {
$viewfile = VIEWDIR.'/'.implode('/', explode('.', $incname)).'.php';
if(!file_exists($viewfile))
return NULL;
+
+ /* only provide specified variable names */
+ foreach($viewdata as $k => $v)
+ ${$k} = $v;
+ unset($viewdata);
+ unset($incname);
+
ob_start();
require($viewfile);
$d = ob_get_contents();