Skip to content

Commit

Permalink
fixed Issue #3493: removeBOM is undefined
Browse files Browse the repository at this point in the history
git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey@7407 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
Tim Wahrendorff committed Aug 5, 2009
1 parent 88ed87b commit dd49412
Showing 1 changed file with 31 additions and 11 deletions.
42 changes: 31 additions & 11 deletions admin/remotecontrol/lsrc.helper.php
Expand Up @@ -18,7 +18,8 @@
*
*/
class LsrcHelper {



/**
* simple debug function to make life a bit easier
*
Expand Down Expand Up @@ -192,8 +193,8 @@ function emailSender($surveyid, $type, $maxLsrcEmails='') //XXX
$ctcount = $ctresult->RecordCount();
$ctfieldcount = $ctresult->FieldCount();

$emquery = "SELECT firstname, lastname, email, token, tid, language";
if ($ctfieldcount > 7) {$emquery .= ", attribute_1, attribute_2";}
$emquery = "SELECT * ";
//if ($ctfieldcount > 7) {$emquery .= ", attribute_1, attribute_2";}

$lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", invite ");

Expand Down Expand Up @@ -228,15 +229,19 @@ function emailSender($surveyid, $type, $maxLsrcEmails='') //XXX
$mailsSend = 0;
while ($emrow = $emresult->FetchRow())
{
$c=1;
unset($fieldsarray);
$to = $emrow['email'];
$fieldsarray["{EMAIL}"]=$emrow['email'];
$fieldsarray["{FIRSTNAME}"]=$emrow['firstname'];
$fieldsarray["{LASTNAME}"]=$emrow['lastname'];
$fieldsarray["{TOKEN}"]=$emrow['token'];
$fieldsarray["{LANGUAGE}"]=$emrow['language'];
$fieldsarray["{ATTRIBUTE_1}"]=$emrow['attribute_1'];
$fieldsarray["{ATTRIBUTE_2}"]=$emrow['attribute_2'];
while(isset($emrow["attribute_$c"]))
{
$fieldsarray["{ATTRIBUTE_$c}"]=$emrow["attribute_$c"];
++$c;
}
$fieldsarray["{ADMINNAME}"]= $thissurvey['adminname'];
$fieldsarray["{ADMINEMAIL}"]=$thissurvey['adminemail'];
$fieldsarray["{SURVEYNAME}"]=$thissurvey['name'];
Expand Down Expand Up @@ -481,15 +486,19 @@ function emailSender($surveyid, $type, $maxLsrcEmails='') //XXX
{
while ($emrow = $emresult->FetchRow())
{
$c=1;
unset($fieldsarray);
$to = $emrow['email'];
$fieldsarray["{EMAIL}"]=$emrow['email'];
$fieldsarray["{FIRSTNAME}"]=$emrow['firstname'];
$fieldsarray["{LASTNAME}"]=$emrow['lastname'];
$fieldsarray["{TOKEN}"]=$emrow['token'];
$fieldsarray["{LANGUAGE}"]=$emrow['language'];
$fieldsarray["{ATTRIBUTE_1}"]=$emrow['attribute_1'];
$fieldsarray["{ATTRIBUTE_2}"]=$emrow['attribute_2'];
while(isset($emrow["attribute_$c"]))
{
$fieldsarray["{ATTRIBUTE_$c}"]=$emrow["attribute_$c"];
++$c;
}

$fieldsarray["{ADMINNAME}"]= $thissurvey['adminname'];
$fieldsarray["{ADMINEMAIL}"]=$thissurvey['adminemail'];
Expand Down Expand Up @@ -722,7 +731,7 @@ function importSurvey($iVid, $sVtit , $sVbes, $sVwel, $sUbes, $sVtyp) //XXX
// foreach($bigarray as $ba)
// $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", OK ".$ba);

if (isset($bigarray[0])) $bigarray[0]=removeBOM($bigarray[0]);
if (isset($bigarray[0])) $bigarray[0]=$this->removeBOM($bigarray[0]);
// Now we try to determine the dataformat of the survey file.

if (isset($bigarray[1]) && isset($bigarray[4])&& (substr($bigarray[1], 0, 22) == "# SURVEYOR SURVEY DUMP")&& (substr($bigarray[4], 0, 29) == "# http://www.phpsurveyor.org/"))
Expand Down Expand Up @@ -3885,7 +3894,18 @@ function deleteSurvey($surveyid)
return true;

}

/**
* This function removes the UTF-8 Byte Order Mark from a string
*
* @param string $str
* @return string
*/
private function removeBOM($str=""){
if(substr($str, 0,3) == pack("CCC",0xef,0xbb,0xbf)) {
$str=substr($str, 3);
}
return $str;
}
/**
* This function pulls a CSV representation of the Field map
*
Expand Down Expand Up @@ -3918,8 +3938,8 @@ function FieldMap2CSV($surveyid)
}
return $result;
}

function getqtypelist($SelectedCode = "T", $ReturnType = "array")
private function getqtypelist($SelectedCode = "T", $ReturnType = "array")
{
include("lsrc.config.php");
global $publicurl;
Expand Down

0 comments on commit dd49412

Please sign in to comment.