Skip to content
This repository has been archived by the owner on Aug 22, 2022. It is now read-only.

Commit

Permalink
Code overhaul
Browse files Browse the repository at this point in the history
  • Loading branch information
SoftCreatR committed Aug 22, 2022
1 parent 2f48712 commit 6e21ec3
Show file tree
Hide file tree
Showing 24 changed files with 672 additions and 439 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
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"

- 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"
6 changes: 0 additions & 6 deletions .gitignore

This file was deleted.

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__.'/files/')
->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 README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# OpenAuth.dev Provider for WoltLab Suite 5
# OpenAuth.dev Provider for WoltLab Suite

<div align=center>

![openauth-icon](https://user-images.githubusercontent.com/81188/87538212-25d2ef00-c69c-11ea-87a7-b967826cb669.png)


### OpenAuth.dev Provider for WoltLab Suite 5
### OpenAuth.dev Provider for WoltLab Suite

</div>

Expand All @@ -29,8 +29,8 @@ WIP

You need:

- A WoltLab Suite installation (5.2.0 or newer)
- PHP (7.0.22 or newer)
- A WoltLab Suite installation (5.4.0 or newer)
- PHP (7.2.24 or newer)
- Activated `fsockopen` (including support for SSL connections) on your webspace/server
- A free user account on [OpenAuth.dev](https://www.openauth.dev), which has been authorized as a developer

Expand Down
13 changes: 3 additions & 10 deletions constants.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
<?php
if (!defined('WCF_N')) {
define('WCF_N', 1);
}

if (!defined('OPENAUTH_CLIENT_ID')) {
define('OPENAUTH_CLIENT_ID', '');
}

if (!defined('OPENAUTH_CLIENT_SECRET')) {
define('OPENAUTH_CLIENT_SECRET', '');
}
const WCF_N = 1;
const OPENAUTH_CLIENT_ID = '';
const OPENAUTH_CLIENT_SECRET = '';
2 changes: 1 addition & 1 deletion eventListener.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<data 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/eventListener.xsd">
<data xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com https://www.woltlab.com/XSD/5.4/eventListener.xsd">
<import>
<!-- admin -->
<eventlistener name="openAuthAvatarEditListenerAdmin">
Expand Down
41 changes: 41 additions & 0 deletions files/acp/database/install_dev.openauth.wsc.login.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

/*
* Copyright by The OpenAuth.dev Team.
*
* License: GNU Lesser General Public License v2.1
*
* THIS LIBRARY 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 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
*
* THIS LIBRARY 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 LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE
* FOUNDATION, INC., 51 FRANKLIN STREET, FIFTH FLOOR, BOSTON, MA 02110-1301 USA
*
* The above copyright notice and this disclaimer notice shall be included in all
* copies or substantial portions of the Software.
*/

use wcf\system\database\table\column\IntDatabaseTableColumn;
use wcf\system\database\table\column\NotNullVarchar255DatabaseTableColumn;
use wcf\system\database\table\column\TinyintDatabaseTableColumn;
use wcf\system\database\table\PartialDatabaseTable;

return [
PartialDatabaseTable::create('wcf1_user')
->columns([
IntDatabaseTableColumn::create('openAuthID'),
NotNullVarchar255DatabaseTableColumn::create('openAuthAvatar'),
TinyintDatabaseTableColumn::create('enableOpenAuthAvatar')
->length(1)
->notNull()
->defaultValue(0),
]),
];
Loading

0 comments on commit 6e21ec3

Please sign in to comment.