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


PHP Piwik::getSuperUserEmail方法代码示例

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


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

示例1: safemode

 public function safemode($lastError = array())
 {
     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;
     }
     $view = new View('@CorePluginsAdmin/safemode');
     $view->lastError = $lastError;
     $view->isSuperUser = Piwik::isUserIsSuperUser();
     $view->isAnonymousUser = Piwik::isUserIsAnonymous();
     $view->plugins = Plugin\Manager::getInstance()->returnLoadedPluginsInfo();
     $view->deactivateNonce = Nonce::getNonce(static::DEACTIVATE_NONCE);
     $view->uninstallNonce = Nonce::getNonce(static::UNINSTALL_NONCE);
     $view->emailSuperUser = Piwik::getSuperUserEmail();
     $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:KiwiJuicer,项目名称:handball-dachau,代码行数:35,代码来源:Controller.php

示例2: getUserInformation

 /**
  * Get user information
  *
  * @param string $loginMail user login or email address
  * @return array ("login" => '...', "email" => '...', "password" => '...') or null, if user not found
  */
 protected function getUserInformation($loginMail)
 {
     Piwik::setUserIsSuperUser();
     $user = null;
     if ($loginMail == Piwik::getSuperUserEmail() || $loginMail == Config::getInstance()->superuser['login']) {
         $user = array('login' => Config::getInstance()->superuser['login'], 'email' => Piwik::getSuperUserEmail(), 'password' => Config::getInstance()->superuser['password']);
     } else {
         if (API::getInstance()->userExists($loginMail)) {
             $user = API::getInstance()->getUser($loginMail);
         } else {
             if (API::getInstance()->userEmailExists($loginMail)) {
                 $user = API::getInstance()->getUserByEmail($loginMail);
             }
         }
     }
     return $user;
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:23,代码来源: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())
 {
     if (empty($websiteId)) {
         $websiteId = $this->getDefaultWebsiteId();
     }
     if (empty($defaultDate)) {
         $defaultDate = $this->getDefaultDate();
     }
     if (empty($defaultPeriod)) {
         $defaultPeriod = $this->getDefaultPeriod();
     }
     $parametersString = '';
     if (!empty($parameters)) {
         $parametersString = '&' . Url::getQueryStringFromParameters($parameters);
     }
     if ($websiteId) {
         $url = "Location: index.php?module=" . $moduleToRedirect . "&action=" . $actionToRedirect . "&idSite=" . $websiteId . "&period=" . $defaultPeriod . "&date=" . $defaultDate . $parametersString;
         header($url);
         exit;
     }
     if (Piwik::isUserIsSuperUser()) {
         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') {
         $errorMessage = sprintf(Piwik::translate('CoreHome_NoPrivilegesAskPiwikAdmin'), $currentLogin, "<br/><a href='mailto:" . Piwik::getSuperUserEmail() . "?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:KiwiJuicer,项目名称:handball-dachau,代码行数:45,代码来源:Controller.php

示例4: sendReport

 public function sendReport($reportType, $report, $contents, $filename, $prettyDate, $reportSubject, $reportTitle, $additionalFiles)
 {
     if (self::manageEvent($reportType)) {
         $periods = self::getPeriodToFrequencyAsAdjective();
         $message = Piwik::translate('ScheduledReports_EmailHello');
         $subject = Piwik::translate('General_Report') . ' ' . $reportTitle . " - " . $prettyDate;
         $mail = new Mail();
         $mail->setSubject($subject);
         $fromEmailName = Config::getInstance()->branding['use_custom_logo'] ? Piwik::translate('CoreHome_WebAnalyticsReports') : Piwik::translate('ScheduledReports_PiwikReports');
         $fromEmailAddress = Config::getInstance()->General['noreply_email_address'];
         $attachmentName = $subject;
         $mail->setFrom($fromEmailAddress, $fromEmailName);
         $displaySegmentInfo = false;
         $segmentInfo = null;
         $segment = API::getSegment($report['idsegment']);
         if ($segment != null) {
             $displaySegmentInfo = true;
             $segmentInfo = Piwik::translate('ScheduledReports_SegmentAppliedToReports', $segment['name']);
         }
         switch ($report['format']) {
             case 'html':
                 // Needed when using images as attachment with cid
                 $mail->setType(Zend_Mime::MULTIPART_RELATED);
                 $message .= "<br/>" . Piwik::translate('ScheduledReports_PleaseFindBelow', array($periods[$report['period']], $reportTitle));
                 if ($displaySegmentInfo) {
                     $message .= " " . $segmentInfo;
                 }
                 $mail->setBodyHtml($message . "<br/><br/>" . $contents);
                 break;
             default:
             case 'pdf':
                 $message .= "\n" . Piwik::translate('ScheduledReports_PleaseFindAttachedFile', array($periods[$report['period']], $reportTitle));
                 if ($displaySegmentInfo) {
                     $message .= " " . $segmentInfo;
                 }
                 $mail->setBodyText($message);
                 $mail->createAttachment($contents, 'application/pdf', Zend_Mime::DISPOSITION_INLINE, Zend_Mime::ENCODING_BASE64, $attachmentName . '.pdf');
                 break;
         }
         foreach ($additionalFiles as $additionalFile) {
             $fileContent = $additionalFile['content'];
             $at = $mail->createAttachment($fileContent, $additionalFile['mimeType'], Zend_Mime::DISPOSITION_INLINE, $additionalFile['encoding'], $additionalFile['filename']);
             $at->id = $additionalFile['cid'];
             unset($fileContent);
         }
         // Get user emails and languages
         $reportParameters = $report['parameters'];
         $emails = array();
         if (isset($reportParameters[self::ADDITIONAL_EMAILS_PARAMETER])) {
             $emails = $reportParameters[self::ADDITIONAL_EMAILS_PARAMETER];
         }
         if ($reportParameters[self::EMAIL_ME_PARAMETER] == 1) {
             if (Piwik::getCurrentUserLogin() == $report['login']) {
                 $emails[] = Piwik::getCurrentUserEmail();
             } elseif ($report['login'] == Piwik::getSuperUserLogin()) {
                 $emails[] = Piwik::getSuperUserEmail();
             } else {
                 try {
                     $user = APIUsersManager::getInstance()->getUser($report['login']);
                 } catch (Exception $e) {
                     return;
                 }
                 $emails[] = $user['email'];
             }
         }
         foreach ($emails as $email) {
             if (empty($email)) {
                 continue;
             }
             $mail->addTo($email);
             try {
                 $mail->send();
             } catch (Exception $e) {
                 // If running from piwik.php with debug, we ignore the 'email not sent' error
                 if (!isset($GLOBALS['PIWIK_TRACKER_DEBUG']) || !$GLOBALS['PIWIK_TRACKER_DEBUG']) {
                     throw new Exception("An error occured while sending '{$filename}' " . " to " . implode(', ', $mail->getRecipients()) . ". Error was '" . $e->getMessage() . "'");
                 }
             }
             $mail->clearRecipients();
         }
     }
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:82,代码来源:ScheduledReports.php

示例5: userSettings

 /**
  * The "User Settings" admin UI screen view
  */
 public function userSettings()
 {
     Piwik::checkUserIsNotAnonymous();
     $view = new View('@UsersManager/userSettings');
     $userLogin = Piwik::getCurrentUserLogin();
     if (Piwik::isUserIsSuperUser()) {
         $view->userAlias = $userLogin;
         $view->userEmail = Piwik::getSuperUserEmail();
         $this->displayWarningIfConfigFileNotWritable();
     } else {
         $user = APIUsersManager::getInstance()->getUser($userLogin);
         $view->userAlias = $user['alias'];
         $view->userEmail = $user['email'];
     }
     $defaultReport = APIUsersManager::getInstance()->getUserPreference($userLogin, APIUsersManager::PREFERENCE_DEFAULT_REPORT);
     if ($defaultReport === false) {
         $defaultReport = $this->getDefaultWebsiteId();
     }
     $view->defaultReport = $defaultReport;
     if ($defaultReport == 'MultiSites') {
         $view->defaultReportSiteName = Site::getNameFor($this->getDefaultWebsiteId());
     } else {
         $view->defaultReportSiteName = Site::getNameFor($defaultReport);
     }
     $view->defaultDate = $this->getDefaultDateForUser($userLogin);
     $view->availableDefaultDates = array('today' => Piwik::translate('General_Today'), 'yesterday' => Piwik::translate('General_Yesterday'), 'previous7' => Piwik::translate('General_PreviousDays', 7), 'previous30' => Piwik::translate('General_PreviousDays', 30), 'last7' => Piwik::translate('General_LastDays', 7), 'last30' => Piwik::translate('General_LastDays', 30), 'week' => Piwik::translate('General_CurrentWeek'), 'month' => Piwik::translate('General_CurrentMonth'), 'year' => Piwik::translate('General_CurrentYear'));
     $view->ignoreCookieSet = IgnoreCookie::isIgnoreCookieFound();
     $this->initViewAnonymousUserSettings($view);
     $view->piwikHost = Url::getCurrentHost();
     $this->setBasicVariablesView($view);
     return $view->render();
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:35,代码来源:Controller.php


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