Location: PHPKode > projects > infoboard > infoboard/_class/class.global.php
<?
class global_infoboard{
	var $iscon = array();
	var $dbconnect;
	var $dbname;
	var $string;
	var $isexp;
	var $qtopic;
	var $htm;
	var $idpage;
	var $qid;
	var $aid;
	var $gid;
	var $qreply;
	var $totalnext;
	var $action;
	var $totalgroup;

	var $cid;
	var $target;

	var $border;
	var $postact;
	var $pnext;
	var $andfield;
	var $gname;
	var $gdetail;
	var $qlevel;
	var $alevel;
	var $gformat;
	var $limit;
	var $gread;
	var $checkq;
	var $checka;
	var $checkpic;
	var $uppic;
	var $orderby;

	var $isuser;
	var $iscode;
	var $linkmenu = true;

	function getglobal(){
		 global $iscon;
		 $this->action ="";
		 $this->isexp="";
		 $this->gid=0;
		 $this->htm=0;
		 $this->pnext=0;

		 $this->qid=0;
		 $this->aid=0;
		 $this->orderby=0;

		 $this->cid=0;
		 $this->target="";

		 $this->isuser="";
		 $this->iscode="";
		 if(isset($_GET["infoboard"])) $this->string=$_GET["infoboard"]; else $this->string="";
		 if($this->string){
			  $this->isexp = explode($iscon["_s"], $this->string);
			  $this->action=$this->isexp[0];
			  if(isset($this->isexp[1])){
				    if(is_numeric($this->isexp[1])) $this->gid=$this->isexp[1];
			  }
		 }
	}


	function stringurl(){
		 if($this->string){
			   switch($this->action){

				   case"group";
				   if(isset($this->isexp[2])){
					    if(is_numeric($this->isexp[2])) $this->orderby=$this->isexp[2];
				   }

				   if(isset($this->isexp[3])){
					    if(is_numeric($this->isexp[3])) $this->pnext=$this->isexp[3];
				   }

				   break;
				   case"topic";
				   if(isset($this->isexp[2])){
					    if(is_numeric($this->isexp[2])) $this->htm=$this->isexp[2];
				   }
				   if(isset($this->isexp[3])){
					    if(is_numeric($this->isexp[3])) $this->pnext=$this->isexp[3];
				   }
				   break;
				   case"ins";
				   if(isset($this->isexp[2])){
					    if(is_numeric($this->isexp[2])) $this->htm=$this->isexp[2];
				   }
				   if(isset($this->isexp[3])){
					    if(is_numeric($this->isexp[3])) $this->pnext=$this->isexp[3];
				   }
				   if(isset($this->isexp[4])){
					    if(is_numeric($this->isexp[4])) $this->qid=$this->isexp[4];
				   }
				   if(isset($this->isexp[5])){
					    if(is_numeric($this->isexp[5])) $this->aid=$this->isexp[5];
				   }
				   break;
				   case"edit";
				   if(isset($this->isexp[2])){
					    if(is_numeric($this->isexp[2])) $this->htm=$this->isexp[2];
				   }
				   if(isset($this->isexp[3])){
					    if(is_numeric($this->isexp[3])) $this->pnext=$this->isexp[3];
				   }

				   if(isset($this->isexp[4])){
					    if(is_numeric($this->isexp[4])) $this->cid=$this->isexp[4];
				   }

				   if(isset($this->isexp[5])){
					    if(is_numeric($this->isexp[5])) $this->target=$this->isexp[5];
				   }

				   break;

				   case"report";
				   if(isset($this->isexp[2])){
					    if(is_numeric($this->isexp[2])) $this->htm=$this->isexp[2];
				   }
				   if(isset($this->isexp[3])){
					    if(is_numeric($this->isexp[3])) $this->pnext=$this->isexp[3];
				   }
				   break;

				   case"user";
				   if(isset($this->isexp[2])){
					    if(is_numeric($this->isexp[2])) $this->cid=$this->isexp[2];
				   }

				   break;

				   case"active";
				   if(isset($this->isexp[1])) $this->isuser=$this->isexp[1];
				   if(isset($this->isexp[2])) $this->iscode=$this->isexp[2];
				   break;

				   case"forget";
				   if(isset($this->isexp[1])) $this->isuser=$this->isexp[1];
				   if(isset($this->isexp[2])) $this->iscode=$this->isexp[2];
				   break;


				   case"member";
				   if(isset($this->isexp[2])){
					    if(is_numeric($this->isexp[2])) $this->orderby=$this->isexp[2];
				   }

				   if(isset($this->isexp[3])){
					    if(is_numeric($this->isexp[3])) $this->pnext=$this->isexp[3];
				   }

				   break;

				   case"admin";
				   if(isset($this->isexp[2])){
					    if(is_numeric($this->isexp[2])) $this->orderby=$this->isexp[2];
				   }

				   if(isset($this->isexp[3])){
					    if(is_numeric($this->isexp[3])) $this->pnext=$this->isexp[3];
				   }

				   break;


				   default;
				   }
		 }
	}

	function urlfriendly($string){
		 global $iscon;
		 return $iscon["_s"].strip_tags(stripslashes($string)).$iscon["_s"];
    }

	function checksess(){
		 global $iscon;
		 global $_SESSION;
		 if(isset($_SESSION["idadmin"])) $iscon["idadmin"] = $_SESSION["idadmin"]; else $iscon["idadmin"] = "";
		 if(isset($_SESSION["admin"])) $iscon["admin"] = $_SESSION["admin"]; else $iscon["admin"] = "";
		 if(isset($_SESSION["mailadmin"])) $iscon["mailadmin"] = $_SESSION["mailadmin"]; else $iscon["mailadmin"] = "";

		 if(isset($_SESSION["iduser"])) $iscon["iduser"] = $_SESSION["iduser"]; else $iscon["iduser"] = "";
		 if(isset($_SESSION["user"])) $iscon["user"] = $_SESSION["user"]; else $iscon["user"] = "";
		 if(isset($_SESSION["mailuser"])) $iscon["mailuser"] = $_SESSION["mailuser"]; else $iscon["mailuser"] = "";

		   if($iscon["idadmin"]) $this->andfield=""; else $this->andfield=" and _active='1' ";

		 return $iscon;
	}

	function showslide(){
		 global $iscon;
		 $path="../data/slideshow.dat";
		   $count=0;
		   if(!file_exists($path)) return;
		   $fp = fopen ($path, "r");
		   while (!feof ($fp)){
			   $data= fgets($fp);
			   $exp = explode("_|_",$data);
			   if(trim($exp[0])){
				    $image[] = trim($exp[0]);
					$desc[] = trim($exp[1]);
					$count++;
			    }
		   }
		   if($count == 0) return;
		   $print="";
		   $print.= "<link href=\"../_css/slide.css\" rel=\"stylesheet\" type=\"text/css\" />\n";
		   $print.= "<script type=\"text/javascript\" src=\"../_js/mootools-release-1.11.js\"></script>\n";
		   $print.= "<script type=\"text/javascript\" src=\"../_js/rokslideshow.js\"></script>\n";
		   $print.= "<div id=\"slideshow\"></div>\n";
		   $print.= "<div id=\"loadingDiv\"></div>\n";
		   $print.= "
		   <script type=\"text/javascript\">
			window.RokSlideshowPath = '';

			var myshow;
			window.addEvent('load', function(){
				var imgs = [];
				";
			for($i=0; $i<count($image); $i++){
				 if(file_exists("../data/slide/".trim($image[$i]).".jpg")){
					  $print.= "\n imgs.push({\n";
					  $print.= "file: '".$image[$i].".jpg',\n";
					  $print.= "title: 'INFOBOARD 8+',\n";
					  $print.= "desc: '".$desc[$i]."',\n";
					  $print.= "url: ''\n";
					  $print.= "});\n";
				 }
			}
			$print.= "
				myshow = new Slideshow('slideshow', { 
					type: 'combo',
					showTitleCaption: 0,
					captionHeight: 20,
					width: 999, 
					height: 250, 
					pan: 20,
					zoom: 30,
					loadingDiv: 1,
					resize: true,
					duration: [2000, 9000],
					transition: Fx.Transitions.Expo.easeOut,
					images: imgs, 
					path: '../data/slide/'
				});

				myshow.caps.h2.setStyles({
					color: '#fff',
					fontSize: '13px'
				});
				myshow.caps.p.setStyles({
					color: '#ccc',
					fontSize: '11px'
				});
			});
		</script>
		";
		return $print;
    }

