Просмотр файла functions.php

Размер файла: 8.33Kb
<?php
 ##############################################################################
##                                                                            ##
##                                  P C M S                                   ##
##    Движок на файлах                                                        ##
##    Скрипт распространяется бесплатно!                                      ##
##    Запрещается продавать его и вносить изменения в код!                    ##
##                                                                            ##
##    Автор скрипта: Proton (http://wap-svoboda.com                           ##
##    Создан в ноябре 2009 года.                                              ##
##                                                                            ##
 ##############################################################################
 
function one_letter_big($text) {
$arr=array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');
$arr2=array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z');
$text{0}=str_replace($arr2,$arr,$text{0});
return $text;
}
////////////////////////////////////////////////////////////////////////////////
function upload_file_name($file_name) {
global $path;
$arr=array('ж','щ','ч','ш','ю','я','а','б','в','г','д','е','ё','з','и','й','к','л','м','н','о','п','р','с','т','у','ф','х','ц','ъ','ы','ь','э',' ','Ж','Щ','Ч','Ш','Ю','Я','А','Б','В','Г','Д','Е','Ё','З','И','Й','К','Л','М','Н','О','П','Р','С','Т','У','Ф','Х','Ц','Ъ','Ы','Ь','Э');
$arr2=array('zh','sch','ch','sh','yu','ya','a','b','v','g','d','e','e','z','i','j','k','l','m','n','o','p','r','s','t','u','f','h','c','','y','','e','_','Zh','Sch','Ch','Sh','Yu','Ya','A','B','V','G','D','E','E','Z','I','J','K','L','M','N','O','P','R','S','T','U','F','H','C','','Y','','E');
$file_name=str_replace($arr,$arr2,$file_name);
$file_name=preg_replace("~[^a-z0-9\.\_\-]+~i",'',$file_name);
$new_name=$path.'/upload/'.rand('111','999').'_'.$file_name;
if (file_exists($new_name)) {
return upload_file_name($file_name);
} else {
return $new_name;
}}
////////////////////////////////////////////////////////////////////////////////
function online_tag($user) {
global $path;
$time=time();
$file=@file($path.'/data/users.dat');
if (!empty($file)) {
$str=trim($file[$user-1]);
$arr=explode('||',$str);
$visit=$arr[4];
if ($time<$visit+300) {
return '<span style="color:#00FF00">(on)</span>';
} else {
return '<span style="color:#FF0000">(off)</span>';
}}}
////////////////////////////////////////////////////////////////////////////////
function smile($text) {
$text=preg_replace('/\:\)|\:\-\)|8\-\)/','<img src="/smiles/1.gif" alt="" />',$text,1);
$text=preg_replace('/\:\(|\:\-\(|8\-\(/','<img src="/smiles/2.gif" alt="" />',$text,1);
$text=preg_replace('/\;\)|\;\-\)/','<img src="/smiles/3.gif" alt="" />',$text,1);
$text=preg_replace('/\:P|\:\-P/i','<img src="/smiles/4.gif" alt="" />',$text,1);
$text=preg_replace('/\:D|\:\-D/i','<img src="/smiles/5.gif" alt="" />',$text,1);
return $text;
}
////////////////////////////////////////////////////////////////////////////////
function color_show1($text) {
$text=str_replace('<br />','',$text);
$arr=array('ff0000','ff6200','ff8000','ffc400','adcc00','5fcc00','11cc00','5fcc00','adcc00','ffc400','ff6200','ff0000','ff6200','ff8000','ffc400','adcc00','5fcc00','11cc00','5fcc00','adcc00','ffc400','ff6200','ff0000','ff6200','ff8000','ffc400','adcc00','5fcc00','11cc00','5fcc00','adcc00','ffc400','ff6200','ff0000','ff6200','ff8000','ffc400','adcc00','5fcc00','11cc00','5fcc00','adcc00','ffc400','ff6200','ff0000','ff6200','ff8000','ffc400','adcc00','5fcc00','11cc00','5fcc00','adcc00','ffc400','ff6200','ff0000','ff6200','ff8000','ffc400','adcc00','5fcc00','11cc00','5fcc00','adcc00','ffc400','ff6200','ff0000','ff6200','ff8000','ffc400','adcc00','5fcc00','11cc00','5fcc00','adcc00','ffc400','ff6200','ff0000','ff6200','ff8000','ffc400','adcc00','5fcc00','11cc00','5fcc00','adcc00','ffc400','ff6200'
);
$str='';
$text=iconv('utf-8','windows-1251',$text);
for ($i=0; $i<strlen($text); $i++) {
$str.='<font color="#'.$arr[$i].'">'.$text[$i].'</font>';
}
$str=iconv('windows-1251','utf-8',$str);
return $str;
}
////////////////////////////////////////////////////////////////////////////////
function color_show2($text) {
$text=str_replace('<br />','',$text);
$arr=array('ff00ff','ff00cc','ff0099','ff0066','ff0033','ff0000','ff3300','ff6600','ff9900','ffcc00','ffff00','ccff00','99ff00','ff00ff','ff00cc','ff0099','ff0066','ff0033','ff0000','ff3300','ff6600','ff9900','ffcc00','ffff00','ccff00','99ff00','ff00ff','ff00cc','ff0099','ff0066','ff0033','ff0000','ff3300','ff6600','ff9900','ffcc00','ffff00','ccff00','99ff00','ff00ff','ff00cc','ff0099','ff0066','ff0033','ff0000','ff3300','ff6600','ff9900','ffcc00','ffff00','ccff00','99ff00','ff00ff','ff00cc','ff0099','ff0066','ff0033','ff0000','ff3300','ff6600','ff9900','ffcc00','ffff00','ccff00','99ff00','ff00ff','ff00cc','ff0099','ff0066','ff0033','ff0000','ff3300','ff6600','ff9900','ffcc00','ffff00','ccff00','99ff00','ff00ff','ff00cc','ff0099','ff0066','ff0033','ff0000','ff3300','ff6600','ff9900','ffcc00','ffff00','ccff00','99ff00','ff00ff','ff00cc','ff0099','ff0066','ff0033','ff0000','ff3300','ff6600','ff9900','ffcc00','ffff00','ccff00','99ff00','ff00ff','ff00cc','ff0099','ff0066','ff0033','ff0000','ff3300','ff6600','ff9900','ffcc00','ffff00','ccff00','99ff00',
);
$str='';
$text=iconv('utf-8','windows-1251',$text);
for ($i=0; $i<strlen($text); $i++) {
$str.='<font color="#'.$arr[$i].'">'.$text[$i].'</font>';
}
$str=iconv('windows-1251','utf-8',$str);
return $str;
}
////////////////////////////////////////////////////////////////////////////////
function head_tags($title) {
global $style, $path, $php_self;
$title_head=$title;
//$title=color_show1($title);
$head='<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<!-- PCMS -->
<title>
'.$title_head.'
</title>
<link rel="shortcut icon" href="/favicon.ico">
';
include $path.'/diz/'.$style.'.php';
$head.='</head>
<body>
<div class="t0">
<div class="t1">
<div class="t2">
<div class="t3">
<div class="tcs">
<div class="t2">
<div class="bg3">
<b>'.$title.'</b><br />
</div>
</div>
</div>
</div>
</div>
';
if (!empty($_SESSION['text'])) {
//$head.=color_show1($_SESSION['text']);
$head.=$_SESSION['text'];
$_SESSION['text']='';
}
$head.='</div>
</div>
';
if ($file=@file($path.'/data/head.dat')) {
$head.='<div class="t2">
<div class="t3">
<div class="t2">
';
$count=count($file);
$file=array_reverse($file);
for($i=0;$i<$count;$i++) {
if (!empty($file[$i])) {
$str=trim($file[$i]);
$array=explode('||',$str);
$arr['id']=$array[0];
$arr['time']=$array[1];
$arr['name']=$array[2];
$arr['link']=$array[3];
$head.='<div class="t4_4">
<a href="'.$arr['link'].'">'.$arr['name'].'</a><br />
</div>
';
}}
$head.='</div>
</div>
</div>
';
}
return $head;
}
////////////////////////////////////////////////////////////////////////////////
function foot_tags($timestart) {
global $path, $php_self;
$str='<div class="t0">
<div class="t1">
<div class="t2">
<div class="t3">
<div class="t4">
<div class="tcs">
<div class="bg">
';
$file=@file_get_contents($path.'/data/foot.dat');
$arr=explode('||',$file);
$code=@$arr['0'];
$code2=@$arr['1'];
$code3=@$arr['2'];
if (!empty($code) or !empty($code1) or !empty($code2)) {
$str.=$code.'';
if ($php_self=='/index.php') {
$str.=$code2.'';
} else {
$str.=$code3.'';
}} else {
$str.='<a href="http://wap-svoboda.com"><small>'.color_show1('Copyright©2008-2010 by Proton').'</small></a><br />
<small>'.round((microtime(1)-$timestart)*1000,2).'</small>
'; // Не нарушайте авторских прав!
}
$str.='</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- '.round((microtime(1)-$timestart)*1000,2).' -->
</body></html>
';
return $str;
}
////////////////////////////////////////////////////////////////////////////////
function search_user($user) {
global $path;
$file=@file($path.'/data/users.dat');
$str=trim($file[$user-1]);
$arr=explode("||",$str);
return $arr[0];
}
?>