View file topotags.php

File size: 24.48Kb
<?php
//
//  topotags.php
//  rev006
//
include('config.php');
include('lang/'.$idioma.'.php');
include('funciones.php');

function generarPREVIEW($para1,$para2) {
    global $_Rank_, $_Webs_, $_INOUT_, $bloque1, $bloque2;
    global $_Average_, $_Comments_, $_IN_, $_OUT_, $_Ratio_, $_day_, $_votes_, $_DaysInTop_, $_RateIt_, $_Info_;
    $_Average_=strtoupper($_Average_);
    $_Comments_=strtoupper($_Comments_);
	$orden=orden("read",0);
	$plantilla=TOPoTags("read",$para1,0);
	$maxBannerAncho=$plantilla[7];
	$maxBannerAlto=$plantilla[8];
	$anchoWebs=500;
	if($anchoWebs<$maxBannerAncho+10) $anchoWebs=$maxBannerAncho+10;

    $top[1]='<table align="center" border="0" bgcolor="Black" cellspacing="1" cellpadding="2">';
    $top[1].='<tr align="center" class="2"><td class="texto1">'.$_Rank_.'</td>';
    $top[1].='<td class="texto1" width="'.$anchoWebs.'">'.$_Webs_.'</td>';
    $top[1].='<td class="texto1">'.$_INOUT_.'</td></tr>';
    for($i=1;$i<=$bloque1;$i++) {   //Cуdigo HTML para top1.htm
		if(!isset($orden[$i])) break;
        $datos=datos("read",$orden[$i],0);
        include("data/".$orden[$i]."info.php");
        //Cбlculos previos
        if($datos[5]) {
            $nota=number_format($datos[4]/$datos[5],1,'.','');
        } else {
            $nota=0;
        }
        $dif=rand(-2,2);
        if($dif>0) $flecha='<img src="gif/arrow_green.gif" border="0" width="15" height="20"><font color="green">+'.$dif.'</font>';
        if($dif<0) $flecha='<img src="gif/arrow_red.gif" border="0" width="15" height="20"><font color="red">'.$dif.'</font>';
        if($dif==0) $flecha='<span style="{font-size:15pt; color:blue; font-weight:bold;}">=</span>';
		if(strlen($bannerURL)>10) {
			$bannerAncho=string("int",$bannerAncho,$maxBannerAncho);
			$bannerAlto=string("int",$bannerAlto,$maxBannerAlto);
			$bannerAUX='<A href="out.php?ID='.$orden[$i].'" target="_blank" onMouseover="window.status=\''.$webURL.'\'; return true;" onMouseout="window.status=\'\'; return true;"><img src="'.$bannerURL.'" border="0" width="'.$bannerAncho.'" height="'.$bannerAlto.'"></A>';
		} else {
			$bannerAUX="";
		}
		//TOPoTags
		$old[0]='%%RANK%%';			$new[0]=$i;
		$old[1]='%%RANKARROW%%';	$new[1]=$flecha;
		$old[2]='%%BGCOLOR%%';		$new[2]='class="'.($i%2).'"';
		$old[3]='%%BANNER%%';		$new[3]=$bannerAUX;
		$old[4]='%%WEB%%';			$new[4]='<A href="out.php?ID='.$orden[$i].'" target="_blank" onMouseover="window.status=\''.$webURL.'\'; return true;" onMouseout="window.status=\'\'; return true;">'.$web.'</A>';
		$old[5]='%%DESCRIPTION%%';	$new[5]=$descripcion;
		$old[6]='%%STARS%%';		$new[6]='<img src="gif/star'.number_format($nota,0,'.','').'.gif" border="0">';
		$old[7]='%%AVERAGE1%%';		$new[7]=$nota;		
		$old[8]='%%AVERAGE2%%';		$new[8]=$nota.' <i>('.$datos[5].' '.$_votes_.')</i>';		
		$old[9]='%%AVERAGE3%%';		$new[9]='<b>'.$_Average_.':</b> '.$new[8];
		$old[10]='%%COMMENTS%%';	$new[10]='<b>'.$_Comments_.':</b> '.$datos[6];
		$old[11]='%%RATEIT%%';		$new[11]='<INPUT TYPE="BUTTON" class="miniboton" value="'.$_RateIt_.'" onClick="ventana(\'info.php?ID='.$orden[$i].'&modo=puntuar&paso=1\',\'_blank\',300,150)">';
		$old[12]='%%INFO%%';		$new[12]='<INPUT TYPE="BUTTON" class="miniboton" value="'.$_Info_.'" onClick="ventana(\'info.php?ID='.$orden[$i].'\',\'_blank\',560,425)">';
		$old[13]='%%IN%%';			$new[13]=$_IN_;		
		$old[14]='%%IN1%%';			$new[14]='<span class="in">'.$datos[0].'</span>';
		$old[15]='%%IN2%%';			$new[15]='<span class="in">'.$datos[2].'</span>';				
		$old[16]='%%IN3%%';			$new[16]='<span class="in">'.media("pordia",$orden[$i],time(),$datos[2]).'/'.$_day_.'</span>';
		$old[17]='%%OUT%%';			$new[17]=$_OUT_;		
		$old[18]='%%OUT1%%';		$new[18]='<span class="out">'.$datos[1].'</span>';
		$old[19]='%%OUT2%%';		$new[19]='<span class="out">'.$datos[3].'</span>';				
		$old[20]='%%OUT3%%';		$new[20]='<span class="out">'.media("pordia",$orden[$i],time(),$datos[3]).'/'.$_day_.'</span>';
		$old[21]='%%DAYS%%';		$new[21]='<i>'.media("dias",time(),$orden[$i],0).$_DaysInTop_.'</i>';
		$old[22]='%%RATIO1%%';		$new[22]=barra("ratio",100,$datos[0],$datos[1]);		
		$old[23]='%%RATIO2%%';		$new[23]='<b>'.$_Ratio_.':</b> '.barra("ratio",100,$datos[0],$datos[1]);
		//Plantilla
		$RANK=str_replace($old,$new,$plantilla[1]);
		$WEBS=str_replace($old,$new,$plantilla[2]);
		$INOUT=str_replace($old,$new,$plantilla[3]);				
		//Tablas estructurales
        $top[1].='<TR class="'.($i%2).'">';
        $top[1].='<TD class="texto0" valign="middle">'.$RANK.'</TD>';
        $top[1].='<TD valign="middle" width="'.$anchoWebs.'">'.$WEBS.'</TD>';
        $top[1].='<TD class="minitexto0" valign="middle">'.$INOUT.'</TD>';
		$top[1].='</TR>';
    }
    $top[1].='</table>';

    $top[2]='<br><hr width="60%"><br><table align="center" border="0" bgcolor="Black" cellspacing="1" cellpadding="2">';
    $top[2].='<tr align="center" class="2"><td class="texto1">'.$_Rank_.'</td>';
    $top[2].='<td class="texto1" width="'.$anchoWebs.'">'.$_Webs_.'</td>';
    $top[2].='<td class="texto1">'.$_INOUT_.'</td></tr>';
    for($i=$bloque1+1;$i<=$bloque1+$bloque2;$i++) {   //Cуdigo HTML para top2.htm	
		if(!isset($orden[$i])) break;
        $datos=datos("read",$orden[$i],0);
        include("data/".$orden[$i]."info.php");
        //Cбlculos previos
        if($datos[5]) {
            $nota=number_format($datos[4]/$datos[5],1,'.','');
        } else {
            $nota=0;
        }
        $dif=rand(-2,2);
        if($dif>0) $flecha='<img src="gif/arrow_green.gif" border="0" width="15" height="20"><font color="green">+'.$dif.'</font>';
        if($dif<0) $flecha='<img src="gif/arrow_red.gif" border="0" width="15" height="20"><font color="red">'.$dif.'</font>';
        if($dif==0) $flecha='<span style="{font-size:15pt; color:blue; font-weight:bold;}">=</span>';
		if(strlen($bannerURL)>10) {
			$bannerAncho=string("int",$bannerAncho,$maxBannerAncho);
			$bannerAlto=string("int",$bannerAlto,$maxBannerAlto);
			$bannerAUX='<A href="out.php?ID='.$orden[$i].'" target="_blank" onMouseover="window.status=\''.$webURL.'\'; return true;" onMouseout="window.status=\'\'; return true;"><img src="'.$bannerURL.'" border="0" width="'.$bannerAncho.'" height="'.$bannerAlto.'"></A>';
		} else {
			$bannerAUX="";
		}
		//TOPoTags
		$old[0]='%%RANK%%';			$new[0]=$i;
		$old[1]='%%RANKARROW%%';	$new[1]=$flecha;
		$old[2]='%%BGCOLOR%%';		$new[2]='class="'.($i%2).'"';
		//$old[3]='%%BANNER%%';		$new[3]=$bannerAUX;
		$old[4]='%%WEB%%';			$new[4]='<A href="out.php?ID='.$orden[$i].'" target="_blank" onMouseover="window.status=\''.$webURL.'\'; return true;" onMouseout="window.status=\'\'; return true;">'.$web.'</A>';
		$old[5]='%%DESCRIPTION%%';	$new[5]=$descripcion;
		$old[6]='%%STARS%%';		$new[6]='<img src="gif/star'.number_format($nota,0,'.','').'.gif" border="0">';
		$old[7]='%%AVERAGE1%%';		$new[7]=$nota;		
		$old[8]='%%AVERAGE2%%';		$new[8]=$nota.' <i>('.$datos[5].' '.$_votes_.')</i>';		
		$old[9]='%%AVERAGE3%%';		$new[9]='<b>'.$_Average_.':</b> '.$new[8];
		$old[10]='%%COMMENTS%%';	$new[10]='<b>'.$_Comments_.':</b> '.$datos[6];
		$old[11]='%%RATEIT%%';		$new[11]='<INPUT TYPE="BUTTON" class="miniboton" value="'.$_RateIt_.'" onClick="ventana(\'info.php?ID='.$orden[$i].'&modo=puntuar&paso=1\',\'_blank\',300,150)">';
		$old[12]='%%INFO%%';		$new[12]='<INPUT TYPE="BUTTON" class="miniboton" value="'.$_Info_.'" onClick="ventana(\'info.php?ID='.$orden[$i].'\',\'_blank\',560,425)">';
		$old[13]='%%IN%%';			$new[13]=$_IN_;		
		$old[14]='%%IN1%%';			$new[14]='<span class="in">'.$datos[0].'</span>';
		$old[15]='%%IN2%%';			$new[15]='<span class="in">'.$datos[2].'</span>';				
		$old[16]='%%IN3%%';			$new[16]='<span class="in">'.media("pordia",$orden[$i],time(),$datos[2]).'/'.$_day_.'</span>';
		$old[17]='%%OUT%%';			$new[17]=$_OUT_;		
		$old[18]='%%OUT1%%';		$new[18]='<span class="out">'.$datos[1].'</span>';
		$old[19]='%%OUT2%%';		$new[19]='<span class="out">'.$datos[3].'</span>';				
		$old[20]='%%OUT3%%';		$new[20]='<span class="out">'.media("pordia",$orden[$i],time(),$datos[3]).'/'.$_day_.'</span>';
		$old[21]='%%DAYS%%';		$new[21]='<i>'.media("dias",time(),$orden[$i],0).$_DaysInTop_.'</i>';
		$old[22]='%%RATIO1%%';		$new[22]=barra("ratio",100,$datos[0],$datos[1]);		
		$old[23]='%%RATIO2%%';		$new[23]='<b>'.$_Ratio_.':</b> '.barra("ratio",100,$datos[0],$datos[1]);
		//Plantilla
		$RANK=str_replace($old,$new,$plantilla[4]);
		$WEBS=str_replace($old,$new,$plantilla[5]);
		$INOUT=str_replace($old,$new,$plantilla[6]);				
		//Tablas estructurales
        $top[2].='<TR class="'.($i%2).'">';
        $top[2].='<TD class="texto0" valign="middle">'.$RANK.'</TD>';
        $top[2].='<TD valign="middle" width="'.$anchoWebs.'">'.$WEBS.'</TD>';
        $top[2].='<TD class="minitexto0" valign="middle">'.$INOUT.'</TD>';
		$top[2].='</TR>';
    }
    $top[2].='</table>';

	return $top;
}

