mirror of
https://github.com/kleeja-official/kleeja.git
synced 2025-12-24 00:39:40 +01:00
enhancement to styles page
This commit is contained in:
@@ -98,7 +98,7 @@
|
||||
|
||||
<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>
|
||||
<a class="btn btn-danger btn-sm" href="{plugin_delete_folder_link}{{name}}" title="{lang.DELETE}" onclick="javascript:return confirm_form();"><i class="fa fa-trash" title="{lang.DELETE}"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
@@ -144,12 +144,12 @@
|
||||
<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>
|
||||
<span class="p-3 font-weight-bold">{lang.STORE_SERVER_ERROR}</span>
|
||||
</IF>
|
||||
</div>
|
||||
</UNLESS>
|
||||
|
||||
<IF NAME="store_plugins_count gt 1">
|
||||
<IF NAME="store_plugins_count gt 1" AND="case == check">
|
||||
<div class="d-flex justify-content-end my-3">
|
||||
<button id="updateAllBtn" type="button" onclick="updateAll()" class="btn btn-primary px-5">
|
||||
<i class="fa fa-flash"></i> {lang.UPDATE_ALL}
|
||||
@@ -184,11 +184,11 @@
|
||||
|
||||
<!-- Modal -->
|
||||
<div class="modal fade" id="Modal_{{name}}" tabindex="-1" role="dialog"
|
||||
aria-labelledby="exampleModalLabel" aria-hidden="true">
|
||||
aria-labelledby="Plugin_View_{{name}}" 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>
|
||||
<h4 class="modal-title" id="Plugin_View_{{name}}">{{title}}</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
@@ -203,7 +203,7 @@
|
||||
<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}
|
||||
{lang.PACKAGE_N_CMPT_KLJ}
|
||||
</li>
|
||||
</IF>
|
||||
</ul>
|
||||
|
||||
@@ -277,15 +277,6 @@ function toggleStartBox(name, hide, current) {
|
||||
{lang.HURRY_HURRY}
|
||||
</div>
|
||||
<ul class="list-group list-group-flush">
|
||||
<li class="list-group-item d-flex justify-content-between">
|
||||
{lang.STYLE}
|
||||
<div>
|
||||
<select name="style_change" id="style_change" class="custom-select">
|
||||
{hurry_styles_list}
|
||||
</select>
|
||||
<button class="btn btn-outline-primary" onclick="javascript:get_kleeja_link('{hurry_style_link}' + $('#style_change').val()); return false;"><span>{lang.CHANGE}</span></button>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item d-lg-flex justify-content-between">
|
||||
{lang.LANGUAGE}
|
||||
<div>
|
||||
|
||||
@@ -12,11 +12,23 @@
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
<ul class="nav nav-tabs mb-3">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link (case == local?active:)" href="{action}&case=local">{lang.R_STYLES}</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link (case == store?active:)" href="{action}&case=store">{lang.KLEEJA_STORE}</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link (case == check?active:)" href="{action}&case=check">{lang.R_CHECK_UPDATE}</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<IF NAME="case == local">
|
||||
<ul class="list-unstyled list-group">
|
||||
<LOOP NAME="arr">
|
||||
<LOOP NAME="available_styles">
|
||||
<li class="media justify-content-between d-lg-flex list-group-item">
|
||||
<img class="mr-3" src="{{icon}}" alt="{{style_name}}" style="width: 250px">
|
||||
<img class="mr-3" src="{{icon}}" alt="{{name}}" style="width: 250px">
|
||||
<div class="media-body col-xs-12" style="padding: 10px">
|
||||
<h5 class="mt-0 mb-1">{{info.name}} <small class="text-muted">{{info.version}}</small> </h5>
|
||||
|
||||
@@ -26,7 +38,8 @@
|
||||
<IF LOOP="is_default">
|
||||
<span class="badge badge-pill badge-dark"><i class="fa fa-certificate text-warning" title="{lang.STYLE_IS_DEFAULT}"></i> {lang.STYLE_IS_DEFAULT}</span>
|
||||
<ELSE>
|
||||
<a href="{{link_mk_default}}" class="btn btn-primary" title="{lang.MAKE_AS_DEFAULT}"><i class="fa fa-check-square-o" title="{lang.MAKE_AS_DEFAULT}"></i> {lang.MAKE_AS_DEFAULT}</a>
|
||||
<a href="{style_select_link}{{name}}" class="btn btn-primary" title="{lang.MAKE_AS_DEFAULT}"><i class="fa fa-check-square-o" title="{lang.MAKE_AS_DEFAULT}"></i> {lang.MAKE_AS_DEFAULT}</a>
|
||||
<a href="{style_delete_link}{{name}}" onclick="javascript:return confirm_form();" class="btn btn-danger" title="{lang.DELETE}"><i class="fa fa-trash" title="{lang.DELETE}"></i> {lang.DELETE}</a>
|
||||
</IF>
|
||||
</div>
|
||||
</div>
|
||||
@@ -34,6 +47,142 @@
|
||||
</LOOP>
|
||||
</ul>
|
||||
|
||||
<!-- ...... -->
|
||||
<!-- store/check -->
|
||||
<!-- ..... -->
|
||||
<ELSEIF NAME="case == store" OR="case == check">
|
||||
|
||||
<UNLESS NAME="store_styles_count">
|
||||
<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_STYLES_UPDATED}</span>
|
||||
<ELSE>
|
||||
<i class="fa fa-exclamation fa-3x text-info p-2"></i>
|
||||
<span class="p-3 font-weight-bold">{lang.STORE_SERVER_ERROR}</span>
|
||||
</IF>
|
||||
</div>
|
||||
</UNLESS>
|
||||
|
||||
<IF NAME="store_styles_count gt 1" AND="case == check">
|
||||
<div class="d-flex justify-content-end my-3">
|
||||
<button id="updateAllBtn" type="button" onclick="updateAll()" class="btn btn-primary px-5">
|
||||
<i class="fa fa-flash"></i> {lang.UPDATE_ALL}
|
||||
</button>
|
||||
</div>
|
||||
</IF>
|
||||
|
||||
<ul class="list-unstyled list-group mt-2">
|
||||
<LOOP NAME="store_styles">
|
||||
<li class="media d-flex justify-content-between list-group-item">
|
||||
<img class="mr-3" src="{{icon}}" alt="{{title}}" style="width: 75px">
|
||||
<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="downloadStyle('{{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="Style_View_{{name}}" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="Style_View_{{name}}">{{title}}</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</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"><a href="{{website}}" target="_tab"><i class="fa fa-external-link"></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.PACKAGE_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 -->
|
||||
</li>
|
||||
</LOOP>
|
||||
</ul>
|
||||
<script>
|
||||
function downloadStyle(name, nextStyles) {
|
||||
$('#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: '{style_download_link}'.replace(/&/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();
|
||||
}
|
||||
|
||||
setTimeout(function() {
|
||||
var currentStyle = nextStyles.shift();
|
||||
downloadPlugin(currentStyle, nextStyles);
|
||||
}, 500);
|
||||
})
|
||||
.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}'))
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
function updateAll() {
|
||||
$('#updateAllBtn').prop('disabled', true);
|
||||
|
||||
var styles = [<LOOP NAME="store_styles">'{{name}}',</LOOP>];
|
||||
|
||||
$.each(styles, function( index, name ) {
|
||||
$('#downloadBtn-' + name).prop('disabled', true);
|
||||
});
|
||||
|
||||
var currentStyle = styles.shift();
|
||||
downloadPlugin(currentStyle, styles);
|
||||
}
|
||||
</script>
|
||||
|
||||
</IF>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- new style modal -->
|
||||
@@ -65,4 +214,3 @@
|
||||
</form>
|
||||
</div>
|
||||
<!-- end new style modal -->
|
||||
|
||||
|
||||
@@ -23,30 +23,30 @@ if (! defined('IN_ADMIN'))
|
||||
$case = g('case', 'str', 'installed');
|
||||
|
||||
//set _get form key
|
||||
$GET_FORM_KEY = kleeja_add_form_key_get('PLUGINS_FORM_KEY');
|
||||
$GET_FORM_KEY = kleeja_add_form_key_get('adm_plugins_get');
|
||||
$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') . '&case=install&' . $GET_FORM_KEY . '&plg=';
|
||||
$plugin_uninstall_link = ADMIN_PATH . '?cp=' . basename(__file__, '.php') . '&case=uninstall&' . $GET_FORM_KEY . '&plg=';
|
||||
$plugin_enable_link = ADMIN_PATH . '?cp=' . basename(__file__, '.php') . '&case=enable&' . $GET_FORM_KEY . '&plg=';
|
||||
$plugin_disable_link = ADMIN_PATH . '?cp=' . basename(__file__, '.php') . '&case=disable&' . $GET_FORM_KEY . '&plg=';
|
||||
$plugin_download_link = ADMIN_PATH . '?cp=' . basename(__file__, '.php') . '&case=download&' . $GET_FORM_KEY . '&plg=';
|
||||
$plugin_delete_folder_link = ADMIN_PATH . '?cp=' . basename(__file__, '.php') . '&case=delete_folder&' . $GET_FORM_KEY . '&plg=';
|
||||
$plugin_install_link = $action . '&case=install&' . $GET_FORM_KEY . '&plg=';
|
||||
$plugin_uninstall_link = $action . '&case=uninstall&' . $GET_FORM_KEY . '&plg=';
|
||||
$plugin_enable_link = $action . '&case=enable&' . $GET_FORM_KEY . '&plg=';
|
||||
$plugin_disable_link = $action . '&case=disable&' . $GET_FORM_KEY . '&plg=';
|
||||
$plugin_download_link = $action . '&case=download&' . $GET_FORM_KEY . '&plg=';
|
||||
$plugin_delete_folder_link = $action . '&case=dfolder&' . $GET_FORM_KEY . '&plg=';
|
||||
|
||||
|
||||
//check _GET Csrf token
|
||||
if (! empty($case) && in_array($case, ['install', 'uninstall', 'enable', 'disable' , 'download' , 'delete_folder']))
|
||||
if (! empty($case) && in_array($case, ['install', 'uninstall', 'enable', 'disable' , 'download' , 'dfolder']))
|
||||
{
|
||||
if (! kleeja_check_form_key_get('PLUGINS_FORM_KEY'))
|
||||
if (! kleeja_check_form_key_get('adm_plugins_get'))
|
||||
{
|
||||
header('HTTP/1.0 401 Unauthorized');
|
||||
kleeja_admin_err($lang['INVALID_GET_KEY']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//check _POST Csrf token
|
||||
if (ip('newplugin'))
|
||||
{
|
||||
if (! kleeja_check_form_key('adm_plugins'))
|
||||
@@ -125,15 +125,12 @@ switch ($case):
|
||||
{
|
||||
if (empty($installed_plugins[$folder_name]))
|
||||
{
|
||||
array_push($available_plugins,
|
||||
[
|
||||
array_push($available_plugins, [
|
||||
'name' => $folder_name,
|
||||
'icon' => file_exists(PATH . KLEEJA_PLUGINS_FOLDER . '/' . $folder_name . '/icon.png')
|
||||
? PATH . KLEEJA_PLUGINS_FOLDER . '/' . $folder_name . '/icon.png'
|
||||
: $STYLE_PATH_ADMIN . 'images/plugin.png',
|
||||
|
||||
]
|
||||
);
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -151,16 +148,16 @@ switch ($case):
|
||||
}
|
||||
|
||||
// plugins avilable in kleeja remote catalog
|
||||
if (! ($catalog_plugins = $cache->get('catalog_plugins')))
|
||||
if (! ($store_catalog = $cache->get('store_catalog')))
|
||||
{
|
||||
$store_link = 'https://raw.githubusercontent.com/kleeja-official/store-catalog/master/catalog.json';
|
||||
|
||||
$catalog_plugins = fetch_remote_file($store_link);
|
||||
$catalog_plugins = json_decode($catalog_plugins, true);
|
||||
$store_catalog = fetch_remote_file($store_link);
|
||||
$store_catalog = json_decode($store_catalog, true);
|
||||
|
||||
if (json_last_error() == JSON_ERROR_NONE)
|
||||
{
|
||||
$cache->save('catalog_plugins', $catalog_plugins);
|
||||
$cache->save('store_catalog', $store_catalog);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,8 +166,13 @@ switch ($case):
|
||||
$store_plugins = [];
|
||||
$available_plugins_names = array_column($available_plugins, 'name');
|
||||
|
||||
foreach ($catalog_plugins as $plugin_info)
|
||||
foreach ($store_catalog as $plugin_info)
|
||||
{
|
||||
if ($plugin_info['type'] != 'plugin')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($case == 'store' && (in_array($plugin_info['name'], $available_plugins_names) ||
|
||||
! empty($installed_plugins[$plugin_info['name']]))
|
||||
) {
|
||||
@@ -337,7 +339,7 @@ switch ($case):
|
||||
if (version_compare(KLEEJA_VERSION, $plugin_info['plugin_kleeja_version_min'], '<'))
|
||||
{
|
||||
kleeja_admin_info(
|
||||
$lang['PLUGIN_N_CMPT_KLJ'] . '<br>k:' . KLEEJA_VERSION . '|<|p.min:' . $plugin_info['plugin_kleeja_version_min'],
|
||||
$lang['PACKAGE_N_CMPT_KLJ'] . '<br>k:' . KLEEJA_VERSION . '|<|p.min:' . $plugin_info['plugin_kleeja_version_min'],
|
||||
true, '', true, ADMIN_PATH . '?cp=' . basename(__file__, '.php')
|
||||
);
|
||||
|
||||
@@ -349,7 +351,7 @@ switch ($case):
|
||||
if (version_compare(KLEEJA_VERSION, $plugin_info['plugin_kleeja_version_max'], '>'))
|
||||
{
|
||||
kleeja_admin_info(
|
||||
$lang['PLUGIN_N_CMPT_KLJ'] . '<br>k:' . KLEEJA_VERSION . '|>|p.max:' . $plugin_info['plugin_kleeja_version_max'],
|
||||
$lang['PACKAGE_N_CMPT_KLJ'] . '<br>k:' . KLEEJA_VERSION . '|>|p.max:' . $plugin_info['plugin_kleeja_version_max'],
|
||||
true, '', true, ADMIN_PATH . '?cp=' . basename(__file__, '.php')
|
||||
);
|
||||
|
||||
@@ -473,7 +475,7 @@ switch ($case):
|
||||
$SQL->build($query_del);
|
||||
|
||||
//show done, msg
|
||||
$text = '<h3>' . $lang['PLUGIN_DELETED'] . '</h3>';
|
||||
$text = '<h3>' . sprintf($lang['ITEM_DELETED'], $plg_name) . '</h3>';
|
||||
$text .= '<script type="text/javascript"> setTimeout("get_kleeja_link(\'' . ADMIN_PATH . '?cp=' . basename(__file__, '.php') . '\');", 2000);</script>' . "\n";
|
||||
|
||||
$stylee = 'admin_info';
|
||||
@@ -537,23 +539,23 @@ switch ($case):
|
||||
kleeja_admin_err($lang['HV_NOT_PRVLG_ACCESS']);
|
||||
}
|
||||
|
||||
$download_plugin = g('plg');
|
||||
$plugin_name = g('plg');
|
||||
|
||||
$is_update = false;
|
||||
|
||||
//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'))
|
||||
if (file_exists(PATH . KLEEJA_PLUGINS_FOLDER . '/' . $plugin_name . '/init.php'))
|
||||
{
|
||||
$is_update = true;
|
||||
|
||||
if (! rename(
|
||||
PATH . KLEEJA_PLUGINS_FOLDER . '/' . $download_plugin,
|
||||
PATH . KLEEJA_PLUGINS_FOLDER . '/' . $download_plugin . '_backup'
|
||||
PATH . KLEEJA_PLUGINS_FOLDER . '/' . $plugin_name,
|
||||
PATH . KLEEJA_PLUGINS_FOLDER . '/' . $plugin_name . '_backup'
|
||||
))
|
||||
{
|
||||
if (is_dir(PATH . KLEEJA_PLUGINS_FOLDER . '/' . $download_plugin))
|
||||
if (is_dir(PATH . KLEEJA_PLUGINS_FOLDER . '/' . $plugin_name))
|
||||
{
|
||||
kleeja_unlink(PATH . KLEEJA_PLUGINS_FOLDER . '/' . $download_plugin);
|
||||
kleeja_unlink(PATH . KLEEJA_PLUGINS_FOLDER . '/' . $plugin_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -572,6 +574,11 @@ switch ($case):
|
||||
// make an arry for all plugins in kleeja store that not included in our server
|
||||
foreach ($catalog_plugins as $plugin_info)
|
||||
{
|
||||
if ($plugin_info['type'] != 'plugin')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$store_plugins[$plugin_info['name']] = [
|
||||
'name' => $plugin_info['name'] ,
|
||||
'plg_version' => $plugin_info['file']['version'] ,
|
||||
@@ -581,46 +588,46 @@ switch ($case):
|
||||
];
|
||||
}
|
||||
|
||||
// // => this plugin is hosted in our store
|
||||
if (isset($store_plugins[$download_plugin]))
|
||||
// this plugin is hosted in our store
|
||||
if (isset($store_plugins[$plugin_name]))
|
||||
{
|
||||
// check if the version of the plugin is compatible with our kleeja version or not
|
||||
if (
|
||||
version_compare(strtolower($store_plugins[$download_plugin]['kj_min_version']), KLEEJA_VERSION, '<=')
|
||||
&& version_compare(strtolower($store_plugins[$download_plugin]['kj_max_version']), KLEEJA_VERSION, '>=')
|
||||
version_compare(strtolower($store_plugins[$plugin_name]['kj_min_version']), KLEEJA_VERSION, '<=')
|
||||
&& version_compare(strtolower($store_plugins[$plugin_name]['kj_max_version']), KLEEJA_VERSION, '>=')
|
||||
) {
|
||||
$download_plugin_link = $store_plugins[$download_plugin]['url'];
|
||||
$plugin_name_link = $store_plugins[$plugin_name]['url'];
|
||||
|
||||
$downloaded_plugin_zip = fetch_remote_file($download_plugin_link, PATH . 'cache/' . $download_plugin . '.zip', 60, false, 10, true);
|
||||
$plugin_archive = fetch_remote_file($plugin_name_link, PATH . 'cache/' . $plugin_name . '.zip', 60, false, 10, true);
|
||||
|
||||
if ($downloaded_plugin_zip)
|
||||
if ($plugin_archive)
|
||||
{
|
||||
if (file_exists(PATH . 'cache/' . $download_plugin . '.zip'))
|
||||
if (file_exists(PATH . 'cache/' . $plugin_name . '.zip'))
|
||||
{
|
||||
$zip = new ZipArchive();
|
||||
|
||||
if ($zip->open(PATH . 'cache/' . $download_plugin . '.zip') === true)
|
||||
if ($zip->open(PATH . 'cache/' . $plugin_name . '.zip') === true)
|
||||
{
|
||||
if ($zip->extractTo(PATH . KLEEJA_PLUGINS_FOLDER))
|
||||
{
|
||||
// we dont need the zip file anymore
|
||||
kleeja_unlink(PATH . 'cache/' . $download_plugin . '.zip');
|
||||
kleeja_unlink(PATH . 'cache/' . $plugin_name . '.zip');
|
||||
|
||||
// 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
|
||||
PATH . KLEEJA_PLUGINS_FOLDER . '/' . $plugin_name
|
||||
);
|
||||
|
||||
$zip->close();
|
||||
|
||||
// download or update msg
|
||||
$adminAjaxContent = '1:::' . sprintf($lang[$is_update ? 'PLUGIN_UPDATED' : 'PLUGIN_DOWNLOADED'], $download_plugin);
|
||||
$adminAjaxContent = '1:::' . sprintf($lang[$is_update ? 'ITEM_UPDATED' : 'ITEM_DOWNLOADED'], $plugin_name);
|
||||
|
||||
//in case of update, delete back up version
|
||||
if (is_dir(PATH . KLEEJA_PLUGINS_FOLDER . '/' . $download_plugin . '_backup'))
|
||||
if (is_dir(PATH . KLEEJA_PLUGINS_FOLDER . '/' . $plugin_name . '_backup'))
|
||||
{
|
||||
kleeja_unlink(PATH . KLEEJA_PLUGINS_FOLDER . '/' . $download_plugin . '_backup');
|
||||
kleeja_unlink(PATH . KLEEJA_PLUGINS_FOLDER . '/' . $plugin_name . '_backup');
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -631,38 +638,38 @@ switch ($case):
|
||||
}
|
||||
else
|
||||
{
|
||||
$adminAjaxContent = '1004:::' . $lang['PLUGIN_FILE_NOT_FOUND'];
|
||||
$adminAjaxContent = '1004:::' . $lang['DOWNLOADED_FILE_NOT_FOUND'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$adminAjaxContent = '1005:::' . $lang['PLUGINS_SERVER_ERROR'];
|
||||
$adminAjaxContent = '1005:::' . $lang['STORE_SERVER_ERROR'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$adminAjaxContent = '1006:::' . $lang['PLUGIN_N_CMPT_KLJ'];
|
||||
$adminAjaxContent = '1006:::' . $lang['PACKAGE_N_CMPT_KLJ'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$adminAjaxContent = '1007:::' . sprintf($lang['PLUGIN_REMOTE_FILE_MISSING'], $download_plugin);
|
||||
$adminAjaxContent = '1007:::' . sprintf($lang['PACKAGE_REMOTE_FILE_MISSING'], $plugin_name);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$adminAjaxContent = '1008:::' . $lang['PLUGINS_SERVER_ERROR'];
|
||||
$adminAjaxContent = '1008:::' . $lang['STORE_SERVER_ERROR'];
|
||||
}
|
||||
|
||||
|
||||
//in case of update failure, rollback to current plugin version
|
||||
if (strpos($adminAjaxContent, '1:::') === false)
|
||||
{
|
||||
if (is_dir(PATH . KLEEJA_PLUGINS_FOLDER . '/' . $download_plugin . '_backup'))
|
||||
if (is_dir(PATH . KLEEJA_PLUGINS_FOLDER . '/' . $plugin_name . '_backup'))
|
||||
{
|
||||
rename(
|
||||
PATH . KLEEJA_PLUGINS_FOLDER . '/' . $download_plugin . '_backup',
|
||||
PATH . KLEEJA_PLUGINS_FOLDER . '/' . $download_plugin
|
||||
PATH . KLEEJA_PLUGINS_FOLDER . '/' . $plugin_name . '_backup',
|
||||
PATH . KLEEJA_PLUGINS_FOLDER . '/' . $plugin_name
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -670,21 +677,30 @@ switch ($case):
|
||||
break;
|
||||
|
||||
|
||||
case 'delete_folder':
|
||||
case 'dfolder':
|
||||
|
||||
$plugin_folder = g('plg');
|
||||
$plugin_name = preg_replace('/[^a-z0-9_\-\.]/i', '', g('plg'));
|
||||
|
||||
$plugin_folder_name = PATH . KLEEJA_PLUGINS_FOLDER . '/' . $plugin_folder;
|
||||
$plugin_folder_path = PATH . KLEEJA_PLUGINS_FOLDER . '/' . $plugin_name;
|
||||
|
||||
if (is_dir($plugin_folder_name))
|
||||
|
||||
if (is_dir($plugin_folder_path))
|
||||
{
|
||||
kleeja_unlink($plugin_folder_name);
|
||||
if (! is_writable($plugin_folder_path))
|
||||
{
|
||||
chmod($plugin_folder_path, K_DIR_CHMOD);
|
||||
}
|
||||
|
||||
kleeja_admin_info(
|
||||
sprintf($lang['PLG_SUCSS_DEL'], $plugin_folder),
|
||||
ADMIN_PATH . '?cp=' . basename(__file__, '.php') . '&case=local'
|
||||
);
|
||||
kleeja_unlink($plugin_folder_path);
|
||||
}
|
||||
|
||||
|
||||
if (! is_dir($plugin_folder_path))
|
||||
{
|
||||
kleeja_admin_info(sprintf($lang['ITEM_DELETED'], $plugin_name), $action . '&case=local');
|
||||
}
|
||||
|
||||
kleeja_admin_err($lang['ERROR_TRY_AGAIN'], $action);
|
||||
|
||||
break;
|
||||
|
||||
|
||||
@@ -13,47 +13,186 @@ if (! defined('IN_ADMIN'))
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
//current secondary menu action
|
||||
$current_smt = preg_replace('/[^a-z0-9_]/i', '', g('smt', 'str', 'general'));
|
||||
|
||||
$action = ADMIN_PATH . '?cp=' . basename(__file__, '.php');
|
||||
|
||||
//set _get form key
|
||||
$GET_FORM_KEY = kleeja_add_form_key_get('adm_styles_get');
|
||||
$H_FORM_KEYS = kleeja_add_form_key('adm_styles');
|
||||
|
||||
|
||||
//for style ..
|
||||
$action = ADMIN_PATH . '?cp=' . basename(__file__, '.php');
|
||||
$style_select_link = $action . '&case=select&' . $GET_FORM_KEY . '&style=';
|
||||
$style_download_link = $action . '&case=download&' . $GET_FORM_KEY . '&style=';
|
||||
$style_delete_link = $action . '&case=dfolder&' . $GET_FORM_KEY . '&style=';
|
||||
$style_upload_link = $action . '&case=upload';
|
||||
|
||||
$stylee = 'admin_styles';
|
||||
$case = g('case', 'str', 'local');
|
||||
|
||||
|
||||
|
||||
//after submit
|
||||
if (ip('style_choose') || ig('style_choose'))
|
||||
//check _GET Csrf token
|
||||
if (! empty($case) && in_array($case, ['select', 'download', 'dfolder']))
|
||||
{
|
||||
$style_id = ip('style_choose') ? p('style_choose') : g('style_choose');
|
||||
|
||||
$style_id = preg_replace('/[^a-z0-9_\-\.]/i', '', $style_id);
|
||||
|
||||
|
||||
//if empty, let's ignore it
|
||||
if (empty($style_id))
|
||||
if (! kleeja_check_form_key_get('adm_styles_get'))
|
||||
{
|
||||
redirect(basename(ADMIN_PATH) . '?cp=' . basename(__file__, '.php'));
|
||||
header('HTTP/1.0 401 Unauthorized');
|
||||
kleeja_admin_err($lang['INVALID_GET_KEY'], $action);
|
||||
}
|
||||
}
|
||||
|
||||
//check _POST Csrf token
|
||||
if (ip('newstyle'))
|
||||
{
|
||||
if (! kleeja_check_form_key('adm_styles'))
|
||||
{
|
||||
header('HTTP/1.0 401 Unauthorized');
|
||||
kleeja_admin_err($lang['INVALID_FORM_KEY'], true, $lang['ERROR'], true, $action);
|
||||
}
|
||||
|
||||
// make style as default
|
||||
$case = 'upload';
|
||||
}
|
||||
|
||||
//check _GET Csrf token
|
||||
if (isset($_REQUEST['home']) && ! kleeja_check_form_key_get('adm_start_actions'))
|
||||
switch ($case):
|
||||
default:
|
||||
case 'local':
|
||||
case 'store':
|
||||
|
||||
//get styles
|
||||
$available_styles = [];
|
||||
|
||||
if ($dh = @opendir(PATH . 'styles'))
|
||||
{
|
||||
kleeja_admin_err($lang['INVALID_GET_KEY'], true, $lang['ERROR'], true, basename(ADMIN_PATH) . '?cp=start', 2);
|
||||
while (false !== ($folder_name = readdir($dh)))
|
||||
{
|
||||
if (is_dir(PATH . 'styles/' . $folder_name) && preg_match('/[a-z0-9_.]{3,}/', $folder_name))
|
||||
{
|
||||
|
||||
//info
|
||||
$style_info_arr = [
|
||||
'name' => $folder_name,
|
||||
'desc' => '',
|
||||
'copyright' => '',
|
||||
'version' => ''
|
||||
];
|
||||
|
||||
|
||||
if (($style_info = kleeja_style_info($folder_name)) != false)
|
||||
{
|
||||
foreach (['name', 'desc', 'copyright', 'version'] as $InfoKey)
|
||||
{
|
||||
if (array_key_exists($InfoKey, $style_info))
|
||||
{
|
||||
if (is_array($style_info[$InfoKey]))
|
||||
{
|
||||
$style_info_arr[$InfoKey] = ! empty($style_info[$InfoKey][$config['language']])
|
||||
? htmlspecialchars($style_info[$InfoKey][$config['language']])
|
||||
: htmlspecialchars($style_info[$InfoKey]['en']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$style_info_arr[$InfoKey] = htmlspecialchars($style_info[$InfoKey]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$available_styles[$folder_name] = [
|
||||
'name' => $folder_name,
|
||||
'is_default' => $config['style'] == $folder_name ? true : false,
|
||||
'link_mk_default' => basename(ADMIN_PATH) . '?cp=' . basename(__file__, '.php') . '&style_choose=' . $folder_name,
|
||||
'icon' => file_exists(PATH . 'styles/' . $folder_name . '/screenshot.png')
|
||||
? PATH . 'styles/' . $folder_name . '/screenshot.png'
|
||||
: $STYLE_PATH_ADMIN . 'images/style.png',
|
||||
'info' => $style_info_arr
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@closedir($dh);
|
||||
}
|
||||
|
||||
//do not proceed if not store case
|
||||
if (! in_array($case, ['store', 'check']))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// plugins avilable in kleeja remote catalog
|
||||
if (! ($store_catalog = $cache->get('store_catalog')))
|
||||
{
|
||||
$store_link = 'https://raw.githubusercontent.com/kleeja-official/store-catalog/master/catalog.json';
|
||||
|
||||
$store_catalog = fetch_remote_file($store_link);
|
||||
$store_catalog = json_decode($store_catalog, true);
|
||||
|
||||
if (json_last_error() == JSON_ERROR_NONE)
|
||||
{
|
||||
$cache->save('store_catalog', $store_catalog);
|
||||
}
|
||||
}
|
||||
|
||||
// make an array for all styles in kleeja remote catalog
|
||||
// that are not exsisted locally.
|
||||
$store_styles = [];
|
||||
$available_styles_names = array_column($available_styles, 'name');
|
||||
|
||||
foreach ($store_catalog as $style_info)
|
||||
{
|
||||
if ($style_info['type'] != 'style')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($case == 'store' && ! empty($available_styles[$style_info['name']]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// is there a new version of this in the store
|
||||
elseif (
|
||||
$case == 'check' && (! empty($available_styles[$style_info['name']]['version']) &&
|
||||
version_compare(
|
||||
strtolower($available_styles[$style_info['name']]['version']),
|
||||
strtolower($style_info['file']['version']),
|
||||
'>='
|
||||
) || empty($available_styles[$style_info['name']]))
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$store_styles[$style_info['name']] = [
|
||||
'name' => $style_info['name'],
|
||||
'developer' => $style_info['developer'],
|
||||
'version' => $style_info['file']['version'],
|
||||
'title' => ! empty($style_info['title'][$config['language']]) ? $style_info['title'][$config['language']] : $style_info['title']['en'],
|
||||
'website' => $style_info['website'],
|
||||
'current_version' => ! empty($available_styles[$style_info['name']]) ? strtolower($available_styles[$style_info['name']]['version']) : '',
|
||||
'kj_min_version' => $style_info['kleeja_version']['min'],
|
||||
'kj_max_version' => $style_info['kleeja_version']['max'],
|
||||
'kj_version_cmtp' => sprintf($lang['KLJ_VER_NO_PLUGIN'], $style_info['kleeja_version']['min'], $style_info['kleeja_version']['max']),
|
||||
'icon' => $style_info['icon'],
|
||||
'NotCompatible' => version_compare(strtolower($style_info['kleeja_version']['min']), KLEEJA_VERSION, '<=')
|
||||
&& version_compare(strtolower($style_info['kleeja_version']['max']), KLEEJA_VERSION, '>=')
|
||||
? false : true,
|
||||
];
|
||||
}
|
||||
|
||||
$store_styles_count = sizeof($store_styles);
|
||||
|
||||
break;
|
||||
|
||||
case 'select':
|
||||
|
||||
$style_name = preg_replace('/[^a-z0-9_\-\.]/i', '', g('style'));
|
||||
|
||||
//if empty, let's ignore it
|
||||
if (empty($style_name))
|
||||
{
|
||||
redirect(basename(ADMIN_PATH) . '?cp=' . basename(__file__, '.php'));
|
||||
}
|
||||
|
||||
//
|
||||
//check if this style depend on other style and
|
||||
//check kleeja version that required by this style
|
||||
//
|
||||
if (($style_info = kleeja_style_info($style_id)) != false)
|
||||
if (($style_info = kleeja_style_info($style_name)) != false)
|
||||
{
|
||||
if (isset($style_info['depend_on']) && ! file_exists(PATH . 'styles/' . $style_info['depend_on']))
|
||||
{
|
||||
@@ -103,29 +242,25 @@ if (ip('style_choose') || ig('style_choose'))
|
||||
|
||||
|
||||
//make it as default
|
||||
update_config('style', $style_id);
|
||||
update_config('style', $style_name);
|
||||
update_config('style_depend_on', isset($style_info['depend_on']) ? $style_info['depend_on'] : '');
|
||||
|
||||
//delete all cache to get new style
|
||||
delete_cache('', true);
|
||||
|
||||
//show msg
|
||||
kleeja_admin_info(sprintf($lang['STYLE_NOW_IS_DEFAULT'], htmlspecialchars($style_id)), true, '', true, basename(ADMIN_PATH) . '?cp=' . (isset($_REQUEST['home']) ? 'start' : basename(__file__, '.php')));
|
||||
}
|
||||
elseif (ip('newstyle'))
|
||||
{
|
||||
kleeja_admin_info(sprintf($lang['STYLE_NOW_IS_DEFAULT'], $style_name), $action);
|
||||
|
||||
break;
|
||||
|
||||
case 'upload':
|
||||
|
||||
if (intval($userinfo['founder']) !== 1)
|
||||
{
|
||||
$ERRORS[] = $lang['HV_NOT_PRVLG_ACCESS'];
|
||||
}
|
||||
|
||||
|
||||
if (! kleeja_check_form_key('adm_styles'))
|
||||
{
|
||||
kleeja_admin_err($lang['INVALID_FORM_KEY'], true, $lang['ERROR'], true, $action);
|
||||
}
|
||||
|
||||
|
||||
$ERRORS = [];
|
||||
|
||||
//is uploaded?
|
||||
@@ -135,7 +270,6 @@ elseif (ip('newstyle'))
|
||||
}
|
||||
|
||||
|
||||
|
||||
//extract it to plugins folder
|
||||
if (! sizeof($ERRORS))
|
||||
{
|
||||
@@ -176,61 +310,190 @@ elseif (ip('newstyle'))
|
||||
{
|
||||
kleeja_admin_err('- ' . implode('<br>- ', $ERRORS), $action);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
//get styles
|
||||
$arr = [];
|
||||
case 'dfolder':
|
||||
|
||||
if ($dh = @opendir(PATH . 'styles'))
|
||||
{
|
||||
while (false !== ($folder_name = readdir($dh)))
|
||||
{
|
||||
if (is_dir(PATH . 'styles/' . $folder_name) && preg_match('/[a-z0-9_.]{3,}/', $folder_name))
|
||||
$style_name = preg_replace('/[^a-z0-9_\-\.]/i', '', g('style'));
|
||||
|
||||
//can not delete default style
|
||||
if ($config['style'] === $style_name)
|
||||
{
|
||||
kleeja_admin_info($lang['CANT_DEL_DEFAULT_STYLE'], true, '', true, $action);
|
||||
}
|
||||
|
||||
//info
|
||||
$style_info_arr =
|
||||
[
|
||||
'name' => $folder_name,
|
||||
'desc' => '',
|
||||
'copyright'=> '',
|
||||
'version' => ''
|
||||
$style_folder_path = PATH . 'styles/' . $style_name;
|
||||
|
||||
if (is_dir($style_folder_path))
|
||||
{
|
||||
if (! is_writable($style_folder_path))
|
||||
{
|
||||
chmod($style_folder_path, K_DIR_CHMOD);
|
||||
}
|
||||
|
||||
kleeja_unlink($style_folder_path);
|
||||
}
|
||||
|
||||
|
||||
if (! is_dir($style_folder_path))
|
||||
{
|
||||
kleeja_admin_info(sprintf($lang['ITEM_DELETED'], $style_name), $action);
|
||||
}
|
||||
|
||||
kleeja_admin_err($lang['ERROR_TRY_AGAIN'], $action);
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case 'download':
|
||||
|
||||
if (intval($userinfo['founder']) !== 1)
|
||||
{
|
||||
header('HTTP/1.0 401 Unauthorized');
|
||||
kleeja_admin_err($lang['HV_NOT_PRVLG_ACCESS']);
|
||||
}
|
||||
|
||||
$style_name = g('style');
|
||||
|
||||
$is_update = false;
|
||||
|
||||
|
||||
if (! is_writable(PATH . 'styles'))
|
||||
{
|
||||
chmod(PATH . 'styles', K_DIR_CHMOD);
|
||||
}
|
||||
|
||||
//if style exists before, then trigger update action. rename folder to rollback in case of failure
|
||||
if (file_exists(PATH . 'styles/' . $style_name . '/init.php'))
|
||||
{
|
||||
$is_update = true;
|
||||
|
||||
if (! rename(
|
||||
PATH . 'styles/' . $style_name,
|
||||
PATH . 'styles/' . $style_name . '_backup'
|
||||
))
|
||||
{
|
||||
if (is_dir(PATH . 'styles/' . $style_name))
|
||||
{
|
||||
kleeja_unlink(PATH . 'styles/' . $style_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// plugins avilable in kleeja store
|
||||
$store_link = 'https://raw.githubusercontent.com/kleeja-official/store-catalog/master/catalog.json';
|
||||
|
||||
$catalog_styles = fetch_remote_file($store_link);
|
||||
|
||||
if ($catalog_styles)
|
||||
{
|
||||
$catalog_styles = json_decode($catalog_styles, true);
|
||||
|
||||
$store_styles = [];
|
||||
|
||||
// make an arry for all plugins in kleeja store that not included in our server
|
||||
foreach ($catalog_styles as $style_info)
|
||||
{
|
||||
if ($style_info['type'] != 'style')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$store_styles[$style_info['name']] = [
|
||||
'name' => $style_info['name'] ,
|
||||
'plg_version' => $style_info['file']['version'] ,
|
||||
'url' => $style_info['file']['url'] ,
|
||||
'kj_min_version' => $style_info['kleeja_version']['min'] ,
|
||||
'kj_max_version' => $style_info['kleeja_version']['max'] ,
|
||||
];
|
||||
}
|
||||
|
||||
// this style is hosted in our store
|
||||
if (isset($store_styles[$style_name]))
|
||||
{
|
||||
// check if the version of the plugin is compatible with our kleeja version or not
|
||||
if (
|
||||
version_compare(strtolower($store_styles[$style_name]['kj_min_version']), KLEEJA_VERSION, '<=')
|
||||
&& version_compare(strtolower($store_styles[$style_name]['kj_max_version']), KLEEJA_VERSION, '>=')
|
||||
) {
|
||||
$style_name_link = $store_styles[$style_name]['url'];
|
||||
|
||||
if (($style_info = kleeja_style_info($folder_name)) != false)
|
||||
$style_archive = fetch_remote_file($style_name_link, PATH . 'cache/' . $style_name . '.zip', 60, false, 10, true);
|
||||
|
||||
if ($style_archive)
|
||||
{
|
||||
foreach (['name', 'desc', 'copyright', 'version'] as $InfoKey)
|
||||
if (file_exists(PATH . 'cache/' . $style_name . '.zip'))
|
||||
{
|
||||
if (array_key_exists($InfoKey, $style_info))
|
||||
$zip = new ZipArchive();
|
||||
|
||||
if ($zip->open(PATH . 'cache/' . $style_name . '.zip') === true)
|
||||
{
|
||||
if (is_array($style_info[$InfoKey]))
|
||||
if ($zip->extractTo(PATH . 'styles'))
|
||||
{
|
||||
$style_info_arr[$InfoKey] = ! empty($style_info[$InfoKey][$config['language']])
|
||||
? htmlspecialchars($style_info[$InfoKey][$config['language']])
|
||||
: htmlspecialchars($style_info[$InfoKey]['en']);
|
||||
// we dont need the zip file anymore
|
||||
kleeja_unlink(PATH . 'cache/' . $style_name . '.zip');
|
||||
|
||||
// uploaded style's archive has different name, so we change it
|
||||
rename(
|
||||
PATH . 'styles/' . trim($zip->getNameIndex(0), '/'),
|
||||
PATH . 'styles/' . $style_name
|
||||
);
|
||||
|
||||
$zip->close();
|
||||
|
||||
// download or update msg
|
||||
$adminAjaxContent = '1:::' . sprintf($lang[$is_update ? 'ITEM_UPDATED' : 'ITEM_DOWNLOADED'], $style_name);
|
||||
|
||||
//in case of update, delete back up version
|
||||
if (is_dir(PATH . 'styles/' . $style_name . '_backup'))
|
||||
{
|
||||
kleeja_unlink(PATH . 'styles/' . $style_name . '_backup');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$style_info_arr[$InfoKey] = htmlspecialchars($style_info[$InfoKey]);
|
||||
$adminAjaxContent = '1003:::' . sprintf($lang['EXTRACT_ZIP_FAILED'], PATH . 'styles');
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$adminAjaxContent = '1004:::' . $lang['DOWNLOADED_FILE_NOT_FOUND'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$adminAjaxContent = '1005:::' . $lang['STORE_SERVER_ERROR'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$adminAjaxContent = '1006:::' . $lang['PACKAGE_N_CMPT_KLJ'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$adminAjaxContent = '1007:::' . sprintf($lang['PACKAGE_REMOTE_FILE_MISSING'], $style_name);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$adminAjaxContent = '1008:::' . $lang['STORE_SERVER_ERROR'];
|
||||
}
|
||||
|
||||
|
||||
//in case of update failure, rollback to current plugin version
|
||||
if (strpos($adminAjaxContent, '1:::') === false)
|
||||
{
|
||||
if (is_dir(PATH . 'styles/' . $style_name . '_backup'))
|
||||
{
|
||||
rename(
|
||||
PATH . 'styles/' . $style_name . '_backup',
|
||||
PATH . 'styles/' . $style_name
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$arr[] =
|
||||
[
|
||||
'style_name' => $folder_name,
|
||||
'is_default' => $config['style'] == $folder_name ? true : false,
|
||||
'link_mk_default' => basename(ADMIN_PATH) . '?cp=' . basename(__file__, '.php') . '&style_choose=' . $folder_name,
|
||||
'icon' => file_exists(PATH . 'styles/' . $folder_name . '/screenshot.png')
|
||||
? PATH . 'styles/' . $folder_name . '/screenshot.png'
|
||||
: $STYLE_PATH_ADMIN . 'images/style.png',
|
||||
'info' => $style_info_arr
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@closedir($dh);
|
||||
}
|
||||
break;
|
||||
endswitch;
|
||||
|
||||
@@ -243,22 +243,6 @@ $image_last_visit = filter_exists('i_lastvisit', 'filter_uid', 'lastvisit', $use
|
||||
|
||||
|
||||
|
||||
//hurry, hurry section, get styles
|
||||
$hurry_style_link = basename(ADMIN_PATH) . '?cp=m_styles&sty_t=st&method=2&home=1&smt=curstyle&' . $GET_FORM_KEY . '&style_choose=';
|
||||
$hurry_styles_list = '';
|
||||
|
||||
if ($dh = @opendir(PATH . 'styles'))
|
||||
{
|
||||
while (($file = @readdir($dh)) !== false)
|
||||
{
|
||||
if (strpos($file, '.') === false && $file != '..' && $file != '.')
|
||||
{
|
||||
$hurry_styles_list .= '<option value="' . htmlspecialchars($file) . '"' . ($config['style'] == $file ? ' selected="selected"' : '') . '>' . $file . '</option>';
|
||||
}
|
||||
}
|
||||
@closedir($dh);
|
||||
}
|
||||
|
||||
//hurry, hurry section, get languages
|
||||
$hurry_lang_link = basename(ADMIN_PATH) . '?cp=g_users&smt=general&smt=group_data&' . $GET_FORM_KEY . '&lang_change=';
|
||||
$hurry_langs_list = '';
|
||||
|
||||
@@ -116,7 +116,7 @@ return [
|
||||
|
||||
'R_PLUGINS' => 'إضافات برمجية',
|
||||
'ADD_NEW_PLUGIN' => 'أضف إضافة برمجية جديدة',
|
||||
'PLUGIN_DELETED' => 'لقد تم حذف الإضافة البرمجية...',
|
||||
'ITEM_DELETED' => 'لقد تم حذف "%s" بنجاح...',
|
||||
'PLGUIN_DISABLED_ENABLED' => 'لقد تم تفعيل \ تعطيل الإضافة البرمجية..',
|
||||
'NO_PLUGINS' => 'لا يوجد أي إضافات برمجية ..',
|
||||
'NEW_PLUGIN_ADDED' => 'لقد تمت إضافة الإضافة البرمجية .. ',
|
||||
@@ -163,7 +163,7 @@ return [
|
||||
'CONFIG_KLJ_MENUS_INTERFACE'=> 'خيارات الواجهة والتصميم',
|
||||
'CONFIG_KLJ_MENUS_ADVANCED' => 'خيارات متقدمة',
|
||||
'DELF_CAUTION' => '<small class="delf_caution">تحذير : هذه الخاصية قد تكون خطرة عند وضع ارقام صغيرة أو عند إستخدام الروابط المباشرة.</small>',
|
||||
'PLUGIN_N_CMPT_KLJ' => 'هذه الإضافة غيره متوافقة مع إصدار كليجا الذي تستخدمه ! .',
|
||||
'PACKAGE_N_CMPT_KLJ' => 'هذه الإضافة/الستايل غيره متوافقة مع إصدار كليجا الذي تستخدمه ! .',
|
||||
'PHPINI_FILESIZE_SMALL' => 'اعلى حجم يستطيع المستخدمين تحميله لديك "%1$s" بينما إعدادات الـ PHP لديك فيما يتعلق بـ upload_max_filesize هي فقط "%2$s" , قم بسؤال مدير خادمك لرفعها ليستطيع المستخدمين رفع ملفات بالحجم الذي وضعته.',
|
||||
'PHPINI_MPOSTSIZE_SMALL' => 'بما أنك سمحت بتحميل "%1$s" ملفات دفعة واحدة , فيجب ان تسأل مدير خادمك لرفع قيمة post_max_size من اعدادات ال PHP بالخادم لما يقارب "%2$s" لتضمن لكليجا عمل أفضل.',
|
||||
'NUMPER_REPORT' => 'البلاغات',
|
||||
@@ -261,18 +261,19 @@ return [
|
||||
'INSTALL' => 'تثبيت',
|
||||
'CLOSE' => 'إغلاق',
|
||||
'STATS_BOXES' => 'صناديق الإحصائيات',
|
||||
'PLUGIN_UPDATED' => 'الإضافة "%s" تم تحديثها بنجاح ..',
|
||||
'PLUGIN_DOWNLOADED' => 'الإضافة "%s" تم تحميلها بنجاح! لتفعيلها توجه للإضافات المحلية.',
|
||||
'PLUGIN_FILE_NOT_FOUND' => 'ملف الإضافة مفقود لايمكن إيجاده!',
|
||||
'PLUGIN_REMOTE_FILE_MISSING' => 'الإضافة "%s" ليست على موجوة على متجر كليجا الخارجي!',
|
||||
'PLUGINS_SERVER_ERROR' => 'واجهنا خطأ أثناء الإتصال بخادم متجر كليجا الخارجي...',
|
||||
'ITEM_UPDATED' => 'تم تحديث "%s" بنجاح ..',
|
||||
'ITEM_DOWNLOADED' => 'تم تحميل "%s" بنجاح! يمكنك تفعيلها لاحقاً.',
|
||||
'DOWNLOADED_FILE_NOT_FOUND' => 'الملف الذي تم تحميله مفقود لايمكن إيجاده!',
|
||||
'PACKAGE_REMOTE_FILE_MISSING' => 'حزمة "%s" ليست موجودة على متجر كليجا الخارجي!',
|
||||
'STORE_SERVER_ERROR' => 'واجهنا خطأ أثناء الإتصال بخادم متجر كليجا الخارجي...',
|
||||
'INSTALLED_PLUGINS' => 'الإضافات المثبتة',
|
||||
'LOCAL_PLUGINS' => 'الإضافات المحلية',
|
||||
'KLEEJA_STORE' => 'متجر كليجا',
|
||||
'KLJ_VER_NO_PLUGIN' => 'هذه الإضافة يمكنها العمل على إصدار كليجا %1$s حتى إصدار %2$s.',
|
||||
'KLJ_VER_NO_PLUGIN' => 'هذه الإضافة/الستايل يمكنها العمل على إصدار كليجا %1$s حتى إصدار %2$s.',
|
||||
'VERSION' => 'الإصدار',
|
||||
'DEVELOPER' => 'المطور',
|
||||
'ALL_PLUGINS_UPDATED' => 'كافة الإضافات مُحدثة. رائع!',
|
||||
'ALL_STYLES_UPDATED' => 'كافة الستايلات مُحدثة. رائع!',
|
||||
'UPDATE_ERR_FETCH_PACKAGE' => 'واجهتنا مشكلة أثناء تحميل النسخة من الخادم!',
|
||||
'UPDATE_BACKUP_CREATE_FAILED' => 'لم نستطع إنشاء ملف النسخة الإحتياطية في مجلد الكاش!',
|
||||
'UPDATE_PROCESS_FAILED' => 'عملية التحديث فشلت!',
|
||||
@@ -282,4 +283,7 @@ return [
|
||||
'UPDATE_PROCESS_STEP3' => 'الترقية للنسخة الجديدة (تحديث الملفات وقاعدة البيانات) ...',
|
||||
'RELEASE_NOTE' => 'معلومات الإصدار',
|
||||
'UPDATE_ALL' => 'تحديث الكُل',
|
||||
'CANT_DEL_DEFAULT_STYLE' => 'لا يمكنك حذف الستايل الإفتراضي! قم بتعيين ستايل آخر لتستطيع حذفه.',
|
||||
'NOTIFICATIONS' => 'تنبيهات',
|
||||
'KJ_TWEETS' => 'تغريدات كليجا',
|
||||
];
|
||||
|
||||
@@ -24,16 +24,12 @@ return [
|
||||
'WELCOME' => 'مرحباً بك',
|
||||
'KLEEJA_VERSION' => 'إصدار كليجا',
|
||||
'NUMBER_ONLINE' => 'الاعضاء المتواجدون حالياً',
|
||||
//'NUMBER_UONLINE' => 'أعضاء',
|
||||
//'NUMBER_VONLINE' => 'زوار',
|
||||
'USERS_SYSTEM' => 'نظام المستخدمين',
|
||||
'ERROR_NAVIGATATION' => 'خطأ بالتوجه..',
|
||||
'USER_LOGIN' => 'تسجيل الدخول',
|
||||
'LOGIN' => 'دخول',
|
||||
'USERNAME' => 'اسم المستخدم',
|
||||
'PASSWORD' => 'كلمة المرور',
|
||||
//'EMPTY_USERNAME' => 'حقل اسم المستخدم فارغ',
|
||||
//'EMPTY_PASSWORD' => 'حقل كلمة المرور فارغ',
|
||||
'LOSS_PASSWORD' => 'نسيت كلمة المرور؟',
|
||||
'LOGINED_BEFORE' => 'أنت داخل بالفعل',
|
||||
'LOGOUT' => 'خروج',
|
||||
@@ -50,25 +46,19 @@ return [
|
||||
'NOTE_CODE' => 'ادخل الأحرف الموجود في الصورة بالشكل الصحيح مرتبة بشكل دقيق.',
|
||||
'WRONG_EMAIL' => 'بريد خاطيء',
|
||||
'WRONG_NAME' => 'الاسم يجب أن يكون بين 4 احرف و 25 حرف وبدون مسافات أو أحرف خاصة (فقط _- مسموحة)!.',
|
||||
//'WRONG_LINK' => 'رابط خاطيء..',
|
||||
'EXIST_NAME' => 'الاسم موجود مسبقاً',
|
||||
'EXIST_EMAIL' => 'البريد موجود مسبقاً',
|
||||
'WRONG_VERTY_CODE' => 'كود الأمان خاطيء',
|
||||
//'CANT_UPDATE_SQL' => 'لا يمكن التحديث لقاعدة البيانات',
|
||||
//'CANT_INSERT_SQL' => 'لا يمكن إدخال المعلومات لقاعدة البيانات',
|
||||
'REGISTER_SUCCESFUL' => 'شكراً لتسجيلك معناً',
|
||||
'LOGOUT_SUCCESFUL' => 'تم الخروج بنجاح',
|
||||
'LOGOUT_ERROR' => 'هناك مشكلة بالخروج',
|
||||
//'FILECP' => 'إدارة الملفات',
|
||||
'DEL_SELECTED' => 'حذف المحدد',
|
||||
'DEL_ALL' => 'حذف كل ملفاتي',
|
||||
'ALL_DELETED' => 'تم حذف كل ملفاتك',
|
||||
'NO_FILES_DELETE' => 'لا تملك ملفات لحذفها',
|
||||
//'EDIT_U_FILES' => 'إدارة ملفاتك',
|
||||
'FILES_UPDATED' => 'تم تحديث الملفات بنجاح',
|
||||
'PUBLIC_USER_FILES' => 'مجلد ملفات العضو',
|
||||
'FILEUSER' => 'مجلد ملفات',
|
||||
//'GO_FILECP' => 'اضغط هنا لإدارة ملفاتك هذه',
|
||||
'YOUR_FILEUSER' => 'مجلدك الشخصي',
|
||||
'COPY_AND_GET_DUD' => 'انسخ الرابط وشاركهُ مع أصدقائك ليطلعوا على مجلدك ',
|
||||
'NO_FILE_USER' => 'لا يوجد أي ملفات في حساب العضوية حتى الآن!',
|
||||
@@ -156,7 +146,6 @@ return [
|
||||
'WRONG_F_NAME' => 'اسم الملف "%s" يحتوي على أحرف غير مسموحة .. الرجاء تغيير اسم الملف والمحاولة من جديد ',
|
||||
'FORBID_EXT' => ' الامتداد "%s" غير مسموح ',
|
||||
'SIZE_F_BIG' => 'الحجم للملف "%1$s" يجب أن يكون أقل من %2$s .',
|
||||
//'CANT_CON_FTP' => 'لايمكن الاتصال بـ ',
|
||||
'URL_F_DEL' => 'رابط الحذف',
|
||||
'URL_F_THMB' => 'رابط المصغرة',
|
||||
'URL_F_FILE' => 'رابط الملف',
|
||||
@@ -167,10 +156,8 @@ return [
|
||||
'CANT_UPLAOD' => 'خطأ.. لم يتم تحميل الملف "%s" لأسباب غير معروفة',
|
||||
'CANT_DIR_CRT' => 'لم يتم إنشاء مجلد تلقائياً.. قم بإنشاءه انت',
|
||||
'AGREE_RULES' => 'بالضغط على الزر بالاسفل فانت توافق على %1$sشروط الخدمة%2$s.',
|
||||
//'CHANG_TO_URL_FILE' => 'تبديل طريقة التحميل.. رابط أو إدخال',
|
||||
'URL_CANT_GET' => 'خطأ في جلب الملف من الرابط',
|
||||
'ADMINCP' => 'مركز التحكم',
|
||||
//'JUMPTO' => 'انتقل إلى',
|
||||
'GO_BACK_BROWSER' => 'رجوع للخلف',
|
||||
'U_R_BANNED' => 'لقد تم حظر الآي بي هذا..',
|
||||
'U_R_FLOODER' => 'لقد قمت بتخطي عدد مرات عرض الصفحة بالوقت المحدد..',
|
||||
@@ -180,7 +167,7 @@ return [
|
||||
'NORMAL' => 'عادي',
|
||||
'STYLE' => 'الستايل',
|
||||
'GROUP' => 'المجموعة',
|
||||
//'UPDATE_FILES' => 'تحديث الملفات',
|
||||
'UPDATE_FILES' => 'تحديث الملفات',
|
||||
'BY' => 'من',
|
||||
'FILDER' => 'مجلد',
|
||||
'DELETE' => 'حذف',
|
||||
@@ -199,7 +186,7 @@ return [
|
||||
'OPEN' => 'افتح',
|
||||
'NOTE' => 'ملاحظة',
|
||||
'WARN' => 'انتبه',
|
||||
//'BITE' => 'بايت',
|
||||
'BITE' => 'بايت',
|
||||
'KILOBYTE' => 'كيلوبايت',
|
||||
'NOT_SAFE_FILE' => 'نظام كليجا اكتشف أن الملف "%s" غير آمن ويحتوي على أكواد خبيثه .. !!',
|
||||
'ARE_YOU_SURE_DO_THIS' => 'هل أنت متأكد من القيام بهذه العملية؟',
|
||||
@@ -295,9 +282,5 @@ return [
|
||||
'EMAIL_CHANGE_REQ_PASS' => 'لتغيير بريدك الإلكتروني يجب أن تقوم بكتابة كلمة مرورك الحالية.',
|
||||
'DRAG_AND_DROP' => 'جر وأسقط ملف هنا للرفع…',
|
||||
'OR_MANUAL_SELECT' => 'أو قم بالضغط هنا <em>لإختيار</em> ملف يدوياً..',
|
||||
//3.0.3
|
||||
'NOTIFICATIONS' => 'تنبيهات',
|
||||
'KJ_TWEETS' => 'تغريدات كليجا' ,
|
||||
'PLG_SUCSS_DEL' => 'تم حذف مجلد الاضافة "%s" بنجاح!' ,
|
||||
'PLG_DEL_CONFIRM' => 'سوف تقوم بحذف مجلد الاضافة' ,
|
||||
|
||||
];
|
||||
|
||||
@@ -118,7 +118,7 @@ return [
|
||||
'R_PLUGINS' => 'Plugins',
|
||||
'ADD_NEW_PLUGIN' => 'Add plugin',
|
||||
|
||||
'PLUGIN_DELETED' => 'Plugin deleted...',
|
||||
'ITEM_DELETED' => '%s has been deleted successfully...',
|
||||
'PLGUIN_DISABLED_ENABLED' => 'Plugin Enabled / Disabled',
|
||||
'NO_PLUGINS' => 'No plugins found! You could start browsing plugins and installing them by clicking the tab "Kleeja Store" or upload a plugin file from the tab "Local Plugins".',
|
||||
'NEW_PLUGIN_ADDED' => 'Plugin added ... ',
|
||||
@@ -165,7 +165,7 @@ return [
|
||||
'CONFIG_KLJ_MENUS_INTERFACE'=> 'Interface and design settings',
|
||||
'CONFIG_KLJ_MENUS_ADVANCED' => 'Advanced settings',
|
||||
'DELF_CAUTION' => '<small class="delf_caution">Caution: might be dangerous when using small numbers or using direct form of URLS.</small>',
|
||||
'PLUGIN_N_CMPT_KLJ' => 'This plugin is not compatible with your current version of Kleeja.',
|
||||
'PACKAGE_N_CMPT_KLJ' => 'This plugin/style is not compatible with your current version of Kleeja.',
|
||||
'PHPINI_FILESIZE_SMALL' => 'Maximum file size allowed for your service is "%1$s" while <b>upload_max_filesize</b> in your hosts PHP settings is set to "%2$s", update it so that your chosen size can be applied.',
|
||||
'PHPINI_MPOSTSIZE_SMALL' => 'You have allowed the upload of "%1$s" files at once, You need to use a bigger value for <b>post_max_size</b> in your servers PHP settings, something like "%2$s" for a better performance.',
|
||||
'NUMPER_REPORT' => 'Number of reports',
|
||||
@@ -263,18 +263,19 @@ return [
|
||||
'INSTALL' => 'Install',
|
||||
'CLOSE' => 'Close',
|
||||
'STATS_BOXES' => 'Stats Boxes',
|
||||
'PLUGIN_UPDATED' => 'Plugin "%s" has been updated 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 ...',
|
||||
'ITEM_UPDATED' => 'We have updated "%s" successfully ..',
|
||||
'ITEM_DOWNLOADED' => 'We have downloaded "%s" successfully! you can enable it later.',
|
||||
'DOWNLOADED_FILE_NOT_FOUND' => 'The downloaded file is missing! We couldn\'t find it.',
|
||||
'PACKAGE_REMOTE_FILE_MISSING' => 'Package of "%s" is not on Kleeja remote server!',
|
||||
'STORE_SERVER_ERROR' => 'We encountered an error while connecting to the kleeja store remote server ...',
|
||||
'INSTALLED_PLUGINS' => 'Installed Plugins',
|
||||
'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.',
|
||||
'KLJ_VER_NO_PLUGIN' => 'This plugin/style can works on Kleeja version %1$s up to version %2$s.',
|
||||
'VERSION' => 'Version',
|
||||
'DEVELOPER' => 'Developer',
|
||||
'ALL_PLUGINS_UPDATED' => 'All plugins are up-to-date. Hooray!',
|
||||
'ALL_STYLES_UPDATED' => 'All styles 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!',
|
||||
@@ -284,4 +285,7 @@ return [
|
||||
'UPDATE_PROCESS_STEP3' => 'Updating to new version (files & database upgrade) ...',
|
||||
'RELEASE_NOTE' => 'Release Notes',
|
||||
'UPDATE_ALL' => 'Update All',
|
||||
'CANT_DEL_DEFAULT_STYLE' => 'You can not delete the current default style! choose another style to be the default then try again.',
|
||||
'NOTIFICATIONS' => 'Notifications',
|
||||
'KJ_TWEETS' => 'Kleeja Tweets',
|
||||
];
|
||||
|
||||
@@ -285,9 +285,4 @@ return [
|
||||
'EMAIL_CHANGE_REQ_PASS' => 'In order to change your email address, It\'s required to type your current password.',
|
||||
'DRAG_AND_DROP' => 'Drop a file inside…',
|
||||
'OR_MANUAL_SELECT' => 'Or click here to <em>Select</em> a file manually..',
|
||||
//3.0.3
|
||||
'NOTIFICATIONS' => 'Notifications',
|
||||
'KJ_TWEETS' => 'Kleeja Tweets' ,
|
||||
'PLG_SUCSS_DEL' => 'the Folder of plugin "%s" is deleted successfuly !!' ,
|
||||
'PLG_DEL_CONFIRM' => 'You will delete the plugin folder' ,
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user