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


PHP Piwik::getSuperUserEmail方法代码示例

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


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

示例1: redirectToIndex

 /**
  * Helper method used to redirect the current http request to another module/action
  * If specified, will also redirect to a given website, period and /or date
  *
  * @param string  $moduleToRedirect  Module, eg. "MultiSites"
  * @param string  $actionToRedirect  Action, eg. "index"
  * @param string  $websiteId         Website ID, eg. 1
  * @param string  $defaultPeriod     Default period, eg. "day"
  * @param string  $defaultDate       Default date, eg. "today"
  * @param array   $parameters        Parameters to append to url
  */
 function redirectToIndex($moduleToRedirect, $actionToRedirect, $websiteId = null, $defaultPeriod = null, $defaultDate = null, $parameters = array())
 {
     if (is_null($websiteId)) {
         $websiteId = $this->getDefaultWebsiteId();
     }
     if (is_null($defaultDate)) {
         $defaultDate = $this->getDefaultDate();
     }
     if (is_null($defaultPeriod)) {
         $defaultPeriod = $this->getDefaultPeriod();
     }
     $parametersString = '';
     if (!empty($parameters)) {
         $parametersString = '&' . Piwik_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 '" . Piwik_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=" . Zend_Registry::get('auth')->getName() . "&amp;action=logout'>&rsaquo; " . Piwik_Translate('General_Logout') . "</a></b><br />";
         Piwik_ExitWithMessage($errorMessage, false, true);
     }
     Piwik_FrontController::getInstance()->dispatch(Piwik::getLoginPluginName(), false);
     exit;
 }
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:43,代码来源:Controller.php

示例2: sendEmailReport

 public function sendEmailReport($idReport, $idSite, $period = false, $date = false)
 {
     Piwik::checkUserIsNotAnonymous();
     $reports = $this->getReports($idSite, false, $idReport);
     $report = reset($reports);
     if ($report['period'] == 'never') {
         $report['period'] = 'day';
     }
     if (!empty($period)) {
         $report['period'] = $period;
     }
     if (empty($date)) {
         $date = Piwik_Date::now()->subPeriod(1, $report['period'])->toString();
     }
     // Get user emails and languages
     $emails = self::getEmailsFromString($report['additional_emails']);
     if ($report['email_me'] == 1) {
         if (Piwik::getCurrentUserLogin() == $report['login']) {
             $emails[] = Piwik::getCurrentUserEmail();
         } elseif ($report['login'] == Piwik_Config::getInstance()->superuser['login']) {
             $emails[] = Piwik::getSuperUserEmail();
         } else {
             try {
                 $user = Piwik_UsersManager_API::getInstance()->getUser($report['login']);
             } catch (Exception $e) {
                 return;
             }
             $emails[] = $user['email'];
         }
     }
     $language = Piwik_LanguagesManager_API::getInstance()->getLanguageForUser($report['login']);
     list($outputFilename, $prettyDate, $websiteName, $reportFormat, $additionalFiles) = $this->generateReport($idReport, $date, $idSite, $language, self::OUTPUT_SAVE_ON_DISK, $report['period']);
     $this->sendReportEmail($emails, $outputFilename, $prettyDate, $websiteName, $report, $reportFormat, $additionalFiles);
 }
开发者ID:0h546f6f78696342756e4e59,项目名称:piwik,代码行数:34,代码来源:API.php

