mirror of
https://github.com/xevidos/codiad.git
synced 2024-11-14 07:41:14 +01:00
63 lines
No EOL
1.2 KiB
PHP
63 lines
No EOL
1.2 KiB
PHP
<?php
|
|
require_once('../../common.php');
|
|
|
|
if ( ! isset( $_POST['action'] ) && ! isset( $_GET['action'] ) ) {
|
|
|
|
die( formatJSEND( "error", "Missing parameter" ) );
|
|
} else {
|
|
|
|
if( isset( $_POST["action"] ) ) {
|
|
|
|
$action = $_POST["action"];
|
|
} else {
|
|
|
|
$action = $_GET["action"];
|
|
}
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////
|
|
// Verify Session or Key
|
|
//////////////////////////////////////////////////////////////////
|
|
|
|
checkSession();
|
|
|
|
switch( $action ) {
|
|
|
|
case( "create_default_tables" ):
|
|
|
|
if( is_admin() ) {
|
|
|
|
global $sql;
|
|
$result = $sql->create_default_tables();
|
|
|
|
//echo var_dump( $result );
|
|
|
|
if( $result === true ) {
|
|
|
|
exit( formatJSEND( "success", "Created tables." ) );
|
|
} else {
|
|
|
|
exit( formatJSEND( "error", array( "message" => "Could not create tables.", "result" => $result ) ) );
|
|
}
|
|
} else {
|
|
|
|
exit( formatJSEND( "error", "Only admins can use this method." ) );
|
|
}
|
|
break;
|
|
|
|
case( "get_ini_setting" ):
|
|
|
|
if( isset( $_POST["option"] ) ) {
|
|
|
|
$option = $_POST["option"];
|
|
} else {
|
|
|
|
$option = $_GET["option"];
|
|
}
|
|
|
|
exit( json_encode( array(
|
|
"option" => $option,
|
|
"value" => ini_get( $option ),
|
|
)));
|
|
break;
|
|
} |