Location: PHPKode > projects > infoboard > infoboard/_class/_func.php
<?
$iscon["limit_group"]=5;
$iscon["show_lastpost"]=1;
$iscon["limit_lastpost"]=5;
$iscon["edtior_width"]=500;
$iscon["edtior_height"]=150;
$iscon["showslide"]=1;
$iscon["slide_width"]=999;
$iscon["slide_height"]=250;
$iscon["image_slideshow"]=5;
$iscon["image_size"]=500;
$iscon["title_user"]=15;
$iscon["last_modified"]=1;
$iscon["show_numberpage"] = 1;
$iscon["show_read"] = 1;
$iscon["show_reply"] = 1;
$iscon["show_insert"] = 1;
$iscon["form_album"] = 1;
$iscon["form_upload"] = 1;
$iscon["form_icon"] = 1;
$iscon["form_color"] = 1;
$iscon["form_code"] = 1;
$iscon["public_code"] = 0;

$iscon["point"] = array(
    200,
	150,
	120,
	90,
	70,
	50,
	40,
	30,
	20,
	5,
	0
);

$iscon["impoint"] = array(
    "5.0",
	"4.5",
	"4.0",
	"3.5",
	"3.0",
	"2.5",
	"2.0",
	"1.5",
	"1.0",
	"0.5",
	"0.0"
);


	function ismail($mail){
		  if(eregi( '^[-_\.a-z0-9]+@([-a-z0-9]+\.)+[a-z]{2,}$', $mail)){
			  return true;
		  }
		  return false;
	}
	
	function refback($txt){
		echo"
		<script language=\"JavaScript\" type=\"text/javascript\">
		<!--//
		alert(\"".$txt."\");
		window.history.go(-1);
		//-->
		</script>
		";
		exit();
    }

	function refurl($string, $url){
		echo"
		<script language=\"JavaScript\" type=\"text/javascript\">
		var reurl = location.target=top;
		";
		if($string) echo"alert(\"".$string."\");\n";
		echo"
		reurl.location.href=\"".$url."\";
		</script>
		";
		exit();
	}




function brtext($string){
	 return eregi_replace("\n","<br />",$string);
}


function rteSafe($strText) {
	$tmpString = $strText;
	$tmpString = str_replace(chr(145), chr(39), $tmpString);
	$tmpString = str_replace(chr(146), chr(39), $tmpString);
	$tmpString = str_replace("'", "&#39;", $tmpString);
	//$tmpString = str_replace(chr(147), chr(34), $tmpString);
	//$tmpString = str_replace(chr(148), chr(34), $tmpString);
	$tmpString = str_replace(chr(10), " ", $tmpString);
	$tmpString = str_replace(chr(13), " ", $tmpString);
	
	return $tmpString;
}

    function numcaptcha(){
	  $str = "";
	  $htm="";
	   while(strlen($str)<3){
		    $random=rand(48,122);
			if( ($random>47 && $random<58)  ) $str.=chr($random);
	  }
	  $random=rand(2,6);
	  $imcaptcha=$str."+".$random;
	  $imstring[]=base64_encode($imcaptcha);
	  $imstring[]=($str+$random);
	  return $imstring;
   }



function search_dir () {
     global $cur_path, $dir_depth, $matches ;
	 if ($matches > 100) return;
	 $s_dir='';
	 for ($c=0; $c<=$dir_depth; $c++) $s_dir .= $cur_path[$c];
	 $dhandle=opendir($s_dir);
	     while ($file = readdir($dhandle)) {
			    if (($file!='.') && ($file!='..')) {
					  if (is_readable($s_dir.$file)) {
						    if (is_file($s_dir.$file)) {
								 $ext = substr($file, strlen($file)-3, 3);
								 if ($ext == "txt") search_file($s_dir.$file);
							 }elseif (is_dir($s_dir.$file)) {
								  $cur_path[++$dir_depth] = ($file."/");
								  search_dir();
								  $dir_depth--;
							 }
						}
				 }
		  }
  }

function search_file ($file) {
      global $cur_path, $dir_depth, $qry, $results, $topic, $detail, $matches ;
	  $s_dir="";
	  for ($c=0; $c<=$dir_depth; $c++) $s_dir .= $cur_path[$c];
	  $f_size = filesize($file);
	  if($f_size){
		     if ($f_size>100000) $f_size=100000;
			 $f_handle = fopen($file, "r");
			 $f_data   = fread($f_handle, $f_size);
			 if (strpos($f_data, 'SSIGNORE')!==FALSE) return;
			 $f_dlc    = strtolower($f_data);
			 if ($text = strstr(strip_tags($f_dlc), $qry)) {
				   $results[$matches] = $file;
				   $starttopic = strpos ($f_dlc, "<title>") + 7;
				   $endtopic   = strpos ($f_dlc, "</title>");
				   $topic[$matches] = substr($f_data, $starttopic, $endtopic-$starttopic); 
				   $startdetail = strpos ($f_dlc, "<des>") + 5;
				   $enddetail   = strpos ($f_dlc, "</des>");
				   $detail[$matches++] = substr($f_data, $startdetail, $enddetail-$startdetail); 
			   }
			   fclose($f_handle);
		}
  }

?>
Return current item: infoboard