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); ?> TinyBrowser :: <?php echo TB_FOLDERS; ?> 0) alert($notify); form_open('foldertab',false,'folders.php','?type='.$typenow.$passfeid); ?>
'; echo ''; echo '' .'\n"; } echo "
'.$dirs[$i][2].''.$dirs[$i][4].''.date($tinybrowser['dateformat'],$dirs[$i][5]).''; form_hidden_input('actionfolder['.$i.']',$dirs[$i][0]); switch($actionnow) { case 'create': echo '→ '; form_text_input('createfolder['.$i.']',false,'',30,120); break; case 'delete': $disabledel = ($dirs[$i][4] > 0 ? ' DISABLED' : ''); if(!$disable) echo ''; break; case 'rename': if(!$disable) form_text_input('renamefolder['.$i.']',false,$dirs[$i][3],30,120); break; default: // do nothing } echo "
\n".'
'; if($tinybrowser['allowdelete'] && $tinybrowser['allowedit']) { form_hidden_input('editaction',$actionnow); form_submit_button('commit',$actionhead.' '.TB_FOLDERS,'edit'); } ?>