This commit is contained in:
Abdulrahman
2019-05-12 04:15:11 +03:00
parent b70e76664c
commit 4ff3debbf0
8 changed files with 71 additions and 33 deletions

View File

@@ -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('<i class="fa fa-warning text-danger"></i>');
$('#update'+step+' .update-message').removeClass('d-none').addClass('d-block').html(
(data.content ? data.content : (data.responseJSON ? data.responseJSON.content : '{lang.ERROR_TRY_AGAIN}'))
);

View File

@@ -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

View File

@@ -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'], '<input type=\"t
$config_values[] = ['cookie_domain', $cookie_data['cookie_domain'], '<input type=\"text\" id=\"cookie_domain\" name=\"cookie_domain\" value=\"{con.cookie_domain}\" size=\"20\" style=\"direction:ltr\" />', '15', 'advanced', 0, 0];
$config_values[] = ['cookie_secure', ($cookie_data['cookie_secure'] ? '1' : '0'), '<label>{lang.YES}<input type=\"radio\" id=\"cookie_secure\" name=\"cookie_secure\" value=\"1\" <IF NAME=\"con.cookie_secure==1\"> checked=\"checked\"</IF> /></label>\r\n <label>{lang.NO}<input type=\"radio\" id=\"cookie_secure\" name=\"cookie_secure\" value=\"0\" <IF NAME=\"con.cookie_secure==0\"> checked=\"checked\"</IF> /></label>', '16', 'advanced', 0, 0];
// Upload settings
// Upload settings
$config_values[] = ['total_size', '10000000000', '<input type=\"text\" id=\"total_size\" name=\"total_size\" value=\"{con.total_size}\" size=\"20\" style=\"direction:ltr\" />', 17, 'upload', 0, 0];
$config_values[] = ['foldername', 'uploads', '<input type=\"text\" id=\"foldername\" name=\"foldername\" value=\"{con.foldername}\" size=\"20\" style=\"direction:ltr\" />', 18, 'upload', 0, 0];
$config_values[] = ['prefixname', '', '<input type=\"text\" id=\"prefixname\" name=\"prefixname\" value=\"{con.prefixname}\" size=\"20\" style=\"direction:ltr\" />', 19, 'upload', 0, 0];
@@ -68,7 +68,7 @@ $config_values[] = ['filesnum_show', '1', '<label>{lang.YES}<input type=\"radio\
//$config_values[] = array('imagefolderexts', '', '<input type=\"text\" id=\"imagefolderexts\" name=\"imagefolderexts\" value=\"{con.imagefolderexts}\" size=\"80\">', '20', 'KLIVE', '0', '0');
//$config_values[] = array('imagefoldere', '1', '<label>{lang.YES}<input type=\"radio\" id=\"imagefoldere\" name=\"imagefoldere\" value=\"1\" <IF NAME=\"con.imagefoldere\"> checked=\"checked\"</IF>></label><label>{lang.NO}<input type=\"radio\" id=\"imagefoldere\" name=\"imagefoldere\" value=\"0\" <IF NAME=\"con.imagefoldere\"> <ELSE> checked=\"checked\"</IF>></label>', '30', 'KLIVE', '0', '0');
// Interface settings
// Interface settings
$config_values[] = ['welcome_msg', $lang['INST_MSGINS'], '<input type=\"text\" id=\"welcome_msg\" name=\"welcome_msg\" value=\"{con.welcome_msg}\" size=\"68\" />', 30, 'interface', 0, 0];
$config_values[] = ['allow_stat_pg', '1', '<label>{lang.YES}<input type=\"radio\" id=\"allow_stat_pg\" name=\"allow_stat_pg\" value=\"1\" <IF NAME=\"con.allow_stat_pg==1\"> checked=\"checked\"</IF> /></label>\r\n <label>{lang.NO}<input type=\"radio\" id=\"allow_stat_pg\" name=\"allow_stat_pg\" value=\"0\" <IF NAME=\"con.allow_stat_pg==0\"> checked=\"checked\"</IF> /></label>', 31, 'interface', 0, 0];
$config_values[] = ['allow_online', '0', '<label>{lang.YES}<input type=\"radio\" id=\"allow_online\" name=\"allow_online\" value=\"1\" <IF NAME=\"con.allow_online==1\"> checked=\"checked\"</IF> /></label>\r\n <label>{lang.NO}<input type=\"radio\" id=\"allow_online\" name=\"allow_online\" value=\"0\" <IF NAME=\"con.allow_online==0\"> checked=\"checked\"</IF> /></label>', 32, 'interface', 0, 0];
@@ -81,7 +81,7 @@ $config_values[] = ['enable_captcha', '1', '<label>{lang.YES}<input type=\"radio
$config_values[] = ['thmb_dims', '100*100', '', 0, 0, 0];
$config_values[] = ['style', 'bootstrap', '', 0, '0', 0, 0];
$config_values[] = ['new_version', '', '', 0, 0, 0];
$config_values[] = ['db_version', LAST_DB_VERSION, '', 0, 0, 0];
$config_values[] = ['db_version', KLEEJA_DB_VERSION, '', 0, 0, 0];
$config_values[] = ['last_online_time_update', time(), '', 0, 0, 1];
$config_values[] = ['klj_clean_files_from', '0', '', 0, 0, 1];
$config_values[] = ['style_depend_on', '', '', 0, 0, 0];
@@ -96,7 +96,7 @@ $config_values[] = ['default_group', '3', '', 0, 0, 1];
// Extensions
//
// do it like this :
// do it like this :
//$ext_values[group_id] = array('ext'=>sizeInKB);
$ext_values = [];

View File

@@ -10,8 +10,7 @@
// Requirements of Kleeja
define('MIN_PHP_VERSION', '7.0');
define('MIN_MYSQL_VERSION', '4.2.2');
//version of latest changes at db
define('LAST_DB_VERSION', '9');
//set no errors
define('MYSQL_NO_ERRORS', true);
@@ -25,6 +24,8 @@ if (ig('change_lang'))
}
}
require PATH . 'includes/version.php';
// Including current language
$lang = require PATH . 'lang/' . getlang() . '/common.php';
$lang = array_merge($lang, require PATH . 'lang/' . getlang() . '/install.php');

