mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-01 08:12:17 +09:00
issue 2662 install, integration_search
git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@12249 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
e7177034b3
commit
9aefe700b6
10 changed files with 1720 additions and 1577 deletions
|
|
@ -1,294 +1,314 @@
|
|||
<?php
|
||||
/**
|
||||
* @class installAdminController
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief admin controller class of the install module
|
||||
**/
|
||||
/**
|
||||
* @class installAdminController
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief admin controller class of the install module
|
||||
*/
|
||||
class installAdminController extends install
|
||||
{
|
||||
/**
|
||||
* @brief Initialization
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
}
|
||||
|
||||
class installAdminController extends install {
|
||||
/**
|
||||
* @brief Install the module
|
||||
*/
|
||||
function procInstallAdminInstall()
|
||||
{
|
||||
$module_name = Context::get('module_name');
|
||||
if(!$module_name) return new object(-1, 'invalid_request');
|
||||
|
||||
$oInstallController = &getController('install');
|
||||
$oInstallController->installModule($module_name, './modules/'.$module_name);
|
||||
|
||||
/**
|
||||
* @brief Initialization
|
||||
**/
|
||||
function init() {
|
||||
}
|
||||
$this->setMessage('success_installed');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Install the module
|
||||
**/
|
||||
function procInstallAdminInstall() {
|
||||
$module_name = Context::get('module_name');
|
||||
if(!$module_name) return new object(-1, 'invalid_request');
|
||||
/**
|
||||
* @brief Upate the module
|
||||
*/
|
||||
function procInstallAdminUpdate()
|
||||
{
|
||||
set_time_limit(0);
|
||||
$module_name = Context::get('module_name');
|
||||
if(!$module_name) return new object(-1, 'invalid_request');
|
||||
|
||||
$oInstallController = &getController('install');
|
||||
$oInstallController->installModule($module_name, './modules/'.$module_name);
|
||||
$oModule = &getModule($module_name, 'class');
|
||||
if($oModule) $output = $oModule->moduleUpdate();
|
||||
else $output = new Object(-1, 'invalid_request');
|
||||
|
||||
$this->setMessage('success_installed');
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Upate the module
|
||||
**/
|
||||
function procInstallAdminUpdate() {
|
||||
set_time_limit(0);
|
||||
$module_name = Context::get('module_name');
|
||||
if(!$module_name) return new object(-1, 'invalid_request');
|
||||
/**
|
||||
* @brief Change settings
|
||||
*/
|
||||
function procInstallAdminSaveTimeZone()
|
||||
{
|
||||
$admin_ip_list = Context::get('admin_ip_list');
|
||||
|
||||
$oModule = &getModule($module_name, 'class');
|
||||
if($oModule) $output = $oModule->moduleUpdate();
|
||||
else $output = new Object(-1, 'invalid_request');
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Change settings
|
||||
**/
|
||||
function procInstallAdminSaveTimeZone() {
|
||||
$admin_ip_list = Context::get('admin_ip_list');
|
||||
|
||||
$admin_ip_list = preg_replace("/[\r|\n|\r\n]+/",",",$admin_ip_list);
|
||||
$admin_ip_list = preg_replace("/\s+/","",$admin_ip_list);
|
||||
if(preg_match('/(<\?|<\?php|\?>)/xsm', $admin_ip_list))
|
||||
{
|
||||
$admin_ip_list = '';
|
||||
}
|
||||
|
||||
$default_url = Context::get('default_url');
|
||||
if($default_url && !preg_match('/^(http|https):\/\//i', $default_url)) $default_url = 'http://'.$default_url;
|
||||
|
||||
$use_ssl = Context::get('use_ssl');
|
||||
if(!$use_ssl) $use_ssl = 'none';
|
||||
|
||||
$http_port = Context::get('http_port');
|
||||
$https_port = Context::get('https_port');
|
||||
|
||||
$use_cdn = Context::get('use_cdn');
|
||||
if($use_cdn != 'Y') $use_cdn = 'N';
|
||||
|
||||
$use_rewrite = Context::get('use_rewrite');
|
||||
if($use_rewrite!='Y') $use_rewrite = 'N';
|
||||
|
||||
$use_sso = Context::get('use_sso');
|
||||
if($use_sso !='Y') $use_sso = 'N';
|
||||
|
||||
$use_db_session = Context::get('use_db_session');
|
||||
if($use_db_session!='Y') $use_db_session = 'N';
|
||||
|
||||
$qmail_compatibility = Context::get('qmail_compatibility');
|
||||
if($qmail_compatibility!='Y') $qmail_compatibility = 'N';
|
||||
|
||||
$use_html5 = Context::get('use_html5');
|
||||
if(!$use_html5) $use_html5 = 'N';
|
||||
|
||||
$db_info = Context::getDBInfo();
|
||||
$db_info->default_url = $default_url;
|
||||
$db_info->qmail_compatibility = $qmail_compatibility;
|
||||
$db_info->use_db_session = $use_db_session;
|
||||
$db_info->use_rewrite = $use_rewrite;
|
||||
$db_info->use_sso = $use_sso;
|
||||
$db_info->use_ssl = $use_ssl;
|
||||
$db_info->use_cdn = $use_cdn;
|
||||
$db_info->use_html5 = $use_html5;
|
||||
$db_info->admin_ip_list = $admin_ip_list;
|
||||
|
||||
if($http_port) $db_info->http_port = (int) $http_port;
|
||||
else if($db_info->http_port) unset($db_info->http_port);
|
||||
|
||||
if($https_port) $db_info->https_port = (int) $https_port;
|
||||
else if($db_info->https_port) unset($db_info->https_port);
|
||||
|
||||
unset($db_info->lang_type);
|
||||
|
||||
Context::setDBInfo($db_info);
|
||||
|
||||
$oInstallController = &getController('install');
|
||||
$oInstallController->makeConfigFile();
|
||||
|
||||
if($default_url)
|
||||
{
|
||||
$site_args->site_srl = 0;
|
||||
$site_args->domain = $default_url;
|
||||
$oModuleController = &getController('module');
|
||||
$oModuleController->updateSite($site_args);
|
||||
}
|
||||
$this->setRedirectUrl(Context::get('error_return_url'));
|
||||
}
|
||||
|
||||
function procInstallAdminUpdateIndexModule()
|
||||
$admin_ip_list = preg_replace("/[\r|\n|\r\n]+/",",",$admin_ip_list);
|
||||
$admin_ip_list = preg_replace("/\s+/","",$admin_ip_list);
|
||||
if(preg_match('/(<\?|<\?php|\?>)/xsm', $admin_ip_list))
|
||||
{
|
||||
if(!Context::get('index_module_srl') || !Context::get('menu_item_srl'))
|
||||
{
|
||||
return new Object(-1, 'msg_invalid_request');
|
||||
}
|
||||
$admin_ip_list = '';
|
||||
}
|
||||
|
||||
$default_url = Context::get('default_url');
|
||||
if($default_url && !preg_match('/^(http|https):\/\//i', $default_url)) $default_url = 'http://'.$default_url;
|
||||
|
||||
$use_ssl = Context::get('use_ssl');
|
||||
if(!$use_ssl) $use_ssl = 'none';
|
||||
|
||||
$http_port = Context::get('http_port');
|
||||
$https_port = Context::get('https_port');
|
||||
|
||||
$use_cdn = Context::get('use_cdn');
|
||||
if($use_cdn != 'Y') $use_cdn = 'N';
|
||||
|
||||
$use_rewrite = Context::get('use_rewrite');
|
||||
if($use_rewrite!='Y') $use_rewrite = 'N';
|
||||
|
||||
$use_sso = Context::get('use_sso');
|
||||
if($use_sso !='Y') $use_sso = 'N';
|
||||
|
||||
$use_db_session = Context::get('use_db_session');
|
||||
if($use_db_session!='Y') $use_db_session = 'N';
|
||||
|
||||
$qmail_compatibility = Context::get('qmail_compatibility');
|
||||
if($qmail_compatibility!='Y') $qmail_compatibility = 'N';
|
||||
|
||||
$use_html5 = Context::get('use_html5');
|
||||
if(!$use_html5) $use_html5 = 'N';
|
||||
|
||||
$db_info = Context::getDBInfo();
|
||||
$db_info->default_url = $default_url;
|
||||
$db_info->qmail_compatibility = $qmail_compatibility;
|
||||
$db_info->use_db_session = $use_db_session;
|
||||
$db_info->use_rewrite = $use_rewrite;
|
||||
$db_info->use_sso = $use_sso;
|
||||
$db_info->use_ssl = $use_ssl;
|
||||
$db_info->use_cdn = $use_cdn;
|
||||
$db_info->use_html5 = $use_html5;
|
||||
$db_info->admin_ip_list = $admin_ip_list;
|
||||
|
||||
if($http_port) $db_info->http_port = (int) $http_port;
|
||||
else if($db_info->http_port) unset($db_info->http_port);
|
||||
|
||||
if($https_port) $db_info->https_port = (int) $https_port;
|
||||
else if($db_info->https_port) unset($db_info->https_port);
|
||||
|
||||
unset($db_info->lang_type);
|
||||
|
||||
Context::setDBInfo($db_info);
|
||||
|
||||
$oInstallController = &getController('install');
|
||||
$oInstallController->makeConfigFile();
|
||||
|
||||
if($default_url)
|
||||
{
|
||||
$site_args->site_srl = 0;
|
||||
$site_args->index_module_srl = Context::get('index_module_srl');
|
||||
$site_args->domain = $default_url;
|
||||
$oModuleController = &getController('module');
|
||||
$oModuleController->updateSite($site_args);
|
||||
}
|
||||
$this->setRedirectUrl(Context::get('error_return_url'));
|
||||
}
|
||||
|
||||
// get menu item info
|
||||
$menuItemSrl = Context::get('menu_item_srl');
|
||||
$oMenuAdminModel = &getAdminModel('menu');
|
||||
$output = $oMenuAdminModel->getMenuItemInfo($menuItemSrl);
|
||||
function procInstallAdminUpdateIndexModule()
|
||||
{
|
||||
if(!Context::get('index_module_srl') || !Context::get('menu_item_srl'))
|
||||
{
|
||||
return new Object(-1, 'msg_invalid_request');
|
||||
}
|
||||
|
||||
// update homeSitemap.php cache file
|
||||
$oMenuAdminController = &getAdminController('menu');
|
||||
$homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile();
|
||||
if(file_exists($homeMenuCacheFile))
|
||||
$site_args->site_srl = 0;
|
||||
$site_args->index_module_srl = Context::get('index_module_srl');
|
||||
$oModuleController = &getController('module');
|
||||
$oModuleController->updateSite($site_args);
|
||||
|
||||
// get menu item info
|
||||
$menuItemSrl = Context::get('menu_item_srl');
|
||||
$oMenuAdminModel = &getAdminModel('menu');
|
||||
$output = $oMenuAdminModel->getMenuItemInfo($menuItemSrl);
|
||||
|
||||
// update homeSitemap.php cache file
|
||||
$oMenuAdminController = &getAdminController('menu');
|
||||
$homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile();
|
||||
if(file_exists($homeMenuCacheFile))
|
||||
{
|
||||
@include($homeMenuCacheFile);
|
||||
}
|
||||
|
||||
if(!$homeMenuSrl || $homeMenuSrl != $output->menu_srl)
|
||||
{
|
||||
$oMenuAdminController->makeHomemenuCacheFile($output->menu_srl);
|
||||
}
|
||||
|
||||
$this->setMessage('success_updated');
|
||||
}
|
||||
|
||||
function procInstallAdminRemoveFTPInfo()
|
||||
{
|
||||
$ftp_config_file = Context::getFTPConfigFile();
|
||||
if(file_exists($ftp_config_file)) unlink($ftp_config_file);
|
||||
if($_SESSION['ftp_password']) unset($_SESSION['ftp_password']);
|
||||
$this->setMessage('success_deleted');
|
||||
}
|
||||
|
||||
function procInstallAdminSaveFTPInfo()
|
||||
{
|
||||
$ftp_info = Context::getFTPInfo();
|
||||
$ftp_info->ftp_user = Context::get('ftp_user');
|
||||
$ftp_info->ftp_port = Context::get('ftp_port');
|
||||
$ftp_info->ftp_host = Context::get('ftp_host');
|
||||
$ftp_info->ftp_pasv = Context::get('ftp_pasv');
|
||||
if(!$ftp_info->ftp_pasv) $ftp_info->ftp_pasv = "N";
|
||||
$ftp_info->sftp = Context::get('sftp');
|
||||
|
||||
$ftp_root_path = Context::get('ftp_root_path');
|
||||
if(substr($ftp_root_path, strlen($ftp_root_path)-1) == "/")
|
||||
{
|
||||
$ftp_info->ftp_root_path = $ftp_root_path;
|
||||
}
|
||||
else
|
||||
{
|
||||
$ftp_info->ftp_root_path = $ftp_root_path.'/';
|
||||
}
|
||||
|
||||
if(ini_get('safe_mode'))
|
||||
{
|
||||
$ftp_info->ftp_password = Context::get('ftp_password');
|
||||
}
|
||||
|
||||
$buff = '<?php if(!defined("__ZBXE__")) exit();'."\n";
|
||||
foreach($ftp_info as $key => $val)
|
||||
{
|
||||
if(!$val) continue;
|
||||
if(preg_match('/(<\?|<\?php|\?>)/xsm', preg_replace('/\s/', '', $val)))
|
||||
{
|
||||
@include($homeMenuCacheFile);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!$homeMenuSrl || $homeMenuSrl != $output->menu_srl)
|
||||
{
|
||||
$oMenuAdminController->makeHomemenuCacheFile($output->menu_srl);
|
||||
}
|
||||
|
||||
$this->setMessage('success_updated');
|
||||
$buff .= sprintf("\$ftp_info->%s = '%s';\n", $key, str_replace("'","\\'",$val));
|
||||
}
|
||||
$buff .= "?>";
|
||||
$config_file = Context::getFTPConfigFile();
|
||||
FileHandler::WriteFile($config_file, $buff);
|
||||
if($_SESSION['ftp_password']) unset($_SESSION['ftp_password']);
|
||||
|
||||
function procInstallAdminRemoveFTPInfo() {
|
||||
$ftp_config_file = Context::getFTPConfigFile();
|
||||
if(file_exists($ftp_config_file)) unlink($ftp_config_file);
|
||||
if($_SESSION['ftp_password']) unset($_SESSION['ftp_password']);
|
||||
$this->setMessage('success_deleted');
|
||||
}
|
||||
$this->setMessage('success_updated');
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminConfigFtp');
|
||||
$this->setRedirectUrl($returnUrl);
|
||||
}
|
||||
|
||||
function procInstallAdminSaveFTPInfo() {
|
||||
$ftp_info = Context::getFTPInfo();
|
||||
$ftp_info->ftp_user = Context::get('ftp_user');
|
||||
$ftp_info->ftp_port = Context::get('ftp_port');
|
||||
$ftp_info->ftp_host = Context::get('ftp_host');
|
||||
$ftp_info->ftp_pasv = Context::get('ftp_pasv');
|
||||
if(!$ftp_info->ftp_pasv) $ftp_info->ftp_pasv = "N";
|
||||
$ftp_info->sftp = Context::get('sftp');
|
||||
function procInstallAdminConfig()
|
||||
{
|
||||
$use_mobile_view = Context::get('use_mobile_view');
|
||||
if($use_mobile_view!='Y') $use_mobile_view = 'N';
|
||||
|
||||
$ftp_root_path = Context::get('ftp_root_path');
|
||||
if (substr($ftp_root_path, strlen($ftp_root_path)-1) == "/") {
|
||||
$ftp_info->ftp_root_path = $ftp_root_path;
|
||||
} else {
|
||||
$ftp_info->ftp_root_path = $ftp_root_path.'/';
|
||||
}
|
||||
$time_zone = Context::get('time_zone');
|
||||
|
||||
if(ini_get('safe_mode')) {
|
||||
$ftp_info->ftp_password = Context::get('ftp_password');
|
||||
}
|
||||
$db_info = Context::getDBInfo();
|
||||
$db_info->use_mobile_view = $use_mobile_view;
|
||||
$db_info->time_zone = $time_zone;
|
||||
|
||||
$buff = '<?php if(!defined("__ZBXE__")) exit();'."\n";
|
||||
foreach($ftp_info as $key => $val) {
|
||||
if(!$val) continue;
|
||||
if(preg_match('/(<\?|<\?php|\?>)/xsm', preg_replace('/\s/', '', $val)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$buff .= sprintf("\$ftp_info->%s = '%s';\n", $key, str_replace("'","\\'",$val));
|
||||
}
|
||||
$buff .= "?>";
|
||||
$config_file = Context::getFTPConfigFile();
|
||||
FileHandler::WriteFile($config_file, $buff);
|
||||
if($_SESSION['ftp_password']) unset($_SESSION['ftp_password']);
|
||||
unset($db_info->lang_type);
|
||||
Context::setDBInfo($db_info);
|
||||
$oInstallController = &getController('install');
|
||||
$oInstallController->makeConfigFile();
|
||||
|
||||
$site_args->site_srl = 0;
|
||||
$site_args->index_module_srl = Context::get('index_module_srl');//
|
||||
$site_args->default_language = Context::get('change_lang_type');//
|
||||
$oModuleController = &getController('module');
|
||||
$oModuleController->updateSite($site_args);
|
||||
|
||||
//언어 선택
|
||||
$selected_lang = Context::get('selected_lang');
|
||||
$this->saveLangSelected($selected_lang);
|
||||
|
||||
//모듈 설정 저장(썸네일, 풋터스크립트)
|
||||
$config->thumbnail_type = Context::get('thumbnail_type');
|
||||
$config->htmlFooter = Context::get('htmlFooter');
|
||||
$config->siteTitle = Context::get('site_title');
|
||||
$this->setModulesConfig($config);
|
||||
|
||||
//파비콘
|
||||
$favicon = Context::get('favicon');
|
||||
$this->saveIcon($favicon,'favicon.ico');
|
||||
|
||||
//모바일아이콘
|
||||
$mobicon = Context::get('mobicon');
|
||||
$this->saveIcon($mobicon,'mobicon.png');
|
||||
|
||||
$this->setRedirectUrl(Context::get('error_return_url'));
|
||||
}
|
||||
|
||||
//from procInstallAdminSaveTimeZone
|
||||
/**
|
||||
* @brief Supported languages (was procInstallAdminSaveLangSelected)
|
||||
*/
|
||||
function saveLangSelected($selected_lang)
|
||||
{
|
||||
$langs = $selected_lang;
|
||||
|
||||
$lang_supported = Context::loadLangSupported();
|
||||
$buff = null;
|
||||
for($i=0;$i<count($langs);$i++)
|
||||
{
|
||||
$buff .= sprintf("%s,%s\n", $langs[$i], $lang_supported[$langs[$i]]);
|
||||
|
||||
$this->setMessage('success_updated');
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminConfigFtp');
|
||||
$this->setRedirectUrl($returnUrl);
|
||||
}
|
||||
FileHandler::writeFile(_XE_PATH_.'files/config/lang_selected.info', trim($buff));
|
||||
//$this->setMessage('success_updated');
|
||||
}
|
||||
|
||||
function procInstallAdminConfig(){
|
||||
$use_mobile_view = Context::get('use_mobile_view');
|
||||
if($use_mobile_view!='Y') $use_mobile_view = 'N';
|
||||
|
||||
$time_zone = Context::get('time_zone');
|
||||
/* 썸내일 보여주기 방식 변경.*/
|
||||
function setModulesConfig($config)
|
||||
{
|
||||
|
||||
$db_info = Context::getDBInfo();
|
||||
$db_info->use_mobile_view = $use_mobile_view;
|
||||
$db_info->time_zone = $time_zone;
|
||||
if(!$config->thumbnail_type || $config->thumbnail_type != 'ratio' ) $args->thumbnail_type = 'crop';
|
||||
else $args->thumbnail_type = 'ratio';
|
||||
|
||||
unset($db_info->lang_type);
|
||||
Context::setDBInfo($db_info);
|
||||
$oInstallController = &getController('install');
|
||||
$oInstallController->makeConfigFile();
|
||||
$oModuleController = &getController('module');
|
||||
$oModuleController->insertModuleConfig('document',$args);
|
||||
|
||||
$site_args->site_srl = 0;
|
||||
$site_args->index_module_srl = Context::get('index_module_srl');//
|
||||
$site_args->default_language = Context::get('change_lang_type');//
|
||||
$oModuleController = &getController('module');
|
||||
$oModuleController->updateSite($site_args);
|
||||
unset($args);
|
||||
|
||||
//언어 선택
|
||||
$selected_lang = Context::get('selected_lang');
|
||||
$this->saveLangSelected($selected_lang);
|
||||
$args->htmlFooter = $config->htmlFooter;
|
||||
$args->siteTitle = $config->siteTitle;
|
||||
$oModuleController->insertModuleConfig('module',$args);
|
||||
|
||||
//모듈 설정 저장(썸네일, 풋터스크립트)
|
||||
$config->thumbnail_type = Context::get('thumbnail_type');
|
||||
$config->htmlFooter = Context::get('htmlFooter');
|
||||
$config->siteTitle = Context::get('site_title');
|
||||
$this->setModulesConfig($config);
|
||||
return $output;
|
||||
}
|
||||
|
||||
//파비콘
|
||||
$favicon = Context::get('favicon');
|
||||
$this->saveIcon($favicon,'favicon.ico');
|
||||
function saveIcon($icon,$iconname)
|
||||
{
|
||||
$mobicon_size = array('57','114');
|
||||
$target_file = $icon['tmp_name'];
|
||||
$type = $icon['type'];
|
||||
$target_filename = _XE_PATH_.'files/attach/xeicon/'.$iconname;
|
||||
|
||||
//모바일아이콘
|
||||
$mobicon = Context::get('mobicon');
|
||||
$this->saveIcon($mobicon,'mobicon.png');
|
||||
|
||||
$this->setRedirectUrl(Context::get('error_return_url'));
|
||||
list($width, $height, $type_no, $attrs) = @getimagesize($target_file);
|
||||
if($iconname == 'favicon.ico' && preg_match('/^.*(icon).*$/',$type))
|
||||
{
|
||||
$fitHeight = $fitWidth = '16';
|
||||
}
|
||||
|
||||
//from procInstallAdminSaveTimeZone
|
||||
/**
|
||||
* @brief Supported languages (was procInstallAdminSaveLangSelected)
|
||||
**/
|
||||
function saveLangSelected($selected_lang){
|
||||
$langs = $selected_lang;
|
||||
|
||||
$lang_supported = Context::loadLangSupported();
|
||||
$buff = null;
|
||||
for($i=0;$i<count($langs);$i++) {
|
||||
$buff .= sprintf("%s,%s\n", $langs[$i], $lang_supported[$langs[$i]]);
|
||||
|
||||
}
|
||||
FileHandler::writeFile(_XE_PATH_.'files/config/lang_selected.info', trim($buff));
|
||||
//$this->setMessage('success_updated');
|
||||
else if($iconname == 'mobicon.png' && preg_match('/^.*(png).*$/',$type) && in_array($height,$mobicon_size) && in_array($width,$mobicon_size))
|
||||
{
|
||||
$fitHeight = $fitWidth = $height;
|
||||
}
|
||||
|
||||
/* 썸내일 보여주기 방식 변경.*/
|
||||
function setModulesConfig($config){
|
||||
|
||||
if(!$config->thumbnail_type || $config->thumbnail_type != 'ratio' ) $args->thumbnail_type = 'crop';
|
||||
else $args->thumbnail_type = 'ratio';
|
||||
|
||||
$oModuleController = &getController('module');
|
||||
$oModuleController->insertModuleConfig('document',$args);
|
||||
|
||||
unset($args);
|
||||
|
||||
$args->htmlFooter = $config->htmlFooter;
|
||||
$args->siteTitle = $config->siteTitle;
|
||||
$oModuleController->insertModuleConfig('module',$args);
|
||||
|
||||
return $output;
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
//FileHandler::createImageFile($target_file, $target_filename, $fitHeight, $fitWidth, $ext);
|
||||
FileHandler::copyFile($target_file, $target_filename);
|
||||
}
|
||||
|
||||
function saveIcon($icon,$iconname){
|
||||
$mobicon_size = array('57','114');
|
||||
$target_file = $icon['tmp_name'];
|
||||
$type = $icon['type'];
|
||||
$target_filename = _XE_PATH_.'files/attach/xeicon/'.$iconname;
|
||||
|
||||
list($width, $height, $type_no, $attrs) = @getimagesize($target_file);
|
||||
if($iconname == 'favicon.ico' && preg_match('/^.*(icon).*$/',$type)){
|
||||
$fitHeight = $fitWidth = '16';
|
||||
} else if($iconname == 'mobicon.png' && preg_match('/^.*(png).*$/',$type) && in_array($height,$mobicon_size) && in_array($width,$mobicon_size)) {
|
||||
$fitHeight = $fitWidth = $height;
|
||||
} else{
|
||||
return false;
|
||||
}
|
||||
//FileHandler::createImageFile($target_file, $target_filename, $fitHeight, $fitWidth, $ext);
|
||||
FileHandler::copyFile($target_file, $target_filename);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
}
|
||||
/* End of file install.admin.controller.php */
|
||||
/* Location: ./modules/install/install.admin.controller.php */
|
||||
|
|
|
|||
|
|
@ -1,37 +1,41 @@
|
|||
<?php
|
||||
/**
|
||||
* @class install
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief install module of the high class
|
||||
**/
|
||||
/**
|
||||
* @class install
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief install module of the high class
|
||||
*/
|
||||
class install extends ModuleObject
|
||||
{
|
||||
/**
|
||||
* @brief Implement if additional tasks are necessary when installing
|
||||
*/
|
||||
function moduleInstall()
|
||||
{
|
||||
return new Object();
|
||||
}
|
||||
|
||||
class install extends ModuleObject {
|
||||
/**
|
||||
* @brief a method to check if successfully installed
|
||||
*/
|
||||
function checkUpdate()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Implement if additional tasks are necessary when installing
|
||||
**/
|
||||
function moduleInstall() {
|
||||
return new Object();
|
||||
}
|
||||
/**
|
||||
* @brief Execute update
|
||||
*/
|
||||
function moduleUpdate()
|
||||
{
|
||||
return new Object();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief a method to check if successfully installed
|
||||
**/
|
||||
function checkUpdate() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Execute update
|
||||
**/
|
||||
function moduleUpdate() {
|
||||
return new Object();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Re-generate the cache file
|
||||
**/
|
||||
function recompileCache() {
|
||||
}
|
||||
}
|
||||
?>
|
||||
/**
|
||||
* @brief Re-generate the cache file
|
||||
*/
|
||||
function recompileCache()
|
||||
{
|
||||
}
|
||||
}
|
||||
/* End of file install.class.php */
|
||||
/* Location: ./modules/install/install.class.php */
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
class installModel extends install {
|
||||
class installModel extends install
|
||||
{
|
||||
var $pwd;
|
||||
|
||||
function getSFTPList()
|
||||
|
|
@ -21,7 +21,8 @@ class installModel extends install {
|
|||
$dh = @opendir($curpwd);
|
||||
if(!$dh) return new Object(-1, 'msg_ftp_invalid_path');
|
||||
$list = array();
|
||||
while(($file = readdir($dh)) !== false) {
|
||||
while(($file = readdir($dh)) !== false)
|
||||
{
|
||||
if(is_dir($curpwd.$file))
|
||||
{
|
||||
$file .= "/";
|
||||
|
|
@ -77,8 +78,10 @@ class installModel extends install {
|
|||
{
|
||||
require_once(_XE_PATH_.'libs/ftp.class.php');
|
||||
$oFtp = new ftp();
|
||||
if($oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)){
|
||||
if($oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) {
|
||||
if($oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port))
|
||||
{
|
||||
if($oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
|
||||
{
|
||||
$_list = $oFtp->ftp_rawlist($this->pwd);
|
||||
$oFtp->ftp_quit();
|
||||
}
|
||||
|
|
@ -91,8 +94,10 @@ class installModel extends install {
|
|||
}
|
||||
$list = array();
|
||||
|
||||
if($_list){
|
||||
foreach($_list as $k => $v){
|
||||
if($_list)
|
||||
{
|
||||
foreach($_list as $k => $v)
|
||||
{
|
||||
$src = null;
|
||||
$src->data = $v;
|
||||
$res = Context::convertEncoding($src);
|
||||
|
|
@ -103,4 +108,5 @@ class installModel extends install {
|
|||
$this->add('list', $list);
|
||||
}
|
||||
}
|
||||
?>
|
||||
/* End of file install.model.php */
|
||||
/* Location: ./modules/install/install.model.php */
|
||||
|
|
|
|||
|
|
@ -1,140 +1,153 @@
|
|||
<?php
|
||||
/**
|
||||
* @class installView
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief View class of install module
|
||||
**/
|
||||
/**
|
||||
* @class installView
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief View class of install module
|
||||
*/
|
||||
class installView extends install
|
||||
{
|
||||
var $install_enable = false;
|
||||
|
||||
class installView extends install {
|
||||
/**
|
||||
* @brief Initialization
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
// Set browser title
|
||||
Context::setBrowserTitle(Context::getLang('introduce_title'));
|
||||
// Specify the template path
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
// Error occurs if already installed
|
||||
if(Context::isInstalled()) return $this->stop('msg_already_installed');
|
||||
// Install a controller
|
||||
$oInstallController = &getController('install');
|
||||
$this->install_enable = $oInstallController->checkInstallEnv();
|
||||
// If the environment is installable, execute installController::makeDefaultDirectory()
|
||||
if($this->install_enable) $oInstallController->makeDefaultDirectory();
|
||||
}
|
||||
|
||||
var $install_enable = false;
|
||||
|
||||
/**
|
||||
* @brief Initialization
|
||||
**/
|
||||
function init() {
|
||||
// Set browser title
|
||||
Context::setBrowserTitle(Context::getLang('introduce_title'));
|
||||
// Specify the template path
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
// Error occurs if already installed
|
||||
if(Context::isInstalled()) return $this->stop('msg_already_installed');
|
||||
// Install a controller
|
||||
$oInstallController = &getController('install');
|
||||
$this->install_enable = $oInstallController->checkInstallEnv();
|
||||
// If the environment is installable, execute installController::makeDefaultDirectory()
|
||||
if($this->install_enable) $oInstallController->makeDefaultDirectory();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Display license messages
|
||||
**/
|
||||
function dispInstallIntroduce() {
|
||||
$install_config_file = FileHandler::getRealPath('./config/install.config.php');
|
||||
if(file_exists($install_config_file)){
|
||||
include $install_config_file;
|
||||
if(is_array($install_config)){
|
||||
foreach($install_config as $k => $v)
|
||||
{
|
||||
$v = ($k == 'db_table_prefix') ? $v.'_' : $v;
|
||||
Context::set($k,$v,true);
|
||||
}
|
||||
unset($GLOBALS['__DB__']);
|
||||
Context::set('install_config', true, true);
|
||||
$oInstallController = &getController('install');
|
||||
$output = $oInstallController->procInstall();
|
||||
if (!$output->toBool()) return $output;
|
||||
header("location: ./");
|
||||
Context::close();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
Context::set('l', Context::getLangType());
|
||||
$this->setTemplateFile('introduce');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Display messages about installation environment
|
||||
**/
|
||||
function dispInstallCheckEnv() {
|
||||
$useRewrite = $this->useRewriteModule() ? 'Y' : 'N';
|
||||
$_SESSION['use_rewrite'] = $useRewrite;
|
||||
Context::set('use_rewrite', $useRewrite);
|
||||
|
||||
$this->setTemplateFile('check_env');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Choose a DB
|
||||
**/
|
||||
function dispInstallSelectDB() {
|
||||
// Display check_env if it is not installable
|
||||
if(!$this->install_enable) return $this->dispInstallCheckEnv();
|
||||
// Enter ftp information
|
||||
if(ini_get('safe_mode') && !Context::isFTPRegisted()) {
|
||||
Context::set('progressMenu', '3');
|
||||
$this->setTemplateFile('ftp');
|
||||
} else {
|
||||
Context::set('progressMenu', '4');
|
||||
$this->setTemplateFile('select_db');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Display a screen to enter DB and administrator's information
|
||||
**/
|
||||
function dispInstallDBForm() {
|
||||
// Display check_env if not installable
|
||||
if(!$this->install_enable) return $this->dispInstallCheckEnv();
|
||||
// Return to the start-up screen if db_type is not specified
|
||||
if(!Context::get('db_type')) return $this->dispInstallSelectDB();
|
||||
|
||||
// Output the file, disp_db_info_form.html
|
||||
$tpl_filename = sprintf('form.%s', Context::get('db_type'));
|
||||
$this->setTemplateFile($tpl_filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Display a screen to enter DB and administrator's information
|
||||
**/
|
||||
function dispInstallConfigForm() {
|
||||
// Display check_env if not installable
|
||||
if(!$this->install_enable) return $this->dispInstallCheckEnv();
|
||||
|
||||
include _XE_PATH_.'files/config/tmpDB.config.php';
|
||||
|
||||
Context::set('use_rewrite', $_SESSION['use_rewrite']);
|
||||
Context::set('time_zone', $GLOBALS['time_zone']);
|
||||
Context::set('db_type', $db_info->db_type);
|
||||
$this->setTemplateFile('config_form');
|
||||
}
|
||||
|
||||
function useRewriteModule()
|
||||
/**
|
||||
* @brief Display license messages
|
||||
*/
|
||||
function dispInstallIntroduce()
|
||||
{
|
||||
$install_config_file = FileHandler::getRealPath('./config/install.config.php');
|
||||
if(file_exists($install_config_file))
|
||||
{
|
||||
if(function_exists('apache_get_modules') && in_array('mod_rewrite',apache_get_modules()))
|
||||
include $install_config_file;
|
||||
if(is_array($install_config))
|
||||
{
|
||||
return true;
|
||||
foreach($install_config as $k => $v)
|
||||
{
|
||||
$v = ($k == 'db_table_prefix') ? $v.'_' : $v;
|
||||
Context::set($k,$v,true);
|
||||
}
|
||||
unset($GLOBALS['__DB__']);
|
||||
Context::set('install_config', true, true);
|
||||
$oInstallController = &getController('install');
|
||||
$output = $oInstallController->procInstall();
|
||||
if (!$output->toBool()) return $output;
|
||||
header("location: ./");
|
||||
Context::close();
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once(_XE_PATH_.'classes/httprequest/XEHttpRequest.class.php');
|
||||
$httpRequest = new XEHttpRequest($_SERVER['HTTP_HOST'], $_SERVER['SERVER_PORT']);
|
||||
$xeInstallPath = substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], 'index.php', 1));
|
||||
$output = $httpRequest->send($xeInstallPath.'modules/install/conf/info.xml');
|
||||
|
||||
return (strpos($output->body, '<?xml') !== 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Display a screen to enter DB and administrator's information
|
||||
**/
|
||||
function dispInstallManagerForm() {
|
||||
// Display check_env if not installable
|
||||
if(!$this->install_enable) {
|
||||
return $this->dispInstallCheckEnv();
|
||||
}
|
||||
Context::set('l', Context::getLangType());
|
||||
$this->setTemplateFile('introduce');
|
||||
}
|
||||
|
||||
$this->setTemplateFile('admin_form');
|
||||
}
|
||||
}
|
||||
?>
|
||||
/**
|
||||
* @brief Display messages about installation environment
|
||||
*/
|
||||
function dispInstallCheckEnv()
|
||||
{
|
||||
$useRewrite = $this->useRewriteModule() ? 'Y' : 'N';
|
||||
$_SESSION['use_rewrite'] = $useRewrite;
|
||||
Context::set('use_rewrite', $useRewrite);
|
||||
|
||||
$this->setTemplateFile('check_env');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Choose a DB
|
||||
*/
|
||||
function dispInstallSelectDB()
|
||||
{
|
||||
// Display check_env if it is not installable
|
||||
if(!$this->install_enable) return $this->dispInstallCheckEnv();
|
||||
// Enter ftp information
|
||||
if(ini_get('safe_mode') && !Context::isFTPRegisted())
|
||||
{
|
||||
Context::set('progressMenu', '3');
|
||||
$this->setTemplateFile('ftp');
|
||||
}
|
||||
else
|
||||
{
|
||||
Context::set('progressMenu', '4');
|
||||
$this->setTemplateFile('select_db');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Display a screen to enter DB and administrator's information
|
||||
*/
|
||||
function dispInstallDBForm()
|
||||
{
|
||||
// Display check_env if not installable
|
||||
if(!$this->install_enable) return $this->dispInstallCheckEnv();
|
||||
// Return to the start-up screen if db_type is not specified
|
||||
if(!Context::get('db_type')) return $this->dispInstallSelectDB();
|
||||
|
||||
// Output the file, disp_db_info_form.html
|
||||
$tpl_filename = sprintf('form.%s', Context::get('db_type'));
|
||||
$this->setTemplateFile($tpl_filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Display a screen to enter DB and administrator's information
|
||||
*/
|
||||
function dispInstallConfigForm()
|
||||
{
|
||||
// Display check_env if not installable
|
||||
if(!$this->install_enable) return $this->dispInstallCheckEnv();
|
||||
|
||||
include _XE_PATH_.'files/config/tmpDB.config.php';
|
||||
|
||||
Context::set('use_rewrite', $_SESSION['use_rewrite']);
|
||||
Context::set('time_zone', $GLOBALS['time_zone']);
|
||||
Context::set('db_type', $db_info->db_type);
|
||||
$this->setTemplateFile('config_form');
|
||||
}
|
||||
|
||||
function useRewriteModule()
|
||||
{
|
||||
if(function_exists('apache_get_modules') && in_array('mod_rewrite',apache_get_modules()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
require_once(_XE_PATH_.'classes/httprequest/XEHttpRequest.class.php');
|
||||
$httpRequest = new XEHttpRequest($_SERVER['HTTP_HOST'], $_SERVER['SERVER_PORT']);
|
||||
$xeInstallPath = substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], 'index.php', 1));
|
||||
$output = $httpRequest->send($xeInstallPath.'modules/install/conf/info.xml');
|
||||
|
||||
return (strpos($output->body, '<?xml') !== 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Display a screen to enter DB and administrator's information
|
||||
*/
|
||||
function dispInstallManagerForm()
|
||||
{
|
||||
// Display check_env if not installable
|
||||
if(!$this->install_enable)
|
||||
{
|
||||
return $this->dispInstallCheckEnv();
|
||||
}
|
||||
|
||||
$this->setTemplateFile('admin_form');
|
||||
}
|
||||
}
|
||||
/* End of file install.view.php */
|
||||
/* Location: ./modules/install/install.view.php */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue