Beispiel #1
0
} else {
    if (isset($_GET['task'])) {
        $task = $_GET['task'];
        unset($_GET['task']);
    } else {
        $task = 'None';
    }
}
// Call the method
switch ($task) {
    case 'optimizeDB':
        $data = array();
        $data['success'] = true;
        $data['errors'] = array();
        // Call method ===========================================================================
        $return = $controller->optimizeDB();
        $return = json_decode($return['data'], TRUE);
        // User notification =====================================================================
        $data['errors'] = $return['errors'];
        if (!empty($data['errors'])) {
            $data['success'] = false;
            // Notification
            $data['msgType'] = 'warning';
            $data['msg'] = T_('Bad Settings!');
        } else {
            $data['success'] = true;
            // Notification
            bgp_set_alert(T_('Optimizing tables... Done!'), T_('Tables are up to date.'), 'success');
        }
        // Return ================================================================================
        header('Content-Type: application/json');
Beispiel #2
0
/**
 * Load Plugin Controller
 */
// Init Controller
$controller = new BGP_Controller_Tools();
// Get the method
if (isset($_POST['task'])) {
    $task = $_POST['task'];
    unset($_POST['task']);
} else {
    if (isset($_GET['task'])) {
        $task = $_GET['task'];
        unset($_GET['task']);
    } else {
        $task = 'None';
    }
}
// Call the method
switch ($task) {
    case 'optimizeDB':
        $json = $controller->optimizeDB();
        if ($json['success'] === TRUE) {
            // Notification
            bgp_set_alert(T_('Optimizing tables... Done!'), T_('Tables are up to date.'), 'success');
        }
        Flight::json($json);
        exit(0);
    default:
        Flight::redirect('/400');
}
Flight::redirect('/403');