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

@@ -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)

View File

@@ -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<br />$query<br />".$connect->ErrorMsg());
if ($first==true)
{

View File

@@ -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;}

View File

@@ -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;
}
}
?>
?>

View File

@@ -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

View File

@@ -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) {

View File

@@ -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);

View File

@@ -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);
}
}
?>
?>

View File

@@ -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

View File

@@ -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;
}
?>
?>

View File

@@ -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<br />".$usquery."<br /><br /><strong>".$connect->ErrorMsg()); // Checked
}

View File

@@ -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'] . "&amp";
}
$surveysummary .= "<li><a href='#' accesskey='d' onclick=\"window.open('"
. $publicurl."/index.php?sid={$surveyid}&amp;interviewer=" . $_SESSION['interviewer'] . "&amp;newtest=Y&amp;lang={$baselang}', '_blank')\" title=\"{$icontext2}\" >"
. $publicurl."/index.php?sid={$surveyid}&amp;" . $interviewer . "newtest=Y&amp;lang={$baselang}', '_blank')\" title=\"{$icontext2}\" >"
. "<img src='{$imageurl}/do.png' alt='{$icontext}' />"
. "</a></li>\n";

View File

@@ -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
// Yes, closing PHP tag was intentionally left out

View File

@@ -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);

View File

@@ -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})";

View File

@@ -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 {
}
}
?>
?>

View File

@@ -164,19 +164,11 @@ else {$codelanguage='en';}
if (isset ($_POST['changes'])) {
$changedtext=$_POST['changes'];
$changedtext=str_replace ('<?','',$changedtext);
if(get_magic_quotes_gpc())
{
$changedtext = stripslashes($changedtext);
}
}
if (isset ($_POST['changes_cp'])) {
$changedtext=$_POST['changes_cp'];
$changedtext=str_replace ('<?','',$changedtext);
if(get_magic_quotes_gpc())
{
$changedtext = stripslashes($changedtext);
}
}

View File

@@ -801,7 +801,7 @@
$fieldvalue['bounceaccounthost']=$_POST['bounceaccounthost'];
}
$connect->AutoExecute("{$dbprefix}surveys", $fieldvalue, 2,"sid=$surveyid",get_magic_quotes_gpc());
$connect->AutoExecute("{$dbprefix}surveys", $fieldvalue, 2,"sid=$surveyid",0);
$tokenoutput .= "<div class='header ui-widget-header'>".$clang->gT("Bounce settings")."</div>\n"
."<div class='messagebox ui-corner-all'>"
."\t<div class='successheader'>".$clang->gT("Bounce settings have been saved.")."</div>\n"

View File

@@ -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';

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;
}
}
?>
?>

View File

@@ -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";

View File

@@ -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)

View File

@@ -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];

View File

@@ -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 =================================================

View File

@@ -206,12 +206,12 @@ function templatereplace($line, $replacements=array(), $anonymized=false, $quest
$_question_text = '<div class="em_equation">' .$_question_text. '</div>';
}
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.")."<br />".$clang->gT("Type in the 'name' you used to save the survey, and the password.")."<br />";
$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;