Exemple #1
0
 public function saveLogin(Login $login)
 {
     $id = (int) $login->getId();
     if ($id > 0) {
         $requete = $this->dbGateway->prepare("\n\t\tUPDATE backofficeaccess SET user_access = :user, pwd_access = :pwd, role_access = :role WHERE id_access = :id\n\t\t\t") or die(print_r($this->dbGateway->errors_info()));
         $requete->execute(array('id' => $id, 'user' => $login->getUser(), 'pwd' => $login->getPwd(), 'role' => $login->getRole()));
     } else {
         $requete = $this->dbGateway->prepare("INSERT into backofficeaccess(user_access, pwd_access, role_access) \n\t\t\t\t\tvalues(:user, :pwd, :role)") or die(print_r($this->dbGateway->error_info()));
         $requete->execute(array('user' => $login->getUser(), 'pwd' => $login->getPwd(), 'role' => $login->getRole()));
     }
 }
Exemple #2
0
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details. 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
 */
## Includes
require_once '..' . DIRECTORY_SEPARATOR . 'include.php';
require_once '..' . DIRECTORY_SEPARATOR . 'include_globals.php';
## Security validation's
$authCheck = new Login(USERDB_FILE_LOCATION, $config['use_domus_security']);
if (!$authCheck->login()) {
    header("Location: ../login.php?from=events/macros");
    exit;
}
if ($authCheck->getUser()->getSecurityLevel() > 1) {
    header("Location: ../index.php");
    exit;
}
$tpl->set('sec_level', $authCheck->getUser()->getSecurityLevel());
if (!isset($heyusched)) {
    gen_error(null, $lang['noscheddefined']);
    exit;
}
$schedObjs = $heyusched->getObjects();
$macros = $heyusched->getMacroObjects();
## Set template parameters
$tpl->set('title', $lang['macros']);
$tpl_body = new Template(TPL_FILE_LOCATION . 'macro_view.tpl');
$tpl_body->set('lang', $lang);
$tpl_body->set('macros', $macros);
Exemple #3
0
    try {
        CSRF::check($_POST['CSRF-key']);
    } catch (Exception $e) {
        unset($_POST);
        $_POST = [];
    }
}
// --- locale
if (Config::getSetting('locale', false)) {
    setlocale(LC_ALL, Config::getSetting('locale'));
}
// --- Login
if (Clockwork::isModuleLoaded('Login') && !defined('CW_CRON') && !defined('CW_SKIP_LOGIN')) {
    new Login();
    $_loginpage = Config::getSetting('login_loginpage', false, false) ? Config::getSetting('login_loginpage') : 'login/';
    $_allowed = Config::getSetting('login_no_login', false, false) ? Config::getSetting('login_no_login') : [];
    $_allowed[] = $_loginpage;
    if (!Login::getUser() && !in_array(substr(strpos($_SERVER['REQUEST_URI'], '?') !== false ? stristr($_SERVER['REQUEST_URI'], '?', true) : $_SERVER['REQUEST_URI'], 1), $_allowed)) {
        redirect($_loginpage);
    }
}
// --- app
if (!defined('CW_CRON') && !defined('CW_OVERRIDE_TEMPLATE')) {
    if (Config::getSetting('load_template_engine', false, true) && !isset($template)) {
        $template = new Template();
        include_once APP_DIR . 'index.php';
        $template->loadFromURL();
    } else {
        include_once APP_DIR . 'index.php';
    }
}
Exemple #4
0
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details. 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
 */
## Includes
require_once '..' . DIRECTORY_SEPARATOR . 'include.php';
## Security validation must be checked
$authCheck = new Login(USERDB_FILE_LOCATION, $config['use_domus_security']);
if (!$authCheck->login()) {
    header("Location: ../login.php?from=utility/status");
    exit;
}
//if($authCheck->getUser()->getSecurityLevel() > 2) {
//	header("Location: ../index.php");
//	exit();
//}
$tpl->set('sec_level', $authCheck->getUser()->getSecurityLevel());
## Set template parameters
$tpl->set('title', $lang['status']);
$tpl_body = new Template(TPL_FILE_LOCATION . 'systemstatus.tpl');
$tpl_body->set('lang', $lang);
$tpl_body->set('config', $config);
$tpl_body->set('sec_level', $authCheck->getUser()->getSecurityLevel());
## Display the page
if (!empty($tpl_body)) {
    $tpl->set('content', $tpl_body);
}
echo $tpl->fetch(TPL_FILE_LOCATION . 'layout.tpl');
Exemple #5
0
$dirname = dirname(__FILE__);
require_once $dirname . DIRECTORY_SEPARATOR . 'include.php';
if (!isset($_SESSION['filesChecked']) || !$_SESSION['filesChecked']) {
    header("Location: utility/diagnostic.php?from=index");
    exit;
}
## Security validation's
## Setup the userdb if it does not exist.
require_once $dirname . DIRECTORY_SEPARATOR . 'utility/setupuserdb.php';
setUpUserDB();
$authCheck = new Login(USERDB_FILE_LOCATION, $config['use_domus_security']);
if (!$authCheck->login()) {
    header("Location: login.php?from=index");
    exit;
}
$tpl->set('sec_level', $authCheck->getUser()->getSecurityLevel());
$tpl->set('sec_level_type', $authCheck->getUser()->getSecurityLevelType());
// start/stop controls for heyu
if (isset($_GET["daemon"]) && $authCheck->getUser()->getSecurityLevel() <= 2) {
    try {
        heyu_ctrl($config, $_GET["daemon"]);
    } catch (Exception $e) {
        gen_error("heyu " . $_GET["daemon"], $e->getMessage());
        exit;
    }
}
// get which page is open
$page = isset($_GET['page']) ? $_GET['page'] : "domus_home_page";
// set page title
$tpl->set('title', ucwords($page));
$tpl->set('page', $page);
Exemple #6
0
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details. 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
 */
