Esempio n. 1
0
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*************************************************************************************************/
define('_PHP_CONGES', 1);
define('ROOT_PATH', '../');
include ROOT_PATH . 'define.php';
defined('_PHP_CONGES') or die('Restricted access');
$session = isset($_GET['session']) ? $_GET['session'] : (isset($_POST['session']) ? $_POST['session'] : "");
if (file_exists(CONFIG_PATH . 'config_ldap.php')) {
    include CONFIG_PATH . 'config_ldap.php';
}
include ROOT_PATH . 'fonctions_conges.php';
include INCLUDE_PATH . 'fonction.php';
if (!isset($_SESSION['config'])) {
    $_SESSION['config'] = init_config_tab();
}
// on initialise le tableau des variables de config
include INCLUDE_PATH . 'session.php';
$session = isset($_GET['session']) ? $_GET['session'] : (isset($_POST['session']) ? $_POST['session'] : "");
//$DEBUG = TRUE ;
$DEBUG = FALSE;
// verif des droits du user à afficher la page
verif_droits_user($session, "is_admin", $DEBUG);
/*** initialisation des variables ***/
/*************************************/
// recup des parametres reçus :
// SERVER
$PHP_SELF = $_SERVER['PHP_SELF'];
// GET / POST
$action = getpost_variable('action');
Esempio n. 2
0
 public static function commit_saisie(&$tab_new_values, $session)
 {
     $PHP_SELF = $_SERVER['PHP_SELF'];
     $return = '';
     if ($session == "") {
         $URL = "{$PHP_SELF}";
     } else {
         $URL = "{$PHP_SELF}?session={$session}";
     }
     $timeout = 2;
     // temps d'attente pour rafraichir l'écran après l'update !
     foreach ($tab_new_values as $key => $value) {
         // CONTROLE gestion_conges_exceptionnels
         // si désactivation les conges exceptionnels, on verif s'il y a des conges exceptionnels enregistres ! si oui : changement impossible !
         if ($key == "gestion_conges_exceptionnels" && $value == "FALSE") {
             $sql_abs = "SELECT ta_id, ta_libelle FROM conges_type_absence WHERE ta_type='conges_exceptionnels' ";
             $ReqLog_abs = \includes\SQL::query($sql_abs);
             if ($ReqLog_abs->num_rows != 0) {
                 $return .= '<b>' . _('config_abs_desactive_cong_excep_impossible') . '</b><br>';
                 $value = "TRUE";
                 $timeout = 5;
             }
         }
         // CONTROLE jour_mois_limite_reliquats
         // si modif de jour_mois_limite_reliquats, on verifie le format ( 0 ou jj-mm) , sinon : changement impossible !
         if ($key == "jour_mois_limite_reliquats" && $value != "0") {
             $t = explode("-", $value);
             if (checkdate($t[1], $t[0], date("Y")) == FALSE) {
                 $return .= '<b>' . _('config_jour_mois_limite_reliquats_modif_impossible') . '</b><br>';
                 $sql_date = "SELECT conf_valeur FROM conges_config WHERE conf_nom='jour_mois_limite_reliquats' ";
                 $ReqLog_date = \includes\SQL::query($sql_date);
                 $data = $ReqLog_date->fetch_row();
                 $value = $data[0];
                 $timeout = 5;
             }
         }
         if (preg_match("/_installed\$/", $key) && $value == "1") {
             $plugin = explode("_", $key);
             $plugin = $plugin[0];
             install_plugin($plugin);
         } elseif (preg_match("/_installed\$/", $key) && $value == "0") {
             $plugin = explode("_", $key);
             $plugin = $plugin[0];
             uninstall_plugin($plugin);
         }
         if (preg_match("/_activated\$/", $key) && $value == "1") {
             $plugin = explode("_", $key);
             $plugin = $plugin[0];
             activate_plugin($plugin);
         } elseif (preg_match("/_activated\$/", $key) && $value == "0") {
             $plugin = explode("_", $key);
             $plugin = $plugin[0];
             disable_plugin($plugin);
         }
         // Mise à jour
         $sql2 = 'UPDATE conges_config SET conf_valeur = \'' . addslashes($value) . '\' WHERE conf_nom ="' . \includes\SQL::quote($key) . '" ';
         $ReqLog2 = \includes\SQL::query($sql2);
     }
     $_SESSION['config'] = init_config_tab();
     // on re-initialise le tableau des variables de config
     // enregistrement dans les logs
     $comment_log = "nouvelle configuration de php_conges ";
     log_action(0, "", "", $comment_log);
     $return .= '<span class="messages">' . _('form_modif_ok') . '</span><br>';
     $return .= '<META HTTP-EQUIV=REFRESH CONTENT="' . $timeout . '; URL=' . $URL . '">';
     return $return;
 }
