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


PHP Piwik::checkUserIsNotAnonymous方法代码示例

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


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

示例1: index

 public function index()
 {
     Piwik::checkUserIsNotAnonymous();
     $view = Piwik_View::factory('index');
     $this->setGeneralVariablesView($view);
     $view->currentUserEmail = Piwik::getCurrentUserEmail();
     $availableReports = Piwik_API_API::getInstance()->getReportMetadata($this->idSite);
     $reportsByCategory = array();
     foreach ($availableReports as $report) {
         $reportsByCategory[$report['category']][] = $report;
     }
     unset($reportsByCategory['API']);
     $reports = Piwik_PDFReports_API::getInstance()->getReports($this->idSite, $period = false, $idReport = false, $ifSuperUserReturnOnlySuperUserReports = true);
     $reportsById = array();
     foreach ($reports as &$report) {
         $report['additional_emails'] = str_replace(',', "\n", $report['additional_emails']);
         $report['reports'] = explode(',', str_replace('.', '_', $report['reports']));
         $reportsById[$report['idreport']] = $report;
     }
     $view->downloadOutputType = Piwik_PDFReports_API::OUTPUT_DOWNLOAD;
     $columnsCount = 2;
     $view->newColumnAfter = ceil(count($reportsByCategory) / $columnsCount);
     $view->reportsByCategory = $reportsByCategory;
     $view->reportsJSON = Piwik_Common::json_encode($reportsById);
     $view->periods = array_merge(array('never' => Piwik_Translate('General_Never')), Piwik_PDFReports_API::getPeriodToFrequency());
     $view->defaultFormat = Piwik_PDFReports::DEFAULT_FORMAT;
     $view->formats = Piwik_ReportRenderer::$availableReportRenderers;
     $view->aggregateReportsFormats = Piwik_PDFReports_API::getAggregateReportsFormats();
     $view->reports = $reports;
     $view->language = Piwik_LanguagesManager::getLanguageCodeForCurrentUser();
     echo $view->render();
 }
开发者ID:neolf,项目名称:PIWIK4MOBILE,代码行数:32,代码来源:Controller.php

示例2: index

 function index()
 {
     Piwik::checkUserIsNotAnonymous();
     $view = Piwik_View::factory('Settings');
     $view->isSuperUser = Piwik::isUserIsSuperUser();
     $mobileMessagingAPI = Piwik_MobileMessaging_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('UserSettings_SubmenuSettings'), Piwik_Translate('MobileMessaging_SettingsMenu')));
     if ($view->credentialSupplied && $view->accountManagedByCurrentUser) {
         $view->provider = $mobileMessagingAPI->getSMSProvider();
         $view->creditLeft = $mobileMessagingAPI->getCreditLeft();
     }
     $view->smsProviders = Piwik_MobileMessaging_SMSProvider::$availableSMSProviders;
     // construct the list of countries from the lang files
     $countries = array();
     foreach (Piwik_Common::getCountriesList() as $countryCode => $continentCode) {
         if (isset(Piwik_MobileMessaging_CountryCallingCodes::$countryCallingCodes[$countryCode])) {
             $countries[$countryCode] = array('countryName' => Piwik_CountryTranslate($countryCode), 'countryCallingCode' => Piwik_MobileMessaging_CountryCallingCodes::$countryCallingCodes[$countryCode]);
         }
     }
     $view->countries = $countries;
     $view->defaultCountry = Piwik_Common::getCountry(Piwik_LanguagesManager::getLanguageCodeForCurrentUser(), true, Piwik_IP::getIpFromHeader());
     $view->phoneNumbers = $mobileMessagingAPI->getPhoneNumbers();
     $this->setBasicVariablesView($view);
     $view->menu = Piwik_GetAdminMenu();
     echo $view->render();
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:29,代码来源:Controller.php

示例3: addReport

 /**
  * Creates a new PDF report and schedules it. 
  * 
  * @param int $idSite 
  * @param string $description Report description
  * @param string $period Schedule frequency: day, week or month 
  * @param bool $sendToMe
  * @param string $additionalEmails Comma separated list of emails
  * @param string $reports Comma separated list of reports
  * @return int idReport generated
  */
 public function addReport($idSite, $description, $period, $reports, $emailMe = true, $additionalEmails = false)
 {
     Piwik::checkUserIsNotAnonymous();
     Piwik::checkUserHasViewAccess($idSite);
     $this->checkPeriod($period);
     $description = $this->checkDescription($description);
     $emailMe = (bool) $emailMe;
     $additionalEmails = $this->checkAdditionalEmails($additionalEmails);
     $reports = $this->checkAvailableReports($idSite, $reports);
     $db = Zend_Registry::get('db');
     $idReport = $db->fetchOne("SELECT max(idreport) + 1 \n\t\t\t\t\t\t\t\tFROM " . Piwik_Common::prefixTable('pdf'));
     if ($idReport == false) {
         $idReport = 1;
     }
     $db->insert(Piwik_Common::prefixTable('pdf'), array('idreport' => $idReport, 'idsite' => $idSite, 'login' => Piwik::getCurrentUserLogin(), 'description' => $description, 'period' => $period, 'email_me' => $emailMe, 'additional_emails' => $additionalEmails, 'reports' => $reports, 'ts_created' => Piwik_Date::now()->getDatetime(), 'deleted' => 0));
     return $idReport;
 }
