View file template/func.php

File size: 2.62Kb
<?

function check($message){ 
$message=str_replace("::","I",$message); 
$message=str_replace("|","I",$message); 
$message=str_replace("||","I",$message);
$message=htmlspecialchars($message);                  
$message=str_replace("'","&#39;",$message);            
$message=str_replace("\"","&#34;",$message);  
$message=str_replace("/\\\$/","&#36;",$message);    
$message=str_replace("$","&#36;",$message);          
$message=str_replace("\\","&#92;", $message);                            
$message=str_replace("@","&#64;", $message);      
$message=str_replace("`","", $message);    
$message=str_replace("%","&#37;", $message);                          
$message=stripslashes(trim($message));               
return $message;  }




//онлайн
function on($log) 
{
	$time=time()-$log;
	if($time < 300){echo'<font color=lime>На сайте</font><br/>';}
}





//фото
function photo($log,$id) {

global $sit;

echo'<img src="http://'.$sit.'/data/photo/'.$id.'/'.$log.'" width="200">';}

function photo_sten($log,$id) {

global $sit;
echo'<img src="http://'.$sit.'/data/photo/'.$id.'/'.$log.'" width="100">';}




function img_min($tit,$img) {
global $sit;
echo'<img src="http://'.$sit.'/photo/'.$img.'" title="'.$tit.'" width="200">';
}

function s($rod)
{	

			$d = opendir("s/$rod/");
			while($f = readdir($d))
			{
				if(($f !=".") && ($f !=".."))
				{
					$smil[]=$f;
				}
			}
			closedir($d);

				$tf=count($smil);
				$ts=$tf/10;
				$tb=ceil($ts);
				$tc=floor($ts);
				
				
									for($i=0; $i<$tc; $i++)
					{
						for($ii=$i*10; $ii<$i*10+10; $ii++)
						{
						
							$smil[$ii] = str_replace(".gif","",$smil[$ii]);
						
							echo' <a href="javascript:%20x()" onclick="DoSmilie(\' .'.$smil[$ii].'. \');"> <img src="s/'.$rod.'/'.$smil[$ii].'.gif" alt=""> </a> ';
						}
						echo'<br/>';
					}

					$tvc=$tc*10;
					$to=$tf-$tvc;
					for($iii=$tvc; $iii<$ii+$to; $iii++)
					{
					
						$smil[$iii] = str_replace(".gif","",$smil[$iii]);
					
					
						echo' <a href="javascript:%20x()" onclick="DoSmilie(\' .'.$smil[$iii].'. \');"> <img src="s/'.$rod.'/'.$smil[$iii].'.gif" alt=""> </a> ';
					}
					echo'</br>';
}



function smiles($text)
{
$d = opendir("s");
			while($f = readdir($d))
			{
				if(($f !=".") && ($f !="..") && ($f !="m") && ($f !="zh"))
				{
					$smil[]=$f;
				}
			}
			closedir($d);
$tf=count($smil);
for($i=0; $i<$tf; $i++)
{
$smil[$i] = str_replace(".gif","",$smil[$i]);
$text = str_replace(".$smil[$i].","<img src='s/$smil[$i].gif' alt=''/>",$text);
}




return $text;
}