From 42f2ce31cfc96648b38b13334866d465cad4933f Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 8 Jul 2021 14:19:36 +0200 Subject: [PATCH] check if hooks return false (but not action is taken) --- controllers/class.EditDocument.php | 18 +++++++++--------- controllers/class.EditFolder.php | 2 +- controllers/class.EmptyFolder.php | 2 +- controllers/class.RemoveDocument.php | 2 +- controllers/class.RemoveFolder.php | 2 +- controllers/class.TransferDocument.php | 2 +- controllers/class.UpdateDocument.php | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/controllers/class.EditDocument.php b/controllers/class.EditDocument.php index ca4b38218..483972780 100644 --- a/controllers/class.EditDocument.php +++ b/controllers/class.EditDocument.php @@ -52,7 +52,7 @@ class SeedDMS_Controller_EditDocument extends SeedDMS_Controller_Common { $expires = $this->params['expires']; $oldexpires = $document->getExpires(); if ($expires != $oldexpires) { - if(!$this->callHook('preSetExpires', $document, $expires)) { + if(false === $this->callHook('preSetExpires', $document, $expires)) { } if(!$document->setExpires($expires)) { @@ -61,21 +61,21 @@ class SeedDMS_Controller_EditDocument extends SeedDMS_Controller_Common { $document->verifyLastestContentExpriry(); - if(!$this->callHook('postSetExpires', $document, $expires)) { + if(false === $this->callHook('postSetExpires', $document, $expires)) { } } $keywords = $this->params['keywords']; $oldkeywords = $document->getKeywords(); if ($oldkeywords != $keywords) { - if(!$this->callHook('preSetKeywords', $document, $keywords, $oldkeywords)) { + if(false === $this->callHook('preSetKeywords', $document, $keywords, $oldkeywords)) { } if(!$document->setKeywords($keywords)) { return false; } - if(!$this->callHook('postSetKeywords', $document, $keywords, $oldkeywords)) { + if(false === $this->callHook('postSetKeywords', $document, $keywords, $oldkeywords)) { } } @@ -95,21 +95,21 @@ class SeedDMS_Controller_EditDocument extends SeedDMS_Controller_Common { if (count($categoriesarr) != count($oldcategories) || array_diff($categories, $oldcatsids)) { - if(!$this->callHook('preSetCategories', $document, $categoriesarr, $oldcategories)) { + if(false === $this->callHook('preSetCategories', $document, $categoriesarr, $oldcategories)) { } if(!$document->setCategories($categoriesarr)) { return false; } - if(!$this->callHook('postSetCategories', $document, $categoriesarr, $oldcategories)) { + if(false === $this->callHook('postSetCategories', $document, $categoriesarr, $oldcategories)) { } } } elseif($oldcategories) { - if(!$this->callHook('preSetCategories', $document, array(), $oldcategories)) { + if(false === $this->callHook('preSetCategories', $document, array(), $oldcategories)) { } if(!$document->setCategories(array())) { return false; } - if(!$this->callHook('postSetCategories', $document, array(), $oldcategories)) { + if(false === $this->callHook('postSetCategories', $document, array(), $oldcategories)) { } } @@ -180,7 +180,7 @@ class SeedDMS_Controller_EditDocument extends SeedDMS_Controller_Common { return false; } - if(!$this->callHook('postEditDocument')) { + if(false === $this->callHook('postEditDocument')) { } return true; diff --git a/controllers/class.EditFolder.php b/controllers/class.EditFolder.php index 7e37d5016..b3a3c572b 100644 --- a/controllers/class.EditFolder.php +++ b/controllers/class.EditFolder.php @@ -108,7 +108,7 @@ class SeedDMS_Controller_EditFolder extends SeedDMS_Controller_Common { return false; } - if(!$this->callHook('postEditFolder')) { + if(false === $this->callHook('postEditFolder')) { } return true; diff --git a/controllers/class.EmptyFolder.php b/controllers/class.EmptyFolder.php index 529fa9a74..a6629923c 100644 --- a/controllers/class.EmptyFolder.php +++ b/controllers/class.EmptyFolder.php @@ -68,7 +68,7 @@ class SeedDMS_Controller_EmptyFolder extends SeedDMS_Controller_Common { return false; } - if(!$this->callHook('postEmptyFolder')) { + if(false === $this->callHook('postEmptyFolder')) { } return true; diff --git a/controllers/class.RemoveDocument.php b/controllers/class.RemoveDocument.php index 70cff8fe1..56e165e6a 100644 --- a/controllers/class.RemoveDocument.php +++ b/controllers/class.RemoveDocument.php @@ -68,7 +68,7 @@ class SeedDMS_Controller_RemoveDocument extends SeedDMS_Controller_Common { } } - if(!$this->callHook('postRemoveDocument')) { + if(false === $this->callHook('postRemoveDocument')) { } return true; diff --git a/controllers/class.RemoveFolder.php b/controllers/class.RemoveFolder.php index 6706eb8e4..a0633d093 100644 --- a/controllers/class.RemoveFolder.php +++ b/controllers/class.RemoveFolder.php @@ -91,7 +91,7 @@ class SeedDMS_Controller_RemoveFolder extends SeedDMS_Controller_Common { return false; } - if(!$this->callHook('postRemoveFolder')) { + if(false === $this->callHook('postRemoveFolder')) { } return true; diff --git a/controllers/class.TransferDocument.php b/controllers/class.TransferDocument.php index 6585e3f0b..fcc1d8168 100644 --- a/controllers/class.TransferDocument.php +++ b/controllers/class.TransferDocument.php @@ -42,7 +42,7 @@ class SeedDMS_Controller_TransferDocument extends SeedDMS_Controller_Common { if (!$document->transferToUser($newuser)) { return false; } else { - if(!$this->callHook('postTransferDocument')) { + if(false === $this->callHook('postTransferDocument')) { } } } diff --git a/controllers/class.UpdateDocument.php b/controllers/class.UpdateDocument.php index 854fe1f60..4f6013256 100644 --- a/controllers/class.UpdateDocument.php +++ b/controllers/class.UpdateDocument.php @@ -88,7 +88,7 @@ class SeedDMS_Controller_UpdateDocument extends SeedDMS_Controller_Common { } } - if(!$this->callHook('postUpdateDocument', $document, $content)) { + if(false === $this->callHook('postUpdateDocument', $document, $content)) { } return $content;