From: Nicolas Boisselier Date: Mon, 18 Nov 2024 23:19:57 +0000 (+0100) Subject: www/dbq/dbq.php X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=3ebd0a059af035e4023dc08201bd9ff53682b3fb;p=nb.git www/dbq/dbq.php --- diff --git a/www/dbq/dbq.php b/www/dbq/dbq.php index 0e8dc26a..18ea6662 100644 --- a/www/dbq/dbq.php +++ b/www/dbq/dbq.php @@ -1317,11 +1317,45 @@ EOF; } 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);