Properly implemented landing page
authorAlexander Ebert <ebert@woltlab.com>
Tue, 5 Apr 2016 20:12:21 +0000 (22:12 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 5 Apr 2016 20:12:26 +0000 (22:12 +0200)
18 files changed:
com.woltlab.wcf/acpMenu.xml
com.woltlab.wcf/templates/dashboard.tpl
wcfsetup/install/files/acp/install.php
wcfsetup/install/files/acp/templates/pageAdd.tpl
wcfsetup/install/files/acp/templates/pageLanding.tpl [deleted file]
wcfsetup/install/files/lib/acp/form/PageAddForm.class.php
wcfsetup/install/files/lib/acp/form/PageEditForm.class.php
wcfsetup/install/files/lib/acp/form/PageLandingForm.class.php [deleted file]
wcfsetup/install/files/lib/data/page/Page.class.php
wcfsetup/install/files/lib/system/WCF.class.php
wcfsetup/install/files/lib/system/cache/builder/PageCacheBuilder.class.php
wcfsetup/install/files/lib/system/cache/builder/RoutingCacheBuilder.class.php
wcfsetup/install/files/lib/system/request/ControllerMap.class.php
wcfsetup/install/files/lib/system/request/Request.class.php
wcfsetup/install/files/lib/system/request/RequestHandler.class.php
wcfsetup/install/files/lib/system/request/route/DynamicRequestRoute.class.php
wcfsetup/install/files/lib/system/request/route/StaticRequestRoute.class.php
wcfsetup/setup/db/install.sql

index 3d3f75b860b84c7bf4d06e6fcacd5bffee800428..94d96a8f89bed3821a5d6587ecdac9c0f75f8bca 100644 (file)
                                <parent>wcf.acp.menu.link.cms</parent>
                                <permissions>admin.content.cms.canManagePage</permissions>
                        </acpmenuitem>
-                       <acpmenuitem name="wcf.acp.menu.link.cms.page.landing">
-                               <controller><![CDATA[wcf\acp\form\PageLandingForm]]></controller>
-                               <parent>wcf.acp.menu.link.cms.page.list</parent>
-                               <permissions>admin.content.cms.canManagePage</permissions>
-                               <icon>fa-home</icon>
-                       </acpmenuitem>
                        <acpmenuitem name="wcf.acp.menu.link.cms.page.add">
                                <controller><![CDATA[wcf\acp\form\PageAddForm]]></controller>
                                <parent>wcf.acp.menu.link.cms.page.list</parent>
index e40e9b3c64284c72d85db74141aa2748134fb608..b25eea05e6046cf92e3e696caee292d34b264416 100644 (file)
@@ -1,7 +1,7 @@
 {include file='documentHeader'}
 
 <head>
-       <title>{if $__wcf->getPageMenu()->getLandingPage()->menuItem != 'wcf.user.dashboard'}{lang}wcf.user.dashboard{/lang} - {/if}{PAGE_TITLE|language}</title>
+       <title>{if !$__wcf->isLandingPage()}{lang}wcf.user.dashboard{/lang} - {/if}{PAGE_TITLE|language}</title>
        
        {include file='headInclude'}
        
@@ -18,7 +18,7 @@
 
 {include file='header'}
 
-{if $__wcf->getPageMenu()->getLandingPage()->menuItem == 'wcf.user.dashboard'}
+{if $__wcf->isLandingPage()}
        <header class="contentHeader">
                <div class="contentHeaderTitle">
                        <h1 class="contentTitle">{PAGE_TITLE|language}</h1>
index a86c1ec0d0c24b63c80c7dcfba569c64d08f6065..98326293c35082f7c2f689f1afb2b80d445e1191 100644 (file)
@@ -2,11 +2,10 @@
 use wcf\system\session\SessionHandler;
 use wcf\system\WCF;
 use wcf\util\DateUtil;
-use wcf\util\StringUtil;
 
 /**
  * @author     Marcel Werk
- * @copyright  2001-2015 WoltLab GmbH
+ * @copyright  2001-2016 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @category   Community Framework
@@ -15,7 +14,7 @@ use wcf\util\StringUtil;
 $sql = "UPDATE wcf".WCF_N."_package_installation_plugin
        SET     priority = ?";
 $statement = WCF::getDB()->prepareStatement($sql);
-$statement->execute(array(1));
+$statement->execute([1]);
 
 // reset sessions
 SessionHandler::resetSessions();
@@ -24,36 +23,46 @@ SessionHandler::resetSessions();
 $sql = "UPDATE wcf".WCF_N."_acp_template
        SET     packageID = ?";
 $statement = WCF::getDB()->prepareStatement($sql);
-$statement->execute(array(1));
+$statement->execute([1]);
 
 // update language
 $sql = "UPDATE wcf".WCF_N."_language_item
        SET     packageID = ?";
 $statement = WCF::getDB()->prepareStatement($sql);
-$statement->execute(array(1));
+$statement->execute([1]);
 
 // update installation logs
 $sql = "UPDATE wcf".WCF_N."_package_installation_file_log
        SET     packageID = ?";
 $statement = WCF::getDB()->prepareStatement($sql);
-$statement->execute(array(1));
+$statement->execute([1]);
 
 $sql = "UPDATE wcf".WCF_N."_package_installation_sql_log
        SET     packageID = ?";
 $statement = WCF::getDB()->prepareStatement($sql);
-$statement->execute(array(1));
+$statement->execute([1]);
 
 // update pips
 $sql = "UPDATE wcf".WCF_N."_package_installation_plugin
        SET     packageID = ?";
 $statement = WCF::getDB()->prepareStatement($sql);
-$statement->execute(array(1));
+$statement->execute([1]);
 
 // group options
 $sql = "UPDATE wcf".WCF_N."_user_group_option
        SET     packageID = ?";
 $statement = WCF::getDB()->prepareStatement($sql);
-$statement->execute(array(1));
+$statement->execute([1]);
+
+// landing page
+$sql = "UPDATE  wcf".WCF_N."_page
+       SET     isLandingPage = ?
+       WHERE   identifier = ?";
+$statement = WCF::getDB()->prepareStatement($sql);
+$statement->execute([
+       1,
+       'com.woltlab.wcf.Dashboard'
+]);
 
 // get server timezone
 if ($timezone = @date_default_timezone_get()) {
@@ -62,6 +71,9 @@ if ($timezone = @date_default_timezone_get()) {
                        SET     optionValue = ?
                        WHERE   optionName = ?";
                $statement = WCF::getDB()->prepareStatement($sql);
-               $statement->execute(array($timezone, 'timezone'));
+               $statement->execute([
+                       $timezone,
+                       'timezone'
+               ]);
        }
 }
index 62200b484bfbfd1206af4334f0c411541d15121d..6d959a43436a4fa57c1ae2f7d295662825c360b2 100644 (file)
                        </dl>
                {/if}
                
-               <dl>
-                       <dt></dt>
-                       <dd>
-                               <label><input type="checkbox" id="isLandingPage" name="isLandingPage" value="1" {if $isLandingPage}checked="checked" {/if}{if $action == 'edit' && $page->isLandingPage}disabled="disabled" {/if}/> {lang}wcf.acp.page.isLandingPage{/lang}</label>
-                       </dd>
-               </dl>
+               {if $action != 'edit' || !$page->requireObjectID}
+                       <dl>
+                               <dt></dt>
+                               <dd>
+                                       <label><input type="checkbox" id="isLandingPage" name="isLandingPage" value="1" {if $isLandingPage}checked="checked" {/if}{if $action == 'edit' && $page->isLandingPage}disabled="disabled" {/if}/> {lang}wcf.acp.page.isLandingPage{/lang}</label>
+                               </dd>
+                       </dl>
+               {/if}
                
                <dl>
                        <dt></dt>
diff --git a/wcfsetup/install/files/acp/templates/pageLanding.tpl b/wcfsetup/install/files/acp/templates/pageLanding.tpl
deleted file mode 100644 (file)
index 94ed422..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-{include file='header' pageTitle='wcf.acp.page.landing'}
-
-<header class="contentHeader">
-       <h1 class="contentTitle">{lang}wcf.acp.page.landing{/lang}</h1>
-</header>
-
-{include file='formError'}
-
-{if $success|isset}
-       <p class="success">{lang}wcf.global.success.{$action}{/lang}</p>
-{/if}
-
-<div class="contentNavigation">
-       <nav>
-               <ul>
-                       <li><a href="{link controller='PageList'}{/link}" class="button"><span class="icon icon16 fa-list"></span> <span>{lang}wcf.acp.menu.link.cms.page.list{/lang}</span></a></li>
-                       
-                       {event name='contentNavigationButtons'}
-               </ul>
-       </nav>
-</div>
-
-<form method="post" action="{link controller='PageLanding'}{/link}">
-       <div class="section tabularBox">
-               <table class="table">
-                       <thead>
-                               <tr>
-                                       <th class="columnText">{lang}wcf.acp.page.landing.application{/lang}</th>
-                                       <th class="columnURL">{lang}wcf.acp.page.landing.pageURL{/lang}</th>
-                                       <th class="columnText">{lang}wcf.acp.page.landing.landingPage{/lang}</th>
-                               </tr>
-                       </thead>
-                       
-                       <tbody>
-                               {foreach from=$applications item=application}
-                                       <tr>
-                                               <td class="columnText">{$application->getPackage()}</td>
-                                               <td class="columnURL">{$application->getPageURL()}</td>
-                                               <td class="columnText">
-                                                       <select name="landingPages[{@$application->packageID}]">
-                                                               <option value="-1">{lang}wcf.acp.page.landing.applicationDefault{/lang}</option>
-                                                               {foreach from=$pageNodeList item=pageNode}
-                                                                       <option value="{@$pageNode->getPage()->pageID}"{if $pageNode->getPage()->pageID == $application->landingPageID} selected{/if}>{if $pageNode->getDepth() > 1}{@"&nbsp;&nbsp;&nbsp;&nbsp;"|str_repeat:($pageNode->getDepth() - 1)}{/if}{$pageNode->getPage()}</option>
-                                                               {/foreach}
-                                                       </select>
-                                               </td>
-                                       </tr>
-                               {/foreach}      
-                       </tbody>
-               </table>
-       </div>
-       
-       <div class="formSubmit">
-               <input type="submit" value="{lang}wcf.global.button.submit{/lang}" accesskey="s">
-               {@SECURITY_TOKEN_INPUT_TAG}
-       </div>
-</form>
-
-{include file='footer'}
index d021ca7033c99089ec02324e8249827bcd16926d..16a5b43e63e928cf5e7189e21ed5638346f947eb 100644 (file)
@@ -275,20 +275,27 @@ class PageAddForm extends AbstractForm {
                        'pageType' => $this->pageType,
                        'name' => $this->name,
                        'isDisabled' => ($this->isDisabled) ? 1 : 0,
-                       'isLandingPage' => ($this->isLandingPage) ? 1 : 0,
+                       'isLandingPage' => 0,
                        'packageID' => ($this->packageID ?: null),
                        'lastUpdateTime' => TIME_NOW,
                        'isMultilingual' => $this->isMultilingual,
                        'identifier' => '',
                        'controller' => $this->controller
                ]), 'content' => $content]);
-               $returnValues = $this->objectAction->executeAction();
+               
+               /** @var Page $page */
+               $page = $this->objectAction->executeAction()['returnValues'];
+               
                // set generic page identifier
-               $pageEditor = new PageEditor($returnValues['returnValues']);
+               $pageEditor = new PageEditor($page);
                $pageEditor->update([
                        'identifier' => 'com.woltlab.wcf.generic'.$pageEditor->pageID
                ]);
                
+               if ($this->isLandingPage) {
+                       $page->setAsLandingPage();
+               }
+               
                // call saved event
                $this->saved();
                
index 315bf0671c84728134e3a5a0f12e4e4467044077..5f210ade9c8a5430ee2054d6efa0289908119d79 100644 (file)
@@ -63,6 +63,11 @@ class PageEditForm extends PageAddForm {
                        $this->packageID = $this->page->packageID;
                        $this->controller = $this->page->controller;
                }
+               
+               if ($this->page->requireObjectID) {
+                       // pages that require an object id can never be set as landing page
+                       $this->isLandingPage = 0;
+               }
        }
        
        /**
@@ -83,7 +88,6 @@ class PageEditForm extends PageAddForm {
                $data = array(
                        'name' => $this->name,
                        'isDisabled' => ($this->isDisabled) ? 1 : 0,
-                       'isLandingPage' => ($this->isLandingPage) ? 1 : 0,
                        'lastUpdateTime' => TIME_NOW,
                        'parentPageID' => ($this->parentPageID ?: null),
                        'packageID' => $this->packageID
@@ -121,6 +125,10 @@ class PageEditForm extends PageAddForm {
                        $this->objectAction->executeAction();
                }
                
+               if ($this->isLandingPage != $this->page->isLandingPage) {
+                       $this->page->setAsLandingPage();
+               }
+               
                // call saved event
                $this->saved();
                
diff --git a/wcfsetup/install/files/lib/acp/form/PageLandingForm.class.php b/wcfsetup/install/files/lib/acp/form/PageLandingForm.class.php
deleted file mode 100644 (file)
index c996b41..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-<?php
-namespace wcf\acp\form;
-use wcf\data\application\Application;
-use wcf\data\application\ApplicationAction;
-use wcf\data\application\ApplicationList;
-use wcf\data\page\Page;
-use wcf\data\page\PageList;
-use wcf\data\page\PageNodeTree;
-use wcf\form\AbstractForm;
-use wcf\system\exception\UserInputException;
-use wcf\system\WCF;
-use wcf\util\ArrayUtil;
-
-/**
- * Shows the page add form.
- * 
- * @author     Marcel Werk
- * @copyright  2001-2015 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    com.woltlab.wcf
- * @subpackage acp.form
- * @category   Community Framework
- */
-class PageLandingForm extends AbstractForm {
-       /**
-        * @inheritDoc
-        */
-       public $activeMenuItem = 'wcf.acp.menu.link.cms.page.landing';
-       
-       /**
-        * list of available applications
-        * @var Application[]
-        */
-       public $applications;
-       
-       /**
-        * landing page id per application package id
-        * @var integer[]
-        */
-       public $landingPages = [];
-       
-       /**
-        * @inheritDoc
-        */
-       public $neededPermissions = ['admin.content.cms.canManagePage'];
-       
-       /**
-        * list of available pages
-        * @var Page[]
-        */
-       public $pages = [];
-       
-       /**
-        * @inheritDoc
-        */
-       public function readParameters() {
-               parent::readParameters();
-       
-               // get available applications and pages
-               $applicationList = new ApplicationList();
-               $applicationList->readObjects();
-               $this->applications = $applicationList->getObjects();
-               
-               $pageList = new PageList();
-               $pageList->readObjects();
-               foreach ($pageList as $page) {
-                       if (!isset($this->pages[$page->packageID])) $this->pages[$page->packageID] = [];
-                       
-                       $this->pages[$page->packageID][$page->pageID] = $page;
-               }
-       }
-       
-       /**
-        * @inheritDoc
-        */
-       public function readFormParameters() {
-               parent::readFormParameters();
-               
-               if (isset($_POST['landingPages']) && is_array($_POST['landingPages'])) $this->landingPages = ArrayUtil::toIntegerArray($_POST['landingPages']);
-       }
-       
-       /**
-        * @inheritDoc
-        */
-       public function validate() {
-               parent::validate();
-               
-               foreach ($this->applications as $packageID => $application) {
-                       if (empty($this->landingPages[$packageID])) {
-                               throw new UserInputException('landingPage');
-                       }
-                       
-                       // handle application default
-                       if ($this->landingPages[$packageID] === -1) {
-                               $this->landingPages[$packageID] = null;
-                               
-                               continue;
-                       }
-                       
-                       $page = new Page($this->landingPages[$packageID]);
-                       if (!$page->pageID) {
-                               throw new UserInputException('landingPage', 'notValid');
-                       }
-               }
-       }
-       
-       /**
-        * @inheritDoc
-        */
-       public function save() {
-               parent::save();
-               
-               $this->objectAction = new ApplicationAction($this->applications, 'setLandingPage', ['landingPages' => $this->landingPages]);
-               $this->objectAction->executeAction();
-               
-               // call saved event
-               $this->saved();
-               
-               // show success
-               WCF::getTPL()->assign('success', true);
-       }
-       
-       /**
-        * @inheritDoc
-        */
-       public function assignVariables() {
-               parent::assignVariables();
-               
-               WCF::getTPL()->assign([
-                       'applications' => $this->applications,
-                       'pageNodeList' => (new PageNodeTree())->getNodeList()
-               ]);
-       }
-}
index f03f641fe8e55c7028c2c8151518c9ef9d77a522..a35e9133271472d528e77f255c4b9578d580c2fb 100644 (file)
@@ -5,6 +5,7 @@ use wcf\data\TDatabaseObjectOptions;
 use wcf\data\TDatabaseObjectPermissions;
 use wcf\system\application\ApplicationHandler;
 use wcf\system\database\util\PreparedStatementConditionBuilder;
