Example #1
0
function kplaylist_filelist($pwd, $d, $n3)
{
    global $runinit, $mark, $marksid, $setctl, $bd, $cfg, $valuser;
    $kpdir = new kpdir();
    $kpdir->setpwd(base64_decode($pwd));
    $kpdir->setdrive($d);
    if (strlen($n3) > 0) {
        $ln = explode('_', $n3);
        if (count($ln) == 2) {
            $kpdir->finddest($ln[0], $ln[1]);
        }
    }
    if (frm_isset('mark') && !frm_empty('mark')) {
        $mark = explode(' ', strtoupper(trim(frm_get('mark'))));
    } else {
        $mark = array();
    }
    if (frm_ok('marksid', 1)) {
        $marksid = frm_get('marksid', 1);
    }
    $kpd = new kpdesign();
    $kpd->top();
    $list = true;
    if ($valuser->isadmin()) {
        if ($bd->getcnt() == 1 && $bd->getpath(0) == '/path/to/my/music/archive/') {
            $list = false;
            eval(gethtml('welcome'));
        }
        if ($setctl->get('basedir_changed') && $bd->getpath(0) != '/path/to/my/music/archive/') {
            $setctl->set('basedir_changed', 0);
            if ($setctl->get('base_dir') != $setctl->get('oldbase_dir')) {
                $setctl->set('oldbase_dir', $setctl->get('base_dir'));
                $list = false;
                eval(gethtml('basedirchange'));
            }
        } else {
            if ($setctl->get('reupdate')) {
                $setctl->set('reupdate', 0);
                $list = false;
                eval(gethtml('needupdate'));
            }
        }
    }
    $dcnt = $fcnt = 0;
    if ($list) {
        $kpdir = new kpdir();
        $kpdir->setdrive($d);
        $kpdir->setpwd($runinit['pdir']);
        if (!$kpdir->determine()) {
            access_denied();
        }
        showdir($kpdir->pwd, '', $d);
        echo '<table width="100%" border="0" cellspacing="0" cellpadding="0">';
        if ($cfg['mergerootdir']) {
            $kpdir->merge();
        }
        $kpdir->dsort();
        $dcnt = $kpdir->show();
        $fcnt = $kpdir->showfiles($dcnt);
        if ($fcnt == 0 && $dcnt == 0) {
            echo '<tr><td class="file">' . get_lang(156) . '</td></tr>';
        }
        echo '</table>';
    }
    endmp3table(1, $dcnt, $fcnt);
    $kpd->bottom();
}