commit ef4d51b94bb0f94aef42a869ec4d299f811cd1bf
parent 1efb5aa8b59fa78d7f585d860b5cbba2a7083f5a
Author: Felicitus <felicitus@felicitus.org>
Date: Thu, 1 Sep 2011 22:35:10 +0200
Use the "standard" configuration approach instead of a custom one for the frontend
Diffstat:
4 files changed, 36 insertions(+), 14 deletions(-)
diff --git a/config.php.template b/config.php.template
@@ -70,3 +70,23 @@ Configuration::setOption("partkeepr.images.path", __DIR__."/data/images/");
* Specifies the cache dir
*/
Configuration::setOption("partkeepr.images.cache", Configuration::getOption("partkeepr.images.path")."cache/");
+
+/**
+ * Specifies if auto login is wanted or not
+ */
+Configuration::setOption("partkeepr.frontend.autologin.enabled", false);
+
+/**
+ * Specifies the auto login username
+ */
+Configuration::setOption("partkeepr.frontend.autologin.username", null);
+
+/**
+ * Specifies the auto login password
+ */
+Configuration::setOption("partkeepr.frontend.autologin.password", null);
+
+/**
+ * Specifies if frontend debugging should be turned on
+ */
+Configuration::setOption("partkeepr.frontend.debug", false);+
\ No newline at end of file
diff --git a/frontend/config-release.php b/frontend/config-release.php
@@ -1,3 +0,0 @@
-<?php
-$debug = false;
-$autoLogin = true;-
\ No newline at end of file
diff --git a/frontend/config.php b/frontend/config.php
@@ -1,3 +0,0 @@
-<?php
-$debug = true;
-$autoLogin = false;-
\ No newline at end of file
diff --git a/frontend/index.php b/frontend/index.php
@@ -1,5 +1,14 @@
<?php
-include("config.php");
+namespace de\RaumZeitLabor\PartKeepr\Frontend;
+declare(encoding = 'UTF-8');
+
+use de\RaumZeitLabor\PartKeepr\Service\ServiceManager;
+use de\RaumZeitLabor\PartKeepr\PartKeepr;
+use de\RaumZeitLabor\PartKeepr\Util\Configuration;
+
+include("../src/de/RaumZeitLabor/PartKeepr/PartKeepr.php");
+
+PartKeepr::initialize("");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
@@ -24,7 +33,7 @@ include("config.php");
<?php
// @todo This is ugly, but how to fix?
- if ($debug) {
+ if (Configuration::getOption("partkeepr.frontend.debug", false) === true) {
?>
<script type="text/javascript" src="extjs/ext-all-debug.js"></script>
<script type="text/javascript" src="js/partkeepr-debug.js"></script>
@@ -60,17 +69,17 @@ $maxFilesize = return_bytes(ini_get("upload_max_filesize"));
$maxUploadSize = ($maxPostSize < $maxFilesize) ? $maxPostSize : $maxFilesize;
-$imagick = new Imagick();
+$imagick = new \Imagick();
?>
<script type="text/javascript">
window.maxUploadSize = <?php echo $maxUploadSize; ?>;
window.availableImageFormats = <?php echo json_encode($imagick->queryFormats()); ?>;
<?php
-if ($autoLogin) {
+if (Configuration::getOption("partkeepr.frontend.autologin.enabled", false) === true) {
?>
-window.autoLoginUsername = "admin";
-window.autoLoginPassword = "admin";
+window.autoLoginUsername = "<?php echo Configuration::getOption("partkeepr.frontend.autologin.username"); ?>";
+window.autoLoginPassword = "<?php echo Configuration::getOption("partkeepr.frontend.autologin.password"); ?>";
<?php
}
?>