<?php
/*  
 * SAMS (Squid Account Management System)
 * Author: Dmitry Chemerik chemerik@mail.ru
 * (see the file 'main.php' for license details)
 */


function RemoveCache()
{
  global $SAMSConf;
  $DB=new SAMSDB("$SAMSConf->DB_ENGINE", $SAMSConf->ODBC, $SAMSConf->DB_SERVER, $SAMSConf->DB_USER, $SAMSConf->DB_PASSWORD, $SAMSConf->SAMSDB, $SAMSConf->PDO);
  $DB2=new SAMSDB("$SAMSConf->DB_ENGINE", $SAMSConf->ODBC, $SAMSConf->DB_SERVER, $SAMSConf->DB_USER, $SAMSConf->DB_PASSWORD, $SAMSConf->SAMSDB, $SAMSConf->PDO);
 if(isset($_GET["cache"])) $cache=$_GET["cache"];
  
  $num_rows=$DB->samsdb_query_value("SELECT * FROM proxy ");
  while($row=$DB->samsdb_fetch_array())
     {
        $id=$row['s_proxy_id'];
	if($cache[$id]=="on")
	  {
            $DB2->samsdb_query("DELETE FROM $SAMSConf->SAMSDB.proxy WHERE s_proxy_id=\"$id\" ");
          }
    }
  print("<SCRIPT>\n");
  print("  parent.basefrm.location.href=\"main.php?show=exe&function=cacheform&filename=squidbuttom_4_addcache.php\"; \n");
  print("  parent.lframe.location.href=\"lframe.php\";\n");
  print("</SCRIPT> \n");
}

function AddCache()
{
  global $SAMSConf;
  $DB=new SAMSDB("$SAMSConf->DB_ENGINE", $SAMSConf->ODBC, $SAMSConf->DB_SERVER, $SAMSConf->DB_USER, $SAMSConf->DB_PASSWORD, $SAMSConf->SAMSDB, $SAMSConf->PDO);

$delaypool=0;
$ntlmdomain=0;
$bigdomain=0;
$bigusername=0;
$parser_on=0;
$parser_time=1;
$count_clean=0;
$sleep=1;
$nameencode=0;
$checkdns=0;
$loglevel=0;
$squidbase=0;
$parser=0;
$adminaddr="root@localhost";

  if(isset($_GET["description"])) $description=$_GET["description"];
  if(isset($_GET["delaypool"])) $delaypool=SetCheckBoxValue($_GET["delaypool"]);
  if(isset($_GET["redirect_to"])) $redirect_to=$_GET["redirect_to"];
  if(isset($_GET["denied_to"])) $denied_to=$_GET["denied_to"];
  if(isset($_GET["redirector"])) $redirector=$_GET["redirector"];
  if(isset($_GET["auth"])) $auth=$_GET["auth"];
  if(isset($_GET["wbinfopath"])) $wbinfopath=$_GET["wbinfopath"];
  if(isset($_GET["ntlmdomain"])) $ntlmdomain=SetCheckBoxValue($_GET["ntlmdomain"]);
  if(isset($_GET["bigdomain"])) $bigdomain=SetCheckBoxValue($_GET["bigdomain"]);
  if(isset($_GET["bigusername"])) $bigusername=SetCheckBoxValue($_GET["bigusername"]);
  if(isset($_GET["parser_on"])) $parser_on=SetCheckBoxValue($_GET["parser_on"]);
  if(isset($_GET["parser"])) $parser=$_GET["parser"];
  if(isset($_GET["parser_time"])) $parser_time=$_GET["parser_time"];
  if(isset($_GET["count_clean"])) $count_clean=SetCheckBoxValue($_GET["count_clean"]);
  if(isset($_GET["sleep"])) $sleep=$_GET["sleep"];
  if(isset($_GET["nameencode"])) $nameencode=SetCheckBoxValue($_GET["nameencode"]);
  if(isset($_GET["traffic"])) $traffic=$_GET["traffic"];
  if(isset($_GET["checkdns"])) $checkdns=SetCheckBoxValue($_GET["checkdns"]);
  if(isset($_GET["loglevel"])) $loglevel=$_GET["loglevel"];
  if(isset($_GET["at"])) $at=SetCheckBoxValue($_GET["at"]);
  if(isset($_GET["slashe"])) $slashe=SetCheckBoxValue($_GET["slashe"]);
  if(isset($_GET["plus"])) $plus=SetCheckBoxValue($_GET["plus"]);
  if(isset($_GET["defaultdomain"])) $defaultdomain=$_GET["defaultdomain"];
  if(isset($_GET["squidbase"])) $squidbase=SetCheckBoxValue($_GET["squidbase"]);
  if(isset($_GET["udscript"])) $udscript=$_GET["udscript"];
  if(isset($_GET["adminaddr"])) $adminaddr=$_GET["adminaddr"];
  if(isset($_GET["kbsize"])) $kbsize=$_GET["kbsize"];
  if(isset($_GET["mbsize"])) $mbsize=$_GET["mbsize"];
  
  $lang="./lang/lang.$SAMSConf->LANG";
  require($lang);

   if($SAMSConf->access!=2)     {       exit;     }

  if($at==1)    { $at="@"; }
  if($slashe==1)   {  $slashe="\\"; }
  if($plus==1)    { $plus="+"; }

	$query = "INSERT INTO proxy ( s_description) VALUES ( '$description' ) ";
	$DB->samsdb_query($query);
	$query = "UPDATE proxy SET  s_endvalue='0', s_redirect_to='$redirect_to', s_denied_to='$denied_to', s_redirector='$redirector', s_delaypool='$delaypool', s_auth='$auth', s_wbinfopath='$wbinfopath', s_separator='0$plus$at$slashe$slashe', s_usedomain='$ntlmdomain', s_bigd='$bigdomain', s_bigu='$bigusername', s_sleep='$sleep', s_parser='$parser', s_parser_time='$parser_time', s_count_clean='$count_clean', s_nameencode='$nameencode', s_realsize='$traffic', s_checkdns='$checkdns', s_debuglevel='$loglevel', s_defaultdomain='workgroup', s_squidbase='$squidbase', s_udscript='$udscript', s_adminaddr='$adminaddr', s_kbsize='$kbsize', s_mbsize='$mbsize' WHERE s_description='$description' ";
//echo "$query<BR>";
	$DB->samsdb_query($query);

     //    UpdateLog("$SAMSConf->adminname","Added SQUID-cache $description ","01");
  print("<SCRIPT>\n");
  print("  parent.basefrm.location.href=\"main.php?show=exe&function=cacheform&filename=squidbuttom_4_addcache.php\"; \n");
  print("</SCRIPT> \n");
}

 
 
