Ejemplo n.º 1
0
 function load($ifsses, $appid)
 {
     //Avant tout on check le browser
     //exit($appid);
     if (!check_browser()) {
         $errpage = "Navigateur non supporté<br> merci de contacter le Service Informatique de l'ONAPE.";
         header("location:ff.exe");
         exit(msgbox($errpage, 0, '', 45));
     }
     global $db;
     Cookie::close_session_open();
     //Cookie::session_autoclosed();
     //Set default App if need Session or not
     // $_GET['_tsk'] est le parametre qui appel l'application demandée
     //
     $default_applic_id = $ifsses == 1 ? 'login' : $appid;
     //exit(tg('_tsk'));
     if (tg('_tsk') != '0') {
         $app_id = tg('_tsk');
         $msg = "Vous n'êtes pas autorisé(e) à accéder à cette Application , redirection vers acceuil....  ";
         if (!$db->Query("SELECT * FROM task where app='{$app_id}'")) {
             $db->Kill($db->Error());
         }
         $array = $db->RowArray();
         $appc_idc = $array['id'];
         $needsession = $array['session'];
         if ($db->RowCount() <= 0) {
             exit(msgbox($msg, 0, './', 5));
         }
         //app autorized sans session
         $array_godapp = array(1, 2, 3, 4, 5, 6, 11, 21);
         $needajax = $array['ajax'];
         if ($needajax == 1) {
             exit(msgbox($msg . 'ajax', 0, './', 5));
         }
         if ($needsession == 1 && !isset($_SESSION['userid'])) {
             exit(msgbox($msg, 0, './', 5));
         }
         if (!in_array($appc_idc, $array_godapp)) {
             $sql = "SELECT *  FROM permission_users where perm=1 and  appid=" . $appc_idc . " and userid=" . $_SESSION['userid'];
             if (!$db->Query($sql)) {
                 $db->Kill(exit($sql));
             }
             if ($db->RowCount() <= 0) {
                 exit(msgbox($msg, 0, './', 5));
             }
         }
         //************************************
         $app_rep = $array['rep'];
         $app_file = $array['file'];
         $app_active = $array['dscrip'];
         define('ACTIV_APP', $array['dscrip']);
         //si l'application demandée n'a pas besoin de session retour à l'index
         if ($array['session'] == 0 && $ifsses == 2) {
             header('location:./');
         }
         //verif si application exist
         if ($app_rep != '') {
             $this->application = (require_once CONTROLLER_REP . SLASH . $app_rep . SLASH . $app_file . '_c.php');
         } else {
             header('location:./');
         }
     } else {
         if (!$db->Query("SELECT * FROM task where app='" . $default_applic_id . "'")) {
             $db->Kill('Error1');
         }
         $array = $db->RowArray();
         $app_rep = $array['rep'];
         $app_file = $array['file'];
         $app_active = $array['dscrip'];
         define('ACTIV_APP', $array['dscrip']);
         define('APP_ID', $array['id']);
         $this->application = (require_once CONTROLLER_REP . SLASH . $app_rep . SLASH . $app_file . '_c.php');
     }
     //end else
 }
Ejemplo n.º 2
0
 public static function session_autoclosed()
 {
     global $db;
     if (isset($_SESSION['ssid'])) {
         $ssid = $_SESSION['ssid'];
         $expired = $db->QuerySingleValue0("select expir from session where id='{$ssid}'");
         if ($expired != NULL) {
             Cookie::close_session_open();
             model::load('login', 'login');
             //Stop session
             stop_session();
             token::delimda();
             $msg = "Vous êtes déconnecté automatiquement pour inactivité de 5 min {$expired} {$ssid} , redirection vers page login....  ";
             exit(msgbox($msg, 0, './', 5));
         }
     }
 }
Ejemplo n.º 3
0
 public static function load($ifsses, $appid)
 {
     //Format Messages
     $msg_ajax = '<div class="alert alert-error"><strong><i class="icon-remove"></i>Attention!</strong><br> Vous n\'êtes pas autorisé(e) à accéder à cette application , redirection vers acceuil.... \\AJAX</div>';
     $msg_app = "Vous n'êtes pas autorisé(e) à accéder à cette application , redirection vers acceuil.... \\APP";
     $msg_file = "Vous n'êtes pas autorisé(e) à accéder à cette application , redirection vers acceuil.... \\FILE";
     $msg_perm = "Vous n'êtes pas autorisé(e) à accéder à cette application , redirection vers acceuil.... \\PERMISSION_USER";
     $msg_sess = "Vous n'êtes pas autorisé(e) à accéder à cette application , redirection vers acceuil.... \\SESSION_USER";
     //Avant tout on check le browser
     //exit($appid);
     if (!MInit::check_browser()) {
         $errpage = "Navigateur non supporté<br> merci de contacter le Service Informatique de <<CLIENT>>.";
         //header("location:ff.exe");
         exit(msgbox($errpage, 0, '', 45));
     }
     global $db;
     Cookie::close_session_open();
     $default_applic_id = $ifsses == 1 ? 'login' : $appid;
     //exit(Mreq::tg('_tsk'));
     $app_id = Mreq::tg('_tsk') != "0" ? Mreq::tg('_tsk') : $default_applic_id;
     if (!$db->Query("SELECT * FROM task where  app='{$app_id}' ")) {
         $db->Kill($db->Error());
     }
     if ($db->RowCount() == 0) {
         exit("3#{$msg_app}'");
     }
     $array = $db->RowArray();
     $appc_idc = $array['id'];
     $needsession = $array['session'];
     $app_rep = $array['rep'];
     $app_file = $array['file'];
     $app_ajax = $array['ajax'];
     $app_target = MPATH_MODULES . $app_rep . SLASH . $app_file . '_c.php';
     if ($app_ajax == 1) {
         exit("3#{$msg_ajax}");
     }
     //Check if is good appli not need session
     $good_app = $db->QuerySingleValue0("select modul from task where id = {$appc_idc}");
     if ($needsession == 1 && session::get('userid') == FALSE) {
         //exit("3#$msg_sess");
         header('location:./');
     }
     if ($needsession == 0 && session::get('userid') == TRUE) {
         //exit("3#$msg_sess");
         header('location:./');
     }
     if ($good_app == "0") {
         $sql = "SELECT *  FROM permission_users where perm=1 and  appid=" . $appc_idc . " and userid=" . $_SESSION['userid'];
         if (!$db->Query($sql)) {
             $db->Kill($db->Error());
         }
         if ($db->RowCount() <= 0) {
             exit("3#{$msg_perm} ");
         }
     }
     if (!file_exists($app_target)) {
         print "3#{$msg_file} {$app_target}";
     } else {
         define('ACTIV_APP', $array['dscrip']);
         define('MODUL_APP', $array['modul']);
         define('APP_ID', $array['id']);
         require_once $app_target;
     }
 }