Gets audio file contents from the session or database

@return string|boolean Audio contents on success, or false if no audio found in session or DB
342223
protected function getAudioData()
    {
        if ($this->no_session != true) {
            if (isset($_SESSION['securimage_code_audio'][$this->namespace])) {
                return $_SESSION['securimage_code_audio'][$this->namespace];
            }
        }

        if ($this->use_database) {
            $this->openDatabase();
            $code = $this->getCodeFromDatabase();

            if (!empty($code['audio_data'])) {
                return $code['audio_data'];
            }
        }

        return false;
    }
976712
protected function getArchive()
    {
        if (($fileData = $this->getRemoteContent(self::ARCHIVE_URL)) === false) {
            return false;
        }

        $fileName = Yii::getAlias('@runtime') . DIRECTORY_SEPARATOR . substr(strrchr(self::ARCHIVE_URL, '/'), 1);
        if (@file_put_contents($fileName, $fileData) !== false) {
            return $fileName;
        }

        return false;
    }
6477
protected function saveAudioToDatabase($data)
    {
        $success = false;
        $this->openDatabase();

        if ($this->use_database && $this->pdo_conn) {
            $id = $this->getCaptchaId(false);
            $ip = $_SERVER['REMOTE_ADDR'];
            $ns = $this->namespace;

            if (empty($id)) {
                $id = $ip;
            }

            $query = "UPDATE {$this->database_table} SET audio_data = :audioData WHERE id = :id AND namespace = :namespace";
            $stmt  = $this->pdo_conn->prepare($query);
            $stmt->bindParam(':audioData', $data, PDO::PARAM_LOB);
            $stmt->bindParam(':id', $id);
            $stmt->bindParam(':namespace', $ns);
            $success = $stmt->execute();
        }

        return $success !== false;
    }
464983
static function fetchAuditEnabled()
    {
        $ini = eZINI::instance( 'audit.ini' );
        $auditEnabled = $ini->hasVariable( 'AuditSettings', 'Audit' )
                      ? $ini->variable( 'AuditSettings', 'Audit' )
                      : 'disabled';
        $enabled = $auditEnabled == 'enabled';
        return $enabled;
    }
1085133
public function outputAudioFile($format = null)
    {
        set_error_handler(array(&$this, 'errorHandler'));

        if (isset($_SERVER['HTTP_RANGE'])) {
            $range   = true;
            $rangeId = (isset($_SERVER['HTTP_X_PLAYBACK_SESSION_ID'])) ?
                       'ID' . $_SERVER['HTTP_X_PLAYBACK_SESSION_ID']   :
                       'ID' . md5($_SERVER['REQUEST_URI']);
            $uniq    = $rangeId;
        } else {
            $uniq = md5(uniqid(microtime()));
        }

        try {
            if (!($audio = $this->getAudioData())) {
                // if previously generated audio not found for current captcha
                require_once dirname(__FILE__) . '/WavFile.php';
                $audio = $this->getAudibleCode();

                if (strtolower($format) == 'mp3') {
                    $audio = $this->wavToMp3($audio);
                }

                $this->saveAudioData($audio);
            }
        } catch (Exception $ex) {
            $log_file = rtrim($this->log_path, '/\\ ') . DIRECTORY_SEPARATOR . $this->log_file;

            if (($fp = fopen($log_file, 'a+')) !== false) {
                fwrite($fp, date('Y-m-d H:i:s') . ': Securimage audio error "' . $ex->getMessage() . '"' . "\n");
                fclose($fp);
            }

            $audio = $this->audioError();
        }

        if ($this->no_session != true) {
            // close session to make it available to other requests in the event
            // streaming the audio takes sevaral seconds or more
            session_write_close();
        }

        if ($this->canSendHeaders() || $this->send_headers == false) {
            if ($this->send_headers) {
                if ($format == 'mp3') {
                    $ext  = 'mp3';
                    $type = 'audio/mpeg';
                } else {
                    $ext  = 'wav';
                    $type = 'audio/wav';
                }

                header('Accept-Ranges: bytes');
                header("Content-Disposition: attachment; filename=\"securimage_audio-{$uniq}.{$ext}\"");
                header('Cache-Control: no-store, no-cache, must-revalidate');
                header('Expires: Sun, 1 Jan 2000 12:00:00 GMT');
                header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . 'GMT');
                header('Content-type: ' . $type);
            }

            $this->rangeDownload($audio);
        } else {
            echo '<hr /><strong>'
                .'Failed to generate audio file, content has already been '
                .'output.<br />This is most likely due to misconfiguration or '
                .'a PHP error was sent to the browser.</strong>';
        }

        restore_error_handler();

        if (!$this->no_exit) exit;
    }