	function isconnect(){
		 global $iscon;
		 $this->dbconnect = mysql_connect($iscon["localhost"], $iscon["isuser"], $iscon["ispass"]) or die ("Could not connect: " . mysql_error());
		 mysql_query("SET NAMES UTF8");
		 mysql_select_db($iscon["isdbname"]) or die ("Could not connect: " . mysql_error());
		 $this->dbname = $iscon["isdbname"];
	}

	function isclose(){ 
		return mysql_close();
	}

	function adminsess(){
		 global $iscon;
		 if(!$iscon["admin"]) refback($iscon["lang"][112]);
	}



    function getdir($file) {
		global $iscon;
	    $dir = "";
		$path = dirname($file);
		$path = rtrim(preg_replace(array("/\\\\/", "/\/{2,}/"), "/", $path), "/");
		$e = explode("/", ltrim($path, "/"));
		$total = count($e);
		for($i = 0; $i < $total; $i++){
			  if(isset($e[$i])){
				   if(trim($e[$i])) $dir = $e[$i];
			   }
		}
		return $dir ;
   }



	 function fieldselect($tb, $field, $where, $cid){
		   global $iscon;
		   $query=mysql_db_query($this->dbname, "select ".$field." from ".$tb." where ".$where."='".$cid."'");
		   if($result = @mysql_fetch_array($query)){
				 return $result[$field];
			}
	 }


	 function tbupdate($tb, $value, $fieldwhere, $id){
		   global $iscon;
		   if(mysql_db_query($this->dbname, "update ".$tb." set ".$value." where ".$fieldwhere."='".$id."'")){
				 return true;
			}else{
				 return false;
			}
	 }
	 
	 function tbupdateat($tb, $value, $where){
		   global $iscon;
		   if(mysql_db_query($this->dbname, "update ".$tb." set ".$value." where ".$where."")){
				 return true;
			}
	 }


	 function checkactive($user, $code){
		   global $iscon;
		   $query=mysql_db_query($this->dbname, "select * from _user where (_name='".$user."') and (_code='".base64_decode($code)."')");
		   if(mysql_fetch_array($query)){
				 if($this->tbupdate("_user", "_active='1'", "_name", $user)){
					  return true;
				 }
			}
	 }
	 
	 function topicproof($act, $id, $cat, $page){
		   global $iscon;
		   $print="";
		   $print.= "<br /><span class=\"prooftopic\">*".$iscon["lang"][122]."  &nbsp; \n";
		   $print.= " [<a  title=\"".$iscon["lang"][77]."\" href=\"./_req/showtopic.php?action=".$act."&cat=".$cat."&cid=".$id."&page=".$page."\">";
		   $print.= $iscon["lang"][77]."</a>]  \n";
		   $print.= "  &nbsp; [<a onclick=\"return rusure();\" title=\"".$iscon["lang"][24]."\"";
		   $print.= " href=\"./_req/delete.php?action=del".$act."&cat=".$cat."&cid=".$id."&page=".$page."\">";
		   $print.= "<img src=\"./_img/delete.gif\" alt=\"delete\"  border=\"0\" align=\"absmiddle\" /> ".$iscon["lang"][24]."</a>] \n";
		   $print.= "</span><br /><br />\n";
		   return $print;
	 }

	 function imgproof($act, $id, $pic, $ext, $picformat, $cat, $page){
		   global $iscon;
		   if(!$pic) return;
		   if(!$ext) return;
		   $print="";
		   if($picformat == 1){
			    if(!file_exists("./data/pic/".$pic.".".$ext)) return;
		   }elseif($picformat == 2){
			    $img="";
			    for($i=2; $i<=9; $i++){
					 if(file_exists("./data/pic/".$pic."-".$i.".jpg")) $img=1;
				}
				if(!$img) return;
		   }else{
			    return;
		   }
		   $print.= "<br /><span class=\"prooftopic\">*".$iscon["lang"][50]." &nbsp; \n";
		   $print.= " [<a  title=\"".$iscon["lang"][48]."\" href=\"./_req/showimg.php?action=".$act."&cat=".$cat."&cid=".$id."&page=".$page."\">";
		   $print.= $iscon["lang"][48]."</a>]  \n";
		   $print.= "  &nbsp; [<a onclick=\"return rusure();\" title=\"".$iscon["lang"][24]."\" ";
		   $print.= "href=\"./_req/delete.php?action=pic&cat=".$cat."&n=".$pic."&ex=".$ext."&f=".$picformat."&tb=".$act."&cid=".$id."&page=".$page."\">";
		   $print.= "<img src=\"./_img/delete.gif\" alt=\"delete\"  border=\"0\" align=\"absmiddle\" /> ".$iscon["lang"][24]."</a>] \n";
		   $print.= "</span><br /><br />\n";

		   return $print;
	 }

	 function checkmailforget($user, $code){
		   global $iscon;
		   $query=mysql_db_query($this->dbname, "select * from _user where (_name='".$user."') and (_code='".base64_decode($code)."')");
		   if($result = @mysql_fetch_array($query)){
			   $sess=1;
			    if($iscon["lockuser"] > 0){
					  if($result["_active"] == 0) $sess="";
				}
				if($sess){
					 session_register("iduser");
					 $_SESSION["iduser"] = $result["_cid"];
					 session_register("user");
					 $_SESSION["user"] = $result["_name"];
					 session_register("mailuser");
					 $_SESSION["mailuser"] = $result["_mail"];
					 refurl($iscon["lang"][105], "./");
				}else{
					 refurl($iscon["lang"][106]." ".$result["_mail"]."!", "./");
				}
			}
	 }

	 function adminlogin($name, $pass){
		   global $iscon;
		   $query=mysql_db_query($this->dbname, "select * from _admin where (_name='".$name."') and (_pass='".md5($pass)."')");
		   if($result=mysql_fetch_array($query)){
			     session_register("idadmin");
				 $_SESSION["idadmin"] = $result["_cid"];
				 session_register("admin");
				 $_SESSION["admin"] = $result["_name"];
				 session_register("mailadmin");
				 $_SESSION["mailadmin"] = $result["_mail"];
				 return $_SESSION;
			}
	 }


	 function cutword($string, $limit){
		   $string = strip_tags(stripslashes($string));
		   if($limit > 0) if(strlen($string) > $limit ) $string=substr($string, 0, $limit)."..";
		   return htmlspecialchars($string);
	 }

