summaryrefslogtreecommitdiff
path: root/telemetry/report/index.php
blob: 442d53a79f3f23d02c6096a6913b3ac215091f1e (plain)
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
<?php

class UUID {
    public static function v4() {
        return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
            mt_rand(0, 0xffff), mt_rand(0, 0xffff),
            mt_rand(0, 0xffff),
            mt_rand(0, 0x0fff) | 0x4000,
            mt_rand(0, 0x3fff) | 0x8000,
            mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff)
        );
    }
}

if (isset($_GET['report'])) {
    $d = utf8_encode(base64_decode($_GET['report']));
} else {
    echo("Not set");
    die();
}

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://familine.jetbrains.space/api/http/projects/id:cUW7s1nHBNd/planning/issues");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "kos:yc2c\VT<6T.?`h43p$[ttyD,4(VqDKM<F)hXxdCP72a~ghXJe@4CLF8P3K.;r+XAr;n6(*\a4[J>!{t<WA4=&EpZ!pgnA}W#8\"UfqN9Vs,-rPW;C!?a_94%SPrRH~Rm>");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Content-Type: application/json',
    'Accept: application/json',
));
curl_setopt($ch, CURLOPT_POST, 1);
$j = "{\"title\":\"Rapport de bug automatique (" . UUID::v4() . ")\",\"description\":\"\",\"assignee\":\"id:3hh9iS36gW9p\",\"status\":\"458T9x3wM0zN\",\"tags\":[\"3XhWk14WX0Jj\"]}";
$a = json_decode($j, true);
$a["description"] = "```" . str_replace("`", "'", $d) . "```";
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($a));
var_dump(json_encode($a));
$output = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);

echo("Done!");
var_dump($output);
var_dump($info);
die();