better plugins install/update process

This commit is contained in:
Abdulrahman
2019-05-15 00:48:58 +03:00
parent f13d5fda39
commit ec33730e36
7 changed files with 190 additions and 151 deletions

View File

@@ -25,12 +25,11 @@
<!-- installed plugins -->
<IF NAME="case == installed">
<IF NAME="no_plugins">
<div class="alert alert-info my-1">
{lang.NO_PLUGINS}
<IF NAME="no_installed_plugins">
<div class="alert alert-info my-3 px-4 py-2 d-flex justify-content-start align-items-center">
<i class="fa fa-exclamation fa-3x text-info p-2"></i>
<span class="p-3">{lang.NO_PLUGINS}</span>
</div>
</IF>
<IF NAME="installed_plugins">
@@ -52,7 +51,7 @@
<IF LOOP="plg_disabled">
{{plg_dsc}}
<ELSE>
{{extra_info.plugin_description}}
{{extra_info.plugin_description}}
</IF>
<br>
<small>{{extra_info.plugin_developer}}</small>
@@ -94,11 +93,13 @@
<LOOP NAME="available_plugins">
<li class="media d-flex justify-content-between list-group-item">
<img class="mr-3 rounded-circle" src="{{icon}}" alt="{{name}}" style="width: 75px">
<div class="media-body">
<div class="media-body d-flex justify-content-between">
<h5 class="mt-0 mb-1 pull-(lang.DIR==ltr?left:right)">{{name}}</h5>
<a class="btn btn-primary pull-(lang.DIR==ltr?right:left)" href="{plugin_install_link}{{name}}" title="{lang.ENABLE}" onclick="javascript:return confirm_form('{lang.PLUGIN_CONFIRM_ADD}');"><i class="fa fa-download" title="{lang.ENABLE}"></i></a>
<a class="btn btn-danger pull-(lang.DIR==ltr?right:left)" href="{plugin_delete_folder_link}{{name}}" title="{lang.DELETE}" onclick="javascript:return confirm_form('{lang.PLG_DEL_CONFIRM}');"><i class="fa fa-trash" title="{lang.DELETE}"></i></a>
<div class="btn-group btn-group-toggle">
<a class="btn btn-primary btn-sm" href="{plugin_install_link}{{name}}" title="{lang.ENABLE}" onclick="javascript:return confirm_form('{lang.PLUGIN_CONFIRM_ADD}');"><i class="fa fa-plus" title="{lang.ENABLE}"></i></a>
<a class="btn btn-danger btn-sm" href="{plugin_delete_folder_link}{{name}}" title="{lang.DELETE}" onclick="javascript:return confirm_form('{lang.PLG_DEL_CONFIRM}');"><i class="fa fa-trash" title="{lang.DELETE}"></i></a>
</div>
</div>
</li>
</LOOP>
@@ -117,13 +118,10 @@
</button>
</div>
<div class="modal-body">
<label class="form-control">
<input type="file" id="file" name="plugin_file">
</label>
{H_FORM_KEYS}
</div>
<div class="modal-footer">
<input type="submit" name="newplugin" class="btn btn-primary" value="{lang.SUBMIT}">
@@ -140,8 +138,14 @@
<ELSEIF NAME="case == store" OR="case == check">
<IF NAME="no_store_plugins">
<div class="alert alert-info my-3">
<IF NAME="case == check">{lang.ALL_PLUGINS_UPDATED}<ELSE>{lang.NO_PLUGINS}</IF>
<div class="alert alert-info my-3 px-4 py-2 d-flex justify-content-start align-items-center">
<IF NAME="case == check">
<i class="fa fa-check fa-3x text-info p-2"></i>
<span class="p-3 font-weight-bold">{lang.ALL_PLUGINS_UPDATED}</span>
<ELSE>
<i class="fa fa-exclamation fa-3x text-info p-2"></i>
<span class="p-3 font-weight-bold">{lang.NO_PLUGINS}</span>
</IF>
</div>
</IF>
@@ -149,52 +153,92 @@
<LOOP NAME="store_plugins">
<li class="media d-flex justify-content-between list-group-item">
<img class="mr-3 rounded-circle" src="{{icon}}" alt="{{title}}" style="width: 75px">
<div class="media-body">
<h5 class="mt-0 mb-2">{{title}}</h5>
<!-- Button trigger modal -->
<div class="d-flex justify-content-between">
<div style="direction: ltr;"><IF NAME="case == check">{{current_version}} → </IF>{{version}}</div>
<button type="button" class="btn btn-primary pull-(lang.DIR==ltr?right:left)" data-toggle="modal" data-target="#Modal_{{name}}">
<IF NAME="case == check">{lang.UPDATE}<ELSE>{lang.VIEW}</IF>
<div class="media-body d-flex justify-content-between">
<div>
<h5 class="mt-0 mb-2">{{title}}</h5>
<div style="direction: ltr;">
<IF NAME="case == check">{{current_version}} → </IF>{{version}}
</div>
</div>
<div class="d-flex justify-content-between flex-column align-items-end">
<div class="btn-group" rol="group">
<button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#Modal_{{name}}">
<i class="fa fa-eye"></i> {lang.VIEW}
</button>
<button type="button" class="btn btn-primary btn-sm" onclick="downloadPlugin('{{name}}')" id="downloadBtn-{{name}}">
<i class="fa fa-download"></i> <IF NAME="case == check">{lang.UPDATE}<ELSE>{lang.INSTALL}</IF>
</button>
</div>
<div id="installLoading-{{name}}" class="badge badge-light border mt-1 d-none"></div>
</div>
<!-- Modal -->
<div class="modal fade" id="Modal_{{name}}" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<!-- Modal -->
<div class="modal fade" id="Modal_{{name}}" tabindex="-1" role="dialog"
aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="exampleModalLabel">{{title}}</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<ul class="list-group list-group-flush">
<li class="list-group-item">
{lang.DEVELOPER}: {{developer}}
<IF LOOP="website"> <i class="fa fa-download" title="{lang.ENABLE}"></i><a href="{{website}}" target="_tab"><i class="fa fa-external-link" title="{lang.ENABLE}"></i></a></IF>
</li>
<li class="list-group-item">{lang.VERSION}: {{version}}</li>
<li class="list-group-item">{{kj_version_cmtp}}</li>
<IF LOOP="NotCompatible">
<li class="list-group-item list-group-item-danger">
{lang.PLUGIN_N_CMPT_KLJ}
</li>
</IF>
</ul>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">{lang.CLOSE}</button>
<a class="btn btn-primary" href="{plugin_download_link}{{name}}" title="Install">{lang.INSTALL} <i class="fa fa-download" title="Download"></i></a>
</div>
<div class="modal-header">
<h4 class="modal-title" id="exampleModalLabel">{{title}}</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<ul class="list-group list-group-flush">
<li class="list-group-item">
{lang.DEVELOPER}: {{developer}}
<IF LOOP="website"> <i class="fa fa-download" title="{lang.ENABLE}"></i><a
href="{{website}}" target="_tab"><i class="fa fa-external-link"
title="{lang.ENABLE}"></i></a></IF>
</li>
<li class="list-group-item">{lang.VERSION}: {{version}}</li>
<li class="list-group-item">{{kj_version_cmtp}}</li>
<IF LOOP="NotCompatible">
<li class="list-group-item list-group-item-danger">
{lang.PLUGIN_N_CMPT_KLJ}
</li>
</IF>
</ul>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary"
data-dismiss="modal">{lang.CLOSE}</button>
</div>
</div>
</div>
</div>
<!-- end modal -->
</div>
<!-- end modal -->
</li>
</LOOP>
</ul>
<script>
function downloadPlugin(name) {
$('#downloadBtn-' + name).prop('disabled', true);
$('#installLoading-' + name)
.removeClass('d-none badge-warning badge-success badge-danger').addClass('badge-light')
.html('<img src="{STYLE_PATH_ADMIN}images/ajax-loader-small.gif" /> {lang.LOADING}...');
$.ajax({
url: '{plugin_download_link}'.replace(/&amp;/g, '&') + name + '&_ajax_=1',
dataType: 'json'})
.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).html(info[1]);
} else {
this.fail();
}
})
.fail(function(data) {
$('#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}'))
);
});
}
</script>
</IF>

