<?php
//#*********************************************************************************************************************** 
 if (isset ($_REQUEST['res']))                // 
//************************************************************************************************************************
 {if ($_REQUEST['row']=="")
  {$os=$os.'<b style="color:red">The object before which you want to restore the deleted object is not selected! Click to select an object and repeat.</b>';
  }
  else
  {$fs=$_prhtm.'/_del.txt';                     //
    if (file_exists($fs))                       //
  {$nus=$_REQUEST['row'];                       //
   $ff=$_frhtm;
   $i=-1; 		            					//
   $l = file(wu($ff,$utf8)); 					//
   $w = fopen(wu($ff,$utf8), 'w') or exit;  	//
   foreach ($l as $li => $lin)                  //
   {if ($li<$nus)                               //
    {fwrite($w,$lin);++$i;}                     //
    if ($li==$nus)                              //
    {$s = file($fs); 			                //
    foreach ($s as $lis => $lins)               //
{$pozs=strpos($lins,">");				        //
     $tags=explode(" ",substr($lins,0,$pozs));  //
     $tagws="";						            //
     foreach ($tags as $ks => $zs)              //
     {if (substr($zs,0,6)=="title=")            //
      {$tagws=$tagws.'title="'.(++$i).'" ';
	   }
	   else
	   {$tagws=$tagws.$zs." ";
	   }} 
      fwrite($w,trim($tagws).substr($lins,$pozs)); //
}}
    if ($li>=$nus)                                 //
	  {$poz=strpos($lin,">");			           //
      $tag=explode(" ",substr($lin,0,$poz));       //
      $tagw="";						               //
      foreach ($tag as $k => $z)                   //
      {if (substr($z,0,6)=="title=")               //
       {$tagw=$tagw.'title="'.(++$i).'" ';
	   }
	   else
	   {$tagw=$tagw.$z." ";
	   }
      } 
      fwrite($w,trim($tagw).substr($lin,$poz));
     }
    } // 
    fclose($w);
    $os=$os. '<b style="color:green">Objects from the buffer are inserted before the object '.$nus.'  !</b>';
	}
   else
   {$os=$os.'<b style="color:red">There was no deletion or saving of objects in the buffer! There is nothing to insert. '.$nus.'  !</b>';
   }}}


