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 ignore_user_abort(true);
16 if (!defined('AT_INCLUDE_PATH')) { exit; }
18 if (isset($_POST['submit'])) {
19 if (!isset($errors)) {
20 unset($_POST['submit']);
28 print_progress($step);
30 /* try copying the content over from the old dir to the new one */
31 require('../mods/_core/file_manager/filemanager.inc.php'); // for copys()
33 $content_dir = urldecode(trim($_POST['step5']['content_dir']));
34 $_POST['step5']['copy_from'] = urldecode(trim($_POST['step5']['copy_from'])) . DIRECTORY_SEPARATOR;
36 //copy if copy_from is not empty
38 if ($_POST['step5']['copy_from'] && ($_POST['step5']['copy_from'] != DIRECTORY_SEPARATOR)) {
39 if (is_dir($_POST['step5']['copy_from'])) {
40 $files = scandir($_POST['step5']['copy_from']);
42 foreach ($files as $file) {
43 if ($file == '.' || $file == '..') { continue; }
44 if (is_dir($_POST['step5']['copy_from'] . $file)) {
45 copys($_POST['step5']['copy_from'] . $file, $content_dir . $file);
46 if (is_dir($content_dir.$course)) {
47 $progress[] = 'Course content directory <b>'.$file.'</b> copied successfully.';
49 $errors[] = 'Course content directory <b>'.$file.'</b> <strong>NOT</strong> copied.';
53 copy($_POST['step5']['copy_from'] . $file, $content_dir .$file);
59 $progress[] = 'Using existing content directory <strong>'.$content_dir.'</strong>.';
62 // Create the patcher content directory
63 if (!is_dir($content_dir.'/patcher')) {
64 if (!@mkdir($content_dir.'/patcher')) {
65 $errors[] = '<strong>'.$content_dir.'/patcher</strong> directory does not exist and cannot be created.';
67 } else if (!is_writable($content_dir.'/patcher')){
68 $errors[] = '<strong>'.$content_dir.'/patcher</strong> directory is not writable.';
70 ////////////////////////
72 // Create the module content directory
73 if (!is_dir($content_dir.'/module')) {
74 if (!@mkdir($content_dir.'/module')) {
75 $errors[] = '<strong>'.$content_dir.'/module</strong> directory does not exist and cannot be created.';
77 } else if (!is_writable($content_dir.'/module')){
78 $errors[] = '<strong>'.$content_dir.'/module</strong> directory is not writable.';
80 ////////////////////////
82 // Create the theme content directory
83 if (!is_dir($content_dir.'/theme')) {
84 if (!@mkdir($content_dir.'/theme')) {
85 $errors[] = '<strong>'.$content_dir.'/theme</strong> directory does not exist and cannot be created.';
87 } else if (!is_writable($content_dir.'/theme')){
88 $errors[] = '<strong>'.$content_dir.'/theme</strong> directory is not writable.';
90 ////////////////////////
93 if (isset($progress)) {
94 print_feedback($progress);
97 print_errors($errors);
100 if ($_POST['step1']['cache_dir'] != '') {
101 define('CACHE_DIR', urldecode($_POST['step1']['cache_dir']));
102 define('CACHE_ON', 1);
103 require('../include/phpCache/phpCache.inc.php');
104 cache_gc(NULL, 1, true);
108 <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="form">
109 <input type="hidden" name="step" value="<?php echo $step;?>" />
110 <?php print_hidden($step); ?>
112 <br /><br /><p align="center"><input type="submit" class="button" value=" Next »" name="submit" /></p>