2
0
mirror of https://github.com/ACSPRI/queXS synced 2024-04-02 12:12:16 +00:00

Fix for warnings/notices/deprecated messages on PHP 7.4

This commit is contained in:
Adam Zammit
2021-01-28 14:07:17 +11:00
parent e7093af41e
commit ead8e5f0ea
53 changed files with 152 additions and 248 deletions

View File

@@ -252,7 +252,6 @@ $ADODB_INCLUDED_CSV = 1;
//var_dump($arr);
if (!is_array($arr)) {
$err = "Recordset had unexpected EOF (in serialized recordset)";
if (get_magic_quotes_runtime()) $err .= ". Magic Quotes Runtime should be disabled!";
return $false;
}
$rs = new $rsclass();

View File

@@ -691,12 +691,6 @@ Committed_AS: 348732 kB
}
$this->conn->LogSQL($savelog);
// magic quotes
if (isset($_GET['sql']) && get_magic_quotes_gpc()) {
$_GET['sql'] = $_GET['sql'] = str_replace(array("\\'",'\"'),array("'",'"'),$_GET['sql']);
}
if (!isset($_SESSION['ADODB_PERF_SQL'])) $nsql = $_SESSION['ADODB_PERF_SQL'] = 10;
else $nsql = $_SESSION['ADODB_PERF_SQL'];
@@ -999,12 +993,6 @@ Committed_AS: 348732 kB
function undomq($m)
{
if (get_magic_quotes_gpc()) {
// undo the damage
$m = str_replace('\\\\','\\',$m);
$m = str_replace('\"','"',$m);
$m = str_replace('\\\'','\'',$m);
}
return $m;
}

View File

