Deleted POST, GET ...

This commit is contained in:
Visman 2017-01-08 14:21:23 +07:00
parent 9607fb3919
commit e89537505d
12 changed files with 140 additions and 96 deletions

View file

@ -36,7 +36,9 @@ class addon_security_for_login extends flux_addon
function hook_login_before_header()
{
global $db, $pun_config;
global $container, $pun_config;
$db = $container->get('DB');
if (empty($pun_config['o_sec_of_login']) || $pun_config['o_sec_of_login'] != $this->version)
{
@ -89,7 +91,9 @@ class addon_security_for_login extends flux_addon
function hook_login_before_submit()
{
global $db;
global $container;
$db = $container->get('DB');
$now = time();
$ip = get_remote_address();
@ -113,26 +117,29 @@ class addon_security_for_login extends flux_addon
function hook_login_before_validation()
{
global $db, $errors;
global $container, $errors;
$db = $container->get('DB');
$request = $container->get('Request');
if (!defined('FORUM_SEC_FUNCTIONS_LOADED'))
include PUN_ROOT.'include/security.php';
$now = time();
if (!isset($_POST[$this->form_key]))
if (! $request->isPost($this->form_key))
{
$errors[] = security_msg('1');
return;
}
if (empty($_POST['req_username']) || empty($_POST['req_password']) || empty($_POST['redirect_url']))
if (empty($request->postStr('req_username')) || empty($request->postStr('req_password')) || empty($request->postStr('redirect_url')))
$errors[] = security_msg('1');
if (security_test_browser())
$errors[] = security_msg('2');
$result = $db->query('SELECT * FROM '.$db->prefix.'sec_of_login WHERE form_key=\''.$db->escape($_POST[$this->form_key]).'\' LIMIT 1') or error('Unable to get sec_of_login data', __FILE__, __LINE__, $db->error());
$result = $db->query('SELECT * FROM '.$db->prefix.'sec_of_login WHERE form_key=\''.$db->escape($requst->postStr($this->form_key, '')).'\' LIMIT 1') or error('Unable to get sec_of_login data', __FILE__, __LINE__, $db->error());
$cur_form = $db->fetch_assoc($result);
if (empty($cur_form['form_time']) || $cur_form['form_captcha'] == 'error')
@ -158,9 +165,9 @@ class addon_security_for_login extends flux_addon
}
if (empty($errors))
$db->query('DELETE FROM '.$db->prefix.'sec_of_login WHERE form_key=\''.$db->escape($_POST[$this->form_key]).'\'') or error('Unable to delete sec_of_login data', __FILE__, __LINE__, $db->error());
$db->query('DELETE FROM '.$db->prefix.'sec_of_login WHERE form_key=\''.$db->escape($requst->postStr($this->form_key, '')).'\'') or error('Unable to delete sec_of_login data', __FILE__, __LINE__, $db->error());
else
$db->query('UPDATE '.$db->prefix.'sec_of_login SET form_captcha=\'error\' WHERE form_key=\''.$db->escape($_POST[$this->form_key]).'\'') or error('Unable to update sec_of_login data', __FILE__, __LINE__, $db->error());
$db->query('UPDATE '.$db->prefix.'sec_of_login SET form_captcha=\'error\' WHERE form_key=\''.$db->escape($requst->postStr($this->form_key, '')).'\'') or error('Unable to update sec_of_login data', __FILE__, __LINE__, $db->error());
}

View file

@ -36,7 +36,9 @@ class addon_security_for_post extends flux_addon
function hook_post_before_header()
{
global $db, $pun_config;
global $container, $pun_config;
$db = $container->get('DB');
if (empty($pun_config['o_sec_of_post']) || $pun_config['o_sec_of_post'] != $this->version)
{
@ -89,7 +91,9 @@ class addon_security_for_post extends flux_addon
function hook_post_before_submit()
{
global $db, $pun_config;
global $container, $pun_config;
$db = $container->get('DB');
$this->hook_post_before_header();
@ -114,14 +118,17 @@ class addon_security_for_post extends flux_addon
function hook_post_after_validation()
{
global $db, $pun_config, $errors;
global $container, $pun_config, $errors;
$db = $container->get('DB');
$request = $container->get('Request');
if (!defined('FORUM_SEC_FUNCTIONS_LOADED'))
include PUN_ROOT.'include/security.php';
$now = time();
if (!isset($_POST[$this->form_key]))
if (! $request->isPost($this->form_key))
{
$errors[] = security_msg('1');
return;
@ -130,7 +137,7 @@ class addon_security_for_post extends flux_addon
if (security_test_browser())
$errors[] = security_msg('2');
$result = $db->query('SELECT * FROM '.$db->prefix.'sec_of_post WHERE form_key=\''.$db->escape($_POST[$this->form_key]).'\' LIMIT 1') or error('Unable to get sec_of_post data', __FILE__, __LINE__, $db->error());
$result = $db->query('SELECT * FROM '.$db->prefix.'sec_of_post WHERE form_key=\''.$db->escape($requst->postStr($this->form_key, '')).'\' LIMIT 1') or error('Unable to get sec_of_post data', __FILE__, __LINE__, $db->error());
$cur_form = $db->fetch_assoc($result);
if (empty($cur_form['form_time']) || $cur_form['form_captcha'] == 'error')
@ -157,9 +164,9 @@ class addon_security_for_post extends flux_addon
}
if (empty($errors))
$db->query('DELETE FROM '.$db->prefix.'sec_of_post WHERE form_key=\''.$db->escape($_POST[$this->form_key]).'\'') or error('Unable to delete sec_of_post data', __FILE__, __LINE__, $db->error());
$db->query('DELETE FROM '.$db->prefix.'sec_of_post WHERE form_key=\''.$db->escape($requst->postStr($this->form_key, '')).'\'') or error('Unable to delete sec_of_post data', __FILE__, __LINE__, $db->error());
else
$db->query('UPDATE '.$db->prefix.'sec_of_post SET form_captcha=\'error\' WHERE form_key=\''.$db->escape($_POST[$this->form_key]).'\'') or error('Unable to update sec_of_post data', __FILE__, __LINE__, $db->error());
$db->query('UPDATE '.$db->prefix.'sec_of_post SET form_captcha=\'error\' WHERE form_key=\''.$db->escape($requst->postStr($this->form_key, '')).'\'') or error('Unable to update sec_of_post data', __FILE__, __LINE__, $db->error());
}

View file

@ -36,7 +36,9 @@ class addon_security_for_register extends flux_addon
function hook_register_before_header()
{
global $db, $pun_config;
global $container, $pun_config;
$db = $container->get('DB');
if (empty($pun_config['o_sec_of_register']) || $pun_config['o_sec_of_register'] != $this->version)
{
@ -89,7 +91,9 @@ class addon_security_for_register extends flux_addon
function hook_register_before_submit()
{
global $db, $pun_config;
global $container, $pun_config;
$db = $container->get('DB');
if (!defined('FORUM_SEC_FUNCTIONS_LOADED'))
include PUN_ROOT.'include/security.php';
@ -112,26 +116,29 @@ class addon_security_for_register extends flux_addon
function hook_register_after_validation()
{
global $db, $errors;
global $container, $errors;
$db = $container->get('DB');
$request = $container->get('Request');
if (!defined('FORUM_SEC_FUNCTIONS_LOADED'))
include PUN_ROOT.'include/security.php';
$now = time();
if (!isset($_POST[$this->form_key]))
if (! $request->isPost($this->form_key))
{
$errors[] = security_msg('1');
return;
}
if (!isset($_POST['req_user']) || !isset($_POST['req_email1']) || !isset($_POST['timezone']) || !isset($_POST['email_setting']))
if (! $request->isPost('req_user') || ! $request->isPost('req_email1') || ! $request->isPost('timezone') || ! $request->isPost('email_setting'))
$errors[] = security_msg('1');
if (security_test_browser())
$errors[] = security_msg('2');
$result = $db->query('SELECT * FROM '.$db->prefix.'sec_of_register WHERE form_key=\''.$db->escape($_POST[$this->form_key]).'\' LIMIT 1') or error('Unable to get sec_of_register data', __FILE__, __LINE__, $db->error());
$result = $db->query('SELECT * FROM '.$db->prefix.'sec_of_register WHERE form_key=\''.$db->escape($requst->postStr($this->form_key, '')).'\' LIMIT 1') or error('Unable to get sec_of_register data', __FILE__, __LINE__, $db->error());
$cur_form = $db->fetch_assoc($result);
if (empty($cur_form['form_time']) || $cur_form['form_captcha'] == 'error')
@ -158,9 +165,9 @@ class addon_security_for_register extends flux_addon
}
if (empty($errors))
$db->query('DELETE FROM '.$db->prefix.'sec_of_register WHERE form_key=\''.$db->escape($_POST[$this->form_key]).'\'') or error('Unable to delete sec_of_register data', __FILE__, __LINE__, $db->error());
$db->query('DELETE FROM '.$db->prefix.'sec_of_register WHERE form_key=\''.$db->escape($requst->postStr($this->form_key, '')).'\'') or error('Unable to delete sec_of_register data', __FILE__, __LINE__, $db->error());
else
$db->query('UPDATE '.$db->prefix.'sec_of_register SET form_captcha=\'error\' WHERE form_key=\''.$db->escape($_POST[$this->form_key]).'\'') or error('Unable to update sec_of_register data', __FILE__, __LINE__, $db->error());
$db->query('UPDATE '.$db->prefix.'sec_of_register SET form_captcha=\'error\' WHERE form_key=\''.$db->escape($requst->postStr($this->form_key, '')).'\'') or error('Unable to update sec_of_register data', __FILE__, __LINE__, $db->error());
}

View file

@ -112,8 +112,10 @@ function DeleteModInFiles ()
return $errors;
}
$request = $container->get('Request');
// Установка плагина/мода
if (isset($_POST['installation']))
if ($request->isPost('installation'))
{
$db->query('DELETE FROM '.$db->prefix.'config WHERE conf_name LIKE \'o\_fbox\_%\'') or error('Unable to remove config entries', __FILE__, __LINE__, $db->error());;
$db->query('INSERT INTO '.$db->prefix.'config (conf_name, conf_value) VALUES(\'o_fbox_guest\', \'0\')') or error('Unable to insert into table config.', __FILE__, __LINE__, $db->error());
@ -133,10 +135,10 @@ if (isset($_POST['installation']))
}
// Обновления параметров
else if (isset($_POST['update']))
else if ($request->isPost('update'))
{
$gst = isset($_POST['guest_on']) ? 1 : 0;
$files = isset($_POST['files']) ? array_map('pun_trim', $_POST['files']) : array();
$gst = $request->isPost('guest_on') ? 1 : 0;
$files = array_map('trim', $request->post('files', array()));
$fls = array();
foreach ($files as $file)
{
@ -158,7 +160,7 @@ else if (isset($_POST['update']))
}
// Удаление мода
else if (isset($_POST['delete']))
else if ($request->isPost('delete'))
{
$db->query('DELETE FROM '.$db->prefix.'config WHERE conf_name LIKE \'o\_fbox\_%\'') or error('Unable to remove config entries', __FILE__, __LINE__, $db->error());;

View file

@ -19,14 +19,16 @@ if (file_exists(PUN_ROOT.'lang/'.$admin_language.'/admin_plugin_merge_posts.php'
else
require PUN_ROOT.'lang/English/admin_plugin_merge_posts.php';
$request = $container->get('Request');
// If the "Show text" button was clicked
if (isset($_POST['show_text']))
if ($request->isPost('show_text'))
{
// Make sure something was entered
if (!isset($_POST['text_to_show']) || pun_trim($_POST['text_to_show']) == '')
if (trim($request->postStr('text_to_show')) == '') //????
message($lang_admin_plugin_merge_posts['No text']);
$merge_timeout = intval($_POST['text_to_show']);
$merge_timeout = $request->postInt('text_to_show', 0); //????
$db->query('UPDATE '.$db->prefix.'config SET conf_value=\''.$merge_timeout.'\' WHERE conf_name=\'o_merge_timeout\'') or error('Unable to update board config', __FILE__, __LINE__, $db->error());
// Regenerate the config cache

View file

@ -20,14 +20,18 @@ if (file_exists(PUN_ROOT.'lang/'.$admin_language.'/admin_plugin_not_sum.php'))
else
require PUN_ROOT.'lang/English/admin_plugin_not_sum.php';
$request = $container->get('Request');
// If the "Show text" button was clicked
if (isset($_POST['show_text']))
if ($request->isPost('show_text'))
{
$result = $db->query('SELECT id FROM '.$db->prefix.'forums ORDER BY id') or error('Unable to fetch forums', __FILE__, __LINE__, $db->error());
$data = $request->post('no_sum_mess', array());
while ($cur_forum = $db->fetch_assoc($result))
{
$nosu = isset($_POST['no_sum_mess'][$cur_forum['id']]) ? intval($_POST['no_sum_mess'][$cur_forum['id']]) : 0;
$nosu = isset($data[$cur_forum['id']]) ? intval($data[$cur_forum['id']]) : 0;
$db->query('UPDATE '.$db->prefix.'forums SET no_sum_mess='.$nosu.' WHERE id='.$cur_forum['id']) or error('Unable to update forums', __FILE__, __LINE__, $db->error());
}

View file

@ -20,14 +20,16 @@ if (file_exists(PUN_ROOT.'lang/'.$admin_language.'/admin_plugin_pms_new.php'))
else
require PUN_ROOT.'lang/English/admin_plugin_pms_new.php';
$request = $container->get('Request');
// If the "Show text" button was clicked
if (isset($_POST['show_text']))
if ($request->isPost('show_text'))
{
$en_pms = isset($_POST['enable_pms']) ? 1 : 0;
$g_limit = isset($_POST['g_limit']) ? array_map('pun_trim', $_POST['g_limit']) : array();
$g_pm = isset($_POST['g_pm']) ? array_map('pun_trim', $_POST['g_pm']) : array();
$min_kolvo = isset($_POST['min_kolvo']) ? intval($_POST['min_kolvo']) : 0;
$flash_pms = isset($_POST['flasher_pms']) ? 1 : 0;
$en_pms = $request->isPost('enable_pms') ? 1 : 0;
$g_limit = array_map('trim', $request->post('g_limit', array()));
$g_pm = array_map('trim', $request->post('g_pm', array());
$min_kolvo = max($request->postInt('min_kolvo', 0), 0);
$flash_pms = $request->isPost('flasher_pms') ? 1 : 0;
$db->query('UPDATE '.$db->prefix.'config SET conf_value=\''.$en_pms.'\' WHERE conf_name=\'o_pms_enabled\'') or error('Unable to update board config', __FILE__, __LINE__, $db->error());
$db->query('UPDATE '.$db->prefix.'config SET conf_value=\''.$min_kolvo.'\' WHERE conf_name=\'o_pms_min_kolvo\'') or error('Unable to update board config', __FILE__, __LINE__, $db->error());

View file

@ -20,22 +20,23 @@ if (file_exists(PUN_ROOT.'lang/'.$admin_language.'/admin_plugin_poll.php'))
else
require PUN_ROOT.'lang/English/admin_plugin_poll.php';
$request = $container->get('Request');
// If the "Show text" button was clicked
if (isset($_POST['show_text']))
if ($request->isPost('show_text'))
{
$en_poll = isset($_POST['enable_poll']) ? intval($_POST['enable_poll']) : 0;
$en_poll = ($en_poll == 1) ? 1 : 0;
$en_poll = $request->isPost('enable_poll') ? 1 : 0;
$db->query('UPDATE '.$db->prefix.'config SET conf_value=\''.$en_poll.'\' WHERE conf_name=\'o_poll_enabled\'') or error('Unable to update board config', __FILE__, __LINE__, $db->error());
if ($en_poll == 1)
{
$poll_max_ques = isset($_POST['poll_max_ques']) ? $_POST['poll_max_ques'] : $pun_config['o_poll_max_ques'];
$poll_max_field = isset($_POST['poll_max_field']) ? $_POST['poll_max_field'] : $pun_config['o_poll_max_field'];
$poll_time = isset($_POST['poll_time']) ? $_POST['poll_time'] : $pun_config['o_poll_time'];
$poll_term = isset($_POST['poll_term']) ? $_POST['poll_term'] : $pun_config['o_poll_term'];
$poll_guest = isset($_POST['poll_guest']) ? 1 : 0;
$poll_max_ques = $request->postInt('poll_max_ques', $pun_config['o_poll_max_ques']);
$poll_max_field = $request->postInt('poll_max_field', $pun_config['o_poll_max_field']);
$poll_time = $request->postInt('poll_time', $pun_config['o_poll_time']);
$poll_term = $request->postInt('poll_term', $pun_config['o_poll_term']);
$poll_guest = $request->isPost('poll_guest') ? 1 : 0;
$poll_max_ques = min(10, max(1, $poll_max_ques));
$poll_max_field = min(90, max(2, $poll_max_field));

View file

@ -19,15 +19,17 @@ if (file_exists(PUN_ROOT.'lang/'.$admin_language.'/admin_plugin_security.php'))
else
require PUN_ROOT.'lang/English/admin_plugin_security.php';
$request = $container->get('Request');
// If the "Show text" button was clicked
if (isset($_POST['show_text']))
if ($request->isPost('show_text'))
{
$b_coding_forms = isset($_POST['coding_forms']) ? intval($_POST['coding_forms']) : 0;
$b_check_ip = isset($_POST['check_ip']) ? intval($_POST['check_ip']) : 0;
$b_redirect = isset($_POST['board_redirect']) ? pun_trim($_POST['board_redirect']) : '';
$b_redirectg = isset($_POST['board_redirectg']) ? intval($_POST['board_redirectg']) : 0;
$b_crypto = isset($_POST['crypto_enable']) ? intval($_POST['crypto_enable']) : 0;
$b_enable_acaptcha = isset($_POST['enable_acaptcha']) ? intval($_POST['enable_acaptcha']) : 0;
$b_coding_forms = $request->isPost('coding_forms') ? 1 : 0;
$b_crypto = $request->isPost('crypto_enable') ? 1 : 0;
$b_enable_acaptcha = $request->isPost('enable_acaptcha') ? 1 : 0;
$b_check_ip = $request->isPost('check_ip') ? 1 : 0;
$b_redirect = trim($request->postStr('board_redirect'));
$b_redirectg = $request->isPost('board_redirectg') ? 1 : 0;
$db->query('UPDATE '.$db->prefix.'config SET conf_value=\''.$b_coding_forms.'\' WHERE conf_name=\'o_coding_forms\'') or error('Unable to update board config', __FILE__, __LINE__, $db->error());
$db->query('UPDATE '.$db->prefix.'config SET conf_value=\''.$b_check_ip.'\' WHERE conf_name=\'o_check_ip\'') or error('Unable to update board config', __FILE__, __LINE__, $db->error());

View file

@ -50,12 +50,14 @@ while (($entry = $d->read()) !== false)
$d->close();
@natsort($img_smilies);
$request = $container->get('Request');
// Change smilies texts, images and positions
if (isset($_POST['reord']))
if ($request->isPost('reord'))
{
$smilies_order = array_map('intval', array_map('pun_trim', $_POST['smilies_order']));
$smilies_img = array_map('pun_trim', $_POST['smilies_img']);
$smilies_code = array_map('pun_trim', $_POST['smilies_code']);
$smilies_order = array_map('intval', array_map('trim', $request->post('smilies_order')));
$smilies_img = array_map('trim', $request->post('smilies_img'));
$smilies_code = array_map('trim', $request->post('smilies_code'));
// Checking smilies codes
$smiley_dups = array();
@ -86,11 +88,12 @@ if (isset($_POST['reord']))
}
// Remove smilies
elseif (isset($_POST['remove']))
elseif ($request->isPost('remove'))
{
if (empty($_POST['rem_smilies']))
$rem_smilies = $request->post('rem_smilies');
if (empty($rem_smilies))
message($lang_smiley['No Smileys']);
$rem_smilies = array_map('intval', array_keys($_POST['rem_smilies']));
$rem_smilies = array_map('intval', array_keys($rem_smilies));
// Delete smilies
$db->query('DELETE FROM '.$db->prefix.'smilies WHERE id IN ('.implode(', ', $rem_smilies).')') or error('Unable to delete smiley', __FILE__, __LINE__, $db->error());
@ -105,10 +108,10 @@ elseif (isset($_POST['remove']))
}
// Add a smiley to the list
elseif (isset($_POST['add_smiley']))
elseif ($request->isPost('add_smiley'))
{
$smiley_code = pun_trim($_POST['smiley_code']);
$smiley_image = pun_trim($_POST['smiley_image']);
$smiley_code = trim($request->postStr('smiley_code'));
$smiley_image = trim($request->postStr('smiley_image'));
// Checking text code and image
if ($smiley_code == '')
@ -131,11 +134,12 @@ elseif (isset($_POST['add_smiley']))
}
// Delete images
elseif (isset($_POST['delete']))
elseif ($request->isPost('delete'))
{
if (empty($_POST['del_smilies']))
$del_smilies = $request->post('del_smilies');
if (empty($del_smilies))
message($lang_smiley['No Images']);
$del_smilies = array_map('pun_trim', $_POST['del_smilies']);
$del_smilies = array_map('trim', $del_smilies);
$to_delete = $images_affected = $not_deleted = array();
@ -170,7 +174,7 @@ elseif (isset($_POST['delete']))
}
// Add an image
elseif (isset($_POST['add_image']))
elseif ($request->isPost('add_image'))
{
if (!isset($_FILES['req_file']))
message($lang_smiley['No file']);

View file

@ -20,11 +20,13 @@ if (file_exists(PUN_ROOT.'lang/'.$pun_user['language'].'/admin_plugin_timelimit.
else
require PUN_ROOT.'lang/English/admin_plugin_timelimit.php';
$request = $container->get('Request');
// If the "Show text" button was clicked
if (isset($_POST['show_text']))
if ($request->isPost('show_text'))
{
$g_order = array_map('pun_trim', $_POST['g_order']);
$g_order = array_map('trim', $request->post('g_order'));
$result = $db->query('SELECT g_id, g_title, g_deledit_interval FROM '.$db->prefix.'groups ORDER BY g_id') or error('Unable to fetch user group list', __FILE__, __LINE__, $db->error());

View file

@ -29,8 +29,10 @@ $sconf = array(
'pic_h' => 1050,
);
$request = $container->get('Request');
// Установка плагина/мода
if (isset($_POST['installation']))
if ($request->isPost('installation'))
{
$db->add_field('users', 'upload', 'INT(15)', false, 0) or error(sprintf($lang_up['Error DB'], 'users'), __FILE__, __LINE__, $db->error());
$db->add_field('groups', 'g_up_ext', 'VARCHAR(255)', false, PLUGIN_EXTS) or error(sprintf($lang_up['Error DB'], 'groups'), __FILE__, __LINE__, $db->error());
@ -51,7 +53,7 @@ if (isset($_POST['installation']))
}
// Обновления параметров
else if (isset($_POST['update']))
else if ($request->isPost('update'))
{
if (!isset($pun_user['g_up_ext']))
{
@ -60,9 +62,9 @@ else if (isset($_POST['update']))
$db->add_field('groups', 'g_up_limit', 'INT(15)', false, 0) or error(sprintf($lang_up['Error DB'], 'groups'), __FILE__, __LINE__, $db->error());
}
$g_up_ext = isset($_POST['g_up_ext']) ? array_map('pun_trim', $_POST['g_up_ext']) : array();
$g_up_limit = isset($_POST['g_up_limit']) ? array_map('intval', $_POST['g_up_limit']) : array();
$g_up_max = isset($_POST['g_up_max']) ? array_map('intval', $_POST['g_up_max']) : array();
$g_up_ext = array_map('trim', $request->post('g_up_ext', array()));
$g_up_limit = array_map('intval', $request->post('g_up_limit', array()));
$g_up_max = array_map('intval', $request->post('g_up_max', array()));
$result = $db->query('SELECT g_id FROM '.$db->prefix.'groups ORDER BY g_id') or error('Unable to fetch user group list', __FILE__, __LINE__, $db->error());
while ($cur_group = $db->fetch_assoc($result))
@ -94,21 +96,22 @@ else if (isset($_POST['update']))
$db->query('UPDATE '.$db->prefix.'groups SET g_up_ext=\''.$db->escape($g_ext).'\', g_up_limit='.$g_lim.', g_up_max='.$g_max.' WHERE g_id='.$cur_group['g_id']) or error('Unable to update user group list', __FILE__, __LINE__, $db->error());
}
if (isset($_POST['thumb']))
$sconf['thumb'] = ($_POST['thumb'] == '1' ? 1 : 0);
if (isset($_POST['thumb_size']) && $_POST['thumb_size'] > 0)
$sconf['thumb_size'] = intval($_POST['thumb_size']);
if (isset($_POST['thumb_perc']) && $_POST['thumb_perc'] > 0 && $_POST['thumb_perc'] <= 100)
$sconf['thumb_perc'] = intval($_POST['thumb_perc']);
//????
if ($request->isPost('thumb'))
$sconf['thumb'] = $request->postInt('thumb', 0) === 1 ? 1 : 0;
if ($request->isPost('thumb_size') && $request->postInt('thumb_size', 0) > 0)
$sconf['thumb_size'] = $request->postInt('thumb_size', 1);
if ($request->isPost('thumb_perc') && $request->postInt('thumb_perc', 0) > 0 && $request->postInt('thumb_perc', 0) <= 100)
$sconf['thumb_perc'] = $request->postInt('thumb_perc', 1);
if (isset($_POST['pic_mass']) && $_POST['pic_mass'] >= 0)
$sconf['pic_mass'] = intval($_POST['pic_mass']);
if (isset($_POST['pic_perc']) && $_POST['pic_perc'] > 0 && $_POST['pic_perc'] <= 100)
$sconf['pic_perc'] = intval($_POST['pic_perc']);
if (isset($_POST['pic_w']) && $_POST['pic_w'] >= 100)
$sconf['pic_w'] = intval($_POST['pic_w']);
if (isset($_POST['pic_h']) && $_POST['pic_h'] >= 100)
$sconf['pic_h'] = intval($_POST['pic_h']);
if ($request->isPost('pic_mass') && $request->postInt('pic_mass', -1) > -1)
$sconf['pic_mass'] = $request->postInt('pic_mass', 0);
if ($request->isPost('pic_perc') && $request->postInt('pic_perc', 0) > 0 && $request->postInt('pic_perc', 0) <= 100)
$sconf['pic_perc'] = $request->postInt('pic_perc', 1);
if ($request->isPost('pic_w') && $request->postInt('pic_w', 0) >= 100)
$sconf['pic_w'] = $request->postInt('pic_w', 100);
if ($request->isPost('pic_h') && $request->postInt('pic_h', 0) >= 100)
$sconf['pic_h'] = $request->postInt('pic_h', 100);
$db->query('DELETE FROM '.$db->prefix.'config WHERE conf_name LIKE \'o\_uploadile\_%\'') or error('Unable to remove config entries', __FILE__, __LINE__, $db->error());;
$db->query('INSERT INTO '.$db->prefix.'config (conf_name, conf_value) VALUES(\'o_uploadile_other\', \''.$db->escape(serialize($sconf)).'\')') or error($lang_up['Error DB ins-up'], __FILE__, __LINE__, $db->error());
@ -122,7 +125,7 @@ else if (isset($_POST['update']))
}
// Удаление мода
else if (isset($_POST['restore']))
else if ($request->isPost('restore'))
{
$db->drop_field('users', 'upload') or error('Unable to drop upload field', __FILE__, __LINE__, $db->error());
$db->drop_field('groups', 'g_up_ext') or error('Unable to drop g_up_ext field', __FILE__, __LINE__, $db->error());
@ -152,14 +155,15 @@ $mem = 'img/members/';
$regx = '%^img/members/(\d+)/(.+)\.([0-9a-zA-Z]+)$%i';
// #############################################################################
// Удаление файлов
if (isset($_POST['delete']) && isset($_POST['delete_f']) && is_array($_POST['delete_f']))
if ($request->isPost('delete') && is_array($request->post('delete_f')))
{
$error = 0;
if (is_dir(PUN_ROOT.$mem))
{
$au = array();
foreach ($_POST['delete_f'] as $file)
$data = $request->post('delete_f');
foreach ($data as $file)
{
preg_match($regx, $file, $fi);
if (!isset($fi[1]) || !isset($fi[2]) || !isset($fi[3])) continue;
@ -190,7 +194,7 @@ if (isset($_POST['delete']) && isset($_POST['delete_f']) && is_array($_POST['del
}
}
$p = (!isset($_GET['p']) || $_GET['p'] <= 1) ? 1 : intval($_GET['p']);
$p = max($request->getInt('p', 1), 1);
if ($error == 0)
redirect(PLUGIN_URL.($p > 1 ? '&amp;p='.$p : ''), $lang_up['Redirect delete']);
@ -402,7 +406,7 @@ if (is_dir(PUN_ROOT.$mem))
if (!empty($af))
{
$num_pages = ceil(sizeof($af) / PLUGIN_NF);
$p = (!isset($_GET['p']) || $_GET['p'] <= 1) ? 1 : intval($_GET['p']);
$p = max($request->getInt('p', 1), 1);
if ($p > $num_pages)
{
header('Location: '.PLUGIN_URL.'&p='.$num_pages.'#gofile');
@ -501,7 +505,7 @@ else
$dir = $mem.$fi[1].'/';
$size_file = file_size(filesize(PUN_ROOT.$file));
$miniature = $dir.'mini_'.$fi[2].'.'.$fi[3];
if (isset($_POST['update_thumb']) && $aconf['thumb'] == 1 && array_key_exists(strtolower($fi[3]),$extimageGD))
if ($request->isPost('update_thumb') && $aconf['thumb'] == 1 && array_key_exists(strtolower($fi[3]),$extimageGD))
img_resize(PUN_ROOT.$file, $dir, 'mini_'.$fi[2], $fi[3], 0, $aconf['thumb_size'], $aconf['thumb_perc']);
?>