## Includes
require_once '..' . DIRECTORY_SEPARATOR . 'include.php';
require_once '..' . DIRECTORY_SEPARATOR . 'include_globals.php';
## Security validation's
$authCheck = new Login(USERDB_FILE_LOCATION, $config['use_domus_security']);
if (!$authCheck->login()) {
    header("Location: ../login.php?from=events/triggers");
    exit;
}
if ($authCheck->getUser()->getSecurityLevel() > 1) {
    header("Location: ../index.php");
    exit;
}
$tpl->set('sec_level', $authCheck->getUser()->getSecurityLevel());
if (!isset($heyusched)) {
    gen_error(null, $lang['noscheddefined']);
    exit;
}
$aliases = $heyuconf->getAliases($authCheck->getUser());
$schedObjs = $heyusched->getObjects();
$macros = $heyusched->getMacroObjects();
$triggers = $heyusched->getTriggerObjects();
## Set template parameters
$tpl->set('title', $lang['triggers']);
$tpl_body = new Template(TPL_FILE_LOCATION . 'trigger_view.tpl');
Exemple #7
0
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details. 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
 */
## Includes
require_once '..' . DIRECTORY_SEPARATOR . 'include.php';
require_once '..' . DIRECTORY_SEPARATOR . 'include_globals.php';
## Security validation's
$authCheck = new Login(USERDB_FILE_LOCATION, $config['use_domus_security']);
if (!$authCheck->login()) {
    header("Location: ../login.php?from=admin/aliases");
    exit;
}
if ($authCheck->getUser()->getSecurityLevel() != 0) {
    header("Location: ../index.php");
    exit;
}
$tpl->set('sec_level', $authCheck->getUser()->getSecurityLevel());
## Get heyu conf & aliases
$settings = $heyuconf->getObjects();
$aliases = $heyuconf->getAliases($authCheck->getUser());
$floorPlan = $heyuconf->getFloorPlan($authCheck->getUser());
$groupings = $groups->getElementObjects(ALL_OBJECTS_D);
$modules = $modtypes->getElementObjects(ALL_OBJECTS_D);
## Disallowed characters for alias label (separator |)
$chars = '/ã|é|à|ç|õ|ñ|è|ñ|ª|º|~|è|!|"|\\#|\\$|\\^|%|\\&|\\?|\\«|\\»/';
## Set template parameters
$tpl->set('title', $lang['aliases']);
$tpl->set('page', 'aliases');
Exemple #8
0
 public function cadastraLogin(Login $l)
 {
     return $this->cadastraLogin2($l->getUser(), $l->getSenha(), $l->getNivel());
 }
Exemple #9
0
<?php

include_once '../bd/LoginDAO.php';
include_once '../modelo/Modelo.php';
$login = $_POST['log'];
$pass = $_POST['password'];
$lDao = new LoginDAO();
$vet = $lDao->buscaLogin($login, $pass);
if (sizeof($vet) > 1) {
    //resultado de consulta com usuário valido encontrado
    $lTemp = new Login($vet['usuario'], $vet['senha'], $vet['nivel']);
    session_start();
    $_SESSION['nivel'] = $lTemp->getNivel();
    $_SESSION['usuario'] = $lTemp->getUser();
    //if($lTemp->getNivel() === "ATENDENTE")
    header("Location: ../visao/vAtendente.php");
    //elseif ($lTemp->getNivel() === "ADMINISTRADOR") {
    //header("Location: ../visao/vAtendente.php");
    //header("Location: ../visao/vAdmin.php");
    //}
} elseif (sizeof($vet) < 2) {
    header("Location: ../visao/vLogin.php?mess= login ou senha incorreta");
    //resultado vazio de consulta
    echo 'nao encontrado';
} else {
    header("Location: ../visao/vLogin.php?mess= login ou senha incorreta");
    //erro desconhecido ounulo
}
Exemple #10
0
<?php

// // Require User class to check if user is logged in
// require 'php/class/user.php';
// $user = new User();
//
// // If user is logged in, redirect to index page
// session_start();
// if ($user->isLoggedIn()) { header('Location: index.php'); die(); }
// If user posted data in page reload, start verifing user input
if (isset($_POST['submit'])) {
    // Require Login class to verify input data and insert user into database
    require 'php/class/login.php';
    $login = new Login();
    if ($_POST['submit'] == 'login') {
        if ($login->getUser()) {
            header('Location: index.php');
        }
    } else {
        if ($_POST['submit'] == 'register') {
            if ($login->insertUser()) {
                header('Location: index.php');
            }
        }
    }
}
?>

<!DOCTYPE html>
<html>
<head>