Skip to content

Commit

Permalink
5.5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
SoftCreatR committed Sep 18, 2022
1 parent 65ad695 commit 2fe5996
Show file tree
Hide file tree
Showing 10 changed files with 362 additions and 156 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Release

on:
push:
tags: ['*']
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: 16

- name: Create package
run: |
rm -rf *.tar.gz
npx --yes wspackager
- name: Check file existence
id: check_files
uses: andstor/file-existence-action@v1
with:
#files: "${{ github.event.repository.name }}_*.tar.gz"
files: "de.softcreatr*.tar.gz"

- name: On Build Failure
if: steps.check_files.outputs.files_exists == 'false'
run: |
echo "Packaging FAILED" && exit 1
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/') && steps.check_files.outputs.files_exists == 'true'
with:
#files: "${{ github.event.repository.name }}_*.tar.gz"
files: "de.softcreatr*.tar.gz"
132 changes: 132 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
<?php
$finder = PhpCsFixer\Finder::create()
->exclude('*/vendor/*')
->in(__DIR__)
->notPath('lib/system/api');

return (new PhpCsFixer\Config())
->setRiskyAllowed(true)
->setRules([
'@PSR1' => true,
'@PSR2' => true,

'array_push' => true,
'backtick_to_shell_exec' => true,
'no_alias_language_construct_call' => true,
'no_mixed_echo_print' => true,
'pow_to_exponentiation' => true,
'random_api_migration' => true,

'array_syntax' => ['syntax' => 'short'],
'no_multiline_whitespace_around_double_arrow' => true,
'no_trailing_comma_in_singleline_array' => true,
'no_whitespace_before_comma_in_array' => true,
'normalize_index_brace' => true,
'whitespace_after_comma_in_array' => true,

'non_printable_character' => ['use_escape_sequences_in_strings' => true],

'lowercase_static_reference' => true,
'magic_constant_casing' => true,
'magic_method_casing' => true,
'native_function_casing' => true,
'native_function_type_declaration_casing' => true,

'cast_spaces' => ['space' => 'none'],
'lowercase_cast' => true,
'no_unset_cast' => true,
'short_scalar_cast' => true,

'class_attributes_separation' => true,
'no_blank_lines_after_class_opening' => true,
'no_null_property_initialization' => true,
'self_accessor' => true,
'single_class_element_per_statement' => true,
'single_trait_insert_per_statement' => true,

'no_empty_comment' => true,
'single_line_comment_style' => ['comment_types' => ['hash']],

'native_constant_invocation' => ['strict' => false],

'no_alternative_syntax' => true,
'no_trailing_comma_in_list_call' => true,
'no_unneeded_control_parentheses' => ['statements' => ['break', 'clone', 'continue', 'echo_print', 'return', 'switch_case', 'yield', 'yield_from']],
'no_unneeded_curly_braces' => ['namespaces' => true],
'switch_continue_to_break' => true,
'trailing_comma_in_multiline' => ['elements' => ['arrays']],

'function_typehint_space' => true,
'lambda_not_used_import' => true,
'native_function_invocation' => ['include' => ['@all']],
'no_unreachable_default_argument_value' => true,
'nullable_type_declaration_for_default_null_value' => true,
'return_type_declaration' => true,
'static_lambda' => true,

'fully_qualified_strict_types' => true,
'no_leading_import_slash' => true,
'no_unused_imports' => true,
//'ordered_imports' => true,

'declare_equal_normalize' => true,
'dir_constant' => true,
'explicit_indirect_variable' => true,
'function_to_constant' => true,
'is_null' => true,
'no_unset_on_property' => true,

'list_syntax' => ['syntax' => 'short'],

'clean_namespace' => true,
'no_leading_namespace_whitespace' => true,
'single_blank_line_before_namespace' => true,

'no_homoglyph_names' => true,

'binary_operator_spaces' => true,
'concat_space' => ['spacing' => 'one'],
'increment_style' => ['style' => 'post'],
'logical_operators' => true,
'object_operator_without_whitespace' => true,
'operator_linebreak' => true,
'standardize_increment' => true,
'standardize_not_equals' => true,
'ternary_operator_spaces' => true,
'ternary_to_elvis_operator' => true,
'ternary_to_null_coalescing' => true,
'unary_operator_spaces' => true,

'no_useless_return' => true,
'return_assignment' => true,

'multiline_whitespace_before_semicolons' => true,
'no_empty_statement' => true,
'no_singleline_whitespace_before_semicolons' => true,
'space_after_semicolon' => ['remove_in_empty_for_expressions' => true],

'escape_implicit_backslashes' => true,
'explicit_string_variable' => true,
'heredoc_to_nowdoc' => true,
'no_binary_string' => true,
'simple_to_complex_string_variable' => true,

'array_indentation' => true,
'blank_line_before_statement' => ['statements' => ['return', 'exit']],
'compact_nullable_typehint' => true,
'method_chaining_indentation' => true,
'no_extra_blank_lines' => ['tokens' => ['case', 'continue', 'curly_brace_block', 'default', 'extra', 'parenthesis_brace_block', 'square_brace_block', 'switch', 'throw', 'use']],
'no_spaces_around_offset' => true,

// SoftCreatR style
'blank_line_between_import_groups' => true,
'global_namespace_import' => [
'import_classes' => true,
'import_constants' => true,
'import_functions' => false,
],
'ordered_imports' => [
'imports_order' => ['class', 'function', 'const'],
],
])
->setFinder($finder);
8 changes: 4 additions & 4 deletions acptemplates/__uzbotAddNotifyTimeline.tpl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="section notifyTimelineSettings">
<header class="sectionHeader">
<h2 class="sectionTitle">{lang}wcf.acp.uzbot.notify.timeline.setting{/lang}</h2>
</header>
<header class="sectionHeader">
<h2 class="sectionTitle">{lang}wcf.acp.uzbot.notify.timeline.setting{/lang}</h2>
</header>