	 function isip(){
		  if(function_exists("HTTP_X_FORWARDED_FOR")){
			   return getenv("HTTP_X_FORWARDED_FOR");
		  }else{
			   return getenv("REMOTE_ADDR");
		  }
	 }

	function checklevel($num){
		 global $iscon;
		 if($iscon["idadmin"]) return true;
		 if(!$iscon["boardinfo"]){
			  switch($num){
				  case"1";
				  if($iscon["iduser"]) return true;
				  break;
				  case"2";
				  break;
				  default;
				  return true;
			 }
		 }
	}

	function showreport($num){
		 global $iscon;
		 if(!$iscon["boardinfo"]){
			  if($num < 2) return true;
		 }
	}


	 function isright($num){
		  global $iscon;
		  switch($num){
			  case"1";
			  return $iscon["lang"][42];
			  break;
			  case"2";
			  return $iscon["lang"][41];
			  break;
			  default;
		  }
	 }

	 function islevel($num){
		  global $iscon;
		  switch($num){
			  case"1";
			  return " <img src=\"./_img/user.gif\"  title=\"User\" align=\"absmiddle\" />";
			  break;
			  case"2";
			  return " <img src=\"./_img/admin.gif\" title=\"Admin\" align=\"absmiddle\" />";
			  break;
			  default;
			  return " <img src=\"./_img/guest.gif\"  title=\"Guest\" align=\"absmiddle\" />";
		  }
	 }

	 function checknew($time){
		   global $iscon;
		   if($iscon["imgnew"] == 0) return;
		   $new="<img src=\"./_img/new.gif\" border=\"0\" />";
		   $day = $this->getdays(date("Y/m/d"),date("Y-m-d",strtotime($time)));
		   if($day >= 0) return $new;
		   if($day <= 0){
			    if($day >= -5) return $new;
		    }
	 }

	 function isname($target, $level, $id, $uid, $user){
		  global $iscon;
		   $print="";
		   $href = $this->txtmod()."edit".$iscon["_s"].$this->idpage.$iscon["_s"].$id.$iscon["_s"].$target.$this->extmod();
		   $profile = $this->txtmod()."user".$iscon["_s"].$this->gid.$iscon["_s"].$uid.$this->extmod();
		   $banner ="";
		   $point=0;

		  switch($level){
			  case"1";
			  $islevel="User";
			  $img = "./_img/icon/user.png";
			  $print.=" <a title=\"Profile : ".$user."\" href=\"".$profile."\">";
			  $ext="";
			  if($read = $this->isread("./data/user/banner/".$user.".ext.dat")){
				   $ex = explode("%", $read);
				   $ext = $ex[0];
				   $point=$ex[1];
				   if(file_exists("./data/user/".$user.".".$ext)) $img = "./data/user/".$user.".".$ext;
			  }
			  $banner = $this->isread("./data/user/banner/".$user.".dat");

			  $print.=" <img src=\"".$img."\" border=\"0\" align=\"absmiddle\" /></a>\n";
			  $print.="<br />";
			  $print.=$this->nickname(1, $user);
			  break;
			  case"2";
			  $islevel="Admin";
			  $img ="./_img/icon/admin.png";
			  $ext = $this->isread("./data/admin/".$iscon["admin"].".ext.dat");
			  if($ext){
					  if(file_exists("./data/admin/".$user.".".$ext)) $img = "./data/admin/".$user.".".$ext;
			  }
			  $print.=" <img src=\"".$img."\" title=\"".$islevel."\" align=\"absmiddle\" />\n";
			  $print.="<br />";
			  $print.=$this->nickname(2, $user);
			  break;
			  default;
			  $islevel="Guest";
			  $print.=" <img src=\"./_img/icon/guest.png\"  title=\"".$islevel."\" align=\"absmiddle\" />\n";
			  $print.="<br />".$user;
		  }
		  
		  if($this->action != "ins"){
			  if(($target == 3) || ($target == 4)){
				    $print.= " - <a onclick=\"return rusure();\" title=\"delete\" href=\"./_req/delete.php?action=delins&cid=".$id."\">";
				    $print.= "<img src=\"./_img/delete.gif\" alt=\"delete\"  border=\"0\" align=\"absmiddle\" /></a> \n";
			  }
			  $print.=" - [<a href=\"".$href."\">".$iscon["lang"][130]."</a>]\n";
		  }
		  $print.="<br />level : ".$islevel."\n";

		  if($level < 2){
			    if($point > 0) $print.="<br />".$point." Posted\n";
				$print.=" <img src=\"./_img/star/".$this->impoint($point)."star.gif\" border=\"0\" align=\"absmiddle\" />\n";
		  }

		  if($banner) $print.= "<br class=\"clear-all\" />\n".$banner;
		  return $print;
	 }

	 function istime($level, $ip, $time, $edit){
		   global $iscon;
		   $print="";
		   $print.= "<br />".date ("d/m/Y - H:i", strtotime($time))."\n";
		   if($iscon["idadmin"]){
			   $print.= " - ".$ip;
		   }elseif($iscon["showip"] > 0){
			   if($level == 0) $print.= " - ".$this->getip($ip);
		   }
		   if($iscon["last_modified"]){
			    if($edit) $print.= "<br />".$iscon["lang"][131]." <em>".$edit."</em>\n";
		   }
		   return $print;
	 }

	 function nickname($level, $user){
		  switch($level){
			  case"1";
			    $path="user";
			  break;
			  case"2";
			    $path="admin";
			  break;
			  default;
			    $path="";
		  }
		  if($path){
			   if($nickname = $this->isread("./data/".$path."/".$user.".txt")){
				    return $nickname;
			   }
		  }
		  return $user;
	 }

	 function impoint($point){
		  global $iscon;
		  $img="0.0";
		  for($i=0; $i<count($iscon["point"]); $i++){
			    if($point >= $iscon["point"][$i]){
					  $img=$iscon["impoint"][$i];
					  return $img;
				}
		  }
		  return $img;
	 }

    function img2bytes($size){ 
		 $bytes = array("B", "KB", "MB", "GB", "TB", "PB"); 
		 $i = 0; 
		 while ($size >= 1024) { 
			 $size = $size/1024; 
			 $i++; 
		} 
		if($i > 1){ 
			return round($size,1)." ".$bytes[$i]; 
		}else{ 
			return round($size,0)." ".$bytes[$i]; 
		} 
	}


	function showip($ip, $user, $admin){
		 if($user > 0) return;
		 if($admin > 0) return;
		 return " - ".$this->getip($ip);
	}


	function getip($string){
		$ip="";
		$exp = explode(",",$string);
		for($i=0;$i<count($exp); $i++){
			$iexp = explode(".",trim($exp[$i]));
			for($x=0;$x<count($iexp); $x++){
				if($x == count($iexp)-1) $ip.="xx "; else $ip.=$iexp[$x].".";
			}
		}
		if($ip=="xx ") $ip="";
		return $ip;
	}


	function getdays($day1,$day2) { 
		return round((strtotime($day2)-strtotime($day1))/(24*60*60),0); 
	} 


	function getcode($cid, $target, $code){
		  if(!$code) return;
		  $file="./data/code/".$target."-".$cid.".code";
		  if(file_exists($file)){
				$line=file($file);
				$count = count($line);
				$height = 30+($count*10);
			    return "<iframe src=\"./_req/iframe.php?cid=".$cid."&target=".$target."\" frameborder=\"0\" width=\"700\"  scrolling=\"auto\" height=\"".$height."\"  wrap=\"physical\" border=\"0\"></iframe>\n";
		  }else{
			   return stripslashes($code);
		  }
	} 

