mirror of
https://github.com/e107inc/e107.git
synced 2025-01-17 20:58:30 +01:00
Switched add/remove functions to make use of the unified functions
from the user_class class (user_class::ucAdd(), user_class::ucRemove()) Fixed some typo and removed missing template vars
This commit is contained in:
parent
a2d5b9c31e
commit
322b5ba60d
@ -1062,16 +1062,19 @@ class e_user_model extends e_admin_model
|
||||
return false;
|
||||
}
|
||||
|
||||
$curClasses = explode(",", $this->getData('user_class'));
|
||||
$curClasses[] = $userClassId;
|
||||
$curClasses = array_unique($curClasses);
|
||||
|
||||
$insert = implode(",", $curClasses);
|
||||
// $curClasses = explode(",", $this->getData('user_class'));
|
||||
// $curClasses[] = $userClassId;
|
||||
// $curClasses = array_unique($curClasses);
|
||||
//
|
||||
// $insert = implode(",", $curClasses);
|
||||
|
||||
//FIXME - @SecretR - I'm missing something here with setCore() etc.
|
||||
// $this->setCore('user_class',$insert );
|
||||
// $this->saveDebug(false);
|
||||
|
||||
// Switched to unified remove user class method
|
||||
$insert = e107::getUserClass()->ucAdd($userClassId, $this->getData('user_class'), false);
|
||||
|
||||
if(!$uid = $this->getData('user_id'))
|
||||
{
|
||||
return false;
|
||||
@ -1094,20 +1097,28 @@ class e_user_model extends e_admin_model
|
||||
return false;
|
||||
}
|
||||
|
||||
$curClasses = explode(",", $this->getData('user_class'));
|
||||
// $curClasses = explode(",", $this->getData('user_class'));
|
||||
//
|
||||
// foreach($curClasses as $k=>$v)
|
||||
// {
|
||||
// if($v == $userClassId)
|
||||
// {
|
||||
// unset($curClasses[$k]);
|
||||
// }
|
||||
// }
|
||||
|
||||
foreach($curClasses as $k=>$v)
|
||||
// $uid = $this->getData('user_id');
|
||||
|
||||
// $insert = implode(",", $curClasses);
|
||||
|
||||
// Switched to unified remove user class method
|
||||
$insert = e107::getUserClass()->ucRemove($userClassId, $this->getData('user_class'), false);
|
||||
|
||||
if(!$uid = $this->getData('user_id'))
|
||||
{
|
||||
if($v == $userClassId)
|
||||
{
|
||||
unset($curClasses[$k]);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
$uid = $this->getData('user_id');
|
||||
|
||||
$insert = implode(",", $curClasses);
|
||||
|
||||
return e107::getDb()->update('user',"user_class='".$insert."' WHERE user_id = ".$uid." LIMIT 1");
|
||||
|
||||
|
||||
@ -1240,7 +1251,8 @@ class e_system_user extends e_user_model
|
||||
* @return array
|
||||
*/
|
||||
public function renderEmail($type, $userInfo)
|
||||
{
|
||||
{
|
||||
global $SIGNUPEMAIL_USETHEME, $QUICKADDUSER_TEMPLATE, $NOTIFY_TEMPLATE;
|
||||
$pref = e107::getPref();
|
||||
$ret = array();
|
||||
$tp = e107::getParser();
|
||||
@ -1285,10 +1297,10 @@ class e_system_user extends e_user_model
|
||||
$EMAIL_TEMPLATE['signup']['bcc'] = $SIGNUPEMAIL_BCC;
|
||||
$EMAIL_TEMPLATE['signup']['attachments'] = $SIGNUPEMAIL_ATTACHMENTS;
|
||||
$EMAIL_TEMPLATE['signup']['body'] = $SIGNUPEMAIL_TEMPLATE;
|
||||
|
||||
$EMAIL_TEMPLATE['quickadduser']['body'] = $QUICKADDUSER_TEMPLATE['email_body'];
|
||||
$EMAIL_TEMPLATE['notify']['body'] = $NOTIFY_TEMPLATE['email_body'];
|
||||
|
||||
|
||||
$EMAIL_TEMPLATE['quickadduser']['body'] = vartrue($QUICKADDUSER_TEMPLATE['email_body'], '');
|
||||
$EMAIL_TEMPLATE['notify']['body'] = vartrue($NOTIFY_TEMPLATE['email_body'], '');
|
||||
|
||||
}
|
||||
|
||||
$template = '';
|
||||
@ -1928,12 +1940,12 @@ class e_user extends e_user_model
|
||||
{
|
||||
$this->set('user_lastvisit', (integer) $this->get('user_currentvisit'));
|
||||
$this->set('user_currentvisit', time());
|
||||
$sql->db_Update('user', "user_visits = user_visits + 1, user_lastvisit = ".$this->get('user_lastvisit').", user_currentvisit = ".$this->get('user_currentvisit')."{$update_ip} WHERE user_id='".$this->getId()."' ");
|
||||
$sql->update('user', "user_visits = user_visits + 1, user_lastvisit = ".$this->get('user_lastvisit').", user_currentvisit = ".$this->get('user_currentvisit')."{$update_ip} WHERE user_id='".$this->getId()."' ");
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->set('user_currentvisit', time());
|
||||
$sql->db_Update('user', "user_currentvisit = ".$this->get('user_currentvisit')."{$update_ip} WHERE user_id='".$this->getId()."' ");
|
||||
$sql->update('user', "user_currentvisit = ".$this->get('user_currentvisit')."{$update_ip} WHERE user_id='".$this->getId()."' ");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2518,7 +2530,7 @@ class e_user_extended_model extends e_admin_model
|
||||
/**
|
||||
* Doesn't save anything actually...
|
||||
*/
|
||||
public function saveDebug($retrun = false, $undo = true)
|
||||
public function saveDebug($return = false, $undo = true)
|
||||
{
|
||||
$this->_buildManageRules();
|
||||
return parent::saveDebug($return, $undo);
|
||||
@ -2842,7 +2854,7 @@ class e_user_pref extends e_front_model
|
||||
{
|
||||
$data = $this->toString(true);
|
||||
$this->apply();
|
||||
return (e107::getDb('user_prefs')->db_Update('user', "user_prefs='{$data}' WHERE user_id=".$this->_user->getId()) ? true : false);
|
||||
return (e107::getDb('user_prefs')->update('user', "user_prefs='{$data}' WHERE user_id=".$this->_user->getId()) ? true : false);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user