640163
public function getContents()
    {
        $contents = file_get_contents($this->getPath());

        foreach ($this->getReplaces() as $search => $replace) {
            $contents = str_replace('$'.strtoupper($search).'$', $replace, $contents);
        }

        return $contents;
    }
1234766
public function getCacheContents()
    {
        $cacheFile = $this->getCacheFile();

        if ( ! file_exists($cacheFile)) {
            return false;
        }

        return json_decode($this->sharedGet($cacheFile), true) ?? [];
    }
94673
public function getContents() : string
    {
        $r = false;
        $err = ($this->stream === null || $this->readable === false);

        if ($err === false) {
            $r = stream_get_contents($this->stream);
        }

        if ($err === true || $r === false) {
            // @codeCoverageIgnoreStart
            throw new \RuntimeException("Could not get contents of stream.");
            // @codeCoverageIgnoreEnd
        }

        return $r;
    }
261522
public function
	GetData() {
	/*//
	@override Nether\Database\Coda::GetData
	transform the given data into a regex the query can use.
	//*/

		return sprintf(
			'%s%s%s',
			(($this->MountStart)?('^'):('')),
			((is_array($this->Data))?
				('('.implode('|',$this->Data).')'):
				($this->Data)
			),
			(($this->MountEnd)?('$'):(''))
		);
	}
658470
public function getContents()
    {
        $content = '';
        while(!$this->streamable->isEOF()) {
            $r = $this->streamable->read(1024);
            if ($r == null)
                break;

            $content .= $r;
        }
        
        return $content;
    }
736772
public function getContent() {

		if(false !== $this -> file -> getExists()) {

			$this -> refresh();

			if(false === $this -> file -> getReadable()) {
				trigger_error(sprintf('File "%s" is not readable', $this -> file -> getBasepath()), E_USER_ERROR);
			}
			
			return file_get_contents($this -> file -> getBasepath());
		}
	}
213825
public function getInfoString() : string
   {

      $out = '';

      if ( isset( $this->_attributes[ 'db' ] ) )
      {
         $out = 'db="' . $this->_attributes[ 'db' ] . '"';
      }

      return $out;

   }
256754
public function getMetaData(): string
    {
        return Helper::createMetaDataXml($this->itemId, "-1", [
            "res"               =>  $this->uri,
            "upnp:albumArtURI"  =>  $this->albumArt,
            "dc:title"          =>  $this->title,
            "upnp:class"        =>  "object.item.audioItem.musicTrack",
            "dc:creator"        =>  $this->artist,
            "upnp:album"        =>  $this->album,
        ]);
    }
819909
protected function getSourcesContent()
    {
        if (empty($this->sources)) {
            return null;
        }

        $content = array();

        foreach ($this->sources as $sourceFile) {
            $content[] = file_get_contents($sourceFile);
        }

        return $content;
    }
229889
public function read(/*# string */ $session_id)/*# : string */
    {
        $file = $this->getSessionFile($session_id);
        $content = @file_get_contents($file);
        if (false === $content) {
            $content = 'a:0:{}';
        }
        return $content;
    }
237624
protected function getFileContent()
    {
        if (ends_with($this->file->getFilename(), '.blade.php')) {
            return $this->renderBlade();
        } elseif (ends_with($this->file->getFilename(), '.md')) {
            return $this->renderMarkdown();
        }

        return $this->file->getContents();
    }
853967
public function getFileContents()
    {
        if ($this->fileContentsCache === null && $filePath = $this->getFile()) {
            if ($filePath === "Unknown" || !is_file($filePath)) {
                return null;
            }

            $this->fileContentsCache = file_get_contents($filePath);
        }

        return $this->fileContentsCache;
    }