<?php
/************************************************************************/
/* DUNE by NPDS                                                         */
/* ===========================                                          */
/*                                                                      */
/* This version name NPDS Copyright (c) 2001-2013 by Philippe Brunier   */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/
function Access_Error () {
  include("admin/die.php");
}

function MetaTagAdmin($saved = false) {
   global $hlpfile;
   $tags = GetMetaTags("meta/meta.php");
   include("header.php");
   GraphicAdmin($hlpfile);
   opentable();
   echo "<table width=\"100%\" cellspacing=\"2\" cellpadding=\"2\" border=\"0\"><tr><td class=\"header\">\n";
   echo adm_translate("Administration des MétaTags");
   echo "</td></tr></table>\n";
   echo "<br />\n";
   if ($saved){
      echo "<p align=\"center \" class class=\"rouge\">".adm_translate("Vos MétaTags ont été modifiés avec succès !")."</p><br />\n";
   }
   echo "<form action=\"admin.php\" method=\"post\">\n";

   echo "<b>".adm_translate("Auteur(s)")." :</b><br />\n";
   echo "<input class=\"textbox_standard\" type=\"text\" name=\"newtag[author]\" value=\"".$tags['author']."\" size=\"80\" maxlength=\"100\"><br />\n";
   echo adm_translate("(Ex. : nom du webmaster)")."<br /><br />\n";

   echo "<b>".adm_translate("Propriétaire")." :</b><br />\n";
   echo "<input class=\"textbox_standard\" type=\"text\" name=\"newtag[owner]\" value=\"".$tags['owner']."\" size=\"80\" maxlength=\"100\" /><br />\n";
   echo adm_translate("(Ex. : nom de votre compagnie/service)")."<br /><br />\n";

   echo "<b>".adm_translate("Adresse e-mail principale")." :</b><br />\n";
   echo "<input class=\"textbox_standard\" type=\"text\" name=\"newtag[reply-to]\" value=\"".$tags['reply-to']."\" size=\"80\" maxlength=\"100\" /><br />\n";
   echo adm_translate("(Ex. : l'adresse e-mail du webmaster)")."<br /><br />\n";

   echo "<b>".adm_translate("Langue principale")." :</b><br />\n";
   echo "<input class=\"textbox_standard\" type=\"text\" name=\"newtag[language]\" value=\"".$tags['language']."\" size=\"6\" maxlength=\"5\" /><br />\n";
   echo adm_translate("(Ex. : fr(Français), en(Anglais), en-us(Américain), de(Allemand), it(Italien), pt(Portugais), etc)")."<br /><br />\n";

   echo "<b>".adm_translate("Description")." :</b><br />\n";
   echo "<input class=\"textbox_standard\" type=\"text\" name=\"newtag[description]\" value=\"".$tags['description']."\" size=\"100\" maxlength=\"200\" /><br />\n";
   echo adm_translate("(Brève description des centres d'intérêt du site. 200 caractères maxi.)")."<br /><br />\n";

   echo "<b>".adm_translate("Mot(s) clé(s)")." :</b><br />\n";
   echo "<input class=\"textbox_standard\" type=\"text\" name=\"newtag[keywords]\" value=\"".$tags['keywords']."\" size=\"90\" maxlength=\"1000\" /><br />\n";
   echo adm_translate("(Définissez un ou plusieurs mot(s) clé(s). 1000 caractères maxi.<br />Remarques : une lettre accentuée équivaut le plus souvent à 8 caractères. La majorité des moteurs de recherche font la distinction minuscule/majuscule. Séparez vos mots par une virgule)")."<br /><br />\n";

   echo "<b>".adm_translate("Audience")." :</b><br />\n";
   echo "<select class=\"textbox_standard\" name=\"newtag[rating]\">\n";
   echo "<option value=\"general\"".(!strcasecmp($tags['rating'], 'general') ? " selected" : "").">".adm_translate("Tout public")."</option>\n";
   echo "<option value=\"mature\"".(!strcasecmp($tags['rating'], 'mature') ? " selected" : "").">".adm_translate("Adulte")."</option>\n";
   echo "<option value=\"restricted\"".(!strcasecmp($tags['rating'], 'restricted') ? " selected" : "").">".adm_translate("Accès restreint")."</option>\n";
   echo "<option value=\"14 years\"".(!strcasecmp($tags['rating'], '14 years') ? " selected" : "").">".adm_translate("14 ans")."</option>\n";
   echo "</select><br />\n";
   echo adm_translate("(Définissez le public intéressé par votre site)")."<br /><br />\n";

   echo "<b>".adm_translate("Distribution")." :</b><br />\n";
   echo "<select class=\"textbox_standard\" name=\"newtag[distribution]\">\n";
   echo "<option value=\"global\"".(!strcasecmp($tags['distribution'], 'global') ? " selected=\"selected\"" : "").">".adm_translate("Large")."</option>\n";
   echo "<option value=\"local\"".(!strcasecmp($tags['distribution'], 'local') ? " selected=\"selected\"" : "").">".adm_translate("Restreinte")."</option>\n";
   echo "</select><br /><br />\n";

   echo "<b>".adm_translate("Copyright")." :</b><br />\n";
   echo "<input class=\"textbox_standard\" type=\"text\" name=\"newtag[copyright]\" value=\"".$tags['copyright']."\" size=\"80\" maxlength=\"100\" /><br />\n";
   echo adm_translate("(Informations légales)")."<br /><br />\n";

   echo "<b>".adm_translate("Robots/Spiders")." :</b><br />\n";
   echo "<select class=\"textbox_standard\" name=\"newtag[robots]\">\n";
   echo "<option value=\"all\"".(!strcasecmp($tags['robots'], 'all') ? " selected=\"selected\"" : "").">".adm_translate("Tout contenu (page/liens/etc)")."</option>\n";
   echo "<option value=\"none\"".(!strcasecmp($tags['robots'], 'none') ? " selected=\"selected\"" : "").">".adm_translate("Aucune indexation")."</option>\n";
   echo "<option value=\"index,nofollow\"".(!strcasecmp($tags['robots'], 'index,nofollow') ? " selected=\"selected\"" : "").">".adm_translate("Page courante sans liens locaux")."</option>\n";
   echo "<option value=\"noindex,follow\"".(!strcasecmp($tags['robots'], 'noindex,follow') ? " selected=\"selected\"" : "").">".adm_translate("Liens locaux sauf page courante")."</option>\n";
   echo "<option value=\"noarchive\"".(!strcasecmp($tags['robots'], 'noarchive') ? " selected=\"selected\"" : "").">".adm_translate("Pas d'affichage du cache")."</option>\n";
   echo "<option value=\"noodp,noydir\"".(!strcasecmp($tags['robots'], 'noodp,noydir') ? " selected=\"selected\"" : "").">".adm_translate("Pas d'utilisation des descriptions ODP ou YDIR")."</option>\n";
   echo "</select><br />\n";
   echo adm_translate("(Définissez la méthode d'analyse que doivent adopter les robots des moteurs de recherche)")."<br /><br />\n";

   echo "<b>".adm_translate("Fréquence de visite des Robots/Spiders")." :</b><br />\n";
   echo "<input class=\"textbox_standard\" type=\"text\" name=\"newtag[revisit-after]\" value=\"".$tags['revisit-after']."\" size=\"20\" maxlength=\"30\" /><br />\n";
   echo adm_translate("(Ex. : 16 days. Remarque : ne définissez pas de fréquence inférieure à 14 jours !)")."<br /><br />\n";

   if (function_exists("utf8_encode")) {
      echo "<b>".adm_translate("Encodage")." :</b><br />\n";
      echo "<select class=\"textbox_standard\" name=\"newtag[content-type]\">\n";
      echo "<option value=\"text/html; charset=iso-8859-1\"".(!strcasecmp($tags['content-type'], 'text/html; charset=iso-8859-1') ? " selected=\"selected\"" : "").">charset=ISO-8859-1</option>\n";
      echo "<option value=\"text/html; charset=utf-8\"".(!(strcasecmp($tags['content-type'], 'text/html; charset=utf-8') and strcasecmp($tags['content-type'], 'text/html')) ? " selected=\"selected\"" : "").">charset=UTF-8</option>\n";
      echo "</select>";
   } else {
      echo "<b>".adm_translate("Encodage")." :</b> ";
      echo "<span class=\"rouge\">utf8_encode() ".adm_translate("non disponible")."</span>";
   }
   echo "<br /><br />\n";
   echo "<b>DOCTYPE :</b><br />\n";
   echo "<select class=\"textbox_standard\" name=\"newtag[doctype]\">\n";
   echo "<option value=\"HTML 4.01 Transitional\"".(!strcasecmp(doctype, 'HTML 4.01 Transitional') ? " selected=\"selected\"" : "").">HTML 4.01 ".adm_translate("Transitional")." (deprecated)</option>\n";
   echo "<option value=\"HTML 4.01 Strict\"".(!strcasecmp(doctype, 'HTML 4.01 Strict') ? " selected=\"selected\"" : "").">HTML 4.01 ".adm_translate("Strict")." (deprecated)</option>\n";
   echo "<option value=\"XHTML 1.0 Transitional\"".(!strcasecmp(doctype, 'XHTML 1.0 Transitional') ? " selected=\"selected\"" : "").">XHTML 1.0 ".adm_translate("Transitional")."</option>\n";
   echo "<option value=\"XHTML 1.0 Strict\"".(!strcasecmp(doctype, 'XHTML 1.0 Strict') ? " selected=\"selected\"" : "").">XHTML 1.0 ".adm_translate("Strict")."</option>\n";
   echo "<option value=\"HTML 5.0\"".(!strcasecmp(doctype, 'HTML 5.0') ? " selected=\"selected\"" : "").">HTML 5.0 (experimental)</option>\n";
   echo "</select>";
   echo "<br /><br />\n";

   echo "<input type=\"hidden\" name=\"op\" value=\"MetaTagSave\" />\n";
   echo "<input class=\"bouton_standard\" type=\"submit\" value=\"".adm_translate("Enregistrer")."\" />\n";
   echo "</form>\n";
   closetable();
   include("footer.php");
}

if (!stristr($_SERVER['PHP_SELF'],"admin.php")) { Access_Error(); }
include ("admin/settings_save.php");

global $language;
$hlpfile = "manuels/$language/metatags.html";
$result = sql_query("SELECT radminsuper FROM ".$NPDS_Prefix."authors WHERE aid='$aid'");
list($radminsuper) = sql_fetch_row($result);
if ($radminsuper != 1) {
   Access_Error();
} else {
   settype($meta_saved,'string');
   switch ($op) {
      case "MetaTagSave":
         $meta_saved = MetaTagSave("meta/meta.php", $newtag);
         header("location: admin.php?op=MetaTagAdmin");
         break;

       case "MetaTagAdmin":
         MetaTagAdmin($meta_saved);
         break;
    }
}
?>