<?php header('Content-Type: text/html; charset=windows-1251'); ?>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<title>Moderation of voting forms</title>
</head>
<?php
if (file_exists(getcwd ( )."/otd/2.txt"))
{
echo '<body leftMargin=0 id=bod topMargin=0  style="overflow:hidden;background:silver;">';
echo '<table id=monoz  border=0 style="width:100%;height:100%;
z-index:3;position:absolute;top:0px;left:0px;">
<tr ><td width=30%>&nbsp;</td><td width=30%  valign=center align=center>
<table border=0 width=400 style="background:white" >
<tr><td><IMG height=60 border=0 src="d~e~f/pas.jpg"></td>
<td  height=30px ><center><b style="color:red">ATTENTION !'.
'</b> </center> <br>
<ol>
<li> THE ADMINISTRATOR closed the site to carry out work on its reorganization!
<li> The site will be available after completion of work!
<li> For information, please contact the ADMINISTRATOR!
<li> Close site
<li> Check back later!
</ol>
</td></tr>
</table>
</td><td width=30%>&nbsp;</td></tr></table></body></html>';
die;}
?>

<body background="d~e~f/bkg4.gif" topMargin=0 style="overflow:hidden" width=100% height=100%>
<div id=ppp style="z-index:2;opacity:0.3;visibility:hidden;height:100%;width:100%;position:absolute;top:0;left:10;background:black;filter:alpha(opacity=30)">&#160;&#160;&#160;</div>
<?php
include "f.php";   // 
if (isset ($_REQUEST['site']))
{$site=$_REQUEST['site'];}
else
{ $site=$_GET['site'];} 
if (isset ($_REQUEST['nam']))
{$nam=$_REQUEST['nam'];}
else
{$nam=$_GET['nam'];} 
if  (strpos($site,'/contents/')>0)      // 
{list($a1,$a2,$a3,$a4,$a5)=explode("/",$site);  //
$fol=$a1."/".$a2."/".$a3;
}
else
{$fol=str_replace(".htm","",$site);   //
}
?>
<form id="form"  method="POST" enctype="multipart/form-data" action="modtv.php
<?php echo '?site='.$site.'&utf8='.$utf8.'&nam='.$nam;?>
">
<b style="color:red;font-family:tahoma;font-size:12px;font-weight:bold;">WEBSITE:</b> 
<b style="color:#316290;font-family:tahoma;font-size:12px;font-weight:bold;" id=sname2>
<?php
include "plan/name.txt";
?>
</b>

