public static function reminderInvoker(Folder $folder) { $configuration = new Configuration(); //parameter to know the max gap between last parsing done on the folder. $invokeMinutes = $configuration->getConfiguration(ConfigurationKeys::$reminderInvokeMinutes); //parameter to know the max gap between notifications $intervalMinutes = $configuration->getConfiguration(ConfigurationKeys::$reminderIntervalMinutes); $invokeMinutes = intval($invokeMinutes); $intervalMinutes = intval($intervalMinutes); $parsedSinceMinutes = self::getDatesDifferenceInMinutes($folder->getLastParsedOn(), date("Y-m-d H:i:s")); if ($parsedSinceMinutes > 0) { //OK we have some minutes passed with no parsing undertook if ($parsedSinceMinutes > $invokeMinutes) { //if reminder already sent, check interval and send again if ($folder->getLastRemindedOn() != null) { $lastRemindedSince = self::getDatesDifferenceInMinutes($folder->getLastRemindedOn(), date("Y-m-d H:i:s")); if ($lastRemindedSince > $intervalMinutes) { self::sendNotification($folder); FolderDataStore::getInstance()->updateLastReminderDate($folder->getSeq()); } } else { self::sendNotification($folder); FolderDataStore::getInstance()->updateLastReminderDate($folder->getSeq()); } } else { //time still there to remind } } }
/** * Login base class constructor * @param w34u\ssp\Protect $session - session object * @param w34u\ssp\Template $tpl - template in which to wrap the form * @param bool $ignoreToken - dont use a token on the login form * @param bool $createForm - create the login form */ public function __construct($session, $tpl = "", $ignoreToken = false, $createForm = true) { if ($createForm) { parent::__construct($session, $tpl, $ignoreToken); } else { $this->cfg = Configuration::getConfiguration(); $this->db = SspDb::getConnection(); } }
/** * SSP site constructor * @param Protect $session - protection object * @param bool $translateAdmin - load admin translation files * @param string $template - main template name */ function __construct($session, $translateAdmin = false, $template = false) { $this->session = $session; $this->cfg = Configuration::getConfiguration(); $this->db = SspDb::getConnection(); if ($this->cfg->translate and $translateAdmin) { Protect::$tranlator->loadFile(false, 'admin'); } if ($template !== false) { $this->template = $template; } }
public function __construct() { $this->cfg = Configuration::getConfiguration(); $this->db = SspDb::getConnection(); }
<?php require_once 'IConstants.inc'; require_once $ConstantsArray['dbServerUrl'] . "Utils/MailerUtils.php"; require $ConstantsArray['dbServerUrl'] . "admin/configuration.php"; if ($_POST['submit'] != "") { $configuration = new Configuration(); $email = $configuration->getConfiguration($configuration->adminEmailId); $Password = $configuration->getConfiguration($configuration->adminPassword); $message = $Password; $ok = MailerUtils::sendMandrillEmailNotification($message, 'Reterive Password', '*****@*****.**', '*****@*****.**'); if ($ok) { $msg = "your password emailed to your email account"; } else { $errorMsg = "error during retrieve password"; } } ?> <!DOCTYPE html> <html> <head> <link type="text/css" href="css/cupertino/jquery-ui-1.8.14.custom.css" rel="stylesheet" /> <link type="text/css" href="css/custom.css" rel="stylesheet" /> </head> <table align="center" width="40%" border="0"> <tr> <td class="ui-widget-header" style="padding:10px 10px 10px 10px;"> Forgot Password </td> </tr> <tr>
/** * Constructor * @param SSP_Protect $session - session object * @param Setup $ssp * @param string $id */ public function __construct($session, $ssp, $id = "", $templateFile = "", $generateMenus = true) { // constructor for the user admin object $this->cfg = Configuration::getConfiguration(); $this->db = SspDb::getConnection(); if ($id != "") { $this->id = $id; } elseif (is_object($session)) { $this->id = $session->userId; } $this->session = $session; $this->ssp = $ssp; $this->admin = $this->session->admin; $this->templateFile = $templateFile; $this->generateMenus = $generateMenus; }
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * The MIT License (MIT) for more details. * * Revision: a * Rev. Date 12/04/2005 * Descrip: Created. * * Revision: b * Rev. Date 14/01/2016 * Descrip: Composer implemented. */ namespace w34u\ssp; require "../includeheader.php"; $SSP_DB = SspDb::getConnection(); $SSP_Config = Configuration::getConfiguration(); $values = array(); $query = "CREATE TABLE `" . $SSP_Config->sessionTable . "` (\n `SessionId` char(32) NOT NULL default '',\n `UserId` char(32) NOT NULL default '',\n `SessionTime` int(11) NOT NULL default '0',\n `SessionName` varchar(30) NOT NULL default '',\n `SessionIp` varchar(40) NOT NULL default '',\n `SessionUserIp` varchar(40) NOT NULL default '',\n `SessionCheckIp` tinyint(4) NOT NULL default '0',\n `SessionRandom` int(11) NOT NULL default '0',\n `SessionData` blob NOT NULL,\n PRIMARY KEY (`SessionId`),\n KEY `SessionTime` (`SessionTime`)\n) CHARACTER SET " . $SSP_Config->connectionEncoding . " COLLATE " . $SSP_Config->tableCollation; $SSP_DB->query($query, $values, "SSP Database configuration: Creating session table"); $query = "CREATE TABLE `" . $SSP_Config->tokenTable . "` (\n `token` char(32) NOT NULL default '',\n `time` int(11) NOT NULL default '0',\n `id` varchar(50) NOT NULL default '',\n PRIMARY KEY (`token`),\n KEY `time` (`time`),\n KEY `id` (`id`)\n) CHARACTER SET " . $SSP_Config->connectionEncoding . " COLLATE " . $SSP_Config->tableCollation; $SSP_DB->query($query, $values, "SSP Database configuration: Creating token table"); $query = "CREATE TABLE `" . $SSP_Config->userTable . "` (\n `UserId` char(32) NOT NULL default '',\n `UserEmail` varchar(255) NOT NULL default '',\n `UserName` varchar(50) default NULL,\n `UserPassword` varchar(255) NOT NULL default '',\n `UserIp` varchar(30) NOT NULL default '',\n `UserIpCheck` tinyint(4) NOT NULL default '0',\n `UserAccess` varchar(20) NOT NULL default 'public',\n `lang` varchar(10) NOT NULL default '',\n `country` varchar(10) NOT NULL default '',\n `UserDateLogon` int(11) NOT NULL default '0',\n `UserDateLastLogon` int(11) NOT NULL default '0',\n `UserDateCreated` int(11) NOT NULL default '0',\n `UserDisabled` tinyint(4) NOT NULL default '0',\n `UserPending` tinyint(4) NOT NULL default '0',\n `UserAdminPending` tinyint(4) NOT NULL default '0',\n `CreationFinished` tinyint(4) NOT NULL default '0',\n `UserWaiting` tinyint(4) NOT NULL default '0',\n `UserInvisible` tinyint(4) NOT NULL default '0',\n PRIMARY KEY (`UserId`),\n KEY `UserEmail` (`UserEmail`),\n UNIQUE KEY `UserName` (`UserName`),\n KEY `UserPassword` (`UserPassword`),\n KEY `UserDisabled` (`UserDisabled`,`UserPending`,`UserAdminPending`,`CreationFinished`,`UserWaiting`)\n) CHARACTER SET " . $SSP_Config->connectionEncoding . " COLLATE " . $SSP_Config->tableCollation; $SSP_DB->query($query, $values, "SSP Database configuration: Creating login table"); $query = "CREATE TABLE `" . $SSP_Config->userMiscTable . "` (\n `UserId` char(32) NOT NULL default '',\n `Title` varchar(15) NOT NULL default '',\n `FirstName` varchar(20) NOT NULL default '',\n `Initials` varchar(5) NOT NULL default '',\n `FamilyName` varchar(30) NOT NULL default '',\n `Address` varchar(255) NOT NULL default '',\n `TownCity` varchar(30) NOT NULL default '',\n `PostCode` varchar(10) NOT NULL default '',\n `County` varchar(20) NOT NULL default '',\n `Country` varchar(5) NOT NULL default '',\n PRIMARY KEY (`UserId`)\n) CHARACTER SET " . $SSP_Config->connectionEncoding . " COLLATE " . $SSP_Config->tableCollation; $SSP_DB->query($query, $values, "SSP Database configuration: Creating user misc data table"); $query = "CREATE TABLE `" . $SSP_Config->responseTable . "` (\n `token` char(32) NOT NULL default '',\n `time` int(11) NOT NULL default '0',\n `UserId` char(32) NOT NULL default '',\n PRIMARY KEY (`token`),\n KEY `time` (`time`)\n) CHARACTER SET " . $SSP_Config->connectionEncoding . " COLLATE " . $SSP_Config->tableCollation; $SSP_DB->query($query, $values, "SSP Database configuration: Creating user misc data table"); $query = "CREATE TABLE `" . $SSP_Config->tableRememberMe . "` (\n `id` char(32) NOT NULL default '',\n `user_id` char(32) NOT NULL default '',\n `date_expires` int(11) NOT NULL default '0',\n PRIMARY KEY (`id`),\n KEY `date_expires` (`date_expires`)\n) CHARACTER SET " . $SSP_Config->connectionEncoding . " COLLATE " . $SSP_Config->tableCollation; $SSP_DB->query($query, $values, "SSP Database configuration: Creating remember me table"); $session = new Protect(); $ssp = new Setup($session);
/** * Trigger a user defined error * @param string $error error thrown * @param integer $errorType User error type, e.g. E_USER_WARNING, E_USER_NOTICE and E_USER_ERROR * @param bool $triggerError - trigger an error */ function SSP_error($error, $errorType = E_USER_WARNING, $triggerError = true) { $SSP_Config = Configuration::getConfiguration(); if ($SSP_Config->errorDisplayBacktrace) { $error .= "\nDebug backtrace\n"; ob_start(); debug_print_backtrace(); $error .= ob_get_clean(); } if ($triggerError) { trigger_error($error, $errorType); } return $error; }
<?php require_once 'IConstants.inc'; require_once $ConstantsArray['dbServerUrl'] . "Utils/MailerUtils.php"; if ($_POST['submit'] != "") { require "configuration.php"; $configuration = new Configuration(); $email = $configuration->getConfiguration(ConfigurationKeys::$adminEmailId); $Password = $configuration->getConfiguration(ConfigurationKeys::$adminPassword); $message = $Password; $ok = MailerUtils::sendMandrillEmailNotification($message, 'Reterive Password', '*****@*****.**', $email); if ($ok) { $msg = "your password emailed to your email account"; } else { $errorMsg = "error during retrieve password"; } } ?> <!DOCTYPE html> <html> <head> <link type="text/css" href="css/cupertino/jquery-ui-1.8.14.custom.css" rel="stylesheet" /> <link type="text/css" href="css/custom.css" rel="stylesheet" /> </head> <table align="center" width="40%" border="0"> <tr> <td class="ui-widget-header" style="padding:10px 10px 10px 10px;"> Forgot Password </td> </tr> <tr>
<?php $messageText = ""; if ($_POST["submit"] != "") { $earlierPassword = $_POST["earlierPassword"]; $newPassword = $_POST["newPassword"]; $confirmNewPassword = $_POST["confirmNewPassword"]; require_once "configuration.php"; require_once 'IConstants.inc'; require_once $ConstantsArray['dbServerUrl'] . "FormValidator//validator.php"; $configuration = new Configuration(); $h = $configuration->getConfiguration($configuration->adminPassword); $configurationPassword = $h["configvalue"]; $messageText = ""; $div = ""; $messageText = validator::validateform("Earlier Password", $earlierPassword, 256, false); if ($messageText != null && $messageText != "") { $messageText = $messageText . "<br/>" . validator::validateform("New Password", $newPassword, 256, false); } else { $messageText = validator::validateform("New Password", $newPassword, 256, false); } if ($messageText != null && $messageText != "") { $messageText = $messageText . "<br/>" . validator::validateform("Confirm Password", $confirmNewPassword, 256, false); } else { $messageText = validator::validateform("Confirm New Password", $confirmNewPassword, 256, false); } if ($messageText == "") { if ($newPassword != $confirmNewPassword) { $messageText = "-New password and confirm password does not match"; } if ($configurationPassword != $earlierPassword) {
/** * Constructor * @param string $pageAccessLevel - users allowed to access the page * @param bool $pageCheckEquals - if true only this user type can access this page * @param bool $doHistory - do history for this page * @param ProtectConfig $config - Protected session configuration options */ public function __construct($pageAccessLevel = "", $pageCheckEquals = false, $doHistory = true, $config = false) { global $loginContent; if ($config === false) { $this->config = new \w34u\ssp\ProtectConfig(); } else { $this->config = $config; } $this->cfg = Configuration::getConfiguration(); $this->db = SspDb::getConnection(); // set up db session handling $handler = new SessionHandler(); session_set_save_handler(array($handler, 'open'), array($handler, 'close'), array($handler, 'read'), array($handler, 'write'), array($handler, 'destroy'), array($handler, 'gc')); // the following prevents unexpected effects when using objects as save handlers register_shutdown_function("session_write_close"); session_start(); $this->setupLanguage(); $this->maintenanceMode(); // turn off sql cacheing if it is set, but preserve the status to turn it back on after if ($this->db->cache) { $queryResultCacheing = true; $this->db->cache = false; } else { $queryResultCacheing = false; } $pageAccessLevel = $this->checkParameters($pageAccessLevel, $pageCheckEquals); if (isset($loginContent)) { $_SESSION["SSP_LoginPageAddtionalContent"] = $loginContent; } // check https:// site, and if fail divert to correct url if ($this->cfg->useSSL or $this->config->forceSSLPath) { if (!isset($_SERVER['HTTPS']) or $_SERVER['HTTPS'] == "off") { // script not called using https SSP_Divert(SSP_Path(true, true)); } } $this->country = ""; // do any external routines before history is called $this->autoLogin(); if ($doHistory) { $this->pageHistory(); } // get all session information for valid sessions $query = sprintf("select * from %s where %s = ? and %s = ?", $this->cfg->sessionTable, $this->db->qt("SessionId"), $this->db->qt("SessionName")); $values = array(session_id(), session_name()); $this->db->query($query, $values, "SSP session handling: Get session information"); if ($this->db->numRows() > 0) { // get result if existing session $sessionInfo = $this->db->fetchRow(); $newSession = false; } else { $newSession = true; $this->log("New session started"); } // process user information if logged in. $userFault = false; $needHigherLogin = false; $userInfo = null; if (!$newSession and trim($sessionInfo->UserId) != "") { $where = array("UserId" => $sessionInfo->UserId); $userInfo = $this->db->get($this->cfg->userTable, $where, "SSP Session: getting login data"); if ($this->db->numRows()) { // user found // check for login expiry if ($sessionInfo->SessionTime + $this->cfg->loginExpiry > time()) { $this->loggedIn = true; $this->userId = $userInfo->UserId; $this->userName = $userInfo->UserName; $this->userAccessLevel = $userInfo->UserAccess; if ($this->cfg->userLevels[$this->userAccessLevel] >= $this->cfg->adminLevel) { // admin user $this->admin = true; } $this->userEmail = SSP_decrypt($userInfo->UserEmail); if (isset($userInfo->country) and trim($userInfo->country) != "") { $this->country = $userInfo->country; } } else { $this->log("Login expired"); $this->loggedIn = false; $this->db->update($this->cfg->sessionTable, array('UserId' => ''), array('SessionId' => session_id(), 'SessionName' => session_name()), 'SSP Session: clearing user id from expired login'); } } else { $this->log("User not found from ID"); $userFault = true; } } $pageAccess = $this->cfg->userLevels[$pageAccessLevel]; if ($this->loggedIn) { // do security checking for user if logged in // validate flags $flagsValid = true; foreach ($this->cfg->validUserFlags as $flagName => $validFlagValue) { if ($userInfo->{$flagName} != $validFlagValue) { $flagsValid = false; $this->log("Invalid user flag " . $flagName . " value required: " . $validFlagValue . " actual: " . $userInfo->{$flagName}); break; } } if (!$flagsValid) { $userFault = true; } elseif ($this->cfg->userLevels[$userInfo->UserAccess] < $pageAccess) { // user does not have a high enough access level $userFault = true; $needHigherLogin = true; // flag higher login needed $this->log("User Access level not high enough Level: " . $userInfo->UserAccess . " " . $this->cfg->userLevels[$userInfo->UserAccess] . " Page " . $pageAccess); } elseif ($pageCheckEquals and $this->cfg->userLevels[$userInfo->UserAccess] != $pageAccess) { // user does not have the correct user access level $userFault = true; $needHigherLogin = true; // flag different login needed $this->log("User Access level not equal to the page's level"); } elseif ($this->cfg->checkIpAddress and SSP_trimIp($sessionInfo->SessionIp) !== SSP_trimIp($_SERVER["REMOTE_ADDR"])) { // users IP address has changed $userFault = true; $this->log("User IP address changed " . SSP_paddIp($_SERVER["REMOTE_ADDR"])); } elseif (($this->cfg->fixedIpAddress or $userInfo->UserIpCheck) and SSP_paddIp($sessionInfo->SessionUserIp) !== SSP_paddIp($_SERVER["REMOTE_ADDR"])) { // user is at incorrect IP address $userFault = true; $this->log("User IP address incorrect, UserIP: " . SSP_paddIp($sessionInfo->SessionUserIp) . " Remote IP: " . SSP_paddIp($_SERVER["REMOTE_ADDR"])); } $userFault = $this->chackRandom($sessionInfo); } else { $this->log("User not logged in"); } // handle user faults $this->userFaultHandling($pageAccess, $userFault, $needHigherLogin, $queryResultCacheing); // final setup of page $this->finalSetup($userInfo); // restore query cacheing mode $this->db->cache = $queryResultCacheing; }
function getConfiguration() { App::import('Model', 'Configuration'); $Configuration = new Configuration(); return $Configuration->getConfiguration(); }
<?php require_once "helpers.php"; require_once "class.configuration.php"; require_once "class.sqlite.php"; require_once "class.pagination.php"; require_once "class.user.php"; require_once "class.game.php"; require_once "class.captcha.php"; session_start(); $config = new Configuration("config/config"); $GLOBALS['db'] = new Sqlite($config->getConfiguration("db")); $GLOBALS['paginatior'] = new Paginator(); User::refresh(); // refresh user data in session
/** * Get the database connection, if necessary create the database connection * @return sspDb */ public static function getConnection() { $SSP_Config = Configuration::getConfiguration(); if (self::$connection === null) { self::$connection = new SspDb($SSP_Config->dsn); } return self::$connection; }
$email = $_POST["emailId"]; $msg = validator::validateform("Email Id", $email, 256, false); if ($msg == "") { if ($email != $conEmail) { $msg = "Email id does not match with confirm email id"; } } if ($msg != null && $msg != "") { $div = " <div class='ui-widget'>\n <div class='ui-state-error ui-corner-all' style='padding: 0 .7em;'> \n <p><span class='ui-icon ui-icon-alert' style='float: left; margin-right: .3em;'></span> \n <strong>Error during change email id :</strong> <br/>" . $msg . "</p>\n </div></div>"; } else { $configuration->saveConfig($configuration->adminEmailId, $email); $msg = "Email id updated successfully"; $div = "<div class='ui-widget'>\n <div class='ui-state-default ui-corner-all' style='padding: 0 .7em;'> \n <p><span class='ui-icon ui-icon-alert' style='float: left; margin-right: .3em;'></span> \n <strong>Message:</strong> " . $msg . "</p> \n </div></div>"; } } else { $h = $configuration->getConfiguration($configuration->adminEmailId); $email = $h["configvalue"]; $conEmail = $email; } ?> <!DOCTYPE html> <html> <head> <?php include "_jsAdminInclude.php"; ?> </head> <body>
<?php $div = ""; if ($_POST["submit"] != "") { $adminPassword = $_POST["adminPassword"]; require_once "configuration.php"; $configuration = new Configuration(); $configurationPassword = $configuration->getConfiguration(ConfigurationKeys::$adminPassword); if ($configurationPassword == $adminPassword) { //session_register("adminlogged"); session_start(); $_SESSION["adminlogged"] = 1; header("Location:adminTabs.php"); $msg = "Welcome"; } else { $msg = "-Invalid Password"; $div = " <div class='ui-widget'>\n <div class='ui-state-error ui-corner-all' style='padding: 0 .7em;'> \n <p><span class='ui-icon ui-icon-alert' style='float: left; margin-right: .3em;'></span> \n <strong>Error During Admin login :</strong> <br/>" . $msg . "</p>\n </div></div>"; } } ?> <!DOCTYPE html> <html> <head> <link type="text/css" href="css/cupertino/jquery-ui-1.8.14.custom.css" rel="stylesheet" /> <link type="text/css" href="css/custom.css" rel="stylesheet" /> </head> <table align="center" width="40%" border="0"> <tr>
/** * Login base class constructor * @param w34u\ssp\Protect $session - session object * @param w34u\ssp\Template $tpl - template in which to wrap the form * @param bool $ignoreToken - dont use a token on the login form */ public function __construct($session, $tpl = "", $ignoreToken = false) { $this->session = $session; $this->cfg = Configuration::getConfiguration(); $this->db = SspDb::getConnection(); $this->rememberMe = $this->cfg->loginRememberMe; // define the form to login $form = $this->loginScreenDefine($tpl, $ignoreToken); // process the form on submit $this->processForm($form); }