<?php
#####################################
# phprofession January 2002 #
# modified by Aidan Peiser #
# Recruitment module for postnuke #
# www.galore.co.za #
# .,.,.,, #
# C 'C' C #
# > ~ < #
#####################################
# $modulename = "phprofession"; change this to the name of your recruitmentmodule #
$modulename = "phprofession";
include("../config.php");
if ($path == null)
$path=".";
if ($file == "undefined")
$file = null;
?>
<html>
<head>
<title>File Manager</title>
</head>
<body bgcolor="whitesmoke">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2" bgcolor="ffffff">
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td height=85 align=left><a href="<? echo "$websiteurl";?>"><img src="<? echo "$logopath"; ?>" border="0" alt=""></a></td>
</tr>
</table>
<center>
<br>
<? echo "<a href=\"javascript:history.back()\">Go Back</a> | <a href=\"../admin.php?cmd=Admin\">Admin Menu</a> | <a href=\"../admin.php?cmd=Add\">Add Listing</a> | <a href=\"../admin.php?cmd=browse\">Browse CV's</a> | <a href=\"../admin.php?cmd=Search\">search CV's</a> | <a href=\"index.php\">Uploaded CV's</a> | <a href=\"../admin.php?cmd=RecruitingClient\">Recruitment Clients</a> | <a href=\"../admin.php?cmd=Administrator\">Administrator</a>"; ?>
</font>
</center>
</td></tr>
<tr><td height="100%" width="83%" bgcolor="ffffff" align="left" valign="top">
<?php
function displaydir()
{
global $path, $pw;
$dir = opendir ($path);
while ($file = readdir($dir)):
if (is_dir($file)):
if ($file == "."):
echo ('<b><A HREF="javascript:go(\''. urlencode($path) .'\');">'.$file.'/</a></b><br>');
elseif ($file == ".."):
echo ('<b><A HREF="javascript:go(\'' . urlencode(dirname($path)) .'\');">'.$file.'/</a></b><br>');
else:
echo ('<b><A HREF="javascript:go(\'' . urlencode($path . '/'. $file) .'\');">'.$file.'/</a></b><br>');
endif;
else:
echo ('<li><b><A HREF="'. dirname($file) .'">'.$file.'</a></b><br>');
endif;
endwhile;
closedir($dir);
echo ('<br><br><br><input type="radio" name="action" value="view" checked>View<input type="radio" name="action" value="edit">Edit<input type="radio" name="action" value="delete">Delete<input type="radio" name="action" value="rename">Rename<input type="radio" name="action" value="copy">Copy<br>');
echo ('<input type="text" name="text1"><input type="submit" name="new" value="New File"><input type="submit" name="new" value="New Dir"><br>');
echo ('Upload: <br>');
echo ('<input type="file" name="userfile">');
echo ('<input type="submit" name="action" value="upload">');
}
function displayfile()
{
global $file, $action, $area, $path,$pw;
echo ('<b><A HREF="javascript:go(\''. urlencode($path) .'\');">'.$path.'</a></b><br>');
echo ('<b><A HREF="$path">'.$path.'download</a></b><br>');
if ($action != "view")
{
echo ('<textarea cols=80 rows=25 name="area" wrap=off>'.htmlentities(join( '', file( $file))) .'</textarea>');
echo ('<input type="submit" value="save" name="action">');
}
else
{
echo ('<a href=admin.php>go back</a><pre>');
$fcontents = file( $file );
while ( list( $line_num, $line ) = each( $fcontents ) ) {
echo "<b>$line_num</b>\t" . htmlspecialchars( $line );
}
echo ('</pre>');
echo ('<input type="submit" value="edit" name="action">');
}
}
if ($pw != "$uploadpassword")
{
echo ('<form action="'.getenv("SCRIPT_URL").'" method="POST">');
echo('<br>Password (try "password") chmod uploads dir to 776:<INPUT type="password" name="pw">' );
echo('<INPUT type="submit">');
echo('</form></body></html>');
exit;
}
echo ('<script language="javascript">function go(p,f){ document.forms[0].path.value=p; document.forms[0].file.value=f;document.forms[0].submit();}</script>');
echo ('<form ENCTYPE="multipart/form-data" action="'.getenv("SCRIPT_URL").'" method="POST">');
echo ('<input type="hidden" name="file" value="'.$file.'">');
echo ('<input type="hidden" name="path" value="'.$path.'">');
echo ('<input type="hidden" name="pw" value="'.$pw.'">');
if ($action == "upload")
{
if ($userfile != null)
copy($userfile, $path.'/'.basename(str_replace('\\','/',stripslashes($userfile_name))));
}
else
if ($new == "New File")
{
if(!fopen($path . '/'. $text1, "w")) echo ("Couldn't create $text1<br>");
}
else if ($new == "New Dir")
{
if(!mkdir($path . '/' .$text1, 0777)) echo ("Couldn't create $text1<br>");
}
else
if ($action == "save")
{
$f = fopen($file, "w");
fputs($f, stripslashes($area));
fclose($f);
}
if ($action == "delete")
{
if ($file != null)
{
if(!unlink($file)) echo "Could not delete $file<br>";
}
else
{
if(!rmdir($path)) echo "Could not delete $path<br>";
$path = dirname($path);
}
}
else
if ($action == "copy")
{
if ($file != null)
{
if(!copy($file, $path .'/'.$text1)) echo("Could not copy $file to $text1<br>");
}
else
{
if (!copy($path, $path .'/'.$text1)) echo("Could not copy $path to $text1<br>");
}
}
else
if ($action == "rename")
{
if ($file != null)
{
if(!rename($file, $path .'/'.$text1)) echo("Could not rename $file to $text1<br>");
}
else
{
if(!rename($path, $path .'/'.$text1)) echo("Could not rename $path to $text1<br>");
}
}
if ($file != null && ($action =="view" || $action == "edit" || $action == "save"))
{
displayfile();
}
else
displaydir();
?>
</form></td></tr></table>
</body>
</html>