<?php
include ('logue.php'); 
include ('entete2.php');
include ('ressource.php');
include ('entete.php');
echo"
<script type=\"text/javascript\">
<!--
function AddText(startTag,defaultText,endTag,champs) {
if (champs.createTextRange){
	var text;
    champs.focus(champs.caretPos);
    champs.caretPos = document.selection.createRange().duplicate();
    if(champs.caretPos.text.length>0){
         champs.caretPos.text = startTag + champs.caretPos.text + endTag;
    }else{
        champs.caretPos.text = startTag+defaultText+endTag;
    }

}else champs.value += startTag+defaultText+endTag;
}
function smiley(codedusmiley){
	var reg=new RegExp('[ ]', 'g');
	var tabs=codedusmiley.split(reg);
	if(tabs.length>=2 && tabs.length<=3){
		AddText(tabs[0],' ',tabs[1], document.rep.presentation);
	}else{
		AddText(codedusmiley,' ','', document.rep.presentation);
	}
}
function smiley2(codedusmiley){
	var reg=new RegExp('[ ]', 'g');
	var tabs=codedusmiley.split(reg);
	if(tabs.length>=2 && tabs.length<=3){
		AddText(tabs[0],' ',tabs[1], document.rep.txtinterne);
	}else{
		AddText(codedusmiley,' ','', document.rep.txtinterne);
	}	
}
// -->
</script>
<STYLE TYPE=text/css>
.Style1 {color: #0000FF}
.Style2 {color: #FF0000}
input {
border:1px solid #7E7E7E;
background-color:#000000;
font-family:'trebuchet ms',sans-serif;
color:white;
}
textarea {
border:1px solid #7E7E7E;
background-color:#000000;
font-family:'trebuchet ms',sans-serif;
color:white;
}
select, option {
background-color:#000000;
color:white;
}
A.menulink2 {
width: 150px;
text-decoration: none;
font-family:Verdana;
font-size:11px;
color: #FF3300;
BORDER: none;
border: solid 1px #000000;
}

A.menulink2:hover {
border: solid 1px #000000;
background-color:#000000;
}
</STYLE>";
echo"<div align=\"center\"><form name=\"colo\" method=\"post\" action=\"colonie.php\" target=\"_parent\">
<table align=\"center\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
   <tr>
     <td width=\"100\" rowspan=\"2\" valign=\"middle\">
       <div align=\"center\">
         <input name=\"page\" value=\"" . $PHP_SELF . "\" type=\"hidden\" id=\"page\">
         <select name=\"idcolo\" onchange=submit()>";
include ('colo2.php'); 

$sql2 = "SELECT ally,statut FROM matgraph_users WHERE id='$idlogin'";
$res2 = db_mysql_Query($sql2)or die('erreur sql<br>'.$sql2.'<br>'.mysql_error());
$row2 = mysql_fetch_array($res2); 

$sql_options = "SELECT admin,administrer FROM matgraph_ally_statut WHERE id='$row2[statut]'";
$res_options = db_mysql_Query($sql_options)or die('erreur sql<br>'.$sql_options.'<br>'.mysql_error());
$row_options = mysql_fetch_array($res_options); 

if($row2[ally] == "no") {
	echo '<script language="javascript" type="text/javascript">
	<!--
	window.location.replace("ally_index.php");
	-->
	</script>';
	exit;
}

if($row2[statut] !== "0" AND $row_options[administrer] == "1" OR $row2[statut] == "-1") {

	echo"<div align=\"left\"><a href=\"ally_index.php\" target=\"_parent\"> Retour</a></div><br>";

	$sql = "SELECT * FROM matgraph_ally WHERE id='$row2[ally]'";
	$res = db_mysql_Query($sql)or die('erreur sql<br>'.$sql.'<br>'.mysql_error());
	$row = mysql_fetch_array($res); 

	echo"<form name=\"rep\" method=\"post\" action=\"ally_admin_envoi.php\" target=\"_parent\">
	  <table width=\"618\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\" bordercolor=\"#000000\" style=\"font-family:trebuchet ms,sans-serif; font-size: 9pt ;\">
	    <tr style =\"background-color:#222222;\">
	      <td width=\"159\"><strong>Nom : </strong></td>
	      <td width=\"453\"><div align=\"center\">
	        <input name=\"nom\" type=\"text\" id=\"nom\" value=\"$row[nom]\" maxlength=\"35\">
	      </div></td>
	    </tr>
	    <tr>
	      <td><strong>Tag : </strong></td>
	      <td width=\"453\"><div align=\"center\">
	        <input name=\"tag\" type=\"text\" id=\"tag\" value=\"$row[tag]\" maxlength=\"6\">
	      </div></td>
	    </tr>
	    <tr style =\"background-color:#222222;\">
	      <td><strong>Url Page d'accueil : </strong></td>
	      <td width=\"453\"><div align=\"center\">
	        <input name=\"url\" type=\"text\" id=\"url\" value=\"$row[url]\" maxlength=\"300\">
	      </div></td>
	    </tr>
	    <tr>
	      <td><strong>Url Logo : </strong></td>
	      <td width=\"453\"><div align=\"center\">
	        <input name=\"img\" type=\"text\" id=\"img\" value=\"$row[img]\" maxlength=\"300\">
	      </div></td>
	    </tr>
	    <tr style =\"background-color:#222222;\">
	      <td colspan=\"2\"> <strong>Pr&eacute;sentation : </strong><br>
		  <div align=\"center\">
		   	<a href=\"javascript:smiley('[i] [/i]');\"><img src=\"images/rte-italic.png\" alt=\"Mettre en Italique\" /></a>	
			<a href=\"javascript:smiley('[b] [/b]');\"><img src=\"images/rte-bold.png\" alt=\"Mettre en Gras\" /></a>
			<a href=\"javascript:smiley('[u] [/u]');\"><img src=\"images/rte-underlined.png\" alt=\"Souligner\" /></a>
			<a href=\"javascript:smiley('[img] [/img]');\"><img src=\"images/rte-image.png\" alt=\"Mettre une Image\" /></a>
			<a href=\"javascript:smiley('[URL=l\'url de le page]Visitez ce site[/URL]');\"><img src=\"images/rte-url.png\" alt=\"Mettre une URL\" /></a>
			<a href=\"javascript:smiley('[align=left] [/align]');\"><img src=\"images/rte-align-left.png\" alt=\"Gauche\" /></a>
			<a href=\"javascript:smiley('[align=center] [/align]');\"><img src=\"images/rte-align-center.png\" alt=\"Centrer\" /></a>
			<a href=\"javascript:smiley('[align=right] [/align]');\"><img src=\"images/rte-align-right.png\" alt=\"Droite\" /></a>
			<select>
				<option>Couleur de texte</option>
				<option onclick=\"javascript:smiley('[color=red] [/color]');\" style=\"color: red\">Rouge</option>
				<option onclick=\"javascript:smiley('[color=green] [/color]');\" style=\"color: green\">Vert</option>
				<option onclick=\"javascript:smiley('[color=blue] [/color]');\" style=\"color: blue\">Bleu</option>
				<option onclick=\"javascript:smiley('[color=#8B0000] [/color]');\" style=\"color:#8B0000;\">Rouge sombre</option>
				<option onclick=\"javascript:smiley('[color=#00008B] [/color]');\" style=\"color:#00008B;\">Bleu sombre</option>
				<option onclick=\"javascript:smiley('[color=#FFA500] [/color]');\" style=\"color:#FFA500;\">Orange</option>
				<option onclick=\"javascript:smiley('[color=#A52A2A] [/color]');\" style=\"color:#A52A2A;\">Marron</option>
				<option onclick=\"javascript:smiley('[color=#FFFF00] [/color]');\" style=\"color:#FFFF00;\">Jaune</option>
				<option onclick=\"javascript:smiley('[color=#EE82EE] [/color]');\" style=\"color:#EE82EE;\">Violet</option>
				<option onclick=\"javascript:smiley('[color=#808000] [/color]');\" style=\"color:#808000;\">Olive</option>
				<option onclick=\"javascript:smiley('[color=#00FFFF] [/color]');\" style=\"color:#00FFFF;\">Cyan</option>
				<option onclick=\"javascript:smiley('[color=#4B0082] [/color]');\" style=\"color:#4B0082;\">Indigo</option>
				<option onclick=\"javascript:smiley('[color=#FFFFFF] [/color]');\" style=\"color:#FFFFFF;\">Blanc</option>
			</select>
		</div>
		  
		 </td>
	    </tr>
	    <tr>
	      <td colspan=\"2\"><div align=\"center\">
	        <textarea name=\"presentation\" cols=\"70\" id=\"presentation\" rows=\"8\">$row[presentation]</textarea>
	      </div></td>
	    </tr>
	    <tr style =\"background-color:#222222;\">
	     <td colspan=\"2\"><strong>Texte interne : </strong> <br>
		  <div align=\"center\">
		   	<a href=\"javascript:smiley('[i] [/i]');\"><img src=\"images/rte-italic.png\" alt=\"Mettre en Italique\" /></a>	
			<a href=\"javascript:smiley('[b] [/b]');\"><img src=\"images/rte-bold.png\" alt=\"Mettre en Gras\" /></a>
			<a href=\"javascript:smiley('[u] [/u]');\"><img src=\"images/rte-underlined.png\" alt=\"Souligner\" /></a>
			<a href=\"javascript:smiley('[img] [/img]');\"><img src=\"images/rte-image.png\" alt=\"Mettre une Image\" /></a>
			<a href=\"javascript:smiley('[URL=l\'url de le page]Visitez ce site[/URL]');\"><img src=\"images/rte-url.png\" alt=\"Mettre une URL\" /></a>
			<a href=\"javascript:smiley('[align=left] [/align]');\"><img src=\"images/rte-align-left.png\" alt=\"Gauche\" /></a>
			<a href=\"javascript:smiley('[align=center] [/align]');\"><img src=\"images/rte-align-center.png\" alt=\"Centrer\" /></a>
			<a href=\"javascript:smiley('[align=right] [/align]');\"><img src=\"images/rte-align-right.png\" alt=\"Droite\" /></a>
			<select>
				<option>Couleur de texte</option>
				<option onclick=\"javascript:smiley('[color=red] [/color]');\" style=\"color: red\">Rouge</option>
				<option onclick=\"javascript:smiley('[color=green] [/color]');\" style=\"color: green\">Vert</option>
				<option onclick=\"javascript:smiley('[color=blue] [/color]');\" style=\"color: blue\">Bleu</option>
				<option onclick=\"javascript:smiley('[color=#8B0000] [/color]');\" style=\"color:#8B0000;\">Rouge sombre</option>
				<option onclick=\"javascript:smiley('[color=#00008B] [/color]');\" style=\"color:#00008B;\">Bleu sombre</option>
				<option onclick=\"javascript:smiley('[color=#FFA500] [/color]');\" style=\"color:#FFA500;\">Orange</option>
				<option onclick=\"javascript:smiley('[color=#A52A2A] [/color]');\" style=\"color:#A52A2A;\">Marron</option>
				<option onclick=\"javascript:smiley('[color=#FFFF00] [/color]');\" style=\"color:#FFFF00;\">Jaune</option>
				<option onclick=\"javascript:smiley('[color=#EE82EE] [/color]');\" style=\"color:#EE82EE;\">Violet</option>
				<option onclick=\"javascript:smiley('[color=#808000] [/color]');\" style=\"color:#808000;\">Olive</option>
				<option onclick=\"javascript:smiley('[color=#00FFFF] [/color]');\" style=\"color:#00FFFF;\">Cyan</option>
				<option onclick=\"javascript:smiley('[color=#4B0082] [/color]');\" style=\"color:#4B0082;\">Indigo</option>
				<option onclick=\"javascript:smiley('[color=#FFFFFF] [/color]');\" style=\"color:#FFFFFF;\">Blanc</option>
			</select>
		</div>

	</td>
	    </tr>
	    <tr>
	      <td colspan=\"2\"><div align=\"center\">
	        <textarea name=\"txtinterne\" cols=\"70\" id=\"txtinterne\" rows=\"8\">$row[txtinterne]</textarea>
	      </div></td>
	    </tr>
	    <tr style =\"background-color:#222222;\">
	      <td colspan=\"2\" height=\"45\"><div align=\"center\">
	        <input type=\"submit\" name=\"Submit\" value=\"Envoyer\">
	      </div></td>
	    </tr>";
	    
	echo"</table>
	</form>";
}
else {
	echo '<script language="javascript" type="text/javascript">
	<!--
	window.location.replace("ally_index.php");
	-->
	</script>';
	exit;
}
?>

