function uploadCheck($url) { $allowed = true; if (!is_dir($uploaddir . $url)) { $allowed = false; } if (!dirCheck($url)) { $allowed = false; } return $allowed; }
function get_dirlist_files($currDir, $relDir) { //Goes through directory and reads files and folders in that directory if (dirCheck($currDir)) { $dh = opendir($currDir); while ($file = readdir($dh)) { $tempfilearray[] = $file; } closedir($dh); natcasesort($tempfilearray); //sorts array alphabetically $filearray = array_slice($tempfilearray, 0); // reassigns array keys so directory list will be alphabetical for ($a = 0; $a < count($filearray); $a++) { if (!is_dir($dir . "/" . $filearray[$a])) { $filenum++; } } if ($filenum > 0) { for ($i = 0; $i < count($filearray); $i++) { if ($filearray[$i] != "." and $filearray[$i] != "..") { if (!is_dir($currDir . "/" . $filearray[$i])) { if ($_GET['dir']) { $fh = fopen($currDir . "/" . $filearray[$i], "r"); $fileinfo = fstat($fh); $kbsize = round($fileinfo['size'] / 1024, 2); echo "<li id='" . $relDir . "/" . $filearray[$i] . "'><a href=\"" . $reldir . "user.php?dir=" . $relDir . "&delfilerequest=" . $filearray[$i] . "\"><img src=\"img/delete.png\" alt=\"delete\" title=\"delete\"></a> <a href=\"user.php?dir=" . $_GET['dir'] . "&rename=" . $filearray[$i] . "\"><img src=\"img/rename.png\" alt=\"rename\" title=\"rename\"></a><a href=\"" . $reldir . "user.php?dir=" . $relDir . "&movefilebox=" . $filearray[$i] . "\"><img src=\"img/move.png\" alt=\"move\" title=\"move\"></a> "; echo "<a href=\"readfile.php?file=" . $relDir . "/" . $filearray[$i] . "\"><strong>" . $filearray[$i] . "</strong></a> "; if ($kbsize < 1024) { echo "(" . round($fileinfo['size'] / 1024, 2) . " KB) "; } else { echo "(" . round($fileinfo['size'] / 1024 / 1024, 2) . " MB) "; } echo "</li>\n"; echo "<script type='text/javascript'>new Draggable('" . $relDir . "/" . $filearray[$i] . "', {revert:true});</script>"; } } } } } else { echo "<li>There are no files in this folder</li>"; } } }
function get_dirlist_files($currDir, $relDir) { //Goes through directory and reads files and folders in that directory if (dirCheck($currDir)) { $dh = opendir($currDir); while ($file = readdir($dh)) { $tempfilearray[] = $file; } closedir($dh); natcasesort($tempfilearray); //sorts array alphabetically $filearray = array_slice($tempfilearray, 0); // reassigns array keys so directory list will be alphabetical for ($a = 0; $a < count($filearray); $a++) { if (!is_dir($dir . "/" . $filearray[$a])) { $filenum++; } } if ($filenum > 0) { for ($i = 0; $i < count($filearray); $i++) { if ($filearray[$i] != "." and $filearray[$i] != "..") { if (!is_dir($currDir . "/" . $filearray[$i])) { $fh = fopen($currDir . "/" . $filearray[$i], "r"); $fileinfo = fstat($fh); $kbsize = round($fileinfo['size'] / 1024, 2); echo "<li id='" . $relDir . $filearray[$i] . "'>\n\t\t\t\t\t\t\t\t<a href=\"javascript:delPopUp('" . str_replace("_", " ", $filearray[$i]) . "','" . $relDir . "');\" onclick=\"return dragCheck('" . $relDir . $filearray[$i] . "');\"><img src=\"img/delete.png\" alt=\"delete\" title=\"delete\"></a>"; echo "<a href=\"javascript:renPopUp('" . str_replace("_", " ", $filearray[$i]) . "','" . $relDir . "')\" onclick=\"return dragCheck('" . $relDir . $filearray[$i] . "');\"><img src=\"img/folder_rename.png\" alt=\"rename\" title=\"rename\"></a>"; echo "<a target='_blank' href=\"readfile.php?file=" . $relDir . $filearray[$i] . "\" onclick=\"return dragCheck('" . $relDir . $filearray[$i] . "');\"><strong>" . $filearray[$i] . "</strong></a> "; if ($kbsize < 1024) { echo "(" . round($fileinfo['size'] / 1024, 2) . " KB) "; } else { echo "(" . round($fileinfo['size'] / 1024 / 1024, 2) . " MB) "; } echo "</li>\n"; echo "<script type='text/javascript'>dragDrop('" . $relDir . $filearray[$i] . "');</script>"; } } } } else { echo "<li>There are no files in this folder</li>"; } } }
function get_dirlist_folders($currDir, $relDir) { //Reads all directories in the current folder and checks to make sure its valid if (dirCheck($currDir)) { $dh = opendir($currDir); while ($file = readdir($dh)) { $tempfilearray[] = $file; } closedir($dh); natcasesort($tempfilearray); //sorts array alphabetically $filearray = array_slice($tempfilearray, 0); //reassigns array keys so directory list will be alphabetical for ($a = 0; $a < count($filearray); $a++) { if (is_dir($currDir . "/" . $filearray[$a])) { $filenum++; } } if ($relDir && !strstr($relDir, '.')) { echo "<li><a href=\"javascript: navigate('" . preg_replace('/\\/[^\\/]*\\/$/', '', $currDir) . "/','" . preg_replace('/[^\\/]*\\/$/', '', $relDir) . "');\"><strong>" . "Back" . "</strong></a></li><br />"; } if ($filenum > 2) { echo "<script type='text/javascript'>\n Droppables.drops = [];Draggables.drags=[];\n</script>"; for ($i = 0; $i < count($filearray); $i++) { if ($filearray[$i] != "." && $filearray[$i] != "..") { if (is_dir($currDir . "/" . $filearray[$i])) { echo "<li id='" . $relDir . $filearray[$i] . "/'>\n\t\t\t\t\t\t\t\t<a href=\"javascript:delPopUp('" . str_replace("_", " ", $filearray[$i]) . "','" . $relDir . "');\" onclick=\"return dragCheck('" . $relDir . $filearray[$i] . "/');\"><img src=\"img/delete.png\" alt=\"delete\" title=\"delete\"></a>"; echo "<a href=\"javascript:renPopUp('" . str_replace("_", " ", $filearray[$i]) . "','" . $relDir . "')\" onclick=\"return dragCheck('" . $relDir . $filearray[$i] . "/');\"><img src=\"img/folder_rename.png\" alt=\"rename\" title=\"rename\"></a>"; echo "<a href=\"javascript:navigate('" . $currDir . $filearray[$i] . "/','" . $relDir . $filearray[$i] . "/')\" onclick=\"return dragCheck('" . $relDir . $filearray[$i] . "/');\" ><strong>" . str_replace("_", " ", $filearray[$i]) . "</strong></a></li>\n"; echo "<script type='text/javascript'>dragDrop('" . $relDir . $filearray[$i] . "/','droppable');</script>"; } } } } else { echo "<li>There are no directories in this folder</li>"; } } else { echo "<p>That directory is restricted for security purposes.</p>"; } }
<?php include_once 'config.php'; include_once 'process.php'; include_once 'namecheck.php'; include_once 'dirsize.php'; include_once 'ajaxFileList.php'; include_once 'ajaxDirList.php'; if ($_GET['delfolder']) { if (dirCheck("/" . $_GET['delfolder'])) { $delfolderres = deleteDirectory("uploaded_files/" . $_GET['dir'] . "/" . $_GET['delfolder']); } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-trans.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Class Repository</title> <link href="style.css" rel="stylesheet" type="text/css" /> <script src="js/prototype.js" type="text/javascript"></script> <script src="js/scriptaculous.js" type="text/javascript"></script> <script src="js/functions.js" type="text/javascript"></script> </head> <div id="background"> <body> <div id="functionboxwrap" style="display: none">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>meltingice file system - <?php echo $_SESSION['username'] . "'s personal files"; ?> </title> <link href="style.css" rel="stylesheet" type="text/css" /> <script src="js/prototype.js" type="text/javascript"></script> <script src="js/scriptaculous.js" type="text/javascript"></script> </head> <div id="background"> <?php if ($_GET['upload'] || $_GET['mkdir'] || $_GET['renameres'] || $_GET['edit'] || $_GET['moveres']) { echo '<body onLoad="new Effect.Appear(\'userstatus\'); new Effect.Fade(\'userstatus\', {delay: 5});">'; } elseif ($_GET['rename'] && dirCheck("/" . $_GET['rename'])) { echo '<body onLoad="new Effect.Appear(\'renamefile\')">'; } elseif ($_GET['uploadbox'] == "true") { echo '<body onLoad="new Effect.Appear(\'uploadbox\')">'; } elseif ($_GET['mkdirbox'] == "true") { echo '<body onLoad="new Effect.Appear(\'mkdirbox\')">'; } elseif ($_GET['delfileconfirm']) { echo '<body onLoad="new Effect.Appear(\'delfilebox\')">'; } elseif ($_GET['movefilebox']) { echo '<body onLoad="new Effect.Appear(\'movefilebox\')">'; } else { echo "<body>"; } ?> <div id="functionboxwrap" style="<?php
<?php include_once 'namecheck.php'; include_once 'config.php'; if ($_GET['file']) { if (!dirCheck("/" . $_GET['file'])) { echo "Stop hacking >.>"; } else { $finfo = finfo_open(FILEINFO_MIME_TYPE); $fullpath = $uploaddir . $_GET['file']; $urlinfo = pathinfo($fullpath); $mimeT = finfo_file($finfo, $fullpath); header('Content-Type: ' . $mimeT); header('Content-Disposition: inline; filename="' . $urlinfo['basename'] . '"'); header('Content-Length: ' . filesize($fullpath)); readfile($fullpath); finfo_close($finfo); } } else { echo "<p>You must specify an input file!</p>"; }
} if (!file_exists("{$logosPath}login_sx.png")) { copy(R3_WEB_DIR . "images/login_sx.png", "{$logosPath}login_sx.png"); chmod("{$logosPath}login_sx.png", 0770); } if (!file_exists("{$logosPath}logo_sx.png")) { copy(R3_WEB_DIR . "images/logo_sx.png", "{$logosPath}logo_sx.png"); chmod("{$logosPath}logo_sx.png", 0770); } if (!file_exists("{$logosPath}logo_dx.png")) { copy(R3_WEB_DIR . "images/logo_dx.png", "{$logosPath}logo_dx.png"); chmod("{$logosPath}logo_dx.png", 0770); } dirCheck(R3_SMARTY_TEMPLATE_DIR, array('fatal' => true)); dirCheck(R3_SMARTY_TEMPLATE_C_DIR_ADMIN, array('fatal' => false, 'create' => true, 'writeable' => true)); dirCheck(R3_LOG_DIR, array('fatal' => false, 'create' => true, 'writeable' => true)); fileCheck(R3_FOP_CMD, array('fatal' => true)); // Error mail check if (R3_ERROR_SYSLOG) { echo "Warning: R3_ERROR_SYSLOG is true\n"; } if (!R3_ERROR_ERRLOG) { echo "Warning: R3_ERROR_SYSLOG is false\n"; } if (!R3_ERROR_MAIL) { echo "Warning: R3_ERROR_MAIL is false\n"; } else { echo "Mail notify to " . R3_ERROR_MAIL_ADDR . " (limit to " . R3_ERROR_MAX_EMAIL . ")\n"; } try { echo "Connectiong to {$dsn['dbname']} on {$dsn['dbhost']} as {$dsn['dbuser']}\n";