View file template/func/smiles.php

File size: 1.35Kb
<?

function s($rod)
{	

			$d = opendir("smiles");
			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="smiles/'.$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="smiles/'.$smil[$iii].'.gif" alt=""> </a> ';
					}
					echo'</br>';
}



function smiles($text)
{
$d = opendir("smiles");
			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='smiles/$smil[$i].gif' alt=''/>",$text);
}




return $text;
}

?>