View File

@@ -23,28 +23,26 @@ if (! defined('IN_ADMIN'))
$case = g('case', 'str', 'installed');
//set _get form key
$GET_FORM_KEY = kleeja_add_form_key_get('PLUGINS_FORM_KEY');
$H_FORM_KEYS = kleeja_add_form_key('adm_plugins');
$GET_FORM_KEY = kleeja_add_form_key_get('PLUGINS_FORM_KEY');
$H_FORM_KEYS = kleeja_add_form_key('adm_plugins');
$action = ADMIN_PATH . '?cp=' . basename(__file__, '.php');
$plugin_install_link = ADMIN_PATH . '?cp=' . basename(__file__, '.php') . '&amp;case=install&amp;' . $GET_FORM_KEY . '&amp;plg=';
$plugin_uninstall_link = ADMIN_PATH . '?cp=' . basename(__file__, '.php') . '&amp;case=uninstall&amp;' . $GET_FORM_KEY . '&amp;plg=';
$plugin_enable_link = ADMIN_PATH . '?cp=' . basename(__file__, '.php') . '&amp;case=enable&amp;' . $GET_FORM_KEY . '&amp;plg=';
$plugin_disable_link = ADMIN_PATH . '?cp=' . basename(__file__, '.php') . '&amp;case=disable&amp;' . $GET_FORM_KEY . '&amp;plg=';
$plugin_download_link = ADMIN_PATH . '?cp=' . basename(__file__, '.php') . '&amp;case=download&amp;' . $GET_FORM_KEY . '&amp;plg=';
$plugin_update_link = ADMIN_PATH . '?cp=' . basename(__file__, '.php') . '&amp;case=update&amp;' . $GET_FORM_KEY . '&amp;plg=';
$plugin_install_link = ADMIN_PATH . '?cp=' . basename(__file__, '.php') . '&amp;case=install&amp;' . $GET_FORM_KEY . '&amp;plg=';
$plugin_uninstall_link = ADMIN_PATH . '?cp=' . basename(__file__, '.php') . '&amp;case=uninstall&amp;' . $GET_FORM_KEY . '&amp;plg=';
$plugin_enable_link = ADMIN_PATH . '?cp=' . basename(__file__, '.php') . '&amp;case=enable&amp;' . $GET_FORM_KEY . '&amp;plg=';
$plugin_disable_link = ADMIN_PATH . '?cp=' . basename(__file__, '.php') . '&amp;case=disable&amp;' . $GET_FORM_KEY . '&amp;plg=';
$plugin_download_link = ADMIN_PATH . '?cp=' . basename(__file__, '.php') . '&amp;case=download&amp;' . $GET_FORM_KEY . '&amp;plg=';
$plugin_delete_folder_link = ADMIN_PATH . '?cp=' . basename(__file__, '.php') . '&amp;case=delete_folder&amp;' . $GET_FORM_KEY . '&amp;plg=';
//check _GET Csrf token
if (! empty($case) && in_array($case, ['install', 'uninstall', 'enable', 'disable' , 'download' , 'update' , 'delete_folder']))
if (! empty($case) && in_array($case, ['install', 'uninstall', 'enable', 'disable' , 'download' , 'delete_folder']))
{
if (! kleeja_check_form_key_get('PLUGINS_FORM_KEY'))
{
kleeja_admin_err($lang['INVALID_GET_KEY'], $action);
exit;
header('HTTP/1.0 401 Unauthorized');
kleeja_admin_err($lang['INVALID_GET_KEY']);
}
}
@@ -53,9 +51,8 @@ if (ip('newplugin'))
{
if (! kleeja_check_form_key('adm_plugins'))
{
header('HTTP/1.0 401 Unauthorized');
kleeja_admin_err($lang['INVALID_FORM_KEY'], true, $lang['ERROR'], true, $action);
exit;
}
$case = 'upload';
@@ -142,7 +139,8 @@ switch ($case):
}
@closedir($dh);
$no_plugins = sizeof($available_plugins) == 0 && sizeof($installed_plugins) == 0;
$no_plugins = sizeof($available_plugins) == 0 && sizeof($installed_plugins) == 0;
$no_installed_plugins = sizeof($installed_plugins) == 0;
$stylee = 'admin_plugins';
@@ -174,7 +172,7 @@ switch ($case):
foreach ($catalog_plugins as $plugin_info)
{
if ($case == 'store' && (in_array($plugin_info['name'], $available_plugins_names) ||
! empty($installed_plugins[$plugin_info['name']]) )
! empty($installed_plugins[$plugin_info['name']]))
) {
continue;
}
@@ -198,7 +196,7 @@ switch ($case):
'current_version' => ! empty($installed_plugins[$plugin_info['name']]) ? strtolower($installed_plugins[$plugin_info['name']]['extra_info']['plugin_version']) : '',
'kj_min_version' => $plugin_info['kleeja_version']['min'],
'kj_max_version' => $plugin_info['kleeja_version']['max'],
'kj_version_cmtp' => sprintf($lang[ 'KLJ_VER_NO_PLUGIN'], $plugin_info['kleeja_version']['min'], $plugin_info['kleeja_version']['max']),
'kj_version_cmtp' => sprintf($lang['KLJ_VER_NO_PLUGIN'], $plugin_info['kleeja_version']['min'], $plugin_info['kleeja_version']['max']),
'icon' => $plugin_info['icon'] ,
'NotCompatible' => version_compare(strtolower($plugin_info['kleeja_version']['min']), KLEEJA_VERSION, '<=')
&& version_compare(strtolower($plugin_info['kleeja_version']['max']), KLEEJA_VERSION, '>=')
@@ -260,11 +258,11 @@ switch ($case):
if (! sizeof($ERRORS))
{
kleeja_admin_info($lang['NO_PROBLEM_AFTER_ZIP'], true, '', true, $action);
kleeja_admin_info($lang['NO_PROBLEM_AFTER_ZIP'], $action);
}
else
{
kleeja_admin_err('- ' . implode('<br>- ', $ERRORS), true, '', true, ADMIN_PATH . '?cp=' . basename(__file__, '.php'));
kleeja_admin_err('- ' . implode('<br>- ', $ERRORS), $action);
}
break;
@@ -277,9 +275,8 @@ switch ($case):
if (intval($userinfo['founder']) !== 1)
{
kleeja_admin_err($lang['HV_NOT_PRVLG_ACCESS'], ADMIN_PATH . '?cp=' . basename(__file__, '.php'));
exit;
header('HTTP/1.0 401 Unauthorized');
kleeja_admin_err($lang['HV_NOT_PRVLG_ACCESS'], $action);
}
$plg_name = g('plg', 'str');
@@ -408,9 +405,8 @@ switch ($case):
if (intval($userinfo['founder']) !== 1)
{
kleeja_admin_err($lang['HV_NOT_PRVLG_ACCESS'], ADMIN_PATH . '?cp=' . basename(__file__, '.php'));
exit;
header('HTTP/1.0 401 Unauthorized');
kleeja_admin_err($lang['HV_NOT_PRVLG_ACCESS'], $action);
}
$plg_name = g('plg', 'str');
@@ -494,9 +490,8 @@ switch ($case):
if (intval($userinfo['founder']) !== 1)
{
kleeja_admin_err($lang['HV_NOT_PRVLG_ACCESS'], ADMIN_PATH . '?cp=' . basename(__file__, '.php'));
exit;
header('HTTP/1.0 401 Unauthorized');
kleeja_admin_err($lang['HV_NOT_PRVLG_ACCESS'], $action);
}
$plg_name = g('plg', 'str');
@@ -538,19 +533,29 @@ switch ($case):
if (intval($userinfo['founder']) !== 1)
{
kleeja_admin_err($lang['HV_NOT_PRVLG_ACCESS'], ADMIN_PATH . '?cp=' . basename(__file__, '.php'));
exit;
header('HTTP/1.0 401 Unauthorized');
kleeja_admin_err($lang['HV_NOT_PRVLG_ACCESS']);
}
$download_plugin = g('plg');
// update it , rename function doesn't move the folder , if the folder is exists on the new dir
if ( file_exists( PATH . KLEEJA_PLUGINS_FOLDER . '/' . $download_plugin . '/init.php' ) )
{
redirect( $plugin_update_link . $download_plugin );
$is_update = false;
exit;
//if plugin exists before, then trigger update action. rename folder to rollback in case of failure
if (file_exists(PATH . KLEEJA_PLUGINS_FOLDER . '/' . $download_plugin . '/init.php'))
{
$is_update = true;
if (! rename(
PATH . KLEEJA_PLUGINS_FOLDER . '/' . $download_plugin,
PATH . KLEEJA_PLUGINS_FOLDER . '/' . $download_plugin . '_backup'
))
{
if (is_dir(PATH . KLEEJA_PLUGINS_FOLDER . '/' . $download_plugin))
{
kleeja_unlink(PATH . KLEEJA_PLUGINS_FOLDER . '/' . $download_plugin);
}
}
}
// plugins avilable in kleeja store
@@ -590,80 +595,81 @@ switch ($case):
if ($downloaded_plugin_zip)
{
if (file_exists(PATH . 'cache/' . $download_plugin . '.zip' ) )
if (file_exists(PATH . 'cache/' . $download_plugin . '.zip'))
{
$zip = new ZipArchive();
if ($zip->open(PATH . 'cache/' . $download_plugin . '.zip' ) === true)
if ($zip->open(PATH . 'cache/' . $download_plugin . '.zip') === true)
{
if ( $zip->extractTo(PATH . KLEEJA_PLUGINS_FOLDER))
if ($zip->extractTo(PATH . KLEEJA_PLUGINS_FOLDER))
{
$zip->close();
// we dont need the zip file anymore
unlink(PATH . 'cache/' . $download_plugin . '.zip');
kleeja_unlink(PATH . 'cache/' . $download_plugin . '.zip');
// for example :: When we extract zip file , the name will be ( advanced-extras-1.0 )
// so we need to remove the version from folder name and replace ( - ) with ( _ )
// and done
$plugin_folder_name = PATH . KLEEJA_PLUGINS_FOLDER . '/' . str_replace('_', '-', $download_plugin) . '-' . $store_plugins[$download_plugin]['plg_version'];
rename($plugin_folder_name, PATH . KLEEJA_PLUGINS_FOLDER . '/' . $download_plugin);
// download or update msg
kleeja_admin_info(
sprintf($lang[ig('update') ? 'PLUGIN_UPDATED' : 'PLUGIN_DOWNLOADED'], $download_plugin),
ADMIN_PATH . '?cp=' . basename(__file__, '.php') . '&amp;case=local'
// uploaded plugin's archive has different name, so we change it
rename(
PATH . KLEEJA_PLUGINS_FOLDER . '/' . trim($zip->getNameIndex(0), '/'),
PATH . KLEEJA_PLUGINS_FOLDER . '/' . $download_plugin
);
exit;
$zip->close();
// download or update msg
$adminAjaxContent = '1:::' . sprintf($lang[$is_update ? 'PLUGIN_UPDATED' : 'PLUGIN_DOWNLOADED'], $download_plugin);
//in case of update, delete back up version
if (is_dir(PATH . KLEEJA_PLUGINS_FOLDER . '/' . $download_plugin . '_backup'))
{
kleeja_unlink(PATH . KLEEJA_PLUGINS_FOLDER . '/' . $download_plugin . '_backup');
}
}
else
{
kleeja_admin_err(sprintf($lang['EXTRACT_ZIP_FAILED'], KLEEJA_PLUGINS_FOLDER));
$adminAjaxContent = '1003:::' . sprintf($lang['EXTRACT_ZIP_FAILED'], KLEEJA_PLUGINS_FOLDER);
}
}
}
else
{
kleeja_admin_err($lang['PLUGIN_FILE_NOT_FOUND']);
$adminAjaxContent = '1004:::' . $lang['PLUGIN_FILE_NOT_FOUND'];
}
}
else
{
kleeja_admin_err($lang['PLUGINS_SERVER_ERROR']);
$adminAjaxContent = '1005:::' . $lang['PLUGINS_SERVER_ERROR'];
}
}
else
{
kleeja_admin_err($lang['PLUGIN_N_CMPT_KLJ']);
$adminAjaxContent = '1006:::' . $lang['PLUGIN_N_CMPT_KLJ'];
}
}
else
{
kleeja_admin_err(sprintf($lang['PLUGIN_REMOTE_FILE_MISSING'], $download_plugin));
$adminAjaxContent = '1007:::' . sprintf($lang['PLUGIN_REMOTE_FILE_MISSING'], $download_plugin);
}
}
else
{
kleeja_admin_err($lang['PLUGINS_SERVER_ERROR']);
$adminAjaxContent = '1008:::' . $lang['PLUGINS_SERVER_ERROR'];
}
break;
case 'update':
$update_plugin = g('plg');
$plugin_folder_name = PATH . KLEEJA_PLUGINS_FOLDER . '/' . $update_plugin;
if (is_dir($plugin_folder_name))
//in case of update failure, rollback to current plugin version
if (strpos($adminAjaxContent, '1:::') === false)
{
kleeja_unlink($plugin_folder_name);
if (is_dir(PATH . KLEEJA_PLUGINS_FOLDER . '/' . $download_plugin . '_backup'))
{
rename(
PATH . KLEEJA_PLUGINS_FOLDER . '/' . $download_plugin . '_backup',
PATH . KLEEJA_PLUGINS_FOLDER . '/' . $download_plugin
);
}
}
redirect($plugin_download_link . $update_plugin . '&amp;update' );
break;
case 'delete_folder':
$plugin_folder = g('plg');
@@ -676,7 +682,7 @@ switch ($case):
}
kleeja_admin_info(
sprintf($lang['PLG_SUCSS_DEL'] , $plugin_folder),
sprintf($lang['PLG_SUCSS_DEL'], $plugin_folder),
ADMIN_PATH . '?cp=' . basename(__file__, '.php') . '&amp;case=local'
);

