/*"****************************************************************************************************** * (c) 2004-2006 by MulchProductions, www.mulchprod.de * * (c) 2007-2015 by Kajona, www.kajona.de * * Published under the GNU LGPL v2.1, see /system/licence_lgpl.txt * ********************************************************************************************************/ echo "+-------------------------------------------------------------------------------+\n"; echo "| Kajona Debug Subsystem |\n"; echo "| |\n"; echo "| Delete all tables |\n"; echo "| |\n"; echo "+-------------------------------------------------------------------------------+\n"; if (issetPost("dodelete")) { $strUsername = getPost("username"); $strPassword = getPost("password"); $objUsersource = new class_module_user_sourcefactory(); $objUser = $objUsersource->getUserByUsername($strUsername); echo "Authenticating user...\n"; if ($objUsersource->authenticateUser($strUsername, $strPassword)) { echo " ... authenticated.\n"; $arrGroupIds = $objUser->getArrGroupIds(); if (in_array(class_module_system_setting::getConfigValue("_admins_group_id_"), $arrGroupIds)) { echo "User is member of admin-group.\n"; $arrTables = class_carrier::getInstance()->getObjDB()->getTables(); foreach ($arrTables as $strOneTable) { $strQuery = "DROP TABLE " . $strOneTable; echo " executing " . $strQuery . "\n"; class_carrier::getInstance()->getObjDB()->_pQuery($strQuery, array()); } } else { echo "User is not a member of the admin-group!\n"; }
/** * Fetches all available active users with the given username an returns them in an array * * @param string $strName * * @return mixed */ public static function getAllUsersByName($strName) { $objSubsystem = new class_module_user_sourcefactory(); $objUser = $objSubsystem->getUserByUsername($strName); if ($objUser != null) { return array($objUser); } else { return null; } }
/** * Creates a form to enter the username of the account to reset. * * @return string */ private function resetForm() { $strReturn = ""; if ($this->getParam("reset") != "" && getPost("reset") != "") { //try to load the user $objSubsystem = new class_module_user_sourcefactory(); $objUser = $objSubsystem->getUserByUsername($this->getParam("portallogin_username")); if ($objUser != null) { $objValidator = new class_email_validator(); if ($objUser->getStrEmail() != "" && $objValidator->validate($objUser->getStrEmail()) && $objUser->getIntPortal() == 1 && $objUser->getIntActive() == 1) { //generate an authcode and save it with the user $strAuthcode = generateSystemid(); $objUser->setStrAuthcode($strAuthcode); $objUser->updateObjectToDb(); $strMailContent = $this->getLang("resetemailBody"); $strTemp = class_link::getLinkPortalHref($this->getPagename(), "", "portalResetPwd", "&authcode=" . $strAuthcode, $objUser->getSystemid()); $strMailContent .= html_entity_decode("<a href=\"" . $strTemp . "\">" . $strTemp . "</a>"); $objScriptlets = new class_scriptlet_helper(); $strMailContent = $objScriptlets->processString($strMailContent); //create a mail confirming the change $objEmail = new class_mail(); $objEmail->setSubject($this->getLang("resetemailTitle")); $objEmail->setHtml($strMailContent); $objEmail->addTo($objUser->getStrEmail()); $objEmail->sendMail(); $strReturn .= $this->getLang("resetMailSuccess"); } } } else { $strTemplateID = $this->objTemplate->readTemplate("/element_portallogin/" . $this->arrElementData["portallogin_template"], "portallogin_resetform"); $arrTemplate = array(); $arrTemplate["portallogin_action"] = "portalLoginReset"; $arrTemplate["portallogin_resetHint"] = "portalLoginReset"; $arrTemplate["portallogin_elsystemid"] = $this->arrElementData["content_id"]; $arrTemplate["action"] = class_link::getLinkPortalHref($this->getPagename()); $strReturn .= $this->fillTemplate($arrTemplate, $strTemplateID); } return $strReturn; }
/** * Logs a user into the system if the credentials are correct * and the user is active * * @param string $strName * @param string $strPassword * * @return bool */ public function login($strName, $strPassword) { $bitReturn = false; //How many users are out there with this username and being active? $objUsersources = new class_module_user_sourcefactory(); try { if ($objUsersources->authenticateUser($strName, $strPassword)) { $objUser = $objUsersources->getUserByUsername($strName); $bitReturn = $this->internalLoginHelper($objUser); } } catch (class_authentication_exception $objEx) { $bitReturn = false; } if ($bitReturn === false) { class_logger::getInstance()->addLogRow("Unsuccessful login attempt by user " . $strName, class_logger::$levelInfo); class_module_user_log::generateLog(0, $strName); } return $bitReturn; }