<?PHP
/************************************************************************/
/* NPDS V : Net Portal Dynamic System .                                 */
/* ===========================                                          */
/*                                                                      */
/* Original Copyright (c) 2001 by Francisco Burzi (fburzi@ncc.org.ve)   */
/* http://phpnuke.org                                                   */
/*                                                                      */
/* This version name NPDS Copyright (c) 2001-2005 by Philippe Brunier   */
/*                                                                      */
/* =========================                                            */
/* Based on Parts of phpBB                                              */
/*                                                                      */
/* 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 () {
  if (file_exists("meta/meta.php"))
     include ("meta/meta.php");
  echo "<title>NPDS</title></head><body bgcolor=\"white\"><br /><p align=\"center\"><span style=\"font-size: 14px; font-family: Arial; font-weight: bold; color: red;\">";
  echo "Access Denied / Acc&egrave;s Refus&eacute;";
  if (cur_charset=="utf-8") echo" / &#x901A;&#x5165;&#x88AB;&#x5426;&#x8BA4;";
  echo "</span>";
  echo "<br /><br /><span style=\"font-size: 12px; font-family: Arial; font-weight: bold; color: black;\">NPDS - Portal System";
  echo "</span></p></body></html>";
  die();
}
if (!strstr($PHP_SELF,"admin.php")) { Access_Error(); }
global $pdst; $pdst="0";

global $language;
$hlpfile = "manuels/$language/forumconfig.html";
$result = mysql_query("select radminforum, radminsuper from authors where aid='$aid'");
list($radminforum, $radminsuper) = mysql_fetch_row($result);
if (($radminforum!=1) and ($radminsuper!=1)) {
   Access_Error();
}

function ForumConfigAdmin() {
    global $hlpfile;
    include ("header.php");
    GraphicAdmin($hlpfile);
    OpenTable();
    $result = mysql_query("select * from config");
    list($allow_html,$allow_bbcode,$allow_sig,$posts_per_page,$hot_threshold,$topics_per_page,$allow_upload_forum,$allow_forum_hide,$forum_attachments,$rank1,$rank2,$rank3,$rank4,$rank5,$anti_flood,$solved) = mysql_fetch_row($result);
    echo "<table width=\"100%\" cellspacing=\"2\" cellpadding=\"2\" border=\"0\"><tr><td CLASS=\"HEADER\">\n";
    echo adm_translate("Configuration des Forums");
    echo "</td></tr></table>\n";
    echo "<form action=\"admin.php\" method=\"post\">
    <table width=\"100%\" cellspacing=\"0\" cellpadding=\"2\" border=\"0\"><tr>\n<td>
    ".adm_translate("Autoriser le HTML : ")." </td><td>";
    if ($allow_html==1) {
       echo "<input type=\"radio\" name=\"allow_html\" value=\"1\" checked> ".adm_translate("Oui")." <input type=\"radio\" name=\"allow_html\" value=\"0\"> ".adm_translate("Non");
    } else {
       echo "<input type=\"radio\" name=\"allow_html\" value=\"1\"> ".adm_translate("Oui")." <input type=\"radio\" name=\"allow_html\" value=\"0\" checked> ".adm_translate("Non");
    }
    echo"</td></tr>
    <tr><td>
    ".adm_translate("Autoriser les Smilies : ")." </td><td>";
    if ($allow_bbcode==1) {
       echo "<input type=\"radio\" name=\"allow_bbcode\" value=\"1\" checked> ".adm_translate("Oui")." <input type=\"radio\" name=\"allow_bbcode\" value=\"0\"> ".adm_translate("Non");
    } else {
       echo "<input type=\"radio\" name=\"allow_bbcode\" value=\"1\"> ".adm_translate("Oui")." <input type=\"radio\" name=\"allow_bbcode\" value=\"0\" checked> ".adm_translate("Non");
    }
    echo"</td></tr>
    <tr><td>
    ".adm_translate("Autoriser les Signatures :")."</td><td>";
    if ($allow_sig==1) {
       echo "<input type=\"radio\" name=\"allow_sig\" value=\"1\" checked> ".adm_translate("Oui")." <input type=\"radio\" name=\"allow_sig\" value=\"0\"> ".adm_translate("Non");
    } else {
       echo "<input type=\"radio\" name=\"allow_sig\" value=\"1\"> ".adm_translate("Oui")." <input type=\"radio\" name=\"allow_sig\" value=\"0\" checked> ".adm_translate("Non");
    }
    echo "</td></tr>
    <tr><td>
    ".adm_translate("Seuil pour les Sujet 'chauds' :")." </td><td width=\"30%\"><input class=\"TEXTBOX_STANDARD\" type=\"text\" name=\"hot_threshold\" size=\"4\" value=\"$hot_threshold\"></td></tr>
    <tr><td>
    ".adm_translate("Nombre de contributions par page : ")."<br /><small><i>".adm_translate("(C'est le nombre de contributions affichées pour chaque page relative à un Sujet)")."</i></small></td><td width=\"30%\"><input class=\"TEXTBOX_STANDARD\" type=\"text\" name=\"posts_per_page\" size=\"4\" value=\"$posts_per_page\"></td></tr>
    <tr><td>
    ".adm_translate("Sujets par forum :")."<br /><small><i>".adm_translate("(C'est le nombre de Sujets affichés pour chaque page relative à un Forum)")."</i></small></td><td width=\"30%\"><input class=\"TEXTBOX_STANDARD\" type=\"text\" name=\"topics_per_page\" size=\"4\" value=\"$topics_per_page\"></td></tr>
    <tr><td>
    ".adm_translate("Nombre maximum de contributions par IP et par période de 30 minutes (0=système inactif) :")."</td><td width=\"30%\"><input class=\"TEXTBOX_STANDARD\" type=\"text\" name=\"anti_flood\" size=\"3\" value=\"$anti_flood\"></td></tr>
    <tr><td>
    ".adm_translate("Activer le tri des contributions 'résolues' :")."</td><td>";
    if ($solved==1) {
       echo "<input type=\"radio\" name=\"solved\" value=\"1\" checked> ".adm_translate("Oui")." <input type=\"radio\" name=\"solved\" value=\"0\"> ".adm_translate("Non");
    } else {
       echo "<input type=\"radio\" name=\"solved\" value=\"1\"> ".adm_translate("Oui")." <input type=\"radio\" name=\"solved\" value=\"0\" checked> ".adm_translate("Non");
    }

    echo "<tr><td>
    ".adm_translate("Activer l'upload dans les forums ?")."</td><td width=\"30%\">";
    if ($allow_upload_forum) {
        echo "<input type=\"radio\" name=\"allow_upload_forum\" value=\"1\" checked>".adm_translate("Oui")." &nbsp;
        <input type=\"radio\" name=\"allow_upload_forum\" value=\"0\">".adm_translate("Non");
    } else {
        echo "<input type=\"radio\" name=\"allow_upload_forum\" value=\"1\">".adm_translate("Oui")." &nbsp;
        <input type=\"radio\" name=\"allow_upload_forum\" value=\"0\" checked>".adm_translate("Non");
    }
    echo "</td></tr><tr><td>
    ".adm_translate("Activer les textes cachés dans les forums ?")."</td><td width=\"30%\">";
    if ($allow_forum_hide==1) {
        echo "<input type=\"radio\" name=\"allow_forum_hide\" value=\"1\" checked>".adm_translate("Oui")." &nbsp;
        <input type=\"radio\" name=\"allow_forum_hide\" value=\"0\">".adm_translate("Non");
    } else {
        echo "<input type=\"radio\" name=\"allow_forum_hide\" value=\"1\">".adm_translate("Oui")." &nbsp;
        <input type=\"radio\" name=\"allow_forum_hide\" value=\"0\" checked>".adm_translate("Non");
    }
    echo "</td></tr><tr><td>
    ".adm_translate("Texte pour le rôle")." 1 :</td><td width=\"30%\">
    <input class=\"TEXTBOX_STANDARD\" type=\"text\" name=\"rank1\" size=\"50\" maxlength=\"255\" value=\"$rank1\">";
    echo "</td></tr><tr><td>
    ".adm_translate("Texte pour le rôle")." 2 :</td><td width=\"30%\">
    <input class=\"TEXTBOX_STANDARD\" type=\"text\" name=\"rank2\" size=\"50\" maxlength=\"255\" value=\"$rank2\">";
    echo "</td></tr><tr><td>
    ".adm_translate("Texte pour le rôle")." 3 :</td><td width=\"30%\">
    <input class=\"TEXTBOX_STANDARD\" type=\"text\" name=\"rank3\" size=\"50\" maxlength=\"255\" value=\"$rank3\">";
    echo "</td></tr><tr><td>
    ".adm_translate("Texte pour le rôle")." 4 :</td><td width=\"30%\">
    <input class=\"TEXTBOX_STANDARD\" type=\"text\" name=\"rank4\" size=\"50\" maxlength=\"255\" value=\"$rank4\">";
    echo "</td></tr><tr><td>
    ".adm_translate("Texte pour le rôle")." 5 :</td><td width=\"30%\">
    <input class=\"TEXTBOX_STANDARD\" type=\"text\" name=\"rank5\" size=\"50\" maxlength=\"255\" value=\"$rank5\">";

    echo "</td></tr></table><br />
    <input type=\"hidden\" name=\"op\" value=\"ForumConfigChange\">
    <input class=\"BOUTON_STANDARD\" type=\"submit\" value=\"".adm_translate("Changer")."\">
    </form>";
    closetable();
    include("footer.php");
}

function ForumConfigChange($allow_html,$allow_bbcode,$allow_sig,$posts_per_page,$hot_threshold,$topics_per_page,$allow_upload_forum,$allow_forum_hide,$rank1,$rank2,$rank3,$rank4,$rank5,$anti_flood,$solved) {
    mysql_query("update config set allow_html='$allow_html', allow_bbcode='$allow_bbcode', allow_sig='$allow_sig', posts_per_page='$posts_per_page', hot_threshold='$hot_threshold', topics_per_page='$topics_per_page', allow_upload_forum='$allow_upload_forum', allow_forum_hide='$allow_forum_hide', rank1='$rank1', rank2='$rank2', rank3='$rank3', rank4='$rank4', rank5='$rank5', anti_flood='$anti_flood', solved='$solved'");
    Q_Clean();
    Header("Location: admin.php?op=ForumConfigAdmin");
}
?>