if($pass!=$adminPass OR $login!=$adminLogin) {
    $modo="";
    if($pass!="") $HTML.='<br><center><span class="titulo">Incorrect user/pass !!!</span></center>';
    $HTML.='<form action="admin.php" method="post">';
    $HTML.='<table align="center" border="0" bgcolor="Black" cellspacing="1" cellpadding="5">';
    $HTML.='<caption><span class="titulo">'.$_LoginScreen_.'</span></caption>';
    $HTML.='<tr class="1"><td align="right" class="texto0">'.$_Login_.'</td><td><INPUT TYPE="text" name="login" size="40"></td></tr>';
    $HTML.='<tr class="0"><td align="right" class="texto0">'.$_Pass_.'</td><td class="minitexto0"><INPUT TYPE="password" name="pass" maxlength="50" size="40"></tr>';
    $HTML.='<INPUT TYPE="HIDDEN" name="modo" value="frames">';
    $HTML.='<tr class="1"><td>&nbsp;</td><td><input type="submit" class="boton"></td></tr>';
    $HTML.='</table></form>';
	setcookie("cookieLogin",$adminLogin,time()+1800,"/");
	setcookie("cookiePass",$adminPass,time()+1800,"/");
}

if(!isset($design)) $design=$template;
if(!isset($block)) $block=0;

