Example #1
0
 public function messagesToDataArray($controller)
 {
     $errors = getErrorArray();
     if (!empty($errors)) {
         $controller->data['php_errors'] = $errors;
     }
     if (!empty($controller->errors)) {
         $controller->data['errors'] = $controller->errors;
     }
     if (!empty($controller->warnings)) {
         $controller->data['warnings'] = $controller->warnings;
     }
     if (!empty($controller->messages)) {
         $controller->data['messages'] = $controller->messages;
     }
 }
Example #2
0
File: ajax.php Project: T-101/party
    $stmt->bindValue(3, htmlspecialchars($end), SQLITE3_TEXT);
    $stmt->bindValue(4, htmlspecialchars($where), SQLITE3_TEXT);
    $result = $stmt->execute();
    return $result;
}
if (isset($_POST) && isset($_POST['action'])) {
    $dbConnection = connectDB();
    $action = $_POST['action'];
    if ($dbConnection) {
        switch ($action) {
            case 'getParties':
                $retarr = getParties($dbConnection);
                break;
            case 'deleteParty':
                $retarr = deleteParty($dbConnection, $_POST['party']);
                break;
            case 'addParty':
                $retarr = addParty($dbConnection, $_POST['partyname'], $_POST['partystart'], $_POST['partyend'], $_POST['partyplace']);
                break;
            default:
                $retarr['error'] = 'Unknown action';
                break;
        }
        disconnectDB($dbConnection);
    } else {
        $retarr = getErrorArray("Couldn't connect database");
    }
} else {
    $retarr['error'] = 'Unknown method';
}
echo json_encode($retarr);