44 @ini_set('display_errors', 'on'); |
44 @ini_set('display_errors', 'on'); |
45 |
45 |
46 if ( in_array(enano_version(), array('1.0RC1', '1.0RC2', '1.0RC3', '1.0', '1.0.1', '1.0.2', '1.0.3', '1.0.4', '1.0.5', '1.0.6', '1.1.1', '1.1.2', '1.1.3', '1.1.4', '1.1.5')) ) |
46 if ( in_array(enano_version(), array('1.0RC1', '1.0RC2', '1.0RC3', '1.0', '1.0.1', '1.0.2', '1.0.3', '1.0.4', '1.0.5', '1.0.6', '1.1.1', '1.1.2', '1.1.3', '1.1.4', '1.1.5')) ) |
47 define('ENANO_UPGRADE_USE_AES_PASSWORDS', 1); |
47 define('ENANO_UPGRADE_USE_AES_PASSWORDS', 1); |
48 |
48 |
49 $ui = new Enano_Installer_UI('Enano upgrader', false); |
|
50 |
|
51 $stg_welcome = $ui->add_stage('Welcome', true); |
|
52 $stg_confirm = $ui->add_stage('Confirmation', true); |
|
53 $stg_upgrade = $ui->add_stage('Perform upgrade', true); |
|
54 $stg_finish = $ui->add_stage('Finish', true); |
|
55 |
|
56 // init languages |
49 // init languages |
57 $lang_id_list = array_keys($languages); |
50 $lang_id_list = array_keys($languages); |
58 $lang_id = $lang_id_list[0]; |
51 $lang_id = $lang_id_list[0]; |
59 $language_dir = $languages[$lang_id]['dir']; |
52 $language_dir = $languages[$lang_id]['dir']; |
60 |
53 |
61 // load the language file |
54 // load the language file |
62 $lang = new Language($lang_id); |
55 $lang = new Language($lang_id); |
63 $lang->load_file(ENANO_ROOT . '/language/' . $language_dir . '/install.json'); |
56 $lang->load_file(ENANO_ROOT . '/language/' . $language_dir . '/install.json'); |
64 $lang->load_file(ENANO_ROOT . '/language/' . $language_dir . '/user.json'); |
57 $lang->load_file(ENANO_ROOT . '/language/' . $language_dir . '/user.json'); |
|
58 |
|
59 $ui = new Enano_Installer_UI($lang->get('upgrade_system_title'), false); |
|
60 |
|
61 $stg_welcome = $ui->add_stage($lang->get('upgrade_stg_welcome'), true); |
|
62 $stg_login = $ui->add_stage($lang->get('upgrade_stg_login'), true); |
|
63 $stg_confirm = $ui->add_stage($lang->get('upgrade_stg_confirm'), true); |
|
64 $stg_upgrade = $ui->add_stage($lang->get('upgrade_stg_upgrade'), true); |
|
65 $stg_finish = $ui->add_stage($lang->get('upgrade_stg_finish'), true); |
65 |
66 |
66 // Version check |
67 // Version check |
67 if ( enano_version() == installer_enano_version() ) |
68 if ( enano_version() == installer_enano_version() ) |
68 { |
69 { |
69 $ui->show_header(); |
70 $ui->show_header(); |
75 exit(); |
76 exit(); |
76 } |
77 } |
77 |
78 |
78 // Start session manager |
79 // Start session manager |
79 $session->start(); |
80 $session->start(); |
|
81 |
|
82 // Welcome page |
|
83 if ( !isset($_GET['stage']) ) |
|
84 { |
|
85 $ui->show_header(); |
|
86 |
|
87 if ( preg_match('/1\.0/', enano_version()) ) |
|
88 { |
|
89 // Migrating from 1.0.x |
|
90 echo '<h3>' . $lang->get('upgrade_welcome_banshee_heading', array('enano_version' => installer_enano_version())) . '</h3>'; |
|
91 echo '<p>' . $lang->get('upgrade_welcome_banshee_para1') . '</p>'; |
|
92 echo '<p>' . $lang->get('upgrade_welcome_banshee_para2') . '</p>'; |
|
93 } |
|
94 else |
|
95 { |
|
96 // Upgrading from 1.1.x/1.2.x |
|
97 echo '<h3>' . $lang->get('upgrade_welcome_caoineag_heading', array('enano_version' => installer_enano_version())) . '</h3>'; |
|
98 echo '<p>' . $lang->get('upgrade_welcome_caoineag_para1') . '</p>'; |
|
99 } |
|
100 |
|
101 echo '<div style="font-size: x-large; text-align: center; margin: 20px 0;">'; |
|
102 echo '<a class="abutton" href="' . $session->append_sid('upgrade.php?stage=confirm') . '" style="text-decoration: none;">' . $lang->get('upgrade_welcome_btn_continue') . ' »</a>'; |
|
103 echo '</div>'; |
|
104 |
|
105 $ui->show_footer(); |
|
106 exit; |
|
107 } |
|
108 |
80 if ( !$session->user_logged_in || ( $session->user_logged_in && $session->auth_level < USER_LEVEL_ADMIN ) ) |
109 if ( !$session->user_logged_in || ( $session->user_logged_in && $session->auth_level < USER_LEVEL_ADMIN ) ) |
81 { |
110 { |
|
111 $ui->set_visible_stage($stg_login); |
82 if ( isset($_POST['do_login']) ) |
112 if ( isset($_POST['do_login']) ) |
83 { |
113 { |
84 if ( !$session->user_logged_in ) |
114 if ( !$session->user_logged_in ) |
85 { |
115 { |
86 $result = $session->login_without_crypto($_POST['username'], $_POST['password'], false, USER_LEVEL_MEMBER); |
116 $result = $session->login_without_crypto($_POST['username'], $_POST['password'], false, USER_LEVEL_MEMBER); |
89 { |
119 { |
90 $result = $session->login_without_crypto($_POST['username'], $_POST['password'], false, USER_LEVEL_ADMIN); |
120 $result = $session->login_without_crypto($_POST['username'], $_POST['password'], false, USER_LEVEL_ADMIN); |
91 if ( $result['success'] ) |
121 if ( $result['success'] ) |
92 { |
122 { |
93 header('HTTP/1.1 302 Some kind of redirect with implied no content'); |
123 header('HTTP/1.1 302 Some kind of redirect with implied no content'); |
94 header('Location: ' . scriptPath . '/install/' . $session->append_sid('upgrade.php')); |
124 header('Location: ' . scriptPath . '/install/' . $session->append_sid('upgrade.php?stage=confirm')); |
95 exit(); |
125 exit(); |
96 } |
126 } |
97 } |
127 } |
98 } |
128 } |
99 |
129 |
275 <ul> |
305 <ul> |
276 <li><?php echo $lang->get('upgrade_confirm_objective_backup_fs', array('dir' => ENANO_ROOT)); ?></li> |
306 <li><?php echo $lang->get('upgrade_confirm_objective_backup_fs', array('dir' => ENANO_ROOT)); ?></li> |
277 <li><?php echo $lang->get('upgrade_confirm_objective_backup_db', array('dbname' => $dbname)); ?></li> |
307 <li><?php echo $lang->get('upgrade_confirm_objective_backup_db', array('dbname' => $dbname)); ?></li> |
278 </ul> |
308 </ul> |
279 <?php |
309 <?php |
280 if ( $do_langimport ): |
310 if ( $do_langimport && !preg_match('/1\.0/', enano_version()) ): |
281 ?> |
311 ?> |
282 <div class="warning-box"> |
312 <div class="warning-box" style="margin: 10px 0;"> |
283 <?php echo $lang->get('upgrade_confirm_warning_langimport'); ?> |
313 <?php echo $lang->get('upgrade_confirm_warning_langimport'); ?> |
284 </div> |
314 </div> |
285 <?php |
315 <?php |
286 endif; |
316 endif; |
287 ?> |
317 ?> |
288 <form method="get" action="upgrade.php" style="text-align: center;"> |
318 <form method="get" action="upgrade.php" style="text-align: center;"> |
289 <input type="hidden" name="auth" value="<?php echo $session->sid_super; ?>" /> |
319 <input type="hidden" name="auth" value="<?php echo $session->sid_super; ?>" /> |
290 <button name="stage" value="pimpmyenano" class="submit"> |
320 <button name="stage" value="pimpmyenano" class="submit" style="padding-bottom: 8px;"> |
291 <img src="images/icons/pimp.png" /> |
321 <img src="images/icons/pimp.png" style="position: relative; top: 6px;" /> |
292 <?php echo $lang->get('upgrade_confirm_btn_upgrade'); ?> |
322 <?php echo $lang->get('upgrade_confirm_btn_upgrade'); ?> |
293 </button> |
323 </button> |
294 </form> |
324 </form> |
295 <?php |
325 <?php |
296 } |
326 } |