Commit 6f895ba4 authored by Markus Sommer's avatar Markus Sommer Committed by Thomas Löffler

[TASK] CGL Fix

parent 99917543
...@@ -68,7 +68,7 @@ class tx_ter_api ...@@ -68,7 +68,7 @@ class tx_ter_api
*/ */
public function __construct($parentObj) public function __construct($parentObj)
{ {
$this->helperObj = new tx_ter_helper ($parentObj); $this->helperObj = new tx_ter_helper($parentObj);
$this->parentObj = $parentObj; $this->parentObj = $parentObj;
$this->cObj = $parentObj->cObj; $this->cObj = $parentObj->cObj;
} }
...@@ -128,15 +128,17 @@ class tx_ter_api ...@@ -128,15 +128,17 @@ class tx_ter_api
// All following code will then fail, because it is tested if it was an array. // All following code will then fail, because it is tested if it was an array.
// To make it work, we wrap the object into an array, so that the following code works as expected // To make it work, we wrap the object into an array, so that the following code works as expected
if (!empty($extensionInfoData->technicalData->dependencies) && is_object( if (!empty($extensionInfoData->technicalData->dependencies) && is_object(
$extensionInfoData->technicalData->dependencies $extensionInfoData->technicalData->dependencies
) )
) { ) {
$extensionInfoData->technicalData->dependencies = [$extensionInfoData->technicalData->dependencies]; $extensionInfoData->technicalData->dependencies = [$extensionInfoData->technicalData->dependencies];
} }
$extensionKey = strtolower($extensionInfoData->extensionKey); $extensionKey = strtolower($extensionInfoData->extensionKey);
if (TYPO3_DLOG) { if (TYPO3_DLOG) {
GeneralUtility::devLog( GeneralUtility::devLog(
'tx_ter_api->uploadExtension()', 'ter', 0, 'tx_ter_api->uploadExtension()',
'ter',
0,
'Upload of extension ' . $extensionKey . ' (' . $extensionInfoData->version . ') by user ' . $accountData->username 'Upload of extension ' . $extensionKey . ' (' . $extensionInfoData->version . ') by user ' . $accountData->username
); );
} }
...@@ -147,8 +149,8 @@ class tx_ter_api ...@@ -147,8 +149,8 @@ class tx_ter_api
throw new tx_ter_exception_notFound('Extension "' . $extensionKey . '" does not exist.', TX_TER_ERROR_UPLOADEXTENSION_EXTENSIONDOESNTEXIST); throw new tx_ter_exception_notFound('Extension "' . $extensionKey . '" does not exist.', TX_TER_ERROR_UPLOADEXTENSION_EXTENSIONDOESNTEXIST);
} }
if (strtolower($extensionKeyRecordArr['ownerusername']) !== strtolower( if (strtolower($extensionKeyRecordArr['ownerusername']) !== strtolower(
$accountData->username $accountData->username
) && $uploadUserRecordArr['admin'] !== true ) && $uploadUserRecordArr['admin'] !== true
) { ) {
throw new tx_ter_exception_unauthorized('Access denied.', TX_TER_ERROR_UPLOADEXTENSION_ACCESSDENIED); throw new tx_ter_exception_unauthorized('Access denied.', TX_TER_ERROR_UPLOADEXTENSION_ACCESSDENIED);
} }
...@@ -158,7 +160,8 @@ class tx_ter_api ...@@ -158,7 +160,8 @@ class tx_ter_api
throw new tx_ter_exception( throw new tx_ter_exception(
'Your version number "' . htmlspecialchars( 'Your version number "' . htmlspecialchars(
$extensionInfoData->version $extensionInfoData->version
) . '" is invalid. Allowed are three numbers with maximum 999, e.g. "7.8.999".', 1429912029 ) . '" is invalid. Allowed are three numbers with maximum 999, e.g. "7.8.999".',
1429912029
); );
} }
...@@ -245,7 +248,8 @@ class tx_ter_api ...@@ -245,7 +248,8 @@ class tx_ter_api
throw new tx_ter_exception( throw new tx_ter_exception(
'Your version number "' . htmlspecialchars( 'Your version number "' . htmlspecialchars(
$extensionInfoData->version $extensionInfoData->version
) . '" is invalid. Allowed are three numbers with maximum 999, e.g. "7.8.999".', 1429912029 ) . '" is invalid. Allowed are three numbers with maximum 999, e.g. "7.8.999".',
1429912029
); );
} }
...@@ -289,7 +293,9 @@ class tx_ter_api ...@@ -289,7 +293,9 @@ class tx_ter_api
{ {
if (TYPO3_DLOG) { if (TYPO3_DLOG) {
GeneralUtility::devLog( GeneralUtility::devLog(
'tx_ter_api->deleteExtension()', 'ter', 0, 'tx_ter_api->deleteExtension()',
'ter',
0,
'Deletion of extension ' . $extensionKey . ' (' . $version . ') by user ' . $accountData->username 'Deletion of extension ' . $extensionKey . ' (' . $version . ') by user ' . $accountData->username
); );
} }
...@@ -304,7 +310,8 @@ class tx_ter_api ...@@ -304,7 +310,8 @@ class tx_ter_api
$extensionKeyRecordArr = $this->helperObj->getExtensionKeyRecord($extensionKey); $extensionKeyRecordArr = $this->helperObj->getExtensionKeyRecord($extensionKey);
if ($extensionKeyRecordArr == false) { if ($extensionKeyRecordArr == false) {
throw new tx_ter_exception_notFound( throw new tx_ter_exception_notFound(
'Extension does not exist.', TX_TER_ERROR_DELETEEXTENSION_EXTENSIONDOESNTEXIST 'Extension does not exist.',
TX_TER_ERROR_DELETEEXTENSION_EXTENSIONDOESNTEXIST
); );
} }
...@@ -403,27 +410,33 @@ class tx_ter_api ...@@ -403,27 +410,33 @@ class tx_ter_api
$whereClause = 'pid=' . (int)$this->parentObj->extensionsPID; $whereClause = 'pid=' . (int)$this->parentObj->extensionsPID;
if (!empty($extensionKeyFilterOptions->username)) { if (!empty($extensionKeyFilterOptions->username)) {
$whereClause .= ' AND ownerusername = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr( $whereClause .= ' AND ownerusername = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr(
$extensionKeyFilterOptions->username, 'tx_ter_extensionkeys' $extensionKeyFilterOptions->username,
); 'tx_ter_extensionkeys'
);
} }
if (!empty($extensionKeyFilterOptions->title)) { if (!empty($extensionKeyFilterOptions->title)) {
$whereClause .= ' AND title = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr( $whereClause .= ' AND title = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr(
$extensionKeyFilterOptions->title, 'tx_ter_extensionkeys' $extensionKeyFilterOptions->title,
); 'tx_ter_extensionkeys'
);
} }
if (!empty($extensionKeyFilterOptions->description)) { if (!empty($extensionKeyFilterOptions->description)) {
$whereClause .= ' AND description = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr( $whereClause .= ' AND description = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr(
$extensionKeyFilterOptions->description, 'tx_ter_extensionkeys' $extensionKeyFilterOptions->description,
); 'tx_ter_extensionkeys'
);
} }
if (!empty($extensionKeyFilterOptions->extensionKey)) { if (!empty($extensionKeyFilterOptions->extensionKey)) {
$whereClause .= ' AND extensionkey = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr( $whereClause .= ' AND extensionkey = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr(
$extensionKeyFilterOptions->extensionKey, 'tx_ter_extensionkeys' $extensionKeyFilterOptions->extensionKey,
); 'tx_ter_extensionkeys'
);
} }
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'extensionkey,title,description,ownerusername', 'tx_ter_extensionkeys', $whereClause 'extensionkey,title,description,ownerusername',
'tx_ter_extensionkeys',
$whereClause
); );
if ($res) { if ($res) {
...@@ -433,7 +446,8 @@ class tx_ter_api ...@@ -433,7 +446,8 @@ class tx_ter_api
$resultCode = TX_TER_RESULT_GENERAL_OK; $resultCode = TX_TER_RESULT_GENERAL_OK;
} else { } else {
throw new tx_ter_exception_internalServerError( throw new tx_ter_exception_internalServerError(
'Database error while fetching extension keys.', TX_TER_ERROR_GENERAL_DATABASEERROR 'Database error while fetching extension keys.',
TX_TER_ERROR_GENERAL_DATABASEERROR
); );
} }
...@@ -465,15 +479,18 @@ class tx_ter_api ...@@ -465,15 +479,18 @@ class tx_ter_api
if (is_array($extensionKeyRecordArr)) { if (is_array($extensionKeyRecordArr)) {
if (strtolower($extensionKeyRecordArr['ownerusername']) != strtolower( if (strtolower($extensionKeyRecordArr['ownerusername']) != strtolower(
$accountData->username $accountData->username
) && $userRecordArr['admin'] !== true ) && $userRecordArr['admin'] !== true
) { ) {
throw new tx_ter_exception_unauthorized('Access denied.', TX_TER_ERROR_DELETEEXTENSIONKEY_ACCESSDENIED); throw new tx_ter_exception_unauthorized('Access denied.', TX_TER_ERROR_DELETEEXTENSIONKEY_ACCESSDENIED);
} }
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'extensionkey', 'tx_ter_extensions', 'extensionkey=' . $GLOBALS['TYPO3_DB']->fullQuoteStr( 'extensionkey',
$extensionKey, 'tx_ter_extensions' 'tx_ter_extensions',
'extensionkey=' . $GLOBALS['TYPO3_DB']->fullQuoteStr(
$extensionKey,
'tx_ter_extensions'
) . ' AND pid=' . (int)$this->parentObj->extensionsPID ) . ' AND pid=' . (int)$this->parentObj->extensionsPID
); );
...@@ -482,13 +499,16 @@ class tx_ter_api ...@@ -482,13 +499,16 @@ class tx_ter_api
$resultCode = TX_TER_ERROR_DELETEEXTENSIONKEY_CANTDELETEBECAUSEVERSIONSEXIST; $resultCode = TX_TER_ERROR_DELETEEXTENSIONKEY_CANTDELETEBECAUSEVERSIONSEXIST;
} else { } else {
$res = $GLOBALS['TYPO3_DB']->exec_DELETEquery( $res = $GLOBALS['TYPO3_DB']->exec_DELETEquery(
'tx_ter_extensionkeys', 'extensionkey=' . $GLOBALS['TYPO3_DB']->fullQuoteStr( 'tx_ter_extensionkeys',
$extensionKey, 'tx_ter_extensions' 'extensionkey=' . $GLOBALS['TYPO3_DB']->fullQuoteStr(
$extensionKey,
'tx_ter_extensions'
) . ' AND pid=' . (int)$this->parentObj->extensionsPID ) . ' AND pid=' . (int)$this->parentObj->extensionsPID
); );
if (!$res) { if (!$res) {
throw new tx_ter_exception_internalServerError( throw new tx_ter_exception_internalServerError(
'Database error while deleting extension key.', TX_TER_ERROR_GENERAL_DATABASEERROR 'Database error while deleting extension key.',
TX_TER_ERROR_GENERAL_DATABASEERROR
); );
} }
...@@ -497,7 +517,8 @@ class tx_ter_api ...@@ -497,7 +517,8 @@ class tx_ter_api
} }
} else { } else {
throw new tx_ter_exception_internalServerError( throw new tx_ter_exception_internalServerError(
'Database error while fetching versions.', TX_TER_ERROR_GENERAL_DATABASEERROR 'Database error while fetching versions.',
TX_TER_ERROR_GENERAL_DATABASEERROR
); );
} }
} else { } else {
...@@ -539,8 +560,8 @@ class tx_ter_api ...@@ -539,8 +560,8 @@ class tx_ter_api
if (is_array($extensionKeyRecordArr)) { if (is_array($extensionKeyRecordArr)) {
if (strtolower($extensionKeyRecordArr['ownerusername']) != strtolower( if (strtolower($extensionKeyRecordArr['ownerusername']) != strtolower(
$accountData->username $accountData->username
) && $userRecordArr['admin'] !== true ) && $userRecordArr['admin'] !== true
) { ) {
throw new tx_ter_exception_unauthorized('Access denied.', TX_TER_ERROR_MODIFYEXTENSIONKEY_ACCESSDENIED); throw new tx_ter_exception_unauthorized('Access denied.', TX_TER_ERROR_MODIFYEXTENSIONKEY_ACCESSDENIED);
} }
...@@ -614,7 +635,8 @@ class tx_ter_api ...@@ -614,7 +635,8 @@ class tx_ter_api
'DownloadCounter: Trying to increase extension download counters - user "' . $accountData->username . '" connected from IP "' . GeneralUtility::getIndpEnv( 'DownloadCounter: Trying to increase extension download counters - user "' . $accountData->username . '" connected from IP "' . GeneralUtility::getIndpEnv(
'REMOTE_ADDR' 'REMOTE_ADDR'
) . '" - number of results: ' . count($extensionVersionsAndIncrementors->extensionVersionAndIncrementor), ) . '" - number of results: ' . count($extensionVersionsAndIncrementors->extensionVersionAndIncrementor),
'tx_ter_api', 0 'tx_ter_api',
0
); );
$userRecordArr = $this->helperObj->getValidUser($accountData); $userRecordArr = $this->helperObj->getValidUser($accountData);
...@@ -622,7 +644,9 @@ class tx_ter_api ...@@ -622,7 +644,9 @@ class tx_ter_api
if ($mirrorsFrontendUsergroupUid == 0) { if ($mirrorsFrontendUsergroupUid == 0) {
GeneralUtility::devLog( GeneralUtility::devLog(
'DownloadCounter: No usergroup for mirrors has been defined on the server side. Aborting ...', 'tx_ter_api', 3 'DownloadCounter: No usergroup for mirrors has been defined on the server side. Aborting ...',
'tx_ter_api',
3
); );
throw new tx_ter_exception_internalServerError( throw new tx_ter_exception_internalServerError(
'Warning: No usergroup for mirrors has been defined on the server side. Aborting ...', 'Warning: No usergroup for mirrors has been defined on the server side. Aborting ...',
...@@ -631,7 +655,10 @@ class tx_ter_api ...@@ -631,7 +655,10 @@ class tx_ter_api
} }
if (!GeneralUtility::inList($userRecordArr['usergroup'], $mirrorsFrontendUsergroupUid)) { if (!GeneralUtility::inList($userRecordArr['usergroup'], $mirrorsFrontendUsergroupUid)) {
GeneralUtility::devLog( GeneralUtility::devLog(
'DownloadCounter: Access denied for user ' . $accountData->username, 'tx_ter_api', 3, $userRecordArr 'DownloadCounter: Access denied for user ' . $accountData->username,
'tx_ter_api',
3,
$userRecordArr
); );
throw new tx_ter_exception_unauthorized('Access denied.', TX_TER_ERROR_INCREASEEXTENSIONDOWNLOADCOUNTER_ACCESSDENIED); throw new tx_ter_exception_unauthorized('Access denied.', TX_TER_ERROR_INCREASEEXTENSIONDOWNLOADCOUNTER_ACCESSDENIED);
} }
...@@ -658,7 +685,8 @@ class tx_ter_api ...@@ -658,7 +685,8 @@ class tx_ter_api
GeneralUtility::devLog( GeneralUtility::devLog(
'DownloadCounter: Increased download counter for ' . $counter . ' extensions. User "' . $accountData->username . '".', 'DownloadCounter: Increased download counter for ' . $counter . ' extensions. User "' . $accountData->username . '".',
'tx_ter_api', 0 'tx_ter_api',
0
); );
// Update extension index file // Update extension index file
$this->helperObj->requestUpdateOfExtensionIndexFile(); $this->helperObj->requestUpdateOfExtensionIndexFile();
...@@ -666,7 +694,10 @@ class tx_ter_api ...@@ -666,7 +694,10 @@ class tx_ter_api
// Return results including list of error messages if any // Return results including list of error messages if any
if (!empty($errorMessages)) { if (!empty($errorMessages)) {
GeneralUtility::devLog( GeneralUtility::devLog(
'DownloadCounter: Errors occured for user "' . $accountData->username . '".', 'tx_ter_api', 2, $errorMessages 'DownloadCounter: Errors occured for user "' . $accountData->username . '".',
'tx_ter_api',
2,
$errorMessages
); );
$result = [ $result = [
'resultCode' => TX_TER_RESULT_ERRORS_OCCURRED, 'resultCode' => TX_TER_RESULT_ERRORS_OCCURRED,
...@@ -718,7 +749,8 @@ class tx_ter_api ...@@ -718,7 +749,8 @@ class tx_ter_api
{ {
if (!@is_dir($this->parentObj->repositoryDir)) { if (!@is_dir($this->parentObj->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
); );
} }
if (!is_array($filesData->fileData)) { if (!is_array($filesData->fileData)) {
...@@ -728,11 +760,11 @@ class tx_ter_api ...@@ -728,11 +760,11 @@ class tx_ter_api
// Prepare Files Data Array: // Prepare Files Data Array:
$preparedFilesDataArr = []; $preparedFilesDataArr = [];
foreach ($filesData->fileData as $fileData) { foreach ($filesData->fileData as $fileData) {
$decodedContent = base64_decode($fileData->content); $decodedContent = base64_decode($fileData->content);
if ($fileData->contentMD5 != md5($decodedContent)) { if ($fileData->contentMD5 != md5($decodedContent)) {
throw new tx_ter_exception_notFound( throw new tx_ter_exception_notFound(
'MD5 does not match for file ' . (string)$fileData->name, TX_TER_ERROR_UPLOADEXTENSION_FILEMD5DOESNOTMATCH 'MD5 does not match for file ' . (string)$fileData->name,
TX_TER_ERROR_UPLOADEXTENSION_FILEMD5DOESNOTMATCH
); );
} }
...@@ -753,8 +785,10 @@ class tx_ter_api ...@@ -753,8 +785,10 @@ class tx_ter_api
foreach ($extensionInfoData->technicalData->dependencies as $dependency) { foreach ($extensionInfoData->technicalData->dependencies as $dependency) {
$dependency = json_decode(json_encode($dependency), true); $dependency = json_decode(json_encode($dependency), true);
if (!empty($dependency['kind']) && !empty($dependency['extensionKey']) && in_array( if (!empty($dependency['kind']) && !empty($dependency['extensionKey']) && in_array(
$dependency['kind'], ['depends', 'conflicts', 'suggests'], true $dependency['kind'],
) ['depends', 'conflicts', 'suggests'],
true
)
) { ) {
$constraints[$dependency['kind']][$dependency['extensionKey']] = (string)$dependency['versionRange']; $constraints[$dependency['kind']][$dependency['extensionKey']] = (string)$dependency['versionRange'];
} }
...@@ -776,7 +810,9 @@ class tx_ter_api ...@@ -776,7 +810,9 @@ class tx_ter_api
'createDirs' => $extensionInfoData->technicalData->createDirs, 'createDirs' => $extensionInfoData->technicalData->createDirs,
'modify_tables' => $extensionInfoData->technicalData->modifyTables, 'modify_tables' => $extensionInfoData->technicalData->modifyTables,
'clearcacheonload' => in_array( 'clearcacheonload' => in_array(
strtolower((string)$extensionInfoData->technicalData->clearCacheOnLoad), ['1', 'false'], true strtolower((string)$extensionInfoData->technicalData->clearCacheOnLoad),
['1', 'false'],
true
), ),
'lockType' => $extensionInfoData->technicalData->lockType, 'lockType' => $extensionInfoData->technicalData->lockType,
'author' => $extensionInfoData->metaData->authorName, 'author' => $extensionInfoData->metaData->authorName,
...@@ -820,7 +856,8 @@ class tx_ter_api ...@@ -820,7 +856,8 @@ class tx_ter_api
} }
list($majorVersion, $minorVersion, $devVersion) = GeneralUtility::intExplode( list($majorVersion, $minorVersion, $devVersion) = GeneralUtility::intExplode(
'.', $extensionInfoData->version '.',
$extensionInfoData->version
); );
$t3xFileName = $extensionKey . '_' . $majorVersion . '.' . $minorVersion . '.' . $devVersion . '.t3x'; $t3xFileName = $extensionKey . '_' . $majorVersion . '.' . $minorVersion . '.' . $devVersion . '.t3x';
...@@ -1021,15 +1058,20 @@ class tx_ter_api ...@@ -1021,15 +1058,20 @@ class tx_ter_api
{ {
if (!@is_dir($this->parentObj->repositoryDir)) { if (!@is_dir($this->parentObj->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
); );
} }
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'uid', 'tx_ter_extensions', 'extensionkey=' . $GLOBALS['TYPO3_DB']->fullQuoteStr( 'uid',
$extensionKey, 'tx_ter_extensions' 'tx_ter_extensions',
'extensionkey=' . $GLOBALS['TYPO3_DB']->fullQuoteStr(
$extensionKey,
'tx_ter_extensions'
) . ' AND version=' . $GLOBALS['TYPO3_DB']->fullQuoteStr( ) . ' AND version=' . $GLOBALS['TYPO3_DB']->fullQuoteStr(
$version, 'tx_ter_extensions' $version,
'tx_ter_extensions'
) . ' AND pid=' . (int)$this->parentObj->extensionsPID ) . ' AND pid=' . (int)$this->parentObj->extensionsPID
); );
if (!$result) { if (!$result) {
...@@ -1047,7 +1089,8 @@ class tx_ter_api ...@@ -1047,7 +1089,8 @@ class tx_ter_api
} }
$result = $GLOBALS['TYPO3_DB']->exec_DELETEquery( $result = $GLOBALS['TYPO3_DB']->exec_DELETEquery(
'tx_ter_extensiondetails', 'extensionuid = ' . (int)$extensionRow['uid'] 'tx_ter_extensiondetails',
'extensionuid = ' . (int)$extensionRow['uid']
); );
if (!$result) { if (!$result) {
throw new tx_ter_exception_internalServerError( throw new tx_ter_exception_internalServerError(
...@@ -1056,8 +1099,10 @@ class tx_ter_api ...@@ -1056,8 +1099,10 @@ class tx_ter_api
); );
} }
$result = $GLOBALS['TYPO3_DB']->exec_DELETEquery( $result = $GLOBALS['TYPO3_DB']->exec_DELETEquery(
'tx_ter_extensions', 'extensionkey=' . $GLOBALS['TYPO3_DB']->fullQuoteStr( 'tx_ter_extensions',
$extensionKey, 'tx_ter_extensions' 'extensionkey=' . $GLOBALS['TYPO3_DB']->fullQuoteStr(
$extensionKey,
'tx_ter_extensions'
) . ' AND version=' . $GLOBALS['TYPO3_DB']->fullquoteStr($version, 'tx_ter_extensions') ) . ' AND version=' . $GLOBALS['TYPO3_DB']->fullquoteStr($version, 'tx_ter_extensions')
); );
if (!$result) { if (!$result) {
...@@ -1100,8 +1145,11 @@ class tx_ter_api ...@@ -1100,8 +1145,11 @@ class tx_ter_api
{ {
return $GLOBALS['TYPO3_DB']->sql_num_rows( return $GLOBALS['TYPO3_DB']->sql_num_rows(
$GLOBALS['TYPO3_DB']->exec_SELECTquery( $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'uid', 'tx_ter_extensions', 'extensionkey = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr( 'uid',
strtolower($extensionInfoData->extensionKey), 'tx_ter_extensions' 'tx_ter_extensions',
'extensionkey = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr(
strtolower($extensionInfoData->extensionKey),
'tx_ter_extensions'
) . ' AND version = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr($extensionInfoData->version, 'tx_ter_extensions') ) . ' AND version = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr($extensionInfoData->version, 'tx_ter_extensions')
) )
); );
...@@ -1303,7 +1351,8 @@ class tx_ter_api ...@@ -1303,7 +1351,8 @@ class tx_ter_api
$result = $GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_ter_extensionkeys', $extensionKeysRow); $result = $GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_ter_extensionkeys', $extensionKeysRow);
if (!$result) { if (!$result) {
throw new tx_ter_exception_internalServerError( throw new tx_ter_exception_internalServerError(
'Database error while inserting extension key.', TX_TER_ERROR_REGISTEREXTENSIONKEY_DBERRORWHILEINSERTINGKEY 'Database error while inserting extension key.',
TX_TER_ERROR_REGISTEREXTENSIONKEY_DBERRORWHILEINSERTINGKEY
); );
} }
} }
...@@ -1332,11 +1381,14 @@ class tx_ter_api ...@@ -1332,11 +1381,14 @@ class tx_ter_api
{ {
$updateValues = []; $updateValues = [];
if (isset ($modifyExtensionKeyData->ownerUsername)) { if (isset($modifyExtensionKeyData->ownerUsername)) {
$modifyExtensionKeyData->ownerUsername; $modifyExtensionKeyData->ownerUsername;
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'*', 'fe_users', 'username=' . $GLOBALS['TYPO3_DB']->fullQuoteStr( '*',
$modifyExtensionKeyData->ownerUsername, 'fe_users' 'fe_users',
'username=' . $GLOBALS['TYPO3_DB']->fullQuoteStr(
$modifyExtensionKeyData->ownerUsername,
'fe_users'
) . $GLOBALS['TSFE']->sys_page->enableFields('fe_users') ) . $GLOBALS['TSFE']->sys_page->enableFields('fe_users')
); );
if ($newOwnerUserRecordArr = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { if ($newOwnerUserRecordArr = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
...@@ -1353,7 +1405,8 @@ class tx_ter_api ...@@ -1353,7 +1405,8 @@ class tx_ter_api
); );
if (!$res) { if (!$res) {
throw new tx_ter_exception_internalServerError( throw new tx_ter_exception_internalServerError(
'Database error while updating extension key.', TX_TER_ERROR_GENERAL_DATABASEERROR 'Database error while updating extension key.',
TX_TER_ERROR_GENERAL_DATABASEERROR
); );
} }
...@@ -1383,30 +1436,38 @@ class tx_ter_api ...@@ -1383,30 +1436,38 @@ class tx_ter_api
protected function setReviewState_writeNewStateIntoDB($setReviewStateData) protected function setReviewState_writeNewStateIntoDB($setReviewStateData)
{ {
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'uid', 'tx_ter_extensions', 'extensionkey =' . $GLOBALS['TYPO3_DB']->fullQuoteStr( 'uid',
$setReviewStateData->extensionKey, 'tx_ter_extensions' 'tx_ter_extensions',
'extensionkey =' . $GLOBALS['TYPO3_DB']->fullQuoteStr(
$setReviewStateData->extensionKey,
'tx_ter_extensions'
) . ' AND ' . 'version =' . $GLOBALS['TYPO3_DB']->fullQuoteStr($setReviewStateData->version, 'tx_ter_extensions') ) . ' AND ' . 'version =' . $GLOBALS['TYPO3_DB']->fullQuoteStr($setReviewStateData->version, 'tx_ter_extensions')
); );
if (!$res) { if (!$res) {
throw new tx_ter_exception_internalServerError( throw new tx_ter_exception_internalServerError(
'Database error while searching for extension record.', TX_TER_ERROR_GENERAL_DATABASEERROR 'Database error while searching for extension record.',
TX_TER_ERROR_GENERAL_DATABASEERROR
); );
} }
if ($GLOBALS['TYPO3_DB']->sql_num_rows($res) != 1) { if ($GLOBALS['TYPO3_DB']->sql_num_rows($res) != 1) {