Compare commits
2 Commits
master
...
troys_issu
| Author | SHA1 | Date | |
|---|---|---|---|
| 61b52d8427 | |||
| b475672eac |
@ -8,6 +8,8 @@ $_m['data'] = '';
|
|||||||
$_m['pre'] = '';
|
$_m['pre'] = '';
|
||||||
$_m['salt'] = '';
|
$_m['salt'] = '';
|
||||||
|
|
||||||
|
$_m['issuedata'] = ['domain'=>'','secret'=>''];
|
||||||
|
|
||||||
$_sendermail = 'noreply@.de';
|
$_sendermail = 'noreply@.de';
|
||||||
$_smtp['srv'] = 'mail.seemsleg.it';
|
$_smtp['srv'] = 'mail.seemsleg.it';
|
||||||
$_smtp['user'] = 'noreply@.de';
|
$_smtp['user'] = 'noreply@.de';
|
||||||
|
|||||||
2
sql.php
2
sql.php
@ -4,6 +4,7 @@ class SQL {
|
|||||||
private $res = false;
|
private $res = false;
|
||||||
private $m;
|
private $m;
|
||||||
public $salt;
|
public $salt;
|
||||||
|
public $issuedata;
|
||||||
public $pre;
|
public $pre;
|
||||||
public $cnt_get = 0;
|
public $cnt_get = 0;
|
||||||
public $cnt_set = 0;
|
public $cnt_set = 0;
|
||||||
@ -11,6 +12,7 @@ class SQL {
|
|||||||
require_once ('secret.php');
|
require_once ('secret.php');
|
||||||
|
|
||||||
$this->m = $_m;
|
$this->m = $_m;
|
||||||
|
$this->issuedata = $_m['issuedata'];
|
||||||
$this->pre = $_m ['pre'];
|
$this->pre = $_m ['pre'];
|
||||||
$this->salt = $_m ['salt'];
|
$this->salt = $_m ['salt'];
|
||||||
if (SQL_LOG)
|
if (SQL_LOG)
|
||||||
|
|||||||
58
troy-api.php
58
troy-api.php
@ -1,16 +1,50 @@
|
|||||||
<?php
|
<?php
|
||||||
function sendToTroy($data) {
|
function sendToTroy($data) {
|
||||||
$url = 'https://troy-grunt.de/api.php';
|
$url = 'https://troy-grunt.de/api.php';
|
||||||
$options = array (
|
$options = array (
|
||||||
'http' => array (
|
'http' => array (
|
||||||
'method' => 'POST',
|
'method' => 'POST',
|
||||||
'header' => array (
|
'header' => array (
|
||||||
'Content-Type: application/json'
|
'Content-Type: application/json'
|
||||||
),
|
),
|
||||||
'content' => json_encode ( $data )
|
'content' => json_encode ( $data )
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$context = stream_context_create ( $options );
|
$context = stream_context_create ( $options );
|
||||||
return file_get_contents ( $url, false, $context );
|
return file_get_contents ( $url, false, $context );
|
||||||
|
}
|
||||||
|
|
||||||
|
function troysIssue($ident, $typ, $text = null, $data = [], $reaction = []) {
|
||||||
|
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