function at_config_display() { if (!atIsAdminUser()) { return; } $runningconfig = atGetRunningConfig(); extract($runningconfig); if (isset($_GET['at_admin'])) { ob_end_clean(); OpenTable(); eval($command['print-link']); echo "<h1>AutoTheme</h1><br />"; switch ($_GET['at_admin']) { case "cmds": echo "<h2>" . _AT_LOADEDCOMMANDS . "</h2>"; $commands = atRunningGetVar("command"); foreach ($runningconfig as $cmd => $action) { $vars = " echo \${$cmd};"; } $commands = array_merge((array) $commands, (array) $vars); echo "<table border=\"1\" width=\"100%\"><tr><td><b>" . _AT_COMMAND . "</b></td><td width=\"50%\"><b>" . _AT_ACTION . "</b></td><td width=\"50%\"><b>" . _AT_RESULT . "</b></td></tr>"; foreach ($commands as $cmd => $action) { ob_start(); eval($action); $result = ob_get_contents(); ob_end_clean(); echo "<tr><td valign=\"top\">{$cmd}</td><td valign=\"top\">" . htmlentities($action) . "</td><td valign=\"top\"> {$result}</td></tr>"; } echo "</table>"; break; case "at": // echo "<h2>" . _AT_CONFIG . "</h2>"; echo "<table border=\"1\" width=\"100%\"><tr><td><b>" . _AT_NAME . "</b></td><td><b>" . _AT_VALUE . "</b></td></tr>"; $atconfig = atGetAutoConfig(); foreach ($atconfig as $name => $val) { if (is_array($val)) { ob_start(); at_array_display($val); $result = ob_get_contents(); ob_end_clean(); } else { $result = $val; } echo "<tr><td valign=\"top\">{$name}</td><td valign=\"top\">{$result}</td></tr>"; } echo "</table>"; break; case "theme": echo "<h2>" . _AT_THEMECONFIG . "</h2>"; echo "<table border=\"1\" width=\"100%\"><tr><td><b>" . _AT_NAME . "</b></td><td><b>" . _AT_VALUE . "</b></td></tr>"; $themeconfig = atGetThemeConfig(); foreach ($themeconfig as $name => $val) { if (is_array($val)) { ob_start(); at_array_display($val); $result = ob_get_contents(); ob_end_clean(); } else { $result = $val; } echo "<tr><td valign=\"top\">{$name}</td><td valign=\"top\">{$result}</td></tr>"; } echo "</table>"; break; case "running": echo "<h2>" . _AT_RUNNINGCONFIG . "</h2>"; echo "<table border=\"1\" width=\"100%\"><tr><td><b>" . _AT_NAME . "</b></td><td><b>" . _AT_VALUE . "</b></td></tr>"; $runningconfig = atGetRunningConfig(); foreach ($runningconfig as $name => $val) { if (is_array($val)) { ob_start(); at_array_display($val); $result = ob_get_contents(); ob_end_clean(); } else { $result = $val; } echo "<tr><td valign=\"top\">{$name}</td><td valign=\"top\">{$result}</td></tr>"; } echo "</table>"; break; } CloseTable(); die; } }
function at_array_display($var) { foreach ($var as $k => $v) { if (is_array($v)) { echo $k; at_array_display($v); continue; } echo "<pre>" . htmlentities("{$k} = {$v}") . "</pre>"; } }