* do not use stop_gpc() for compatibility with PHP 8

This commit is contained in:
Max Pozdeev 2021-04-19 20:12:24 +03:00
parent 471825c6af
commit 924a2147ff
4 changed files with 6 additions and 16 deletions

View file

@ -29,7 +29,6 @@ if(isset($_GET['loadLists']))
}
elseif(isset($_GET['loadTasks']))
{
stop_gpc($_GET);
$listId = (int)_get('list');
check_read_access($listId);
@ -117,7 +116,6 @@ elseif(isset($_GET['loadTasks']))
}
elseif(isset($_GET['newTask']))
{
stop_gpc($_POST);
$listId = (int)_post('list');
check_write_access($listId);
$t = array();
@ -160,7 +158,6 @@ elseif(isset($_GET['newTask']))
}
elseif(isset($_GET['fullNewTask']))
{
stop_gpc($_POST);
$listId = (int)_post('list');
check_write_access($listId);
$title = trim(_post('title'));
@ -225,7 +222,6 @@ elseif(isset($_GET['editNote']))
{
check_write_access();
$id = (int)_post('id');
stop_gpc($_POST);
$note = str_replace("\r\n", "\n", trim(_post('note')));
$db->dq("UPDATE {$db->prefix}todolist SET note=?,d_edited=? WHERE id=$id", array($note, time()) );
$t = array();
@ -237,7 +233,6 @@ elseif(isset($_GET['editTask']))
{
check_write_access();
$id = (int)_post('id');
stop_gpc($_POST);
$title = trim(_post('title'));
$note = str_replace("\r\n", "\n", trim(_post('note')));
$prio = (int)_post('prio');
@ -272,7 +267,6 @@ elseif(isset($_GET['editTask']))
elseif(isset($_GET['changeOrder']))
{
check_write_access();
stop_gpc($_POST);
$s = _post('order');
parse_str($s, $order);
$t = array();
@ -301,7 +295,6 @@ elseif(isset($_POST['login']))
$t['disabled'] = 1;
jsonExit($t);
}
stop_gpc($_POST);
$password = _post('password');
if($password == Config::get('password')) {
$t['logged'] = 1;
@ -379,7 +372,6 @@ elseif(isset($_GET['tagCloud']))
elseif(isset($_GET['addList']))
{
check_write_access();
stop_gpc($_POST);
$t = array();
$t['total'] = 0;
$name = str_replace( array('"',"'",'<','>','&'), '', trim(_post('name')) );
@ -395,7 +387,6 @@ elseif(isset($_GET['addList']))
elseif(isset($_GET['renameList']))
{
check_write_access();
stop_gpc($_POST);
$t = array();
$t['total'] = 0;
$id = (int)_post('list');
@ -409,7 +400,6 @@ elseif(isset($_GET['renameList']))
elseif(isset($_GET['deleteList']))
{
check_write_access();
stop_gpc($_POST);
$t = array();
$t['total'] = 0;
$id = (int)_post('list');
@ -457,7 +447,6 @@ elseif(isset($_GET['moveTask']))
elseif(isset($_GET['changeListOrder']))
{
check_write_access();
stop_gpc($_POST);
$order = (array)_post('order');
$t = array();
$t['total'] = 0;
@ -480,7 +469,6 @@ elseif(isset($_GET['changeListOrder']))
elseif(isset($_GET['parseTaskStr']))
{
check_write_access();
stop_gpc($_POST);
$t = array(
'title' => trim(_post('title')),
'prio' => 0,
@ -497,7 +485,6 @@ elseif(isset($_GET['parseTaskStr']))
elseif(isset($_GET['clearCompletedInList']))
{
check_write_access();
stop_gpc($_POST);
$t = array();
$t['total'] = 0;
$listId = (int)_post('list');

View file

@ -30,14 +30,15 @@ function htmlarray_ref(&$a, $exclude=null)
return;
}
/*
function stop_gpc(&$arr)
{
if (!is_array($arr)) {
return 1;
}
// Since PHP v5.4.0 magic quotes feature was removed from PHP
// In PHP v7.4 get_magic_quotes_gpc is deprecated
// Since PHP v5.4.0 magic quotes config option was removed from PHP.
// In PHP v7.4 get_magic_quotes_gpc() is deprecated, in v8.0 is removed.
// TODO: do not use get_magic_quotes_gpc() and stop_gpc()
if (!@get_magic_quotes_gpc()) {
return 1;
@ -56,6 +57,8 @@ function stop_gpc(&$arr)
return 1;
}
*/
function _post($param,$defvalue = '')
{
if(!isset($_POST[$param])) {

View file

@ -9,6 +9,7 @@ define('MTT_VERSION', '@VERSION');
##### MyTinyTodo requires php 5.4.0 and above! #####
if (version_compare(PHP_VERSION, '5.4.0') < 0) {
# If you adopt the script for old php version, look at stop_gpc() function in the sources of MTT v1.6
die("PHP 5.4+ is required");
}

View file

@ -17,7 +17,6 @@ if ( !is_logged() )
if(isset($_POST['save']))
{
stop_gpc($_POST);
$t = array();
$langs = getLangs();
Config::$params['lang']['options'] = array_keys($langs);