if($modo=="editor") {
	$aux=TOPoTags("read",$design,0);
	$HTML.='<TABLE class="estructura" width="100%" align="center" border="0" cellspacing="0" cellpadding="0">';
	$HTML.='<TR><TD>';
        $HTML.='<table class="texto0" width="99%" align="center" border="0" cellspacing="1" cellpadding="1">';
        $HTML.='<tr class="2"><td class="texto1" align="center" colspan="2">TOPoTags</td></tr>';		
        $HTML.='<tr><td align="center" class="1">%%RANK%%</td><td align="left" class="0">&nbsp;'.rand(1,9).'</td></tr>';
        $HTML.='<tr><td align="center" class="1">%%RANKARROW%%</td><td align="left" class="0">&nbsp;<img src="gif/arrow_green.gif" border="0" width="15" height="20"><font color="green">+'.rand(1,3).'</font> || <img src="gif/arrow_red.gif" border="0" width="15" height="20"><font color="red">+'.rand(-3,-1).'</font> || <span style="{font-size:15pt; color:blue; font-weight:bold;}">=</span></td></tr>';
        $HTML.='<tr><td align="center" class="1">%%BGCOLOR%%</td><td align="left" class="0">&nbsp;<i>class="0"</i> || <i>class="1"</i></td></tr>';
        if($block==0) $HTML.='<tr><td align="center" class="1">%%BANNER%%</td><td align="left" class="0">&nbsp;<i>&ltIMG max.('.$aux[7].'x'.$aux[8].')&gt</i></td></tr>';
        $HTML.='<tr><td align="center" class="1">%%WEB%%</td><td align="left" class="0">&nbsp;<a href="#">'.$_WebTitle_.'</a></td></tr>';
        $HTML.='<tr><td align="center" class="1">%%DESCRIPTION%%</td><td align="left" class="0">&nbsp;'.$_Description_.'</td></tr>';
        $HTML.='<tr><td align="center" class="1">%%STARS%%</td><td align="left" class="0">&nbsp;<img src="gif/star'.rand(0,10).'.gif" border="0"></td></tr>';
		$HTML.='<tr><td align="center" class="1">%%AVERAGE1%%</td><td align="left" class="0">&nbsp;'.rand(0,10).'.'.rand(1,9).'</i></td></tr>';
        $HTML.='<tr><td align="center" class="1">%%AVERAGE2%%</td><td align="left" class="0">&nbsp;'.rand(0,10).'.'.rand(1,9).' <i>('.rand(2,20).' '.$_votes_.')</i></td></tr>';
        $HTML.='<tr><td align="center" class="1">%%AVERAGE3%%</td><td align="left" class="0">&nbsp;<b>'.strtoupper($_Average_).':</b> '.rand(0,10).'.'.rand(1,9).' <i>('.rand(2,20).' '.$_votes_.')</i></td></tr>';
		$HTML.='<tr><td align="center" class="1">%%COMMENTS%%</td><td align="left" class="0">&nbsp;<b>'.strtoupper($_Comments_).':</b> '.rand(1,5).'</td></tr>';
		$HTML.='<tr><td align="center" class="1">%%RATEIT%%</td><td align="left" class="0">&nbsp;<INPUT TYPE="BUTTON" class="miniboton" value="'.$_RateIt_.'"></td></tr>';
		$HTML.='<tr><td align="center" class="1">%%INFO%%</td><td align="left" class="0">&nbsp;<INPUT TYPE="BUTTON" class="miniboton" value="'.$_Info_.'"></td></tr>';
		$HTML.='<tr><td align="center" class="1">%%IN%%</td><td align="left" class="0">&nbsp;'.$_IN_.'</td></tr>';
		$HTML.='<tr><td align="center" class="1">%%IN1%%</td><td align="left" class="0">&nbsp;<span class="in">'.rand(50,150).'</span></td></tr>';
		$HTML.='<tr><td align="center" class="1">%%IN2%%</td><td align="left" class="0">&nbsp;<span class="in">'.rand(200,999).'</span></td></tr>';
		$HTML.='<tr><td align="center" class="1">%%IN3%%</td><td align="left" class="0">&nbsp;<span class="in">'.rand(0,2).'.'.rand(1,9).'/'.$_day_.'</span></td></tr>';
		$HTML.='<tr><td align="center" class="1">%%OUT%%</td><td align="left" class="0">&nbsp;'.$_OUT_.'</td></tr>';
		$HTML.='<tr><td align="center" class="1">%%OUT1%%</td><td align="left" class="0">&nbsp;<span class="out">'.rand(50,150).'</span></td></tr>';
		$HTML.='<tr><td align="center" class="1">%%OUT2%%</td><td align="left" class="0">&nbsp;<span class="out">'.rand(200,999).'</span></td></tr>';
		$HTML.='<tr><td align="center" class="1">%%OUT3%%</td><td align="left" class="0">&nbsp;<span class="out">'.rand(0,2).'.'.rand(1,9).'/'.$_day_.'</span></td></tr>';
		$HTML.='<tr><td align="center" class="1">%%DAYS%%</td><td align="left" class="0">&nbsp;<i>'.rand(0,100).$_DaysInTop_.'</i></td></tr>';
		$HTML.='<tr><td align="center" class="1">%%RATIO1%%</td><td align="left" class="0">'.barra("ratio",100,rand(1,100),rand(50,150)).'</td></tr>';
		$HTML.='<tr><td align="center" class="1">%%RATIO2%%</td><td align="left" class="0">&nbsp;<b>'.$_Ratio_.':</b> '.barra("ratio",100,rand(1,100),rand(50,150)).'</td></tr>';
        $HTML.='</table>';
		$HTML.='</TD><TD valign="top">';
        $HTML.='<table class="texto0" width="99%" align="center" border="0" cellspacing="0" cellpadding="1">';
		$HTML.='<form action="topotags.php" method="post">';
        $HTML.='<caption><span class="titulo">'.$_TOPoTagsEditor_.'</span></caption>';
        $HTML.='<tr class="2"><td class="texto1" align="center">'.$_Template_.'</td></tr>';		
        $HTML.='<tr><td align="center" class="0">';
		$HTML.='<SELECT name="design">'.TOPoTags("select",$design,0).'"</SELECT>';
		$HTML.='&nbsp;<SELECT name="block">';
        $HTML.='<OPTION value="0">'.$_WebBanner_.'</OPTION>';
        $HTML.='<OPTION value="1"';
        if($block) $HTML.=' selected';
        $HTML.='>'.$_WebNormal_.'</OPTION>';
		$HTML.='</SELECT>';
        $HTML.='<INPUT TYPE="HIDDEN" name="modo" value="editor">';
        $HTML.='<INPUT TYPE="HIDDEN" name="login" value="'.$login.'">';
        $HTML.='<INPUT TYPE="HIDDEN" name="pass" value="'.$pass.'">';
        $HTML.='&nbsp;<input type="submit" class="boton" value="'.$_View_.'"></td></tr>';
        $HTML.='</form></table>';
        $HTML.='<table class="texto0" width="95%" align="center" border="0" cellspacing="0" cellpadding="1">';
		$HTML.='<form action="topotags.php" method="post">';
        $HTML.='<caption><span class="titulo">'.$_Template_.': '.$aux[0];
		if($block==0) $HTML.=' ('.$_WebBanner_.')';
		if($block==1) $HTML.=' ('.$_WebNormal_.')';
		$HTML.='</span></caption>';
        if($block==0) $HTML.='<tr class="0"><td align="center" class="0">'.$_BannerWidth_.': <INPUT type="text" name="NEWancho" value="'.$aux[7].'" size="4">&nbsp;&nbsp;&nbsp;'.$_BannerHeight_.': <INPUT type="text" name="NEWalto" value="'.$aux[8].'" size="4"></td></tr>';
        $HTML.='<tr class="2"><td class="texto1" align="center">'.$_Rank_.'</td></tr>';		
        $HTML.='<tr class="0"><td align="center" class="0"><TEXTAREA name="NEWRANK" rows="8" cols="65" wrap="soft">'.$aux[1+3*$block].'</TEXTAREA></td></tr>';
        $HTML.='<tr class="2"><td class="texto1" align="center">'.$_Webs_.'</td></tr>';		
        $HTML.='<tr class="0"><td align="center" class="0"><TEXTAREA name="NEWWEBS" rows="9" cols="65" wrap="soft">'.$aux[2+3*$block].'</TEXTAREA></td></tr>';
        $HTML.='<tr class="2"><td class="texto1" align="center">'.$_InOut_.'</td></tr>';		
        $HTML.='<tr class="0"><td align="center" class="0"><TEXTAREA name="NEWINOUT" rows="9" cols="65" wrap="soft">'.$aux[3+3*$block].'</TEXTAREA></td></tr>';
		$HTML.='<tr class="2"><td class="texto1" align="center">';
		if($design!=0) $HTML.='<INPUT class="boton" type="submit" name="modo" value="'.$_Save_.'">';
		$HTML.='&nbsp;<INPUT class="boton" type="submit" name="modo" value="'.$_SaveAs_.'">';
		$HTML.='</td></tr>';		
		$HTML.='<tr class="2"><td class="texto1" align="center">';		
		$HTML.="<INPUT class=\"boton\" type=\"button\" value=\"".$_Preview_."\" onClick=\"window.open('".$topURL."topotags.php?modo=".$_Preview_."&design=".$design."&login=".$login."&pass=".$pass."','_blank','directories=no,location=no,menubar=no,scrollbars=yes,status=yes,toolbar=no,resizable=yes')\">";
		$HTML.='&nbsp;<INPUT class="boton" type="reset">';		
		if($design!=0) $HTML.='&nbsp;<INPUT class="boton" type="submit" name="modo" value="'.$_Delete_.'">';
		$HTML.='</td></tr>';
        $HTML.='<INPUT TYPE="HIDDEN" name="block" value="'.$block.'">';
        $HTML.='<INPUT TYPE="HIDDEN" name="design" value="'.$design.'">';
        $HTML.='<INPUT TYPE="HIDDEN" name="login" value="'.$login.'">';
        $HTML.='<INPUT TYPE="HIDDEN" name="pass" value="'.$pass.'">';
        $HTML.='</form></table>';
	$HTML.='</TD></TR></TABLE>';
}

