<supporti18n>1</supporti18n>
<requirei18n>0</requirei18n>
</option>
- <option name="page_url">
- <categoryname>general.page</categoryname>
- <optiontype>text</optiontype>
- </option>
<option name="page_urls">
<categoryname>general.page</categoryname>
<optiontype>textarea</optiontype>
<?php
namespace wcf\acp\action;
use wcf\action\AbstractDialogAction;
+use wcf\data\application\Application;
use wcf\data\package\installation\queue\PackageInstallationQueue;
use wcf\system\cache\CacheHandler;
use wcf\system\exception\IllegalLinkException;
}
// get domain path
- $sql = "SELECT domainName, domainPath
+ $sql = "SELECT *
FROM wcf".WCF_N."_application
WHERE packageID = ?";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute(array($packageID));
- $row = $statement->fetchArray();
+ $application = new Application(null, $statement->fetchArray());
// build redirect location
- $location = $row['domainName'] . $row['domainPath'] . 'acp/index.php/PackageList/' . SID_ARG_1ST;
+ $location = $application->getPageURL() . 'acp/index.php/PackageList/' . SID_ARG_1ST;
// show success
$this->data = array(
<?php
namespace wcf\acp\action;
use wcf\action\AbstractDialogAction;
+use wcf\data\application\Application;
use wcf\data\package\installation\queue\PackageInstallationQueue;
use wcf\data\package\installation\queue\PackageInstallationQueueEditor;
use wcf\data\package\Package;
}
// get domain path
- $sql = "SELECT domainName, domainPath
+ $sql = "SELECT *
FROM wcf".WCF_N."_application
WHERE packageID = ?";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute(array($packageID));
- $row = $statement->fetchArray();
+ $application = new Application(null, $statement->fetchArray());
// build redirect location
- $location = $row['domainName'] . $row['domainPath'] . 'acp/index.php/PackageList/' . SID_ARG_1ST;
+ $location = $application->getPageURL() . 'acp/index.php/PackageList/' . SID_ARG_1ST;
// show success
$this->data = array(
<?php
namespace wcf\data\application;
use wcf\data\DatabaseObject;
+use wcf\system\request\RouteHandler;
/**
* Represents an application.
* @see wcf\data\DatabaseObject::$databaseTableIndexIsIdentity
*/
protected static $databaseTableIndexIsIdentity = false;
+
+ /**
+ * absolute page URL
+ * @var string
+ */
+ protected $pageURL = '';
+
+ /**
+ * Returns absolute page URL.
+ *
+ * @return string
+ */
+ public function getPageURL() {
+ if (empty($this->pageURL)) {
+ $this->pageURL = RouteHandler::getProtocol() . $this->domainName . $this->domainPath;
+ }
+
+ return $this->pageURL;
+ }
}
<?php
namespace wcf\system\cache\builder;
use wcf\data\application\group\ApplicationGroup;
+use wcf\data\application\Application;
+use wcf\data\application\ApplicationList;
use wcf\data\package\Package;
use wcf\data\package\PackageList;
-use wcf\data\application;
use wcf\system\WCF;
/**
// current application is not part of an application group
if (!$row || ($row['groupID'] == 0) || $row['groupID'] === null) {
- $data['application'] = array($packageID => new application\Application($packageID));
+ $data['application'] = array($packageID => new Application($packageID));
}
else {
// fetch applications
- $applicationList = new application\ApplicationList();
+ $applicationList = new ApplicationList();
$applicationList->getConditionBuilder()->add("application.groupID = ?", array($row['groupID']));
$applicationList->sqlLimit = 0;
$applicationList->readObjects();
}
// fetch wcf pseudo-application
- $data['wcf'] = new application\Application(1);
+ $data['wcf'] = new Application(1);
return $data;
}
$this->package = null;
if ($package->isApplication) {
- $host = RouteHandler::getHost();
+ $host = StringUtil::replace(RouteHandler::getProtocol(), '', RouteHandler::getHost());
$path = RouteHandler::getPath(array('acp'));
// insert as application
$application = ApplicationHandler::getInstance()->getPrimaryApplication();
}
- $url = $application->domainName.$application->domainPath.(RequestHandler::getInstance()->isACPRequest() ? 'acp/' : '').$url;
+ $url = $application->getPageURL() . (RequestHandler::getInstance()->isACPRequest() ? 'acp/' : '') . $url;
}
// append previously removed anchor
*/
protected static $path = '';
+ /**
+ * HTTP protocol, either 'http://' or 'https://'
+ * @var string
+ */
+ protected static $protocol = '';
+
+ /**
+ * HTTP encryption
+ * @var boolean
+ */
+ protected static $secure = null;
+
/**
* list of available routes
* @var array<wcf\system\request\Route>
throw new SystemException("Unable to build route, no available route is satisfied.");
}
+ /**
+ * Returns true, if this is a secure connection.
+ *
+ * @return true
+ */
+ public static function secureConnection() {
+ if (self::$secure === null) {
+ self::$secure = false;
+
+ if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' || $_SERVER['SERVER_PORT'] == 443) {
+ self::$secure = true;
+ }
+ }
+
+ return self::$secure;
+ }
+
+ /**
+ * Returns HTTP protocol, either 'http://' or 'https://'.
+ *
+ * @return string
+ */
+ public static function getProtocol() {
+ if (empty(self::$protocol)) {
+ self::$protocol = 'http' . (self::secureConnection() ? 's' : '') . '://';
+ }
+
+ return self::$protocol;
+ }
+
/**
* Returns protocol and domain name.
*
*/
public static function getHost() {
if (empty(self::$host)) {
- // get protocol and domain name
- $protocol = 'http://';
- if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' || $_SERVER['SERVER_PORT'] == 443) {
- $protocol = 'https://';
- }
-
- self::$host = $protocol . $_SERVER['HTTP_HOST'];
+ self::$host = self::getProtocol() . $_SERVER['HTTP_HOST'];
}
return self::$host;
<?php
namespace wcf\util;
+use wcf\system\request\RouteHandler;
use wcf\system\WCF;
/**
* Alias to php setcookie() function.
*/
public static function setCookie($name, $value = '', $expire = 0) {
- @header('Set-Cookie: '.rawurlencode(COOKIE_PREFIX.$name).'='.rawurlencode($value).($expire ? '; expires='.gmdate('D, d-M-Y H:i:s', $expire).' GMT' : '').(COOKIE_PATH ? '; path='.COOKIE_PATH : '').(COOKIE_DOMAIN ? '; domain='.COOKIE_DOMAIN : '').((isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == '443') ? '; secure' : '').'; HttpOnly', false);
+ // TODO: COOKIE_PATH is static and does not always reflect the application's domain and path
+ @header('Set-Cookie: '.rawurlencode(COOKIE_PREFIX.$name).'='.rawurlencode($value).($expire ? '; expires='.gmdate('D, d-M-Y H:i:s', $expire).' GMT' : '').(COOKIE_PATH ? '; path='.COOKIE_PATH : '').(COOKIE_DOMAIN ? '; domain='.COOKIE_DOMAIN : '').(RouteHandler::secureConnection() ? '; secure' : '').'; HttpOnly', false);
}
/**
* Outputs the compressed page content.
*/
public static function getCompressedOutput($output) {
- if (defined('LESS_FILES') && LESS_FILES) {
- // remove .css files
- $output = preg_replace('~\\@import url\("((?!burningBoard).)*.css"\) screen;~U', '', $output);
- $output = str_replace(array('<!-- LESS_FILES', 'LESS_FILES -->'), array('', ''), $output);
- }
-
$size = strlen($output);
$crc = crc32($output);
<item name="wcf.acp.option.page_description"><![CDATA[Seitenbeschreibung]]></item>
<item name="wcf.acp.option.page_title"><![CDATA[Titel der Seite]]></item>
<item name="wcf.acp.option.page_title.description"><![CDATA[Dieser Titel wird im Seitenkopf dargestellt, wenn Sie die Anzeige dieses Textes im Stileditor aktiviert haben.]]></item>
- <item name="wcf.acp.option.page_url"><![CDATA[Adresse (URL) der Seite]]></item>
- <item name="wcf.acp.option.page_url.description"><![CDATA[Adresse (URL) unter der die Seite aufzurufen ist (ohne abschließenden Slash).]]></item>
<item name="wcf.acp.option.page_urls"><![CDATA[Weitere Adressen (URLs)]]></item>
<item name="wcf.acp.option.page_urls.description"><![CDATA[Weitere Adressen (URLs) unter denen Ihre Seite erreichbar ist.]]></item>
<item name="wcf.acp.option.proxy_server_http"><![CDATA[Proxy-Server (HTTP)]]></item>
<item name="wcf.acp.option.page_description"><![CDATA[Page description]]></item>
<item name="wcf.acp.option.page_title"><![CDATA[Page title]]></item>
<item name="wcf.acp.option.page_title.description"><![CDATA[That title will show up inside the page header, if you have enabled it with the style editor.]]></item>
- <item name="wcf.acp.option.page_url"><![CDATA[Page adress (URL)]]></item>
- <item name="wcf.acp.option.page_url.description"><![CDATA[Please enter the adress (URL) of the page (without trailing slash).]]></item>
<item name="wcf.acp.option.page_urls"><![CDATA[Further adresses (URLs)]]></item>
<item name="wcf.acp.option.page_urls.description"><![CDATA[Enter further adresses (URLs) which also link to your site.]]></item>
<item name="wcf.acp.option.proxy_server_http"><![CDATA[Proxy-Server (HTTP)]]></item>