Merge branch 'develop' into next

This commit is contained in:
Kijin Sung 2020-08-29 23:53:31 +09:00
commit ffe9cda5e0
37 changed files with 2047 additions and 1931 deletions

View file

@ -16,7 +16,6 @@ class autoinstallAdminController extends autoinstall
*/
function init()
{
}
/**
@ -75,7 +74,11 @@ class autoinstallAdminController extends autoinstall
'ssl_verify_peer' => FALSE,
'ssl_verify_host' => FALSE
);
$buff = FileHandler::getRemoteResource(_XE_DOWNLOAD_SERVER_, $body, 3, "POST", "application/xml", array(), array(), array(), $request_config);
$oAdminModel = getAdminModel('autoinstall');
$config = $oAdminModel->getAutoInstallAdminModuleConfig();
$buff = FileHandler::getRemoteResource($config->download_server, $body, 3, "POST", "application/xml", array(), array(), array(), $request_config);
$xml = new XmlParser();
$xmlDoc = $xml->parse($buff);
$this->updateCategory($xmlDoc);
@ -224,7 +227,10 @@ class autoinstallAdminController extends autoinstall
$oModuleInstaller = new FTPModuleInstaller($package);
}
$oModuleInstaller->setServerUrl(_XE_DOWNLOAD_SERVER_);
$oAdminModel = getAdminModel('autoinstall');
$config = $oAdminModel->getAutoInstallAdminModuleConfig();
$oModuleInstaller->setServerUrl($config->download_server);
$oModuleInstaller->setPassword($ftp_password);
$output = $oModuleInstaller->install();
if(!$output->toBool())
@ -397,7 +403,10 @@ class autoinstallAdminController extends autoinstall
$oModuleInstaller = new FTPModuleInstaller($package);
}
$oModuleInstaller->setServerUrl(_XE_DOWNLOAD_SERVER_);
$oAdminModel = getAdminModel('autoinstall');
$config = $oAdminModel->getAutoInstallAdminModuleConfig();
$oModuleInstaller->setServerUrl($config->download_server);
$oModuleInstaller->setPassword($ftp_password);
$output = $oModuleInstaller->uninstall();
@ -413,6 +422,39 @@ class autoinstallAdminController extends autoinstall
return new BaseObject();
}
function procAutoinstallAdminInsertConfig()
{
// if end of string does not have a slash, add it
$_location_site = Context::get('location_site');
if(substr($_location_site, -1) != '/' && strlen($_location_site) > 0)
{
$_location_site .= '/';
}
$_download_server = Context::get('download_server');
if(substr($_download_server, -1) != '/' && strlen($_download_server) > 0)
{
$_download_server .= '/';
}
$args = new stdClass();
$args->location_site = $_location_site;
$args->download_server = $_download_server;
$oModuleController = getController('module');
$output = $oModuleController->updateModuleConfig('autoinstall', $args);
// init. DB tables
executeQuery("autoinstall.deletePackages");
executeQuery("autoinstall.deleteCategory");
executeQuery("autoinstall.deleteInstalledPackage");
// default setting end
$this->setMessage('success_updated');
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAutoinstallAdminConfig');
$this->setRedirectUrl($returnUrl);
}
}
/* End of file autoinstall.admin.controller.php */
/* Location: ./modules/autoinstall/autoinstall.admin.controller.php */

View file

@ -420,6 +420,20 @@ class autoinstallAdminModel extends autoinstall
return new BaseObject();
}
public function getAutoInstallAdminModuleConfig()
{
$oModuleModel = getModel('module');
$config_info = $oModuleModel->getModuleConfig('autoinstall');
$_location_site = 'https://xe1.xpressengine.com/';
$_download_server = 'https://download.xpressengine.com/';
$config = new stdClass();
$config->location_site = $config_info->location_site ? $config_info->location_site : $_location_site;
$config->download_server = $config_info->download_server ? $config_info->download_server : $_download_server;
return $config;
}
}
/* End of file autoinstall.admin.model.php */
/* Location: ./modules/autoinstall/autoinstall.admin.model.php */

View file

