/** * Download given WSDL file and return name of cache file. * * @param string $wsdl WSDL file URL/path * * @return string */ public function download($wsdl) { // download and cache remote WSDL files or local ones where we want to // resolve remote XSD includes $isRemoteFile = $this->isRemoteFile($wsdl); if ($isRemoteFile || $this->resolveRemoteIncludes) { $cacheFilePath = $this->cacheDir . DIRECTORY_SEPARATOR . 'wsdl_' . md5($wsdl) . '.cache'; if (!$this->cacheEnabled || !file_exists($cacheFilePath) || filemtime($cacheFilePath) + $this->cacheTtl < time()) { if ($isRemoteFile) { // execute request $responseSuccessfull = $this->curl->exec($wsdl); // get content if ($responseSuccessfull) { $response = $this->curl->getResponseBody(); if ($this->resolveRemoteIncludes) { $this->resolveRemoteIncludes($response, $cacheFilePath, $wsdl); } else { file_put_contents($cacheFilePath, $response); } } else { throw new \ErrorException("SOAP-ERROR: Parsing WSDL: Couldn't load from '" . $wsdl . "'"); } } elseif (file_exists($wsdl)) { $response = file_get_contents($wsdl); $this->resolveRemoteIncludes($response, $cacheFilePath); } else { throw new \ErrorException("SOAP-ERROR: Parsing WSDL: Couldn't load from '" . $wsdl . "'"); } } return $cacheFilePath; } elseif (file_exists($wsdl)) { return realpath($wsdl); } throw new \ErrorException("SOAP-ERROR: Parsing WSDL: Couldn't load from '" . $wsdl . "'"); }
/** * Add a site.. but take care! This works with regex!!! * @param unknown_type $name * @param unknown_type $connection */ public function addSite($name, $connection) { if ($connection->exec("INSERT INTO `learncards`.`config_loginneedlesssites` (`site`) VALUES ('" . $name . "');") > 0) { $site = new allowedSite(); $site->setName($name); $site->setId($connection->lastInsertId()); array_push($this->allAllowedSites, $site); return "Site " . $name . " is successfully added"; } else { return "A error happend. Nothings changed!"; } }
/** * Create a new question * @param question $question * @param unknown_type $connection */ public function newQuestion($question, $connection) { $connection->exec("INSERT INTO `" . $GLOBALS['dbPrefix'] . "question_question` (`set`, `question`, `mode`) VALUES (" . $this->setid . ", '" . $question->getQuestion() . "', '" . $question->getMode() . "')"); $question->setId($connection->lastInsertId()); array_push($this->questions, $question); }
/** * Set a password * @param unknown_type $username * @param unknown_type $password * @param unknown_type $connection */ public static function setPassword($username, $password, $connection) { if (usertools::passwordRequirements($password, $GLOBALS["min_password_length"], $GLOBALS["password_need_specialchars"])) { $password = hash($GLOBALS["password_hash"], $password); $connection->exec('UPDATE users SET password="******" WHERE username="******";'); } }