acptemplates.tar100666 0 0 3000 13330614341 7273 __usersLicenseWarning.tpl100666 0 0 114 13330603347 11101
{lang}filebase.acp.license.isUsersLicense{/lang}
files.tar100666 0 0 56000 13330614341 5743 acp/uninstall/de.mysterycode.filebase.userlicenses.php100666 0 0 567 13330605215 16577 getConditionBuilder()->add('license.isUserLicense = 1'); $licenseList->readObjects(); if ($licenseList->count() > 0) { $licenseAction = new UserLicenseAction($licenseList->getObjects(), 'delete'); $licenseAction->executeAction(); } lib/data/license/UserLicenseAction.class.php100666 0 0 15224 13330613774 14442 parameters['data']['isUserLicense'])) $this->parameters['data']['isUserLicense'] = 1; if (!isset($this->parameters['data']['userID'])) $this->parameters['data']['userID'] = WCF::getUser()->userID; if (!isset($this->parameters['data']['username'])) $this->parameters['data']['username'] = WCF::getUser()->username; if (!empty($this->parameters['htmlInputProcessor'])) { /** @noinspection PhpUndefinedMethodInspection */ $this->parameters['data']['licenseText'] = $this->parameters['htmlInputProcessor']->getHtml(); } $license = parent::create(); $licenseEditor = new LicenseEditor($license); // save embedded objects if (!empty($this->parameters['htmlInputProcessor'])) { /** @noinspection PhpUndefinedMethodInspection */ $this->parameters['htmlInputProcessor']->setObjectID($license->licenseID); if (MessageEmbeddedObjectManager::getInstance()->registerObjects($this->parameters['htmlInputProcessor'])) { $licenseEditor->update(['hasEmbeddedObjects' => 1]); } } if (!FILEBASE_LICENSE_REDACTOR_ENABLE) { $filePath = 'licenses/' . $license->licenseID . '.txt'; $content = $this->parameters['data']['licenseText']; } else { $filePath = 'licenses/' . $license->licenseID . '.html'; $content = $this->generate($license, $this->parameters['data']['licenseText']); } $filename = FileUtil::getRealPath(FILEBASE_DIR) . $filePath; file_put_contents($filename, $content); $licenseEditor->update([ 'licensePath' => $filePath, 'licenseURL' => LinkHandler::getInstance()->getLink(null, ['application' => 'filebase']) . $filePath, 'isPlainText' => intval(!FILEBASE_LICENSE_REDACTOR_ENABLE) ]); return new License($license->licenseID); } /** * @param \filebase\data\license\License $license * @param string $text * @return string */ protected function generate(License $license, $text) { $this->loadEmbeddedObjects($license); $processor = new HtmlOutputProcessor(); $processor->process($text, 'de.mysterycode.filebase.userlicense', $license->licenseID); $wcf = WCF::getTPL()->get('__wcf'); $icons = [ 'appleTouchIcon' => StyleHandler::getInstance()->getStyle()->getFaviconAppleTouchIcon(), 'manifest' => StyleHandler::getInstance()->getStyle()->getFaviconManifest(), 'favicon' => $wcf->getFavicon(), 'msapplication' => StyleHandler::getInstance()->getStyle()->getFaviconBrowserconfig(), 'themecolor' => StyleHandler::getInstance()->getStyle()->getVariable('wcfHeaderBackground', true) ]; $pagetitle = PAGE_TITLE; $output = << {$license->getTitle()} - {$license->username} - {$pagetitle} user.message.disallowedBBCodes HTML; $output .= $processor->getHtml(); $output .= << HTML; return $output; } /** * @inheritDoc */ public function update() { if (!empty($this->parameters['htmlInputProcessor'])) { /** @noinspection PhpUndefinedMethodInspection */ $this->parameters['data']['licenseText'] = $this->parameters['htmlInputProcessor']->getHtml(); } parent::update(); foreach ($this->getObjects() as $object) { if (!empty($this->parameters['htmlInputProcessor'])) { /** @noinspection PhpUndefinedMethodInspection */ $this->parameters['htmlInputProcessor']->setObjectID($object->licenseID); if ($object->hasEmbeddedObjects != MessageEmbeddedObjectManager::getInstance()->registerObjects($this->parameters['htmlInputProcessor'])) { $object->update(['hasEmbeddedObjects' => $object->hasEmbeddedObjects ? 0 : 1]); } } if (!FILEBASE_LICENSE_REDACTOR_ENABLE) { $filePath = 'licenses/' . $object->licenseID . '.txt'; $content = $this->parameters['data']['licenseText']; } else { $filePath = 'licenses/' . $object->licenseID . '.html'; $content = $this->generate($object->getDecoratedObject(), $this->parameters['data']['licenseText']); } $filename = FileUtil::getRealPath(FILEBASE_DIR) . $filePath; file_put_contents($filename, $content); } } /** * @inheritDoc */ public function validateDelete() { // read objects if (empty($this->objects)) { $this->readObjects(); if (empty($this->objects)) { throw new UserInputException('objectIDs'); } } foreach ($this->objects as $object) { // validate permissions if ($object->isUserLicense && $object->userID == WCF::getUser()->userID) { continue; } else if (is_array($this->permissionsDelete) && !empty($this->permissionsDelete)) { WCF::getSession()->checkPermissions($this->permissionsDelete); continue; } throw new PermissionDeniedException(); } } /** * @inheritDoc */ public function delete() { if (empty($this->objects)) { $this->readObjects(); } foreach ($this->objects as $object) { @unlink(FileUtil::getRealPath(FILEBASE_DIR) . $object->licensePath); } return parent::delete(); } public function validateDeleteFile() { $this->validateDelete(); } /** * @inheritDoc */ public function deleteFile() { if (empty($this->objects)) { $this->readObjects(); } foreach ($this->objects as $object) { @unlink(FileUtil::getRealPath(FILEBASE_DIR) . $object->licensePath); } } /** * Loads the embedded objects. */ public function loadEmbeddedObjects(License &$license) { if ($license->hasEmbeddedObjects && !$license->embeddedObjectsLoaded) { MessageEmbeddedObjectManager::getInstance()->loadObjects('de.mysterycode.filebase.userlicense', [$license->licenseID]); /** @noinspection PhpUndefinedFieldInspection */ $license->embeddedObjectsLoaded = true; } } } lib/form/UserLicenseAddForm.class.php100666 0 0 11361 13330614003 13131 readParameters(); } /** * @inheritDoc */ public function readFormParameters() { parent::readFormParameters(); if (isset($_POST['licenseText'])) $this->licenseText = StringUtil::trim(MessageUtil::stripCrap($_POST['licenseText'])); MessageQuoteManager::getInstance()->readFormParameters(); } /** * @inheritDoc */ public function validate() { parent::validate(); if (FILEBASE_LICENSE_REDACTOR_ENABLE) { $this->validateText(); } else { if (empty($this->licenseText)) { throw new UserInputException('licenseText'); } // search for censored words if (ENABLE_CENSORSHIP) { $result = Censorship::getInstance()->test($this->licenseText); if ($result) { WCF::getTPL()->assign('censoredWords', $result); throw new UserInputException('licenseText', 'censoredWordsFound'); } } } } /** * @inheritDoc */ public function save() { AbstractForm::save(); if (FILEBASE_LICENSE_REDACTOR_ENABLE) $this->licenseText = $this->htmlInputProcessor->getHtml(); // create license $this->objectAction = new UserLicenseAction([], 'create', [ 'data' => array_merge($this->additionalFields, [ 'licenseName' => $this->licenseName, 'licenseText' => $this->licenseText, 'isPlainText' => intval(!FILEBASE_LICENSE_REDACTOR_ENABLE) ]), 'htmlInputProcessor' => $this->htmlInputProcessor ]); $this->objectAction->executeAction(); $this->saved(); // reset values $this->licenseName = $this->licenseURL = $this->licenseText = ''; $this->htmlInputProcessor = null; MessageQuoteManager::getInstance()->saved(); // show success message WCF::getTPL()->assign('success', true); } /** * @inheritDoc */ public function assignVariables() { parent::assignVariables(); MessageQuoteManager::getInstance()->assignVariables(); WCF::getTPL()->assign('licenseText', $this->licenseText); } /** * Validates the message text. * @see \wcf\form\MessageForm::validateText() */ protected function validateText() { if (empty($this->messageObjectType)) { throw new \RuntimeException("Expected non-empty message object type for '".get_class($this)."'"); } if (empty($this->licenseText)) { throw new UserInputException('licenseText'); } if ($this->disallowedBBCodesPermission) { BBCodeHandler::getInstance()->setDisallowedBBCodes(explode(',', WCF::getSession()->getPermission($this->disallowedBBCodesPermission))); } else if($this->disallowedBBCodesPermission === null) { BBCodeHandler::getInstance()->setDisallowedBBCodes(explode(',', WCF::getSession()->getPermission('user.message.disallowedBBCodes'))); } $this->htmlInputProcessor = new HtmlInputProcessor(); $this->htmlInputProcessor->process($this->licenseText, $this->messageObjectType, 0); // check text length if ($this->htmlInputProcessor->appearsToBeEmpty()) { throw new UserInputException('licenseText'); } $message = $this->htmlInputProcessor->getTextContent(); if ($this->maxTextLength != 0 && mb_strlen($message) > $this->maxTextLength) { throw new UserInputException('licenseText', 'tooLong'); } $disallowedBBCodes = $this->htmlInputProcessor->validate(); if (!empty($disallowedBBCodes)) { WCF::getTPL()->assign('disallowedBBCodes', $disallowedBBCodes); throw new UserInputException('licenseText', 'disallowedBBCodes'); } // search for censored words if (ENABLE_CENSORSHIP) { $result = Censorship::getInstance()->test($message); if ($result) { WCF::getTPL()->assign('censoredWords', $result); throw new UserInputException('licenseText', 'censoredWordsFound'); } } } } lib/form/UserLicenseEditForm.class.php100666 0 0 3635 13330600423 13314 licenseID = intval($_REQUEST['id']); $this->license = new License($this->licenseID); if (!$this->license->licenseID) { throw new IllegalLinkException(); } if ($this->license->userID != WCF::getUser()->userID) { throw new PermissionDeniedException(); } } /** * @inheritDoc */ public function save() { AbstractForm::save(); // update license $this->objectAction = new UserLicenseAction([$this->license], 'update', [ 'data' => array_merge($this->additionalFields, [ 'licenseName' => $this->licenseName, 'licenseText' => $this->licenseText ]), 'htmlInputProcessor' => $this->htmlInputProcessor ]); $this->objectAction->executeAction(); $this->saved(); MessageQuoteManager::getInstance()->saved(); // show success message WCF::getTPL()->assign('success', true); } /** * @inheritDoc */ public function readData() { parent::readData(); if (empty($_POST)) { $this->licenseName = $this->license->licenseName; $this->licenseURL = $this->license->licenseURL; $this->licenseText = $this->license->licenseText; } } /** * @inheritDoc */ public function assignVariables() { parent::assignVariables(); WCF::getTPL()->assign([ 'action' => 'edit', 'licenseID' => $this->licenseID, 'license' => $this->license ]); } } lib/page/UserLicenseListPage.class.php100666 0 0 1360 13330600412 13253 objectList->getConditionBuilder()->add('(license.userID = ? OR license.isUserLicense = 0', [WCF::getUser()->userID]); $this->objectList->getConditionBuilder()->add('license.userID = ?', [WCF::getUser()->userID]); } } lib/system/event/listener/UserLicenseRemovalListener.class.php100666 0 0 2106 13330605432 20242 * @license Kostenpflichtige Produkte * @package de.mysterycode.filebase.userlicenses */ class UserLicenseRemovalListener implements IParameterizedEventListener { /** * @inheritDoc */ public function execute($eventObj, $className, $eventName, array &$parameters) { /** @var \filebase\data\license\LicenseAction $eventObj */ if ($eventObj->getActionName() == 'delete' || $eventObj->getActionName() == 'deleteAll') { $objects = []; foreach ($eventObj->getObjects() as $object) { if ($object->isUserLicense) $objects[] = $object; } if (!empty($objects)) { $deleteAction = new UserLicenseAction([], 'deleteFile'); $deleteAction->executeAction(); } } } } lib/system/event/listener/UserLicenseUserRenameListener.class.php100666 0 0 1756 13330604126 20714 * @license Kostenpflichtige Produkte * @package de.mysterycode.filebase.userlicenses */ class UserLicenseUserRenameListener implements IParameterizedEventListener { /** * @inheritDoc */ public function execute($eventObj, $className, $eventName, array &$parameters) { $objects = $eventObj->getObjects(); $userID = $objects[0]->userID; $parameters = $eventObj->getParameters(); $username = $parameters['data']['username']; $sql = "UPDATE filebase" . WCF_N . "_license SET username = ? WHERE userID = ?"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute([$username, $userID]); } } licenses/.gitignore100666 0 0 236 13330603144 7665 # This file ensures this directory is within version control since git does # not track directories but files. In fact, this directory is meant to be empty * templates.tar100666 0 0 22000 13330614341 6630 userLicenseAdd.tpl100666 0 0 5622 13330607777 7547 {capture assign='contentHeaderNavigation'}
  • {lang}filebase.acp.menu.link.filebase.license.list{/lang}
  • {/capture} {include file='header'} {include file='formError'} {if $success|isset}

    {lang}wcf.global.success.{$action}{/lang}

    {/if}
    {lang}filebase.license.mode{/lang}
    {if $errorField == 'licenseName'} {if $errorType == 'empty'} {lang}wcf.global.form.error.empty{/lang} {else} {lang}filebase.license.licenseName.error.{$errorType}{/lang} {/if} {/if}
    {if ($action == 'add' && FILEBASE_LICENSE_REDACTOR_ENABLE) || ($license|isset && !$license->isPlainText)} {include file='wysiwyg' wysiwygSelector='licenseText'} {include file='messageFormTabs' wysiwygContainerID='licenseText'} {/if} {if $errorField == 'licenseText'} {if $errorType == 'empty'} {lang}wcf.global.form.error.empty{/lang} {elseif $errorType == 'tooLong'} {lang}wcf.message.error.tooLong{/lang} {elseif $errorType == 'censoredWordsFound'} {lang}wcf.message.error.censoredWordsFound{/lang} {elseif $errorType == 'disallowedBBCodes'} {lang}wcf.message.error.disallowedBBCodes{/lang} {else} {lang}filebase.license.licenseText.error.{$errorType}{/lang} {/if} {/if}
    {event name='dataFields'}
    {event name='sections'}
    {@SECURITY_TOKEN_INPUT_TAG}
    {include file='footer'} userLicenseList.tpl100666 0 0 10542 13330610637 7774 {capture assign='contentHeaderNavigation'}
  • {lang}filebase.acp.license.add{/lang}
  • {/capture} {include file='header'} {hascontent}
    {content}{pages print=true assign=pagesLinks application='filebase' controller="UserLicenseList" link="pageNo=%d&sortField=$sortField&sortOrder=$sortOrder"}{/content}
    {/hascontent} {if $objects|count}
    {event name='columnHeads'} {foreach from=$objects item=license} {event name='columns'} {/foreach}
    {lang}wcf.global.objectID{/lang} {lang}filebase.license.licenseName{/lang} {lang}filebase.license.licenseURL{/lang} {lang}filebase.license.username{/lang}
    {event name='rowButtons'} {@$license->licenseID} {$license->licenseName} {$license->licenseURL} {if $license->userID} {$license->username} {else} {$license->username} {/if}
    {else}

    {lang}wcf.global.noItems{/lang}

    {/if} {include file='footer'} install.sql100666 0 0 1216 13330577542 6312 ALTER TABLE filebase1_license ADD COLUMN isUserLicense TINYINT(1) NOT NULL DEFAULT 0; ALTER TABLE filebase1_license ADD COLUMN licenseText TEXT; ALTER TABLE filebase1_license ADD COLUMN isPlainText TINYINT(1) NOT NULL DEFAULT 0; ALTER TABLE filebase1_license ADD COLUMN hasEmbeddedObjects TINYINT(1) NOT NULL DEFAULT 0; ALTER TABLE filebase1_license ADD COLUMN licensePath varchar(255) NOT NULL DEFAULT ''; ALTER TABLE filebase1_license ADD COLUMN userID INT(10); ALTER TABLE filebase1_license ADD COLUMN username VARCHAR(255) NOT NULL DEFAULT ''; ALTER TABLE filebase1_license ADD FOREIGN KEY (userID) REFERENCES wcf1_user (userID) ON DELETE SET NULL; xml/templateListener.xml100666 0 0 1142 13330601302 10742 admin licenseAdd sections xml/objectType.xml100666 0 0 624 13330601255 7524 de.mysterycode.filebase.userlicense com.woltlab.wcf.message xml/option.xml100666 0 0 1011 13330601270 6730 xml/page.xml100666 0 0 4056 13330601274 6354 com.woltlab.filebase.FileList filebase\page\UserLicenseListPage system 1 filebase_enable_license user.filebase.canAddFile Lizenzen Licenses Lizenzen Licenses de.mysterycode.filebase.userlicense.UserLicenseList filebase\form\UserLicenseAddForm system 1 filebase_enable_license user.filebase.canAddFile Lizenz hinzufügen Add License Lizenz hinzufügen Add License de.mysterycode.filebase.userlicense.UserLicenseList filebase\form\UserLicenseEditForm system 1 filebase_enable_license user.filebase.canAddFile Lizenz bearbeiten Edit License Lizenz bearbeiten Edit License xml/menuItem.xml100666 0 0 1030 13330601263 7206 com.woltlab.filebase.FileList de.mysterycode.filebase.userlicense.UserLicenseList Lizenzen Licenses xml/eventListener.xml100666 0 0 2707 13330604357 10275 user wcf\data\user\UserAction rename filebase\system\event\listener\UserLicenseUserRenameListener admin wcf\data\user\UserAction rename filebase\system\event\listener\UserLicenseUserRenameListener admin filebase\data\license\LicenseAction finalizeAction filebase\system\event\listener\UserLicenseRemovalListener user filebase\data\license\LicenseAction finalizeAction filebase\system\event\listener\UserLicenseRemovalListener language/de.xml100666 0 0 2464 13330614323 7013 isPlainText)}Sie können sämtliche Formatierungen des Editors verwenden. Ihre Lizenz wird als HTML-Seite gespeichert.{else}Sie können ausschließlich Plain-Text verwenden. Das Eingabefeld unterstützt kein HTML; der Lizenztext wird als Text-Datei im System hinterlegt.{/if}]]> language/en.xml100666 0 0 2363 13330614316 7025 isPlainText)}You can use the editor's functions. Your license will be stored as a HTML-page on our system.{else}You can use plaintext contents only. The input field doesn't support HTML; your license's text will be stored as a text-file on our system.{/if}]]> package.xml100666 0 0 3425 13330614336 6235 xml/templateListener.xml xml/objectType.xml xml/option.xml xml/page.xml xml/menuItem.xml xml/eventListener.xml