@ -27,9 +27,13 @@ class autoinstallAdminView extends autoinstall
*/
function init()
{
$oAdminModel = getAdminModel('autoinstall');
$config = $oAdminModel->getAutoInstallAdminModuleConfig();
Context::set('config', $config);
$template_path = sprintf("%stpl/", $this->module_path);
Context::set('original_site', _XE_LOCATION_SITE_);
Context::set('uri', _XE_DOWNLOAD_SERVER_);
Context::set('original_site', $config->location_site);
Context::set('uri', $config->download_server);
$this->setTemplatePath($template_path);
$ftp_info = Context::getFTPInfo();
@ -192,17 +196,30 @@ class autoinstallAdminView extends autoinstall
$depto = array();
$oAdminModel = getAdminModel('autoinstall');
$config = $oAdminModel->getAutoInstallAdminModuleConfig();
foreach($items as $item)
{
$v = $this->rearrange($item, $targets);
$v->item_screenshot_url = str_replace('./', _XE_DOWNLOAD_SERVER_, $v->item_screenshot_url);
$v->item_screenshot_url = str_replace('./', $config->download_server, $v->item_screenshot_url);
$v->category = $this->categories[$v->category_srl]->title;
$v->url = _XE_LOCATION_SITE_ . '?mid=download&package_srl=' . $v->package_srl;
$v->url = $config->location_site . '?mid=download&package_srl=' . $v->package_srl;
if($packages[$v->package_srl])
{
$v->current_version = $packages[$v->package_srl]->current_version;
$v->need_update = $packages[$v->package_srl]->need_update;
// if version is up
// insert Y
if(version_compare($v->item_version, $v->current_version, '>'))
{
$v->need_update = 'Y';
}
else
{
$v->need_update = 'N';
}
//$v->need_update = $packages[$v->package_srl]->need_update;
$v->type = $oModel->getTypeFromPath($packages[$v->package_srl]->path);
if($this->ftp_set && $v->depfrom)
@ -314,7 +331,11 @@ class autoinstallAdminView extends autoinstall
'ssl_verify_peer' => FALSE,
'ssl_verify_host' => FALSE
);
$buff = FileHandler::getRemoteResource(_XE_DOWNLOAD_SERVER_, $body, 3, "POST", "application/xml", array(), array(), array(), $request_config);
$oAdminModel = getAdminModel('autoinstall');
$config = $oAdminModel->getAutoInstallAdminModuleConfig();
$buff = FileHandler::getRemoteResource($config->download_server, $body, 3, "POST", "application/xml", array(), array(), array(), $request_config);
$xml_lUpdate = new XmlParser();
$xmlDoc = $xml_lUpdate->parse($buff);
if($xmlDoc && $xmlDoc->response->packagelist->item)
@ -366,6 +387,7 @@ class autoinstallAdminView extends autoinstall
Context::set("package", $package);
Context::set('contain_core', $package->contain_core);
Context::set('module_config', $oAdminModel->getAutoInstallAdminModuleConfig());
if(!$_SESSION['ftp_password'])
{
@ -407,7 +429,11 @@ class autoinstallAdminView extends autoinstall
'ssl_verify_peer' => FALSE,
'ssl_verify_host' => FALSE
);
$buff = FileHandler::getRemoteResource(_XE_DOWNLOAD_SERVER_, $body, 3, "POST", "application/xml", array(), array(), array(), $request_config);
$oAdminModel = getAdminModel('autoinstall');
$config = $oAdminModel->getAutoInstallAdminModuleConfig();
$buff = FileHandler::getRemoteResource($config->download_server, $body, 3, "POST", "application/xml", array(), array(), array(), $request_config);
$xml_lUpdate = new XmlParser();
$lUpdateDoc = $xml_lUpdate->parse($buff);
$updateDate = $lUpdateDoc->response->updatedate->body;
@ -558,7 +584,11 @@ class autoinstallAdminView extends autoinstall
'ssl_verify_peer' => FALSE,
'ssl_verify_host' => FALSE
);
$buff = FileHandler::getRemoteResource(_XE_DOWNLOAD_SERVER_, $body, 3, "POST", "application/xml", array(), array(), array(), $request_config);
$oAdminModel = getAdminModel('autoinstall');
$config = $oAdminModel->getAutoInstallAdminModuleConfig();
$buff = FileHandler::getRemoteResource($config->download_server, $body, 3, "POST", "application/xml", array(), array(), array(), $request_config);
$xml_lUpdate = new XmlParser();
$xmlDoc = $xml_lUpdate->parse($buff);
if($xmlDoc && $xmlDoc->response->packagelist->item)
@ -583,6 +613,14 @@ class autoinstallAdminView extends autoinstall
}
}
/**
* Display config
*
*/
function dispAutoinstallAdminConfig()
{
$this->setTemplateFile('config');
}
}
/* End of file autoinstall.admin.view.php */
/* Location: ./modules/autoinstall/autoinstall.admin.view.php */

