aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2013-11-19 12:04:56 +0100
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2013-11-19 13:17:08 +0100
commitcebf1d9fd9e8479dac300e2fad5ba1c41927b850 (patch)
treef6066ca4b2c6811c11bbc815d16dae13e6a7166c
parenta80a39e975c673c6466f1eb3580e3107401d1eeb (diff)
Message d'erreur si fichier conf innaccessible
Voir #282
-rw-r--r--app/App_FrontController.php10
-rwxr-xr-xlib/minz/dao/Model_txt.php9
2 files changed, 17 insertions, 2 deletions
diff --git a/app/App_FrontController.php b/app/App_FrontController.php
index 3a980349a..b1e6787dc 100644
--- a/app/App_FrontController.php
+++ b/app/App_FrontController.php
@@ -40,7 +40,15 @@ class App_FrontController extends FrontController {
}
private function loadParamsView () {
- $this->conf = Session::param ('conf', new RSSConfiguration ());
+ try {
+ $this->conf = Session::param ('conf', new RSSConfiguration ());
+ } catch(MinzException $e) {
+ // Permission denied or conf file does not exist
+ // it's critical!
+ print $e->getMessage();
+ exit();
+ }
+
View::_param ('conf', $this->conf);
Session::_param ('language', $this->conf->language ());
diff --git a/lib/minz/dao/Model_txt.php b/lib/minz/dao/Model_txt.php
index c9d5cfe77..aed653068 100755
--- a/lib/minz/dao/Model_txt.php
+++ b/lib/minz/dao/Model_txt.php
@@ -27,10 +27,17 @@ class Model_txt {
*/
public function __construct ($nameFile, $mode = 'a+') {
$this->filename = $nameFile;
+ if (!file_exists($this->filename)) {
+ throw new FileNotExistException (
+ $this->filename,
+ MinzException::WARNING
+ );
+ }
+
$this->file = @fopen ($this->filename, $mode);
if (!$this->file) {
- throw new FileNotExistException (
+ throw new PermissionDeniedException (
$this->filename,
MinzException::WARNING
);