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


PHP Piwik::checkUserIsNotAnonymous方法代码示例

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


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

示例1: index

 public function index()
 {
     Piwik::checkUserIsNotAnonymous();
     $view = new View('@MobileMessaging/index');
     $view->isSuperUser = Piwik::hasUserSuperUserAccess();
     $mobileMessagingAPI = 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('General_Settings'), Piwik::translate('MobileMessaging_SettingsMenu')));
     if ($view->credentialSupplied && $view->accountManagedByCurrentUser) {
         $view->provider = $mobileMessagingAPI->getSMSProvider();
         $view->creditLeft = $mobileMessagingAPI->getCreditLeft();
     }
     $view->smsProviders = SMSProvider::$availableSMSProviders;
     // construct the list of countries from the lang files
     $countries = array();
     foreach (Common::getCountriesList() as $countryCode => $continentCode) {
         if (isset(CountryCallingCodes::$countryCallingCodes[$countryCode])) {
             $countries[$countryCode] = array('countryName' => \Piwik\Plugins\UserCountry\countryTranslate($countryCode), 'countryCallingCode' => CountryCallingCodes::$countryCallingCodes[$countryCode]);
         }
     }
     $view->countries = $countries;
     $view->defaultCountry = Common::getCountry(LanguagesManager::getLanguageCodeForCurrentUser(), true, IP::getIpFromHeader());
     $view->phoneNumbers = $mobileMessagingAPI->getPhoneNumbers();
     $this->setBasicVariablesView($view);
     return $view->render();
 }
开发者ID:carriercomm,项目名称:piwik,代码行数:28,代码来源:Controller.php

示例2: index

 /**
  * Mobile Messaging Settings tab :
  *  - set delegated management
  *  - provide & validate SMS API credential
  *  - add & activate phone numbers
  *  - check remaining credits
  */
 public function index()
 {
     Piwik::checkUserIsNotAnonymous();
     $view = new View('@MobileMessaging/index');
     $this->setManageVariables($view);
     return $view->render();
 }
开发者ID:piwik,项目名称:piwik,代码行数:14,代码来源:Controller.php

示例3: sendFeedbackForFeature

 /**
  * Sends feedback for a specific feature to the Piwik team or alternatively to the email address configured in the
  * config: "feedback_email_address".
  *
  * @param string      $featureName  The name of a feature you want to give feedback to.
  * @param bool|int    $like         Whether you like the feature or not
  * @param string|bool $message      A message containing the actual feedback
  */
 public function sendFeedbackForFeature($featureName, $like, $message = false)
 {
     Piwik::checkUserIsNotAnonymous();
     Piwik::checkUserHasSomeViewAccess();
     $featureName = $this->getEnglishTranslationForFeatureName($featureName);
     $likeText = 'Yes';
     if (empty($like)) {
         $likeText = 'No';
     }
     $body = sprintf("Feature: %s\nLike: %s\n", $featureName, $likeText, $message);
     $feedbackMessage = "";
     if (!empty($message) && $message != 'undefined') {
         $feedbackMessage = sprintf("Feedback:\n%s\n", trim($message));
     }
     $body .= $feedbackMessage ? $feedbackMessage : " \n";
     $subject = sprintf("%s for %s %s", empty($like) ? "-1" : "+1", $featureName, empty($feedbackMessage) ? "" : "(w/ feedback)");
     $this->sendMail($subject, $body);
 }
开发者ID:brienomatty,项目名称:elmsln,代码行数:26,代码来源:API.php

示例4: regenerate

 /**
  * Action to generate a new Google Authenticator secret for the current user
  *
  * @return string
  * @throws \Exception
  * @throws \Piwik\NoAccessException
  */
 public function regenerate()
 {
     Piwik::checkUserIsNotAnonymous();
     $view = new View('@GoogleAuthenticator/regenerate');
     $this->setGeneralVariablesView($view);
     $googleAuth = new PHPGangsta\GoogleAuthenticator();
     $storage = new Storage(Piwik::getCurrentUserLogin());
     $secret = Common::getRequestVar('gasecret', '', 'string');
     $authCode = Common::getRequestVar('gaauthcode', '', 'string');
     $authCodeNonce = Common::getRequestVar('authCodeNonce', '', 'string');
     $title = Common::getRequestVar('gatitle', $storage->getTitle(), 'string');
     $description = Common::getRequestVar('gadescription', $storage->getDescription(), 'string');
     if (!empty($secret) && !empty($authCode) && Nonce::verifyNonce(self::AUTH_CODE_NONCE, $authCodeNonce) && $googleAuth->verifyCode($secret, $authCode, 2)) {
         $storage->setSecret($secret);
         $storage->setDescription($description);
         $storage->setTitle($title);
         $this->auth->setAuthCode($authCode);
         $this->auth->validateAuthCode();
         Url::redirectToUrl(Url::getCurrentUrlWithoutQueryString() . Url::getCurrentQueryStringWithParametersModified(array('action' => 'settings', 'activate' => '1')));
     }
     if (empty($secret)) {
         $secret = $googleAuth->createSecret(32);
     }
     $view->title = $title;
     $view->description = $description;
     $view->authCodeNonce = Nonce::getNonce(self::AUTH_CODE_NONCE);
     $view->newSecret = $secret;
     $view->googleAuthImage = $googleAuth->getQRCodeGoogleUrl($description, $secret, $title);
     return $view->render();
 }
