Work-around for orphaned pages
authorAlexander Ebert <ebert@woltlab.com>
Tue, 2 Jan 2018 11:49:01 +0000 (12:49 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 2 Jan 2018 11:49:01 +0000 (12:49 +0100)
wcfsetup/install/files/acp/templates/pageList.tpl
wcfsetup/install/files/lib/data/page/Page.class.php
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml

index 51716aa549c51ec71d566ef4091c2ee99650594a..7b3d4bd96052d6e3dfe7d541ac69722552cca5b6 100644 (file)
                                                <td class="columnID columnPageID">{@$page->pageID}</td>
                                                <td class="columnTitle columnName">{if $page->isLandingPage}<span class="icon icon16 fa-home jsTooltip" title="{lang}wcf.acp.page.isLandingPage{/lang}"></span> {/if}<a href="{link controller='PageEdit' id=$page->pageID}{/link}">{$page->name}</a></td>
                                                <td class="columnText columnURL">
-                                                       {$page->getDisplayLink()}
+                                                       {if $page->applicationPackageID === null}
+                                                               <span class="icon icon16 fa-exclamation-triangle red"></span> <span>{lang}wcf.acp.page.application.error.missing{/lang}</span>
+                                                       {else}
+                                                               {$page->getDisplayLink()}
+                                                       {/if}
                                                </td>
                                                <td class="columnText columnPageType">{lang}wcf.acp.page.type.{@$page->pageType}{/lang}</td>
                                                <td class="columnDate columnLastUpdateTime">{@$page->lastUpdateTime|time}</td>
index dde8b49d777d959d0ef79ebf0a7f3cf37545d973..6f0a6fe6a4900d7772d2b76d8f481ce5a735c51c 100644 (file)
@@ -157,9 +157,19 @@ class Page extends DatabaseObject implements ILinkableObject, ITitledObject {
                                'forceFrontend' => true
                        ]);
                }
-               else {
-                       return LinkHandler::getInstance()->getCmsLink($this->pageID);
+               else if ($this->applicationPackageID === null) {
+                       // we cannot reliably generate a link for an orphaned page
+                       return '';
                }
+               
+               try {
+                       LinkHandler::getInstance()->getCmsLink($this->pageID);
+               }
+               catch (\Error $e) {
+                       wcfDebug($this, $this->applicationPackageID);
+               }
+               
+               return LinkHandler::getInstance()->getCmsLink($this->pageID);
        }
        
        /**
index 1e23fa7373b872aed0d5cdc01551f2389ddbf934..ac29d833cba71cf9d552ca2bdb5db2f556db2d93 100644 (file)
@@ -1371,6 +1371,7 @@ GmbH=Gesellschaft mit beschränkter Haftung]]></item>
        <category name="wcf.acp.page">
                <item name="wcf.acp.page.add"><![CDATA[Seite hinzufügen]]></item>
                <item name="wcf.acp.page.application"><![CDATA[App]]></item>
+               <item name="wcf.acp.page.application.error.missing"><![CDATA[Keine App festgelegt, Seite kann nicht angezeigt werden.]]></item>
                <item name="wcf.acp.page.boxes"><![CDATA[Ausgewählte Boxen auf dieser Seite anzeigen]]></item>
                <item name="wcf.acp.page.button.viewPage"><![CDATA[Vorschau anzeigen]]></item>
                <item name="wcf.acp.page.content"><![CDATA[Inhalt]]></item>
index 71eaf72d7457c1387297b800651bd68a980c6995..66a9c45942694902c3631233cfa0ae69f9542194 100644 (file)
@@ -2837,6 +2837,7 @@ Errors are:
        <category name="wcf.acp.page">
                <item name="wcf.acp.page.add"><![CDATA[Add Page]]></item>
                <item name="wcf.acp.page.application"><![CDATA[App]]></item>
+               <item name="wcf.acp.page.application.error.missing"><![CDATA[No app specified, page cannot be accessed.]]></item>
                <item name="wcf.acp.page.boxes"><![CDATA[Display the Selected Boxes on This Page]]></item>
                <item name="wcf.acp.page.button.viewPage"><![CDATA[Show Preview]]></item>
                <item name="wcf.acp.page.content"><![CDATA[Content]]></item>