<?php header('Content-Type: text/html; charset=windows-1251'); ?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">

<style>
td {color:#316290;font-family:tahoma;font-size:12px;font-weight:normal;}
th {color:#316290;font-family:tahoma;font-size:12px;font-weight:bold;}
b {color:#316290;font-family:tahoma;font-size:12px;font-weight:bold;}
.redlink {color:#B92327;font-family:tahoma;font-size:11px;font-weight:normal;}
.bluelink {color:#254A6C;font-family:tahoma;font-size:11px;font-weight:normal;}
}
</style>
<title>Global text variables</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, contact your ADMINISTRATOR!
<li> Close the site.
<li> Check back later!</ol>
</td></tr>
</table>
</td><td width=30%>&nbsp;</td></tr></table></body></html>';
die;
}
?>
<body  leftMargin=0 id=bod topMargin=0 background="d~e~f/bkg4.gif" 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";                        // 
//--------------
$os="";
$os1="";
$soob="";
if (isset ($_REQUEST['name'])) 
{$name=$_REQUEST['name'];}             //
else
{$name="";}
if (isset ($_REQUEST['name1']))       // 
{$name1=$_REQUEST['name1'];}  
else
{$name1="";}
$katw= getcwd ( ). '/ctext/';	     // 
if (isset ($_REQUEST['content']))    // 
{$content=trim($_REQUEST['content']);}
else
{$content=trim($_REQUEST['content']);}

if (isset ($_REQUEST['content1']))   // 
{$content1=trim($_REQUEST['content1']);}
else
{$content1=trim($_REQUEST['content1']);}
$mif=$katw.tr($name).".txt";
$mif1=$katw.tr($name1).".txt";

//***************************************************************
if (isset ($_REQUEST['delete']))   // 
//***************************************************************
{if ($name!="")
{if (file_exists ($mif))   
{unlink ($mif);
$soob= $name.": deleted!";
}}
else
{$soob= "No row selected! Click a line and repeat!";
}}
else
{if (isset ($_REQUEST['save']))                     //
{if ($name1!="" and $content1!="" )                 //
{if ($name==$name1 and $content==$content1)         //
{$soob=$name.": without changes !";
}
else if ($name==$name1 and $content!=$content1)      //
{ $w = fopen($mif, 'w+') or exit;
 fwrite($w,$content1);                               //
 fclose($w);                                         //
$soob=$name. ": changed Contents ";
}                                                     //
else if ($name!=$name1 and $content==$content1)       //
{if (file_exists ($mif))
{rename($mif,$mif1);	
$soob=$name1.": renaming '". $name."'=>'".$name1."'";
}}   
else if ($name!=$name1 and $content!=$content1)        // 
 // 
{if (file_exists ($mif1))                              //
 { $w = fopen($mif1, 'w') or exit; 
 $soob=$name.": changed content ";
 }
else
{$w = fopen($mif1, 'w+') or exit;
$soob=$name1.": added "; 
}
 fwrite($w,$content1);                               //
 fclose($w);                                         //
  }
}
else
{$soob=$name.": no changes !"; }
}}
?>
<b style=color:red>WEBSITE:</b> <b  id=sname2>
<?php
include "plan/name.txt";
echo '</b>';
?>
<table border=0 width=100% height=50>
<tr><td align=center ><b><big>GLOBAL TEXT VARIABLES</big></b>
<b>Ascending</b>&nbsp;<img id=ksort onclick=izs(this) src=d~e~f/yes.gif 
title="SORT BY ASCENDING: Mark me, click the title text in the header; DESCENDING: Dump me, click the heading in the header;">
&nbsp;&nbsp;&nbsp;<button form="" title="To begin" onclick=tnd(0) style="background:white">&nbsp;&#8593;&nbsp;</button>&nbsp;&nbsp
<button form="" style="background:white" onclick=tnd(9999999) title="To end">&nbsp;&#8595;&nbsp;</button>
&nbsp;&nbsp;&nbsp;<button form="" style="background:white" onclick=ptab() title="In a separate window for printing">&nbsp;P&nbsp;</button>
<center>
<b>Filter by <b id=zs>?</b> and by context </b>
<input type="text" id=goto size="30" title="One or more context values, separated by '/'.">
<button form="" onclick=got(0) 
title="Show only those rows that contain context anywhere in the text of the selected column.">
&nbsp;Select&nbsp;&nbsp;</button>&nbsp;&nbsp;&nbsp;
<button form="" onclick=got(2) 
title="Cancel selection">&nbsp;Cancel&nbsp;</button>
</center>
<center><b id=soob style="color:brown">
<?php
echo $soob."&nbsp;";
?>
</b></center>
</td></tr></table>

<table id=zag height=10% width=100% border=1 >
<tr onclick=clz(this,event) id=sort  >
<TH id=z1 lang=0>N</TH>
<TH id=z2 lang=1>Name</TH>
<TH id=z3 lang=2>Value</TH>
</tr>
<tr onclick=clz(this,event) id=sel >
<TH align=center >1</TH>
<TH align=center >2</TH>
<TH align=center >3</TH>
</tr>

<tr><td width=100% height=50% valign=top colspan=3>
<div id=k onclick="v(this,event)"  style="WIDTH: 100%; OVERFLOW: scroll;background:white">
<TABLE  id=tab2 border=1 width=100% >
<TBODY>
<?php
$dr=" .txt.htm.html";                   //
$_pohtm="ctext";
$fes =scandir($_pohtm);	                //
$i=1;
 foreach ($fes as $val) 				//
 {if ($val != "." && $val != "..")  	//
  {if  (!strstr($val, '.'))             //
  {}
  else
  {  list($s1, $s2) = explode(".",$val);
  if (strpos($dr,".".$s2)>0)
{echo '<tr  title="'.$val.'"><TD width=70px>'.$i++.'</TD><TD width=150px>'.rtr(str_replace (".txt","",$val)).'</TD><td>';
  include "ctext/".$val;
  echo '</td></tr>';	
}
else
{}
}}
}
?>
</TBODY></TABLE>
</div>
</td></tr>
<tr><td valign=top colspan=3>
<form id="form" action="tc.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="name" id="name"   rows=1 value="">
<input type="hidden" name="content" id="content"   rows=3 value="">
<center>
<b>Name:</b> <input type="text" name="name1" id="name1" size=30 value=""> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b>EDIT FIELDS:</b> &nbsp;&nbsp;&nbsp;
<b>Value:</b>&nbsp;&nbsp;&nbsp;
<button form="" title="Cleaning edit fields" onclick=era()>Cleaning</button><br>
<textarea type="text" name="content1" id="content1" rows=6 cols=120  value=""></textarea>
</center>
<center>
<input  type="submit" value="save"  name="save" id="save" style="display:none">
<button form="" onclick=timeb(2) 
title="Save new text variable or changes to old variable.">
&nbsp;Save&nbsp;&nbsp;</button>
<input  type="submit" style="display:none" name="delete" id="delete" >
&nbsp;&nbsp;&nbsp;
<button form="" onclick=timeb(1) 
title="Remove text variable.">
&nbsp;Delete&nbsp;&nbsp;</button>
&nbsp;&nbsp;&nbsp;

<small>Click a cell to select a row and a column; click the column text in the header to sort.</small>
</center>
</td></tr></table>
</form>
</body>


<script type="text/javascript">
//*********************************************************************************
window.onload=function () // 
//*******************************************************************************
{obj9= document.getElementById("tab2")
mobj9=obj9.getElementsByTagName("TR")[0].getElementsByTagName("TD")
document.getElementById("z1").style.width=mobj9[0].offsetWidth+"px"
document.getElementById("z2").style.width=(parseInt(mobj9[1].offsetWidth,10)-15)+"px"
document.getElementById("z3").style.width=(parseInt(mobj9[2].offsetWidth,10)-15)+"px"
document.getElementById("k").style.height=parseInt(document.getElementById("ppp").offsetHeight,10)-320
da=false
if (document.getElementById("soob").innerHTML!="")     //
{
nam=document.getElementById("soob").innerHTML.split(":")[0]
nam=nam.replace(/(^\s*)|(\s*)$/g, '')  
mk=document.getElementById("k").getElementsByTagName("TR")   //
for (var j2 = 0; j2 <= mk.length-1; j2++)
{mmk=mk[j2].getElementsByTagName("TD") 
if (mmk[1].innerHTML==nam)
{da=true 
break
}}
if (da)                                                       //
{
document.getElementById("k").scrollTop=mmk[1].offsetTop      // 
mmk[1].click()                                                //
}
}






}
//***************************************************************
function timeb(p)  //
//**************************************************************
{if (p==1)  //
//*********************************
{if (document.getElementById("name1").value=="")
{alert("The line to delete is not selected! \r\n Click the line to be deleted and repeat!")
return
}
if (!confirm("The variable will be permanently deleted, \r\n sure you want this? \r\n Think and decide."))
{return}
else
{document.getElementById("delete").click()    //
}}
if (p==2)                                      //
//******************************
{if (objj!="")      // 
{mobjj=objj.parentNode.getElementsByTagName("TD")
if (document.getElementById("name1").value==mobjj[1].innerHTML && 
document.getElementById("content1").value==mobjj[2].innerHTML)
{alert("No change!")
return
}}
if (document.getElementById("name1").value!=document.getElementById("name").value) //
{mkk=document.getElementById("name1").value
mk=document.getElementById("k").getElementsByTagName("TR")   //
for (var j2 = 0; j2 <= mk.length-1; j2++)
{mk2=mk[j2].getElementsByTagName("TD")                       //
if (mkk==mk2[1].innerHTML)                                   //
{alert("No change possible! \r\nSuch variable already exists! \r\nClick the line with this variable and repeat. ")
return
}}}
if (document.getElementById("name1").value=="" || document.getElementById("content1").value=="")
{alert("No data entered!")
return
}
mmm=document.getElementById("name1").value    //
document.getElementById("name1").value=mmm.replace(/(^\s*)|(\s*)$/g, '')  

ks=' (),_¸1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM'
mnum=document.getElementById("name1").value.split("")
nedop=""
for (var j = 0; j <= mnum.length-1; j++)
{if (ks.indexOf(mnum[j])<0)
{nedop=nedop+" "+mnum[j]}
}
if (nedop!="")
{alert("Invalid characters in 'Name': "+nedop)
return
}

ktag=document.getElementById("content1").value
if (!code_check("<div>"+ktag+"</div>"))      // 
{return}	



document.getElementById("save").click()
}}
//*******************************************************************************
function era()   //
//*******************************************************************************
{
document.getElementById("name1").value=""
document.getElementById("content1").value=""
document.getElementById("name").value=""
document.getElementById("content").value=""

if (objj!="")
 {objj.style.background=""
}
}
obj1=k
objj=""

//********************************************************************************
function v(p,event) // 
//********************************************************************************
{event = event || window.event
var t = event.target || event.srcElement
for(var j = 0; j <10 ; j++)
{if (t.tagName=="TD")
{if (t.parentNode.parentNode.parentNode.id!="tab2")  //
{return}
break}	
t=t.parentNode
}
 mt=t.parentNode.getElementsByTagName("TD")
 document.getElementById("name").value=mt[1].innerHTML
 document.getElementById("content").value=mt[2].innerHTML
 document.getElementById("name1").value=mt[1].innerHTML
 document.getElementById("content1").value=mt[2].innerHTML
if (objj!="")
 {objj.style.background=""
 }
 t.style.background="yellow"
 objj=t
}
//****************************************************
function tnd(p) //
//***************************************************
{document.getElementById('k').scrollTop=p}
//****************************************************
function izs(p)   //
//****************************************************
{if (p.src.indexOf('no.gif')>0) 
{p.src='d~e~f/yes.gif'}
else
{p.src='d~e~f/no.gif' }}
objsort=""
objselect=""
isort="no"

//*******************************************************************************************************
function clz(p,event) //
//*******************************************************************************************************
{ev = event || window.event
var t = ev.target || ev.srcElement
if (t.tagName!="TH") return
if (t.parentNode.id=="sort")                       //
{if (objsort!="")                                  //
{
if (t.style.background.indexOf("yellow")>=0)      //
{sort2(3)
return
}
objsort.style.background=""
objsort.style.color=""
}
if (objj!="")
{objj.style.background=""
objj=""
 }



isort=t.lang
t.style.background="yellow"
t.style.color="brown"
objsort=t
if (document.getElementById("ksort").src.indexOf('no.gif')>0)
{sort2(2)}
else
{sort2(1)}
objsort=t
}
else if (t.parentNode.id=="sel")            //
{if (objselect!="")                         //
{objselect.style.background=""
objselect.style.color=""}
t.style.background="yellow"
t.style.color="brown"
document.getElementById("zs").innerHTML=t.innerHTML
objselect=t
document.getElementById("soob").innerHTML="Column "+ t.innerHTML +" for filter is selected."
}
else
{return}
}
//********************************************************
function sort2(p)  // 
//********************************************************
{
var mss = new Array();        // 
is=isort                       //
document.getElementById("soob").innerHTML="Sorting!"
if (p==3)     // 
{p=1
is=0
isort="no"
if (objsort!="")                         //
{objsort.style.background=""
objsort.style.color=""}
document.getElementById("soob").innerHTML="Sorting canceled."
}

mas=document.getElementById("tab2").getElementsByTagName("TR")
if (is==0)                      // 
{for(var j = 0; j <mas.length ; j++)
{mas2=mas[j].getElementsByTagName("TD")
tt=mas2[0].innerHTML
tt2="0000000"+tt
tt2=tt2.substr(parseInt(tt.length))
mss[j]=tt2+"#"+(j)
}}
else
{
for(var j = 0; j <mas.length ; j++)
{mas2=mas[j].getElementsByTagName("TD")
tt= mas2[is].innerHTML
tt=tt.substr(0,10)
tt2=tt+"0000000"
tt2=tt2.substr(0,parseInt(tt.length))
mss[j]=tt2+"#"+(j)
}}
mss=mss.sort()
mtr="<table border=1 id=tab2 width=100%>"
if (p==1)
{for(var j = 0; j < mas.length; j++)
{sss=mss[j].split("#")
iii=parseInt(sss[1])
mtr=mtr+mas[iii].outerHTML
}}
else
{for(var j = mas.length-1; j>=0; j--)
{sss=mss[j].split("#")
iii=parseInt(sss[1])
mtr=mtr+mas[iii].outerHTML
}}
document.getElementById("tab2").outerHTML=mtr+"</table>"
document.getElementById("name1").value=""
document.getElementById("content1").value=""
document.getElementById("name").value=""
document.getElementById("content").value=""
}

fi2=false     // 
//****************************************************************************************
function got(p)   // 
//****************************************************************************************
{if (p==2 &&  !fi2)
{return	}	
mtr2=document.getElementById("k").getElementsByTagName("TR")  //
if (p==2)
{for(var j = 0; j <= mtr2.length-1; j++)
{mmtr2=mtr2[j].getElementsByTagName("TD")
mtr2[j].style.display=""
}
fi2=false	
document.getElementById("soob").innerHTML="Filter canceled!"
return
}
if (document.getElementById("goto").value=="" && p==0)
{alert("Enter the filter context!")	
return}
if (document.getElementById("zs").innerHTML=="?")
{alert("No column selection! Click the desired column in the table!")
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
}}


// 
fi=parseInt(document.getElementById("zs").innerHTML,10)-1
// 
if (objj!="")
{objj.style.background=""
objj=""
}
for(var j = 0; j <= mtr2.length-1; j++)
{mmtr2=mtr2[j].getElementsByTagName("TD")
if (fi==3)
{text2=mmtr2[3].getElementsByTagName("A")[0].innerHTML	
}
else
{text2=mmtr2[fi].innerHTML}
fi2=true
for(var jj = 0; jj <= mkont.length-1; jj++)
{if (fi!=0)
{if (text2.indexOf(mkont[jj])>=0)
{mtr2[j].style.display="";break}
else
{mtr2[j].style.display="none"
}}
else
{if (text2==mkont[jj])
{mtr2[j].style.display="";break}
else
{mtr2[j].style.display="none"
}}}}
document.getElementById("soob").innerHTML="Filtering!"
}

//********************************************************************
function ptab() //
//********************************************************************
{
newstr2="<b>Website: </b>"+document.getElementById("sname2").innerHTML
newstr2=newstr2+"<h2 style='text-align:center'>Global text variables</h2>"
is=""
if (isort!="no")
{if (document.getElementById("ksort").src.indexOf("yes.gif")>0)
{is="  sort by column N "+(parseInt(isort,10)+1)+ " ascending "
}
else
{is=" sort by column N "+(parseInt(isort,10)+1)+" descending"
}}
if (fi2)
{newstr2=newstr2+ "Filter by '"+
document.getElementById("goto").value+"' in "+document.getElementById("zs").innerHTML+ is 
}
else
{newstr2=newstr2+is
}
mstr=document.getElementById("tab2").getElementsByTagName("TR")
newstr2=newstr2+"<table width=100% border=1><tr><th>N</th><th>Name</th><th>Value</th></tr><tr><th>1</th><th>2</th><th>3</th></tr>"
for(var j = 0; j <mstr.length; j++)  
{
if (mstr[j].style.display!="none")
{
newstr=""
mstrtd=mstr[j].getElementsByTagName("TD")
newstr=newstr+"<tr><td>"+mstrtd[0].innerHTML+"</td>"
newstr=newstr+"<td>"+mstrtd[1].innerHTML+"</td>"
newstr=newstr+"<td>"+mstrtd[2].innerHTML+"</td></tr>"
newstr2=newstr2+newstr
}}
newstr2=newstr2+"</table>"
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>
<script src="code_check.js"></script>    
</html>