Compare commits

..

3 Commits

Author SHA1 Message Date
troy grunt
c13739e81f hotfixes 2021-04-01 22:08:16 +02:00
troy grunt
c414ec0917 dürfte passen 2021-04-01 21:24:02 +02:00
troy grunt
0d1c93bdb5 SQL update 2021-04-01 19:17:50 +02:00
12 changed files with 241 additions and 6903 deletions

9
.gitignore vendored
View File

@ -1,6 +1,5 @@
/.buildpath
/.project
/secret.php
/config.php
/.buildpath
/.project
/secret.php
/config.php
/test.php
/_secret.php

View File

@ -1,2 +1,3 @@
# php-func-lib
git submodule add https://git.seemsleg.it/pub/php-func-lib lib
git submodule add https://git.seemsleg.it/ef/php-func-lib lib
test

View File

@ -1,11 +1,10 @@
<?php
// include ('config.php');
include_once ('sql.php');
$sql = new SQL ();
include_once ('string.php');
include_once ('numbers.php');
include_once ('mail.php');
include_once ('debug.php');
include_once ('troy-api.php');
// include_once ('markdown.php');
<?php
// include ('config.php');
include_once ('sql.php');
$sql = new SQL ();
include_once ('string.php');
include_once ('numbers.php');
include_once ('mail.php');
include_once ('debug.php');
include_once ('markdown.php');
?>

View File

@ -1,43 +0,0 @@
<?php
$_ips_crawler = array (
'34.79.234.76', // google
'40.77.167.', // bing bot
'54.36.148.', // ahrefbot
'54.36.149.', // ahrefbot
'66.249.',
'62.138.',
'62.210.149.60',
'65.21.180.26', // seekport
'81.209.177.145', // website-datenbank.de
'85.25.177.', // abuse
'85.25.210.', // hosteurope abuse
'92.118.160.37', // netsystem research bot
'104.155.85.', // google
'114.119.1', // petalbot
'144.76.15.153', // mj12bot
'148.251.120.201', // mj12bot
'157.55.39.', // microsoft???
'172.217.', //google
'176.125.230.38', //sql inj
'185.191.171.', // semrush bot
'192.99.5.225', // ...
'205.185.115.87', //sex spam
'207.46.13.', // bing bot
'216.58.', //google
'216.244.66.196', // opensiteexplorer
'2a01:4f8:190:4244::2', // mj12bot
'2a01:4f8:162:43c5::2', // mj12bot
);
function checkHuman() {
global $_ips_crawler;
if (stripos ( $_SERVER ['HTTP_USER_AGENT'], 'bot' ) !== false || stripos ( $_SERVER ['HTTP_USER_AGENT'], 'crawler' ) !== false) {
return false;
}
foreach ( $_ips_crawler as $np ) {
if (startsWith ( $_SERVER ['REMOTE_ADDR'], $np )) {
return false;
}
}
return true;
}
?>

View File

