2 /****************************************************************/
4 /****************************************************************/
5 /* Copyright (c) 2002-2010 */
6 /* Inclusive Design Institute */
9 /* This program is free software. You can redistribute it and/or*/
10 /* modify it under the terms of the GNU General Public License */
11 /* as published by the Free Software Foundation. */
12 /****************************************************************/
15 define('AT_INCLUDE_PATH', '../../../include/');
16 require(AT_INCLUDE_PATH.'vitals.inc.php');
17 require_once(AT_INCLUDE_PATH.'../mods/_core/file_manager/filemanager.inc.php');
19 if (!authenticate(AT_PRIV_FILES,AT_PRIV_RETURN)) {
20 authenticate(AT_PRIV_CONTENT);
24 $current_path = AT_CONTENT_DIR.$_SESSION['course_id'].'/';
26 $popup = $_REQUEST['popup'];
27 $framed = $_REQUEST['framed'];
29 if (isset($_POST['submit_no'])) {
30 $msg->addFeedback('CANCELLED');
31 header('Location: index.php?pathext='.$_POST['pathext'].SEP.'framed='.$_POST['framed'].SEP.'popup='.$_POST['popup'].SEP.'cp='.$_POST['cp'].SEP.'cid='.$_POST['cid'].SEP.'pid='.$_POST['pid'].SEP.'a_type='.$_POST['a_type']);
35 if (isset($_POST['cancel'])) {
36 $msg->addFeedback('CANCELLED');
37 header('Location: index.php?pathext='.$_POST['pathext'].SEP.'framed='.$_REQUEST['framed'].SEP.'popup='.$_REQUEST['popup'].SEP.'cp='.$_POST['cp'].SEP.'cid='.$_POST['cid'].SEP.'pid='.$_POST['pid'].SEP.'a_type='.$_POST['a_type']);
41 if (isset($_POST['submit_yes'])) {
42 $dest = $_POST['dest'] .'/';
43 $pathext = $_POST['pathext'];
45 if (isset($_POST['listofdirs'])) {
47 $_dirs = explode(',',$_POST['listofdirs']);
48 $count = count($_dirs);
50 for ($i = 0; $i < $count; $i++) {
53 if (course_realpath($current_path . $pathext . $source) == FALSE) {
54 // error: File does not exist
55 $msg->addError('DIR_NOT_EXIST');
56 header('Location: index.php?pathext='.$pathext.SEP.'framed='.$framed.SEP.'popup='.$popup.SEP.'cp='.$_POST['cp'].SEP.'cid='.$_POST['cid'].SEP.'pid='.$_POST['pid'].SEP.'a_type='.$_POST['a_type']);
59 else if (course_realpath($current_path . $dest) == FALSE) {
60 // error: File does not exist
61 $msg->addError('UNKNOWN');
62 header('Location: index.php?pathext='.$pathext.SEP.'framed='.$framed.SEP.'popup='.$popup.SEP.'cp='.$_POST['cp'].SEP.'cid='.$_POST['cid'].SEP.'pid='.$_POST['pid'].SEP.'a_type='.$_POST['a_type']);
65 else if (strpos($source, '..') !== false) {
66 $msg->addError('UNKNOWN');
67 header('Location: index.php?pathext='.$pathext.SEP.'framed='.$framed.SEP.'popup='.$popup.SEP.'cp='.$_POST['cp'].SEP.'cid='.$_POST['cid'].SEP.'pid='.$_POST['pid'].SEP.'a_type='.$_POST['a_type']);
71 @rename($current_path.$pathext.$source, $current_path.$dest.$source);
74 $msg->addFeedback('DIRS_MOVED');
76 if (isset($_POST['listoffiles'])) {
78 $_files = explode(',',$_POST['listoffiles']);
79 $count = count($_files);
81 for ($i = 0; $i < $count; $i++) {
82 $source = $_files[$i];
84 if (course_realpath($current_path . $pathext . $source) == FALSE) {
85 // error: File does not exist
86 $msg->addError('FILE_NOT_EXIST');
87 header('Location: index.php?pathext='.$pathext.SEP.'framed='.$framed.SEP.'popup='.$popup.SEP.'cp='.$_POST['cp'].SEP.'cid='.$_POST['cid'].SEP.'pid='.$_POST['pid'].SEP.'a_type='.$_POST['a_type']);
90 else if (course_realpath($current_path . $dest) == FALSE) {
91 // error: File does not exist
92 $msg->addError('UNKNOWN');
93 header('Location: index.php?pathext='.$pathext.SEP.'framed='.$framed.SEP.'popup='.$popup.SEP.'cp='.$_POST['cp'].SEP.'cid='.$_POST['cid'].SEP.'pid='.$_POST['pid'].SEP.'a_type='.$_POST['a_type']);
96 else if (strpos($source, '..') !== false) {
97 $msg->addError('UNKNOWN');
98 header('Location: index.php?pathext='.$pathext.SEP.'framed='.$framed.SEP.'popup='.$popup.SEP.'cp='.$_POST['cp'].SEP.'cid='.$_POST['cid'].SEP.'pid='.$_POST['pid'].SEP.'a_type='.$_POST['a_type']);
102 @rename($current_path.$pathext.$source, $current_path.$dest.$source);
105 $msg->addFeedback('MOVED_FILES');
107 header('Location: index.php?pathext='.$_POST['pathext'].SEP.'framed='.$_POST['framed'].SEP.'popup='.$_POST['popup'].SEP.'cp='.$_POST['cp'].SEP.'cid='.$_POST['cid'].SEP.'pid='.$_POST['pid'].SEP.'a_type='.$_POST['a_type']);
111 if (isset($_POST['dir_chosen'])) {
112 $hidden_vars['framed'] = $_REQUEST['framed'];
113 $hidden_vars['popup'] = $_REQUEST['popup'];
114 $hidden_vars['pathext'] = $_REQUEST['pathext'];
115 $hidden_vars['dest'] = $_REQUEST['dir_name'];
116 $hidden_vars['cp'] = $_REQUEST['cp'];
117 $hidden_vars['cid'] = $_REQUEST['cid'];
118 $hidden_vars['pid'] = $_REQUEST['pid'];
119 $hidden_vars['a_type'] = $_REQUEST['a_type'];
121 if (isset($_POST['files'])) {
122 $list_of_files = implode(' <br />', $_POST['files']);
123 $hidden_vars['listoffiles'] = $list_of_files;
124 $msg->addConfirm(array('FILE_MOVE', "<br />".$list_of_files."<br />", $_POST['dir_name']), $hidden_vars);
126 if (isset($_POST['dirs'])) {
127 $list_of_dirs = implode(',', $_POST['dirs']);
128 $hidden_vars['listoffiles'] = $list_of_dirs;
129 $msg->addConfirm(array('DIR_MOVE', $list_of_dirs, $_POST['dir_name']), $hidden_vars);
131 require(AT_INCLUDE_PATH.'header.inc.php');
132 $msg->printConfirm();
133 require(AT_INCLUDE_PATH.'footer.inc.php');
136 require(AT_INCLUDE_PATH.'header.inc.php');
138 $tree = AT_CONTENT_DIR.$_SESSION['course_id'].'/';
139 $file = $_GET['file'];
140 $pathext = $_GET['pathext'];
141 $popup = $_GET['popup'];
142 $framed = $_GET['framed'];
146 $a_type = $_GET['a_type'];
148 /* find the files and directories to be copied */
149 $total_list = explode(',', $_GET['list']);
151 $count = count($total_list);
154 for ($i=0; $i<$count; $i++) {
155 if (is_dir($current_path.$pathext.$total_list[$i])) {
156 $_dirs[$countd] = $total_list[$i];
157 $hidden_dirs .= '<input type="hidden" name="dirs['.$countd.']" value="'.$_dirs[$countd].'" />';
160 $_files[$countf] = $total_list[$i];
161 $hidden_files .= '<input type="hidden" name="files['.$countf.']" value="'.$_files[$countf].'" />';
167 <form name="move_form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
168 <div class="input-form">
170 <p><?php echo _AT('select_directory'); ?></p>
175 <li class="folders"><label><input type="radio" name="dir_name" value="<?php echo _AT('home'); ?>"<?php
176 if ($pathext == '') {
177 echo ' checked="checked"';
178 $here = ' ' . _AT('current_location');
180 echo '/>'._AT('home').' ' .$here.'</label>';
182 echo display_tree($current_path, '', $pathext);
187 <div class="row buttons">
188 <input type="submit" name="dir_chosen" value="<?php echo _AT('move'); ?>" accesskey="s" />
189 <input type="submit" name="cancel" value="<?php echo _AT('cancel'); ?>" />
193 <input type="hidden" name="pathext" value="<?php echo $pathext; ?>" />
194 <input type="hidden" name="framed" value="<?php echo $framed; ?>" />
195 <input type="hidden" name="popup" value="<?php echo $popup; ?>" />
196 <input type="hidden" name="cp" value="<?php echo $cp; ?>" />
197 <input type="hidden" name="cid" value="<?php echo $cid; ?>" />
198 <input type="hidden" name="pid" value="<?php echo $pid; ?>" />
199 <input type="hidden" name="a_type" value="<?php echo $a_type; ?>" />
206 <?php require(AT_INCLUDE_PATH.'footer.inc.php');