Skip to content

Commit

Permalink
For 1.2.2 (Fix critical bug)
Browse files Browse the repository at this point in the history
  • Loading branch information
cskaza committed Jun 12, 2019
1 parent de9ce63 commit 9db529e
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 40 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion cszcms/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion cszcms/config/session.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
7 changes: 4 additions & 3 deletions cszcms/controllers/admin/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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','<div class="alert alert-success" role="alert">'.$this->lang->line('success_message_alert').'</div>');
redirect($this->csz_referrer->getIndex(), 'refresh');
$this->Csz_admin_model->jsredirect($this->csz_referrer->getIndex());
}

public function uploadIndex() {
Expand Down
57 changes: 26 additions & 31 deletions cszcms/controllers/admin/Upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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','<div class="alert alert-danger" role="alert">'.$this->lang->line('error_message_alert').'</div>');
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);
Expand Down Expand Up @@ -109,38 +108,38 @@ public function download() {
@unlink($newfname);
}
$this->session->set_flashdata('error_message','<div class="alert alert-danger" role="alert">'.$this->lang->line('error_message_alert').'</div>');
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','<div class="alert alert-success" role="alert">'.$this->lang->line('upgrade_success_alert').'</div>');
redirect($this->csz_referrer->getIndex(), 'refresh');
$this->Csz_admin_model->jsredirect($this->csz_referrer->getIndex());
}
}else{
$this->session->set_flashdata('error_message','<div class="alert alert-danger" role="alert">'.$this->lang->line('error_message_alert').'</div>');
redirect($this->csz_referrer->getIndex(), 'refresh');
$this->Csz_admin_model->jsredirect($this->csz_referrer->getIndex());
}
} else {
$this->session->set_flashdata('error_message','<div class="alert alert-info" role="alert">'.$this->lang->line('upgrade_lastver_alert').'</div>');
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');
if (function_exists('ini_set')) {
@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);
Expand Down Expand Up @@ -169,37 +168,37 @@ public function CIupdate() {
@unlink($newfname);
}
$this->session->set_flashdata('error_message','<div class="alert alert-danger" role="alert">'.$this->lang->line('error_message_alert').'</div>');
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','<div class="alert alert-success" role="alert">'.$this->lang->line('success_message_alert').'</div>');
redirect($this->csz_referrer->getIndex(), 'refresh');
$this->Csz_admin_model->jsredirect($this->csz_referrer->getIndex());
}
}else{
$this->session->set_flashdata('error_message','<div class="alert alert-danger" role="alert">'.$this->lang->line('error_message_alert').'</div>');
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');
if (function_exists('ini_set')) {
@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) {
Expand Down Expand Up @@ -242,28 +241,27 @@ public function install() {
$this->session->set_flashdata('error_message', '<div class="alert alert-danger" role="alert">' . $this->lang->line('error_message_alert') . '</div>');
}
// 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','<div class="alert alert-success" role="alert">'.$this->lang->line('optimize_success_alert').'</div>');
redirect($this->csz_referrer->getIndex(), 'refresh');
$this->Csz_admin_model->jsredirect($this->csz_referrer->getIndex());
}else{
$this->session->set_flashdata('error_message','<div class="alert alert-danger" role="alert">'.$this->lang->line('optimize_error_alert').'</div>');
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');
Expand All @@ -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');
Expand Down Expand Up @@ -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');
Expand All @@ -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','<div class="alert alert-success" role="alert">'.$this->lang->line('clearallcache_success_alert').'</div>');
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','<div class="alert alert-success" role="alert">'.$this->lang->line('clearalldbcache_success_alert').'</div>');
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','<div class="alert alert-success" role="alert">'.$this->lang->line('success_message_alert').'</div>');
$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','<div class="alert alert-success" role="alert">'.$this->lang->line('success_message_alert').'</div>');
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');
Expand Down
10 changes: 7 additions & 3 deletions cszcms/models/Csz_admin_model.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

/**
* CSZ CMS
*
Expand All @@ -19,7 +18,7 @@
* @link https://www.cszcms.com
* @since Version 1.0.0
*/
defined('BASEPATH') OR exit('No direct script access allowed');
defined('BASEPATH') || exit('No direct script access allowed');

class Csz_admin_model extends CI_Model{

Expand Down Expand Up @@ -2882,7 +2881,12 @@ public function updatePWidget($id){
}

public function showLoadingImg() {
echo '<center><div style="position:fixed;top:50%;left:50%;transform:translate(-50%,-50%)"><img src="'.base_url('', '', TRUE).'assets/images/loading.gif" class="img-responsive"/><br>Loading...</div></center>';
echo '<center><div style="position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);font-size:14px"><img src="'.base_url('', '', TRUE).'assets/images/loading.gif" class="img-responsive" width="32"/><br>Loading...</div></center>';
}

public function jsredirect($url, $delay = 500){
echo '<script>window.setTimeout(function(){window.location = "'.$url.'"; },'.$delay.');</script>';
exit(0);
}

}

0 comments on commit 9db529e

Please sign in to comment.