示例#1
0
文件: index.php 项目: michaelprem/phc
     $parrentdir = $_REQUEST['parentdir'];
     $fname = $_REQUEST['fname'];
     if ($subdir != "") {
         $parrentdir = $dir;
         $dir = $subdir;
     }
     $newid = $_REQUEST['id'];
     $main->savefile($access, $dir, $parrentdir, $fname, $newid);
 }
 if ($_REQUEST['do'] == "delete" and isset($_REQUEST['id'])) {
     if ($_REQUEST['id'] > 0) {
         $main->deletefile($_REQUEST['id']);
     }
 }
 if ($_REQUEST['do'] == "edit" and isset($_REQUEST['id'])) {
     $fileinfo = $main->getfileedit($_REQUEST['id']);
     print "<script type='text/javascript'>\n            function savevalidate(form)\n            {\n                error=\"\";\n                if ( form.fname.value == \"\" )\n                {\n                    error=\"" . str_replace(":", ",", " " . $main->edit_array($text['fname']) . " ") . "\";\n                }\n                if (error != '' )\n                {\n                    error=error.replace(\":\", \",\");\n                    alert('" . $main->edit_array($text['missingfields']) . "'+' '+error);\n                    return;\n                }\n                else\n                {\n                    form.submit();\n                }\n            }\n        </script>";
     print "<br /><br /><form enctype='multipart/form-data' action='?page=downloads' method='post'>\n            <table><tr><td>\n            <input type='hidden' name='rid' value='{$requestid}' />\n            <input type='hidden' name='id' value='{$_REQUEST['id']}' />\n            <input type='hidden' name='do' value='save' />\n            <input type='hidden' name='parentdir' value='" . $fileinfo->records['0']['parrentdir'] . "' />\n            <input type='hidden' name='dir' value='{$dir}' />\n            {$text['filename']}</td><td>" . $fileinfo->records['0']['filename'] . "</td></tr>\n            <tr><td>{$text['size']}</td><td>" . $fileinfo->records['0']['size'] . "</td></tr>\n            <tr><td>{$text['uploaded']}</td><td>" . $fileinfo->records['0']['date'] . "</td></tr>\n            \n";
     print "<tr><td><label for='fname'>{$text['fname']}</label></td><td><input name='fname' type='text' id='fname' value='" . $fileinfo->records['0']['name'] . "'/></td></tr>";
     print "<tr><td><label for='subdir'>{$text['subdir']}</label></td><td><input name='subdir' type='text' id='subdir' value='" . $fileinfo->records['0']['dir'] . "'/></td></tr>";
     print "<tr><td><label for='access'>{$text['access']}</label></td><td><select name='access'>";
     $editedfileaccess = $fileinfo->records['0']['access'];
     $selected = "";
     if ($editedfileaccess == 0) {
         $selected = "selected=selected";
     } else {
         $selected = "";
     }
     print "<option value='0' {$selected}>{$text['noaccess']}</option>\n";
     if ($editedfileaccess == 1) {
         $selected = "selected=selected";