当前位置: 首页>>代码示例>>PHP>>正文


PHP Piwik::isUserIsSuperUser方法代码示例

本文整理汇总了PHP中Piwik\Piwik::isUserIsSuperUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Piwik::isUserIsSuperUser方法的具体用法?PHP Piwik::isUserIsSuperUser怎么用?PHP Piwik::isUserIsSuperUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Piwik\Piwik的用法示例。


在下文中一共展示了Piwik::isUserIsSuperUser方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: index

 public function index()
 {
     Piwik::checkUserIsNotAnonymous();
     $view = new View('@MobileMessaging/index');
     $view->isSuperUser = Piwik::isUserIsSuperUser();
     $mobileMessagingAPI = API::getInstance();
     $view->delegatedManagement = $mobileMessagingAPI->getDelegatedManagement();
     $view->credentialSupplied = $mobileMessagingAPI->areSMSAPICredentialProvided();
     $view->accountManagedByCurrentUser = $view->isSuperUser || $view->delegatedManagement;
     $view->strHelpAddPhone = Piwik::translate('MobileMessaging_Settings_PhoneNumbers_HelpAdd', array(Piwik::translate('General_Settings'), Piwik::translate('MobileMessaging_SettingsMenu')));
     if ($view->credentialSupplied && $view->accountManagedByCurrentUser) {
         $view->provider = $mobileMessagingAPI->getSMSProvider();
         $view->creditLeft = $mobileMessagingAPI->getCreditLeft();
     }
     $view->smsProviders = SMSProvider::$availableSMSProviders;
     // construct the list of countries from the lang files
     $countries = array();
     foreach (Common::getCountriesList() as $countryCode => $continentCode) {
         if (isset(CountryCallingCodes::$countryCallingCodes[$countryCode])) {
             $countries[$countryCode] = array('countryName' => \Piwik\Plugins\UserCountry\countryTranslate($countryCode), 'countryCallingCode' => CountryCallingCodes::$countryCallingCodes[$countryCode]);
         }
     }
     $view->countries = $countries;
     $view->defaultCountry = Common::getCountry(LanguagesManager::getLanguageCodeForCurrentUser(), true, IP::getIpFromHeader());
     $view->phoneNumbers = $mobileMessagingAPI->getPhoneNumbers();
     $this->setBasicVariablesView($view);
     return $view->render();
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:28,代码来源:Controller.php

示例2: getDefaultLayout

 public function getDefaultLayout()
 {
     $defaultLayout = $this->getLayoutForUser('', 1);
     if (empty($defaultLayout)) {
         if (Piwik::isUserIsSuperUser()) {
             $topWidget = '{"uniqueId":"widgetCoreHomegetDonateForm",' . '"parameters":{"module":"CoreHome","action":"getDonateForm"}},';
         } else {
             $topWidget = '{"uniqueId":"widgetCoreHomegetPromoVideo",' . '"parameters":{"module":"CoreHome","action":"getPromoVideo"}},';
         }
         $defaultLayout = '[
             [
                 {"uniqueId":"widgetVisitsSummarygetEvolutionGraphcolumnsArray","parameters":{"module":"VisitsSummary","action":"getEvolutionGraph","columns":"nb_visits"}},
                 {"uniqueId":"widgetLivewidget","parameters":{"module":"Live","action":"widget"}},
                 {"uniqueId":"widgetVisitorInterestgetNumberOfVisitsPerVisitDuration","parameters":{"module":"VisitorInterest","action":"getNumberOfVisitsPerVisitDuration"}}
             ],
             [
                 ' . $topWidget . '
                 {"uniqueId":"widgetReferrersgetKeywords","parameters":{"module":"Referrers","action":"getKeywords"}},
                 {"uniqueId":"widgetReferrersgetWebsites","parameters":{"module":"Referrers","action":"getWebsites"}}
             ],
             [
                 {"uniqueId":"widgetUserCountryMapvisitorMap","parameters":{"module":"UserCountryMap","action":"visitorMap"}},
                 {"uniqueId":"widgetUserSettingsgetBrowser","parameters":{"module":"UserSettings","action":"getBrowser"}},
                 {"uniqueId":"widgetReferrersgetSearchEngines","parameters":{"module":"Referrers","action":"getSearchEngines"}},
                 {"uniqueId":"widgetVisitTimegetVisitInformationPerServerTime","parameters":{"module":"VisitTime","action":"getVisitInformationPerServerTime"}},
                 {"uniqueId":"widgetExampleRssWidgetrssPiwik","parameters":{"module":"ExampleRssWidget","action":"rssPiwik"}}
             ]
         ]';
     }
     $defaultLayout = $this->removeDisabledPluginFromLayout($defaultLayout);
     return $defaultLayout;
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:32,代码来源:Dashboard.php

示例3: checkAutoArchive

 protected function checkAutoArchive($autoArchive, $idSite)
 {
     $autoArchive = (int) $autoArchive;
     if ($autoArchive) {
         $exception = new Exception("To prevent abuse, autoArchive=1 requires Super User or ControllerAdmin access.");
         if (empty($idSite)) {
             if (!Piwik::isUserIsSuperUser()) {
                 throw $exception;
             }
         } else {
             if (!Piwik::isUserHasAdminAccess($idSite)) {
                 throw $exception;
             }
         }
     }
     return $autoArchive;
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:17,代码来源:API.php

示例4: getCacheWebsiteAttributes

 /**
  * Returns array containing data about the website: goals, URLs, etc.
  *
  * @param int $idSite
  * @return array
  */
 static function getCacheWebsiteAttributes($idSite)
 {
     if ($idSite == 'all') {
         return array();
     }
     $idSite = (int) $idSite;
     if ($idSite <= 0) {
         return array();
     }
     $cache = self::getInstance();
     if (($cacheContent = $cache->get($idSite)) !== false) {
         return $cacheContent;
     }
     Tracker::initCorePiwikInTrackerMode();
     // save current user privilege and temporarily assume super user privilege
     $isSuperUser = Piwik::isUserIsSuperUser();
     Piwik::setUserIsSuperUser();
     $content = array();
     /**
      * Triggered to get the attributes of a site entity that might be used by the
      * Tracker.
      * 
      * Plugins add new site attributes for use in other tracking events must
      * use this event to put those attributes in the Tracker Cache.
      * 
      * **Example**
      * 
      *     public function getSiteAttributes($content, $idSite)
      *     {
      *         $sql = "SELECT info FROM " . Common::prefixTable('myplugin_extra_site_info') . " WHERE idsite = ?";
      *         $content['myplugin_site_data'] = Db::fetchOne($sql, array($idSite));
      *     }
      * 
      * @param array &$content Array mapping of site attribute names with values.
      * @param int $idSite The site ID to get attributes for.
      */
     Piwik::postEvent('Tracker.Cache.getSiteAttributes', array(&$content, $idSite));
     // restore original user privilege
     Piwik::setUserIsSuperUser($isSuperUser);
     // if nothing is returned from the plugins, we don't save the content
     // this is not expected: all websites are expected to have at least one URL
     if (!empty($content)) {
         $cache->set($idSite, $content);
     }
     return $content;
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:52,代码来源:Cache.php

示例5: addMenu

 function addMenu()
 {
     $pluginsUpdateMessage = '';
     $themesUpdateMessage = '';
     if (Piwik::isUserIsSuperUser() && static::isMarketplaceEnabled()) {
         $marketplace = new Marketplace();
         $pluginsHavingUpdate = $marketplace->getPluginsHavingUpdate($themesOnly = false);
         $themesHavingUpdate = $marketplace->getPluginsHavingUpdate($themesOnly = true);
         if (!empty($pluginsHavingUpdate)) {
             $pluginsUpdateMessage = sprintf(' (%d)', count($pluginsHavingUpdate));
         }
         if (!empty($themesHavingUpdate)) {
             $themesUpdateMessage = sprintf(' (%d)', count($themesHavingUpdate));
         }
     }
     MenuAdmin::getInstance()->add('CorePluginsAdmin_MenuPlatform', null, "", !Piwik::isUserIsAnonymous(), $order = 7);
     MenuAdmin::getInstance()->add('CorePluginsAdmin_MenuPlatform', Piwik::translate('General_Plugins') . $pluginsUpdateMessage, array('module' => 'CorePluginsAdmin', 'action' => 'plugins', 'activated' => ''), Piwik::isUserIsSuperUser(), $order = 1);
     MenuAdmin::getInstance()->add('CorePluginsAdmin_MenuPlatform', Piwik::translate('CorePluginsAdmin_Themes') . $themesUpdateMessage, array('module' => 'CorePluginsAdmin', 'action' => 'themes', 'activated' => ''), Piwik::isUserIsSuperUser(), $order = 3);
     if (static::isMarketplaceEnabled()) {
         MenuAdmin::getInstance()->add('CorePluginsAdmin_MenuPlatform', 'CorePluginsAdmin_Marketplace', array('module' => 'CorePluginsAdmin', 'action' => 'extend', 'activated' => ''), !Piwik::isUserIsAnonymous(), $order = 5);
     }
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:22,代码来源:CorePluginsAdmin.php

示例6: 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();
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:23,代码来源:Controller.php

示例7: getAllActive

 public function getAllActive($idSite, $period, $idReport, $ifSuperUserReturnOnlySuperUserReports)
 {
     $where = array();
     $params = array();
     if (!Piwik::isUserIsSuperUser() || $ifSuperUserReturnOnlySuperUserReports) {
         $where[] = ' login = ? ';
         $params[] = Piwik::getCurrentUserLogin();
     }
     if (!empty($period)) {
         $where[] = ' period = ? ';
         $params[] = $period;
     }
     if (!empty($idSite)) {
         // Joining with the site table to work around pre-1.3 where reports could still be linked to a deleted site
         $where[] = Common::prefixTable('site') . '.idsite = ? ';
         $params[] = $idSite;
     }
     if (!empty($idReport)) {
         $where[] = ' idreport = ? ';
         $params[] = $idReport;
     }
     $sql = 'SELECT * FROM ' . $this->table . ' ' . 'INNER JOIN ' . Common::prefixTable('site') . ' ' . '    USING (idsite) ' . 'WHERE deleted = 0 AND ' . implode(' AND ', $where);
     return $this->db->fetchAll($sql, $params);
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:24,代码来源:Pdf.php

示例8: saveTrustedHostnameInConfig

 /**
  * Records one host, or an array of hosts in the config file,
  * if user is super user
  *
  * @static
  * @param $host string|array
  * @return bool
  */
 public static function saveTrustedHostnameInConfig($host)
 {
     if (Piwik::isUserIsSuperUser() && file_exists(Config::getLocalConfigPath())) {
         $general = Config::getInstance()->General;
         if (!is_array($host)) {
             $host = array($host);
         }
         $host = array_filter($host);
         if (empty($host)) {
             return false;
         }
         $general['trusted_hosts'] = $host;
         Config::getInstance()->General = $general;
         Config::getInstance()->forceSave();
         return true;
     }
     return false;
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:26,代码来源:Url.php

示例9: isRequestAuthorizedToArchive

 protected static function isRequestAuthorizedToArchive()
 {
     return !self::$archivingDisabledByTests && (Rules::isBrowserTriggerEnabled() || Common::isPhpCliMode() || Piwik::isUserIsSuperUser() && SettingsServer::isArchivePhpTriggered());
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:4,代码来源:Rules.php

示例10: addMenu

 /**
  * Adds the 'System Check' admin page if the user is the super user.
  */
 public function addMenu()
 {
     MenuAdmin::addEntry('Installation_SystemCheck', array('module' => 'Installation', 'action' => 'systemCheckPage'), Piwik::isUserIsSuperUser(), $order = 15);
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:7,代码来源:Installation.php

示例11: saveLayoutAsDefault

 /**
  * Saves the layout as default
  */
 public function saveLayoutAsDefault()
 {
     $this->checkTokenInUrl();
     if (Piwik::isUserIsSuperUser()) {
         $layout = Common::unsanitizeInputValue(Common::getRequestVar('layout'));
         $paramsBind = array('', '1', $layout, $layout);
         $query = sprintf('INSERT INTO %s (login, iddashboard, layout) VALUES (?,?,?) ON DUPLICATE KEY UPDATE layout=?', Common::prefixTable('user_dashboard'));
         Db::query($query, $paramsBind);
     }
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:13,代码来源:Controller.php

示例12: getDonateForm

 /**
  * Renders and echo's the in-app donate form w/ slider.
  */
 public function getDonateForm()
 {
     $view = new View('@CoreHome/getDonateForm');
     if (Common::getRequestVar('widget', false) && Piwik::isUserIsSuperUser()) {
         $view->footerMessage = Piwik::translate('CoreHome_OnlyForAdmin');
     }
     return $view->render();
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:11,代码来源:Controller.php

示例13: __construct

 /**
  * Constructor.
  * 
  * @param string $name The persisted name of the setting.
  * @param string $title The display name of the setting.
  */
 public function __construct($name, $title)
 {
     parent::__construct($name, $title);
     $this->displayedForCurrentUser = Piwik::isUserIsSuperUser();
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:11,代码来源:SystemSetting.php

示例14: buildDataTable

 private function buildDataTable($idSitesOrIdSite, $period, $date, $segment, $_restrictSitesToLogin, $enhanced, $multipleWebsitesRequested)
 {
     $allWebsitesRequested = $idSitesOrIdSite == 'all';
     if ($allWebsitesRequested) {
         // First clear cache
         Site::clearCache();
         // Then, warm the cache with only the data we should have access to
         if (Piwik::isUserIsSuperUser() && !TaskScheduler::isTaskBeingExecuted()) {
             $sites = APISitesManager::getInstance()->getAllSites();
         } else {
             $sites = APISitesManager::getInstance()->getSitesWithAtLeastViewAccess($limit = false, $_restrictSitesToLogin);
         }
         // Both calls above have called Site::setSitesFromArray. We now get these sites:
         $sitesToProblablyAdd = Site::getSites();
     } else {
         $sitesToProblablyAdd = array(APISitesManager::getInstance()->getSiteFromId($idSitesOrIdSite));
     }
     // build the archive type used to query archive data
     $archive = Archive::build($idSitesOrIdSite, $period, $date, $segment, $_restrictSitesToLogin);
     // determine what data will be displayed
     $fieldsToGet = array();
     $columnNameRewrites = array();
     $apiECommerceMetrics = array();
     $apiMetrics = API::getApiMetrics($enhanced);
     foreach ($apiMetrics as $metricName => $metricSettings) {
         $fieldsToGet[] = $metricSettings[self::METRIC_RECORD_NAME_KEY];
         $columnNameRewrites[$metricSettings[self::METRIC_RECORD_NAME_KEY]] = $metricName;
         if ($metricSettings[self::METRIC_IS_ECOMMERCE_KEY]) {
             $apiECommerceMetrics[$metricName] = $metricSettings;
         }
     }
     // get the data
     // $dataTable instanceOf Set
     $dataTable = $archive->getDataTableFromNumeric($fieldsToGet);
     $dataTable = $this->mergeDataTableMapAndPopulateLabel($idSitesOrIdSite, $multipleWebsitesRequested, $dataTable);
     if ($dataTable instanceof DataTable\Map) {
         foreach ($dataTable->getDataTables() as $table) {
             $this->addMissingWebsites($table, $fieldsToGet, $sitesToProblablyAdd);
         }
     } else {
         $this->addMissingWebsites($dataTable, $fieldsToGet, $sitesToProblablyAdd);
     }
     // calculate total visits/actions/revenue
     $this->setMetricsTotalsMetadata($dataTable, $apiMetrics);
     // if the period isn't a range & a lastN/previousN date isn't used, we get the same
     // data for the last period to show the evolution of visits/actions/revenue
     list($strLastDate, $lastPeriod) = Range::getLastDate($date, $period);
     if ($strLastDate !== false) {
         if ($lastPeriod !== false) {
             // NOTE: no easy way to set last period date metadata when range of dates is requested.
             //       will be easier if DataTable\Map::metadata is removed, and metadata that is
             //       put there is put directly in DataTable::metadata.
             $dataTable->setMetadata(self::getLastPeriodMetadataName('date'), $lastPeriod);
         }
         $pastArchive = Archive::build($idSitesOrIdSite, $period, $strLastDate, $segment, $_restrictSitesToLogin);
         $pastData = $pastArchive->getDataTableFromNumeric($fieldsToGet);
         $pastData = $this->mergeDataTableMapAndPopulateLabel($idSitesOrIdSite, $multipleWebsitesRequested, $pastData);
         // use past data to calculate evolution percentages
         $this->calculateEvolutionPercentages($dataTable, $pastData, $apiMetrics);
         $this->setPastDataMetadata($dataTable, $pastData, $apiMetrics);
     }
     // remove eCommerce related metrics on non eCommerce Piwik sites
     // note: this is not optimal in terms of performance: those metrics should not be retrieved in the first place
     if ($enhanced) {
         if ($dataTable instanceof DataTable\Map) {
             foreach ($dataTable->getDataTables() as $table) {
                 $this->removeEcommerceRelatedMetricsOnNonEcommercePiwikSites($table, $apiECommerceMetrics);
             }
         } else {
             $this->removeEcommerceRelatedMetricsOnNonEcommercePiwikSites($dataTable, $apiECommerceMetrics);
         }
     }
     // move the site id to a metadata column
     $dataTable->filter('ColumnCallbackAddMetadata', array('label', 'idsite'));
     // set the label of each row to the site name
     if ($multipleWebsitesRequested) {
         $dataTable->filter('ColumnCallbackReplace', array('label', '\\Piwik\\Site::getNameFor'));
     } else {
         $dataTable->filter('ColumnDelete', array('label'));
     }
     // replace record names with user friendly metric names
     $dataTable->filter('ReplaceColumnNames', array($columnNameRewrites));
     // Ensures data set sorted, for Metadata output
     $dataTable->filter('Sort', array(self::NB_VISITS_METRIC, 'desc', $naturalSort = false));
     // filter rows without visits
     // note: if only one website is queried and there are no visits, we can not remove the row otherwise
     // ResponseBuilder throws 'Call to a member function getColumns() on a non-object'
     if ($multipleWebsitesRequested && !$enhanced) {
         $dataTable->filter('ColumnCallbackDeleteRow', array(self::NB_VISITS_METRIC, function ($value) {
             return $value == 0;
         }));
     }
     return $dataTable;
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:94,代码来源:API.php

示例15: addAdminMenu

 /**
  * Event handler. Adds menu items to the MenuAdmin menu.
  */
 public function addAdminMenu()
 {
     if ($this->isGeoLocationAdminEnabled()) {
         MenuAdmin::getInstance()->add('General_Settings', 'UserCountry_Geolocation', array('module' => 'UserCountry', 'action' => 'adminIndex'), Piwik::isUserIsSuperUser(), $order = 8);
     }
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:9,代码来源:UserCountry.php


注:本文中的Piwik\Piwik::isUserIsSuperUser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。