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


PHP Piwik::checkUserHasSuperUserAccessOrIsTheUser方法代码示例

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


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

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

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

示例3: get

 /**
  * Returns a stored segment by ID
  *
  * @param $idSegment
  * @throws Exception
  * @return bool
  */
 public function get($idSegment)
 {
     Piwik::checkUserHasSomeViewAccess();
     if (!is_numeric($idSegment)) {
         throw new Exception("idSegment should be numeric.");
     }
     $segment = Db::get()->fetchRow("SELECT * " . " FROM " . Common::prefixTable("segment") . " WHERE idsegment = ?", $idSegment);
     if (empty($segment)) {
         return false;
     }
     try {
         if (!$segment['enable_all_users']) {
             Piwik::checkUserHasSuperUserAccessOrIsTheUser($segment['login']);
         }
     } catch (Exception $e) {
         throw new Exception($this->getMessageCannotEditSegmentCreatedBySuperUser());
     }
     if ($segment['deleted']) {
         throw new Exception("This segment is marked as deleted. ");
     }
     return $segment;
 }
开发者ID:brienomatty,项目名称:elmsln,代码行数:29,代码来源:API.php

示例4: deleteReport

 /**
  * Deletes a specific report
  *
  * @param int $idReport
  */
 public function deleteReport($idReport)
 {
     $APIScheduledReports = $this->getReports($idSite = false, $periodSearch = false, $idReport);
     $report = reset($APIScheduledReports);
     Piwik::checkUserHasSuperUserAccessOrIsTheUser($report['login']);
     Db::get()->update(Common::prefixTable('report'), array('deleted' => 1), "idreport = '{$idReport}'");
     self::$cache = array();
 }
开发者ID:carriercomm,项目名称:piwik,代码行数:13,代码来源:API.php

示例5: set12HourClockForUser

 /**
  * Returns whether the user uses 12 hour clock
  *
  * @param string $login
  * @param bool $use12HourClock
  * @return string
  */
 public function set12HourClockForUser($login, $use12HourClock)
 {
     if ($login == 'anonymous') {
         return false;
     }
     Piwik::checkUserHasSuperUserAccessOrIsTheUser($login);
     $lang = $this->getModel()->set12HourClock($login, $use12HourClock);
     return $lang;
 }
开发者ID:dorelljames,项目名称:piwik,代码行数:16,代码来源:API.php

示例6: updateUser

 /**
  * Updates a user in the database.
  * Only login and password are required (case when we update the password).
  * When the password changes, the key token for this user will change, which could break
  * its API calls.
  *
  * @see addUser() for all the parameters
  */
 public function updateUser($userLogin, $password = false, $email = false, $alias = false, $_isPasswordHashed = false)
 {
     Piwik::checkUserHasSuperUserAccessOrIsTheUser($userLogin);
     $this->checkUserIsNotAnonymous($userLogin);
     $userInfo = $this->getUser($userLogin);
     $passwordHasBeenUpdated = false;
     if (empty($password)) {
         $password = $userInfo['password'];
     } else {
         $password = Common::unsanitizeInputValue($password);
         if (!$_isPasswordHashed) {
             UsersManager::checkPassword($password);
             $password = UsersManager::getPasswordHash($password);
         }
         $passwordHasBeenUpdated = true;
     }
     if (empty($alias)) {
         $alias = $userInfo['alias'];
     }
     if (empty($email)) {
         $email = $userInfo['email'];
     }
     if ($email != $userInfo['email']) {
         $this->checkEmail($email);
     }
     $alias = $this->getCleanAlias($alias, $userLogin);
     $token_auth = $this->getTokenAuth($userLogin, $password);
     $this->model->updateUser($userLogin, $password, $email, $alias, $token_auth);
     Cache::deleteTrackerCache();
     /**
      * Triggered after an existing user has been updated.
      * Event notify about password change.
      *
      * @param string $userLogin The user's login handle.
      * @param boolean $passwordHasBeenUpdated Flag containing information about password change.
      */
     Piwik::postEvent('UsersManager.updateUser.end', array($userLogin, $passwordHasBeenUpdated, $email, $password, $alias));
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:46,代码来源:API.php

示例7: deleteReport

 /**
  * Deletes a specific report
  *
  * @param int $idReport
  */
 public function deleteReport($idReport)
 {
     $APIScheduledReports = $this->getReports($idSite = false, $periodSearch = false, $idReport);
     $report = reset($APIScheduledReports);
     Piwik::checkUserHasSuperUserAccessOrIsTheUser($report['login']);
     $this->getModel()->updateReport($idReport, array('deleted' => 1));
     self::$cache = array();
 }
开发者ID:TensorWrenchOSS,项目名称:piwik,代码行数:13,代码来源:API.php

示例8: get

 /**
  * Returns a stored segment by ID
  *
  * @param $idSegment
  * @throws Exception
  * @return bool
  */
 public function get($idSegment)
 {
     Piwik::checkUserHasSomeViewAccess();
     if (!is_numeric($idSegment)) {
         throw new Exception("idSegment should be numeric.");
     }
     $segment = $this->getModel()->getSegment($idSegment);
     if (empty($segment)) {
         return false;
     }
     try {
         if (!$segment['enable_all_users']) {
             Piwik::checkUserHasSuperUserAccessOrIsTheUser($segment['login']);
         }
     } catch (Exception $e) {
         throw new Exception($this->getMessageCannotEditSegmentCreatedBySuperUser());
     }
     if ($segment['deleted']) {
         throw new Exception("This segment is marked as deleted. ");
     }
     return $segment;
 }
开发者ID:CaptainSharf,项目名称:SSAD_Project,代码行数:29,代码来源:API.php

示例9: recordUserSettings

 /**
  * Records settings from the "User Settings" page
  * @throws Exception
  */
 public function recordUserSettings()
 {
     $response = new ResponseBuilder(Common::getRequestVar('format'));
     try {
         $this->checkTokenInUrl();
         $defaultReport = Common::getRequestVar('defaultReport');
         $defaultDate = Common::getRequestVar('defaultDate');
         $language = Common::getRequestVar('language');
         $timeFormat = Common::getRequestVar('timeformat');
         $userLogin = Piwik::getCurrentUserLogin();
         Piwik::checkUserHasSuperUserAccessOrIsTheUser($userLogin);
         $this->processPasswordChange($userLogin);
         LanguagesManager::setLanguageForSession($language);
         APILanguagesManager::getInstance()->setLanguageForUser($userLogin, $language);
         APILanguagesManager::getInstance()->set12HourClockForUser($userLogin, $timeFormat);
         APIUsersManager::getInstance()->setUserPreference($userLogin, APIUsersManager::PREFERENCE_DEFAULT_REPORT, $defaultReport);
         APIUsersManager::getInstance()->setUserPreference($userLogin, APIUsersManager::PREFERENCE_DEFAULT_REPORT_DATE, $defaultDate);
         $toReturn = $response->getResponse();
     } catch (Exception $e) {
         $toReturn = $response->getResponseException($e);
     }
     return $toReturn;
 }
开发者ID:piwik,项目名称:piwik,代码行数:27,代码来源:Controller.php


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