开发者ID:sgiehl,项目名称:piwik-plugin-GoogleAuthenticator,代码行数:37,代码来源:Controller.php

示例5: setLanguageForUser

 /**
  * Sets the language for the user
  *
  * @param string $login
  * @param string $languageCode
  * @return bool
  */
 public function setLanguageForUser($login, $languageCode)
 {
     Piwik::checkUserHasSuperUserAccessOrIsTheUser($login);
     Piwik::checkUserIsNotAnonymous();
     if (!$this->isLanguageAvailable($languageCode)) {
         return false;
     }
     $this->getModel()->setLanguageForUser($login, $languageCode);
     return true;
 }
开发者ID:bossrabbit,项目名称:piwik,代码行数:17,代码来源:API.php

示例6: getUserSettings

 /**
  * @internal
  * @return array
  * @throws \Piwik\NoAccessException
  */
 public function getUserSettings()
 {
     Piwik::checkUserIsNotAnonymous();
     $userSettings = $this->settingsProvider->getAllUserSettings();
     return $this->settingsMetadata->formatSettings($userSettings);
 }
开发者ID:piwik,项目名称:piwik,代码行数:11,代码来源:API.php

示例7: setIgnoreCookie

 public function setIgnoreCookie()
 {
     Piwik::checkUserHasSomeViewAccess();
     Piwik::checkUserIsNotAnonymous();
     $this->checkTokenInUrl();
     IgnoreCookie::setIgnoreCookie();
     Piwik::redirectToModule('UsersManager', 'userSettings', array('token_auth' => false));
 }
开发者ID:brienomatty,项目名称:elmsln,代码行数:8,代码来源:Controller.php

示例8: checkCredentialManagementRights

 private function checkCredentialManagementRights()
 {
     $this->getDelegatedManagement() ? Piwik::checkUserIsNotAnonymous() : Piwik::checkUserHasSuperUserAccess();
 }
开发者ID:carriercomm,项目名称:piwik,代码行数:4,代码来源:API.php

