update Piwik to version 2.16 (fixes #91)
This commit is contained in:
parent
296343bf3b
commit
d885a4baa9
5833 changed files with 418860 additions and 226988 deletions
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
|
|
@ -8,6 +8,7 @@
|
|||
*/
|
||||
|
||||
namespace Piwik\Settings;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Piwik;
|
||||
|
||||
|
|
@ -22,9 +23,15 @@ class UserSetting extends Setting
|
|||
{
|
||||
private $userLogin = null;
|
||||
|
||||
/**
|
||||
* Null while not initialized, bool otherwise.
|
||||
* @var null|bool
|
||||
*/
|
||||
private $hasReadAndWritePermission = null;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
*
|
||||
* @param string $name The setting's persisted name.
|
||||
* @param string $title The setting's display name.
|
||||
* @param null|string $userLogin The user this setting applies to. Will default to the current user login.
|
||||
|
|
@ -34,13 +41,37 @@ class UserSetting extends Setting
|
|||
parent::__construct($name, $title);
|
||||
|
||||
$this->setUserLogin($userLogin);
|
||||
}
|
||||
|
||||
$this->displayedForCurrentUser = Piwik::isUserHasSomeViewAccess();
|
||||
/**
|
||||
* Returns `true` if this setting can be displayed for the current user, `false` if otherwise.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isReadableByCurrentUser()
|
||||
{
|
||||
return $this->isWritableByCurrentUser();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns `true` if this setting can be displayed for the current user, `false` if otherwise.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isWritableByCurrentUser()
|
||||
{
|
||||
if (isset($this->hasReadAndWritePermission)) {
|
||||
return $this->hasReadAndWritePermission;
|
||||
}
|
||||
|
||||
$this->hasReadAndWritePermission = Piwik::isUserHasSomeViewAccess();
|
||||
|
||||
return $this->hasReadAndWritePermission;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the display order. User settings are displayed after system settings.
|
||||
*
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getOrder()
|
||||
|
|
@ -100,16 +131,13 @@ class UserSetting extends Setting
|
|||
$pluginsSettings = Manager::getAllPluginSettings();
|
||||
|
||||
foreach ($pluginsSettings as $pluginSettings) {
|
||||
|
||||
$settings = $pluginSettings->getSettings();
|
||||
|
||||
foreach ($settings as $setting) {
|
||||
|
||||
if ($setting instanceof UserSetting) {
|
||||
$setting->setUserLogin($userLogin);
|
||||
$pluginSettings->removeSettingValue($setting);
|
||||
$setting->removeValue();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$pluginSettings->save();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue