3 $sharedLibrary= dirname(__FILE__) .
"/../../shared/library";
5 require_once(
"$sharedLibrary/hcuEnv.i");
9 "action" => array(
"filter" => FILTER_SANITIZE_STRING),
10 "ndir" => array(
"filter" => FILTER_SANITIZE_STRING),
11 "mdir" => array(
"filter" => FILTER_SANITIZE_STRING),
12 "csub" => array(
"filter" => FILTER_SANITIZE_STRING),
13 "newfolder" => array(
"filter" => FILTER_SANITIZE_STRING),
14 "delete" => array(
"filter" => FILTER_SANITIZE_STRING)
16 HCU_ImportVars($admVars,
"DIRMAINT", $admOk);
20 $top_dir=
"$home_path/public_html";
24 $allowed_dir = array();
25 $allowed_files = array();
30 $allow_multi_subdir =
false;
38 $allowed_dir[] =
"employees";
39 $allowed_dir[] =
"board";
40 $allowed_dir[] =
"vendors";
42 $allowed_dir[] =
"alm";
43 $allowed_dir[] =
"supervisory";
44 $allowed_dir[] =
"misc";
45 $allowed_dir[] =
"disaster";
46 $allowed_dir[] =
"images";
48 $csubValue = HCU_array_key_value(
"csub", $admVars[
'DIRMAINT']);
49 $csub = $csubValue !==
false ? $csubValue :
"";
51 $newfolderValue = HCU_array_key_value(
"newfolder", $admVars[
'DIRMAINT']);
52 $newfolder = $newfolderValue !==
false ? $newfolderValue :
"";
54 $mdirValue = HCU_array_key_value(
"mdir", $admVars[
'DIRMAINT']);
55 $mdir = $mdirValue !==
false ? $mdirValue :
"";
57 $ndirValue = HCU_array_key_value(
"ndir", $admVars[
'DIRMAINT']);
58 $ndir = $ndirValue !==
false ? $ndirValue :
"";
60 $csubValue = HCU_array_key_value(
"csub", $admVars[
'DIRMAINT']);
61 $csub = $csubValue !==
false ? $csubValue :
"";
63 if (strlen($ndir) > 0 && strlen($csub) >= 0 && $dir_search) {
68 if (strpos(strrev($tdir),
"/") !==
false) {
69 $cdir = substr($tdir, 0, strlen($tdir) - strpos(strrev($tdir),
"/") - 1);
71 ($cdir ==
'' ?
"" :
"/" . $cdir);
79 ($csub ==
'' ?
"" :
"/" . $csub) .
80 ($ndir ==
'' ?
"" :
"/" . $ndir) ;
82 } elseif (isset($csub) ==
true) {
83 $cpath = $top_dir . ($csub ==
'' ?
"" :
"/" . $csub);
84 $cdir = substr(strrchr($csub,
"/"), 1);
90 $cpath =
"$home_path/public_html";
96 if (in_array($cdir, $allowed_dir)) {
99 $pwd_file=
"$home_path/admin/$cdir";
100 if (!file_exists($pwd_file)) {
102 $fp = fopen($pwd_file,
"w");
110 if (strpos($cpath, $top_dir) !==
false) {
111 $dir_pos = strpos($cpath, $top_dir);
112 $cspath = substr($cpath, $dir_pos + 1 + strlen($top_dir));
114 $dir_pos = strpos($cpath, $top_dir);
118 $action = (empty($action) ?
"none" : $action);
119 $action = strtolower($action);
148 function print_directory_list() {
149 global $cpath, $top_dir, $dir_search, $allowed_files, $allowed_dir, $allow_subdir, $max_subdir, $self, $cspath, $chome, $ndir;
151 $dirlistReturn = array(
153 "activeTitle" =>
"Active Directories",
154 "inactive" => array(),
157 $url = GetEnvSetting(
'TICKET_DOMAIN') ? GetEnvSetting(
'TICKET_DOMAIN') :
'localhost:8000';
158 $httpprotocol = GetEnvSetting(
'REQUIRE_ENCRYPTION') ?
'https' :
'http';
159 $finalurl = $httpprotocol .
'://' . $url;
163 if ($fhandle = @opendir($cpath)) {
164 while (
false !== ($file = readdir($fhandle))) {
165 if (($file ==
"..") && ($dir_search ==
true)) {
171 if ((strpos($cpath, $top_dir) !==
false) && ($cpath != $top_dir)) {
172 $dirlist[count($dirlist)] = $file;
176 } elseif (($cpath == $top_dir)) {
178 if (is_file($cpath .
"/" . $file)) {
180 if (in_array($file, $allowed_files))
181 $filelist[count($filelist)] = $file;
182 } elseif ($dir_search ==
true) {
184 if (in_array($file, $allowed_dir))
185 $dirlist[count($dirlist)] = $file;
188 } elseif (($file !=
".") && ($file !=
"..") && (substr($file, 0, 1) !=
".")) {
191 if (is_file($cpath .
"/" . $file))
192 $filelist[count($filelist)] = $file;
193 elseif($dir_search ==
true)
194 $dirlist[count($dirlist)] = $file;
203 if (in_array($cspath, $allowed_dir) && $cspath !==
'images') {
204 $maintDirName = ucfirst($cspath) .
" Password Maintenance";
205 $dirlistReturn[
'active'][] = array(
207 "name" =>
"$maintDirName",
208 "link" =>
"main.prg?ft=26&tdir=$cspath",
216 $dirlist_count = count($dirlist);
217 if ($dirlist_count > 0) {
219 array_multisort ($dirlist, SORT_ASC, SORT_STRING);
221 foreach ($dirlist as $shortname) {
222 $ftime=date(
"m/d/y g:i:s A",filemtime(
"$cpath/$shortname"));
223 if ($shortname ==
"..") {
224 $dirlistReturn[
"active"][] = array(
225 "icon" =>
"fa-arrow-left",
226 "name" =>
"Parent Folder",
227 "link" =>
"$self&ndir=$shortname&csub=$cspath",
234 $crumbArray = explode(
"/", $cspath);
235 $crumbSlice = array_slice($crumbArray, 0, 1);
236 $crumbString = implode(
"/", $crumbSlice);
238 $dirlistReturn[
'activeTitle'] =
"<a href=\"$self&ndir=$shortname&csub=$crumbString\">Active Directories</a>";
242 foreach ($crumbArray as $key => $value) {
243 $crumbSlice = array_slice($crumbArray, 0, $key + 2);
244 $crumbString = implode(
"/", $crumbSlice);
246 if ($key == count($crumbArray) - 1) {
247 $dirlistReturn[
'activeTitle'] .=
" / {$crumbArray[$key]}";
249 $dirlistReturn[
'activeTitle'] .=
" / <a href=\"$self&ndir=$shortname&csub=$crumbString\">{$crumbArray[$key]}</a>";
258 if ($allow_subdir && $dirlist_count <= $max_subdir) {
261 if (in_array($cspath, $allowed_dir)) {
262 $dirlistReturn[
"active"][] = array(
263 "icon" =>
"fa-folder",
264 "name" =>
"New Folder",
273 $dirDelete = ($cpath != $top_dir) && (
sizeof(scandir(
"$cpath/$shortname")) == 2);
274 $dirlistReturn[
"active"][] = array(
275 "icon" =>
"fa-folder-open",
276 "name" =>
"$shortname",
277 "link" =>
"$self&ndir=$shortname&csub=$cspath",
279 "delete" => $dirDelete,
287 if (count($filelist) > 0) {
290 foreach ($filelist as $shortname) {
291 $ftime=date(
"m/d/y g:i:s A",filemtime(
"$cpath/$shortname"));
292 $urlencode = urlencode(
"$shortname");
293 $filepath = ($cspath ==
"" ?
"$urlencode" :
"$cspath/$urlencode");
295 if (substr($cspath, 0, 6) ===
'images') {
296 $dirlistReturn[
"active"][] = array(
298 "name" =>
"$shortname",
299 "link" =>
"/fi/$chome/$filepath",
300 "copy" => $finalurl .
"/fi/$chome/$filepath",
306 $dirlistReturn[
"active"][] = array(
308 "name" =>
"$shortname",
309 "link" =>
"/fi/$chome/$filepath",
322 if ((count($dirlist) < count($allowed_dir)) && ($cpath == $top_dir)) {
325 foreach ($allowed_dir as $key => $value) {
326 if (!in_array($value, $dirlist)) {
327 $dirlistReturn[
"inactive"][] = array(
328 "icon" =>
"fa-folder",
339 return $dirlistReturn;
344 function create_dir() {
345 global $msg_err, $msg_suc, $Cn, $Cu, $mdir, $allowed_dir, $top_dir, $home_path, $chome;
349 $mdir = intval($mdir);
352 $dir_to_create = trim($allowed_dir[$mdir]);
353 if (strlen($dir_to_create) == 0) {
354 $msg_err =
"Problem creating the directory. Please select again.";
356 $path_to_dir = $top_dir .
"/" . $dir_to_create;
358 if (is_dir($path_to_dir)) {
359 $msg_err =
"The directory already exists. It was not created.";
362 if (@mkdir($path_to_dir, 0755) ===
false) {
364 $msg_err =
"Unknown error creating the directory. <br> 365 You may need to contact HomeCU to enable private directories.";
368 $ht_file = $path_to_dir .
"/.htaccess";
369 $pwd_file =
"$home_path/admin/$dir_to_create";
370 if (!file_exists($ht_file)) {
372 $hp = fopen($ht_file,
"w");
374 fwrite ($hp,
"AuthName \"" . strtoupper($chome) .
" " . ucfirst($dir_to_create) .
"\"\n");
375 fwrite ($hp,
"AuthType Basic\n");
376 fwrite ($hp,
"require valid-user\n");
377 fwrite ($hp,
"AuthUserFile $pwd_file\n");
387 function create_subdir() {
388 global $msg_err, $msg_suc, $Cn, $Cu, $allowed_dir, $top_dir, $home_path, $chome, $allow_subdir, $allow_multi_subdir, $max_subdir, $csub, $newfolder;
396 if ($allow_subdir ==
true) {
402 $newfolder = preg_replace(
"/\W/",
"", $newfolder);
405 $dir_to_create = trim($csub) .
"/" . $newfolder;
406 if (strlen($dir_to_create) == 0) {
407 $msg_err =
"Problem creating the directory. Please select again.";
411 if ($allow_multi_subdir ==
true || ((array_search($csub, $allowed_dir) !==
false))) {
415 $dirpath = $top_dir .
"/" . $csub;
418 if ($fhandle = @opendir($dirpath)) {
419 while (
false !== ($file = readdir($fhandle))) {
420 if (($file !=
".") && ($file !=
"..") && (substr($file, 0, 1) !=
".")) {
423 if (is_dir($dirpath .
"/" . $file)) {
425 $dirlist[count($dirlist)] = $file;
431 $dirlist_count = count($dirlist);
433 if ($dirlist_count < $max_subdir) {
434 $path_to_dir = $top_dir .
"/" . $dir_to_create;
436 if (is_dir($path_to_dir)) {
437 $msg_err =
"The directory already exists. It can not be created.";
440 if (@mkdir($path_to_dir, 0755) ===
false) {
442 $msg_err =
"Unknown error creating the directory. <br> 443 You may need to contact HomeCU for additional help .";
447 $msg_suc =
"A new folder named '$newfolder' was created.";
452 $msg_err =
"Maximum number of folders has been reached. You will need to remove a folder before adding additional.";
456 $msg_err =
"Unable to create the new folder. Custom folders are only allowed in the top most folder.";
462 $msg_err =
"Creating subdirectories is NOT allowed.";
467 function delete_files() {
468 global $admVars, $msg_err, $msg_suc, $csub, $top_dir;
470 $filesList = $admVars[
'DIRMAINT'][
'delete'];
471 $files = explode(
",", $filesList);
473 foreach ($files as $filename) {
475 $us_file_name = str_replace(
"/",
"", $filename);
476 $us_file_name = str_replace(
"\\",
"", $us_file_name);
478 $delete_file = $top_dir . ($csub ==
'' ?
"" :
"/$csub") .
"/" . $us_file_name;
480 if (file_exists($delete_file)) {
481 if (is_file($delete_file)) {
482 if (!@unlink ($delete_file)) {
484 $msg_err .=
"Unable to delete the file! Please try again.<br>";
486 $msg_suc .=
"The file '$filename' was deleted successfully.<br>";
488 } elseif (is_dir($delete_file)) {
489 $directory_empty = TRUE;
490 $directory = dir($delete_file);
491 while (FALSE !== ($item = $directory->read())) {
493 if ($item !=
'.' && $item !=
'..') {
494 $directory_empty = FALSE;
499 if(($directory_empty == TRUE) && ( @rmdir ($delete_file))) {
500 $msg_suc .=
"The folder '$filename' was deleted successfully.<br>";
502 $msg_err .=
"Unable to delete folder '$filename'! Please be sure the folder is empty.<br>";
510 function print_status() {
511 global $msg_err, $msg_suc, $dir, $self, $Cn, $Cu, $cdir, $cpath, $dir_search, $top_dir, $cspath, $csub, $allowed_dir, $allowed_files, $chome, $allow_subdir, $allow_multi_subdir, $max_subdir, $top_upload, $delurl;
513 $directoryList = print_directory_list();
515 $url = GetEnvSetting(
'TICKET_DOMAIN') ? GetEnvSetting(
'TICKET_DOMAIN') :
'localhost:8000';
516 $httpprotocol = GetEnvSetting(
'REQUIRE_ENCRYPTION') ?
'https' :
'http';
517 $finalurl = $httpprotocol .
'://' . $url;
519 header(
"Expires: Sat 20 May 1995 03:32:38 GMT");
520 header(
"Pragma: no-cache");
521 header(
"Cache-Control: no-cache, must-revalidate");
524 <!-- Clipboard.js -->
525 <script type=
'text/javascript' src=
'/admcom/static/js/clipboard.min.js'></script>
526 <!-- NEW HTML / JS -->
527 <script type=
"text/javascript">
529 new ClipboardJS(
'.btn');
531 var windowStack = [];
533 var gridActive =
null;
534 var gridInactive =
null;
535 var gridData = <?php echo HCU_JsonEncode($directoryList); ?>;
537 var fileUploader =
null;
538 var fileNameToUpload =
null;
539 var fileSizeToBeUploaded =
null;
542 var msg_err =
"<?php echo $msg_err; ?>";
543 var msg_suc =
"<?php echo $msg_suc; ?>";
546 if (msg_err.length > 0) {
547 $.homecuValidator.homecuResetMessage =
true;
548 $.homecuValidator.displayMessage(msg_err, $.homecuValidator.settings.statusError);
549 }
else if (msg_suc.length > 0) {
550 $.homecuValidator.homecuResetMessage =
true;
551 $.homecuValidator.displayMessage(msg_suc, $.homecuValidator.settings.statusSuccess);
554 $(document).ready(
function(e) {
555 gridActive = $(
"#gridActive").kendoGrid({
557 data: gridData.active
560 template:
"No active directories found." 563 headerTemplate: gridData.activeTitle,
570 headerTemplate:
"<input type=\"checkbox\" name=\"chk_delete_all\" />" 572 rowTemplate: kendo.template($(
"#rowTemplateActive").html()),
573 dataBound:
function(e) {
576 $(
"input[name=\"chk_delete_all\"]").on(
"change",
function(e) {
577 var checked = $(
this).prop(
"checked");
579 $(
"input[name=\"chk_delete\"]").prop(
"checked", checked);
582 $(
"#btn_delete").prop(
"disabled", !checked);
585 $(
"input[name=\"chk_delete\"]").on(
"change",
function(e) {
586 var checked = $(
this).prop(
"checked");
589 var numBoxes = $(
"input[name=\"chk_delete\"]").length;
590 var numChecked = $(
"input[name=\"chk_delete\"]:checked").length;
595 if (numBoxes == numChecked) {
596 $(
"input[name=\"chk_delete_all\"]").prop(
"checked",
true);
601 $(
"input[name=\"chk_delete_all\"]").prop(
"checked",
false);
605 $(
"#btn_delete").prop(
"disabled", (numChecked == 0));
608 }).data(
"kendoGrid");
611 <?php
if ($cpath == $top_dir) { ?>
612 gridInactive = $(
"#gridInactive").kendoGrid({
614 data: gridData.inactive
617 template:
"No inactive directories found." 620 title:
"Inactive Directories",
623 rowTemplate: kendo.template($(
"#rowTemplateInactive").html())
624 }).data(
"kendoGrid");
627 $(
"#btn_delete").on(
"click", check_delete);
628 $(
"#btn_upload").on(
"click", check_upload);
629 fileUploader = $(
"#upload").kendoUpload({
633 maxFileSize: 40000000
635 select:
function(e) {
636 fileNameToUpload = e.files[0].name;
637 fileSizeToBeUploaded = e.files[0].size;
638 console.log(fileSizeToBeUploaded);
640 }).data(
"kendoUpload");
643 $(document).on(
"click",
".k-overlay",
function() {
644 if (windowStack.length > 0) {
645 var openWindow = windowStack[windowStack.length - 1];
651 <!-- GRID ROW TEMPLATE -->
652 <script type=
"text/x-kendo-tmpl" id=
"rowTemplateActive">
653 <tr data-uid=
"#: uid #">
655 <span
class=
"fa #: data.icon #"></span> 
657 <a href=
"\\#" onclick=
"new_folder('#: data.link #')">#: data.name #</a>
659 # if (data.icon == "fa-file") { # 660 <a href=
"#: data.link #" target=
"_blank">#: data.name #</a>
663 <img src=
"/admcom/static/img/clippy.png" class=
"btn" data-clipboard-text=
"#: data.copy #" alt=
"Copy to clipboard">
667 <a href=
"#: data.link #">#: data.name #</a>
671 <td>#: data.mod #</td>
672 # if (data.delete) { # 674 <input type=
"checkbox" name=
"chk_delete" value=
"#: data.name #" />
682 <!-- This grid will only display
if user is on root directory -->
683 <script type=
"text/x-kendo-tmpl" id=
"rowTemplateInactive">
684 <tr data-uid=
"#: uid #">
686 <span
class=
"fa #: data.icon #"></span> 
687 <a href=
"\\#" onclick=
"confirm_dir('#:data.name#', '#: data.link #')">#: data.name #</a>
692 <div
class=
"container-fluid">
693 <div
id=
"dirMaintPopout"></div>
694 <h2>Private Directories</h2>
695 <form
id=
"pdForm" method=
"post" action=
"<?php echo $self ?>" enctype=
"multipart/form-data">
696 <input type=
"hidden" name=
"action" value=
"upload">
697 <input type=
"hidden" name=
"delete" value=
"">
698 <input type=
"hidden" name=
"csub" value=
"<?php echo $cspath; ?>">
700 <!-- Only show upload
for non root directory -->
701 <?php
if ($cpath != $top_dir) { ?>
703 <label>Directory Access Link: </label>
704 <a href=
"<?php echo $finalurl . "/fi/$chome/$cspath
"; ?>"><?php echo $finalurl .
"/fi/$chome/$cspath"; ?></a>
706 <div
class=
"well well-sm">
707 <input type=
"file" name=
"upload" id=
"upload">
708 <p style=
"padding-top: 1em; text-align: right;">
709 <button type=
"button" class=
"k-button k-primary" id=
"btn_upload"><span
class=
"fa fa-upload"> </span>Upload</button>
714 <div
id=
"gridActive"></div>
716 <?php
if ($cpath != $top_dir) { ?>
717 <div
class=
"hcu-template">
718 <div
class=
"hcu-edit-buttons k-state-default">
719 <button type=
"button" id=
"btn_delete" class=
"k-button" disabled>
720 <i
class=
"fa fa-trash fa-lg"></i>Delete
727 <!-- Only show inactive grid
if on root directory -->
728 <?php
if ($cpath == $top_dir) { ?>
729 <div
class=
"hcu-secondary">
730 <div
class=
"vsgSecondary">
731 <span>To activate a
private directory, click on the directory name.</span>
734 <div
id=
"gridInactive"></div>
739 <!-- END NEW HTML / JS -->
740 <script language=
"javascript">
743 function check_upload() {
745 var fileFound =
false;
746 for (var i = 0; i < gridData.active.length; i++) {
747 var name = gridData.active[i].name;
748 if (name == fileNameToUpload) {
754 if (fileSizeToBeUploaded > 40000000) {
761 var confirmOverwrite = $(
"<div></div>").kendoDialog({
762 title:
"Upload File",
769 windowStack.push(
this);
778 text:
"Yes", primary:
true,
779 action:
function(e) {
781 $(
"#pdForm").submit();
785 content:
"<div class=\"col-xs-12\"><p><strong>You are about to overwrite the file '" + fileNameToUpload +
"'.</strong></p><p>Do you wish to continue?</p></div>" 786 }).data(
"kendoDialog");
788 confirmOverwrite.open().center();
791 $(
"#pdForm").submit();
795 function check_delete() {
797 var numChecked = $(
"input[name=\"chk_delete\"]:checked").length;
799 if (numChecked > 0) {
800 var dialogConfirmDelete = $(
"<div></div>").kendoDialog({
801 title:
"Delete Files",
808 windowStack.push(
this);
817 text:
"Yes", primary:
true,
818 action:
function(e) {
820 var delete_files = [];
821 $(
"input[name=\"chk_delete\"]:checked").each(
function(e) {
822 delete_files.push($(
this).val());
826 var delete_files_string = delete_files.join(
",");
829 $(
"input[name=\"delete\"]").val(delete_files_string);
830 $(
"input[name=\"action\"]").val(
"delete");
831 $(
"#pdForm").submit();
835 content:
"<div class=\"col-xs-12\"><p><strong>You are about to delete the delected files or folders.</strong></p><p>Do you wish to continue?</p></div>" 836 }).data(
"kendoDialog");
838 dialogConfirmDelete.open().center();
842 function confirm_dir(sdir, idir) {
845 var confirmActivate = $(
"<div></div>").kendoDialog({
846 title:
"Activate Directory",
853 windowStack.push(
this);
862 text:
"Yes", primary:
true,
863 action:
function(e) {
864 var url =
"<?php echo $self; ?>&action=create&mdir=" + idir;
865 document.location = url;
869 content:
"<div class=\"col-xs-12\"><p><strong>This will create the private directory '" + sdir +
"'</strong></p><p>Do you wish to continue?</p></div>" 870 }).data(
"kendoDialog");
872 confirmActivate.open().center();
874 function new_folder(cur_sub) {
875 var confirmNewFolder = $(
"<div></div>").kendoDialog({
876 title:
"Activate Directory",
883 windowStack.push(
this);
892 text:
"Yes", primary:
true,
893 action:
function(e) {
894 var newFolderField = $(
"#newFolder");
896 if (newFolderField) {
897 var folderName = newFolderField.val();
899 folderName = folderName.replace(/\W/g,
"");
900 var url =
"<?php echo $self; ?>&action=createsub&csub=" + escape(cur_sub) +
"&newfolder=" + folderName;
901 document.location = url;
906 content:
"<div class=\"col-xs-12\"><p>Please enter a name for the new directory</p><input class=\"k-textbox hcu-all-100\" type=\"text\" name=\"newFolder\" id=\"newFolder\" maxlength=\"10\"></div>" 907 }).data(
"kendoDialog");
909 confirmNewFolder.open().center();
916 function view_form() {
923 $file_path =
"$top_dir/$cspath/$file";
924 $form = file($file_path);
925 if (is_array($form)){
926 print implode(
"", $form);
928 print
"Cannot open $file_path";
932 function post_form() {
934 global $msg_err, $msg_suc, $replace, $csub, $top_dir, $err_msg;
938 if (!is_uploaded_file($_FILES[
'upload'][
'tmp_name']) || ($_FILES[
'upload'][
'size'] < 1)) {
939 switch ($_FILES[
'upload'][
'error']) {
941 $msg_suc =
"0: No error, the file was uploaded successfully";
944 $msg_err =
"1: The upload is larger than the amount allowable by the upload_max_filesize directive in the php.ini";
945 $msg_err =
"1: The file you tried to upload is just too big. The allowable limit is 40mb.";
948 $msg_err =
"2: The upload is larger than the MAX_FILE_SIZE directive that was specified via html";
949 $msg_err =
"2: The file you tried to upload is just too big. The allowable limit is 40mb.";
952 $msg_err =
"3: The file was only partially uploaded";
955 $msg_err =
"4: no file was uploaded";
958 $msg_err =
"NOT SET";
962 $filedir = $top_dir . ($csub ==
'' ?
"" :
"/$csub");
965 $find_ary = array(
"\\",
"/",
" ",
";");
966 $rpl_ary = array(
"_",
"_",
"_",
"_");
967 $us_file_name = str_replace($find_ary, $rpl_ary, $_FILES[
'upload'][
'name']);
968 # make sure we still have a valid file name: 969 if (
"$us_file_name" ==
"") {
970 $up_err =
"Error Reported - Invalid Upload to Private Directory";
974 $msg_suc =
"The file '$us_file_name' was uploaded successfully.";
976 if ($msg_err !=
"") {
978 Upload File Error --\n 979 Client Information \n 980 Client Filename: {$_FILES['upload']['name']}\n 981 Client Filesize: {$_FILES['upload']['size']}\n 982 Client Filetype: {$_FILES['upload']['type']}\n\n 983 Client IP: {$_SERVER['REMOTE_ADDR']}\n\n 984 Web Server Information \n 985 Temp File Name - {$_FILES['upload']['tmp_name']} 986 Error Reported - $up_err\n\n 990 $notify->line = __LINE__;
991 $notify->file = __FILE__;
992 $notify->callingfunction = __FUNCTION__;
995 $notify->mailto =
"custmnt1@homecu.net";
996 $notify->subject =
"Private Directories upload error";
1001 print <<< print_html
1004 There was an error uploading the file <b>{$_FILES[
'upload'][
'name']}</b>.<br>
1005 The error reported was: <b>$up_err</b>.<br>
1006 Please retry uploading the file.<br>
1007 If the problem persists call HomeCU and report the problem.
1012 $filename = $filedir .
"/" . $us_file_name;
1014 if (!move_uploaded_file($_FILES[
'upload'][
'tmp_name'], $filename)) {
1015 unlink ($_FILES[
'upload'][
'tmp_name']);
1019 Uh-oh, couldn
't post the file where it belongs. Not sure what happened. Better call HomeCU. 1022 // File was moved change the mod settings 1023 $rc = @chmod($filename, 0644);