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


PHP Piwik::getAllSuperUserAccessEmailAddresses方法代码示例

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


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

示例1: redirectToIndex

 /**
  * Helper method used to redirect the current HTTP request to another module/action.
  * 
  * This function will exit immediately after executing.
  *
  * @param string $moduleToRedirect The plugin to redirect to, eg. `"MultiSites"`.
  * @param string $actionToRedirect Action, eg. `"index"`.
  * @param int|null $websiteId The new idSite query parameter, eg, `1`.
  * @param string|null $defaultPeriod The new period query parameter, eg, `'day'`.
  * @param string|null $defaultDate The new date query parameter, eg, `'today'`.
  * @param array $parameters Other query parameters to append to the URL.
  * @api
  */
 public function redirectToIndex($moduleToRedirect, $actionToRedirect, $websiteId = null, $defaultPeriod = null, $defaultDate = null, $parameters = array())
 {
     $userPreferences = new UserPreferences();
     if (empty($websiteId)) {
         $websiteId = $userPreferences->getDefaultWebsiteId();
     }
     if (empty($defaultDate)) {
         $defaultDate = $userPreferences->getDefaultDate();
     }
     if (empty($defaultPeriod)) {
         $defaultPeriod = $userPreferences->getDefaultPeriod();
     }
     $parametersString = '';
     if (!empty($parameters)) {
         $parametersString = '&' . Url::getQueryStringFromParameters($parameters);
     }
     if ($websiteId) {
         $url = "index.php?module=" . $moduleToRedirect . "&action=" . $actionToRedirect . "&idSite=" . $websiteId . "&period=" . $defaultPeriod . "&date=" . $defaultDate . $parametersString;
         Url::redirectToUrl($url);
         exit;
     }
     if (Piwik::hasUserSuperUserAccess()) {
         Piwik_ExitWithMessage("Error: no website was found in this Piwik installation.\n\t\t\t<br />Check the table '" . Common::prefixTable('site') . "' in your database, it should contain your Piwik websites.", false, true);
     }
     $currentLogin = Piwik::getCurrentUserLogin();
     if (!empty($currentLogin) && $currentLogin != 'anonymous') {
         $emails = implode(',', Piwik::getAllSuperUserAccessEmailAddresses());
         $errorMessage = sprintf(Piwik::translate('CoreHome_NoPrivilegesAskPiwikAdmin'), $currentLogin, "<br/><a href='mailto:" . $emails . "?subject=Access to Piwik for user {$currentLogin}'>", "</a>");
         $errorMessage .= "<br /><br />&nbsp;&nbsp;&nbsp;<b><a href='index.php?module=" . Registry::get('auth')->getName() . "&amp;action=logout'>&rsaquo; " . Piwik::translate('General_Logout') . "</a></b><br />";
         Piwik_ExitWithMessage($errorMessage, false, true);
     }
     echo FrontController::getInstance()->dispatch(Piwik::getLoginPluginName(), false);
     exit;
 }
开发者ID:brienomatty,项目名称:elmsln,代码行数:47,代码来源:Controller.php

示例2: safemode

 public function safemode($lastError = array())
 {
     $this->tryToRepairPiwik();
     if (empty($lastError)) {
         $lastError = array('message' => Common::getRequestVar('error_message', null, 'string'), 'file' => Common::getRequestVar('error_file', null, 'string'), 'line' => Common::getRequestVar('error_line', null, 'integer'));
     }
     $outputFormat = Common::getRequestVar('format', 'html', 'string');
     $outputFormat = strtolower($outputFormat);
     if (!empty($outputFormat) && 'html' !== $outputFormat) {
         $errorMessage = $lastError['message'];
         if (Piwik::isUserIsAnonymous()) {
             $errorMessage = 'A fatal error occurred.';
         }
         $response = new \Piwik\API\ResponseBuilder($outputFormat);
         $message = $response->getResponseException(new Exception($errorMessage));
         return $message;
     }
     if (Common::isPhpCliMode()) {
         // TODO: I can't find how this will ever get called / safeMode is never set for Console
         throw new Exception("Error: " . var_export($lastError, true));
     }
     $view = new View('@CorePluginsAdmin/safemode');
     $view->lastError = $lastError;
     $view->isSuperUser = Piwik::hasUserSuperUserAccess();
     $view->isAnonymousUser = Piwik::isUserIsAnonymous();
     $view->plugins = Plugin\Manager::getInstance()->loadAllPluginsAndGetTheirInfo();
     $view->deactivateNonce = Nonce::getNonce(static::DEACTIVATE_NONCE);
     $view->uninstallNonce = Nonce::getNonce(static::UNINSTALL_NONCE);
     $view->emailSuperUser = implode(',', Piwik::getAllSuperUserAccessEmailAddresses());
     $view->piwikVersion = Version::VERSION;
     $view->showVersion = !Common::getRequestVar('tests_hide_piwik_version', 0);
     $view->pluginCausesIssue = '';
     if (!empty($lastError['file'])) {
         preg_match('/piwik\\/plugins\\/(.*)\\//', $lastError['file'], $matches);
         if (!empty($matches[1])) {
             $view->pluginCausesIssue = $matches[1];
         }
     }
     return $view->render();
 }
开发者ID:dorelljames,项目名称:piwik,代码行数:40,代码来源:Controller.php

示例3: redirectToIndex

 /**
  * Helper method used to redirect the current HTTP request to another module/action.
  *
  * This function will exit immediately after executing.
  *
  * @param string $moduleToRedirect The plugin to redirect to, eg. `"MultiSites"`.
  * @param string $actionToRedirect Action, eg. `"index"`.
  * @param int|null $websiteId The new idSite query parameter, eg, `1`.
  * @param string|null $defaultPeriod The new period query parameter, eg, `'day'`.
  * @param string|null $defaultDate The new date query parameter, eg, `'today'`.
  * @param array $parameters Other query parameters to append to the URL.
  * @api
  */
 public function redirectToIndex($moduleToRedirect, $actionToRedirect, $websiteId = null, $defaultPeriod = null, $defaultDate = null, $parameters = array())
 {
     try {
         $this->doRedirectToUrl($moduleToRedirect, $actionToRedirect, $websiteId, $defaultPeriod, $defaultDate, $parameters);
     } catch (Exception $e) {
         // no website ID to default to, so could not redirect
     }
     if (Piwik::hasUserSuperUserAccess()) {
         Piwik_ExitWithMessage("Error: no website was found in this Piwik installation.\n\t\t\t<br />Check the table '" . Common::prefixTable('site') . "' in your database, it should contain your Piwik websites.", false, true);
     }
     if (!Piwik::isUserIsAnonymous()) {
         $emails = implode(',', Piwik::getAllSuperUserAccessEmailAddresses());
         $errorMessage = sprintf(Piwik::translate('CoreHome_NoPrivilegesAskPiwikAdmin'), $currentLogin, "<br/><a href='mailto:" . $emails . "?subject=Access to Piwik for user {$currentLogin}'>", "</a>");
         $errorMessage .= "<br /><br />&nbsp;&nbsp;&nbsp;<b><a href='index.php?module=" . Registry::get('auth')->getName() . "&amp;action=logout'>&rsaquo; " . Piwik::translate('General_Logout') . "</a></b><br />";
         Piwik_ExitWithMessage($errorMessage, false, true);
     }
     echo FrontController::getInstance()->dispatch(Piwik::getLoginPluginName(), false);
     exit;
 }
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:32,代码来源:Controller.php


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