Esempio n. 3
0
    /**
     * Encapsule le comportement du module calendrier
     *
     * @param string $session
     *
     * @return void
     * @access public
     * @static
     */
    public static function calendrierModule($session)
    {
        $return = '';
        if (substr($session, 0, 9) != "phpconges") {
            session_start();
            $_SESSION['config'] = init_config_tab();
            // on initialise le tableau des variables de config
            if ($_SESSION['config']['consult_calendrier_sans_auth'] == FALSE) {
                redirect(ROOT_PATH . 'index.php');
            }
        } else {
            include_once INCLUDE_PATH . 'session.php';
        }
        $script = '<script language=javascript>
        function afficher(id)
        {
            el = document.getElementById(id);
            el.style.display = "block";
        }

        function cacher(id)
        {
            el = document.getElementById(id);
            el.style.display = "none";
        }
        </script>';
        /*************************************/
        // recup des parametres reçus :
        // SERVER
        $PHP_SELF = $_SERVER['PHP_SELF'];
        // GET / POST
        $selected = getpost_variable('selected');
        $printable = getpost_variable('printable', 0);
        $year = getpost_variable('year', date("Y"));
        $mois = getpost_variable('mois', date("n"));
        $first_jour = getpost_variable('first_jour', 1);
        //    $first_load    = getpost_variable('first_load', "Y") ;
        $select_groupe = getpost_variable('select_groupe', 0);
        /*************************************/
        // on initialise le tableau global des jours fériés s'il ne l'est pas déjà :
        if (!isset($_SESSION["tab_j_feries"])) {
            init_tab_jours_feries();
        }
        // renvoit un tableau de tableau contenant les infos des types de conges et absences
        $tab_type_absence = recup_tableau_tout_types_abs();
        //    echo "<hr align=\"center\" size=\"2\" width=\"90%\"> \n";
        $jour_today = date("j");
        $mois_today = date("m");
        $year_today = date("Y");
        $timestamp_today = mktime(0, 0, 0, $mois_today, $jour_today, $year_today);
        $mois_timestamp = mktime(0, 0, 0, $mois, 1, $year);
        $nom_mois = date_fr("F", $mois_timestamp);
        $group_names = get_groups_name();
        // AFFICHAGE PAGE
        $return .= '<div id="main-calendar" class="main-content">';
        if ($_SESSION['config']['gestion_groupes'] && $printable != 1) {
            // affiche le select des groupes du user OU les groupes du resp (si user est resp) OU tous les groupes (si option de config ok)
            $return .= '<div class="pull-right">';
            $return .= \calendrier\Fonctions::affiche_select_groupe($select_groupe, $selected, $printable, $year, $mois, $first_jour, $group_names);
            $return .= '</div>';
        }
        $return .= '<h1>' . _('calendrier_titre') . '</h1>';
        if ($_SESSION['config']['gestion_groupes'] && $select_groupe != 0) {
            $return .= '<h2>' . _('divers_groupe') . ' : <strong>' . $group_names[$select_groupe] . '</strong></h2>';
        }
        $return .= '<hr/>';
        $return .= '<h3 class="current-month">' . $nom_mois . ' ' . $year . '</h3>';
        $return .= '<hr/>';
        /**********************/
        /* Boutons de defilement */
        if ($printable != 1) {
            $return .= \calendrier\Fonctions::affichage_boutons_defilement($first_jour, $mois, $year, $select_groupe);
        }
        /***********************************/
        /* AFFICHAGE  TABLEAU (CALENDRIER) */
        $return .= \calendrier\Fonctions::affichage_calendrier($year, $mois, $first_jour, $timestamp_today, $printable, $selected, $tab_type_absence, $select_groupe);
        /**********************/
        /* Boutons de defilement */
        if ($printable != 1) {
            $return .= '<tr>';
            $return .= '<td align="center">';
            $return .= \calendrier\Fonctions::affichage_boutons_defilement($first_jour, $mois, $year, $select_groupe);
            $return .= '</td>';
            $return .= '</tr>';
        }
        $return .= '<tr>';
        $return .= '</tr>';
        $return .= '</table>';
        if ($printable != 1) {
            $return .= '<br/><a href="' . $PHP_SELF . '?session=' . $session . '&printable=1&year=' . $year . '&mois=' . $mois . '&first_jour=' . $first_jour . '&select_groupe=' . $select_groupe . '" target="_blank" method="post">';
            $return .= '<i class="fa fa-print"></i>';
            $return .= _('calendrier_imprimable');
            $return .= '</a>';
            $return .= '<br><a href="calendrier-pdf.php?session=' . $session . '&printable=1&year=' . $year . '&mois=' . $mois . '&first_jour=' . $first_jour . '&select_groupe=' . $select_groupe . '" target="_blank" method="post">';
            $return .= '<img src="' . TEMPLATE_PATH . 'img/pdf_22x22_2.png" width="22" height="22" border="0" title="Version PDF">';
            $return .= 'PDF';
            $return .= '</a>';
        }
        $return .= '<br><br><table cellpadding="1" class="calendar table-responsive table-bordered table-stripped">';
        $return .= '<tr align="center">';
        $return .= '<td bgcolor="#FFFFFF" class="cal-legende"> - </td>';
        $return .= '<td class="cal-legende"> </td>';
        $return .= '</tr>';
        $return .= '<tr align="center">';
        $return .= '<td bgcolor="#DCDCDC" class="cal-legende"> - </td>';
        $return .= '<td class="cal-legende">' . _('calendrier_legende_we') . '</td>';
        $return .= '</tr>';
        $return .= '<tr align="center">';
        $return .= '<td bgcolor="#8addf2" class="cal-legende">abs</td>';
        $return .= '<td class="cal-legende">' . _('calendrier_legende_conges') . '</td>';
        $return .= '</tr>';
        $return .= '<tr align="center">';
        $return .= '<td bgcolor="#ffc1ff" class="cal-legende">abs</td>';
        $return .= '<td class="cal-legende">' . _('calendrier_legende_demande') . '</td>';
        $return .= '</tr>';
        $return .= '<tr align="center">';
        $return .= '<td bgcolor="#ffffad" class="cal-legende"> - </td>';
        $return .= '<td class="cal-legende">' . _('calendrier_legende_part_time') . '</td>';
        $return .= '</tr>';
        $return .= '<tr align="center">';
        $return .= '<td bgcolor="#C3C3C3" class="cal-legende">abs</td>';
        $return .= '<td class="cal-legende">' . _('calendrier_legende_abs') . '</td>';
        $return .= '</tr>';
        $return .= '<tr align="center">';
        $return .= '<td bgcolor="#CEB6FF" class="cal-legende">abs</td>';
        $return .= '<td class="cal-legende">' . _('divers_fermeture') . '</td>';
        $return .= '</tr>';
        $return .= '</table>';
        $return .= '</div>';
        /********************/
        /* bouton retour */
        /********************/
        if ($printable == 1) {
            // appel de la fenetre d'impression directe
            ?>
            <script type="text/javascript" language="javascript1.2">
            <!--
            // Do print the page
            if (typeof(window.print) != 'undefined') {
                window.print();
            }
            //-->
            </script>
            <?php 
        }
        return $return;
    }
