Fixed some legacy urls
authorAlexander Ebert <ebert@woltlab.com>
Sat, 10 Dec 2016 18:07:49 +0000 (19:07 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Sat, 10 Dec 2016 18:07:49 +0000 (19:07 +0100)
These two URLs were purposely not generated in the expected fashion due
to their special purposes, but they were both abusing a non-standard
behavior that is no longer possible due to a recent change.

wcfsetup/install/files/lib/acp/action/InstallPackageAction.class.php
wcfsetup/install/files/lib/form/SearchForm.class.php

index 15e68845468c90335195e9454a408ce9a0b0c8a8..c491d7e1d5ead105b02398562ced2bd373df140f 100755 (executable)
@@ -88,38 +88,18 @@ class InstallPackageAction extends AbstractDialogAction {
                                $this->installation->completeSetup();
                                $this->finalize();
                                
-                               switch (PACKAGE_ID) {
-                                       // redirect to application if not already within one
-                                       case 0: // during WCFSetup
-                                       case 1:
-                                               // select first installed application
-                                               $sql = "SELECT          packageID
-                                                       FROM            wcf".WCF_N."_package
-                                                       WHERE           packageID <> 1
-                                                                       AND isApplication = 1
-                                                       ORDER BY        installDate ASC";
-                                               $statement = WCF::getDB()->prepareStatement($sql, 1);
-                                               $statement->execute();
-                                               $row = $statement->fetchArray();
-                                               $packageID = ($row === false) ? 1 : $row['packageID'];
-                                       break;
-                                       
-                                       default:
-                                               $packageID = PACKAGE_ID;
-                                       break;
-                               }
-                                       
                                // get domain path
                                $sql = "SELECT  *
                                        FROM    wcf".WCF_N."_application
                                        WHERE   packageID = ?";
                                $statement = WCF::getDB()->prepareStatement($sql);
-                               $statement->execute([$packageID]);
+                               $statement->execute([1]);
                                
                                /** @var Application $application */
                                $application = $statement->fetchObject(Application::class);
                                
                                // build redirect location
+                               // do not use the LinkHandler here as it is sort of unreliable during WCFSetup
                                $location = $application->getPageURL() . 'acp/index.php?package-list/';
                                
                                WCF::resetZendOpcache();
index 7cd697e34d19f66c5c8174e934a8a809c6ce6317..ad058338327437280f674e9fa2e58ecb1a2549f3 100644 (file)
@@ -2,7 +2,6 @@
 namespace wcf\form;
 use wcf\data\search\Search;
 use wcf\data\search\SearchAction;
-use wcf\system\application\ApplicationHandler;
 use wcf\system\exception\IllegalLinkException;
 use wcf\system\exception\NamedUserException;
 use wcf\system\exception\PermissionDeniedException;
@@ -375,21 +374,8 @@ class SearchForm extends AbstractCaptchaForm {
                }
                $this->saved();
                
-               // get application
-               $application = 'wcf';
-               if (count($this->selectedObjectTypes) == 1) {
-                       $objectType = SearchEngine::getInstance()->getObjectType(reset($this->selectedObjectTypes));
-                       /** @noinspection PhpUndefinedFieldInspection */
-                       if ($tmp = ApplicationHandler::getInstance()->getAbbreviation($objectType->packageID)) {
-                               $application = $tmp;
-                       }
-               }
-               
                // forward to result page
-               HeaderUtil::redirect(LinkHandler::getInstance()->getLink('SearchResult', [
-                       'id' => $this->searchID,
-                       'application' => $application
-               ], 'highlight='.urlencode($this->query)));
+               HeaderUtil::redirect(LinkHandler::getInstance()->getLink('SearchResult', ['id' => $this->searchID], 'highlight='.urlencode($this->query)));
                exit;
        }