示例9: setIgnoreCookie

 public function setIgnoreCookie()
 {
     Piwik::checkUserHasSomeViewAccess();
     Piwik::checkUserIsNotAnonymous();
     $salt = Common::getRequestVar('ignoreSalt', false, 'string');
     if ($salt !== $this->getIgnoreCookieSalt()) {
         throw new Exception("Not authorized");
     }
     IgnoreCookie::setIgnoreCookie();
     Piwik::redirectToModule('UsersManager', 'userSettings', array('token_auth' => false));
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:11,代码来源:Controller.php

示例10: 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 = Date::now()->subPeriod(1, $report['period'])->toString();
     }
     $language = \Piwik\Plugins\LanguagesManager\API::getInstance()->getLanguageForUser($report['login']);
     // generate report
     list($outputFilename, $prettyDate, $reportSubject, $reportTitle, $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);
     /**
      * Triggered when sending scheduled reports.
      *
      * Plugins that provide new scheduled report transport mediums should use this event to
      * send the scheduled report.
      * 
      * @param string $reportType A string ID describing how the report is sent, eg,
      *                           `'sms'` or `'email'`.
      * @param array $report An array describing the scheduled report that is being
      *                      generated.
      * @param string $contents The contents of the scheduled report that was generated
      *                         and now should be sent.
      * @param string $filename The path to the file where the scheduled report has
      *                         been saved.
      * @param string $prettyDate A prettified date string for the data within the
      *                           scheduled report.
      * @param string $reportSubject A string describing what's in the scheduled
      *                              report.
      * @param string $reportTitle The scheduled report's given title (given by a Piwik user).
      * @param array $additionalFiles The list of additional files that should be
      *                               sent with this report.
      */
     Piwik::postEvent(self::SEND_REPORT_EVENT, array($report['type'], $report, $contents, $filename, $prettyDate, $reportSubject, $reportTitle, $additionalFiles));
     // Update flag in DB
     Db::get()->update(Common::prefixTable('report'), array('ts_last_sent' => 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:carriercomm,项目名称:piwik,代码行数:54,代码来源:API.php

示例11: userEmailExists

 /**
  * Returns true if user with given email (userEmail) is known in the database, or the Super User
  *
  * @param string $userEmail
  * @return bool true if the user is known
  */
 public function userEmailExists($userEmail)
 {
     Piwik::checkUserIsNotAnonymous();
     return $this->model->userEmailExists($userEmail);
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:11,代码来源:API.php

示例12: getUserLoginFromUserEmail

 /**
  * Returns the first login name of an existing user that has the given email address. If no user can be found for
  * this user an error will be returned.
  *
  * @param string $userEmail
  * @return bool true if the user is known
  */
 public function getUserLoginFromUserEmail($userEmail)
 {
     Piwik::checkUserIsNotAnonymous();
     Piwik::checkUserHasSomeAdminAccess();
     $this->checkUserEmailExists($userEmail);
     $user = $this->model->getUserByEmail($userEmail);
     // any user with some admin access is allowed to find any user by email, no need to filter by access here
     return $user['login'];
 }
开发者ID:JoeHorn,项目名称:piwik,代码行数:16,代码来源:API.php

示例13: checkPermission

 private function checkPermission()
 {
     Piwik::checkUserIsNotAnonymous();
 }
开发者ID:andrzejewsky,项目名称:plugin-CustomAlerts,代码行数:4,代码来源:CustomAlerts.php

示例14: sendReport

 public function sendReport($idReport, $period = false, $date = false, $force = 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 = Date::now()->subPeriod(1, $report['period'])->toString();
     }
     $language = \Piwik\Plugins\LanguagesManager\API::getInstance()->getLanguageForUser($report['login']);
     // generate report
     list($outputFilename, $prettyDate, $reportSubject, $reportTitle, $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}");
     }
     $contents = file_get_contents($outputFilename);
     if (empty($contents)) {
         Log::warning("Scheduled report file '%s' exists but is empty!", $outputFilename);
     }
     /**
      * Triggered when sending scheduled reports.
      *
      * Plugins that provide new scheduled report transport mediums should use this event to
      * send the scheduled report.
      *
      * @param string $reportType A string ID describing how the report is sent, eg,
      *                           `'sms'` or `'email'`.
      * @param array $report An array describing the scheduled report that is being
      *                      generated.
      * @param string $contents The contents of the scheduled report that was generated
      *                         and now should be sent.
      * @param string $filename The path to the file where the scheduled report has
      *                         been saved.
      * @param string $prettyDate A prettified date string for the data within the
      *                           scheduled report.
      * @param string $reportSubject A string describing what's in the scheduled
      *                              report.
      * @param string $reportTitle The scheduled report's given title (given by a Piwik user).
      * @param array $additionalFiles The list of additional files that should be
      *                               sent with this report.
      * @param \Piwik\Period $period The period for which the report has been generated.
      * @param boolean $force A report can only be sent once per period. Setting this to true
      *                       will force to send the report even if it has already been sent.
      */
     Piwik::postEvent(self::SEND_REPORT_EVENT, array($report['type'], $report, $contents, $filename = basename($outputFilename), $prettyDate, $reportSubject, $reportTitle, $additionalFiles, \Piwik\Period\Factory::build($report['period'], $date), $force));
     // Update flag in DB
     $now = Date::now()->getDatetime();
     $this->getModel()->updateReport($report['idreport'], array('ts_last_sent' => $now));
     // If running from piwik.php with debug, do not delete the PDF after sending the email
     $tracker = new Tracker();
     if (!$tracker->isDebugModeEnabled()) {
         @chmod($outputFilename, 0600);
     }
 }
开发者ID:CaptainSharf,项目名称:SSAD_Project,代码行数:59,代码来源:API.php

示例15: setLanguageForUser

 /**
  * Sets the language for the user
  *
  * @param string $login
  * @param string $languageCode
  * @return bool
  */
 public function setLanguageForUser($login, $languageCode)
 {
     Piwik::checkUserHasSuperUserAccessOrIsTheUser($login);
     Piwik::checkUserIsNotAnonymous();
     if (!$this->isLanguageAvailable($languageCode)) {
         return false;
     }
     $paramsBind = array($login, $languageCode, $languageCode);
     Db::query('INSERT INTO ' . Common::prefixTable('user_language') . ' (login, language)
             VALUES (?,?)
         ON DUPLICATE KEY UPDATE language=?', $paramsBind);
     return true;
 }
开发者ID:carriercomm,项目名称:piwik,代码行数:20,代码来源:API.php


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