Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only allow Joomla Version with major.minor.patch #25

Merged
merged 2 commits into from
Mar 30, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions src/Controllers/SubmitControllerCreate.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function execute()
'cms_version' => $input->getRaw('cms_version'),
'unique_id' => $input->getString('unique_id'),
'db_type' => $input->getString('db_type'),
'server_os' => $input->getString('server_os')
'server_os' => $input->getString('server_os'),
];

// Backup the original POST before manipulating/validating data
Expand All @@ -89,7 +89,7 @@ public function execute()

$response = [
'error' => true,
'message' => 'There was an error storing the data.'
'message' => 'There was an error storing the data.',
];

$this->getApplication()->setHeader('HTTP/1.1 500 Internal Server Error', 500, true);
Expand All @@ -103,7 +103,7 @@ public function execute()
{
$response = [
'error' => true,
'message' => 'Invalid data submission.'
'message' => 'Invalid data submission.',
];

$this->getApplication()->setHeader('HTTP/1.1 500 Internal Server Error', 500, true);
Expand All @@ -116,7 +116,7 @@ public function execute()

$response = [
'error' => false,
'message' => 'Data saved successfully'
'message' => 'Data saved successfully',
];

$this->getApplication()->setBody(json_encode($response));
Expand All @@ -143,6 +143,14 @@ private function checkCMSVersion($version)
return false;
}

// Joomla only uses major.minor.patch so everything else is invalid
$explodedVersion = explode('.', $version);

if (count($explodedVersion) > 3)
{
return false;
}

// We are only collecting data for the 3.x series
if (version_compare($version, '3.0.0', '<') || version_compare($version, '4.0.0', '>='))
{
Expand Down