From 4e1c7e65d9074347f16b2bee5df5d797e859610e Mon Sep 17 00:00:00 2001 From: Abdulrahman Date: Sat, 25 May 2019 19:59:45 +0300 Subject: [PATCH] fixes --- admin/Masmak/admin_check_update.html | 7 +++-- admin/Masmak/admin_plugins.html | 7 +++-- admin/Masmak/admin_start.html | 5 +++- admin/Masmak/admin_styles.html | 3 ++- includes/common.php | 6 ++++- includes/functions.php | 2 ++ includes/style.php | 39 ++++++++++------------------ 7 files changed, 36 insertions(+), 33 deletions(-) diff --git a/admin/Masmak/admin_check_update.html b/admin/Masmak/admin_check_update.html index 0191023..87bcdb4 100755 --- a/admin/Masmak/admin_check_update.html +++ b/admin/Masmak/admin_check_update.html @@ -69,7 +69,9 @@ function checkVersion() { .done(function (data) { if(data.content) { var info = data.content.split(":::"); - $('#updateInfo').addClass(info[0] != 0 ? 'alert-warning' : 'alert-info'); + $('#updateInfo').addClass( + info[0] != 0 ? 'alert-warning' : 'alert-info' + ); $('#updateInfoStatus').html(info[1]); if(info[0] == 2) { @@ -128,9 +130,10 @@ function updateNow(step) { } }) .fail(function(data) { + var tryAgainMsg = '{lang.ERROR_TRY_AGAIN}'; $('#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}')) + (data.content ? data.content : (data.responseJSON ? data.responseJSON.content : tryAgainMsg)) ); }); } diff --git a/admin/Masmak/admin_plugins.html b/admin/Masmak/admin_plugins.html index 69ba95f..9ac8d10 100755 --- a/admin/Masmak/admin_plugins.html +++ b/admin/Masmak/admin_plugins.html @@ -237,7 +237,9 @@ function downloadPlugin(name, nextPlugins) { .done(function (data) { if(data.content) { var info = data.content.split(":::"); - $('#installLoading-'+name).removeClass('badge-light').addClass(info[0] != 1 ? 'badge-warning' : 'badge-success'); + $('#installLoading-'+name).removeClass('badge-light').addClass( + info[0] != 1 ? 'badge-warning' : 'badge-success' + ); $('#installLoading-'+name).html(info[1]); } else { this.fail(); @@ -249,9 +251,10 @@ function downloadPlugin(name, nextPlugins) { }, 500); }) .fail(function(data) { + var tryAgainMsg = '{lang.ERROR_TRY_AGAIN}'; $('#downloadBtn-' + name).prop('disabled', false); $('#installLoading-'+name).removeClass('badge-light').addClass('badge-danger').html( - (data.content ? data.content : (data.responseJSON ? data.responseJSON.content : '{lang.ERROR_TRY_AGAIN}')) + (data.content ? data.content : (data.responseJSON ? data.responseJSON.content : tryAgainMsg)) ); }); } diff --git a/admin/Masmak/admin_start.html b/admin/Masmak/admin_start.html index 38bbfac..50b9032 100755 --- a/admin/Masmak/admin_start.html +++ b/admin/Masmak/admin_start.html @@ -17,7 +17,10 @@ function toggleStartBox(name, hide, current) { } }) .fail(function(data) { - $('#boxesErrors>span').html((data.content ? data.content : (data.responseJSON ? data.responseJSON.content : '{lang.ERROR_TRY_AGAIN}'))); + var tryAgainMsg = '{lang.ERROR_TRY_AGAIN}'; + $('#boxesErrors>span').html( + (data.content ? data.content : (data.responseJSON ? data.responseJSON.content : tryAgainMsg)) + ); $('#boxesErrors').removeClass('d-none alert-info').addClass('alert-danger'); var itemRemoveClass = current == 1 ? 'cb-disable' : 'cb-enable'; var itemAddClass = current == 0 ? 'cb-disable' : 'cb-enable'; diff --git a/admin/Masmak/admin_styles.html b/admin/Masmak/admin_styles.html index 3257897..0b4224a 100755 --- a/admin/Masmak/admin_styles.html +++ b/admin/Masmak/admin_styles.html @@ -159,9 +159,10 @@ function downloadStyle(name, nextStyles) { }, 500); }) .fail(function(data) { + var tryAgainMsg = '{lang.ERROR_TRY_AGAIN}'; $('#downloadBtn-' + name).prop('disabled', false); $('#installLoading-'+name).removeClass('badge-light').addClass('badge-danger').html( - (data.content ? data.content : (data.responseJSON ? data.responseJSON.content : '{lang.ERROR_TRY_AGAIN}')) + (data.content ? data.content : (data.responseJSON ? data.responseJSON.content : tryAgainMsg)) ); }); } diff --git a/includes/common.php b/includes/common.php index 00ab564..38f26a6 100755 --- a/includes/common.php +++ b/includes/common.php @@ -70,8 +70,12 @@ function kleeja_show_error($error_number, $error_string = '', $error_file = '', case E_NOTICE: case E_WARNING: case E_USER_WARNING: case E_USER_NOTICE: case E_STRICT: if (function_exists('kleeja_log')) { - kleeja_log($error_number . ':' . basename($error_file) . ':' . $error_line .' ' . $error_string); + $error_name = [ + 2 => 'Warning', 8 => 'Notice', 512 => 'U_Warning', 1024 => 'U_Notice', 2048 => 'Strict' + ][$error_number]; + kleeja_log('[' . $error_name . '] ' . basename($error_file) . ':' . $error_line . ' ' . $error_string); } + break; default: diff --git a/includes/functions.php b/includes/functions.php index 3d621a0..5c87041 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -852,6 +852,8 @@ function delete_config($name) { delete_config($n); } + + return; } global $dbprefix, $SQL, $d_groups, $userinfo; diff --git a/includes/style.php b/includes/style.php index ce58ec8..050145f 100755 --- a/includes/style.php +++ b/includes/style.php @@ -126,11 +126,22 @@ class kleeja_style { is_array($plugin_run_result = Plugins::getInstance()->run('style_parse_func', get_defined_vars())) ? extract($plugin_run_result) : null; //run hook + + $html = preg_replace_callback('/(.*?)<\/IGNORE>/is', function($m) { + return '' . strrev($m[1]) . ''; + }, $html); $html = preg_replace(['#<([\?%])=?.*?\1>#s', '#.*?#s', '#<\?php(?:\r\n?|[ \n\t]).*?\?>#s'], '', $html); - $html = preg_replace_callback('/\(([{A-Z0-9_\.}\s!=<>]+)\?(.*):(.*)\)/iU', ['kleeja_style', '_iif_callback'], $html); + $html = preg_replace_callback('/\(([{A-Z0-9_\.}\s!=<>]+)\?(.*):(.*)\)/iU', function($m) { + return '' . $m[2] . '' . $m[3] . ''; + }, $html); $html = preg_replace_callback('/<(IF|ELSEIF|UNLESS) (.+)>/iU', ['kleeja_style', '_if_callback'], $html); - $html = preg_replace_callback('//i', ['kleeja_style', '_loop_callback'], $html); + $html = preg_replace_callback('//i', function($m) { + return 'vars["' . (strpos($m[2], '.') !== false ? str_replace('.', '"]["', $m[2]) : $m[2]) . '"] as $key=>$value){ ?>'; + }, $html); $html = preg_replace_callback(kleeja_style::reg('var'), ['kleeja_style', '_vars_callback'], $html); + $html = preg_replace_callback('/(.*?)<\/STRREV>/is', function($m) { + return strrev($m[1]); + }, $html); $rep = [ @@ -148,19 +159,6 @@ class kleeja_style return preg_replace(array_keys($rep), array_values($rep), $html); } - - /** - * loop tag - * @param $matches - * @return string - */ - protected function _loop_callback($matches) - { - $var = strpos($matches[2], '.') !== false ? str_replace('.', '"]["', $matches[2]) : $matches[2]; - return 'vars["' . $var . '"] as $key=>$value){ ?>'; - } - - /** * if tag * @param $matches @@ -184,17 +182,6 @@ class kleeja_style : (strtoupper($matches[1]) == 'UNLESS' ? '' : ''); } - - /** - * iif tag, if else /if - * @param $matches - * @return string - */ - protected function _iif_callback($matches) - { - return '' . $matches[2] . '' . $matches[3] . ''; - } - protected function parse_condition($condition, $is_loop) { $char = [' eq ', ' lt ', ' gt ', ' lte ', ' gte ', ' neq ', '==', '!=', '>=', '<=', '<', '>'];