function update_one_ver($up_file) { global $progress; $update_file = implode('_',$up_file); queryFromFile('db/'.$update_file.'sql'); //$progress[] = 'Successful update from version '.$up_file[2].' to '.$up_file[4]; return $up_file[4]; }
if ($_POST['instructor']) { $status = 3; } else { $status = 2; } $db = mysql_connect($_POST['step2']['db_host'] . ':' . $_POST['step2']['db_port'], $_POST['step2']['db_login'], urldecode($_POST['step2']['db_password'])); mysql_select_db($_POST['step2']['db_name'], $db); $sql = "INSERT INTO ".$_POST['step2']['tb_prefix']."members VALUES (NULL,'$_POST[username]','$_POST[password]','$_POST[email]','','','','', '','', '','','','','', '',$status,'', NOW(),'en', 0, 1, '0000-00-00 00:00:00')"; $result = mysql_query($sql ,$db); $m_id = mysql_insert_id($db); if ($_POST['welcome_course'] && $_POST['instructor']) { $_POST['tb_prefix'] = $_POST['step2']['tb_prefix']; queryFromFile('db/atutor_welcome_course.sql'); } store_steps($step); $step++; return; } } else { unset($_POST['email']); } print_progress($step); if (isset($errors)) { print_errors($errors); }
$sql2 = 'ALTER DATABASE `'.$_POST['db_name'].'` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci'; $result2 = mysql_query($sql2); if (!$result2){ $errors[] = 'Database <b>'.$_POST['db_name'].'</b> is not in UTF8. Please set the database character set to UTF8 before continuing by using the following query: <br /> ALTER DATABASE `'.$_POST['db_name'].'` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci. <br />To use ALTER DATABASE, you need the ALTER privilege on the database. You can also check the MySQL manual <a href="http://dev.mysql.com/doc/refman/4.1/en/alter-database.html" target="mysql_window">here</a>.'; } } } } if (!isset($errors)) { $progress[] = 'Connected to database <b>'.$_POST['db_name'].'</b> successfully.'; $errors = array(); /* @See include/classes/dbmanager.php */ queryFromFile('db/atutor_schema.sql'); queryFromFile('db/atutor_language_text.sql'); if (!$errors) { print_progress($step); unset($_POST['submit']); unset($_POST['action']); store_steps($step); print_feedback($progress); echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post" name="form"> <input type="hidden" name="step" value="3" />'; print_hidden(3); echo '<p align="center"><input type="submit" class="button" value="Next » " name="submit" /></p></form>'; return; }
print_post_for_step9($_POST); echo '<p align="center"><input type="submit" class="button" value=" Next » " name="submit" /></p></form>'; return; } $result = ''; // Get course code to map encoding/charset if ($_POST['convert_type'] == 'all' || $_POST['convert_type'] == 'courses' ){ $query = "SELECT course_id, title FROM ".$_POST['tb_prefix']."courses"; $result = mysql_query($query); if (mysql_num_rows($result) <= 0){ return false; } } else { //'Skip' was selected, convert table structure only queryFromFile('db/atutor_convert_db_to_utf8.sql'); $progress[] = 'Database table structure has been converted to UTF-8.'; print_feedback($progress); if (isset($errors)){ print_errors($errors); echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post" name="form"> <input type="hidden" name="step" value="3" />'; print_hidden(2); print_post_for_step9($_POST); echo '<p align="center"><input type="submit" class="button" value=" Retry " name="submit" /></p></form>'; return; } echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post" name="form"> <input type="hidden" name="step" value="3" />'; echo '<input type="hidden" name="con_step" value="4" />'; print_hidden(2);
} else { /* Check if the database that existed is in UTF-8, if not, ask for retry */ $sql = "SHOW CREATE DATABASE {$_POST['db_name']}"; $result = mysql_query($sql, $db); $row = mysql_fetch_assoc($result); if (!preg_match('/CHARACTER SET utf8/i', $row['Create Database'])) { $errors[] = 'Database <b>' . $_POST['db_name'] . '</b> is not in UTF8. Please set the database character set to UTF8 before continuing by using the following query: ALTER DATABASE `' . $_POST['db_name'] . '` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci. To use ALTER DATABASE, you need the ALTER privilege on the database.'; } } } if (!isset($errors)) { $progress[] = 'Connected to database <b>' . $_POST['db_name'] . '</b> successfully.'; $errors = array(); /* @See include/classes/dbmanager.php */ queryFromFile('db/achecker_schema.sql'); queryFromFile('db/language_text.sql'); if (!$errors) { print_progress($step); unset($_POST['submit']); unset($_POST['action']); store_steps($step); print_feedback($progress); echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post" name="form"> <input type="hidden" name="step" value="3" />'; print_hidden(3); echo '<p align="center"><input type="submit" class="button" value="Next » " name="submit" /></p></form>'; return; } } } }
/* Check if the database that existed is in UTF-8, if not, ask for retry */ $sql = "SHOW CREATE DATABASE {$_POST['db_name']}"; $result = mysql_query($sql, $db); $row = mysql_fetch_assoc($result); if (!preg_match('/CHARACTER SET utf8/i', $row['Create Database'])) { $errors[] = 'Database <b>' . $_POST['db_name'] . '</b> is not in UTF8. Please set the database character set to UTF8 before continuing by using the following query: ALTER DATABASE `' . $_POST['db_name'] . '` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci. To use ALTER DATABASE, you need the ALTER privilege on the database.'; } } } if (!isset($errors)) { $progress[] = 'Connected to database <b>' . $_POST['db_name'] . '</b> successfully.'; $errors = array(); /* @See include/classes/dbmanager.php */ queryFromFile('db/db_schema.sql'); queryFromFile('db/language_text.sql'); queryFromFile('db/HowTo_lesson.sql'); if (!$errors) { print_progress($step); unset($_POST['submit']); unset($_POST['action']); store_steps($step); print_feedback($progress); echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post" name="form"> <input type="hidden" name="step" value="3" />'; print_hidden(3); echo '<p align="center"><input type="submit" class="button" value="Next » " name="submit" /></p></form>'; return; } } } }