private function login($sUserName, $sPassword) { if ($this->oConfig->get('demoMode') && $sUserName == 'demo' && $sPassword == 'demo' || $this->oUser->loginLdap($sUserName, $sPassword)) { return [self::RESPONSE_SUCCESS => true, self::RESPONSE_TOKEN => $this->oUser->generateToken(sha1($sUserName . $sPassword))]; } return [self::RESPONSE_SUCCESS => false]; }
ini_set('date.timezone', 'Europe/Berlin'); require 'vendor/autoload.php'; use mroswald\invme\models\Attendance; use mroswald\invme\models\Character; use mroswald\invme\models\Raid; use mroswald\invme\models\User; define('POPULATE_TESTDATA', true); $aRaidIds = []; $oRaid = new Raid(); $oRaid->installModel(true); // this could be used to populate test data if (POPULATE_TESTDATA) { for ($i = 1; $i < 12; $i++) { $date = date("Y-m-d", time() + $i * 2 * 60 * 60 * 24); $oRaid->generateUuid()->setTitle("Höllenfeuerzitadelle")->setMaxAttendees(20)->setStart($date, '20:00')->setEnd($date, '22:30')->save(); array_push($aRaidIds, $oRaid->getUuid()); } } $oUser = new User(); $oUser->installModel(true); $oCharacter = new Character(); $oCharacter->installModel(true); $oAttendance = new Attendance(); $oAttendance->installModel(true); if (POPULATE_TESTDATA) { $oUser->generateUuid()->setName("demo")->setRole("admin")->save(); $oCharacter->generateUuid()->setUser($oUser->getUuid())->setName("ultraMonk")->setRace("pandaren")->setClass("monk")->setRole("heal")->save(); foreach ($aRaidIds as $sRaidId) { $oAttendance->generateUuid()->setCharacterId($oCharacter->getUuid())->setRaidId($sRaidId)->setStatus(rand(1, 5))->save(); } }