@ -1,81 +1,17 @@
<?php
function send_mail($an, $betreff, $text, $ok = '', $error = '') {
global $absender;
$sender = 'noreply@troy-grunt.de';
if(isset($absender) && $absender) {
$sender = $absender;
}else{
include 'secret.php';
if (isset ( $_sendermail )) {
$sender = $_sendermail;
function send_mail($an, $betreff, $text, $ok = '', $error = '')
{
$header = 'From: noreply@isleofhope.de' . "\r\n";
$header .= 'To: ' . $an . "\r\n";
$header .= 'Content-Type:text/html' . "\r\n";
$header .= 'Content-Transfer-Encoding: 8bit' . "\r\n";
$header .= 'X-Mailer: PHP/' . phpversion();
if (mail($an, $betreff, $text, $header) === true) {
echo $ok;
} else {
echo $error;
}
}
$header = 'From: ' . $sender . "\r\n";
$header .= 'To: ' . $an . "\r\n";
$header .= 'Content-Type:text/html' . "\r\n";
$header .= 'Content-Transfer-Encoding: 8bit' . "\r\n";
$header .= 'X-Mailer: PHP/' . phpversion ();
if (mail ( $an, $betreff, $text, $header ) === true) {
echo $ok;
} else {
echo $error;
}
}
function send_html_mail($an, $betreff, $text, $ok = '', $error = '') {
global $absender;
$sender = 'noreply@troy-grunt.de';
if(isset($absender) && $absender) {
$sender = $absender;
}else{
include 'secret.php';
if (isset ( $_sendermail )) {
$sender = $_sendermail;
}
}
$boundary = md5($an.$betreff.$text.time());
$header = 'From: ' . $sender . "\n";
$header .= 'To: ' . $an . "\n";
$header .= 'Content-Type:multipart/alternative;boundary='.$boundary . "\n";
$header .= 'X-Mailer: PHP/' . phpversion ();
$content = "This is multipart message using MIME\n";
$content .= "--" . $boundary . "\n";
$content .= "Content-type: text/plain;charset=utf-8\n";
$content .= 'Content-Transfer-Encoding: 8bit' . "\n\n";
$content .= strip_tags($text)."\n\n";
$content .= "--" . $boundary . "\n";
$content .= "Content-type: text/html;charset=utf-8\n";
$content .= "Content-Transfer-Encoding: 8bit". "\n\n";
$content .= '<html><body>'.$text.'</body></html>'."\n\n";
if (mail ( $an, $betreff, $content, $header ) === true) {
echo $ok;
} else {
echo $error;
}
}
function send_php_mail($an, $betreff, $text, $ok = '', $error = '') {
global $_sendermail;
$sender = 'noreply@troy-grunt.de';
if (isset ( $_sendermail )) {
$sender = $_sendermail;
}
include 'php-mailer/PHPMailer.php';
$mail = new PHPMailer();
$mail->setFrom($sender);
$mail->addAddress($an);
$mail->Subject = $betreff;
$mail->msgHTML($text, __DIR__);
$mail->AltBody = strip_tags($text);
if (!$mail->send()) {
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message sent!';
}
}
?>

15
og.php
View File

@ -1,15 +0,0 @@
<?php
function scanOG($url) {
$og = array();
$html = file_get_contents($url);
$re = '/<meta (name|property)=("|\')(.*?)("|\').*?content=("|\')(.*?)("|\')/m';
preg_match_all($re, $html, $matches, PREG_SET_ORDER, 0);
foreach($matches as $m) {
$og[$m[3]] = $m[6];
}
//print_r($og);
return $og;
}
?>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,15 +1,10 @@
<?php
<?php
if (!defined('SQL_LOG')) define ( 'SQL_LOG', 1 ); // schreibt sql querys in eine log
$_m['host'] = 'localhost';
$_m['host'] = 'localhost';
$_m['user'] = '';
$_m['pass'] = '';
$_m['data'] = '';
$_m['pre'] = '';
$_m['pre'] = 'efcms2_';
$_m['salt'] = '';
$_sendermail = 'noreply@.de';
$_smtp['srv'] = 'mail.seemsleg.it';
$_smtp['user'] = 'noreply@.de';
$_smtp['pw'] = '';
?>

228
sql.php
View File

@ -1,4 +1,12 @@
<?php
/*
* $query = sprintf("SELECT firstname, lastname, address, age FROM friends
* WHERE firstname='%s' AND lastname='%s'",
* mysql_real_escape_string($firstname),
* mysql_real_escape_string($lastname));
*
*
*/
class SQL {
private $h;
private $res = false;
@ -16,77 +24,123 @@ class SQL {
if (SQL_LOG)
$this->f = fopen ( 'sql.log', 'w' );
$this->h = new mysqli ( $_m ['host'], $_m ['user'], $_m ['pass'], $_m ['data'] );
if ($this->h->connect_errno) {
$this->h = mysqli_connect ( $_m ['host'], $_m ['user'], $_m ['pass'] );
//var_dump ( $this->h );
if (! $this->h) {
return false;
}
mysqli_select_db ( $this->h, $_m ['data'] );
return true;
}
private function prepare($q, $t, $p) {
$t = str_split ( $t );
$v = array ();
$q = str_replace ( "?", "%s", $q );
foreach ( $t as $i => $c ) {
switch ($c) {
case 's' :
$v [] = "'" . mysqli_real_escape_string ( $this->h, $p [$i] ) . "'";
break;
case 'i' :
$v [] = ( int ) $p [$i];
break;
case 'd' :
$v [] = ( double ) $p [$i];
break;
default :
//return false;
}
}
$res = array ();
switch (count ( $p )) {
case 0 :
$res = mysqli_query ( $this->h, $q );
break;
case 1 :
$res = mysqli_query ( $this->h, sprintf ( $q, $v [0] ) );
break;
case 2 :
$res = mysqli_query ( $this->h, sprintf ( $q, $v [0], $v [1] ) );
break;
case 3 :
$res = mysqli_query ( $this->h, sprintf ( $q, $v [0], $v [1], $v [2] ) );
break;
case 4 :
$res = mysqli_query ( $this->h, sprintf ( $q, $v [0], $v [1], $v [2], $v [3] ) );
break;
case 5 :
$res = mysqli_query ( $this->h, sprintf ( $q, $v [0], $v [1], $v [2], $v [3], $v [4] ) );
break;
case 6 :
$res = mysqli_query ( $this->h, sprintf ( $q, $v [0], $v [1], $v [2], $v [3], $v [4], $v [5] ) );
break;
case 7 :
$res = mysqli_query ( $this->h, sprintf ( $q, $v [0], $v [1], $v [2], $v [3], $v [4], $v [5], $v [6] ) );
break;
case 8 :
$res = mysqli_query ( $this->h, sprintf ( $q, $v [0], $v [1], $v [2], $v [3], $v [4], $v [5], $v [6], $v [7] ) );
break;
case 9 :
$res = mysqli_query ( $this->h, sprintf ( $q, $v [0], $v [1], $v [2], $v [3], $v [4], $v [5], $v [6], $v [7], $v [8] ) );
break;
case 10 :
$res = mysqli_query ( $this->h, sprintf ( $q, $v [0], $v [1], $v [2], $v [3], $v [4], $v [5], $v [6], $v [7], $v [8], $v [9] ) );
break;
case 11 :
$res = mysqli_query ( $this->h, sprintf ( $q, $v [0], $v [1], $v [2], $v [3], $v [4], $v [5], $v [6], $v [7], $v [8], $v [9], $v [10] ) );
break;
case 12 :
$res = mysqli_query ( $this->h, sprintf ( $q, $v [0], $v [1], $v [2], $v [3], $v [4], $v [5], $v [6], $v [7], $v [8], $v [9], $v [10], $v [11] ) );
break;
case 13 :
$res = mysqli_query ( $this->h, sprintf ( $q, $v [0], $v [1], $v [2], $v [3], $v [4], $v [5], $v [6], $v [7], $v [8], $v [9], $v [10], $v [11], $v [12] ) );
break;
case 14 :
$res = mysqli_query ( $this->h, sprintf ( $q, $v [0], $v [1], $v [2], $v [3], $v [4], $v [5], $v [6], $v [7], $v [8], $v [9], $v [10], $v [11], $v [12], $v [13] ) );
break;
case 15 :
$res = mysqli_query ( $this->h, sprintf ( $q, $v [0], $v [1], $v [2], $v [3], $v [4], $v [5], $v [6], $v [7], $v [8], $v [9], $v [10], $v [11], $v [12], $v [13], $v [14] ) );
break;
}
//echo 'ERROR:';
//var_dump ( mysqli_error_list ( $this->h ) );
//echo '<br>';
/*
* if (! $res || mysqli_errno ( $this->h )) {
* return false;
* }
*/
return $res;
}
public function get($que, $t = '', $p = array ()) {
// echo $que;
$this->cnt_get ++;
if (SQL_LOG)
fputs ( $this->f, str_replace ( array (
"\n",
" "
"\n",
" "
), array (
' ',
''
' ',
''
), $que ) . "\n" . print_r ( $p, true ) . "\n\n" );
$statement = $this->h->prepare ( $que );
if (is_array ( $p )) {
switch (count ( $p )) {
case 0 :
break;
case 1 :
$statement->bind_param ( $t, $p [0] );
break;
case 2 :
$statement->bind_param ( $t, $p [0], $p [1] );
break;
case 3 :
$statement->bind_param ( $t, $p [0], $p [1], $p [2] );
break;
case 4 :
$statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3] );
break;
case 5 :
$statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4] );
break;
case 6 :
$statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5] );
break;
case 7 :
$statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5], $p [6] );
break;
case 8 :
$statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5], $p [6], $p [7] );
break;
case 9 :
$statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5], $p [6], $p [7], $p [8] );
break;
case 10 :
$statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5], $p [6], $p [7], $p [8], $p [9] );
break;
}
} else {
$statement->bind_param ( $t, $p );
}
$statement->execute ();
$res = $this->prepare ( $que, $t, $p );
//var_dump ( $res );
//echo '<hr>';
$ret = array ();
// print_r($statement);
if (isset ( $statement->error ) && $statement->error != '') {
if (! $res) {
if (SQL_LOG)
fputs ( $this->f, $statement->error );
fputs ( $this->f, mysqli_error ( $this->h ) );
return false;
}
$result = $statement->get_result ();
// print_r($result);
while ( $row = $result->fetch_assoc () ) {
while ( $row = $res->fetch_assoc () ) {
$ret [] = $row;
}
//var_dump ( $ret );
//echo '<hr><hr>';
return $ret;
}
public function single($que, $t = '', $p = array ()) {
@ -123,76 +177,30 @@ class SQL {
public function set($que, $t = '', $p = array (), $id = false) {
// echo $que;
$this->cnt_set ++;
$statement = $this->h->prepare ( $que );
if (SQL_LOG)
fputs ( $this->f, str_replace ( array (
"\n",
" "
"\n",
" "
), array (
' ',
''
' ',
''
), $que ) . "\n" . print_r ( $p, true ) . "\n\n" );
if (is_array ( $p )) {
switch (count ( $p )) {
case 0 :
break;
case 1 :
$statement->bind_param ( $t, $p [0] );
break;
case 2 :
$statement->bind_param ( $t, $p [0], $p [1] );
break;
case 3 :
$statement->bind_param ( $t, $p [0], $p [1], $p [2] );
break;
case 4 :
$statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3] );
break;
case 5 :
$statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4] );
break;
case 6 :
$statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5] );
break;
case 7 :
$statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5], $p [6] );
break;
case 8 :
$statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5], $p [6], $p [7] );
break;
case 9 :
$statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5], $p [6], $p [7], $p [8] );
break;
case 10 :
$statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5], $p [6], $p [7], $p [8], $p [9] );
break;
case 11 :
$statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5], $p [6], $p [7], $p [8], $p [9], $p [10] );
break;
case 12 :
$statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5], $p [6], $p [7], $p [8], $p [9], $p [10], $p [11] );
break;
}
} else {
$statement->bind_param ( $t, $p );
}
$statement->execute ();
if (isset ( $statement->error ) && $statement->error != '') {
$res = $this->prepare ( $que, $t, $p );
if (! $res) {
if (SQL_LOG)
fputs ( $this->f, $statement->error );
fputs ( $this->f, mysqli_error ( $this->h ) );
return false;
}
if ($id) {
return $statement->insert_id;
return mysqli_insert_id ( $this->h );
} else {
return $statement->affected_rows;
return ( bool ) mysqli_affected_rows ( $this->h );
}
}
function __destruct() {
if (SQL_LOG)
$this->h->close ();
// echo 'DESTROY';
mysqli_close ( $this->h );
}
}
?>
?>

