--- /dev/null
+{include file='header' pageTitle='wcf.acp.application.edit'}
+
+<header class="boxHeadline">
+ <hgroup>
+ <h1>{lang}wcf.acp.application.edit.title{/lang}</h1>
+ </hgroup>
+</header>
+
+{if $errorField}
+ <p class="error">{lang}wcf.global.form.error{/lang}</p>
+{/if}
+
+{if $success|isset}
+ <p class="success">{lang}wcf.global.form.edit.success{/lang}</p>
+{/if}
+
+<div class="contentNavigation">
+ <nav>
+ <ul>
+ <li><a href="{link controller='ApplicationManagement'}{/link}" title="{lang}wcf.acp.application.management{/lang}" class="button"><img src="{@$__wcf->getPath()}icon/list.svg" alt="" class="icon24" /> <span>{lang}wcf.acp.application.management{/lang}</span></a></li>
+
+ {event name='largeButtons'}
+ </ul>
+ </nav>
+</div>
+
+<form method="post" action="{link controller='ApplicationEdit' id=$application->packageID}{/link}">
+ <div class="container containerPadding marginTop shadow">
+ <fieldset>
+ <legend>{lang}wcf.acp.application.domain{/lang}</legend>
+
+ <dl{if $errorField == 'domainName'} class="formError"{/if}>
+ <dt><label for="domainName">{lang}wcf.acp.application.domainName{/lang}</label></dt>
+ <dd>
+ <input type="text" name="domainName" id="domainName" value="{$domainName}" class="long" />
+ <small>{lang}wcf.acp.application.domainName.description{/lang}</small>
+ {if $errorField == 'domainName'}
+ <small class="innerError">
+ {if $errorType == 'empty'}
+ {lang}wcf.acp.global.form.error.empty{/lang}
+ {else}
+ {lang}wcf.acp.application.domainName.error.{$errorType}{/lang}
+ {/if}
+ </small>
+ {/if}
+ </dd>
+ </dl>
+ <dl>
+ <dt><label for="domainPath">{lang}wcf.acp.application.domainPath{/lang}</label></dt>
+ <dd>
+ <input type="text" name="domainPath" id="domainPath" value="{$domainPath}" class="long" />
+ <small>{lang}wcf.acp.application.domainPath.description{/lang}</small>
+ </dd>
+ </dl>
+ </fieldset>
+
+ <fieldset>
+ <legend>{lang}wcf.acp.application.cookie{/lang}</legend>
+
+ <p class="warning">{lang}wcf.acp.application.cookie.warning{/lang}</p>
+
+ <dl class="marginTop {if $errorField == 'cookieDomain'} formError{/if}">
+ <dt><label for="cookieDomain">{lang}wcf.acp.application.cookieDomain{/lang}</label></dt>
+ <dd>
+ <input type="text" name="cookieDomain" id="cookieDomain" value="{$cookieDomain}" class="long" />
+ {if $errorField == 'cookieDomain'}
+ <small class="innerError">
+ {if $errorType == 'empty'}
+ {lang}wcf.acp.global.form.error.empty{/lang}
+ {else}
+ {lang}wcf.acp.application.cookieDomain.error.{$errorType}{/lang}
+ {/if}
+ </small>
+ {/if}
+ </dd>
+ </dl>
+ <dl{if $errorField == 'cookiePath'} class="formError"{/if}>
+ <dt><label for="cookiePath">{lang}wcf.acp.application.cookiePath{/lang}</label></dt>
+ <dd>
+ <input type="text" name="cookiePath" id="cookiePath" value="{$cookiePath}" class="long" />
+ {if $errorField == 'cookiePath'}
+ <small class="innerError">
+ {if $errorType == 'empty'}
+ {lang}wcf.acp.global.form.error.empty{/lang}
+ {else}
+ {lang}wcf.acp.application.cookiePath.error.{$errorType}{/lang}
+ {/if}
+ </small>
+ {/if}
+ </dd>
+ </dl>
+ </fieldset>
+
+ {event name='fieldsets'}
+ </div>
+
+ <div class="formSubmit">
+ <input type="submit" value="{lang}wcf.global.button.submit{/lang}" accesskey="s" />
+ </div>
+</form>
+
+{include file='footer'}
--- /dev/null
+<?php
+namespace wcf\acp\form;
+use wcf\data\application\Application;
+use wcf\data\application\ApplicationAction;
+use wcf\system\exception\IllegalLinkException;
+use wcf\system\exception\UserInputException;
+use wcf\system\Regex;
+use wcf\system\WCF;
+use wcf\util\FileUtil;
+use wcf\util\StringUtil;
+
+/**
+ * Shows the application edit form.
+ *
+ * @author Alexander Ebert
+ * @copyright 2001-2012 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 ApplicationEditForm extends ACPForm {
+ /**
+ * @see wcf\acp\form\ACPForm::$activeMenuItem
+ */
+ public $activeMenuItem = 'wcf.acp.menu.link.application';
+
+ /**
+ * application object
+ * @var wcf\data\application\Application
+ */
+ public $application = null;
+
+ /**
+ * cookie domain
+ * @var string
+ */
+ public $cookieDomain = '';
+
+ /**
+ * cookie path
+ * @var string
+ */
+ public $cookiePath = '';
+
+ /**
+ * domain name
+ * @var string
+ */
+ public $domainName = '';
+
+ /**
+ * domain path
+ * @var string
+ */
+ public $domainPath = '';
+
+ /**
+ * @see wcf\page\AbstractPage::$neededPermissions
+ */
+ public $neededPermissions = array('admin.system.canManageApplication');
+
+ /**
+ * application package id
+ * @var integer
+ */
+ public $packageID = 0;
+
+ /**
+ * @see wcf\page\AbstractPage::$templateName
+ */
+ public $templateName = 'applicationEdit';
+
+ /**
+ * @see wcf\page\IPage::readParameters()
+ */
+ public function readParameters() {
+ parent::readParameters();
+
+ if (isset($_REQUEST['id'])) $this->packageID = intval($_REQUEST['id']);
+ $this->application = new Application($this->packageID);
+ if (!$this->application->packageID) {
+ throw new IllegalLinkException();
+ }
+ }
+
+ /**
+ * @see wcf\form\IForm::readFormParameters()
+ */
+ public function readFormParameters() {
+ parent::readFormParameters();
+
+ if (isset($_POST['cookieDomain'])) $this->cookieDomain = StringUtil::trim($_POST['cookieDomain']);
+ if (isset($_POST['cookiePath'])) $this->cookiePath = StringUtil::trim($_POST['cookiePath']);
+ if (isset($_POST['domainName'])) $this->domainName = StringUtil::trim($_POST['domainName']);
+ if (isset($_POST['domainPath'])) $this->domainPath = StringUtil::trim($_POST['domainPath']);
+ }
+
+ /**
+ * @see wcf\page\IForm::readData()
+ */
+ public function readData() {
+ parent::readData();
+
+ if (empty($_POST)) {
+ $this->cookieDomain = $this->application->cookieDomain;
+ $this->cookiePath = $this->application->cookiePath;
+ $this->domainName = $this->application->domainName;
+ $this->domainPath = $this->application->domainPath;
+ }
+ }
+
+ /**
+ * @see wcf\form\IForm::validate()
+ */
+ public function validate() {
+ parent::validate();
+
+ if (empty($this->domainName)) {
+ throw new UserInputException('domainName');
+ }
+ else {
+ $regex = new Regex('^https?\://');
+ $this->domainName = FileUtil::removeTrailingSlash($regex->replace($this->domainName, ''));
+ $this->cookieDomain = FileUtil::removeTrailingSlash($regex->replace($this->cookieDomain, ''));
+
+ // domain may not contain path components
+ $regex = new Regex('[/#\?&]');
+ if ($regex->match($this->domainName)) {
+ throw new UserInputException('domainName', 'containsPath');
+ }
+ else if ($regex->match($this->cookieDomain)) {
+ throw new UserInputException('cookieDomain', 'containsPath');
+ }
+
+ // check if cookie domain shares the same domain (may exclude subdomains)
+ if (!StringUtil::endsWith($this->domainName, $this->cookieDomain)) {
+ throw new UserInputException('cookieDomain', 'notValid');
+ }
+ }
+
+ if (empty($this->domainPath)) {
+ $this->cookiePath = '';
+ }
+ else {
+ // strip first and last slash
+ $this->domainPath = FileUtil::removeLeadingSlash(FileUtil::removeTrailingSlash($this->domainPath));
+ $this->cookiePath = FileUtil::removeLeadingSlash(FileUtil::removeTrailingSlash($this->cookiePath));
+
+ if (!empty($this->cookiePath) && ($this->domainPath != $this->cookiePath)) {
+ // check if cookie path is contained within domain path
+ if (!StringUtil::startsWith($this->domainPath, $this->cookiePath)) {
+ throw new UserInputException('cookiePath', 'notValid');
+ }
+ }
+ }
+
+ // add slashes
+ $this->domainPath = FileUtil::addLeadingSlash(FileUtil::addTrailingSlash($this->domainPath));
+ $this->cookiePath = FileUtil::addLeadingSlash(FileUtil::addTrailingSlash($this->cookiePath));
+ }
+
+ /**
+ * @see wcf\form\IForm::save()
+ */
+ public function save() {
+ parent::save();
+
+ // save application
+ $this->objectAction = new ApplicationAction(array($this->application), 'update', array('data' => array(
+ 'cookieDomain' => $this->cookieDomain,
+ 'cookiePath' => $this->cookiePath,
+ 'domainName' => $this->domainName,
+ 'domainPath' => $this->domainPath
+ )));
+ $this->objectAction->executeAction();
+ $this->saved();
+
+ // show success.
+ WCF::getTPL()->assign(array(
+ 'success' => true
+ ));
+ }
+
+ /**
+ * @see wcf\page\IPage::assignVariables()
+ */
+ public function assignVariables() {
+ parent::assignVariables();
+
+ WCF::getTPL()->assign(array(
+ 'application' => $this->application,
+ 'cookieDomain' => $this->cookieDomain,
+ 'cookiePath' => $this->cookiePath,
+ 'domainName' => $this->domainName,
+ 'domainPath' => $this->domainPath,
+ 'packageID' => $this->packageID
+ ));
+ }
+}
</category>
<category name="wcf.acp.application">
+ <item name="wcf.acp.application.cookie"><![CDATA[Cookie-Einstellungen]]></item>
+ <item name="wcf.acp.application.cookie.warning"><![CDATA[Die folgenden Einstellungen stellen sicher, dass der Login gespeichert wird und ein automatischer Login möglich ist. Sie müssen diese Einstellungen anpassen, sollten sich Domain und/oder Pfad geändert haben. Sollten Sie sich bei den korrekten Werten nicht sicher sein, übernehmen Sie bitte die exakten Angaben der beiden obigen Eingabefelder.]]></item>
<item name="wcf.acp.application.cookieDomain"><![CDATA[Cookie-Domain]]></item>
+ <item name="wcf.acp.application.cookieDomain.error.containsPfad"><![CDATA[Die Cookie-Domain darf keine Pfadangaben enthalten]]></item>
+ <item name="wcf.acp.application.cookieDomain.error.notValid"><![CDATA[Die Cookie-Domain stimmt nicht mit der oben angegebenen Domain überein (Subdomains wie zum Beispiel „www“ dürfen weggelassen werden).]]></item>
<item name="wcf.acp.application.cookiePath"><![CDATA[Cookie-Pfad]]></item>
+ <item name="wcf.acp.application.cookiePath.error.notValid"><![CDATA[Der Cookie-Pfad passt nicht zum oben angegebenen Domain-Pfad.]]></item>
+ <item name="wcf.acp.application.domain"><![CDATA[Domain-Einstellungen]]></item>
<item name="wcf.acp.application.domainName"><![CDATA[Domain]]></item>
+ <item name="wcf.acp.application.domainName.description"><![CDATA[Geben Sie die Domain an, über die diese Anwendung erreichbar ist. Wenn Ihre Anwendung zum Beispiel unter „http://www.example.com/community/forum/“ erreichbar ist, so geben Sie hier bitte „www.example.com“ ein.]]></item>
+ <item name="wcf.acp.application.domainName.error.containsPfad"><![CDATA[Die Domain darf keine Pfadangaben enthalten]]></item>
<item name="wcf.acp.application.domainPath"><![CDATA[Pfad]]></item>
+ <item name="wcf.acp.application.domainPath.description"><![CDATA[Geben Sie den Pfad an, über den diese Anwendung erreichbar ist. Wenn Ihre Anwendung zum Beispiel unter „http://www.example.com/community/forum/“ erreichbar ist, so geben Sie bitte „/community/forum/“ ein.]]></item>
+ <item name="wcf.acp.application.edit"><![CDATA[Anwendung bearbeiten]]></item>
+ <item name="wcf.acp.application.edit.title"><![CDATA[Anwendung bearbeiten: WoltLab Burning Board]]></item>
<item name="wcf.acp.application.group.add"><![CDATA[Anwendungsgruppe hinzufügen]]></item>
<item name="wcf.acp.application.group.applications.error.duplicate"><![CDATA[Zwei oder mehr Anwendungen des selben Typs können nicht in einer Gruppe zusammengefasst werden.]]></item>
<item name="wcf.acp.application.group.applications.error.notValid"><![CDATA[Eine oder mehrere ausgewählte Anwendungen sind nicht mehr verfügbar.]]></item>