File size: 1.45Kb
<?php
/*
* this will attach an upload link in the admin folder options
* 19 Feb 2013 - Mihai Ionut Vilcu (ionutvmi@gmail.com)
* master autoindex plugin
*
*/
// check if the file is included
if(!defined("MAI_PREFIX"))
die("You can't access the plugin directly !");
$plugins->add_hook("index_admin","fselector_add");
$plugins->add_hook("admin_upload_form","fselector_select");
$plugins->add_hook("admin_import_form","fselector_select");
function fselector_info(){
return array(
"name" => "Folder Selector",
"author" => "ionutvmi",
"author_site" => "http://master-land.net",
"description" => "This will allow you to select the folder you want to upload files from File Manager",
);
}
function fselector_add($value=''){
global $_admin2,$set,$downloads_menu;
// append the new options
$_admin2 = str_replace("</div>"," | <a href='$set->url/admincp/upload.php'>Upload files</a> | <a href='$set->url/admincp/import.php'>Import files</a></div>",$_admin2);
// add current dir in a session
$_SESSION['c_dir'] = substr($downloads_menu->path,6);
return $value;
}
function fselector_select($value=''){
global $path_opt,$all_folders;
if($_SESSION['c_dir']){
$path_opt = '';
// echo $_SESSION['c_dir'];
foreach($all_folders as $folder){
$folder = substr($folder->path,6); // remove /files
$path_opt .= "<option value='$folder'".($folder == $_SESSION['c_dir'] ? "SELECTED" : "").">$folder</option>";
}
}
return $value;
}