public function init()
{
parent::init();
// PHP 7.0 compatibility of adminer (throws some warnings)
ini_set("display_errors", 0);
// only for admins
$this->checkPermission("adminer");
// call this to keep the session 'open' so that Adminer can write to it
$session = \Pimcore\Tool\Session::get();
$this->adminerHome = PIMCORE_DOCUMENT_ROOT . '/vendor/vrana/adminer/';
// proxy for resources
$path = $this->getRequest()->getPathInfo();
$path = str_replace("/admin/external_adminer/", "", $path);
if (preg_match("@\\.(css|js|ico|png|jpg|gif)\$@", $path)) {
$filePath = $this->adminerHome . "/" . $path;
// it seems that css files need the right content-type (Chrome)
if (preg_match("@.css\$@", $path)) {
header("Content-Type: text/css");
} elseif (preg_match("@.js\$@", $path)) {
header("Content-Type: text/javascript");
}
if (file_exists($filePath)) {
echo file_get_contents($filePath);
if (preg_match("@default.css\$@", $path)) {
// append custom styles, because in Adminer everything is hardcoded
echo file_get_contents($this->adminerHome . "designs/konya/adminer.css");
echo file_get_contents(PIMCORE_DOCUMENT_ROOT . "/pimcore/static6/css/adminer-modifications.css");
}
}
exit;
}
}