示例#1
0
<?php

require_once 'functions.php';
$user_info = denies_with_redirect();
$user_email = $user_info['user_email'];
/*
if (!preg_match('|@appgame\.com$|i', $user_email)) {
	header('Location: /index.php');
	exit();
}
*/
header('Content-Type: text/html; charset=utf-8');
$db_captions = get_db_captions();
$table_captions = get_table_captions();
$init_db = get_param('db', 'default');
$init_table = get_param('table', 'default');
?>
<html><head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" type="image/ico" href="images/favicon.ico" />
<title>JsonDB</title>


<!--加载jquery-->
<script type="text/javascript" language="javascript" src="client/jquery/jquery-1.11.1.min.js"></script>
<script type="text/javascript" language="javascript" src="client/jquery/md5.min.js"></script>
<script type="text/javascript" language="javascript" src="client/jquery/jquery.fileDownload.js"></script>
<script type="text/javascript" language="javascript" src="client/contextMenu/jquery.contextMenu.js"></script>
<script type="text/javascript" language="javascript" src="client/contextMenu/jquery.ui.position.js"></script>

示例#2
0
function get_table_captions($db_name = null)
{
    $result = array();
    if ($db_name === null) {
        $db_captions = get_db_captions();
        foreach ($db_captions as $caption) {
            $result[$caption['name']] = get_table_captions($caption['name']);
        }
        return $result;
    } else {
        $dirs = glob(dbs_path() . "/{$db_name}/*", GLOB_ONLYDIR);
        usort($dirs, 'filemtime_sort');
        foreach ($dirs as $table_path) {
            $table_name = basename($table_path);
            $filename = $table_path . '/schema.json';
            $schema_str = file_get_contents($filename);
            if ($schema_str) {
                $schema = json_decode($schema_str, true);
                $caption = $schema['caption'];
                $caption['name'] = $table_name;
                $result[] = $caption;
            }
        }
        return $result;
    }
}