| Server IP : 213.186.33.4 / Your IP : 216.73.216.193 Web Server : Apache System : Linux webm006.cluster103.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : awebpaca ( 35430) PHP Version : 8.5.0 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/a/w/e/awebpaca/piwik/plugins/Proxy/ |
Upload File : |
<?php
/**
* Matomo - free/libre analytics platform
*
* @link https://matomo.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/
namespace Piwik\Plugins\Proxy;
use Piwik\AssetManager;
use Piwik\AssetManager\UIAsset;
use Piwik\Common;
use Piwik\Exception\StylesheetLessCompileException;
use Piwik\Piwik;
use Piwik\ProxyHttp;
use Piwik\Url;
use Piwik\UrlHelper;
/**
* Controller for proxy services
*
*/
class Controller extends \Piwik\Plugin\Controller
{
const TRANSPARENT_PNG_PIXEL = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAApJREFUCNdjYAAAAAIAAeIhvDMAAAAASUVORK5CYII=';
const JS_MIME_TYPE = "application/javascript; charset=UTF-8";
/**
* Output the merged CSS file.
* This method is called when the asset manager is enabled.
*
* @see core/AssetManager.php
*/
public function getCss()
{
try {
$cssMergedFile = AssetManager::getInstance()->getMergedStylesheet();
} catch (StylesheetLessCompileException $exception) {
$cssMergedFile = AssetManager::getInstance()->getMergedStylesheet();
}
ProxyHttp::serverStaticFile($cssMergedFile->getAbsoluteLocation(), "text/css");
}
/**
* Output the merged core JavaScript file.
* This method is called when the asset manager is enabled.
*
* @see core/AssetManager.php
*/
public function getCoreJs()
{
$jsMergedFile = AssetManager::getInstance()->getMergedCoreJavaScript();
$this->serveJsFile($jsMergedFile);
}
/**
* Output the merged non core JavaScript file.
* This method is called when the asset manager is enabled.
*
* @see core/AssetManager.php
*/
public function getNonCoreJs()
{
$jsMergedFile = AssetManager::getInstance()->getMergedNonCoreJavaScript();
$this->serveJsFile($jsMergedFile);
}
/**
* @param UIAsset $uiAsset
*/
private function serveJsFile($uiAsset)
{
ProxyHttp::serverStaticFile($uiAsset->getAbsoluteLocation(), self::JS_MIME_TYPE);
}
/**
* Validate URL against *.piwik.org domains
*
* @param string $url
* @return bool True if valid; false otherwise
*/
public static function isPiwikUrl($url)
{
// guard for IE6 meta refresh parsing weakness (OSVDB 19029)
if (strpos($url, ';') !== false
|| strpos($url, ';') !== false
) {
return false;
}
if (preg_match('~^http://(qa\.|demo\.|dev\.|forum\.)?piwik.org([#?/]|$)~', $url)) {
return true;
}
if (preg_match('~^http://(qa\.|demo\.|dev\.|forum\.)?matomo.org([#?/]|$)~', $url)) {
return true;
}
// Allow clockworksms domain
if (strpos($url, 'http://www.clockworksms.com/') === 0) {
return true;
}
return false;
}
}