mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-06 10:11:38 +09:00
Merge branch 'pr/extra-content' into develop
This commit is contained in:
commit
a840e26b71
1 changed files with 34 additions and 30 deletions
|
|
@ -903,44 +903,45 @@ class documentController extends document
|
|||
$obj->content = getModel('editor')->converter($obj, 'document');
|
||||
}
|
||||
|
||||
// Change not extra vars but language code of the original document if document's lang_code is different from author's setting.
|
||||
if($source_obj->get('lang_code') != Context::getLangType())
|
||||
{
|
||||
// Change not extra vars but language code of the original document if document's lang_code doesn't exist.
|
||||
if(!$source_obj->get('lang_code'))
|
||||
{
|
||||
$lang_code_args = new stdClass();
|
||||
$lang_code_args->document_srl = $source_obj->get('document_srl');
|
||||
$lang_code_args->lang_code = Context::getLangType();
|
||||
$output = executeQuery('document.updateDocumentsLangCode', $lang_code_args);
|
||||
}
|
||||
else
|
||||
{
|
||||
$extra_content = new stdClass;
|
||||
$extra_content->title = $obj->title;
|
||||
$extra_content->content = $obj->content;
|
||||
|
||||
$document_args = new stdClass;
|
||||
$document_args->document_srl = $source_obj->get('document_srl');
|
||||
$document_output = executeQuery('document.getDocument', $document_args);
|
||||
$obj->title = $document_output->data->title;
|
||||
$obj->content = $document_output->data->content;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove iframe and script if not a top adminisrator in the session.
|
||||
if($logged_info->is_admin != 'Y')
|
||||
{
|
||||
$obj->content = removeHackTag($obj->content);
|
||||
}
|
||||
|
||||
// if temporary document, regdate is now setting
|
||||
if($source_obj->get('status') == $this->getConfigStatus('temp')) $obj->regdate = date('YmdHis');
|
||||
|
||||
// Fix encoding of non-BMP UTF-8 characters.
|
||||
$obj->title = utf8_mbencode($obj->title);
|
||||
$obj->content = utf8_mbencode($obj->content);
|
||||
|
||||
// Set lang_code if the original document doesn't have it.
|
||||
if (!$source_obj->get('lang_code'))
|
||||
{
|
||||
$output = executeQuery('document.updateDocumentsLangCode', [
|
||||
'document_srl' => $source_obj->get('document_srl'),
|
||||
'lang_code' => Context::getLangType(),
|
||||
]);
|
||||
}
|
||||
// Move content to extra vars if the current language is different from the original document's lang_code.
|
||||
elseif ($source_obj->get('lang_code') !== Context::getLangType())
|
||||
{
|
||||
$extra_content = new stdClass;
|
||||
$extra_content->title = $obj->title;
|
||||
$extra_content->content = $obj->content;
|
||||
|
||||
$document_output = executeQuery('document.getDocument', ['document_srl' => $source_obj->get('document_srl')], ['title', 'content']);
|
||||
if (isset($document_output->data->title))
|
||||
{
|
||||
$obj->title = $document_output->data->title;
|
||||
$obj->content = $document_output->data->content;
|
||||
}
|
||||
}
|
||||
|
||||
// if temporary document, regdate is now setting
|
||||
if ($source_obj->get('status') == $this->getConfigStatus('temp'))
|
||||
{
|
||||
$obj->regdate = date('YmdHis');
|
||||
}
|
||||
|
||||
// Insert data into the DB
|
||||
$output = executeQuery('document.updateDocument', $obj);
|
||||
if(!$output->toBool())
|
||||
|
|
@ -977,8 +978,11 @@ class documentController extends document
|
|||
}
|
||||
|
||||
// Inert extra vars for multi-language support of title and contents.
|
||||
if($extra_content->title) $this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, -1, $extra_content->title, 'title_'.Context::getLangType());
|
||||
if($extra_content->content) $this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, -2, $extra_content->content, 'content_'.Context::getLangType());
|
||||
if (isset($extra_content))
|
||||
{
|
||||
$this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, -1, $extra_content->title, 'title_'.Context::getLangType());
|
||||
$this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, -2, $extra_content->content, 'content_'.Context::getLangType());
|
||||
}
|
||||
}
|
||||
|
||||
// Update the category if the category_srl exists.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue