surveyExists($iVid)) { $query2num = "SELECT owner_id FROM {$dbprefix}surveys WHERE sid=".sanitize_int($iVid).""; $rs = db_execute_assoc($query2num); $field=$rs->FetchRow(); return $field['owner_id']; }else{return false;} } /** * This function changes data in LS-DB, its very sensitive, because every table can be changed. * * @param unknown_type $table * @param unknown_type $key * @param unknown_type $value * @param unknown_type $where * @return String */ function changeTable($table, $key, $value, $where, $mode='0')//XXX {//be aware that this function may be a security risk global $connect ; // global $dbprefix ; $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; include("lsrc.config.php"); if($mode=='' || !isset($mode) || $mode=='0') { $where = str_replace("\\","",$where); $query2num = "SELECT {$key} FROM {$dbprefix}{$table} WHERE {$where}"; $rs = db_execute_assoc($query2num); $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", OK ($query2num)"); $query2update = "update ".$dbprefix.$table." set ".$key."='".$value."' where ".$where.""; $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", OK ($query2update)"); if($connect->Execute($query2update)){ return $rs->RecordCount()." Rows changed"; } else{ return "nothing changed"; } } if($mode==1 || $mode=='1') { $query2insert = "INSERT INTO {$dbprefix}{$table} ({$key}) VALUES ({$value});"; $this->debugLsrc("wir sind in Line ".__LINE__.", inserting ($query2insert)"); if($connect->Execute($query2insert)) { $this->debugLsrc("wir sind in Line ".__LINE__.", inserting OK"); return true; } else { return false; } } } /** * * Enter description here... * @param $surveyid * @param $type * @param $maxLsrcEmails * @return unknown_type */ function emailSender($surveyid, $type, $maxLsrcEmails='') //XXX { global $connect,$sitename ; global $dbprefix ; $surveyid = sanitize_int($surveyid); include("lsrc.config.php"); $lsrcHelper= new LsrcHelper(); // wenn maxmails ber den lsrc gegeben wird das nutzen, ansonsten die default werte aus der config.php if($maxLsrcEmails!='') $maxemails = $maxLsrcEmails; switch ($type){ case "custom": break; case "invite": $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", START invite "); if(isset($surveyid) && getEmailFormat($surveyid) == 'html') { $ishtml=true; } else { $ishtml=false; } //$tokenoutput .= ("Sending Invitations"); //if (isset($tokenid)) {$tokenoutput .= " (".("Sending to Token ID").": {$tokenid})";} //$tokenoutput .= "\n"; $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", $surveyid, $type"); // Texte für Mails aus der Datenbank holen und in die POST Dinger schreiben. Nicht schön aber praktikabel $sql = "SELECT surveyls_language, surveyls_email_invite_subj, surveyls_email_invite ". "FROM {$dbprefix}surveys_languagesettings ". "WHERE surveyls_survey_id = ".$surveyid." "; //GET SURVEY DETAILS $thissurvey=getSurveyInfo($surveyid); // $connect->SetFetchMode(ADODB_FETCH_ASSOC); // $sqlResult=$connect->Execute($sql); $sqlResult = db_execute_assoc($sql); $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", invite "); while($languageRow = $sqlResult->FetchRow()) { $_POST['message_'.$languageRow['surveyls_language']] = $languageRow['surveyls_email_invite']; $_POST['subject_'.$languageRow['surveyls_language']] = $languageRow['surveyls_email_invite_subj']; } // if (isset($_POST['bypassbademails']) && $_POST['bypassbademails'] == 'Y') // { // $SQLemailstatuscondition = " AND emailstatus = 'OK'"; // } // else // { // $SQLemailstatuscondition = ""; // } $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", invite "); $ctquery = "SELECT * FROM ".db_table_name("tokens_{$surveyid}")." WHERE ((completed ='N') or (completed='')) AND ((sent ='N') or (sent='')) AND token !='' AND email != '' "; if (isset($tokenid)) {$ctquery .= " AND tid='{$tokenid}'";} //$tokenoutput .= "\n"; $ctresult = $connect->Execute($ctquery); $ctcount = $ctresult->RecordCount(); $ctfieldcount = $ctresult->FieldCount(); $emquery = "SELECT * "; //if ($ctfieldcount > 7) {$emquery .= ", attribute_1, attribute_2";} $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", invite "); $emquery .= " FROM ".db_table_name("tokens_{$surveyid}")." WHERE ((completed ='N') or (completed='')) AND ((sent ='N') or (sent='')) AND token !='' AND email != '' "; if (isset($tokenid)) {$emquery .= " and tid='{$tokenid}'";} //$tokenoutput .= "\n\n\n\n"; $emresult = db_select_limit_assoc($emquery,$maxemails); $emcount = $emresult->RecordCount(); //$tokenoutput .= "
| \n"; $surveylangs = GetAdditionalLanguagesFromSurveyID($surveyid); $baselanguage = GetBaseLanguageFromSurveyID($surveyid); array_unshift($surveylangs,$baselanguage); $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", invite "); foreach ($surveylangs as $language) { $_POST['message_'.$language]=auto_unescape($_POST['message_'.$language]); $_POST['subject_'.$language]=auto_unescape($_POST['subject_'.$language]); if ($ishtml) $_POST['message_'.$language] = html_entity_decode($_POST['message_'.$language], ENT_QUOTES, $emailcharset); } $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", invite "); if ($emcount > 0) { $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']; while(isset($emrow["attribute_$c"])) { $fieldsarray["{ATTRIBUTE_$c}"]=$emrow["attribute_$c"]; ++$c; } $fieldsarray["{ADMINNAME}"]= $thissurvey['adminname']; $fieldsarray["{ADMINEMAIL}"]=$thissurvey['adminemail']; $fieldsarray["{SURVEYNAME}"]=$thissurvey['name']; $fieldsarray["{SURVEYDESCRIPTION}"]=$thissurvey['description']; $fieldsarray["{EXPIRY}"]=$thissurvey["expiry"]; $fieldsarray["{EXPIRY-DMY}"]=date("d-m-Y",strtotime($thissurvey["expiry"])); $fieldsarray["{EXPIRY-MDY}"]=date("m-d-Y",strtotime($thissurvey["expiry"])); $emrow['language']=trim($emrow['language']); if ($emrow['language']=='') {$emrow['language']=$baselanguage;} //if language is not give use default $found = array_search($emrow['language'], $surveylangs); if ($found==false) {$emrow['language']=$baselanguage;} $from = $thissurvey['adminemail']; if ($ishtml === false) { if ( $modrewrite ) { $fieldsarray["{SURVEYURL}"]="$publicurl/$surveyid/lang-".trim($emrow['language'])."/tk-{$emrow['token']}"; } else { $fieldsarray["{SURVEYURL}"]="$publicurl/index.php?lang=".trim($emrow['language'])."&sid=$surveyid&token={$emrow['token']}"; } } else { if ( $modrewrite ) { $fieldsarray["{SURVEYURL}"]="".htmlspecialchars("$publicurl/$surveyid/lang-".trim($emrow['language'])."/tk-{$emrow['token']}").""; } else { $fieldsarray["{SURVEYURL}"]="".htmlspecialchars("$publicurl/index.php?lang=".trim($emrow['language'])."&sid=$surveyid&token={$emrow['token']}").""; } } $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", invite "); $modsubject=Replacefields($_POST['subject_'.$emrow['language']], $fieldsarray); $modmessage=Replacefields($_POST['message_'.$emrow['language']], $fieldsarray); if (MailTextMessage($modmessage, $modsubject, $to , $from, $sitename, $ishtml, getBounceEmail($surveyid))) { // Put date into sent $timeadjust = 0; $today = date("Y-m-d H:i"); $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", invite Today:".$today); $udequery = "UPDATE ".db_table_name("tokens_{$surveyid}")."\n" ."SET sent='$today' WHERE tid={$emrow['tid']}"; // $uderesult = $connect->Execute($udequery); $mailsSend++; //$tokenoutput .= "[".("Invitation sent to:")."{$emrow['firstname']} {$emrow['lastname']} ($to)]\n"; } else { //$tokenoutput .= ReplaceFields(("Email to {FIRSTNAME} {LASTNAME} ({EMAIL}) failed. Error Message:")." ".$maildebug."", $fieldsarray); if($n==1) $failedAddresses .= ",".$to; else { $failedAddresses = $to; $n=1; } } } $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", invite "); if ($ctcount > $emcount) { $lefttosend = $ctcount-$maxemails; }else{$lefttosend = 0;} } else { return "No Mails to send"; } if($maxemails>0 && $maxemails!='') { $returnValue = "".$mailsSend." Mails send. ".$lefttosend." Mails left to send"; if(isset($failedAddresses)) $returnValue .= "\nCould not send to: ".$failedAddresses; return $returnValue; } if(isset($mailsSend)) { $returnValue = "".$mailsSend." Mails send. "; if(isset($failedAddresses)) $returnValue .= "\nCould not send to: ".$failedAddresses; return $returnValue; } break; case "remind": // XXX: // TODO: // if (!isset($_POST['ok']) || !$_POST['ok']) // { /* * look if there were reminders send in the past, and if some tokens got lesser reminders than others * * - if so: send reminders to the unremindet participants until they got the same remindcount than the others * - if not: send reminders normally */ $remSQL = "SELECT tid, remindercount " . "FROM ".db_table_name("tokens_{$surveyid}")." " . "WHERE (completed = 'N' or completed = '') AND sent <> 'N' and sent <>'' AND token <>'' AND EMAIL <>'' " . "ORDER BY remindercount desc LIMIT 1"; $remResult = db_execute_assoc($remSQL); $remRow = $remResult->FetchRow(); $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", remind ".$remRow['tid']."; ".$remRow['remindercount']." "); $sendOnlySQL = "SELECT tid, remindercount " . "FROM ".db_table_name("tokens_{$surveyid}")." " . "WHERE (completed = 'N' or completed = '') AND sent <> 'N' and sent <>'' AND token <>'' AND EMAIL <>'' AND remindercount < ".$remRow['remindercount']." " . "ORDER BY tid asc LIMIT 1"; $sendOnlyResult = db_execute_assoc($sendOnlySQL); if($sendOnlyResult->RecordCount()>0) { $sendOnlyRow = $sendOnlyResult->FetchRow(); $starttokenid = $sendOnlyRow['tid']; $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", remind ".$sendOnlyRow['tid']."; ".$sendOnlyRow['remindercount']." "); } if(isset($surveyid) && getEmailFormat($surveyid) == 'html') { $ishtml=true; } else { $ishtml=false; } //GET SURVEY DETAILS $thissurvey=getSurveyInfo($surveyid); $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", $surveyid, $type"); // Texte für Mails aus der Datenbank holen. $sql = "SELECT surveyls_language, surveyls_email_remind_subj, surveyls_email_remind ". "FROM {$dbprefix}surveys_languagesettings ". "WHERE surveyls_survey_id = ".$surveyid." "; $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", remind "); $sqlResult = db_execute_assoc($sql); while($languageRow = $sqlResult->FetchRow()) { $_POST['message_'.$languageRow['surveyls_language']] = $languageRow['surveyls_email_remind']; $_POST['subject_'.$languageRow['surveyls_language']] = $languageRow['surveyls_email_remind_subj']; } $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", remind "); //$tokenoutput .= ("Sending Reminders")."\n"; $surveylangs = GetAdditionalLanguagesFromSurveyID($surveyid); $baselanguage = GetBaseLanguageFromSurveyID($surveyid); array_unshift($surveylangs,$baselanguage); foreach ($surveylangs as $language) { $_POST['message_'.$language]=auto_unescape($_POST['message_'.$language]); $_POST['subject_'.$language]=auto_unescape($_POST['subject_'.$language]); } $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", remind "); $SQLemailstatuscondition = " AND emailstatus = 'OK'"; if (isset($_POST['maxremindercount']) && $_POST['maxremindercount'] != '' && intval($_POST['maxremindercount']) != 0) { $SQLremindercountcondition = " AND remindercount < ".intval($_POST['maxremindercount']); } else { $SQLremindercountcondition = ""; } $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", remind "); if (isset($_POST['minreminderdelay']) && $_POST['minreminderdelay'] != '' && intval($_POST['minreminderdelay']) != 0) { // $_POST['minreminderdelay'] in days (86400 seconds per day) $compareddate = date_shift( date("Y-m-d H:i:s",time() - 86400 * intval($_POST['minreminderdelay'])), "Y-m-d H:i", $timeadjust); $SQLreminderdelaycondition = " AND ( " . " (remindersent = 'N' AND sent < '".$compareddate."') " . " OR " . " (remindersent < '".$compareddate."'))"; } else { $SQLreminderdelaycondition = ""; } $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", remind "); $ctquery = "SELECT * FROM ".db_table_name("tokens_{$surveyid}")." WHERE (completed ='N' or completed ='') AND sent<>'' AND sent<>'N' AND token <>'' AND email <> '' $SQLemailstatuscondition $SQLremindercountcondition $SQLreminderdelaycondition"; if (isset($starttokenid)) {$ctquery .= " AND tid >= '{$starttokenid}'";} // if (isset($tokenid) && $tokenid) {$ctquery .= " AND tid = '{$tokenid}'";} // //$tokenoutput .= "\n"; $ctresult = $connect->Execute($ctquery) or $this->debugLsrc ("Database error!\n" . $connect->ErrorMsg()); $ctcount = $ctresult->RecordCount(); $ctfieldcount = $ctresult->FieldCount(); $emquery = "SELECT firstname, lastname, email, token, tid, language "; if ($ctfieldcount > 7) {$emquery .= ", attribute_1, attribute_2";} $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", remind "); // TLR change to put date into sent $emquery .= " FROM ".db_table_name("tokens_{$surveyid}")." WHERE (completed = 'N' or completed = '') AND sent <> 'N' and sent <>'' AND token <>'' AND EMAIL <>'' $SQLemailstatuscondition $SQLremindercountcondition $SQLreminderdelaycondition"; if (isset($starttokenid)) {$emquery .= " AND tid >= '{$starttokenid}'";} if (isset($tokenid) && $tokenid) {$emquery .= " AND tid = '{$tokenid}'";} $emquery .= " ORDER BY tid "; $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", remind, maxemails?: $maxemails, emquery: $emquery "); //$emresult = db_select_limit_assoc($emquery, $maxemails) or $this->debugLsrc ("Database error!\n" . $connect->ErrorMsg()); $emresult = db_execute_assoc($emquery); $emcount = $emresult->RecordCount() or $this->debugLsrc ("Database error!\n" . $connect->ErrorMsg()); $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", remind "); if ($emcount > 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']; while(isset($emrow["attribute_$c"])) { $fieldsarray["{ATTRIBUTE_$c}"]=$emrow["attribute_$c"]; ++$c; } $fieldsarray["{ADMINNAME}"]= $thissurvey['adminname']; $fieldsarray["{ADMINEMAIL}"]=$thissurvey['adminemail']; $fieldsarray["{SURVEYNAME}"]=$thissurvey['name']; $fieldsarray["{SURVEYDESCRIPTION}"]=$thissurvey['description']; $fieldsarray["{EXPIRY}"]=$thissurvey["expiry"]; $fieldsarray["{EXPIRY-DMY}"]=date("d-m-Y",strtotime($thissurvey["expiry"])); $fieldsarray["{EXPIRY-MDY}"]=date("m-d-Y",strtotime($thissurvey["expiry"])); $emrow['language']=trim($emrow['language']); if ($emrow['language']=='') {$emrow['language']=$baselanguage;} //if language is not give use default if(!in_array($emrow['language'], $surveylangs)) {$emrow['language']=$baselanguage;} // if given language is not available use default $found = array_search($emrow['language'], $surveylangs); if ($found==false) {$emrow['language']=$baselanguage;} $from = $thissurvey['adminemail']; //$from = $_POST['from_'.$emrow['language']]; if (getEmailFormat($surveyid) == 'html') { $ishtml=true; } else { $ishtml=false; } if ($ishtml == false) { if ( $modrewrite ) { $fieldsarray["{SURVEYURL}"]="$publicurl/$surveyid/lang-".trim($emrow['language'])."/tk-{$emrow['token']}"; } else { $fieldsarray["{SURVEYURL}"]="$publicurl/index.php?lang=".trim($emrow['language'])."&sid=$surveyid&token={$emrow['token']}"; } } else { if ( $modrewrite ) { $fieldsarray["{SURVEYURL}"]="".htmlspecialchars("$publicurl/$surveyid/lang-".trim($emrow['language'])."/tk-{$emrow['token']}").""; } else { $fieldsarray["{SURVEYURL}"]="".htmlspecialchars("$publicurl/index.php?lang=".trim($emrow['language'])."&sid=$surveyid&token={$emrow['token']}").""; $_POST['message_'.$emrow['language']] = html_entity_decode($_POST['message_'.$emrow['language']], ENT_QUOTES, $emailcharset); } } $msgsubject=Replacefields($_POST['subject_'.$emrow['language']], $fieldsarray); $sendmessage=Replacefields($_POST['message_'.$emrow['language']], $fieldsarray); if (MailTextMessage($sendmessage, $msgsubject, $to, $from, $sitename, $ishtml, getBounceEmail($surveyid))) { // Put date into remindersent $today = date_shift(date("Y-m-d H:i:s"), "Y-m-d H:i", $timeadjust); $udequery = "UPDATE ".db_table_name("tokens_{$surveyid}")."\n" ."SET remindersent='$today',remindercount = remindercount+1 WHERE tid={$emrow['tid']}"; // $uderesult = $connect->Execute($udequery) or $this->debugLsrc ("Could not update tokens$udequery".$connect->ErrorMsg()); //orig: $tokenoutput .= "\t\t\t({$emrow['tid']})[".("Reminder sent to:")." {$emrow['firstname']} {$emrow['lastname']}]\n"; //$tokenoutput .= "\t\t\t({$emrow['tid']}) [".("Reminder sent to:")." {$emrow['firstname']} {$emrow['lastname']} ($to)]\n"; $mailsSend++; } else { //$tokenoutput .= ReplaceFields(("Email to {FIRSTNAME} {LASTNAME} ({EMAIL}) failed. Error Message:")." ".$maildebug."", $fieldsarray); if($n==1) $failedAddresses .= ",".$to; else { $failedAddresses = $to; $n=1; } } //$lasttid = $emrow['tid']; } if ($ctcount > $emcount) { $lefttosend = $ctcount-$maxemails; }else{$lefttosend = 0;} } else { return "No Reminders to send"; } if($maxemails>0) { $returnValue = "".$mailsSend." Reminders send. ".$lefttosend." Reminders left to send"; if(isset($failedAddresses)) $returnValue .= "\nCould not send to: ".$failedAddresses; return $returnValue; } if(isset($mailsSend)) { $returnValue = "".$mailsSend." Reminders send. "; if(isset($failedAddresses)) $returnValue .= "\nCould not send to: ".$failedAddresses; return $returnValue; } break; default: break; } } /** * loginCheck for Lsrc, checks if the user with given password exists in LS Database and * sets the SESSION rights for this user * @param String $sUser * @param String $sPass * @return boolean */ function checkUser($sUser, $sPass) // XXX { global $connect ; global $dbprefix ; $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; include("lsrc.config.php"); require(dirname(__FILE__)."/../classes/core/sha256.php"); $query="SELECT uid, password, lang, superadmin FROM {$dbprefix}users WHERE users_name=".$connect->qstr(sanitize_user($sUser)); // echo $query; $result = db_execute_assoc($query); $gv = $result->FetchRow(); if($result->RecordCount() < 1) { return false; } else { if((SHA256::hashing($sPass)==$gv['password'])) { $_SESSION['loginID']=$gv['uid']; $_SESSION['lang']=$gv['lang']; $squery = "SELECT create_survey, configurator, create_user, delete_user, superadmin, manage_template, manage_label FROM {$dbprefix}users WHERE uid={$gv['uid']}"; $sresult = db_execute_assoc($squery); //Checked if ($sresult->RecordCount()>0) { $fields = $sresult->FetchRow(); $_SESSION['USER_RIGHT_CREATE_SURVEY'] = $fields['create_survey']; $_SESSION['USER_RIGHT_CONFIGURATOR'] = $fields['configurator']; $_SESSION['USER_RIGHT_CREATE_USER'] = $fields['create_user']; $_SESSION['USER_RIGHT_DELETE_USER'] = $fields['delete_user']; $_SESSION['USER_RIGHT_SUPERADMIN'] = $fields['superadmin']; $_SESSION['USER_RIGHT_MANAGE_TEMPLATE'] = $fields['manage_template']; $_SESSION['USER_RIGHT_MANAGE_LABEL'] = $fields['manage_label']; } return true; } else { return false; } } } /** * Lsrc checks the existence of Surveys more than one time, so this makes sense to be DRY * * @param int $sid * @return boolean */ function surveyExists($sid)//XXX { global $connect ; // global $dbprefix ; $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; include("lsrc.config.php"); $query="SELECT * FROM {$dbprefix}surveys WHERE sid = ".$sid; // echo $query; $result = db_execute_assoc($query); if($result->RecordCount() < 1) { return false; } else { return true; } } /** * function to import surveys, based on new importsurvey.php 6979 2009-05-30 11:59:03Z c_schmitz $ * * @param unknown_type $iVid * @param unknown_type $sVtit * @param unknown_type $sVbes * @return boolean */ function importSurvey($iVid, $sVtit , $sVbes, $sVwel, $sUbes, $sVtyp) //XXX { global $connect ; // global $dbprefix ; include("lsrc.config.php"); $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", OK "); // HINT FOR IMPORTERS: go to Line 714 to manipulate the Survey, while it's imported $the_full_file_path = $coreDir.$sVtyp.".csv"; $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.",the_full_file_path ='$the_full_file_path' OK "); //$_SERVER['SERVER_NAME'] = ""; // just to avoid notices //$_SERVER['SERVER_SOFTWARE'] = ""; // just to avoid notices //require_once(dirname(__FILE__).'/../config-defaults.php'); //require_once(dirname(__FILE__).'/../common.php'); $handle = fopen($the_full_file_path, "r"); while (!feof($handle)) { //To allow for very long survey lines (up to 64k) $buffer = fgets($handle, 56550); $bigarray[] = $buffer; } fclose($handle); // foreach($bigarray as $ba) // $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", OK ".$ba); 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/")) { $importversion = 100; // version 1.0 file } elseif (isset($bigarray[1]) && isset($bigarray[4])&& (substr($bigarray[1], 0, 22) == "# SURVEYOR SURVEY DUMP")&& (substr($bigarray[4], 0, 37) == "# http://phpsurveyor.sourceforge.net/")) { $importversion = 99; // Version 0.99 file or older - carries a different URL } elseif (substr($bigarray[0], 0, 24) == "# LimeSurvey Survey Dump" || substr($bigarray[0], 0, 25) == "# PHPSurveyor Survey Dump") { // Wow.. this seems to be a >1.0 version file - these files carry the version information to read in line two $importversion=substr($bigarray[1], 12, 3); } else // unknown file - show error message { if ($importingfrom == "http") { // $importsurvey .= "".("Error")."\n"; // $importsurvey .= ("This file is not a LimeSurvey survey file. Import failed.")."\n"; // $importsurvey .= " |