Запись [f:_dev/util/globals.php] < dev.sky.1.001
Версия 1.001
001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 018 019 020 021 022 023 024 025 026 027 028 029 030 031 032 033 034 035 036 037 038 039 040 041 042 043 044 045 046 047 048 049 050 051 052 053 054 055 056 057 058 059 060 | <?php defined('START') and AUTH_OK or die; $menu = ['Summary', 2 => 'Objects', 'Functions', 'Variables', 'Constants']; $TOP .= ' > ' . menu($WVAL, $menu, '?utility=globals&id=%d'); if (DEBUG || !$WVAL || $s_allow_submenu[0]) switch ($WVAL) { case 0: # write here code for main page $ltime = PHP_OS == 'WINNT' ? shell_exec('date /t & time /t') : '???'; # shell_exec('time') 2do - MAC PC $utime = PHP_OS == 'WINNT' ? preg_replace("@^.*?(\d+/\d+/\d{4} \d+:\d+ [A|P]M).*$@s", "$1", shell_exec('net stats srv')) : '???'; # shell_exec('uptime') $out = [ 'Primary configuration' => sprintf('DEV = %d, DEBUG = %d, ENC = %s', DEV, DEBUG, ENC), 'System' => PHP_OS, 'Server localtime' => $ltime, 'Server uptime' => $utime, ]; $ary = ['phpversion' => 'PHP version', 'zend_version' => 'Zend engine version', 'mysqli_get_server_info' => 'MySQL version']; if (function_exists('apache_get_version')) $ary += ['apache_get_version' => 'HTTP server version']; #$_SERVER['SERVER_SOFTWARE'] foreach ($ary as $k => $v) $out["$v:"] = $v == 'MySQL version' ? $k($idc) : $k(); $out += [ 'PHP NOW, GMT:' => gmdate(DATE_DT), 'PHP NOW:' => NOW . " ($u_php_tz)", 'SQL NOW:' => sql("+select now()") . " ($u_sql_tz)", # 'Cron layer last tick:' => $s_cron_dt, 'Timestamp NOW:' => time(), 'Max timestamp:' => sprintf('%d (PHP_INT_MAX), GMT: %s', PHP_INT_MAX, gmdate(DATE_DT, PHP_INT_MAX)), ]; break; # 2DO: REVIEW CONSOLE OPTIONS AND ADD HERE INFORMATION! case 1: $out = sql("+select tmemo from memory where id=3"); break; case 3: $out = get_defined_functions(); $out = print_r($out['user'], true); break; case 2: case 4: $out = get_defined_vars(); #array_splice($out, 0, 5); $out['GLOBALS'] = $out['_SERVER'] = '..cutted..'; # sprintf(span_r, '..cutted..'); $out = array_filter($out, create_function('$v', 'global $WVAL; return 4 == $WVAL ^ is_object($v);')); break; case 5: $list = array_keys($ary = get_defined_constants(true)); $g_c = isset($g_c) ? intval($g_c) : array_search('user', $list); $out = $ary[$list[$g_c]]; $tpl = '<form id="c_form">%s<select name="c" onchange="this.form.submit()">%s</select></form>'; $TOP .= sprintf($tpl, hidden(['utility' => 'globals', 'id' => 5]), option($g_c, $list)); break; } # is_array($out) and $out = array_map(create_function('$v', 'return html($v);'), $out); if (is_array($out)) { echo '<form method="post">' . th(['NAME', in_array($PVAL, [4,5]) ? '' : 'VALUE'] + (isset($actions) ? [2 => ''] : []), 'id="table"'); reset($out); for ($i = 0; list($k, $v) = each($out); ) { is_string($v) or is_int($v) or $v = print_r($v, true); in_array($PVAL, [4,5]) or $v = html($v); echo td([[$k, 'style="min-width:100px"'], $v], eval(zebra)); } echo '</table>'; if (@$actions) printf('Action: <input type="submit" name="do" value="%s" /></form>', is_string($actions) ? $actions : 'do'); echo '</form>'; } elseif ($out) printf("<pre>%s</pre>", html($out)); ?> <style type="text/css"> #c_form { display:inline; } #c_form select { font-size: 11px; margin: -5px 3px; } </style> |