Esempio n. 1
0
function PMBP_get_dirs($dir, $renew = FALSE)
{
    $dirs = FALSE;
    // renew date if the 'renew' link was clicked
    if (isset($_GET['update_dir_list'])) {
        $renew = true;
    }
    // return existing data
    if ($renew) {
        unset($_SESSION['file_system'][$dir]);
    }
    if (isset($_SESSION['file_system'][$dir])) {
        return $_SESSION['file_system'][$dir];
    }
    // create directory list
    $dir_handle = @opendir($dir);
    while ($file = @readdir($dir_handle)) {
        if ($file != "." && $file != "..") {
            if (@is_dir($dir . $file)) {
                $dirs[] = $file . "/";
                $tmp = PMBP_get_dirs($dir . $file . "/", TRUE);
                if (is_array($tmp)) {
                    foreach ($tmp as $value) {
                        $dirs[] = $file . "/" . $value;
                    }
                }
            }
        }
    }
    $_SESSION['file_system'][$dir] = $dirs;
    return $dirs;
}
Esempio n. 2
0
 // get content of these directories (I know, it's partly redundant - but I think this is necessary)
 if ($_SESSION['multi_user_mode']) {
     $search_path1 = $PMBP_MU_CONF['user_export_dir'];
     $search_path2 = $PMBP_MU_CONF['user_scheduled_dir'];
 } else {
     $search_path1 = substr($_SERVER['DOCUMENT_ROOT'], 0, strrpos($_SERVER['DOCUMENT_ROOT'], "/"));
     $search_path2 = substr($search_path1, 0, strrpos($search_path1, "/"));
     $search_path1 .= "/";
     //        $search_path1=$_SERVER['DOCUMENT_ROOT']."/"."../";
     //        $search_path2=$_SERVER['DOCUMENT_ROOT']."/"."../../";
 }
 if ($PMBP_SYS_VAR['dir_lists'] >= 1) {
     $dirs1 = PMBP_get_dirs($search_path1);
 }
 if ($PMBP_SYS_VAR['dir_lists'] >= 2) {
     $dirs2 = PMBP_get_dirs($search_path2);
 }
 echo EXS_PATH . ": (<a href=\"scheduled.php?update_dir_list=TRUE\">" . PMBP_EXS_UPDATE_DIRS . "</a>)<br>\n";
 echo "<select name=\"path\">\n";
 //echo "      <option value=\"/\" selected>./</option>\n";
 if (isset($dirs1)) {
     foreach ($dirs1 as $value) {
         if ($PMBP_SYS_VAR['EXS_scheduled_dir'] == $search_path1 . $value) {
             echo "<option value=\"" . $search_path1 . $value . "\" selected>" . $search_path1 . $value . "</option>\n";
         } else {
             echo "<option value=\"" . $search_path1 . $value . "\">" . $search_path1 . $value . "</option>\n";
         }
     }
 }
 if (isset($dirs2)) {
     echo "<option value=\"\">----------------------------</option>\n";