mirror of
https://github.com/e107inc/e107.git
synced 2025-07-31 20:00:37 +02: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:
@@ -1062,16 +1062,19 @@ class e_user_model extends e_admin_model
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$curClasses = explode(",", $this->getData('user_class'));
|
// $curClasses = explode(",", $this->getData('user_class'));
|
||||||
$curClasses[] = $userClassId;
|
// $curClasses[] = $userClassId;
|
||||||
$curClasses = array_unique($curClasses);
|
// $curClasses = array_unique($curClasses);
|
||||||
|
//
|
||||||
$insert = implode(",", $curClasses);
|
// $insert = implode(",", $curClasses);
|
||||||
|
|
||||||
//FIXME - @SecretR - I'm missing something here with setCore() etc.
|
//FIXME - @SecretR - I'm missing something here with setCore() etc.
|
||||||
// $this->setCore('user_class',$insert );
|
// $this->setCore('user_class',$insert );
|
||||||
// $this->saveDebug(false);
|
// $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'))
|
if(!$uid = $this->getData('user_id'))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@@ -1094,20 +1097,28 @@ class e_user_model extends e_admin_model
|
|||||||
return false;
|
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)
|
return false;
|
||||||
{
|
|
||||||
unset($curClasses[$k]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$uid = $this->getData('user_id');
|
|
||||||
|
|
||||||
$insert = implode(",", $curClasses);
|
|
||||||
|
|
||||||
return e107::getDb()->update('user',"user_class='".$insert."' WHERE user_id = ".$uid." LIMIT 1");
|
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
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function renderEmail($type, $userInfo)
|
public function renderEmail($type, $userInfo)
|
||||||
{
|
{
|
||||||
|
global $SIGNUPEMAIL_USETHEME, $QUICKADDUSER_TEMPLATE, $NOTIFY_TEMPLATE;
|
||||||
$pref = e107::getPref();
|
$pref = e107::getPref();
|
||||||
$ret = array();
|
$ret = array();
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
@@ -1285,10 +1297,10 @@ class e_system_user extends e_user_model
|
|||||||
$EMAIL_TEMPLATE['signup']['bcc'] = $SIGNUPEMAIL_BCC;
|
$EMAIL_TEMPLATE['signup']['bcc'] = $SIGNUPEMAIL_BCC;
|
||||||
$EMAIL_TEMPLATE['signup']['attachments'] = $SIGNUPEMAIL_ATTACHMENTS;
|
$EMAIL_TEMPLATE['signup']['attachments'] = $SIGNUPEMAIL_ATTACHMENTS;
|
||||||
$EMAIL_TEMPLATE['signup']['body'] = $SIGNUPEMAIL_TEMPLATE;
|
$EMAIL_TEMPLATE['signup']['body'] = $SIGNUPEMAIL_TEMPLATE;
|
||||||
|
|
||||||
$EMAIL_TEMPLATE['quickadduser']['body'] = $QUICKADDUSER_TEMPLATE['email_body'];
|
$EMAIL_TEMPLATE['quickadduser']['body'] = vartrue($QUICKADDUSER_TEMPLATE['email_body'], '');
|
||||||
$EMAIL_TEMPLATE['notify']['body'] = $NOTIFY_TEMPLATE['email_body'];
|
$EMAIL_TEMPLATE['notify']['body'] = vartrue($NOTIFY_TEMPLATE['email_body'], '');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$template = '';
|
$template = '';
|
||||||
@@ -1928,12 +1940,12 @@ class e_user extends e_user_model
|
|||||||
{
|
{
|
||||||
$this->set('user_lastvisit', (integer) $this->get('user_currentvisit'));
|
$this->set('user_lastvisit', (integer) $this->get('user_currentvisit'));
|
||||||
$this->set('user_currentvisit', time());
|
$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
|
else
|
||||||
{
|
{
|
||||||
$this->set('user_currentvisit', time());
|
$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...
|
* Doesn't save anything actually...
|
||||||
*/
|
*/
|
||||||
public function saveDebug($retrun = false, $undo = true)
|
public function saveDebug($return = false, $undo = true)
|
||||||
{
|
{
|
||||||
$this->_buildManageRules();
|
$this->_buildManageRules();
|
||||||
return parent::saveDebug($return, $undo);
|
return parent::saveDebug($return, $undo);
|
||||||
@@ -2842,7 +2854,7 @@ class e_user_pref extends e_front_model
|
|||||||
{
|
{
|
||||||
$data = $this->toString(true);
|
$data = $this->toString(true);
|
||||||
$this->apply();
|
$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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user