</div>
4 changes: 2 additions & 2 deletions acptemplates/__uzbotAddNotifyTimelineJS.tpl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$('.notifyTimelineSettings').hide();

if ($value == 30) {
$('.notifyTimelineSettings').show();
$('.notifyReceiverSettings, .notifyReceiverConditionSettings').show();
$('.notifyTimelineSettings').show();
$('.notifyReceiverSettings, .notifyReceiverConditionSettings').show();
}
157 changes: 89 additions & 68 deletions files/lib/data/uzbot/notification/UzbotNotifyTimelineEntry.class.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,30 @@
<?php

/*
* Copyright by Udo Zaydowicz.
* Modified by SoftCreatR.dev.
*
* License: http://opensource.org/licenses/lgpl-license.php
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
namespace timeline\data\uzbot\notification;

use timeline\data\entry\EntryEditor;
use wcf\data\uzbot\Uzbot;
use wcf\data\uzbot\log\UzbotLogEditor;
use wcf\data\uzbot\Uzbot;
use wcf\system\exception\SystemException;
use wcf\system\html\input\HtmlInputProcessor;
use wcf\system\language\LanguageFactory;
Expand All @@ -11,72 +33,71 @@

/**
* Creates timeline entries for Bot
*
* @author 2018-2022 Zaydowicz
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.uz.wcf.bot3.timeline
*/
class UzbotNotifyTimelineEntry {
public function send(Uzbot $bot, $content, $subject, $teaser, $language, $receiver, $tags) {
// prepare text and data
$defaultLanguage = LanguageFactory::getInstance()->getLanguage(LanguageFactory::getInstance()->getDefaultLanguageID());

$subject = $teaser = '';
$content = MessageUtil::stripCrap($content);

// set publication time
$publicationTime = TIME_NOW;
if (isset($bot->publicationTime) && $bot->publicationTime) {
$publicationTime = $bot->publicationTime;
}

if (!$bot->testMode) {
$htmlInputProcessor = new HtmlInputProcessor();
$htmlInputProcessor->process($content, 'de.darkwood-studios.timeline.entry', 0);

// create entry
try {

$data = [
'message' => $htmlInputProcessor->getHtml(),
'typeID' => 0,
'timelineUserID' => $receiver->userID,
'userID' => $bot->senderID,
'username' => $bot->sendername,
'time' => $publicationTime,
'additionalData' => serialize([]),
'isShare' => 0
];

$entry = EntryEditor::create($data);
}
catch (SystemException $e) {
// users may get lost; check sender again to abort
if (!$bot->checkSender(true, true)) return false;

// report any other error und continue
if ($bot->enableLog) {
$error = $defaultLanguage->get('wcf.acp.uzbot.log.notify.error') . ' ' . $e->getMessage();

UzbotLogEditor::create([
'bot' => $bot,
'status' => 1,
'count' => 1,
'additionalData' => $error
]);
}
}
}
else {
if (mb_strlen($content) > 63500) $content = mb_substr($content, 0, 63500) . ' ...';
$result = serialize([$subject, $teaser, $content]);

UzbotLogEditor::create([
'bot' => $bot,
'count' => 1,
'testMode' => 1,
'additionalData' => $result
]);
}
}
class UzbotNotifyTimelineEntry
{
public function send(Uzbot $bot, $content, $subject, $teaser, $language, $receiver, $tags)
{
// prepare text and data
$defaultLanguage = LanguageFactory::getInstance()->getLanguage(LanguageFactory::getInstance()->getDefaultLanguageID());

$subject = $teaser = '';
$content = MessageUtil::stripCrap($content);

// set publication time
$publicationTime = TIME_NOW;
if (isset($bot->publicationTime) && $bot->publicationTime) {
$publicationTime = $bot->publicationTime;
}

if (!$bot->testMode) {
$htmlInputProcessor = new HtmlInputProcessor();
$htmlInputProcessor->process($content, 'de.darkwood-studios.timeline.entry', 0);

// create entry
try {
$data = [
'message' => $htmlInputProcessor->getHtml(),
'typeID' => 0,
'timelineUserID' => $receiver->userID,
'userID' => $bot->senderID,
'username' => $bot->sendername,
'time' => $publicationTime,
'additionalData' => \serialize([]),
'isShare' => 0,
];

$entry = EntryEditor::create($data);
} catch (SystemException $e) {
// users may get lost; check sender again to abort
if (!$bot->checkSender(true, true)) {
return false;
}

// report any other error und continue
if ($bot->enableLog) {
$error = $defaultLanguage->get('wcf.acp.uzbot.log.notify.error') . ' ' . $e->getMessage();

UzbotLogEditor::create([
'bot' => $bot,
'status' => 1,
'count' => 1,
'additionalData' => $error,
]);
}
}
} else {
if (\mb_strlen($content) > 63500) {
$content = \mb_substr($content, 0, 63500) . ' ...';
}
$result = \serialize([$subject, $teaser, $content]);

UzbotLogEditor::create([
'bot' => $bot,
'count' => 1,
'testMode' => 1,
'additionalData' => $result,
]);
}
}
}
10 changes: 5 additions & 5 deletions language/de.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<language xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com http://www.woltlab.com/XSD/2019/language.xsd" languagecode="de" languagename="Deutsch" countrycode="de">
<category name="wcf.acp.uzbot">
<item name="wcf.acp.uzbot.notify.timeline"><![CDATA[Chronik-Eintrag]]></item>
<item name="wcf.acp.uzbot.notify.timeline.setting"><![CDATA[Eintrag]]></item>
<item name="wcf.acp.uzbot.notify.type.timeline"><![CDATA[Chronik]]></item>
</category>
<category name="wcf.acp.uzbot">
<item name="wcf.acp.uzbot.notify.timeline"><![CDATA[Chronik-Eintrag]]></item>
<item name="wcf.acp.uzbot.notify.timeline.setting"><![CDATA[Eintrag]]></item>
<item name="wcf.acp.uzbot.notify.type.timeline"><![CDATA[Chronik]]></item>
</category>
</language>
10 changes: 5 additions & 5 deletions language/en.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<language xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com http://www.woltlab.com/XSD/2019/language.xsd" languagecode="en" languagename="English" countrycode="gb">
<category name="wcf.acp.uzbot">
<item name="wcf.acp.uzbot.notify.timeline"><![CDATA[Timeline Entry]]></item>
<item name="wcf.acp.uzbot.notify.timeline.setting"><![CDATA[Entry]]></item>
<item name="wcf.acp.uzbot.notify.type.timeline"><![CDATA[Timeline]]></item>
</category>
<category name="wcf.acp.uzbot">
<item name="wcf.acp.uzbot.notify.timeline"><![CDATA[Timeline Entry]]></item>
<item name="wcf.acp.uzbot.notify.timeline.setting"><![CDATA[Entry]]></item>
<item name="wcf.acp.uzbot.notify.type.timeline"><![CDATA[Timeline]]></item>
</category>
</language>
Loading

0 comments on commit 2fe5996

Please sign in to comment.