array(), 'message' => array() ); $createqty = 0; $deleteqty = 0; $renameqty = 0; $errorqty = 0; // Create any child folders with entered name if(isset($_POST['createfolder'])) { foreach($_POST['createfolder'] as $parent => $newfolder) { if($newfolder != '') { $createthisfolder = $tinybrowser['docroot'].$dirpath.urldecode($_POST['actionfolder'][$parent]).clean_filename($newfolder); if (!file_exists($createthisfolder) && createfolder($createthisfolder,$tinybrowser['unixpermissions'])) $createqty++; else $errorqty++; if($typenow=='image') { createfolder($createthisfolder.'/_thumbs/',$tinybrowser['unixpermissions']); } } } } // Delete any checked folders if(isset($_POST['deletefolder'])) { foreach($_POST['deletefolder'] as $delthis => $val) { if($typenow=='image') { $delthisthumbdir = $tinybrowser['docroot'].$dirpath.urldecode($_POST['actionfolder'][$delthis]).'_thumbs/'; if (is_dir($delthisthumbdir)) rmdir($delthisthumbdir); } $delthisdir = $tinybrowser['docroot'].$dirpath.urldecode($_POST['actionfolder'][$delthis]); if (is_dir($delthisdir) && rmdir($delthisdir)) $deleteqty++; else $errorqty++; if($foldernow==urldecode($_POST['actionfolder'][$delthis])) { $foldernow = ''; $passfolder = ''; } } } // Rename any folders with changed name if(isset($_POST['renamefolder'])) { foreach($_POST['renamefolder'] as $namethis => $newname) { $urlparts = explode('/',rtrim(urldecode($_POST['actionfolder'][$namethis]),'/')); if(array_pop($urlparts) != $newname) { $namethisfolderfrom = $tinybrowser['docroot'].$dirpath.urldecode($_POST['actionfolder'][$namethis]); $renameurl = implode('/',$urlparts).'/'.clean_filename($newname).'/'; $namethisfolderto = $tinybrowser['docroot'].$dirpath.$renameurl; if (is_dir($namethisfolderfrom) && rename($namethisfolderfrom,$namethisfolderto)) $renameqty++; else $errorqty++; if($foldernow==urldecode($_POST['actionfolder'][$namethis])) { $foldernow = ltrim($renameurl,'/'); $passfolder = '&folder='.urlencode(ltrim($renameurl,'/')); } } } } // Assign directory structure to array $dirs=array(); dirtree($dirs,$tinybrowser['filetype'][$typenow],$tinybrowser['docroot'],$tinybrowser['path'][$typenow]); // generate alert if folders deleted if($createqty>0) { $notify['type'][]='success'; $notify['message'][]=sprintf(TB_MSGCREATE, $createqty); } // generate alert if folders deleted elseif($deleteqty>0) { $notify['type'][]='success'; $notify['message'][]=sprintf(TB_MSGDELETE, $deleteqty); } // generate alert if folders renamed elseif($renameqty>0) { $notify['type'][]='success'; $notify['message'][]=sprintf(TB_MSGRENAME, $renameqty); } // generate alert if file errors encountered if($errorqty>0) { $notify['type'][]='failure'; $notify['message'][]=sprintf(TB_MSGEDITERR, $errorqty); } // count folders $num_of_folders = (isset($dirs) ? count($dirs) : 0); ?>