partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

commit 017f7f1f1b38a3e9ac7461d1feac85b9c4647161
parent 653ab3382fb7f32dd0dd2904e4324b98a0075a17
Author: felicitus <felicitus@felicitus.org>
Date:   Sun, 27 May 2012 04:05:53 +0200

Check if ImageMagick is installed during building the main page; this is necessary in case the server configuration was changed.

Diffstat:
Msrc/frontend/index.php | 20+++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/src/frontend/index.php b/src/frontend/index.php @@ -52,12 +52,27 @@ if (Configuration::getOption("partkeepr.auth.http", false) === true) { $aParameters["userPreferences"] = array("response" => array("data" => $aPreferences)); } +\Twig_Autoloader::register(); + +$loader = new \Twig_Loader_Filesystem(dirname(__FILE__) . '/templates/'); +$twig = new \Twig_Environment($loader); + + /* Information about maximum upload sizes */ $maxPostSize = PartKeepr::getBytesFromHumanReadable(ini_get("post_max_size")); $maxFileSize = PartKeepr::getBytesFromHumanReadable(ini_get("upload_max_filesize")); $aParameters["maxUploadSize"] = min($maxPostSize, $maxFileSize); +if (!class_exists("Imagick")) { + $template = $twig->loadTemplate("error.tpl"); + echo $template->render(array( + "title" => PartKeepr::i18n("ImageMagick is not installed"), + "error" => PartKeepr::i18n("You are missing the ImageMagick extension. Please install it and restart the setup to verify that the library was installed correctly.") + )); + exit; +} + /* ImageMagick formats */ $imagick = new \Imagick(); $aParameters["availableImageFormats"] = $imagick->queryFormats(); @@ -69,11 +84,6 @@ if (Configuration::getOption("partkeepr.frontend.autologin.enabled", false) === } /* Load and render the template */ -\Twig_Autoloader::register(); - -$loader = new \Twig_Loader_Filesystem(dirname(__FILE__) . '/templates/'); -$twig = new \Twig_Environment($loader); - $template = $twig->loadTemplate("index.tpl"); echo $template->render(array(