Fixed update of box to page assignments
authorMarcel Werk <burntime@woltlab.com>
Tue, 11 Oct 2016 15:31:16 +0000 (17:31 +0200)
committerMarcel Werk <burntime@woltlab.com>
Tue, 11 Oct 2016 15:31:16 +0000 (17:31 +0200)
wcfsetup/install/files/lib/data/page/PageAction.class.php

index 06339b6f8163461f6ed656104503514869ca3a03..3a85816b2ebed5fcd30909d8978a9ac99244411e 100644 (file)
@@ -191,7 +191,7 @@ class PageAction extends AbstractDatabaseObjectAction implements ISearchAction,
                }
                
                // save box to page assignments
-               if (!empty($this->parameters['boxToPage'])) {
+               if (isset($this->parameters['boxToPage'])) {
                        $sql = "DELETE FROM     wcf".WCF_N."_box_to_page
                                WHERE           pageID = ?";
                        $deleteStatement = WCF::getDB()->prepareStatement($sql);
@@ -204,13 +204,15 @@ class PageAction extends AbstractDatabaseObjectAction implements ISearchAction,
                        foreach ($this->getObjects() as $page) {
                                $deleteStatement->execute([$page->pageID]);
                                
-                               foreach ($this->parameters['boxToPage'] as $boxData) {
-                                       $insertStatement->execute([
-                                               $boxData['boxID'],
-                                               $page->pageID,
-                                               $boxData['visible']
-                                       ]);
-                               }
+                               if (!empty($this->parameters['boxToPage'])) {
+                                       foreach ($this->parameters['boxToPage'] as $boxData) {
+                                               $insertStatement->execute([
+                                                       $boxData['boxID'],
+                                                       $page->pageID,
+                                                       $boxData['visible']
+                                               ]);
+                                       }
+                               }       
                        }
                }
        }