From 923571c5a2964085c7e245fe0454e7e8dbc0860f Mon Sep 17 00:00:00 2001 From: Guillermo Date: Fri, 29 Dec 2017 17:50:46 -0300 Subject: [PATCH 01/10] fix bug #58 --- server/controllers/system/edit-settings.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/controllers/system/edit-settings.php b/server/controllers/system/edit-settings.php index 879a8f12..dfdf7352 100755 --- a/server/controllers/system/edit-settings.php +++ b/server/controllers/system/edit-settings.php @@ -53,7 +53,7 @@ class EditSettingsController extends Controller { ]; foreach($settings as $setting) { - if(Controller::request($setting)) { + if(Controller::request($setting)!==null) { $settingInstance = Setting::getSetting($setting); $settingInstance->value = Controller::request($setting); $settingInstance->store(); @@ -68,7 +68,7 @@ class EditSettingsController extends Controller { Response::respondSuccess(); } - + public function handleLanguages() { $allowed = json_decode(Controller::request('allowedLanguages')); $supported = json_decode(Controller::request('supportedLanguages')); @@ -83,4 +83,4 @@ class EditSettingsController extends Controller { } } -} \ No newline at end of file +} From c002fdf00fd8200f4ba7b7f9ef77b1b9786136dd Mon Sep 17 00:00:00 2001 From: Guillermo Date: Fri, 29 Dec 2017 18:40:59 -0300 Subject: [PATCH 02/10] fix bug #115 --- server/controllers/ticket/change-department.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/controllers/ticket/change-department.php b/server/controllers/ticket/change-department.php index 22679a0d..5cea221d 100755 --- a/server/controllers/ticket/change-department.php +++ b/server/controllers/ticket/change-department.php @@ -66,10 +66,13 @@ class ChangeDepartmentController extends Controller { $ticket->addEvent($event); $ticket->department = $department; $ticket->unread = true; + if(!Controller::getLoggedUser()->sharedDepartmentList->includesId($department->id)) { + $ticket->owner = null; + } $ticket->store(); Log::createLog('DEPARTMENT_CHANGED', $ticket->ticketNumber); Response::respondSuccess(); } -} \ No newline at end of file +} From 0837754ffb1219c575bca9dbad3b80c640afa614 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 3 Jan 2018 20:08:04 -0300 Subject: [PATCH 03/10] Fix #125 Maintenance mode --- .gitignore | 4 +++- client/gulp/config.js | 2 +- client/src/app/App.js | 8 ++++---- client/src/lib-app/session-store.js | 3 ++- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index c2230d54..caaa71d1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ server/composer.lock server/vendor .idea -.jshintrc \ No newline at end of file +.jshintrc +server/files/ +!server/files/.gitkeep diff --git a/client/gulp/config.js b/client/gulp/config.js index 86e35dc7..2525122c 100644 --- a/client/gulp/config.js +++ b/client/gulp/config.js @@ -2,7 +2,7 @@ module.exports = { - 'serverport': 3000, + 'serverport': 3006, 'scripts': { 'src': './src/*.js', diff --git a/client/src/app/App.js b/client/src/app/App.js index 4faa9121..053fd186 100644 --- a/client/src/app/App.js +++ b/client/src/app/App.js @@ -64,12 +64,12 @@ class App extends React.Component { loggedInStaff: !_.includes(props.location.pathname, '/admin/panel') && props.session.logged && props.session.staff, loggedOutStaff: _.includes(props.location.pathname, '/admin/panel') && !props.session.logged }; - - if(props.config['maintenance-mode'] === '1' && !_.includes(props.location.pathname, '/admin') && !_.includes(props.location.pathname, '/maintenance')) { + + if(props.config['maintenance-mode'] && !_.includes(props.location.pathname, '/admin') && !_.includes(props.location.pathname, '/maintenance')) { history.push('/maintenance'); } - if(props.config['maintenance-mode'] === '0' && _.includes(props.location.pathname, '/maintenance')) { + if(!props.config['maintenance-mode'] && _.includes(props.location.pathname, '/maintenance')) { history.push('/'); } @@ -139,4 +139,4 @@ export default connect((store) => { session: store.session, routing: store.routing }; -})(App); \ No newline at end of file +})(App); diff --git a/client/src/lib-app/session-store.js b/client/src/lib-app/session-store.js index 7d2c35eb..bfcf14cb 100644 --- a/client/src/lib-app/session-store.js +++ b/client/src/lib-app/session-store.js @@ -60,6 +60,7 @@ class SessionStore { this.setItem('registration', configs.registration); this.setItem('user-system-enabled', configs['user-system-enabled']); this.setItem('allow-attachments', configs['allow-attachments']); + this.setItem('maintenance-mode', configs['maintenance-mode']); } getConfigs() { @@ -115,4 +116,4 @@ class SessionStore { } } -export default new SessionStore(); \ No newline at end of file +export default new SessionStore(); From 02b69936159a35e530c3f0520bf0e334205e72f1 Mon Sep 17 00:00:00 2001 From: Guillermo Date: Thu, 4 Jan 2018 00:57:45 -0300 Subject: [PATCH 04/10] Fix edit settings test --- tests/system/edit-settings.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/system/edit-settings.rb b/tests/system/edit-settings.rb index 69223599..f39395b7 100644 --- a/tests/system/edit-settings.rb +++ b/tests/system/edit-settings.rb @@ -6,7 +6,7 @@ describe'system/edit-settings' do result= request('/system/edit-settings', { "csrf_userid" => $csrf_userid, "csrf_token" => $csrf_token, - "maintenance-mode" => false, + "maintenance-mode" => 0, "time-zone" => -3, "layout" => 'full-width', "allow-attachments" => 1, @@ -82,4 +82,4 @@ describe'system/edit-settings' do request('/user/logout') end -end \ No newline at end of file +end From 4b3ea709c82dd90ca9f8ea2f7f9f0015658eee6e Mon Sep 17 00:00:00 2001 From: Ivan Diaz Date: Mon, 8 Jan 2018 18:01:55 -0300 Subject: [PATCH 05/10] Revert "fix bug #58" --- server/controllers/system/edit-settings.php | 6 +++--- server/controllers/ticket/change-department.php | 5 +---- tests/system/edit-settings.rb | 4 ++-- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/server/controllers/system/edit-settings.php b/server/controllers/system/edit-settings.php index dfdf7352..879a8f12 100755 --- a/server/controllers/system/edit-settings.php +++ b/server/controllers/system/edit-settings.php @@ -53,7 +53,7 @@ class EditSettingsController extends Controller { ]; foreach($settings as $setting) { - if(Controller::request($setting)!==null) { + if(Controller::request($setting)) { $settingInstance = Setting::getSetting($setting); $settingInstance->value = Controller::request($setting); $settingInstance->store(); @@ -68,7 +68,7 @@ class EditSettingsController extends Controller { Response::respondSuccess(); } - + public function handleLanguages() { $allowed = json_decode(Controller::request('allowedLanguages')); $supported = json_decode(Controller::request('supportedLanguages')); @@ -83,4 +83,4 @@ class EditSettingsController extends Controller { } } -} +} \ No newline at end of file diff --git a/server/controllers/ticket/change-department.php b/server/controllers/ticket/change-department.php index 5cea221d..22679a0d 100755 --- a/server/controllers/ticket/change-department.php +++ b/server/controllers/ticket/change-department.php @@ -66,13 +66,10 @@ class ChangeDepartmentController extends Controller { $ticket->addEvent($event); $ticket->department = $department; $ticket->unread = true; - if(!Controller::getLoggedUser()->sharedDepartmentList->includesId($department->id)) { - $ticket->owner = null; - } $ticket->store(); Log::createLog('DEPARTMENT_CHANGED', $ticket->ticketNumber); Response::respondSuccess(); } -} +} \ No newline at end of file diff --git a/tests/system/edit-settings.rb b/tests/system/edit-settings.rb index f39395b7..69223599 100644 --- a/tests/system/edit-settings.rb +++ b/tests/system/edit-settings.rb @@ -6,7 +6,7 @@ describe'system/edit-settings' do result= request('/system/edit-settings', { "csrf_userid" => $csrf_userid, "csrf_token" => $csrf_token, - "maintenance-mode" => 0, + "maintenance-mode" => false, "time-zone" => -3, "layout" => 'full-width', "allow-attachments" => 1, @@ -82,4 +82,4 @@ describe'system/edit-settings' do request('/user/logout') end -end +end \ No newline at end of file From feea28a1597c7b91fac4d66bbb02038d5fcc9b76 Mon Sep 17 00:00:00 2001 From: Ivan Diaz Date: Mon, 8 Jan 2018 18:16:44 -0300 Subject: [PATCH 06/10] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 45894a2d..d2e77c9e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![OpenSupports](http://www.opensupports.com/logo.png) -[![Build Status](https://travis-ci.org/opensupports/opensupports.svg?branch=master)](https://travis-ci.org/opensupports/opensupports) v4.1.1 +[![Build Status](https://travis-ci.org/opensupports/opensupports.svg?branch=master)](https://travis-ci.org/opensupports/opensupports) v4.1.2 OpenSupports is an open source ticket system built primarly with PHP and ReactJS. Please, visit our website for more information: [http://www.opensupports.com/](http://www.opensupports.com/) From 4b45a45a2313a1c1c0b796b928b1a0863724b64a Mon Sep 17 00:00:00 2001 From: Ivan Diaz Date: Mon, 8 Jan 2018 18:16:57 -0300 Subject: [PATCH 07/10] Update package.json --- client/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/package.json b/client/package.json index 228d77d4..784b2b4d 100644 --- a/client/package.json +++ b/client/package.json @@ -1,6 +1,6 @@ { "name": "OpenSupports", - "version": "4.1.1", + "version": "4.1.2", "author": "Ivan Diaz ", "description": "Open source ticket system made with PHP and ReactJS", "repository": { From 2d8311652043bccc9bb830cabc7c67d88e04aa08 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 11 Jan 2018 18:51:07 -0300 Subject: [PATCH 08/10] [HOTFIX] - Fix check-requirements to check files folder correctly --- .../src/app/install/install-step-4-user-system.js | 10 ++-------- server/controllers/system/check-requirements.php | 10 ++++++---- server/controllers/system/init-database.php | 6 ++---- tests/system/init-settings.rb | 15 ++++++++++++++- 4 files changed, 24 insertions(+), 17 deletions(-) diff --git a/client/src/app/install/install-step-4-user-system.js b/client/src/app/install/install-step-4-user-system.js index 528efd8a..d4ae18c0 100644 --- a/client/src/app/install/install-step-4-user-system.js +++ b/client/src/app/install/install-step-4-user-system.js @@ -30,7 +30,6 @@ class InstallStep4UserSystem extends React.Component {
{i18n('NEXT')} -
@@ -46,17 +45,12 @@ class InstallStep4UserSystem extends React.Component { }); } - onPreviousClick(event) { - event.preventDefault(); - history.push('/install/step-3'); - } - onSubmit(form) { this.props.dispatch(ConfigActions.updateUserSystemSettings({ 'user-system-enabled': form['user-system-enabled'] * 1, 'registration': form['registration'] * 1 })); - + history.push('/install/step-5'); } @@ -69,4 +63,4 @@ export default connect((store) => { return { language: store.config.language }; -})(InstallStep4UserSystem); \ No newline at end of file +})(InstallStep4UserSystem); diff --git a/server/controllers/system/check-requirements.php b/server/controllers/system/check-requirements.php index 5eb35cb2..1958460f 100755 --- a/server/controllers/system/check-requirements.php +++ b/server/controllers/system/check-requirements.php @@ -30,7 +30,9 @@ class CheckRequirementsController extends Controller { } public function handler() { - $configWritable = !!fopen('config.php', 'w+'); + if(InstallationDoneController::isInstallationDone()) { + throw new Exception(ERRORS::INIT_SETTINGS_DONE); + } Response::respondSuccess([ 'phpVersion' => [ @@ -50,8 +52,8 @@ class CheckRequirementsController extends Controller { ], 'files' => [ 'name' => 'Folder: /api/files', - 'value' => $configWritable ? 'Writable' : 'Not writable', - 'ok' => $configWritable + 'value' => is_writable('files') ? 'Writable' : 'Not writable', + 'ok' => is_writable('files') ] ]); } @@ -64,4 +66,4 @@ class CheckRequirementsController extends Controller { else if($currentVersion[0] < $requiredVersion[0]) return false; else return $currentVersion[1] >= $requiredVersion[1]; } -} \ No newline at end of file +} diff --git a/server/controllers/system/init-database.php b/server/controllers/system/init-database.php index dd21c026..d777add9 100755 --- a/server/controllers/system/init-database.php +++ b/server/controllers/system/init-database.php @@ -48,9 +48,7 @@ class InitDatabaseController extends Controller { $dbUser = Controller::request('dbUser'); $dbPass = Controller::request('dbPassword'); - if(!defined('MYSQL_HOST')) { - RedBean::setup('mysql:host=' . $dbHost, $dbUser, $dbPass); - } + RedBean::setup('mysql:host=' . $dbHost, $dbUser, $dbPass); if($dbName) { RedBean::addDatabase($dbName, 'mysql:host='. $dbHost . ';dbname=' . $dbName, $dbUser, $dbPass); @@ -81,4 +79,4 @@ class InitDatabaseController extends Controller { fclose($configFile); Response::respondSuccess(); } -} \ No newline at end of file +} diff --git a/tests/system/init-settings.rb b/tests/system/init-settings.rb index 920815dc..4a10c846 100644 --- a/tests/system/init-settings.rb +++ b/tests/system/init-settings.rb @@ -1,4 +1,17 @@ describe '/system/init-settings' do + it 'should prevent initing database if already called' do + result = request('/system/init-database', {}) + (result['status']).should.equal('fail') + (result['message']).should.equal('INIT_SETTINGS_DONE') + + result = request('/system/check-requirements', {}) + (result['status']).should.equal('success') + + result = request('/system/init-database', {}) + (result['status']).should.equal('fail') + (result['message']).should.equal('INIT_SETTINGS_DONE') + end + it 'should initialize correctly' do result = request('/system/init-settings', { 'user-system-enabled' => true, @@ -25,4 +38,4 @@ describe '/system/init-settings' do (result['status']).should.equal('success') end -end \ No newline at end of file +end From a68aa76b2f830243a6052307440feeafe0595ddd Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 11 Jan 2018 18:51:54 -0300 Subject: [PATCH 09/10] Revert "Fix #125 Maintenance mode" This reverts commit 0837754ffb1219c575bca9dbad3b80c640afa614. --- .gitignore | 4 +--- client/gulp/config.js | 2 +- client/src/app/App.js | 8 ++++---- client/src/lib-app/session-store.js | 3 +-- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index caaa71d1..c2230d54 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,4 @@ server/composer.lock server/vendor .idea -.jshintrc -server/files/ -!server/files/.gitkeep +.jshintrc \ No newline at end of file diff --git a/client/gulp/config.js b/client/gulp/config.js index 2525122c..86e35dc7 100644 --- a/client/gulp/config.js +++ b/client/gulp/config.js @@ -2,7 +2,7 @@ module.exports = { - 'serverport': 3006, + 'serverport': 3000, 'scripts': { 'src': './src/*.js', diff --git a/client/src/app/App.js b/client/src/app/App.js index 053fd186..4faa9121 100644 --- a/client/src/app/App.js +++ b/client/src/app/App.js @@ -64,12 +64,12 @@ class App extends React.Component { loggedInStaff: !_.includes(props.location.pathname, '/admin/panel') && props.session.logged && props.session.staff, loggedOutStaff: _.includes(props.location.pathname, '/admin/panel') && !props.session.logged }; - - if(props.config['maintenance-mode'] && !_.includes(props.location.pathname, '/admin') && !_.includes(props.location.pathname, '/maintenance')) { + + if(props.config['maintenance-mode'] === '1' && !_.includes(props.location.pathname, '/admin') && !_.includes(props.location.pathname, '/maintenance')) { history.push('/maintenance'); } - if(!props.config['maintenance-mode'] && _.includes(props.location.pathname, '/maintenance')) { + if(props.config['maintenance-mode'] === '0' && _.includes(props.location.pathname, '/maintenance')) { history.push('/'); } @@ -139,4 +139,4 @@ export default connect((store) => { session: store.session, routing: store.routing }; -})(App); +})(App); \ No newline at end of file diff --git a/client/src/lib-app/session-store.js b/client/src/lib-app/session-store.js index bfcf14cb..7d2c35eb 100644 --- a/client/src/lib-app/session-store.js +++ b/client/src/lib-app/session-store.js @@ -60,7 +60,6 @@ class SessionStore { this.setItem('registration', configs.registration); this.setItem('user-system-enabled', configs['user-system-enabled']); this.setItem('allow-attachments', configs['allow-attachments']); - this.setItem('maintenance-mode', configs['maintenance-mode']); } getConfigs() { @@ -116,4 +115,4 @@ class SessionStore { } } -export default new SessionStore(); +export default new SessionStore(); \ No newline at end of file From f12dfc3754031682c772a1f193c8564618495456 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 11 Jan 2018 20:40:30 -0300 Subject: [PATCH 10/10] realease version 4.1.2 --- version_upgrades/{4.1.1/4.1.1.php => 4.1.2/4.1.2.php} | 0 version_upgrades/{4.1.1 => 4.1.2}/libs/Hashing.php | 0 .../{4.1.1 => 4.1.2}/libs/LinearCongruentialGenerator.php | 0 version_upgrades/{4.1.1 => 4.1.2}/libs/MailSender.php | 2 +- version_upgrades/{4.1.1 => 4.1.2}/libs/migration-mail.html | 0 5 files changed, 1 insertion(+), 1 deletion(-) rename version_upgrades/{4.1.1/4.1.1.php => 4.1.2/4.1.2.php} (100%) rename version_upgrades/{4.1.1 => 4.1.2}/libs/Hashing.php (100%) rename version_upgrades/{4.1.1 => 4.1.2}/libs/LinearCongruentialGenerator.php (100%) rename version_upgrades/{4.1.1 => 4.1.2}/libs/MailSender.php (98%) rename version_upgrades/{4.1.1 => 4.1.2}/libs/migration-mail.html (100%) diff --git a/version_upgrades/4.1.1/4.1.1.php b/version_upgrades/4.1.2/4.1.2.php similarity index 100% rename from version_upgrades/4.1.1/4.1.1.php rename to version_upgrades/4.1.2/4.1.2.php diff --git a/version_upgrades/4.1.1/libs/Hashing.php b/version_upgrades/4.1.2/libs/Hashing.php similarity index 100% rename from version_upgrades/4.1.1/libs/Hashing.php rename to version_upgrades/4.1.2/libs/Hashing.php diff --git a/version_upgrades/4.1.1/libs/LinearCongruentialGenerator.php b/version_upgrades/4.1.2/libs/LinearCongruentialGenerator.php similarity index 100% rename from version_upgrades/4.1.1/libs/LinearCongruentialGenerator.php rename to version_upgrades/4.1.2/libs/LinearCongruentialGenerator.php diff --git a/version_upgrades/4.1.1/libs/MailSender.php b/version_upgrades/4.1.2/libs/MailSender.php similarity index 98% rename from version_upgrades/4.1.1/libs/MailSender.php rename to version_upgrades/4.1.2/libs/MailSender.php index 10751415..e8850bfc 100644 --- a/version_upgrades/4.1.1/libs/MailSender.php +++ b/version_upgrades/4.1.2/libs/MailSender.php @@ -1,5 +1,5 @@