Ejemplo n.º 1
0
 /**
  * Load the captcha configuration defaults.
  *
  * @return void
  */
 private static function loadCaptchaConfigDefaults($session)
 {
     self::includeFile(Path::getCaptchaConfigDefaultsFilePath(), true, $session);
 }
Ejemplo n.º 2
0
 /**
  * Get contents of Captcha resources (js, css, gif files).
  *
  * @return string
  */
 public function getResourceContents()
 {
     $filename = $this->request->query('get');
     $resourcePath = realpath(Path::getPublicDirPathInLibrary() . $filename);
     if (!is_file($resourcePath)) {
         $this->badRequest(sprintf('File "%s" could not be found.', $filename));
     }
     $mimeTypes = ['css' => 'text/css', 'gif' => 'image/gif', 'js' => 'application/x-javascript'];
     // captcha resource file information
     $fileInfo = pathinfo($resourcePath);
     $fileLength = filesize($resourcePath);
     $mimeType = $mimeTypes[$fileInfo['extension']];
     header("Content-Type: {$mimeType}");
     header("Content-Length: {$fileLength}");
     echo file_get_contents($resourcePath);
     exit;
 }