View file cfg/func.php

File size: 11.31Kb
<?php
include 'conf.php';
//низ страниц

/* нетрогать тут ничего, кроме того, что в foot() */


function foot()
{
	echo '<a href="index.php">На главную</a><br/>';
	echo '<div class="foot">';
	echo '</div>
	</body></html>';
}
################
$def_stile = 'body {
  background-color: #FFFFFF;
  color: #494949;
  font-family: Lucida Grande, Verdana, Arial, Helvetica, sans-serif;
  font-size: 10px;
}

table {
  color: #494949;
  font-family: Lucida Grande, Verdana, Arial, Helvetica, sans-serif;
  font-size: 12px;
  border-width 10px
}

a:link,a:active,a:visited   {
  color: #3B678D;
  text-decoration: none;
}

.center  {
  background-color: #EBEBEB;
  border: 1px solid #999999;
  padding: 1px;
}

.title  {
  background-color: #D4D6D4;
  border: 1px solid #999999;
  padding: 1px;
}

.buttom  {
  color: #333333;
  border: 1px solid #999999;
  background: #D4D6D4;
  padding: 0px 2px 0px;
  line-height: 1px;
}';
################
function sec($input)
{
$input = mysql_real_escape_string(htmlspecialchars(trim($input)));
return $input;
}
################
function out($input)
{
$input = htmlspecialchars(stripslashes($input));
return $input;
}
################
function int($input)
{
$input = abs(intval($input));
return $input;
}
################
function hashed($input)
{
	$input = md5(md5($input));
	return $input;
}
################
function sys_time()
{
	$month = date('m');
	$month = str_replace('01','Января',$month);
	$month = str_replace('02','Февраля',$month);
	$month = str_replace('03','Марта',$month);
	$month = str_replace('04','Апреля',$month);
	$month = str_replace('05','Мая',$month);
	$month = str_replace('06','Июня',$month);
	$month = str_replace('07','Июля',$month);
	$month = str_replace('08','Августа',$month);
	$month = str_replace('09','Сентября',$month);
	$month = str_replace('10','Октября',$month);
	$month = str_replace('11','Ноября',$month);
	$month = str_replace('12','Декабря',$month);

	echo '<font color="red">[</font>Календарь<font color="red">]</font>: Сегодня '.date('d').' <b>'.$month.'</b> '.date('Y').' года<Br/>';
	echo '<font color="red">[</font>Время<font color="red">]</font>: <b>'.date('H:i').'</b><Br/>';
}
################################################
############################
############################ функция постраничной навигации ############################
############################ лалала ############################
############################ BB-коды ############################

function BBcode($str)
{
$str = preg_replace("#\[link=(.*?)\](.*?)\[/link\]#si", "<a href=\"\\1\">\\2</a>", $str);
$str = preg_replace("#\[url=(.*?)\](.*?)\[/url\]#si", "<a href=\"\\1\">\\2</a>", $str);
$str = preg_replace("#\[red\](.*?)\[/red\]#si", "<span style=\"color: red\">\\1</span>", $str);
$str = preg_replace("#\[blue\](.*?)\[/blue\]#si", "<span style=\"color: blue\">\\1</span>", $str);
$str = preg_replace("#\[black\](.*?)\[/black\]#si", "<span style=\"color: black\">\\1</span>", $str);
$str = preg_replace("#\[white\](.*?)\[/white\]#si", "<span style=\"color: white\">\\1</span>", $str);
$str = preg_replace("#\[green\](.*?)\[/green\]#si", "<span style=\"color: green\">\\1</span>", $str);
$str = preg_replace("#\[orange\](.*?)\[/orange\]#si", "<span style=\"color: orange\">\\1</span>", $str);
$str = preg_replace("#\[pink\](.*?)\[/pink\]#si", "<span style=\"color: pink\">\\1</span>", $str);
$str = preg_replace("#\[gray\](.*?)\[/gray\]#si", "<span style=\"color: gray\">\\1</span>", $str);
$str = preg_replace("#\[big\](.*?)\[/big\]#si", "<span style=\"font-size: 20px\">\\1</span>", $str);
$str = preg_replace("#\[small\](.*?)\[/small\]#si", "<span style=\"font-size: 8px\">\\1</span>", $str);
$str = preg_replace("#\[cod\](.*?)\[/cod\]#si", "<div class=\"d\"><span style=\"color: #000000\">\\1</span></div>", $str);
$str = preg_replace("#\[b\](.*?)\[/b\]#si", "<b>\\1</b>", $str);
$str = preg_replace("#\[u\](.*?)\[/u\]#si", "<u>\\1</u>", $str);
$str = preg_replace("#\[i\](.*?)\[/i\]#si", "<i>\\1</i>", $str);
$str = preg_replace("#\[li\](.*?)\[/li\]#si", "<ul><li>\\1</li></ul>", $str);
$str = preg_replace("#\[strike\](.*?)\[/strike\]#si", "<strike>\\1</strike>", $str);
return nl2br($str);
}