if($modo==$_Save_) {
	$aux=TOPoTags("read",$design,0);
	$NEWRANK=string("raw",$NEWRANK,0);
	$NEWWEBS=string("raw",$NEWWEBS,0);
	$NEWINOUT=string("raw",$NEWINOUT,0);
	$NEWancho=string("int2",$NEWancho,468);
	$NEWalto=string("int2",$NEWalto,60);
	if($block==0) $data=$aux[0]."||".$NEWRANK."||".$NEWWEBS."||".$NEWINOUT."||".$aux[4]."||".$aux[5]."||".$aux[6]."||".$NEWancho."||".$NEWalto."||\n";
	if($block==1) $data=$aux[0]."||".$aux[1]."||".$aux[2]."||".$aux[3]."||".$NEWRANK."||".$NEWWEBS."||".$NEWINOUT."||".$aux[7]."||".$aux[8]."||\n";
	$ok=TOPoTags("save",$design,$data);
	$HTML='ERROR:<br>File: TOPoTags.php<br>modo=save';
    if($ok) {
        $HTML='<form action="topotags.php" method="post">';
        $HTML.='<table width="50%" class="texto0" align="center" border="0" bgcolor="Black" cellspacing="1" cellpadding="5">';
        $HTML.='<caption><span class="titulo">'.$_TOPoTagsEditor_.'</span></caption>';
        $HTML.='<tr class="0"><td align="center" valign="middle"><br>'.$_UpdateData_.'<br>&nbsp;</td></tr>';
        $HTML.='<tr class="1"><td align="center" valign="middle"><br><INPUT TYPE="SUBMIT" class="boton" value="'.$_Return_.'"><br>&nbsp;</td></tr>';
        $HTML.='<INPUT TYPE="HIDDEN" name="modo" value="editor">';
        $HTML.='<INPUT TYPE="HIDDEN" name="block" value="'.$block.'">';
        $HTML.='<INPUT TYPE="HIDDEN" name="design" value="'.$design.'">';
        $HTML.='<INPUT TYPE="HIDDEN" name="login" value="'.$login.'">';
        $HTML.='<INPUT TYPE="HIDDEN" name="pass" value="'.$pass.'">';
        $HTML.='</table></form>';
    }
}