View File

@@ -22,7 +22,7 @@ $SQL->set_utf8();
//
//In the future here will be a real cache class
//In the future here will be a real cache class
//this codes, it's just a sample and usefull for
//some time ..
//
@@ -61,7 +61,7 @@ class cache
public function save($name, $data, $time = 86400)
{
//
//We have problems if APC is enabled, so we disable our cache
//We have problems if APC is enabled, so we disable our cache
//system if it's lodoed to prevent those problems, but we will
//try to fix it in the near future .. I hope that.
//
@@ -75,8 +75,8 @@ class cache
$data_for_save .= '//Cache file, generated for Kleeja at ' . gmdate('d-m-Y h:i A') . "\n\n";
$data_for_save .= '//No direct opening' . "\n";
$data_for_save .= '(!defined("IN_COMMON") ? exit("hacking attemp!") : null);' . "\n\n";
$data_for_save .= '//return false after x time' . "\n";
$data_for_save .= 'if(time() > ' . (time() + $time) . ') return false;' . "\n\n";
$data_for_save .= '//return false after x time' . "\n";
$data_for_save .= 'if(time() > ' . (time() + $time) . ') return false;' . "\n\n";
$data_for_save .= '$data = ' . var_export($data, true) . ";\n\n//end of cache";
if ($fd = @fopen(PATH . 'cache/' . $name . '.php', 'w'))
@@ -167,7 +167,7 @@ if (! ($olang = $cache->get('data_lang' . $config['language'])))
if (! ($stats = $cache->get('data_stats')))
{
$query = [
'SELECT' => 's.files, s.imgs, s.sizes, s.users, s.last_file, s.last_f_del, s.last_google' .
'SELECT' => 's.files, s.imgs, s.sizes, s.users, s.last_file, s.last_f_del, s.last_google' .
', s.last_bing, s.google_num, s.bing_num, s.lastuser',
'FROM' => "{$dbprefix}stats s"
];
@@ -207,7 +207,7 @@ if (! ($stats = $cache->get('data_stats')))
'WHERE' => "f.filter_type='stats_for_acp' AND f.filter_uid = '" . date('d-n-Y') . "'"
];
$result = $SQL->build($query);
$result = $SQL->build($query);
//if already there is stats for this day, just update it, if not insert a new one
if ($SQL->num_rows($result))
@@ -256,7 +256,7 @@ if (! ($banss = $cache->get('data_ban')))
if (! empty($ban1) || $ban1 != ' '|| $ban1 != ' ')
{
//seperate ips ..
//seperate ips ..
$ban2 = explode('|', $ban1);
for ($i=0; $i<sizeof($ban2); $i++)
@@ -272,7 +272,7 @@ if (! ($banss = $cache->get('data_ban')))
$cache->save('data_ban', $banss);
}
//
//
//get rules data from stats table ...
//
if (! ($ruless = $cache->get('data_rules')))
@@ -290,11 +290,11 @@ if (! ($ruless = $cache->get('data_rules')))
$SQL->freeresult($result);
$cache->save('data_rules', $ruless);
}
}
//
//get ex-header-footer data from stats table …
//
//get ex-header-footer data from stats table …
//
if (! ($extras = $cache->get('data_extra')))
{
@@ -319,7 +319,7 @@ if (! ($extras = $cache->get('data_extra')))
}
//
//
//Get groups data
//
if (! ($d_groups = $cache->get('data_groups')))
@@ -340,7 +340,7 @@ if (! ($d_groups = $cache->get('data_groups')))
while ($row=$SQL->fetch_array($result))
{
$d_groups[$row['group_id']]['data'] = $row;
$d_groups[$row['group_id']]['configs'] = [];
$d_groups[$row['group_id']]['configs'] = [];
$d_groups[$row['group_id']]['acls'] = [];
$d_groups[$row['group_id']]['exts'] = [];
}