function BBcode_forum($str)
{
$str = preg_replace("#\[link=(.*?)\](.*?)\[/link\]#si", "<a href=\"\\1\">\\2</a>", $str);
$str = preg_replace("#\[cod\](.*?)\[/cod\]#si", "<div class=\"d\"><span style=\"color: #000000\">\\1</span></div>", $str);
$str = preg_replace("#\[quote\](.*?)\[/quote\]#si", "<div class=\"link\"><span style=\"color: #000000\">\\1</span></div>", $str);
$str = preg_replace("#\[url=(.*?)\](.*?)\[/url\]#si", "<a href=\"\\1\">\\2</a>", $str);
$str = preg_replace("#\[red\](.*?)\[/red\]#si", "<span style=\"color: red\">\\1</span>", $str);
$str = preg_replace("#\[blue\](.*?)\[/blue\]#si", "<span style=\"color: blue\">\\1</span>", $str);
$str = preg_replace("#\[black\](.*?)\[/black\]#si", "<span style=\"color: black\">\\1</span>", $str);
$str = preg_replace("#\[green\](.*?)\[/green\]#si", "<span style=\"color: green\">\\1</span>", $str);
$str = preg_replace("#\[orange\](.*?)\[/orange\]#si", "<span style=\"color: orange\">\\1</span>", $str);
$str = preg_replace("#\[pink\](.*?)\[/pink\]#si", "<span style=\"color: pink\">\\1</span>", $str);
$str = preg_replace("#\[gray\](.*?)\[/gray\]#si", "<span style=\"color: gray\">\\1</span>", $str);
$str = preg_replace("#\[small\](.*?)\[/small\]#si", "<span style=\"font-size: 8px\">\\1</span>", $str);
$str = preg_replace("#\[b\](.*?)\[/b\]#si", "<b>\\1</b>", $str);
$str = preg_replace("#\[u\](.*?)\[/u\]#si", "<u>\\1</u>", $str);
$str = preg_replace("#\[i\](.*?)\[/i\]#si", "<i>\\1</i>", $str);
$str = preg_replace("#\[strike\](.*?)\[/strike\]#si", "<strike>\\1</strike>", $str);
return nl2br($str);
}
############################ check ############################
########################## translit ############################
########################## упрощенные знаки к новостям ############################
#######################################################3
function navigation($url, $current_page, $all_pages) {
$center = $current_page;
$left1 = 1;
$left2 = 2;
$left3 = $current_page - 2;
$left4 = $current_page - 1;
$right1 = $current_page + 1;
$right2 = $current_page + 2;
$right3 = $all_pages - 1;
$right4 = $all_pages;

$_left1 = ( $left1 == $center || $left1 <= 0 ) ? null : '<a href="'.$url.'page=1">1</a> ';
$_left2 = ( $left2 == $center || $left2 > $center ) ? null : '<a href="'.$url.'page=2">2</a> ';
$_left3 = ( $left3 < 1 || $left3 == $center || $left3 == $left2 || $left3 == $left1 ) ? null
: '<a href="'.$url.'page='.$left3.'">'.$left3.'</a> ';
$_left4 = ( $left4 < 1 || $left4 == $center || $left4 == $left2 || $left4 == $left1 || $left4 == $right1 ) ? null
: '<a href="'.$url.'page='.$left4.'">'.$left4.'</a> ';

$_right4 = ( $right4 == $center || $right4 <= 0 ) ? null : ' <a href="'.$url.'page='.$all_pages.'">'.$all_pages.'</a>';
$_right3 = ( $right3 == $center || $right3 < $center ) ? null : ' <a href="'.$url.'page='.$right3.'">'.$right3.'</a>';
$_right2 = ( $right2 > $all_pages || $right2 == $center || $right2 == $right3 || $right2 == $right4 ) ? null
: ' <a href="'.$url.'page='.$right2.'">'.$right2.'</a>';
$_right1 = ( $right1 > $all_pages || $right1 == $center || $right1 == $right3 || $right1 == $right4 || $right1 == $left4 ) ? null
: ' <a href="'.$url.'page='.$right1.'">'.$right1.'</a>';

$left_interval = !empty($_left2) && !empty($_left3) ? '..' : null;
$right_interval = !empty($_right2) && !empty($_right3) ? '..' : null;

$page_back = $current_page > 1
? '<a href="'.$url.'page='.($current_page - 1).'">&lt;&lt;</a> '
: '<span style="color: gray">&lt;&lt;</span> ';
$page_forward = $current_page < $all_pages
? ' <a href="'.$url.'page='.($current_page + 1).'">&gt;&gt;</a><br />'
: ' <span style="color: gray">&gt;&gt;</span>';

echo $page_back.$_left1.$_left2.$left_interval.$_left3.$_left4.$center.$_right1.$_right2.$right_interval.$_right3.$_right4.$page_forward;

# вот такая кухня)) ^_^
}
#######################################################
############################ none ############################
##################################################################
##################################################################