View File

@@ -3,9 +3,9 @@
// Kleeja database version : 9
//
define('UPDATE_DB_VERSION', '9');
$update_sqls =
$update_sqls =
[
'files_size_big' => "ALTER TABLE `{$dbprefix}files` CHANGE `size` `size` BIGINT(20) NOT NULL DEFAULT '0';",
'group_size_big' => "ALTER TABLE `{$dbprefix}groups_exts` CHANGE `size` `size` BIGINT(20) NOT NULL DEFAULT '0';",

View File

@@ -102,7 +102,7 @@ case 'action_file':
}
@closedir($dh);
ksort($upfiles);
ksort($upfiles);
echo gettpl('update_list.html');
}
@@ -137,14 +137,14 @@ case 'update_now':
$update_msgs_arr = [];
if ($config['db_version'] >= LAST_DB_VERSION && ! defined('DEV_STAGE'))
if ($config['db_version'] >= UPDATE_DB_VERSION && ! defined('DEV_STAGE'))
{
$update_msgs_arr[] = '<span style="color:green;">' . $lang['INST_UPDATE_CUR_VER_IS_UP'] . '</span>';
$complete_update = false;
}
//
//is there any sqls
//is there any sqls
//
if (($complete_update || (defined('DEV_STAGE')) && ! defined('C_U_F')))
{
@@ -170,7 +170,7 @@ case 'update_now':
}
//
//is there any functions
//is there any functions
//
if ($complete_update || defined('DEV_STAGE') || defined('C_U_F'))
{
@@ -187,7 +187,7 @@ case 'update_now':
}
//
//is there any notes
//is there any notes
//
$NOTES_CUP = false;
@@ -205,7 +205,7 @@ case 'update_now':
}
}
$sql = "UPDATE `{$dbprefix}config` SET `value` = '" . LAST_DB_VERSION . "' WHERE `name` = 'db_version'";
$sql = "UPDATE `{$dbprefix}config` SET `value` = '" . UPDATE_DB_VERSION . "' WHERE `name` = 'db_version'";
$SQL->query($sql);
}

View File

@@ -273,4 +273,8 @@ return [
'VERSION' => 'الإصدار',
'DEVELOPER' => 'المطور',
'ALL_PLUGINS_UPDATED' => 'لا يوجد إضافات تحتاج تحديث حالياً ... ',
'UPDATE_ERR_FETCH_PACKAGE' => 'واجهتنا مشكلة أثناء تحميل النسخة من الخادم!',
'UPDATE_BACKUP_CREATE_FAILED' => 'لم نستطع إنشاء ملف النسخة الإحتياطية في مجلد الكاش!',
'UPDATE_PROCESS_FAILED' => 'عملية التحديث فشلت!',
'UPDATE_PROCESS_DONE' => 'تم تحديث كليجا إلى النسخة `%s` بنجاح...',
];

View File

@@ -264,16 +264,20 @@ return [
'INSTALL' => 'Install',
'CLOSE' => 'Close',
'STATS_BOXES' => 'Stats Boxes',
'PLUGIN_UPDATED' => 'Plugin "%s" has been updated successfully ..',
'PLUGIN_UPDATED' => 'Plugin "%s" has been updated successfully ..',
'PLUGIN_DOWNLOADED' => 'Plugin "%s" has been downloaded successfully ..',
'PLUGIN_FILE_NOT_FOUND' => 'The plugin file is missing!',
'PLUGIN_REMOTE_FILE_MISSING'=> 'The plugin "%s" is not on Kleeja remote server!',
'PLUGINS_SERVER_ERROR' => 'We encountered an error while connecting to the plugins remote server ...',
'PLUGIN_FILE_NOT_FOUND' => 'The plugin file is missing!',
'PLUGIN_REMOTE_FILE_MISSING' => 'The plugin "%s" is not on Kleeja remote server!',
'PLUGINS_SERVER_ERROR' => 'We encountered an error while connecting to the plugins remote server ...',
'INSTALLED_PLUGINS' => 'Installed Plugins',
'LOCAL_PLUGINS' => 'Local Plugins',
'KLEEJA_STORE' => 'Kleeja Store',
'LOCAL_PLUGINS' => 'Local Plugins',
'KLEEJA_STORE' => 'Kleeja Store',
'KLJ_VER_NO_PLUGIN' => 'This plugin can works on Kleeja version %1$s up to version %2$s.',
'VERSION' => 'Version',
'DEVELOPER' => 'Developer',
'ALL_PLUGINS_UPDATED' => 'There are no plugins that require an update currently...',
'VERSION' => 'Version',
'DEVELOPER' => 'Developer',
'ALL_PLUGINS_UPDATED' => 'There are no plugins that require an update currently...',
'UPDATE_ERR_FETCH_PACKAGE' => 'We have encountered a problem while downloading the package from the server!',
'UPDATE_BACKUP_CREATE_FAILED' => 'We couldn\'t create a backup archive in cache folder!',
'UPDATE_PROCESS_FAILED' => 'The update process has failed!',
'UPDATE_PROCESS_DONE' => 'Kleeja has been updated to version `%s` successfully...',
];