开发者ID:Gninety,项目名称:Microweber,代码行数:28,代码来源:API.php

示例4: sendReport

 public function sendReport($idReport, $period = false, $date = false)
 {
     Piwik::checkUserIsNotAnonymous();
     $reports = $this->getReports($idSite = false, 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();
     }
     $language = Piwik_LanguagesManager_API::getInstance()->getLanguageForUser($report['login']);
     // generate report
     list($outputFilename, $prettyDate, $websiteName, $additionalFiles) = $this->generateReport($idReport, $date, $language, self::OUTPUT_SAVE_ON_DISK, $report['period']);
     if (!file_exists($outputFilename)) {
         throw new Exception("The report file wasn't found in {$outputFilename}");
     }
     $filename = basename($outputFilename);
     $handle = fopen($outputFilename, "r");
     $contents = fread($handle, filesize($outputFilename));
     fclose($handle);
     $notificationObject = null;
     Piwik_PostEvent(self::SEND_REPORT_EVENT, $notificationObject, $notificationInfo = array(self::REPORT_TYPE_INFO_KEY => $report['type'], self::REPORT_KEY => $report, self::REPORT_CONTENT_KEY => $contents, self::FILENAME_KEY => $filename, self::PRETTY_DATE_KEY => $prettyDate, self::WEBSITE_NAME_KEY => $websiteName, self::ADDITIONAL_FILES_KEY => $additionalFiles));
     // Update flag in DB
     Zend_Registry::get('db')->update(Piwik_Common::prefixTable('report'), array('ts_last_sent' => Piwik_Date::now()->getDatetime()), "idreport = " . $report['idreport']);
     // If running from piwik.php with debug, do not delete the PDF after sending the email
     if (!isset($GLOBALS['PIWIK_TRACKER_DEBUG']) || !$GLOBALS['PIWIK_TRACKER_DEBUG']) {
         @chmod($outputFilename, 0600);
     }
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:33,代码来源:API.php

示例5: userEmailExists

 /**
  * Returns true if user with given email (userEmail) is known in the database
  *
  * @return bool true if the user is known
  */
 public function userEmailExists($userEmail)
 {
     Piwik::checkUserIsNotAnonymous();
     $count = Piwik_FetchOne("SELECT count(*) \n\t\t\t\t\t\t\t\tFROM " . Piwik_Common::prefixTable("user") . " \n\t\t\t\t\t\t\t\tWHERE email = ?", $userEmail);
     return $count != 0;
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:11,代码来源:API.php

示例6: 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

示例7: setIgnoreCookie

	public function setIgnoreCookie()
	{
		Piwik::checkUserHasSomeViewAccess();
		Piwik::checkUserIsNotAnonymous();
		$this->checkTokenInUrl();
		Piwik_Tracker_IgnoreCookie::setIgnoreCookie();
		Piwik::redirectToModule('UsersManager', 'userSettings');
	}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:8,代码来源:Controller.php

示例8: getDelegatedManagement

 /**
  * Determine if normal users can manage their own SMS API credential
  *
  * @return bool false if SMS API credential only manageable by super admin, true otherwise
  */
 public function getDelegatedManagement()
 {
     Piwik::checkUserIsNotAnonymous();
     return Piwik_GetOption(Piwik_MobileMessaging::DELEGATED_MANAGEMENT_OPTION) == 'true';
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:10,代码来源:API.php

示例9: userEmailExists

 /**
  * Returns true if user with given email (userEmail) is known in the database, or the super user
  *
  * @return bool true if the user is known
  */
 public function userEmailExists($userEmail)
 {
     Piwik::checkUserIsNotAnonymous();
     $count = Piwik_FetchOne("SELECT count(*) \n\t\t\t\t\t\t\t\tFROM " . Piwik_Common::prefixTable("user") . " \n\t\t\t\t\t\t\t\tWHERE email = ?", $userEmail);
     return $count != 0 || Piwik_Config::getInstance()->superuser['email'] == $userEmail;
 }
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:11,代码来源:API.php


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