function CacheForm()
{
  global $SAMSConf;
  $DB=new SAMSDB($SAMSConf->DB_ENGINE, $SAMSConf->ODBC, $SAMSConf->DB_SERVER, $SAMSConf->DB_USER, $SAMSConf->DB_PASSWORD, $SAMSConf->SAMSDB, $SAMSConf->PDO);
  $lang="./lang/lang.$SAMSConf->LANG";
  require($lang);

  if($SAMSConf->access==2)
    {
      PageTop("proxyes_48.jpg","$CacheForm_squidbuttom_4_addcache_1");
      //print("<H2>$CacheForm_squidbuttom_4_addcache_1</H2>\n");
/*
      print("<FORM NAME=\"cacheform\" ACTION=\"main.php\">\n");
      print("<INPUT TYPE=\"HIDDEN\" NAME=\"show\" value=\"exe\">\n");
      print("<INPUT TYPE=\"HIDDEN\" NAME=\"function\" value=\"removecache\">\n");
      print("<INPUT TYPE=\"HIDDEN\" NAME=\"filename\" id=filename value=\"squidbuttom_4_addcache.php\">\n");
      print("<TABLE CLASS=samstable WIDTH=\"80%\">");
      print("<TH width=20%>$CacheForm_squidbuttom_4_addcache_2");
      print("<TH width=60%>$CacheForm_squidbuttom_4_addcache_3");
      print("<TH width=20%>$CacheForm_squidbuttom_4_addcache_4");
      $num_rows=$DB->samsdb_query_value("SELECT s_proxy_id,s_description FROM proxy ORDER BY s_proxy_id");
       while($row=$DB->samsdb_fetch_array())
           {
             print("<TR><TD>$row[s_proxy_id]<TD> $row[s_description]");
              print("<TD><INPUT TYPE=\"CHECKBOX\" NAME=cache[$row[s_proxy_id]]> \n");
           }
      print("</TABLE>");
      print("<INPUT TYPE=\"SUBMIT\" value=\"$CacheForm_squidbuttom_4_addcache_5\" >\n");
      print("</FORM>\n");
*/  

           print("<SCRIPT LANGUAGE=JAVASCRIPT>\n");
           print("function EnableCheckBox(formname)\n");
           print("{\n");
           print("    formname.ntlmdomain.disabled=false; \n");
           print("    formname.bigdomain.disabled=false; \n");
           print("    formname.bigusername.disabled=false; \n");
           print("    formname.nameencode.disabled=false; \n");
           print("    formname.testpdc.disabled=false; \n");
           print("    formname.plus.disabled=false; \n");
           print("    formname.at.disabled=false; \n");
           print("    formname.slashe.disabled=false; \n");
//		   print("    document.getElementById('c1').innerHTML='YES'; ");
		   print("}\n");
           print("function DisableCheckBox(formname)\n");
           print("{\n");
           print("    formname.ntlmdomain.disabled=true; \n");
           print("    formname.bigdomain.disabled=true; \n");
           print("    formname.bigusername.disabled=true; \n");
           print("    formname.nameencode.disabled=true; \n");
           print("    formname.testpdc.disabled=true; \n");
           print("    formname.plus.disabled=true; \n");
           print("    formname.at.disabled=true; \n");
           print("    formname.slashe.disabled=true; \n");
           print("}\n");

	   print("function TestPDC(formname)\n");
           print("{\n");
           print("  if(formname.auth[0].checked==true)\n");
           print("    {\n");
           print("      window.open('main.php?show=exe&function=testpdc&filename=configbuttom_1_prop.php&auth=ntlm'); \n");
           print("    }\n");
           print("  if(formname.auth[1].checked==true)\n");
           print("    {\n");
           print("      window.open('main.php?show=exe&function=testpdc&filename=configbuttom_1_prop.php&auth=adld'); \n");
           print("    }\n");
           print("}\n");

           print("</SCRIPT>\n");


     print("<P>\n");
      print("<H2>$CacheForm_squidbuttom_4_addcache_6</H2>\n");
       print("<SCRIPT language=JAVASCRIPT>\n");
       print("function TestName(formname)\n");
       print("{\n");
       print("  var shablonname=formname.description.value; \n");
       print("  if(shablonname.length==0) \n");
       print("    {\n");
       print("       alert(\"$CacheForm_squidbuttom_4_addcache_9\");\n");
       print("       return false");
       print("    }\n");
       print("  return true");
       print("}\n");
       print("</SCRIPT> \n");
 
      print("<FORM NAME=\"ADDCACHE\" ACTION=\"main.php\" onsubmit=\"return TestName(ADDCACHE)\">\n");
      print("<INPUT TYPE=\"HIDDEN\" NAME=\"show\" id=Show value=\"exe\">\n");
      print("<INPUT TYPE=\"HIDDEN\" NAME=\"function\" id=function value=\"addcache\">\n");
      print("<INPUT TYPE=\"HIDDEN\" NAME=\"filename\" id=filename value=\"squidbuttom_4_addcache.php\">\n");
	print("<INPUT TYPE=\"SUBMIT\" value=\"$CacheForm_squidbuttom_4_addcache_8\" >\n");

	print("<TABLE CLASS=samstable WIDTH=\"90%\" BORDER=0>\n");

	print("<TR><TD><B>$CacheForm_squidbuttom_4_addcache_7:</B>\n");
	print("<TD><INPUT TYPE=\"TEXT\" NAME=\"description\" SIZE=30> \n");

	/*      Считать трафик: REAL/FULL     */
	print("<TR><TD><B>$adminbuttom_1_prop_SamsReConfigForm_46: </B>\n");
	print("<TD><SELECT NAME=\"traffic\">\n");
	print("<OPTION VALUE=\"full\"> $adminbuttom_1_prop_SamsReConfigForm_48");
	print("<OPTION VALUE=\"real\"> $adminbuttom_1_prop_SamsReConfigForm_47");
	print("</SELECT>\n");
	/*      Проверять DNS     */
	print("<TR bgcolor=blanchedalmond>\n");
	print("<TD><B>$adminbuttom_1_prop_SamsReConfigForm_49</B>\n");
	print("<TD><INPUT TYPE=\"CHECKBOX\" NAME=\"checkdns\" > \n");
	/*      Уровень логов     */
	print("<TR bgcolor=blanchedalmond>\n");
	print("<TD><B>$adminbuttom_1_prop_SamsReConfigForm_51</B>\n");
	print("<TD><SELECT NAME=\"loglevel\">\n");
	for($i=0;$i<10;$i++)
	  {
		if($row['loglevel']==$i)
			print("<OPTION VALUE=\"$i\" SELECTED> $i");
		else    
			print("<OPTION VALUE=\"$i\"> $i");
	  }
	print("</SELECT>\n");
	/*     Домен по-умолчанию     */
	print("<TR bgcolor=blanchedalmond>\n");
	print("<TD><B>$adminbuttom_1_prop_SamsReConfigForm_52</B>\n");
	print("<TD><INPUT TYPE=\"TEXT\" NAME=\"defaultdomain\" value=\"$row[defaultdomain]\">\n");
            
	$scount=0;
	if ($handle2 = opendir("./src/script"))
        {
	  while (false !== ($file = readdir($handle2)))
            {
		if($file!="."&&$file!=".."&&$file!=".svn")
		  {
			       if(strlen($file)>0)
			         {
					$script[$scount]=$file;
					$scount++;
				}  

		  }
            }
        }
	/*     Скрипт, вызываемый при отключении пользователя     */
	print("<TR>\n");
	print("<TD><B>$configbuttom_1_prop_SamsReConfigForm_56</B>\n");
	print("<TD><SELECT NAME=\"udscript\" ID=\"udscript\" >\n");
	$SELECTED="";
	print("<OPTION VALUE=\"none\"> NONE\n");
	for($i=0;$i<$scount;$i++)
	{
		print("<OPTION VALUE=\"$script[$i]\"> $script[$i]\n");
	}
	print("</SELECT>\n");
	/*     Адрес администратора     */
	print("<TR bgcolor=blanchedalmond>\n");
	print("<TD><B>$configbuttom_1_prop_SamsReConfigForm_57</B>\n");
	print("<TD><INPUT TYPE=\"TEXT\" NAME=\"adminaddr\" value=\"root@localhost\">\n");
 
  print("<TR><TD><B>$webconfigbuttom_1_prop_WebInterfaceReConfigForm_7 (byte)</B>\n");
  print("<TD><INPUT TYPE=\"TEXT\" NAME=\"kbsize\" value=\"1024\">\n");
  print("<TR><TD><B>$webconfigbuttom_1_prop_WebInterfaceReConfigForm_8 (byte)</B>\n");
  print("<TD><INPUT TYPE=\"TEXT\" NAME=\"mbsize\" value=\"1048576\">\n");
 
	print("</TABLE>\n");


     
	//********* Авторизация пользователя  **************************
	print("<P><B>$adminbuttom_1_prop_SamsReConfigForm_17</B>\n");
  print("<TABLE WIDTH=\"90%\" BORDER=0 >\n");
  print("<TR><TD><B>$adminbuttom_1_prop_SamsReConfigForm_2</B><TD>\n");
  print("<TR bgcolor=blanchedalmond><TD VALIGN=TOP >");
  print("<INPUT TYPE=\"RADIO\" NAME=\"auth\" VALUE=\"ntlm\" onclick=EnableCheckBox(ADDCACHE) onchange=EnableDomainName(ADDCACHE)>\n");
  $sdomain="";
  $suser="";
  if($row['bigu']=="Y")            $suser="USER";
  if($row['bigu']=="S")            $suser="user";
  if($row['bigu']=="N")            $suser="User";
  
  print("  <B>NTLM (</B>\n<B ID=\"DomainUser\"> $sdomain $suser");
  print("  </B>\n<B>)</B>\n");
  print("<BR><INPUT TYPE=\"RADIO\" NAME=\"auth\" VALUE=\"adld\" onclick=EnableCheckBox(ADDCACHE) onchange=EnableDomainName(ADDCACHE)>\n");
  print("  <B>Active Directory</B><BR>(Experimental)\n");
  
  print("<TD name=c1  ID=\"c1\">");
     print("<INPUT TYPE=\"CHECKBOX\" NAME=\"ntlmdomain\" DISABLED onchange=EnableDomainName(ADDCACHE)>$adminbuttom_1_prop_SamsReConfigForm_19\n");
  
  print("<BR><LI>$adminbuttom_1_prop_SamsReConfigForm_20 \n");
  print("<SELECT NAME=\"bigdomain\" DISABLED onchange=EnableDomainName(ADDCACHE)>\n");
            print("<OPTION VALUE=\"Y\">$adminbuttom_1_prop_SamsReConfigForm_20a</OPTION>\n");
            print("<OPTION VALUE=\"S\" >$adminbuttom_1_prop_SamsReConfigForm_20b</OPTION>\n");
            print("<OPTION VALUE=\"N\">$adminbuttom_1_prop_SamsReConfigForm_20c</OPTION>\n");
            print("<OPTION VALUE=\"A\" >$adminbuttom_1_prop_SamsReConfigForm_20a & $adminbuttom_1_prop_SamsReConfigForm_20b</OPTION>\n");
  print("</SELECT > $adminbuttom_1_prop_SamsReConfigForm_20d\n");

  print("<BR><LI>$adminbuttom_1_prop_SamsReConfigForm_22 \n");
  print("<SELECT NAME=\"bigusername\" DISABLED onchange=EnableDomainName(ADDCACHE)>\n");
            print("<OPTION VALUE=\"Y\">$adminbuttom_1_prop_SamsReConfigForm_20a</OPTION>\n");
            print("<OPTION VALUE=\"S\" >$adminbuttom_1_prop_SamsReConfigForm_20b</OPTION>\n");
            print("<OPTION VALUE=\"N\">$adminbuttom_1_prop_SamsReConfigForm_20c</OPTION>\n");
	print("</SELECT >$adminbuttom_1_prop_SamsReConfigForm_20d\n");
  
	print("<P><B> $adminbuttom_1_prop_SamsReConfigForm_50 </B>\n");
	print("<P><INPUT TYPE=\"CHECKBOX\" NAME=\"plus\" CHECKED DISABLED> <B>+</B>\n");
	print("<BR><INPUT TYPE=\"CHECKBOX\" NAME=\"slashe\" DISABLED> <B>\\</B> \n");
	print("<BR><INPUT TYPE=\"CHECKBOX\" NAME=\"at\"  DISABLED> <B>@</B> \n");
     

  
  print("<P >\n");
  print("<BR><INPUT TYPE=\"BUTTON\" NAME=\"testpdc\" VALUE=\"$adminbuttom_1_prop_SamsReConfigForm_39\" onclick=TestPDC(ADDCACHE) DISABLED>\n");

  print("<P><INPUT TYPE=\"CHECKBOX\" NAME=\"nameencode\" DISABLED >\n");

  print("$adminbuttom_1_prop_SamsReConfigForm_28");
  print("<BR>$adminbuttom_1_prop_SamsReConfigForm_29");
  print("<TR bgcolor=blanchedalmond><TD><INPUT TYPE=\"RADIO\" NAME=\"auth\" VALUE=\"ncsa\"  onclick=DisableCheckBox(ADDCACHE)><B>NCSA</B><TD>\n");
  print("<TR bgcolor=blanchedalmond><TD><INPUT TYPE=\"RADIO\" NAME=\"auth\" VALUE=\"ip\"  CHECKED  onclick=DisableCheckBox(ADDCACHE)><B>IP</B><TD>\n");
  print("</TABLE>\n");

       print("<SCRIPT LANGUAGE=JAVASCRIPT>\n");
       print("function EnableDomainName(formname) \n");
       print("{\n");
       print("  var domain='domain'; \n");
       print("  var user='user'; \n");
       print("  var enabled=formname.ntlmdomain.checked; \n");
       print("  var bigdomain=formname.bigdomain.value; \n");
       print("  var bigusername=formname.bigusername.value; \n");
       print("  if(bigdomain=='Y') \n");
       print("    {\n");
       print("       domain='DOMAIN'; \n");
       print("    }\n");
       print("  if(bigdomain=='N') \n");
       print("    {\n");
       print("       domain='Domain'; \n");
       print("    }\n");
       print("  if(bigusername=='Y') \n");
       print("    {\n");
       print("       user='USER'; \n");
       print("    }\n");
       print("  if(bigusername=='N') \n");
       print("    {\n");
       print("       user='User'; \n");
       print("    }\n");
       print("  if(enabled==true) \n");
       print("    {\n");
       print("       var domainuser=domain+'+'+user; \n");
       print("       document.getElementById('DomainUser').innerHTML=domainuser;  \n");
       print("    }\n");
       print("  else \n");
       print("    {\n");
       print("       document.getElementById('DomainUser').innerHTML=user;  \n");
       print("    }\n");
       print("}\n");

       print("function DisableDomainName() \n");
       print("{\n");
       print("  document.getElementById('DomainUser').innerHTML=\"1234qwer\";  \n");
       print("  output1.innerText=\"123\"; \n");
       print("}\n");
       print("</SCRIPT>\n");


//***********************************
	print("<TABLE WIDTH=\"90%\" BORDER=0>\n");
	print("<TR><TD>$adminbuttom_1_prop_SamsReConfigForm_24\n");
	print("<TR><TD> $adminbuttom_1_prop_SamsReConfigForm_25\n");
	print("<TR><TD><LI> $adminbuttom_1_prop_SamsReConfigForm_26\n");
	print("<TR><TD><LI> $adminbuttom_1_prop_SamsReConfigForm_27\n");

           print("<SCRIPT LANGUAGE=JAVASCRIPT>");
           print("function EnableParser(formname)");
           print("{");
           print("  var parser_on=formname.parser_on.checked; \n");
  	       print("  if(parser_on==true) \n");
           print("    {\n");
           print("      formname.parser.disabled=false; ");
           print("      formname.parser_time.disabled=false; ");
           print("      DisableParserTime(formname); ");
		   print("    }\n");
  	       print("  else \n");
           print("    {\n");
           print("      formname.parser.disabled=true; ");
           print("      formname.parser_time.disabled=true; ");
           print("    }\n");
           print("}\n");
           print("</SCRIPT>");


	print("<P>\n");
	print("<P><CENTER><B>$adminbuttom_1_prop_SamsReConfigForm_30</B></CENTER>\n");
	print("<TABLE WIDTH=\"90%\" BORDER=0 >\n");

	$SLEEP=1;
	print("<TR bgcolor=blanchedalmond><TD><B>$adminbuttom_1_prop_SamsReConfigForm_31 </B>\n");
	print("<TD><INPUT TYPE=\"TEXT\" NAME=\"sleep\" SIZE=5 VALUE=$SLEEP> $adminbuttom_1_prop_SamsReConfigForm_32\n");

	print("<TR bgcolor=blanchedalmond>\n");
	print("<TD><B>$adminbuttom_1_prop_SamsReConfigForm_38</B>\n");
	print("<TD><INPUT TYPE=\"CHECKBOX\" NAME=\"parser_on\" CHECKED onchange=EnableParser(ADDCACHE)>\n");

	print("<TR bgcolor=blanchedalmond><TD ALIGN=\"RIGHT\"><B> $adminbuttom_1_prop_SamsReConfigForm_40</B>\n");
	print("<TD><SELECT NAME=\"parser\" $DISABLED_PARSER  onchange=DisableParserTime(ADDCACHE)>\n");
	//Disable discret parser (#239)
	//print("<OPTION VALUE=\"1\" SELECTED >  $adminbuttom_1_prop_SamsReConfigForm_34\n");
	print("<OPTION VALUE=\"2\" >  $adminbuttom_1_prop_SamsReConfigForm_33\n");
	print("</SELECT>\n");

	$time=1;

	print("<TR bgcolor=blanchedalmond><TD ALIGN=\"RIGHT\"><B>$adminbuttom_1_prop_SamsReConfigForm_35 </B>\n");
	print("<TD><INPUT TYPE=\"TEXT\" NAME=\"parser_time\" SIZE=5 VALUE=\"$time\" > $adminbuttom_1_prop_SamsReConfigForm_36\n");

	print("<TR bgcolor=blanchedalmond><TD><B>$adminbuttom_1_prop_SamsReConfigForm_37 </B>\n");
	print("<TD><INPUT TYPE=\"CHECKBOX\" NAME=\"count_clean\" CHECKED >\n");

	print("</TABLE >\n");

           print("<SCRIPT LANGUAGE=JAVASCRIPT> \n");
           print("function DisableParserTime(formname) \n");
           print("{ \n");
           print("  var parser_on=formname.parser.value; \n");
  	       print("  if(parser_on==\"0\") \n");
           print("    {\n");
           print("      formname.parser_time.disabled=false;  \n");
           print("    }\n");
  	       print("  else \n");
           print("    {\n");
           print("      formname.parser_time.disabled=true;  \n");
           print("    }\n");
           print("}\n");
           print("</SCRIPT> \n");






	print("<P><TABLE WIDTH=\"90%\" BORDER=0 >\n");
	print("<TR bgcolor=blanchedalmond>\n");
	print("<TD><B>$adminbuttom_1_prop_SamsReConfigForm_3</B>\n");
	print("<TD><INPUT TYPE=\"TEXT\" NAME=\"wbinfopath\" SIZE=50 VALUE=\"/usr/bin\">\n");

	print("<TR bgcolor=blanchedalmond>\n");
	print("<TD><B>$adminbuttom_1_prop_SamsReConfigForm_4</B>\n");
	print("<TD><INPUT TYPE=\"TEXT\" NAME=\"redirect_to\" SIZE=50 VALUE=\"http://ip.addr/sams2/icon/classic/blank.gif\">\n");

	print("<TR bgcolor=blanchedalmond>\n");
	print("<TD><B>$adminbuttom_1_prop_SamsReConfigForm_5</B>\n");
	print("<TD><INPUT TYPE=\"TEXT\" NAME=\"denied_to\" SIZE=50 VALUE=\"http://ip.addr/sams2\"> \n");

	print("<TR bgcolor=blanchedalmond>\n");
	print("<TD><B>$adminbuttom_1_prop_SamsReConfigForm_6</B>\n");
	print("<TD><SELECT NAME=\"redirector\">\n");
	print("<OPTION VALUE=\"none\" > $adminbuttom_1_prop_SamsReConfigForm_43");
	print("<OPTION VALUE=\"sams\" > $adminbuttom_1_prop_SamsReConfigForm_7");
	print("<OPTION VALUE=\"rejik\"> Rejik");
	print("<OPTION VALUE=\"squidguard\"> SquidGuard");
	print("<OPTION VALUE=\"squid\"> $adminbuttom_1_prop_SamsReConfigForm_8");

	print("<TR bgcolor=blanchedalmond>\n");
	print("<TD><B>$adminbuttom_1_prop_SamsReConfigForm_9</B>\n");
	print("<TD><INPUT TYPE=\"CHECKBOX\" NAME=\"delaypool\" > \n");

	print("<TR bgcolor=blanchedalmond>\n");
	print("<TD><B>$configbuttom_1_prop_SamsReConfigForm_53</B>\n");
	print("<TD><SELECT NAME=\"squidbase\">\n");
	print("<OPTION VALUE=\"0\" $SELECTED> $configbuttom_1_prop_SamsReConfigForm_54");
	for($i=1;$i<=12;$i++)
	{
		$SELECTED="";
		print("<OPTION VALUE=\"$i\" > $i");
	} 
	print("</SELECT>\n");
	print("$configbuttom_1_prop_SamsReConfigForm_55\n");

  
  
  print("</TABLE>\n");







	print("<BR><INPUT TYPE=\"SUBMIT\" value=\"$CacheForm_squidbuttom_4_addcache_8\" >\n");
      print("</FORM>\n");

    
    }
}

 
function squidbuttom_4_addcache()
{
	global $SAMSConf;
	
	$lang="./lang/lang.$SAMSConf->LANG";
	 require($lang);
	
	$result = "";
	
	$SamsTools = new SamsTools();
	
	if($SAMSConf->access==2)
	{
		$result .= "<TD VALIGN=\"TOP\" WIDTH=\"10%\">\n";
		$result .= $SamsTools->GraphButton("main.php?module=Squid&function=cacheform&filename=squidbuttom_4_addcache.php","basefrm","proxyes_32.jpg","proxyes_48.jpg","$squidbuttom_4_addcache_squidbuttom_4_addcache_1");
	}
	
	return $result;
}
?>
