-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TASK] Documentation update and cleanup
- Loading branch information
Showing
10 changed files
with
114 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"php":"7.3.11","version":"2.16.1","indent":" ","lineEnding":"\n","rules":{"blank_line_after_namespace":true,"braces":true,"class_definition":true,"constant_case":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"method_argument_space":{"on_multiline":"ensure_fully_multiline"},"no_break_comment":true,"no_closing_tag":true,"no_spaces_after_function_name":true,"no_spaces_inside_parenthesis":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":{"elements":["property"]},"single_import_per_statement":true,"single_line_after_imports":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"visibility_required":true,"encoding":true,"full_opening_tag":true,"array_syntax":{"syntax":"short"},"binary_operator_spaces":true,"cast_spaces":{"space":"none"},"concat_space":{"spacing":"one"},"function_typehint_space":true,"hash_to_slash_comment":true,"lowercase_cast":true,"modernize_types_casting":true,"native_function_casing":true,"no_alias_functions":true,"no_blank_lines_after_class_opening":true,"no_blank_lines_after_phpdoc":true,"no_blank_lines_before_namespace":true,"no_empty_phpdoc":true,"no_empty_statement":true,"no_extra_consecutive_blank_lines":true,"no_leading_import_slash":true,"no_leading_namespace_whitespace":true,"no_multiline_whitespace_around_double_arrow":true,"no_short_bool_cast":true,"no_singleline_whitespace_before_semicolons":true,"no_trailing_comma_in_singleline_array":true,"no_unneeded_control_parentheses":true,"no_unused_imports":true,"no_useless_else":true,"no_whitespace_in_blank_line":true,"ordered_imports":true,"phpdoc_add_missing_param_annotation":true,"phpdoc_annotation_without_dot":true,"phpdoc_indent":true,"phpdoc_no_access":true,"phpdoc_no_empty_return":true,"phpdoc_no_package":true,"phpdoc_order":true,"phpdoc_scalar":true,"phpdoc_single_line_var_spacing":true,"phpdoc_trim":true,"phpdoc_types":true,"phpdoc_var_without_name":true,"self_accessor":true,"single_quote":true,"trailing_comma_in_multiline_array":true,"whitespace_after_comma_in_array":true},"hashes":{"Classes\/Backend\/PmaModule.php":2811090119,"Classes\/Controller\/PhpmyadminController.php":1481525829,"Classes\/Hooks\/BeUserAuthLogOffHook.php":4054383919,"Classes\/Utility\/EnvironmentUtility.php":1648830403}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<?php | ||
|
||
if (PHP_SAPI !== 'cli') { | ||
die('This script supports command line usage only. Please check your command.'); | ||
} | ||
|
||
// Return a Code Sniffing configuration using | ||
// all sniffers needed for PSR-2 | ||
// and additionally: | ||
// - Remove leading slashes in use clauses. | ||
// - PHP single-line arrays should not have trailing comma. | ||
// - Single-line whitespace before closing semicolon are prohibited. | ||
// - Remove unused use statements in the PHP source code | ||
// - Ensure Concatenation to have at least one whitespace around | ||
// - Remove trailing whitespace at the end of blank lines. | ||
return PhpCsFixer\Config::create() | ||
->setRiskyAllowed(true) | ||
->setRules([ | ||
'@PSR2' => true, | ||
'array_syntax' => [ | ||
'syntax' => 'short', | ||
], | ||
'binary_operator_spaces' => true, | ||
'cast_spaces' => [ | ||
'space' => 'none', | ||
], | ||
'concat_space' => [ | ||
'spacing' => 'one', | ||
], | ||
'function_typehint_space' => true, | ||
'hash_to_slash_comment' => true, | ||
'lowercase_cast' => true, | ||
'modernize_types_casting' => true, | ||
'native_function_casing' => true, | ||
'no_alias_functions' => true, | ||
'no_blank_lines_after_class_opening' => true, | ||
'no_blank_lines_after_phpdoc' => true, | ||
'no_blank_lines_before_namespace' => true, | ||
'no_empty_phpdoc' => true, | ||
'no_empty_statement' => true, | ||
'no_extra_consecutive_blank_lines' => true, | ||
'no_leading_import_slash' => true, | ||
'no_leading_namespace_whitespace' => true, | ||
'no_multiline_whitespace_around_double_arrow' => true, | ||
'no_short_bool_cast' => true, | ||
'no_singleline_whitespace_before_semicolons' => true, | ||
'no_trailing_comma_in_singleline_array' => true, | ||
'no_unneeded_control_parentheses' => true, | ||
'no_unused_imports' => true, | ||
'no_useless_else' => true, | ||
'no_whitespace_in_blank_line' => true, | ||
'ordered_imports' => true, | ||
'phpdoc_add_missing_param_annotation' => true, | ||
'phpdoc_annotation_without_dot' => true, | ||
'phpdoc_indent' => true, | ||
'phpdoc_no_access' => true, | ||
'phpdoc_no_empty_return' => true, | ||
'phpdoc_no_package' => true, | ||
'phpdoc_order' => true, | ||
'phpdoc_scalar' => true, | ||
'phpdoc_single_line_var_spacing' => true, | ||
'phpdoc_trim' => true, | ||
'phpdoc_types' => true, | ||
'phpdoc_var_without_name' => true, | ||
'self_accessor' => true, | ||
'single_quote' => true, | ||
'trailing_comma_in_multiline_array' => true, | ||
'whitespace_after_comma_in_array' => true, | ||
]) | ||
->setFinder( | ||
PhpCsFixer\Finder::create() | ||
->in( | ||
[ | ||
__DIR__ . '/Classes/', | ||
] | ||
) | ||
->exclude('Vendor') | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,27 +15,24 @@ | |
*/ | ||
|
||
use Mehrwert\Phpmyadmin\Utility\EnvironmentUtility; | ||
use TYPO3\CMS\Core\Utility\GeneralUtility; | ||
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; | ||
use TYPO3\CMS\Core\Utility\GeneralUtility; | ||
use TYPO3\CMS\Core\Utility\HttpUtility; | ||
use TYPO3\CMS\Core\Utility\PathUtility; | ||
use TYPO3\CMS\Core\Utility\VersionNumberUtility; | ||
|
||
/** | ||
* Utilities for the phpMyAdmin third party database administration Tool | ||
* | ||
* @package TYPO3 | ||
* @subpackage tx_phpmyadmin | ||
* @author mehrwert <[email protected]> | ||
* @author Kasper Skårhøj <[email protected]> | ||
* @license GPL | ||
*/ | ||
class PmaModule | ||
{ | ||
|
||
/** | ||
* Configuration for the module | ||
* @var array $MCONF | ||
* @var array | ||
*/ | ||
public $MCONF = []; | ||
|
||
|
@@ -53,8 +50,6 @@ class PmaModule | |
|
||
/** | ||
* The main method of the backend module | ||
* | ||
* @return void | ||
*/ | ||
public function main() | ||
{ | ||
|
@@ -91,8 +86,11 @@ public function main() | |
// Abort if devIPmask is wildcarded | ||
if ($devIPmask != '*') { | ||
$message = '<h1>' . $GLOBALS['LANG']->getLL('module.headline.accessDenied') . '</h1> | ||
<p>' . sprintf($GLOBALS['LANG']->getLL('module.message.accessDenied.devIpMask'), | ||
$remoteAddress, $devIPmask) . '</p>'; | ||
<p>' . sprintf( | ||
$GLOBALS['LANG']->getLL('module.message.accessDenied.devIpMask'), | ||
$remoteAddress, | ||
$devIPmask | ||
) . '</p>'; | ||
if (!GeneralUtility::cmpIP($remoteAddress, $devIPmask)) { | ||
die($message); | ||
} | ||
|
@@ -103,8 +101,11 @@ public function main() | |
$allowedIps = trim($extensionConfiguration['allowedIps']); | ||
if (!empty($allowedIps)) { | ||
$message = '<h1>' . $GLOBALS['LANG']->getLL('module.headline.accessDenied') . '</h1> | ||
<p>' . sprintf($GLOBALS['LANG']->getLL('module.message.accessDenied.allowedIps'), | ||
$remoteAddress, $allowedIps) . '</p>'; | ||
<p>' . sprintf( | ||
$GLOBALS['LANG']->getLL('module.message.accessDenied.allowedIps'), | ||
$remoteAddress, | ||
$allowedIps | ||
) . '</p>'; | ||
if (!GeneralUtility::cmpIP($remoteAddress, $allowedIps)) { | ||
die($message); | ||
} | ||
|
@@ -193,7 +194,7 @@ public function main() | |
'nl' => 'nl', | ||
'cz' => 'cs-iso', | ||
'pl' => 'pl', | ||
'si' => 'sk' | ||
'si' => 'sk', | ||
]; | ||
$languageKey = $languageKeyMapping[$GLOBALS['LANG']->lang]; | ||
if (!$languageKey) { | ||
|
@@ -209,7 +210,7 @@ public function main() | |
$headers = [ | ||
'Expires: Mon, 26 Jul 1997 05:00:00 GMT', | ||
'Pragma: no-cache', | ||
'Cache-Control: private' | ||
'Cache-Control: private', | ||
]; | ||
// Send all headers | ||
foreach ($headers as $header) { | ||
|
@@ -220,24 +221,23 @@ public function main() | |
$redirectUri, | ||
HttpUtility::HTTP_STATUS_302 | ||
); | ||
|
||
} else { | ||
// Render body | ||
$this->doc = GeneralUtility::makeInstance('TYPO3\CMS\Backend\Template\DocumentTemplate'); | ||
$this->content = $this->doc->startPage($GLOBALS['LANG']->getLL('module.title')); | ||
$this->content .= '<h1>' . $GLOBALS['LANG']->getLL('module.headline.error') . '</h1>'; | ||
// No configuration set | ||
$this->content .= '<p>' . sprintf($GLOBALS['LANG']->getLL('module.error.invalidConfiguration'), | ||
$this->MCONF['PMA_subdir']) . '</p>'; | ||
$this->content .= '<p>' . sprintf( | ||
$GLOBALS['LANG']->getLL('module.error.invalidConfiguration'), | ||
$this->MCONF['PMA_subdir'] | ||
) . '</p>'; | ||
// End document | ||
$this->content .= $this->doc->endPage(); | ||
} | ||
} | ||
|
||
/** | ||
* Prints the content of the module directly to the browser | ||
* | ||
* @return void | ||
*/ | ||
public function printContent() | ||
{ | ||
|
@@ -247,17 +247,15 @@ public function printContent() | |
|
||
// Proceed if TYPO3_MODE is defined | ||
if (!defined('TYPO3_MODE')) { | ||
die ('<h1>Error</h1><p>Unable to determine TYPO3_MODE.</p>'); | ||
} else { | ||
die('<h1>Error</h1><p>Unable to determine TYPO3_MODE.</p>'); | ||
} | ||
|
||
// Proceed if BE loaded | ||
if (TYPO3_MODE === 'BE') { | ||
// Make instance: | ||
$GLOBALS['SOBE'] = GeneralUtility::makeInstance(PmaModule::class); | ||
$GLOBALS['SOBE']->main(); | ||
$GLOBALS['SOBE']->printContent(); | ||
|
||
} else { | ||
die ('<h1>Error</h1><p>The TYPO3 Backend is required for phpMyAdmin module but was not loaded.</p>'); | ||
die('<h1>Error</h1><p>The TYPO3 Backend is required for phpMyAdmin module but was not loaded.</p>'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,30 +15,25 @@ | |
*/ | ||
|
||
use Mehrwert\Phpmyadmin\Utility\EnvironmentUtility; | ||
use \TYPO3\CMS\Core\Utility\ExtensionManagementUtility; | ||
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; | ||
|
||
/** | ||
* Utilities for the phpMyAdmin third party database Administration Tool | ||
* | ||
* @package TYPO3 | ||
* @subpackage tx_phpmyadmin | ||
* @author mehrwert <[email protected]> | ||
* @license GPL | ||
*/ | ||
class BeUserAuthLogOffHook | ||
{ | ||
|
||
/** | ||
* Log off method for the signon-based phpMyAdmin extension. Called as post processing | ||
* hook in t3lib_userauth.php. Deletes the signon cookies | ||
* | ||
* @param array $params Additional params passed to the method | ||
* @param \TYPO3\CMS\Core\Authentication\AbstractUserAuthentication $ref The parent object (BE User Auth) | ||
* @return void | ||
*/ | ||
public function pmaLogOff($params = array(), $ref = null) | ||
public function pmaLogOff($params = [], $ref = null) | ||
{ | ||
|
||
if (isset($GLOBALS['PHP_UNIT_TEST_RUNNING']) === false) { | ||
// Define the cookie path | ||
$cookiePath = substr( | ||
|
@@ -89,4 +84,4 @@ public function pmaLogOff($params = array(), $ref = null) | |
session_start(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,14 +17,11 @@ | |
/** | ||
* Utilities for the phpMyAdmin third party database Administration Tool | ||
* | ||
* @package TYPO3 | ||
* @subpackage tx_phpmyadmin | ||
* @author mehrwert <[email protected]> | ||
* @license GPL | ||
*/ | ||
class EnvironmentUtility | ||
{ | ||
|
||
/** | ||
* The TYPO3 public web folder | ||
* | ||
|
@@ -63,4 +60,4 @@ public static function getBackendPath() | |
{ | ||
return self::getPublicPath() . '/typo3'; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters