Location: PHPKode > projects > infoboard > infoboard/_class/class.topic.php
<?
class showboard extends global_infoboard{

	 function first(){
		   global $iscon;
		   $print="";
		   $word=0;
		   $line=20;
		   $iscon["rewrite"]=$this->txtmod();
		   $iscon["extmod"]=$this->extmod();
		   if(isset($iscon["friendly"])) $getfriendly = $iscon["friendly"]; else $getfriendly=false;

		   if(!$data = $this->quegroup()){
			    return;
		   }
		   $this->totalgroup=count($data[0]);
		   if($this->totalgroup ==1){
			    $showgroup=$iscon["showtopic"];
		   }else{
				$showgroup=$iscon["limit_group"];
		   }
		   
		   for($i =0; $i<$this->totalgroup; $i++){
			   $idcat=$data[0][$i];
			   $gname=$data[1][$i];
			   $gdetail=$data[2][$i];
			   $qlevel=$data[3][$i];
			   $alevel=$data[4][$i];
			   $format=$data[5][$i];
			   $limit=$data[6][$i];
			   $readlevel=$data[7][$i];
			   $checkq=$data[8][$i];
			   $checka=$data[9][$i];
			   $checkpic=$data[10][$i];
			   $uppic=$data[11][$i];

			   $print.= "<br class=\"clear-all\" />\n";
			   $print.= "<div id=\"firsttabgroup\">";
			   $print.= "<a title=\"".$gname."\" href=\"".$iscon["rewrite"]."group".$iscon["_s"].$idcat.$iscon["_s"]."0".$iscon["_s"]."1".$iscon["extmod"]."\">";
			   $print.= $gname."</a>\n";
			   $print.= " &nbsp; <span class=\"stopic\">".$gdetail."</span>\n";
			   $print.= "</div>\n";

			   $topiccount = 0;

				$query=mysql_db_query($this->dbname, "select * from _infoboardq  where _cat='".$idcat."' ".$this->andfield." order by  _page desc  limit 0, ".$showgroup);

				$print.= "<div id=\"firsttopiccontent\">\n";
				$print.= "<ul>\n";
				if($format > 0) $no="&nbsp;"; else $no="No.";
				if($qlevel < 2){
					 $licount = array("no", "topic", "posted", "modified");
					 $litext = array($no, "Topic", "Posted by", "Latest");
				}else{
					 $licount = array("no", "topicadmin", "posted");
					 $litext = array($no, "Topic", "Posted by");
				}

				for($a=0; $a<count($licount); $a++){
					   $li = $a+1;
					  $print.= "<li class=\"".$licount[$a]."\">\n";
					  $print.= "".$litext[$a]."\n";
					  $print.= "</li>\n";
				}
				$print.= "</ul>\n";
				$print.= "</div>\n";
				$print.= "<br />\n";

				while($result = @mysql_fetch_array($query)){
					   $topiccount++;
					   $word++;
					   $time = date ("d/m/Y - H:i", strtotime($result["_time"]));
					   $topic = $result["_topic"];
					   $read = $result["_read"];
					   $reply = $result["_reply"];
					   $insert = $result["_insert"];
					   
					   if($getfriendly){
							$gettitle = $this->urlfriendly($topic);
					   }else{
						    $gettitle="";
					   }
					   $href = $iscon["rewrite"]."topic".$iscon["_s"].$result["_cat"].$iscon["_s"].$result["_page"].$iscon["_s"];

					   $linktopic = "<a title=\"".stripslashes($topic)."\"  href=\"".$href."1".$iscon["extmod"].$gettitle."\"  target=\"".$iscon["target"]."\">\n";

					   $print.= "<div id=\"firsttopiclist\">\n";
					   $print.= "<ul>\n";

					   if($format > 0){
						     $print.= "<li class=\"topicimg\">";
							 $print.= $linktopic;
							 $print.= $this->showimgcover($result["_pic"], $result["_piccover"], $result["_coverformat"], 50, $result["_activeimg"], $checkpic);
							 $print.= "</a></li>\n";
					   }else{
						    if($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";
							$print.= "<li class=\"no\">".sprintf("%06d",$result["_page"])."</li>\n";
					   }

					   if($qlevel < 2) $print.= "<li  class=\"topic\">\n"; else $print.= "<li  class=\"topicadmin\">\n";

					   $print.= $linktopic;
					   $print.= "".$this->cutword($topic, $limit)."</a>\n";
					   
					   $print.= "<br /><span class=\"stopic\">";

					   if($iscon["show_read"]) $print.= $iscon["lang"][151]." <strong>".$read."</strong> ";
					   if($iscon["show_reply"]) $print.= "- ".$iscon["lang"][152]." <strong>".$reply."</strong> ";
					   if($iscon["show_insert"]) $print.= "- ".$iscon["lang"][153]." <strong>".$insert."</strong>\n";
					   if($iscon["imghot"] > 0){
						     if($read > $iscon["imghot"]) $print.= " <img src=\"./_img/hot.gif\" border=\"0\" /> ";
					   }
					   if($iscon["imgcool"] > 0){
						     if($reply > $iscon["imgcool"]) $print.= " <img src=\"./_img/cool.gif\" border=\"0\" /> ";
					   }

					   $this->totalnext = 1;
					   $print.= $this->numtopic($this->totalnext, $reply, $topic, $href);

					   $print.= "</span>\n";
					   $print.= "\n";
					   $print.= "\n";
					   $print.= "</li>\n";

					   $print.= "<li class=\"posted\">";
					   $print.= $linktopic;
					   $print.=$this->nickname($result["_level"], $result["_name"]);
					   $print.= "</a>\n";

					   $print.= $this->islevel($result["_level"])."\n";
					   $print.= "<br />".$time."\n";
					   $print.= "</li>\n";

					   if($qlevel < 2){
						     $print.= "<li class=\"modified\">";
						     if($result["_save"] == 1){
								   $print.= "<a title=\"".stripslashes($topic)."\"  href=\"".$href.$this->totalnext.$iscon["extmod"]."\"  target=\"".$iscon["target"]."\">";
								   $print.= $this->nickname($result["_anslevel"], stripslashes($result["_ansname"]));
								   $print.= "</a>\n";
								   $print.= $this->islevel($result["_anslevel"]);
								   $print.= $this->lastupdate($result["_update"])."\n";
							 }elseif($result["_save"] == 2){
								   $print.= "<a title=\"".stripslashes($topic)."\"  href=\"".$href.$result["_uppage"].$iscon["extmod"]."\"  target=\"".$iscon["target"]."\">";
								   $print.= $this->nickname($result["_anslevel"], stripslashes($result["_ansname"]));
								   $print.= "</a>\n";
								   $print.= $this->islevel($result["_anslevel"]);
								   $print.= $this->lastupdate($result["_update"])."\n";
							 }else{
								   $print.= "&nbsp;\n";
							 }
							 $print.= "</li>\n";
					   }

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

				$print.= "<div id=\"firstlevel\">\n";
				 $print.= $this->showlevel($readlevel, $qlevel, $alevel, $checkq, $checka, $checkpic, $uppic);
				 $print.= "</div>\n";
				 
				 $print.= "<br class=\"clear-all\" />\n";

				 if($topiccount > 0){
					  $print.= "<div id=\"buttomgroup\">\n";
					  $print.= "<a title=\"".$gname."\" href=\"".$iscon["rewrite"]."group".$iscon["_s"].$idcat.$iscon["_s"]."0".$iscon["_s"]."1".$iscon["extmod"]."\">";
					  $print.= $iscon["lang"][141]." <u>".$gname."</u> &nbsp; <img src=\"./_img/next.png\" align=\"absmiddle\" border=\"0\" /></a></div>\n";
				 }
			  
		   }

			  if($word < $line){
				   for($i=0; $i<($line-$word); $i++){
					     $print.= "<br class=\"clear-all\" />\n";
				   }
			  }
			  return $print;
	 }


	 function groupid($stick){
		   global $iscon;
		   $print="";
		   $word=0;
		   $line=20;
		   
		   if(!$this->gid) return;
		   $iscon["rewrite"]=$this->txtmod();
		   $iscon["extmod"]=$this->extmod();
		   if(isset($iscon["friendly"])) $getfriendly = $iscon["friendly"]; else $getfriendly=false;

		   $and= $this->andfield." and _stick='".$stick."' ";

		   if($stick){
			    $print.= "<div id=\"tabhgroup\">".$this->gname." &nbsp; <span class=\"stopic\">".$this->gdetail."</span></div>\n";
		   }else{
			    $print.= "<div id=\"tabgroup\">".$this->gname." &nbsp; <span class=\"stopic\">".$this->gdetail."</span></div>\n";
		   }

		   if($this->action){
				$order = $this->isby($this->orderby);
		   }else{
				$order = "order by  _page desc";
		   }

			      $query=mysql_db_query($this->dbname, "select _page from _infoboardq  where _cat='".$this->gid."' ".$and."");
			      $totalrecord=mysql_num_rows($query);
			      if($totalrecord == 0){
					  if($stick)  return; else return $this->nodata($line);
				  }

				 if($stick){
					  $query=mysql_db_query($this->dbname, "select * from _infoboardq  where _cat='".$this->gid."' ".$and." order by  _page desc");
				 }else{
					  if($iscon["showtopic"] > 0) { $totalpage=(int) ($totalrecord / $iscon["showtopic"]); }
					  if(($totalrecord % $iscon["showtopic"]) !=0 ) $totalpage+=1;
					  if($this->pnext) {
						  $start = $iscon["showtopic"] * ($this->pnext - 1);
					  }else{
						  $this->pnext = 1; $start = 0;
					  }
					  $nextid = $this->pnext+1;
					  $previousid = $this->pnext -1;

					  $query=mysql_db_query($this->dbname, "select * from _infoboardq  where _cat='".$this->gid."' ".$and." ".$order."  limit ".$start.", ".$iscon["showtopic"]."");
					  $print.= "<div id=\"topiccontent\">\n";
					  $print.= "<ul>\n";
					  
					  if($this->gformat > 0) $no="&nbsp;"; else $no="No.";
					  if($this->qlevel < 2){
						   $licount = array("no", "topic", "posted", "modified");
						   $litext = array($no, "Topic", "Posted by", "Latest");
					  }else{
						   $licount = array("no", "topicadmin", "posted");
						   $litext = array($no, "Topic", "Posted by");
					  }
					  for($i=0; $i<count($licount); $i++){
						   $li = $i+1;
						   $print.= "<li class=\"".$licount[$i]."\">\n";
						   if($this->orderby == $li){
							     $print.= "<a href=\"".$iscon["rewrite"]."group".$iscon["_s"].$this->gid.$iscon["_s"]."0".$iscon["_s"].$this->pnext.$iscon["extmod"]."\"><img src=\"./_img/arrow1.gif\" alt=\"\" border=\"0\" />".$litext[$i]."</a>\n";
						   }else{
							    $print.= "<a href=\"".$iscon["rewrite"]."group".$iscon["_s"].$this->gid.$iscon["_s"].$li.$iscon["_s"].$this->pnext.$iscon["extmod"]."\"><img src=\"./_img/arrow0.gif\" alt=\"\" border=\"0\" />".$litext[$i]."</a>\n";
						   }
						   $print.= "</li>\n";
					  }
					  $print.= "</ul>\n";
					  $print.= "</div>\n";
					  $print.= "<br />\n";
				 }

				while($result = @mysql_fetch_array($query)){
					   $word++;
					   $topic = $result["_topic"];
					   $read = $result["_read"];
					   $reply = $result["_reply"];
					   $insert = $result["_insert"];
					   if($getfriendly){
							$gettitle = $this->urlfriendly($topic);
					   }else{
						    $gettitle="";
					   }

					   $href = $iscon["rewrite"]."topic".$iscon["_s"].$result["_cat"].$iscon["_s"].$result["_page"].$iscon["_s"];

					   $linktopic = "<a title=\"".stripslashes($topic)."\"  href=\"".$href."1".$iscon["extmod"].$gettitle."\"  target=\"".$iscon["target"]."\">\n";

					   $print.= "<div id=\"topiclist\">\n";
					   $print.= "<ul>\n";

					   if($this->gformat > 0){
						     $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($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";
							$print.= "<li class=\"no\">".sprintf("%06d",$result["_page"])."</li>\n";
					   }

					   if($this->qlevel < 2) $print.= "<li  class=\"topic\">\n"; else $print.= "<li  class=\"topicadmin\">\n";

					   $print.= $linktopic;
					   if($iscon["idadmin"]){
						    if($result["_active"] > 0) $print.= $topic; else $print.= "<s>".$topic."</s>";
					   }else{
						    $print.= $this->cutword($topic, $this->limit);
					   }
					   $print.= "</a>\n";
					   $print.= $this->checknew($result["_time"]);
					   $print.= "<br /><span class=\"stopic\">";

					   if($iscon["show_read"]) $print.= $iscon["lang"][151]." <strong>".$read."</strong> ";
					   if($iscon["show_reply"]) $print.= "- ".$iscon["lang"][152]." <strong>".$reply."</strong> ";
					   if($iscon["show_insert"]) $print.= "- ".$iscon["lang"][153]." <strong>".$insert."</strong>\n";
					   if($iscon["imghot"] > 0){
						     if($read > $iscon["imghot"]) $print.= " <img src=\"./_img/hot.gif\" border=\"0\" /> ";
					   }
					   if($iscon["imgcool"] > 0){
						     if($reply > $iscon["imgcool"]) $print.= " <img src=\"./_img/cool.gif\" border=\"0\" /> ";
					   }

					   if($iscon["idadmin"]){
						    if($result["_active"] > 0){
								  $print.= " &nbsp; <a onclick=\"return rusure();\" title=\"".$iscon["lang"][24]."\"";
								  $print.= " href=\"./_req/delete.php?action=deltopic&cid=".$result["_cid"]."\">";
								  $print.= "<img src=\"./_img/delete.gif\" alt=\"".$iscon["lang"][24]."\"  border=\"0\" align=\"absmiddle\" /></a>\n";
								  
								  if($result["_stick"] > 0){
									   $print.= " &nbsp; <a title=\"".$iscon["lang"][100]."\" href=\"./_req/highlight.php?cid=".$result["_cid"]."&stick=0\">";
									   $print.= "<img src=\"./_img/down.gif\" alt=\"".$iscon["lang"][100]."\"  border=\"0\" />";
								  }else{
									   $print.= " &nbsp; <a title=\"".$iscon["lang"][128]."\" href=\"./_req/highlight.php?cid=".$result["_cid"]."&stick=1\">";
									   $print.= "<img src=\"./_img/up.gif\" alt=\"".$iscon["lang"][128]."\"  border=\"0\" />";
								  }
								  $print.= "</a>\n";
							}
					   }

					   $this->totalnext = 1;
					   $print.= $this->numtopic($this->totalnext, $reply, $topic, $href);

					   $print.= "</span>\n";
					   $print.= "</li>\n";

					   $print.= "<li class=\"posted\">";
					   $print.= $linktopic;
					   $print.=$this->nickname($result["_level"], $result["_name"]);
					   $print.= "</a>";
					   
					   $print.= $this->islevel($result["_level"])."\n";
					   $print.= "<br />".date ("d/m/Y - H:i", strtotime($result["_time"]))."\n";
					   $print.= "</li>\n";

					   if($this->qlevel < 2){
						     $print.= "<li class=\"modified\">";
						     if($result["_save"] == 1){
								   $print.= "<a title=\"".stripslashes($topic)."\"  href=\"".$href.$this->totalnext.$iscon["extmod"]."\"  target=\"".$iscon["target"]."\">";
								   $print.= $this->nickname($result["_anslevel"], stripslashes($result["_ansname"]));
								   $print.= "</a>\n";

								   $print.= $this->islevel($result["_anslevel"]);
								   $print.= $this->lastupdate($result["_update"])."\n";
							 }elseif($result["_save"] == 2){
								   $print.= "<a title=\"".stripslashes($topic)."\"  href=\"".$href.$result["_uppage"].$iscon["extmod"]."\"  target=\"".$iscon["target"]."\">";
								   $print.= $this->nickname($result["_anslevel"], stripslashes($result["_ansname"]));
								   $print.= "</a>\n";
								   $print.= $this->islevel($result["_anslevel"]);
								   $print.= $this->lastupdate($result["_update"])."\n";
							 }else{
								   $print.= "&nbsp;\n";
							 }
							 $print.= "</li>\n";
					   }

					   $print.= "</ul>\n";
					   $print.= "</div>\n";
					   $print.= "<br class=\"clear-all\" />\n";
				}
				if(!$stick){

				if($totalrecord > $iscon["showtopic"]){
					   $print.= "<br class=\"clear-all\" />\n";
					   $hrefnext = "group".$iscon["_s"].$this->gid.$iscon["_s"].$this->orderby.$iscon["_s"];
					   $print.= "<form id=\"form1\" name=\"form1\">\n";
					   $print.= "<div align=\"center\">";
					   if($previousid <= 0) { 
						   $print.= "<span class=\"nonext\"><img src=\"./_img/ci_prev_0.gif\" border=\"0\" align=\"absmiddle\" /></span>"; 
					  }else{ 
						   $print.= "<a title=\"PREV\" href=\"".$iscon["rewrite"].$hrefnext.$previousid.$iscon["extmod"]."\"><img src=\"./_img/ci_prev.gif\" border=\"0\" align=\"absmiddle\" /></a>"; 
					  }

					  $print.= " &nbsp; <select name=\"iselect\" onChange=\"openselect(this.form)\" class=\"sinput\">\n";
					  if($iscon["urlmod"] > 0) $linkurl=""; else $linkurl=$iscon["rewrite"];
					  for($i=1; $i <= $totalpage; $i++) {
						    if($i == $this->pnext) {
								 $print.="<option value=\"".$linkurl.$hrefnext.$i.$iscon["extmod"]."\" selected=\"selected\">".$i."</option>\n";
							}else{
								 $print.="<option value=\"".$linkurl.$hrefnext.$i.$iscon["extmod"]."\">".$i."</option>\n";
							}
					  }
					  $print.= "</select> &nbsp; \n";

					  if($nextid > $totalpage) { 
						   $print.= "<span class=\"nonext\"><img src=\"./_img/ci_next_0.gif\" border=\"0\" align=\"absmiddle\" /></span>"; 
					 }else{ 
						   $print.= "<a title=\"NEXT\"  href=\"".$iscon["rewrite"].$hrefnext.$nextid.$iscon["extmod"]."\"><img src=\"./_img/ci_next.gif\" border=\"0\" align=\"absmiddle\" /></a>"; 
					 }
					 $print.= "</div>";
					 $print.= "</form>\n";
			  }
			}

			  $print.= "<br class=\"clear-all\" />\n";
			  if(!$stick){
				    if($word < $line){
						 for($i=0; $i<($line-$word); $i++){
							   $print.= "<br class=\"clear-all\" />\n";
						 }
					}
					$print.= $this->showlevel($this->gread, $this->qlevel, $this->alevel, $this->checkq, $this->checka, $this->checkpic, $this->uppic);
			  }
			  return $print;
	 }

	 function firstupdate(){
		   global $iscon;
		   $print="";
		   $data="";
		   $iscon["rewrite"]=$this->txtmod();
		   $iscon["extmod"]=$this->extmod();
		   if(isset($iscon["friendly"])) $getfriendly = $iscon["friendly"]; else $getfriendly=false;

		   $lasttab= "<br class=\"clear-all\" />\n";
		   $lasttab.= "<div id=\"uptabgroup\"><a title=\"last post\"><strong>last post</strong></a> &nbsp; <span class=\"stopic\"></span>\n";
		   
		   $print.= "<br class=\"clear-all\" />\n";
		   $query=mysql_db_query($this->dbname, "select * from _infoboardq  where _active='1' order by  _update desc  limit 0, ".$iscon["limit_lastpost"]);
		   while($result = @mysql_fetch_array($query)){
			      $data=1;
			      if($getfriendly){
					   $gettitle = $this->urlfriendly($result["_topic"]);
				  }else{
					   $gettitle="";
				  }
			      $href = "./".$iscon["rewrite"]."topic".$iscon["_s"].$result["_cat"].$iscon["_s"].$result["_page"].$iscon["_s"];
				  $linktopic = "<a title=\"".stripslashes($result["_topic"])."\"  href=\"".$href."1".$gettitle.$iscon["extmod"]."\"  target=\"".$iscon["target"]."\">\n";
				  
				  $print.= "<div id=\"uptopic\">\n";
				  $print.= "<ul>\n";
				  if($result["_reply"] > 0) $qim=1; else $qim=0;
				  $print.= "<li class=\"upicon\"><img src=\"./_img/knot".$qim.".gif\" alt=\"\" width=\"13\" height=\"13\" border=\"0\" /></li>\n";
				  $print.= "<li  class=\"uptop\">\n";
				  $print.= $linktopic.$this->cutword($result["_topic"], 200)."</a>\n";
				  $print.= "<span class=\"stopic\">";
				  $print.= " - ".$this->islevel($result["_anslevel"])."";
				  $print.= " - ";
				  $print.= $this->nickname($result["_anslevel"], stripslashes($result["_ansname"]));

				  $print.= " - [".date ("d/m/Y", strtotime($result["_update"]))."]\n";
				  $print.= " <img src=\"./_img/update.gif\" alt=\"\"  border=\"0\" /> ";
 
				  $print.= "</span>\n";
				  $print.= "</li>\n";

					   $print.= "</ul>\n";
					   $print.= "</div>\n";
					   $print.= "<br class=\"clear-all\" />\n";
		   }
		   if($data){
		      $output= $lasttab.$print;
		      $output.= "</div>";
			  $output.= "<div style=\"clear: both;\">&nbsp;</div>\n";
			  return $output;
		   }
	 }


	 function isby($by){
		  switch($by){
			  case"1";
			  return "order by  _page asc";
			  break;
			  case"2";
			  return "order by  _topic asc";
			  break;
			  case"3";
			  return "order by  _name asc";
			  break;
			  case"4";
			  return "order by  _page asc";
			  break;
			  default;
			  return "order by  _page desc";
		  }
	 }

	 function sidetopic(){
		   global $iscon;
		   $print="";
		   if(!$this->gid) return;
		   $iscon["rewrite"]=$this->txtmod();
		   $iscon["extmod"]=$this->extmod();
		   if(isset($iscon["friendly"])) $getfriendly = $iscon["friendly"]; else $getfriendly=false;

		   $start=0;
		   $query=mysql_db_query($this->dbname, "select * from _infoboardq  where _cat='".$this->gid."' ".$this->andfield." order by  _page desc  limit ".$start.", ".$iscon["righttopic"]."");
		   $print.= "<br class=\"clear-all\" />\n";
		   $print.= "<div id=\"righttopiccontent\">\n";
		   $print.= "<a title=\"".$this->gname."\" href=\"".$this->txtmod()."group".$iscon["_s"].$this->gid.$iscon["_s"]."0".$iscon["_s"]."1".$this->extmod()."\">";
		   $print.= $this->gname."</a></div>\n";
		   $print.= "<br class=\"clear-all\" />\n";
		   $print.= "<div id=\"righttopic\">\n";
		   $print.= "<div id=\"contopic\">\n";
		   $print.= "<ul>\n";

		   while($result = @mysql_fetch_array($query)){
				$href = $iscon["rewrite"]."topic".$iscon["_s"].$result["_cat"].$iscon["_s"].$result["_page"].$iscon["_s"];
				if($getfriendly){
					 $gettitle = $this->urlfriendly($result["_topic"]);
				}else{
					 $gettitle="";
				}
			    $print.= "<li>\n";
				$print.= "<a title=\"".stripslashes($result["_topic"])."\"  href=\"".$href."1".$iscon["extmod"].$gettitle."\" target=\"".$iscon["target"]."\">\n";
				$print.= $this->cutword($result["_topic"], $iscon["numright"])."</a>\n";
				$print.= "(".$result["_reply"].")\n";
				$print.= "<br />\n";
				$print.= "<div id=\"constopic\">".$result["_name"]." / ".date ("d/m/Y", strtotime($result["_time"]))."</div>\n";
				$print.= "</li>\n";
		   }
		   $print.= "</ul>\n";
		   $print.= "</div>\n";
		   $print.= "</div>\n";
		   return $print;
	 }

	 function styleborder($border){
		   return "border-top: #".$border." 1px solid; border-left: #".$border." 1px solid; border-right: #".$border." 1px solid; border-bottom: #".$border." 1px solid;";
	 }



	 function titlequestion($gid, $htm){
		   global $iscon;
		   $print="";
		   $query=mysql_db_query($this->dbname, "select _topic from _infoboardq  where _cat='".$gid."' and _page='".$htm."' ".$this->andfield."");
		   if($result = @mysql_fetch_array($query)){
				$this->qtopic = $result["_topic"];
				return stripslashes($this->qtopic);
		   }
	 }

	 function questiondetail($gid, $htm){
		   global $iscon;
		   $print="";
		   $iscon["rewrite"]=$this->txtmod();
		   $iscon["extmod"]=$this->extmod();
		   $this->gid = $gid;
		   $this->htm =$htm;

		   $showq = "";
		   if($this->pnext > 1){
			    $query=mysql_db_query($this->dbname, "select _cid, _page, _reply, _lock from _infoboardq  where _cat='".$gid."' and _page='".$htm."' ".$this->andfield."");
				if($result = @mysql_fetch_array($query)){
					 $this->linkmenu=true;
					 $this->qid = $result["_cid"];
					 $this->htm = $result["_page"];
					 $this->qreply = $result["_reply"];
					 $locktopic=$result["_lock"];
					 if($locktopic > 0){
						  $iscon["boardinfo"]=1;
					 }
				}
			    $print.= "<div id=\"topicquestion\">".stripslashes($this->qtopic)."</div>\n";
				$showq = true;
		   }else{
			     $this->idpage = $gid.$iscon["_s"].$htm.$iscon["_s"]."1";

		         $query=mysql_db_query($this->dbname, "select * from _infoboardq  where _cat='".$gid."' and _page='".$htm."' ".$this->andfield."");
				 if($result = @mysql_fetch_array($query)){
					     $this->linkmenu=true;
						 $this->qid = $result["_cid"];
						 $this->htm = $result["_page"];
						 $this->qreply = $result["_reply"];
						 $locktopic=$result["_lock"];
						 if($locktopic > 0){
							 $iscon["boardinfo"]=1;
						 }

						 $print.= "<div id=\"question\" style=\"".$this->styleborder($result["_border"])."\">\n";

						 if($iscon["idadmin"]){
							  if($result["_active"] == 0){
								  $print.= $this->topicproof("topic", $this->qid, $gid, $this->htm);
								  $this->linkmenu=false;
							  }
							  if($result["_activeimg"] == 2){
								  if($print.= $this->imgproof("topic", $this->qid, $result["_pic"], $result["_ext"], $result["_picformat"], $gid, $this->htm)){
									   $this->linkmenu=false;
								  }
							  }
						 }

						 $print.= $this->showimg("./data/pic/", $result["_pic"], $result["_ext"], $result["_picformat"], "", $result["_align"], $result["_activeimg"], $this->checkpic, "");

						 $print.= "<div id=\"topicquestion\">".stripslashes($result["_topic"])."</div>\n";
						 $print.= "<p>".stripslashes($result["_detail"])."</p>\n";
						 $print.= $this->getcode($this->qid, 1, $result["_code"]);

						 $print.= "<p>";
						 $print.= $this->isname(1, $result["_level"], $this->qid, $result["_userid"], $result["_name"]);
						$print.= $this->istime($result["_level"], $result["_ip"], $result["_time"], $result["_edit"]);
						 $print.= "</p>\n";
						 $print.= $this->showins("_qid='".$this->qid."'", 1);
						 $print.= $this->showlinkmenu($this->qid, 0, 1, $this->linkmenu);
						 $print.= "</div>";
						 $showq = true;
				 }
		  }

				 if($showq){
					  if($iscon["idadmin"]) $this->qreply = $this->hidereply($this->qreply, $gid);
					  if($this->qreply > 0){
						   $next = $this->pnext;
						   if($iscon["showreply"] > 0) { $totalpage=(int) ($this->qreply / $iscon["showreply"]); }
						   if(($this->qreply % $iscon["showreply"]) !=0 ) $totalpage+=1;
						   if($next) {
							   $start = $iscon["showreply"] * ($next - 1);
						   }else{
							   $next = 1; $start = 0;
						   }

						   $query2=mysql_db_query($this->dbname, "select * from _infoboarda  where _cat='".$gid."' ".$this->andfield." and _qid='".$this->qid."' order by  _cid asc  limit ".$start.", ".$iscon["showreply"]."");
						   $number = 1;
						   $no = 0;
						   if($start > 0) $no = $no+$start;

						   while($result2 = @mysql_fetch_array($query2)){
							    $this->linkmenu=true;
								$this->idpage = $gid.$iscon["_s"].$htm.$iscon["_s"].$next;

								$print.= "<div style=\"clear: both;\">&nbsp;</div>\n";
								$print.= "<a name=\"".$number."\" id=\"".$number."\"></a>\n";
								$print.= "<div id=\"answer\" style=\"".$this->styleborder($result2["_border"])."\">\n";
								$no++;
								$print.= "No. ".$no." [".$this->qid.".".$htm.".".$result2["_cid"]."]\n";
								
								if($iscon["idadmin"]){
									 if($result2["_active"] == 0){
										 $print.= $this->topicproof("ans", $result2["_cid"], $gid, $this->htm);
										 $this->linkmenu=false;
									 }
									 if($result2["_activeimg"] == 2){
										 if($print.= $this->imgproof("ans", $result2["_cid"], $result2["_pic"], $result2["_ext"], $result2["_picformat"],$gid, $this->htm)){
											  $this->linkmenu=false;
										 }
									 }
								}

								$print.= $this->showimg("./data/pic/", $result2["_pic"], $result2["_ext"], $result2["_picformat"], "", $result2["_align"], $result2["_activeimg"], $this->checkpic, "");

								$print.= "<br /><p>".stripslashes($result2["_detail"])."</p>\n";
								$print.= $this->getcode($result2["_cid"], 2, $result2["_code"]);

								$print.= "<p>";
								$print.= $this->isname(2, $result2["_level"], $result2["_cid"], $result2["_userid"], $result2["_name"]);
								$print.= $this->istime($result2["_level"], $result2["_ip"], $result2["_time"], $result2["_edit"]);

								$print.= "</p>\n";
								$print.= $this->showins("_aid='".$result2["_cid"]."'", 2);
								$print.= $this->showlinkmenu(0, $result2["_cid"], 2, $this->linkmenu);
								$print.= "</div>\n";
								$number++;
						   }
						   
						   if($this->qreply > $iscon["showreply"]){
							     $print.= "<div align=\"right\">";
								 $print.= "Page :   ";
								 for($i=1; $i <= $totalpage; $i++) {
									   if($i == $next) {
										   $print.= "&nbsp;<strong>".$i."</strong>&nbsp;";
									   }else{
										   $print.= "&nbsp;";
										   $print.= "<a href=\"".$iscon["rewrite"]."topic".$iscon["_s"].$gid.$iscon["_s"].$htm.$iscon["_s"].$i.$iscon["extmod"]."\">";
										   $print.= $i."</a>&nbsp;";
									   }
								 }
								 $print.= "</div>";
						   }
					  }
					  
					  $print.= "<div style=\"clear: both;\">&nbsp;</div>\n";
					  $print.= "<br class=\"clear-all\" />\n";  
					  $print.= $this->showlevel($this->gread, $this->qlevel, $this->alevel, $this->checkq, $this->checka, $this->checkpic, $this->uppic);
					  $print.= "<br class=\"clear-all\" />\n"; 


					  if($locktopic > 0){
						    $print.= "<img src=\"./_img/lock.gif\" border=\"0\" align=\"absmiddle\" /> ";
						    $print.= $iscon["lang"][148]; 
					  }
					  if($iscon["idadmin"]){
						   if($locktopic > 0){
								 $print.= " [ <a title=\"".$iscon["lang"][150]."\" href=\"./_req/actlock.php?cid=". $this->qid."&lock=0\">".$iscon["lang"][150]."</a> ] ";
						   }else{
								 $print.= "<br class=\"clear-all\" />\n"; 
								 $print.= "<img src=\"./_img/unlock.gif\" border=\"0\" align=\"absmiddle\" /> ";
								 $print.= " [ <a title=\"".$iscon["lang"][149]."\" href=\"./_req/actlock.php?cid=". $this->qid."&lock=1\">".$iscon["lang"][149]."</a> ] ";
								 $print.= "<br class=\"clear-all\" />\n"; 
								 $print.= "<br class=\"clear-all\" />\n"; 
						   }
					  }

					  if($iscon["boardinfo"] == 0){
						    if($this->checklevel($this->alevel)) $print.= "<div id=\"formanswer\"><u>".$iscon["lang"][142]."</u> : <span class=\"textblack\">".stripslashes($this->qtopic)."</span></div>\n";
					  }

						  $fieldupdate="
						  _read=_read+1
						  ";
						  $this->tbupdate("_infoboardq", $fieldupdate, "_cid", $this->qid);
						  return $print;

				 }
	 }


	 function showlinkmenu($qid, $aid, $target, $proof){
		   global $iscon;
		   if($iscon["boardinfo"] > 0) return;
		   $print="";
		   $print.= "<div id=\"subinfoboard\">\n";
		   $print.= "<ul>\n";
		   if($aid > 0){
			    if($proof){
					 $print.= "<li>\n";
					 $print.= "<a onclick=\"return rusure();\" title=\"".$iscon["lang"][24]."\" href=\"./_req/delete.php?action=delans&cid=".$aid."\">";
					 $print.= "<img src=\"./_img/delete.gif\" alt=\"".$iscon["lang"][24]."\"  border=\"0\" align=\"absmiddle\" /> ".$iscon["lang"][24]."</a>\n";
					 $print.= "</li>\n";
				}
		   }
		   if($this->checklevel($this->alevel)){
			     if($target == 1){
					   if($this->checkq < 1){
						     $print.= "<li><a href=\"".$iscon["rewrite"]."ins".$iscon["_s"].$this->idpage.$iscon["_s"].$qid.$iscon["_s"].$aid.$iscon["extmod"]."\">";
							 $print.= "[ ".$iscon["lang"][22]." ]</a></li>\n";
					   }
				 }elseif($target == 2){
					   if($this->checka < 1){
						     $print.= "<li><a href=\"".$iscon["rewrite"]."ins".$iscon["_s"].$this->idpage.$iscon["_s"].$qid.$iscon["_s"].$aid.$iscon["extmod"]."\">";
							 $print.= "[ ".$iscon["lang"][22]." ]</a></li>\n";
					   }
				 }

			     $print.= "<li><a href=\"".$iscon["rewrite"]."topic".$iscon["_s"].$this->idpage.$iscon["extmod"]."#reply\">[ ".$iscon["lang"][21]." ]</a></li>\n";
		   }
		   if($this->checklevel($this->qlevel)){
			     $print.= "<li><a href=\"".$iscon["rewrite"]."addnew".$iscon["_s"].$this->gid.$iscon["extmod"]."\">[ ".$iscon["lang"][2]." ]</a></li>\n";
			}
		    if($this->showreport($this->qlevel)) $print.= "<li><a href=\"".$iscon["rewrite"]."report".$iscon["_s"].$this->idpage.$iscon["extmod"]."\">[ ".$iscon["lang"][23]." ]</a></li>\n";
			$print.= "</ul>\n";
			$print.= "</div>\n";
			return $print;
	 }

	 function showins($field, $action){
		   global $iscon;
		   $print="";
		   $query=mysql_db_query($this->dbname, "select * from _infoboardi  where _cat='".$this->gid."' and ".$field." ".$this->andfield." and _target='".$action."' order by  _cid asc");
		   while($result = @mysql_fetch_array($query)){
				 $print.= "<div class=\"dotted\"></div>\n";
				 
				 if($iscon["idadmin"]){
					  if($result["_active"] == 0){
						  $print.= $this->topicproof("ins", $result["_cid"], $this->gid, $this->htm);
						  $this->linkmenu=false;
					  }
					  if($result["_activeimg"] == 2){
						  if($print.= $this->imgproof("ins", $result["_cid"], $result["_pic"], $result["_ext"], $result["_picformat"], $this->gid, $this->htm)){
							   $this->linkmenu=false;
						  }
					  }
				 }

				 $print.= $this->showimg("./data/pic/", $result["_pic"], $result["_ext"], $result["_picformat"], "", "", $result["_activeimg"], $this->checkpic, "");

				 $print.= "<p>".stripslashes($result["_detail"])."</p>\n";
				 $print.= $this->getcode($result["_cid"], 3, $result["_code"]);
				 $print.= "<p>";
				 $target = $result["_target"]+2;
				 $print.= $this->isname($target, $result["_level"], $result["_cid"], $result["_userid"], $result["_name"]);
				 $print.= $this->istime($result["_level"], $result["_ip"], $result["_time"], $result["_edit"]);

				 $print.= "</p>\n";
		   }
		   return $print;
	 }

	 function insertquestion($target, $idpage, $qid, $aid, $pnext){
		   global $iscon;
		   $print="";
		   $this->idpage = $idpage;
		   switch($target){
			   case"3";
		         $query=mysql_db_query($this->dbname, "select * from _infoboardq  where _cat='".$this->gid."' and _cid='".$qid."' ".$this->andfield."");
				 if($result = @mysql_fetch_array($query)){
						 $print.= "<div id=\"question\" style=\"".$this->styleborder($result["_border"])."\">\n";
						 $print.= "<div id=\"topicquestion\">".stripslashes($result["_topic"])."</div>\n";
						 $print.= "<p>".stripslashes($result["_detail"])."</p>\n";
						 $print.= $this->getcode($result["_cid"], 1, $result["_code"]);
						 $print.= "<p>";
						 $print.= $this->isname(1, $result["_level"], $result["_cid"], $result["_userid"], $result["_name"]);
						 $print.= $this->istime($result["_level"], $result["_ip"], $result["_time"], $result["_edit"]);
						 $print.= "</p>\n";
						 $print.= $this->showins("_qid='".$qid."'", 1);
						 $this->border = $result["_border"];
				 }
			   break;
			   case"4";
			     $print.= "<div id=\"topicquestion\">".stripslashes($this->qtopic)."</div>\n";
			     $query=mysql_db_query($this->dbname, "select * from _infoboarda  where _cat='".$this->gid."' ".$this->andfield." and _cid='".$aid."'");
				 if($result = @mysql_fetch_array($query)){
						$print.= "<div style=\"clear: both;\">&nbsp;</div>\n";
						$print.= "<div id=\"answer\" style=\"".$this->styleborder($result["_border"])."\">\n";

						$print.= "<p>".stripslashes($result["_detail"])."</p>\n";
						$print.= $this->getcode($result["_cid"], 2, $result["_code"]);
						$print.= "<p>";
						$print.= $this->isname(2, $result["_level"], $result["_cid"], $result["_userid"], $result["_name"]);
						$print.= $this->istime($result["_level"], $result["_ip"], $result["_time"], $result["_edit"]);
						$print.= "</p>\n";
						$print.= $this->showins("_aid='".$result["_cid"]."'", 2);
						$this->border = $result["_border"];
				 }
			   break;
			   default;
			   return;
		   }

		   $this->pnext = $pnext;

				$print.= "<br class=\"clear-all\" />\n"; 
				 $print.= $this->showlevel($this->gread, $this->qlevel, $this->alevel, $this->checkq, $this->checka, $this->checkpic, $this->uppic);
				 $print.= "<br class=\"clear-all\" />\n"; 

				$print.= "<div id=\"formanswer\"><u>".$iscon["lang"][143]."</u> : <span class=\"textblack\">".stripslashes($this->qtopic)."</span></div>\n";
				return $print;

	 }


	 function sideadmin($gid){
		 global $iscon;
		 if(!$iscon["idadmin"]) return;
		 $print="";
		 $print.= "<div id=\"righttopicadmincontent\">".$iscon["lang"][7]."</div>\n";

		 $print.= "<div id=\"righttopic\">\n";
		 $print.= "<div id=\"contopic\">\n";
		 $print.= "<ul>\n";


		 $print.= "<li><a href=\"".$this->txtmod()."config".$iscon["_s"].$gid.$this->extmod()."\" id=\"topuser1\">";
		 if($this->action == "config") $print.= "<span class=\"boldtopic\">".$iscon["lang"][92]."</span>";  else $print.=$iscon["lang"][92];
		 $print.= "</a></li>\n";
		 $print.= "<li><a href=\"".$this->txtmod()."egroup".$iscon["_s"].$gid.$this->extmod()."\" id=\"topuser1\">";
		 if($this->action == "egroup") $print.= "<span class=\"boldtopic\">".$iscon["lang"][62]."</span>";  else $print.=$iscon["lang"][62];
		 $print.= "</a></li>\n";
		 $print.= "<li><a href=\"".$this->txtmod()."slideshow".$iscon["_s"].$gid.$this->extmod()."\" id=\"topuser1\">";
		 if($this->action == "slideshow") $print.= "<span class=\"boldtopic\">".$iscon["lang"][156]."</span>";  else $print.= $iscon["lang"][156];
		 $print.= "</a></li>\n";
		 $print.= "<li><a href=\"".$this->txtmod()."topbanner".$iscon["_s"].$gid.$this->extmod()."\" id=\"topuser1\">";
		 if($this->action == "topbanner") $print.= "<span class=\"boldtopic\">".$iscon["lang"][146]."</span>"; else $print.=$iscon["lang"][146];
		 $print.= "</a></li>\n";
		 $print.= "<li><a href=\"".$this->txtmod()."banner".$iscon["_s"].$gid.$this->extmod()."\" id=\"topuser1\">";
		 if($this->action == "banner") $print.= "<span class=\"boldtopic\">".$iscon["lang"][17]."</span>"; else $print.=$iscon["lang"][17];
		 $print.= "</a></li>\n";
		 $print.= "<li><a href=\"".$this->txtmod()."icon".$iscon["_s"].$gid.$this->extmod()."\" id=\"topuser1\">";
		 if($this->action == "icon") $print.= "<span class=\"boldtopic\">".$iscon["lang"][26]."</span>"; else $print.=$iscon["lang"][26];
		 $print.= "</a></li>\n";

		 $print.= "<li><a href=\"".$this->txtmod()."proof".$iscon["_s"].$gid.$this->extmod()."\" id=\"topuser1\">";
		 if($this->action == "proof") $print.= "<span class=\"boldtopic\">".$iscon["lang"][122]."</span>"; else $print.=$iscon["lang"][122];
		 
		 if(file_exists("./data/unproof.dat")){
			 $read=file("./data/unproof.dat");
			 $print.= "</a> <span class=\"boldtopic\">(".count($read).")</span></li>\n";
		}else{
			 $print.= "</a></li>\n";
		}
		$print.= "<li><a href=\"".$this->txtmod()."pic".$iscon["_s"].$gid.$this->extmod()."\" id=\"topuser1\">";
		if($this->action == "pic") $print.= "<span class=\"boldtopic\">".$iscon["lang"][50]."</span>"; else $print.=$iscon["lang"][50];
		
		if(file_exists("./data/improof.dat")){
		     $read=file("./data/improof.dat");
			 $print.= "</a> <span class=\"boldtopic\">(".count($read).")</span></li>\n";
		}else{
			 $print.= "</a></li>\n";
		}

		$print.= "<li><a href=\"".$this->txtmod()."blockad".$iscon["_s"].$gid.$this->extmod()."\" id=\"topuser1\">";
		if($this->action == "blockad") $print.= "<span class=\"boldtopic\">".$iscon["lang"][155]."</span>"; else $print.= $iscon["lang"][155];
		$print.= "</a></li>\n";
		
		 $print.= "<li><a href=\"".$this->txtmod()."member".$iscon["_s"].$gid.$this->extmod()."\" id=\"topuser1\">";
		 if($this->action == "member") $print.= "<span class=\"boldtopic\">".$iscon["lang"][65]."</span>"; else $print.=$iscon["lang"][65];
		 $print.= "</a></li>\n";
		 $print.= "<li><a href=\"".$this->txtmod()."blockuser".$iscon["_s"].$gid.$this->extmod()."\" id=\"topuser1\">";
		 if($this->action == "blockuser") $print.= "<span class=\"boldtopic\">".$iscon["lang"][154]."</span>"; else $print.=$iscon["lang"][154];
		 $print.= "</a></li>\n";
		 $print.= "<li><a href=\"".$this->txtmod()."admin".$iscon["_s"].$gid.$this->extmod()."\" id=\"topuser1\">";
		 if($this->action == "admin") $print.= "<span class=\"boldtopic\">".$iscon["lang"][64]."</span>"; else $print.=$iscon["lang"][64];
		 $print.= "</a></li>\n";
		 if($iscon["idadmin"])  $print.= "<li><a href=\"./_req/logout.php\" id=\"topuser1\">".$iscon["lang"][6]."</a></li>\n";

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


	 function sideuser($gid){
		 global $iscon;
		 if(!$iscon["user"]) return;
		 $print="";
		 $print.= "<br class=\"clear-all\" />\n";
		 $print.= "<div id=\"righttopiccontent\">".$iscon["lang"][15]." : ".$iscon["user"]."</div>\n";

		 $print.= "<div id=\"righttopic\">\n";
		 $print.= "<div id=\"contopic\">\n";
		 $print.= "<ul>\n";

		 $print.= "<li><a href=\"".$this->txtmod()."user".$iscon["_s"].$gid.$this->extmod()."\" id=\"topuser1\">".$iscon["lang"][7]." : ".$iscon["user"]."</a></li>\n";
		 $print.= "<li><a href=\"./_req/logout.php\" id=\"topuser1\">".$iscon["lang"][6]."</a></li>\n";

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


	 function sidegroup(){
		   global $iscon;
		   $print="";
		   if($data = $this->quegroup()){
			    if(count($data[0]) ==1) return;
				$print.= "<div id=\"righttopiccontent\">".$iscon["lang"][144]."</div>\n";
				$print.= "<br class=\"clear-all\" />\n";
			    $print.= "<div id=\"righttopic\">\n";
				$print.= "<div id=\"contopic\">\n";
				$print.= "<ul>\n";
				for($i =0; $i<count($data[0]); $i++){
					  $idcat=$data[0][$i];
					  $gname=$data[1][$i];
					  $gdetail=$data[2][$i];
					  $print.= "<li>\n";
					  $print.= "<a title=\"".$gname."\" href=\"".$this->txtmod()."group".$iscon["_s"].$idcat.$iscon["_s"]."0".$iscon["_s"]."1".$this->extmod()."\">";
					  $print.= $gname."</a>\n";
					  $print.= "<br />\n";
					  $print.= "<div id=\"constopic\">".$gdetail."</div>\n";
					  $print.= "</li>\n";
				}
				$print.= "</ul>\n";
				$print.= "</div>\n";
				$print.= "</div>\n";
		   }
		   return $print;
	 }
	 
	 function formreport($idpage){
		   global $iscon;
		   $print="";
		   $url = $iscon["fullpath"].$this->txtmod()."topic".$idpage.$this->extmod();
		   if(!$iscon["user"]){
			     $print.= "<div class=\"textform\">".$iscon["lang"][39]."</div>\n";
		   }else{
			     $print.= "<form name=\"freport\" method=\"post\">";
				 $print.= "<div class=\"textform\" id=\"_report\">".$iscon["lang"][93]."</div> URL : ".$url."\n";
				 $print.= "<label>\n";
				 $print.= "<textarea name=\"report\" cols=\"78\" rows=\"10\"></textarea>\n";
				 $print.= "</label>\n";
				 $print.= "<div class=\"textform\">".$iscon["lang"][9]." <strong>".$iscon["user"]."</strong></div>\n";
				 $print.= "<label>\n";
				 $print.= "<br class=\"clear-all\" />\n";
				 $print.= "<br class=\"clear-all\" />\n";
				 $print.= "<p><input type=\"submit\" name=\"submit\" id=\"forminfo\" value=\"Submit\" onclick=\"return checkreport();\" /> \n";
				 $print.= "<input type=\"button\" value=\"Cancel\" onclick=\"javascript:history.back();\" /></p>\n";
				 $print.= "</label>\n";
				 $print.= "<input type=\"hidden\" name=\"url\" value=\"".$url."\" />\n";
				 $print.= "</form>";
		   }
		   return $print;
     }

	 function formprofile(){
		   global $iscon;
		   $print="";
		   if($this->cid > 0){
			    $query=mysql_db_query($this->dbname, "select * from _user where _cid='".$this->cid."'");
		   }else{
			    if(!$iscon["user"]) return "<div class=\"textform\">".$iscon["lang"][39]."</div>\n";
			    $query=mysql_db_query($this->dbname, "select * from _user where _cid='".$iscon["iduser"]."'");
		   } 
		   if($result = @mysql_fetch_array($query)){
			     $name = $result["_name"];
				 $mail = $result["_mail"];
				 $website = stripslashes($result["_website"]);
			}else{
				return;
			}
			$ext="";
			$point=0;
			if($read = $this->isread("./data/user/banner/".$name.".ext.dat")){
				 $ex = explode("%", $read);
				 $ext = $ex[0];
				 $point=$ex[1];
			}

			$banner = $this->isread("./data/user/banner/".$name.".dat");

			if($nickname = $this->isread("./data/user/".$name.".txt")){
				 $titleuser = $nickname;
			}else{
				 $titleuser = $name;
			}

			if(!$this->cid > 0) $print.= "<form name=\"fuserprofile\" action=\"./_req/user.php\" method=\"post\" enctype=\"multipart/form-data\">";
			$imguser="<br /><img src=\"./_img/icon/user.png\" border=\"0\" /><br />";

				 if($ext){
					  if(file_exists("./data/user/".$name.".".$ext)) $imguser="<br /><img src=\"./data/user/".$name.".".$ext."\" border=\"0\" /><br />";
				 }
				 $print.=$imguser;
				 $print.= "<div class=\"textform\">".$iscon["lang"][15]."  : ".$titleuser."  (".$point." ".$iscon["lang"][18].")</div>\n";
				 $print.= "<br class=\"clear-all\" />\n";

			if(!$this->cid > 0) {
				 $print.= "<div class=\"textform\">Title user : </div>\n";
				 $print.= "<label>\n";
				 $print.= "<input name=\"nickname\" type=\"text\" size=\"20\" value=\"".$titleuser."\" maxlength=\"".$iscon["title_user"]."\" class=\"input\" />\n";
				 $print.= "</label>\n";


				 $print.= "<div class=\"textform\">".$iscon["lang"][10]." : </div>\n";
				 $print.= "<label>\n";
				 $print.= "<input name=\"newpass\" type=\"text\" size=\"20\" value=\"\" class=\"input\" />\n";
				 $print.= "</label>\n";

				 $print.= "<div class=\"textform\">".$iscon["lang"][12]." : </div>\n";
				 $print.= "<label>\n";
				 $print.= "<input name=\"mail\" type=\"text\" size=\"20\" value=\"".$mail."\" class=\"input\" />\n";
				 if($iscon["lockuser"] > 0) $print.= " <font color=\"#0000FF\">".$iscon["lang"][145]."</font>\n";

				 $print.= "</label>\n";

				 $print.= "<div class=\"textform\">".$iscon["lang"][16]." : </div>\n";
				 $print.= "<label>\n";
				 $print.= "<input name=\"website\" type=\"text\" size=\"40\" value=\"".$website."\" class=\"input\" />\n";
				 $print.= "</label>\n";

				 $print.= "<div class=\"textform\">".$iscon["lang"][17]." (code): </div>\n";
				 $print.= "<label>\n";
				 $print.= "<textarea name=\"banner\" cols=\"50\" rows=\"5\">".$banner."</textarea>\n";
				 $print.= "</label>\n";
				 $print.= "<br class=\"clear-all\" />\n";
				 $c=0;
				 for($i=1; $i<=70; $i++){
					   if(file_exists("./_img/icon/".$i.".jpg")){
						    $c++;
						    $print.= " <input name=\"icon\" type=\"radio\" value=\"".$i."\" /> <img src=\"./_img/icon/".$i.".jpg\" border=\"0\" /> \n";
							if($c == 6){
								 $print.= "<br />\n";
								 $c=0;
							}
					   }
				 }
				 $print.= " <input name=\"icon\" type=\"radio\" value=\"\" checked=\"checked\" /> ".$iscon["lang"][19]."\n";

				 $print.= "<div class=\"textform\">".$iscon["lang"][20]." : </div>\n";
				 $print.= "<label>\n";
				 $print.= "<input type=\"file\" name=\"image\" size=\"20\" class=\"input\" />\n";
				 $print.= "</label>\n";
			}else{
				 $print.= "<div class=\"textform\">".$iscon["lang"][12]." : ".eregi_replace("@" ," [ at ] " ,$mail)."</div>\n";
				 $print.= "<div class=\"textform\">".$iscon["lang"][16]." : ".$website."</div>\n";
				 $print.= "<div class=\"textform\">".$banner."</div>\n";
			}
				 $print.= "<br class=\"clear-all\" />\n";
				 $print.= "<br class=\"clear-all\" />\n";
			if(!$this->cid > 0) {
				 $print.= "<p><input type=\"submit\" name=\"submit\" value=\"SAVE\" />\n";
				 $print.= " <input type=\"button\" value=\"Cancel\" onclick=\"javascript:history.back();\" /></p>\n";
				 $print.= "<input type=\"hidden\" name=\"ext\" value=\"".$ext."\" />\n";
				 $print.= "</form>";
			}
				 return $print;
     }

	 function egroupform($idadmin){
		   global $iscon;
		   if(!$iscon["idadmin"]) return $this->formadmin();
		   $print="";
		   $userlevel = array($iscon["lang"][40], $iscon["lang"][39], $iscon["lang"][38]);
		   $yesno = array($iscon["lang"][59], $iscon["lang"][58]);
		   $boardformat = array($iscon["lang"][54], $iscon["lang"][55]);
		   $showlevelpic = array($iscon["lang"][40], $iscon["lang"][39], $iscon["lang"][50]);

		   $edit="";
		   
		   $print.= "<form name=\"setting\" action=\"./_req/egroup.php\" method=\"post\">";

		   if($data = $this->quegroup()){
			    $edit=true;
			    $print.= "<br class=\"clear-all\" />\n";
			    $print.= "<div id=\"tabgroup\"><strong>".$iscon["lang"][62]."</strong></div>\n";
			    $print.= "<br class=\"clear-all\" />\n";
			     for($i =0; $i<count($data[0]); $i++){
					  $idcat=$data[0][$i];
					  $gname=$data[1][$i];
					  $gdetail=$data[2][$i];
					  $qlevel=$data[3][$i];
					  $alevel=$data[4][$i];
					  $format=$data[5][$i];
					  $limit=$data[6][$i];
					  $readlevel=$data[7][$i];
					  $checkq=$data[8][$i];
					  $checka=$data[9][$i]; 
					  $checkpic=$data[10][$i]; 
					  $uppic=$data[11][$i]; 

					  $print.= "<div class=\"textform\">\n";
					  $print.= $iscon["lang"][60]." <input type=\"text\" name=\"gname[".$i ."]\" size=\"15\" value=\"".$gname."\" class=\"input\" />\n";
					  $print.= "&nbsp; &nbsp; ".$iscon["lang"][61]." <input type=\"text\" name=\"gdetail[".$i ."]\" size=\"40\" value=\"".$gdetail."\" class=\"input\" />\n";
					  $print.= "&nbsp; &nbsp; ".$iscon["lang"][56]." <input type=\"text\" name=\"limit[".$i ."]\" size=\"3\" value=\"".$limit."\" class=\"input\" /> ".$iscon["lang"][57]." \n";


					  $print.= "<div style=\"clear: both;\">&nbsp;</div>\n";
					  $print.= "<div id=\"col_l\">\n";

					  $print.= $iscon["lang"][44]." ";
					  $print.= "<select name=\"qlevel[".$i ."]\" class=\"input\">\n";
					  for($a=0; $a<=2; $a++){
						   if($qlevel == $a){
							    $print.= "<option value=\"".$a."\" selected=\"selected\">";
						   }else{
							    $print.= "<option value=\"".$a."\">";
						   }
						   $print.= $userlevel[$a]."</option>\n";
					  }
					  $print.= "</select>\n";

					  $print.= "&nbsp; &nbsp; ".$iscon["lang"][45]." ";
					  $print.= "<select name=\"alevel[".$i ."]\" class=\"input\">\n";
					  for($a=0; $a<=2; $a++){
						   if($alevel == $a){
							    $print.= "<option value=\"".$a."\" selected=\"selected\">";
						   }else{
							    $print.= "<option value=\"".$a."\">";
						   }
						   $print.= $userlevel[$a]."</option>\n";
					  }
					  $print.= "</select>\n";

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


					  $print.= $iscon["lang"][43]." ";
					  for($a=0; $a<=1; $a++){
						    if($readlevel == $a){
								 $print.= "<input name=\"readlevel[".$i ."]\" type=\"radio\" value=\"".$a."\" checked=\"checked\" /> ";
							}else{
								 $print.= "<input name=\"readlevel[".$i ."]\" type=\"radio\" value=\"".$a."\" /> ";
							}
							$print.= $userlevel[$a]." \n";
					  }

					  $print.= "</div>\n";
					  $print.= "<div id=\"col_r\">\n";

					  $print.= $iscon["lang"][46]." ";
					  $print.= "<select name=\"checkq[".$i ."]\" class=\"input\">\n";
					  for($a=0; $a<=1; $a++){
						   if($checkq == $a){
							    $print.= "<option value=\"".$a."\" selected=\"selected\">";
						   }else{
							    $print.= "<option value=\"".$a."\">";
						   }
						   $print.= $yesno[$a]."</option>\n";
					  }
					  $print.= "</select>\n";

					  $print.= "&nbsp; &nbsp; ".$iscon["lang"][47]." ";
					  $print.= "<select name=\"checka[".$i ."]\" class=\"input\">\n";
					  for($a=0; $a<=1; $a++){
						   if($checka == $a){
							    $print.= "<option value=\"".$a."\" selected=\"selected\">";
						   }else{
							    $print.= "<option value=\"".$a."\">";
						   }
						   $print.= $yesno[$a]."</option>\n";
					  }
					  $print.= "</select>\n";

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

					  $print.= $iscon["lang"][28]." ";
					  for($a=0; $a<=1; $a++){
						    if($format == $a){
								 $print.= "<input name=\"format[".$i ."]\" type=\"radio\" value=\"".$a."\" checked=\"checked\" /> ";
							}else{
								 $print.= "<input name=\"format[".$i ."]\" type=\"radio\" value=\"".$a."\" /> ";
							}
							$print.= $boardformat[$a]." \n";
					  }

					  $print.= "</div>\n";	  
					  $print.= "<div style=\"clear: both;\">&nbsp;</div>\n";


					  $print.= $iscon["lang"][48]." ";
					  for($a=0; $a<=2; $a++){
						    if($checkpic == $a){
								 $print.= "<input name=\"checkpic[".$i ."]\" type=\"radio\" value=\"".$a."\" checked=\"checked\" /> ";
							}else{
								 $print.= "<input name=\"checkpic[".$i ."]\" type=\"radio\" value=\"".$a."\" /> ";
							}
							$print.= $showlevelpic[$a]." \n";
					  }


					  $print.= " &nbsp; &nbsp; &nbsp; ".$iscon["lang"][49]."  ";
					  $print.= "<select name=\"uppic[".$i ."]\" class=\"input\">\n";
					  for($a=0; $a<=2; $a++){
						   if($uppic == $a){
							    $print.= "<option value=\"".$a."\" selected=\"selected\">";
						   }else{
							    $print.= "<option value=\"".$a."\">";
						   }
						   $print.= $userlevel[$a]."</option>\n";
					  }
					  $print.= "</select>\n";




					  $print.= "<br class=\"clear-all\" />\n";
					  $print.= "<br class=\"clear-all\" />\n";
					  $print.= "<a onclick=\"return rusure();\" title=\"".$iscon["lang"][25]."\" href=\"./_req/delete.php?action=delgroup&idcat=".$idcat."\">";
					  $print.= "<img src=\"./_img/delete.gif\" alt=\"".$iscon["lang"][25]."\"  border=\"0\" align=\"absmiddle\" /> ".$iscon["lang"][25]." (".$gname.")</a>\n";
					  $print.= "</div>\n";
					  $print.= "<br class=\"clear-all\" />\n";
					  $print.= "<hr size=\"1\" />\n";
				 }
		   }


		   $print.= "<br class=\"clear-all\" />\n";
		   $print.= "<br class=\"clear-all\" />\n";
		   $print.= "<br class=\"clear-all\" />\n";
		   $print.= "<div id=\"tabgroup\"><strong>".$iscon["lang"][63]."</strong></div>\n";
		   $print.= "<br class=\"clear-all\" />\n";
		   
		   $print.= "<div class=\"textform\">\n";
		   $print.= $iscon["lang"][60]." <input type=\"text\" name=\"_gname\" size=\"15\"  class=\"input\" />\n";
		   $print.= "&nbsp; &nbsp; ".$iscon["lang"][61]." <input type=\"text\" name=\"_gdetail\" size=\"40\" class=\"input\" />\n";
		   $print.= "&nbsp; &nbsp; ".$iscon["lang"][56]." <input type=\"text\" name=\"_limit\" size=\"3\" value=\"200\" class=\"input\" /> ".$iscon["lang"][57]." \n";
		   
		   $print.= "<div style=\"clear: both;\">&nbsp;</div>\n";
		   $print.= "<div id=\"col_l\">\n";
		   
		   $print.= $iscon["lang"][44]." ";
		   $print.= "<select name=\"_qlevel\" class=\"input\">\n";
		   for($a=0; $a<=2; $a++) $print.= "<option value=\"".$a."\">".$userlevel[$a]."</option>\n";
		   $print.= "</select>\n";
		   
		   $print.= "&nbsp; &nbsp; ".$iscon["lang"][45]." ";
		   $print.= "<select name=\"_alevel\" class=\"input\">\n";
		   for($a=0; $a<=2; $a++) $print.= "<option value=\"".$a."\">".$userlevel[$a]."</option>\n";
		   $print.= "</select>\n";
		   
		   $print.= "<br class=\"clear-all\" />\n";
		   $print.= "<br class=\"clear-all\" />\n";
		   
		   $print.= $iscon["lang"][43]." ";
		   for($a=0; $a<=1; $a++){
			   if($a == 0){
				    $print.= "<input name=\"_readlevel\" type=\"radio\" value=\"".$a."\" checked=\"checked\" /> ";
				}else{
					$print.= "<input name=\"_readlevel\" type=\"radio\" value=\"".$a."\" /> ";
				}
				$print.= $userlevel[$a]." \n";
			}
			
			$print.= "</div>\n";
			$print.= "<div id=\"col_r\">\n";
			$print.= $iscon["lang"][46]." ";
			$print.= "<select name=\"_checkq\" class=\"input\">\n";
			for($a=0; $a<=1; $a++) $print.= "<option value=\"".$a."\">".$yesno[$a]."</option>\n";
			$print.= "</select>\n";
			
			$print.= "&nbsp; &nbsp; ".$iscon["lang"][47]." ";
			$print.= "<select name=\"_checka\" class=\"input\">\n";
			for($a=0; $a<=1; $a++) $print.= "<option value=\"".$a."\">".$yesno[$a]."</option>\n";
			$print.= "</select>\n";
			
			$print.= "<br class=\"clear-all\" />\n";
			$print.= "<br class=\"clear-all\" />\n";
			
			$print.= $iscon["lang"][28]." ";
			for($a=0; $a<=1; $a++){
				if($a == 0){
					 $print.= "<input name=\"_format\" type=\"radio\" value=\"".$a."\" checked=\"checked\" /> ";
				}else{
					$print.= "<input name=\"_format\" type=\"radio\" value=\"".$a."\" /> ";
				}
				$print.= $boardformat[$a]." \n";
			}
			
			$print.= "</div>\n";
			$print.= "<div style=\"clear: both;\">&nbsp;</div>\n";

			$print.= $iscon["lang"][48]." ";
			for($a=0; $a<=2; $a++){
				  if($a == 0){
					    $print.= "<input name=\"_checkpic\" type=\"radio\" value=\"".$a."\" checked=\"checked\" /> ";
				   }else{
					    $print.= "<input name=\"_checkpic\" type=\"radio\" value=\"".$a."\" /> ";
				   }
				   $print.= $showlevelpic[$a]." \n";
			}
			
			$print.= " &nbsp; &nbsp; &nbsp; ".$iscon["lang"][49]."  ";
			$print.= "<select name=\"_uppic\" class=\"input\">\n";
			for($a=0; $a<=2; $a++){
				   if($a == 0){
					    $print.= "<option value=\"".$a."\" selected=\"selected\">";
				   }else{
					    $print.= "<option value=\"".$a."\">";
				   }
				   $print.= $userlevel[$a]."</option>\n";
			}
			$print.= "</select>\n";

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

			if(!$idadmin) $disabled = " disabled=\"disabled\" "; else $disabled="";
			
			$print.= "<p><input type=\"submit\" name=\"submit\" value=\"Submit\" ".$disabled." /></p>\n";
			if($edit) $print.= "<input type=\"hidden\" name=\"edit\" value=\"true\" />\n";
			$print.= "</form>";
			$print.= "<br class=\"clear-all\" />\n";
			return $print;
	 }



	 function listuser(){
		   global $iscon;
		   if(!$iscon["idadmin"]) return $this->formadmin();
		   $print="";
		   $showtopic = 20;
		   $line=20;
		   
		   $iscon["rewrite"]=$this->txtmod();
		   $iscon["extmod"]=$this->extmod();
		   $print.= "<div id=\"tabgroup\"><strong>".$iscon["lang"][65]."</strong></div>\n";
		   $print.= "<br class=\"clear-all\" />\n";


			      $query=mysql_db_query($this->dbname, "select _cid from _user");
			      $totalrecord=mysql_num_rows($query);
			      if($totalrecord == 0) return $this->nodata($line);

			     if($showtopic > 0) { $totalpage=(int) ($totalrecord / $showtopic); }
			     if(($totalrecord % $showtopic) !=0 ) $totalpage+=1;
			     if($this->pnext) {
					  $start = $showtopic  * ($this->pnext - 1);
			     }else{
					  $this->pnext = 1; $start = 0;
			    }
			    $nextid = $this->pnext+1;
			    $previousid = $this->pnext -1;
				$query=mysql_db_query($this->dbname, "select * from _user  order by  _cid desc  limit ".$start.", ".$showtopic."");

				while($result = @mysql_fetch_array($query)){
					  if($result["_active"] > 0){
						   $uactive = " <font color=\"#00FF00\">Active</font>";
					  }else{
						   $uactive = " <em>(None Active)</em>";
					  }
					  if($this->fieldselect("_block", "_mail", "_mail", $result["_mail"])){
						   $block=1;
					  }else{
						   $block="";
					  }

					   $print.= "<div id=\"topiclist\">\n";
					   $print.= "<ul>\n";
					   $print.= "<li  class=\"topic\">";
					   $print.= "<a onclick=\"return rusure();\" title=\"".$iscon["lang"][24]."\" href=\"./_req/delete.php?action=deluser&cid=".$result["_cid"]."&n=".$result["_name"]."&ext=".$result["_ext"]."\">";
					   $print.= "<img src=\"./_img/delete.gif\" alt=\"".$iscon["lang"][24]."\"  border=\"0\" align=\"absmiddle\" /></a> ".$result["_name"];
					   $print.= " - ".$uactive."</li>\n";

					   $print.= "<li class=\"posted\">";
					   if($block){
						    $print.= " <font color=\"#FF0000\"><em>Block User</em></font>";
					   }else{
						    if($result["_active"] > 0){
								 $print.= "<a  href=\"./_req/ublock.php?action=block&cid=".$result["_cid"]."&mail=".$result["_mail"]."\">";
								 $print.= "<font color=\"#FF0000\"><em>Click for Block User</em></font></a>\n";
							}else{
								 $print.= "<a  href=\"./_req/uactive.php?cid=".$result["_cid"]."&a=1\"><em>Click for Active</em></a>\n";
							}
					   }
					   $print.= "</li>\n";
					   $print.= "<li class=\"modified\">".$result["_mail"]."</li>\n";
					   $print.= "</ul>\n";
					   $print.= "</div>\n";
					   $print.= "<br class=\"clear-all\" />\n";
				}

				if($totalrecord > $showtopic){
					   $print.= "<br class=\"clear-all\" />\n";
					   $print.= "<div align=\"center\">";
					  for($i=1; $i <= $totalpage; $i++) {
						    if($i == $this->pnext) {
								 $print.="".$i."\n";
							}else{
								 $print.="<a href=\"".$iscon["rewrite"]."member".$iscon["_s"]."1".$iscon["_s"]."0".$iscon["_s"].$i.$iscon["extmod"]."\">".$i."</a>\n";
							}
					  }
					 $print.= "</div>";
			  }
			  $print.= "<br class=\"clear-all\" />\n";

			  return $print;
	 }


	 function listblockuser(){
		   global $iscon;
		   if(!$iscon["idadmin"]) return $this->formadmin();
		   $print="";
		   $showtopic = 20;
		   
		   $iscon["rewrite"]=$this->txtmod();
		   $iscon["extmod"]=$this->extmod();
		   $print.= "<div id=\"tabgroup\"><strong>".$iscon["lang"][154]."</strong></div>\n";
		   $print.= "<br class=\"clear-all\" />\n";


				$query=mysql_db_query($this->dbname, "select * from _block  order by  _cid desc");

				while($result = @mysql_fetch_array($query)){
					   $name = $this->fieldselect("_user", "_name", "_mail", $result["_mail"]);
					   $print.= "<div id=\"topiclist\">\n";
					   $print.= "<ul>\n";
					   $print.= "<li  class=\"topic\">";
					   $print.= "<a onclick=\"return rusure();\" title=\"".$iscon["lang"][24]."\" href=\"./_req/ublock.php?action=delblock&mail=".$result["_mail"]."\">";
					   $print.= "<img src=\"./_img/delete.gif\" alt=\"".$iscon["lang"][24]."\"  border=\"0\" align=\"absmiddle\" /></a> ";
					   $print.= " User :  ".$name." (".$result["_mail"].") </li>\n";
					   
					   $print.= "<li class=\"posted\"><a  href=\"./_req/ublock.php?action=unblock&n=".$name."&mail=".$result["_mail"]."\">";
					   $print.= "<em>Click for UnBlock</em></a></li>\n";

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

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

			  return $print;
	 }


	 function listadmin(){
		   global $iscon;
		   $line=20;
		   if(!$iscon["idadmin"]) return $this->formadmin();
		   $print="";
		   $showtopic = 20;
		   
		   $iscon["rewrite"]=$this->txtmod();
		   $iscon["extmod"]=$this->extmod();
		   $print.= "<div id=\"tabgroup\"><strong>".$iscon["lang"][64]."</strong></div>\n";
		   $print.= "<br class=\"clear-all\" />\n";


			      $query=mysql_db_query($this->dbname, "select _cid from _admin");
			      $totalrecord=mysql_num_rows($query);
			      if($totalrecord == 0) return $this->nodata($line);

			     if($showtopic > 0) { $totalpage=(int) ($totalrecord / $showtopic); }
			     if(($totalrecord % $showtopic) !=0 ) $totalpage+=1;
			     if($this->pnext) {
					  $start = $showtopic  * ($this->pnext - 1);
			     }else{
					  $this->pnext = 1; $start = 0;
			    }
			    $nextid = $this->pnext+1;
			    $previousid = $this->pnext -1;
				$query=mysql_db_query($this->dbname, "select * from _admin  order by  _cid desc  limit ".$start.", ".$showtopic."");

				while($result = @mysql_fetch_array($query)){
					   $print.= "<div id=\"topiclist\">\n";
					   $print.= "<ul>\n";
					   $print.= "<li  class=\"topic\">";
					   if($iscon["idadmin"] != $result["_cid"]){
						    $print.= "<a onclick=\"return rusure();\" title=\"".$iscon["lang"][24]."\" href=\"./_req/delete.php?action=deladmin&cid=".$result["_cid"]."\">";
							$print.= "<img src=\"./_img/delete.gif\" alt=\"".$iscon["lang"][24]."\"  border=\"0\" align=\"absmiddle\" /></a> ";
					   }
					   $print.= $result["_name"]."</li>\n";
					   $print.= "<li class=\"modified\">".$result["_mail"]."</li>\n";
					   $print.= "</ul>\n";
					   $print.= "</div>\n";
					   $print.= "<br class=\"clear-all\" />\n";
				}


				if($totalrecord > $showtopic){
					   $print.= "<br class=\"clear-all\" />\n";
					   $print.= "<div align=\"center\">";
					  for($i=1; $i <= $totalpage; $i++) {
						    if($i == $this->pnext) {
								 $print.="".$i."\n";
							}else{
								 $print.="<a href=\"".$iscon["rewrite"]."admin".$iscon["_s"]."1".$iscon["_s"]."0".$iscon["_s"].$i.$iscon["extmod"]."\">".$i."</a>\n";
							}
					  }
					 $print.= "</div>";
			  }
			  $print.= "<br class=\"clear-all\" />\n";
			  $print.= "<br class=\"clear-all\" />\n";
			  $print.= "<br class=\"clear-all\" />\n";

			  $print.= "<div id=\"col_l\">\n";
			  
			  $print.= "<form method=\"post\" action=\"./_req/sadmin.php\" enctype=\"multipart/form-data\">\n";
			  $print.= "<div  class=\"textform\"><strong>NEW ADMIN</strong></div>\n";
			  $print.= "<label>\n";
			  $print.= "<input name=\"_name\" type=\"text\" size=\"20\" class=\"input\" />\n";
			  $print.= "</label>\n";
			  
			  $print.= "<div  class=\"textform\">Password</div>\n";
			  $print.= "<label>\n";
			  $print.= "<input name=\"_pass\" type=\"text\" size=\"20\" class=\"input\" />\n";
			  $print.= "</label>\n";
			  
			  $print.= "<div  class=\"textform\">Email</div>\n";
			  $print.= "<label>\n";
			  $print.= "<input name=\"_mail\" type=\"text\" size=\"20\" class=\"input\" />\n";
			  $print.= "</label>\n";

			  $print.= "<br class=\"clear-all\" />\n";
			  $print.= "<label>\n<input name=\"image\" type=\"file\" id=\"image\" size=\"15\" class=\"input\" /></label>\n\n";
			  $print.= "<br class=\"clear-all\" />\n";

			  $print.= "<p><input type=\"submit\" name=\"submit\" value=\"NEW ADMIN\" /></p>\n";
			  $print.= "</form>\n";

			  $print.= "</div>\n";
			  $print.= "<div id=\"col_r\">\n";

			  $print.= "<form method=\"post\" action=\"./_req/sadmin.php\" enctype=\"multipart/form-data\">\n";
			  $print.= "<div  class=\"textform\"><strong>EDIT ADMIN</strong></div>\n";
			  $print.= "<label>\n";
			  $print.= "<input name=\"_name\" type=\"text\" size=\"20\" value=\"".$iscon["admin"]."\" class=\"input\" />\n";
			  $print.= "</label>\n";
			  
			  $print.= "<div  class=\"textform\">Password</div>\n";
			  $print.= "<label>\n";
			  $print.= "<input name=\"_pass\" type=\"text\" size=\"20\" value=\"\" class=\"input\" />\n";
			  $print.= "</label>\n";
			  
			  $print.= "<div  class=\"textform\">Email</div>\n";
			  $print.= "<label>\n";
			  $print.= "<input name=\"_mail\" type=\"text\" size=\"20\" value=\"".$iscon["mailadmin"]."\" class=\"input\" />\n";
			  $print.= "</label>\n";

			  $ext = $this->isread("./data/admin/".$iscon["admin"].".ext.dat");
			  if($ext){
					  if(file_exists("./data/admin/".$iscon["admin"].".".$ext)) $print.= "<br /><img src=\"./data/admin/".$iscon["admin"].".".$ext."\" border=\"0\" /><br />";
			  }

			  $print.= "<br class=\"clear-all\" />\n";
			  $print.= "<label>\n<input name=\"image\" type=\"file\" id=\"image\" size=\"15\" class=\"input\" /></label>\n\n";
			  $print.= "<br class=\"clear-all\" />\n";

			  $print.= "<input type=\"hidden\" name=\"ext\" value=\"".$ext."\" />\n";
			  $print.= "<p><input type=\"submit\" name=\"submit\" value=\"EDIT ADMIN\" /></p>\n";
			  $print.= "</form>\n";


			  $print.= "</div>\n";

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

			  return $print;
	 }

	 function formadmin(){
		   global $iscon;
				$print="";
				$print.= "<br class=\"clear-all\" />\n";
				$print.= "<div id=\"tabgroup\"><strong>".$iscon["lang"][91]."</strong></div>\n";
				$print.= "<br class=\"clear-all\" />\n";
				$print.= "<form name=\"admin\" action=\"./_req/sadmin.php\" method=\"post\">";
				$print.= "<div  class=\"textform\">".$iscon["lang"][9]."</div>\n";
				$print.= "<label>\n";
				$print.= "<input name=\"_name\" type=\"text\" size=\"20\" class=\"input\" />\n";
				$print.= "</label>\n";
				$print.= "<div  class=\"textform\">".$iscon["lang"][10]."</div>\n";
				$print.= "<label>\n";
				$print.= "<input name=\"_pass\" type=\"password\" size=\"20\" class=\"input\" />\n";
				$print.= "</label>\n";
				$print.= "<br class=\"clear-all\" />\n";
				$print.= "<p><input type=\"submit\" name=\"submit\" value=\"LOGIN\" /></p>\n";
				$print.= "</form>\n";
				return $print;
	 }

	 function hidereply($id, $cat){
		   $path="./data/unproof.dat";
		   if(file_exists($path)){
			    $read=file($path);
				for ($i=0;$i<count($read);$i++){
					 $exp = explode("_|_",$read[$i]);
					 if(($exp[0] == $cat) && ($exp[1] == $this->htm)) return $exp[3];
				}
		   }
		   return $id;
	 }

	 function checkproof(){
		   global $iscon;
		   if(!$iscon["idadmin"]) return $this->formadmin();
		   $print="";
		   $data="";
		   $iscon["rewrite"]=$this->txtmod();
		   $iscon["extmod"]=$this->extmod();
		   $s =$iscon["_s"];
		   $count=0;
		   $print.= "<div id=\"tabgroup\"><strong>".$iscon["lang"][122]."</strong></div>\n";
		   $print.= "<br class=\"clear-all\" />\n";

		   $path="./data/unproof.dat";
		   if(file_exists($path)){
			    $read=file($path);
				for ($i=0;$i<count($read);$i++){
					 $exp = explode("_|_",$read[$i]);
					 $query=mysql_db_query($this->dbname, "select _cid, _topic, _active  from _infoboardq  where _cat='".$exp[0]."' and _page='".$exp[1]."'");
					 $num=0;
					 if($result = @mysql_fetch_array($query)){
						 if($result["_active"] == 0) $num++;
						 $num = $this->countproof($result["_cid"], $num);
						 if($num > 0){
							  $print.= "<div id=\"topicupdate\">\n";
							  $print.= "<ul>\n";
							  $print.= "<li  class=\"topicadmin\">\n";
							  $print.= "<a  href=\"".$iscon["rewrite"]."topic".$s.$exp[0].$s.$exp[1].$s."1".$iscon["extmod"]."\">".$result["_topic"]."</a>\n &nbsp; ";
							  if($exp[2] == 1){
								   $print.= "(".$iscon["lang"][44].")\n";
							  }else{
								   $print.= "(".$num.")\n";
							  }
							  $print.= "</li>\n";
							  $print.= "</ul>\n";
							  $print.= "</div>\n";
							  $print.= "<br class=\"clear-all\" />\n";
							  $data.=trim($exp[0])."_|_".trim($exp[1])."_|_".trim($exp[2])."_|_".trim($num)."_|_".trim($exp[4])."\n";
							  $count = 1;
						 }
					 }
				}
		   }
		   if($data){
				$this->iswrite($path, $data);
		   }else{
			    if(file_exists($path)) unlink($path);
		   }
		   if($count == 0) $print.= $iscon["lang"][136]."\n";
			  $print.= "<br class=\"clear-all\" />\n";
			  return $print;
	 }

	 function checkpicproof(){
		   global $iscon;
		   if(!$iscon["idadmin"]) return $this->formadmin();
		   $print="";
		   $data="";
		   $iscon["rewrite"]=$this->txtmod();
		   $iscon["extmod"]=$this->extmod();
		   $s =$iscon["_s"];
		   $count=0;
		   $print.= "<div id=\"tabgroup\"><strong>".$iscon["lang"][50]."</strong></div>\n";
		   $print.= "<br class=\"clear-all\" />\n";

		   $path="./data/improof.dat";
		   if(file_exists($path)){
			    $read=file($path);
				for ($i=0;$i<count($read);$i++){
					 $exp = explode("_|_",$read[$i]);
					 $query=mysql_db_query($this->dbname, "select _cid, _topic, _activeimg, _pic  from _infoboardq  where _cat='".$exp[0]."' and _page='".$exp[1]."'");
					 $num=0;
					 if($result = @mysql_fetch_array($query)){
						  if(trim($result["_pic"])){
							   if($result["_activeimg"] == 2) $num++;
						  }
						  $num = $this->countimgproof($result["_cid"], $num);
						  if($num > 0){
							   $print.= "<div id=\"topicupdate\">\n";
							   $print.= "<ul>\n";
							   $print.= "<li  class=\"topicadmin\">\n";
							   $print.= "<a  href=\"".$iscon["rewrite"]."topic".$s.$exp[0].$s.$exp[1].$s."1".$iscon["extmod"]."\">".$result["_topic"]."</a>\n &nbsp; ";
							   if($exp[2] == 1){
								   $print.= "(".$iscon["lang"][44].")\n";
							   }else{
								   $print.= "(".$num.")\n";
							   }
							   $print.= "</li>\n";
							   $print.= "</ul>\n";
							   $print.= "</div>\n";
							   $print.= "<br class=\"clear-all\" />\n";
							   $data.=trim($exp[0])."_|_".trim($exp[1])."_|_".trim($exp[2])."_|_".trim($num)."_|_".trim($exp[4])."\n";
							   $count = 1;
						  }
					 }
				}
		   }
		   if($data){
				$this->iswrite($path, $data);
		   }else{
			    if(file_exists($path)) unlink($path);
		   }
		   if($count == 0) $print.= $iscon["lang"][136]."\n";
			  $print.= "<br class=\"clear-all\" />\n";
			  return $print;
	 }

	 function countproof($cid, $num){
		   global $iscon;
		   $query1=mysql_db_query($this->dbname, "select _cid, _active from _infoboarda  where  _qid='".$cid."'");
		   while($result1 = @mysql_fetch_array($query1)){
			    $aid = $result1["_cid"];
				if($result1["_active"] == 0) $num++;
			}
			$query2=mysql_db_query($this->dbname, "select _active from _infoboardi where  _qid='".$cid."' and _target='1'");
			while($result2 = @mysql_fetch_array($query2)){
				 if($result2["_active"] == 0) $num++;
			}
			$query3=mysql_db_query($this->dbname, "select _active from _infoboardi where  _aid='".$aid."' and _target='2'");
			while($result3 = @mysql_fetch_array($query3)){
				 if($result3["_active"] == 0) $num++;
			}
			return $num;
	 }


	 function countimgproof($cid, $num){
		   global $iscon;
		   $query1=mysql_db_query($this->dbname, "select _cid, _activeimg, _pic from _infoboarda  where  _qid='".$cid."'");
		   while($result1 = @mysql_fetch_array($query1)){
			    $aid = $result1["_cid"];
				if(trim($result1["_pic"])){
					 if($result1["_activeimg"] == 2) $num++;
				}
			}
			$query2=mysql_db_query($this->dbname, "select _activeimg, _pic from _infoboardi where  _qid='".$cid."' and _target='1'");
			while($result2 = @mysql_fetch_array($query2)){
				 if(trim($result2["_pic"])){
					  if($result2["_activeimg"] == 2) $num++;
				 }
			}
			$query3=mysql_db_query($this->dbname, "select _activeimg, _pic from _infoboardi where  _aid='".$aid."' and _target='2'");
			while($result3 = @mysql_fetch_array($query3)){
				 if(trim($result3["_pic"])){
					  if($result3["_activeimg"] == 2) $num++;
				 }
			}
			return $num;
	 }

}

?> 
Return current item: infoboard