Example #1
0
// { Setting the theme
if (isset($_GET['theme'])) {
    $kfm_session->set('theme', $_GET['theme']);
}
if ($kfm_session->get('theme')) {
    $kfm->setting('theme', $kfm_session->get('theme'));
} else {
    if ($kfm->setting('theme')) {
        $kfm_session->set('theme', $kfm->setting('theme'));
    } else {
        if (in_array('default', $kfm->themes)) {
            $kfm->defaultSetting('theme', 'default');
            $kfm_session->set('theme', 'default');
        } else {
            if (!count($kfm->themes)) {
                kfm_error('No themes available');
            } else {
                $kfm->defaultSetting('theme', $kfm->themes[0]);
                $kfm_session->set('theme', $kfm->themes[0]);
            }
        }
    }
}
// }
// { languages
$kfm_language = '';
// {  find available languages
if ($handle = opendir(KFM_BASE_PATH . 'lang')) {
    $files = array();
    while (false !== ($file = readdir($handle))) {
        if (is_file(KFM_BASE_PATH . 'lang/' . $file)) {
Example #2
0
function _zip($filename, $files)
{
    global $kfm_session;
    $cwd_id = $kfm_session->get('cwd_id');
    $dir = kfmDirectory::getInstance($cwd_id);
    $cwd = $dir->path();
    if (!$kfm->setting('allow_file_create')) {
        return kfm_error(kfm_lang('permissionDeniedCreateFile'));
    }
    global $rootdir;
    if (!kfmFile::checkName($filename)) {
        return kfm_error(kfm_lang('illegalFileName', $filename));
    }
    $arr = array();
    foreach ($files as $f) {
        $file = kfmFile::getInstance($f);
        if (!$file) {
            return kfm_error(kfm_lang('missingFileInSelection'));
        }
        $arr[] = $file->path;
    }
    # try native system zip command
    $res = -1;
    $pdir = $cwd . '/';
    $zipfile = $pdir . $filename;
    for ($i = 0; $i < count($arr); ++$i) {
        $arr[$i] = str_replace($pdir, '', $arr[$i]);
    }
    exec('cd "' . escapeshellcmd($cwd) . '" && zip -D "' . escapeshellcmd($zipfile) . '" "' . join('" "', $arr) . '"', $arr, $res);
    if ($res) {
        return kfm_error(kfm_lang('noNativeZipCommand'));
    }
    return kfm_loadFiles($cwd_id);
}