Пример #1
0
<?php

/**
 * Fetches the properties edit form for the file manager.
 */
$page->layout = false;
header('Content-Type: application/json');
$file = urldecode(join('/', $this->params));
$out = array('title' => __('Properties'), 'body' => $tpl->render('filemanager/properties', array('file' => $file, 'desc' => FileManager::prop($file, 'desc'), 'link' => FileManager::prop($file, 'link'))));
echo json_encode($out);
Пример #2
0
	sort ($files);
}

// remove 'files/' from paths and create output list
$list = array ();
foreach ($files as $key => $file) {
	$list[preg_replace ('/^' . preg_quote ($root, '/') . '/', '', $file)] = (object) array (
		'path' => $file,
		'desc' => ''
	);
}

// fetch descriptions
if ($data['desc'] === 'yes') {
	if (!empty ($list)) {
		$descriptions = FileManager::prop (array_keys ($list), 'desc');
		foreach ($descriptions as $file => $desc) {
			$list[$file]->desc = $desc;
		}
	}
}

// display style
if ($data['style'] === 'lightbox') {
	$page->add_style ('/apps/filemanager/css/gallery.css');
	$page->add_style ('/apps/filemanager/css/colorbox/colorbox.css');
	$page->add_script ('/apps/filemanager/js/jquery.colorbox.min.js');

	$template = 'filemanager/gallery';
} else {
	$template = 'filemanager/gallery/embedded';
Пример #3
0
        if (!preg_match('|^/files/|', $data['photo'])) {
            $data['photo'] = null;
        } else {
            $photo = preg_replace('|^/files/|', '', $data['photo']);
            if (!FileManager::verify_file($photo)) {
                $data['photo'] = null;
            }
        }
    } else {
        $data['photo'] = null;
    }
}
$data['photo'] = Image::for_key($data['key'], $data['photo']);
if ((!isset($data['link']) || !$data['link'] || $data['link'] === '') && $data['photo'] !== null) {
    $photo = preg_replace('|^/files/|', '', $data['photo']);
    $data['link'] = FileManager::prop($photo, 'link');
}
if ($data['photo']) {
    $data['src'] = '/' . Image::resize($data['photo'], $data['width'], $data['height'], 'cover', 'ext');
} elseif (isset($data['default'])) {
    if (preg_match('/^https?:\\/\\//', $data['default'])) {
        $data['src'] = $data['default'];
    } else {
        $data['src'] = '/' . Image::resize(ltrim($data['default'], '/'), $data['width'], $data['height'], 'cover', 'ext');
    }
} else {
    $data['src'] = 'http://placehold.it/' . $data['width'] . 'x' . $data['height'];
}
if (!$this->internal) {
    header('Content-Type: application/json');
    echo json_encode(array('success' => true, 'data' => $data));
Пример #4
0
	}
} else {
	return;
}

if (isset ($data['speed'])) {
	$speed = $data['speed'];
} else {
	$speed = "2000";
}

// get links for each file
$prop_files = array_map (function ($file) {
	return preg_replace ('/^files\//', '', $file);
}, $files);
$prop_links = FileManager::prop ($prop_files, 'link');
$links = array ();
foreach ($prop_links as $f => $link) {
	$links['files/' . $f] = $link;
}

if (isset ($data['ratio'])) {
	$ratio = $data['ratio'];
}

// rewrite if proxy is set
if ($appconf['General']['proxy_handler']) {
	foreach ($files as $k => $file) {
		$files[$k] = str_replace ($root, 'filemanager/proxy/', $file);
	}
}