Example #1
0
defined('_PHP_CONGES') or die('Restricted access');
/*************************************/
// recup des parametres reçus :
// SERVER
$u_login = getpost_variable('u_login');
$u_login_to_update = getpost_variable('u_login_to_update');
$new_pwd1 = getpost_variable('new_pwd1');
$new_pwd2 = getpost_variable('new_pwd2');
/*************************************/
if ($u_login != "") {
    echo "<H1>" . _('admin_chg_passwd_titre') . " : {$u_login} .</H1>\n\n";
    modifier($u_login, $onglet, $DEBUG);
} else {
    if ($u_login_to_update != "") {
        echo "<H1>" . _('admin_chg_passwd_titre') . " : {$u_login_to_update} .</H1>\n\n";
        commit_update($u_login_to_update, $new_pwd1, $new_pwd2, $DEBUG);
    } else {
        // renvoit sur la page principale .
        redirect(ROOT_PATH . 'admin/admin_index.php?session=' . $session . '&onglet=admin-users', false);
    }
}
/*********************************************************************************/
/*  FONCTIONS   */
/*********************************************************************************/
function modifier($u_login, $onglet, $DEBUG = FALSE)
{
    $PHP_SELF = $_SERVER['PHP_SELF'];
    $session = session_id();
    /********************/
    /* Etat utilisateur */
    /********************/
    $tab_new_reliquat = getpost_variable('tab_new_reliquat');
    $tab_new_user['login'] = getpost_variable('new_login');
    $tab_new_user['nom'] = getpost_variable('new_nom');
    $tab_new_user['prenom'] = getpost_variable('new_prenom');
    $tab_new_user['quotite'] = getpost_variable('new_quotite');
    $tab_new_user['is_resp'] = getpost_variable('new_is_resp');
    $tab_new_user['resp_login'] = getpost_variable('new_resp_login');
    $tab_new_user['is_admin'] = getpost_variable('new_is_admin');
    $tab_new_user['is_hr'] = getpost_variable('new_is_hr');
    $tab_new_user['is_active'] = getpost_variable('new_is_active');
    $tab_new_user['see_all'] = getpost_variable('new_see_all');
    $tab_new_user['email'] = getpost_variable('new_email');
    $tab_new_user['jour'] = getpost_variable('new_jour');
    $tab_new_user['mois'] = getpost_variable('new_mois');
    $tab_new_user['year'] = getpost_variable('new_year');
    commit_update($u_login_to_update, $tab_new_user, $tab_new_jours_an, $tab_new_solde, $tab_new_reliquat, $tab_checkbox_sem_imp, $tab_checkbox_sem_p, $DEBUG);
    redirect(ROOT_PATH . 'admin/admin_index.php?session=' . $session . '&onglet=admin-users', false);
    exit;
} else {
    // renvoit sur la page principale .
    redirect(ROOT_PATH . 'admin/admin_index.php?session=' . $session . '&onglet=admin-users', false);
    exit;
}
/*************************************************************************************************/
/*   FONCTIONS    */
/*************************************************************************************************/
function modifier($u_login, $tab_checkbox_sem_imp, $tab_checkbox_sem_p, $onglet, $DEBUG = FALSE)
{
    $PHP_SELF = $_SERVER['PHP_SELF'];
    $session = session_id();
    // recup du tableau des types de conges (seulement les conges)
defined('_PHP_CONGES') or die('Restricted access');
$session = isset($_GET['session']) ? $_GET['session'] : (isset($_POST['session']) ? $_POST['session'] : session_id());
/*************************************/
// recup des parametres reçus :
$group = getpost_variable('group');
$group_to_update = getpost_variable('group_to_update');
$new_groupname = getpost_variable('new_groupname');
$new_comment = getpost_variable('new_comment');
$new_double_valid = getpost_variable('new_double_valid');
/*************************************/
// TITRE
echo "<H1>" . _('admin_modif_groupe_titre') . "</H1>\n\n";
if ($group != "") {
    modifier($group, $onglet, $DEBUG);
} elseif ($group_to_update != "") {
    commit_update($group_to_update, $new_groupname, $new_comment, $new_double_valid, $DEBUG);
} else {
    // renvoit sur la page principale .
    redirect(ROOT_PATH . 'admin/admin_index.php?session=' . $session . '&onglet=admin-group', false);
}
/**************************************************************************************/
/**********  FONCTIONS  ***************************************************************/
function modifier($group, $onglet, $DEBUG = FALSE)
{
    $PHP_SELF = $_SERVER['PHP_SELF'];
    $session = session_id();
    // Récupération des informations
    $sql1 = 'SELECT g_groupename, g_comment, g_double_valid FROM conges_groupe WHERE g_gid = \'' . SQL::quote($group) . '\'';
    // AFFICHAGE TABLEAU
    echo '<form action="' . $PHP_SELF . '?session=' . $session . '&onglet=' . $onglet . '&group_to_update=' . $group . '" method="POST">';
    echo "<table cellpadding=\"2\" class=\"tablo\">\n";