Esempio n. 4
0
function session_create($username)
{
    if ($username != "") {
        if (isset($_SESSION)) {
            unset($_SESSION);
        }
        $session = "phpconges" . md5(uniqid(rand()));
        session_name($session);
        session_id($session);
        session_start();
        $_SESSION['userlogin'] = $username;
        $maintenant = time();
        $_SESSION['timestamp_start'] = $maintenant;
        $_SESSION['timestamp_last'] = $maintenant;
        if (function_exists('init_config_tab')) {
            $_SESSION['config'] = init_config_tab();
        }
        // on initialise le tableau des variables de config
        //$session=session_id();
        if (isset($_REQUEST['lang'])) {
            $_SESSION['lang'] = $_REQUEST['lang'];
        }
    } else {
        $session = "";
    }
    $comment_log = 'Connexion de ' . $username;
    log_action(0, "", $username, $comment_log);
    return $session;
}
Esempio n. 5
0
 /**
  * Encapsule le comportement du module d'export ics
  *
  * @return void
  * @access public
  * @static
  */
 public static function exportICSModule()
 {
     $_SESSION['config'] = init_config_tab();
     // on initialise le tableau des variables de config
     if ($_SESSION['config']['export_ical'] == FALSE) {
         header('HTTP/1.0 403 Forbidden');
         exit('403 Forbidden');
     }
     //on récupère le hash du user
     $usrh = $_GET['usr'];
     //on récupère le nom associé au hash
     $session_username = unhash_user($usrh);
     if ($session_username != "") {
         \export\Fonctions::export_ical($session_username);
     }
 }