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 /************************************************************************/
11 // $Id: ustep4.php 10055 2010-06-29 20:30:24Z cindy $
13 ignore_user_abort(true);
16 if (!defined('TR_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('../include/classes/FileUtility.class.php'); // for copys()
33 $content_dir = urldecode(trim($_POST['step4']['content_dir']));
34 $_POST['step4']['copy_from'] = urldecode(trim($_POST['step4']['copy_from'])) . DIRECTORY_SEPARATOR;
36 //copy if copy_from is not empty
37 if ($_POST['step4']['copy_from'] && ($_POST['step4']['copy_from'] != DIRECTORY_SEPARATOR)) {
38 if (is_dir($_POST['step4']['copy_from'])) {
39 $files = scandir($_POST['step4']['copy_from']);
41 foreach ($files as $file) {
42 if ($file == '.' || $file == '..') { continue; }
43 if (is_dir($_POST['step4']['copy_from'] . $file)) {
44 FileUtility::copys($_POST['step4']['copy_from'] . $file, $content_dir . $file);
45 if (is_dir($content_dir.$course)) {
46 $progress[] = 'Course content directory <b>'.$file.'</b> copied successfully.';
48 $errors[] = 'Course content directory <b>'.$file.'</b> <strong>NOT</strong> copied.';
52 copy($_POST['step4']['copy_from'] . $file, $content_dir .$file);
57 $progress[] = 'Using existing content directory <strong>'.$content_dir.'</strong>.';
60 if (isset($progress)) {
61 print_feedback($progress);
64 print_errors($errors);
67 if ($_POST['step1']['cache_dir'] != '') {
68 define('CACHE_DIR', urldecode($_POST['step1']['cache_dir']));
69 define('CACHE_ON', 1);
70 require('../include/phpCache/phpCache.inc.php');
71 cache_gc(NULL, 1, true);
75 <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="form">
76 <input type="hidden" name="step" value="<?php echo $step;?>" />
77 <?php print_hidden($step); ?>
79 <br /><br /><p align="center"><input type="submit" class="button" value=" Next »" name="submit" /></p>