本文整理汇总了PHP中Piwik::checkUserIsSuperUserOrTheUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Piwik::checkUserIsSuperUserOrTheUser方法的具体用法?PHP Piwik::checkUserIsSuperUserOrTheUser怎么用?PHP Piwik::checkUserIsSuperUserOrTheUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik
的用法示例。
在下文中一共展示了Piwik::checkUserIsSuperUserOrTheUser方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteReport
/**
* Deletes a specific report
*
* @param int $idReport
*/
public function deleteReport($idReport)
{
$pdfReports = $this->getReports($idSite = false, $periodSearch = false, $idReport);
$report = reset($pdfReports);
Piwik::checkUserIsSuperUserOrTheUser($report['login']);
Zend_Registry::get('db')->update(Piwik_Common::prefixTable('report'), array('deleted' => 1), "idreport = '{$idReport}'");
self::$cache = array();
}
示例2: 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)
{
Piwik::checkUserIsSuperUserOrTheUser($userLogin);
$this->checkUserIsNotAnonymous($userLogin);
$this->checkUserIsNotSuperUser($userLogin);
$userInfo = $this->getUser($userLogin);
if (empty($password)) {
$password = $userInfo['password'];
} else {
$password = Piwik_Common::unsanitizeInputValue($password);
$this->checkPassword($password);
$password = $this->getCleanPassword($password);
}
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);
$db = Zend_Registry::get('db');
$db->update(Piwik_Common::prefixTable("user"), array('password' => $password, 'alias' => $alias, 'email' => $email, 'token_auth' => $token_auth), "login = '{$userLogin}'");
Piwik_Common::deleteTrackerCache();
Piwik_PostEvent('UsersManager.updateUser', $userLogin);
}
示例3: setLanguageForUser
/**
* Sets the language for the user
*
* @param string $login
* @param string $languageCode
* @return bool
*/
public function setLanguageForUser($login, $languageCode)
{
Piwik::checkUserIsSuperUserOrTheUser($login);
if (!$this->isLanguageAvailable($languageCode)) {
return false;
}
$paramsBind = array($login, $languageCode, $languageCode);
Piwik_Query('INSERT INTO ' . Piwik_Common::prefixTable('user_language') . ' (login, language)
VALUES (?,?)
ON DUPLICATE KEY UPDATE language=?', $paramsBind);
}
示例4: setLanguageForUser
/**
* Sets the language for the user
*
* @param string $login
* @param string $languageCode
*/
static public function setLanguageForUser($login, $languageCode)
{
Piwik::checkUserIsSuperUserOrTheUser($login);
$paramsBind = array($login, $languageCode, $languageCode);
Piwik_Query('INSERT INTO '.Piwik::prefixTable('user_language') .
' (login, language)
VALUES (?,?)
ON DUPLICATE KEY UPDATE language=?',
$paramsBind);
}
示例5: 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
*/
static public function updateUser( $userLogin, $password = false, $email = false, $alias = false )
{
Piwik::checkUserIsSuperUserOrTheUser($userLogin);
self::checkUserIsNotAnonymous( $userLogin );
self::checkUserIsNotSuperUser($userLogin);
$userInfo = self::getUser($userLogin);
if(empty($password))
{
$password = $userInfo['password'];
}
else
{
self::checkPassword($password);
$password = self::getCleanPassword($password);
}
if(empty($alias))
{
$alias = $userInfo['alias'];
}
if(empty($email))
{
$email = $userInfo['email'];
}
if($email != $userInfo['email'])
{
self::checkEmail($email);
}
$alias = self::getCleanAlias($alias,$userLogin);
$token_auth = self::getTokenAuth($userLogin,$password);
$db = Zend_Registry::get('db');
$db->update( Piwik::prefixTable("user"),
array(
'password' => $password,
'alias' => $alias,
'email' => $email,
'token_auth' => $token_auth,
),
"login = '$userLogin'"
);
}
示例6: setLanguageForUser
public static function setLanguageForUser($login, $language)
{
Piwik::checkUserIsSuperUserOrTheUser($login);
$table = Piwik::prefixTable('user_language');
$dataIns = array('language' => $language, 'login' => $login);
$dataUpd = array('language' => $language);
$where = 'login = ' . Zend_Registry::get('db')->quote($login);
if (!Zend_Registry::get('db')->update($table, $dataUpd, $where)) {
Zend_Registry::get('db')->insert($table, $dataIns);
}
}