X-Git-Url: https://git.llucax.com/mecon/samurai.git/blobdiff_plain/14b7965388416e66c0d012ac6f001f9c877b5ce8..84f76d573967832523dfc728235a56f2b2e14dba:/sistema/local_lib/prepend.php?ds=sidebyside diff --git a/sistema/local_lib/prepend.php b/sistema/local_lib/prepend.php index 31a95f1..fd3706d 100644 --- a/sistema/local_lib/prepend.php +++ b/sistema/local_lib/prepend.php @@ -1,26 +1,45 @@ connect(); -if (!isset($_SESSION['samurai']['id_sistema']) && isset($_GET['id_sistema'])) { - $_SESSION['samurai']['id_sistema'] = $_GET['id_sistema']; -} -if (!isset($_SESSION['samurai']['login']) && isset($_GET['login'])) { - $_SESSION['samurai']['login'] = $_GET['login']; +if (PEAR::isError($DB)) { + $ERROR = new MECON_HTML_Error($DB->getMessage()); + echo $ERROR->toHtml(); + exit; } -//Realizo la conexion con la base de datos -$tmp = new Samurai_DB; -$DB =& $tmp->connect(); +//CARGO LAS VARIABLES DE SESION INTERNAS {{{ +if (!isset($_SESSION['usuario'])) { + header('Location: /sistemas/intranet/login?redirect='.$_SERVER['REQUEST_URI']); +} +if (isset($_GET['id_sistema'])) { + $_SESSION['samurai']['id_sistema'] = $_GET['id_sistema']; +} +elseif (($_SERVER['REQUEST_URI'] != "/sistemas/samurai/sel-sistema" && + $_SERVER['REQUEST_URI'] != + "/sistemas/samurai/sel-sistema?redirect=index")&& + !@$_SESSION['samurai']['id_sistema']) { + header('Location: /sistemas/samurai/sel-sistema?redirect=index'); +} +if (@$_SESSION['samurai']['id_sistema']) { + //Creo el objeto Permiso + $SAMURAI_PERM = new SAMURAI_Perm ($_SESSION['usuario'], + $_SESSION['samurai']['id_sistema'], $DB); +} +//}}} ?>