erster versuch
This commit is contained in:
parent
560ef6589c
commit
b475672eac
@ -8,6 +8,8 @@ $_m['data'] = '';
|
||||
$_m['pre'] = '';
|
||||
$_m['salt'] = '';
|
||||
|
||||
$_m['issuedata'] = ['domain'=>'','secret'=>''];
|
||||
|
||||
$_sendermail = 'noreply@.de';
|
||||
$_smtp['srv'] = 'mail.seemsleg.it';
|
||||
$_smtp['user'] = 'noreply@.de';
|
||||
|
||||
2
sql.php
2
sql.php
@ -4,6 +4,7 @@ class SQL {
|
||||
private $res = false;
|
||||
private $m;
|
||||
public $salt;
|
||||
public $issuedata;
|
||||
public $pre;
|
||||
public $cnt_get = 0;
|
||||
public $cnt_set = 0;
|
||||
@ -11,6 +12,7 @@ class SQL {
|
||||
require_once ('secret.php');
|
||||
|
||||
$this->m = $_m;
|
||||
$this->issuedata = $_m['issuedata'];
|
||||
$this->pre = $_m ['pre'];
|
||||
$this->salt = $_m ['salt'];
|
||||
if (SQL_LOG)
|
||||
|
||||
34
troy-api.php
34
troy-api.php
@ -13,4 +13,38 @@ function sendToTroy($data) {
|
||||
$context = stream_context_create ( $options );
|
||||
return file_get_contents ( $url, false, $context );
|
||||
}
|
||||
|
||||
function troysIssue($ident, $typ, $text = null, $data = [], $reaction = [], $wait_til = null) {
|
||||
global $sql;
|
||||
$url = "https://issues.troy-grunt.de/api/input";
|
||||
|
||||
$payload = [
|
||||
"domain" => $sql->issuedata['domain'],
|
||||
"secret" => $sql->issuedata['secret'],
|
||||
"ident" => $ident,
|
||||
"typ" => $typ,
|
||||
"text" => $text,
|
||||
"data" => $data,
|
||||
"reaction" => $reaction
|
||||
];
|
||||
|
||||
// Entferne null-Werte aus dem Array
|
||||
$payload = array_filter($payload, function ($value) {
|
||||
return $value !== null;
|
||||
});
|
||||
|
||||
$options = [
|
||||
"http" => [
|
||||
"header" => "Content-Type: application/json\r\n",
|
||||
"method" => "POST",
|
||||
"content" => json_encode($payload),
|
||||
"ignore_errors" => true
|
||||
]
|
||||
];
|
||||
|
||||
$context = stream_context_create($options);
|
||||
$result = file_get_contents($url, false, $context);
|
||||
|
||||
return json_decode($result, true);
|
||||
}
|
||||
?>
|
||||
Loading…
Reference in New Issue
Block a user