Merge branch 'zentaopms_289' of https://gitlab.zcorp.cc/easycorp/zentaopms into zentaopms_289

This commit is contained in:
caoyanyi
2023-02-23 16:31:44 +08:00
3 changed files with 47 additions and 24 deletions

View File

@@ -124,29 +124,49 @@ class router extends baseRouter
{
foreach($lang->db->custom[$moduleName] as $section => $fields)
{
if(isset($lang->{$moduleName}->{$section}['']))
if($section == 'featureBar')
{
$nullKey = '';
$nullValue = $lang->{$moduleName}->{$section}[$nullKey];
foreach($fields as $featureBarMethod => $featureBarValues)
{
foreach($featureBarValues as $featureBarKey => $featureBarValue)
{
if(is_array($featureBarValue))
{
foreach($featureBarValue as $key => $value) $lang->{$moduleName}->{$section}[$featureBarMethod][$featureBarKey][$key] = $value;
}
else
{
$lang->{$moduleName}->{$section}[$featureBarMethod][$featureBarKey] = $featureBarValue;
}
}
}
}
elseif(isset($lang->{$moduleName}->{$section}[0]))
else
{
$nullKey = 0;
$nullValue = $lang->{$moduleName}->{$section}[0];
}
unset($lang->{$moduleName}->{$section});
if(isset($lang->{$moduleName}->{$section}['']))
{
$nullKey = '';
$nullValue = $lang->{$moduleName}->{$section}[$nullKey];
}
elseif(isset($lang->{$moduleName}->{$section}[0]))
{
$nullKey = 0;
$nullValue = $lang->{$moduleName}->{$section}[0];
}
unset($lang->{$moduleName}->{$section});
if(isset($nullKey))$lang->{$moduleName}->{$section}[$nullKey] = $nullValue;
foreach($fields as $key => $value)
{
if($section == 'priList' and $key > 0 and trim($value) === '') continue; // Fix bug #23538.
if(isset($nullKey))$lang->{$moduleName}->{$section}[$nullKey] = $nullValue;
foreach($fields as $key => $value)
{
if($section == 'priList' and $key > 0 and trim($value) === '') continue; // Fix bug #23538.
if(!isset($lang->{$moduleName})) $lang->{$moduleName} = new stdclass();
if(!isset($lang->{$moduleName}->{$section})) $lang->{$moduleName}->{$section} = array();
$lang->{$moduleName}->{$section}[$key] = $value;
if(!isset($lang->{$moduleName})) $lang->{$moduleName} = new stdclass();
if(!isset($lang->{$moduleName}->{$section})) $lang->{$moduleName}->{$section} = array();
$lang->{$moduleName}->{$section}[$key] = $value;
}
unset($nullKey);
unset($nullValue);
}
unset($nullKey);
unset($nullValue);
}
}

View File

@@ -124,8 +124,9 @@ class dev extends control
if($this->server->request_method == 'POST')
{
$section = '';
if($type == 'common') $section = '&section=';
if($type == 'first') $section = '&section=mainNav';
if($type == 'common') $section = '&section=';
if($type == 'first') $section = '&section=mainNav';
if($type == 'feature') $section = str_replace('_', '-', "&section=featureBar-{$method}");
$this->loadModel('custom')->deleteItems("lang={$language}&module={$moduleName}&vision={$this->config->vision}{$section}");
$data = fixer::input('post')->get();
@@ -167,19 +168,21 @@ class dev extends control
*
* @param string $type common|first|second|third|feature
* @param string $module
* @param string $method
* @param string $language zh_cn|en|fr|de|zh_tw
* @param string $confirm no|yes
* @access public
* @return void
*/
public function resetLang($type = 'common', $module = '', $language = 'zh_cn', $confirm = 'no')
public function resetLang($type = 'common', $module = '', $method = '', $language = 'zh_cn', $confirm = 'no')
{
if($confirm == 'no') return print(js::confirm($this->lang->dev->confirmRestore, inlink('resetLang', "type={$type}&module={$module}&language={$language}&confirm=yes")));
if($confirm == 'no') return print(js::confirm($this->lang->dev->confirmRestore, inlink('resetLang', "type={$type}&module={$module}&method={$method}&language={$language}&confirm=yes")));
$language = str_replace('_', '-', $language);
$section = '';
if($type == 'common') $section = '&section=';
if($type == 'first') $section = '&section=mainNav';
if($type == 'common') $section = '&section=';
if($type == 'first') $section = '&section=mainNav';
if($type == 'feature') $section = str_replace('_', '-', "&section=featureBar-{$method}");
$this->loadModel('custom')->deleteItems("lang={$language}&module={$module}&vision={$this->config->vision}{$section}");
if($type == 'common' and $this->config->custom->URSR)
{

View File

@@ -80,7 +80,7 @@
</div>
<div class="bottom-btn">
<?php echo html::submitButton(); ?>
<?php echo html::a(inlink('resetLang', "type={$type}&module={$moduleName}&language={$language}"), $lang->restore, 'hiddenwin', "id='reset' class='btn btn-wide ml-20'");?>
<?php echo html::a(inlink('resetLang', "type={$type}&module={$moduleName}&method={$method}&language={$language}"), $lang->restore, 'hiddenwin', "id='reset' class='btn btn-wide ml-20'");?>
</div>
</form>
</div>