View file jokes/config.php

File size: 1.33Kb
<?
$guest_set = 1; // Возможность гостям добавлять 1 - возможно / 0 - нет возможности
###ФУНКЦИИ
function altec($msg) {
$msg = htmlspecialchars($msg);
$search = array('|', '\'', '$', '\\', '^', '%', '`', "\0", "\x00", "\x1A");
$replace = array('&#124;', '&#39;', '&#36;', '&#92;', '&#94;', '&#37;', '&#96;', '', '', '');
$msg = str_replace($search, $replace, $msg);
$msg = stripslashes(trim($msg));
return $msg;
} 
function utf_strlen($str) {
  if (function_exists('mb_strlen')) return mb_strlen($str, 'utf-8');
  if (function_exists('iconv_strlen')) return iconv_strlen($str, 'utf-8');
  if (function_exists('utf8_decode')) return strlen(utf8_decode($str));
  return strlen(utf_to_win($str));
} 
###Обрезание текста
function truncate_utf8($string, $len, $wordsafe = FALSE, $dots = true) {
 $slen = strlen($string);
 if ($slen <= $len) {
 return $string;
 }
 if ($wordsafe) {
 $end = $len;
 while (($string[--$len] != ' ') && ($len > 0)) {};
 if ($len == 0) {
 $len = $end;
 }
 }
 if ((ord($string[$len]) < 0x80) || (ord($string[$len]) >= 0xC0)) {
 return substr($string, 0, $len) . ($dots ? ' ...' : '');
 }
 while (--$len >= 0 && ord($string[$len]) >= 0x80 && ord($string[$len]) < 0xC0) {};
 return substr($string, 0, $len) . ($dots ? ' ...' : '');
 }
?>