本文整理汇总了PHP中Piwik\Piwik::checkUserHasSomeAdminAccess方法的典型用法代码示例。如果您正苦于以下问题:PHP Piwik::checkUserHasSomeAdminAccess方法的具体用法?PHP Piwik::checkUserHasSomeAdminAccess怎么用?PHP Piwik::checkUserHasSomeAdminAccess使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\Piwik
的用法示例。
在下文中一共展示了Piwik::checkUserHasSomeAdminAccess方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: searchTranslation
public function searchTranslation()
{
Piwik::checkUserHasSomeAdminAccess();
$view = new View('@LanguagesManager/searchTranslation');
$this->setBasicVariablesView($view);
return $view->render();
}
示例2: doesIncludePluginTrackersAutomatically
/**
* Detects whether plugin trackers will be automatically added to piwik.js or not. If not, the plugin tracker files
* need to be loaded manually.
* @return bool
*/
public function doesIncludePluginTrackersAutomatically()
{
Piwik::checkUserHasSomeAdminAccess();
try {
$updater = new TrackerUpdater();
$updater->checkWillSucceed();
return true;
} catch (AccessDeniedException $e) {
return false;
} catch (\Exception $e) {
return false;
}
}
示例3: showList
public function showList()
{
Piwik::checkUserHasSomeAdminAccess();
$view = new View('@DevicesDetection/list');
$type = Common::getRequestVar('type', 'brands', 'string');
$list = array();
switch ($type) {
case 'brands':
$availableBrands = \DeviceDetector\Parser\Device\DeviceParserAbstract::$deviceBrands;
foreach ($availableBrands as $short => $name) {
if ($name != 'Unknown') {
$list[$name] = getBrandLogo($name);
}
}
break;
case 'browsers':
$availableBrowsers = \DeviceDetector\Parser\Client\Browser::getAvailableBrowsers();
foreach ($availableBrowsers as $short => $name) {
$list[$name] = getBrowserLogo($short);
}
break;
case 'browserfamilies':
$availableBrowserFamilies = \DeviceDetector\Parser\Client\Browser::getAvailableBrowserFamilies();
foreach ($availableBrowserFamilies as $name => $browsers) {
$list[$name] = getBrowserFamilyLogo($name);
}
break;
case 'os':
$availableOSs = \DeviceDetector\Parser\OperatingSystem::getAvailableOperatingSystems();
foreach ($availableOSs as $short => $name) {
$list[$name] = getOsLogo($short);
}
break;
case 'osfamilies':
$osFamilies = \DeviceDetector\Parser\OperatingSystem::getAvailableOperatingSystemFamilies();
foreach ($osFamilies as $name => $oss) {
$list[$name] = getOsFamilyLogo($name);
}
break;
case 'devicetypes':
$deviceTypes = \DeviceDetector\Parser\Device\DeviceParserAbstract::getAvailableDeviceTypes();
foreach ($deviceTypes as $name => $id) {
$list[$name] = getDeviceTypeLogo($name);
}
break;
}
$view->itemList = $list;
return $view->render();
}
示例4: index
/**
* Main Plugin Index
*
* @return mixed
* @throws \Exception
*/
public function index()
{
Piwik::checkUserHasSomeAdminAccess();
if (isset($_SERVER['REQUEST_METHOD']) && 'POST' == $_SERVER['REQUEST_METHOD']) {
// Cannot use Common::getRequestVar, because the function remove whitespaces and newline breaks
$postedSiteData = isset($_POST['site']) ? $_POST['site'] : null;
if (is_array($postedSiteData) && count($postedSiteData) > 0) {
foreach ($postedSiteData as $id => $site) {
if (!isset($site['css'], $site['file'])) {
continue;
}
// Check URL
if (!UrlHelper::isLookLikeUrl($site['file'])) {
$site['file'] = null;
}
API::getInstance()->saveSite($id, $site['css'], $site['file']);
}
// Redirect to, clear POST vars
$this->redirectToIndex('CustomOptOut', 'index');
return;
}
}
$view = new View('@CustomOptOut/index.twig');
Site::clearCache();
if (Piwik::hasUserSuperUserAccess()) {
$sitesRaw = APISiteManager::getInstance()->getAllSites();
} else {
$sitesRaw = APISiteManager::getInstance()->getSitesWithAdminAccess();
}
// Gets sites after Site.setSite hook was called
$sites = array_values(Site::getSites());
if (count($sites) != count($sitesRaw)) {
throw new \Exception("One or more website are missing or invalid.");
}
foreach ($sites as &$site) {
$site['alias_urls'] = APISiteManager::getInstance()->getSiteUrlsFromId($site['idsite']);
}
$view->adminSites = $sites;
$view->adminSitesCount = count($sites);
$view->language = LanguagesManager::getLanguageCodeForCurrentUser();
$view->isEditorEnabled = API::getInstance()->isCssEditorEnabled();
$view->editorTheme = API::getInstance()->getEditorTheme();
$view->showOldLinks = false;
$this->setBasicVariablesView($view);
return $view->render();
}
示例5: index
/**
* @internal For Debugging only
* Call metadata reports and draw the default graph for each report.
*/
public function index()
{
Piwik::checkUserHasSomeAdminAccess();
$idSite = Common::getRequestVar('idSite', 1, 'int');
$period = Common::getRequestVar('period', 'day', 'string');
$date = Common::getRequestVar('date', 'today', 'string');
$_GET['token_auth'] = Piwik::getCurrentUserTokenAuth();
$reports = APIPlugins::getInstance()->getReportMetadata($idSite, $period, $date);
$plot = array();
foreach ($reports as $report) {
if (!empty($report['imageGraphUrl'])) {
$plot[] = array($report['category'] . ' › ' . $report['name'], SettingsPiwik::getPiwikUrl() . $report['imageGraphUrl']);
}
}
$view = new View('@ImageGraph/index');
$view->titleAndUrls = $plot;
return $view->render();
}
示例6: getMeasurableTypeSettings
public function getMeasurableTypeSettings()
{
$idSite = Common::getRequestVar('idSite', 0, 'int');
$idType = Common::getRequestVar('idType', '', 'string');
if ($idSite >= 1) {
Piwik::checkUserHasAdminAccess($idSite);
} else {
if ($idSite === 0) {
Piwik::checkUserHasSomeAdminAccess();
} else {
throw new Exception('Invalid idSite parameter. IdSite has to be zero or higher');
}
}
$view = new View('@SitesManager/measurable_type_settings');
$propSettings = new MeasurableSettings($idSite, $idType);
$view->settings = $propSettings->getSettingsForCurrentUser();
return $view->render();
}
示例7: generalSettings
public function generalSettings()
{
Piwik::checkUserHasSomeAdminAccess();
$view = new View('@CoreAdminHome/generalSettings');
if (Piwik::hasUserSuperUserAccess()) {
$this->handleGeneralSettingsAdmin($view);
$view->trustedHosts = Url::getTrustedHostsFromConfig();
$logo = new CustomLogo();
$view->branding = array('use_custom_logo' => $logo->isEnabled());
$view->logosWriteable = $logo->isCustomLogoWritable();
$view->pathUserLogo = CustomLogo::getPathUserLogo();
$view->pathUserFavicon = CustomLogo::getPathUserFavicon();
$view->pathUserLogoSmall = CustomLogo::getPathUserLogoSmall();
$view->pathUserLogoSVG = CustomLogo::getPathUserSvgLogo();
$view->pathUserLogoDirectory = realpath(dirname($view->pathUserLogo) . '/');
}
$view->language = LanguagesManager::getLanguageCodeForCurrentUser();
$this->setBasicVariablesView($view);
return $view->render();
}
示例8: privacySettings
public function privacySettings()
{
Piwik::checkUserHasSomeAdminAccess();
$view = new View('@PrivacyManager/privacySettings');
if (Piwik::hasUserSuperUserAccess()) {
$view->deleteData = $this->getDeleteDataInfo();
$view->anonymizeIP = $this->getAnonymizeIPInfo();
$dntChecker = new DoNotTrackHeaderChecker();
$view->dntSupport = $dntChecker->isActive();
$view->canDeleteLogActions = Db::isLockPrivilegeGranted();
$view->dbUser = PiwikConfig::getInstance()->database['username'];
$view->deactivateNonce = Nonce::getNonce(self::DEACTIVATE_DNT_NONCE);
$view->activateNonce = Nonce::getNonce(self::ACTIVATE_DNT_NONCE);
$view->maskLengthOptions = array(array('key' => '1', 'value' => Piwik::translate('PrivacyManager_AnonymizeIpMaskLength', array("1", "192.168.100.xxx")), 'description' => ''), array('key' => '2', 'value' => Piwik::translate('PrivacyManager_AnonymizeIpMaskLength', array("2", "192.168.xxx.xxx")), 'description' => Piwik::translate('General_Recommended')), array('key' => '3', 'value' => Piwik::translate('PrivacyManager_AnonymizeIpMaskLength', array("3", "192.xxx.xxx.xxx")), 'description' => ''));
$view->useAnonymizedIpForVisitEnrichmentOptions = array(array('key' => '1', 'value' => Piwik::translate('General_Yes'), 'description' => Piwik::translate('PrivacyManager_RecommendedForPrivacy')), array('key' => '0', 'value' => Piwik::translate('General_No'), 'description' => ''));
$view->scheduleDeletionOptions = array(array('key' => '1', 'value' => Piwik::translate('Intl_PeriodDay')), array('key' => '7', 'value' => Piwik::translate('Intl_PeriodWeek')), array('key' => '30', 'value' => Piwik::translate('Intl_PeriodMonth')));
$view->doNotTrackOptions = array(array('key' => '1', 'value' => Piwik::translate('PrivacyManager_DoNotTrack_Enable'), 'description' => Piwik::translate('General_Recommended')), array('key' => '0', 'value' => Piwik::translate('PrivacyManager_DoNotTrack_Disable'), 'description' => Piwik::translate('General_NotRecommended')));
}
$view->language = LanguagesManager::getLanguageCodeForCurrentUser();
$this->setBasicVariablesView($view);
return $view->render();
}
示例9: generalSettings
public function generalSettings()
{
Piwik::checkUserHasSomeAdminAccess();
$view = new View('@CoreAdminHome/generalSettings');
if (Piwik::isUserIsSuperUser()) {
$this->handleGeneralSettingsAdmin($view);
$trustedHosts = array();
if (isset(Config::getInstance()->General['trusted_hosts'])) {
$trustedHosts = Config::getInstance()->General['trusted_hosts'];
}
$view->trustedHosts = $trustedHosts;
$view->branding = Config::getInstance()->branding;
$logo = new CustomLogo();
$view->logosWriteable = $logo->isCustomLogoWritable();
$view->pathUserLogo = CustomLogo::getPathUserLogo();
$view->pathUserLogoSmall = CustomLogo::getPathUserLogoSmall();
$view->pathUserLogoSVG = CustomLogo::getPathUserSvgLogo();
$view->pathUserLogoDirectory = dirname($view->pathUserLogo) . '/';
}
$view->language = LanguagesManager::getLanguageCodeForCurrentUser();
$this->setBasicVariablesView($view);
return $view->render();
}
示例10: getUserLoginFromUserEmail
/**
* Returns the first login name of an existing user that has the given email address. If no user can be found for
* this user an error will be returned.
*
* @param string $userEmail
* @return bool true if the user is known
*/
public function getUserLoginFromUserEmail($userEmail)
{
Piwik::checkUserIsNotAnonymous();
Piwik::checkUserHasSomeAdminAccess();
$this->checkUserEmailExists($userEmail);
$user = $this->model->getUserByEmail($userEmail);
// any user with some admin access is allowed to find any user by email, no need to filter by access here
return $user['login'];
}
示例11: getDefaultCurrency
/**
* Returns the default currency that will be set when creating a website through the API.
*
* @return string Currency ID eg. 'USD'
*/
public function getDefaultCurrency()
{
Piwik::checkUserHasSomeAdminAccess();
$defaultCurrency = Option::get(self::OPTION_DEFAULT_CURRENCY);
if ($defaultCurrency) {
return $defaultCurrency;
}
return 'USD';
}
示例12: privacySettings
public function privacySettings()
{
Piwik::checkUserHasSomeAdminAccess();
$view = new View('@PrivacyManager/privacySettings');
if (Piwik::hasUserSuperUserAccess()) {
$view->deleteData = $this->getDeleteDataInfo();
$view->anonymizeIP = $this->getAnonymizeIPInfo();
$view->dntSupport = DoNotTrackHeaderChecker::isActive();
$view->canDeleteLogActions = Db::isLockPrivilegeGranted();
$view->dbUser = PiwikConfig::getInstance()->database['username'];
$view->deactivateNonce = Nonce::getNonce(self::DEACTIVATE_DNT_NONCE);
$view->activateNonce = Nonce::getNonce(self::ACTIVATE_DNT_NONCE);
}
$view->language = LanguagesManager::getLanguageCodeForCurrentUser();
$this->setBasicVariablesView($view);
return $view->render();
}
示例13: index
/**
* Main view showing listing of websites and settings
*/
public function index()
{
Piwik::checkUserHasSomeAdminAccess();
return $this->renderTemplate('index');
}
示例14: checkForUpdates
/**
* Forces a check for updates and re-renders the header message.
*
* This will check piwik.org at most once per 10s.
*/
public function checkForUpdates()
{
Piwik::checkUserHasSomeAdminAccess();
$this->checkTokenInUrl();
// perform check (but only once every 10s)
UpdateCheck::check($force = false, UpdateCheck::UI_CLICK_CHECK_INTERVAL);
MarketplaceApiClient::clearAllCacheEntries();
$view = new View('@CoreHome/checkForUpdates');
$this->setGeneralVariablesView($view);
return $view->render();
}
示例15: getUsersLogin
/**
* Returns the list of all the users login
*
* @return array the list of all the users login
*/
public function getUsersLogin()
{
Piwik::checkUserHasSomeAdminAccess();
$db = Db::get();
$users = $db->fetchAll("SELECT login\n\t\t\t\t\t\t\t\tFROM " . Common::prefixTable("user") . "\n\t\t\t\t\t\t\t\tORDER BY login ASC");
$return = array();
foreach ($users as $login) {
$return[] = $login['login'];
}
return $return;
}