<?php
//******************************************************************************************************************
 if (isset ($_REQUEST['pub']))                       // 
//******************************************************************************************************************
 { //
  $l = file($_frhtm);  			//
  $kcal=0;                      //
  $keg=0;                       //
  $kzk=0;                       //
  $kkk=0;                       //
  $kkol=0;  
 foreach ($l as $li => $lin)   // 
  {if (strstr($lin,'id=eva') or strstr($lin,'id="eva"'))  // 
  {if ($kkk==1)
   {$os=$os."<b>PUBLICATION IS FORBIDDEN: Error on the page multiple calculators! Leave 1 and repeat!</b>";$kkk++;}
   else
   {$kkk++;}
   }
  if (strstr($lin,'id=cal') or strstr($lin,'id="cal"'))  //  
  {if ($kcal==1)
   {$os=$os."<b>PUBLICATION IS FORBIDDEN: Error on the page several calendars! Leave 1 calendar and repeat!</b>";$kcal++;}
   else {$kcal++;}
   }
  if (strstr($lin,'id=eg') or strstr($lin,'id="eg"'))   // 
  {if ($keg==1)
   {$os=$os."<b>PUBLICATION IS FORBIDDEN: Error on the page several diaries! Leave 1 diary and repeat!</b>";$keg++;}
   else
   {$keg++;}
   }
   if (strstr($lin,'id=zk') or strstr($lin,'id="zk"') )  //
  {if ($kzk==1)
   {$os=$os."<b>PUBLICATION IS FORBIDDEN: Error on the page multiple notebooks! Leave 1 and repeat!</b>";$kzk++;}
   else
   {$kzk++;}
   }
   $kkol++;
   // 
 if ($prizg and strpos($lin,'href="../pages')>0)  //
   {//
    list($sq1, $sq2) = explode('../pages',$lin);
	list($sq3, $sq4) = explode('.php',$sq2);
//    echo htmlspecialchars("../pages".$sq3.'.php', ENT_QUOTES);  
    $lq = file("pages".$sq3.'.php');    //
    foreach ($lq as $lii => $lini)      //
    {if (strpos($lini,'id=eva')>0)      //
	{$os=$os."<b>PUBLICATION IS FORBIDDEN: Error, there is a calculator on the insert page! Replace content insert or remove calculator!</b><br>";}
    if (strpos($lini,'id=cal ')>0)     // 
     {$os=$os."<b>PUBLICATION IS FORBIDDEN: Error, there is a calendar on the insert page! Replace the content insert or delete the calendar!</b><br>";}
    if (strpos($lini,'id=eg ')>0)      // 
     {$os=$os."<b>PUBLICATION IS FORBIDDEN: Error, there is a diary on the insert page! Replace the content insert or delete the diary!</b><br>";}
	if (strpos($lini,'id=zk ')>0)      // 
	{$os=$os."<b>PUBLICATION IS FORBIDDEN: Error, there is a notebook on the insert page! Replace the content insert or delete the notebook!</b><br>";}
	}}}
  if ($kcal==0 and  $keg==0 and $kzk==0 and $kkk==0)           //
 {}
 else                                                          //
 {if (!$prizg and !$priz and ($keg!=0 or $kzk!=0))             //
  {$l5 = file($_fohtm_);                                       //
  foreach ($l5 as $k5 => $z5)                                  //
 {if (strpos(" ".$z5,'-card-file.php')>0) 
{ $os=$os."<b>PUBLICATION IS FORBIDDEN: Error, external page - card index, notebook and diary are not allowed! Delete your notebook and / or diary and repeat!</b><br>";
 break;  
 }}}
// 
$scf1="plan/r1t/r1t.htm,plan/r2t/r2t.htm,plan/r3t/r3t.htm,plan/pl/pl.htm,plan/pc/pc.htm,plan/pr/pr.htm";
$tag11=explode(',',$scf1);       //
$kpp='include "../pages/'.$nam1."/".$nam1.'.php"';  //
foreach ($tag11 as $k => $z)    // 
{if (file_exists($z)) 
{$l = file($z); 					 //
foreach ($l as $li => $lin)      //
{if (strpos(" ".$lin,$kpp)>0)    //
{$ur="";
if ($k==0)
{$ur=" 1 section of the right column. ";}
else if ($k==1)
{$ur=" 2 section of the right column. ";}
else if ($k==2)
{$ur=" 3 section of the right column. ";}
else if ($k==3)
{$ur=" left footer section ";}
else if ($k==4)
{$ur=" center section footer ";}
else if ($k==5)
{$ur=" right section footer ";}
$os=$os."<b>PUBLISHING FORBIDDEN: the page contains gadgets, the page content is published to ". $ur." home page! Delete the gadget or change the contents of the section and repeat!</b>";
}}}}}
 if  ($kkol==0)
  {// 
$scf1="tv,tc,tg,tq,y,n";                 //
$tag11=explode(',',$scf1);               //
foreach ($tag11 as $k => $z)             //
{if (file_exists($_pohtm."/".$z)) 
{full_del_dir($_pohtm."/".$z);}
}}
 if ($kcal==0 and $keg==0 and $os=="")   //
{$fes =scandir($_pohtm, 1);	             //
  foreach ($fes as &$val) 				 //
   {if ($val != "." && $val != "..")     //
    {if  (!strstr($val, '.'))            //
     {}
     else
     {$fu=$_pohtm."/".$val;
      //
      $ucf1=" 1.txt,2.txt,3.txt,4.txt,tables.php,help.php,p.txt".str_replace(".htm",".php",$imf).",".str_replace(".htm","0.php",$imf).",".str_replace(".htm","-card-file.php",$imf);  
//
//    []0.php - 
//    [].php  - 
//    []1.php - 
	  if (strpos($ucf1,$val)==0)         // 
      {if (unlink ($fu))    			 // 
      {} 
      else
      {$os=$os."<b>Error while deleting file! Contact the developer!</b>";   break; }
}}}}}
  if ($os=="")  //
  {$fes =scandir($_prhtm, 1);			//
  foreach ($fes as &$val) 				//
   {if ($val != "." && $val != "..")  	//
    {if  (!strstr($val, '.'))           //
     {}
     else
     {if (strpos($val,"_del.")=== false and strpos($val,"_tmp.")=== false
and strpos($val,"_begin.")=== false and strpos($val,"_end.")=== false) // 
	 {$fr=$_prhtm."/".$val;	                   // 
     $fw=$_pohtm."/".$val;                     // 
	  if ($val==$imf)                          // 
	   {$l = file($_frhtm);  		           // 
        $w = fopen($_fophp, 'w') or exit;  	   // 
		fwrite($w,'<!--created=gidra-->');
        $br=false;
		foreach ($l as $li => $lin)       		//
        {$b=$lin;
		 $b=str_replace('id=s ','',$b);			     // 

$b=str_replace('lang="onclick=','onclick="',$b);	      //
$b=str_replace('lang=onclick=','onclick=',$b);			  //


//*****************************************************************************************************
//  
$b=str_replace('id="passw"',"id=passw",$b); 
if  (strstr($b,'id=passw'))                           //
{$b=str_replace("src~=","src=",$b); 
 $b=str_replace("<STRONG","<strong",$b);    
 $b=str_replace("</STRONG>","</strong>",$b);    
 $poz1=strpos($b,'<strong id=passw>')+17;              //
  $poz2=strpos($b,'</strong>'); 
  $pass=substr($b,$poz1,$poz2-$poz1);
  $b=str_replace($pass,'',$b);			               //
  $pass=trim(str_replace('Password=','',$pass));	   //
  if ($pass=="")
   {$pass=md5("1");}
  else
   {if  (strpos($pass,'+')>0  )                        //
     {$pass=trim(str_replace('+','',$pass));           //
	 $pass=md5($pass,false);}                          //
    else                                    //
	 {$pass=md5($pass,false);
  	  $pass=substr($pass,3);}}                        //
      $kuda=$_pohtm."/y/p.html";                      //
      $wpass = fopen($kuda, 'w') or exit;  	          //
      fwrite($wpass,$pass);
	  fclose($wpass);
}
// *************************************************************************
 if  (strstr($b,'id=listd') || strstr($b,'id="listd"')  )      // 
{$b=str_replace("<OL>",'<OL style="display:none">',$b);        // 
$b=str_replace("<UL>",'<UL style="display:none">',$b); 
$b=str_replace("<ol>",'<ol style="display:none">',$b);         // 
$b=str_replace("<ul>",'<ul style="display:none">',$b); 
$b=str_replace("minus.gif",'plus.gif ',$b); 
}
//******************************************************************
if (strstr($b,'id=kons') or strstr($b,'id="kons"'))                               
{$b=str_replace("<DIV",'<div',$b);
$ss=explode("<div",$b);                                        // 
$sss=explode(">",$ss[2]);
$sss[0]=str_replace('style="','style="display:none;',$sss[0]);
$ss[2]=implode(">", $sss);
$b=implode("<div", $ss);                                       // 
$b=str_replace("minus.gif",'plus.gif ',$b); 
}

// ***************************************************************
$b=str_replace('id="zkpassw"','id=zkpassw',$b);          // 
if  (strstr($b,'id=zkpassw'))                            // 
{$b=str_replace("src~=","src=",$b); 
$b=str_replace("<STRONG","<strong",$b);    
$b=str_replace("</STRONG>","</strong>",$b);    
$poz1=strpos($b,'<strong id=zkpassw>')+19;               // 
$poz2=strpos($b,'</strong>'); 
  $pass=substr($b,$poz1,$poz2-$poz1);
  $b=str_replace($pass,'',$b);			                 // 
  $pass=trim(str_replace('Password=','',$pass));	     // 
  if ($pass=="")
   {$pass=md5("1");}
  else
   {if  (strpos($pass,'+')>0  )                 //
     {$pass=trim(str_replace('+','',$pass));    // 
	 $pass=md5($pass,false);}                   // 
    else                                        // 
	 {$pass=md5($pass,false);
  	  $pass=substr($pass,3);}}                 //
      $kuda=$_pohtm."/n/p.html";               //
      $wpass = fopen($kuda, 'w') or exit;  	   //
      fwrite($wpass,$pass);
	  fclose($wpass);
}
//*****************************************************************************
		 $b=str_replace('onclick1=','onclick=',$b);			//
		 $b=str_replace('//cal.nu(0)','cal.nu(0)',$b);		//
		 $b=str_replace('//eg.nu(0)','eg.nu(0)',$b);		//
         $b=str_replace('"rn"','"\r\n"',$b);	            //
         $b=str_replace('lang=$','',$b);			        //
		 $b=str_replace(' alt=',' name=',$b);		        	// 
		 $b=str_replace(' href2=',' href=',$b);		        	// 
		 $b=str_replace('http://'.trim($_SERVER['SERVER_NAME']).'/gidra/','',$b);			//
		 $b=str_replace('%5E','^',$b);
		 if  (strpos($b,'pfoto1.php?')>0  )                 // 
		 {$ss=explode("pfoto1.php?",$b);
         $izkk=0;
		 $kb1="";
        	foreach ($ss as $kk => $zkk)
          {if  (strpos($zkk,'pod=*')>0  )
			{list($ss1, $ss2) = explode('title="',$zkk);    // 
            list($ss3, $ss4) = explode('"',$ss2); 
		    $ss3=str_replace('"','',$ss3);
		    $ss3=tr(str_replace(' ','_',$ss3));
		    $zkk=str_replace('pod=*','pod='.$ss3,$zkk);
			$kb1=$kb1."pfoto1.php?".$zkk;
			}
			else
			{$kb1=$kb1.$zkk;
		   }
			$i++;
		  }
		 $b=$kb1; 
		 }
//************************************************************************ 
		 if ($priz)                                                       // 
		 {$b=str_replace('pfoto1.php','../pfoto1.php',$b);
	     $b=str_replace('d~e~f','../d~e~f',$b);	                           //
		 $b=str_replace('src="pages/'.$im.'/'.$im.'/','src="'.$im.'/',$b); //
		 $b=str_replace('id=pages/'.$nam1."/".$nam1."/",'id=../pages/'.$nam1."/".$nam1."/",$b);
		 $b=str_replace('id="pages/'.$nam1."/".$nam1."/",'id="../pages/'.$nam1."/".$nam1."/",$b);
		$b=str_replace('src="pages/'.$nam1.'/contents/01,01,01_apx/','src="../pages/'.$nam1.'/contents/01,01,01_apx/',$b);         //
		$b=str_replace('src="pages/'.$nam1.'/contents/01,01,01_tmp/','src="../pages/'.$nam1.'/contents/01,01,01_tmp/',$b);         //
		$b=str_replace('id=pages/'.$nam1.'/contents/01,01,01_apx/','id=../pages/'.$nam1.'/contents/01,01,01_apx/',$b);         //
		$b=str_replace('id=pages/'.$nam1.'/contents/01,01,01_tmp/','id=../pages/'.$nam1.'/contents/01,01,01_tmp/',$b);         //
		 $b=str_replace('url(plan/','url(../plan/',$b);			  //
		 }
		 else if ($prizg)                                                   // 
		 {$b=str_replace('pfoto1.php','../pfoto1.php',$b);
		 $b=str_replace('url(plan/','url(../plan/',$b);			  //
	     $b=str_replace('d~e~f','../d~e~f',$b);                         	//
		 $b=str_replace('plan/','../plan/',$b);                             //
		 $b=str_replace('img=','img=pages/',$b);
		 }
		 else                                                               //
		 {$b=str_replace('pfoto1.php','../../../../pfoto1.php',$b);
         $b=str_replace('pages/'.$s1."/". $s2.'/'.$s3."/",'pages/'.$s1."/".$s2.'/',$b); //
	     $b=str_replace('d~e~f','../../../../d~e~f',$b);	                //
$b=str_replace('url(plan/','url(../../../../plan/',$b);			  //
		 
		 $b=str_replace('src="pages/','src="../../../../pages/',$b);        // 
		 $b=str_replace('id=pages/','id=../../../../pages/',$b);
		 $b=str_replace('id="pages/','id="../../../../pages/',$b);
		 //
		 }
$b=str_replace(' disabled',' ',$b);                  // 
$b=str_replace('aa(this)','a(this)',$b);			//
		 $vp=strpos($b,'title=');
		 if  ($vp>0)                                // 
		 {$b=substr($b,0,$vp).substr($b,$vp+2);
		 }
		 // *******************************************************************   
if  (strpos($b,'id=so')>0  )                          //
{$b=substr($b, strpos($b,'href=')+6);                 //
$bp=strpos($b,'"');
$b=substr($b, 0,$bp); 
if ($priz or $prizg)                                  //
{$b='<?php include "'.$b.'" ?>'."<!--insert-->\r\n";
}
else
{$b='<?php include "'.str_replace('../','../../../../',$b).'" ?>'."<!--insert-->\r\n";;
}}

$b=str_replace('id="lin"','id=lin',$b);
if  (strpos($b,'id=lin')>0)                          //
{

 $b=str_replace('id=lin','',$b);			         // 
 $b=str_replace('id=no','',$b);
 $b=str_replace('id="no"','',$b);

 $b=str_replace(' onclickk',' click',$b);              // 
 $b=str_replace(' click',' onclick',$b);               // 
 if ($priz)                        // 
{$b=str_replace('<u ','<img style="display:none" src="../d~e~f/arrow-rj.gif">&#160;&#160;<a ',$b);	
//
 $b=str_replace('</u> ','</a>',$b);			
 $b=str_replace('<U ','<img style="display:none" src="../d~e~f/arrow-rj.gif">&#160;&#160;<a ',$b);
//
 }
 else if ($prizg)                 //
{$b=str_replace('<u ','<img style="display:none" src="../d~e~f/arrow-rj.gif">&#160;&#160;<a ',$b);
// 
 $b=str_replace('</u> ','</a>',$b);			
 $b=str_replace('<U ','<img style="display:none" src="../d~e~f/arrow-rj.gif">&#160;&#160;<a ',$b);
// 
}
else                            // 
{$b=str_replace('<u ','<img style="display:none" src="../../../../d~e~f/arrow-rj.gif">&#160;&#160;<a ',$b);			//
 $b=str_replace('</u> ','</a>',$b);			
 $b=str_replace('<U ','<img style="display:none" src="../../../../d~e~f/arrow-rj.gif">&#160;&#160;<a ',$b);	
 if  (!strstr($b,'mailto:') and  !strstr($b,'http:') ) 
{$b=str_replace('href="','href="../../../',$b);
}
  //
  }  
  $b=str_replace('</U>','</a>',$b);
  $b=str_replace('</u>','</a>',$b);						
  }
$but=false;                   //
$zag="";                      //
$htm="";                      //
//**********************************************************************************************************************
if  (strstr($b,'links.htm') and !$prizg)      // 
{if  (strpos($b,'time="~~')>0)                // 
 {$par=explode("~~",$b);                      // 
  $vrp='$time="~~'.$par[1]. '~~"';
  }
else                                                    //
{$vrp= "";
}
	 $fex = file_get_contents ('otd/new.txt');  		//
	 if ($priz)                                         //
	 {list($nad,$exd)=explode('.',$imf);                //
      $katii='pages/'.$nad.'/contents/';	            //
	 $nad='../pages/'.$nad;
	 }
	 else if ($prizg)                                   //
	  {} 
	 else                                               //
	 {$nad='../../../../pages/'.$s1;
	  $katii='pages/'. $s1.'/contents/';	            //
	 }
     $b='<center><br><table border="1"><CAPTION >Document link table</CAPTION><THEAD><TR>';
     $b=$b.'<TH title="Number in order" width="20">N</TH>';
     $b=$b.'<TH title="date" width="42">Date</TH>';
     $b=$b.'<TH title="number" width="42">Number</TH>';
     $b=$b.'<TH title="Summary">Content</TH>';
     $b=$b.'<TH title="File size in Kilobytes" width="26">KB</TH>';
     $b=$b.'<TH title="File type" width="20">Type</TH>';
     $b=$b.'</TR></THEAD><TBODY>';
     $i=1;
     $files2 = scandir($katii, 1);		                           //
     foreach ($files2 as &$value) 		                            //
     {$value=uw($value,$utf8);
     if ($value != "." && $value != "..")  
    {if (!strstr($value, '.'))   	                     			//
     {if (substr($value,2,1)=="," and substr($value,5,1)==",")  	//
      { $d=substr($value,0,8); 			                         	//
        $n=substr($value,9,12); 			                        //
        $filesp = scandir(wu($katii.$value,$utf8), 1);	            //
        foreach ($filesp as &$va) 			                        //
        {$va=uw($va,$utf8);
	     if ($va != "." && $va != "..")  
         {if (strpos($va, '.')>0)    		                        //
	 	  { list($na,$ex)=explode('.',$va);                         //
		   if  (strpos($fex,'.'.$ex)>0)		                        //
	      {//
if (substr($n,0,1)=="0" or $na=="select2" or $na=="select3" or $na=="sv") 
{}
else
{   	   $b=$b.'<TR><TD width=10 align=center>'.$i.'</TD>';    	//
           $b=$b.'<TD width=45><nobr>'.$d.'</nobr></TD>';		    //
           $b=$b.'<TD width=65><nobr>'.rtr($n).'</nobr></TD>';	    //
	       $v=filesize(wu($katii.$value.'/'.$va,$utf8))/1000;		//
	       if  (strpos($va,'.htm')>0)		                        //
	       {	                                                     //
	       }
	       else
	       {$va1=$va;}
		   $b=$b.'<TD>&nbsp<a class=menul target=_blank href="'.$nad.'/contents/'.$value.'/'.$va1.'">'. rtr($na).'</a></TD>';
           $b=$b.'<TD width=1 align=center>'.$v.'</TD>';		     //
           $b=$b.'<TD width=10 align=center>'.$ex.'</TD></TR>';	     //
           $i++;}
		   }
		   }}}}}}}
           $b=$b.'</tbody></table></center>'."\r\n";	             //
}
//****************************************************************************************************************************
if  (strpos($b,'linkshtml.htm')>0 and !$prizg)      // 
//*****************************************************************************************************************************
{if  (strpos($b,'time="~~')>0)                //
 {$par=explode("~~",$b);                      //
  $vrp='$time="~~'.$par[1]. '~~"';
  }
else                                          //
{$vrp= "";
}
	 $fex = " .htm";  		                  //
	 if ($priz)                               //
	 {list($nad,$exd)=explode('.',$imf);      //
      $katii='pages/'.$nad.'/contents/';      //
	 $nad='../pages/'.$nad;
	 }
	 else if ($prizg)                         //
	  {} 
	 else                                     //
	 {$nad='../../../../pages/'.$s1;
	  $katii='pages/'. $s1.'/contents/';      //
	 }
     $b='<center><br><table border="1"><CAPTION >Page links table</CAPTION><THEAD><TR>';
     $b=$b.'<TH title="Number in order" width="20">N</TH>';
     $b=$b.'<TH title="date" width="42">Date</TH>';
     $b=$b.'<TH title="number" width="42">Number</TH>';
     $b=$b.'<TH title="Summary">Content</TH>';
     $b=$b.'<TH title="File size in Kilobytes" width="26">KB</TH>';
     $b=$b.'<TH title="File type" width="20">Type</TH>';
     $b=$b.'</TR></THEAD><TBODY>';
     $i=1;
     $files2 = scandir($katii, 1);		                           //
     foreach ($files2 as &$value) 		                           //
     {$value=uw($value,$utf8);
     if ($value != "." && $value != "..")  
    {if (!strstr($value, '.'))   				                    //
     {if (substr($value,2,1)=="," and substr($value,5,1)==",")  	//
      { $d=substr($value,0,8); 			                         	//
        $n=substr($value,9,12); 			                        //
        $filesp = scandir(wu($katii.$value,$utf8), 1);	            //
        foreach ($filesp as &$va) 			                        //
        {$va=uw($va,$utf8);
	     if ($va != "." && $va != "..")  
         {if (strpos($va, '.')>0)    		                        //
	 	  {list($na,$ex)=explode('.',$va);                          //
		   if  (strpos($fex,'.'.$ex)>0 and $d!="01,01,01")	        //
	      {$b=$b.'<TR><TD width=10 align=center>'.$i.'</TD>';  	    //
           $b=$b.'<TD width=45><nobr>'.$d.'</nobr></TD>';		    //
           $b=$b.'<TD width=65><nobr>'.rtr($n).'</nobr></TD>';	    //
	       $v=filesize(wu($katii.$value.'/'.$va,$utf8))/1000;		//
	       if  (strpos($va,'.htm')>0)		                    //
	       {$va1=$va;	                              
	       }
	       else     //
	       {}
		   $b=$b.'<TD>&nbsp<a class=menul target=_blank href="'.$nad.'/contents/'.$value.'/'.str_replace(".htm",".php",$va1).'">'. rtr($na).'</a></TD>';
           $b=$b.'<TD width=1 align=center>'.$v.'</TD>';		     //
           $b=$b.'<TD width=10 align=center>'.$ex.'</TD></TR>';	     //
           $i++;}}}}}}}}
           $b=$b.'</tbody></table></center>'."\r\n";	             //
}
//********************************************************************************************************************************
if  (strstr($b,'name=V') or strstr($b,'name="V"') )      // 
{$fs=$_pohtm.'/tv/';
if (file_exists($fs))                                    // 
{} else                                                  // 
{$rew=mkdir($fs);}
$list= explode('vvv',$b);                                // 
$count=count($list);
$new=false;
$imy="vvv".$list[1]."vvv";                               // 
$ifg=$_pohtm.'/tv/'.$imy.'.htm';                         // 
$ifg1=$_pohtm.'/tv/'.$imy.'.txt';                        // 
if (file_exists($ifg1))                                  // 
{$os=$os.'<b style="color:red">Published voting form:'.$imy.' not editable! </b><br>';
}
else                                                      //
 {if (strpos(' '.$imy,'\\')>0 or strpos(' '.$imy,'/')>0 or strpos(' '.$imy,':')>0 or strpos(' '.$imy,'*')>0
   or strpos(' '.$imy,'<')>0 or strpos(' '.$imy,'>')>0 or strpos(' '.$imy,'|')>0)
   {$ifg=$_pohtm.'/tv/invalid character in filename.txt'; 
   $os=$os."Invalid character \\ / : * ? < > in the voting topic, change the topic and repeat!";
   }
   $ww = fopen($ifg, 'w') or exit; 	                      //
$bb=$b;
$bb=str_replace("</FORM>","</form>",$bb);
$bb=str_replace("</form>",'<input type="hidden" value="'.$imy.'" name="file"></form>',$bb);
$bb=str_replace("<","\r\n<",$bb); 
$bb=str_replace("<SPAN>","<span>",$bb);
   $bb=str_replace("<span>","<span>\r\n",$bb); 
   fwrite($ww,$bb);                                        //
   fclose($ww);}                                           //
   if ($priz)                                              //
   {$kr='../pages/'.$im;}
   else if ($prizg)                                        //
   {}
   else                                                    //
   {$kr='../../../../pages/'.$s1."/". $s2."/". $s3;}
   if  (strpos($b,'time="~~')>0)                           //
   {$par=explode("~~",$b);                                 //
    $b='<?php include "'.$kr.'/tv/'.$imy.'.htm";$time="~~'.$par[1]. '~~"; ?>'."\r\n";
   }
   else                                                    //
   {$b='<?php include "'.$kr.'/tv/'.$imy.'.htm";$time="0"; ?>'."\r\n";
   }
  }
//***************************************************************************************
if  (strpos($b,'tg/tg.txt')>0)      // 
{//
$fg = $_pohtm.'/tg';                //
$fg1 = $_pohtm.'/tg/tg.txt';        //
$fg2 = $_pohtm.'/tg/tg.htm';        //
$htm='/tg/tg.htm';
$but=true;
$zag='Guest book';
$htm='/tg/tg.htm';
}
//***************************************************************************************
if  (strpos($b,'tq/tq.txt')>0)      //
{// 
$fg = $_pohtm.'/tq';           //
$fg1 =$_pohtm .'/tq/tq.txt';   //
$fg2 =$_pohtm .'/tq/tq.htm';   //
$htm='/tq/tq.htm';
$but=true;
$zag='Questions-Answers';
$htm='/tq/tq.htm';
}
//***************************************************************************************
if  (strpos($b,'tc/tc.txt')>0)      //
{//
$fg = $_pohtm.'/tc';           // 
$fg1 = $_pohtm.'/tc/tc.txt';   // 
$fg2 = $_pohtm.'/tc/tc.htm';   // 
$htm='/tc/tc.htm';
$but=true;
$zag='Comments';
}
if ($but)
{if (file_exists($fg))
{}
else
{mkdir($fg);}
if (file_exists($fg1))
{}
else
{$wf1 = fopen($fg1, 'w') or exit;  	
fwrite($wf1,'');
fclose($wf1);
}
if (file_exists($fg2))
{}
else
{$wf2 = fopen($fg2, 'w') or exit;  	
fwrite($wf2,'<h3 style="background:#b0c4de;text-align:center">'.$zag.'</h3>');
fclose($wf2);
}
if ($priz)                     // 
{$kr='../pages/'.$im;}
else if ($prizg)               // 
{$kr='../pages/'.$im;}
else                           // 
{$kr='../../../../pages/'.$s1."/". $s2."/". $s3;}
if  (strpos($b,'time="~~')>0)  // 
{$par=explode("~~",$b);        // 
$b='<?php include "'.$kr.$htm.'";$time="~~'.$par[1]. '~~";?>'."\r\n";
}
else
{$b='<?php include "'.$kr.$htm.'";$time="0"; ?>'."\r\n";
}
}
fwrite($w,$b);
} 
		 fclose($w);
	  }
      else
	   {if (copy(wu($fr,$utf8),wu($fw,$utf8)))  	 //
       {  } 
       else
       {$os=$os. "Error while copying file! Contact the developer!" ; break; }
  }}}}}
  $os=$os. "<b style='color:green'>PAGE IS PUBLISHED!</b>" ;
  }
if ($os=="")
{echo $os;}
}  //     ***************************************************************************************************
echo $div.$div1.'">'."\n";