示例3: sendReport

 /**
  * @param Piwik_Event_Notification $notification notification object
  */
 function sendReport($notification)
 {
     if (self::manageEvent($notification)) {
         $notificationInfo = $notification->getNotificationInfo();
         $report = $notificationInfo[Piwik_PDFReports_API::REPORT_KEY];
         $websiteName = $notificationInfo[Piwik_PDFReports_API::WEBSITE_NAME_KEY];
         $prettyDate = $notificationInfo[Piwik_PDFReports_API::PRETTY_DATE_KEY];
         $contents = $notificationInfo[Piwik_PDFReports_API::REPORT_CONTENT_KEY];
         $filename = $notificationInfo[Piwik_PDFReports_API::FILENAME_KEY];
         $additionalFiles = $notificationInfo[Piwik_PDFReports_API::ADDITIONAL_FILES_KEY];
         $periods = self::getPeriodToFrequency();
         $message = Piwik_Translate('PDFReports_EmailHello');
         $subject = Piwik_Translate('General_Report') . ' ' . $websiteName . " - " . $prettyDate;
         $mail = new Piwik_Mail();
         $mail->setSubject($subject);
         $fromEmailName = Piwik_Config::getInstance()->branding['use_custom_logo'] ? Piwik_Translate('CoreHome_WebAnalyticsReports') : Piwik_Translate('PDFReports_PiwikReports');
         $fromEmailAddress = Piwik_Config::getInstance()->General['noreply_email_address'];
         $attachmentName = $subject;
         $mail->setFrom($fromEmailAddress, $fromEmailName);
         switch ($report['format']) {
             case 'html':
                 // Needed when using images as attachment with cid
                 $mail->setType(Zend_Mime::MULTIPART_RELATED);
                 $message .= "<br/>" . Piwik_Translate('PDFReports_PleaseFindBelow', array($periods[$report['period']], $websiteName));
                 $mail->setBodyHtml($message . "<br/><br/>" . $contents);
                 break;
             default:
             case 'pdf':
                 $message .= "\n" . Piwik_Translate('PDFReports_PleaseFindAttachedFile', array($periods[$report['period']], $websiteName));
                 $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_Config::getInstance()->superuser['login']) {
                 $emails[] = Piwik::getSuperUserEmail();
             } else {
                 try {
                     $user = Piwik_UsersManager_API::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:nnnnathann,项目名称:piwik,代码行数:79,代码来源:PDFReports.php

示例4: 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 == Piwik_Config::getInstance()->superuser['login']) {
         $user = array('login' => Piwik_Config::getInstance()->superuser['login'], 'email' => Piwik::getSuperUserEmail(), 'password' => Piwik_Config::getInstance()->superuser['password']);
     } else {
         if (Piwik_UsersManager_API::getInstance()->userExists($loginMail)) {
             $user = Piwik_UsersManager_API::getInstance()->getUser($loginMail);
         } else {
             if (Piwik_UsersManager_API::getInstance()->userEmailExists($loginMail)) {
                 $user = Piwik_UsersManager_API::getInstance()->getUserByEmail($loginMail);
             }
         }
     }
     return $user;
 }
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:23,代码来源:Controller.php

示例5: userSettings

	/**
	 * The "User Settings" admin UI screen view
	 */
	public function userSettings()
	{
		$view = Piwik_View::factory('userSettings');
		
		$userLogin = Piwik::getCurrentUserLogin();
		if(Piwik::isUserIsSuperUser())
		{
			$view->userAlias = $userLogin;
			$view->userEmail = Piwik::getSuperUserEmail();
			if(!Zend_Registry::get('config')->isFileWritable())
			{
				$view->configFileNotWritable = true;
			}
		}
		else
		{
			$user = Piwik_UsersManager_API::getInstance()->getUser($userLogin);
			$view->userAlias = $user['alias'];
	 		$view->userEmail = $user['email'];
		}
		
		$defaultReport = Piwik_UsersManager_API::getInstance()->getUserPreference($userLogin, Piwik_UsersManager_API::PREFERENCE_DEFAULT_REPORT);
		if($defaultReport === false)
		{
			$defaultReport = $this->getDefaultWebsiteId();
		}
		$view->defaultReport = $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 = Piwik_Tracker_IgnoreCookie::isIgnoreCookieFound();
		$this->initViewAnonymousUserSettings($view);
		$view->piwikHost = Piwik_Url::getCurrentHost();
		$this->setBasicVariablesView($view);
		$view->menu = Piwik_GetAdminMenu();
		echo $view->render();
	}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:51,代码来源:Controller.php

示例6: 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 == Zend_Registry::get('config')->superuser->login )
		{
			$user = array(
					'login' => Zend_Registry::get('config')->superuser->login,
					'email' => Piwik::getSuperUserEmail(),
					'password' => Zend_Registry::get('config')->superuser->password,
			);
		}
		else if( Piwik_UsersManager_API::getInstance()->userExists($loginMail) )
		{
			$user = Piwik_UsersManager_API::getInstance()->getUser($loginMail);
		}
		else if( Piwik_UsersManager_API::getInstance()->userEmailExists($loginMail) )
		{
			$user = Piwik_UsersManager_API::getInstance()->getUserByEmail($loginMail);
		}

		return $user;
	}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:31,代码来源:Controller.php


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