	 function lastupdate($time){
		   global $iscon;
		   $update= "<br />".date ("d M Y - H:i", strtotime($time))."\n";

		   $postlast = $this->getdays(date("Y/m/d"),date("Y-m-d",strtotime($time)));
		   if($postlast >= 0) return $update."<br /><img src=\"./_img/update.gif\" border=\"0\" />";
		   
		   if($postlast <= 0){
			    if($postlast >= -7){
					 if($postlast == -1){
						   return $update."<br />".$iscon["lang"][132];
					 }elseif($postlast < -1){
						   return $update."<br />".$iscon["lang"][133]." ".(0-$postlast)." ".$iscon["lang"][134];
					 }
				}else{
					return $update."<br />".$iscon["lang"][135];
				}
		    }
			return $update;
	 }



	 function nodata($line){
		   global $iscon;
		   $print=$iscon["lang"][136];
		   for($i=0; $i<$line; $i++){
			    $print.= "<br class=\"clear-all\" />\n";
		   }
		   return $print;
	 }


	 function txtmod(){
		  global $iscon;
		  if($iscon["urlmod"] > 0){
			   return "infoboard/";
		  }else{
			   return "?infoboard=";
		  }
	 }

	 function extmod(){
		 global $iscon;
		  if($iscon["urlmod"] > 0){
			   if($iscon["_s"] == "/") return ""; else return ".html";
		  }
		  return "";
	 }


	function isread($path){
	    $detail="";
		if(!file_exists($path)) return;
		$fp = fopen ($path, "r");
		while (!feof ($fp)) {
			$detail.= fgets($fp);
		}
		if($detail) return stripslashes($detail);
    }


	function iswrite($path, $data){
		  $fp=fopen($path,"w");
		  fwrite($fp ,stripslashes($data));  
		  fclose($fp);
	} 


	 function showcoverbanner($target){
		 global $iscon;
		 $print= "";
		 if($banner=$this->isread("./data/banner".$target.".dat")){
			  $print.=$banner;
		 }
		 return $print;
	 }


	 function showbanner($target, $align){
		 global $iscon;
		 $print= "";
		 if($banner=$this->isread("./data/banner".$target.".dat")){
			  $print.="<br class=\"clear-all\" />\n";
			  $print.="<div align=\"".$align."\">";
			  $print.=$banner;
			  $print.= "</div>\n";
			  $print.= "<br class=\"clear-all\" />\n";
		 }
		 return $print;
	 }



	function getlast($toget) {
		 $pos=strrpos($toget,".");
		 $lastext=substr($toget,$pos+1) ;
		 return $lastext ;
	}

	function checkext($ext){
		global $iscon;
		$qetext = "";
		for($i=0;$i<count($iscon["fileext"]);$i++){
			  if($ext ==$iscon["fileext"][$i]){
				    $qetext = $ext;
		      }
		 }
		 return $qetext;
	}

	function checkkeep($word){
		global $iscon;
		for($i=0;$i<count($iscon["keepregister"]);$i++){
			  if($word ==$iscon["keepregister"][$i]){
					return true;
		      }
		 }
	}

	function badword($string){
		global $iscon;
		for ( $i=0 ; $i<sizeof($iscon["badword"]); $i++ ){
			$string = eregi_replace($iscon["badword"][$i] ,"***" ,$string);
		}
		return $string;
	}


	 function checklogin($user, $pass){
		   global $iscon;
		   $query=mysql_db_query($this->dbname, "select * from _user where (_name='".$user."') and (_pass='".$pass."')");
		   if($result=mysql_fetch_array($query)){
				 return $result;
			}else{
				 return false;
			}
	 }


	function gdext($ext){
		  switch($ext){
		  case"jpg";
		      return $ext;
		  break;
		  case"jpeg";
		      return $ext;
		  break;
		  case"png";
		      return $ext;
		  break;
		  default;
		  }
		 return;
	}


	function checkon($path){
		global $iscon;
		if($iscon["useronline"] == 0) return;
		$on =0;
		$min =10;
		$ip=$this->isip();
		$time = @time();
		$timeout = time()-(60*$min);
		$data=$ip."_|_".$time."\r\n";
		$buffer="";
	    if(file_exists($path)){
			 $read=file($path);
			 for ($i=0;$i<count($read);$i++){
				  $exp = explode("_|_",$read[$i]);
				  if($exp[1] > $timeout) {
					    if($exp[0] != $ip) $buffer.= $read[$i]; 
				  }
			 }
		 }
          $fp=fopen($path,"w");
          fwrite($fp ,$buffer.$data);  
          fclose($fp);

		  if(file_exists($path)){
			   $read=file($path);
			   for ($i=0;$i<count($read);$i++){
				    $on++;
				}
				return "<br /><div align=\"center\">".$on." useronline </div>";
		  }
	}


	 function showlevel($readlevel, $qlevel, $alevel, $checkq, $checka, $checkpic, $uppic){
		   global $iscon;
		   if($iscon["boardinfo"]) return;
		   if($iscon["showlevel"] == 0) return;
		   $show=0;
		   $print="";
		   $ucontent = array($iscon["lang"][43], $iscon["lang"][44], $iscon["lang"][45], $iscon["lang"][46], $iscon["lang"][47], $iscon["lang"][48], $iscon["lang"][49]);
		   $slevel= array($iscon["lang"][40], $iscon["lang"][39], $iscon["lang"][38]);
		   $img ="<img src=\"./_img/checked1.gif\" width=\"15\" height=\"17\" align=\"absbottom\" />";
		   $checked = array($readlevel, $qlevel, $alevel, $checkq, $checka, $checkpic, $uppic);
		   $print.= "<br class=\"clear-all\" />\n"; 
		   $print.= "<div id=\"levelgtopic\">\n";
		   $print.= "<ul> <span class=\"blacktopic\">".$iscon["lang"][53]."";
		   if($iscon["gname"]) $print.= " (".$iscon["gname"].")";
		   $print.= "</span> \n";
		   $print.= "<br class=\"clear-all\" />\n";
		   
		   if($checked[0] == 1){
				 $print.= "<li class=\"level\">".$img." ".$ucontent[0]." (".$slevel[$checked[0]].")</li>\n";
				 $show=1;
			}

		   $text = "";
		   $count=0;
		   for($i=1; $i<=2; $i++){
			         if($checked[$i] == 2){
						  $text.= "<li class=\"level\">".$img." ล็อค".$ucontent[$i]."</li>\n";
						  $show=1;
						  $count++;
					 }elseif($checked[$i] == 1){
						  $text.= "<li class=\"level\">".$img." ".$ucontent[$i]." (".$slevel[$checked[$i]].")</li>\n";
						  $show=1;
					 }
		   }
		   if($count > 1){
			    $print.= "<li class=\"level\">".$img." ".$iscon["lang"][52]."</li>\n";
		   }else{
			    $print.= $text;
		   }
		   
		   $text = "";
		   $count=0;
		   for($i=3; $i<=4; $i++){
					 if($checked[$i] == 1){
						  $text.= "<li class=\"level\">".$img." ".$ucontent[$i]."</li>\n";
						  $count++;
						  $show=1;
					 }
		   }
		   if($count > 1){
			    $print.= "<li class=\"level\">".$img." ".$iscon["lang"][51]."</li>\n";
		   }else{
			    $print.= $text;
		   }


		   if($checked[5] == 1){
			    $print.= "<li class=\"level\">".$img." ".$ucontent[5]." (".$slevel[1].")</li>\n";
				$show=1;
		  }elseif($checked[5] == 2){
			   $print.= "<li class=\"level\">".$img." ".$iscon["lang"][50]."</li>\n";
			   $show=1;
		  }


		  if($checked[6] == 1){
			   $print.= "<li class=\"level\">".$img." ".$ucontent[6]." (".$slevel[1].")</li>\n";
			   $show=1;
		  }elseif($checked[6] == 2){
			   $print.= "<li class=\"level\">".$img." ".$ucontent[6]." (".$slevel[2].")</li>\n";
			   $show=1;
		  }


			$print.= "</ul>\n";
			$print.= "</div>\n";
			$print.= "<br class=\"clear-all\" />\n"; 
			if($show > 0) return $print;
    }


