本文整理汇总了PHP中Piwik\Piwik::getSuperUserLogin方法的典型用法代码示例。如果您正苦于以下问题:PHP Piwik::getSuperUserLogin方法的具体用法?PHP Piwik::getSuperUserLogin怎么用?PHP Piwik::getSuperUserLogin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\Piwik
的用法示例。
在下文中一共展示了Piwik::getSuperUserLogin方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
}
}
示例2: checkUserIsNotSuperUser
private function checkUserIsNotSuperUser($userLogin)
{
if ($userLogin == Piwik::getSuperUserLogin()) {
throw new Exception(Piwik::translate("UsersManager_ExceptionSuperUser"));
}
}
示例3: getCredentialManagerLogin
private function getCredentialManagerLogin()
{
return $this->getDelegatedManagement() ? Piwik::getCurrentUserLogin() : Piwik::getSuperUserLogin();
}