diff options
-rw-r--r-- | plugins/Proxy/Controller.php | 31 | ||||
-rw-r--r-- | plugins/Proxy/tests/Unit/ProxyTest.php | 48 |
2 files changed, 0 insertions, 79 deletions
diff --git a/plugins/Proxy/Controller.php b/plugins/Proxy/Controller.php index fe3c529196..7b0a60ec90 100644 --- a/plugins/Proxy/Controller.php +++ b/plugins/Proxy/Controller.php @@ -20,7 +20,6 @@ use Piwik\ProxyHttp; */ class Controller extends \Piwik\Plugin\Controller { - const TRANSPARENT_PNG_PIXEL = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAApJREFUCNdjYAAAAAIAAeIhvDMAAAAASUVORK5CYII='; const JS_MIME_TYPE = "application/javascript; charset=UTF-8"; /** @@ -83,34 +82,4 @@ class Controller extends \Piwik\Plugin\Controller { 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; - } } diff --git a/plugins/Proxy/tests/Unit/ProxyTest.php b/plugins/Proxy/tests/Unit/ProxyTest.php deleted file mode 100644 index e4db54b303..0000000000 --- a/plugins/Proxy/tests/Unit/ProxyTest.php +++ /dev/null @@ -1,48 +0,0 @@ -<?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\tests\Unit; - -use Piwik\Plugins\Proxy\Controller; - -/** - * @group Proxy - * @group ProxyTest - * @group Plugins - */ -class ProxyTest extends \PHPUnit\Framework\TestCase -{ - public function getAcceptableRemoteUrls() - { - return array( - // piwik white list (and used in homepage) - array('http://piwik.org/', true), - - array('http://piwik.org', true), - array('http://qa.piwik.org/', true), - array('http://forum.piwik.org/', true), - array('http://dev.piwik.org/', true), - array('http://demo.piwik.org/', true), - - // not in the piwik white list - array('http://www.piwik.org/', false), - array('https://piwik.org/', false), - array('http://example.org/', false), - ); - } - - /** - * @dataProvider getAcceptableRemoteUrls - * @group Plugins - */ - public function testIsAcceptableRemoteUrl($url, $expected) - { - $this->assertEquals($expected, Controller::isPiwikUrl($url)); - } -} - |