This commit is contained in:
Yagami
2019-01-25 09:00:11 +08:00
4 changed files with 41 additions and 6 deletions
+7 -4
View File
@@ -750,7 +750,7 @@ class actionModel extends model
}
$objectNames['user'][0] = 'guest'; // Add guest account.
foreach($actions as $action)
foreach($actions as $i => $action)
{
/* Add name field to the actions. */
$action->objectName = isset($objectNames[$action->objectType][$action->objectID]) ? $objectNames[$action->objectType][$action->objectID] : '';
@@ -779,11 +779,14 @@ class actionModel extends model
{
list($objectLabel, $moduleName, $methodName, $vars) = explode('|', $action->objectLabel);
$action->objectLink = '';
if(common::hasPriv($moduleName, $methodName))
if(!common::hasPriv($moduleName, $methodName))
{
$action->objectLink = helper::createLink($moduleName, $methodName, sprintf($vars, $action->objectID));
if($action->objectType == 'user') $action->objectLink = helper::createLink($moduleName, $methodName, sprintf($vars, $action->actor));
unset($actions[$i]);
continue;
}
$action->objectLink = helper::createLink($moduleName, $methodName, sprintf($vars, $action->objectID));
if($action->objectType == 'user') $action->objectLink = helper::createLink($moduleName, $methodName, sprintf($vars, $action->actor));
$action->objectLabel = $objectLabel;
}
else
@@ -29,9 +29,7 @@ class admin extends control
if($errors) $this->send(array('result' => 'fail', 'message' => $errors));
$result = $this->loadModel('setting')->setItems('system.common.xuanxuan', $setting);
$this->setting->setItem('system.mail.domain', $setting->server);
if(!$result) $this->send(array('result' => 'fail', 'message' => dao::getError()));
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('xuanxuan')));
}
@@ -65,4 +65,28 @@ class xuanxuanChat extends chatModel
unset($_SESSION['user']);
return $entries;
}
public function editUser($user = null)
{
if(empty($user->id)) return null;
$data = array();
foreach($this->config->chat->user->canEditFields as $field)
{
if(!empty($user->$field)) $data[$field] = $user->$field;
}
if(!$data) return null;
$data['clientLang'] = $this->app->getClientLang();
$this->dao->update(TABLE_USER)->data($data)->where('id')->eq($user->id)->exec();
return $this->getUserByUserID($user->id);
}
public function getServer($backend = 'xxb')
{
$server = commonModel::getSysURL();
if(!empty($this->config->xuanxuan->server)) $server = $this->config->xuanxuan->server;
return $server;
}
}
@@ -3,3 +3,13 @@ public function getExtensionList($userID)
{
return $this->loadExtension('xuanxuan')->getExtensionList($userID);
}
public function editUser($user = null)
{
return $this->loadExtension('xuanxuan')->editUser($user);
}
public function getServer($backend = 'xxb')
{
return $this->loadExtension('xuanxuan')->getServer($backend);
}