diff --git a/_func.php b/_func.php index 07b5ff6..d5e69cd 100644 --- a/_func.php +++ b/_func.php @@ -1,10 +1,10 @@ - \ No newline at end of file diff --git a/secret.php.example b/secret.php.example index ae43e09..e7ca578 100644 --- a/secret.php.example +++ b/secret.php.example @@ -1,10 +1,10 @@ - \ No newline at end of file diff --git a/sql.php b/sql.php index ff7ca41..5df6de9 100644 --- a/sql.php +++ b/sql.php @@ -8,7 +8,7 @@ class SQL { public $cnt_get = 0; public $cnt_set = 0; public function __construct() { - require ('secret.php'); + require_once ('secret.php'); $this->m = $_m; $this->pre = $_m ['pre']; diff --git a/string.php b/string.php index 91ba4ae..0839fbd 100644 --- a/string.php +++ b/string.php @@ -1,129 +1,129 @@ -' - ), array ( - '<', - '>' - ), $str ); -} -function random($name_laenge) { - $zeichen = "abcedfghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRTSUVWXYZ0123456789"; - $name_neu = ""; - - @mt_srand ( ( double ) microtime () * 1000000 ); - for($i = 0; $i < $name_laenge; $i ++) { - $r = mt_rand ( 0, strlen ( $zeichen ) - 1 ); - $name_neu .= $zeichen {$r}; - } - return $name_neu; -} -function startsWith($haystack, $needle) { - $length = strlen ( $needle ); - return (substr ( $haystack, 0, $length ) === $needle); -} -function endsWith($haystack, $needle) { - $length = strlen ( $needle ); - - return $length === 0 || (substr ( $haystack, - $length ) === $needle); -} -function onlyAlpha($str, $auch = '') { - return preg_replace ( "/[^a-zA-Z0-9 \-\_" . $auch . "]+/", "", $str ); -} -function shortener($str, $len = 50, $fill = '...') { - if (strlen ( $str ) > $len) { - $str = substr ( $str, 0, $len - strlen ( $fill ) ) . $fill; - } - return $str; -} -function isEmail($str) { - $match = preg_match ( "/[a-zA-Z0-9\-\_\.]*\@[a-zA-Z0-9\-\_\.]*.[a-z]{2,10}/", $str ); - if ($match) { - return $str; - } - return false; -} -function markUp($text) { - $r = ''; - $lv = 0; - foreach ( explode ( "\n", $text ) as $t ) { - $nlv = 0; - if (startsWith ( '**** ', $t )) { - $t = substr ( $t, 5 ); - $nlv = 4; - } - if (startsWith ( '*** ', $t )) { - $t = substr ( $t, 4 ); - $nlv = 3; - } - if (startsWith ( '** ', $t )) { - $t = substr ( $t, 3 ); - $nlv = 2; - } - if (startsWith ( '* ', $t )) { - $t = substr ( $t, 2 ); - $nlv = 1; - } - if ($lv != $nlv) { - while ( $lv < $nlv ) { - $text .= ''; - $lv --; - } - } - if (startsWith ( $t, '!!!!! ' )) { - $t = '
' . substr ( $t, 6 ) . '
'; - } - if (startsWith ( $t, '!!!! ' )) { - $t = '

' . substr ( $t, 5 ) . '

'; - } - if (startsWith ( $t, '!!! ' )) { - $t = '

' . substr ( $t, 4 ) . '

'; - } - if (startsWith ( $t, '!! ' )) { - $t = '

' . substr ( $t, 3 ) . '

'; - } - if (startsWith ( $t, '! ' )) { - $t = '

' . substr ( $t, 2 ) . '

'; - } - if ($lv == 0) { - $r .= $t; - } else { - $r .= '
  • ' . $t . '
  • '; - } - // var_dump ( $t ); - } - while ( $lv > 0 ) { - $r .= ''; - $lv --; - } - return $r; -} +' + ), array ( + '<', + '>' + ), $str ); +} +function random($name_laenge) { + $zeichen = "abcedfghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRTSUVWXYZ0123456789"; + $name_neu = ""; + + @mt_srand ( ( double ) microtime () * 1000000 ); + for($i = 0; $i < $name_laenge; $i ++) { + $r = mt_rand ( 0, strlen ( $zeichen ) - 1 ); + $name_neu .= $zeichen {$r}; + } + return $name_neu; +} +function startsWith($haystack, $needle) { + $length = strlen ( $needle ); + return (substr ( $haystack, 0, $length ) === $needle); +} +function endsWith($haystack, $needle) { + $length = strlen ( $needle ); + + return $length === 0 || (substr ( $haystack, - $length ) === $needle); +} +function onlyAlpha($str) { + return preg_replace ( "/[^a-zA-Z0-9 \-\_]+/", "", $str ); +} +function shortener($str, $len = 50, $fill = '...') { + if (strlen ( $str ) > $len) { + $str = substr ( $str, 0, $len - strlen ( $fill ) ) . $fill; + } + return $str; +} +function isEmail($str) { + $match = preg_match ( "/[a-zA-Z0-9\-\_\.]*\@[a-zA-Z0-9\-\_\.]*.[a-z]{2,10}/", $str ); + if ($match) { + return $str; + } + return false; +} +function markUp($text) { + $r = ''; + $lv = 0; + foreach ( explode ( "\n", $text ) as $t ) { + $nlv = 0; + if (startsWith ( '**** ', $t )) { + $t = substr ( $t, 5 ); + $nlv = 4; + } + if (startsWith ( '*** ', $t )) { + $t = substr ( $t, 4 ); + $nlv = 3; + } + if (startsWith ( '** ', $t )) { + $t = substr ( $t, 3 ); + $nlv = 2; + } + if (startsWith ( '* ', $t )) { + $t = substr ( $t, 2 ); + $nlv = 1; + } + if ($lv != $nlv) { + while ( $lv < $nlv ) { + $text .= ''; + $lv --; + } + } + if (startsWith ( $t, '!!!!! ' )) { + $t = '
    ' . substr ( $t, 6 ) . '
    '; + } + if (startsWith ( $t, '!!!! ' )) { + $t = '

    ' . substr ( $t, 5 ) . '

    '; + } + if (startsWith ( $t, '!!! ' )) { + $t = '

    ' . substr ( $t, 4 ) . '

    '; + } + if (startsWith ( $t, '!! ' )) { + $t = '

    ' . substr ( $t, 3 ) . '

    '; + } + if (startsWith ( $t, '! ' )) { + $t = '

    ' . substr ( $t, 2 ) . '

    '; + } + if ($lv == 0) { + $r .= $t; + } else { + $r .= '
  • ' . $t . '
  • '; + } + // var_dump ( $t ); + } + while ( $lv > 0 ) { + $r .= ''; + $lv --; + } + return $r; +} ?> \ No newline at end of file