XpressEngine Core  1.11.2
 All Classes Namespaces Files Functions Variables Pages
install.view.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) NAVER <http://www.navercorp.com> */
8 class installView extends install
9 {
10  var $install_enable = false;
11 
15  function init()
16  {
17  // Set browser title
18  Context::setBrowserTitle(Context::getLang('introduce_title'));
19  // Specify the template path
20  $this->setTemplatePath($this->module_path.'tpl');
21  // Error occurs if already installed
22  if(Context::isInstalled()) return $this->stop('msg_already_installed');
23  // Install a controller
24  $oInstallController = getController('install');
25  $this->install_enable = $oInstallController->checkInstallEnv();
26  // If the environment is installable, execute installController::makeDefaultDirectory()
27  if($this->install_enable) $oInstallController->makeDefaultDirectory();
28  }
29 
34  {
35  $install_config_file = FileHandler::getRealPath('./config/install.config.php');
36  if(file_exists($install_config_file))
37  {
59  include $install_config_file;
60  if(is_array($install_config))
61  {
62  foreach($install_config as $k => $v)
63  {
64  $v = ($k == 'db_table_prefix') ? $v.'_' : $v;
65  Context::set($k,$v,true);
66  }
67  unset($GLOBALS['__DB__']);
68  Context::set('install_config', true, true);
69  $oInstallController = getController('install');
70  $output = $oInstallController->procInstall();
71  if (!$output->toBool()) return $output;
72  header("location: ./");
74  exit;
75  }
76  }
77 
79  $this->setTemplateFile('introduce');
80  }
81 
86  {
87  $this->setTemplateFile('license_agreement');
88 
89  $lang_type = Context::getLangType();
90  Context::set('lang_type', $lang_type);
91  }
92 
97  {
98  $oInstallController = getController('install');
99  $useRewrite = $oInstallController->checkRewriteUsable() ? 'Y' : 'N';
100  $_SESSION['use_rewrite'] = $useRewrite;
101  Context::set('use_rewrite', $useRewrite);
102 
103  // nginx 체크, rewrite 사용법 안내
104  if($useRewrite == 'N' && stripos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false) Context::set('use_nginx', 'Y');
105 
106  $this->setTemplateFile('check_env');
107  }
108 
113  {
114  // Display check_env if it is not installable
115  if(!$this->install_enable) return $this->dispInstallCheckEnv();
116  // Enter ftp information
117  if(ini_get('safe_mode') && !Context::isFTPRegisted())
118  {
119  Context::set('progressMenu', '3');
120  $this->setTemplateFile('ftp');
121  }
122  else
123  {
124  $defaultDatabase = 'mysqli';
125  $disableList = DB::getDisableList();
126  if(is_array($disableList))
127  {
128  foreach($disableList AS $key=>$value)
129  {
130  if($value->db_type == $defaultDatabase)
131  {
132  $defaultDatabase = 'mysql';
133  break;
134  }
135  }
136  }
137  Context::set('defaultDatabase', $defaultDatabase);
138 
139  Context::set('progressMenu', '4');
140  $this->setTemplateFile('select_db');
141  }
142  }
143 
147  function dispInstallDBForm()
148  {
149  // Display check_env if not installable
150  if(!$this->install_enable) return $this->dispInstallCheckEnv();
151  // Return to the start-up screen if db_type is not specified
152  if(!Context::get('db_type')) return $this->dispInstallSelectDB();
153 
154  // Output the file, disp_db_info_form.html
155  $tpl_filename = sprintf('form.%s', Context::get('db_type'));
156 
157  $title = sprintf(Context::getLang('input_dbinfo_by_dbtype'), Context::get('db_type'));
158  Context::set('title', $title);
159 
160  $error_return_url = getNotEncodedUrl('', 'act', Context::get('act'), 'db_type', Context::get('db_type'));
161  if($_SERVER['HTTPS'] == 'on')
162  {
163  // Error occured when using https protocol at "ModuleHandler::init() '
164  $parsedUrl = parse_url($error_return_url);
165  $error_return_url = '';
166  if(isset($parsedUrl['path'])) $error_return_url .= $parsedUrl['path'];
167  if(isset($parsedUrl['query'])) $error_return_url .= '?' . $parsedUrl['query'];
168  if(isset($parsedUrl['fragment'])) $error_return_url .= '?' . $parsedUrl['fragment'];
169  }
170  Context::set('error_return_url', $error_return_url);
171 
172  $this->setTemplateFile($tpl_filename);
173  }
174 
179  {
180  // Display check_env if not installable
181  if(!$this->install_enable) return $this->dispInstallCheckEnv();
182 
183  include _XE_PATH_.'files/config/tmpDB.config.php';
184 
185  Context::set('use_rewrite', $_SESSION['use_rewrite']);
186  Context::set('time_zone', $GLOBALS['time_zone']);
187  Context::set('db_type', $db_info->db_type);
188  $this->setTemplateFile('config_form');
189  }
190 
191  function useRewriteModule()
192  {
193  if(function_exists('apache_get_modules') && in_array('mod_rewrite',apache_get_modules()))
194  {
195  return true;
196  }
197 
198  require_once(_XE_PATH_.'classes/httprequest/XEHttpRequest.class.php');
199  $httpRequest = new XEHttpRequest($_SERVER['HTTP_HOST'], $_SERVER['SERVER_PORT']);
200  $xeInstallPath = substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], 'index.php', 1));
201  $output = $httpRequest->send($xeInstallPath.'modules/install/conf/info.xml');
202 
203  return (strpos($output->body, '<?xml') !== 0);
204  }
205 
210  {
211  // Display check_env if not installable
212  if(!$this->install_enable)
213  {
214  return $this->dispInstallCheckEnv();
215  }
216 
217  Context::loadLang('modules/member/lang');
218  $message = Context::getLang('about_password_strength');
219 
220  Context::setLang('msg_password_strength', $message['high']);
221 
222  $this->setTemplateFile('admin_form');
223  }
224 }
225 /* End of file install.view.php */
226 /* Location: ./modules/install/install.view.php */
setTemplateFile($filename)
getController($module_name)
Definition: func.inc.php:90
static getDisableList()
Definition: DB.class.php:238
dispInstallIntroduce()
Display license messages.
loadLang($path)
if(file_exists(_XE_PATH_. 'config/config.user.inc.php')) if(!defined('__DEBUG__')) if(!defined('__DEBUG_OUTPUT__')) if(!defined('__DEBUG_PROTECT__')) if(!defined('__DEBUG_PROTECT_IP__')) if(!defined('__DEBUG_DB_OUTPUT__')) if(!defined('__LOG_SLOW_QUERY__')) if(!defined('__LOG_SLOW_TRIGGER__')) if(!defined('__LOG_SLOW_ADDON__')) if(!defined('__LOG_SLOW_WIDGET__')) if(!defined('__DEBUG_QUERY__')) if(!defined('__OB_GZHANDLER_ENABLE__')) if(!defined('__ENABLE_PHPUNIT_TEST__')) if(!defined('__PROXY_SERVER__')) if(!defined('__ERROR_LOG__')) if(!defined('__DISABLE_DEFAULT_CSS__')) if(!defined('__AUTO_OPCACHE_INVALIDATE__')) if((__DEBUG_OUTPUT__==2)&&version_compare(PHP_VERSION, '6.0.0')===-1) if(version_compare(PHP_VERSION, '5.3.0') >=0) $GLOBALS['__xe_autoload_file_map']
Definition: config.inc.php:324
$output
Definition: ko.install.php:193
set($key, $val, $set_to_get_vars=0)
getNotEncodedUrl()
Definition: func.inc.php:316
setBrowserTitle($site_title)
init()
Initialization.
setLang($code, $val)
dispInstallSelectDB()
Choose a DB.
install module of the high class
getRealPath($source)
dispInstallCheckEnv()
Display messages about installation environment.
getLang($code)
const _XE_PATH_
Definition: config.inc.php:49
dispInstallLicenseAgreement()
License agreement.
dispInstallDBForm()
Display a screen to enter DB and administrator&#39;s information.
View class of install module.
Definition: install.view.php:8
dispInstallConfigForm()
Display a screen to enter DB and administrator&#39;s information.
dispInstallManagerForm()
Display a screen to enter DB and administrator&#39;s information.