Merge branch 'master' of https://git.seemsleg.it/ef/php-func-lib into
HEAD Conflicts: string.php
This commit is contained in:
commit
90fe919d65
18
_func.php
18
_func.php
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
// include ('config.php');
|
// include ('config.php');
|
||||||
include ('sql.php');
|
include_once ('sql.php');
|
||||||
$sql = new SQL ();
|
$sql = new SQL ();
|
||||||
include ('string.php');
|
include_once ('string.php');
|
||||||
include ('numbers.php');
|
include_once ('numbers.php');
|
||||||
include ('mail.php');
|
include_once ('mail.php');
|
||||||
include ('debug.php');
|
include_once ('debug.php');
|
||||||
include ('markdown.php');
|
include_once ('markdown.php');
|
||||||
?>
|
?>
|
||||||
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
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'] = 'efcms2_';
|
$_m['pre'] = 'efcms2_';
|
||||||
$_m['salt'] = '';
|
$_m['salt'] = '';
|
||||||
?>
|
?>
|
||||||
2
sql.php
2
sql.php
@ -8,7 +8,7 @@ class SQL {
|
|||||||
public $cnt_get = 0;
|
public $cnt_get = 0;
|
||||||
public $cnt_set = 0;
|
public $cnt_set = 0;
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
require ('secret.php');
|
require_once ('secret.php');
|
||||||
|
|
||||||
$this->m = $_m;
|
$this->m = $_m;
|
||||||
$this->pre = $_m ['pre'];
|
$this->pre = $_m ['pre'];
|
||||||
|
|||||||
254
string.php
254
string.php
@ -1,129 +1,129 @@
|
|||||||
<?php
|
<?php
|
||||||
function umlaute($str) {
|
function umlaute($str) {
|
||||||
return str_replace ( array (
|
return str_replace ( array (
|
||||||
'Ä',
|
'Ä',
|
||||||
'Ö',
|
'Ö',
|
||||||
'Ü',
|
'Ü',
|
||||||
'ä',
|
'ä',
|
||||||
'ö',
|
'ö',
|
||||||
'ü',
|
'ü',
|
||||||
'ß'
|
'ß'
|
||||||
), array (
|
), array (
|
||||||
'Ä',
|
'Ä',
|
||||||
'Ö',
|
'Ö',
|
||||||
'Ü',
|
'Ü',
|
||||||
'ä',
|
'ä',
|
||||||
'ö',
|
'ö',
|
||||||
'ü',
|
'ü',
|
||||||
'ß'
|
'ß'
|
||||||
), $str );
|
), $str );
|
||||||
}
|
}
|
||||||
function chk($str) {
|
function chk($str) {
|
||||||
return str_replace ( "'", '"', $str );
|
return str_replace ( "'", '"', $str );
|
||||||
}
|
}
|
||||||
function noScript($str) {
|
function noScript($str) {
|
||||||
return str_replace ( array (
|
return str_replace ( array (
|
||||||
'<',
|
'<',
|
||||||
'>'
|
'>'
|
||||||
), array (
|
), array (
|
||||||
'<',
|
'<',
|
||||||
'>'
|
'>'
|
||||||
), $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 );
|
||||||
$name_neu .= $zeichen {$r};
|
$name_neu .= $zeichen {$r};
|
||||||
}
|
}
|
||||||
return $name_neu;
|
return $name_neu;
|
||||||
}
|
}
|
||||||
function startsWith($haystack, $needle) {
|
function startsWith($haystack, $needle) {
|
||||||
$length = strlen ( $needle );
|
$length = strlen ( $needle );
|
||||||
return (substr ( $haystack, 0, $length ) === $needle);
|
return (substr ( $haystack, 0, $length ) === $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, $auch = '') {
|
function onlyAlpha($str) {
|
||||||
return preg_replace ( "/[^a-zA-Z0-9 \-\_" . $auch . "]+/", "", $str );
|
return preg_replace ( "/[^a-zA-Z0-9 \-\_]+/", "", $str );
|
||||||
}
|
}
|
||||||
function shortener($str, $len = 50, $fill = '...') {
|
function shortener($str, $len = 50, $fill = '...') {
|
||||||
if (strlen ( $str ) > $len) {
|
if (strlen ( $str ) > $len) {
|
||||||
$str = substr ( $str, 0, $len - strlen ( $fill ) ) . $fill;
|
$str = substr ( $str, 0, $len - strlen ( $fill ) ) . $fill;
|
||||||
}
|
}
|
||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
function isEmail($str) {
|
function isEmail($str) {
|
||||||
$match = preg_match ( "/[a-zA-Z0-9\-\_\.]*\@[a-zA-Z0-9\-\_\.]*.[a-z]{2,10}/", $str );
|
$match = preg_match ( "/[a-zA-Z0-9\-\_\.]*\@[a-zA-Z0-9\-\_\.]*.[a-z]{2,10}/", $str );
|
||||||
if ($match) {
|
if ($match) {
|
||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
function markUp($text) {
|
function markUp($text) {
|
||||||
$r = '';
|
$r = '';
|
||||||
$lv = 0;
|
$lv = 0;
|
||||||
foreach ( explode ( "\n", $text ) as $t ) {
|
foreach ( explode ( "\n", $text ) as $t ) {
|
||||||
$nlv = 0;
|
$nlv = 0;
|
||||||
if (startsWith ( '**** ', $t )) {
|
if (startsWith ( '**** ', $t )) {
|
||||||
$t = substr ( $t, 5 );
|
$t = substr ( $t, 5 );
|
||||||
$nlv = 4;
|
$nlv = 4;
|
||||||
}
|
}
|
||||||
if (startsWith ( '*** ', $t )) {
|
if (startsWith ( '*** ', $t )) {
|
||||||
$t = substr ( $t, 4 );
|
$t = substr ( $t, 4 );
|
||||||
$nlv = 3;
|
$nlv = 3;
|
||||||
}
|
}
|
||||||
if (startsWith ( '** ', $t )) {
|
if (startsWith ( '** ', $t )) {
|
||||||
$t = substr ( $t, 3 );
|
$t = substr ( $t, 3 );
|
||||||
$nlv = 2;
|
$nlv = 2;
|
||||||
}
|
}
|
||||||
if (startsWith ( '* ', $t )) {
|
if (startsWith ( '* ', $t )) {
|
||||||
$t = substr ( $t, 2 );
|
$t = substr ( $t, 2 );
|
||||||
$nlv = 1;
|
$nlv = 1;
|
||||||
}
|
}
|
||||||
if ($lv != $nlv) {
|
if ($lv != $nlv) {
|
||||||
while ( $lv < $nlv ) {
|
while ( $lv < $nlv ) {
|
||||||
$text .= '<ul>';
|
$text .= '<ul>';
|
||||||
$lv ++;
|
$lv ++;
|
||||||
}
|
}
|
||||||
while ( $lv > $nlv ) {
|
while ( $lv > $nlv ) {
|
||||||
$text .= '</ul>';
|
$text .= '</ul>';
|
||||||
$lv --;
|
$lv --;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (startsWith ( $t, '!!!!! ' )) {
|
if (startsWith ( $t, '!!!!! ' )) {
|
||||||
$t = '<h5>' . substr ( $t, 6 ) . '</h5>';
|
$t = '<h5>' . substr ( $t, 6 ) . '</h5>';
|
||||||
}
|
}
|
||||||
if (startsWith ( $t, '!!!! ' )) {
|
if (startsWith ( $t, '!!!! ' )) {
|
||||||
$t = '<h4>' . substr ( $t, 5 ) . '</h4>';
|
$t = '<h4>' . substr ( $t, 5 ) . '</h4>';
|
||||||
}
|
}
|
||||||
if (startsWith ( $t, '!!! ' )) {
|
if (startsWith ( $t, '!!! ' )) {
|
||||||
$t = '<h3>' . substr ( $t, 4 ) . '</h3>';
|
$t = '<h3>' . substr ( $t, 4 ) . '</h3>';
|
||||||
}
|
}
|
||||||
if (startsWith ( $t, '!! ' )) {
|
if (startsWith ( $t, '!! ' )) {
|
||||||
$t = '<h2>' . substr ( $t, 3 ) . '</h2>';
|
$t = '<h2>' . substr ( $t, 3 ) . '</h2>';
|
||||||
}
|
}
|
||||||
if (startsWith ( $t, '! ' )) {
|
if (startsWith ( $t, '! ' )) {
|
||||||
$t = '<h1>' . substr ( $t, 2 ) . '</h1>';
|
$t = '<h1>' . substr ( $t, 2 ) . '</h1>';
|
||||||
}
|
}
|
||||||
if ($lv == 0) {
|
if ($lv == 0) {
|
||||||
$r .= $t;
|
$r .= $t;
|
||||||
} else {
|
} else {
|
||||||
$r .= '<li>' . $t . '</li>';
|
$r .= '<li>' . $t . '</li>';
|
||||||
}
|
}
|
||||||
// var_dump ( $t );
|
// var_dump ( $t );
|
||||||
}
|
}
|
||||||
while ( $lv > 0 ) {
|
while ( $lv > 0 ) {
|
||||||
$r .= '</ul>';
|
$r .= '</ul>';
|
||||||
$lv --;
|
$lv --;
|
||||||
}
|
}
|
||||||
return $r;
|
return $r;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
Loading…
Reference in New Issue
Block a user