2 /************************************************************************/
4 /************************************************************************/
5 /* Copyright (c) 2002-2010 */
7 /* This program is free software. You can redistribute it and/or */
8 /* modify it under the terms of the GNU General Public License */
9 /* as published by the Free Software Foundation. */
10 /************************************************************************/
13 if (!defined('AT_INCLUDE_PATH')) { exit; }
15 if(isset($_POST['submit'])) {
16 unset($_POST['submit']);
23 $file = '../include/config.inc.php';
28 if ( file_exists($file) ) {
30 if (!is_writeable($file)) {
31 $errors[] = '<strong>' . $file . '</strong> is not writeable.';
33 $progress[] = '<strong>' . $file . '</strong> is writeable.';
36 $errors[] = '<strong>' . $file . '</strong> does not exist.';
39 print_progress($step);
41 echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post" name="form">';
44 if (isset($progress)) {
45 print_feedback($progress);
47 print_errors($errors);
49 echo'<input type="hidden" name="step" value="'.$step.'" />';
51 unset($_POST['step']);
52 unset($_POST['action']);
56 echo '<p><strong>Note:</strong> To change permissions on Unix use <kbd>chmod a+rw</kbd> then the file name.</p>';
58 echo '<p align="center"><input type="submit" class="button" value=" Try Again " name="retry" />';
61 require('include/config_template.php');
63 $comments = '/*'.str_pad(' This file was generated by the ATutor '.$new_version. ' installation script.', 70, ' ').'*/
64 /*'.str_pad(' File generated '.date('Y-m-d H:m:s'), 70, ' ').'*/';
66 if (!write_config_file('../include/config.inc.php', $comments)) {
67 echo '<input type="hidden" name="step" value="'.$step.'" />';
69 print_feedback($progress);
71 $errors[] = 'include/config.inc.php cannot be written! Please verify that the file exists and is writeable. On Unix issue the command <kbd>chmod a+rw include/config.inc.php</kbd> to make the file writeable. On Windows edit the file\'s properties ensuring that the <kbd>Read-only</kbd> attribute is <em>not</em> checked and that <kbd>Everyone</kbd> access permissions are given to that file.';
72 print_errors($errors);
74 echo '<p><strong>Note:</strong> To change permissions on Unix use <kbd>chmod a+rw</kbd> then the file name.</p>';
76 echo '<p align="center"><input type="submit" class="button" value=" Try Again " name="retry" />';
79 /* if header img and logo were carried forward AND the upgrade was from 1.4.3 to 1.5 then */
80 if (($_POST['step1']['header_img'] != '' || $_POST['step1']['header_logo'] != '')
81 && $new_version == '1.5' && $_POST['step1']['old_version'] == '1.4.3')
83 $db = mysql_connect($_POST['step1']['db_host'] . ':' . $_POST['step1']['db_port'], $_POST['step1']['db_login'], urldecode($_POST['step1']['db_password']));
84 mysql_select_db($_POST['step1']['db_name'], $db);
86 $sql = "INSERT INTO ".$_POST['step1']['tb_prefix']."themes VALUES ('ATutor_alt', '1.5', 'default_oldheader', NOW() , 'Backwards compatible default theme', 2)";
87 @mysql_query($sql, $db);
89 $sql = "UPDATE ".$_POST['step1']['tb_prefix']."themes SET status=0, version='1.5' WHERE dir_name = 'default'";
90 @mysql_query($sql, $db);
93 echo '<input type="hidden" name="step" value="'.$step.'" />';
96 $progress[] = 'Data has been saved successfully.';
98 $cdir = urldecode(trim($_POST['step4']['content_dir']));
100 @chmod('../include/config.inc.php', 0444);
102 print_feedback($progress);
104 echo '<p align="center"><input type="submit" class="button" value=" Next » " name="submit" /></p>';