Compare commits

..

1 Commits

Author SHA1 Message Date
Sebastian Titz
2e426509b6 remove markdown 2021-08-26 09:17:58 +02:00
11 changed files with 108 additions and 6828 deletions

View File

@ -6,6 +6,5 @@ include_once ('string.php');
include_once ('numbers.php'); include_once ('numbers.php');
include_once ('mail.php'); include_once ('mail.php');
include_once ('debug.php'); include_once ('debug.php');
include_once ('troy-api.php');
// include_once ('markdown.php'); // include_once ('markdown.php');
?> ?>

View File

@ -1,43 +1,18 @@
<?php <?php
$_ips_crawler = array ( $_ips_crawler = array (
'34.79.234.76', // google
'40.77.167.', // bing bot '40.77.167.', // bing bot
'54.36.148.', // ahrefbot
'54.36.149.', // ahrefbot
'66.249.', '66.249.',
'62.138.', '62.138.',
'62.210.149.60', '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 '92.118.160.37', // netsystem research bot
'104.155.85.', // google '104.155.85.', // google
'114.119.1', // petalbot '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 '185.191.171.', // semrush bot
'192.99.5.225', // ... '207.46.13.124', // bing bot
'205.185.115.87', //sex spam '54.36.148.', // ahrefbot
'207.46.13.', // bing bot
'216.58.', //google
'216.244.66.196', // opensiteexplorer '216.244.66.196', // opensiteexplorer
'2a01:4f8:190:4244::2', // mj12bot '65.21.180.26', // seekport
'2a01:4f8:162:43c5::2', // mj12bot '81.209.177.145', // website-datenbank.de
'2a01:4f8:190:4244::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,14 +1,9 @@
<?php <?php
function send_mail($an, $betreff, $text, $ok = '', $error = '') { function send_mail($an, $betreff, $text, $ok = '', $error = '') {
global $absender; include 'secret.php';
$sender = 'noreply@troy-grunt.de'; $sender = 'noreply@troy-grunt.de';
if(isset($absender) && $absender) { if (isset ( $_sendermail )) {
$sender = $absender; $sender = $_sendermail;
}else{
include 'secret.php';
if (isset ( $_sendermail )) {
$sender = $_sendermail;
}
} }
$header = 'From: ' . $sender . "\r\n"; $header = 'From: ' . $sender . "\r\n";
$header .= 'To: ' . $an . "\r\n"; $header .= 'To: ' . $an . "\r\n";
@ -23,59 +18,3 @@ function send_mail($an, $betreff, $text, $ok = '', $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!';
}
}
?>

View File

@ -1,84 +0,0 @@
<?php
// TODO markdown imple
function md($str) {
// return nl2br ( $str ); // TODO md problem
$text = '<p>';
$lv = 0;
$str = explode ( "\n", str_replace ( "\r\n", "\n", $str ) );
// var_dump ( $str );
foreach ( $str as $t ) {
// echo '<pre>' . $t . '</pre>';
$t = preg_replace_callback ( '/\[\[([^\]]*)\]\]/m', '_md_link_replacer', $t );
$nlv = 0;
if (startsWith ( $t, '**** ' )) {
// echo - 1;
$t = substr ( $t, 5 );
$nlv = 4;
}
if (startsWith ( $t, '*** ' )) {
// echo - 2;
$t = substr ( $t, 4 );
$nlv = 3;
}
if (startsWith ( $t, '** ' )) {
// echo - 3;
$t = substr ( $t, 3 );
$nlv = 2;
}
if (startsWith ( $t, '* ' )) {
// echo - 4;
$t = substr ( $t, 2 );
$nlv = 1;
}
if ($lv != $nlv) {
while ( $lv < $nlv ) {
// echo '-5 (' . $lv . '-' . $nlv . ')';
$text .= '<ul>';
$lv ++;
}
while ( $lv > $nlv ) {
// echo '-6 (' . $lv . '-' . $nlv . ')';
$text .= '</ul>';
$lv --;
}
}
if (startsWith ( $t, '!!!!! ' )) {
$t = '<h5>' . substr ( $t, 6 ) . '</h5>';
}
if (startsWith ( $t, '!!!! ' )) {
$t = '<h4>' . substr ( $t, 5 ) . '</h4>';
}
if (startsWith ( $t, '!!! ' )) {
$t = '<h3>' . substr ( $t, 4 ) . '</h3>';
}
if (startsWith ( $t, '!! ' )) {
$t = '<h2>' . substr ( $t, 3 ) . '</h2>';
}
if (startsWith ( $t, '! ' )) {
$t = '<h1>' . substr ( $t, 2 ) . '</h1>';
}
if ($lv == 0) {
if ($t == '') {
$text .= '</p><p>';
} else {
$text .= $t;
}
} else {
$text .= '<li>' . $t . '</li>';
}
// var_dump ( $t );
}
while ( $lv > 0 ) {
$text .= '</ul>';
$lv --;
}
$text .= '</p>';
return $text;
}
function _md_link_replacer($in) {
// var_dump ( $in );
$in = explode ( '|', $in [1], 2 );
return '<a href="' . $in [0] . '" target="_blank">' . (isset ( $in [1] ) ? $in [1] : $in [0]) . '</a>';
}
?>

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

177
sql.php
View File

@ -27,50 +27,46 @@ class SQL {
$this->cnt_get ++; $this->cnt_get ++;
if (SQL_LOG) if (SQL_LOG)
fputs ( $this->f, str_replace ( array ( fputs ( $this->f, str_replace ( array (
"\n", "\n",
" " " "
), array ( ), array (
' ', ' ',
'' ''
), $que ) . "\n" . print_r ( $p, true ) . "\n\n" ); ), $que ) . "\n" . print_r ( $p, true ) . "\n\n" );
$statement = $this->h->prepare ( $que ); $statement = $this->h->prepare ( $que );
if (is_array ( $p )) { switch (count ( $p )) {
switch (count ( $p )) { case 0 :
case 0 : break;
break; case 1 :
case 1 : $statement->bind_param ( $t, $p [0] );
$statement->bind_param ( $t, $p [0] ); break;
break; case 2 :
case 2 : $statement->bind_param ( $t, $p [0], $p [1] );
$statement->bind_param ( $t, $p [0], $p [1] ); break;
break; case 3 :
case 3 : $statement->bind_param ( $t, $p [0], $p [1], $p [2] );
$statement->bind_param ( $t, $p [0], $p [1], $p [2] ); break;
break; case 4 :
case 4 : $statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3] );
$statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3] ); break;
break; case 5 :
case 5 : $statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4] );
$statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4] ); break;
break; case 6 :
case 6 : $statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5] );
$statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5] ); break;
break; case 7 :
case 7 : $statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5], $p [6] );
$statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5], $p [6] ); break;
break; case 8 :
case 8 : $statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5], $p [6], $p [7] );
$statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5], $p [6], $p [7] ); break;
break; case 9 :
case 9 : $statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5], $p [6], $p [7], $p [8] );
$statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5], $p [6], $p [7], $p [8] ); break;
break; case 10 :
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] );
$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;
break;
}
} else {
$statement->bind_param ( $t, $p );
} }
$statement->execute (); $statement->execute ();
@ -126,55 +122,60 @@ class SQL {
$statement = $this->h->prepare ( $que ); $statement = $this->h->prepare ( $que );
if (SQL_LOG) if (SQL_LOG)
fputs ( $this->f, str_replace ( array ( fputs ( $this->f, str_replace ( array (
"\n", "\n",
" " " "
), array ( ), array (
' ', ' ',
'' ''
), $que ) . "\n" . print_r ( $p, true ) . "\n\n" ); ), $que ) . "\n" . print_r ( $p, true ) . "\n\n" );
if (is_array ( $p )) { switch (count ( $p )) {
switch (count ( $p )) { case 0 :
case 0 : break;
break; case 1 :
case 1 : $statement->bind_param ( $t, $p [0] );
$statement->bind_param ( $t, $p [0] ); break;
break; case 2 :
case 2 : $statement->bind_param ( $t, $p [0], $p [1] );
$statement->bind_param ( $t, $p [0], $p [1] ); break;
break; case 3 :
case 3 : $statement->bind_param ( $t, $p [0], $p [1], $p [2] );
$statement->bind_param ( $t, $p [0], $p [1], $p [2] ); break;
break; case 4 :
case 4 : $statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3] );
$statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3] ); break;
break; case 5 :
case 5 : $statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4] );
$statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4] ); break;
break; case 6 :
case 6 : $statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5] );
$statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5] ); break;
break; case 7 :
case 7 : $statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5], $p [6] );
$statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5], $p [6] ); break;
break; case 8 :
case 8 : $statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5], $p [6], $p [7] );
$statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5], $p [6], $p [7] ); break;
break; case 9 :
case 9 : $statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5], $p [6], $p [7], $p [8] );
$statement->bind_param ( $t, $p [0], $p [1], $p [2], $p [3], $p [4], $p [5], $p [6], $p [7], $p [8] ); break;
break; case 10 :
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] );
$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;
break; case 11 :
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] );
$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;
break; case 12 :
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] );
$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;
break; case 13 :
} $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], $p [12] );
} else { break;
$statement->bind_param ( $t, $p ); case 14 :
$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], $p [12], $p [13] );
break;
case 15 :
$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], $p [12], $p [13], $p [14] );
break;
} }
$statement->execute (); $statement->execute ();
if (isset ( $statement->error ) && $statement->error != '') { if (isset ( $statement->error ) && $statement->error != '') {

View File

@ -7,8 +7,7 @@ function umlaute($str) {
'ä', 'ä',
'ö', 'ö',
'ü', 'ü',
'ß', 'ß'
'&'
), array ( ), array (
'&Auml;', '&Auml;',
'&Ouml;', '&Ouml;',
@ -16,8 +15,7 @@ function umlaute($str) {
'&auml;', '&auml;',
'&ouml;', '&ouml;',
'&uuml;', '&uuml;',
'&szlig;', '&szlig;'
'&amp;'
), $str ); ), $str );
} }
function chk($str) { function chk($str) {
@ -35,11 +33,11 @@ function noScript($str) {
function random($name_laenge) { function random($name_laenge) {
$zeichen = "abcedfghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRTSUVWXYZ0123456789"; $zeichen = "abcedfghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRTSUVWXYZ0123456789";
$name_neu = ""; $name_neu = "";
@mt_srand ( ( double ) microtime () * 1000000 ); @mt_srand ( ( double ) microtime () * 1000000 );
for($i = 0; $i < $name_laenge; $i ++) { for($i = 0; $i < $name_laenge; $i ++) {
$r = mt_rand ( 0, strlen ( $zeichen ) - 1 ); $r = mt_rand ( 0, strlen ( $zeichen ) - 1 );
$name_neu .= $zeichen[$r]; $name_neu .= $zeichen {$r};
} }
return $name_neu; return $name_neu;
} }
@ -49,7 +47,7 @@ function startsWith($haystack, $needle) {
} }
function endsWith($haystack, $needle) { function endsWith($haystack, $needle) {
$length = strlen ( $needle ); $length = strlen ( $needle );
return $length === 0 || (substr ( $haystack, - $length ) === $needle); return $length === 0 || (substr ( $haystack, - $length ) === $needle);
} }
function onlyAlpha($str, $zus = '') { function onlyAlpha($str, $zus = '') {
@ -247,7 +245,7 @@ function onlySimpleHTML($s) {
'<pre>', '<pre>',
'<pre/>' '<pre/>'
), $s ); ), $s );
// cleanup // cleanup
$s = str_replace ( array ( $s = str_replace ( array (
'{{|-', '{{|-',
@ -256,7 +254,7 @@ function onlySimpleHTML($s) {
'', '',
'' ''
), $s ); ), $s );
return $s; return $s;
} }
function linkify($input) { function linkify($input) {

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 );
}
?>