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:
authormattab <matthieu.aubry@gmail.com>2013-10-07 05:08:56 +0400
committermattab <matthieu.aubry@gmail.com>2013-10-07 05:08:56 +0400
commit9d4e91ee598fa2b19cfc21acac18cb45d8702e39 (patch)
tree687c104e92628ab0ebfed526bb97b4a32c92f597
parentcb26fffe12b9b61a53240a8935f1b0ee6a94f1a8 (diff)
Refactoring + improve Trusted Host message
-rw-r--r--core/Controller.php6
-rw-r--r--piwik.php1
-rw-r--r--plugins/CoreAdminHome/templates/generalSettings.twig12
-rw-r--r--plugins/CoreHome/templates/_warningInvalidHost.twig10
-rw-r--r--plugins/CorePluginsAdmin/PluginInstaller.php5
-rw-r--r--plugins/Login/templates/login.twig9
-rw-r--r--plugins/Zeitgeist/templates/_iframeBuster.twig12
7 files changed, 29 insertions, 26 deletions
diff --git a/core/Controller.php b/core/Controller.php
index 1ec4979a55..6addbc5653 100644
--- a/core/Controller.php
+++ b/core/Controller.php
@@ -516,9 +516,9 @@ abstract class Controller
'</a>'
));
}
- $view->invalidHostMessageHowToFix = '<b>How do I fix this problem and how do I login again?</b><br/> The Piwik Super User can manually edit the file piwik/config/config.ini.php
- and add the following lines: <pre>[General]' . "\n" . 'trusted_hosts[] = "' . $validHost . '"</pre><br/>After making the change, you will be able to login again.<br/><br/>
- You may also <i>disable this security feature (not recommended)</i>. To do so edit config/config.ini.php and add:
+ $view->invalidHostMessageHowToFix = '<p><b>How do I fix this problem and how do I login again?</b><br/> The Piwik Super User can manually edit the file piwik/config/config.ini.php
+ and add the following lines: <pre>[General]' . "\n" . 'trusted_hosts[] = "' . $invalidHost . '"</pre>After making the change, you will be able to login again.</p>
+ <p>You may also <i>disable this security feature (not recommended)</i>. To do so edit config/config.ini.php and add:
<pre>[General]' . "\n" . 'enable_trusted_host_check=0</pre>';
$view->invalidHost = $invalidHost; // for UserSettings warning
diff --git a/piwik.php b/piwik.php
index 36a9cced21..1f98005d2a 100644
--- a/piwik.php
+++ b/piwik.php
@@ -58,6 +58,7 @@ require_once PIWIK_INCLUDE_PATH . '/core/Tracker/Action.php';
require_once PIWIK_INCLUDE_PATH . '/core/Tracker/Request.php';
require_once PIWIK_INCLUDE_PATH . '/core/Tracker/Referrer.php';
require_once PIWIK_INCLUDE_PATH . '/core/Tracker/VisitExcluded.php';
+require_once PIWIK_INCLUDE_PATH . '/core/Tracker/VisitorNotFoundInDb.php';
require_once PIWIK_INCLUDE_PATH . '/core/CacheFile.php';
require_once PIWIK_INCLUDE_PATH . '/core/Filesystem.php';
require_once PIWIK_INCLUDE_PATH . '/core/Cookie.php';
diff --git a/plugins/CoreAdminHome/templates/generalSettings.twig b/plugins/CoreAdminHome/templates/generalSettings.twig
index 15df9d9b08..1ed5b826a1 100644
--- a/plugins/CoreAdminHome/templates/generalSettings.twig
+++ b/plugins/CoreAdminHome/templates/generalSettings.twig
@@ -159,15 +159,9 @@
</div>
<h2 id="trustedHostsSection">{{ 'CoreAdminHome_TrustedHostSettings'|translate }}</h2>
<div id='trustedHostSettings'>
- {# untrusted host warning (display again) #}
- {% if isValidHost is defined and invalidHostMessage is defined and not isValidHost %}
- <div class="ajaxSuccess">
- <a style="float:right;" href="http://piwik.org/faq/troubleshooting/#faq_171" target="_blank">
- <img src="plugins/Zeitgeist/images/help_grey.png"/>
- </a>
- <strong>{{ 'General_Warning'|translate }}:&nbsp;</strong>{{ invalidHostMessage }}
- </div>
- {% endif %}
+
+ {% include "@CoreHome/_warningInvalidHost.twig" %}
+
{% if trustedHosts|length == 1 and (isValidHost is not defined or isValidHost) %}
{{ 'CoreAdminHome_PiwikIsInstalledAt'|translate }}:&nbsp;&nbsp;
<input name="trusted_host" type="text" value="{{ trustedHosts[0] }}"/>
diff --git a/plugins/CoreHome/templates/_warningInvalidHost.twig b/plugins/CoreHome/templates/_warningInvalidHost.twig
index 8251874e27..2e77d9605b 100644
--- a/plugins/CoreHome/templates/_warningInvalidHost.twig
+++ b/plugins/CoreHome/templates/_warningInvalidHost.twig
@@ -2,7 +2,15 @@
{% if (isValidHost is defined and invalidHostMessage is defined and isValidHost == false) %}
<div class="ajaxSuccess" style="clear:both;width:800px;">
<a style="float:right;" href="http://piwik.org/faq/troubleshooting/#faq_171" target="_blank"><img src="plugins/Zeitgeist/images/help_grey.png"/></a>
- <strong>{{ 'General_Warning'|translate }}:&nbsp;</strong>{{ invalidHostMessage }}
+ <strong>{{ 'General_Warning'|translate }}:&nbsp;</strong>{{ invalidHostMessage|raw }}
+
+ <br><hr>
+
+ <small>{{ invalidHostMessageHowToFix|raw }}
+ <br/><br/><a style="float:right;" href="http://piwik.org/faq/troubleshooting/#faq_171" target="_blank">{{ 'General_Help'|translate }}
+ <img style="vertical-align: bottom;" src="plugins/Zeitgeist/images/help_grey.png"/></a><br/>
+ </small>
</div>
+
{% endif %}
diff --git a/plugins/CorePluginsAdmin/PluginInstaller.php b/plugins/CorePluginsAdmin/PluginInstaller.php
index d284ff75c8..849b910e21 100644
--- a/plugins/CorePluginsAdmin/PluginInstaller.php
+++ b/plugins/CorePluginsAdmin/PluginInstaller.php
@@ -142,6 +142,11 @@ class PluginInstaller
throw new PluginInstallerException('Plugin is not valid, the plugin.json file does not specify the plugin name.');
}
+ if (!preg_match('/^[a-zA-Z0-9_-]+$/', $metadata->name)) {
+ throw new PluginInstallerException('The plugin name specified in plugin.json contains illegal characters. ' .
+ 'Plugin name can only contain following characters: [a-zA-Z0-9-_].');
+ }
+
if (empty($metadata->version)) {
throw new PluginInstallerException('Plugin is not valid, the plugin.json file does not specify the plugin version.');
}
diff --git a/plugins/Login/templates/login.twig b/plugins/Login/templates/login.twig
index 8cdc70973d..d3c7a43614 100644
--- a/plugins/Login/templates/login.twig
+++ b/plugins/Login/templates/login.twig
@@ -73,14 +73,7 @@
{# untrusted host warning #}
{% if (isValidHost is defined and invalidHostMessage is defined and isValidHost == false) %}
- <div class="message_error">
- <strong>{{ 'General_Warning'|translate }}:&nbsp;</strong>{{ invalidHostMessage }}
-
- <br><br>{{ invalidHostMessageHowToFix }}
- <br/><br/><a style="float:right;" href="http://piwik.org/faq/troubleshooting/#faq_171"
- target="_blank">{{ 'General_Help'|translate }}
- <img style="vertical-align: bottom;" src="plugins/Zeitgeist/images/help_grey.png"/></a><br/>
- </div>
+ {% include '@CoreHome/_warningInvalidHost.twig' %}
{% else %}
<div id="message_container">
{% if form_data.errors %}
diff --git a/plugins/Zeitgeist/templates/_iframeBuster.twig b/plugins/Zeitgeist/templates/_iframeBuster.twig
index d5bfd4f5d8..b7c1b3784b 100644
--- a/plugins/Zeitgeist/templates/_iframeBuster.twig
+++ b/plugins/Zeitgeist/templates/_iframeBuster.twig
@@ -1,9 +1,11 @@
{% if (enableFrames is defined and enableFrames == false) %}
<script type="text/javascript">
- $('body').css("display", "none");
- if (self == top) {
- var theBody = document.getElementsByTagName('body')[0];
- theBody.style.display = 'block';
- } else { top.location = self.location; }
+ $(function () {
+ $('body').css("display", "none");
+ if (self == top) {
+ var theBody = document.getElementsByTagName('body')[0];
+ theBody.style.display = 'block';
+ } else { top.location = self.location; }
+ });
</script>
{% endif %} \ No newline at end of file