View file

@ -44,7 +44,13 @@ class XmlGenerater
'ssl_verify_peer' => FALSE,
'ssl_verify_host' => FALSE
);
$buff = FileHandler::getRemoteResource(_XE_DOWNLOAD_SERVER_, $body, 3, "POST", "application/xml", array(), array(), array(), $request_config);
$oModuleModel = getModel('module');
$module_info = $oModuleModel->getModuleConfig('autoinstall');
$location_site = $module_info->location_site;
$download_server = $module_info->download_server;
$buff = FileHandler::getRemoteResource($download_server, $body, 3, "POST", "application/xml", array(), array(), array(), $request_config);
if(!$buff)
{
return;

View file

@ -6,16 +6,20 @@
<action name="dispAutoinstallAdminInstall" type="view" menu_name="easyInstall" />
<action name="dispAutoinstallAdminUninstall" type="view" menu_name="easyInstall" />
<action name="dispAutoinstallAdminInstalledPackages" type="view" menu_name="easyInstall" />
<action name="dispAutoinstallAdminConfig" type="view" menu_name="easyInstall" />
<action name="getAutoinstallAdminMenuPackageList" type="model" />
<action name="getAutoinstallAdminLayoutPackageList" type="model" />
<action name="getAutoinstallAdminSkinPackageList" type="model" />
<action name="getAutoinstallAdminIsAuthed" type="model" />
<action name="getAutoInstallAdminInstallInfo" type="model" />
<action name="getAutoInstallAdminModuleConfig" type="model" />
<action name="procAutoinstallAdminUpdateinfo" type="controller" />
<action name="procAutoinstallAdminPackageinstall" type="controller" ruleset="ftp" />
<action name="procAutoinstallAdminUninstallPackage" type="controller" ruleset="ftp" />
<action name="procAutoinstallAdminInsertConfig" type="controller" />
</actions>
<menus>
<menu name="easyInstall">

View file

@ -53,3 +53,8 @@ $lang->typename['m.skin'] = 'Mobile Skin';
$lang->typename['skin'] = 'Skin';
$lang->typename['widgetstyle'] = 'Widget style';
$lang->typename['style'] = 'Document style';
$lang->location_site = 'Download Homepage';
$lang->about_location_site = 'Please type your download homepage. ex)https://xe1.xpressengine.com/';
$lang->download_server = 'Download Server';
$lang->about_download_server = 'Please type your download server. ex)https://download.xpressengine.com/';

View file

@ -55,3 +55,9 @@ $lang->typename['m.skin'] = '모바일 스킨';
$lang->typename['skin'] = '스킨';
$lang->typename['widgetstyle'] = '위젯스타일';
$lang->typename['style'] = '문서스타일';
$lang->location_site = '다운로드 홈페이지';
$lang->about_location_site = '다운로드 홈페이지를 입력해 주세요. 예)https://xe1.xpressengine.com/';
$lang->download_server = '다운로드 서버';
$lang->about_download_server = '다운로드 서버를 입력해 주세요. 예)https://download.xpressengine.com/';

View file

@ -0,0 +1,5 @@
<query id="deletePackages" action="delete">
<tables>
<table name="autoinstall_packages" />
</tables>
</query>

View file

@ -1,6 +1,7 @@
<ul class="x_nav x_nav-tabs">
<li class="x_active"|cond="$act == 'dispAutoinstallAdminIndex'"><a href="{getUrl('', 'module', 'admin', 'act', 'dispAutoinstallAdminIndex')}">{lang('all')} ({$tCount})</a></li>
<li class="x_active"|cond="$act == 'dispAutoinstallAdminInstalledPackages'"><a href="{getUrl('', 'module', 'admin', 'act', 'dispAutoinstallAdminInstalledPackages')}">Installed({$iCount})</a></li>
<li class="x_active"|cond="$act == 'dispAutoinstallAdminConfig'"><a href="{getUrl('', 'module', 'admin', 'act', 'dispAutoinstallAdminConfig')}">{lang('cmd_setup')}</a></li>
</ul>
<nav cond="$act == 'dispAutoinstallAdminIndex'" class="x_thumbnail x_clearfix category">

View file

@ -0,0 +1,36 @@
<include target="header.html" />
<include target="category.html" />
{@
$from_id = array(
'modules/autoinstall/tpl/config/1' => 1
);
}
<div cond="$XE_VALIDATOR_MESSAGE && isset($from_id[$XE_VALIDATOR_ID])" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
<p>{$XE_VALIDATOR_MESSAGE}</p>
</div>
<form action="./" class="x_form-horizontal" ruleset="insert_config" method="post">
<input type="hidden" name="module" value="autoinstall" />
<input type="hidden" name="act" value="procAutoinstallAdminInsertConfig" />
<input type="hidden" name="success_return_url" value="{getUrl('', 'module', 'admin', 'act', $act)}" />
<input type="hidden" name="xe_validator_id" value="modules/autoinstall/tpl/config/1" />
<div class="x_control-group">
<label class="x_control-label" for="location_site">{$lang->location_site}</label>
<div class="x_controls">
<input type="url" id="location_site" name="location_site" style="min-width:90%" value="{$config->location_site}" />
<p class="x_help-block">{$lang->about_location_site}</p>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label" for="download_server">{$lang->download_server}</label>
<div class="x_controls">
<input type="url" id="download_server" name="download_server" style="min-width:90%" value="{$config->download_server}" />
<p class="x_help-block">{$lang->about_download_server}</p>
</div>
</div>
<div class="x_clearfix btnArea">
<span class="x_pull-right"><input class="x_btn x_btn-primary" type="submit" value="{$lang->cmd_save}" /></span>
</div>
</form>

View file

@ -1,6 +1,7 @@
<filter name="insert_config" module="autoinstall" act="procAutoinstallAdminInsertConfig" confirm_msg_code="confirm_submit">
<form>
<node target="ftp_root_path" required="true" />
<node target="location_site" required="true" />
<node target="download_server" required="true" />
</form>
<response>
<tag name="error" />

View file

@ -29,7 +29,7 @@
<block cond="$dep->installed">{$lang->current_version}: {$dep->cur_version} <block cond="$dep->need_update">({$lang->require_update})</block></block>
<block cond="!$dep->installed">{$lang->require_installation}</block>
<block cond="$show_ftp_note && ($dep->need_update || !$dep->installed)">
<a href="{_XE_DOWNLOAD_SERVER_}?module=resourceapi&act=procResourceapiDownload&package_srl={$dep->package_srl}">{$lang->cmd_download}</a> ({$lang->path}: {$dep->path})
<a href="{$module_config->download_server}?module=resourceapi&act=procResourceapiDownload&package_srl={$dep->package_srl}">{$lang->cmd_download}</a> ({$lang->path}: {$dep->path})
</block>
</li>
</ul>
@ -46,7 +46,7 @@
<block cond="$show_ftp_note" >
<p>{$lang->description_download}. (<a href="{getUrl('', 'module', 'admin', 'act', 'dispAdminConfigFtp')}">FTP Setup</a>)</p>
<p>{$lang->path}: {$package->path}</p>
<p><a class="x_btn x_btn-primary x_pull-right" href="{_XE_DOWNLOAD_SERVER_}?module=resourceapi&act=procResourceapiDownload&package_srl={$package->package_srl}">{$lang->cmd_download}</a>
<p><a class="x_btn x_btn-primary x_pull-right" href="{$module_config->download_server}?module=resourceapi&act=procResourceapiDownload&package_srl={$package->package_srl}">{$lang->cmd_download}</a>
</block>
</div>
<div cond="!$show_ftp_note">