<table border="0" width=100% height=100%><tbody>
<TR><td valign=top height=100%>
<table border="0" width=100% height=100% ><tbody><TR><td valign=top>
<table border="1" width=100%   style="border:2px brown solid"  ><tbody>
<THEAD><th colspan=4>Voting forms</th>
<th width=20px title="To delete the voting results, install me and click 'Execute', before that you need to use the constructor to delete the voting form and publish the page.">x</th>
<th width=10px>&nbsp;</th>
</THEAD></table>
<DIV id=k style="OVERFLOW: scroll; HEIGHT: 90%" align=left >
<table border="0" width=100%  height=100%>
<TBODY>
<?php
$os=""; 						  //
//**************************************************************************
if (isset ($_REQUEST['de']))      //
//**************************************************************************
{if (is_dir(getcwd ( ).'/pages/'.$fol.'/tv/')) 
{full_del_dir (getcwd ( ).'/pages/'.$fol.'/tv/');
}
$soob='All deleted!';
}
//*****************************************************************************************************************************
if (isset ($_REQUEST['hid']))     //
//*****************************************************************************************************************************
{//
//
if  (strpos($site,'contents')==0)                                    //
{$f=getcwd ( ).'/pages/'.$fol.'/'.str_replace(".htm",".php",$site);  //
}
else                                                                 //
{$f=getcwd ( ).'/pages/'.str_replace(".php",".htm",$site);           //
}
$fff=file_get_contents ($f);                                         //
foreach ($_REQUEST as $i => $z)                                      //
{//echo htmlspecialchars($i, ENT_QUOTES)."<br>";
if (strpos($i,'_htm')>0)                                              //
  {$ss= str_replace('_htm',".htm",trim($i));
 $sss= str_replace('.htm',".txt",$ss);
  unlink (wu(getcwd ( ).'/pages/'.$fol.'/tv/'.$ss,$utf8));            //
 if (is_file ( getcwd ( ).'/pages/'.$fol.'/tv/'.$sss ))
{ unlink (wu(getcwd ( ).'/pages/'.$fol.'/tv/'.$sss,$utf8));           //
}}}  
$soob='Marked deleted!';
}
//********************************************************************************************************************
//                                                                      
//********************************************************************************************************************
$ipv = wu(getcwd ( ).'/pages/'.$fol.'/tv',$utf8);           //
if  (@opendir($ipv))
{$s =scandir(wu($ipv,$utf8), 1);	                        //
foreach ($s as &$val) 			         
{if ($val != "." && $val != "..")                           //
 {if  (strstr($val, '.'))                                   //
 {if (strpos($val,'.txt')==0)                               //
{$l = file(wu($ipv.'/'.$val,$utf8));                        //
// 
echo '<tr><td disabled>';
foreach ($l as $li => $lin)
{$t=strtolower($lin);
if (strstr($t,"<form") or strstr($t,"<input") or strstr($t,"</form") or strstr($t,"<a") or strstr($t,"</>a"))   //
{echo "&nbsp;";}
 else
{

$lin=str_replace('onclick=','onclick1=',$lin);
$itag=substr(trim($lin),0,4);
if ($itag=="<IMG" or $itag=="<img")
{$mlin=explode('src="',$lin);  
$mlin2=explode('"',$mlin[1]);  
$zamena='src="'.$mlin2[0].'"';
if (strstr($zamena,'d~e~f/'))      //
{$lin=str_replace('../../../../','',$lin);
}
else                               //
{if (strstr($site,'contents'))                                     //
{$lin=str_replace('../../../../','',$lin);
}
else                                                                //
{$mzamena=explode('/',$zamena);  
$lin=str_replace($zamena,'src="pages/'.$nam."/".$mzamena[count($mzamena)-1],$lin);
}}}
$olin=str_replace('style="visibility:hidden"',' ',$lin);              //
$olin=str_replace('style="VISIBILITY: hidden"',' ',$olin);
echo  $olin;
}}
echo '</td><td width=20px>';
echo '<input type="checkbox"   name="'.$val.'">';
echo '</td></tr>';
}}}}}
?>
</tbody></table>
</div></td>
<td valign=center width=300px>
<br><br> 
<center><b  >MODERATION OF VOTING ON THE PAGE</b>
<br><u   title="To view the published page, go back to the designer and click 'LOOK'!">
<?php  echo rtr($nam); ?> </u></center>
<hr>
<li><a  href="help/10.htm#104" target=_blank>&nbsp;Help&nbsp;</a>
<li>
Filter by Voting Topic <input type="text" id=goto size="40" title="One or more filtering contexts
  in the voting topic (1 line) separated by the '/' character">
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button onclick=got(0) form=""  
title="Show only those lines that contain context in any part of the topic">
Select</button>&nbsp;&nbsp;&nbsp;
<button form="" onclick=got(2) title="Cancel selection">&nbsp;X&nbsp;</button>
&nbsp;&nbsp;&nbsp;To print&nbsp;&nbsp;&nbsp;<button form="" style=width:30 onclick=ptab()>P</button>



<li> All voting forms are shown in the table!
<li> Select the forms to delete by clicking in the "X" column and click the button
<center>
<button form="" onclick=dm() 
title="Click me to process the marks.">Execute</button>
</center>
<li>To remove all click<br>
<center>
<button form="" onclick=da() 
>Delete all</button>
</center>