View File

@ -1,23 +1,21 @@
<?php
function umlaute($str) {
return str_replace ( array (
'Ä',
'Ö',
'Ü',
'ä',
'ö',
'ü',
'ß',
'&'
'Ä',
'Ö',
'Ü',
'ä',
'ö',
'ü',
'ß'
), array (
'&Auml;',
'&Ouml;',
'&Uuml;',
'&auml;',
'&ouml;',
'&uuml;',
'&szlig;',
'&amp;'
'&Auml;',
'&Ouml;',
'&Uuml;',
'&auml;',
'&ouml;',
'&uuml;',
'&szlig;'
), $str );
}
function chk($str) {
@ -25,11 +23,11 @@ function chk($str) {
}
function noScript($str) {
return str_replace ( array (
'<',
'>'
'<',
'>'
), array (
'&lt;',
'&gt;'
'&lt;',
'&gt;'
), $str );
}
function random($name_laenge) {
@ -39,7 +37,7 @@ function random($name_laenge) {
@mt_srand ( ( double ) microtime () * 1000000 );
for($i = 0; $i < $name_laenge; $i ++) {
$r = mt_rand ( 0, strlen ( $zeichen ) - 1 );
$name_neu .= $zeichen[$r];
$name_neu .= $zeichen {$r};
}
return $name_neu;
}
@ -129,144 +127,134 @@ function markUp($text) {
}
function onlySimpleHTML($s) {
$s = str_replace ( array (
'<',
'>'
'<',
'>'
), array (
'{{|-&lt;-|}}',
'{{|-&gt;-|}}'
'{{|-&lt;-|}}',
'{{|-&gt;-|}}'
), $s );
$s = str_replace ( array (
'{{|-&lt;-|}}b{{|-&gt;-|}}',
'{{|-&lt;-|}}b/{{|-&gt;-|}}'
'{{|-&lt;-|}}b{{|-&gt;-|}}',
'{{|-&lt;-|}}b/{{|-&gt;-|}}'
), array (
'<b>',
'<b/>'
'<b>',
'<b/>'
), $s );
$s = str_replace ( array (
'{{|-&lt;-|}}u{{|-&gt;-|}}',
'{{|-&lt;-|}}u/{{|-&gt;-|}}'
'{{|-&lt;-|}}u{{|-&gt;-|}}',
'{{|-&lt;-|}}u/{{|-&gt;-|}}'
), array (
'<u>',
'<u/>'
'<u>',
'<u/>'
), $s );
$s = str_replace ( array (
'{{|-&lt;-|}}i{{|-&gt;-|}}',
'{{|-&lt;-|}}i/{{|-&gt;-|}}'
'{{|-&lt;-|}}i{{|-&gt;-|}}',
'{{|-&lt;-|}}i/{{|-&gt;-|}}'
), array (
'<i>',
'<i/>'
'<i>',
'<i/>'
), $s );
$s = str_replace ( array (
'{{|-&lt;-|}}span{{|-&gt;-|}}',
'{{|-&lt;-|}}span/{{|-&gt;-|}}'
'{{|-&lt;-|}}span{{|-&gt;-|}}',
'{{|-&lt;-|}}span/{{|-&gt;-|}}'
), array (
'<span>',
'<span/>'
'<span>',
'<span/>'
), $s );
$s = str_replace ( array (
'{{|-&lt;-|}}b{{|-&gt;-|}}',
'{{|-&lt;-|}}b/{{|-&gt;-|}}'
'{{|-&lt;-|}}b{{|-&gt;-|}}',
'{{|-&lt;-|}}b/{{|-&gt;-|}}'
), array (
'<b>',
'<b/>'
'<b>',
'<b/>'
), $s );
$s = str_replace ( array (
'{{|-&lt;-|}}br{{|-&gt;-|}}',
'{{|-&lt;-|}}br/{{|-&gt;-|}}'
'{{|-&lt;-|}}br{{|-&gt;-|}}',
'{{|-&lt;-|}}br/{{|-&gt;-|}}'
), array (
'<br>',
'<br/>'
'<br>',
'<br/>'
), $s );
$s = str_replace ( array (
'{{|-&lt;-|}}h1{{|-&gt;-|}}',
'{{|-&lt;-|}}h1/{{|-&gt;-|}}'
'{{|-&lt;-|}}h1{{|-&gt;-|}}',
'{{|-&lt;-|}}h1/{{|-&gt;-|}}'
), array (
'<h1>',
'<h1/>'
'<h1>',
'<h1/>'
), $s );
$s = str_replace ( array (
'{{|-&lt;-|}}h2{{|-&gt;-|}}',
'{{|-&lt;-|}}h2/{{|-&gt;-|}}'
'{{|-&lt;-|}}h2{{|-&gt;-|}}',
'{{|-&lt;-|}}h2/{{|-&gt;-|}}'
), array (
'<h2>',
'<h2/>'
'<h2>',
'<h2/>'
), $s );
$s = str_replace ( array (
'{{|-&lt;-|}}h3{{|-&gt;-|}}',
'{{|-&lt;-|}}h3/{{|-&gt;-|}}'
'{{|-&lt;-|}}h3{{|-&gt;-|}}',
'{{|-&lt;-|}}h3/{{|-&gt;-|}}'
), array (
'<h3>',
'<h3/>'
'<h3>',
'<h3/>'
), $s );
$s = str_replace ( array (
'{{|-&lt;-|}}h4{{|-&gt;-|}}',
'{{|-&lt;-|}}h4/{{|-&gt;-|}}'
'{{|-&lt;-|}}h4{{|-&gt;-|}}',
'{{|-&lt;-|}}h4/{{|-&gt;-|}}'
), array (
'<h4>',
'<h4/>'
'<h4>',
'<h4/>'
), $s );
$s = str_replace ( array (
'{{|-&lt;-|}}h5{{|-&gt;-|}}',
'{{|-&lt;-|}}h5/{{|-&gt;-|}}'
'{{|-&lt;-|}}h5{{|-&gt;-|}}',
'{{|-&lt;-|}}h5/{{|-&gt;-|}}'
), array (
'<h5>',
'<h5/>'
'<h5>',
'<h5/>'
), $s );
$s = str_replace ( array (
'{{|-&lt;-|}}h6{{|-&gt;-|}}',
'{{|-&lt;-|}}h6/{{|-&gt;-|}}'
'{{|-&lt;-|}}h6{{|-&gt;-|}}',
'{{|-&lt;-|}}h6/{{|-&gt;-|}}'
), array (
'<h6>',
'<h6/>'
'<h6>',
'<h6/>'
), $s );
$s = str_replace ( array (
'{{|-&lt;-|}}li{{|-&gt;-|}}',
'{{|-&lt;-|}}li/{{|-&gt;-|}}'
'{{|-&lt;-|}}li{{|-&gt;-|}}',
'{{|-&lt;-|}}li/{{|-&gt;-|}}'
), array (
'<li>',
'<li/>'
'<li>',
'<li/>'
), $s );
$s = str_replace ( array (
'{{|-&lt;-|}}ul{{|-&gt;-|}}',
'{{|-&lt;-|}}ul/{{|-&gt;-|}}'
'{{|-&lt;-|}}ul{{|-&gt;-|}}',
'{{|-&lt;-|}}ul/{{|-&gt;-|}}'
), array (
'<ul>',
'<ul/>'
'<ul>',
'<ul/>'
), $s );
$s = str_replace ( array (
'{{|-&lt;-|}}ol{{|-&gt;-|}}',
'{{|-&lt;-|}}ol/{{|-&gt;-|}}'
'{{|-&lt;-|}}ol{{|-&gt;-|}}',
'{{|-&lt;-|}}ol/{{|-&gt;-|}}'
), array (
'<ol>',
'<ol/>'
'<ol>',
'<ol/>'
), $s );
$s = str_replace ( array (
'{{|-&lt;-|}}pre{{|-&gt;-|}}',
'{{|-&lt;-|}}pre/{{|-&gt;-|}}'
'{{|-&lt;-|}}pre{{|-&gt;-|}}',
'{{|-&lt;-|}}pre/{{|-&gt;-|}}'
), array (
'<pre>',
'<pre/>'
'<pre>',
'<pre/>'
), $s );
// cleanup
$s = str_replace ( array (
'{{|-',
'-|}}'
'{{|-',
'-|}}'
), array (
'',
''
'',
''
), $s );
return $s;
}
function linkify($input) {
$pattern = '@(http(s)?://[a-zA-Z0-9/\.\#\-\_]*)@';
return $output = preg_replace ( $pattern, '<a href="$1">$1</a>', $input );
}
function inStr($needle, $haystack) {
if (strpos ( $haystack, $needle ) !== false) {
return true;
}
return false;
}
?>

View File

@ -1,16 +0,0 @@
<?php
function sendToTroy($data) {
$url = 'https://troy-grunt.de/api.php';
$options = array (
'http' => array (
'method' => 'POST',
'header' => array (
'Content-Type: application/json'
),
'content' => json_encode ( $data )
)
);
$context = stream_context_create ( $options );
return file_get_contents ( $url, false, $context );
}
?>