@@ -1303,8 +1303,7 @@ class adoSchema {
*/
function __construct( $db ) {
// Initialize the environment
$this->mgq = get_magic_quotes_runtime();
ini_set("magic_quotes_runtime", 0);
$this->mgq = 0;
#set_magic_quotes_runtime(0);
$this->db = $db;

View File

@@ -1407,9 +1407,8 @@ class adoSchema {
*/
function __construct( $db ) {
// Initialize the environment
$this->mgq = get_magic_quotes_runtime();
$this->mgq = 0;
#set_magic_quotes_runtime(0);
ini_set("magic_quotes_runtime", 0);
$this->db = $db;
$this->debug = $this->db->debug;

View File

@@ -834,7 +834,7 @@ if (!defined('_ADODB_LAYER')) {
* Requested by "Karsten Dambekalns" <k.dambekalns@fishfarm.de>
*/
function QMagic($s) {
return $this->qstr($s,get_magic_quotes_gpc());
return $this->qstr($s,0);
}
function q(&$s) {
@@ -2034,9 +2034,6 @@ if (!defined('_ADODB_LAYER')) {
if (!$rs) {
// no cached rs found
if ($this->debug) {
if (get_magic_quotes_runtime() && !$this->memCache) {
ADOConnection::outp("Please disable magic_quotes_runtime - it corrupts cache files :(");
}
if ($this->debug !== -1) {
ADOConnection::outp( " $md5file cache failure: $err (this is a notice and not an error)");
}
@@ -2941,7 +2938,7 @@ http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10759/statements_1
* An example is $db->qstr("Don't bother",magic_quotes_runtime());
*
* @param s the string to quote
* @param [magic_quotes] if $s is GET/POST var, set to get_magic_quotes_gpc().
* @param [magic_quotes] if $s is GET/POST var, set to 0.
* This undoes the stupidity of magic quotes for GPC.
*
* @return quoted string to be sent back to database

View File

@@ -170,7 +170,7 @@ class ADODB_mssql extends ADOConnection {
* An example is $db->qstr("Don't bother",magic_quotes_runtime());
*
* @param s the string to quote
* @param [magic_quotes] if $s is GET/POST var, set to get_magic_quotes_gpc().
* @param [magic_quotes] if $s is GET/POST var, set to 0.
* This undoes the stupidity of magic quotes for GPC.
*
* @return quoted string to be sent back to database

View File

@@ -226,10 +226,10 @@ class ADODB_mysqli extends ADOConnection {
* @param string $s The string to quote
* @param boolean $magic_quotes If false, use mysqli_real_escape_string()
* if you are quoting a string extracted from a POST/GET variable,
* then pass get_magic_quotes_gpc() as the second parameter. This will
* then pass 0 as the second parameter. This will
* ensure that the variable is not quoted twice, once by qstr() and
* once by the magic_quotes_gpc.
* Eg. $s = $db->qstr(_GET['name'],get_magic_quotes_gpc());
* Eg. $s = $db->qstr(_GET['name'],0);
* @return string Quoted string
*/
function qstr($s, $magic_quotes = false)

View File

@@ -1495,7 +1495,7 @@ SELECT /*+ RULE */ distinct b.column_name
* An example is $db->qstr("Don't bother",magic_quotes_runtime());
*
* @param string $s the string to quote
* @param bool $magic_quotes if $s is GET/POST var, set to get_magic_quotes_gpc().
* @param bool $magic_quotes if $s is GET/POST var, set to 0.
* This undoes the stupidity of magic quotes for GPC.
*
* @return string quoted string to be sent back to database

View File

@@ -54,13 +54,6 @@ function err($s)
// undo stupid magic quotes
function undomq(&$m)
{
if (get_magic_quotes_gpc()) {
// undo the damage
$m = str_replace('\\\\','\\',$m);
$m = str_replace('\"','"',$m);
$m = str_replace('\\\'','\'',$m);
}
return $m;
}

View File

@@ -31,7 +31,7 @@ class limesurvey_lang {
var $gettextclass;
var $langcode;
function limesurvey_lang($langcode){
function __construct($langcode){
global $rootdir;
$langcode=sanitize_languagecode($langcode);
$streamer = new FileReader($rootdir.'/locale/'.$langcode.'/LC_MESSAGES/'.$langcode.'.mo');

View File

@@ -1010,7 +1010,7 @@
}
$questionNum = $qinfo['qid'];
$type = $qinfo['type'];
$hasSubqs = (isset($qinfo['subqs']) && count($qinfo['subqs'] > 0));
$hasSubqs = (isset($qinfo['subqs']) && is_array($qinfo['subqs']) && count($qinfo['subqs']) > 0);
$qattr = isset($this->qattr[$questionNum]) ? $this->qattr[$questionNum] : array();
if (isset($qattr['input_boxes']) && $qattr['input_boxes'] == '1')
@@ -4727,12 +4727,6 @@
}
// otherwise will already be in yyyy-mm-dd format after ProcessCurrentResponses()
break;
case '|': //File upload
// This block can be removed once we require 5.3 or later
if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) {
$val=addslashes($val);
}
break;
case 'N': //NUMERICAL QUESTION TYPE
case 'K': //MULTIPLE NUMERICAL QUESTION
if (trim($val)=='') {
@@ -7184,7 +7178,7 @@ EOT;
foreach(explode("\n",$tests) as $test)
{
$args = explode("~",$test);
$type = (($args[1]=='expr') ? '*' : ($args[1]=='message') ? 'X' : 'S');
$type = ((($args[1]=='expr') ? '*' : ($args[1]=='message')) ? 'X' : 'S');
$vars[$args[0]] = array('sgqa'=>$args[0], 'code'=>'', 'jsName'=>'java' . $args[0], 'jsName_on'=>'java' . $args[0], 'readWrite'=>'Y', 'type'=>$type, 'relevanceStatus'=>'1', 'gid'=>1, 'gseq'=>1, 'qseq'=>$i, 'qid'=>$i);
$varSeq[] = $args[0];
$testArgs[] = $args;
@@ -7896,7 +7890,7 @@ EOD;
|| ($this->surveyMode=='group' && $gseq != -1 && isset($var['gseq']) && $gseq == $var['gseq'])
|| ($this->surveyMode=='question' && $qseq != -1 && isset($var['qseq']) && $qseq == $var['qseq']))
{
return (isset($var['jsName_on']) ? $var['jsName_on'] : (isset($var['jsName'])) ? $var['jsName'] : $default);
return ((isset($var['jsName_on']) ? $var['jsName_on'] : (isset($var['jsName']))) ? $var['jsName'] : $default);
}
else {
return (isset($var['jsName']) ? $var['jsName'] : $default);

View File

@@ -98,7 +98,7 @@ class gettext_reader {
* @param object Reader the StreamReader object
* @param boolean enable_cache Enable or disable caching of strings (default on)
*/
function gettext_reader($Reader, $enable_cache = true) {
function __construct($Reader, $enable_cache = true) {
// If there isn't a StreamReader, turn on short circuit mode.
if (! $Reader || isset($Reader->error) ) {
$this->short_circuit = true;

View File

@@ -49,7 +49,7 @@ class StringReader {
var $_pos;
var $_str;
function StringReader($str='') {
function __construct($str='') {
$this->_str = $str;
$this->_pos = 0;
}
@@ -86,7 +86,7 @@ class FileReader {
var $_fd;
var $_length;
function FileReader($filename) {
function __construct($filename) {
if (file_exists($filename)) {
$this->_length=filesize($filename);
@@ -143,7 +143,7 @@ class FileReader {
// Preloads entire file in memory first, then creates a StringReader
// over it (it assumes knowledge of StringReader internals)
class CachedFileReader extends StringReader {
function CachedFileReader($filename) {
function __construct($filename) {
if (file_exists($filename)) {
$length=filesize($filename);

View File

@@ -1460,18 +1460,11 @@ class PHPMailer {
if (!is_readable($path)) {
throw new phpmailerException($this->Lang('file_open') . $path, self::STOP_CONTINUE);
}
if (function_exists('get_magic_quotes')) {
function get_magic_quotes() {
return false;
}
}
if (PHP_VERSION < 6) {
$magic_quotes = get_magic_quotes_runtime();
@set_magic_quotes_runtime(0);
$magic_quotes = 0;
}
$file_buffer = file_get_contents($path);
$file_buffer = $this->EncodeString($file_buffer, $encoding);
if (PHP_VERSION < 6) { @set_magic_quotes_runtime($magic_quotes); }
return $file_buffer;
} catch (Exception $e) {
$this->SetError($e->getMessage());
@@ -2316,4 +2309,4 @@ class phpmailerException extends Exception {
return $errorMsg;
}
}
?>
?>