*/ claro_send_file($downloadArchiveFile, $downloadArchiveName); unlink($downloadArchiveFile); exit; } else { $dialogBox->error(get_lang('Unable to create zip file')); } } else { $dialogBox->error(get_lang('Not allowed')); } } /*= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = DEFINE CURRENT DIRECTORY = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ if (in_array($cmd, array('rqMv', 'exRm', 'rqEdit', 'exEdit', 'exEditHtml', 'exChVis', 'rqComment', 'exComment', 'submitImage'))) { $curDirPath = claro_dirname(isset($_REQUEST['file']) ? $_REQUEST['file'] : $_REQUEST['relatedFile']); } elseif (in_array($cmd, array('rqMkDir', 'exMkDir', 'rqUpload', 'exUpload', 'rqMkUrl', 'exMkUrl', 'reqMkHtml', 'exMkHtml', 'rqSearch'))) { $curDirPath = $cwd; } elseif ($cmd == 'exChDir') { $curDirPath = $_REQUEST['file']; } elseif ($cmd == 'exMv') { $curDirPath = $_REQUEST['destination']; } elseif ($docView == 'image' || $docView == 'thumbnails') { $curDirPath = $cwd; } else { $curDirPath = ''; } if ($curDirPath == '/' || $curDirPath == '\\' || strstr($curDirPath, '..')) { $curDirPath = ''; // manage the root directory problem /*
/** * build an html form listing all directories of a given directory and file to move * * @param file string: filename to o move * @param baseWorkDir string: complete path to root directory to prupose as target for move */ function form_dir_list($file, $baseWorkDir) { $dirList = index_and_sort_dir($baseWorkDir); $dialogBox = '<strong>' . get_lang('Move') . '</strong>' . "\n" . "<form action=\"" . $_SERVER['PHP_SELF'] . "\" method=\"post\">\n" . claro_form_relay_context() . "<input type=\"hidden\" name=\"cmd\" value=\"exMv\" />\n" . "<input type=\"hidden\" name=\"file\" value=\"" . base64_encode($file) . "\" />\n" . "<label for=\"destiantion\">" . get_lang('Move <i>%filename</i> to', array('%filename' => basename($file))) . "</label> \n" . "<select name=\"destination\">\n"; if (dirname($file) == '/' || dirname($file) == '\\') { $dialogBox .= '<option value="" class="invisible">root</option>' . "\n"; } else { $dialogBox .= '<option value="" >root</option>' . "\n"; } $bwdLen = strlen($baseWorkDir); // base directories length, used under /* build html form inputs */ if ($dirList) { while (list(, $pathValue) = each($dirList)) { $pathValue = substr($pathValue, $bwdLen); // truncate confidential informations $dirname = basename($pathValue); // extract $pathValue directory name /* compute de the display tab */ $tab = ''; // $tab reinitialisation $depth = substr_count($pathValue, '/'); // The number of nombre '/' indicates the directory deepness for ($h = 0; $h < $depth; $h++) { $tab .= '  '; } if ($file == $pathValue or dirname($file) == $pathValue) { $dialogBox .= '<option class="invisible" value="' . $pathValue . '">' . $tab . ' > ' . $dirname . '</option>' . "\n"; } else { $dialogBox .= '<option value="' . $pathValue . '">' . $tab . ' > ' . $dirname . '</option>' . "\n"; } } } $dialogBox .= '</select>' . "\n" . '<br /><br />' . '<input type="submit" value="' . get_lang('Ok') . '" /> ' . claro_html_button($_SERVER['PHP_SELF'] . '?cmd=exChDir&file=' . claro_htmlspecialchars(claro_dirname($file)), get_lang('Cancel')) . '</form>' . "\n"; return $dialogBox; }