0) {
session_write_close();
}
session_start();
session_register( 'AppUI' );
// write the HTML headers
header ("Expires: Mon, 26 Jul 1995 05:00:00 GMT"); // Date in the past
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header ("Pragma: no-cache"); // HTTP/1.0
// Check that the user has correctly set the root directory
is_file( "{$dPconfig['root_dir']}/includes/config.php" ) or die( "ERRO FATAL : Root directory in configuration file probably incorrect." );
// Do not change version for support reasons
$dPconfig['version'] = "1.0";
// check if session has previously been initialised
if (!isset( $_SESSION['AppUI'] ) || isset($_GET['logout'])) {
$_SESSION['AppUI'] = new CAppUI();
}
$AppUI =& $_SESSION['AppUI'];
$AppUI->setConfig( $dPconfig );
$AppUI->checkStyle();
// load the commonly used classes
require_once( $AppUI->getSystemClass( 'date' ) );
require_once( $AppUI->getSystemClass( 'dp' ) );
// load the db handler
require_once( "./includes/db_connect.php" );
require_once( "./misc/debug.php" );
// load default preferences if not logged in
if ($AppUI->doLogin()) {
$AppUI->loadPrefs( 0 );
}
include "lib/spaw/config/spaw_control.config.php";
// check if the user is trying to log in
if (isset($_POST['login'])) {
$username = dPgetParam( $_POST, 'username', '' );
$password = dPgetParam( $_POST, 'password', '' );
$redirect = dPgetParam( $_REQUEST, 'redirect', '' );
$redirecte = dPgetParam( $_POST, "redirecte", 0);
$ok = $AppUI->login( $username, $password );
if (!$ok) {
@include_once( "./locales/core.php" );
$AppUI->setMsg( 'Sua Tentativa de Login Falhou
Sua senha ou login estão incorretos' );
}
if ($redirecte) {
$AppUI->redirect( $redirecte );
} else {
$AppUI->redirect( 'm=home' );
}
}
// supported since PHP 4.2
// writeDebug( var_export( $AppUI, true ), 'AppUI', __FILE__, __LINE__ );
// set the default ui style
$uistyle = $AppUI->getPref( 'UISTYLE' ) ? $AppUI->getPref( 'UISTYLE' ) : $AppUI->cfg['host_style'];
// clear out main url parameters
$m = '';
$a = '';
$u = '';
// check if we are logged in
if ($AppUI->doLogin()) {
$AppUI->setUserLocale();
// load basic locale settings
@include_once( "./locales/$AppUI->user_locale/locales.php" );
@include_once( "./locales/core.php" );
setlocale( LC_TIME, $AppUI->user_locale );
$redirect = @$_SERVER['QUERY_STRING'];
if (strpos( $redirect, 'logout' ) !== false) {
$redirect = 'm=home';
}
require "./style/$uistyle/login.php";
// destroy the current session and output login page
session_unset();
session_destroy();
exit;
}
// bring in the rest of the support and localisation files
// RESPONSÁVEL PELO APARECIMENTO DE QUALQUER INFORMAÇÃO
require_once( "./includes/permissions.php" );
// set the module and action from the url
$m = dPgetParam( $_GET, 'm', getReadableModule() );
$u = dPgetParam( $_GET, 'u', '' );
$a = dPgetParam( $_GET, 'a', 'index' );
@include_once( "./functions/" . $m . "_func.php" );
// TODO: canRead/Edit assignements should be moved into each file
// check overall module permissions
// these can be further modified by the included action files
$canRead = !getDenyRead( $m );
$canEdit = !getDenyEdit( $m );
$canAuthor = $canEdit;
$canDelete = $canEdit;
// load module based locale settings
@include_once( "./locales/$AppUI->user_locale/locales.php" );
@include_once( "./locales/core.php" );
setlocale( LC_TIME, $AppUI->user_locale );
if ( !$suppressHeaders ) {
// output the character set header
if (isset( $locale_char_set )) {
header("Content-type: text/html;charset=$locale_char_set");
}
}
// A PARTIR DAQUI ACABA OS HEADERS
/*
echo $m;
echo 'M<||>A';
echo $a;
*
* TODO: Permissions should be handled by each file.
* Denying access from index.php still doesn't asure
* someone won't access directly skipping this security check.
*
// bounce the user if they don't have at least read access
if (!(
// however, some modules are accessible by anyone
$m == 'public' ||
($m == 'admin' && $a == 'viewuser')
)) {
if (!$canRead) {
$AppUI->redirect( "m=public&a=access_denied" );
}
}
*/
// A PARTIR DO M PASSADO COMO PARAMETRO ATRAVES DO GET,
// ELE TRAZ O MÕDULO E A CLASSE CORRESPONDENTE
// include the module class file
//require_once( "./modules/communication/jobscheduler.php" );
@include_once( $AppUI->getModuleClass( $m ));
@include_once( "./modules/$m/" . ($u ? "$u/" : "") . "$u.class.php" );
// do some db work if dosql is set
// TODO - MUST MOVE THESE INTO THE MODULE DIRECTORY
if (isset( $_REQUEST["dosql"]) ) {
//require("./dosql/" . $_REQUEST["dosql"] . ".php");
require ("./modules/$m/" . $_REQUEST["dosql"] . ".php");
}
// start output proper
// MONTA A TELA A PARTIR DA MENSAGEM DE BEMVINDO AO USUÁRIO
include "./style/$uistyle/overrides.php";
ob_start();
$pages = 'pages';
if ($AppUI->site_lang == 'i')
$pages = 'ingles';
// O HEADER CONTEM O MENU E AS INFORMACOES DO ESTILO DA PÁGINA
if(!$suppressHeaders) {
require "./style/$uistyle/header.php";
}
// CHAMA O ARQUIVO CORRESPONDENTE AO MÓDULO QUE ESTÁ EM AÇÃO.
//require "./modules/$m/" . ($u ? "$u/" : "") . "$a.php";
$dir = dPgetParam( $_GET, 'dir', 0 );
$st = dPgetParam( $_GET, 'st', 0 );
if (isset($_GET["st"]) && ($st != '0') ) {
require "./$pages/$st.php";
}
else{
if (isset($_GET["m"]) && ($m != '0') ) {
require "./modules/$m/" . ($u ? "$u/" : "") . "$a.php";
require "./style/$uistyle/footer.php";
}
}
ob_end_flush();
?>