From 4ff3debbf03abe031c794d2475e6710afe402eee Mon Sep 17 00:00:00 2001 From: Abdulrahman Date: Sun, 12 May 2019 04:15:11 +0300 Subject: [PATCH] fixes --- admin/Masmak/admin_check_update.html | 4 +- includes/adm/p_check_update.php | 43 ++++++++++++++++---- install/includes/default_values.php | 10 ++--- install/includes/functions_install.php | 5 ++- install/includes/update_files/1.7_to_2.0.php | 4 +- install/update.php | 12 +++--- lang/ar/acp.php | 4 ++ lang/en/acp.php | 22 ++++++---- 8 files changed, 71 insertions(+), 33 deletions(-) diff --git a/admin/Masmak/admin_check_update.html b/admin/Masmak/admin_check_update.html index b759c5c..e9cce73 100755 --- a/admin/Masmak/admin_check_update.html +++ b/admin/Masmak/admin_check_update.html @@ -102,7 +102,7 @@ function updateNow(step) { if(info[1].length > 0) { $('#update'+step+' .update-message').removeClass('d-none').addClass('d-block').text(info[1]); if(info[0] == 1) { - $('#update'+step+' .update-message').removeClass('alter-danger').addClass('alert-success'); + $('#update'+step+' .update-message').removeClass('alert-danger').addClass('alert-success'); } } @@ -117,7 +117,7 @@ function updateNow(step) { } }) .fail(function(data) { - $('#update'+step+' .update-status').text('error!'); + $('#update'+step+' .update-status').html(''); $('#update'+step+' .update-message').removeClass('d-none').addClass('d-block').html( (data.content ? data.content : (data.responseJSON ? data.responseJSON.content : '{lang.ERROR_TRY_AGAIN}')) ); diff --git a/includes/adm/p_check_update.php b/includes/adm/p_check_update.php index 4a8d243..3c623cd 100755 --- a/includes/adm/p_check_update.php +++ b/includes/adm/p_check_update.php @@ -127,9 +127,9 @@ elseif ($current_smt == 'update1') { $adminAjaxContent = '930:::' . $lang['NO_ZIP_ARCHIVE']; } - elseif (! version_compare(strtolower($current_version), strtolower($new_version), '<')) + elseif (! version_compare(strtolower($current_version), strtolower($new_version), '<=')) { - $adminAjaxContent = '940:::there is no update for your version!'; + $adminAjaxContent = '940:::' . $lang['U_LAST_VER_KLJ']; } else { @@ -142,7 +142,7 @@ elseif ($current_smt == 'update1') } else { - $adminAjaxContent = '2:::We have encountered a problem while downloading the package ... '; + $adminAjaxContent = '2:::' . $lang['UPDATE_ERR_FETCH_PACKAGE']; } } } @@ -205,7 +205,8 @@ elseif ($current_smt == 'update3') $backup = new ZipArchive; if($backup->open($backup_archive_path, ZipArchive::CREATE) !== true) { - + header('HTTP/1.0 401 Unauthorized'); + kleeja_admin_err($lang['UPDATE_BACKUP_CREATE_FAILED']); } // delete plugin folder function with some changes :) @@ -292,7 +293,7 @@ elseif ($current_smt == 'update3') //maintenance mode off update_config('siteclose', 0); - $adminAjaxContent = '1002:::updating process has failed...' . + $adminAjaxContent = '1002:::' . $lang['UPDATE_PROCESS_FAILED'] (defined('DEV_STAGE') ? '[failed files: ' . implode(', ', $failed_files) . ']' : ''); } else @@ -301,6 +302,34 @@ elseif ($current_smt == 'update3') if (file_exists($db_update_file = PATH . "cache/update_{$old_version}_to_{$new_version}.php")) { require_once $db_update_file; + + if($config['db_version'] < UPDATE_DB_VERSION) + { + $SQL->show_errors = false; + + if (isset($update_sqls) && sizeof($update_sqls) > 0) + { + foreach ($update_sqls as $name=>$sql_content) + { + $SQL->query($sql_content); + } + } + + if (isset($update_functions) && sizeof($update_functions) > 0) + { + foreach ($update_functions as $n) + { + if (is_callable($n)) + { + $n(); + } + } + } + + $SQL->query( + "UPDATE `{$dbprefix}config` SET `value` = '" . UPDATE_DB_VERSION . "' WHERE `name` = 'db_version'" + ); + } } //maintenance mode off @@ -308,9 +337,9 @@ elseif ($current_smt == 'update3') // after a success update, delete files and folders in cache kleeja_unlink(PATH . "cache/kleeja-{$new_version}"); + kleeja_unlink(PATH . "cache/kleeja-{$new_version}.zip"); delete_cache('', true); - $adminAjaxContent = "1:::Kleeja has been updated to {$new_version} successfully..."; + $adminAjaxContent = '1:::' . sprintf($lang['UPDATE_PROCESS_DONE'], $new_version); } } -//endif diff --git a/install/includes/default_values.php b/install/includes/default_values.php index b46d1dd..a573111 100755 --- a/install/includes/default_values.php +++ b/install/includes/default_values.php @@ -20,7 +20,7 @@ if (! defined('IN_COMMON')) $config_values = []; -// do it like this : +// do it like this : //$config_values = array('name', 'value', 'option', 'display_order', 'type', 'plg_id', 'dynamic'); // General settings @@ -45,7 +45,7 @@ $config_values[] = ['cookie_path', $cookie_data['cookie_path'], '', '15', 'advanced', 0, 0]; $config_values[] = ['cookie_secure', ($cookie_data['cookie_secure'] ? '1' : '0'), '\r\n ', '16', 'advanced', 0, 0]; -// Upload settings +// Upload settings $config_values[] = ['total_size', '10000000000', '', 17, 'upload', 0, 0]; $config_values[] = ['foldername', 'uploads', '', 18, 'upload', 0, 0]; $config_values[] = ['prefixname', '', '', 19, 'upload', 0, 0]; @@ -68,7 +68,7 @@ $config_values[] = ['filesnum_show', '1', '