From ead8e5f0ea9914abb7e7e2dc3c6c110e15ab9200 Mon Sep 17 00:00:00 2001 From: Adam Zammit Date: Thu, 28 Jan 2021 14:07:17 +1100 Subject: [PATCH] Fix for warnings/notices/deprecated messages on PHP 7.4 --- admin/availability.php | 4 +- admin/callrestrict.php | 4 +- admin/clients.php | 10 +-- admin/operators.php | 16 ++-- admin/questionnairelist.php | 6 +- admin/shifttemplate.php | 4 +- admin/timezonetemplate.php | 4 +- functions/functions.operator.php | 12 +-- functions/functions.process.php | 2 +- .../limesurvey/admin/activate_functions.php | 4 +- include/limesurvey/admin/assessments.php | 2 +- .../admin/classes/core/class.progressbar.php | 2 +- .../admin/classes/core/settingsstorage.php | 8 +- .../admin/classes/pclzip/pclzip-trace.lib.php | 2 +- .../admin/classes/pclzip/pclzip.lib.php | 2 +- .../classes/pear/Spreadsheet/Excel/Writer.php | 2 +- .../admin/classes/tcpdf/extensiontcpdf.php | 4 +- .../limesurvey/admin/classes/tcpdf/tcpdf.php | 80 +++++++++---------- .../admin/classes/xmlrpc/debugger/common.php | 16 +--- include/limesurvey/admin/database.php | 5 +- include/limesurvey/admin/html.php | 6 +- include/limesurvey/admin/htmleditor-popup.php | 3 +- .../limesurvey/admin/http_importsurvey.php | 5 +- include/limesurvey/admin/labels.php | 17 ---- .../scripts/kcfinder/lib/class_input.php | 4 +- include/limesurvey/admin/templates.php | 8 -- include/limesurvey/admin/tokens.php | 2 +- .../limesurvey/admin/userrighthandling.php | 3 - .../classes/adodb/adodb-csvlib.inc.php | 1 - .../classes/adodb/adodb-perf.inc.php | 12 --- .../classes/adodb/adodb-xmlschema.inc.php | 3 +- .../classes/adodb/adodb-xmlschema03.inc.php | 3 +- .../limesurvey/classes/adodb/adodb.inc.php | 7 +- .../classes/adodb/drivers/adodb-mssql.inc.php | 2 +- .../adodb/drivers/adodb-mysqli.inc.php | 4 +- .../classes/adodb/drivers/adodb-oci8.inc.php | 2 +- include/limesurvey/classes/adodb/server.php | 7 -- include/limesurvey/classes/core/language.php | 2 +- .../expressions/LimeExpressionManager.php | 12 +-- .../classes/php-gettext/gettext.php | 2 +- .../classes/php-gettext/streams.php | 6 +- .../classes/phpmailer/class.phpmailer.php | 11 +-- include/limesurvey/common_functions.php | 38 +++------ include/limesurvey/docs/release_notes.txt | 2 +- include/limesurvey/index.php | 3 +- include/limesurvey/qanda.php | 4 +- include/limesurvey/replacements.php | 20 +++-- include/pear/HTML/QuickForm.php | 2 +- include/pear/PEAR/Config.php | 2 +- include/pear/PEAR/DependencyDB.php | 4 +- include/pear/PEAR/Registry.php | 6 +- include/php-gettext-1.0.11/gettext.php | 2 +- include/php-gettext-1.0.11/streams.php | 6 +- 53 files changed, 152 insertions(+), 248 deletions(-) diff --git a/admin/availability.php b/admin/availability.php index d6a21d99..87daef5d 100644 --- a/admin/availability.php +++ b/admin/availability.php @@ -94,8 +94,8 @@ if (isset($_POST['day'])) $val = intval($val); $key = intval($key); - $start = $db->qstr($_POST['start'][$key],get_magic_quotes_gpc()); - $end = $db->qstr($_POST['end'][$key],get_magic_quotes_gpc()); + $start = $db->qstr($_POST['start'][$key],0); + $end = $db->qstr($_POST['end'][$key],0); $sql = "INSERT INTO availability (day_of_week,start,end,availability_group_id) VALUES ('$val',$start,$end,$availability_group)"; diff --git a/admin/callrestrict.php b/admin/callrestrict.php index 044a3d74..bc205318 100644 --- a/admin/callrestrict.php +++ b/admin/callrestrict.php @@ -88,8 +88,8 @@ if (isset($_POST['day'])) $val = intval($val); $key = intval($key); - $start = $db->qstr($_POST['start'][$key],get_magic_quotes_gpc()); - $end = $db->qstr($_POST['end'][$key],get_magic_quotes_gpc()); + $start = $db->qstr($_POST['start'][$key],0); + $end = $db->qstr($_POST['end'][$key],0); $sql = "INSERT INTO call_restrict (day_of_week,start,end) VALUES ('$val',$start,$end)"; diff --git a/admin/clients.php b/admin/clients.php index 8c478e61..b91290e7 100644 --- a/admin/clients.php +++ b/admin/clients.php @@ -61,11 +61,11 @@ $client =""; $firstname="";$lastname="";$email=""; $time_zone_name=""; if (isset($_POST['client']) && !empty($_POST['client'])) { - $client = $db->qstr($_POST['client'],get_magic_quotes_gpc()); - $firstname = $db->qstr($_POST['firstname'],get_magic_quotes_gpc()); - $email = $db->qstr($_POST['email'],get_magic_quotes_gpc()); - $lastname = $db->qstr($_POST['lastname'],get_magic_quotes_gpc()); - $time_zone_name = $db->qstr($_POST['Time_zone_name'],get_magic_quotes_gpc()); + $client = $db->qstr($_POST['client'],0); + $firstname = $db->qstr($_POST['firstname'],0); + $email = $db->qstr($_POST['email'],0); + $lastname = $db->qstr($_POST['lastname'],0); + $time_zone_name = $db->qstr($_POST['Time_zone_name'],0); /* check if there'a record with this username*/ $sql = "SELECT `username`,`client_id` from client WHERE `username` LIKE $client"; diff --git a/admin/operators.php b/admin/operators.php index 75380c2c..2f851270 100644 --- a/admin/operators.php +++ b/admin/operators.php @@ -56,14 +56,14 @@ $a = false; if (isset($_POST['operator']) && isset($_POST['adduser'])) { - $operator = $db->qstr($_POST['operator'],get_magic_quotes_gpc()); - $email= $db->qstr($_POST['email'],get_magic_quotes_gpc()); - $password = $db->qstr($_POST['password'],get_magic_quotes_gpc()); - $firstname = $db->qstr($_POST['firstname'],get_magic_quotes_gpc()); - $lastname = $db->qstr($_POST['lastname'],get_magic_quotes_gpc()); - $chat_user = $db->qstr($_POST['chat_user'],get_magic_quotes_gpc()); - $chat_password = $db->qstr($_POST['chat_password'],get_magic_quotes_gpc()); - $time_zone_name = $db->qstr($_POST['Time_zone_name'],get_magic_quotes_gpc()); + $operator = $db->qstr($_POST['operator'],0); + $email= $db->qstr($_POST['email'],0); + $password = $db->qstr($_POST['password'],0); + $firstname = $db->qstr($_POST['firstname'],0); + $lastname = $db->qstr($_POST['lastname'],0); + $chat_user = $db->qstr($_POST['chat_user'],0); + $chat_password = $db->qstr($_POST['chat_password'],0); + $time_zone_name = $db->qstr($_POST['Time_zone_name'],0); $extension = ""; if (FREEPBX_PATH != false) { diff --git a/admin/questionnairelist.php b/admin/questionnairelist.php index d5e66aaf..2e4399d6 100644 --- a/admin/questionnairelist.php +++ b/admin/questionnairelist.php @@ -311,9 +311,9 @@ if (isset($_POST['update']) && isset($_GET['modify'])) if ($respsc == 1) { - $lime_mode = $db->qstr($_POST['lime_mode'],get_magic_quotes_gpc()); - $lime_template = $db->qstr($_POST['lime_template'],get_magic_quotes_gpc()); - $lime_endurl = $db->qstr($_POST['lime_endurl'],get_magic_quotes_gpc()); + $lime_mode = $db->qstr($_POST['lime_mode'],0); + $lime_template = $db->qstr($_POST['lime_template'],0); + $lime_endurl = $db->qstr($_POST['lime_endurl'],0); $sql = "UPDATE questionnaire SET lime_mode = $lime_mode, lime_template = $lime_template, lime_endurl = $lime_endurl diff --git a/admin/shifttemplate.php b/admin/shifttemplate.php index f2227093..ce45e1b4 100644 --- a/admin/shifttemplate.php +++ b/admin/shifttemplate.php @@ -85,8 +85,8 @@ if (isset($_POST['day'])) $val = intval($val); $key = intval($key); - $start = $db->qstr($_POST['start'][$key],get_magic_quotes_gpc()); - $end = $db->qstr($_POST['end'][$key],get_magic_quotes_gpc()); + $start = $db->qstr($_POST['start'][$key],0); + $end = $db->qstr($_POST['end'][$key],0); $sql = "INSERT INTO shift_template(day_of_week,start,end) VALUES ($val,$start,$end)"; diff --git a/admin/timezonetemplate.php b/admin/timezonetemplate.php index 75265c7c..0e875fd1 100644 --- a/admin/timezonetemplate.php +++ b/admin/timezonetemplate.php @@ -72,7 +72,7 @@ if (isset($_GET['time_zone'])) { //need to add sample to questionnaire - $tz = $db->qstr($_GET['time_zone'],get_magic_quotes_gpc()); + $tz = $db->qstr($_GET['time_zone'],0); $sql = "INSERT INTO timezone_template(Time_zone_name) VALUES($tz)"; @@ -85,7 +85,7 @@ if (isset($_GET['tz'])) { //need to remove rsid from questionnaire - $tz = $db->qstr($_GET['tz'],get_magic_quotes_gpc()); + $tz = $db->qstr($_GET['tz'],0); $sql = "DELETE FROM timezone_template WHERE Time_zone_name = $tz"; diff --git a/functions/functions.operator.php b/functions/functions.operator.php index 4c8bd44d..258c9819 100644 --- a/functions/functions.operator.php +++ b/functions/functions.operator.php @@ -57,9 +57,9 @@ function sRandomChars($length = 15,$pattern="23456789abcdefghijkmnpqrstuvwxyz") for($i=0;$i<$length;$i++) { if(isset($key)) - $key .= $pattern{mt_rand(0,$patternlength)}; + $key .= $pattern[mt_rand(0,$patternlength)]; else - $key = $pattern{mt_rand(0,$patternlength)}; + $key = $pattern[mt_rand(0,$patternlength)]; } return $key; } @@ -2577,10 +2577,10 @@ function add_respondent($case_id,$firstName,$lastName,$Time_zone_name) { global $db; - $case_id = $db->qstr($case_id,get_magic_quotes_gpc()); - $firstName = $db->qstr($firstName,get_magic_quotes_gpc()); - $lastName = $db->qstr($lastName,get_magic_quotes_gpc()); - $Time_zone_name = $db->qstr($Time_zone_name,get_magic_quotes_gpc()); + $case_id = $db->qstr($case_id,0); + $firstName = $db->qstr($firstName,0); + $lastName = $db->qstr($lastName,0); + $Time_zone_name = $db->qstr($Time_zone_name,0); $sql = "INSERT INTO respondent (respondent_id,case_id,firstName,lastName,Time_zone_name) VALUES (NULL,$case_id,$firstName,$lastName,$Time_zone_name)"; diff --git a/functions/functions.process.php b/functions/functions.process.php index 12388053..678a2f6d 100644 --- a/functions/functions.process.php +++ b/functions/functions.process.php @@ -185,7 +185,7 @@ function process_append_data($process_id,$data) { global $db; - $data = $db->qstr($data,get_magic_quotes_gpc()); + $data = $db->qstr($data,0); $sql = "INSERT INTO `process_log` (process_log_id,process_id,datetime,data) VALUES (NULL,'$process_id',NOW(),$data)"; diff --git a/include/limesurvey/admin/activate_functions.php b/include/limesurvey/admin/activate_functions.php index bc78b907..1998fc32 100644 --- a/include/limesurvey/admin/activate_functions.php +++ b/include/limesurvey/admin/activate_functions.php @@ -241,8 +241,8 @@ function checkQuestions($postsid, $surveyid, $qtypes) } $fieldlist=array_reverse($fieldlist); //let's always change the later duplicate, not the earlier one } - $checkKeysUniqueComparison = create_function('$value','if ($value > 1) return true;'); - @$duplicates = array_keys (array_filter (array_count_values($fieldlist), $checkKeysUniqueComparison)); + //$checkKeysUniqueComparison = create_function('$value','if ($value > 1) return true;'); + @$duplicates = array_keys (array_filter (array_count_values($fieldlist), function($k) { if ($k > 1) return true; })); if (isset($duplicates)) { foreach ($duplicates as $dup) diff --git a/include/limesurvey/admin/assessments.php b/include/limesurvey/admin/assessments.php index 70bb06ea..e403bb36 100644 --- a/include/limesurvey/admin/assessments.php +++ b/include/limesurvey/admin/assessments.php @@ -59,7 +59,7 @@ if ($action == "assessmentadd" && bHasSurveyPermission($surveyid, 'assessments', $datarray['id']=$aid; } - $query = $connect->GetInsertSQL($inserttable, $datarray, get_magic_quotes_gpc()); + $query = $connect->GetInsertSQL($inserttable, $datarray, 0); $result=$connect->Execute($query) or safe_die("Error inserting
$query
".$connect->ErrorMsg()); if ($first==true) { diff --git a/include/limesurvey/admin/classes/core/class.progressbar.php b/include/limesurvey/admin/classes/core/class.progressbar.php index c396ba4d..7a766c18 100644 --- a/include/limesurvey/admin/classes/core/class.progressbar.php +++ b/include/limesurvey/admin/classes/core/class.progressbar.php @@ -63,7 +63,7 @@ class ProgressBar // constructor - function ProgressBar($width=0,$height=0) + function __construct($width=0,$height=0) { $this->code = substr(md5(microtime()), 0, 6); if ($width>0) {$this->width = $width;} diff --git a/include/limesurvey/admin/classes/core/settingsstorage.php b/include/limesurvey/admin/classes/core/settingsstorage.php index d3bb7c11..07df1667 100644 --- a/include/limesurvey/admin/classes/core/settingsstorage.php +++ b/include/limesurvey/admin/classes/core/settingsstorage.php @@ -46,9 +46,13 @@ final class SettingsStorage extends ArrayObject */ public function offsetExists($index) { - return array_key_exists($index, $this); + if (is_array($this)) { + return array_key_exists($index, $this); + } else if (is_object($this)) { + return property_exists('SettingsStorage', $index); + } else return false; } } -?> \ No newline at end of file +?> diff --git a/include/limesurvey/admin/classes/pclzip/pclzip-trace.lib.php b/include/limesurvey/admin/classes/pclzip/pclzip-trace.lib.php index ec1f21d3..fcf0b0cb 100644 --- a/include/limesurvey/admin/classes/pclzip/pclzip-trace.lib.php +++ b/include/limesurvey/admin/classes/pclzip/pclzip-trace.lib.php @@ -5955,7 +5955,7 @@ class PclZip } // ----- Get and memorize the magic_quote value - $this->magic_quotes_status = @get_magic_quotes_runtime(); + $this->magic_quotes_status = @0; PclTraceFctMessage(__FILE__, __LINE__, 3, "Current magic_quotes_runtime status is '".($this->magic_quotes_status==0?'disable':'enable')."'"); // ----- Disable magic_quotes diff --git a/include/limesurvey/admin/classes/pclzip/pclzip.lib.php b/include/limesurvey/admin/classes/pclzip/pclzip.lib.php index 7e96630b..1f452e27 100644 --- a/include/limesurvey/admin/classes/pclzip/pclzip.lib.php +++ b/include/limesurvey/admin/classes/pclzip/pclzip.lib.php @@ -5316,7 +5316,7 @@ class PclZip } // ----- Get and memorize the magic_quote value - $this->magic_quotes_status = @get_magic_quotes_runtime(); + $this->magic_quotes_status = @0; // ----- Disable magic_quotes if ($this->magic_quotes_status == 1) { diff --git a/include/limesurvey/admin/classes/pear/Spreadsheet/Excel/Writer.php b/include/limesurvey/admin/classes/pear/Spreadsheet/Excel/Writer.php index 7f6ef067..07fe46c5 100644 --- a/include/limesurvey/admin/classes/pear/Spreadsheet/Excel/Writer.php +++ b/include/limesurvey/admin/classes/pear/Spreadsheet/Excel/Writer.php @@ -51,7 +51,7 @@ class Spreadsheet_Excel_Writer extends Spreadsheet_Excel_Writer_Workbook * @param string $filename The optional filename for the Workbook. * @return Spreadsheet_Excel_Writer_Workbook The Workbook created */ - function Spreadsheet_Excel_Writer($filename = '') + function __construct($filename = '') { $this->_filename = $filename; $this->Spreadsheet_Excel_Writer_Workbook($filename); diff --git a/include/limesurvey/admin/classes/tcpdf/extensiontcpdf.php b/include/limesurvey/admin/classes/tcpdf/extensiontcpdf.php index 13bd077c..260de7d2 100644 --- a/include/limesurvey/admin/classes/tcpdf/extensiontcpdf.php +++ b/include/limesurvey/admin/classes/tcpdf/extensiontcpdf.php @@ -4,7 +4,7 @@ require_once('tcpdf.php'); class PDF extends TCPDF { - function PDF($orientation='L', $unit='mm', $format='A4') + function __construct($orientation='L', $unit='mm', $format='A4') { parent::__construct($orientation,$unit,$format); $this->SetAutoPageBreak(true,10); @@ -105,4 +105,4 @@ class PDF extends TCPDF return strip_tags($text); } } -?> \ No newline at end of file +?> diff --git a/include/limesurvey/admin/classes/tcpdf/tcpdf.php b/include/limesurvey/admin/classes/tcpdf/tcpdf.php index 984e4b5b..609ada36 100644 --- a/include/limesurvey/admin/classes/tcpdf/tcpdf.php +++ b/include/limesurvey/admin/classes/tcpdf/tcpdf.php @@ -2872,7 +2872,7 @@ class TCPDF { if (empty($orientation)) { $orientation = $default_orientation; } else { - $orientation = strtoupper($orientation{0}); + $orientation = strtoupper($orientation[0]); } if (in_array($orientation, $valid_orientations) AND ($orientation != $default_orientation)) { $this->CurOrientation = $orientation; @@ -3324,7 +3324,7 @@ class TCPDF { $slen = strlen($brd); $newbrd = array(); for ($i = 0; $i < $slen; ++$i) { - $newbrd[$brd{$i}] = true; + $newbrd[$brd[$i]] = true; } $brd = $newbrd; } elseif (($brd === 1) OR ($brd === true) OR (is_numeric($brd) AND (intval($brd) > 0))) { @@ -5757,7 +5757,7 @@ class TCPDF { $slen = strlen($brd); $newbrd = array(); for ($i = 0; $i < $slen; ++$i) { - $newbrd[$brd{$i}] = array('cap' => 'square', 'join' => 'miter'); + $newbrd[$brd[$i]] = array('cap' => 'square', 'join' => 'miter'); } $brd = $newbrd; } @@ -6260,7 +6260,7 @@ class TCPDF { $slen = strlen($brd); $newbrd = array(); for ($i = 0; $i < $slen; ++$i) { - $newbrd[$brd{$i}] = array('cap' => 'square', 'join' => 'miter'); + $newbrd[$brd[$i]] = array('cap' => 'square', 'join' => 'miter'); } $brd = $newbrd; } @@ -7343,7 +7343,7 @@ class TCPDF { public function set_mqr($mqr) { if(!defined('PHP_VERSION_ID')) { $version = PHP_VERSION; - define('PHP_VERSION_ID', (($version{0} * 10000) + ($version{2} * 100) + $version{4})); + define('PHP_VERSION_ID', (($version[0] * 10000) + ($version[2] * 100) + $version[4])); } if (PHP_VERSION_ID < 50300) { @set_magic_quotes_runtime($mqr); @@ -7358,10 +7358,10 @@ class TCPDF { public function get_mqr() { if(!defined('PHP_VERSION_ID')) { $version = PHP_VERSION; - define('PHP_VERSION_ID', (($version{0} * 10000) + ($version{2} * 100) + $version{4})); + define('PHP_VERSION_ID', (($version[0] * 10000) + ($version[2] * 100) + $version[4])); } if (PHP_VERSION_ID < 50300) { - return @get_magic_quotes_runtime(); + return @0; } return 0; } @@ -7834,7 +7834,7 @@ class TCPDF { $dest = $dest ? 'D' : 'F'; } $dest = strtoupper($dest); - if ($dest{0} != 'F') { + if ($dest[0] != 'F') { $name = preg_replace('/[\s]+/', '_', $name); $name = preg_replace('/[^a-zA-Z0-9_\.-]/', '', $name); } @@ -9520,12 +9520,12 @@ class TCPDF { $font = file_get_contents($fontfile); $compressed = (substr($file, -2) == '.z'); if ((!$compressed) AND (isset($info['length2']))) { - $header = (ord($font{0}) == 128); + $header = (ord($font[0]) == 128); if ($header) { //Strip first binary header $font = substr($font, 6); } - if ($header AND (ord($font{$info['length1']}) == 128)) { + if ($header AND (ord($font[$info['length1']]) == 128)) { //Strip second binary header $font = substr($font, 0, $info['length1']).substr($font, ($info['length1'] + 6)); } @@ -10990,7 +10990,7 @@ class TCPDF { $strarr = array(); $strlen = strlen($str); for ($i=0; $i < $strlen; ++$i) { - $strarr[] = ord($str{$i}); + $strarr[] = ord($str[$i]); } // insert new value on cache $this->cache_UTF8StringToArray[$strkey]['s'] = $strarr; @@ -11004,7 +11004,7 @@ class TCPDF { $str .= ''; // force $str to be a string $length = strlen($str); for ($i = 0; $i < $length; ++$i) { - $char = ord($str{$i}); // get one string character at time + $char = ord($str[$i]); // get one string character at time if (count($bytes) == 0) { // get starting octect if ($char <= 0x7F) { $unichar = $char; // use the character "as is" because is ASCII @@ -11286,7 +11286,7 @@ class TCPDF { * @access public */ public function addHtmlLink($url, $name, $fill=false, $firstline=false, $color='', $style=-1, $firstblock=false) { - if (!$this->empty_string($url) AND ($url{0} == '#')) { + if (!$this->empty_string($url) AND ($url[0] == '#')) { // convert url to internal link $lnkdata = explode(',', $url); if (isset($lnkdata[0])) { @@ -11645,7 +11645,7 @@ class TCPDF { $j = 0; for ($i = 0; $i < 256; ++$i) { $t = $rc4[$i]; - $j = ($j + $t + ord($k{$i})) % 256; + $j = ($j + $t + ord($k[$i])) % 256; $rc4[$i] = $rc4[$j]; $rc4[$j] = $t; } @@ -11665,7 +11665,7 @@ class TCPDF { $rc4[$a] = $rc4[$b]; $rc4[$b] = $t; $k = $rc4[($rc4[$a] + $rc4[$b]) % 256]; - $out .= chr(ord($text{$i}) ^ $k); + $out .= chr(ord($text[$i]) ^ $k); } return $out; } @@ -11719,7 +11719,7 @@ class TCPDF { for ($i = 1; $i <= 19; ++$i) { $ek = ''; for ($j = 0; $j < $len; ++$j) { - $ek .= chr(ord($this->encryptdata['key']{$j}) ^ $i); + $ek .= chr(ord($this->encryptdata['key'][$j]) ^ $i); } $enc = $this->_RC4($ek, $enc); } @@ -11770,7 +11770,7 @@ class TCPDF { for ($i = 1; $i <= 19; ++$i) { $ek = ''; for ($j = 0; $j < $len; ++$j) { - $ek .= chr(ord($owner_key{$j}) ^ $i); + $ek .= chr(ord($owner_key[$j]) ^ $i); } $enc = $this->_RC4($ek, $enc); } @@ -12084,7 +12084,7 @@ class TCPDF { ++$bslenght; } for ($i = 0; $i < $bslenght; $i += 2) { - $string .= chr(hexdec($bs{$i}.$bs{($i + 1)})); + $string .= chr(hexdec($bs[$i].$bs[($i + 1)])); } return $string; } @@ -16410,7 +16410,7 @@ class TCPDF { $cnt = count($lines); for ($i=0; $i < $cnt; ++$i) { $line = $lines[$i]; - if (($line == '') OR ($line{0} == '%')) { + if (($line == '') OR ($line[0] == '%')) { continue; } $len = strlen($line); @@ -16460,7 +16460,7 @@ class TCPDF { case 'V': case 'L': case 'C': { - $line{$len-1} = strtolower($cmd); + $line[$len-1] = strtolower($cmd); $this->_out($line); break; } @@ -17383,7 +17383,7 @@ class TCPDF { $attrib = strtolower(trim($attrib[0])); if (!empty($attrib)) { // check if matches class, id, attribute, pseudo-class or pseudo-element - switch ($attrib{0}) { + switch ($attrib[0]) { case '.': { // class if (in_array(substr($attrib, 1), $class)) { $valid = true; @@ -17450,7 +17450,7 @@ class TCPDF { break; } case ':': { // pseudo-class or pseudo-element - if ($attrib{1} == ':') { // pseudo-element + if ($attrib[1] == ':') { // pseudo-element // pseudo-elements are not supported! // (::first-line, ::first-letter, ::before, ::after) } else { // pseudo-class @@ -18075,7 +18075,7 @@ class TCPDF { $tagname = strtolower($tag[1]); // check if we are inside a table header if ($tagname == 'thead') { - if ($element{0} == '/') { + if ($element[0] == '/') { $thead = false; } else { $thead = true; @@ -18090,7 +18090,7 @@ class TCPDF { } else { $dom[$key]['block'] = false; } - if ($element{0} == '/') { + if ($element[0] == '/') { // *** closing html tag $dom[$key]['opening'] = false; $dom[$key]['parent'] = end($level); @@ -18296,10 +18296,10 @@ class TCPDF { } } // font style - if (isset($dom[$key]['style']['font-weight']) AND (strtolower($dom[$key]['style']['font-weight']{0}) == 'b')) { + if (isset($dom[$key]['style']['font-weight']) AND (strtolower($dom[$key]['style']['font-weight'][0]) == 'b')) { $dom[$key]['fontstyle'] .= 'B'; } - if (isset($dom[$key]['style']['font-style']) AND (strtolower($dom[$key]['style']['font-style']{0}) == 'i')) { + if (isset($dom[$key]['style']['font-style']) AND (strtolower($dom[$key]['style']['font-style'][0]) == 'i')) { $dom[$key]['fontstyle'] .= 'I'; } // font color @@ -18318,13 +18318,13 @@ class TCPDF { foreach ($decors as $dec) { $dec = trim($dec); if (!$this->empty_string($dec)) { - if ($dec{0} == 'u') { + if ($dec[0] == 'u') { // underline $dom[$key]['fontstyle'] .= 'U'; - } elseif ($dec{0} == 'l') { + } elseif ($dec[0] == 'l') { // line-trough $dom[$key]['fontstyle'] .= 'D'; - } elseif ($dec{0} == 'o') { + } elseif ($dec[0] == 'o') { // overline $dom[$key]['fontstyle'] .= 'O'; } @@ -18343,7 +18343,7 @@ class TCPDF { } // check for text alignment if (isset($dom[$key]['style']['text-align'])) { - $dom[$key]['align'] = strtoupper($dom[$key]['style']['text-align']{0}); + $dom[$key]['align'] = strtoupper($dom[$key]['style']['text-align'][0]); } // check for CSS border properties if (isset($dom[$key]['style']['border'])) { @@ -18504,9 +18504,9 @@ class TCPDF { // font size if (isset($dom[$key]['attribute']['size'])) { if ($key > 0) { - if ($dom[$key]['attribute']['size']{0} == '+') { + if ($dom[$key]['attribute']['size'][0] == '+') { $dom[$key]['fontsize'] = $dom[($dom[$key]['parent'])]['fontsize'] + intval(substr($dom[$key]['attribute']['size'], 1)); - } elseif ($dom[$key]['attribute']['size']{0} == '-') { + } elseif ($dom[$key]['attribute']['size'][0] == '-') { $dom[$key]['fontsize'] = $dom[($dom[$key]['parent'])]['fontsize'] - intval(substr($dom[$key]['attribute']['size'], 1)); } else { $dom[$key]['fontsize'] = intval($dom[$key]['attribute']['size']); @@ -18548,10 +18548,10 @@ class TCPDF { if (($dom[$key]['value'] == 'pre') OR ($dom[$key]['value'] == 'tt')) { $dom[$key]['fontname'] = $this->default_monospaced_font; } - if (($dom[$key]['value']{0} == 'h') AND (intval($dom[$key]['value']{1}) > 0) AND (intval($dom[$key]['value']{1}) < 7)) { + if (($dom[$key]['value'][0] == 'h') AND (intval($dom[$key]['value'][1]) > 0) AND (intval($dom[$key]['value'][1]) < 7)) { // headings h1, h2, h3, h4, h5, h6 if (!isset($dom[$key]['attribute']['size']) AND !isset($dom[$key]['style']['font-size'])) { - $headsize = (4 - intval($dom[$key]['value']{1})) * 2; + $headsize = (4 - intval($dom[$key]['value'][1])) * 2; $dom[$key]['fontsize'] = $dom[0]['fontsize'] + $headsize; } if (!isset($dom[$key]['style']['font-weight'])) { @@ -18613,7 +18613,7 @@ class TCPDF { } // check for text alignment if (isset($dom[$key]['attribute']['align']) AND (!$this->empty_string($dom[$key]['attribute']['align'])) AND ($dom[$key]['value'] !== 'img')) { - $dom[$key]['align'] = strtoupper($dom[$key]['attribute']['align']{0}); + $dom[$key]['align'] = strtoupper($dom[$key]['attribute']['align'][0]); } // check for text rendering mode (the following attributes do not exist in HTML) if (isset($dom[$key]['attribute']['stroke'])) { @@ -19268,7 +19268,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: if (($stroffset !== false) AND ($stroffset <= $strpiece[2][1])) { // set offset to the end of string section $offset = strpos($pmid, ')]', $stroffset); - while (($offset !== false) AND ($pmid{($offset - 1)} == '\\')) { + while (($offset !== false) AND ($pmid[($offset - 1)] == '\\')) { $offset = strpos($pmid, ')]', ($offset + 1)); } if ($offset === false) { @@ -19327,7 +19327,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: // justify block if (!$this->empty_string($this->lispacer)) { $this->lispacer = ''; - continue; + continue 2; } preg_match('/([0-9\.\+\-]*)[\s]([0-9\.\+\-]*)[\s]([0-9\.\+\-]*)[\s]('.$strpiece[1][0].')[\s](re)([\s]*)/x', $pmid, $xmatches); $currentxpos = $xmatches[1]; @@ -20330,7 +20330,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $imglink = ''; if (isset($this->HREF['url']) AND !$this->empty_string($this->HREF['url'])) { $imglink = $this->HREF['url']; - if ($imglink{0} == '#') { + if ($imglink[0] == '#') { // convert url to internal link $lnkdata = explode(',', $imglink); if (isset($lnkdata[0])) { @@ -25501,11 +25501,11 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $this->SVGTransform($tm); $obstyle = $this->setSVGStyles($svgstyle, $prev_svgstyle, $x, $y, $w, $h); // fix image path - if (!$this->empty_string($this->svgdir) AND (($img{0} == '.') OR (basename($img) == $img))) { + if (!$this->empty_string($this->svgdir) AND (($img[0] == '.') OR (basename($img) == $img))) { // replace relative path with full server path $img = $this->svgdir.'/'.$img; } - if (($img{0} == '/') AND ($_SERVER['DOCUMENT_ROOT'] != '/')) { + if (($img[0] == '/') AND ($_SERVER['DOCUMENT_ROOT'] != '/')) { $findroot = strpos($img, $_SERVER['DOCUMENT_ROOT']); if (($findroot === false) OR ($findroot > 1)) { // replace relative path with full server path diff --git a/include/limesurvey/admin/classes/xmlrpc/debugger/common.php b/include/limesurvey/admin/classes/xmlrpc/debugger/common.php index 4abcfcf8..46a1207a 100644 --- a/include/limesurvey/admin/classes/xmlrpc/debugger/common.php +++ b/include/limesurvey/admin/classes/xmlrpc/debugger/common.php @@ -10,20 +10,6 @@ */ // work around magic quotes - if (get_magic_quotes_gpc()) - { - function stripslashes_deep($value) - { - $value = is_array($value) ? - array_map('stripslashes_deep', $value) : - stripslashes($value); - - return $value; - } - $_GET = array_map('stripslashes_deep', $_GET); - } - - if ( isset( $_GET['usepost'] ) && $_GET['usepost'] === 'true' ) { $_GET = $_POST; @@ -132,4 +118,4 @@ { return true; } -?> \ No newline at end of file +?> diff --git a/include/limesurvey/admin/database.php b/include/limesurvey/admin/database.php index 32405341..9ec4d95a 100644 --- a/include/limesurvey/admin/database.php +++ b/include/limesurvey/admin/database.php @@ -23,9 +23,6 @@ $postgid=returnglobal('gid'); $postqid=returnglobal('qid'); $postqaid=returnglobal('qaid'); -if (get_magic_quotes_gpc()) -{$_POST = array_map('recursive_stripslashes', $_POST);} - /** @@ -1131,7 +1128,7 @@ if(isset($surveyid)) 'tokenlength'=>$_POST['tokenlength'] ); - $usquery=$connect->GetUpdateSQL($rs, $updatearray, false, get_magic_quotes_gpc()); + $usquery=$connect->GetUpdateSQL($rs, $updatearray, false, 0); if ($usquery) { $usresult = $connect->Execute($usquery) or safe_die("Error updating
".$usquery."

".$connect->ErrorMsg()); // Checked } diff --git a/include/limesurvey/admin/html.php b/include/limesurvey/admin/html.php index ec069712..c3707134 100644 --- a/include/limesurvey/admin/html.php +++ b/include/limesurvey/admin/html.php @@ -280,8 +280,12 @@ $action!='vvimport' && $action!='vvexport' && $action!='exportresults') rsort($tmp_survlangs); if (count($tmp_survlangs) == 1) { + $interviewer = ""; + if (isset($_SESSION['interviewer'])) { + $interviewer = "interviewer=" . $_SESSION['interviewer'] . "&"; + } $surveysummary .= "
  • " + . $publicurl."/index.php?sid={$surveyid}&" . $interviewer . "newtest=Y&lang={$baselang}', '_blank')\" title=\"{$icontext2}\" >" . "{$icontext}" . "
  • \n"; diff --git a/include/limesurvey/admin/htmleditor-popup.php b/include/limesurvey/admin/htmleditor-popup.php index 8f069637..ec4d4f8e 100644 --- a/include/limesurvey/admin/htmleditor-popup.php +++ b/include/limesurvey/admin/htmleditor-popup.php @@ -64,7 +64,6 @@ else { $fieldname=$oFilter->process($_GET['fieldname']); $fieldtext=$oFilter->process($_GET['fieldtext']); - if (get_magic_quotes_gpc()) $fieldtext = stripslashes($fieldtext); $controlidena=$_GET['fieldname'].'_popupctrlena'; $controliddis=$_GET['fieldname'].'_popupctrldis'; @@ -192,4 +191,4 @@ else { echo $output; -// Yes, closing PHP tag was intentionally left out \ No newline at end of file +// Yes, closing PHP tag was intentionally left out diff --git a/include/limesurvey/admin/http_importsurvey.php b/include/limesurvey/admin/http_importsurvey.php index c4ee9f17..91073053 100644 --- a/include/limesurvey/admin/http_importsurvey.php +++ b/include/limesurvey/admin/http_importsurvey.php @@ -76,10 +76,7 @@ elseif ($action == 'copysurvey') { $surveyid = sanitize_int($_POST['copysurveylist']); $exclude = array(); - if (get_magic_quotes_gpc()) {$sNewSurveyName = stripslashes($_POST['copysurveyname']);} - else{ - $sNewSurveyName=$_POST['copysurveyname']; - } + $sNewSurveyName=$_POST['copysurveyname']; require_once("../classes/inputfilter/class.inputfilter_clean.php"); $myFilter = new InputFilter('','',1,1,1); diff --git a/include/limesurvey/admin/labels.php b/include/limesurvey/admin/labels.php index 1913c64b..7a4f3129 100644 --- a/include/limesurvey/admin/labels.php +++ b/include/limesurvey/admin/labels.php @@ -20,12 +20,7 @@ include_once("login_check.php"); //Login Check dies also if the script is start // Do not stripslashes on POSted fields because labels.php uses db_quoteall($str, $ispostvariable) that checks for magic_quotes_gpc // However We need to stripslashes from $_POST['method'] compared to // unescaped strings in switch case -//if (get_magic_quotes_gpc()) //$_POST = array_map('stripslashes', $_POST); -if (isset($_POST['method']) && get_magic_quotes_gpc()) -{ - $_POST['method'] = stripslashes($_POST['method']); -} $labelsoutput=''; if($_SESSION['USER_RIGHT_SUPERADMIN'] == 1 || $_SESSION['USER_RIGHT_MANAGE_LABEL'] == 1) @@ -600,14 +595,7 @@ function modlabelsetanswers($lid) $sPostData=html_entity_decode($_POST['dataToSend'], ENT_QUOTES, "UTF-8"); $sPostData=str_replace("\t", '', $sPostData); - if (get_magic_quotes_gpc()) - { - $data = json_decode(stripslashes($sPostData)); - } - else - { $data = json_decode($sPostData); - } if ($ajax){ @@ -657,11 +645,6 @@ function modlabelsetanswers($lid) $lang = db_quoteall($lang); $title = trim($title, "'"); - if (get_magic_quotes_gpc()) - { - $title = str_replace("'","\'",$title); - } - $query = "INSERT INTO ".db_table_name('labels')." (lid,code,title,sortorder, assessment_value, language) VALUES({$lid},{$actualcode},'".$title."',{$sort_order},{$assessmentvalue},{$lang})"; diff --git a/include/limesurvey/admin/scripts/kcfinder/lib/class_input.php b/include/limesurvey/admin/scripts/kcfinder/lib/class_input.php index d0545345..1cd99094 100644 --- a/include/limesurvey/admin/scripts/kcfinder/lib/class_input.php +++ b/include/limesurvey/admin/scripts/kcfinder/lib/class_input.php @@ -35,7 +35,7 @@ class input { protected $magic_quotes_sybase; public function __construct() { - $this->magic_quotes_gpc = function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc(); + $this->magic_quotes_gpc = 0; $this->magic_quotes_sybase = ini_get('magic_quotes_sybase'); $this->magic_quotes_sybase = $this->magic_quotes_sybase ? !in_array(strtolower(trim($this->magic_quotes_sybase)), @@ -83,4 +83,4 @@ class input { } } -?> \ No newline at end of file +?> diff --git a/include/limesurvey/admin/templates.php b/include/limesurvey/admin/templates.php index 91ee477d..7f61e613 100644 --- a/include/limesurvey/admin/templates.php +++ b/include/limesurvey/admin/templates.php @@ -164,19 +164,11 @@ else {$codelanguage='en';} if (isset ($_POST['changes'])) { $changedtext=$_POST['changes']; $changedtext=str_replace ('AutoExecute("{$dbprefix}surveys", $fieldvalue, 2,"sid=$surveyid",get_magic_quotes_gpc()); + $connect->AutoExecute("{$dbprefix}surveys", $fieldvalue, 2,"sid=$surveyid",0); $tokenoutput .= "
    ".$clang->gT("Bounce settings")."
    \n" ."
    " ."\t
    ".$clang->gT("Bounce settings have been saved.")."
    \n" diff --git a/include/limesurvey/admin/userrighthandling.php b/include/limesurvey/admin/userrighthandling.php index 9819cc23..399ef44d 100644 --- a/include/limesurvey/admin/userrighthandling.php +++ b/include/limesurvey/admin/userrighthandling.php @@ -18,9 +18,6 @@ if (!isset($dbprefix) || isset($_REQUEST['dbprefix'])) {die("Cannot run this scr if (isset($_POST['uid'])) {$postuserid=intval($_POST['uid']);} if (isset($_POST['ugid'])) {$postusergroupid=intval($_POST['ugid']);} -if (get_magic_quotes_gpc()) -{$_POST = array_map('recursive_stripslashes', $_POST);} - $js_admin_includes[]='../scripts/jquery/jquery.tablesorter.min.js'; $js_admin_includes[]='scripts/users.js'; diff --git a/include/limesurvey/classes/adodb/adodb-csvlib.inc.php b/include/limesurvey/classes/adodb/adodb-csvlib.inc.php index 0e80e0c5..75214a0d 100644 --- a/include/limesurvey/classes/adodb/adodb-csvlib.inc.php +++ b/include/limesurvey/classes/adodb/adodb-csvlib.inc.php @@ -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(); diff --git a/include/limesurvey/classes/adodb/adodb-perf.inc.php b/include/limesurvey/classes/adodb/adodb-perf.inc.php index 42ad7143..e333e95c 100644 --- a/include/limesurvey/classes/adodb/adodb-perf.inc.php +++ b/include/limesurvey/classes/adodb/adodb-perf.inc.php @@ -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; } diff --git a/include/limesurvey/classes/adodb/adodb-xmlschema.inc.php b/include/limesurvey/classes/adodb/adodb-xmlschema.inc.php index 08901550..e70d1c6f 100644 --- a/include/limesurvey/classes/adodb/adodb-xmlschema.inc.php +++ b/include/limesurvey/classes/adodb/adodb-xmlschema.inc.php @@ -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; diff --git a/include/limesurvey/classes/adodb/adodb-xmlschema03.inc.php b/include/limesurvey/classes/adodb/adodb-xmlschema03.inc.php index 45a59bbf..0a8e9511 100644 --- a/include/limesurvey/classes/adodb/adodb-xmlschema03.inc.php +++ b/include/limesurvey/classes/adodb/adodb-xmlschema03.inc.php @@ -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; diff --git a/include/limesurvey/classes/adodb/adodb.inc.php b/include/limesurvey/classes/adodb/adodb.inc.php index 5207cc04..74880233 100644 --- a/include/limesurvey/classes/adodb/adodb.inc.php +++ b/include/limesurvey/classes/adodb/adodb.inc.php @@ -834,7 +834,7 @@ if (!defined('_ADODB_LAYER')) { * Requested by "Karsten Dambekalns" */ 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 diff --git a/include/limesurvey/classes/adodb/drivers/adodb-mssql.inc.php b/include/limesurvey/classes/adodb/drivers/adodb-mssql.inc.php index fb87a4ac..43902233 100644 --- a/include/limesurvey/classes/adodb/drivers/adodb-mssql.inc.php +++ b/include/limesurvey/classes/adodb/drivers/adodb-mssql.inc.php @@ -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 diff --git a/include/limesurvey/classes/adodb/drivers/adodb-mysqli.inc.php b/include/limesurvey/classes/adodb/drivers/adodb-mysqli.inc.php index 82899ec0..28b05dd5 100644 --- a/include/limesurvey/classes/adodb/drivers/adodb-mysqli.inc.php +++ b/include/limesurvey/classes/adodb/drivers/adodb-mysqli.inc.php @@ -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) diff --git a/include/limesurvey/classes/adodb/drivers/adodb-oci8.inc.php b/include/limesurvey/classes/adodb/drivers/adodb-oci8.inc.php index 48f9107b..2a1002e4 100644 --- a/include/limesurvey/classes/adodb/drivers/adodb-oci8.inc.php +++ b/include/limesurvey/classes/adodb/drivers/adodb-oci8.inc.php @@ -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 diff --git a/include/limesurvey/classes/adodb/server.php b/include/limesurvey/classes/adodb/server.php index 227bb8b2..9954cbce 100644 --- a/include/limesurvey/classes/adodb/server.php +++ b/include/limesurvey/classes/adodb/server.php @@ -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; } diff --git a/include/limesurvey/classes/core/language.php b/include/limesurvey/classes/core/language.php index 3078eab9..88390d0e 100644 --- a/include/limesurvey/classes/core/language.php +++ b/include/limesurvey/classes/core/language.php @@ -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'); diff --git a/include/limesurvey/classes/expressions/LimeExpressionManager.php b/include/limesurvey/classes/expressions/LimeExpressionManager.php index 4e55d0a0..7913cd16 100644 --- a/include/limesurvey/classes/expressions/LimeExpressionManager.php +++ b/include/limesurvey/classes/expressions/LimeExpressionManager.php @@ -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); diff --git a/include/limesurvey/classes/php-gettext/gettext.php b/include/limesurvey/classes/php-gettext/gettext.php index 5064047c..81af5550 100644 --- a/include/limesurvey/classes/php-gettext/gettext.php +++ b/include/limesurvey/classes/php-gettext/gettext.php @@ -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; diff --git a/include/limesurvey/classes/php-gettext/streams.php b/include/limesurvey/classes/php-gettext/streams.php index 3cdc1584..00cf6cc5 100644 --- a/include/limesurvey/classes/php-gettext/streams.php +++ b/include/limesurvey/classes/php-gettext/streams.php @@ -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); diff --git a/include/limesurvey/classes/phpmailer/class.phpmailer.php b/include/limesurvey/classes/phpmailer/class.phpmailer.php index 144892c8..619c928c 100644 --- a/include/limesurvey/classes/phpmailer/class.phpmailer.php +++ b/include/limesurvey/classes/phpmailer/class.phpmailer.php @@ -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; } } -?> \ No newline at end of file +?> diff --git a/include/limesurvey/common_functions.php b/include/limesurvey/common_functions.php index 72e6ce8a..52e6cd18 100644 --- a/include/limesurvey/common_functions.php +++ b/include/limesurvey/common_functions.php @@ -436,7 +436,7 @@ function db_quote($str,$ispostvar=false) // This functions escapes the string only inside { global $connect; - if ($ispostvar) { return $connect->escape($str, get_magic_quotes_gpc());} + if ($ispostvar) { return $connect->escape($str, 0);} else {return $connect->escape($str);} } @@ -445,7 +445,7 @@ function db_quoteall($str,$ispostvar=false) // IF you are quoting a variable from a POST/GET then set $ispostvar to true so it doesnt get quoted twice. { global $connect; - if ($ispostvar) { return $connect->qstr($str, get_magic_quotes_gpc());} + if ($ispostvar) { return $connect->qstr($str, 0);} else {return $connect->qstr($str);} } @@ -4161,27 +4161,11 @@ function CategorySort($a, $b) return $result; } -if (!function_exists('get_magic_quotes_gpc')) { - /** - * Gets the current configuration setting of magic_quotes_gpc - * NOTE: Compat variant for PHP 6+ versions - * - * @link http://www.php.net/manual/en/function.get-magic-quotes-gpc.php - * @return int 0 if magic_quotes_gpc is off, 1 otherwise. - */ - function get_magic_quotes_gpc() { - return 0; - } -} - // make sure the given string (which comes from a POST or GET variable) // is safe to use in MySQL. This does nothing if gpc_magic_quotes is on. function auto_escape($str) { global $connect; - if (!get_magic_quotes_gpc()) { - return $connect->escape($str); - } - return $str; + return $connect->escape($str); } // the opposite of the above: takes a POST or GET variable which may or // may not have been 'auto-quoted', and return the *unquoted* version. @@ -4189,10 +4173,7 @@ function auto_escape($str) { // a SQL query. function auto_unescape($str) { if (!isset($str)) {return null;}; - if (!get_magic_quotes_gpc()) { - return $str; - } - return stripslashes($str); + return $str; } // make a string safe to include in an HTML 'value' attribute. function html_escape($str) { @@ -4235,7 +4216,7 @@ function getHeader($meta = false) if (!isset($_SESSION['interviewer'])) { $_SESSION['interviewer'] = $interviewer; } - if ($SESSION['interviewer']) + if ($_SESSION['interviewer']) { $js_header_includes[] = '/../../js/popup.js'; //queXS Addition include_once("quexs.php"); @@ -4565,7 +4546,6 @@ function SendEmailMessage($mail, $body, $subject, $to, $from, $sitename, $ishtml } } $mail->AddCustomHeader("X-Surveymailer: $sitename Emailer (LimeSurvey.sourceforge.net)"); - if (get_magic_quotes_gpc() != "0") {$body = stripcslashes($body);} if ($ishtml) { $mail->IsHTML(true); $mail->Body = $body; @@ -4704,7 +4684,7 @@ function modify_database($sqlfile='', $sqlstring='') } } else { $sqlstring = trim($sqlstring); - if ($sqlstring{strlen($sqlstring)-1} != ";") { + if ($sqlstring[strlen($sqlstring)-1] != ";") { $sqlstring .= ";"; // add it in if it's not there. } $lines[] = $sqlstring; @@ -5964,9 +5944,9 @@ function sRandomChars($length,$pattern="23456789abcdefghijkmnpqrstuvwxyz") for($i=0;$i<$length;$i++) { if(isset($key)) - $key .= $pattern{rand(0,$patternlength)}; + $key .= $pattern[rand(0,$patternlength)]; else - $key = $pattern{rand(0,$patternlength)}; + $key = $pattern[rand(0,$patternlength)]; } return $key; } @@ -6365,7 +6345,7 @@ function GetAttributeValue($surveyid,$attrName,$token) { return null; } - $sanitized_token=$connect->qstr($token,get_magic_quotes_gpc()); + $sanitized_token=$connect->qstr($token,0); $surveyid=sanitize_int($surveyid); $query="SELECT $attrName FROM {$dbprefix}tokens_$surveyid WHERE token=$sanitized_token"; diff --git a/include/limesurvey/docs/release_notes.txt b/include/limesurvey/docs/release_notes.txt index 979292be..111b9758 100644 --- a/include/limesurvey/docs/release_notes.txt +++ b/include/limesurvey/docs/release_notes.txt @@ -840,7 +840,7 @@ Changes from 1.91+ (build 10629) to 1.91+ (build 10647) #Updated translation: Greek (c_schmitz) #Updated translation: Italian (c_schmitz) -Fixed issue #5376: Timestamp for login attempts was improperly formatted. Fixed. (mot3) --Fixed issue #5377: get_magic_quotes_gpc() finally gone with PHP 6. Conditional forward-compat function fixes fatal errors. (mot3) +-Fixed issue #5377: 0 finally gone with PHP 6. Conditional forward-compat function fixes fatal errors. (mot3) -Fixed issue #5381: Multiple invitations sent (idobraca) -Fixed issue: Firstname & surname aren't used when sending invitation and reminders even if they are provided by survey administrator in token table (idobraca) -Fixed issue: No tabs are showing when editing survey question having more than one language (idobraca) diff --git a/include/limesurvey/index.php b/include/limesurvey/index.php index 44f7773a..4f1084ca 100644 --- a/include/limesurvey/index.php +++ b/include/limesurvey/index.php @@ -2536,8 +2536,7 @@ function UpdateFieldArray() if (isset($_SESSION['fieldarray'])) { - reset($_SESSION['fieldarray']); - while ( list($key) = each($_SESSION['fieldarray']) ) + foreach($_SESSION['fieldarray'] as $key => $value) { $questionarray =& $_SESSION['fieldarray'][$key]; diff --git a/include/limesurvey/qanda.php b/include/limesurvey/qanda.php index 40a6b109..af201b5c 100644 --- a/include/limesurvey/qanda.php +++ b/include/limesurvey/qanda.php @@ -912,8 +912,8 @@ function return_array_filter_strings($ia, $qidattributes, $thissurvey, $ansrow, // ================================================================== // setting constants for 'checked' and 'selected' inputs -define('CHECKED' , ' checked="checked"' , true); -define('SELECTED' , ' selected="selected"' , true); +define('CHECKED' , ' checked="checked"'); +define('SELECTED' , ' selected="selected"'); // ================================================================== // QUESTION METHODS ================================================= diff --git a/include/limesurvey/replacements.php b/include/limesurvey/replacements.php index 15403c3f..97c32877 100644 --- a/include/limesurvey/replacements.php +++ b/include/limesurvey/replacements.php @@ -206,12 +206,12 @@ function templatereplace($line, $replacements=array(), $anonymized=false, $quest $_question_text = '
    ' .$_question_text. '
    '; } - if ( + if (( $showqnumcode == 'both' || $showqnumcode == 'number' || ($showqnumcode == 'choose' && !isset($thissurvey['showqnumcode'])) || ($showqnumcode == 'choose' && $thissurvey['showqnumcode'] == 'B') || - ($showqnumcode == 'choose' && $thissurvey['showqnumcode'] == 'N') + ($showqnumcode == 'choose' && $thissurvey['showqnumcode'] == 'N')) && is_array($question) ) { $_question_number = $question['number']; @@ -220,12 +220,12 @@ function templatereplace($line, $replacements=array(), $anonymized=false, $quest { $_question_number = ''; }; - if ( + if (( $showqnumcode == 'both' || $showqnumcode == 'code' || ($showqnumcode == 'choose' && !isset($thissurvey['showqnumcode'])) || ($showqnumcode == 'choose' && $thissurvey['showqnumcode'] == 'B') || - ($showqnumcode == 'choose' && $thissurvey['showqnumcode'] == 'C') + ($showqnumcode == 'choose' && $thissurvey['showqnumcode'] == 'C')) && is_array($question) ) { $_question_code = $question['code']; @@ -708,7 +708,7 @@ EOD; $coreReplacements['LOADHEADING'] = $clang->gT("Load A Previously Saved Survey"); $coreReplacements['LOADMESSAGE'] = $clang->gT("You can load a survey that you have previously saved from this screen.")."
    ".$clang->gT("Type in the 'name' you used to save the survey, and the password.")."
    "; $coreReplacements['NAVIGATOR'] = $navigator; // global - $coreReplacements['NOSURVEYID'] = $surveylist['nosid']; // global + if (is_array($surveylist)) { $coreReplacements['NOSURVEYID'] = $surveylist['nosid'];} // global $coreReplacements['NUMBEROFQUESTIONS'] = $_totalquestionsAsked; $coreReplacements['PASSTHRULABEL'] = ''; $coreReplacements['PASSTHRUVALUE'] = ''; @@ -756,9 +756,13 @@ EOD; $coreReplacements['SURVEYFORMAT'] = $surveyformat; // global $coreReplacements['SURVEYLANGAGE'] = $clang->langcode; // this misspelling is kept for legacy reasons $coreReplacements['SURVEYLANGUAGE'] = $clang->langcode; - $coreReplacements['SURVEYLIST'] = $surveylist['list']; // global - $coreReplacements['SURVEYLISTHEADING'] = $surveylist['listheading']; // global - $coreReplacements['SURVEYNAME'] = $thissurvey['name']; // global + if (is_array($surveylist)) { + $coreReplacements['SURVEYLIST'] = $surveylist['list']; // global + $coreReplacements['SURVEYLISTHEADING'] = $surveylist['listheading']; // global + } + if (is_array($thissurvey)) { + $coreReplacements['SURVEYNAME'] = $thissurvey['name']; // global + } $coreReplacements['TEMPLATECSS'] = $_templatecss; $coreReplacements['TEMPLATEURL'] = $_templateurl; $coreReplacements['THEREAREXQUESTIONS'] = $_therearexquestions; diff --git a/include/pear/HTML/QuickForm.php b/include/pear/HTML/QuickForm.php index 649af05d..167857e6 100644 --- a/include/pear/HTML/QuickForm.php +++ b/include/pear/HTML/QuickForm.php @@ -290,7 +290,7 @@ class HTML_QuickForm extends HTML_Common $attributes = array('action'=>$action, 'method'=>$method, 'name'=>$formName, 'id'=>$formName) + $target; $this->updateAttributes($attributes); if (!$trackSubmit || isset($_REQUEST['_qf__' . $formName])) { - if (1 == get_magic_quotes_gpc()) { + if (1 == 0) { $this->_submitValues = $this->_recursiveFilter('stripslashes', 'get' == $method? $_GET: $_POST); foreach ($_FILES as $keyFirst => $valFirst) { foreach ($valFirst as $keySecond => $valSecond) { diff --git a/include/pear/PEAR/Config.php b/include/pear/PEAR/Config.php index 1992e681..c13c74fe 100644 --- a/include/pear/PEAR/Config.php +++ b/include/pear/PEAR/Config.php @@ -970,7 +970,7 @@ class PEAR_Config extends PEAR return $this->raiseError("PEAR_Config::readConfigFile fopen('$file','r') failed"); } $size = filesize($file); - $rt = get_magic_quotes_runtime(); + $rt = 0; set_magic_quotes_runtime(0); if (function_exists('file_get_contents')) { fclose($fp); diff --git a/include/pear/PEAR/DependencyDB.php b/include/pear/PEAR/DependencyDB.php index 840cf673..db8856a6 100644 --- a/include/pear/PEAR/DependencyDB.php +++ b/include/pear/PEAR/DependencyDB.php @@ -501,7 +501,7 @@ class PEAR_DependencyDB $err = PEAR::raiseError("Could not open dependencies file `".$this->_depdb."'"); return $err; } - $rt = get_magic_quotes_runtime(); + $rt = 0; set_magic_quotes_runtime(0); clearstatcache(); if (function_exists('file_get_contents')) { @@ -531,7 +531,7 @@ class PEAR_DependencyDB $this->_unlock(); return PEAR::raiseError("Could not open dependencies file `".$this->_depdb."' for writing"); } - $rt = get_magic_quotes_runtime(); + $rt = 0; set_magic_quotes_runtime(0); fwrite($fp, serialize($deps)); set_magic_quotes_runtime($rt); diff --git a/include/pear/PEAR/Registry.php b/include/pear/PEAR/Registry.php index b198eba3..35460bde 100644 --- a/include/pear/PEAR/Registry.php +++ b/include/pear/PEAR/Registry.php @@ -696,7 +696,7 @@ class PEAR_Registry extends PEAR return $this->raiseError('PEAR_Registry: could not open filemap "' . $this->filemap . '"', PEAR_REGISTRY_ERROR_FILE, null, null, $php_errormsg); } clearstatcache(); - $rt = get_magic_quotes_runtime(); + $rt = 0; set_magic_quotes_runtime(0); $fsize = filesize($this->filemap); if (function_exists('file_get_contents')) { @@ -998,7 +998,7 @@ class PEAR_Registry extends PEAR if ($fp === null) { return null; } - $rt = get_magic_quotes_runtime(); + $rt = 0; set_magic_quotes_runtime(0); clearstatcache(); if (function_exists('file_get_contents')) { @@ -1040,7 +1040,7 @@ class PEAR_Registry extends PEAR if ($fp === null) { return null; } - $rt = get_magic_quotes_runtime(); + $rt = 0; set_magic_quotes_runtime(0); clearstatcache(); if (function_exists('file_get_contents')) { diff --git a/include/php-gettext-1.0.11/gettext.php b/include/php-gettext-1.0.11/gettext.php index 5064047c..81af5550 100755 --- a/include/php-gettext-1.0.11/gettext.php +++ b/include/php-gettext-1.0.11/gettext.php @@ -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; diff --git a/include/php-gettext-1.0.11/streams.php b/include/php-gettext-1.0.11/streams.php index 3cdc1584..00cf6cc5 100644 --- a/include/php-gettext-1.0.11/streams.php +++ b/include/php-gettext-1.0.11/streams.php @@ -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);