/** * @return string */ public function ServiceProxyExternal() { $bResult = false; $sData = empty($this->aPaths[1]) ? '' : $this->aPaths[1]; if (!empty($sData) && $this->oActions->Config()->Get('labs', 'use_local_proxy_for_external_images', false)) { $this->oActions->verifyCacheByKey($sData); $aData = \RainLoop\Utils::DecodeKeyValues($sData); if (\is_array($aData) && !empty($aData['Token']) && !empty($aData['Url']) && $aData['Token'] === \RainLoop\Utils::GetConnectionToken()) { $iCode = 404; $sContentType = ''; $mResult = $this->oHttp->GetUrlAsString($aData['Url'], 'RainLoop External Proxy', $sContentType, $iCode); if (false !== $mResult && 200 === $iCode && \in_array($sContentType, array('image/png', 'image/jpeg', 'image/jpg', 'image/bmp', 'image/gif'))) { $bResult = true; $this->oActions->cacheByKey($sData); \header('Content-Type: ' . $sContentType); echo $mResult; } } } if (!$bResult) { $this->oHttp->StatusHeader(404); } }