<input id=sel type="submit" value="Execute" name="hid" style="display:none"> 
<input id=all type="submit" value="Delete all" name="de" style="display:none">
</form>
<hr>
<center >
<b id=soob style='color:brown'>
<?php
echo $soob;
?>
</b></center>
</td>
</tr></tbody></table></body>
 <script type="text/javascript">

//***************************************************************************************
function dm()   //
//**************************************************************************************
{document.getElementById("soob").innerHTML=""
mch=document.getElementById("k").getElementsByTagName("INPUT")   //
if (mch.length==0)                                               //
{alert("Empty!")
return
}
if (!confirm("Will the marked  be deleted? \r\n Click Cancel to cancel"))
{return}
else
{kch=false                                                     
for(var j = 0; j <mch.length ; j++)                              //
{if (mch[j].type=="checkbox" && mch[j].name.substr(0,3)=="vvv")  //
{if  (mch[j].checked)                                         
{kch=true
break
}}}
if (!kch)                                                        //
{alert("Marked NO?")
return
}
document.getElementById("sel").click()                          // 
}}

//********************************************************************************************************
function da()   //
//*******************************************************************************************************
{document.getElementById("soob").innerHTML=""
mch=document.getElementById("k").getElementsByTagName("INPUT")
if (mch.length==0)
{alert("Empty!")
return
}
if (!confirm("Will all  be deleted? \r\n Click Cancel to cancel"))
{return}
else
{document.getElementById("all").click()                        //
}}

//******************************************************************************************************
window.onload=function ()   //
//*****************************************************************************************************
{obj9= document.getElementById("k")
obj9.style.height=document.getElementById("ppp").offsetHeight-100
obj9.scrollLeft=0
obj9.scrollTop=0
}

fi2=false     // 
//*******************************************
function got(p)   //
//*******************************************
{if (p==2 &&  !fi2)                                              //
{return	}	
mtr2=document.getElementById("k").getElementsByTagName("TR")    // 
if (p==2)
{mtr3=document.getElementById("k").getElementsByTagName("TABLE")  // 
for(var j = 0; j <= mtr3.length-1; j++)
{mtr3[j].style.display=""
}
fi2=false     //
document.getElementById("soob").innerHTML="Filter canceled"
}
//**************************************************************************************************
if (p==0)                                                  //
{if (document.getElementById("goto").value=="")
{alert("Enter the filter context!")	
return	
}
kont=document.getElementById("goto").value
mkont=kont.split("/")
for(var jj = 0; jj <= mkont.length-1; jj++)
{if (mkont[jj]=="")
{alert("Empty context in filter list!")
return
}}

mtr2=document.getElementById("k").getElementsByTagName("BIG")  //
for(var j = 0; j <= mtr2.length-1; j++)
{ye=false
for(var jj = 0; jj <= mkont.length-1; jj++)
{if (mtr2[j].innerHTML.indexOf(mkont[jj])>=0)
{ye=true;break}
}
if (!ye)
{mtr2[j].parentNode.parentNode.parentNode.parentNode.style.display="none"  //
}
else
{mtr2[j].parentNode.parentNode.parentNode.parentNode.style.display=""  //
}}
fi2=true
document.getElementById("soob").innerHTML="Filtering!"
}}

//********************************************************************
function ptab() //
//********************************************************************
{
newstr2="<b>Website: </b>"+document.getElementById("sname2").innerHTML
newstr2=newstr2+"<h2 style='text-align:center'>Voting on page «<?php  echo rtr($nam); ?>»</h2>"
if (fi2)
{newstr2=newstr2+ "Filtration '"+
document.getElementById("goto").value+"' by topic of voting (1 line)"
}
else
{newstr2=newstr2
}
newstr2=newstr2+document.getElementById("k").innerHTML
dop=window.open("","","");
tnap="<HTML><HEAD><META http-equiv=Content-Type content='text/html; charset=windows-1251'></head>"
tnap=tnap+newstr2+"</html>"
dop.document.write(tnap)
}

</script>
</html>