<?php
/************************************************************************/
/* DUNE by NPDS                                                         */
/* ===========================                                          */
/*                                                                      */
/* Based on PhpNuke 4.x source code                                     */
/* Based on Parts of phpBB                                              */
/*                                                                      */
/* NPDS Copyright (c) 2002-2010 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");
}
if (!stristr($_SERVER['PHP_SELF'],"admin.php")) { Access_Error(); }

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

function ForumConfigAdmin() {
    global $hlpfile;
    global $NPDS_Prefix;

    include ("header.php");
    GraphicAdmin($hlpfile);
    opentable();
    $result = sql_query("select * from ".$NPDS_Prefix."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) = sql_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=\"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=\"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=\"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=\"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=\"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=\"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=\"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=\"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=\"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=\"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=\"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=\"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) {
    global $NPDS_Prefix;

    sql_query("update ".$NPDS_Prefix."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");
}
?>