2 /************************************************************************/
4 /************************************************************************/
5 /* Copyright (c) 2010 */
6 /* Inclusive Design Institute */
8 /* This program is free software. You can redistribute it and/or */
9 /* modify it under the terms of the GNU General Public License */
10 /* as published by the Free Software Foundation. */
11 /************************************************************************/
13 if (!defined('TR_INCLUDE_PATH')) { exit; }
14 session_unset(); //clear session before using it
16 print_progress($step);
18 if (isset($_POST['submit']) && (trim($_POST['old_path']) != '')) {
19 if ((strpos($_POST['old_path'], '/') === false) && is_dir('../../'.$_POST['old_path'])) {
20 if ( file_exists('../../'.$_POST['old_path'] . '/include/config.inc.php') ) {
22 require('../../'.$_POST['old_path'] . '/include/constants.inc.php');
23 $progress[] = 'Found AContent version <kbd><b>'.VERSION . '</b></kbd> in path <kbd><b>'.$_POST['old_path'].'</b></kbd>.';
25 if (!version_compare(VERSION, $new_version, '<')) {
26 $errors[] = 'The version upgrading (<kbd><b>'.VERSION.'</b></kbd>) is not older than the new version (<kbd><b>'.$new_version.'</b></kbd>).';
30 $progress[] = 'Will be upgrading from version <kbd><b>'.VERSION.'</b></kbd> to version <kbd><b>'.$new_version.'</b></kbd>.';
31 print_feedback($progress);
33 require('../../'.$_POST['old_path'] . '/include/config.inc.php');
35 echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post" name="form">';
36 echo '<input type="hidden" name="step" value="2" />';
37 echo '<input type="hidden" name="old_path" value="'.$_POST['old_path'].'" />';
39 echo '<input type="hidden" name="db_login" value="'.urlencode(DB_USER).'" />';
40 echo '<input type="hidden" name="db_password" value="'.urlencode(DB_PASSWORD).'" />';
41 echo '<input type="hidden" name="db_host" value="'.DB_HOST.'" />';
42 if (defined('DB_PORT')) {
43 echo '<input type="hidden" name="db_port" value="'.DB_PORT.'" />';
45 echo '<input type="hidden" name="db_port" value="3306" />';
47 echo '<input type="hidden" name="db_name" value="'.DB_NAME.'" />';
49 if (defined('TABLE_PREFIX')) {
50 echo '<input type="hidden" name="tb_prefix" value="'.TABLE_PREFIX.'" />';
52 echo '<input type="hidden" name="tb_prefix" value="" />';
54 if (defined('SITE_NAME')) {
55 echo '<input type="hidden" name="site_name" value="'.urlencode(SITE_NAME).'" />';
57 echo '<input type="hidden" name="site_name" value="'.$_defaults['site_name'].'" />';
59 if (defined('HEADER_IMAGE')) {
60 echo '<input type="hidden" name="header_img" value="'.HEADER_IMAGE.'" />';
62 echo '<input type="hidden" name="header_img" value="'.$_defaults['header_img'].'" />';
64 if (defined('HEADER_LOGO')) {
65 echo '<input type="hidden" name="header_logo" value="'.HEADER_LOGO.'" />';
67 echo '<input type="hidden" name="header_logo" value="'.$_defaults['header_logo'].'" />';
69 if (defined('HOME_URL')) {
70 echo '<input type="hidden" name="home_url" value="'.HOME_URL.'" />';
72 echo '<input type="hidden" name="home_url" value="'.$_defaults['home_url'].'" />';
75 if (defined('MAIL_USE_SMTP')) {
76 echo '<input type="hidden" name="smtp" value="'.(MAIL_USE_SMTP ? 'TRUE' : 'FALSE').'" />';
78 echo '<input type="hidden" name="smtp" value="FALSE" />';
80 if (defined('TR_FORCE_GET_FILE')) {
81 echo '<input type="hidden" name="get_file" value="'.(TR_FORCE_GET_FILE ? 'TRUE' : 'FALSE').'" />';
83 echo '<input type="hidden" name="get_file" value="FALSE" />';
85 echo '<input type="hidden" name="admin_password" value="'.urlencode(ADMIN_PASSWORD).'" />';
87 if (defined('ADMIN_USERNAME')) {
88 echo '<input type="hidden" name="admin_username" value="'.ADMIN_USERNAME.'" />';
90 echo '<input type="hidden" name="admin_username" value="'.$_defaults['admin_username'].'" />';
93 if (defined('ADMIN_EMAIL')) {
94 echo '<input type="hidden" name="admin_email" value="'.ADMIN_EMAIL.'" />';
96 echo '<input type="hidden" name="admin_email" value="'.$_defaults['admin_email'].'" />';
98 if (defined('EMAIL')) {
99 echo '<input type="hidden" name="contact_email" value="'.EMAIL.'" />';
100 } else if (defined('ADMIN_EMAIL')) {
101 echo '<input type="hidden" name="contact_email" value="'.ADMIN_EMAIL.'" />';
103 echo '<input type="hidden" name="contact_email" value="'.$_defaults['admin_email'].'" />';
106 if (defined('TR_EMAIL_CONFIRMATION')) {
107 echo '<input type="hidden" name="email_confirmation" value="'.(TR_EMAIL_CONFIRMATION ? 'TRUE' : 'FALSE').'" />';
109 echo '<input type="hidden" name="email_confirmation" value="FALSE" />';
112 if (isset($MaxFileSize)) {
113 echo '<input type="hidden" name="max_file_size" value="'.$MaxFileSize.'" />';
115 echo '<input type="hidden" name="max_file_size" value="'.$_defaults['max_file_size'].'" />';
118 echo '<input type="hidden" name="ill_ext" value="' . $_defaults['ill_ext'] . '" />';
120 if (defined('CACHE_DIR')) {
121 echo '<input type="hidden" name="cache_dir" value="' . CACHE_DIR . '" />';
123 echo '<input type="hidden" name="cache_dir" value="' . $_defaults['cache_dir'] . '" />';
126 if (defined('TR_CONTENT_DIR')) {
127 echo '<input type="hidden" name="content_dir" value="'.TR_CONTENT_DIR.'" />';
129 echo '<input type="hidden" name="content_dir" value="'.$_defaults['content_dir'].'" />';
131 echo '<input type="hidden" name="new_version" value="'.$new_version.'" />';
132 echo '<input type="hidden" name="old_version" value="'.VERSION.'" />';
133 echo '<p align="center"><input type="submit" class="button" value=" Next » " name="submit" /></p></form>';
137 $errors[] = 'Directory was found, but the old configuration file cannot be found.';
140 $errors[] = 'Directory does not exist relative to the new installation.';
144 if (isset($progress)) {
145 print_feedback($progress);
148 if (isset($errors)) {
149 print_errors($errors);
153 <p>Please specify the location of the old AContent installation.</p>
156 <li>Release Candidate (RC) installations cannot be upgraded.</li>
157 <li>Depending on the size of the existing courses, some steps (particularly 2 and 6) of the upgrade may require considerable time to complete.</li>
158 <li>All installed language packs will be deleted.</li>
159 <li>Some installed themes may not be supported by this version.</li>
160 <li>All extra modules will have to be reinstalled before they can be enabled again.</li>
163 <p>Select the old AContent installation directory below.</p>
166 $dirs = scandir('../../');
167 $path = realpath('../../').'/';
168 $current_dir = basename(realpath(getcwd() .'../../'));
169 foreach ($dirs as $key => $value) {
170 if ($value == '.' || $value == '..') {
173 if ($current_dir == $value) {
177 if (!is_dir($path . $value) || !file_exists($path . $value . '/include/config.inc.php')) {
183 <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="form">
184 <input type="hidden" name="new_version" value="<?php echo $new_version; ?>" />
185 <input type="hidden" name="step" value="1" />
187 <table width="70%" class="tableborder" cellspacing="0" cellpadding="1" border="0" align="center">
189 <td class="row1"><div class="required" title="Required Field">*</div><b><label for="dir">Old Directory Name:</label></b><br />
190 The old directory must be at the same level as the current directory.</td>
191 <td class="row1" valign="middle">
193 <select name="old_path">
194 <?php foreach ($dirs as $dir): ?>
195 <option value="<?php echo htmlspecialchars($dir); ?>"><?php echo $dir; ?>/</option>
208 <br /><p align="center"><input type="submit" class="button" value="Next » " name="submit" /></p>