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
8 changed files with 328 additions and 355 deletions

9
.gitignore vendored
View File

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

View File

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

View File

@@ -1,10 +1,10 @@
<?php <?php
// include ('config.php'); // include ('config.php');
include_once ('sql.php'); include_once ('sql.php');
$sql = new SQL (); $sql = new SQL ();
include_once ('string.php'); 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 ('markdown.php'); include_once ('markdown.php');
?> ?>

View File

@@ -1,24 +0,0 @@
<?php
$_ips_crawler = array (
'40.77.167.', // bing bot
'66.249.',
'62.138.',
'62.210.149.60',
'92.118.160.37', // netsystem research bot
'104.155.85.', // google
'114.119.1', // petalbot
'185.191.171.', // semrush bot
'207.46.13.', // bing bot
'54.36.148.', // ahrefbot
'54.36.149.', // ahrefbot
'216.244.66.196', // opensiteexplorer
'65.21.180.26', // seekport
'81.209.177.145', // website-datenbank.de
'2a01:4f8:190:4244::2', // mj12bot
'192.99.5.225', // ...
'157.55.39.', // microsoft???
'2a01:4f8:162:43c5::2', // mj12bot
'85.25.177.', // abuse
'85.25.210.' // hosteurope abuse
);
?>

View File

@@ -1,20 +1,17 @@
<?php <?php
function send_mail($an, $betreff, $text, $ok = '', $error = '') {
include 'secret.php';
$sender = 'noreply@troy-grunt.de';
if (isset ( $_sendermail )) {
$sender = $_sendermail;
}
$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) { function send_mail($an, $betreff, $text, $ok = '', $error = '')
echo $ok; {
} else { $header = 'From: noreply@isleofhope.de' . "\r\n";
echo $error; $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;
}
} }

View File

@@ -7,6 +7,4 @@ $_m['pass'] = '';
$_m['data'] = ''; $_m['data'] = '';
$_m['pre'] = 'efcms2_'; $_m['pre'] = 'efcms2_';
$_m['salt'] = ''; $_m['salt'] = '';
$_sendermail = 'noreply@troy-grunt.de';
?> ?>

396
sql.php
View File

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

View File

