This commit is contained in:
Abdulrahman
2019-05-25 19:59:45 +03:00
parent 5f063c2c79
commit 4e1c7e65d9
7 changed files with 36 additions and 33 deletions

View File

@@ -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]);
<UNLESS NAME="showMessage">
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('<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}'))
<IGNORE>(data.content ? data.content : (data.responseJSON ? data.responseJSON.content : tryAgainMsg))</IGNORE>
);
});
}

View File

@@ -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}'))
<IGNORE>(data.content ? data.content : (data.responseJSON ? data.responseJSON.content : tryAgainMsg))</IGNORE>
);
});
}

View File

@@ -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(
<IGNORE>(data.content ? data.content : (data.responseJSON ? data.responseJSON.content : tryAgainMsg))</IGNORE>
);
$('#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';

View File

@@ -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}'))
<IGNORE>(data.content ? data.content : (data.responseJSON ? data.responseJSON.content : tryAgainMsg))</IGNORE>
);
});
}

View File

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

View File

@@ -852,6 +852,8 @@ function delete_config($name)
{
delete_config($n);
}
return;
}
global $dbprefix, $SQL, $d_groups, $userinfo;

View File

@@ -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>(.*?)<\/IGNORE>/is', function($m) {
return '<STRREV>' . strrev($m[1]) . '</STRREV>';
}, $html);
$html = preg_replace(['#<([\?%])=?.*?\1>#s', '#<script\s+language\s*=\s*(["\']?)php\1\s*>.*?</script\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 '<IF NAME="' . $m[1] . '">' . $m[2] . '<ELSE>' . $m[3] . '</IF>';
}, $html);
$html = preg_replace_callback('/<(IF|ELSEIF|UNLESS) (.+)>/iU', ['kleeja_style', '_if_callback'], $html);
$html = preg_replace_callback('/<LOOP\s+NAME\s*=\s*(\"|)+([a-z0-9_\.]{1,})+(\"|)\s*>/i', ['kleeja_style', '_loop_callback'], $html);
$html = preg_replace_callback('/<LOOP\s+NAME\s*=\s*(\"|)+([a-z0-9_\.]{1,})+(\"|)\s*>/i', function($m) {
return '<?php foreach($this->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>(.*?)<\/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 '<?php foreach($this->vars["' . $var . '"] as $key=>$value){ ?>';
}
/**
* if tag
* @param $matches
@@ -184,17 +182,6 @@ class kleeja_style
: (strtoupper($matches[1]) == 'UNLESS' ? '<?php if(!(' . $condition . ')){ ?>' : '<?php }elseif(' . $condition . '){ ?>');
}
/**
* iif tag, if else /if
* @param $matches
* @return string
*/
protected function _iif_callback($matches)
{
return '<IF NAME="' . $matches[1] . '">' . $matches[2] . '<ELSE>' . $matches[3] . '</IF>';
}
protected function parse_condition($condition, $is_loop)
{
$char = [' eq ', ' lt ', ' gt ', ' lte ', ' gte ', ' neq ', '==', '!=', '>=', '<=', '<', '>'];