if($modo==$_SaveAs_) {
	if(isset($nombre)) {
    	$ok=TOPoTags("rename",$design-1,$nombre);
    	$HTML='ERROR:<br>File: TOPoTags.php<br>modo=save';
        if($ok) {
            $HTML='<form action="topotags.php" method="post">';
            $HTML.='<table width="50%" class="texto0" align="center" border="0" bgcolor="Black" cellspacing="1" cellpadding="5">';
            $HTML.='<caption><span class="titulo">'.$_TOPoTagsEditor_.'</span></caption>';
            $HTML.='<tr class="0"><td align="center" valign="middle"><br>'.$_UpdateData_.'<br>&nbsp;</td></tr>';
            $HTML.='<tr class="1"><td align="center" valign="middle"><br><INPUT TYPE="SUBMIT" class="boton" value="'.$_Return_.'"><br>&nbsp;</td></tr>';
            $HTML.='<INPUT TYPE="HIDDEN" name="modo" value="editor">';
            $HTML.='<INPUT TYPE="HIDDEN" name="block" value="'.$block.'">';
            $HTML.='<INPUT TYPE="HIDDEN" name="design" value="'.($ok-1).'">';
            $HTML.='<INPUT TYPE="HIDDEN" name="login" value="'.$login.'">';
            $HTML.='<INPUT TYPE="HIDDEN" name="pass" value="'.$pass.'">';
            $HTML.='</table></form>';
        }
	} else {
		$nombre=time();
    	$aux=TOPoTags("read",$design,0);
    	$aux=TOPoTags("read",$design,0);
    	$NEWRANK=string("raw",$NEWRANK,0);
    	$NEWWEBS=string("raw",$NEWWEBS,0);
    	$NEWINOUT=string("raw",$NEWINOUT,0);
    	$NEWancho=string("int2",$NEWancho,468);
    	$NEWalto=string("int2",$NEWalto,60);
    	if($block==0) $data=$nombre."||".$NEWRANK."||".$NEWWEBS."||".$NEWINOUT."||".$aux[4]."||".$aux[5]."||".$aux[6]."||".$NEWancho."||".$NEWalto."||\n";
    	if($block==1) $data=$nombre."||".$aux[1]."||".$aux[2]."||".$aux[3]."||".$NEWRANK."||".$NEWWEBS."||".$NEWINOUT."||".$aux[7]."||".$aux[8]."||\n";
    	$NEWdesign=TOPoTags("saveas",0,$data);
        $HTML='<form action="topotags.php" method="post">';
        $HTML.='<table width="50%" class="texto0" align="center" border="0" bgcolor="Black" cellspacing="1" cellpadding="5">';
        $HTML.='<caption><span class="titulo">'.$_TOPoTagsEditor_.'</span></caption>';
        $HTML.='<tr class="2"><td class="texto1" align="center">'.$_SaveAs_.'</td></tr>';
		$HTML.='<tr class="0"><td align="center">'.$_NewDesign_.'&nbsp;<INPUT type="text" name="nombre" value="'.$nombre.'"></td></tr>';		
        $HTML.='<tr class="2"><td align="center"><INPUT TYPE="button" class="boton" value="'.$_Return_.'" onClick="window.history.back()">&nbsp;<INPUT TYPE="SUBMIT" class="boton" value="'.$_Save_.'"></td></tr>';
        $HTML.='<INPUT TYPE="HIDDEN" name="modo" value="'.$_SaveAs_.'">';
        $HTML.='<INPUT TYPE="HIDDEN" name="block" value="'.$block.'">';
        $HTML.='<INPUT TYPE="HIDDEN" name="design" value="'.$NEWdesign.'">';
        $HTML.='<INPUT TYPE="HIDDEN" name="login" value="'.$login.'">';
        $HTML.='<INPUT TYPE="HIDDEN" name="pass" value="'.$pass.'">';
        $HTML.='</table></form>';
	}
}

