<tr class="jsPageRow">
<td class="columnIcon">
{if $page->canDisable()}
- <span class="icon icon16 icon-check{if $page->isDisabled}-empty{/if} jsToggleButton jsTooltip pointer" title="{lang}wcf.global.button.{if !$page->isDisabled}disable{else}enable{/if}{/lang}" data-object-id="{@$page->pageID}"></span>
+ <span class="icon icon16 fa-{if !$page->isDisabled}check-{/if}square-o jsToggleButton jsTooltip pointer" title="{lang}wcf.global.button.{if !$page->isDisabled}disable{else}enable{/if}{/lang}" data-object-id="{@$page->pageID}"></span>
{else}
- <span class="icon icon16 icon-check{if $page->isDisabled}-empty{/if} disabled" title="{lang}wcf.global.button.{if !$page->isDisabled}disable{else}enable{/if}{/lang}"></span>
+ <span class="icon icon16 fa-{if !$page->isDisabled}check-{/if}square-o disabled" title="{lang}wcf.global.button.{if !$page->isDisabled}disable{else}enable{/if}{/lang}"></span>
{/if}
- <a href="{link controller='PageEdit' id=$page->pageID}{/link}" title="{lang}wcf.global.button.edit{/lang}" class="jsTooltip"><span class="icon icon16 icon-pencil"></span></a>
+ <a href="{link controller='PageEdit' id=$page->pageID}{/link}" title="{lang}wcf.global.button.edit{/lang}" class="jsTooltip"><span class="icon icon16 fa-pencil"></span></a>
{if $page->canDelete()}
- <span class="icon icon16 icon-remove jsDeleteButton jsTooltip pointer" title="{lang}wcf.global.button.delete{/lang}" data-object-id="{@$page->pageID}" data-confirm-message="{lang}wcf.acp.page.delete.confirmMessage{/lang}"></span>
+ <span class="icon icon16 fa-times jsDeleteButton jsTooltip pointer" title="{lang}wcf.global.button.delete{/lang}" data-object-id="{@$page->pageID}" data-confirm-message="{lang}wcf.acp.page.delete.confirmMessage{/lang}"></span>
{else}
- <span class="icon icon16 icon-remove disabled" title="{lang}wcf.global.button.delete{/lang}"></span>
+ <span class="icon icon16 fa-times disabled" title="{lang}wcf.global.button.delete{/lang}"></span>
{/if}
{event name='rowButtons'}
</td>
<td class="columnID columnPageID">{@$page->pageID}</td>
<td class="columnTitle columnName"><a href="{link controller='PageEdit' id=$page->pageID}{/link}">{$page->displayName}</a></td>
- <td class="columnText columnCustomURL">{$page->customURL}</td>
+ <td class="columnText columnCustomURL">{$page->controllerCustomURL}</td>
<td class="columnDate columnLastUpdateTime">{@$page->lastUpdateTime|time}</td>
{event name='columns'}
<?php
namespace wcf\acp\form;
+use wcf\data\application\Application;
use wcf\data\application\ApplicationList;
use wcf\data\page\Page;
use wcf\data\page\PageAction;
use wcf\form\AbstractForm;
use wcf\system\exception\UserInputException;
use wcf\system\language\LanguageFactory;
+use wcf\system\request\RouteHandler;
use wcf\system\WCF;
use wcf\util\ArrayUtil;
use wcf\util\StringUtil;
/**
* @see \wcf\page\AbstractPage::$neededPermissions
*/
- public $neededPermissions = array('admin.content.cms.canManagePage');
+ public $neededPermissions = ['admin.content.cms.canManagePage'];
/**
* true if created page is multi-lingual
/**
* list of available applications (standalone packages)
- * @var array<\wcf\data\application\Application>
+ * @var Application[]
*/
- public $availableApplications = array();
+ public $availableApplications = [];
/**
* page custom URL
* @var array<string>
*/
- public $customURL = array();
+ public $customURL = [];
/**
* page titles
* @var array<string>
*/
- public $title = array();
+ public $title = [];
/**
* page contents
* @var array<string>
*/
- public $content = array();
+ public $content = [];
/**
* page meta descriptions
* @var array<string>
*/
- public $metaDescription = array();
+ public $metaDescription = [];
/**
* page meta keywords
* @var array<string>
*/
- public $metaKeywords = array();
+ public $metaKeywords = [];
/**
* @see \wcf\page\IPage::readParameters()
$this->validateParentPageID();
$this->validatePackageID();
+
+ $this->validateCustomUrl();
}
protected function validateDisplayName() {
}
}
+ protected function validateCustomUrl() {
+ foreach ($this->customURL as $type => $customURL) {
+ if (!empty($customURL) && !RouteHandler::isValidCustomUrl($customURL)) {
+ throw new UserInputException('customURL_' . $type, 'invalid');
+ }
+ }
+ }
+
/**
* @see \wcf\form\IForm::save()
*/
public function save() {
parent::save();
- $content = array();
+ $content = [];
if ($this->isMultilingual) {
foreach (LanguageFactory::getInstance()->getLanguages() as $language) {
- $content[$language->languageID] = array(
+ $content[$language->languageID] = [
'customURL' => (!empty($_POST['customURL'][$language->languageID]) ? $_POST['customURL'][$language->languageID] : ''),
'title' => (!empty($_POST['title'][$language->languageID]) ? $_POST['title'][$language->languageID] : ''),
'content' => (!empty($_POST['content'][$language->languageID]) ? $_POST['content'][$language->languageID] : ''),
'metaDescription' => (!empty($_POST['metaDescription'][$language->languageID]) ? $_POST['metaDescription'][$language->languageID] : ''),
'metaKeywords' => (!empty($_POST['metaKeywords'][$language->languageID]) ? $_POST['metaKeywords'][$language->languageID] : '')
- );
+ ];
}
}
else {
- $content[0] = array(
+ $content[0] = [
'customURL' => (!empty($_POST['customURL'][0]) ? $_POST['customURL'][0] : ''),
'title' => (!empty($_POST['title'][0]) ? $_POST['title'][0] : ''),
'content' => (!empty($_POST['content'][0]) ? $_POST['content'][0] : ''),
'metaDescription' => (!empty($_POST['metaDescription'][0]) ? $_POST['metaDescription'][0] : ''),
'metaKeywords' => (!empty($_POST['metaKeywords'][0]) ? $_POST['metaKeywords'][0] : '')
- );
+ ];
}
- $this->objectAction = new PageAction(array(), 'create', array('data' => array_merge($this->additionalFields, array(
+ $this->objectAction = new PageAction([], 'create', ['data' => array_merge($this->additionalFields, [
'parentPageID' => ($this->parentPageID ?: null),
'displayName' => $this->displayName,
'isDisabled' => ($this->isDisabled) ? 1 : 0,
'lastUpdateTime' => TIME_NOW,
'isMultilingual' => $this->isMultilingual,
'name' => ''
- )), 'content' => $content));
+ ]), 'content' => $content]);
$returnValues = $this->objectAction->executeAction();
// set generic page name
$pageEditor = new PageEditor($returnValues['returnValues']);
- $pageEditor->update(array(
+ $pageEditor->update([
'name' => 'com.woltlab.wcf.generic'.$pageEditor->pageID
- ));
+ ]);
// call saved event
$this->saved();
$this->parentPageID = $this->isDisabled = $this->isLandingPage = 0;
$this->packageID = 1;
$this->displayName = '';
- $this->customURL = $this->title = $this->content = $this->metaDescription = $this->metaKeywords = array();
+ $this->customURL = $this->title = $this->content = $this->metaDescription = $this->metaKeywords = [];
}
/**
$pageNodeList = new PageNodeTree();
- WCF::getTPL()->assign(array(
+ WCF::getTPL()->assign([
'action' => 'add',
'parentPageID' => $this->parentPageID,
'displayName' => $this->displayName,
'availableApplications' => $this->availableApplications,
'availableLanguages' => LanguageFactory::getInstance()->getLanguages(),
'pageNodeList' => $pageNodeList->getNodeList()
- ));
+ ]);
}
}
WCF::getDB()->beginTransaction();
foreach ($items as $item) {
$statement->execute([
- $item['attributes']['name'],
+ $item['attributes']['identifier'],
$this->installation->getPackageID()
]);
}
$content = [];
foreach ($data['elements']['content'] as $language => $contentData) {
if (!RouteHandler::isValidCustomUrl($contentData['customurl'])) {
- throw new SystemException("Invalid custom url for page content '" . $language . "', page identifier '" . $data['attributes']['name'] . "'");
+ throw new SystemException("Invalid custom url for page content '" . $language . "', page identifier '" . $data['attributes']['identifier'] . "'");
}
$content[$language] = [
$statement->execute([$data['elements']['parent']]);
$row = $statement->fetchSingleRow();
if ($row === false) {
- throw new SystemException("Unknown parent page '" . $data['elements']['parent'] . "' for page identifier '" . $data['attributes']['name'] . "'");
+ throw new SystemException("Unknown parent page '" . $data['elements']['parent'] . "' for page identifier '" . $data['attributes']['identifier'] . "'");
}
$parentPageID = $row['pageID'];
$customUrl = ($isStatic || empty($data['elements']['customurl'])) ? '' : $data['elements']['customurl'];
if ($customUrl && !RouteHandler::isValidCustomUrl($customUrl)) {
- throw new SystemException("Invalid custom url for page identifier '" . $data['attributes']['name'] . "'");
+ throw new SystemException("Invalid custom url for page identifier '" . $data['attributes']['identifier'] . "'");
}
return [
'controller' => ($isStatic) ? '' : $data['elements']['controller'],
'controllerCustomURL' => $customUrl,
'displayName' => $displayName,
- 'name' => $data['attributes']['name'],
+ 'identifier' => $data['attributes']['identifier'],
+ 'isMultilingual' => ($isStatic) ? 1 : 0,
+ 'lastUpdateTime' => TIME_NOW,
+ 'originIsSystem' => 1,
'parentPageID' => $parentPageID
];
}
WHERE name = ?
AND packageID = ?";
$parameters = array(
- $data['name'],
+ $data['identifier'],
$this->installation->getPackageID()
);