/*-----------------------------------------------------------------------------------------------------------------------------*/

# обрезалка многа букаф
function cut_text($text) {
 $z=0; $bc='';
 $rez=substr($text, 0, 2);
 for ($i=2; $i<strlen($text); $i+=2) {
  $c=substr($text, $i, 2);
  if ($bc==$c) $z++;
   else $z=1;
  if ($z<6) $rez.=$c;
  $bc=$c;
 }
 return $rez;
}

/*-----------------------------------------------------------------------------------------------------------------------------*/

function translit($replytext)
{
$trans1=array("W","w","Q","q","CSH","Csh","ZH","Zh","CH","Ch","SH","Sh","JO","Jo","JE","Je","JU","Ju","JA","Ja","csh","zh","ch","sh","jo","je","ju","ja","A","B","V","G","D","E","Z","I","J","K","L","M","N","O","P","R","S","T","U","F","H","C","&#39;","'","Y","a","b","v","g","d","e","z","i","j","k","l","m","n","o","p","r","s","t","u","f","h","c","&#39;","'","y");
$trans2=array("Ш","ш","Ь","ь","Щ","Щ","Ж","Ж","Ч","Ч","Ш","Ш","Ё","Ё","Э","Э","Ю","Ю","Я","Я","щ","ж","ч","ш","ё","э","ю","я","А","Б","В","Г","Д","Е","З","И","Й","К","Л","М","Н","О","П","Р","С","Т","У","Ф","Х","Ц","ь","ь","Ы","а","б","в","г","д","е","з","и","й","к","л","м","н","о","п","р","с","т","у","ф","х","ц","ь","ь","ы");
$replytext=str_replace($trans1,$trans2,$replytext);
$replytext=str_replace("\н","\n",$replytext);
$replytext=str_replace("&лт;","&lt;",$replytext);
$replytext=str_replace("&гт;","&gt;",$replytext);
return $replytext;
}
function atranslit($replytext)
{
$trans1=array("Ш","ш","Ь","ь","Щ","Щ","Ж","Ж","Ч","Ч","Ш","Ш","Ё","Ё","Э","Э","Ю","Ю","Я","Я","щ","ж","ч","ш","ё","э","ю","я","А","Б","В","Г","Д","Е","З","И","Й","К","Л","М","Н","О","П","Р","С","Т","У","Ф","Х","Ц","ь","ь","Ы","а","б","в","г","д","е","з","и","й","к","л","м","н","о","п","р","с","т","у","ф","х","ц","ь","ь","ы");
$trans2=array("W","w","Q","q","CSH","Csh","ZH","Zh","CH","Ch","SH","Sh","JO","Jo","JE","Je","JU","Ju","JA","Ja","csh","zh","ch","sh","jo","je","ju","ja","A","B","V","G","D","E","Z","I","J","K","L","M","N","O","P","R","S","T","U","F","H","C","&#39;","'","Y","a","b","v","g","d","e","z","i","j","k","l","m","n","o","p","r","s","t","u","f","h","c","&#39;","'","y");
$replytext=str_replace($trans1,$trans2,$replytext);
return $replytext;
}


########################

function SecureReazon()
{

$secureReason =	base64_decode("QXV0aG9yIG9mIHNjcmlwdCAtIEV2Z2VuaXlfdHJvamFuIGFrYSBEZWZhdWx0
X21vIDxici8+DQpJQ1EgOSA0NjYgMzY2IC0gVGVjaG5pY2FsIFN1cHBvcnQg
KFRlaG5pY2hlc2theWEgUG9kZGVyemhrYSku");
echo $secureReason;
}

function SecureInput()
{
	$echo = base64_decode("PHNtYWxsPjxhIGhyZWY9Ij9kbz1hdXRob3IiPkFib3V0IFNjcmlwdDwvYT48
L3NtYWxsPg==");
echo $echo;
}



#########################

?>