コード例 #1
0
 /**
  * @see Page::readParameters()
  */
 public function readParameters()
 {
     parent::readParameters();
     if (isset($_REQUEST['htUsername'])) {
         $this->htUsername = $_REQUEST['htUsername'];
     }
     if (isset($_REQUEST['htPassword'])) {
         $this->htPassword = $_REQUEST['htPassword'];
     }
     if (isset($_REQUEST['saveAuthData'])) {
         $this->saveAuthData = intval($_REQUEST['saveAuthData']);
     }
     if (isset($_REQUEST['packageUpdateServerID'])) {
         $this->packageUpdateServerID = intval($_REQUEST['packageUpdateServerID']);
     }
     if (!empty($_REQUEST['requestedPage']) || !empty($_REQUEST['requestedForm']) || !empty($_REQUEST['requestedAction'])) {
         // get update server
         require_once WCF_DIR . 'lib/acp/package/update/UpdateServerEditor.class.php';
         $updateServer = new UpdateServerEditor($this->packageUpdateServerID);
         if (!$updateServer->packageUpdateServerID) {
             throw new IllegalLinkException();
         }
         // update update server
         if ($this->saveAuthData) {
             $updateServer->update($updateServer->server, $this->htUsername, $this->htPassword);
         }
         // save auth data in session
         $authData = array('authType' => 'Basic', 'htUsername' => $this->htUsername, 'htPassword' => $this->htPassword);
         // session data
         $packageUpdateAuthData = WCF::getSession()->getVar('packageUpdateAuthData');
         if ($packageUpdateAuthData === null) {
             $packageUpdateAuthData = array();
         }
         $packageUpdateAuthData[$this->packageUpdateServerID] = $authData;
         WCF::getSession()->register('packageUpdateAuthData', $packageUpdateAuthData);
         // remove form=PackageUpdateAuth
         unset($_REQUEST['form'], $_GET['form'], $_POST['form']);
         // set page/form/action
         if (!empty($_REQUEST['requestedPage'])) {
             $_POST['page'] = $_REQUEST['requestedPage'];
         } else {
             if (!empty($_REQUEST['requestedForm'])) {
                 $_POST['form'] = $_REQUEST['requestedForm'];
             } else {
                 $_POST['action'] = $_REQUEST['requestedAction'];
             }
         }
         // remove requestedPage...
         unset($_REQUEST['requestedPage'], $_REQUEST['requestedForm'], $_REQUEST['requestedAction']);
         // start request handler
         global $packageDirs;
         RequestHandler::handle(ArrayUtil::appendSuffix(!empty($packageDirs) ? $packageDirs : array(WCF_DIR), 'lib/acp/'));
         exit;
     }
 }