/** * adds a row to the login history table * * WARNING! Multiple sets of options are supported only for LDAP class * * @param number $userID user id that has logged in * @param number $time unix timestamp of the login * * @access public */ public function addLoginToHistory($userID, $time = null) { if (is_null($time)) { $time = time(); } $this->dataHandler->addLoginToHistory($userID, $time, $this->id, $this->successfulOptionsID); }
* Users (types) allowed to access this module. */ $allowedUsersAr = array(AMA_TYPE_SWITCHER); /** * Get needed objects */ $neededObjAr = array(AMA_TYPE_SWITCHER => array('layout')); /** * Performs basic controls before entering this module */ $trackPageToNavigationHistory = false; require_once ROOT_DIR . '/include/module_init.inc.php'; require_once ROOT_DIR . '/browsing/include/browsing_functions.inc.php'; // MODULE's OWN IMPORTS require_once MODULES_LOGIN_PATH . '/config/config.inc.php'; $GLOBALS['dh'] = AMALoginDataHandler::instance(); $retArray = array(); if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST') { if (!isset($_POST['option_id']) && !isset($_POST['provider_id'])) { $retArray = array("status" => "ERROR", "msg" => translateFN("Non so cosa cancellare")); } else { if (isset($_POST['option_id'])) { if (isset($key) && strlen($key) > 0) { $result = $GLOBALS['dh']->deleteOptionByKey(intval($_POST['option_id']), trim($key)); $deletedElement = 'Chiave'; // translateFN delayed when building msg $vowel = 'a'; } else { $result = $GLOBALS['dh']->deleteOptionSet(intval($_POST['option_id'])); $deletedElement = 'Fonte'; // translateFN delayed when building msg
/** * calls and sets the parent instance method, and if !MULTIPROVIDER * checks if module_login_providers table is in the provider db. * * If found, use the provider DB else use the common * * @param string $dsn */ static function instance($dsn = null) { if (!MULTIPROVIDER && is_null($dsn)) { $dsn = MultiPort::getDSN($GLOBALS['user_provider']); } $theInstance = parent::instance($dsn); if (is_null(self::$dbToUse)) { self::$dbToUse = AMA_Common_DataHandler::instance(); if (!MULTIPROVIDER && !is_null($dsn)) { // must check if passed $dsn has the module login tables // execute this dummy query, if result is not an error table is there $sql = 'SELECT NULL FROM `' . self::$PREFIX . 'providers`'; // must use AMA_DataHandler because we are not able to // query AMALoginDataHandelr in this method! $ok = AMA_DataHandler::instance($dsn)->getOnePrepared($sql); if (!AMA_DB::isError($ok)) { self::$dbToUse = $theInstance; } } } return $theInstance; }