public function detection() { Piwik::checkUserHasSomeAdminAccess(); $view = new View('@DevicesDetection/detection'); $this->setBasicVariablesView($view); ControllerAdmin::setBasicVariablesAdminView($view); $userAgent = Common::getRequestVar('ua', $_SERVER['HTTP_USER_AGENT'], 'string'); $uaParser = new DeviceDetector($userAgent); $uaParser->parse(); $view->userAgent = $userAgent; $view->browser_name = $uaParser->getClient('name'); $view->browser_short_name = $uaParser->getClient('short_name'); $view->browser_version = $uaParser->getClient('version'); $view->browser_logo = getBrowserLogo($uaParser->getClient('short_name')); $view->browser_family = \DeviceDetector\Parser\Client\Browser::getBrowserFamily($uaParser->getClient('short_name')); $view->browser_family_logo = getBrowserFamilyLogo($view->browser_family); $view->os_name = $uaParser->getOs('name'); $view->os_logo = getOsLogo($uaParser->getOs('short_name')); $view->os_short_name = $uaParser->getOs('short_name'); $view->os_family = \DeviceDetector\Parser\OperatingSystem::getOsFamily($uaParser->getOs('short_name')); $view->os_family_logo = getOsFamilyLogo($view->os_family); $view->os_version = $uaParser->getOs('version'); $view->device_type = getDeviceTypeLabel($uaParser->getDeviceName()); $view->device_type_logo = getDeviceTypeLogo($uaParser->getDeviceName()); $view->device_model = $uaParser->getModel(); $view->device_brand = getDeviceBrandLabel($uaParser->getBrand()); $view->device_brand_logo = getBrandLogo($uaParser->getBrand()); return $view->render(); }
public function deviceDetection() { Piwik::checkUserHasSomeAdminAccess(); $view = new View('@DevicesDetection/detection'); $this->setBasicVariablesView($view); ControllerAdmin::setBasicVariablesAdminView($view); $userAgent = Common::getRequestVar('ua', $_SERVER['HTTP_USER_AGENT'], 'string'); $parsedUA = DeviceDetector::getInfoFromUserAgent($userAgent); $view->userAgent = $userAgent; $view->browser_name = $parsedUA['browser']['name']; $view->browser_short_name = $parsedUA['browser']['short_name']; $view->browser_version = $parsedUA['browser']['version']; $view->browser_logo = getBrowserLogoExtended($parsedUA['browser']['short_name']); $view->browser_family = $parsedUA['browser_family']; $view->browser_family_logo = getBrowserFamilyLogoExtended($parsedUA['browser_family']); $view->os_name = $parsedUA['os']['name']; $view->os_logo = getOsLogoExtended($parsedUA['os']['short_name']); $view->os_short_name = $parsedUA['os']['short_name']; $view->os_family = $parsedUA['os_family']; $view->os_family_logo = getOsFamilyLogoExtended($parsedUA['os_family']); $view->os_version = $parsedUA['os']['version']; $view->device_type = getDeviceTypeLabel($parsedUA['device']['type']); $view->device_type_logo = getDeviceTypeLogo($parsedUA['device']['type']); $view->device_model = $parsedUA['device']['model']; $view->device_brand = getDeviceBrandLabel($parsedUA['device']['brand']); $view->device_brand_logo = getBrandLogo($view->device_brand); return $view->render(); }
/** * Controller constructor. * @param Translator $translator * @param Plugin\SettingsProvider $settingsProvider * @param PluginInstaller $pluginInstaller * @param Plugins $marketplacePlugins */ public function __construct(Translator $translator, Plugin\SettingsProvider $settingsProvider, PluginInstaller $pluginInstaller, $marketplacePlugins = null) { $this->translator = $translator; $this->settingsProvider = $settingsProvider; $this->pluginInstaller = $pluginInstaller; $this->pluginManager = Plugin\Manager::getInstance(); if (!empty($marketplacePlugins)) { $this->marketplacePlugins = $marketplacePlugins; } elseif (Marketplace::isMarketplaceEnabled()) { // we load it manually as marketplace might not be loaded $this->marketplacePlugins = StaticContainer::get('Piwik\\Plugins\\Marketplace\\Plugins'); } parent::__construct(); }
/** * @return string */ public function admin() { Piwik::checkUserHasSuperUserAccess(); $view = new View('@LoginLdap/index'); ControllerAdmin::setBasicVariablesAdminView($view); if (!function_exists('ldap_connect')) { $notification = new Notification(Piwik::translate('LoginLdap_LdapFunctionsMissing')); $notification->context = Notification::CONTEXT_ERROR; $notification->type = Notification::TYPE_PERSISTENT; Notification\Manager::notify('LoginLdap_LdapFunctionsMissing', $notification); } $this->setBasicVariablesView($view); $serverNames = Config::getServerNameList() ?: array(); $view->servers = array(); if (empty($serverNames)) { try { $serverInfo = ServerInfo::makeFromOldConfig()->getProperties(); $serverInfo['name'] = 'server'; $view->servers[] = $serverInfo; } catch (Exception $ex) { // ignore } } else { foreach ($serverNames as $server) { $serverConfig = Config::getServerConfig($server); if (!empty($serverConfig)) { $serverConfig['name'] = $server; $view->servers[] = $serverConfig; } } } $view->ldapConfig = Config::getPluginOptionValuesWithDefaults(); $view->isLoginControllerActivated = PluginManager::getInstance()->isPluginActivated('Login'); $view->updatedFromPre30 = Option::get('LoginLdap_updatedFromPre3_0'); return $view->render(); }
public function __construct(Translator $translator) { $this->translator = $translator; parent::__construct(); }
<?php /** * Piwik - free/libre analytics platform * * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later * * @package Piwik */ use Piwik\Error; use Piwik\ExceptionHandler; use Piwik\FrontController; use Piwik\Plugin\ControllerAdmin as PluginControllerAdmin; PluginControllerAdmin::disableEacceleratorIfEnabled(); if (!defined('PIWIK_ENABLE_ERROR_HANDLER') || PIWIK_ENABLE_ERROR_HANDLER) { require_once PIWIK_INCLUDE_PATH . '/core/Error.php'; Error::setErrorHandler(); require_once PIWIK_INCLUDE_PATH . '/core/ExceptionHandler.php'; ExceptionHandler::setUp(); } FrontController::setUpSafeMode(); if (!defined('PIWIK_ENABLE_DISPATCH')) { define('PIWIK_ENABLE_DISPATCH', true); } if (PIWIK_ENABLE_DISPATCH) { $controller = FrontController::getInstance(); $controller->init(); $response = $controller->dispatch(); if (is_array($response)) { var_export($response);
public function __construct(Translator $translator, OptOutManager $optOutManager) { $this->translator = $translator; $this->optOutManager = $optOutManager; parent::__construct(); }
public function __construct(ConfigReader $configReader) { $this->configReader = $configReader; parent::__construct(); }
public function __construct(RegionDataProvider $regionDataProvider, Translator $translator) { $this->regionDataProvider = $regionDataProvider; $this->translator = $translator; parent::__construct(); }
if (!defined('PIWIK_USER_PATH')) { define('PIWIK_USER_PATH', PIWIK_DOCUMENT_ROOT); } if (!defined('PIWIK_INCLUDE_PATH')) { define('PIWIK_INCLUDE_PATH', PIWIK_DOCUMENT_ROOT); } @ignore_user_abort(true); if (file_exists(PIWIK_INCLUDE_PATH . '/vendor/autoload.php')) { $vendorDirectory = PIWIK_INCLUDE_PATH . '/vendor'; } else { $vendorDirectory = PIWIK_INCLUDE_PATH . '/../..'; } require_once $vendorDirectory . '/autoload.php'; require_once PIWIK_INCLUDE_PATH . '/core/Plugin/Controller.php'; require_once PIWIK_INCLUDE_PATH . '/core/Plugin/ControllerAdmin.php'; \Piwik\Plugin\ControllerAdmin::disableEacceleratorIfEnabled(); require_once PIWIK_INCLUDE_PATH . '/libs/upgradephp/upgrade.php'; require_once PIWIK_INCLUDE_PATH . '/core/testMinimumPhpVersion.php'; require_once PIWIK_INCLUDE_PATH . '/core/Singleton.php'; require_once PIWIK_INCLUDE_PATH . '/core/Plugin/Manager.php'; require_once PIWIK_INCLUDE_PATH . '/core/Plugin.php'; require_once PIWIK_INCLUDE_PATH . '/core/Common.php'; require_once PIWIK_INCLUDE_PATH . '/core/Piwik.php'; require_once PIWIK_INCLUDE_PATH . '/core/IP.php'; require_once PIWIK_INCLUDE_PATH . '/core/UrlHelper.php'; require_once PIWIK_INCLUDE_PATH . '/core/Url.php'; require_once PIWIK_INCLUDE_PATH . '/core/SettingsPiwik.php'; require_once PIWIK_INCLUDE_PATH . '/core/Tracker.php'; require_once PIWIK_INCLUDE_PATH . '/core/Config.php'; require_once PIWIK_INCLUDE_PATH . '/core/Translate.php'; require_once PIWIK_INCLUDE_PATH . '/core/Tracker/Cache.php';
public function installAllPaidPlugins() { Piwik::checkUserHasSuperUserAccess(); $this->dieIfPluginsAdminIsDisabled(); Plugin\ControllerAdmin::displayWarningIfConfigFileNotWritable(); Nonce::checkNonce(static::INSTALL_NONCE); $paidPlugins = $this->plugins->getAllPaidPlugins(); $hasErrors = false; foreach ($paidPlugins as $paidPlugin) { if (!$this->canPluginBeInstalled($paidPlugin)) { continue; } $pluginName = $paidPlugin['name']; try { $this->pluginInstaller->installOrUpdatePluginFromMarketplace($pluginName); } catch (\Exception $e) { $notification = new Notification($e->getMessage()); $notification->context = Notification::CONTEXT_ERROR; Notification\Manager::notify('Marketplace_Install' . $pluginName, $notification); $hasErrors = true; } } if ($hasErrors) { Url::redirectToReferrer(); return; } $dependency = new Plugin\Dependency(); for ($i = 0; $i <= 10; $i++) { foreach ($paidPlugins as $index => $paidPlugin) { $pluginName = $paidPlugin['name']; if ($this->pluginManager->isPluginActivated($pluginName)) { unset($paidPlugins[$index]); continue; } if (empty($paidPlugin['require']) || !$dependency->hasDependencyToDisabledPlugin($paidPlugin['require'])) { unset($paidPlugins[$index]); try { $this->pluginManager->activatePlugin($pluginName); } catch (Exception $e) { $hasErrors = true; $notification = new Notification($e->getMessage()); $notification->context = Notification::CONTEXT_ERROR; Notification\Manager::notify('Marketplace_Install' . $pluginName, $notification); } } } } if ($hasErrors) { $notification = new Notification(Piwik::translate('Marketplace_OnlySomePaidPluginsInstalledAndActivated')); $notification->context = Notification::CONTEXT_INFO; } else { $notification = new Notification(Piwik::translate('Marketplace_AllPaidPluginsInstalledAndActivated')); $notification->context = Notification::CONTEXT_SUCCESS; } Notification\Manager::notify('Marketplace_InstallAll', $notification); Url::redirectToReferrer(); }