+use wcf\system\exception\SystemException;
 use wcf\system\request\LinkHandler;
 use wcf\system\WCF;
 
@@ -203,6 +204,37 @@ class Page extends DatabaseObject {
                return true;
        }
        
+       /**
+        * Sets the current page as landing page.
+        * 
+        * @throws      SystemException
+        */
+       public function setAsLandingPage() {
+               if ($this->requireObjectID) {
+                       throw new SystemException('Pages requiring an object id cannot be set as landing page.');
+               }
+               
+               // unmark existing landing page
+               $sql = "UPDATE  wcf".WCF_N."_page
+                       SET     isLandingPage = ?
+                               AND isLandingPage = ?";
+               $statement = WCF::getDB()->prepareStatement($sql);
+               $statement->execute([
+                       0,
+                       1
+               ]);
+               
+               // set current page as landing page
+               $sql = "UPDATE  wcf".WCF_N."_page
+                       SET     isLandingPage = ?
+                       WHERE   pageID = ?";
+               $statement = WCF::getDB()->prepareStatement($sql);
+               $statement->execute([
+                       1,
+                       $this->pageID
+               ]);
+       }
+       
        /**
         * Returns the page's internal name.
         *
index 718c434f92d4be75f5d53b5f54c9d09c69472f30..c28cac1581ebe2f40b74f902fda316787e243513 100644 (file)
@@ -20,6 +20,7 @@ use wcf\system\exception\PermissionDeniedException;
 use wcf\system\exception\SystemException;
 use wcf\system\language\LanguageFactory;
 use wcf\system\package\PackageInstallationDispatcher;
+use wcf\system\request\RequestHandler;
 use wcf\system\request\RouteHandler;
 use wcf\system\session\SessionFactory;
 use wcf\system\session\SessionHandler;
@@ -55,7 +56,7 @@ if (!defined('NO_IMPORTS')) {
  * It holds the database connection, access to template and language engine.
  * 
  * @author     Marcel Werk
- * @copyright  2001-2015 WoltLab GmbH
+ * @copyright  2001-2016 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage system
@@ -909,6 +910,15 @@ class WCF {
                return self::getPath() . 'images/favicon.ico';
        }
        
+       /**
+        * Returns true if currently active request represents the landing page.
+        * 
+        * @return      boolean
+        */
+       public function isLandingPage() {
+               return RequestHandler::getInstance()->getActiveRequest()->isLandingPage();
+       }
+       
        /**
         * Initialises the cronjobs.
         */
index b0b115fd9f1112fd394fe1b569b19c817db571e4..6447f21216dd4b649b1ec38c5e41fc206787cbb3 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 namespace wcf\system\cache\builder;
+use wcf\data\page\Page;
 use wcf\data\page\PageList;
 
 /**
@@ -20,7 +21,8 @@ class PageCacheBuilder extends AbstractCacheBuilder {
                $data = [
                        'identifier' => [],
                        'controller' => [],
-                       'pages' => []
+                       'pages' => [],
+                       'landingPage' => null
                ];
                
                $pageList = new PageList();
@@ -28,9 +30,14 @@ class PageCacheBuilder extends AbstractCacheBuilder {
                $data['pages'] = $pageList->getObjects();
                
                // build lookup table
+               /** @var Page $page */
                foreach ($pageList as $page) {
                        $data['identifier'][$page->identifier] = $page->pageID;
                        $data['controller'][$page->controller] = $page->pageID;
+                       
+                       if ($page->isLandingPage) {
+                               $data['landingPage'] = $page;
+                       }
                }
                
                return $data;
index 5fc0428c455de41f2d2fe5a6a9886a6d3a741c7a..8c8509808fd8566210b47abbd58b0c7c2f7a29d2 100644 (file)
@@ -2,6 +2,7 @@
 namespace wcf\system\cache\builder;
 use wcf\data\application\Application;
 use wcf\data\page\Page;
