</div>
<?php
$first = false;
- } while (($e = $this->getPrevious()));
+ } while ($e = $this->getPrevious());
?>
</div>
</body>
}
if(($header['size'] % 512) != 0) {
$buffer = $this->file->read(512);
- $content .= substr($buffer, 0, ($header['size'] % 512));
+ $content .= substr($buffer, 0, $header['size'] % 512);
}
return $content;
}
if (($header['size'] % 512) != 0) {
$content = $this->file->read(512);
- $targetFile->write($content, ($header['size'] % 512));
+ $targetFile->write($content, $header['size'] % 512);
}
$targetFile->close();
$i++;
}
- $this->file->seek($this->file->tell() + (512 * ceil(($header['size'] / 512))));
+ $this->file->seek($this->file->tell() + (512 * ceil($header['size'] / 512)));
}
}
*/
public function __construct($filename, $mode = 'wb') {
if (self::$gzopen64 === null) {
- self::$gzopen64 = (function_exists('gzopen64'));
+ self::$gzopen64 = function_exists('gzopen64');
}
$this->filename = $filename;
// build return values
$returnValues = [
'className' => $this->className,
- 'loopCount' => ($this->loopCount + 1),
+ 'loopCount' => $this->loopCount + 1,
'parameters' => $parameters,
'proceedURL' => $proceedURL,
'progress' => $progress
if ($this->isMultilingual) {
foreach (LanguageFactory::getInstance()->getLanguages() as $language) {
$content[$language->languageID] = [
- 'title' => (!empty($this->title[$language->languageID]) ? $this->title[$language->languageID] : ''),
- 'tags' => (!empty($this->tags[$language->languageID]) ? $this->tags[$language->languageID] : []),
- 'teaser' => (!empty($this->teaser[$language->languageID]) ? $this->teaser[$language->languageID] : ''),
- 'content' => (!empty($this->content[$language->languageID]) ? $this->content[$language->languageID] : ''),
- 'htmlInputProcessor' => (isset($this->htmlInputProcessors[$language->languageID]) ? $this->htmlInputProcessors[$language->languageID] : null),
- 'imageID' => (!empty($this->imageID[$language->languageID]) ? $this->imageID[$language->languageID] : null)
+ 'title' => !empty($this->title[$language->languageID]) ? $this->title[$language->languageID] : '',
+ 'tags' => !empty($this->tags[$language->languageID]) ? $this->tags[$language->languageID] : [],
+ 'teaser' => !empty($this->teaser[$language->languageID]) ? $this->teaser[$language->languageID] : '',
+ 'content' => !empty($this->content[$language->languageID]) ? $this->content[$language->languageID] : '',
+ 'htmlInputProcessor' => isset($this->htmlInputProcessors[$language->languageID]) ? $this->htmlInputProcessors[$language->languageID] : null,
+ 'imageID' => !empty($this->imageID[$language->languageID]) ? $this->imageID[$language->languageID] : null
];
}
}
else {
$content[0] = [
- 'title' => (!empty($this->title[0]) ? $this->title[0] : ''),
- 'tags' => (!empty($this->tags[0]) ? $this->tags[0] : []),
- 'teaser' => (!empty($this->teaser[0]) ? $this->teaser[0] : ''),
- 'content' => (!empty($this->content[0]) ? $this->content[0] : ''),
- 'htmlInputProcessor' => (isset($this->htmlInputProcessors[0]) ? $this->htmlInputProcessors[0] : null),
- 'imageID' => (!empty($this->imageID[0]) ? $this->imageID[0] : null)
+ 'title' => !empty($this->title[0]) ? $this->title[0] : '',
+ 'tags' => !empty($this->tags[0]) ? $this->tags[0] : [],
+ 'teaser' => !empty($this->teaser[0]) ? $this->teaser[0] : '',
+ 'content' => !empty($this->content[0]) ? $this->content[0] : '',
+ 'htmlInputProcessor' => isset($this->htmlInputProcessors[0]) ? $this->htmlInputProcessors[0] : null,
+ 'imageID' => !empty($this->imageID[0]) ? $this->imageID[0] : null
];
}
'time' => $this->timeObj->getTimestamp(),
'categoryID' => $this->categoryID,
'publicationStatus' => $this->publicationStatus,
- 'publicationDate' => ($this->publicationStatus == Article::DELAYED_PUBLICATION ? $this->publicationDateObj->getTimestamp() : 0),
+ 'publicationDate' => $this->publicationStatus == Article::DELAYED_PUBLICATION ? $this->publicationDateObj->getTimestamp() : 0,
'enableComments' => $this->enableComments,
'userID' => $this->author->userID,
'username' => $this->author->username,
if ($this->isMultilingual) {
foreach (LanguageFactory::getInstance()->getLanguages() as $language) {
$content[$language->languageID] = [
- 'title' => (!empty($this->title[$language->languageID]) ? $this->title[$language->languageID] : ''),
- 'tags' => (!empty($this->tags[$language->languageID]) ? $this->tags[$language->languageID] : []),
- 'teaser' => (!empty($this->teaser[$language->languageID]) ? $this->teaser[$language->languageID] : ''),
- 'content' => (!empty($this->content[$language->languageID]) ? $this->content[$language->languageID] : ''),
- 'htmlInputProcessor' => (isset($this->htmlInputProcessors[$language->languageID]) ? $this->htmlInputProcessors[$language->languageID] : null),
- 'imageID' => (!empty($this->imageID[$language->languageID]) ? $this->imageID[$language->languageID] : null)
+ 'title' => !empty($this->title[$language->languageID]) ? $this->title[$language->languageID] : '',
+ 'tags' => !empty($this->tags[$language->languageID]) ? $this->tags[$language->languageID] : [],
+ 'teaser' => !empty($this->teaser[$language->languageID]) ? $this->teaser[$language->languageID] : '',
+ 'content' => !empty($this->content[$language->languageID]) ? $this->content[$language->languageID] : '',
+ 'htmlInputProcessor' => isset($this->htmlInputProcessors[$language->languageID]) ? $this->htmlInputProcessors[$language->languageID] : null,
+ 'imageID' => !empty($this->imageID[$language->languageID]) ? $this->imageID[$language->languageID] : null
];
}
}
else {
$content[0] = [
- 'title' => (!empty($this->title[0]) ? $this->title[0] : ''),
- 'tags' => (!empty($this->tags[0]) ? $this->tags[0] : []),
- 'teaser' => (!empty($this->teaser[0]) ? $this->teaser[0] : ''),
- 'content' => (!empty($this->content[0]) ? $this->content[0] : ''),
- 'htmlInputProcessor' => (isset($this->htmlInputProcessors[0]) ? $this->htmlInputProcessors[0] : null),
- 'imageID' => (!empty($this->imageID[0]) ? $this->imageID[0] : null)
+ 'title' => !empty($this->title[0]) ? $this->title[0] : '',
+ 'tags' => !empty($this->tags[0]) ? $this->tags[0] : [],
+ 'teaser' => !empty($this->teaser[0]) ? $this->teaser[0] : '',
+ 'content' => !empty($this->content[0]) ? $this->content[0] : '',
+ 'htmlInputProcessor' => isset($this->htmlInputProcessors[0]) ? $this->htmlInputProcessors[0] : null,
+ 'imageID' => !empty($this->imageID[0]) ? $this->imageID[0] : null
];
}
$data = [
'categoryID' => $this->categoryID,
'publicationStatus' => $this->publicationStatus,
- 'publicationDate' => ($this->publicationStatus == Article::DELAYED_PUBLICATION ? $this->publicationDateObj->getTimestamp() : 0),
+ 'publicationDate' => $this->publicationStatus == Article::DELAYED_PUBLICATION ? $this->publicationDateObj->getTimestamp() : 0,
'enableComments' => $this->enableComments,
'userID' => $this->author->userID,
'username' => $this->author->username,
$this->tags[$languageID] = TagEngine::getInstance()->getObjectTags(
'com.woltlab.wcf.article',
$content->articleContentID,
- [($languageID ?: LanguageFactory::getInstance()->getDefaultLanguageID())]
+ [$languageID ?: LanguageFactory::getInstance()->getDefaultLanguageID()]
);
}
}
'className' => $this->className,
'htmlOpen' => $this->htmlOpen,
'htmlClose' => $this->htmlClose,
- 'isBlockElement' => ($this->isBlockElement ? 1 : 0),
- 'isSourceCode' => ($this->isSourceCode ? 1 : 0),
+ 'isBlockElement' => $this->isBlockElement ? 1 : 0,
+ 'isSourceCode' => $this->isSourceCode ? 1 : 0,
'packageID' => 1,
- 'showButton' => ($this->showButton ? 1 : 0),
+ 'showButton' => $this->showButton ? 1 : 0,
'wysiwygIcon' => $this->wysiwygIcon
])]);
$returnValues = $this->objectAction->executeAction();
'className' => $this->className,
'htmlClose' => $this->htmlClose,
'htmlOpen' => $this->htmlOpen,
- 'isBlockElement' => ($this->isBlockElement ? 1 : 0),
- 'isSourceCode' => ($this->isSourceCode ? 1 : 0),
- 'showButton' => ($this->showButton ? 1 : 0),
+ 'isBlockElement' => $this->isBlockElement ? 1 : 0,
+ 'isSourceCode' => $this->isSourceCode ? 1 : 0,
+ 'showButton' => $this->showButton ? 1 : 0,
'wysiwygIcon' => $this->wysiwygIcon
])]);
$this->objectAction->executeAction();
WCF::getTPL()->assign([
'bbcode' => $this->bbcode,
'action' => 'edit',
- 'nativeBBCode' => (in_array($this->bbcode->bbcodeTag, self::$nativeBBCodes))
+ 'nativeBBCode' => in_array($this->bbcode->bbcodeTag, self::$nativeBBCodes)
]);
}
}
if ($this->boxType == 'system' || $this->isMultilingual) {
foreach (LanguageFactory::getInstance()->getLanguages() as $language) {
$content[$language->languageID] = [
- 'title' => (!empty($this->title[$language->languageID]) ? $this->title[$language->languageID] : ''),
- 'content' => (!empty($this->content[$language->languageID]) ? $this->content[$language->languageID] : ''),
- 'htmlInputProcessor' => (isset($this->htmlInputProcessors[$language->languageID]) ? $this->htmlInputProcessors[$language->languageID] : null),
- 'imageID' => (!empty($this->imageID[$language->languageID]) ? $this->imageID[$language->languageID] : null)
+ 'title' => !empty($this->title[$language->languageID]) ? $this->title[$language->languageID] : '',
+ 'content' => !empty($this->content[$language->languageID]) ? $this->content[$language->languageID] : '',
+ 'htmlInputProcessor' => isset($this->htmlInputProcessors[$language->languageID]) ? $this->htmlInputProcessors[$language->languageID] : null,
+ 'imageID' => !empty($this->imageID[$language->languageID]) ? $this->imageID[$language->languageID] : null
];
}
}
else {
$content[0] = [
- 'title' => (!empty($this->title[0]) ? $this->title[0] : ''),
- 'content' => (!empty($this->content[0]) ? $this->content[0] : ''),
- 'htmlInputProcessor' => (isset($this->htmlInputProcessors[0]) ? $this->htmlInputProcessors[0] : null),
- 'imageID' => (!empty($this->imageID[0]) ? $this->imageID[0] : null)
+ 'title' => !empty($this->title[0]) ? $this->title[0] : '',
+ 'content' => !empty($this->content[0]) ? $this->content[0] : '',
+ 'htmlInputProcessor' => isset($this->htmlInputProcessors[0]) ? $this->htmlInputProcessors[0] : null,
+ 'imageID' => !empty($this->imageID[0]) ? $this->imageID[0] : null
];
}
'cssClassName' => $this->cssClassName,
'showHeader' => $this->showHeader,
'linkPageID' => $this->linkPageID,
- 'linkPageObjectID' => ($this->linkPageObjectID ?: 0),
+ 'linkPageObjectID' => $this->linkPageObjectID ?: 0,
'externalURL' => $this->externalURL,
'identifier' => ''
];
if ($this->boxType == 'system' || $this->isMultilingual) {
foreach (LanguageFactory::getInstance()->getLanguages() as $language) {
$content[$language->languageID] = [
- 'title' => (!empty($this->title[$language->languageID]) ? $this->title[$language->languageID] : ''),
- 'content' => (!empty($this->content[$language->languageID]) ? $this->content[$language->languageID] : ''),
- 'htmlInputProcessor' => (isset($this->htmlInputProcessors[$language->languageID]) ? $this->htmlInputProcessors[$language->languageID] : null),
- 'imageID' => (!empty($this->imageID[$language->languageID]) ? $this->imageID[$language->languageID] : null)
+ 'title' => !empty($this->title[$language->languageID]) ? $this->title[$language->languageID] : '',
+ 'content' => !empty($this->content[$language->languageID]) ? $this->content[$language->languageID] : '',
+ 'htmlInputProcessor' => isset($this->htmlInputProcessors[$language->languageID]) ? $this->htmlInputProcessors[$language->languageID] : null,
+ 'imageID' => !empty($this->imageID[$language->languageID]) ? $this->imageID[$language->languageID] : null
];
}
}
else {
$content[0] = [
- 'title' => (!empty($this->title[0]) ? $this->title[0] : ''),
- 'content' => (!empty($this->content[0]) ? $this->content[0] : ''),
- 'htmlInputProcessor' => (isset($this->htmlInputProcessors[0]) ? $this->htmlInputProcessors[0] : null),
- 'imageID' => (!empty($this->imageID[0]) ? $this->imageID[0] : null)
+ 'title' => !empty($this->title[0]) ? $this->title[0] : '',
+ 'content' => !empty($this->content[0]) ? $this->content[0] : '',
+ 'htmlInputProcessor' => isset($this->htmlInputProcessors[0]) ? $this->htmlInputProcessors[0] : null,
+ 'imageID' => !empty($this->imageID[0]) ? $this->imageID[0] : null
];
}
'cssClassName' => $this->cssClassName,
'showHeader' => $this->showHeader,
'linkPageID' => $this->linkPageID,
- 'linkPageObjectID' => ($this->linkPageObjectID ?: 0),
+ 'linkPageObjectID' => $this->linkPageObjectID ?: 0,
'externalURL' => $this->externalURL
];
if ($this->boxControllerID) {
// save label
$this->objectAction = new LabelAction([], 'create', ['data' => array_merge($this->additionalFields, [
'label' => $this->label,
- 'cssClassName' => ($this->cssClassName == 'custom' ? $this->customCssClassName : $this->cssClassName),
+ 'cssClassName' => $this->cssClassName == 'custom' ? $this->customCssClassName : $this->cssClassName,
'groupID' => $this->groupID,
'showOrder' => $this->showOrder
])]);
// assigned to them, but the new group is not allowed at their current position
$this->objectAction = new LabelAction([$this->labelID], 'update', ['data' => array_merge($this->additionalFields, [
'label' => $this->label,
- 'cssClassName' => ($this->cssClassName == 'custom' ? $this->customCssClassName : $this->cssClassName),
+ 'cssClassName' => $this->cssClassName == 'custom' ? $this->customCssClassName : $this->cssClassName,
'showOrder' => $this->showOrder
])]);
$this->objectAction->executeAction();
// save label
$this->objectAction = new LabelGroupAction([], 'create', ['data' => array_merge($this->additionalFields, [
- 'forceSelection' => ($this->forceSelection ? 1 : 0),
+ 'forceSelection' => $this->forceSelection ? 1 : 0,
'groupName' => $this->groupName,
'groupDescription' => $this->groupDescription,
'showOrder' => $this->showOrder
foreach ($this->labelObjectTypeContainers as $objectTypeID => $container) {
if ($container->isBooleanOption()) {
- $optionValue = (isset($data[$objectTypeID])) ? 1 : 0;
+ $optionValue = isset($data[$objectTypeID]) ? 1 : 0;
$container->setOptionValue($optionValue);
}
else {
- $hasData = (isset($data[$objectTypeID]));
+ $hasData = isset($data[$objectTypeID]);
foreach ($container as $object) {
if (!$hasData) {
$object->setOptionValue(0);
}
else {
- $optionValue = (in_array($object->getObjectID(), $data[$objectTypeID])) ? 1 : 0;
+ $optionValue = in_array($object->getObjectID(), $data[$objectTypeID]) ? 1 : 0;
$object->setOptionValue($optionValue);
}
}
// update label
$this->objectAction = new LabelGroupAction([$this->groupID], 'update', ['data' => array_merge($this->additionalFields, [
- 'forceSelection' => ($this->forceSelection ? 1 : 0),
+ 'forceSelection' => $this->forceSelection ? 1 : 0,
'groupName' => $this->groupName,
'groupDescription' => $this->groupDescription,
'showOrder' => $this->showOrder
}
// prevent NULL values which confuse isset()
- $data[$row['objectTypeID']][] = ($row['objectID']) ?: 0;
+ $data[$row['objectTypeID']][] = $row['objectID'] ?: 0;
}
}
$action = new UserAuthenticationFailureAction([], 'create', [
'data' => [
- 'environment' => (RequestHandler::getInstance()->isACPRequest() ? 'admin' : 'user'),
- 'userID' => ($user->userID ?: null),
+ 'environment' => RequestHandler::getInstance()->isACPRequest() ? 'admin' : 'user',
+ 'userID' => $user->userID ?: null,
'username' => $this->username,
'time' => TIME_NOW,
'ipAddress' => UserUtil::getIpAddress(),
'name' => $this->title,
'boxType' => 'menu',
'position' => $this->position,
- 'visibleEverywhere' => ($this->visibleEverywhere) ? 1 : 0,
- 'showHeader' => ($this->showHeader) ? 1 : 0,
+ 'visibleEverywhere' => $this->visibleEverywhere ? 1 : 0,
+ 'showHeader' => $this->showHeader ? 1 : 0,
'showOrder' => $this->showOrder,
'cssClassName' => $this->cssClassName,
'packageID' => 1
if ($this->menu->identifier != 'com.woltlab.wcf.MainMenu') {
$boxAction = new BoxAction([$this->menu->getBox()->boxID], 'update', ['data' => array_merge($this->additionalFields, [
'position' => $this->position,
- 'visibleEverywhere' => ($this->visibleEverywhere) ? 1 : 0,
- 'showHeader' => ($this->showHeader) ? 1 : 0,
+ 'visibleEverywhere' => $this->visibleEverywhere ? 1 : 0,
+ 'showHeader' => $this->showHeader ? 1 : 0,
'showOrder' => $this->showOrder,
'cssClassName' => $this->cssClassName
]), 'pageIDs' => $this->pageIDs]);
parent::save();
$this->objectAction = new MenuItemAction([], 'create', ['data' => array_merge($this->additionalFields, [
- 'isDisabled' => ($this->isDisabled) ? 1 : 0,
+ 'isDisabled' => $this->isDisabled ? 1 : 0,
'title' => $this->title,
'pageID' => $this->pageID,
- 'pageObjectID' => ($this->pageObjectID ?: 0),
+ 'pageObjectID' => $this->pageObjectID ?: 0,
'externalURL' => $this->externalURL,
'menuID' => $this->menuID,
'parentItemID' => $this->parentItemID,
// update menu
$this->objectAction = new MenuItemAction([$this->itemID], 'update', ['data' => array_merge($this->additionalFields, [
- 'isDisabled' => ($this->isDisabled) ? 1 : 0,
+ 'isDisabled' => $this->isDisabled ? 1 : 0,
'title' => $this->title,
'pageID' => $this->pageID,
- 'pageObjectID' => ($this->pageObjectID ?: 0),
+ 'pageObjectID' => $this->pageObjectID ?: 0,
'externalURL' => $this->externalURL,
'parentItemID' => $this->parentItemID,
'showOrder' => $this->showOrder
$processNo = PackageInstallationQueue::getNewProcessNo();
// obey foreign key
- $packageID = ($this->package) ? $this->package->packageID : null;
+ $packageID = $this->package ? $this->package->packageID : null;
$archive = null;
if ($this->stylePackageImportLocation) {
'packageName' => PackageValidationManager::getInstance()->getPackageValidationArchive()->getArchive()->getLocalizedPackageInfo('packageName'),
'packageID' => $packageID,
'archive' => $archive,
- 'action' => ($this->package != null ? 'update' : 'install'),
- 'isApplication' => (!$isApplication ? '0' : '1')
+ 'action' => $this->package != null ? 'update' : 'install',
+ 'isApplication' => !$isApplication ? '0' : '1'
]);
$this->saved();
if ($this->isMultilingual) {
foreach (LanguageFactory::getInstance()->getLanguages() as $language) {
$content[$language->languageID] = [
- 'customURL' => (!empty($this->customURL[$language->languageID]) ? $this->customURL[$language->languageID] : ''),
- 'title' => (!empty($this->title[$language->languageID]) ? $this->title[$language->languageID] : ''),
- 'content' => (!empty($this->content[$language->languageID]) ? $this->content[$language->languageID] : ''),
- 'htmlInputProcessor' => (isset($this->htmlInputProcessors[$language->languageID]) ? $this->htmlInputProcessors[$language->languageID] : null),
- 'metaDescription' => (!empty($this->metaDescription[$language->languageID]) ? $this->metaDescription[$language->languageID] : ''),
- 'metaKeywords' => (!empty($this->metaKeywords[$language->languageID]) ? $this->metaKeywords[$language->languageID] : '')
+ 'customURL' => !empty($this->customURL[$language->languageID]) ? $this->customURL[$language->languageID] : '',
+ 'title' => !empty($this->title[$language->languageID]) ? $this->title[$language->languageID] : '',
+ 'content' => !empty($this->content[$language->languageID]) ? $this->content[$language->languageID] : '',
+ 'htmlInputProcessor' => isset($this->htmlInputProcessors[$language->languageID]) ? $this->htmlInputProcessors[$language->languageID] : null,
+ 'metaDescription' => !empty($this->metaDescription[$language->languageID]) ? $this->metaDescription[$language->languageID] : '',
+ 'metaKeywords' => !empty($this->metaKeywords[$language->languageID]) ? $this->metaKeywords[$language->languageID] : ''
];
}
}
else {
$content[0] = [
- 'customURL' => (!empty($this->customURL[0]) ? $this->customURL[0] : ''),
- 'title' => (!empty($this->title[0]) ? $this->title[0] : ''),
- 'content' => (!empty($this->content[0]) ? $this->content[0] : ''),
- 'htmlInputProcessor' => (isset($this->htmlInputProcessors[0]) ? $this->htmlInputProcessors[0] : null),
- 'metaDescription' => (!empty($this->metaDescription[0]) ? $this->metaDescription[0] : ''),
- 'metaKeywords' => (!empty($this->metaKeywords[0]) ? $this->metaKeywords[0] : '')
+ 'customURL' => !empty($this->customURL[0]) ? $this->customURL[0] : '',
+ 'title' => !empty($this->title[0]) ? $this->title[0] : '',
+ 'content' => !empty($this->content[0]) ? $this->content[0] : '',
+ 'htmlInputProcessor' => isset($this->htmlInputProcessors[0]) ? $this->htmlInputProcessors[0] : null,
+ 'metaDescription' => !empty($this->metaDescription[0]) ? $this->metaDescription[0] : '',
+ 'metaKeywords' => !empty($this->metaKeywords[0]) ? $this->metaKeywords[0] : ''
];
}
$this->objectAction = new PageAction([], 'create', ['data' => array_merge($this->additionalFields, [
- 'parentPageID' => ($this->parentPageID ?: null),
+ 'parentPageID' => $this->parentPageID ?: null,
'pageType' => $this->pageType,
'name' => $this->name,
- 'isDisabled' => ($this->isDisabled) ? 1 : 0,
+ 'isDisabled' => $this->isDisabled ? 1 : 0,
'isLandingPage' => 0,
'applicationPackageID' => $this->applicationPackageID,
'lastUpdateTime' => TIME_NOW,
$data = [
'name' => $this->name,
- 'isDisabled' => ($this->isDisabled) ? 1 : 0,
+ 'isDisabled' => $this->isDisabled ? 1 : 0,
'lastUpdateTime' => TIME_NOW,
- 'parentPageID' => ($this->parentPageID ?: null),
+ 'parentPageID' => $this->parentPageID ?: null,
'applicationPackageID' => $this->applicationPackageID
];
foreach (LanguageFactory::getInstance()->getLanguages() as $language) {
$content[$language->languageID] = [
'customURL' => '',
- 'title' => (!empty($this->title[$language->languageID]) ? $this->title[$language->languageID] : ''),
+ 'title' => !empty($this->title[$language->languageID]) ? $this->title[$language->languageID] : '',
'content' => '',
'metaDescription' => '',
'metaKeywords' => ''
if ($this->page->isMultilingual) {
foreach (LanguageFactory::getInstance()->getLanguages() as $language) {
$content[$language->languageID] = [
- 'customURL' => (!empty($this->customURL[$language->languageID]) ? $this->customURL[$language->languageID] : ''),
- 'title' => (!empty($this->title[$language->languageID]) ? $this->title[$language->languageID] : ''),
- 'content' => (!empty($this->content[$language->languageID]) ? $this->content[$language->languageID] : ''),
- 'htmlInputProcessor' => (isset($this->htmlInputProcessors[$language->languageID]) ? $this->htmlInputProcessors[$language->languageID] : null),
- 'metaDescription' => (!empty($this->metaDescription[$language->languageID]) ? $this->metaDescription[$language->languageID] : ''),
- 'metaKeywords' => (!empty($this->metaKeywords[$language->languageID]) ? $this->metaKeywords[$language->languageID] : '')
+ 'customURL' => !empty($this->customURL[$language->languageID]) ? $this->customURL[$language->languageID] : '',
+ 'title' => !empty($this->title[$language->languageID]) ? $this->title[$language->languageID] : '',
+ 'content' => !empty($this->content[$language->languageID]) ? $this->content[$language->languageID] : '',
+ 'htmlInputProcessor' => isset($this->htmlInputProcessors[$language->languageID]) ? $this->htmlInputProcessors[$language->languageID] : null,
+ 'metaDescription' => !empty($this->metaDescription[$language->languageID]) ? $this->metaDescription[$language->languageID] : '',
+ 'metaKeywords' => !empty($this->metaKeywords[$language->languageID]) ? $this->metaKeywords[$language->languageID] : ''
];
}
}
else {
$content[0] = [
- 'customURL' => (!empty($this->customURL[0]) ? $this->customURL[0] : ''),
- 'title' => (!empty($this->title[0]) ? $this->title[0] : ''),
- 'content' => (!empty($this->content[0]) ? $this->content[0] : ''),
- 'htmlInputProcessor' => (isset($this->htmlInputProcessors[0]) ? $this->htmlInputProcessors[0] : null),
- 'metaDescription' => (!empty($this->metaDescription[0]) ? $this->metaDescription[0] : ''),
- 'metaKeywords' => (!empty($this->metaKeywords[0]) ? $this->metaKeywords[0] : '')
+ 'customURL' => !empty($this->customURL[0]) ? $this->customURL[0] : '',
+ 'title' => !empty($this->title[0]) ? $this->title[0] : '',
+ 'content' => !empty($this->content[0]) ? $this->content[0] : '',
+ 'htmlInputProcessor' => isset($this->htmlInputProcessors[0]) ? $this->htmlInputProcessors[0] : null,
+ 'metaDescription' => !empty($this->metaDescription[0]) ? $this->metaDescription[0] : '',
+ 'metaKeywords' => !empty($this->metaKeywords[0]) ? $this->metaKeywords[0] : ''
];
}
public function assignVariables() {
parent::assignVariables();
- $useRequestData = (empty($_POST)) ? false : true;
+ $useRequestData = empty($_POST) ? false : true;
I18nHandler::getInstance()->assignVariables($useRequestData);
WCF::getTPL()->assign([
$action = new UserAuthenticationFailureAction([], 'create', [
'data' => [
'environment' => 'admin',
- 'userID' => ($this->user !== null ? $this->user->userID : null),
+ 'userID' => $this->user !== null ? $this->user->userID : null,
'username' => $this->username,
'time' => TIME_NOW,
'ipAddress' => UserUtil::getIpAddress(),
foreach ($this->specialVariables as $variableName) {
if (isset($_POST[$variableName])) $this->variables[$variableName] = StringUtil::trim($_POST[$variableName]);
}
- $this->variables['useFluidLayout'] = (isset($_POST['useFluidLayout'])) ? 1 : 0;
+ $this->variables['useFluidLayout'] = isset($_POST['useFluidLayout']) ? 1 : 0;
// style data
if (isset($_POST['authorName'])) $this->authorName = StringUtil::trim($_POST['authorName']);
WCF::getTPL()->assign([
'tagObj' => $this->tagObj,
'action' => 'edit',
- 'synonym' => (($this->tagObj !== null && $this->tagObj->synonymFor) ? new Tag($this->tagObj->synonymFor) : null)
+ 'synonym' => ($this->tagObj !== null && $this->tagObj->synonymFor) ? new Tag($this->tagObj->synonymFor) : null
]);
}
}
$this->objectAction = new TemplateGroupAction([], 'create', ['data' => array_merge($this->additionalFields, [
'templateGroupName' => $this->templateGroupName,
'templateGroupFolderName' => $this->templateGroupFolderName,
- 'parentTemplateGroupID' => ($this->parentTemplateGroupID ?: null)
+ 'parentTemplateGroupID' => $this->parentTemplateGroupID ?: null
])]);
$this->objectAction->executeAction();
$this->saved();
$this->objectAction = new TemplateGroupAction([$this->templateGroup], 'update', ['data' => array_merge($this->additionalFields, [
'templateGroupName' => $this->templateGroupName,
'templateGroupFolderName' => $this->templateGroupFolderName,
- 'parentTemplateGroupID' => ($this->parentTemplateGroupID ?: null)
+ 'parentTemplateGroupID' => $this->parentTemplateGroupID ?: null
])]);
$this->objectAction->executeAction();
$this->saved();
// create form elements for each group
foreach ($this->groups as $group) {
- $optionValue = (isset($this->values[$group->groupID])) ? $this->values[$group->groupID] : '';
+ $optionValue = isset($this->values[$group->groupID]) ? $this->values[$group->groupID] : '';
$this->formElements[$group->groupID] = $this->optionType->getFormElement($this->userGroupOption, $optionValue);
}
}
'editable' => $this->editable,
'visible' => $this->visible,
'packageID' => 1,
- 'additionalData' => ($this->optionType == 'select' ? serialize(['allowEmptyValue' => true]) : '')
+ 'additionalData' => $this->optionType == 'select' ? serialize(['allowEmptyValue' => true]) : ''
])]);
$this->objectAction->executeAction();
// save label
$this->objectAction = new UserRankAction([], 'create', ['data' => array_merge($this->additionalFields, [
'rankTitle' => $this->rankTitle,
- 'cssClassName' => ($this->cssClassName == 'custom' ? $this->customCssClassName : $this->cssClassName),
+ 'cssClassName' => $this->cssClassName == 'custom' ? $this->customCssClassName : $this->cssClassName,
'groupID' => $this->groupID,
'requiredPoints' => $this->requiredPoints,
'rankImage' => $this->rankImage,
// update label
$this->objectAction = new UserRankAction([$this->rank], 'update', ['data' => array_merge($this->additionalFields, [
'rankTitle' => $this->rankTitle,
- 'cssClassName' => ($this->cssClassName == 'custom' ? $this->customCssClassName : $this->cssClassName),
+ 'cssClassName' => $this->cssClassName == 'custom' ? $this->customCssClassName : $this->cssClassName,
'groupID' => $this->groupID,
'requiredPoints' => $this->requiredPoints,
'rankImage' => $this->rankImage,
$this->server = [
'os' => PHP_OS,
- 'webserver' => (isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : ''),
+ 'webserver' => isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : '',
'mySQLVersion' => WCF::getDB()->getVersion(),
'load' => ''
];
}
$languageCode = WCF::getLanguage()->languageCode;
- $packageName = (isset($product['packageName'][$languageCode])) ? $product['packageName'][$languageCode] : $product['packageName']['en'];
+ $packageName = isset($product['packageName'][$languageCode]) ? $product['packageName'][$languageCode] : $product['packageName']['en'];
$this->productData[$wcfMajorRelease][$packageUpdateID] = [
'author' => $product['author'],
'available' => $product['lastVersion'],
'installed' => ''
],
- 'status' => (isset($this->updateServers[$wcfMajorRelease]) ? 'install' : 'unavailable')
+ 'status' => isset($this->updateServers[$wcfMajorRelease]) ? 'install' : 'unavailable'
];
$package = PackageCache::getInstance()->getPackageByIdentifier($product['package']);
$templateList->getConditionBuilder()->add('(template.templateGroupID IN(?) OR template.templateGroupID IS NULL)', [array_keys($this->templateGroupHierarchy)]);
$templateList->readObjects();
foreach ($templateList as $template) {
- $this->templateGroupHierarchy[($template->templateGroupID ?: 0)]['hasTemplate'] = $template->templateID;
+ $this->templateGroupHierarchy[$template->templateGroupID ?: 0]['hasTemplate'] = $template->templateID;
}
// a valid parent template was given, calculate diff
* @return string
*/
protected function getQuotes() {
- $supportPaste = (isset($_POST['supportPaste'])) ? (bool)$_POST['supportPaste'] : false;
+ $supportPaste = isset($_POST['supportPaste']) ? (bool)$_POST['supportPaste'] : false;
return MessageQuoteManager::getInstance()->getQuotes($supportPaste);
}
$this->getVote($returnValues);
}
- $returnValues['canVote'] = ($this->poll->isChangeable) ? 1 : 0;
+ $returnValues['canVote'] = $this->poll->isChangeable ? 1 : 0;
}
}
return $item;
}, sanitizeStacktrace($e, true))))."\n";
}
- while (($e = $e->getPrevious()));
+ while ($e = $e->getPrevious());
// calculate Exception-ID
$exceptionID = sha1($message);
</div>
<?php
$first = false;
- } while (($e = $e->getPrevious()));
+ } while ($e = $e->getPrevious());
?>
<?php } ?>
</div>
* @return array
*/
public function loadAll() {
- $objectIDs = ($this->parameters['objectID']) ? [$this->parameters['objectID']] : [];
+ $objectIDs = $this->parameters['objectID'] ? [$this->parameters['objectID']] : [];
$permissions = ACLHandler::getInstance()->getPermissions($this->parameters['objectTypeID'], $objectIDs, $this->parameters['categoryName'], true);
return $permissions;
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute([$this->articleID]);
while ($row = $statement->fetchArray()) {
- $this->articleContents[($row['languageID'] ?: 0)] = new ArticleContent(null, $row);
+ $this->articleContents[$row['languageID'] ?: 0] = new ArticleContent(null, $row);
}
}
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute([$this->articleID]);
while ($row = $statement->fetchArray()) {
- $this->languageLinks[($row['languageID'] ?: 0)] = new ArticleContent(null, $row);
+ $this->languageLinks[$row['languageID'] ?: 0] = new ArticleContent(null, $row);
}
}
/** @var ArticleContent $articleContent */
$articleContent = ArticleContentEditor::create([
'articleID' => $article->articleID,
- 'languageID' => ($languageID ?: null),
+ 'languageID' => $languageID ?: null,
'title' => $content['title'],
'teaser' => $content['teaser'],
'content' => $content['content'],
/** @var ArticleContent $articleContent */
$articleContent = ArticleContentEditor::create([
'articleID' => $article->articleID,
- 'languageID' => ($languageID ?: null),
+ 'languageID' => $languageID ?: null,
'title' => $content['title'],
'teaser' => $content['teaser'],
'content' => $content['content'],
/** @noinspection PhpUndefinedMethodInspection */
$content['htmlInputProcessor']->setObjectID($articleContent->articleContentID);
if ($articleContent->hasEmbeddedObjects != MessageEmbeddedObjectManager::getInstance()->registerObjects($content['htmlInputProcessor'])) {
- $articleContentEditor->update(['hasEmbeddedObjects' => ($articleContent->hasEmbeddedObjects ? 0 : 1)]);
+ $articleContentEditor->update(['hasEmbeddedObjects' => $articleContent->hasEmbeddedObjects ? 0 : 1]);
}
}
}
$this->getDecoratedObject()->articleContents = [];
}
- $this->getDecoratedObject()->articleContents[($articleContent->languageID ?: 0)] = $articleContent;
+ $this->getDecoratedObject()->articleContents[$articleContent->languageID ?: 0] = $articleContent;
}
/**
* @inheritDoc
*/
public function getLocation() {
- return self::getStorage() . substr($this->fileHash, 0, 2) . '/' . ($this->attachmentID) . '-' . $this->fileHash;
+ return self::getStorage() . substr($this->fileHash, 0, 2) . '/' . $this->attachmentID . '-' . $this->fileHash;
}
/**
*/
public function getThumbnailLocation($size = '') {
if ($size == 'tiny') {
- return self::getStorage() . substr($this->fileHash, 0, 2) . '/' . ($this->attachmentID) . '-tiny-' . $this->fileHash;
+ return self::getStorage() . substr($this->fileHash, 0, 2) . '/' . $this->attachmentID . '-tiny-' . $this->fileHash;
}
- return self::getStorage() . substr($this->fileHash, 0, 2) . '/' . ($this->attachmentID) . '-thumbnail-' . $this->fileHash;
+ return self::getStorage() . substr($this->fileHash, 0, 2) . '/' . $this->attachmentID . '-thumbnail-' . $this->fileHash;
}
/**
public function validateUpload() {
// IE<10 fallback
if (isset($_POST['isFallback'])) {
- $this->parameters['objectType'] = (isset($_POST['objectType'])) ? $_POST['objectType'] : '';
- $this->parameters['objectID'] = (isset($_POST['objectID'])) ? $_POST['objectID'] : 0;
- $this->parameters['parentObjectID'] = (isset($_POST['parentObjectID'])) ? $_POST['parentObjectID'] : 0;
- $this->parameters['tmpHash'] = (isset($_POST['tmpHash'])) ? $_POST['tmpHash'] : '';
+ $this->parameters['objectType'] = isset($_POST['objectType']) ? $_POST['objectType'] : '';
+ $this->parameters['objectID'] = isset($_POST['objectID']) ? $_POST['objectID'] : 0;
+ $this->parameters['parentObjectID'] = isset($_POST['parentObjectID']) ? $_POST['parentObjectID'] : 0;
+ $this->parameters['tmpHash'] = isset($_POST['tmpHash']) ? $_POST['tmpHash'] : '';
}
// read variables
], [
'objectID' => intval($this->parameters['objectID']),
'objectTypeID' => $objectType->objectTypeID,
- 'tmpHash' => (!$this->parameters['objectID'] ? $this->parameters['tmpHash'] : '')
+ 'tmpHash' => !$this->parameters['objectID'] ? $this->parameters['tmpHash'] : ''
]);
/** @noinspection PhpUndefinedMethodInspection */
'formattedFilesize' => FileUtil::formatFilesize($attachment->filesize),
'isImage' => $attachment->isImage,
'attachmentID' => $attachment->attachmentID,
- 'tinyURL' => ($attachment->tinyThumbnailType ? LinkHandler::getInstance()->getLink('Attachment', ['object' => $attachment], 'tiny=1') : ''),
- 'thumbnailURL' => ($attachment->thumbnailType ? LinkHandler::getInstance()->getLink('Attachment', ['object' => $attachment], 'thumbnail=1') : ''),
+ 'tinyURL' => $attachment->tinyThumbnailType ? LinkHandler::getInstance()->getLink('Attachment', ['object' => $attachment], 'tiny=1') : '',
+ 'thumbnailURL' => $attachment->thumbnailType ? LinkHandler::getInstance()->getLink('Attachment', ['object' => $attachment], 'thumbnail=1') : '',
'url' => LinkHandler::getInstance()->getLink('Attachment', ['object' => $attachment]),
'height' => $attachment->height,
'width' => $attachment->width
$htmlInputProcessor->process($this->parameters['data']['message'], $this->parameters['messageObjectType'], $this->parameters['messageObjectID']);
// check if disallowed bbcode are used
- $disallowedBBCodesPermission = (isset($this->parameters['disallowedBBCodesPermission'])) ? $this->parameters['disallowedBBCodesPermission'] : 'user.message.disallowedBBCodes';
+ $disallowedBBCodesPermission = isset($this->parameters['disallowedBBCodesPermission']) ? $this->parameters['disallowedBBCodesPermission'] : 'user.message.disallowedBBCodes';
if ($disallowedBBCodesPermission) {
BBCodeHandler::getInstance()->setDisallowedBBCodes(ArrayUtil::trim(explode(',', WCF::getSession()->getPermission($disallowedBBCodesPermission))));
$disallowedBBCodes = $htmlInputProcessor->validate();
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute([$this->boxID]);
while ($row = $statement->fetchArray()) {
- $this->boxContents[($row['languageID'] ?: 0)] = new BoxContent(null, $row);
+ $this->boxContents[$row['languageID'] ?: 0] = new BoxContent(null, $row);
}
}
/** @var BoxContent $boxContent */
$boxContent = BoxContentEditor::create([
'boxID' => $box->boxID,
- 'languageID' => ($languageID ?: null),
+ 'languageID' => $languageID ?: null,
'title' => $content['title'],
'content' => $content['content'],
'imageID' => $content['imageID']
$statement->execute([
$box->boxID,
$pageID,
- ($box->visibleEverywhere ? 0 : 1)
+ $box->visibleEverywhere ? 0 : 1
]);
}
}
/** @var BoxContent $boxContent */
$boxContent = BoxContentEditor::create([
'boxID' => $box->boxID,
- 'languageID' => ($languageID ?: null),
+ 'languageID' => $languageID ?: null,
'title' => $content['title'],
'content' => $content['content'],
'imageID' => $content['imageID']
/** @noinspection PhpUndefinedMethodInspection */
$content['htmlInputProcessor']->setObjectID($boxContent->boxContentID);
if ($boxContent->hasEmbeddedObjects != MessageEmbeddedObjectManager::getInstance()->registerObjects($content['htmlInputProcessor'])) {
- $boxContentEditor->update(['hasEmbeddedObjects' => ($boxContent->hasEmbeddedObjects ? 0 : 1)]);
+ $boxContentEditor->update(['hasEmbeddedObjects' => $boxContent->hasEmbeddedObjects ? 0 : 1]);
}
}
}
$visibleEverywhere = (isset($this->parameters['data']['visibleEverywhere']) ? $this->parameters['data']['visibleEverywhere'] : $box->visibleEverywhere);
foreach ($this->parameters['pageIDs'] as $pageID) {
- $insertStatement->execute([$box->boxID, $pageID, ($visibleEverywhere ? 0 : 1)]);
+ $insertStatement->execute([$box->boxID, $pageID, $visibleEverywhere ? 0 : 1]);
}
}
}
$contentList->getConditionBuilder()->add('(box_content.languageID IS NULL OR box_content.languageID = ?)', [WCF::getLanguage()->languageID]);
$contentList->readObjects();
foreach ($contentList as $boxContent) {
- $this->objects[$boxContent->boxID]->setBoxContents([($boxContent->languageID ?: 0) => $boxContent]);
+ $this->objects[$boxContent->boxID]->setBoxContents([$boxContent->languageID ?: 0 => $boxContent]);
}
}
}
*/
public static function create(array $parameters = []) {
// default values
- $parameters['time'] = (isset($parameters['time'])) ? $parameters['time'] : TIME_NOW;
- $parameters['parentCategoryID'] = (isset($parameters['parentCategoryID'])) ? $parameters['parentCategoryID'] : 0;
- $parameters['showOrder'] = (isset($parameters['showOrder'])) ? $parameters['showOrder'] : null;
+ $parameters['time'] = isset($parameters['time']) ? $parameters['time'] : TIME_NOW;
+ $parameters['parentCategoryID'] = isset($parameters['parentCategoryID']) ? $parameters['parentCategoryID'] : 0;
+ $parameters['showOrder'] = isset($parameters['showOrder']) ? $parameters['showOrder'] : null;
// handle show order
$parameters['showOrder'] = static::getShowOrder($parameters['objectTypeID'], $parameters['parentCategoryID'], $parameters['showOrder']);
WCF::getTPL()->assign([
'commentList' => $commentList,
- 'likeData' => (MODULE_LIKE ? $commentList->getLikeData() : [])
+ 'likeData' => MODULE_LIKE ? $commentList->getLikeData() : []
]);
return [
}
WCF::getTPL()->assign([
- 'likeData' => (MODULE_LIKE ? $responseList->getLikeData() : []),
+ 'likeData' => MODULE_LIKE ? $responseList->getLikeData() : [],
'responseList' => $responseList,
'commentManager' => $this->commentManager
]);
CronjobLogEditor::create([
'cronjobID' => $cronjob->cronjobID,
'execTime' => TIME_NOW,
- 'success' => ($exception ? 0 : 1),
- 'error' => ($exception ? $exception->getMessage() : '')
+ 'success' => $exception ? 0 : 1,
+ 'error' => $exception ? $exception->getMessage() : ''
]);
// calculate next exec-time
$data = [
'lastExec' => TIME_NOW,
'nextExec' => $nextExec,
- 'afterNextExec' => $cronjob->getNextExec(($nextExec + 120))
+ 'afterNextExec' => $cronjob->getNextExec($nextExec + 120)
];
// cronjob failed
*/
public function toggle() {
foreach ($this->getObjects() as $language) {
- $isDisabled = ($language->isDisabled) ? 0 : 1;
+ $isDisabled = $language->isDisabled ? 0 : 1;
$language->update(['isDisabled' => $isDisabled]);
}
}
$items[$languageCategoryID] = [];
}
- $items[$languageCategoryID][$row['languageItem']] = ($row['languageUseCustomValue']) ? $row['languageCustomItemValue'] : $row['languageItemValue'];
+ $items[$languageCategoryID][$row['languageItem']] = $row['languageUseCustomValue'] ? $row['languageCustomItemValue'] : $row['languageItemValue'];
}
foreach ($items as $languageCategoryID => $languageItems) {
if (!empty($itemData)) {
// insert/update a maximum of 50 items per run (prevents issues with max_allowed_packet)
- $step = ($packageID) ? 5 : 4;
+ $step = $packageID ? 5 : 4;
WCF::getDB()->beginTransaction();
for ($i = 0, $length = count($itemData); $i < $length; $i += 50 * $step) {
$parameters = array_slice($itemData, $i, 50 * $step);
$languageItemEditor = new LanguageItemEditor($languageItem);
$languageItemEditor->update([
'languageCustomItemValue' => $items[$languageItem->languageItem],
- 'languageUseCustomValue' => (isset($useCustom[$languageItem->languageItem])) ? 1 : 0
+ 'languageUseCustomValue' => isset($useCustom[$languageItem->languageItem]) ? 1 : 0
]);
// remove updated items, leaving items to be created within
if ($editor->languageItemOriginIsSystem) {
$updateData = [
'languageCustomItemValue' => !$this->parameters['languageUseCustomValue'] && empty($this->parameters['languageCustomItemValue']) ? null : $this->parameters['languageCustomItemValue'],
- 'languageUseCustomValue' => ($this->parameters['languageUseCustomValue'] ? 1 : 0)
+ 'languageUseCustomValue' => $this->parameters['languageUseCustomValue'] ? 1 : 0
];
}
else {
$boxData = $this->parameters['boxData'];
$boxData['menuID'] = $menu->menuID;
$boxData['identifier'] = '';
- $boxAction = new BoxAction([], 'create', ['data' => $boxData, 'pageIDs' => (isset($this->parameters['pageIDs']) ? $this->parameters['pageIDs'] : [])]);
+ $boxAction = new BoxAction([], 'create', ['data' => $boxData, 'pageIDs' => isset($this->parameters['pageIDs']) ? $this->parameters['pageIDs'] : []]);
$returnValues = $boxAction->executeAction();
// set generic box identifier
*/
public function toggle() {
foreach ($this->getObjects() as $object) {
- $object->update(['isDisabled' => ($object->isDisabled) ? 0 : 1]);
+ $object->update(['isDisabled' => $object->isDisabled ? 0 : 1]);
}
}
foreach ($this->parameters['data']['structure'] as $parentItemID => $children) {
foreach ($children as $showOrder => $menuItemID) {
$statement->execute([
- ($parentItemID ?: null),
+ $parentItemID ?: null,
$showOrder + 1,
$menuItemID
]);
* @return string[]
*/
public function getAssignUserForm() {
- $assignedUser = ($this->moderationQueueEditor->assignedUserID) ? new User($this->moderationQueueEditor->assignedUserID) : null;
+ $assignedUser = $this->moderationQueueEditor->assignedUserID ? new User($this->moderationQueueEditor->assignedUserID) : null;
WCF::getTPL()->assign([
'assignedUser' => $assignedUser,
* @return string[]
*/
public function assignUser() {
- $data = ['assignedUserID' => ($this->parameters['assignedUserID'] ?: null)];
+ $data = ['assignedUserID' => $this->parameters['assignedUserID'] ?: null];
if ($this->user->userID) {
if ($this->moderationQueueEditor->status == ModerationQueue::STATUS_OUTSTANDING) {
$data['status'] = ModerationQueue::STATUS_PROCESSING;
$this->moderationQueueEditor->update($data);
- $username = ($this->user->userID) ? $this->user->username : WCF::getLanguage()->get('wcf.moderation.assignedUser.nobody');
+ $username = $this->user->userID ? $this->user->username : WCF::getLanguage()->get('wcf.moderation.assignedUser.nobody');
$link = '';
if ($this->user->userID) {
$link = LinkHandler::getInstance()->getLink('User', ['object' => $this->user]);
*/
public function prepareReport() {
// content was already reported
- $alreadyReported = (ModerationQueueReportManager::getInstance()->hasPendingReport($this->parameters['objectType'], $this->parameters['objectID'])) ? 1 : 0;
+ $alreadyReported = ModerationQueueReportManager::getInstance()->hasPendingReport($this->parameters['objectType'], $this->parameters['objectID']) ? 1 : 0;
WCF::getTPL()->assign([
'alreadyReported' => $alreadyReported,
$reply = $request->getReply();
$response = JSON::decode($reply['body']);
- $code = (isset($response['status'])) ? $response['status'] : 500;
+ $code = isset($response['status']) ? $response['status'] : 500;
switch ($code) {
case 200:
if (empty($response['products'])) {
$scheduler = new PackageInstallationScheduler($this->parameters['packages']);
try {
- $scheduler->buildPackageInstallationStack(($queueType == 'install'));
+ $scheduler->buildPackageInstallationStack($queueType == 'install');
}
catch (PackageUpdateUnauthorizedException $e) {
return [
'userID' => WCF::getUser()->userID,
'package' => $package['package'],
'packageName' => $package['packageName'],
- 'packageID' => ($package['packageID'] ?: null),
+ 'packageID' => $package['packageID'] ?: null,
'archive' => $package['archive'],
'action' => $package['action']
]);
*/
public function toggle() {
foreach ($this->getObjects() as $server) {
- $server->update(['isDisabled' => ($server->isDisabled) ? 0 : 1]);
+ $server->update(['isDisabled' => $server->isDisabled ? 0 : 1]);
}
}
}
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute([$this->pageID]);
while ($row = $statement->fetchArray()) {
- $this->pageContents[($row['languageID'] ?: 0)] = new PageContent(null, $row);
+ $this->pageContents[$row['languageID'] ?: 0] = new PageContent(null, $row);
}
}
/** @var PageContent $pageContent */
$pageContent = PageContentEditor::create([
'pageID' => $page->pageID,
- 'languageID' => ($languageID ?: null),
+ 'languageID' => $languageID ?: null,
'title' => $content['title'],
'content' => $content['content'],
'metaDescription' => $content['metaDescription'],
/** @var PageContent $pageContent */
$pageContent = PageContentEditor::create([
'pageID' => $page->pageID,
- 'languageID' => ($languageID ?: null),
+ 'languageID' => $languageID ?: null,
'title' => $content['title'],
'content' => $content['content'],
'metaDescription' => $content['metaDescription'],
/** @noinspection PhpUndefinedMethodInspection */
$content['htmlInputProcessor']->setObjectID($pageContent->pageContentID);
if ($pageContent->hasEmbeddedObjects != MessageEmbeddedObjectManager::getInstance()->registerObjects($content['htmlInputProcessor'])) {
- $pageContentEditor->update(['hasEmbeddedObjects' => ($pageContent->hasEmbeddedObjects ? 0 : 1)]);
+ $pageContentEditor->update(['hasEmbeddedObjects' => $pageContent->hasEmbeddedObjects ? 0 : 1]);
}
}
else if ($page->pageType == 'html' || $page->pageType == 'tpl') {
*/
public function toggle() {
foreach ($this->getObjects() as $object) {
- $object->update(['isDisabled' => ($object->isDisabled) ? 0 : 1]);
+ $object->update(['isDisabled' => $object->isDisabled ? 0 : 1]);
}
}
* @inheritDoc
*/
public static function supportsVirtualSessions() {
- return (SESSION_ENABLE_VIRTUALIZATION) ? true : false;
+ return SESSION_ENABLE_VIRTUALIZATION ? true : false;
}
}
$statement->execute([$this->styleID]);
while ($row = $statement->fetchArray()) {
$variableName = $row['variableName'];
- $variableValue = (isset($row['variableValue'])) ? $row['variableValue'] : $row['defaultValue'];
+ $variableValue = isset($row['variableValue']) ? $row['variableValue'] : $row['defaultValue'];
$this->variables[$variableName] = $variableValue;
}
return [
'preset' => $tmp[0],
- 'custom' => (isset($tmp[1])) ? $tmp[1] : ''
+ 'custom' => isset($tmp[1]) ? $tmp[1] : ''
];
}
}
}
- $number = (count($numbers)) ? max($numbers) + 1 : 2;
+ $number = count($numbers) ? max($numbers) + 1 : 2;
$styleName = $this->styleEditor->styleName . ' ('.$number.')';
// create the new style
*/
public function toggle() {
foreach ($this->getObjects() as $style) {
- $isDisabled = ($style->isDisabled) ? 0 : 1;
+ $isDisabled = $style->isDisabled ? 0 : 1;
$style->update(['isDisabled' => $isDisabled]);
}
}
if (WCF::getUser()->userID) {
// set this as the permanent style
$userAction = new UserAction([WCF::getUser()], 'update', ['data' => [
- 'styleID' => ($this->style->isDefault ? 0 : $this->style->styleID)
+ 'styleID' => $this->style->isDefault ? 0 : $this->style->styleID
]]);
$userAction->executeAction();
}
}
// insert user groups
- $addDefaultGroups = (isset($this->parameters['addDefaultGroups'])) ? $this->parameters['addDefaultGroups'] : true;
- $groupIDs = (isset($this->parameters['groups'])) ? $this->parameters['groups'] : [];
+ $addDefaultGroups = isset($this->parameters['addDefaultGroups']) ? $this->parameters['addDefaultGroups'] : true;
+ $groupIDs = isset($this->parameters['groups']) ? $this->parameters['groups'] : [];
$userEditor->addToGroups($groupIDs, false, $addDefaultGroups);
// insert visible languages
}
}
- $groupIDs = (isset($this->parameters['groups'])) ? $this->parameters['groups'] : [];
- $languageIDs = (isset($this->parameters['languageIDs'])) ? $this->parameters['languageIDs'] : [];
- $removeGroups = (isset($this->parameters['removeGroups'])) ? $this->parameters['removeGroups'] : [];
- $userOptions = (isset($this->parameters['options'])) ? $this->parameters['options'] : [];
+ $groupIDs = isset($this->parameters['groups']) ? $this->parameters['groups'] : [];
+ $languageIDs = isset($this->parameters['languageIDs']) ? $this->parameters['languageIDs'] : [];
+ $removeGroups = isset($this->parameters['removeGroups']) ? $this->parameters['removeGroups'] : [];
+ $userOptions = isset($this->parameters['options']) ? $this->parameters['options'] : [];
if (!empty($groupIDs)) {
$action = new UserAction($this->objects, 'addToGroups', [
*/
public function getMessagePreview() {
// get options
- $enableBBCodes = (isset($this->parameters['options']['enableBBCodes'])) ? 1 : 0;
- $enableHtml = (isset($this->parameters['options']['enableHtml'])) ? 1 : 0;
- $enableSmilies = (isset($this->parameters['options']['enableSmilies'])) ? 1 : 0;
+ $enableBBCodes = isset($this->parameters['options']['enableBBCodes']) ? 1 : 0;
+ $enableHtml = isset($this->parameters['options']['enableHtml']) ? 1 : 0;
+ $enableSmilies = isset($this->parameters['options']['enableSmilies']) ? 1 : 0;
// validate permissions for options
if ($enableBBCodes && !WCF::getSession()->getPermission('user.signature.canUseBBCodes')) $enableBBCodes = 0;
WCF::getTPL()->assign([
'errorType' => $errors,
'optionTree' => $optionHandler->getOptionTree(),
- '__userTitle' => ($userTitle !== null ? $userTitle : $this->userProfile->userTitle)
+ '__userTitle' => $userTitle !== null ? $userTitle : $this->userProfile->userTitle
]);
return [
/** @noinspection PhpUndefinedFieldInspection */
$userAction = new UserAction([WCF::getUser()], 'update', [
'options' => [
- User::getUserOptionID('recentActivitiesFilterByFollowing') => (WCF::getUser()->recentActivitiesFilterByFollowing ? 0 : 1)
+ User::getUserOptionID('recentActivitiesFilterByFollowing') => WCF::getUser()->recentActivitiesFilterByFollowing ? 0 : 1
]
]);
$userAction->executeAction();
* @return string
*/
public function getFilename($size = null) {
- return substr($this->fileHash, 0, 2) . '/' . ($this->avatarID) . '-' . $this->fileHash . ($size !== null ? ('-' . $size) : '') . '.' . $this->avatarExtension;
+ return substr($this->fileHash, 0, 2) . '/' . $this->avatarID . '-' . $this->fileHash . ($size !== null ? ('-' . $size) : '') . '.' . $this->avatarExtension;
}
/**
// newly subscribed
if ($this->userObjectWatch === null) {
UserObjectWatchEditor::create([
- 'notification' => ($this->parameters['enableNotification'] ? 1 : 0),
+ 'notification' => $this->parameters['enableNotification'] ? 1 : 0,
'objectID' => $this->parameters['objectID'],
'objectTypeID' => $this->objectType->objectTypeID,
'userID' => WCF::getUser()->userID
// update notification type
$editor = new UserObjectWatchEditor($this->userObjectWatch);
$editor->update([
- 'notification' => ($this->parameters['enableNotification'] ? 1 : 0)
+ 'notification' => $this->parameters['enableNotification'] ? 1 : 0
]);
}
'userID' => WCF::getUser()->userID,
'objectID' => intval($this->parameters['data']['objectID']),
'objectTypeID' => $objectType->objectTypeID,
- 'notification' => (!empty($this->parameters['enableNotification']) ? 1 : 0)
+ 'notification' => !empty($this->parameters['enableNotification']) ? 1 : 0
]);
// reset user storage
'commentCanAdd' => true,
'commentList' => $this->commentList,
'commentObjectTypeID' => $this->commentObjectTypeID,
- 'lastCommentTime' => ($this->commentList ? $this->commentList->getMinCommentTime() : 0)
+ 'lastCommentTime' => $this->commentList ? $this->commentList->getMinCommentTime() : 0
]);
}
'attachmentParentObjectID' => $this->attachmentParentObjectID,
'availableContentLanguages' => $this->availableContentLanguages,
'defaultSmilies' => $this->defaultSmilies,
- 'languageID' => ($this->languageID ?: 0),
+ 'languageID' => $this->languageID ?: 0,
'maxTextLength' => $this->maxTextLength,
'smileyCategories' => $this->smileyCategories,
'subject' => $this->subject,
$this->saved();
// forward to index page
- HeaderUtil::delayedRedirect(LinkHandler::getInstance()->getLink(), WCF::getLanguage()->getDynamicVariable('wcf.user.newActivationCode.success', ['email' => (!empty($this->email) ? $this->email : $this->user->email)]), 10);
+ HeaderUtil::delayedRedirect(LinkHandler::getInstance()->getLink(), WCF::getLanguage()->getDynamicVariable('wcf.user.newActivationCode.success', ['email' => !empty($this->email) ? $this->email : $this->user->email]), 10);
exit;
}
'username' => $this->username,
'userID' => $this->userID,
'selectedObjectTypes' => $this->selectedObjectTypes,
- 'alterable' => (!$this->userID ? 1 : 0)
+ 'alterable' => !$this->userID ? 1 : 0
];
if ($this->modifySearchID) {
$this->objectAction = new SearchAction([$this->modifySearchID], 'update', ['data' => [
}
else {
$this->objectAction = new SearchAction([], 'create', ['data' => [
- 'userID' => (WCF::getUser()->userID ?: null),
+ 'userID' => WCF::getUser()->userID ?: null,
'searchData' => serialize($this->searchData),
'searchTime' => TIME_NOW,
'searchType' => 'messages',
$this->tags = TagEngine::getInstance()->getObjectTags(
'com.woltlab.wcf.article',
$this->articleContent->articleContentID,
- [($this->articleContent->languageID ?: LanguageFactory::getInstance()->getDefaultLanguageID())]
+ [$this->articleContent->languageID ?: LanguageFactory::getInstance()->getDefaultLanguageID()]
);
}
FROM wcf" . WCF_N . "_tag_to_object
" . $conditionBuilder . "
GROUP BY objectID
- HAVING COUNT(*) > " . (round(count($this->tags) * (ARTICLE_RELATED_ARTICLES_MATCH_THRESHOLD / 100))) . "
+ HAVING COUNT(*) > " . (round(count($this->tags) * ARTICLE_RELATED_ARTICLES_MATCH_THRESHOLD / 100)) . "
ORDER BY count DESC";
$statement = WCF::getDB()->prepareStatement($sql, ARTICLE_RELATED_ARTICLES);
$statement->execute($conditionBuilder->getParameters());
'commentCanAdd' => WCF::getSession()->getPermission('user.article.canAddComment'),
'commentList' => $this->commentList,
'commentObjectTypeID' => $this->commentObjectTypeID,
- 'lastCommentTime' => ($this->commentList ? $this->commentList->getMinCommentTime() : 0),
- 'likeData' => ((MODULE_LIKE && $this->commentList) ? $this->commentList->getLikeData() : []),
+ 'lastCommentTime' => $this->commentList ? $this->commentList->getMinCommentTime() : 0,
+ 'likeData' => (MODULE_LIKE && $this->commentList) ? $this->commentList->getLikeData() : [],
'articleLikeData' => $this->articleLikeData,
'allowSpidersToIndexThisPage' => true
]);
'filename' => $this->attachment->filename,
'mimeType' => $mimeType,
'filesize' => $filesize,
- 'showInline' => (in_array($mimeType, self::$inlineMimeTypes)),
- 'enableRangeSupport' => (!$this->tiny && !$this->thumbnail),
+ 'showInline' => in_array($mimeType, self::$inlineMimeTypes),
+ 'enableRangeSupport' => !$this->tiny && !$this->thumbnail,
'lastModificationTime' => $this->attachment->uploadTime,
'expirationDate' => TIME_NOW + 31536000,
'maxAge' => 31536000
'contentLanguageID' => $this->languageID,
'page' => $this->page,
'pageID' => $this->pageID,
- 'activePageLanguage' => ($this->languageID ? LanguageFactory::getInstance()->getLanguage($this->languageID) : null),
+ 'activePageLanguage' => $this->languageID ? LanguageFactory::getInstance()->getLanguage($this->languageID) : null,
'allowSpidersToIndexThisPage' => true
]);
}
'filename' => $this->media->filename,
'mimeType' => $mimeType,
'filesize' => $filesize,
- 'showInline' => (in_array($mimeType, self::$inlineMimeTypes)),
- 'enableRangeSupport' => ($this->thumbnail ? true : false),
+ 'showInline' => in_array($mimeType, self::$inlineMimeTypes),
+ 'enableRangeSupport' => $this->thumbnail ? true : false,
'lastModificationTime' => $this->media->uploadTime,
'expirationDate' => TIME_NOW + 31536000,
'maxAge' => 31536000
'highlight' => $this->highlight,
'sortField' => $this->searchData['sortField'],
'sortOrder' => $this->searchData['sortOrder'],
- 'alterable' => (!empty($this->searchData['alterable']) ? 1 : 0),
+ 'alterable' => !empty($this->searchData['alterable']) ? 1 : 0,
'objectTypes' => SearchEngine::getInstance()->getAvailableObjectTypes(),
'resultListTemplateName' => $this->resultListTemplateName,
'resultListApplication' => $this->resultListApplication,
'followerCount' => $this->followerList->countObjects(),
'following' => $this->followingList->getObjects(),
'followingCount' => $this->followingList->countObjects(),
- 'visitors' => ($this->visitorList !== null ? $this->visitorList->getObjects() : []),
- 'visitorCount' => ($this->visitorList !== null ? $this->visitorList->countObjects() : 0),
+ 'visitors' => $this->visitorList !== null ? $this->visitorList->getObjects() : [],
+ 'visitorCount' => $this->visitorList !== null ? $this->visitorList->countObjects() : 0,
'allowSpidersToIndexThisPage' => true,
'isAccessible' => UserGroup::isAccessibleGroup($this->user->getGroupIDs())
]);
}
// refresh the session 1 minute before it expires
- self::getTPL()->assign('__sessionKeepAlive', (SESSION_TIMEOUT - 60));
+ self::getTPL()->assign('__sessionKeepAlive', SESSION_TIMEOUT - 60);
}
}
}
if (class_exists($objectName)) {
- if (!(is_subclass_of($objectName, SingletonFactory::class))) {
+ if (!is_subclass_of($objectName, SingletonFactory::class)) {
throw new ParentClassException($objectName, SingletonFactory::class);
}
*/
protected function initCronjobs() {
if (PACKAGE_ID) {
- self::getTPL()->assign('executeCronjobs', (CronjobScheduler::getInstance()->getNextExec() < TIME_NOW && defined('OFFLINE') && !OFFLINE));
+ self::getTPL()->assign('executeCronjobs', CronjobScheduler::getInstance()->getNextExec() < TIME_NOW && defined('OFFLINE') && !OFFLINE);
}
}
}
$application = Package::getAbbreviation($package->getPackageInfo('name'));
$packages[$application] = [
- 'directory' => ($package->getPackageInfo('applicationDirectory') ?: $application),
+ 'directory' => $package->getPackageInfo('applicationDirectory') ?: $application,
'packageDescription' => $package->getLocalizedPackageInfo('packageDescription'),
'packageName' => $package->getLocalizedPackageInfo('packageName')
];
// split by offsets
$sqlData = explode('/* SQL_PARSER_OFFSET */', $sql);
- $offset = (isset($_POST['offset'])) ? intval($_POST['offset']) : 0;
+ $offset = isset($_POST['offset']) ? intval($_POST['offset']) : 0;
if (!isset($sqlData[$offset])) {
throw new SystemException("Offset for SQL parser is out of bounds, ".$offset." was requested, but there are only ".count($sqlData)." sections");
}
while ($queueID) {
$queueIDs[] = $queueID;
- $queueID = (isset($queues[$queueID])) ? $queues[$queueID] : 0;
+ $queueID = isset($queues[$queueID]) ? $queues[$queueID] : 0;
}
// remove previously created queues
// start buffering
$tag['buffer'] = '';
$bufferedTagStack[] = $tag;
- $buffer =& $bufferedTagStack[(count($bufferedTagStack) - 1)]['buffer'];
+ $buffer =& $bufferedTagStack[count($bufferedTagStack) - 1]['buffer'];
}
else {
$buffer .= $this->buildOpeningTag($tag);
// start buffering
$tag['buffer'] = '';
$bufferedTagStack[] = $tag;
- $buffer =& $bufferedTagStack[(count($bufferedTagStack) - 1)]['buffer'];
+ $buffer =& $bufferedTagStack[count($bufferedTagStack) - 1]['buffer'];
}
else {
$buffer .= $this->buildOpeningTag($tag);
return WCF::getTPL()->fetch('quoteBBCodeTag');
}
else if ($parser->getOutputType() == 'text/simplified-html') {
- return WCF::getLanguage()->getDynamicVariable('wcf.bbcode.quote.text', ['content' => $content, 'cite' => (!empty($openingTag['attributes'][0]) ? $openingTag['attributes'][0] : '')])."\n";
+ return WCF::getLanguage()->getDynamicVariable('wcf.bbcode.quote.text', ['content' => $content, 'cite' => !empty($openingTag['attributes'][0]) ? $openingTag['attributes'][0] : ''])."\n";
}
}
}
if ($parser->getOutputType() == 'text/html') {
WCF::getTPL()->assign([
'content' => $content,
- 'buttonTitle' => (!empty($openingTag['attributes'][0]) ? $openingTag['attributes'][0] : '')
+ 'buttonTitle' => !empty($openingTag['attributes'][0]) ? $openingTag['attributes'][0] : ''
]);
return WCF::getTPL()->fetch('spoilerBBCodeTag');
}
if ($quotesRegEx !== '') {
$quotesRegEx = '(?:'.$quotesRegEx.')';
- $this->quotesRegEx = new Regex($quotesRegEx, ($this->allowsNewslinesInQuotes) ? Regex::DOT_ALL : Regex::MODIFIER_NONE);
+ $this->quotesRegEx = new Regex($quotesRegEx, $this->allowsNewslinesInQuotes ? Regex::DOT_ALL : Regex::MODIFIER_NONE);
}
// cache comment regex
$this->items[$newIndex]['type'] = $type;
$this->items[$newIndex]['before'] = self::getMicrotime();
$this->items[$newIndex]['start'] = self::compareMicrotimes($this->startTime, $this->items[$newIndex]['before']);
- $this->items[$newIndex]['trace'] = (defined('DEBUG_BACKTRACE_IGNORE_ARGS')) ? debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS) : debug_backtrace();
+ $this->items[$newIndex]['trace'] = defined('DEBUG_BACKTRACE_IGNORE_ARGS') ? debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS) : debug_backtrace();
return $newIndex;
}
VALUES (?, ?, ?)";
$statement = WCF::getDB()->prepareStatement($sql);
foreach ($pages as $page) {
- $statement->execute([$box->boxID, $page->pageID, ($visible ? 1 : 0)]);
+ $statement->execute([$box->boxID, $page->pageID, $visible ? 1 : 0]);
}
}
}
'commentObjectTypeID' => CommentHandler::getInstance()->getObjectTypeID('com.woltlab.wcf.page'),
'lastCommentTime' => $this->objectList->getMinCommentTime(),
'pageID' => RequestHandler::getInstance()->getActiveRequest()->getPageID(),
- 'likeData' => ((MODULE_LIKE && $this->objectList) ? $this->objectList->getLikeData() : [])
+ 'likeData' => (MODULE_LIKE && $this->objectList) ? $this->objectList->getLikeData() : []
]);
}
$className = $abbreviation . '\\' . ($libDirectory === 'lib/acp' ? 'acp\\' : '') . $pageType . '\\' . $filename;
if (!isset($data['lookup'][$abbreviation])) $data['lookup'][$abbreviation] = ['acp' => [], 'frontend' => []];
- $data['lookup'][$abbreviation][($libDirectory === 'lib' ? 'frontend' : 'acp')][$ciController] = $className;
+ $data['lookup'][$abbreviation][$libDirectory === 'lib' ? 'frontend' : 'acp'][$ciController] = $className;
$data['reverse'][$filename] = $ciController;
}
}
'menuItem' => 'wcf.user.option.category.'.$row['categoryName'],
'parentMenuItem' => 'wcf.user.menu.settings',
'menuItemController' => SettingsForm::class,
- 'menuItemLink' => ($categoryShortName != 'general' ? 'category='.$categoryShortName : ''),
+ 'menuItemLink' => $categoryShortName != 'general' ? 'category='.$categoryShortName : '',
'permissions' => $row['permissions'],
'options' => $row['options']
]);
'packageName' => $archive->getLocalizedPackageInfo('packageName'),
'packageID' => ($package !== null) ? $package->packageID : null,
'archive' => $file,
- 'action' => ($package !== null ? 'update' : 'install')
+ 'action' => $package !== null ? 'update' : 'install'
]);
// PackageInstallationDispatcher::openQueue()
$statement = WCF::getDB()->prepareStatement($sql, 1);
$statement->execute([
WCF::getUser()->userID,
- (TIME_NOW - WCF::getSession()->getPermission('user.comment.floodControlTime'))
+ TIME_NOW - WCF::getSession()->getPermission('user.comment.floodControlTime')
]);
if (($row = $statement->fetchArray()) !== false) {
throw new NamedUserException(WCF::getLanguage()->getDynamicVariable('wcf.comment.error.floodControl', ['lastCommentTime' => $row['time']]));
$statement = WCF::getDB()->prepareStatement($sql, 1);
$statement->execute([
WCF::getUser()->userID,
- (TIME_NOW - WCF::getSession()->getPermission('user.comment.floodControlTime'))
+ TIME_NOW - WCF::getSession()->getPermission('user.comment.floodControlTime')
]);
if (($row = $statement->fetchArray()) !== false) {
throw new NamedUserException(WCF::getLanguage()->getDynamicVariable('wcf.comment.error.floodControl', ['lastCommentTime' => $row['time']]));
* @inheritDoc
*/
public function canEditComment(Comment $comment) {
- return $this->canEdit(($comment->userID == WCF::getUser()->userID));
+ return $this->canEdit($comment->userID == WCF::getUser()->userID);
}
/**
* @inheritDoc
*/
public function canEditResponse(CommentResponse $response) {
- return $this->canEdit(($response->userID == WCF::getUser()->userID));
+ return $this->canEdit($response->userID == WCF::getUser()->userID);
}
/**
* @inheritDoc
*/
public function canDeleteComment(Comment $comment) {
- return $this->canDelete(($comment->userID == WCF::getUser()->userID));
+ return $this->canDelete($comment->userID == WCF::getUser()->userID);
}
/**
* @inheritDoc
*/
public function canDeleteResponse(CommentResponse $response) {
- return $this->canDelete(($response->userID == WCF::getUser()->userID));
+ return $this->canDelete($response->userID == WCF::getUser()->userID);
}
/**
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute([
0,
- (TIME_NOW - 86400)
+ TIME_NOW - 86400
]);
$attachmentIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
// get time of next execution
$nextExec = $cronjobEditor->getNextExec();
- $afterNextExec = $cronjobEditor->getNextExec(($nextExec + 120));
+ $afterNextExec = $cronjobEditor->getNextExec($nextExec + 120);
// mark cronjob as done
$cronjobEditor->update([
}
// verify class signature
- if (!(is_subclass_of($className, ICronjob::class))) {
+ if (!is_subclass_of($className, ICronjob::class)) {
throw new ImplementationException($className, ICronjob::class);
}
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute([
floor($row['searches'] / 4),
- (TIME_NOW - 86400 * 30)
+ TIME_NOW - 86400 * 30
]);
}
WHERE time < ?";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute([
- (TIME_NOW - 86400 * USER_CLEANUP_NOTIFICATION_LIFETIME)
+ TIME_NOW - 86400 * USER_CLEANUP_NOTIFICATION_LIFETIME
]);
// clean up user activity events
WHERE time < ?";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute([
- (TIME_NOW - 86400 * USER_CLEANUP_ACTIVITY_EVENT_LIFETIME)
+ TIME_NOW - 86400 * USER_CLEANUP_ACTIVITY_EVENT_LIFETIME
]);
// clean up profile visitors
WHERE time < ?";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute([
- (TIME_NOW - 86400 * USER_CLEANUP_PROFILE_VISITOR_LIFETIME)
+ TIME_NOW - 86400 * USER_CLEANUP_PROFILE_VISITOR_LIFETIME
]);
// tracked visits
WHERE execTime < ?";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute([
- (TIME_NOW - (86400 * 7))
+ TIME_NOW - (86400 * 7)
]);
// clean up session access log
)";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute([
- (TIME_NOW - (86400 * 30))
+ TIME_NOW - (86400 * 30)
]);
// clean up session log
WHERE lastActivityTime < ?";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute([
- (TIME_NOW - (86400 * 30))
+ TIME_NOW - (86400 * 30)
]);
// clean up search data
WHERE searchTime < ?";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute([
- (TIME_NOW - 86400)
+ TIME_NOW - 86400
]);
// clean up expired edit history entries
WHERE obsoletedAt < ?";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute([
- (TIME_NOW - 86400 * EDIT_HISTORY_EXPIRATION)
+ TIME_NOW - 86400 * EDIT_HISTORY_EXPIRATION
]);
}
}
WHERE time < ?";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute([
- (TIME_NOW - 86400 * USER_AUTHENTICATION_FAILURE_EXPIRATION)
+ TIME_NOW - 86400 * USER_AUTHENTICATION_FAILURE_EXPIRATION
]);
}
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute([
ModerationQueue::STATUS_DONE,
- (TIME_NOW - (86400 * 30))
+ TIME_NOW - (86400 * 30)
]);
$queueIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute([
0,
- (TIME_NOW - 7 * 24 * 3600)
+ TIME_NOW - 7 * 24 * 3600
]);
$userIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
$typeMatches = $regex->getMatches();
$columns[] = ['name' => $row['Field'], 'data' => [
- 'type' => ((empty($typeMatches)) ? $row['Type'] : $typeMatches[1]),
- 'length' => ((empty($typeMatches)) ? '' : $typeMatches[2]),
- 'notNull' => (($row['Null'] == 'YES') ? false : true),
- 'key' => (($row['Key'] == 'PRI') ? 'PRIMARY' : (($row['Key'] == 'UNI') ? 'UNIQUE' : '')),
+ 'type' => empty($typeMatches) ? $row['Type'] : $typeMatches[1],
+ 'length' => empty($typeMatches) ? '' : $typeMatches[2],
+ 'notNull' => ($row['Null'] == 'YES') ? false : true,
+ 'key' => ($row['Key'] == 'PRI') ? 'PRIMARY' : (($row['Key'] == 'UNI') ? 'UNIQUE' : ''),
'default' => $row['Default'],
- 'autoIncrement' => ($row['Extra'] == 'auto_increment' ? true : false)
+ 'autoIncrement' => $row['Extra'] == 'auto_increment' ? true : false
]];
}
public function fetchMap($keyColumn, $valueColumn, $uniqueKey = true) {
$map = [];
- while (($row = $this->fetchArray())) {
+ while ($row = $this->fetchArray()) {
$key = $row[$keyColumn];
$value = $row[$valueColumn];
$columnType = strtolower($matches[2][$i]);
$column['data'] = [
'type' => $columnType,
- 'notNull' => ((!empty($matches[4][$i]) && strtoupper($matches[4][$i]) == 'NOT NULL') ? true : false),
+ 'notNull' => (!empty($matches[4][$i]) && strtoupper($matches[4][$i]) == 'NOT NULL') ? true : false,
'default' => $matches[5][$i],
- 'autoIncrement' => (!empty($matches[6][$i]) ? true : false),
+ 'autoIncrement' => !empty($matches[6][$i]) ? true : false,
'key' => strtoupper($matches[7][$i])
];
if (!empty($matches[3][$i])) {
$columnType = strtolower($match[6]);
$columnData = [
'type' => $columnType,
- 'notNull' => ((!empty($match[8]) && strtoupper($match[8]) == 'NOT NULL') ? true : false),
- 'default' => (isset($match[9]) ? $match[9] : ''),
- 'autoIncrement' => (!empty($match[10]) ? true : false),
- 'key' => (!empty($match[11]) ? strtoupper($match[11]) : '')
+ 'notNull' => (!empty($match[8]) && strtoupper($match[8]) == 'NOT NULL') ? true : false,
+ 'default' => isset($match[9]) ? $match[9] : '',
+ 'autoIncrement' => !empty($match[10]) ? true : false,
+ 'key' => !empty($match[11]) ? strtoupper($match[11]) : ''
];
if (!empty($match[7])) {
if ($columnType == 'enum') $columnData['values'] = $match[7];
*/
public static function getHost() {
if (self::$host === null) {
- self::$host = (isset($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : '';
+ self::$host = isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : '';
if (empty(self::$host)) {
self::$host = gethostname();
if (self::$host === false) {
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute([
WCF::getSession()->sessionID,
- (TIME_NOW - SESSION_TIMEOUT)
+ TIME_NOW - SESSION_TIMEOUT
]);
$row = $statement->fetchArray();
if (!empty($row['sessionLogID'])) {
* @return string
*/
protected function getErrorClass() {
- return ($this->getError()) ? ' class="formError"' : '';
+ return $this->getError() ? ' class="formError"' : '';
}
/**
* @return string
*/
protected function getErrorField() {
- return ($this->getError()) ? '<small class="innerError">'.$this->getError().'</small>' : '';
+ return $this->getError() ? '<small class="innerError">'.$this->getError().'</small>' : '';
}
}
* @inheritDoc
*/
public function isAllowed(AbstractHtmlNodeProcessor $nodeProcessor) {
- return (BBCodeHandler::getInstance()->isAvailableBBCode('img')) ? [] : ['img'];
+ return BBCodeHandler::getInstance()->isAvailableBBCode('img') ? [] : ['img'];
}
/**
$attributes = $htmlNodeProcessor->parseAttributes($element->getAttribute('data-attributes'));
// check for converters
- $converter = (isset($converters[$name])) ? $converters[$name] : null;
+ $converter = isset($converters[$name]) ? $converters[$name] : null;
if ($converter === null) {
$className = 'wcf\\system\\html\\metacode\\converter\\' . $name . 'MetacodeConverter';
if (class_exists($className)) {
$bbcode = BBCodeCache::getInstance()->getBBCodeByTag($name);
if ($bbcode !== null) {
$bbcodeAttributes = $bbcode->getAttributes();
- $attr = (isset($bbcodeAttributes[0])) ? $bbcodeAttributes[0] : null;
+ $attr = isset($bbcodeAttributes[0]) ? $bbcodeAttributes[0] : null;
if ($attr !== null && $attr->useText && !empty($attributes[0]) && StringUtil::trim($attributes[0]) == StringUtil::trim($element->textContent)) {
// discard content as it is already present in the first attribute
throw new \InvalidArgumentException("Must provide an existing element for start node or end node, both cannot be null.");
}
- $element = ($startNode) ? $startNode->ownerDocument->createElement('woltlab-metacode') : $endNode->ownerDocument->createElement('woltlab-metacode');
+ $element = $startNode ? $startNode->ownerDocument->createElement('woltlab-metacode') : $endNode->ownerDocument->createElement('woltlab-metacode');
$element->setAttribute('data-name', $name);
$element->setAttribute('data-attributes', $attributes);
/** @var \DOMElement $end */
$end = $pair['close'];
- $attributes = (isset($pair['attributes'])) ? $pair['attributes'] : '';
- $textNode = $start->ownerDocument->createTextNode(($pair['openSource']) ?: HtmlBBCodeParser::getInstance()->buildBBCodeTag($name, $attributes, true));
+ $attributes = isset($pair['attributes']) ? $pair['attributes'] : '';
+ $textNode = $start->ownerDocument->createTextNode($pair['openSource'] ?: HtmlBBCodeParser::getInstance()->buildBBCodeTag($name, $attributes, true));
DOMUtil::insertBefore($textNode, $start);
DOMUtil::removeNode($start);
- $textNode = $end->ownerDocument->createTextNode(($pair['closeSource']) ?: '[/' . $name . ']');
+ $textNode = $end->ownerDocument->createTextNode($pair['closeSource'] ?: '[/' . $name . ']');
DOMUtil::insertBefore($textNode, $end);
DOMUtil::removeNode($end);
}
*/
public function convert(\DOMDocumentFragment $fragment, array $attributes) {
$element = $fragment->ownerDocument->createElement('blockquote');
- $element->setAttribute('data-quote-title', (isset($attributes[0])) ? $attributes[0] : '');
- $element->setAttribute('data-quote-url', (isset($attributes[1])) ? $attributes[1] : '');
+ $element->setAttribute('data-quote-title', isset($attributes[0]) ? $attributes[0] : '');
+ $element->setAttribute('data-quote-url', isset($attributes[1]) ? $attributes[1] : '');
$element->appendChild($fragment);
return $element;
'content' => $element->textContent,
'file' => $element->getAttribute('data-file'),
'highlighter' => $element->getAttribute('data-highlighter'),
- 'line' => ($element->hasAttribute('data-line')) ? $element->getAttribute('data-line') : 1
+ 'line' => $element->hasAttribute('data-line') ? $element->getAttribute('data-line') : 1
]);
$htmlNodeProcessor->renameTag($element, 'wcfNode-' . $nodeIdentifier);
*/
public function rotate($degrees) {
// imagerotate interpretes degrees as counter-clockwise
- return imagerotate($this->image, (360.0 - $degrees), ($this->color ?: 0));
+ return imagerotate($this->image, 360.0 - $degrees, ($this->color ?: 0));
}
/**
*/
public function __construct($filename, $mode = 'wb') {
if (self::$gzopen64 === null) {
- self::$gzopen64 = (function_exists('gzopen64'));
+ self::$gzopen64 = function_exists('gzopen64');
}
$this->filename = $filename;
}
if (($header['size'] % 512) != 0) {
$buffer = $this->file->read(512);
- $content .= substr($buffer, 0, ($header['size'] % 512));
+ $content .= substr($buffer, 0, $header['size'] % 512);
}
return $content;
$i++;
}
- $this->file->seek($this->file->tell() + (512 * ceil(($header['size'] / 512))));
+ $this->file->seek($this->file->tell() + (512 * ceil($header['size'] / 512)));
}
}
}
$i = 0;
- while (($buffer = substr($string, (($i++) * 512), 512)) != '') {
+ while (($buffer = substr($string, ($i++) * 512, 512)) != '') {
$this->file->write(pack('a512', $buffer));
}
$this->file->write($binaryDataLast, 356);
$i = 0;
- while (($buffer = substr($filename, (($i++) * 512), 512)) != '') {
+ while (($buffer = substr($filename, ($i++) * 512, 512)) != '') {
$this->file->write(pack('a512', $buffer));
}
if ($legacyReturnValue) {
// WCF 2.0: boolean true/false
- return (empty($validationErrors));
+ return empty($validationErrors);
}
else {
// WCF 2.1+: detailed error report (empty array if validation passed)
$statement->execute([
$languageID,
$languageVariable,
- (isset($this->i18nValues[$elementID]) ? $this->i18nValues[$elementID][$languageID] : $this->plainValues[$elementID]),
+ isset($this->i18nValues[$elementID]) ? $this->i18nValues[$elementID][$languageID] : $this->plainValues[$elementID],
0,
$languageCategoryID,
$packageID
foreach ($updateLanguageIDs as $languageID) {
$statement->execute([
- (isset($this->i18nValues[$elementID]) ? $this->i18nValues[$elementID][$languageID] : $this->plainValues[$elementID]),
+ isset($this->i18nValues[$elementID]) ? $this->i18nValues[$elementID][$languageID] : $this->plainValues[$elementID],
0,
$languageItemIDs[$languageID]
]);
$likeObject = LikeObjectEditor::create([
'objectTypeID' => $likeable->getObjectType()->objectTypeID,
'objectID' => $likeable->getObjectID(),
- 'objectUserID' => ($likeable->getUserID() ?: null),
+ 'objectUserID' => $likeable->getUserID() ?: null,
'likes' => ($likeValue == Like::LIKE) ? 1 : 0,
'dislikes' => ($likeValue == Like::DISLIKE) ? 1 : 0,
'cumulativeLikes' => $cumulativeLikes,
if ($like->likeID) {
$userEditor = new UserEditor(new User($likeable->getUserID()));
$userEditor->updateCounters([
- 'likesReceived' => ($like->likeValue == Like::LIKE ? -1 : 1)
+ 'likesReceived' => $like->likeValue == Like::LIKE ? -1 : 1
]);
}
else if ($likeValue == Like::LIKE) {
$like = LikeEditor::create([
'objectID' => $likeable->getObjectID(),
'objectTypeID' => $likeable->getObjectType()->objectTypeID,
- 'objectUserID' => ($likeable->getUserID() ?: null),
+ 'objectUserID' => $likeable->getUserID() ?: null,
'userID' => $user->userID,
'time' => $time,
'likeValue' => $likeValue
* @param string $name filename
*/
public function addAttachment($path, $name = '') {
- $this->attachments[] = ['path' => $path, 'name' => ($name ?: basename($path))];
+ $this->attachments[] = ['path' => $path, 'name' => $name ?: basename($path)];
}
/**
throw new SystemException($this->formatError("can not connect to '".MAIL_SMTP_HOST.":".MAIL_SMTP_PORT."'"));
}
- $host = (isset($_SERVER['HTTP_HOST'])) ? $_SERVER['HTTP_HOST'] : '';
+ $host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '';
if (empty($host)) {
$host = gethostname();
if ($host === false) {
throw new SystemException($this->formatError("smtp error"));
}
- $serverName = (isset($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : '';
+ $serverName = isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : '';
if (empty($serverName)) {
$serverName = gethostname();
if ($serverName === false) {
*/
public function getActiveMenuItem($level = 0) {
if ($level < count($this->activeMenuItems)) {
- return $this->activeMenuItems[(count($this->activeMenuItems) - ($level + 1))];
+ return $this->activeMenuItems[count($this->activeMenuItems) - ($level + 1)];
}
return null;
}
'commentObjectTypeID' => $this->objectTypeID,
'userID' => $userID,
'lastCommentTime' => $commentList->getMinCommentTime(),
- 'likeData' => (MODULE_LIKE ? $commentList->getLikeData() : [])
+ 'likeData' => MODULE_LIKE ? $commentList->getLikeData() : []
]);
return WCF::getTPL()->fetch('userProfileCommentList');
throw new UserInputException('message', WCF::getLanguage()->get('wcf.global.form.error.empty'));
}
- $parameters['lastPostTime'] = (isset($parameters['lastPostTime'])) ? intval($parameters['lastPostTime']) : 0;
+ $parameters['lastPostTime'] = isset($parameters['lastPostTime']) ? intval($parameters['lastPostTime']) : 0;
if (!$parameters['lastPostTime']) {
throw new UserInputException('lastPostTime');
}
- $parameters['pageNo'] = (isset($parameters['pageNo'])) ? intval($parameters['pageNo']) : 0;
+ $parameters['pageNo'] = isset($parameters['pageNo']) ? intval($parameters['pageNo']) : 0;
if (!$parameters['pageNo']) {
throw new UserInputException('pageNo');
}
- $parameters['objectID'] = (isset($parameters['objectID'])) ? intval($parameters['objectID']) : 0;
+ $parameters['objectID'] = isset($parameters['objectID']) ? intval($parameters['objectID']) : 0;
if (!$parameters['objectID']) {
throw new UserInputException('objectID');
}
// update visit time (messages shouldn't occur as new upon next visit)
if (is_subclass_of($containerActionClassName, IVisitableObjectAction::class)) {
/** @var IDatabaseObjectAction $containerAction */
- $containerAction = new $containerActionClassName([($this->container instanceof DatabaseObjectDecorator ? $this->container->getDecoratedObject() : $this->container)], 'markAsRead');
+ $containerAction = new $containerActionClassName([$this->container instanceof DatabaseObjectDecorator ? $this->container->getDecoratedObject() : $this->container], 'markAsRead');
$containerAction->executeAction();
}
if ($position + mb_strlen($word) < mb_strlen($censoredWord)) {
// look ahead
- if (($newIndex = $this->lookAhead($i + 1, mb_substr($censoredWord, $position + mb_strlen($word))))) {
+ if ($newIndex = $this->lookAhead($i + 1, mb_substr($censoredWord, $position + mb_strlen($word)))) {
$i = $newIndex;
}
else {
return true;
}
else if (mb_strpos($search, $this->words[$index]) === (mb_strlen($search) - mb_strlen($this->words[$index]))) {
- return $this->lookBehind($index - 1, mb_substr($search, 0, (mb_strlen($search) - mb_strlen($this->words[$index]))));
+ return $this->lookBehind($index - 1, mb_substr($search, 0, mb_strlen($search) - mb_strlen($this->words[$index])));
}
}
// load stored quotes from session
$messageQuotes = WCF::getSession()->getVar('__messageQuotes'.$this->packageID);
if (is_array($messageQuotes)) {
- $this->quotes = (isset($messageQuotes['quotes'])) ? $messageQuotes['quotes'] : [];
- $this->quoteData = (isset($messageQuotes['quoteData'])) ? $messageQuotes['quoteData'] : [];
- $this->removeQuoteIDs = (isset($messageQuotes['removeQuoteIDs'])) ? $messageQuotes['removeQuoteIDs'] : [];
+ $this->quotes = isset($messageQuotes['quotes']) ? $messageQuotes['quotes'] : [];
+ $this->quoteData = isset($messageQuotes['quoteData']) ? $messageQuotes['quoteData'] : [];
+ $this->removeQuoteIDs = isset($messageQuotes['removeQuoteIDs']) ? $messageQuotes['removeQuoteIDs'] : [];
}
// load object types
'objectTypeID' => $objectTypeID,
'objectID' => $objectID,
'containerID' => $containerID,
- 'userID' => (WCF::getUser()->userID ?: null),
+ 'userID' => WCF::getUser()->userID ?: null,
'time' => TIME_NOW,
'additionalData' => serialize($additionalData)
]
'data' => [
'status' => ModerationQueue::STATUS_OUTSTANDING,
'containerID' => $containerID,
- 'userID' => (WCF::getUser()->userID ?: null),
+ 'userID' => WCF::getUser()->userID ?: null,
'time' => TIME_NOW,
'additionalData' => serialize($additionalData)
]
$statement->execute([
$queueID,
WCF::getUser()->userID,
- ($isAffected ? 1 : 0)
+ $isAffected ? 1 : 0
]);
}
WCF::getDB()->commitTransaction();
'objectTypeID' => $objectTypeID,
'objectID' => $objectID,
'containerID' => $containerID,
- 'userID' => (WCF::getUser()->userID ?: null),
+ 'userID' => WCF::getUser()->userID ?: null,
'time' => TIME_NOW,
'additionalData' => serialize($additionalData)
]
'data' => [
'status' => ModerationQueue::STATUS_OUTSTANDING,
'containerID' => $containerID,
- 'userID' => (WCF::getUser()->userID ?: null),
+ 'userID' => WCF::getUser()->userID ?: null,
'time' => TIME_NOW,
'additionalData' => serialize($additionalData)
]
WCF::getTPL()->assign([
'categoryList' => $categoryList,
'option' => $option,
- 'value' => (!is_array($value) ? explode("\n", $value) : $value)
+ 'value' => !is_array($value) ? explode("\n", $value) : $value
]);
return WCF::getTPL()->fetch('categoryMultiSelectOptionType');
}
return 0;
}
- return ($value1) ? 1 : -1;
+ return $value1 ? 1 : -1;
}
}
throw new \RuntimeException("Message object type '".$option->optionName."' requires an object type for definition 'com.woltlab.wcf.message'.");
}
- $permission = ($option->disallowedbbcodepermission) ?: 'user.message.disallowedBBCodes';
+ $permission = $option->disallowedbbcodepermission ?: 'user.message.disallowedBBCodes';
BBCodeHandler::getInstance()->setDisallowedBBCodes(explode(',', ArrayUtil::trim(WCF::getSession()->getPermission($permission))));
$this->htmlInputProcessor = new HtmlInputProcessor();
* @inheritDoc
*/
public function getFormElement(Option $option, $value) {
- $permission = ($option->disallowedbbcodepermission) ?: 'user.message.disallowedBBCodes';
+ $permission = $option->disallowedbbcodepermission ?: 'user.message.disallowedBBCodes';
BBCodeHandler::getInstance()->setDisallowedBBCodes(explode(',', ArrayUtil::trim(WCF::getSession()->getPermission($permission))));
WCF::getTPL()->assign([
WCF::getTPL()->assign([
'option' => $option,
'selectOptions' => $this->getSelectOptions($option),
- 'value' => (!is_array($value) ? explode("\n", $value) : $value)
+ 'value' => !is_array($value) ? explode("\n", $value) : $value
]);
return WCF::getTPL()->fetch($this->formElementTemplate);
}
'option' => $option,
'searchOption' => $value !== null && ($value !== $option->defaultValue || isset($_POST['searchOptions'][$option->optionName])),
'selectOptions' => $this->getSelectOptions($option),
- 'value' => (!is_array($value) ? explode("\n", $value) : $value)
+ 'value' => !is_array($value) ? explode("\n", $value) : $value
]);
return WCF::getTPL()->fetch($this->searchableFormElementTemplate);
}
return [
'object' => $option,
- 'value' => (isset($this->optionValues[$option->optionName]) ? $this->optionValues[$option->optionName] : null),
+ 'value' => isset($this->optionValues[$option->optionName]) ? $this->optionValues[$option->optionName] : null,
'html' => $html,
'cssClassName' => $this->getTypeObject($option->optionType)->getCSSClassName(),
'hideLabelInSearch' => $this->getTypeObject($option->optionType)->hideLabelInSearch()
'option' => $option,
'selectOptions' => $this->getSelectOptions($option),
'value' => $value,
- 'allowEmptyValue' => ($this->allowEmptyValue || $option->allowEmptyValue)
+ 'allowEmptyValue' => $this->allowEmptyValue || $option->allowEmptyValue
]);
return WCF::getTPL()->fetch('selectOptionType');
}
WCF::getTPL()->assign([
'option' => $option,
'selectOptions' => $timezoneOptions,
- 'value' => ($value ?: TIMEZONE)
+ 'value' => $value ?: TIMEZONE
]);
return WCF::getTPL()->fetch('selectOptionType');
}
* @inheritDoc
*/
public function compare($value1, $value2) {
- $value1 = ($value1) ? explode(',', $value1) : [];
- $value2 = ($value2) ? explode(',', $value2) : [];
+ $value1 = $value1 ? explode(',', $value1) : [];
+ $value2 = $value2 ? explode(',', $value2) : [];
// check if value1 contains more elements than value2
$diff = array_diff($value1, $value2);
$statement->execute([
$this->queue->packageID,
$excludedPackage['name'],
- (!empty($excludedPackage['version']) ? $excludedPackage['version'] : '')
+ !empty($excludedPackage['version']) ? $excludedPackage['version'] : ''
]);
}
}
$directory = WCF::getSession()->getVar('__wcfSetup_directories');
if ($directory !== null) {
$abbreviation = Package::getAbbreviation($this->getPackage()->package);
- $directory = (isset($directory[$abbreviation])) ? $directory[$abbreviation] : null;
+ $directory = isset($directory[$abbreviation]) ? $directory[$abbreviation] : null;
}
if ($directory === null && !PackageInstallationFormManager::findForm($this->queue, 'packageDir')) {
// validate extensions
if (isset($requirements['extensions'])) {
foreach ($requirements['extensions'] as $extension) {
- $passed = (extension_loaded($extension)) ? true : false;
+ $passed = extension_loaded($extension) ? true : false;
if (!$passed) {
$errors['extension'][] = [
// handle values considered as 'true'
if (in_array($value, $trueValues)) {
- return ($compareValue) ? true : false;
+ return $compareValue ? true : false;
}
// handle values considered as 'false'
else if (in_array($value, $falseValues)) {
* @param PackageInstallationQueue $queue
*/
public static function handleRequest(PackageInstallationQueue $queue) {
- $formName = (isset($_REQUEST['formName'])) ? StringUtil::trim($_REQUEST['formName']) : '';
+ $formName = isset($_REQUEST['formName']) ? StringUtil::trim($_REQUEST['formName']) : '';
// ignore request
if (empty($formName) || !self::findForm($queue, $formName)) return;
// requirements will be checked once package is about to be installed
$this->requirements[$packageName] = [
- 'minVersion' => (isset($package['minversion'])) ? $package['minversion'] : '',
+ 'minVersion' => isset($package['minversion']) ? $package['minversion'] : '',
'packageID' => $package['packageID']
];
'packageID' => $packageID,
'packageName' => $archive->getLocalizedPackageInfo('packageName'),
'archive' => $fileName,
- 'action' => ($packageID ? 'update' : 'install')
+ 'action' => $packageID ? 'update' : 'install'
]);
self::$pendingPackages[$archive->getPackageInfo('name')] = $archive->getPackageInfo('version');
catch (SystemException $e) {
$reply = $request->getReply();
- $statusCode = (is_array($reply['statusCode'])) ? reset($reply['statusCode']) : $reply['statusCode'];
+ $statusCode = is_array($reply['statusCode']) ? reset($reply['statusCode']) : $reply['statusCode'];
// status code 0 is a connection timeout
if (!$statusCode && $secureConnection) {
if (preg_match('~https?://(?:update|store)\.woltlab\.com~', $updateServer->serverURL)) {
foreach ($elements as $element) {
$versionNo = $element->getAttribute('name');
$packageInfo['versions'][$versionNo] = [
- 'isAccessible' => ($element->getAttribute('accessible') == 'true' ? true : false)
+ 'isAccessible' => $element->getAttribute('accessible') == 'true' ? true : false
];
$children = $xpath->query('child::*', $element);
case 'license':
$packageInfo['versions'][$versionNo]['license'] = [
'license' => $child->nodeValue,
- 'licenseURL' => ($child->hasAttribute('url') ? $child->getAttribute('url') : '')
+ 'licenseURL' => $child->hasAttribute('url') ? $child->getAttribute('url') : ''
];
break;
}
// create new database entry
$version = PackageUpdateVersionEditor::create([
'filename' => $packageFile,
- 'license' => (isset($versionData['license']['license']) ? $versionData['license']['license'] : ''),
- 'licenseURL' => (isset($versionData['license']['license']) ? $versionData['license']['licenseURL'] : ''),
- 'isAccessible' => ($versionData['isAccessible'] ? 1 : 0),
+ 'license' => isset($versionData['license']['license']) ? $versionData['license']['license'] : '',
+ 'licenseURL' => isset($versionData['license']['license']) ? $versionData['license']['licenseURL'] : '',
+ 'isAccessible' => $versionData['isAccessible'] ? 1 : 0,
'packageDate' => $versionData['packageDate'],
'packageUpdateID' => $packageUpdateID,
'packageVersion' => $packageVersion
$requirementInserts[] = [
'packageUpdateVersionID' => $packageUpdateVersionID,
'package' => $requiredIdentifier,
- 'minversion' => (isset($required['minversion']) ? $required['minversion'] : '')
+ 'minversion' => isset($required['minversion']) ? $required['minversion'] : ''
];
}
}
$excludedPackagesParameters[] = [
'packageUpdateVersionID' => $packageUpdateVersionID,
'excludedPackage' => $excludedIdentifier,
- 'excludedPackageVersion' => (isset($exclusion['version']) ? $exclusion['version'] : '')
+ 'excludedPackageVersion' => isset($exclusion['version']) ? $exclusion['version'] : ''
];
}
}
}
$data = [
- 'categoryName' => (isset($data['categoryname'])) ? $data['categoryname'] : '',
+ 'categoryName' => isset($data['categoryname']) ? $data['categoryname'] : '',
'optionName' => $element->getAttribute('name'),
'objectTypeID' => $objectTypeID
];
protected function prepareImport(array $data) {
$returnValue = parent::prepareImport($data);
- $returnValue['icon'] = (isset($data['elements']['icon'])) ? $data['elements']['icon'] : '';
+ $returnValue['icon'] = isset($data['elements']['icon']) ? $data['elements']['icon'] : '';
return $returnValue;
}
*/
protected function prepareImport(array $data) {
// get show order
- $showOrder = (isset($data['elements']['showorder'])) ? $data['elements']['showorder'] : null;
+ $showOrder = isset($data['elements']['showorder']) ? $data['elements']['showorder'] : null;
$showOrder = $this->getShowOrder($showOrder);
return [
*/
protected function prepareImport(array $data) {
// adjust show order
- $showOrder = (isset($data['elements']['showorder'])) ? $data['elements']['showorder'] : null;
- $parent = (isset($data['elements']['parent'])) ? $data['elements']['parent'] : '';
+ $showOrder = isset($data['elements']['showorder']) ? $data['elements']['showorder'] : null;
+ $parent = isset($data['elements']['parent']) ? $data['elements']['parent'] : '';
$showOrder = $this->getShowOrder($showOrder, $parent, 'parentMenuItem');
// merge values and default values
return [
'menuItem' => $data['attributes']['name'],
'menuItemController' => isset($data['elements']['controller']) ? $data['elements']['controller'] : '',
- 'menuItemLink' => (isset($data['elements']['link'])) ? $data['elements']['link'] : '',
- 'options' => (isset($data['elements']['options'])) ? $data['elements']['options'] : '',
- 'parentMenuItem' => (isset($data['elements']['parent'])) ? $data['elements']['parent'] : '',
- 'permissions' => (isset($data['elements']['permissions'])) ? $data['elements']['permissions'] : '',
+ 'menuItemLink' => isset($data['elements']['link']) ? $data['elements']['link'] : '',
+ 'options' => isset($data['elements']['options']) ? $data['elements']['options'] : '',
+ 'parentMenuItem' => isset($data['elements']['parent']) ? $data['elements']['parent'] : '',
+ 'permissions' => isset($data['elements']['permissions']) ? $data['elements']['permissions'] : '',
'showOrder' => $showOrder
];
}
// build data block with defaults
$data = [
'categoryName' => $element->getAttribute('name'),
- 'options' => (isset($data['options'])) ? $data['options'] : '',
- 'parentCategoryName' => (isset($data['parent'])) ? $data['parent'] : '',
- 'permissions' => (isset($data['permissions'])) ? $data['permissions'] : '',
- 'showOrder' => (isset($data['showorder'])) ? intval($data['showorder']) : null
+ 'options' => isset($data['options']) ? $data['options'] : '',
+ 'parentCategoryName' => isset($data['parent']) ? $data['parent'] : '',
+ 'permissions' => isset($data['permissions']) ? $data['permissions'] : '',
+ 'showOrder' => isset($data['showorder']) ? intval($data['showorder']) : null
];
// adjust show order
*/
protected function getI18nValues(array $values, $singleValueOnly = false) {
if (empty($values)) {
- return ($singleValueOnly) ? '' : [];
+ return $singleValueOnly ? '' : [];
}
// check for a value with an empty language code and treat it as 'en' unless 'en' exists
protected function prepareImport(array $data) {
$data = [
'bbcodeTag' => mb_strtolower(StringUtil::trim($data['attributes']['name'])),
- 'htmlOpen' => (!empty($data['elements']['htmlopen']) ? $data['elements']['htmlopen'] : ''),
- 'htmlClose' => (!empty($data['elements']['htmlclose']) ? $data['elements']['htmlclose'] : ''),
- 'wysiwygIcon' => (!empty($data['elements']['wysiwygicon']) ? $data['elements']['wysiwygicon'] : ''),
- 'attributes' => (isset($data['elements']['attributes']) ? $data['elements']['attributes'] : []),
- 'className' => (!empty($data['elements']['classname']) ? $data['elements']['classname'] : ''),
- 'isBlockElement' => (!empty($data['elements']['isBlockElement']) ? 1 : 0),
- 'isSourceCode' => (!empty($data['elements']['sourcecode']) ? 1 : 0),
- 'buttonLabel' => (isset($data['elements']['buttonlabel']) ? $data['elements']['buttonlabel'] : ''),
+ 'htmlOpen' => !empty($data['elements']['htmlopen']) ? $data['elements']['htmlopen'] : '',
+ 'htmlClose' => !empty($data['elements']['htmlclose']) ? $data['elements']['htmlclose'] : '',
+ 'wysiwygIcon' => !empty($data['elements']['wysiwygicon']) ? $data['elements']['wysiwygicon'] : '',
+ 'attributes' => isset($data['elements']['attributes']) ? $data['elements']['attributes'] : [],
+ 'className' => !empty($data['elements']['classname']) ? $data['elements']['classname'] : '',
+ 'isBlockElement' => !empty($data['elements']['isBlockElement']) ? 1 : 0,
+ 'isSourceCode' => !empty($data['elements']['sourcecode']) ? 1 : 0,
+ 'buttonLabel' => isset($data['elements']['buttonlabel']) ? $data['elements']['buttonlabel'] : '',
'originIsSystem' => 1
];
BBCodeAttributeEditor::create([
'bbcodeID' => $bbcodeID,
'attributeNo' => $attributeNo,
- 'attributeHtml' => (!empty($attribute['html']) ? $attribute['html'] : ''),
- 'validationPattern' => (!empty($attribute['validationpattern']) ? $attribute['validationpattern'] : ''),
- 'required' => (!empty($attribute['required']) ? $attribute['required'] : 0),
- 'useText' => (!empty($attribute['usetext']) ? $attribute['usetext'] : 0)
+ 'attributeHtml' => !empty($attribute['html']) ? $attribute['html'] : '',
+ 'validationPattern' => !empty($attribute['validationpattern']) ? $attribute['validationpattern'] : '',
+ 'required' => !empty($attribute['required']) ? $attribute['required'] : 0,
+ 'useText' => !empty($attribute['usetext']) ? $attribute['usetext'] : 0
]);
}
}
'position' => $position,
'showOrder' => $this->getItemOrder($position),
'visibleEverywhere' => (!empty($data['elements']['visibleEverywhere'])) ? 1 : 0,
- 'isMultilingual' => ($isMultilingual) ? '1' : '0',
+ 'isMultilingual' => $isMultilingual ? '1' : '0',
'cssClassName' => (!empty($data['elements']['cssClassName'])) ? $data['elements']['cssClassName'] : '',
'showHeader' => (!empty($data['elements']['showHeader'])) ? 1 : 0,
'originIsSystem' => 1,
// save page ids
foreach ($pageIDs as $pageID) {
- $insertStatement->execute([$boxes[$boxIdentifier]->boxID, $pageID, ($boxes[$boxIdentifier]->visibleEverywhere ? 0 : 1)]);
+ $insertStatement->execute([$boxes[$boxIdentifier]->boxID, $pageID, $boxes[$boxIdentifier]->visibleEverywhere ? 0 : 1]);
}
}
}
* @inheritDoc
*/
protected function prepareImport(array $data) {
- $showOrder = (isset($data['elements']['showorder'])) ? intval($data['elements']['showorder']) : null;
+ $showOrder = isset($data['elements']['showorder']) ? intval($data['elements']['showorder']) : null;
$showOrder = $this->getShowOrder($showOrder, $data['elements']['actionclassname'], 'actionClassName');
return [
*/
protected function prepareImport(array $data) {
return [
- 'canBeDisabled' => (isset($data['elements']['canbedisabled'])) ? intval($data['elements']['canbedisabled']) : 1,
- 'canBeEdited' => (isset($data['elements']['canbeedited'])) ? intval($data['elements']['canbeedited']) : 1,
- 'className' => (isset($data['elements']['classname'])) ? $data['elements']['classname'] : '',
- 'cronjobName' => (isset($data['attributes']['name']) ? $data['attributes']['name'] : ''),
- 'description' => (isset($data['elements']['description'])) ? $data['elements']['description'] : '',
- 'isDisabled' => (isset($data['elements']['isdisabled'])) ? intval($data['elements']['isdisabled']) : 0,
- 'options' => (isset($data['elements']['options'])) ? $data['elements']['options'] : '',
+ 'canBeDisabled' => isset($data['elements']['canbedisabled']) ? intval($data['elements']['canbedisabled']) : 1,
+ 'canBeEdited' => isset($data['elements']['canbeedited']) ? intval($data['elements']['canbeedited']) : 1,
+ 'className' => isset($data['elements']['classname']) ? $data['elements']['classname'] : '',
+ 'cronjobName' => isset($data['attributes']['name']) ? $data['attributes']['name'] : '',
+ 'description' => isset($data['elements']['description']) ? $data['elements']['description'] : '',
+ 'isDisabled' => isset($data['elements']['isdisabled']) ? intval($data['elements']['isdisabled']) : 0,
+ 'options' => isset($data['elements']['options']) ? $data['elements']['options'] : '',
'startDom' => $data['elements']['startdom'],
'startDow' => $data['elements']['startdow'],
'startHour' => $data['elements']['starthour'],
if (!isset($item['attributes']['name'])) {
$legacyStatement->execute([
$this->installation->getPackageID(),
- (isset($item['elements']['environment']) ? $item['elements']['environment'] : 'user'),
+ isset($item['elements']['environment']) ? $item['elements']['environment'] : 'user',
$item['elements']['eventclassname'],
$item['elements']['eventname'],
- (isset($item['elements']['inherit'])) ? $item['elements']['inherit'] : 0,
+ isset($item['elements']['inherit']) ? $item['elements']['inherit'] : 0,
$item['elements']['listenerclassname']
]);
}
* @inheritDoc
*/
protected function prepareImport(array $data) {
- $nice = (isset($data['elements']['nice'])) ? intval($data['elements']['nice']) : 0;
+ $nice = isset($data['elements']['nice']) ? intval($data['elements']['nice']) : 0;
if ($nice < -128) $nice = -128;
else if ($nice > 127) $nice = 127;
return [
- 'environment' => (isset($data['elements']['environment']) ? $data['elements']['environment'] : 'user'),
+ 'environment' => isset($data['elements']['environment']) ? $data['elements']['environment'] : 'user',
'eventClassName' => $data['elements']['eventclassname'],
'eventName' => $data['elements']['eventname'],
- 'inherit' => (isset($data['elements']['inherit'])) ? intval($data['elements']['inherit']) : 0,
+ 'inherit' => isset($data['elements']['inherit']) ? intval($data['elements']['inherit']) : 0,
'listenerClassName' => $data['elements']['listenerclassname'],
- 'listenerName' => (isset($data['attributes']['name']) ? $data['attributes']['name'] : ''),
+ 'listenerName' => isset($data['attributes']['name']) ? $data['attributes']['name'] : '',
'niceValue' => $nice,
- 'options' => (isset($data['elements']['options']) ? $data['elements']['options'] : ''),
- 'permissions' => (isset($data['elements']['permissions']) ? $data['elements']['permissions'] : '')
+ 'options' => isset($data['elements']['options']) ? $data['elements']['options'] : '',
+ 'permissions' => isset($data['elements']['permissions']) ? $data['elements']['permissions'] : ''
];
}
WHERE " . ($parentItemID === null ? 'menuID' : 'parentItemID') . " = ?";
$statement = WCF::getDB()->prepareStatement($sql, 1);
$statement->execute([
- ($parentItemID === null ? $menuID : $parentItemID)
+ $parentItemID === null ? $menuID : $parentItemID
]);
$row = $statement->fetchSingleRow();
'name' => $this->getI18nValues($data['elements']['title'], true),
'boxType' => 'menu',
'position' => $position,
- 'showHeader' => (!empty($data['elements']['box']['showHeader']) ? 1 : 0),
- 'visibleEverywhere' => (!empty($data['elements']['box']['visibleEverywhere']) ? 1 : 0),
+ 'showHeader' => !empty($data['elements']['box']['showHeader']) ? 1 : 0,
+ 'visibleEverywhere' => !empty($data['elements']['box']['visibleEverywhere']) ? 1 : 0,
'cssClassName' => (!empty($data['elements']['box']['cssClassName'])) ? $data['elements']['box']['cssClassName'] : '',
'originIsSystem' => 1,
'packageID' => $this->installation->getPackageID()
// save page ids
foreach ($pageIDs as $pageID) {
- $insertStatement->execute([$box->boxID, $pageID, ($box->visibleEverywhere ? 0 : 1)]);
+ $insertStatement->execute([$box->boxID, $pageID, $box->visibleEverywhere ? 0 : 1]);
}
}
}
*/
protected function prepareImport(array $data) {
return [
- 'interfaceName' => (isset($data['elements']['interfacename']) ? $data['elements']['interfacename'] : ''),
+ 'interfaceName' => isset($data['elements']['interfacename']) ? $data['elements']['interfacename'] : '',
'definitionName' => $data['elements']['name'],
- 'categoryName' => (isset($data['elements']['categoryname']) ? $data['elements']['categoryname'] : '')
+ 'categoryName' => isset($data['elements']['categoryname']) ? $data['elements']['categoryname'] : ''
];
}
return [
'definitionID' => $this->getDefinitionID($data['elements']['definitionname']),
'objectType' => $data['elements']['name'],
- 'className' => (isset($data['elements']['classname']) ? $data['elements']['classname'] : ''),
+ 'className' => isset($data['elements']['classname']) ? $data['elements']['classname'] : '',
'additionalData' => serialize($additionalData)
];
}
return [
'className' => $data['nodeValue'],
'pluginName' => $data['attributes']['name'],
- 'priority' => ($this->installation->getPackage()->package == 'com.woltlab.wcf' ? 1 : 0)
+ 'priority' => $this->installation->getPackage()->package == 'com.woltlab.wcf' ? 1 : 0
];
}
'parentPageID' => $parentPageID,
'applicationPackageID' => $applicationPackageID,
'requireObjectID' => (!empty($data['elements']['requireObjectID'])) ? 1 : 0,
- 'options' => (isset($data['elements']['options'])) ? $data['elements']['options'] : '',
- 'permissions' => (isset($data['elements']['permissions'])) ? $data['elements']['permissions'] : '',
+ 'options' => isset($data['elements']['options']) ? $data['elements']['options'] : '',
+ 'permissions' => isset($data['elements']['permissions']) ? $data['elements']['permissions'] : '',
'hasFixedParent' => ($pageType == 'system' && !empty($data['elements']['hasFixedParent'])) ? 1 : 0
];
}
'smileyCode' => $data['attributes']['name'],
'smileyTitle' => $data['elements']['title'],
'smileyPath' => $data['elements']['path'],
- 'aliases' => (isset($data['elements']['aliases']) ? $data['elements']['aliases'] : ''),
+ 'aliases' => isset($data['elements']['aliases']) ? $data['elements']['aliases'] : '',
'showOrder' => $showOrder
];
}
'eventName' => $data['elements']['eventname'],
'niceValue' => $niceValue,
'name' => $data['attributes']['name'],
- 'options' => (isset($data['elements']['options']) ? $data['elements']['options'] : ''),
- 'permissions' => (isset($data['elements']['permissions']) ? $data['elements']['permissions'] : ''),
+ 'options' => isset($data['elements']['options']) ? $data['elements']['options'] : '',
+ 'permissions' => isset($data['elements']['permissions']) ? $data['elements']['permissions'] : '',
'templateCode' => $data['elements']['templatecode'],
'templateName' => $data['elements']['templatename']
];
$data = [
'categoryName' => $categoryName,
'optionType' => $optionType,
- 'defaultValue' => (isset($option['userdefaultvalue']) ? $userDefaultValue : $defaultValue),
+ 'defaultValue' => isset($option['userdefaultvalue']) ? $userDefaultValue : $defaultValue,
'validationPattern' => $validationPattern,
'showOrder' => $showOrder,
'enableOptions' => $enableOptions,
'eventName' => $data['elements']['name'],
'className' => $data['elements']['classname'],
'objectTypeID' => $objectTypeID,
- 'permissions' => (isset($data['elements']['permissions']) ? $data['elements']['permissions'] : ''),
- 'options' => (isset($data['elements']['options']) ? $data['elements']['options'] : ''),
- 'preset' => (!empty($data['elements']['preset']) ? 1 : 0),
+ 'permissions' => isset($data['elements']['permissions']) ? $data['elements']['permissions'] : '',
+ 'options' => isset($data['elements']['options']) ? $data['elements']['options'] : '',
+ 'preset' => !empty($data['elements']['preset']) ? 1 : 0,
'presetMailNotificationType' => $presetMailNotificationType
];
}
*/
protected function prepareImport(array $data) {
// adjust show order
- $showOrder = (isset($data['elements']['showorder'])) ? $data['elements']['showorder'] : null;
+ $showOrder = isset($data['elements']['showorder']) ? $data['elements']['showorder'] : null;
$showOrder = $this->getShowOrder($showOrder);
// merge values and default values
return [
'menuItem' => $data['attributes']['name'],
- 'options' => (isset($data['elements']['options'])) ? $data['elements']['options'] : '',
- 'permissions' => (isset($data['elements']['permissions'])) ? $data['elements']['permissions'] : '',
+ 'options' => isset($data['elements']['options']) ? $data['elements']['options'] : '',
+ 'permissions' => isset($data['elements']['permissions']) ? $data['elements']['permissions'] : '',
'showOrder' => $showOrder,
'className' => $data['elements']['classname']
];
foreach ($articleList->getObjects() as $article) {
$results[] = [
'description' => $article->getFormattedTeaser(),
- 'image' => ($article->getImage() ? $article->getImage()->getElementTag(48) : ''),
+ 'image' => $article->getImage() ? $article->getImage()->getElementTag(48) : '',
'link' => $article->getLink(),
'objectID' => $article->articleID,
'title' => $article->getTitle()
catch (SystemException $e) {
// log failure
$action = new PaidSubscriptionTransactionLogAction([], 'create', ['data' => [
- 'subscriptionUserID' => ($userSubscription !== null ? $userSubscription->subscriptionUserID : null),
- 'userID' => ($user !== null ? $user->userID : null),
- 'subscriptionID' => ($subscription !== null ? $subscription->subscriptionID : null),
+ 'subscriptionUserID' => $userSubscription !== null ? $userSubscription->subscriptionUserID : null,
+ 'userID' => $user !== null ? $user->userID : null,
+ 'subscriptionID' => $subscription !== null ? $subscription->subscriptionID : null,
'paymentMethodObjectTypeID' => $paymentMethodObjectTypeID,
'logTime' => TIME_NOW,
'transactionID' => $transactionID,
if (isset($postData['pollQuestion'])) $this->pollData['question'] = StringUtil::trim($postData['pollQuestion']);
// boolean values
- $this->pollData['isChangeable'] = (isset($postData['pollIsChangeable'])) ? 1 : 0;
- $this->pollData['resultsRequireVote'] = (isset($postData['pollResultsRequireVote'])) ? 1 : 0;
- $this->pollData['sortByVotes'] = (isset($postData['pollSortByVotes'])) ? 1 : 0;
+ $this->pollData['isChangeable'] = isset($postData['pollIsChangeable']) ? 1 : 0;
+ $this->pollData['resultsRequireVote'] = isset($postData['pollResultsRequireVote']) ? 1 : 0;
+ $this->pollData['sortByVotes'] = isset($postData['pollSortByVotes']) ? 1 : 0;
if ($this->poll === null) {
$this->pollData['isPublic'] = (isset($postData['pollIsPublic']) && $this->canStartPublicPoll()) ? 1 : 0;
public function assignVariables() {
$variables = [
'__showPoll' => true,
- 'pollID' => ($this->poll === null ? 0 : $this->poll->pollID),
+ 'pollID' => $this->poll === null ? 0 : $this->poll->pollID,
'pollOptions' => $this->pollOptions
];
foreach ($this->pollData as $key => $value) {
* @return string[]|null className, controller and pageType, or null if this is not a legacy controller name
*/
protected function getLegacyClassData($application, $controller, $isAcpRequest) {
- $environment = ($isAcpRequest) ? 'acp' : 'frontend';
+ $environment = $isAcpRequest ? 'acp' : 'frontend';
if (isset($this->ciControllers['lookup'][$application][$environment][$controller])) {
$className = $this->ciControllers['lookup'][$application][$environment][$controller];
* @inheritDoc
*/
public function buildLink(array $components) {
- $application = (isset($components['application'])) ? $components['application'] : null;
+ $application = isset($components['application']) ? $components['application'] : null;
// drop application component to avoid being appended as query string
unset($components['application']);
* @inheritDoc
*/
public function buildLink(array $components) {
- $application = (isset($components['application'])) ? $components['application'] : null;
+ $application = isset($components['application']) ? $components['application'] : null;
self::loadDefaultControllers();
// drop application component to avoid being appended as query string
$controllerName = RequestHandler::getTokenizedController($controller);
$alias = (!$this->isACP) ? RequestHandler::getInstance()->getAliasByController($controllerName) : null;
- self::$controllerNames[$controller] = ($alias) ?: $controllerName;
+ self::$controllerNames[$controller] = $alias ?: $controllerName;
}
return self::$controllerNames[$controller];
* @inheritDoc
*/
public function buildLink(array $components) {
- $application = (isset($components['application'])) ? $components['application'] : null;
+ $application = isset($components['application']) ? $components['application'] : null;
// drop application component to avoid being appended as query string
unset($components['application']);
'ipAddress' => UserUtil::getIpAddress(),
'userAgent' => UserUtil::getUserAgent(),
'requestURI' => UserUtil::getRequestURI(),
- 'requestMethod' => (!empty($_SERVER['REQUEST_METHOD']) ? substr($_SERVER['REQUEST_METHOD'], 0, 7) : '')
+ 'requestMethod' => !empty($_SERVER['REQUEST_METHOD']) ? substr($_SERVER['REQUEST_METHOD'], 0, 7) : ''
];
}
'userAgent' => UserUtil::getUserAgent(),
'lastActivityTime' => TIME_NOW,
'requestURI' => UserUtil::getRequestURI(),
- 'requestMethod' => (!empty($_SERVER['REQUEST_METHOD']) ? substr($_SERVER['REQUEST_METHOD'], 0, 7) : '')
+ 'requestMethod' => !empty($_SERVER['REQUEST_METHOD']) ? substr($_SERVER['REQUEST_METHOD'], 0, 7) : ''
];
if ($spiderID !== null) $sessionData['spiderID'] = $spiderID;
'userAgent' => UserUtil::getUserAgent(),
'lastActivityTime' => TIME_NOW,
'requestURI' => UserUtil::getRequestURI(),
- 'requestMethod' => (!empty($_SERVER['REQUEST_METHOD']) ? substr($_SERVER['REQUEST_METHOD'], 0, 7) : '')
+ 'requestMethod' => !empty($_SERVER['REQUEST_METHOD']) ? substr($_SERVER['REQUEST_METHOD'], 0, 7) : ''
];
$this->session = call_user_func([$this->sessionEditorClassName, 'create'], $sessionData);
if (PACKAGE_ID) {
foreach (Option::getOptions() as $constantName => $option) {
if (in_array($option->optionType, static::$supportedOptionType)) {
- $variables['wcf_option_'.mb_strtolower($constantName)] = (is_int($option->optionValue)) ? $option->optionValue : '"'.$option->optionValue.'"';
+ $variables['wcf_option_'.mb_strtolower($constantName)] = is_int($option->optionValue) ? $option->optionValue : '"'.$option->optionValue.'"';
}
}
}
$beforeContent = $matches['before'];
$content = $matches['content'];
$afterContent = $matches['after'];
- $elseContent = (isset($matches['else'])) ? $matches['else'] : '';
+ $elseContent = isset($matches['else']) ? $matches['else'] : '';
$assignContent = (isset($matches['assign']) && !empty($matches['assign'])) ? $matches['assign'] : '';
$variable = 'hascontent_' . StringUtil::getRandomID();
}
else if (!empty($tagArgs['lib'])) {
if ($isJqueryUi) {
- $src .= (ENABLE_DEBUG_MODE) ? '3rdParty/' . $tagArgs['lib'] : 'WCF.Combined';
+ $src .= ENABLE_DEBUG_MODE ? '3rdParty/' . $tagArgs['lib'] : 'WCF.Combined';
}
else {
$src .= '3rdParty/' . $tagArgs['lib'];
}
else if (!empty($blockContent)) {
$page = Page::getPageByIdentifier($blockContent);
- $pageID = ($page) ? $page->pageID : 0;
+ $pageID = $page ? $page->pageID : 0;
}
if ($pageID === null) {
'fileType' => $uploadFile->getMimeType(),
'fileHash' => sha1_file($uploadFile->getLocation()),
'uploadTime' => TIME_NOW,
- 'userID' => (WCF::getUser()->userID ?: null)
+ 'userID' => WCF::getUser()->userID ?: null
], $this->data);
// get image data
// multiple uploads
for ($i = 0, $l = count($rawFileData['name']); $i < $l; $i++) {
- $this->files[] = new UploadFile($rawFileData['name'][$i], $rawFileData['tmp_name'][$i], $rawFileData['size'][$i], $rawFileData['error'][$i], ($rawFileData['tmp_name'][$i] ? (self::getMimeType($rawFileData['tmp_name'][$i], $rawFileData['type'][$i])) : ''));
+ $this->files[] = new UploadFile($rawFileData['name'][$i], $rawFileData['tmp_name'][$i], $rawFileData['size'][$i], $rawFileData['error'][$i], ($rawFileData['tmp_name'][$i] ? self::getMimeType($rawFileData['tmp_name'][$i], $rawFileData['type'][$i]) : ''));
}
}
else {
- $this->files[] = new UploadFile($rawFileData['name'], $rawFileData['tmp_name'], $rawFileData['size'], $rawFileData['error'], ($rawFileData['tmp_name'] ? (self::getMimeType($rawFileData['tmp_name'], $rawFileData['type'])) : ''));
+ $this->files[] = new UploadFile($rawFileData['name'], $rawFileData['tmp_name'], $rawFileData['size'], $rawFileData['error'], ($rawFileData['tmp_name'] ? self::getMimeType($rawFileData['tmp_name'], $rawFileData['type']) : ''));
}
}
* @return string
*/
public function getNoUsersMessage() {
- return ($this->noUsersMessage) ? WCF::getLanguage()->get($this->noUsersMessage) : '';
+ return $this->noUsersMessage ? WCF::getLanguage()->get($this->noUsersMessage) : '';
}
/**
$statement = WCF::getDB()->prepareStatement($sql);
foreach ($userToItems as $userID => $items) {
$statement->execute([
- ($items * $objectTypeObj->points),
+ $items * $objectTypeObj->points,
$items,
$objectTypeObj->objectTypeID,
$userID
$recipients = $recipientList->getObjects();
if (!empty($recipients)) {
$data = [
- 'authorID' => ($event->getAuthorID() ?: null),
+ 'authorID' => $event->getAuthorID() ?: null,
'data' => [
'eventID' => $event->eventID,
- 'authorID' => ($event->getAuthorID() ?: null),
+ 'authorID' => $event->getAuthorID() ?: null,
'objectID' => $notificationObject->getObjectID(),
'baseObjectID' => $baseObjectID,
'eventHash' => $event->getEventHash(),
'packageID' => $objectTypeObject->packageID,
- 'mailNotified' => ($event->supportsEmailNotification() ? 0 : 1),
+ 'mailNotified' => $event->supportsEmailNotification() ? 0 : 1,
'time' => TIME_NOW,
'additionalData' => serialize($additionalData)
],
$data = [];
// update cumulative likes
- $data['cumulativeLikes'] = (isset($cumulativeLikes[$article->articleID])) ? $cumulativeLikes[$article->articleID] : 0;
+ $data['cumulativeLikes'] = isset($cumulativeLikes[$article->articleID]) ? $cumulativeLikes[$article->articleID] : 0;
// update comment counter
- $data['comments'] = (isset($comments[$article->articleID])) ? $comments[$article->articleID] : 0;
+ $data['comments'] = isset($comments[$article->articleID]) ? $comments[$article->articleID] : 0;
// update data
$editor->update($data);
ON (user_option.userID = user.userID)
".$this->conditions."
ORDER BY user.userID";
- $statement = WCF::getDB()->prepareStatement($sql, $this->limit, ($this->limit * $this->loopCount));
+ $statement = WCF::getDB()->prepareStatement($sql, $this->limit, $this->limit * $this->loopCount);
$statement->execute($this->conditions->getParameters());
while ($row = $statement->fetchArray()) {
$user = new User(null, $row);
* @return \DOMNode parent node, can be `\DOMElement` or `\DOMDocument`
*/
public static function getParentNode(\DOMNode $node) {
- return ($node->parentNode) ?: $node->ownerDocument;
+ return $node->parentNode ?: $node->ownerDocument;
}
/**
$parents[] = $parent;
}
- return ($reverseOrder) ? array_reverse($parents) : $parents;
+ return $reverseOrder ? array_reverse($parents) : $parents;
}
/**
}
// calculate marker
- $result[] = '@@ -'.($leftStart).(($j - $plus - $start) > 1 ? ','.($j - $plus - $start) : '').' +'.($rightStart).(($j - $minus - $start) > 1 ? ','.($j - $minus - $start) : '').' @@';
+ $result[] = '@@ -'. $leftStart .(($j - $plus - $start) > 1 ? ','.($j - $plus - $start) : '').' +'. $rightStart .(($j - $minus - $start) > 1 ? ','.($j - $minus - $start) : '').' @@';
// append lines
foreach (array_slice($d, $start, $j - $start) as $item) $result[] = implode('', $item);
}
// send file size
- $this->addHeader('Content-Length', ($this->endByte + 1 - $this->startByte));
+ $this->addHeader('Content-Length', $this->endByte + 1 - $this->startByte);
// cache headers
if ($this->options['maxAge']) {