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:
ovclas 2012-11-19 01:26:43 +00:00
parent e7177034b3
commit 9aefe700b6
10 changed files with 1720 additions and 1577 deletions

View file

@ -1,23 +1,23 @@
<?php
/**
/**
* @class installAdminController
* @author NHN (developers@xpressengine.com)
* @brief admin controller class of the install module
**/
class installAdminController extends install {
*/
class installAdminController extends install
{
/**
* @brief Initialization
**/
function init() {
*/
function init()
{
}
/**
* @brief Install the module
**/
function procInstallAdminInstall() {
*/
function procInstallAdminInstall()
{
$module_name = Context::get('module_name');
if(!$module_name) return new object(-1, 'invalid_request');
@ -29,8 +29,9 @@
/**
* @brief Upate the module
**/
function procInstallAdminUpdate() {
*/
function procInstallAdminUpdate()
{
set_time_limit(0);
$module_name = Context::get('module_name');
if(!$module_name) return new object(-1, 'invalid_request');
@ -44,8 +45,9 @@
/**
* @brief Change settings
**/
function procInstallAdminSaveTimeZone() {
*/
function procInstallAdminSaveTimeZone()
{
$admin_ip_list = Context::get('admin_ip_list');
$admin_ip_list = preg_replace("/[\r|\n|\r\n]+/",",",$admin_ip_list);
@ -149,14 +151,16 @@
$this->setMessage('success_updated');
}
function procInstallAdminRemoveFTPInfo() {
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() {
function procInstallAdminSaveFTPInfo()
{
$ftp_info = Context::getFTPInfo();
$ftp_info->ftp_user = Context::get('ftp_user');
$ftp_info->ftp_port = Context::get('ftp_port');
@ -166,18 +170,23 @@
$ftp_info->sftp = Context::get('sftp');
$ftp_root_path = Context::get('ftp_root_path');
if (substr($ftp_root_path, strlen($ftp_root_path)-1) == "/") {
if(substr($ftp_root_path, strlen($ftp_root_path)-1) == "/")
{
$ftp_info->ftp_root_path = $ftp_root_path;
} else {
}
else
{
$ftp_info->ftp_root_path = $ftp_root_path.'/';
}
if(ini_get('safe_mode')) {
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) {
foreach($ftp_info as $key => $val)
{
if(!$val) continue;
if(preg_match('/(<\?|<\?php|\?>)/xsm', preg_replace('/\s/', '', $val)))
{
@ -195,7 +204,8 @@
$this->setRedirectUrl($returnUrl);
}
function procInstallAdminConfig(){
function procInstallAdminConfig()
{
$use_mobile_view = Context::get('use_mobile_view');
if($use_mobile_view!='Y') $use_mobile_view = 'N';
@ -240,13 +250,15 @@
//from procInstallAdminSaveTimeZone
/**
* @brief Supported languages (was procInstallAdminSaveLangSelected)
**/
function saveLangSelected($selected_lang){
*/
function saveLangSelected($selected_lang)
{
$langs = $selected_lang;
$lang_supported = Context::loadLangSupported();
$buff = null;
for($i=0;$i<count($langs);$i++) {
for($i=0;$i<count($langs);$i++)
{
$buff .= sprintf("%s,%s\n", $langs[$i], $lang_supported[$langs[$i]]);
}
@ -255,7 +267,8 @@
}
/* 썸내일 보여주기 방식 변경.*/
function setModulesConfig($config){
function setModulesConfig($config)
{
if(!$config->thumbnail_type || $config->thumbnail_type != 'ratio' ) $args->thumbnail_type = 'crop';
else $args->thumbnail_type = 'ratio';
@ -272,23 +285,30 @@
return $output;
}
function saveIcon($icon,$iconname){
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)){
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)) {
}
else if($iconname == 'mobicon.png' && preg_match('/^.*(png).*$/',$type) && in_array($height,$mobicon_size) && in_array($width,$mobicon_size))
{
$fitHeight = $fitWidth = $height;
} else{
}
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 */

View file

@ -1,37 +1,41 @@
<?php
/**
/**
* @class install
* @author NHN (developers@xpressengine.com)
* @brief install module of the high class
**/
class install extends ModuleObject {
*/
class install extends ModuleObject
{
/**
* @brief Implement if additional tasks are necessary when installing
**/
function moduleInstall() {
*/
function moduleInstall()
{
return new Object();
}
/**
* @brief a method to check if successfully installed
**/
function checkUpdate() {
*/
function checkUpdate()
{
return false;
}
/**
* @brief Execute update
**/
function moduleUpdate() {
*/
function moduleUpdate()
{
return new Object();
}
/**
* @brief Re-generate the cache file
**/
function recompileCache() {
*/
function recompileCache()
{
}
}
?>
}
/* End of file install.class.php */
/* Location: ./modules/install/install.class.php */

View file

@ -1,20 +1,22 @@
<?php
/**
/**
* @class installController
* @author NHN (developers@xpressengine.com)
* @brief install module of the Controller class
**/
class installController extends install {
*/
class installController extends install
{
var $db_tmp_config_file = '';
var $etc_tmp_config_file = '';
/**
* @brief Initialization
**/
function init() {
*/
function init()
{
// Error occurs if already installed
if(Context::isInstalled()) {
if(Context::isInstalled())
{
return new Object(-1, 'msg_already_installed');
}
@ -25,7 +27,7 @@
/**
* @brief cubrid db setting wrapper, becase Server Side Validator...
* Server Side Validatro can use only one proc, one ruleset
**/
*/
function procCubridDBSetting()
{
return $this->_procDBSetting();
@ -34,7 +36,7 @@
/**
* @brief firebird db setting wrapper, becase Server Side Validator...
* Server Side Validatro can use only one proc, one ruleset
**/
*/
function procFirebirdDBSetting()
{
return $this->_procDBSetting();
@ -43,7 +45,7 @@
/**
* @brief mssql db setting wrapper, becase Server Side Validator...
* Server Side Validatro can use only one proc, one ruleset
**/
*/
function procMssqlDBSetting()
{
return $this->_procDBSetting();
@ -52,7 +54,7 @@
/**
* @brief mysql db setting wrapper, becase Server Side Validator...
* Server Side Validatro can use only one proc, one ruleset
**/
*/
function procMysqlDBSetting()
{
return $this->_procDBSetting();
@ -61,7 +63,7 @@
/**
* @brief postgresql db setting wrapper, becase Server Side Validator...
* Server Side Validatro can use only one proc, one ruleset
**/
*/
function procPostgresqlDBSetting()
{
return $this->_procDBSetting();
@ -70,7 +72,7 @@
/**
* @brief sqlite db setting wrapper, becase Server Side Validator...
* Server Side Validatro can use only one proc, one ruleset
**/
*/
function procSqliteDBSetting()
{
return $this->_procDBSetting();
@ -78,8 +80,9 @@
/**
* @brief division install step... DB Config temp file create
**/
function _procDBSetting() {
*/
function _procDBSetting()
{
// Get DB-related variables
$con_string = Context::gets('db_type','db_port','db_hostname','db_userid','db_password','db_database','db_table_prefix');
@ -105,7 +108,8 @@
// Create a db temp config file
if(!$this->makeDBConfigFile()) return new Object(-1, 'msg_install_failed');
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
{
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'act', 'dispInstallConfigForm');
header('location:'.$returnUrl);
return;
@ -114,8 +118,9 @@
/**
* @brief division install step... rewrite, time_zone Config temp file create
**/
function procConfigSetting() {
*/
function procConfigSetting()
{
// Get variables
$config_info = Context::gets('use_rewrite','time_zone');
if($config_info->use_rewrite!='Y') $config_info->use_rewrite = 'N';
@ -123,7 +128,8 @@
// Create a db temp config file
if(!$this->makeEtcConfigFile($config_info)) return new Object(-1, 'msg_install_failed');
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
{
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'act', 'dispInstallManagerForm');
header('location:'.$returnUrl);
return;
@ -132,8 +138,9 @@
/**
* @brief Install with received information
**/
function procInstall() {
*/
function procInstall()
{
// Check if it is already installed
if(Context::isInstalled()) return new Object(-1, 'msg_already_installed');
// Assign a temporary administrator when installing
@ -141,13 +148,13 @@
Context::set('logged_info', $logged_info);
// check install config
if (Context::get('install_config'))
if(Context::get('install_config'))
{
$db_info = $this->_makeDbInfoByInstallConfig();
}
// install by default XE UI
else{
else
{
include $this->db_tmp_config_file;
include $this->etc_tmp_config_file;
}
@ -169,9 +176,11 @@
// load script
$scripts = FileHandler::readDir('./modules/install/script','/(\.php)$/');
if(count($scripts)>0){
if(count($scripts)>0)
{
sort($scripts);
foreach($scripts as $script){
foreach($scripts as $script)
{
$output = include(FileHandler::getRealPath('./modules/install/script/'.$script));
}
}
@ -185,7 +194,8 @@
unset($_SESSION['use_rewrite']);
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
{
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('');
header('location:'.$returnUrl);
return;
@ -194,7 +204,7 @@
/**
* @brief Make DB Information by Install Config
**/
*/
function _makeDbInfoByInstallConfig()
{
$db_info->master_db['db_type'] = Context::get('db_type');
@ -214,8 +224,9 @@
/**
* @brief Set FTP Information
**/
function procInstallFTP() {
*/
function procInstallFTP()
{
if(Context::isInstalled()) return new Object(-1, 'msg_already_installed');
$ftp_info = Context::gets('ftp_host', 'ftp_user','ftp_password','ftp_port','ftp_root_path');
$ftp_info->ftp_port = (int)$ftp_info->ftp_port;
@ -224,39 +235,46 @@
if(!$ftp_info->ftp_root_path) $ftp_info->ftp_root_path = '/';
$buff = '<?php if(!defined("__ZBXE__")) exit();'."\n";
foreach($ftp_info as $key => $val) {
foreach($ftp_info as $key => $val)
{
$buff .= sprintf("\$ftp_info->%s = '%s';\n", $key, str_replace("'","\\'",$val));
}
$buff .= "?".">";
// If safe_mode
if(ini_get('safe_mode')) {
if(ini_get('safe_mode'))
{
if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new Object(-1,'msg_safe_mode_ftp_needed');
require_once(_XE_PATH_.'libs/ftp.class.php');
$oFtp = new ftp();
if(!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), $ftp_info->ftp_host));
if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) {
if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
{
$oFtp->ftp_quit();
return new Object(-1,'msg_ftp_invalid_auth_info');
}
if(!is_dir(_XE_PATH_.'files') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files')) {
if(!is_dir(_XE_PATH_.'files') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files'))
{
$oFtp->ftp_quit();
return new Object(-1,'msg_ftp_mkdir_fail');
}
if(!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files')) {
if(!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files'))
{
$oFtp->ftp_quit();
return new Object(-1,'msg_ftp_chmod_fail');
}
if(!is_dir(_XE_PATH_.'files/config') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files/config')) {
if(!is_dir(_XE_PATH_.'files/config') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files/config'))
{
$oFtp->ftp_quit();
return new Object(-1,'msg_ftp_mkdir_fail');
}
if(!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files/config')) {
if(!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files/config'))
{
$oFtp->ftp_quit();
return new Object(-1,'msg_ftp_chmod_fail');
}
@ -268,7 +286,8 @@
FileHandler::WriteFile($config_file, $buff);
}
function procInstallCheckFtp() {
function procInstallCheckFtp()
{
$ftp_info = Context::gets('ftp_user','ftp_password','ftp_port','sftp');
$ftp_info->ftp_port = (int)$ftp_info->ftp_port;
if(!$ftp_info->ftp_port) $ftp_info->ftp_port = 21;
@ -290,7 +309,8 @@
$oFtp = new ftp();
if(!$oFtp->ftp_connect('localhost', $ftp_info->ftp_port)) return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'localhost'));
if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) {
if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
{
$oFtp->ftp_quit();
return new Object(-1,'msg_ftp_invalid_auth_info');
}
@ -303,8 +323,9 @@
/**
* @brief Result returned after checking the installation environment
**/
function checkInstallEnv() {
*/
function checkInstallEnv()
{
// Check each item
$checklist = array();
// 0. check your version of php (5.2.2 is not supported)
@ -343,8 +364,9 @@
/**
* @brief Create files and subdirectories
* Local evironment setting before installation by using DB information
**/
function makeDefaultDirectory() {
*/
function makeDefaultDirectory()
{
$directory_list = array(
'./files/config',
'./files/cache/queries',
@ -352,7 +374,8 @@
'./files/cache/template_compiled',
);
foreach($directory_list as $dir) {
foreach($directory_list as $dir)
{
FileHandler::makeDir($dir);
}
}
@ -361,12 +384,14 @@
* @brief Install all the modules
*
* Create a table by using schema xml file in the shcema directory of each module
**/
function installDownloadedModule() {
*/
function installDownloadedModule()
{
$oModuleModel = &getModel('module');
// Create a table ny finding schemas/*.xml file in each module
$module_list = FileHandler::readDir('./modules/', NULL, false, true);
foreach($module_list as $module_path) {
foreach($module_list as $module_path)
{
// Get module name
$tmp_arr = explode('/',$module_path);
$module = $tmp_arr[count($tmp_arr)-1];
@ -382,9 +407,12 @@
// Determine the order of module installation depending on category
$install_step = array('system','content','member');
// Install all the remaining modules
foreach($install_step as $category) {
if(count($modules[$category])) {
foreach($modules[$category] as $module) {
foreach($install_step as $category)
{
if(count($modules[$category]))
{
foreach($modules[$category] as $module)
{
if($module == 'module') continue;
$this->installModule($module, sprintf('./modules/%s', $module));
@ -398,10 +426,14 @@
}
}
// Install all the remaining modules
if(count($modules)) {
foreach($modules as $category => $module_list) {
if(count($module_list)) {
foreach($module_list as $module) {
if(count($modules))
{
foreach($modules as $category => $module_list)
{
if(count($module_list))
{
foreach($module_list as $module)
{
if($module == 'module') continue;
$this->installModule($module, sprintf('./modules/%s', $module));
@ -420,8 +452,9 @@
/**
* @brief Install an each module
**/
function installModule($module, $module_path) {
*/
function installModule($module, $module_path)
{
// create db instance
$oDB = &DB::getInstance();
// Create a table if the schema xml exists in the "schemas" directory of the module
@ -429,7 +462,8 @@
$schema_files = FileHandler::readDir($schema_dir, NULL, false, true);
$file_cnt = count($schema_files);
for($i=0;$i<$file_cnt;$i++) {
for($i=0;$i<$file_cnt;$i++)
{
$file = trim($schema_files[$i]);
if(!$file || substr($file,-4)!='.xml') continue;
$output = $oDB->createTableByXmlFile($file);
@ -448,11 +482,14 @@
else
$buff .= "\$db_info->$key = ";
if(!$with_array) $val = array($val);
foreach($val as $con_string){
foreach($val as $con_string)
{
$buff .= 'array(';
foreach($con_string as $k => $v){
foreach($con_string as $k => $v)
{
if(in_array($k, array('resource', 'is_connected'))) continue;
if($k == 'db_table_prefix' && !empty($v)){
if($k == 'db_table_prefix' && !empty($v))
{
if(substr($v,-1)!='_') $v .= '_';
}
$buff .= "'$k' => '$v',";
@ -468,14 +505,18 @@
return $buff;
}
function _getDBConfigFileContents($db_info){
function _getDBConfigFileContents($db_info)
{
$buff = '<?php if(!defined("__ZBXE__")) exit();'."\n";
$db_info = get_object_vars($db_info);
foreach($db_info as $key => $val) {
if($key == 'master_db'){
foreach($db_info as $key => $val)
{
if($key == 'master_db')
{
$buff .= $this->_getDbConnText($key, $val);
}
else if($key == 'slave_db'){
else if($key == 'slave_db')
{
$buff .= $this->_getDbConnText($key, $val, true);
}
else
@ -488,8 +529,9 @@
/**
* @brief Create DB temp config file
* Create the config file when all settings are completed
**/
function makeDBConfigFile() {
*/
function makeDBConfigFile()
{
$db_tmp_config_file = $this->db_tmp_config_file;
$db_info = Context::getDbInfo();
@ -506,12 +548,14 @@
/**
* @brief Create etc config file
* Create the config file when all settings are completed
**/
function makeEtcConfigFile($config_info) {
*/
function makeEtcConfigFile($config_info)
{
$etc_tmp_config_file = $this->etc_tmp_config_file;
$buff = '<?php if(!defined("__ZBXE__")) exit();'."\n";
foreach($config_info as $key => $val) {
foreach($config_info as $key => $val)
{
$buff .= sprintf("\$db_info->%s = '%s';\n", $key, str_replace("'","\\'",$val));
}
$buff .= "?>";
@ -525,8 +569,9 @@
/**
* @brief Create config file
* Create the config file when all settings are completed
**/
function makeConfigFile() {
*/
function makeConfigFile()
{
$config_file = Context::getConfigFile();
//if(file_exists($config_file)) return;
@ -537,7 +582,8 @@
FileHandler::writeFile($config_file, $buff);
if(@file_exists($config_file)) {
if(@file_exists($config_file))
{
FileHandler::removeFile($this->db_tmp_config_file);
FileHandler::removeFile($this->etc_tmp_config_file);
return true;
@ -545,7 +591,8 @@
return false;
}
function installByConfig($install_config_file){
function installByConfig($install_config_file)
{
include $install_config_file;
if(!is_array($auto_config)) return false;
@ -555,18 +602,22 @@
$fstr = "<%s><![CDATA[%s]]></%s>\r\n";
$fheader = "POST %s HTTP/1.1\r\nHost: %s\r\nContent-Type: application/xml\r\nContent-Length: %s\r\n\r\n%s\r\n";
$body = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<methodCall>\r\n<params>\r\n";
foreach($auto_config as $k => $v){
foreach($auto_config as $k => $v)
{
if(!in_array($k,array('host','port','path'))) $body .= sprintf($fstr,$k,$v,$k);
}
$body .= "</params>\r\n</methodCall>";
$header = sprintf($fheader,$auto_config['path'],$auto_config['host'],strlen($body),$body);
$fp = @fsockopen($auto_config['host'], $auto_config['port'], $errno, $errstr, 5);
if($fp){
if($fp)
{
fputs($fp, $header);
while(!feof($fp)) {
while(!feof($fp))
{
$line = trim(fgets($fp, 4096));
if(preg_match("/^<error>/i",$line)){
if(preg_match("/^<error>/i",$line))
{
fclose($fp);
return false;
}
@ -576,4 +627,6 @@
return true;
}
}
}
/* End of file install.controller.php */
/* Location: ./modules/install/install.controller.php */

View file

@ -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 */

View file

@ -1,18 +1,18 @@
<?php
/**
/**
* @class installView
* @author NHN (developers@xpressengine.com)
* @brief View class of install module
**/
class installView extends install {
*/
class installView extends install
{
var $install_enable = false;
/**
* @brief Initialization
**/
function init() {
*/
function init()
{
// Set browser title
Context::setBrowserTitle(Context::getLang('introduce_title'));
// Specify the template path
@ -28,12 +28,15 @@
/**
* @brief Display license messages
**/
function dispInstallIntroduce() {
*/
function dispInstallIntroduce()
{
$install_config_file = FileHandler::getRealPath('./config/install.config.php');
if(file_exists($install_config_file)){
if(file_exists($install_config_file))
{
include $install_config_file;
if(is_array($install_config)){
if(is_array($install_config))
{
foreach($install_config as $k => $v)
{
$v = ($k == 'db_table_prefix') ? $v.'_' : $v;
@ -56,8 +59,9 @@
/**
* @brief Display messages about installation environment
**/
function dispInstallCheckEnv() {
*/
function dispInstallCheckEnv()
{
$useRewrite = $this->useRewriteModule() ? 'Y' : 'N';
$_SESSION['use_rewrite'] = $useRewrite;
Context::set('use_rewrite', $useRewrite);
@ -67,15 +71,19 @@
/**
* @brief Choose a DB
**/
function dispInstallSelectDB() {
*/
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()) {
if(ini_get('safe_mode') && !Context::isFTPRegisted())
{
Context::set('progressMenu', '3');
$this->setTemplateFile('ftp');
} else {
}
else
{
Context::set('progressMenu', '4');
$this->setTemplateFile('select_db');
}
@ -83,8 +91,9 @@
/**
* @brief Display a screen to enter DB and administrator's information
**/
function dispInstallDBForm() {
*/
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
@ -97,8 +106,9 @@
/**
* @brief Display a screen to enter DB and administrator's information
**/
function dispInstallConfigForm() {
*/
function dispInstallConfigForm()
{
// Display check_env if not installable
if(!$this->install_enable) return $this->dispInstallCheckEnv();
@ -127,14 +137,17 @@
/**
* @brief Display a screen to enter DB and administrator's information
**/
function dispInstallManagerForm() {
*/
function dispInstallManagerForm()
{
// Display check_env if not installable
if(!$this->install_enable) {
if(!$this->install_enable)
{
return $this->dispInstallCheckEnv();
}
$this->setTemplateFile('admin_form');
}
}
?>
}
/* End of file install.view.php */
/* Location: ./modules/install/install.view.php */

View file

@ -1,16 +1,16 @@
<?php
/**
/**
* The admin view class of the integration_search module
*
* @author NHN (developers@xpressengine.com)
**/
class integration_searchAdminController extends integration_search {
*/
class integration_searchAdminController extends integration_search
{
/**
* Initialization
*
* @return void
**/
*/
function init()
{
}
@ -19,8 +19,9 @@
* Save Settings
*
* @return mixed
**/
function procIntegration_searchAdminInsertConfig() {
*/
function procIntegration_searchAdminInsertConfig()
{
// Get configurations (using module model object)
$oModuleModel = &getModel('module');
$config = $oModuleModel->getModuleConfig('integration_search');
@ -42,8 +43,9 @@
* Save the skin information
*
* @return mixed
**/
function procIntegration_searchAdminInsertSkin() {
*/
function procIntegration_searchAdminInsertSkin()
{
// Get configurations (using module model object)
$oModuleModel = &getModel('module');
$config = $oModuleModel->getModuleConfig('integration_search');
@ -58,30 +60,36 @@
unset($obj->module_srl);
unset($obj->page);
// Separately handle if the extra_vars is an image type in the original skin_info
if($skin_info->extra_vars) {
foreach($skin_info->extra_vars as $vars) {
if($skin_info->extra_vars)
{
foreach($skin_info->extra_vars as $vars)
{
if($vars->type!='image') continue;
$image_obj = $obj->{$vars->name};
// Get a variable on a request to delete
$del_var = $obj->{"del_".$vars->name};
unset($obj->{"del_".$vars->name});
if($del_var == 'Y') {
if($del_var == 'Y')
{
FileHandler::removeFile($module_info->{$vars->name});
continue;
}
// Use the previous data if not uploaded
if(!$image_obj['tmp_name']) {
if(!$image_obj['tmp_name'])
{
$obj->{$vars->name} = $module_info->{$vars->name};
continue;
}
// Ignore if the file is not successfully uploaded
if(!is_uploaded_file($image_obj['tmp_name'])) {
if(!is_uploaded_file($image_obj['tmp_name']))
{
unset($obj->{$vars->name});
continue;
}
// Ignore if the file is not an image
if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) {
if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name']))
{
unset($obj->{$vars->name});
continue;
}
@ -92,7 +100,8 @@
$filename = $path.$image_obj['name'];
// Move the file
if(!move_uploaded_file($image_obj['tmp_name'], $filename)) {
if(!move_uploaded_file($image_obj['tmp_name'], $filename))
{
unset($obj->{$vars->name});
continue;
}
@ -112,5 +121,6 @@
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispIntegration_searchAdminSkinInfo');
return $this->setRedirectUrl($returnUrl, $output);
}
}
?>
}
/* End of file integration_search.admin.controller.php */
/* Location: ./modules/integration_search/integration_search.admin.controller.php */

View file

@ -1,12 +1,11 @@
<?php
/**
/**
* The admin view class of the integration_search module
*
* @author NHN (developers@xpressengine.com)
**/
class integration_searchAdminView extends integration_search {
*/
class integration_searchAdminView extends integration_search
{
/**
* Cofiguration of integration serach module
*
@ -18,8 +17,9 @@
* Initialization
*
* @return void
**/
function init() {
*/
function init()
{
// Get configurations (using module model object)
$oModuleModel = &getModel('module');
$this->config = $oModuleModel->getModuleConfig('integration_search');
@ -32,8 +32,9 @@
* Module selection and skin set
*
* @return Object
**/
function dispIntegration_searchAdminContent() {
*/
function dispIntegration_searchAdminContent()
{
// Get a list of skins(themes)
$oModuleModel = &getModel('module');
$skin_list = $oModuleModel->getSkins($this->module_path);
@ -69,14 +70,17 @@
* Skin Settings
*
* @return Object
**/
function dispIntegration_searchAdminSkinInfo() {
*/
function dispIntegration_searchAdminSkinInfo()
{
$oModuleModel = &getModel('module');
$skin_info = $oModuleModel->loadSkinInfo($this->module_path, $this->config->skin);
$skin_vars = unserialize($this->config->skin_vars);
// value for skin_info extra_vars
if(count($skin_info->extra_vars)) {
foreach($skin_info->extra_vars as $key => $val) {
if(count($skin_info->extra_vars))
{
foreach($skin_info->extra_vars as $key => $val)
{
$name = $val->name;
$type = $val->type;
$value = $skin_vars->{$name};
@ -95,5 +99,6 @@
$this->setTemplateFile("skin_info");
}
}
?>
}
/* End of file integration_search.admin.view.php */
/* Location: ./modules/integration_search/integration_search.admin.view.php */

View file

@ -1,18 +1,18 @@
<?php
/**
/**
* The view class of the integration_search module
*
* @author NHN (developers@xpressengine.com)
**/
class integration_search extends ModuleObject {
*/
class integration_search extends ModuleObject
{
/**
* Implement if additional tasks are necessary when installing
*
* @return Object
**/
function moduleInstall() {
*/
function moduleInstall()
{
// Registered in action forward
$oModuleController = &getController('module');
$oModuleController->insertActionForward('integration_search', 'view', 'IS');
@ -24,7 +24,7 @@
* Check methoda whether successfully installed
*
* @return bool
**/
*/
function checkUpdate()
{
$oModuleModel = &getModel('module');
@ -33,7 +33,7 @@
if($config->skin)
{
$config_parse = explode('.', $config->skin);
if (count($config_parse) > 1)
if(count($config_parse) > 1)
{
$template_path = sprintf('./themes/%s/modules/integration_search/', $config_parse[0]);
if(is_dir($template_path)) return true;
@ -46,7 +46,7 @@
* Execute update
*
* @return Object
**/
*/
function moduleUpdate()
{
$oModuleModel = &getModel('module');
@ -55,7 +55,7 @@
if($config->skin)
{
$config_parse = explode('.', $config->skin);
if (count($config_parse) > 1)
if(count($config_parse) > 1)
{
$template_path = sprintf('./themes/%s/modules/integration_search/', $config_parse[0]);
if(is_dir($template_path))
@ -74,8 +74,10 @@
* Re-generate the cache file
*
* @return void
**/
function recompileCache() {
*/
function recompileCache()
{
}
}
?>
}
/* End of file integration_search.class.php */
/* Location: ./modules/integration_search/integration_search.class.php */

View file

@ -1,17 +1,18 @@
<?php
/**
/**
* The model class of integration module
*
* @author NHN (developers@xpressengine.com)
**/
class integration_searchModel extends module {
*/
class integration_searchModel extends module
{
/**
* Initialization
*
* @return void
**/
function init() {
*/
function init()
{
}
/**
@ -25,15 +26,19 @@
* @param integer $list_count list count of page navigation
*
* @return Object output document list
**/
function getDocuments($target, $module_srls_list, $search_target, $search_keyword, $page=1, $list_count = 20) {
*/
function getDocuments($target, $module_srls_list, $search_target, $search_keyword, $page=1, $list_count = 20)
{
if(is_array($module_srls_list)) $module_srls_list = implode(',',$module_srls_list);
if($target == 'exclude') {
if($target == 'exclude')
{
$module_srls_list .= ',0'; // exclude 'trash'
if ($module_srls_list{0} == ',') $module_srls_list = substr($module_srls_list, 1);
$args->exclude_module_srl = $module_srls_list;
} else {
}
else
{
$args->module_srl = $module_srls_list;
$args->exclude_module_srl = '0'; // exclude 'trash'
}
@ -63,13 +68,16 @@
* @param integer $list_count list count of page navigation
*
* @return Object output comment list
**/
function getComments($target, $module_srls_list, $search_keyword, $page=1, $list_count = 20) {
if(is_array($module_srls_list)){
*/
function getComments($target, $module_srls_list, $search_keyword, $page=1, $list_count = 20)
{
if(is_array($module_srls_list))
{
if (count($module_srls_list) > 0) $module_srls = implode(',',$module_srls_list);
else $module_srls = 0;
}
else {
else
{
$module_srls = ($module_srls_list)?$module_srls_list:0;
}
if($target == 'exclude') $args->exclude_module_srl = $module_srls;
@ -100,8 +108,9 @@
* @param integer $list_count list count of page navigation
*
* @return Object output trackback list
**/
function getTrackbacks($target, $module_srls_list, $search_target = "title", $search_keyword, $page=1, $list_count = 20) {
*/
function getTrackbacks($target, $module_srls_list, $search_target = "title", $search_keyword, $page=1, $list_count = 20)
{
if(is_array($module_srls_list)) $module_srls = implode(',',$module_srls_list);
else $module_srls = $module_srls_list;
if($target == 'exclude') $args->exclude_module_srl = $module_srls;
@ -131,8 +140,9 @@
* @param string $direct_download Y or N
*
* @return Object output file list
**/
function _getFiles($target, $module_srls_list, $search_keyword, $page, $list_count, $direct_download = 'Y') {
*/
function _getFiles($target, $module_srls_list, $search_keyword, $page, $list_count, $direct_download = 'Y')
{
if(is_array($module_srls_list)) $module_srls = implode(',',$module_srls_list);
else $module_srls = $module_srls_list;
if($target == 'exclude') $args->exclude_module_srl = $module_srls;
@ -152,7 +162,8 @@
if(!$output->toBool() || !$output->data) return $output;
$list = array();
foreach($output->data as $key => $val) {
foreach($output->data as $key => $val)
{
$obj = null;
$obj->filename = $val->source_filename;
$obj->download_count = $val->download_count;
@ -161,7 +172,8 @@
$obj->target_srl = $val->upload_target_srl;
$obj->file_size = $val->file_size;
// Images
if(preg_match('/\.(jpg|jpeg|gif|png)$/i', $val->source_filename)) {
if(preg_match('/\.(jpg|jpeg|gif|png)$/i', $val->source_filename))
{
$obj->type = 'image';
$thumbnail_path = sprintf('files/cache/thumbnails/%s',getNumberingPath($val->file_srl, 3));
@ -171,11 +183,15 @@
if(!file_exists($thumbnail_file)) FileHandler::createImageFile($val->uploaded_filename, $thumbnail_file, 120, 120, 'jpg', 'crop');
$obj->src = sprintf('<img src="%s" alt="%s" width="%d" height="%d" />', $thumbnail_url, htmlspecialchars($obj->filename), 120, 120);
// Videos
} elseif(preg_match('/\.(swf|flv|wmv|avi|mpg|mpeg|asx|asf|mp3)$/i', $val->source_filename)) {
}
else if(preg_match('/\.(swf|flv|wmv|avi|mpg|mpeg|asx|asf|mp3)$/i', $val->source_filename))
{
$obj->type = 'multimedia';
$obj->src = sprintf('<script>displayMultimedia("%s",120,120);</script>', $obj->download_url);
// Others
} else {
}
else
{
$obj->type = 'binary';
$obj->src = '';
}
@ -187,9 +203,12 @@
$oDocumentModel = &getModel('document');
$document_list = $oDocumentModel->getDocuments($target_list);
if($document_list) foreach($document_list as $key => $val) {
foreach($output->data as $k => $v) {
if($v->target_srl== $val->document_srl) {
if($document_list) foreach($document_list as $key => $val)
{
foreach($output->data as $k => $v)
{
if($v->target_srl== $val->document_srl)
{
$output->data[$k]->url = $val->getPermanentUrl();
$output->data[$k]->regdate = $val->getRegdate("Y-m-d H:i");
$output->data[$k]->nick_name = $val->getNickName();
@ -199,9 +218,12 @@
$oCommentModel = &getModel('comment');
$comment_list = $oCommentModel->getComments($target_list);
if($comment_list) foreach($comment_list as $key => $val) {
foreach($output->data as $k => $v) {
if($v->target_srl== $val->comment_srl) {
if($comment_list) foreach($comment_list as $key => $val)
{
foreach($output->data as $k => $v)
{
if($v->target_srl== $val->comment_srl)
{
$output->data[$k]->url = $val->getPermanentUrl();
$output->data[$k]->regdate = $val->getRegdate("Y-m-d H:i");
$output->data[$k]->nick_name = $val->getNickName();
@ -222,8 +244,9 @@
* @param integer $list_count list count of page navigation
*
* @return Object
**/
function getImages($target, $module_srls_list, $search_keyword, $page=1, $list_count = 20) {
*/
function getImages($target, $module_srls_list, $search_keyword, $page=1, $list_count = 20)
{
return $this->_getFiles($target, $module_srls_list, $search_keyword, $page, $list_count);
}
@ -237,10 +260,11 @@
* @param integer $list_count list count of page navigation
*
* @return Object
**/
function getFiles($target, $module_srls_list, $search_keyword, $page=1, $list_count = 20) {
*/
function getFiles($target, $module_srls_list, $search_keyword, $page=1, $list_count = 20)
{
return $this->_getFiles($target, $module_srls_list, $search_keyword, $page, $list_count, 'N');
}
}
?>
}
/* End of file integration_search.model.php */
/* Location: ./modules/integration_search/integration_search.model.php */

View file

@ -1,12 +1,11 @@
<?php
/**
/**
* The view class of the integration_search module
*
* @author NHN (developers@xpressengine.com)
**/
class integration_searchView extends integration_search {
*/
class integration_searchView extends integration_search
{
/**
* Target mid
* @var array target mid
@ -22,16 +21,18 @@
* Initialization
*
* @return void
**/
function init() {
*/
function init()
{
}
/**
* Search Result
*
* @return Object
**/
function IS() {
*/
function IS()
{
$oFile = &getClass('file');
$oModuleModel = &getModel('module');
// Check permissions
@ -63,7 +64,7 @@
$target = $config->target;
if(!$target) $target = 'include';
if (empty($config->target_module_srl))
if(empty($config->target_module_srl))
$module_srl_list = array();
else
$module_srl_list = explode(',',$config->target_module_srl);
@ -76,9 +77,11 @@
// Search by search tab
$where = Context::get('where');
// Create integration search model object
if($is_keyword) {
if($is_keyword)
{
$oIS = &getModel('integration_search');
switch($where) {
switch($where)
{
case 'document' :
$search_target = Context::get('search_target');
if(!in_array($search_target, array('title','content','title_content','tag'))) $search_target = 'title';
@ -123,12 +126,15 @@
$this->setTemplateFile("index", $page);
break;
}
} else {
}
else
{
$this->setTemplateFile("no_keywords");
}
$security = new Security();
$security->encodeHTML('is_keyword', 'search_target', 'where', 'page');
}
}
?>
}
/* End of file integration_search.view.php */
/* Location: ./modules/integration_search/integration_search.view.php */