	 function checkgroup($cid, $field){
		   global $iscon;
		   $query=mysql_db_query($this->dbname, "select ".$field." from _group where _cid='".$cid."'");
		   if($result = @mysql_fetch_array($query)){
				 return $result[$field];
			}
	 }

	 function checksel($gid){
		   global $iscon;
		   $qlevel=0;
		   $print="";
		   $textlevel="";
		   $query=mysql_db_query($this->dbname, "select _readlevel, _qlevel, _alevel, _checkq, _checka, _checkpic, _uppic from _group where _cid='".$gid."'");
		   if($result = @mysql_fetch_array($query)){
				$qlevel = $result["_qlevel"];
				$alevel = $result["_alevel"];
				$readlevel = $result["_readlevel"];
				$checkq = $result["_checkq"];
				$checka = $result["_checka"];
				$checkpic = $result["_checkpic"];
				$uppic = $result["_uppic"];
			    $textlevel=$this->showlevel($readlevel, $qlevel, $alevel, $checkq, $checka, $checkpic, $uppic);
		   }
		   switch($qlevel){
			     case"1";
				 if($iscon["user"]){
					 $print.="<input type=\"submit\" name=\"submit\" id=\"forminfo\" value=\"Submit\" />\n";
				 }elseif($iscon["admin"]){
					 $print.="<input type=\"submit\" name=\"submit\" id=\"forminfo\" value=\"Submit\" />\n";
				}else{
					 $print.="<span class=\"inputerror\">".$iscon["lang"][137]."่</span>\n";
				 }
				 break;
				 case"2";
				 if($iscon["admin"]){
					  $print.="<input type=\"submit\" name=\"submit\" id=\"forminfo\" value=\"Submit\" />\n";
				 }else{
					  $print.="<span class=\"inputerror\">".$iscon["lang"][138]."</span>\n";
				 }
				 break;
				 default;
				 $print.="<input type=\"submit\" name=\"submit\" id=\"forminfo\" value=\"Submit\" />\n";
			}
			
			$print.="<input type=\"hidden\" name=\"_qlevel\" value=\"".$qlevel."\" />\n";
			$print.="<input type=\"hidden\" name=\"_alevel\" value=\"".$alevel."\" />\n";
			$print.="<input type=\"hidden\" name=\"_readlevel\" value=\"".$readlevel."\" />\n";
			$print.="<input type=\"hidden\" name=\"_checkq\" value=\"".$checkq."\" />\n";
			$print.="<input type=\"hidden\" name=\"_checka\" value=\"".$checka."\" />\n";
			$print.="<input type=\"hidden\" name=\"_checkpic\" value=\"".$checkpic."\" />\n";
			$print.="<input type=\"hidden\" name=\"_uppic\" value=\"".$uppic."\" />\n";
			$print.="<br class=\"clear-all\" />\n";

			$print.=$textlevel;
			return $print;
	 }


	 function checkpost($gid, $field){
		   global $iscon;
		   $msg="";
		   $level = $this->checkgroup($gid, $field);
		   switch($level){
			     case"1";
				 if(!$iscon["user"]){
						 if(!$iscon["admin"]) $msg=$iscon["lang"][42];
				 }
				 break;
				 case"2";
				 if(!$iscon["admin"]) $msg=$iscon["lang"][41];
				 break;
				 default;
			}
			return $msg;
	 }


	 function checklevelform($field){
		   global $iscon;
		   $msg="";
		   switch($field){
			     case"1";
				 if(!$iscon["user"]){
						 if(!$iscon["admin"]) $msg=$iscon["lang"][42];
				 }
				 break;
				 case"2";
				 if(!$iscon["admin"]) $msg=$iscon["lang"][41];
				 break;
				 default;
			}
			return $msg;
	 }

	 function numtopic($totalnext, $reply, $topic, $href){
		   global $iscon;
		   if(!$iscon["show_numberpage"]) return;
		   $print="<br />";
		   $print.= "Page ";
		   $totalnext=(int) ($reply / $iscon["showreply"]);
		   if(($reply % $iscon["showreply"]) !=0 ) $totalnext+=1;
		   if($totalnext > 0){
			     for($x=1; $x <= $totalnext; $x++) {
					  $print.= "[<a title=\"".stripslashes($topic)."\"  href=\"".$href.$x.$iscon["extmod"]."\"  target=\"".$iscon["target"]."\">".$x."</a>] ";
				 }
		   }else{
			    $print.= "[<a title=\"".stripslashes($topic)."\"  href=\"".$href."1".$iscon["extmod"]."\"  target=\"".$iscon["target"]."\">1</a>] ";
		   }
		   $this->totalnext = $totalnext;
			return $print;
	 }

	 function checkidgroup(){
		   global $iscon;
		   $query=mysql_db_query($this->dbname, "select _cid from _group order by  _cid asc");
		   if($result = @mysql_fetch_array($query)){
				 return $result["_cid"];
			}
	 }

	 function checkgroupname($cid){
		   global $iscon;
		   $this->gname = "";
		   $this->gdetail = "";
		   $this->qlevel = 0;
		   $this->alevel = 0;
		   $this->gformat = 0;
		   $this->limit = 0;
		   $this->gread = 0;
		   $this->checkq = 0;
		   $this->checka = 0;
		   $this->checkpic=0;
		   $this->uppic=0;
		   $query=mysql_db_query($this->dbname, "select _name, _detail, _qlevel, _alevel, _format, _limit, _readlevel, _checkq, _checka, _checkpic, _uppic from _group  where _cid='".$cid."'");
		   if($result = @mysql_fetch_array($query)){
			     $this->gname = $result["_name"];
				 $this->gdetail = $result["_detail"];
				 $this->qlevel = $result["_qlevel"];
				 $this->alevel = $result["_alevel"];
				 $this->gformat = $result["_format"];
				 $this->limit = $result["_limit"];
				 $this->gread = $result["_readlevel"];
				 $this->checkq = $result["_checkq"];
				 $this->checka = $result["_checka"];
				 $this->checkpic = $result["_checkpic"];
				 $this->uppic = $result["_uppic"];
		  }
	 }


	 function quegroup(){
		   global $iscon;
		   $data="";
		   $query=mysql_db_query($this->dbname, "select * from _group order by  _cid asc");
		   while($result = @mysql_fetch_array($query)){
				 $data[0][] = $result["_cid"];
				 $data[1][] = $result["_name"];
				 $data[2][] = $result["_detail"];
				 $data[3][] = $result["_qlevel"];
				 $data[4][] = $result["_alevel"];
				 $data[5][] = $result["_format"];
				 $data[6][] = $result["_limit"];
				 $data[7][] = $result["_readlevel"];
				 $data[8][] = $result["_checkq"];
				 $data[9][] = $result["_checka"];
				 $data[10][] = $result["_checkpic"];
				 $data[11][] = $result["_uppic"];
				 $que=true;
			}
			return $data;
	 }


	 function isswf($path, $id, $version, $width, $height, $bgcolor, $nobr){
		   $print = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" ";
		   $print.= "codebase=\"http://download.macromedia.com/pub/shockwave/cabs";
		   $print.= "/flash/swflash.cab#version=".$version."\" width=\"".$width."\" height=\"".$height."\" id=\"".$id."\" align=\"middle\">";
		   $print.= "<param name=\"allowScriptAccess\" value=\"sameDomain\" />";
		   $print.= "<param name=\"allowFullScreen\" value=\"false\" />";
		   $print.= "<param name=\"movie\" value=\"".$path."\" />";
		   $print.= "<param name=\"quality\" value=\"high\" />";
		   if($bgcolor)  $print.= "<param name=\"bgcolor\" value=\"".$bgcolor."\" />";
		   $print.= "<param name=\"menu\" value=\"false\">";
		   $print.= "<param name=\"wmode\" value=\"transparent\">";
		   $print.= "<embed src=\"".$path."\" width=\"".$width."\" height=\"".$height."\" align=\"middle\" quality=\"high\"";
		   if($bgcolor)  $print.= " bgcolor=\"".$bgcolor."\"";
		   $print.= " name=\"".$id."\" allowScriptAccess=\"sameDomain\" allowFullScreen=\"false\" type=\"application/x-shockwave-flash\" ";
		   $print.= "pluginspage=\"http://www.macromedia.com/go/getflashplayer\" menu=\"false\" wmode=\"transparent\" />";
		   $print.= "</object>";
		   return $print;
	}


