} elseif ($action == 'phpinfo') {
$this->deniedUnless($this->perm >= self::ADMIN);
#phpinfo();
- $this->rows_table($action,$this->phpinfo_rows());
- #$this->page(['phpinfo'=>$this->page->phpinfo(true)]);
- #$this->page($this->page->phpinfo());
+ #$this->rows_table($action,$this->phpinfo_rows());
+ ob_start();
+ system("php -r 'phpinfo();'");
+ $phpinfo = ob_get_contents();
+ ob_end_clean();
+
+ $lines = explode("\n",$phpinfo);
+
+ $section = 'Root';
+ $rows = [];
+
+ while (true) {
+ $line = next($lines);
+ if ($line === false) break;
+
+ if (strpos($line, '_______') === 1) {
+ #bye($line);
+ $section = '';
+ while (empty($section)) {
+ $section = next($lines);
+ }
+ #bye($section);
+ if ($section == 'PHP Credits') break; # No more interrested
+ continue;
+ }
+
+ if (preg_match('/(.*) => (.*)/',$line,$m)) {
+ $rows[] = [
+ 'section' => $section,
+ 'key' => $m[1],
+ 'val' => $m[2],
+ ];
+ }
+
+ #substr(trim($line_buffer), -1) === ','
+
+ }
+ $this->page($rows);
#$this->page($this,'phpinfo_rows');
- #$this->phpinfo_rows();
} elseif ($action == '_POST') { $this->page($_POST);
} elseif ($action == '_GET') { $this->page($_GET);