[Piwik-svn] r363 - in trunk: modules plugins/Dashboard plugins/Home plugins/Login plugins/SitesManager
svnmaster at piwik.org
svnmaster at piwik.org
Wed Mar 12 11:23:01 CET 2008
Author: matt
Date: 2008-03-12 11:22:59 +0100 (Wed, 12 Mar 2008)
New Revision: 363
Modified:
trunk/modules/testMinimumPhpVersion.php
trunk/plugins/Dashboard/Controller.php
trunk/plugins/Home/Controller.php
trunk/plugins/Login/Controller.php
trunk/plugins/SitesManager/API.php
Log:
- fix #136 Bad default redirection when website with idSite=1 has been deleted
Modified: trunk/modules/testMinimumPhpVersion.php
===================================================================
--- trunk/modules/testMinimumPhpVersion.php 2008-03-12 00:03:15 UTC (rev 362)
+++ trunk/modules/testMinimumPhpVersion.php 2008-03-12 10:22:59 UTC (rev 363)
@@ -38,55 +38,61 @@
If you want to use Piwik you need to set <pre>zend.ze1_compatibility_mode = Off</pre> in your php.ini configuration file. You may have to ask your system administrator.</p>";
}
-if(isset($piwik_errorMessage))
-{
- $html = '<html>
- <head>
- <title>Piwik › Error</title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <style>
- html { background: #eee; }
- body {
- background: #fff;
- color: #000;
- font-family: Georgia, "Times New Roman", Times, serif;
- margin-left: 20%;
- margin-top: 25px;
- margin-right: 20%;
- padding: .2em 2em;
- }
- a { color: #006; }
- #h1 {
- color: #006;
- font-size: 45px;
- font-weight: lighter;
- }
- #subh1 {
- color: #879DBD;
- font-size: 25px;
- font-weight: lighter;
- }
- p, li, dt {
- line-height: 140%;
- padding-bottom: 2px;
- }
- ul, ol { padding: 5px 5px 5px 20px; }
- </style>
- </head>
- <body>
- <span id="h1">Piwik </span><span id="subh1"> # open source web analytics</span>
- <p>'.$piwik_errorMessage.'</p>
+function Piwik_ExitWithMessage($message)
+{
+
+ $html = '<html>
+ <head>
+ <title>Piwik › Error</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <style>
+ html { background: #eee; }
+ body {
+ background: #fff;
+ color: #000;
+ font-family: Georgia, "Times New Roman", Times, serif;
+ margin-left: 20%;
+ margin-top: 25px;
+ margin-right: 20%;
+ padding: .2em 2em;
+ }
+ a { color: #006; }
+ #h1 {
+ color: #006;
+ font-size: 45px;
+ font-weight: lighter;
+ }
+ #subh1 {
+ color: #879DBD;
+ font-size: 25px;
+ font-weight: lighter;
+ }
+ p, li, dt {
+ line-height: 140%;
+ padding-bottom: 2px;
+ }
+ ul, ol { padding: 5px 5px 5px 20px; }
+ </style>
+ </head>
+ <body>
+ <span id="h1">Piwik </span><span id="subh1"> # open source web analytics</span>
+ <p>'.$message.'</p>
<ul>
<li><a href="http://piwik.org">Piwik homepage</a></li>
<li><a href="http://piwik.org/demo">Piwik demo</a></li>
- </ul>
- </body>
- </html>';
- echo $html;
- exit;
+ </ul>
+ </body>
+ </html>';
+ echo $html;
+ exit;
}
+if(isset($piwik_errorMessage))
+{
+ Piwik_ExitWithMessage($piwik_errorMessage);
+}
+
// we now include the upgradephp package to define some functions used in piwik
// that may not be defined in the current php version
require_once PIWIK_INCLUDE_PATH . "/libs/upgradephp/upgrade.php";
\ No newline at end of file
Modified: trunk/plugins/Dashboard/Controller.php
===================================================================
--- trunk/plugins/Dashboard/Controller.php 2008-03-12 00:03:15 UTC (rev 362)
+++ trunk/plugins/Dashboard/Controller.php 2008-03-12 10:22:59 UTC (rev 363)
@@ -46,16 +46,6 @@
return $json;
}
- function getDefaultAction()
- {
- return 'redirectToIndex';
- }
-
- function redirectToIndex()
- {
- header("Location:?module=Dashboard&action=index&idSite=1&period=day&date=yesterday");
- }
-
public function embeddedIndex()
{
$view = new Piwik_View('Dashboard/templates/index.tpl');
Modified: trunk/plugins/Home/Controller.php
===================================================================
--- trunk/plugins/Home/Controller.php 2008-03-12 00:03:15 UTC (rev 362)
+++ trunk/plugins/Home/Controller.php 2008-03-12 10:22:59 UTC (rev 363)
@@ -25,8 +25,27 @@
return 'redirectToIndex';
}
function redirectToIndex()
- {
- header("Location:?module=Home&action=index&idSite=1&period=day&date=yesterday");
+ {
+ $sitesId = Piwik_SitesManager_API::getSitesIdWithAtLeastViewAccess();
+ if(!empty($sitesId))
+ {
+ $firstSiteId = $sitesId[0];
+ header("Location:?module=Home&action=index&idSite=$firstSiteId&period=day&date=yesterday");
+ }
+ else
+ {
+ if(($currentLogin = Piwik::getCurrentUserLogin()) != 'anonymous')
+ {
+ Piwik_ExitWithMessage( "You are logged in as '$currentLogin' but it seems you don't have any permission set in Piwik.
+ <br />Ask your Piwik administrator to give you 'view' access to a website.
+ <br /><br /> <b><a href='?module=Login&action=logout'>› Logout from Piwik</a></b><br />");
+ }
+ else
+ {
+ Piwik_FrontController::dispatch('Login');
+ }
+ }
+ exit;
}
protected function setGeneralVariablesView($view)
Modified: trunk/plugins/Login/Controller.php
===================================================================
--- trunk/plugins/Login/Controller.php 2008-03-12 00:03:15 UTC (rev 362)
+++ trunk/plugins/Login/Controller.php 2008-03-12 10:22:59 UTC (rev 363)
@@ -80,9 +80,8 @@
$cookie = new Piwik_Cookie($authCookieName);
$cookie->delete();
- $baseUrl = Piwik_Url::getReferer();
-
- Piwik_Url::redirectToUrl($baseUrl);
+ // after logout we redirect to the Homepage instead of the referer
+ Piwik::redirectToModule('Home');
}
}
Modified: trunk/plugins/SitesManager/API.php
===================================================================
--- trunk/plugins/SitesManager/API.php 2008-03-12 00:03:15 UTC (rev 362)
+++ trunk/plugins/SitesManager/API.php 2008-03-12 10:22:59 UTC (rev 363)
@@ -282,6 +282,9 @@
$db->query("DELETE FROM ".Piwik::prefixTable("site_url")."
WHERE idsite = ?", $idSite);
+ $db->query("DELETE FROM ".Piwik::prefixTable("access")."
+ WHERE idsite = ?", $idSite);
+
// TODO we should also delete all the data relative to this website...
// post an event here that will be catched by the core and plugins to clean the data
}
More information about the Piwik-svn
mailing list