-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathjson.php
More file actions
56 lines (39 loc) · 1.1 KB
/
json.php
File metadata and controls
56 lines (39 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
/**
* Copyright (C) 2013, Greg Colley
* Available under http://en.wikipedia.org/wiki/MIT_License
*
* @author Greg Colley
*/
if (!file_exists('config.php')) {
$json_data = (array('error'=>'Error - Please check config.php or copy from config.sample.php','success'=>0));
echo json_encode($json_data);
die();
}
require('config.php');
// Override the config settings for suppressing errors
error_reporting(E_ALL);
ini_set('display_errors', 0);
require('functions.php');
require_once('classes/CoreDB.class.php');
require_once('classes/DbDiff.class.php');
require_once('classes/json.class.php');
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;
if ($action) {
json::print_headers();
switch ($action) {
case 'get_database':
$json_data = json::show_databases($global_db_config);
break;
case 'export_schema':
$json_data = json::export_schema($global_db_config);
break;
case 'compare_diff':
$json_data = json::compare_diff($global_db_config);
break;
default:
$json_data = (array('error'=>'Error','success'=>0));
} // switch
echo json_encode($json_data);
}
?>