mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 17:21:39 +09:00
Add domain copy function
This commit is contained in:
parent
7dd9330b1e
commit
04b7f2e677
5 changed files with 131 additions and 4 deletions
|
|
@ -1035,13 +1035,27 @@ class adminAdminController extends admin
|
|||
$domain_info = null;
|
||||
if ($domain_srl !== '')
|
||||
{
|
||||
$domain_info = getModel('module')->getSiteInfo($domain_srl);
|
||||
if ($domain_info->domain_srl != $domain_srl)
|
||||
$domain_info = ModuleModel::getSiteInfo(intval($domain_srl));
|
||||
if ($domain_info->domain_srl !== intval($domain_srl))
|
||||
{
|
||||
throw new Rhymix\Framework\Exception('msg_domain_not_found');
|
||||
}
|
||||
}
|
||||
|
||||
// Copying?
|
||||
if (!$domain_info && intval($vars->copy_domain_srl) > -1)
|
||||
{
|
||||
$copy_domain_info = ModuleModel::getSiteInfo(intval($vars->copy_domain_srl));
|
||||
if (!$copy_domain_info || $copy_domain_info->domain_srl !== intval($vars->copy_domain_srl))
|
||||
{
|
||||
throw new Rhymix\Framework\Exception('msg_domain_not_found');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$copy_domain_info = null;
|
||||
}
|
||||
|
||||
// Validate the title and subtitle.
|
||||
$vars->title = utf8_trim($vars->title);
|
||||
$vars->subtitle = utf8_trim($vars->subtitle);
|
||||
|
|
@ -1223,19 +1237,58 @@ class adminAdminController extends admin
|
|||
}
|
||||
}
|
||||
|
||||
// Save the favicon, mobicon, and default image.
|
||||
// Save or copy the favicon.
|
||||
if ($vars->favicon || $vars->delete_favicon)
|
||||
{
|
||||
$this->_saveFavicon($domain_srl, $vars->favicon, 'favicon.ico', $vars->delete_favicon);
|
||||
}
|
||||
elseif ($copy_domain_info)
|
||||
{
|
||||
$source_filename = \RX_BASEDIR . 'files/attach/xeicon/' . ($copy_domain_info->domain_srl ? ($copy_domain_info->domain_srl . '/') : '') . 'favicon.ico';
|
||||
$target_filename = \RX_BASEDIR . 'files/attach/xeicon/' . $domain_srl . '/' . 'favicon.ico';
|
||||
Rhymix\Framework\Storage::copy($source_filename, $target_filename);
|
||||
}
|
||||
|
||||
// Save or copy the mobile icon.
|
||||
if ($vars->mobicon || $vars->delete_mobicon)
|
||||
{
|
||||
$this->_saveFavicon($domain_srl, $vars->mobicon, 'mobicon.png', $vars->delete_mobicon);
|
||||
}
|
||||
elseif ($copy_domain_info)
|
||||
{
|
||||
$source_filename = \RX_BASEDIR . 'files/attach/xeicon/' . ($copy_domain_info->domain_srl ? ($copy_domain_info->domain_srl . '/') : '') . 'mobicon.png';
|
||||
$target_filename = \RX_BASEDIR . 'files/attach/xeicon/' . $domain_srl . '/' . 'mobicon.png';
|
||||
Rhymix\Framework\Storage::copy($source_filename, $target_filename);
|
||||
}
|
||||
|
||||
// Save or copy the site default image.
|
||||
if ($vars->default_image || $vars->delete_default_image)
|
||||
{
|
||||
$this->_saveDefaultImage($domain_srl, $vars->default_image, $vars->delete_default_image);
|
||||
}
|
||||
elseif ($copy_domain_info)
|
||||
{
|
||||
$source_filename = \RX_BASEDIR . 'files/attach/xeicon/' . ($copy_domain_info->domain_srl ? ($copy_domain_info->domain_srl . '/') : '') . 'default_image.php';
|
||||
$target_filename = \RX_BASEDIR . 'files/attach/xeicon/' . $domain_srl . '/' . 'default_image.php';
|
||||
if (Rhymix\Framework\Storage::copy($source_filename, $target_filename))
|
||||
{
|
||||
$info = Rhymix\Framework\Storage::readPHPData($target_filename);
|
||||
if ($info && $info['filename'])
|
||||
{
|
||||
$source_image = \RX_BASEDIR . $info['filename'];
|
||||
$target_image = \RX_BASEDIR . 'files/attach/xeicon/' . $domain_srl . '/' . basename($info['filename']);
|
||||
if (Rhymix\Framework\Storage::copy($source_image, $target_image))
|
||||
{
|
||||
$info['filename'] = substr($target_image, strlen(\RX_BASEDIR));
|
||||
$info = Rhymix\Framework\Storage::writePHPData($target_filename, $info);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Rhymix\Framework\Storage::delete($target_filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update system configuration to match the default domain.
|
||||
if ($domain_info && $domain_info->is_default_domain === 'Y')
|
||||
|
|
|
|||
|
|
@ -702,6 +702,7 @@ class adminAdminView extends admin
|
|||
}
|
||||
}
|
||||
Context::set('domain_info', $domain_info);
|
||||
Context::set('domain_copy', false);
|
||||
|
||||
// Get modules.
|
||||
if ($domain_info && $domain_info->index_module_srl)
|
||||
|
|
@ -752,6 +753,75 @@ class adminAdminView extends admin
|
|||
$this->setTemplateFile('config_domains_edit');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display domain copy screen
|
||||
* @return void
|
||||
*/
|
||||
function dispAdminCopyDomain()
|
||||
{
|
||||
// Get selected domain.
|
||||
$domain_srl = strval(Context::get('domain_srl'));
|
||||
$domain_info = ModuleModel::getSiteInfo($domain_srl);
|
||||
if ($domain_info->domain_srl != $domain_srl)
|
||||
{
|
||||
throw new Rhymix\Framework\Exception('msg_domain_not_found');
|
||||
}
|
||||
|
||||
// Adjust some properties for copying.
|
||||
$domain_info->domain_srl = null;
|
||||
$domain_info->is_default_domain = 'N';
|
||||
Context::set('domain_info', $domain_info);
|
||||
Context::set('domain_copy', true);
|
||||
|
||||
// Get modules.
|
||||
if ($domain_info && $domain_info->index_module_srl)
|
||||
{
|
||||
$index_module_srl = $domain_info->index_module_srl;
|
||||
}
|
||||
else
|
||||
{
|
||||
$index_module_srl = '';
|
||||
}
|
||||
Context::set('index_module_srl', $index_module_srl);
|
||||
|
||||
// Get language list.
|
||||
Context::set('supported_lang', Rhymix\Framework\Lang::getSupportedList());
|
||||
Context::set('enabled_lang', Rhymix\Framework\Config::get('locale.enabled_lang'));
|
||||
if ($domain_info && $domain_info->settings->language)
|
||||
{
|
||||
$domain_lang = $domain_info->settings->language;
|
||||
}
|
||||
else
|
||||
{
|
||||
$domain_lang = 'default';
|
||||
}
|
||||
Context::set('domain_lang', $domain_lang);
|
||||
|
||||
// Get timezone list.
|
||||
Context::set('timezones', Rhymix\Framework\DateTime::getTimezoneList());
|
||||
if ($domain_info && $domain_info->settings->timezone)
|
||||
{
|
||||
$domain_timezone = $domain_info->settings->timezone;
|
||||
}
|
||||
else
|
||||
{
|
||||
$domain_timezone = Rhymix\Framework\Config::get('locale.default_timezone');
|
||||
}
|
||||
Context::set('domain_timezone', $domain_timezone);
|
||||
|
||||
// Get favicon and images.
|
||||
if ($domain_info)
|
||||
{
|
||||
$oAdminAdminModel = getAdminModel('admin');
|
||||
Context::set('favicon_url', $oAdminAdminModel->getFaviconUrl($domain_srl));
|
||||
Context::set('mobicon_url', $oAdminAdminModel->getMobileIconUrl($domain_srl));
|
||||
Context::set('default_image_url', $oAdminAdminModel->getSiteDefaultImageUrl($domain_srl));
|
||||
Context::set('color_scheme', $domain_info->settings->color_scheme ?? 'auto');
|
||||
}
|
||||
|
||||
$this->setTemplateFile('config_domains_edit');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display FTP Configuration(settings) page
|
||||
* @return void
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
<action name="dispAdminConfigSEO" type="view" menu_name="adminConfigurationGeneral" />
|
||||
<action name="dispAdminConfigSitelock" type="view" menu_name="adminConfigurationGeneral" />
|
||||
<action name="dispAdminInsertDomain" type="view" menu_name="adminConfigurationGeneral" />
|
||||
<action name="dispAdminCopyDomain" type="view" menu_name="adminConfigurationGeneral" />
|
||||
<action name="dispAdminConfigFtp" type="view" menu_name="adminConfigurationFtp" menu_index="true" />
|
||||
<action name="dispAdminSetup" type="view" menu_name="adminMenuSetup" menu_index="true" />
|
||||
<action name="dispAdminViewServerEnv" type="view" />
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
<th scope="col" class="nowr rx_detail_marks">{$lang->use_ssl}</th>
|
||||
<th scope="col" class="nowr rx_detail_marks">{$lang->cmd_index_module_srl}</th>
|
||||
<th scope="col" class="nowr rx_detail_marks">{$lang->cmd_index_document_srl}</th>
|
||||
<th scope="col" class="nowr">{$lang->cmd_modify} / {$lang->cmd_delete}</th>
|
||||
<th scope="col" class="nowr">{$lang->cmd_modify} / {$lang->cmd_delete} / {$lang->cmd_copy}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
|
@ -51,6 +51,8 @@
|
|||
<block cond="$domain->is_default_domain === 'Y'">
|
||||
<span style="color:#aaa">{$lang->cmd_delete}</span>
|
||||
</block>
|
||||
/
|
||||
<a href="{getUrl('', 'module', 'admin', 'act', 'dispAdminCopyDomain', 'domain_srl', $domain->domain_srl)}">{$lang->cmd_copy}</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr cond="$page_navigation->total_count == 0">
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
<input type="hidden" name="act" value="procAdminInsertDomain" />
|
||||
<input type="hidden" name="xe_validator_id" value="modules/admin/tpl/config_domains_edit/1" />
|
||||
<input type="hidden" name="domain_srl" value="{$domain_info ? $domain_info->domain_srl : ''}" />
|
||||
<input type="hidden" name="copy_domain_srl" value="{$domain_copy ? $domain_srl : -1}" />
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label">{$lang->site_title}</label>
|
||||
<div class="x_controls">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue