function show_dirs($Opcion, $db_path, $tag) { global $arrHttp, $img_path, $msgstr; $source = $_GET['source']; // it can be directory or file on which is clicked $type = $_GET['type']; //this is the type of object on which was clicked (it can be file or dir (directory) $path = $_GET['path']; //this is the virtual path of directory which we have left. $kryptis = $_GET['kryptis']; //this is direction of action. It can be pirmyn (forward) if we open directory and other value this variable can be atgal (back) if we press on .. (we will go back from directory). $cont_type = $_GET['cont_type']; //type of the file $source = stripslashes($source); $path = stripslashes($path); if ($arrHttp["Opcion"] != "mostrar") { if ($source != "..") { echo "<strong>" . $path . $source . "</strong><br>"; } echo "<a href=javascript:CrearCarpeta()>" . $msgstr["new_folder"] . "</a>"; echo " <a href='http://isisabcd.pbworks.com/w/page/Explorar-carpeta' target=_blank>" . $msgstr["online_help"] . "</a><p>"; } if ($type == "file") { if ($cont_type == "") { header("Content-type: application/force-download"); header("Content-Disposition: attachment; filename={$source}"); } else { header("Content-type: {$cont_type}"); // @readfile($this->root_dir.$path.$source); $fp = fopen($this->root_dir . $path . $source, 'r'); fpassthru($fp); die; } } if (preg_match("/\\/\\.\\.\\//", $path)) { $path = "/"; } if ($source == "") { $path = "/"; $root = true; } else { if ($type == "dir") { if ($kryptis == "pirmyn") { $path = $path . $source . "/"; } elseif ($kryptis == "atgal") { preg_match_all("/^\\/(.+)/", $path, $out); // strips first char "/" $path = $out[1][0]; preg_match_all("/(.+)\\/.+\\/\$/", $path, $out); // strips from the path the last directory if ($out[1][0] != "") { $path = "/" . $out[1][0] . "/"; } else { $path = "/" . $out[1][0]; $root = true; } } } } php_dirs_explorer::set("root_dir", $this->root_dir . $path); if (is_dir($this->root_dir)) { if ($dh = opendir($this->root_dir)) { while (($file = readdir($dh)) !== false) { if (filetype($this->root_dir . $file) == "dir") { $turinys["tipas"][] = "dir"; } else { $turinys["tipas"][] = "file"; } //array["type"][]="file" $turinys["pavadinimas"][] = $file; //array["name"][]=$file } closedir($dh); array_multisort($turinys["tipas"], SORT_ASC, $turinys["pavadinimas"]); if (!$root) { $i = 1; } else { $i = 2; Encabezamiento(); } for ($i; $i < count($turinys["tipas"]); $i++) { if ($turinys["tipas"][$i] == "dir") { if ($Opcion == "explorar" and $turinys["pavadinimas"][$i] != "..") { $sel_dir = $this->root_dir; $sel_dir = str_replace($img_path, "", $sel_dir); $sel_dir .= $turinys["pavadinimas"][$i]; $sel_dir = str_replace("//", "/", $sel_dir); echo "<input type=radio name=sel value='" . $turinys["pavadinimas"][$i] . "' onclick=\"window.opener.document.upload.storein.value='" . $sel_dir . "';self.close()\">"; } echo "<img src=\"" . $this->icons_dir . $this->dir_icon . "\">"; if ($i == 1 and $turinys["pavadinimas"][$i] == "..") { echo " <a href=\"?source=" . $turinys["pavadinimas"][$i] . "&Opcion={$Opcion}&tag={$tag}&base=" . $arrHttp["base"] . "&desde=" . $arrHttp["desde"] . "&type=dir&kryptis=atgal&path={$path}\"&Opcion={$Opcion}>" . $turinys["pavadinimas"][$i] . "</a> <br>"; } else { echo " <a href=\"?source=" . $turinys["pavadinimas"][$i] . "&Opcion={$Opcion}&tag={$tag}&base=" . $arrHttp["base"] . "&desde=" . $arrHttp["desde"] . "&type=dir&kryptis=pirmyn&path={$path}\"&Opcion={$Opcion}>" . $turinys["pavadinimas"][$i] . "</a> <br>"; } } else { $file_type = php_dirs_explorer::get_file_type($turinys["pavadinimas"][$i]); $icon = $file_type[0]; $cont_type = $file_type[1]; if ($Opcion == "seleccionar") { $sel_dir = $this->root_dir; $sel_dir = str_replace($db_path, "", $sel_dir); $sel_dir .= $turinys["pavadinimas"][$i]; $sel_dir = str_replace("//", "/", $sel_dir); if (substr($sel_dir, 0, 1) == "/") { $sel_dir = substr($sel_dir, 1); } echo "<input type=checkbox name=sel value='" . $turinys["pavadinimas"][$i] . "' onclick=\"CopiarImagen('" . $sel_dir . "')\">"; } echo "<img src=\"" . $this->icons_dir . "{$icon}\">"; if ($icon != "unident.gif") { echo " <a href=\"javascript:MostrarImagen('" . $turinys["pavadinimas"][$i] . "','file','" . $arrHttp["base"] . "','" . $arrHttp["desde"] . "','{$path}','{$cont_type}','mostrar')\">" . $turinys["pavadinimas"][$i] . "</a> <br>"; } else { echo " " . $turinys["pavadinimas"][$i] . "<br>"; } } } } } }