comparison index.php @ 8:19dfa6f3e2be

Support for scripts.
author Tom Fredrik "BFG" Klaussen <bfg@blenning.no>
date Sun, 12 Jun 2011 14:15:00 +0200
parents 350a8c63bd14
children a20bb1b51aad 91ee5f49907e
comparison
equal deleted inserted replaced
7:350a8c63bd14 8:19dfa6f3e2be
126 } 126 }
127 return $param_value; 127 return $param_value;
128 } 128 }
129 129
130 foreach ($files as $file) { 130 foreach ($files as $file) {
131 $src=$file->getAttribute("src"); 131 $script=$file->getAttribute("script");
132 $file_content=loadFile("${lang}/${src}"); 132 if ($script) {
133 $src="";
134 $cwd=getcwd();
135
136 $matches=array();
137 preg_match('/(.*\/)/', $script, $matches);
138 $dirname=$matches[0];
139 preg_match('/([^\/]*)$/', $script, $matches);
140 $filename=$matches[0];
141 chdir("${lang}/${dirname}");
142 $pipe=popen("php ${filename}","r");
143 $file_content = stream_get_contents($pipe);
144 chdir("${cwd}");
145 }
146 else {
147 $src=$file->getAttribute("src");
148 $file_content=loadFile("${lang}/${src}");
149 }
133 if(floatval($file_content)<0) { 150 if(floatval($file_content)<0) {
134 errorPage("Resource not found '${lang}/${src}'"); 151 errorPage("Resource not found '${lang}/${src}'");
135 } 152 }
136 153
137 $filters=$file->getElementsByTagName("filter"); 154 $filters=$file->getElementsByTagName("filter");