public function __construct() { $this->db =& DatabaseConnections::getInstance()->getRadiusDB(); $this->radminDB =& DatabaseConnections::getInstance()->getRadminDB(); // Share SQL Query between functions $this->insert_radius_values_sql = $this->db->prepare('INSERT INTO radreply (Username, Attribute, op, Value) VALUES (?, ?, ?, ?)', array('text', 'text', 'text', 'text'), MDB2_PREPARE_MANIP); }
public function &getInstance($db = false, $Auth = false) { // Static reference of this class's instance. static $instance; if (!isset($instance)) { if ($db == false) { $db = DatabaseConnections::getInstance()->getRadminDB(); } if ($Auth == false) { $Auth = new \Grase\AnonAuth(); } $instance = new AdminLog($db, $Auth); } if (isset($instance) && $Auth != false) { $instance->Auth =& $Auth; } return $instance; }
case -3: $error = "Incorrect Login."; break; case -5: $errro = "Security Issue. Please login again"; break; default: $error = "Authentication Issue. Please report to Admin"; } if (isset($error)) { $templateEngine->assign("error", $error); } $templateEngine->displayPage('usermin_login.tpl'); exit; } $DatabaseConnections = new DatabaseConnections(); $Usermin = new DatabaseUsermin($DatabaseConnections->getRadiusDB()); $options = array('cryptType' => 'none', 'users' => $Usermin->getUsers()); $Auth = new Auth("Array", $options, "loginForm"); $Auth->setSessionName("GRASE Usermin"); $Auth->setAdvancedSecurity(array(AUTH_ADV_USERAGENT => true, AUTH_ADV_IPCHECK => true, AUTH_ADV_CHALLENGE => false)); $Auth->setIdle(120); $Auth->start(); if (!$Auth->checkAuth()) { echo "Should never get here"; // THIS CODE SHOULD NEVER RUN exit; } elseif (isset($_GET['logoff'])) { $Auth->logout(); $Auth->start(); } else {
break; case -5: $errro = T_("Security Issue. Please login again"); AdminLog::getInstance()->log("Security Issue With Login"); break; default: $error = T_("Authentication Issue. Please report to Admin"); AdminLog::getInstance()->log("Auth Issues: {$status}"); } if (isset($error)) { $templateEngine->assign("error", $error); } $templateEngine->displayPage('loginform.tpl'); exit; } $DatabaseConnections = new DatabaseConnections(); $options = array('dsn' => $DatabaseConnections->getRadminDSN(), 'cryptType' => 'sha1salt', 'sessionName' => 'GRASE Radius Admin For Internet', 'db_fields' => array('accesslevel')); $Auth = new Auth("MDB2_Salt", $options, "loginForm"); $Auth->setAdvancedSecurity(array(AUTH_ADV_USERAGENT => true, AUTH_ADV_IPCHECK => true, AUTH_ADV_CHALLENGE => false)); $Auth->setIdle(600); $AdminLog =& AdminLog::getInstance($DatabaseConnections->getRadminDB(), $Auth); if ($Auth->listUsers() == array()) { $templateEngine->assign("error", array(T_("No users defined in database. Please check your install"))); $templateEngine->displayPage('loginform.tpl'); exit; } $Auth->start(); if (!$Auth->checkAuth()) { echo "Should never get here"; // THIS CODE SHOULD NEVER RUN exit;