mirror of
https://github.com/kleeja-official/kleeja.git
synced 2025-12-15 20:49:41 +01:00
Miscellaneous changes
* PHP code style fixes * Updated database schema for upgrade
This commit is contained in:
@@ -275,9 +275,10 @@ foreach ($types as $typekey => $type)
|
||||
if ($option['type'] == $typekey)
|
||||
{
|
||||
$options .= str_replace(
|
||||
['<input ', '<select ', '<td>', '</td>', '<label>', '<tr>', '</tr>'],
|
||||
['<input class="form-control" ', '<select class="form-control" ', '<div class="form-group">', '</div>', '<label class="form-check-label">', '', ''],
|
||||
$option['option']);
|
||||
['<input ', '<select ', '<td>', '</td>', '<label>', '<tr>', '</tr>'],
|
||||
['<input class="form-control" ', '<select class="form-control" ', '<div class="form-group">', '</div>', '<label class="form-check-label">', '', ''],
|
||||
$option['option']
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -285,7 +286,6 @@ foreach ($types as $typekey => $type)
|
||||
//after submit
|
||||
if (ip('submit'))
|
||||
{
|
||||
|
||||
//some configs need refresh page ..
|
||||
$need_refresh_configs = ['language'];
|
||||
|
||||
|
||||
@@ -77,6 +77,7 @@ if (ip('submit'))
|
||||
{
|
||||
//delete from folder ..
|
||||
@kleeja_unlink(PATH . $row['folder'] . '/' . $row['name']);
|
||||
|
||||
//delete thumb
|
||||
if (file_exists(PATH . $row['folder'] . '/thumbs/' . $row['name']))
|
||||
{
|
||||
@@ -98,8 +99,9 @@ if (ip('submit'))
|
||||
$sizes += $row['size'];
|
||||
|
||||
//Subtract size from storage of the user
|
||||
if ($row['user'] != -1) {
|
||||
$SQL->query("UPDATE {$dbprefix}users SET storage_size=storage_size-".$row['size']." WHERE id=".$row['user']);
|
||||
if ($row['user'] != -1)
|
||||
{
|
||||
$SQL->query("UPDATE {$dbprefix}users SET storage_size=storage_size-" . $row['size'] . ' WHERE id=' . $row['user']);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -141,7 +143,6 @@ if (ip('submit'))
|
||||
}
|
||||
elseif ($current_smt == '')
|
||||
{
|
||||
|
||||
//
|
||||
//Delete all user files [only one user]
|
||||
//
|
||||
@@ -258,12 +259,12 @@ elseif ($current_smt == '')
|
||||
{
|
||||
//get search filter
|
||||
$filter = get_filter(g('search_id'), 'file_search', false, 'filter_uid');
|
||||
|
||||
|
||||
if (! $filter)
|
||||
{
|
||||
kleeja_admin_err($lang['ERROR_TRY_AGAIN'], true, $lang['ERROR'], true, basename(ADMIN_PATH) . '?cp=h_search', 1);
|
||||
}
|
||||
|
||||
|
||||
$deletelink = basename(ADMIN_PATH) . '?cp=' . basename(__file__, '.php') . '&deletefiles=' . g('search_id');
|
||||
$is_search = true;
|
||||
$query['WHERE'] = build_search_query(unserialize(htmlspecialchars_decode($filter['filter_value'])));
|
||||
@@ -446,7 +447,7 @@ elseif ($current_smt == 'delete_by_extension')
|
||||
'WHERE' => 'type = \'' . $ext . '\''
|
||||
];
|
||||
|
||||
$result = $SQL->build($query);
|
||||
$result = $SQL->build($query);
|
||||
$deleted_files = [];
|
||||
$fileSizes = 0;
|
||||
|
||||
@@ -470,8 +471,9 @@ elseif ($current_smt == 'delete_by_extension')
|
||||
$deleted_files[] = $file['id'];
|
||||
|
||||
//Subtract size from storage of the user
|
||||
if ($file['user'] != -1) {
|
||||
$SQL->query("UPDATE {$dbprefix}users SET storage_size=storage_size-".$file['size']." WHERE id=".$file['user']);
|
||||
if ($file['user'] != -1)
|
||||
{
|
||||
$SQL->query("UPDATE {$dbprefix}users SET storage_size=storage_size-" . $file['size'] . ' WHERE id=' . $file['user']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -63,6 +63,7 @@ if (ip('submit'))
|
||||
{
|
||||
//delete from folder ..
|
||||
@kleeja_unlink(PATH . $row['folder'] . '/' . $row['name']);
|
||||
|
||||
//delete thumb
|
||||
if (file_exists(PATH . $row['folder'] . '/thumbs/' . $row['name']))
|
||||
{
|
||||
@@ -73,8 +74,9 @@ if (ip('submit'))
|
||||
$sizes += $row['size'];
|
||||
|
||||
//Subtract size from storage of the user
|
||||
if ($row['user'] != -1) {
|
||||
$SQL->query("UPDATE {$dbprefix}users SET storage_size=storage_size-".$row['size']." WHERE id=".$row['user']);
|
||||
if ($row['user'] != -1)
|
||||
{
|
||||
$SQL->query("UPDATE {$dbprefix}users SET storage_size=storage_size-" . $row['size'] . ' WHERE id=' . $row['user']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -53,7 +53,7 @@ if (ip('search_file'))
|
||||
//delete all searches greater than 3 days
|
||||
$query_del = [
|
||||
'DELETE' => "{$dbprefix}filters",
|
||||
'WHERE' => "filter_type='file_search' AND filter_user=" . $userinfo['id'] . " AND filter_time > " . (time() - 3600 * 24 * 3)
|
||||
'WHERE' => "filter_type='file_search' AND filter_user=" . $userinfo['id'] . ' AND filter_time > ' . (time() - 3600 * 24 * 3)
|
||||
];
|
||||
|
||||
$SQL->build($query_del);
|
||||
@@ -96,10 +96,10 @@ if (ip('search_user'))
|
||||
//delete all searches greater than 3 days
|
||||
$query_del = [
|
||||
'DELETE' => "{$dbprefix}filters",
|
||||
'WHERE' => "filter_type='user_search' AND filter_user=" . $userinfo['id'] . " AND filter_time > " . (time() - 3600 * 24 * 3)
|
||||
'WHERE' => "filter_type='user_search' AND filter_user=" . $userinfo['id'] . ' AND filter_time > ' . (time() - 3600 * 24 * 3)
|
||||
];
|
||||
|
||||
$SQL->build($query_del);
|
||||
$SQL->build($query_del);
|
||||
|
||||
|
||||
//add as a user_search filter
|
||||
|
||||
@@ -90,13 +90,13 @@ switch ($case):
|
||||
|
||||
$installed_plugins[$row['plg_name']]['icon'] = file_exists(
|
||||
PATH . KLEEJA_PLUGINS_FOLDER . '/' . $row['plg_name'] . '/icon.png'
|
||||
)
|
||||
)
|
||||
? PATH . KLEEJA_PLUGINS_FOLDER . '/' . $row['plg_name'] . '/icon.png'
|
||||
: $STYLE_PATH_ADMIN . 'images/plugin.png';
|
||||
|
||||
$installed_plugins[$row['plg_name']]['has_settings_page'] = ! empty(
|
||||
$installed_plugins[$row['plg_name']]['extra_info']['settings_page']
|
||||
) && ! preg_match('/^https?:\/\//', $installed_plugins[$row['plg_name']]['extra_info']['settings_page']);
|
||||
) && ! preg_match('/^https?:\/\//', $installed_plugins[$row['plg_name']]['extra_info']['settings_page']);
|
||||
|
||||
|
||||
foreach (['plugin_title', 'plugin_description'] as $localized_info)
|
||||
@@ -197,7 +197,7 @@ switch ($case):
|
||||
|
||||
if ($case == 'store' && (in_array($plugin_info['name'], $available_plugins_names) ||
|
||||
! empty($installed_plugins[$plugin_info['name']]))
|
||||
) {
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -233,8 +233,9 @@ switch ($case):
|
||||
$store_plugins_count = sizeof($store_plugins);
|
||||
|
||||
break;
|
||||
|
||||
//
|
||||
//upload a plugin
|
||||
//upload a plugin
|
||||
//
|
||||
case 'upload':
|
||||
$ERRORS = [];
|
||||
@@ -291,8 +292,9 @@ switch ($case):
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
//
|
||||
//install a plugin
|
||||
//install a plugin
|
||||
//
|
||||
case 'install':
|
||||
|
||||
@@ -369,12 +371,12 @@ switch ($case):
|
||||
if (version_compare(KLEEJA_VERSION, $plugin_info['plugin_kleeja_version_min'], '<'))
|
||||
{
|
||||
kleeja_admin_info(
|
||||
$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')
|
||||
);
|
||||
$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')
|
||||
);
|
||||
|
||||
exit;
|
||||
}
|
||||
@@ -435,8 +437,9 @@ switch ($case):
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
//
|
||||
//uninstall a plugin
|
||||
//uninstall a plugin
|
||||
//
|
||||
case 'uninstall':
|
||||
|
||||
@@ -516,8 +519,9 @@ switch ($case):
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
//
|
||||
// disable a plugin
|
||||
// disable a plugin
|
||||
//
|
||||
case 'disable':
|
||||
case 'enable':
|
||||
@@ -639,7 +643,7 @@ switch ($case):
|
||||
if (
|
||||
version_compare(strtolower($store_plugins[$plugin_name]['kj_min_version']), KLEEJA_VERSION, '<=')
|
||||
&& version_compare(strtolower($store_plugins[$plugin_name]['kj_max_version']), KLEEJA_VERSION, '>=')
|
||||
) {
|
||||
) {
|
||||
$plugin_name_link = $store_plugins[$plugin_name]['url'];
|
||||
|
||||
$plugin_archive = FetchFile::make($plugin_name_link)
|
||||
|
||||
@@ -50,61 +50,61 @@ if (ip('newstyle'))
|
||||
}
|
||||
|
||||
switch ($case):
|
||||
default:
|
||||
case 'local':
|
||||
case 'store':
|
||||
default:
|
||||
case 'local':
|
||||
case 'store':
|
||||
|
||||
//get styles
|
||||
$available_styles = [];
|
||||
//get styles
|
||||
$available_styles = [];
|
||||
|
||||
if ($dh = @opendir(PATH . 'styles'))
|
||||
{
|
||||
while (false !== ($folder_name = readdir($dh)))
|
||||
if ($dh = @opendir(PATH . 'styles'))
|
||||
{
|
||||
if (is_dir(PATH . 'styles/' . $folder_name) && preg_match('/[a-z0-9_.]{3,}/', $folder_name))
|
||||
while (false !== ($folder_name = readdir($dh)))
|
||||
{
|
||||
//info
|
||||
$style_info_arr = [
|
||||
'name' => $folder_name,
|
||||
'desc' => '',
|
||||
'copyright' => '',
|
||||
'version' => ''
|
||||
];
|
||||
|
||||
if (($style_info = kleeja_style_info($folder_name)) != false)
|
||||
if (is_dir(PATH . 'styles/' . $folder_name) && preg_match('/[a-z0-9_.]{3,}/', $folder_name))
|
||||
{
|
||||
foreach (['name', 'desc', 'copyright', 'version'] as $InfoKey)
|
||||
//info
|
||||
$style_info_arr = [
|
||||
'name' => $folder_name,
|
||||
'desc' => '',
|
||||
'copyright' => '',
|
||||
'version' => ''
|
||||
];
|
||||
|
||||
if (($style_info = kleeja_style_info($folder_name)) != false)
|
||||
{
|
||||
if (array_key_exists($InfoKey, $style_info))
|
||||
foreach (['name', 'desc', 'copyright', 'version'] as $InfoKey)
|
||||
{
|
||||
if (is_array($style_info[$InfoKey]))
|
||||
if (array_key_exists($InfoKey, $style_info))
|
||||
{
|
||||
$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]);
|
||||
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
|
||||
];
|
||||
}
|
||||
|
||||
$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);
|
||||
}
|
||||
@closedir($dh);
|
||||
}
|
||||
|
||||
//do not proceed if not store case
|
||||
if (! in_array($case, ['store', 'check']))
|
||||
@@ -174,142 +174,142 @@ case 'store':
|
||||
|
||||
$store_styles_count = sizeof($store_styles);
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'select':
|
||||
case 'select':
|
||||
|
||||
$style_name = preg_replace('/[^a-z0-9_\-\.]/i', '', g('style'));
|
||||
$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_name)) != false)
|
||||
{
|
||||
if (isset($style_info['depend_on']) && ! is_dir(PATH . 'styles/' . $style_info['depend_on']))
|
||||
//if empty, let's ignore it
|
||||
if (empty($style_name))
|
||||
{
|
||||
kleeja_admin_err(sprintf($lang['DEPEND_ON_NO_STYLE_ERR'], $style_info['depend_on']));
|
||||
redirect(basename(ADMIN_PATH) . '?cp=' . basename(__file__, '.php'));
|
||||
}
|
||||
|
||||
if (isset($style_info['kleeja_version']) && version_compare(strtolower($style_info['kleeja_version']), strtolower(KLEEJA_VERSION), '>'))
|
||||
//
|
||||
//check if this style depend on other style and
|
||||
//check kleeja version that required by this style
|
||||
//
|
||||
if (($style_info = kleeja_style_info($style_name)) != false)
|
||||
{
|
||||
kleeja_admin_err(sprintf($lang['KLJ_VER_NO_STYLE_ERR'], $style_info['kleeja_version']));
|
||||
}
|
||||
|
||||
//is this style require some plugins to be installed
|
||||
if (isset($style_info['plugins_required']))
|
||||
{
|
||||
$plugins_required = explode(',', $style_info['plugins_required']);
|
||||
$plugins_required = array_map('trim', $plugins_required);
|
||||
|
||||
$query = [
|
||||
'SELECT' => 'plg_name, plg_disabled',
|
||||
'FROM' => "{$dbprefix}plugins",
|
||||
];
|
||||
|
||||
$result = $SQL->build($query);
|
||||
|
||||
if ($SQL->num_rows($result) != 0)
|
||||
if (isset($style_info['depend_on']) && ! is_dir(PATH . 'styles/' . $style_info['depend_on']))
|
||||
{
|
||||
$plugins_required = array_flip($plugins_required);
|
||||
while ($row = $SQL->fetch_array($result))
|
||||
kleeja_admin_err(sprintf($lang['DEPEND_ON_NO_STYLE_ERR'], $style_info['depend_on']));
|
||||
}
|
||||
|
||||
if (isset($style_info['kleeja_version']) && version_compare(strtolower($style_info['kleeja_version']), strtolower(KLEEJA_VERSION), '>'))
|
||||
{
|
||||
kleeja_admin_err(sprintf($lang['KLJ_VER_NO_STYLE_ERR'], $style_info['kleeja_version']));
|
||||
}
|
||||
|
||||
//is this style require some plugins to be installed
|
||||
if (isset($style_info['plugins_required']))
|
||||
{
|
||||
$plugins_required = explode(',', $style_info['plugins_required']);
|
||||
$plugins_required = array_map('trim', $plugins_required);
|
||||
|
||||
$query = [
|
||||
'SELECT' => 'plg_name, plg_disabled',
|
||||
'FROM' => "{$dbprefix}plugins",
|
||||
];
|
||||
|
||||
$result = $SQL->build($query);
|
||||
|
||||
if ($SQL->num_rows($result) != 0)
|
||||
{
|
||||
if (in_array($row['plg_name'], $plugins_required) and $row['plg_disabled'] != 1)
|
||||
$plugins_required = array_flip($plugins_required);
|
||||
while ($row = $SQL->fetch_array($result))
|
||||
{
|
||||
unset($plugins_required[$row['plg_name']]);
|
||||
if (in_array($row['plg_name'], $plugins_required) and $row['plg_disabled'] != 1)
|
||||
{
|
||||
unset($plugins_required[$row['plg_name']]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$SQL->freeresult($result);
|
||||
$SQL->freeresult($result);
|
||||
|
||||
$plugins_required = array_flip($plugins_required);
|
||||
$plugins_required = array_flip($plugins_required);
|
||||
|
||||
if (sizeof($plugins_required))
|
||||
{
|
||||
kleeja_admin_err(sprintf($lang['PLUGINS_REQ_NO_STYLE_ERR'], implode(', ', $plugins_required)));
|
||||
if (sizeof($plugins_required))
|
||||
{
|
||||
kleeja_admin_err(sprintf($lang['PLUGINS_REQ_NO_STYLE_ERR'], implode(', ', $plugins_required)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//make it as default
|
||||
update_config('style', $style_name);
|
||||
update_config('style_depend_on', isset($style_info['depend_on']) ? $style_info['depend_on'] : '');
|
||||
//make it as default
|
||||
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);
|
||||
//delete all cache to get new style
|
||||
delete_cache('', true);
|
||||
|
||||
//show msg
|
||||
kleeja_admin_info(sprintf($lang['STYLE_NOW_IS_DEFAULT'], $style_name), $action);
|
||||
//show msg
|
||||
kleeja_admin_info(sprintf($lang['STYLE_NOW_IS_DEFAULT'], $style_name), $action);
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'upload':
|
||||
case 'upload':
|
||||
|
||||
if (intval($userinfo['founder']) !== 1)
|
||||
{
|
||||
$ERRORS[] = $lang['HV_NOT_PRVLG_ACCESS'];
|
||||
}
|
||||
|
||||
|
||||
$ERRORS = [];
|
||||
|
||||
//is uploaded?
|
||||
if (empty($_FILES['style_file']['tmp_name']))
|
||||
{
|
||||
$ERRORS[] = $lang['CHOSE_F'];
|
||||
}
|
||||
|
||||
|
||||
//extract it to plugins folder
|
||||
if (! sizeof($ERRORS))
|
||||
{
|
||||
if (class_exists('ZipArchive'))
|
||||
if (intval($userinfo['founder']) !== 1)
|
||||
{
|
||||
$zip = new ZipArchive;
|
||||
$ERRORS[] = $lang['HV_NOT_PRVLG_ACCESS'];
|
||||
}
|
||||
|
||||
if ($zip->open($_FILES['style_file']['tmp_name']) === true)
|
||||
|
||||
$ERRORS = [];
|
||||
|
||||
//is uploaded?
|
||||
if (empty($_FILES['style_file']['tmp_name']))
|
||||
{
|
||||
$ERRORS[] = $lang['CHOSE_F'];
|
||||
}
|
||||
|
||||
|
||||
//extract it to plugins folder
|
||||
if (! sizeof($ERRORS))
|
||||
{
|
||||
if (class_exists('ZipArchive'))
|
||||
{
|
||||
if (! $zip->extractTo(PATH . 'styles'))
|
||||
$zip = new ZipArchive;
|
||||
|
||||
if ($zip->open($_FILES['style_file']['tmp_name']) === true)
|
||||
{
|
||||
$ERRORS[] = sprintf($lang['EXTRACT_ZIP_FAILED'], 'styles');
|
||||
if (! $zip->extractTo(PATH . 'styles'))
|
||||
{
|
||||
$ERRORS[] = sprintf($lang['EXTRACT_ZIP_FAILED'], 'styles');
|
||||
}
|
||||
$zip->close();
|
||||
}
|
||||
else
|
||||
{
|
||||
$ERRORS[] = sprintf($lang['EXTRACT_ZIP_FAILED'], 'styles');
|
||||
}
|
||||
$zip->close();
|
||||
}
|
||||
else
|
||||
{
|
||||
$ERRORS[] = sprintf($lang['EXTRACT_ZIP_FAILED'], 'styles');
|
||||
$ERRORS[] = $lang['NO_ZIP_ARCHIVE'];
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($_FILES['style_file']['tmp_name']))
|
||||
{
|
||||
@unlink($_FILES['style_file']['tmp_name']);
|
||||
}
|
||||
|
||||
|
||||
if (! sizeof($ERRORS))
|
||||
{
|
||||
kleeja_admin_info($lang['NO_PROBLEM_AFTER_ZIP'], true, '', true, $action);
|
||||
}
|
||||
else
|
||||
{
|
||||
$ERRORS[] = $lang['NO_ZIP_ARCHIVE'];
|
||||
kleeja_admin_err('- ' . implode('<br>- ', $ERRORS), $action);
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($_FILES['style_file']['tmp_name']))
|
||||
{
|
||||
@unlink($_FILES['style_file']['tmp_name']);
|
||||
}
|
||||
|
||||
|
||||
if (! sizeof($ERRORS))
|
||||
{
|
||||
kleeja_admin_info($lang['NO_PROBLEM_AFTER_ZIP'], true, '', true, $action);
|
||||
}
|
||||
else
|
||||
{
|
||||
kleeja_admin_err('- ' . implode('<br>- ', $ERRORS), $action);
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'dfolder':
|
||||
|
||||
@@ -341,160 +341,160 @@ case 'upload':
|
||||
|
||||
kleeja_admin_err($lang['ERROR_TRY_AGAIN'], $action);
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
|
||||
case 'download':
|
||||
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))
|
||||
{
|
||||
$is_update = true;
|
||||
|
||||
if (! rename(
|
||||
PATH . 'styles/' . $style_name,
|
||||
PATH . 'styles/' . $style_name . '_backup'
|
||||
))
|
||||
if (intval($userinfo['founder']) !== 1)
|
||||
{
|
||||
if (file_exists(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 = FetchFile::make($store_link)->get();
|
||||
|
||||
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'] ,
|
||||
];
|
||||
header('HTTP/1.0 401 Unauthorized');
|
||||
kleeja_admin_err($lang['HV_NOT_PRVLG_ACCESS']);
|
||||
}
|
||||
|
||||
// this style is hosted in our store
|
||||
if (isset($store_styles[$style_name]))
|
||||
$style_name = g('style');
|
||||
|
||||
$is_update = false;
|
||||
|
||||
|
||||
if (! is_writable(PATH . 'styles'))
|
||||
{
|
||||
// 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'];
|
||||
@chmod(PATH . 'styles', K_DIR_CHMOD);
|
||||
}
|
||||
|
||||
$style_archive = FetchFile::make($style_name_link)
|
||||
->setDestinationPath(PATH . 'cache/' . $style_name . '.zip')
|
||||
->isBinaryFile(true)
|
||||
->get();
|
||||
//if style exists before, then trigger update action. rename folder to rollback in case of failure
|
||||
if (file_exists(PATH . 'styles/' . $style_name))
|
||||
{
|
||||
$is_update = true;
|
||||
|
||||
if ($style_archive)
|
||||
if (! rename(
|
||||
PATH . 'styles/' . $style_name,
|
||||
PATH . 'styles/' . $style_name . '_backup'
|
||||
))
|
||||
{
|
||||
if (file_exists(PATH . 'styles/' . $style_name))
|
||||
{
|
||||
if (file_exists(PATH . 'cache/' . $style_name . '.zip'))
|
||||
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 = FetchFile::make($store_link)->get();
|
||||
|
||||
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'];
|
||||
|
||||
$style_archive = FetchFile::make($style_name_link)
|
||||
->setDestinationPath(PATH . 'cache/' . $style_name . '.zip')
|
||||
->isBinaryFile(true)
|
||||
->get();
|
||||
|
||||
if ($style_archive)
|
||||
{
|
||||
$zip = new ZipArchive();
|
||||
|
||||
if ($zip->open(PATH . 'cache/' . $style_name . '.zip') === true)
|
||||
if (file_exists(PATH . 'cache/' . $style_name . '.zip'))
|
||||
{
|
||||
if ($zip->extractTo(PATH . 'styles'))
|
||||
$zip = new ZipArchive();
|
||||
|
||||
if ($zip->open(PATH . 'cache/' . $style_name . '.zip') === true)
|
||||
{
|
||||
// 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 (file_exists(PATH . 'styles/' . $style_name . '_backup'))
|
||||
if ($zip->extractTo(PATH . 'styles'))
|
||||
{
|
||||
kleeja_unlink(PATH . 'styles/' . $style_name . '_backup');
|
||||
// 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 (file_exists(PATH . 'styles/' . $style_name . '_backup'))
|
||||
{
|
||||
kleeja_unlink(PATH . 'styles/' . $style_name . '_backup');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$adminAjaxContent = '1003:::' . sprintf($lang['EXTRACT_ZIP_FAILED'], PATH . 'styles');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$adminAjaxContent = '1003:::' . sprintf($lang['EXTRACT_ZIP_FAILED'], PATH . 'styles');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$adminAjaxContent = '1004:::' . $lang['DOWNLOADED_FILE_NOT_FOUND'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$adminAjaxContent = '1004:::' . $lang['DOWNLOADED_FILE_NOT_FOUND'];
|
||||
$adminAjaxContent = '1005:::' . $lang['STORE_SERVER_ERROR'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$adminAjaxContent = '1005:::' . $lang['STORE_SERVER_ERROR'];
|
||||
$adminAjaxContent = '1006:::' . $lang['PACKAGE_N_CMPT_KLJ'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$adminAjaxContent = '1006:::' . $lang['PACKAGE_N_CMPT_KLJ'];
|
||||
$adminAjaxContent = '1007:::' . sprintf($lang['PACKAGE_REMOTE_FILE_MISSING'], $style_name);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$adminAjaxContent = '1007:::' . sprintf($lang['PACKAGE_REMOTE_FILE_MISSING'], $style_name);
|
||||
$adminAjaxContent = '1008:::' . $lang['STORE_SERVER_ERROR'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$adminAjaxContent = '1008:::' . $lang['STORE_SERVER_ERROR'];
|
||||
}
|
||||
|
||||
|
||||
//in case of update failure, rollback to current plugin version
|
||||
if (strpos($adminAjaxContent, '1:::') === false)
|
||||
{
|
||||
if (file_exists(PATH . 'styles/' . $style_name . '_backup'))
|
||||
//in case of update failure, rollback to current plugin version
|
||||
if (strpos($adminAjaxContent, '1:::') === false)
|
||||
{
|
||||
rename(
|
||||
PATH . 'styles/' . $style_name . '_backup',
|
||||
PATH . 'styles/' . $style_name
|
||||
);
|
||||
if (file_exists(PATH . 'styles/' . $style_name . '_backup'))
|
||||
{
|
||||
rename(
|
||||
PATH . 'styles/' . $style_name . '_backup',
|
||||
PATH . 'styles/' . $style_name
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
endswitch;
|
||||
|
||||
@@ -55,7 +55,7 @@ if ($current_smt == 'check')
|
||||
if (! ($version_data = $cache->get('kleeja_repo_version')))
|
||||
{
|
||||
$version_data = [];
|
||||
|
||||
|
||||
$github_data = FetchFile::make(KLEEJA_VERSION_CHECK_LINK)->setTimeOut(100)->get();
|
||||
|
||||
if (! empty($github_data))
|
||||
|
||||
@@ -45,183 +45,183 @@ $text = '';
|
||||
|
||||
switch ($case):
|
||||
|
||||
default:
|
||||
default:
|
||||
|
||||
// Get real number from database right now
|
||||
$all_files = get_actual_stats('files');
|
||||
$all_images = get_actual_stats('imgs');
|
||||
$all_users = get_actual_stats('users');
|
||||
$all_sizes = readable_size(get_actual_stats('sizes'));
|
||||
// Get real number from database right now
|
||||
$all_files = get_actual_stats('files');
|
||||
$all_images = get_actual_stats('imgs');
|
||||
$all_users = get_actual_stats('users');
|
||||
$all_sizes = readable_size(get_actual_stats('sizes'));
|
||||
|
||||
|
||||
//links
|
||||
$del_cache_link = basename(ADMIN_PATH) . '?cp=r_repair&case=clearc&' . $GET_FORM_KEY;
|
||||
$resync_files_link = $config['siteurl'] . 'go.php?go=resync&case=sync_files';
|
||||
$resync_images_link = $config['siteurl'] . 'go.php?go=resync&case=sync_images';
|
||||
$resync_users_link = basename(ADMIN_PATH) . '?cp=r_repair&case=sync_users&' . $GET_FORM_KEY;
|
||||
$resync_sizes_link = basename(ADMIN_PATH) . '?cp=r_repair&case=sync_sizes&' . $GET_FORM_KEY;
|
||||
$repair_tables_link = basename(ADMIN_PATH) . '?cp=r_repair&case=tables&' . $GET_FORM_KEY;
|
||||
//links
|
||||
$del_cache_link = basename(ADMIN_PATH) . '?cp=r_repair&case=clearc&' . $GET_FORM_KEY;
|
||||
$resync_files_link = $config['siteurl'] . 'go.php?go=resync&case=sync_files';
|
||||
$resync_images_link = $config['siteurl'] . 'go.php?go=resync&case=sync_images';
|
||||
$resync_users_link = basename(ADMIN_PATH) . '?cp=r_repair&case=sync_users&' . $GET_FORM_KEY;
|
||||
$resync_sizes_link = basename(ADMIN_PATH) . '?cp=r_repair&case=sync_sizes&' . $GET_FORM_KEY;
|
||||
$repair_tables_link = basename(ADMIN_PATH) . '?cp=r_repair&case=tables&' . $GET_FORM_KEY;
|
||||
|
||||
$queue_cron_job_url = $config['siteurl'] . 'go.php?go=queue';
|
||||
$queue_cron_job_url = $config['siteurl'] . 'go.php?go=queue';
|
||||
|
||||
$stylee = 'admin_repair';
|
||||
$stylee = 'admin_repair';
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
|
||||
//
|
||||
//fix tables ..
|
||||
//fix tables ..
|
||||
//
|
||||
case 'tables':
|
||||
case 'tables':
|
||||
|
||||
$query = 'SHOW TABLE STATUS';
|
||||
$result = $SQL->query($query);
|
||||
$query = 'SHOW TABLE STATUS';
|
||||
$result = $SQL->query($query);
|
||||
|
||||
while ($row=$SQL->fetch_array($result))
|
||||
{
|
||||
$queryf = 'REPAIR TABLE `' . $row['Name'] . '`';
|
||||
$resultf = $SQL->query($queryf);
|
||||
|
||||
if ($resultf)
|
||||
{
|
||||
$text .= '<li>' . $lang['REPAIRE_TABLE'] . $row['Name'] . '</li>';
|
||||
}
|
||||
}
|
||||
|
||||
$SQL->freeresult($result);
|
||||
|
||||
$text .= '<script type="text/javascript"> setTimeout("get_kleeja_link(\'' . basename(ADMIN_PATH) . '?cp=r_repair' . '\');", 2000);</script>' . "\n";
|
||||
$stylee = 'admin_info';
|
||||
|
||||
|
||||
break;
|
||||
|
||||
//
|
||||
//re-sync sizes ..
|
||||
//
|
||||
case 'sync_sizes':
|
||||
|
||||
|
||||
$query_s = [
|
||||
'SELECT' => 'size',
|
||||
'FROM' => "{$dbprefix}files"
|
||||
];
|
||||
|
||||
$result_s = $SQL->build($query_s);
|
||||
|
||||
$files_number = $files_sizes = 0;
|
||||
|
||||
while ($row=$SQL->fetch_array($result_s))
|
||||
{
|
||||
$files_number++;
|
||||
$files_sizes = $files_sizes+$row['size'];
|
||||
}
|
||||
|
||||
$SQL->freeresult($result_s);
|
||||
|
||||
$update_query = [
|
||||
'UPDATE' => "{$dbprefix}stats",
|
||||
'SET' => 'files=' . $files_number . ', sizes=' . $files_sizes
|
||||
];
|
||||
|
||||
if ($SQL->build($update_query))
|
||||
{
|
||||
$text .= '<li>' . $lang['REPAIRE_F_STAT'] . '</li>';
|
||||
}
|
||||
|
||||
delete_cache('data_stats');
|
||||
|
||||
$stylee = 'admin_info';
|
||||
|
||||
break;
|
||||
|
||||
|
||||
//
|
||||
//re-sync total users number ..
|
||||
//
|
||||
case 'sync_users':
|
||||
|
||||
$query_w = [
|
||||
'SELECT' => 'name',
|
||||
'FROM' => "{$dbprefix}users"
|
||||
];
|
||||
|
||||
$result_w = $SQL->build($query_w);
|
||||
|
||||
$user_number = 0;
|
||||
while ($row=$SQL->fetch_array($result_w))
|
||||
{
|
||||
$user_number++;
|
||||
}
|
||||
|
||||
$SQL->freeresult($result_w);
|
||||
|
||||
$update_query = [
|
||||
'UPDATE' => "{$dbprefix}stats",
|
||||
'SET' => 'users=' . $user_number
|
||||
];
|
||||
|
||||
$result = $SQL->build($update_query);
|
||||
|
||||
delete_cache('data_stats');
|
||||
$text = sprintf($lang['SYNCING'], $lang['USERS_ST']);
|
||||
$text .= '<script type="text/javascript"> setTimeout("get_kleeja_link(\'' . basename(ADMIN_PATH) . '?cp=r_repair' . '\');", 2000);</script>' . "\n";
|
||||
|
||||
$stylee = 'admin_info';
|
||||
|
||||
|
||||
break;
|
||||
|
||||
|
||||
//
|
||||
//clear all cache ..
|
||||
//
|
||||
case 'clearc':
|
||||
|
||||
//clear cache
|
||||
delete_cache('', true);
|
||||
|
||||
//show done, msg
|
||||
$text .= '<li>' . $lang['REPAIRE_CACHE'] . '</li>';
|
||||
$text .= '<script type="text/javascript"> setTimeout("get_kleeja_link(\'' . basename(ADMIN_PATH) . '?cp=r_repair' . '\');", 2000);</script>' . "\n";
|
||||
|
||||
$stylee = 'admin_info';
|
||||
|
||||
break;
|
||||
|
||||
//toggle admin start boxes
|
||||
case 'toggle_start_box':
|
||||
|
||||
if (! kleeja_check_form_key_get('adm_start_actions'))
|
||||
{
|
||||
header('HTTP/1.1 405 Method Not Allowed');
|
||||
$adminAjaxContent = $lang['INVALID_FORM_KEY'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$items = explode(':', $config['hidden_start_boxes']);
|
||||
$new_items = $items = array_filter($items);
|
||||
|
||||
$name = g('name');
|
||||
$hide = g('toggle', 'int') == 1;
|
||||
|
||||
if (in_array($name, $items) && ! $hide)
|
||||
while ($row=$SQL->fetch_array($result))
|
||||
{
|
||||
$new_items = array_diff($items, [$name]);
|
||||
}
|
||||
elseif ($hide)
|
||||
{
|
||||
$new_items[] = $name;
|
||||
$queryf = 'REPAIR TABLE `' . $row['Name'] . '`';
|
||||
$resultf = $SQL->query($queryf);
|
||||
|
||||
if ($resultf)
|
||||
{
|
||||
$text .= '<li>' . $lang['REPAIRE_TABLE'] . $row['Name'] . '</li>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($new_items != $items)
|
||||
$SQL->freeresult($result);
|
||||
|
||||
$text .= '<script type="text/javascript"> setTimeout("get_kleeja_link(\'' . basename(ADMIN_PATH) . '?cp=r_repair' . '\');", 2000);</script>' . "\n";
|
||||
$stylee = 'admin_info';
|
||||
|
||||
|
||||
break;
|
||||
|
||||
//
|
||||
//re-sync sizes ..
|
||||
//
|
||||
case 'sync_sizes':
|
||||
|
||||
|
||||
$query_s = [
|
||||
'SELECT' => 'size',
|
||||
'FROM' => "{$dbprefix}files"
|
||||
];
|
||||
|
||||
$result_s = $SQL->build($query_s);
|
||||
|
||||
$files_number = $files_sizes = 0;
|
||||
|
||||
while ($row=$SQL->fetch_array($result_s))
|
||||
{
|
||||
update_config('hidden_start_boxes', implode(':', $new_items));
|
||||
$files_number++;
|
||||
$files_sizes = $files_sizes+$row['size'];
|
||||
}
|
||||
|
||||
$adminAjaxContent = $lang['CONFIGS_UPDATED'];
|
||||
}
|
||||
$SQL->freeresult($result_s);
|
||||
|
||||
break;
|
||||
$update_query = [
|
||||
'UPDATE' => "{$dbprefix}stats",
|
||||
'SET' => 'files=' . $files_number . ', sizes=' . $files_sizes
|
||||
];
|
||||
|
||||
if ($SQL->build($update_query))
|
||||
{
|
||||
$text .= '<li>' . $lang['REPAIRE_F_STAT'] . '</li>';
|
||||
}
|
||||
|
||||
delete_cache('data_stats');
|
||||
|
||||
$stylee = 'admin_info';
|
||||
|
||||
break;
|
||||
|
||||
|
||||
//
|
||||
//re-sync total users number ..
|
||||
//
|
||||
case 'sync_users':
|
||||
|
||||
$query_w = [
|
||||
'SELECT' => 'name',
|
||||
'FROM' => "{$dbprefix}users"
|
||||
];
|
||||
|
||||
$result_w = $SQL->build($query_w);
|
||||
|
||||
$user_number = 0;
|
||||
while ($row=$SQL->fetch_array($result_w))
|
||||
{
|
||||
$user_number++;
|
||||
}
|
||||
|
||||
$SQL->freeresult($result_w);
|
||||
|
||||
$update_query = [
|
||||
'UPDATE' => "{$dbprefix}stats",
|
||||
'SET' => 'users=' . $user_number
|
||||
];
|
||||
|
||||
$result = $SQL->build($update_query);
|
||||
|
||||
delete_cache('data_stats');
|
||||
$text = sprintf($lang['SYNCING'], $lang['USERS_ST']);
|
||||
$text .= '<script type="text/javascript"> setTimeout("get_kleeja_link(\'' . basename(ADMIN_PATH) . '?cp=r_repair' . '\');", 2000);</script>' . "\n";
|
||||
|
||||
$stylee = 'admin_info';
|
||||
|
||||
|
||||
break;
|
||||
|
||||
|
||||
//
|
||||
//clear all cache ..
|
||||
//
|
||||
case 'clearc':
|
||||
|
||||
//clear cache
|
||||
delete_cache('', true);
|
||||
|
||||
//show done, msg
|
||||
$text .= '<li>' . $lang['REPAIRE_CACHE'] . '</li>';
|
||||
$text .= '<script type="text/javascript"> setTimeout("get_kleeja_link(\'' . basename(ADMIN_PATH) . '?cp=r_repair' . '\');", 2000);</script>' . "\n";
|
||||
|
||||
$stylee = 'admin_info';
|
||||
|
||||
break;
|
||||
|
||||
//toggle admin start boxes
|
||||
case 'toggle_start_box':
|
||||
|
||||
if (! kleeja_check_form_key_get('adm_start_actions'))
|
||||
{
|
||||
header('HTTP/1.1 405 Method Not Allowed');
|
||||
$adminAjaxContent = $lang['INVALID_FORM_KEY'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$items = explode(':', $config['hidden_start_boxes']);
|
||||
$new_items = $items = array_filter($items);
|
||||
|
||||
$name = g('name');
|
||||
$hide = g('toggle', 'int') == 1;
|
||||
|
||||
if (in_array($name, $items) && ! $hide)
|
||||
{
|
||||
$new_items = array_diff($items, [$name]);
|
||||
}
|
||||
elseif ($hide)
|
||||
{
|
||||
$new_items[] = $name;
|
||||
}
|
||||
|
||||
if ($new_items != $items)
|
||||
{
|
||||
update_config('hidden_start_boxes', implode(':', $new_items));
|
||||
}
|
||||
|
||||
$adminAjaxContent = $lang['CONFIGS_UPDATED'];
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
endswitch;
|
||||
|
||||
@@ -84,7 +84,7 @@ if (! file_exists(PATH . '.htaccess') && (int) $config['mod_writer'] == 1)
|
||||
}
|
||||
|
||||
//updating
|
||||
$v = @unserialize($config['new_version']);
|
||||
$v = @unserialize($config['new_version']);
|
||||
$new_version = isset($v['version_number']) ? $v['version_number'] : '';
|
||||
|
||||
if (version_compare(strtolower(KLEEJA_VERSION), strtolower($new_version), '<'))
|
||||
@@ -266,9 +266,11 @@ $hurry_groups_list .= '<option value="' . $config['default_group'] . '">' . $lan
|
||||
foreach ($d_groups as $id=>$ddt)
|
||||
{
|
||||
$hurry_groups_list .= '<option value="' . $id . '">' .
|
||||
str_replace(['{lang.ADMINS}', '{lang.USERS}', '{lang.GUESTS}'],
|
||||
[$lang['ADMINS'], $lang['USERS'], $lang['GUESTS']],
|
||||
$d_groups[$id]['data']['group_name']) .
|
||||
str_replace(
|
||||
['{lang.ADMINS}', '{lang.USERS}', '{lang.GUESTS}'],
|
||||
[$lang['ADMINS'], $lang['USERS'], $lang['GUESTS']],
|
||||
$d_groups[$id]['data']['group_name']
|
||||
) .
|
||||
'</option>';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user