protected function readConfig() { $wizConfigHandler = new configuration(); $path = $wizConfigHandler->readConfigPathIni(); $this->util->iniUtilities->load($path); $dbSettings = $this->util->iniUtilities->getSection('db'); $this->dbSettings = array('dbHost' => $dbSettings['dbHost'], 'dbName' => $dbSettings['dbName'], 'dbUser' => $dbSettings['dbUser'], 'dbPass' => $dbSettings['dbPass'], 'dbPort' => $dbSettings['dbPort'], 'dbAdminUser' => $dbSettings['dbAdminUser'], 'dbAdminPass' => $dbSettings['dbAdminPass']); $this->paths = $this->util->iniUtilities->getSection('urls'); $this->paths = array_merge($this->paths, $this->util->iniUtilities->getSection('cache')); $this->sysVersion = $this->readVersion(); $this->cachePath = $wizConfigHandler->readCachePath(); $this->proxyPath = $this->cachePath . "/.."; // Total guess. $this->proxyPath = realpath($this->proxyPath . "/proxies"); $this->storeSilent(); }
/** * Runs a DB query and returns a result based on arguments which specify what to look for * * @param string $query The query to run * @param boolean $checkResult Whether to check that a result was found (not needed for update/delete, only select): This result may be empty * @param boolean $resultCheck Whether to check for returned results from the query * @return unknown */ function runDBQuery($query, $checkResult = false, $resultCheck = false) { if (!isset($this->iniUtilities) || !is_object($this->iniUtilities)) { $this->dbUtilities = new dbUtilities(); $this->iniUtilities = new iniUtilities(); } $wizConfigHandler = new configuration(); $configPath = $wizConfigHandler->readConfigPathIni(); $this->iniUtilities->load($configPath); $dconf = $this->iniUtilities->getSection('db'); $this->dbUtilities->load($dconf['dbHost'], '', $dconf['dbAdminUser'], $dconf['dbAdminPass'], $dconf['dbName']); $result = $this->dbUtilities->query($query); if ($checkResult) { $assArr = $this->dbUtilities->fetchAssoc($result); if ($resultCheck) { return !is_null($assArr); } else { return is_null($assArr); } } return !is_null($result); }
private function checkPassword($username, $password) { $upgradeOnly = false; if (isset($_POST['upgradeOnly'])) { $upgradeOnly = $_POST['upgradeOnly']; } $dconf = $this->getDataFromPackage('installers', 'database'); // Use info from install if ($dconf) { // From Install $this->util->dbUtilities->load($dconf['dhost'], $dconf['dport'], $dconf['duname'], $dconf['dpassword'], $dconf['dname']); $sQuery = "SELECT count(*) AS match_count FROM users WHERE username = '******' AND password = '******'"; $res = $this->util->dbUtilities->query($sQuery); $ass = $this->util->dbUtilities->fetchAssoc($res); if ($ass[0]['match_count'] == 1) { return true; } } elseif ($upgradeOnly) { require_once "../wizard/steps/configuration.php"; // configuration to read the ini path $wizConfigHandler = new configuration(); $configPath = $wizConfigHandler->readConfigPathIni(); $this->util->iniUtilities->load($configPath); $dconf = $this->util->iniUtilities->getSection('db'); $this->util->dbUtilities->load($dconf['dbHost'], $dconf['dbPort'], $dconf['dbUser'], $dconf['dbPass'], $dconf['dbName']); $sQuery = "SELECT count(*) AS match_count FROM users WHERE username = '******' AND password = '******'"; $res = $this->util->dbUtilities->query($sQuery); $ass = $this->util->dbUtilities->fetchAssoc($res); if ($ass[0]['match_count'] == 1) { return true; } } else { // Upgrade require_once "../wizard/steps/configuration.php"; // configuration to read the ini path $wizConfigHandler = new configuration(); $configPath = $wizConfigHandler->readConfigPathIni(); if ($configPath) { $this->util->iniUtilities->load($configPath); $dconf = $this->util->iniUtilities->getSection('db'); $this->util->dbUtilities->load($dconf['dbHost'], $dconf['dbPort'], $dconf['dbUser'], $dconf['dbPass'], $dconf['dbName']); $sQuery = "SELECT count(*) AS match_count FROM users WHERE username = '******' AND password = '******'"; $res = $this->util->dbUtilities->query($sQuery); $ass = $this->util->dbUtilities->fetchAssoc($res); if ($ass[0]['match_count'] == 1) { return true; } } } $this->error[] = 'Could Not Authenticate User'; return false; }