Commit c004cc9b authored by Thomas Löffler's avatar Thomas Löffler
Browse files

Merge branch '208-improve-design' into 'develop'

Resolve "Improve Design"

Closes #208

See merge request !178
parents 99917543 861918ab
Pipeline #2220 passed with stages
in 2 minutes and 55 seconds
...@@ -2,44 +2,42 @@ ...@@ -2,44 +2,42 @@
# top-most EditorConfig file # top-most EditorConfig file
root = true root = true
charset = utf-8
# Get rid of whitespace to avoid diffs with a bunch of EOL changes
trim_trailing_whitespace = true
# Unix-style newlines with a newline ending every file # Unix-style newlines with a newline ending every file
[*] [*]
charset = utf-8
end_of_line = lf end_of_line = lf
insert_final_newline = true insert_final_newline = true
trim_trailing_whitespace = true
# CSS-Files # CSS-Files
[*.css] [*.css]
indent_style = tab indent_style = space
indent_size = 4 indent_size = 4
# HTML-Files # HTML-Files
[*.html] [*.html]
indent_style = tab indent_style = space
indent_size = 2 indent_size = 4
# TMPL-Files # TMPL-Files
[*.tmpl] [*.tmpl]
indent_style = tab indent_style = space
indent_size = 4 indent_size = 4
# LESS-Files # SCSS-Files
[*.less] [*.scss]
indent_style = tab indent_style = space
indent_size = 4 indent_size = 4
# JS-Files # JS-Files
[*.js] [*.js]
indent_style = tab indent_style = space
indent_size = 4 indent_size = 4
# JSON-Files # JSON-Files
[*.json] [*.json]
indent_style = tab indent_style = space
indent_size = 4 indent_size = 4
# PHP-Files # PHP-Files
...@@ -62,23 +60,27 @@ indent_size = 4 ...@@ -62,23 +60,27 @@ indent_size = 4
indent_style = space indent_style = space
indent_size = 2 indent_size = 2
# package.json or .travis.yml # package.json
[{package.json,.travis.yml}] # .travis.yml
# bower.json
[{package.json,.travis.yml,bower.json}]
indent_style = space indent_style = space
indent_size = 2 indent_size = 4
# TypoScript # TypoScript
[*.ts] [*.ts]
indent_style = space indent_style = space
indent_size = 2 indent_size = 4
[*.typoscript]
indent_style = space
indent_size = 4
# XLF-Files # XLF-Files
[*.xlf] [*.xlf]
indent_style = tab indent_style = space
indent_size = 4 indent_size = 4
# SQL-Files # SQL-Files
[*.sql] [*.sql]
indent_style = tab indent_style = space
indent_size = 2 indent_size = 2
...@@ -1625,11 +1625,11 @@ ...@@ -1625,11 +1625,11 @@
}, },
{ {
"name": "t3o/t3olayout", "name": "t3o/t3olayout",
"version": "1.0.7", "version": "1.0.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://git-t3o.typo3.org/t3o/t3olayout.git", "url": "https://git-t3o.typo3.org/t3o/t3olayout.git",
"reference": "ff8cfafd888af207cd74c1b48915e94ff34b9926" "reference": "f076f24e7cd75c9aaf70196dc533a95a6a93645c"
}, },
"require": { "require": {
"typo3-ter/ig-ldap-sso-auth": "^3.2" "typo3-ter/ig-ldap-sso-auth": "^3.2"
...@@ -1648,7 +1648,7 @@ ...@@ -1648,7 +1648,7 @@
"keywords": [ "keywords": [
"TYPO3 CMS" "TYPO3 CMS"
], ],
"time": "2017-08-28T21:32:11+00:00" "time": "2017-09-04T15:13:14+00:00"
}, },
{ {
"name": "typo3-ter/ig-ldap-sso-auth", "name": "typo3-ter/ig-ldap-sso-auth",
......
This diff is collapsed.
...@@ -14,4 +14,4 @@ ...@@ -14,4 +14,4 @@
*/ */
class tx_ter_exception extends Exception class tx_ter_exception extends Exception
{ {
} }
\ No newline at end of file
...@@ -42,7 +42,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility; ...@@ -42,7 +42,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
// Make sure that we are executed only in TYPO3 context // Make sure that we are executed only in TYPO3 context
if (!defined('TYPO3_MODE')) { if (!defined('TYPO3_MODE')) {
die ('Access denied.'); die('Access denied.');
} }
// Error codes: // Error codes:
...@@ -135,25 +135,30 @@ class tx_ter_helper ...@@ -135,25 +135,30 @@ class tx_ter_helper
public function getValidUser($accountData) public function getValidUser($accountData)
{ {
if (!strlen($accountData->username) || (!strlen($accountData->password))) { if (!strlen($accountData->username) || (!strlen($accountData->password))) {
throw new tx_ter_exception_unauthorized ('No user or no password submitted.', TX_TER_ERROR_GENERAL_NOUSERORPASSWORD); throw new tx_ter_exception_unauthorized('No user or no password submitted.', TX_TER_ERROR_GENERAL_NOUSERORPASSWORD);
} }
$res = $this->getDatabaseConnection()->exec_SELECTquery( $res = $this->getDatabaseConnection()->exec_SELECTquery(
'*', 'fe_users', '*',
'fe_users',
'username=' . $this->getDatabaseConnection()->fullQuoteStr($accountData->username, 'fe_users') . $this->getTyposcriptFrontendObject()->sys_page->enableFields('fe_users') 'username=' . $this->getDatabaseConnection()->fullQuoteStr($accountData->username, 'fe_users') . $this->getTyposcriptFrontendObject()->sys_page->enableFields('fe_users')
); );
if ($row = $this->getDatabaseConnection()->sql_fetch_assoc($res)) { if ($row = $this->getDatabaseConnection()->sql_fetch_assoc($res)) {
if (!$this->userIsAlreadyLoggedIn($accountData) && !$this->ldapValidationSucceeded($accountData)) {
if (!$this->userIsAlreadyLoggedIn( $accountData
) && !$this->ldapValidationSucceeded($accountData)
) {
throw new tx_ter_exception_unauthorized ('Wrong password.', TX_TER_ERROR_GENERAL_WRONGPASSWORD); throw new tx_ter_exception_unauthorized ('Wrong password.', TX_TER_ERROR_GENERAL_WRONGPASSWORD);
} }
} else { } else {
throw new tx_ter_exception_unauthorized ('The specified user does not exist. You need to login first on extensions.typo3.org.', TX_TER_ERROR_GENERAL_USERNOTFOUND); throw new tx_ter_exception_unauthorized('The specified user does not exist. You need to login first on extensions.typo3.org.', TX_TER_ERROR_GENERAL_USERNOTFOUND);
} }
$row['admin'] = (intval($this->pluginObj->conf['adminFrontendUsergroupUid']) && GeneralUtility::inList( $row['admin'] = (intval($this->pluginObj->conf['adminFrontendUsergroupUid']) && GeneralUtility::inList(
$row['usergroup'], $this->pluginObj->conf['adminFrontendUsergroupUid'] $row['usergroup'],
)); $this->pluginObj->conf['adminFrontendUsergroupUid']
));
return $row; return $row;
} }
...@@ -211,13 +216,18 @@ class tx_ter_helper ...@@ -211,13 +216,18 @@ class tx_ter_helper
} else { } else {
$success = false; $success = false;
$res = $this->getDatabaseConnection()->exec_SELECTquery( $res = $this->getDatabaseConnection()->exec_SELECTquery(
'*', 'fe_users', 'username=' . $this->getDatabaseConnection()->fullQuoteStr( '*',
$accountData->username, 'fe_users' 'fe_users',
'username=' . $this->getDatabaseConnection()->fullQuoteStr(
$accountData->username,
'fe_users'
) . $GLOBALS['TSFE']->sys_page->enableFields('fe_users') ) . $GLOBALS['TSFE']->sys_page->enableFields('fe_users')
); );
if ($row = $this->getDatabaseConnection()->sql_fetch_assoc($res)) { if ($row = $this->getDatabaseConnection()->sql_fetch_assoc($res)) {
if ($this->ldapValidationSucceeded($accountData)) {
if ($this->ldapValidationSucceeded( $accountData)
) {
$success = true; $success = true;
} }
} }
...@@ -243,7 +253,9 @@ class tx_ter_helper ...@@ -243,7 +253,9 @@ class tx_ter_helper
$isAvailable = true; $isAvailable = true;
$res = $this->getDatabaseConnection()->exec_SELECTquery( $res = $this->getDatabaseConnection()->exec_SELECTquery(
'extensionkey', 'tx_ter_extensionkeys', 'pid=' . intval($this->pluginObj->extensionsPID) 'extensionkey',
'tx_ter_extensionkeys',
'pid=' . intval($this->pluginObj->extensionsPID)
); );
while ($row = $this->getDatabaseConnection()->sql_fetch_row($res)) { while ($row = $this->getDatabaseConnection()->sql_fetch_row($res)) {
if ($cleanedExtensionKey === str_replace('_', '', $row[0])) { if ($cleanedExtensionKey === str_replace('_', '', $row[0])) {
...@@ -287,7 +299,9 @@ class tx_ter_helper ...@@ -287,7 +299,9 @@ class tx_ter_helper
public function getLatestVersionNumberOfExtension($extensionKey) public function getLatestVersionNumberOfExtension($extensionKey)
{ {
$res = $this->getDatabaseConnection()->exec_SELECTquery( $res = $this->getDatabaseConnection()->exec_SELECTquery(
'version', 'tx_ter_extensions', 'extensionkey=' . $this->getDatabaseConnection()->fullQuoteStr($extensionKey, 'tx_ter_extensions') . ' 'version',
'tx_ter_extensions',
'extensionkey=' . $this->getDatabaseConnection()->fullQuoteStr($extensionKey, 'tx_ter_extensions') . '
AND pid=' . intval($this->pluginObj->extensionsPID) AND pid=' . intval($this->pluginObj->extensionsPID)
); );
$latestVersion = false; $latestVersion = false;
...@@ -333,7 +347,8 @@ class tx_ter_helper ...@@ -333,7 +347,8 @@ class tx_ter_helper
GeneralUtility::devLog('writing extension index!', 'tx_ter_helper', 0); GeneralUtility::devLog('writing extension index!', 'tx_ter_helper', 0);
if (!@is_dir($this->pluginObj->repositoryDir)) { if (!@is_dir($this->pluginObj->repositoryDir)) {
throw new tx_ter_exception_internalServerError( throw new tx_ter_exception_internalServerError(
'Extension repository directory does not exist.', TX_TER_ERROR_GENERAL_EXTREPDIRDOESNTEXIST 'Extension repository directory does not exist.',
TX_TER_ERROR_GENERAL_EXTREPDIRDOESNTEXIST
); );
} }
...@@ -341,14 +356,16 @@ class tx_ter_helper ...@@ -341,14 +356,16 @@ class tx_ter_helper
$res = $this->getDatabaseConnection()->exec_SELECTquery( $res = $this->getDatabaseConnection()->exec_SELECTquery(
'uid,tstamp,extensionkey,version,title,description,state,reviewstate,category,downloadcounter,t3xfilemd5', 'uid,tstamp,extensionkey,version,title,description,state,reviewstate,category,downloadcounter,t3xfilemd5',
'tx_ter_extensions', '1' 'tx_ter_extensions',
'1'
); );
// Read the extension records from the DB: // Read the extension records from the DB:
$extensionsAndVersionsArr = []; $extensionsAndVersionsArr = [];
$extensionsTotalDownloadsArr = []; $extensionsTotalDownloadsArr = [];
while ($row = $this->getDatabaseConnection()->sql_fetch_assoc($res)) { while ($row = $this->getDatabaseConnection()->sql_fetch_assoc($res)) {
$res2 = $this->getDatabaseConnection()->exec_SELECTquery( $res2 = $this->getDatabaseConnection()->exec_SELECTquery(
'ownerusername,downloadcounter', 'tx_ter_extensionkeys', 'ownerusername,downloadcounter',
'tx_ter_extensionkeys',
'extensionkey=' . $this->getDatabaseConnection()->fullQuoteStr($row['extensionkey'], 'tx_ter_extensionkeys') 'extensionkey=' . $this->getDatabaseConnection()->fullQuoteStr($row['extensionkey'], 'tx_ter_extensionkeys')
); );
$extensionKeyRow = $this->getDatabaseConnection()->sql_fetch_assoc($res2); $extensionKeyRow = $this->getDatabaseConnection()->sql_fetch_assoc($res2);
...@@ -357,7 +374,8 @@ class tx_ter_helper ...@@ -357,7 +374,8 @@ class tx_ter_helper
$res2 = $this->getDatabaseConnection()->exec_SELECTquery( $res2 = $this->getDatabaseConnection()->exec_SELECTquery(
'lastuploaddate,uploadcomment,dependencies,composerinfo,authorname,authoremail,authorcompany', 'lastuploaddate,uploadcomment,dependencies,composerinfo,authorname,authoremail,authorcompany',
'tx_ter_extensiondetails', 'extensionuid=' . (int)$row['uid'] 'tx_ter_extensiondetails',
'extensionuid=' . (int)$row['uid']
); );
$detailsRow = $this->getDatabaseConnection()->sql_fetch_assoc($res2); $detailsRow = $this->getDatabaseConnection()->sql_fetch_assoc($res2);
if (is_array($detailsRow)) { if (is_array($detailsRow)) {
...@@ -366,23 +384,24 @@ class tx_ter_helper ...@@ -366,23 +384,24 @@ class tx_ter_helper
$extensionsAndVersionsArr [$row['extensionkey']]['versions'][$row['version']] = $row; $extensionsAndVersionsArr [$row['extensionkey']]['versions'][$row['version']] = $row;
} }
// Prepare the DOM object: // Prepare the DOM object:
$dom = new DOMDocument ('1.0', 'utf-8'); $dom = new DOMDocument('1.0', 'utf-8');
$dom->formatOutput = true; $dom->formatOutput = true;
$extensionsObj = $dom->appendChild(new DOMElement('extensions')); $extensionsObj = $dom->appendChild(new DOMElement('extensions'));
// Create the nested XML structure: // Create the nested XML structure:
foreach ($extensionsAndVersionsArr as $extensionKey => $extensionVersionsArr) { foreach ($extensionsAndVersionsArr as $extensionKey => $extensionVersionsArr) {
$extensionObj = $extensionsObj->appendChild(new DOMElement('extension')); $extensionObj = $extensionsObj->appendChild(new DOMElement('extension'));
$extensionObj->appendChild(new DOMAttr ('extensionkey', $extensionKey)); $extensionObj->appendChild(new DOMAttr('extensionkey', $extensionKey));
$extensionObj->appendChild( $extensionObj->appendChild(
new DOMElement ( new DOMElement(
'downloadcounter', $this->xmlentities($extensionsTotalDownloadsArr[$extensionKey]) 'downloadcounter',
$this->xmlentities($extensionsTotalDownloadsArr[$extensionKey])
) )
); );
foreach ($extensionVersionsArr['versions'] as $versionNumber => $extensionVersionArr) { foreach ($extensionVersionsArr['versions'] as $versionNumber => $extensionVersionArr) {
$versionObj = $extensionObj->appendChild(new DOMElement('version')); $versionObj = $extensionObj->appendChild(new DOMElement('version'));
$versionObj->appendChild(new DOMAttr ('version', $versionNumber)); $versionObj->appendChild(new DOMAttr('version', $versionNumber));
$versionObj->appendChild(new DOMElement('title', $this->xmlentities($extensionVersionArr['title']))); $versionObj->appendChild(new DOMElement('title', $this->xmlentities($extensionVersionArr['title'])));
$versionObj->appendChild(new DOMElement('description', $this->xmlentities($extensionVersionArr['description']))); $versionObj->appendChild(new DOMElement('description', $this->xmlentities($extensionVersionArr['description'])));
$versionObj->appendChild(new DOMElement('state', $this->xmlentities($extensionVersionArr['state']))); $versionObj->appendChild(new DOMElement('state', $this->xmlentities($extensionVersionArr['state'])));
...@@ -390,13 +409,15 @@ class tx_ter_helper ...@@ -390,13 +409,15 @@ class tx_ter_helper
$versionObj->appendChild(new DOMElement('category', $this->xmlentities($extensionVersionArr['category']))); $versionObj->appendChild(new DOMElement('category', $this->xmlentities($extensionVersionArr['category'])));
$versionObj->appendChild( $versionObj->appendChild(
new DOMElement( new DOMElement(
'downloadcounter', $this->xmlentities($extensionVersionArr['downloadcounter']) 'downloadcounter',
$this->xmlentities($extensionVersionArr['downloadcounter'])
) )
); );
$versionObj->appendChild(new DOMElement('lastuploaddate', $extensionVersionArr['lastuploaddate'])); $versionObj->appendChild(new DOMElement('lastuploaddate', $extensionVersionArr['lastuploaddate']));
$versionObj->appendChild( $versionObj->appendChild(
new DOMElement( new DOMElement(
'uploadcomment', $this->xmlentities($extensionVersionArr['uploadcomment']) 'uploadcomment',
$this->xmlentities($extensionVersionArr['uploadcomment'])
) )
); );
$versionObj->appendChild(new DOMElement('dependencies', $extensionVersionArr['dependencies'])); $versionObj->appendChild(new DOMElement('dependencies', $extensionVersionArr['dependencies']));
...@@ -405,12 +426,14 @@ class tx_ter_helper ...@@ -405,12 +426,14 @@ class tx_ter_helper
$versionObj->appendChild(new DOMElement('authoremail', $this->xmlentities($extensionVersionArr['authoremail']))); $versionObj->appendChild(new DOMElement('authoremail', $this->xmlentities($extensionVersionArr['authoremail'])));
$versionObj->appendChild( $versionObj->appendChild(
new DOMElement( new DOMElement(
'authorcompany', $this->xmlentities($extensionVersionArr['authorcompany']) 'authorcompany',
$this->xmlentities($extensionVersionArr['authorcompany'])
) )
); );
$versionObj->appendChild( $versionObj->appendChild(
new DOMElement( new DOMElement(
'ownerusername', $this->xmlentities($extensionVersionArr['ownerusername']) 'ownerusername',
$this->xmlentities($extensionVersionArr['ownerusername'])
) )
); );
$versionObj->appendChild(new DOMElement('t3xfilemd5', $extensionVersionArr['t3xfilemd5'])); $versionObj->appendChild(new DOMElement('t3xfilemd5', $extensionVersionArr['t3xfilemd5']));
...@@ -423,7 +446,7 @@ class tx_ter_helper ...@@ -423,7 +446,7 @@ class tx_ter_helper
// Write XML data to disk: // Write XML data to disk:
$fh = fopen($this->pluginObj->repositoryDir . 'new-extensions.xml.gz', 'wb'); $fh = fopen($this->pluginObj->repositoryDir . 'new-extensions.xml.gz', 'wb');
if (!$fh) { if (!$fh) {
throw new tx_ter_exception_internalServerError ( throw new tx_ter_exception_internalServerError(
'Write error while writing extensions index file: ' . $this->pluginObj->repositoryDir . 'extensions.xml', 'Write error while writing extensions index file: ' . $this->pluginObj->repositoryDir . 'extensions.xml',
TX_TER_ERROR_UPLOADEXTENSION_WRITEERRORWHILEWRITINGEXTENSIONSINDEX TX_TER_ERROR_UPLOADEXTENSION_WRITEERRORWHILEWRITINGEXTENSIONSINDEX
); );
...@@ -442,14 +465,15 @@ class tx_ter_helper ...@@ -442,14 +465,15 @@ class tx_ter_helper
@unlink($this->pluginObj->repositoryDir . 'extensions.xml.gz'); @unlink($this->pluginObj->repositoryDir . 'extensions.xml.gz');
rename($this->pluginObj->repositoryDir . 'new-extensions.xml.gz', $this->pluginObj->repositoryDir . 'extensions.xml.gz'); rename($this->pluginObj->repositoryDir . 'new-extensions.xml.gz', $this->pluginObj->repositoryDir . 'extensions.xml.gz');
GeneralUtility::writeFile( GeneralUtility::writeFile(
$this->pluginObj->repositoryDir . 'extensions.md5', md5_file($this->pluginObj->repositoryDir . 'extensions.xml.gz') $this->pluginObj->repositoryDir . 'extensions.md5',
md5_file($this->pluginObj->repositoryDir . 'extensions.xml.gz')
); );
// Write serialized array file to disk: // Write serialized array file to disk:
$fh = fopen($this->pluginObj->repositoryDir . 'new-extensions.bin', 'wb'); $fh = fopen($this->pluginObj->repositoryDir . 'new-extensions.bin', 'wb');
if (!$fh) { if (!$fh) {
throw new tx_ter_exception_internalServerError ( throw new tx_ter_exception_internalServerError(
'Write error while writing extensions index file: ' . $this->pluginObj->repositoryDir . 'extensions.bin', 'Write error while writing extensions index file: ' . $this->pluginObj->repositoryDir . 'extensions.bin',
TX_TER_ERROR_UPLOADEXTENSION_WRITEERRORWHILEWRITINGEXTENSIONSINDEX TX_TER_ERROR_UPLOADEXTENSION_WRITEERRORWHILEWRITINGEXTENSIONSINDEX
); );
...@@ -459,7 +483,7 @@ class tx_ter_helper ...@@ -459,7 +483,7 @@ class tx_ter_helper
if (!@filesize($this->pluginObj->repositoryDir . 'new-extensions.bin') > 0) { if (!@filesize($this->pluginObj->repositoryDir . 'new-extensions.bin') > 0) {
GeneralUtility::devLog('Newly created extension index is zero bytes!', 'tx_ter_helper', 0); GeneralUtility::devLog('Newly created extension index is zero bytes!', 'tx_ter_helper', 0);
throw new tx_ter_exception_internalServerError ( throw new tx_ter_exception_internalServerError(
'Write error while writing extensions index file (zero bytes): ' . $this->pluginObj->repositoryDir . 'extensions.bin', 'Write error while writing extensions index file (zero bytes): ' . $this->pluginObj->repositoryDir . 'extensions.bin',
TX_TER_ERROR_UPLOADEXTENSION_WRITEERRORWHILEWRITINGEXTENSIONSINDEX TX_TER_ERROR_UPLOADEXTENSION_WRITEERRORWHILEWRITINGEXTENSIONSINDEX
); );
...@@ -467,7 +491,6 @@ class tx_ter_helper ...@@ -467,7 +491,6 @@ class tx_ter_helper
@unlink($this->pluginObj->repositoryDir . 'extensions.bin'); @unlink($this->pluginObj->repositoryDir . 'extensions.bin');
rename($this->pluginObj->repositoryDir . 'new-extensions.bin', $this->pluginObj->repositoryDir . 'extensions.bin'); rename($this->pluginObj->repositoryDir . 'new-extensions.bin', $this->pluginObj->repositoryDir . 'extensions.bin');
} }
/** /**
......
...@@ -36,7 +36,9 @@ class tx_ter_tcaLabel ...@@ -36,7 +36,9 @@ class tx_ter_tcaLabel
} }
$result = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow( $result = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
'extensionkey', 'tx_ter_extensions', 'uid=' . (int)$params['row']['uid'] 'extensionkey',
'tx_ter_extensions',
'uid=' . (int)$params['row']['uid']
); );
if (!empty($result['extensionkey'])) { if (!empty($result['extensionkey'])) {
...@@ -45,5 +47,4 @@ class tx_ter_tcaLabel ...@@ -45,5 +47,4 @@ class tx_ter_tcaLabel
$params['title'] = (int)$params['row']['uid']; $params['title'] = (int)$params['row']['uid'];
} }
} }
}
}
\ No newline at end of file
...@@ -73,7 +73,6 @@ class tx_ter_buildextensionindex ...@@ -73,7 +73,6 @@ class tx_ter_buildextensionindex
} }
} }
} }
} }
$pluginObj = new tx_ter_buildextensionindex(); $pluginObj = new tx_ter_buildextensionindex();
......
...@@ -4,5 +4,3 @@ ...@@ -4,5 +4,3 @@
define('TYPO3_MOD_PATH', '../typo3conf/ext/ter/cli/'); define('TYPO3_MOD_PATH', '../typo3conf/ext/ter/cli/');
$BACK_PATH = '../../../../typo3/'; $BACK_PATH = '../../../../typo3/';
$MCONF['name'] = '_CLI_ter'; $MCONF['name'] = '_CLI_ter';
?>
#! /usr/bin/php -q #! /usr/bin/php -q
<?php <?php
die ('Access denied'); die('Access denied');