Mercurial > SimpleWebPresenter
diff index.php @ 12:a20bb1b51aad
Merge.
| author | Tom Fredrik "BFG" Klaussen <bfg@blenning.no> |
|---|---|
| date | Tue, 29 May 2012 21:08:23 +0200 |
| parents | ba6f0818018b 19dfa6f3e2be |
| children | ee2c31392ea3 |
line wrap: on
line diff
--- a/index.php Mon May 28 22:57:30 2012 +0200 +++ b/index.php Tue May 29 21:08:23 2012 +0200 @@ -159,8 +159,25 @@ $files=$body->getElementsByTagName("file"); foreach ($files as $file) { - $src=$file->getAttribute("src"); - $file_content=loadFile("${lang}/${src}"); + $script=$file->getAttribute("script"); + if ($script) { + $src=""; + $cwd=getcwd(); + + $matches=array(); + preg_match('/(.*\/)/', $script, $matches); + $dirname=$matches[0]; + preg_match('/([^\/]*)$/', $script, $matches); + $filename=$matches[0]; + chdir("${lang}/${dirname}"); + $pipe=popen("php ${filename}","r"); + $file_content = stream_get_contents($pipe); + chdir("${cwd}"); + } + else { + $src=$file->getAttribute("src"); + $file_content=loadFile("${lang}/${src}"); + } if(floatval($file_content)<0) { errorPage("Resource not found '${lang}/${src}'"); }