@@ -1,23 +1,21 @@
<?php <?php
function umlaute($str) { function umlaute($str) {
return str_replace ( array ( return str_replace ( array (
'Ä', 'Ä',
'Ö', 'Ö',
'Ü', 'Ü',
'ä', 'ä',
'ö', 'ö',
'ü', 'ü',
'ß', 'ß'
'&'
), array ( ), array (
'&Auml;', '&Auml;',
'&Ouml;', '&Ouml;',
'&Uuml;', '&Uuml;',
'&auml;', '&auml;',
'&ouml;', '&ouml;',
'&uuml;', '&uuml;',
'&szlig;', '&szlig;'
'&amp;'
), $str ); ), $str );
} }
function chk($str) { function chk($str) {
@@ -25,17 +23,17 @@ function chk($str) {
} }
function noScript($str) { function noScript($str) {
return str_replace ( array ( return str_replace ( array (
'<', '<',
'>' '>'
), array ( ), array (
'&lt;', '&lt;',
'&gt;' '&gt;'
), $str ); ), $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 );
@@ -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 = '') {
@@ -129,144 +127,134 @@ function markUp($text) {
} }
function onlySimpleHTML($s) { function onlySimpleHTML($s) {
$s = str_replace ( array ( $s = str_replace ( array (
'<', '<',
'>' '>'
), array ( ), array (
'{{|-&lt;-|}}', '{{|-&lt;-|}}',
'{{|-&gt;-|}}' '{{|-&gt;-|}}'
), $s ); ), $s );
$s = str_replace ( array ( $s = str_replace ( array (
'{{|-&lt;-|}}b{{|-&gt;-|}}', '{{|-&lt;-|}}b{{|-&gt;-|}}',
'{{|-&lt;-|}}b/{{|-&gt;-|}}' '{{|-&lt;-|}}b/{{|-&gt;-|}}'
), array ( ), array (
'<b>', '<b>',
'<b/>' '<b/>'
), $s ); ), $s );
$s = str_replace ( array ( $s = str_replace ( array (
'{{|-&lt;-|}}u{{|-&gt;-|}}', '{{|-&lt;-|}}u{{|-&gt;-|}}',
'{{|-&lt;-|}}u/{{|-&gt;-|}}' '{{|-&lt;-|}}u/{{|-&gt;-|}}'
), array ( ), array (
'<u>', '<u>',
'<u/>' '<u/>'
), $s ); ), $s );
$s = str_replace ( array ( $s = str_replace ( array (
'{{|-&lt;-|}}i{{|-&gt;-|}}', '{{|-&lt;-|}}i{{|-&gt;-|}}',
'{{|-&lt;-|}}i/{{|-&gt;-|}}' '{{|-&lt;-|}}i/{{|-&gt;-|}}'
), array ( ), array (
'<i>', '<i>',
'<i/>' '<i/>'
), $s ); ), $s );
$s = str_replace ( array ( $s = str_replace ( array (
'{{|-&lt;-|}}span{{|-&gt;-|}}', '{{|-&lt;-|}}span{{|-&gt;-|}}',
'{{|-&lt;-|}}span/{{|-&gt;-|}}' '{{|-&lt;-|}}span/{{|-&gt;-|}}'
), array ( ), array (
'<span>', '<span>',
'<span/>' '<span/>'
), $s ); ), $s );
$s = str_replace ( array ( $s = str_replace ( array (
'{{|-&lt;-|}}b{{|-&gt;-|}}', '{{|-&lt;-|}}b{{|-&gt;-|}}',
'{{|-&lt;-|}}b/{{|-&gt;-|}}' '{{|-&lt;-|}}b/{{|-&gt;-|}}'
), array ( ), array (
'<b>', '<b>',
'<b/>' '<b/>'
), $s ); ), $s );
$s = str_replace ( array ( $s = str_replace ( array (
'{{|-&lt;-|}}br{{|-&gt;-|}}', '{{|-&lt;-|}}br{{|-&gt;-|}}',
'{{|-&lt;-|}}br/{{|-&gt;-|}}' '{{|-&lt;-|}}br/{{|-&gt;-|}}'
), array ( ), array (
'<br>', '<br>',
'<br/>' '<br/>'
), $s ); ), $s );
$s = str_replace ( array ( $s = str_replace ( array (
'{{|-&lt;-|}}h1{{|-&gt;-|}}', '{{|-&lt;-|}}h1{{|-&gt;-|}}',
'{{|-&lt;-|}}h1/{{|-&gt;-|}}' '{{|-&lt;-|}}h1/{{|-&gt;-|}}'
), array ( ), array (
'<h1>', '<h1>',
'<h1/>' '<h1/>'
), $s ); ), $s );
$s = str_replace ( array ( $s = str_replace ( array (
'{{|-&lt;-|}}h2{{|-&gt;-|}}', '{{|-&lt;-|}}h2{{|-&gt;-|}}',
'{{|-&lt;-|}}h2/{{|-&gt;-|}}' '{{|-&lt;-|}}h2/{{|-&gt;-|}}'
), array ( ), array (
'<h2>', '<h2>',
'<h2/>' '<h2/>'
), $s ); ), $s );
$s = str_replace ( array ( $s = str_replace ( array (
'{{|-&lt;-|}}h3{{|-&gt;-|}}', '{{|-&lt;-|}}h3{{|-&gt;-|}}',
'{{|-&lt;-|}}h3/{{|-&gt;-|}}' '{{|-&lt;-|}}h3/{{|-&gt;-|}}'
), array ( ), array (
'<h3>', '<h3>',
'<h3/>' '<h3/>'
), $s ); ), $s );
$s = str_replace ( array ( $s = str_replace ( array (
'{{|-&lt;-|}}h4{{|-&gt;-|}}', '{{|-&lt;-|}}h4{{|-&gt;-|}}',
'{{|-&lt;-|}}h4/{{|-&gt;-|}}' '{{|-&lt;-|}}h4/{{|-&gt;-|}}'
), array ( ), array (
'<h4>', '<h4>',
'<h4/>' '<h4/>'
), $s ); ), $s );
$s = str_replace ( array ( $s = str_replace ( array (
'{{|-&lt;-|}}h5{{|-&gt;-|}}', '{{|-&lt;-|}}h5{{|-&gt;-|}}',
'{{|-&lt;-|}}h5/{{|-&gt;-|}}' '{{|-&lt;-|}}h5/{{|-&gt;-|}}'
), array ( ), array (
'<h5>', '<h5>',
'<h5/>' '<h5/>'
), $s ); ), $s );
$s = str_replace ( array ( $s = str_replace ( array (
'{{|-&lt;-|}}h6{{|-&gt;-|}}', '{{|-&lt;-|}}h6{{|-&gt;-|}}',
'{{|-&lt;-|}}h6/{{|-&gt;-|}}' '{{|-&lt;-|}}h6/{{|-&gt;-|}}'
), array ( ), array (
'<h6>', '<h6>',
'<h6/>' '<h6/>'
), $s ); ), $s );
$s = str_replace ( array ( $s = str_replace ( array (
'{{|-&lt;-|}}li{{|-&gt;-|}}', '{{|-&lt;-|}}li{{|-&gt;-|}}',
'{{|-&lt;-|}}li/{{|-&gt;-|}}' '{{|-&lt;-|}}li/{{|-&gt;-|}}'
), array ( ), array (
'<li>', '<li>',
'<li/>' '<li/>'
), $s ); ), $s );
$s = str_replace ( array ( $s = str_replace ( array (
'{{|-&lt;-|}}ul{{|-&gt;-|}}', '{{|-&lt;-|}}ul{{|-&gt;-|}}',
'{{|-&lt;-|}}ul/{{|-&gt;-|}}' '{{|-&lt;-|}}ul/{{|-&gt;-|}}'
), array ( ), array (
'<ul>', '<ul>',
'<ul/>' '<ul/>'
), $s ); ), $s );
$s = str_replace ( array ( $s = str_replace ( array (
'{{|-&lt;-|}}ol{{|-&gt;-|}}', '{{|-&lt;-|}}ol{{|-&gt;-|}}',
'{{|-&lt;-|}}ol/{{|-&gt;-|}}' '{{|-&lt;-|}}ol/{{|-&gt;-|}}'
), array ( ), array (
'<ol>', '<ol>',
'<ol/>' '<ol/>'
), $s ); ), $s );
$s = str_replace ( array ( $s = str_replace ( array (
'{{|-&lt;-|}}pre{{|-&gt;-|}}', '{{|-&lt;-|}}pre{{|-&gt;-|}}',
'{{|-&lt;-|}}pre/{{|-&gt;-|}}' '{{|-&lt;-|}}pre/{{|-&gt;-|}}'
), array ( ), array (
'<pre>', '<pre>',
'<pre/>' '<pre/>'
), $s ); ), $s );
// cleanup // cleanup
$s = str_replace ( array ( $s = str_replace ( array (
'{{|-', '{{|-',
'-|}}' '-|}}'
), array ( ), array (
'', '',
'' ''
), $s ); ), $s );
return $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;
}
?> ?>