+use wcf\page\CmsPage;
 use wcf\system\application\ApplicationHandler;
 use wcf\system\request\ControllerMap;
 use wcf\system\WCF;
@@ -169,25 +170,37 @@ class RoutingCacheBuilder extends AbstractCacheBuilder {
                }
                
                foreach (ApplicationHandler::getInstance()->getApplications() as $application) {
-                       if ($application->landingPageID) {
-                               $page = new Page($application->landingPageID);
-                               if ($page->controller) {
-                                       $controller = $page->controller;
+                       $controller = null;
+                       
+                       if ($application->packageID == 1) {
+                               // handle WCF
+                               $page = PageCacheBuilder::getInstance()->getData([], 'landingPage');
+                               if ($page === null) {
+                                       // no landing page defined
+                                       $controller = ['', '', ''];
                                }
                                else {
-                                       $controller = '__WCF_CMS__' . $page->pageID;
-                                       $controller = [$controller, $controller];
+                                       if ($page->controller) {
+                                               $controller = $page->controller;
+                                       }
+                                       else {
+                                               $controller = '__WCF_CMS__' . $page->pageID;
+                                               $controller = [$controller, $controller, CmsPage::class];
+                                       }
+                                       
                                }
                        }
-                       else if ($application->packageID == 1) {
-                               // WCF has no default controller
-                               $controller = ['', ''];
-                       }
                        else {
-                               $controller = preg_replace('~^.*?\\\([^\\\]+)(?:Action|Form|Page)$~', '\\1', WCF::getApplicationObject($application)->getPrimaryController());
+                               $controller = WCF::getApplicationObject($application)->getPrimaryController();
+                       }
+                       
+                       if (is_string($controller)) {
+                               $fqnController = $controller;
+                               $controller = preg_replace('~^.*?\\\([^\\\]+)(?:Action|Form|Page)$~', '\\1', $controller);
                                $controller = [
                                        $controller,
-                                       ControllerMap::transformController($controller)
+                                       ControllerMap::transformController($controller),
+                                       $fqnController
                                ];
                        }
                        
index 2393c91926bd8bb7a04ee27c5330446d8570b764..9cc705ef203e6b26a96ea176260433262069b930 100644 (file)
@@ -246,6 +246,28 @@ class ControllerMap extends SingletonFactory {
                return false;
        }
        
+       /**
+        * Returns true if currently active request represents the landing page.
+        * 
+        * @param       string[]        $classData
+        * @param       array           $metaData
+        * @return      boolean
+        */
+       public function isLandingPage(array $classData, array $metaData) {
+               if ($classData['className'] !== $this->landingPages['wcf'][2]) {
+                       return false;
+               }
+               
+               if ($classData['className'] === CmsPage::class) {
+                       // check if page id matches
+                       if ($this->landingPages['wcf'][1] !== '__WCF_CMS__' . $metaData['cms']['pageID']) {
+                               return false;
+                       }
+               }
+               
+               return true;
+       }
+       
        /**
         * Returns the class data for the active request or null if for the given
         * configuration no proper class exist.
index 9c80572c1280f3c61acc548fa4e3e118a16f3c2a..1634c80d056a3018adf09b31ea97ddb532b1bbf5 100644 (file)
@@ -18,6 +18,11 @@ class Request {
         */
        protected $className = '';
        
+       /**
+        * @var boolean
+        */
+       protected $isLandingPage = false;
+       
        /**
         * request meta data
         * @var string[]
@@ -57,6 +62,13 @@ class Request {
                $this->pageType = $pageType;
        }
        
+       /**
+        * Marks this request as landing page.
+        */
+       public function setIsLandingPage() {
+               $this->isLandingPage = true;
+       }
+       
        /**
         * Executes this request.
         */
@@ -76,6 +88,15 @@ class Request {
                return ($this->requestObject !== null);
        }
        
+       /**
+        * Returns true if this request represents the landing page.
+        * 
+        * @return boolean
+        */
+       public function isLandingPage() {
+               return $this->isLandingPage;
+       }
+       
        /**
         * Returns the page class name of this request.
         * 
index 8985988808d0435cd766978c005cee159f733343..6cfcb74e3bec6250a016e9e4d8fac44024a8e9d8 100644 (file)
@@ -167,6 +167,11 @@ class RequestHandler extends SingletonFactory {
                        }
                        
                        $this->activeRequest = new Request($classData['className'], $classData['controller'], $classData['pageType'], $metaData);
+                       
+                       // determine if current request matches the landing page
+                       if (ControllerMap::getInstance()->isLandingPage($classData, $metaData)) {
+                               $this->activeRequest->setIsLandingPage();
+                       }
                }
                catch (SystemException $e) {
                        throw new IllegalLinkException();
index 0473ad60d6bc5929488bad40d30c8db490bcf10a..c1ab7b433f338e9230b62c7c4bdd32f091724a6d 100644 (file)
@@ -79,7 +79,7 @@ class DynamicRequestRoute implements IRequestRoute {
        }
        
        /**
-        * @see IRequestRoute::setIsACP()
+        * @inheritDoc
         */
        public function setIsACP($isACP) {
                $this->isACP = $isACP;
index ce8baa6fb94c4faf345cdd62efafe851965e2d0c..7bf271535715c88fe1014c4e76b9757061c082e4 100644 (file)
@@ -27,7 +27,7 @@ class StaticRequestRoute extends DynamicRequestRoute {
        protected $staticController = '';
        
        /**
-        * @see \wcf\system\request\route\IRequestRoute::setIsACP()
+        * @inheritDoc
         */
        public function setIsACP($isACP) {
                // static routes are disallowed for ACP
@@ -48,7 +48,7 @@ class StaticRequestRoute extends DynamicRequestRoute {
        }
        
        /**
-        * @see \wcf\system\request\IRoute::buildLink()
+        * @inheritDoc
         */
        public function buildLink(array $components) {
                // static routes don't have these components
@@ -59,7 +59,7 @@ class StaticRequestRoute extends DynamicRequestRoute {
        }
        
        /**
-        * @see \wcf\system\request\IRoute::canHandle()
+        * @inheritDoc
         */
        public function canHandle(array $components) {
                if (isset($components['application']) && $components['application'] == $this->staticApplication) {
@@ -72,7 +72,7 @@ class StaticRequestRoute extends DynamicRequestRoute {
        }
        
        /**
-        * @see \wcf\system\request\IRoute::matches()
+        * @inheritDoc
         */
        public function matches($requestURL) {
                if (parent::matches($requestURL)) {
index 866d2aa5363b9e8acfdcc6d6dd245e1691c22127..130ad586a5558ed54d5d3eb0f408d52b2adffaf8 100644 (file)
@@ -128,8 +128,7 @@ CREATE TABLE wcf1_application (
        domainName VARCHAR(255) NOT NULL,
        domainPath VARCHAR(255) NOT NULL DEFAULT '/',
        cookieDomain VARCHAR(255) NOT NULL,
-       cookiePath VARCHAR(255) NOT NULL DEFAULT '/',
-       landingPageID INT(10) NULL
+       cookiePath VARCHAR(255) NOT NULL DEFAULT '/'
 );
 
 DROP TABLE IF EXISTS wcf1_attachment;