* Merge code.

This commit is contained in:
Yagami
2020-11-24 14:46:19 +08:00
parent 9c59c495ee
commit 97ac6f0b9c
11 changed files with 218 additions and 62 deletions
+27 -5
View File
@@ -587,16 +587,38 @@ class customModel extends model
public function setURAndSR()
{
$data = fixer::input('post')->get();
$lang = $this->app->getClientLang();
$this->loadModel('setting')->setItem("system.custom.URAndSR", $data->URAndSR);
if($data->URAndSR)
{
$clientLang = $this->app->getClientLang();
$URSRName = isset($this->config->custom->URSRName) ? json_decode($this->config->custom->URSRName, true) : array();
$URSRName['URCommon'][$clientLang] = $data->URCommon[$clientLang];
$URSRName['SRCommon'][$clientLang] = $data->SRCommon[$clientLang];
$this->setting->setItem("system.custom.common.URSRName", json_encode($URSRName));
/* If has custom UR and SR name. */
$newKey = '';
if(isset($data->URSRCustom))
{
if(!$data->URName || !$data->SRName) return false;
$newKey = max(array_keys($this->lang->custom->URSRList)) + 1;
$URSRName = $data->URName . '/' . $data->SRName;
/* Delete old lang data, and add new. */
$this->lang->custom->URSRList[$newKey] = $URSRName;
$this->lang->custom->URList[$newKey] = $data->URName;
$this->lang->custom->SRList[$newKey] = $data->SRName;
$this->deleteItems("lang=$lang&module=custom&section=URSRList");
$this->deleteItems("lang=$lang&module=custom&section=URList");
$this->deleteItems("lang=$lang&module=custom&section=SRList");
foreach($this->lang->custom->URSRList as $key => $value) $this->setItem("$lang.custom.URSRList.{$key}.1", $value);
foreach($this->lang->custom->URList as $key => $value) $this->setItem("$lang.custom.URList.{$key}.1", $value);
foreach($this->lang->custom->SRList as $key => $value) $this->setItem("$lang.custom.SRList.{$key}.1", $value);
}
$URSRName = $newKey ? $newKey : $data->URSRCommon;
$this->setting->setItem("system.custom.URSRName", $URSRName);
}
return true;
}
/**