	 function flvplayer($cid, $width, $height, $nobr){
return "
<script language=\"javascript\">
	if (AC_FL_RunContent == 0) {
		alert(\"This page requires AC_RunActiveContent.js.\");
	} else {
		AC_FL_RunContent(
			'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0',
			'width', '".$width."',
			'height', '".$height."',
			'src', './_req/flvplayer.swf?cid=".$cid."',
			'quality', 'high',
			'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
			'align', 'middle',
			'play', 'true',
			'loop', 'true',
			'scale', 'showall',
			'wmode', 'window',
			'devicefont', 'false',
			'id', '".$cid."',
			'bgcolor', '#000000',
			'name', '".$cid."',
			'menu', 'true',
			'allowFullScreen', 'true',
			'allowScriptAccess','sameDomain',
			'movie', './_req/flvplayer.swf?cid=".$cid."',
			'salign', ''
			); //end AC code
	}
</script>
<noscript>
	<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"".$width."\" height=\"".$height."\" id=\"".$cid."\" align=\"middle\">
	<param name=\"allowScriptAccess\" value=\"sameDomain\" />
	<param name=\"allowFullScreen\" value=\"false\" />
	<param name=\"movie\" value=\"./_req/flvplayer.swf?cid=".$cid."\" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#000000\" />	<embed src=\"./_req/flvplayer.swf?cid=".$cid."\" quality=\"high\" bgcolor=\"#000000\" width=\"".$width."\" height=\"".$height."\" name=\"".$cid."\" align=\"middle\" allowScriptAccess=\"sameDomain\" allowFullScreen=\"false\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />
	</object>
</noscript>
";
}



	 function mpplayer($cid, $width, $height, $nobr){
$print= "
<script language=\"javascript\">
	if (AC_FL_RunContent == 0) {
		alert(\"This page requires AC_RunActiveContent.js.\");
	} else {
		AC_FL_RunContent(
			'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0',
			'width', '".$width."',
			'height', '".$height."',
			'src', './_req/mpplayer.swf?cid=".$cid."',
			'quality', 'high',
			'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
			'align', 'middle',
			'play', 'true',
			'loop', 'true',
			'scale', 'showall',
			'wmode', 'window',
			'devicefont', 'false',
			'id', '".$cid."',
			'bgcolor', '#000000',
			'name', '".$cid."',
			'menu', 'true',
			'allowFullScreen', 'true',
			'allowScriptAccess','sameDomain',
			'movie', './_req/mpplayer.swf?cid=".$cid."',
			'salign', ''
			); //end AC code
	}
</script>
<noscript>
	<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"".$width."\" height=\"".$height."\" id=\"".$cid."\" align=\"middle\">
	<param name=\"allowScriptAccess\" value=\"sameDomain\" />
	<param name=\"allowFullScreen\" value=\"false\" />
	<param name=\"movie\" value=\"./_req/mpplayer.swf?cid=".$cid."\" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#000000\" />	<embed src=\"./_req/mpplayer.swf?cid=".$cid."\" quality=\"high\" bgcolor=\"#000000\" width=\"".$width."\" height=\"".$height."\" name=\"".$cid."\" align=\"middle\" allowScriptAccess=\"sameDomain\" allowFullScreen=\"false\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />
	</object>
</noscript>
		
";
     if(!$nobr) $print.= "<div style=\"clear: both;\">&nbsp;</div>\n";
	 return $print;
}



	 function swfgallery($cid, $nobr){
		   $print = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"";
		   $print.= "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" ";
		   $print.= "width=\"650\" height=\"480\" id=\"gallery\" align=\"middle\">\n";
		   $print.= "<param name=\"allowScriptAccess\" value=\"sameDomain\" />\n";
		   $print.= "<param name=\"allowFullScreen\" value=\"true\" />\n";
		   $print.= "<param name=\"movie\" value=\"./_req/gallery.swf?cid=".$cid."\" />\n";
		   $print.= "<param name=\"quality\" value=\"high\" />\n";
		   $print.= "<param name=\"bgcolor\" value=\"#000000\" />\n";
		   $print.= "<embed src=\"./_req/gallery.swf?cid=".$cid."\" quality=\"high\" bgcolor=\"#000000\" ";
		   $print.= "width=\"650\" height=\"480\" name=\"gallery\" align=\"middle\" allowScriptAccess=\"sameDomain\" ";
		   $print.= "allowFullScreen=\"false\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />\n";
		   $print.= "</object>\n";
		   return $print;
	}

	function ismovie($string, $nobr){
		   $print="";
		   if(!$nobr) $print.= "<br />\n";
		   $print.="<object classid='clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95'>";
		   $print.="<param name='FileName' value='".$string."' />";
		   $print.="</object>";
		   return $print;
    }


	function showimg($path, $name, $ext, $format, $getheight, $align, $proofimg, $checkpic, $nobr){
	  global $iscon;
	  if(!$name) return;
	  if($nobr) $br=""; else $br="<br />";
	  if($align){
		   $divs="<div align=\"".$align."\">".$br;
		   $dive=$br."</div>";
	  }else{
		   $divs=$br;
		   $dive=$br;
	  }

	  if($format > 1){
		   $impic=0;
		   for($i=2; $i<=9; $i++){
			    if(!file_exists($path.$name."-".$i.".jpg")) $impic++;
		   }
		   if($impic == 0) return;
		   if($checkpic > 0){
			     if($im = $this->imgsecurity(2, $proofimg, $checkpic)) return $im;
			}
			return $divs.$this->swfgallery($name, $nobr).$dive;
	  }else{
		   if(!file_exists($path.$name.".".$ext))  return;
		   if($checkpic > 0){
			      if($im = $this->imgsecurity(2, $proofimg, $checkpic)) return $im;
		   }
	  }

	  if($getheight) $getheight="height=\"".$getheight."\"";
	  
	  switch($ext){
		  case"swf";
		  list($width, $height) = getimagesize($path.$name.".".$ext);
		  return $divs.$this->isswf($path.$name.".".$ext, $ext[0], 7, $width, $height, "", $nobr).$dive;
		  break;
		  case"mp3";
		  return $divs.$this->mpplayer($name, 200, 35, $nobr).$dive;
		  break;
		  case"avi";
		  return $divs.$this->ismovie($path.$name.".".$ext, $nobr).$dive;
		  break;
		  case"wmv";
		  return $divs.$this->ismovie($path.$name.".".$ext, $nobr).$dive;
		  break;
		  case"wav";
		  return $divs.$this->ismovie($path.$name.".".$ext, $nobr).$dive;
		  break;
		  case"gif";
		  return $divs."<img src=\"".$path.$name.".".$ext."\" ".$getheight." border=\"0\" />".$dive;
		  break;
		  case"jpg";
		  return $divs."<img src=\"".$path.$name.".".$ext."\" ".$getheight." border=\"0\" />".$dive;
		  break;
		  case"jpeg";
		  return $divs."<img src=\"".$path.$name.".".$ext."\" ".$getheight." border=\"0\" />".$dive;
		  break;
		  case"png";
		  return $divs."<img src=\"".$path.$name.".".$ext."\" ".$getheight." border=\"0\" />".$dive;
		  break;
		  case"flv";
		  return $divs.$this->flvplayer($name, 460, 400, $nobr).$dive;
		  break;

		  default;
		     if(file_exists($path.$name.".".$ext)){
				  $img = "";
				  $img.= "<br /><br /><a title=\"\" href=\"".$path.$name.".".$ext."\" target=\"_blank\"><img src=\"./_img/ext/".$ext.".gif\"  border=\"0\" /> ";
				  $img.= "<span class=\"attach\">Attach File (.".$ext.")</span></a><br /><br />";
				  return $img;
			 }
	    }
	 }



	function imgsecurity($target, $proofimg, $checkpic){
	  global $iscon;
	  $print="";
	   if($iscon["idadmin"]) return;
	   if($proofimg == 1){
		     if($iscon["iduser"]) return;
			 $action = 1;
	   }elseif($proofimg == 2){
		     $action = 2;
	   }else{
		    return;
	   }
	   
	  switch($action){
		  case"1";
		     if($checkpic == 2) return;
		     if($target == 1){
				   return "<img src=\"./_img/display_member50.png\"  border=\"0\" />";
			 }else{
				   $print.= "<div>";
				   $print.= "<img src=\"./_img/display_member.png\"  border=\"0\" />";
				   $print.= "<br /><br />".$iscon["lang"][139]."<br />";
				   $print.= "</div>";
				   $print.= "<br class=\"clear-all\" />\n";  
				   $print.= "<br class=\"clear-all\" />\n";  
				   return $print;
			 }
		  break;
		  case"2";
		     if($target == 1){
				   return "<img src=\"./_img/security_site50.png\"  border=\"0\" />";
			 }else{
				   $print.= "<div>";
				   $print.= "<img src=\"./_img/security_site.png\"  border=\"0\" />";
				   $print.= "<br /><br />".$iscon["lang"][140]."<br />";
				   $print.= "</div>";
				   $print.= "<br class=\"clear-all\" />\n";  
				   $print.= "<br class=\"clear-all\" />\n";  
				   return $print;
			 }
		  default;
	   }
	}


	function showimgcover($name, $image, $format, $width, $proofimg, $checkpic){
	  global $iscon;
	  $path = "./data/pic/";
	  $imsize = "width=\"".$width."\"";
	  $noimg = "<img src=\"./_img/no_picture50.png\" ".$imsize."  border=\"0\" />";

	  if($format > 1){
		     $ispic="";
		  	  if($image){
				   $exp = explode(".", $image);
				   $im = $exp[0];
				   for($i = 2; $i<=9; $i++){
					    $file=$path.$im."-".$i.".jpg";
						if(file_exists($file)){
							$ispic = "<img src=\"".$file."\" ".$imsize." border=\"0\" /><br />\n";
							break;
						}
				   }
			  }
			  if(!$ispic){
				   for($i = 2; $i<=9; $i++){
					    $file=$path.$name."-".$i.".jpg";
						if(file_exists($file)){
							 $ispic = "<img src=\"".$file."\" ".$imsize." border=\"0\" /><br />\n";
							 break;
						}
				   }
			  }
			  if(!$ispic) return $noimg;
			  if($checkpic > 0){
				   if($im = $this->imgsecurity(1, $proofimg, $checkpic)) return $im;
			  }
			  return $ispic;
	  }else{
		    if(!$image) return $noimg;
			if($checkpic > 0){
				  if($im = $this->imgsecurity(1, $proofimg, $checkpic)) return $im;
			}
	  }
	  $exp = explode(".", $image);
	  switch($exp[1]){
		  case"swf";
		  return "<img src=\"./_img/player50.png\"  border=\"0\" />";
		  break;
		  case"mp3";
		  return "<img src=\"./_img/player50.png\"  border=\"0\" />";
		  break;
		  case"avi";
		  return "<img src=\"./_img/player50.png\"  border=\"0\" />";
		  break;
		  case"wmv";
		  return "<img src=\"./_img/player50.png\"  border=\"0\" />";
		  break;
		  case"wav";
		  return "<img src=\"./_img/player50.png\"  border=\"0\" />";
		  break;
		  case"gif";
		  return "<img src=\"".$path.$image."\" ".$imsize." border=\"0\" />";
		  break;
		  case"jpg";
		  return "<img src=\"".$path.$image."\" ".$imsize." border=\"0\" />";
		  break;
		  case"jpeg";
		  return "<img src=\"".$path.$image."\" ".$imsize." border=\"0\" />";
		  break;
		  case"png";
		  return "<img src=\"".$path.$image."\" ".$imsize." border=\"0\" />";
		  break;
		  case"flv";
		  return "<img src=\"./_img/player50.png\"  border=\"0\" />";
		  break;
		  default;
			 return "<img src=\"./_img/attach50.png\"  border=\"0\" />";
	   }
	 }



	 function infoboardgroupcover(){
		   global $iscon;
		   global $total;
		   global $icon;
		   global $no;
		   global $topic;
		   global $name;
		   global $level;
		   global $showpic;
		   global $limit;
		   global $read;
		   global $reply;
		   global $insert;
		   global $new;
		   global $hot;
		   global $cool;
		   global $date;
		   $this->isconnect();
		   if(!$data = $this->quegroup()) return;
		   $print="";
		   $print.="<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n";
		   $print.="<html xmlns=\"http://www.w3.org/1999/xhtml\">\n";
		   $print.="<head>\n";
		   $print.="<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n";
		   if($iscon["urlmod"] > 0) $print.="<base href=\"".$iscon["fullpath"]."\" />\n";
		   $print.="<link href=\"./_css/cover.css\" rel=\"stylesheet\" type=\"text/css\" media=\"screen\" />\n";
		   $print.="</head>\n";

		   $iscon["rewrite"]=$this->txtmod();
		   $iscon["extmod"]=$this->extmod();
		   

		   for($i =0; $i<count($data[0]); $i++){
			   $idcat=$data[0][$i];
			   $gname=$data[1][$i];
			   $gdetail=$data[2][$i];
			   $print.= "<div id=\"tabgroup\">".$gname." &nbsp; <span class=\"stopic\">".$gdetail."</span></div>\n";

			   $query=mysql_db_query($this->dbname, "select * from _infoboardq  where _cat='".$idcat."' and _active='1' order by  _page desc  limit 0, ".$total."");
			   while($result = @mysql_fetch_array($query)){
				     $href = "./".$iscon["rewrite"]."topic".$iscon["_s"].$result["_cat"].$iscon["_s"].$result["_page"].$iscon["_s"];
					 $linktopic = "<a title=\"".stripslashes($result["_topic"])."\"  href=\"".$href."1".$iscon["extmod"]."\"  target=\"".$iscon["target"]."\">\n";
					 $print.= "<div id=\"topiclist\">\n";
					 $print.= "<ul>\n";
					 if($showpic){
					     $print.= "<li class=\"topicimg\">";
						 $print.= $linktopic;
						 $print.= $this->showimgcover($result["_pic"], $result["_piccover"], $result["_coverformat"], 50, $result["_activeimg"], $this->checkpic);
						 $print.= "</a></li>\n";
					 }else{
						  if($icon){
							   if($result["_reply"] > 0) $qim=1; else $qim=0;
							   $print.= "<li class=\"topicicon\"><img src=\"./_img/knot".$qim.".gif\" alt=\"\" width=\"13\" height=\"13\" border=\"0\" /></li>\n";
						  }
						  if($no) $print.= "<li class=\"no\">".sprintf("%06d",$result["_page"])."</li>\n";
					 }
					 $print.= "<li  class=\"topicadmin\">\n";
					 if($topic) $print.= $linktopic.$this->cutword($result["_topic"], $limit)."</a>\n";
					 if($new) $print.= " <img src=\"./_img/new.gif\" alt=\"\"  border=\"0\" /> ";
					 if($hot){
						  if($result["_read"] > $iscon["imghot"]) $print.= " <img src=\"./_img/hot.gif\" border=\"0\" /> ";
					 }
					 if($cool){
						  if($result["_reply"] > $iscon["imgcool"]) $print.= " <img src=\"./_img/cool.gif\" border=\"0\" /> ";
					 }
					 if($showpic) $print.= "<br /><br />\n";
					 $print.= "<span class=\"stopic\">";
					 if($level) $print.= " - ".$this->islevel($result["_level"])."";
					 if($name) $print.= " - ".$result["_name"]." ";
					 if($read) $print.= " - ".$iscon["lang"][151].":".$result["_read"]." ";
					 if($reply) $print.= " - ".$iscon["lang"][152].":".$result["_reply"]."  ";
					 if($insert) $print.= " - ".$iscon["lang"][153].":".$result["_insert"]." \n";
					 if($date) $print.= " - [".date ("d/m/Y", strtotime($result["_time"]))."]\n";
					 $print.= "</span>\n";
					 $print.= "</li>\n";
					 $print.= "</ul>\n";
					 $print.= "</div>\n";
					 $print.= "<br class=\"clear-all\" />\n";
			   }
			   $print.= "<br class=\"clear-all\" />\n";
		   }
			  $this->isclose();
			  return $print;
	 }


	 function infoboardcover($gid){
		   global $iscon;
		   global $total;
		   global $icon;
		   global $no;
		   global $topic;
		   global $name;
		   global $level;
		   global $showpic;
		   global $limit;
		   global $read;
		   global $reply;
		   global $insert;
		   global $new;
		   global $hot;
		   global $cool;
		   global $date;
		   if(!$gid) return $this->infoboardgroupcover();
		   $print="";
		   $print.="<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n";
		   $print.="<html xmlns=\"http://www.w3.org/1999/xhtml\">\n";
		   $print.="<head>\n";
		   $print.="<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n";
		   if($iscon["urlmod"] > 0) $print.="<base href=\"".$iscon["fullpath"]."\" />\n";
		   $print.="<link href=\"./_css/cover.css\" rel=\"stylesheet\" type=\"text/css\" media=\"screen\" />\n";
		   $print.="</head>\n";

		   $iscon["rewrite"]=$this->txtmod();
		   $iscon["extmod"]=$this->extmod();
		   $this->isconnect();

		   $query=mysql_db_query($this->dbname, "select * from _infoboardq  where _cat='".$gid."' and _active='1' order by  _page desc  limit 0, ".$total."");
		   while($result = @mysql_fetch_array($query)){
			      $href = "./".$iscon["rewrite"]."topic".$iscon["_s"].$result["_cat"].$iscon["_s"].$result["_page"].$iscon["_s"];
				  $linktopic = "<a title=\"".stripslashes($result["_topic"])."\"  href=\"".$href."1".$iscon["extmod"]."\"  target=\"".$iscon["target"]."\">\n";
				  
				  
				  $print.= "<div id=\"topiclist\">\n";
				  $print.= "<ul>\n";
				  if($showpic){
					     $print.= "<li class=\"topicimg\">";
						 $print.= $linktopic;
						 $print.= $this->showimgcover($result["_pic"], $result["_piccover"], $result["_coverformat"], 50, $result["_activeimg"], $this->checkpic);
						 $print.= "</a></li>\n";
				  }else{
					   if($icon){
						    if($result["_reply"] > 0) $qim=1; else $qim=0;
							$print.= "<li class=\"topicicon\"><img src=\"./_img/knot".$qim.".gif\" alt=\"\" width=\"13\" height=\"13\" border=\"0\" /></li>\n";
					   }
						 if($no) $print.= "<li class=\"no\">".sprintf("%06d",$result["_page"])."</li>\n";
				  }
				  $print.= "<li  class=\"topicadmin\">\n";
				  if($topic) $print.= $linktopic.$this->cutword($result["_topic"], $limit)."</a>\n";

				  if($new) $print.= " <img src=\"./_img/new.gif\" alt=\"\"  border=\"0\" /> ";

				  if($hot){
					    if($result["_read"] > $iscon["imghot"]) $print.= " <img src=\"./_img/hot.gif\" border=\"0\" /> ";
				  }
				  if($cool){
						     if($result["_reply"] > $iscon["imgcool"]) $print.= " <img src=\"./_img/cool.gif\" border=\"0\" /> ";
				  }

				  if($showpic) $print.= "<br /><br />\n";

				  $print.= "<span class=\"stopic\">";
				  if($level) $print.= " - ".$this->islevel($result["_level"])."";
				  if($name) $print.= " - ".$result["_name"]." ";

				  if($read) $print.= " - ".$iscon["lang"][151].":".$result["_read"]." ";
				  if($reply) $print.= " - ".$iscon["lang"][152].":".$result["_reply"]."  ";
				  if($insert) $print.= " - ".$iscon["lang"][153].":".$result["_insert"]." \n";

				  if($date) $print.= " - [".date ("d/m/Y", strtotime($result["_time"]))."]\n";
 
				  $print.= "</span>\n";
				  $print.= "</li>\n";

					   $print.= "</ul>\n";
					   $print.= "</div>\n";
					   $print.= "<br class=\"clear-all\" />\n";
		   }

			  $print.= "<br class=\"clear-all\" />\n";
			  $this->isclose();
			  return $print;
	 }


}
?>
Return current item: infoboard