$opt['use_out'] = false;
if ($this->p('out') or !preg_match('/^('.join('|',
- [ '','template','table','sql','div','wp','_csv','_xml','_json','_yaml' ] # local
+ [ '','template','table','sql','div','wp' ] # local
).')$/',$format))
{
'json' => array(
#'enclose' => array('['.NB_EOL,NB_EOL.']'),
- 'enclose' => array('[',']'),
+ 'enclose' => array('['.self::p('eol',NB_EOL),']'),
'row' => function(&$o,&$row) { return json_encode($row); },
'eol' => self::p('eol',NB_EOL),
'rec' => ',',
padding-left: 1em;
padding-right: 1em;
background-color: #E6E6E6;
+ background-color: #009B9C;
}
h1 {
a,
body {
- color: #333333;
+ color: #cccccc;
}
ul {
text-decoration: none;
line-height: 1.5em;
cursor: pointer;
- background-color: #3C3C3B;
- border: solid 1px #3C3C3B;
+ background-color: #cccccc;
+ border: solid 1px #cccccc;
border-radius: 4px;
-webkit-border-radius: 4px;
white-space: nowrap;
color: #ddd;
margin: 0;
padding: 0 0.2em;
+ color: #009B9C;
}
a:hover,
<?php
# Make it work in php_cli
if (empty($_SERVER['DOCUMENT_ROOT'])) $_SERVER['DOCUMENT_ROOT'] = dirname(__FILE__);
+if (empty($_SERVER['HTTP_USER_AGENT'])) $_SERVER['HTTP_USER_AGENT'] = '';
#var_export([$_SERVER['REQUEST_URI']]);
function run() {
'db' => 'ls',
'table' => 'ls',
'action' => 'ls',
- 'format' => 'human',
+ 'format' => ( preg_match('/^\S+\s+.Windows|iPhone|Android|Macintosh/',$_SERVER['HTTP_USER_AGENT']) ? 'table' : 'human' ),
]);
if (!$params['db']) not_implemented();
#
# Page
require_once($_SERVER['DOCUMENT_ROOT'].'/../../../lib/php/page.php');
+ Page::pdef('out',1);
+ $formats = array_keys(out::types());
+ foreach ($params as $k=>$v) {
+ if (!in_array($v,$formats)) continue;
+ $params['format'] = $v;
+ break;
+ }
$Page = new Page([
'css' => '/default.css',
]);
return $Page->end();
} elseif ($params['action'] == 'status') {
- $Db->out($Table->status()+$Table->status(['fields','sql']));
+ $Db->out($Table->status()+$Table->status(['fields']));
return $Page->end();
} elseif ($params['action'] == 'fields') {