} if (!isset($author) || $author == "") { $author = "Admin"; } if (!isset($priority) || $priority == "" || $priority < 1 || $priority > 4) { $priority = 1; } if (!isset($app_version)) { $app_version = ""; } if (!isset($app_url)) { $app_url = ""; } $bugInfos = array("author" => $author, "app_url" => $app_url, "app_version" => $app_version, "title" => trim(strip_tags($title)), "description" => trim($description), "img" => get_uploaded_files(@$files), "priority" => (int) $priority, "closed" => 0, "FK_label_ID" => 0, "FK_dev_ID" => 0, "FK_comment_ID" => "[]"); $b = new Bug(); $b->setBugData($bugInfos); $b->save(); $response['images'] = $bugInfos['img']; $response['error'] = "OK"; $response['message'] = "Bug saved. Thanks for your report, our devs will take a look at it soon!"; } } catch (Exception $e) { $response['message'] = $e->getMessage(); } header('HTTP/1.1 200 OK'); header('Content-type: application/json; charset=UTF-8'); header('Access-Control-Allow-Origin: *'); // Allows cross-domain requests echo json_encode($response, JSON_UNESCAPED_UNICODE); /** * Save uploaded images (base64 encoded) and get a json array of images filenames