Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/Db/Adapter/Pdo/Mysql.php15
-rw-r--r--core/Tracker/Request.php9
-rw-r--r--plugins/CoreHome/templates/_topBar.twig4
m---------plugins/CustomDimensions0
-rw-r--r--plugins/SegmentEditor/SegmentFormatter.php9
-rw-r--r--plugins/SegmentEditor/tests/Integration/SegmentFormatterTest.php6
-rw-r--r--tests/PHPUnit/Unit/Tracker/RequestTest.php19
m---------tests/UI/expected-ui-screenshots0
8 files changed, 58 insertions, 4 deletions
diff --git a/core/Db/Adapter/Pdo/Mysql.php b/core/Db/Adapter/Pdo/Mysql.php
index aaf93e1b6b..9e26fb7a2b 100644
--- a/core/Db/Adapter/Pdo/Mysql.php
+++ b/core/Db/Adapter/Pdo/Mysql.php
@@ -246,4 +246,19 @@ class Mysql extends Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface
$this->cachePreparedStatement[$sql] = $stmt;
return $stmt;
}
+
+ /**
+ * Override _dsn() to ensure host and port to not be passed along
+ * if unix_socket is set since setting both causes unexpected behaviour
+ * @see http://php.net/manual/en/ref.pdo-mysql.connection.php
+ */
+ protected function _dsn()
+ {
+ if (!empty($this->_config['unix_socket'])) {
+ unset($this->_config['host']);
+ unset($this->_config['port']);
+ }
+
+ return parent::_dsn();
+ }
}
diff --git a/core/Tracker/Request.php b/core/Tracker/Request.php
index 7f194f7d1a..e714ecded7 100644
--- a/core/Tracker/Request.php
+++ b/core/Tracker/Request.php
@@ -288,6 +288,15 @@ class Request
'i' => (string)Common::getRequestVar('m', $this->getCurrentDate("i"), 'int', $this->params),
's' => (string)Common::getRequestVar('s', $this->getCurrentDate("s"), 'int', $this->params)
);
+ if($localTimes['h'] < 0 || $localTimes['h'] > 23) {
+ $localTimes['h'] = 0;
+ }
+ if($localTimes['i'] < 0 || $localTimes['i'] > 59) {
+ $localTimes['i'] = 0;
+ }
+ if($localTimes['s'] < 0 || $localTimes['s'] > 59) {
+ $localTimes['s'] = 0;
+ }
foreach ($localTimes as $k => $time) {
if (strlen($time) == 1) {
$localTimes[$k] = '0' . $time;
diff --git a/plugins/CoreHome/templates/_topBar.twig b/plugins/CoreHome/templates/_topBar.twig
index e69e9c1978..c1158f46bb 100644
--- a/plugins/CoreHome/templates/_topBar.twig
+++ b/plugins/CoreHome/templates/_topBar.twig
@@ -1,5 +1,5 @@
{{ postEvent("Template.beforeTopBar", userAlias, userLogin, topMenu, userMenu) }}
-<ul class="navbar-right">
+<ul role="menubar" class="navbar-right">
{% macro menuItemLabel(label, icon) %}
{% if icon is defined and icon and icon starts with 'icon-' %}
@@ -27,7 +27,7 @@
{% spaceless %}
{% for label,menu in topMenu %}
- <li>{{ _self.topMenuItem(label, menu, topMenuModule, topMenuAction) }}</li>
+ <li role="menuitem">{{ _self.topMenuItem(label, menu, topMenuModule, topMenuAction) }}</li>
{% endfor %}
{% endspaceless %}
diff --git a/plugins/CustomDimensions b/plugins/CustomDimensions
-Subproject eb14bac44db3fc18bfe9403a6004ed93749c4ea
+Subproject 6912032221b6e2536086d3056432e71f3cde1bb
diff --git a/plugins/SegmentEditor/SegmentFormatter.php b/plugins/SegmentEditor/SegmentFormatter.php
index 54dcc20c99..19838d46d5 100644
--- a/plugins/SegmentEditor/SegmentFormatter.php
+++ b/plugins/SegmentEditor/SegmentFormatter.php
@@ -59,8 +59,13 @@ class SegmentFormatter
return Piwik::translate('SegmentEditor_DefaultAllVisits');
}
- $segment = new SegmentExpression($segmentString);
- $expressions = $segment->parseSubExpressions();
+ try {
+ $segment = new SegmentExpression(urldecode($segmentString));
+ $expressions = $segment->parseSubExpressions();
+ } catch (Exception $e) {
+ $segment = new SegmentExpression($segmentString);
+ $expressions = $segment->parseSubExpressions();
+ }
$readable = '';
foreach ($expressions as $expression) {
diff --git a/plugins/SegmentEditor/tests/Integration/SegmentFormatterTest.php b/plugins/SegmentEditor/tests/Integration/SegmentFormatterTest.php
index bc0f206784..ca37e0775b 100644
--- a/plugins/SegmentEditor/tests/Integration/SegmentFormatterTest.php
+++ b/plugins/SegmentEditor/tests/Integration/SegmentFormatterTest.php
@@ -88,6 +88,12 @@ class SegmentFormatterTest extends IntegrationTestCase
$this->assertSame('Browser version is not null nor empty', $readable);
}
+ public function test_getHumanReadable_ShouldHandleAUrlDecodedSegment()
+ {
+ $readable = $this->formatter->getHumanReadable($segment = 'pageUrl%3D%40piwik%2CvisitId!%3D1', $this->idSite);
+ $this->assertSame('Page URL contains "piwik" or Visit ID is not "1"', $readable);
+ }
+
/**
* @expectedException \Exception
* @expectedExceptionMessage The segment 'noTexisTinG' does not exist
diff --git a/tests/PHPUnit/Unit/Tracker/RequestTest.php b/tests/PHPUnit/Unit/Tracker/RequestTest.php
index 3db5c22a4a..7eb38059a2 100644
--- a/tests/PHPUnit/Unit/Tracker/RequestTest.php
+++ b/tests/PHPUnit/Unit/Tracker/RequestTest.php
@@ -470,6 +470,25 @@ class RequestTest extends UnitTestCase
$this->assertContains($needle, $cookie . '');
}
+ public function test_getLocalTime()
+ {
+ $request = $this->buildRequest(array('h' => '12', 'm' => '34', 's' => '3'));
+ $this->assertSame('12:34:03', $request->getLocalTime());
+
+
+ $request = $this->buildRequest(array('h' => '23', 'm' => '59', 's' => '59'));
+ $this->assertSame('23:59:59', $request->getLocalTime());
+ }
+
+ public function test_getLocalTime_shouldReturnValidTime_whenTimeWasInvalid()
+ {
+ $request = $this->buildRequest(array('h' => '26', 'm' => '60', 's' => '333'));
+ $this->assertSame('00:00:00', $request->getLocalTime());
+
+ $request = $this->buildRequest(array('h' => '-26', 'm' => '-60', 's' => '-333'));
+ $this->assertSame('00:00:00', $request->getLocalTime());
+ }
+
public function test_getIdSite()
{
$request = $this->buildRequest(array('idsite' => '14'));
diff --git a/tests/UI/expected-ui-screenshots b/tests/UI/expected-ui-screenshots
-Subproject 6888230ab178bcc2518acbf2e028727c4b69010
+Subproject e04277b04950786ac312b5f78871137e7ff09e5