From 9db529ea598a39622d3d6d97a596894805b46f9f Mon Sep 17 00:00:00 2001 From: cskaza Date: Wed, 12 Jun 2019 21:10:51 +0700 Subject: [PATCH] For 1.2.2 (Fix critical bug) --- CHANGELOG | 4 +- cszcms/config/config.php | 2 +- cszcms/config/session.php | 2 +- cszcms/controllers/admin/Admin.php | 7 ++-- cszcms/controllers/admin/Upgrade.php | 57 +++++++++++++--------------- cszcms/models/Csz_admin_model.php | 10 +++-- 6 files changed, 42 insertions(+), 40 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 24969f7..b0529fc 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,5 @@ #### RELEASE NOTES -CSZ-CMS V.1.2.2 (2019-06-10) +CSZ-CMS V.1.2.2 (2019-06-12) - Update elFinder to 2.1.49. - Update gallery plugin to 1.0.6. - Update Codeigniter core to 3.1.10. @@ -10,6 +10,8 @@ CSZ-CMS V.1.2.2 (2019-06-10) - Fixed remote url response code checking. - Fixed CSV import on backend not working. - Fixed more important bug. +- Fixed Cannot modify header information error. +- Fixed the session namespace. - Improve performance. CSZ-CMS V.1.2.1 (2018-08-29) diff --git a/cszcms/config/config.php b/cszcms/config/config.php index a5d18d0..81d95fc 100644 --- a/cszcms/config/config.php +++ b/cszcms/config/config.php @@ -406,7 +406,7 @@ | 'cookie_httponly') will also affect sessions. | */ -$config['cookie_prefix'] = str_replace('.', '_', $domain).'_cszcookie'; +$config['cookie_prefix'] = 'cszcookie_'.md5(BASE_URL); $config['cookie_domain'] = $domain; $config['cookie_path'] = '/'; $config['cookie_secure'] = isset($_SERVER['HTTPS']) ? TRUE : FALSE; diff --git a/cszcms/config/session.php b/cszcms/config/session.php index 94e0847..bda3290 100644 --- a/cszcms/config/session.php +++ b/cszcms/config/session.php @@ -2,6 +2,6 @@ defined('BASEPATH') OR exit('No direct script access allowed'); /* Session namespace */ -$config['sess_namespace'] = 'cszcms_'.md5(EMAIL_DOMAIN); +$config['sess_namespace'] = 'cszcms_'.md5(BASE_URL); /* End of file session.php */ /* Location: ./application/config/session.php */ \ No newline at end of file diff --git a/cszcms/controllers/admin/Admin.php b/cszcms/controllers/admin/Admin.php index c5910dd..03769e8 100644 --- a/cszcms/controllers/admin/Admin.php +++ b/cszcms/controllers/admin/Admin.php @@ -259,9 +259,9 @@ public function loginCheck() { $this->Csz_admin_model->showLoadingImg(); $this->Csz_model->saveLogs($email, 'Backend Login Successful!', $result); if($this->session->userdata('cszblogin_cururl')){ - redirect($this->session->userdata('cszblogin_cururl'), 'refresh'); + $this->Csz_admin_model->jsredirect($this->session->userdata('cszblogin_cururl')); }else{ - redirect($this->Csz_model->base_link().'/admin', 'refresh'); + $this->Csz_admin_model->jsredirect($this->Csz_model->base_link().'/admin'); } } else { $this->Csz_model->saveLogs($email, 'Backend Login Invalid!', $result); @@ -344,11 +344,12 @@ public function updateSettings() { admin_helper::is_logged_in($this->session->userdata('admin_email')); admin_helper::is_allowchk('site settings'); admin_helper::is_allowchk('save'); + $this->Csz_admin_model->showLoadingImg(); $this->Csz_admin_model->updateSettings(); $this->db->cache_delete_all(); $this->Csz_model->clear_all_cache(); $this->session->set_flashdata('error_message',''); - redirect($this->csz_referrer->getIndex(), 'refresh'); + $this->Csz_admin_model->jsredirect($this->csz_referrer->getIndex()); } public function uploadIndex() { diff --git a/cszcms/controllers/admin/Upgrade.php b/cszcms/controllers/admin/Upgrade.php index 7c83b2a..ffca825 100644 --- a/cszcms/controllers/admin/Upgrade.php +++ b/cszcms/controllers/admin/Upgrade.php @@ -64,14 +64,13 @@ public function index() { } public function download() { - $this->Csz_admin_model->showLoadingImg(); admin_helper::is_logged_in($this->session->userdata('admin_email')); admin_helper::is_allowchk('maintenance'); admin_helper::is_allowchk('save'); + $this->Csz_admin_model->showLoadingImg(); if(strpos($this->cur_version, 'Beta') !== FALSE || strpos($this->cur_version, 'beta') !== FALSE){ $this->session->set_flashdata('error_message',''); - redirect($this->csz_referrer->getIndex(), 'refresh'); - exit(); + $this->Csz_admin_model->jsredirect($this->csz_referrer->getIndex()); } if (function_exists('ini_set')) { @ini_set('max_execution_time', 600); @@ -109,31 +108,30 @@ public function download() { @unlink($newfname); } $this->session->set_flashdata('error_message',''); - redirect($this->csz_referrer->getIndex(), 'refresh'); + $this->Csz_admin_model->jsredirect($this->csz_referrer->getIndex()); } } $this->Csz_admin_model->unsetMaintenance(); $this->Csz_model->clear_all_cache(); $this->db->cache_delete_all(); if($this->Csz_admin_model->chkVerUpdate($this->Csz_model->getVersion()) !== FALSE){ - redirect('/admin/upgrade/download', 'refresh'); + $this->Csz_admin_model->jsredirect($this->Csz_model->base_link().'/admin/upgrade/download'); }else{ // When Success $this->session->set_flashdata('error_message',''); - redirect($this->csz_referrer->getIndex(), 'refresh'); + $this->Csz_admin_model->jsredirect($this->csz_referrer->getIndex()); } }else{ $this->session->set_flashdata('error_message',''); - redirect($this->csz_referrer->getIndex(), 'refresh'); + $this->Csz_admin_model->jsredirect($this->csz_referrer->getIndex()); } } else { $this->session->set_flashdata('error_message',''); - redirect($this->csz_referrer->getIndex(), 'refresh'); + $this->Csz_admin_model->jsredirect($this->csz_referrer->getIndex()); } } public function CIupdate() { - $this->Csz_admin_model->showLoadingImg(); admin_helper::is_logged_in($this->session->userdata('admin_email')); admin_helper::is_allowchk('maintenance'); admin_helper::is_allowchk('save'); @@ -141,6 +139,7 @@ public function CIupdate() { @ini_set('max_execution_time', 600); @ini_set('memory_limit','512M'); } + $this->Csz_admin_model->showLoadingImg(); $lastversion = $this->Csz_admin_model->chkVerUpdate(CI_VERSION, '', TRUE); if ($lastversion !== FALSE) { $nextversion = $this->Csz_admin_model->findNextVersion(CI_VERSION, '', TRUE); @@ -169,30 +168,29 @@ public function CIupdate() { @unlink($newfname); } $this->session->set_flashdata('error_message',''); - redirect($this->csz_referrer->getIndex(), 'refresh'); + $this->Csz_admin_model->jsredirect($this->csz_referrer->getIndex()); } } $this->Csz_admin_model->unsetMaintenance(); $this->Csz_model->clear_all_cache(); $this->db->cache_delete_all(); if($this->Csz_admin_model->chkVerUpdate(CI_VERSION, '', TRUE) !== FALSE){ - redirect('/admin/upgrade/CIupdate', 'refresh'); + $this->Csz_admin_model->jsredirect($this->Csz_model->base_link().'/admin/upgrade/CIupdate'); }else{ // When Success $this->session->set_flashdata('error_message',''); - redirect($this->csz_referrer->getIndex(), 'refresh'); + $this->Csz_admin_model->jsredirect($this->csz_referrer->getIndex()); } }else{ $this->session->set_flashdata('error_message',''); - redirect($this->csz_referrer->getIndex(), 'refresh'); + $this->Csz_admin_model->jsredirect($this->csz_referrer->getIndex()); } } else { - redirect($this->csz_referrer->getIndex(), 'refresh'); + $this->Csz_admin_model->jsredirect($this->csz_referrer->getIndex()); } } public function install() { - $this->Csz_admin_model->showLoadingImg(); admin_helper::is_logged_in($this->session->userdata('admin_email')); admin_helper::is_allowchk('maintenance'); admin_helper::is_allowchk('save'); @@ -200,6 +198,7 @@ public function install() { @ini_set('max_execution_time', 600); @ini_set('memory_limit','512M'); } + $this->Csz_admin_model->showLoadingImg(); /* upload zip file */ $zip_ext = array('application/x-zip', 'application/zip', 'application/x-zip-compressed', 'application/s-compressed', 'multipart/x-zip'); if (isset($_FILES['file_upload']) && $_FILES['file_upload'] != null) { @@ -242,28 +241,27 @@ public function install() { $this->session->set_flashdata('error_message', ''); } // When Success - redirect('admin/upgrade', 'refresh'); + $this->Csz_admin_model->jsredirect($this->Csz_model->base_link().'/admin/upgrade'); } public function dbOptimize() { - $this->Csz_admin_model->showLoadingImg(); admin_helper::is_logged_in($this->session->userdata('admin_email')); admin_helper::is_allowchk('maintenance'); admin_helper::is_allowchk('save'); + $this->Csz_admin_model->showLoadingImg(); $this->load->dbutil(); @array_map('unlink', glob(FCPATH . EMAIL_DOMAIN . '_*')); $result = $this->dbutil->optimize_database(); if ($result !== FALSE){ $this->session->set_flashdata('error_message',''); - redirect($this->csz_referrer->getIndex(), 'refresh'); + $this->Csz_admin_model->jsredirect($this->csz_referrer->getIndex()); }else{ $this->session->set_flashdata('error_message',''); - redirect('admin/upgrade', 'refresh'); + $this->Csz_admin_model->jsredirect($this->Csz_model->base_link().'/admin/upgrade'); } } public function dbBackup() { - $this->Csz_admin_model->showLoadingImg(); admin_helper::is_logged_in($this->session->userdata('admin_email')); admin_helper::is_allowchk('maintenance'); admin_helper::is_allowchk('save'); @@ -287,7 +285,6 @@ public function dbBackup() { } public function fileBackup() { - $this->Csz_admin_model->showLoadingImg(); admin_helper::is_logged_in($this->session->userdata('admin_email')); admin_helper::is_allowchk('maintenance'); admin_helper::is_allowchk('save'); @@ -449,7 +446,6 @@ public function fileBackup() { } public function photoBackup() { - $this->Csz_admin_model->showLoadingImg(); admin_helper::is_logged_in($this->session->userdata('admin_email')); admin_helper::is_allowchk('maintenance'); admin_helper::is_allowchk('save'); @@ -468,58 +464,57 @@ public function photoBackup() { } public function clearAllCache() { - $this->Csz_admin_model->showLoadingImg(); admin_helper::is_logged_in($this->session->userdata('admin_email')); admin_helper::is_allowchk('maintenance'); admin_helper::is_allowchk('save'); + $this->Csz_admin_model->showLoadingImg(); $this->Csz_model->clear_all_cache(); @array_map('unlink', glob(FCPATH . EMAIL_DOMAIN . '_*')); @array_map('unlink', glob(FCPATH . DB_NAME . '_*')); @$this->db->empty_table('save_formdraft'); $this->session->set_flashdata('error_message',''); - redirect($this->csz_referrer->getIndex(), 'refresh'); + $this->Csz_admin_model->jsredirect($this->csz_referrer->getIndex()); } public function clearAllDBCache() { - $this->Csz_admin_model->showLoadingImg(); admin_helper::is_logged_in($this->session->userdata('admin_email')); admin_helper::is_allowchk('maintenance'); admin_helper::is_allowchk('save'); + $this->Csz_admin_model->showLoadingImg(); @$this->db->cache_delete_all(); @array_map('unlink', glob(FCPATH . EMAIL_DOMAIN . '_*')); @array_map('unlink', glob(FCPATH . DB_NAME . '_*')); @$this->db->empty_table('save_formdraft'); @$this->db->flush_cache(); $this->session->set_flashdata('error_message',''); - redirect($this->csz_referrer->getIndex(), 'refresh'); + $this->Csz_admin_model->jsredirect($this->csz_referrer->getIndex()); } public function clearAllSession() { - $this->Csz_admin_model->showLoadingImg(); admin_helper::is_logged_in($this->session->userdata('admin_email')); admin_helper::is_allowchk('maintenance'); admin_helper::is_allowchk('delete'); + $this->Csz_admin_model->showLoadingImg(); @array_map('unlink', glob(FCPATH . EMAIL_DOMAIN . '_*')); @array_map('unlink', glob(FCPATH . DB_NAME . '_*')); $this->session->set_flashdata('error_message',''); $this->Csz_model->clear_all_session(); - redirect('admin/logout', 'refresh'); + $this->Csz_admin_model->jsredirect($this->Csz_model->base_link().'/admin/logout'); } public function clearAllErrLog() { - $this->Csz_admin_model->showLoadingImg(); admin_helper::is_logged_in($this->session->userdata('admin_email')); admin_helper::is_allowchk('maintenance'); admin_helper::is_allowchk('delete'); + $this->Csz_admin_model->showLoadingImg(); $this->Csz_model->clear_all_error_log(); @array_map('unlink', glob(FCPATH . EMAIL_DOMAIN . '_*')); @array_map('unlink', glob(FCPATH . DB_NAME . '_*')); $this->session->set_flashdata('error_message',''); - redirect('admin/upgrade', 'refresh'); + $this->Csz_admin_model->jsredirect($this->Csz_model->base_link().'/admin/upgrade'); } public function downloadErrLog() { - $this->Csz_admin_model->showLoadingImg(); admin_helper::is_logged_in($this->session->userdata('admin_email')); admin_helper::is_allowchk('maintenance'); admin_helper::is_allowchk('save'); diff --git a/cszcms/models/Csz_admin_model.php b/cszcms/models/Csz_admin_model.php index 92eac9c..2a8b770 100644 --- a/cszcms/models/Csz_admin_model.php +++ b/cszcms/models/Csz_admin_model.php @@ -1,5 +1,4 @@

Loading...
'; + echo '

Loading...
'; + } + + public function jsredirect($url, $delay = 500){ + echo ''; + exit(0); } }