From: Alexander Ebert Date: Wed, 1 Feb 2012 13:18:11 +0000 (+0100) Subject: Redirecting to application within WCFSetup X-Git-Tag: 2.0.0_Beta_1~1360^2~42 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=61ad27ff556f2dbd2d11e41682a90a2384e0df09;p=GitHub%2FWoltLab%2FWCF.git Redirecting to application within WCFSetup Fixes #390 --- diff --git a/wcfsetup/install/files/acp/js/WCF.ACP.js b/wcfsetup/install/files/acp/js/WCF.ACP.js index 84404a6cba..ec09d6b73c 100644 --- a/wcfsetup/install/files/acp/js/WCF.ACP.js +++ b/wcfsetup/install/files/acp/js/WCF.ACP.js @@ -361,7 +361,7 @@ WCF.ACP.Package.Installation.prototype = { $('#packageInstallationInnerContent').append('
'); $('#' + $id).click(function() { - window.location.href = "index.php/PackageList/" + SID_ARG_1ST; + window.location.href = data.redirectLocation; }); $('#packageInstallationInnerContentContainer').show(); diff --git a/wcfsetup/install/files/lib/acp/action/InstallPackageAction.class.php b/wcfsetup/install/files/lib/acp/action/InstallPackageAction.class.php index d253c54882..db28bd2b06 100755 --- a/wcfsetup/install/files/lib/acp/action/InstallPackageAction.class.php +++ b/wcfsetup/install/files/lib/acp/action/InstallPackageAction.class.php @@ -86,10 +86,39 @@ class InstallPackageAction extends AbstractDialogAction { // perform final actions $this->installation->completeSetup(); + // redirect to application if not already within one + if (PACKAGE_ID == 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']; + } + else { + $packageID = PACKAGE_ID; + } + + // get domain path + $sql = "SELECT domainName, domainPath + FROM wcf".WCF_N."_application + WHERE packageID = ?"; + $statement = WCF::getDB()->prepareStatement($sql); + $statement->execute(array($packageID)); + $row = $statement->fetchArray(); + + // build redirect location + $location = $row['domainName'] . $row['domainPath'] . 'index.php/PackageList/' . SID_ARG_1ST; + // show success $this->data = array( 'currentAction' => $this->getCurrentAction(null), 'progress' => 100, + 'redirectLocation' => $location, 'step' => 'success' ); return;