<?
defined('C5_EXECUTE') or die("Access Denied.");
$u = new User();
$form = Loader::helper('form');

$ci = Loader::helper('concrete/urls');
$f = File::getByID($_REQUEST['fID']);
$fv = $f->getApprovedVersion();

$fp = new Permissions($f);
if (!$fp->canEditFileContents()) {
	die(t("Access Denied."));
}

$to = $fv->getTypeObject();
if ($to->getPackageHandle() != '') {
	Loader::packageElement('files/edit/' . $to->getEditor(), $to->getPackageHandle(), array('fv' => $fv));
} else {
    Loader::element('files/edit/' . $to->getEditor(), array('fv' => $fv));
}

<?
defined('C5_EXECUTE') or die("Access Denied.");
$u = new User();
$form = Loader::helper('form');

$ci = Loader::helper('concrete/urls');
$f = File::getByID($_REQUEST['fID']);
if (!is_object($f)) {
    die(t('File Not Found.'));
}
$fv = $f->getApprovedVersion();

$fp = new Permissions($f);
if (!$fp->canEditFileContents()) {
    die(t("Access Denied."));
}

$to = $fv->getTypeObject();
if ($to->getPackageHandle() != '') {
    Loader::packageElement('files/edit/' . $to->getEditor(), $to->getPackageHandle(), array('fv' => $fv));
} else {
    Loader::element('files/edit/' . $to->getEditor(), array('fv' => $fv));
}

Add an extra check for when files don't exist
Add an extra check for when files don't exist


Former-commit-id: a74ca99ebad8d185c5392e4240e43963564b5aed
Former-commit-id: e6cb976c5570465fabca0bd8570d74aa4ce4a1ee