View File

@@ -201,7 +201,7 @@ define('ADMIN_PATH', rtrim($config['siteurl'], '/') . '/admin/index.php');
//no tpl caching in dev stage
if (defined('DEV_STAGE'))
if (defined('DEV_STAGE') || defined('STOP_TPL_CACHE'))
{
$tpl->caching = false;
}

View File

@@ -21,17 +21,6 @@ class kleeja_style
protected $reg = ['var' => '/([{]{1,2})+([A-Z0-9_\.]+)[}]{1,2}/i'];
public $caching = true; //save templates as caches to not compiled a lot of times
/**
* check if caching is not enabled and empty style cache files
*/
public function __wakeup()
{
if (! $this->caching)
{
delete_cache(null, true);
}
}
/**
* Function to load a template file.
* @param $template_name

View File

@@ -190,7 +190,7 @@ return [
'ADM_UNWANTED_FILES' => 'يبدوا انك قمت بالترقية من نسخة سابقة وبسبب اختلاف اسماء بعض الملفات ستلاحظ وجود ازرار متكررة بلوحة التحكم . <br /> لحل المشكلة قم بإزالة كافة الملفات في المسار "includes/adm" واعادة رفعها من جديد. ايضا قم بحذف ملف admin.php من المجلد الرئيسي اذا وجد.',
'HTML_URLS_ENABLED_NO_HTCC' => 'لقد قمت بتفعيل روابط الهتمل ولكنك نسيت أن تقوم بإعادة تسمية الملف htaccess.txt في مجلد كليجا الرئيسي ليصبح ".htaccess". اذا لم تفهم شيئاً من هذا الكلام قم بالسؤال في الدعم الفني لكليجا او قم بتعطيل روابط الهتمل .',
'PLUGIN_CONFIRM_ADD' => 'انتبه, الاضافات هي تعديلات برمجية على السكربت و قد تكون ضارة أحياناً , لذا ان كنت غير متأكد من مصدر الإضافة ولم تقم بتحميلها من موقع كليجا فالافضل ان تراجع نفسك الآن . ',
'PLUGIN_CONFIRM_ADD' => 'انتبه, الاضافات هي تعديلات برمجية على كليجا و قد تكون ضارة أحياناً , لذا ان كنت غير متأكد من مصدر الإضافة ولم تقم بتحميلها من موقع كليجا فالافضل ان تراجع نفسك الآن . ',
'LOADING' => 'جاري التنفيذ',
'WELCOME' => 'مرحباً',
'ENABLE_CAPTCHA' => 'تفعيل كود الامان بكليجا',
@@ -262,7 +262,7 @@ return [
'CLOSE' => 'إغلاق',
'STATS_BOXES' => 'صناديق الإحصائيات',
'PLUGIN_UPDATED' => 'الإضافة "%s" تم تحديثها بنجاح ..',
'PLUGIN_DOWNLOADED' => 'الإضافة "%s" تم تحميلها بنجاح ..',
'PLUGIN_DOWNLOADED' => 'الإضافة "%s" تم تحميلها بنجاح! لتفعيلها توجه للإضافات المحلية.',
'PLUGIN_FILE_NOT_FOUND' => 'ملف الإضافة مفقود لايمكن إيجاده!',
'PLUGIN_REMOTE_FILE_MISSING' => 'الإضافة "%s" ليست على موجوة على متجر كليجا الخارجي!',
'PLUGINS_SERVER_ERROR' => 'واجهنا خطأ أثناء الإتصال بخادم متجر كليجا الخارجي...',
@@ -272,7 +272,7 @@ return [
'KLJ_VER_NO_PLUGIN' => 'هذه الإضافة يمكنها العمل على إصدار كليجا %1$s حتى إصدار %2$s.',
'VERSION' => 'الإصدار',
'DEVELOPER' => 'المطور',
'ALL_PLUGINS_UPDATED' => 'لا يوجد إضافات تحتاج تحديث حالياً ... ',
'ALL_PLUGINS_UPDATED' => 'كافة الإضافات مُحدثة. رائع!',
'UPDATE_ERR_FETCH_PACKAGE' => 'واجهتنا مشكلة أثناء تحميل النسخة من الخادم!',
'UPDATE_BACKUP_CREATE_FAILED' => 'لم نستطع إنشاء ملف النسخة الإحتياطية في مجلد الكاش!',
'UPDATE_PROCESS_FAILED' => 'عملية التحديث فشلت!',

View File

@@ -191,7 +191,7 @@ return [
'USERSECTOUPLOAD' => 'The seconds between each upload process',
'ADM_UNWANTED_FILES' => 'You seem to have upgraded from a previous version, and because some file names are different now, you\'ll notice duplicated buttons in control panel. </ br> to solve this, remove all the files in "includes/adm" directory and re-upload them.',
'HTML_URLS_ENABLED_NO_HTCC' => 'you have enabled the rewrite URLs, but you seem to have forgot to rename .htaccess.txt in Kleeja\'s root directory to ".htaccess", however, if you don\'t know what I\'m talking about, go ask for Kleeja\'s support or simply disable the rewrite urls feature.',
'PLUGIN_CONFIRM_ADD' => 'Caution: the plugins make changes to the script, and they could be harmful at times. so be sure to check the plugin source and make sure that it is an official Kleeja plugin.',
'PLUGIN_CONFIRM_ADD' => 'Caution: plugins make changes to Kleeja functionality, and they could be harmful at times. so be sure to check the plugin source and make sure that it is an official Kleeja plugin.',
'LOADING' => 'Loading',
'WELCOME' => 'Welcome',
'ENABLE_CAPTCHA' => 'Enable Captcha in Kleeja',
@@ -264,7 +264,7 @@ return [
'CLOSE' => 'Close',
'STATS_BOXES' => 'Stats Boxes',
'PLUGIN_UPDATED' => 'Plugin "%s" has been updated successfully ..',
'PLUGIN_DOWNLOADED' => 'Plugin "%s" has been downloaded successfully ..',
'PLUGIN_DOWNLOADED' => 'Plugin "%s" has been downloaded successfully! Check "Local Plugins" to enable it.',
'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 ...',
@@ -274,7 +274,7 @@ return [
'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...',
'ALL_PLUGINS_UPDATED' => 'All plugins are up-to-date. Hooray!',
'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!',