if($modo==$_Preview_) {
	$top=generarPREVIEW($design,$block);
	foreach($top as $value) $HTML.='<br>'.$value;

}

if($modo==$_Delete_) {
	if($confirmado) {
    	$ok=TOPoTags("delete",$design,0);
    	$HTML='ERROR:<br>File: TOPoTags.php<br>modo=delete';
        if($ok) {
            $HTML='<form action="topotags.php" method="post">';
            $HTML.='<table width="50%" class="texto0" align="center" border="0" bgcolor="Black" cellspacing="1" cellpadding="5">';
            $HTML.='<caption><span class="titulo">'.$_TOPoTagsEditor_.'</span></caption>';
            $HTML.='<tr class="0"><td align="center" valign="middle"><br>'.$_UpdateData_.'<br>&nbsp;</td></tr>';
            $HTML.='<tr class="1"><td align="center" valign="middle"><br><INPUT TYPE="SUBMIT" class="boton" value="'.$_Return_.'"><br>&nbsp;</td></tr>';
            $HTML.='<INPUT TYPE="HIDDEN" name="modo" value="editor">';
            $HTML.='<INPUT TYPE="HIDDEN" name="block" value="'.$block.'">';
            $HTML.='<INPUT TYPE="HIDDEN" name="design" value="'.$template.'">';
            $HTML.='<INPUT TYPE="HIDDEN" name="login" value="'.$login.'">';
            $HTML.='<INPUT TYPE="HIDDEN" name="pass" value="'.$pass.'">';
            $HTML.='</table></form>';
        }
	} else {
        $HTML='<form action="topotags.php" method="post">';
        $HTML.='<table width="50%" class="texto0" align="center" border="0" bgcolor="Black" cellspacing="1" cellpadding="5">';
        $HTML.='<caption><span class="titulo">'.$_TOPoTagsEditor_.'</span></caption>';
		$HTML.='<tr class="2"><td class="texto1" align="center">'.$_Delete_.'</td></tr>';
		$HTML.='<tr class="0"><td align="center" class="texto0">'.$_Confirm_.'</td></tr>';
		$HTML.='<tr class="2"><td align="center"><input type="button" class="boton" value="'.$_Return_.'" onClick="history.go(-1)">&nbsp;<input type="submit" class="boton" value=" '.$_Yes_.' "></td></tr>';
        $HTML.='<INPUT TYPE="HIDDEN" name="modo" value="'.$_Delete_.'">';
		$HTML.='<INPUT TYPE="HIDDEN" name="confirmado" value="1">';
        $HTML.='<INPUT TYPE="HIDDEN" name="block" value="'.$block.'">';
        $HTML.='<INPUT TYPE="HIDDEN" name="design" value="'.$design.'">';
        $HTML.='<INPUT TYPE="HIDDEN" name="login" value="'.$login.'">';
        $HTML.='<INPUT TYPE="HIDDEN" name="pass" value="'.$pass.'">';
        $HTML.='</table></form>';
	}
}

include('html/header.php');
echo $HTML;
echo '</body></html>';
?>