summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2013-11-19 12:04:56 +0100
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2013-11-19 12:04:56 +0100
commitf427014804b8537d4a14587b3735937d0fe852a5 (patch)
tree75c80906235ec49f1ae87448fefc5ae6f87e60c3
parentb160a731fea1077c85aea7d0f51673644fb04c70 (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 a8415169c..1fd1d8868 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);
$entryDAO = new EntryDAO ();
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
);