# ETä 9.5.2011: lisätty tänne taas tämä rajoittamattomana, notta isojen filujen lataus onnistuisi PHP:n puolesta
@set_time_limit( 0 );
/*
global $REMOTE_ADDRESS;
if( $REMOTE_ADDRESS == "62.142.78.10" )
{
ini_set( "error_reporting", E_ALL ^ ( E_NOTICE + ( E_DEPRECATED > 0 ? E_DEPRECATED : 0 ) ) );
ini_set( "display_errors", "On" );
//print "Testing, testing";
}
elseif( $_SERVER[ "HTTP_HOST" ] != "atk" )
{
error_reporting( 0 );
print "Testing, testing";
}
*/
## -------------------------------------------------
## ETä 2.10.2009: uusi systeemi, jolla träkätään uutiskirjeen lukemisia tännekin
global $_GET;
if( is_array( $_GET ) && array_key_exists( "etrack", $_GET ) )
{
include_once( "etracker.php" );
if( strpos( $_SERVER[ "QUERY_STRING" ], "id=" ) === false && strpos( $_SERVER[ "QUERY_STRING" ], "file_id=" ) === false && strpos( $_SERVER[ "QUERY_STRING" ], "&" ) !== false )
{
$qsp = explode( "&", $_SERVER[ "QUERY_STRING" ] );
if( is_array( $qsp ) && count( $qsp ) > 0 )
{
foreach( $qsp AS $qspp )
{
if( is_numeric( $qspp ) && $qspp > 0 )
{
$_GET[ "id" ] = $qspp;
break;
}
}
unset( $qspp );
}
unset( $qsp );
}
}
## -------------------------------------------------
## 2.-3.6.2009: uusi systeemi, joka kirjaa tiedostolataukset Google Analyticsiin
function checkGoogleAnalytics( $reference_object = -1, $filename = "" )
{
global $_SERVER, $_GET;
if( ( !isset( $_GET[ "fid" ] ) || trim( $_GET[ "fid" ] ) == "" ) && is_object( $reference_object ) && $reference_object->domain_id > 0 )
{
$domain = new Domain();
if( $domain->load( $reference_object->domain_id ) && trim( $domain->ga_ua_id ) != "" && ( !method_exists( $reference_object, "getCodeParams" ) || $reference_object->getCodeParams( "NO_GOOGLE_ANALYTICS", 0 ) != 1 ) )
{
$mod = new Module();
if( $mod->load( MODULE_ID_FILES ) )
{
if( $mod->checkModuleProperty( $domain->id, "Enable", "FileDoNotCheckGoogleAnalytics" ) )
{
return;
}
}
if( trim( $filename ) == "" && ( $reference_object->classname == "Library" || $reference_object->classname == "AUILibrary" ) && trim( $reference_object->filename ) != "" )
{
$filename = $reference_object->filename;
}
$descriptive_name = "";
if( ( $reference_object->classname == "Library" || $reference_object->classname == "AUILibrary" ) && trim( $reference_object->name ) != "" )
{
$descriptive_name = $reference_object->name;
}
if( $descriptive_name == "" )
{
$descriptive_name = $filename;
}
$qs = "fid=".$_SERVER[ "QUERY_STRING" ];
if( isset( $_GET[ "id" ] ) && is_numeric( $_GET[ "id" ] ) )
{
$qs = "fid=".$_GET[ "id" ];
}
elseif( isset( $_GET[ "file_id" ] ) && is_numeric( $_GET[ "file_id" ] ) )
{
$qs = "fid=".$_GET[ "file_id" ];
}
$fsize = round( $reference_object->size / 1024, 1 );
if( $fsize < 1 )
{
$fsize = "<1 KB";
}
elseif( ( $fsize / 1000 ) > 1 )
{
$fsize = round( ( $fsize / 1000 ), 2 )." MB";
}
elseif( $fsize < 100 )
{
$fsize = $fsize." KB";
}
else
{
$fsize = round( $fsize )." KB";
}
$ftype = $reference_object->type;
#
?>
print "FILE/".$descriptive_name." (".$filename.")"; ?>
">
/**/
print "\n";
?>
">
Please click here if the file '' (, ) does not automatically start to download.
Jos tiedosto '' (, ) ei ala latautua automaattisesti, ole hyvä ja klikkaa tästä.
unset( $domain, $qs, $descriptive_name );
@mysql_close( WSM_CONN );
exit;
}
unset( $domain );
}
}
## -------------------------------------------------
## ETä 18.12.2008: uusi systeemi, jolla tsegataan relocatet
if( file_exists( "mods/mod_main/redirect_handler.inc" ) )
{
include_once( "mods/mod_main/redirect_handler.inc" );
}
function getMicroTimeForVAJCache()
{
list( $usec, $sec ) = explode( " ", microtime() );
return ( ( float ) $usec + ( float ) $sec );
}
$VAJ_cache_generation_time = getMicroTimeForVAJCache();
include_once( "mods/mod_main/db_queryobj.inc" );
include_once( "mods/mod_main/class_baseclass.inc" );
include_once( "mods/mod_main/class_module.inc" );
include_once( "mods/mod_main/class_domain.inc" );
include_once( "mods/mod_users/class_user.inc" );
include_once( "mods/mod_users/class_group.inc" );
include_once( "mods/mod_users/class_grouptype.inc" );
include_once( "mods/mod_pages/class_page.inc" );
include_once( "mods/mod_pages/class_pagedata.inc" );
include_once( "mods/mod_pages/class_area.inc" );
include_once( "mods/mod_pages/class_template.inc" );
include_once( "mods/mod_pages/class_terminal.inc" );
include_once( "mods/mod_pages/class_entrepage.inc" );
include_once( "mods/mod_pages/class_style.inc" );
include_once( "mods/mod_pages/class_pagetype.inc" );
include_once( "mods/mod_pages/class_pageparser.inc" );
include_once( "mods/mod_files/class_library.inc" );
include_once( "mods/mod_files/class_librarycat.inc" );
include_once( "mods/mod_files/class_librarytype.inc" );
include_once( "mods/mod_files/class_librarystatus.inc" );
include_once( "mods/mod_main/class_language.inc" );
include_once( "mods/mod_main/class_blankko.inc" );
include_once( "settings.inc" );
@include_once( "mods/mod_users/LDAPConnection.inc" );
include_once( "mods/mod_main/class_useragentdetector.inc" );
include_once( "mods/mod_main/class_usagelogs.inc" );
include_once( "mods/mod_main/domain_user_recog.inc" );
#@makeSpecialVJLog( "logs/special/files_".$_SERVER[ "REMOTE_ADDR" ].".log", "Starting to open a file (".$_SERVER[ "REQUEST_URI" ].")" );
function checkDownloadInfoRequest( $file = -1 )
{
$ret = true;
if( is_object( $file ) )
{
$mod = new Module();
if( $mod->load( MODULE_ID_FILES ) )
{
if( $mod->checkModuleProperty( $file->domain_id, "Enable", "RequestInfoBeforeDownloading" ) )
{
$cname = $mod->getModulePropertyVal( $file->domain_id, "RequestInfoPageCallname", "" );
if( trim( $cname ) != "" )
{
## selvitetään ensin onko jo cookie
if( !class_exists( "LibraryDownloadLog" ) )
{
include_once( "mods/mod_files/class_librarydownloadlog.inc" );
}
if( class_exists( "LibraryDownloadLog" ) )
{
$ret = false;
$log = new LibraryDownloadLog();
if( $log->loadByCookie( $file ) )
{
if( $log->save() )
{
$ret = true;
}
}
if( !$ret )
{
$log->relocateToRequesterPage( $file );
}
unset( $log );
}
}
unset( $cname );
}
}
unset( $mod );
}
return $ret;
}
$mod = new Module();
if( $mod->load( MODULE_ID_FILES ) )
{
$tfid = $_SERVER[ "QUERY_STRING" ];
$tnolog = 0;
if( is_numeric( $_GET[ "fid" ] ) && $_GET[ "fid" ] > 0 )
{
$tfid = $_GET[ "fid" ];
}
elseif( is_numeric( $_GET[ "id" ] ) && $_GET[ "id" ] > 0 )
{
$tfid = $_GET[ "id" ];
}
if( is_numeric( $_GET[ "library_id" ] ) && $_GET[ "library_id" ] > 0 )
{
$tfid = $_GET[ "library_id" ];
}
if( is_numeric( $_POST[ "file_id" ] ) && $_POST[ "file_id" ] > 0 )
{
$tfid = $_POST[ "file_id" ];
}
if( is_numeric( $_GET[ "file_id" ] ) && $_GET[ "file_id" ] > 0 )
{
$tfid = $_GET[ "file_id" ];
}
if( $_GET[ "nolog" ] == 1 )
{
$tnolog = 1;
}
if( strpos( $tfid, "x" ) !== false )
{
$temp = new LibraryCat();
if( $temp->load( trim( substr( $tfid, 0, strpos( $tfid, "x" ) ) ), 0 ) )
{
if( $temp->is_physical != 1 )
{
@mysql_close( WSM_CONN );
exit;
}
$domain_id = $temp->domain_id;
if( $mod->checkModuleProperty( $domain_id, "Enable", "RestrictFilesForExtranet" ) )
{
if( ( $WSM_user->id < 0 && trim( $WSM_user->ldap_key ) == "" ) || ( trim( $WSM_user->username ) == "" && trim( $WSM_user->ldap_key ) == "" ) )
{
@mysql_close( WSM_CONN );
exit;
}
}
}
}
elseif( is_numeric( $tfid ) )
{
$go_to_login = false;
$temp = new Library();
if( $temp->load( $tfid, 0, 1 ) ) //( ( $tnolog == 1 ) ? 0 : 1 ) poistettu loggaaminen tästä testistä
{
$domain_id = $temp->domain_id;
if( $mod->checkModuleProperty( $domain_id, "Enable", "RestrictFilesForExtranet" ) )
{
if( ( $WSM_user->id < 0 && trim( $WSM_user->ldap_key ) == "" ) || ( trim( $WSM_user->username ) == "" && trim( $WSM_user->ldap_key ) == "" ) )
{
$go_to_login = true;
}
}
}
else
{
$go_to_login = true;
}
if( $temp->status_message == "failed/unpublished" )
{
if( !headers_sent() )
{
header( "HTTP/1.1 403 Forbidden" );
}
@mysql_close( WSM_CONN );
exit;
}
if( $go_to_login )
{
## ---------------
## tsegataan ensin oliko tiedosto olemassa
$q = new QueryObject( WSM_CONN );
$query_string = "SELECT library_id, lang_id FROM library WHERE domain_id = ".$CUI_domain->id." AND library_id = ".$tfid;
$q->query( $query_string );
if( $q->numrows() > 0 )
{
## ---------------
## tiedosto oli olemassa, tsegataan nyt löytyykö kirjautumissivua
$lang_id = $q->field( "lang_id" );
if( $loginpage_id = $CUI_domain->getFirstPage( ( $lang_id > 0 ? $lang_id : -1 ), 1 ) > 0 && $WSM_user->id < 1 )
{
?>
VJ5 - print ( $lang_id == 2 ? "Tiedoston saatavuus on rajoitettu!" : "File access restricted!" ); ?>
print ( $lang_id == 2 ? "Tiedoston saatavuus on rajoitettu!" : "File access restricted!" ); ?>
}
unset( $loginpage_id );
}
unset( $q );
@mysql_close( WSM_CONN );
exit;
}
}
unset( $temp, $domain_id );
}
unset( $mod );
## ------------------------------
## the file object
$file = new Library();
if( ( isset( $_GET[ "fid" ] ) && strpos( $_GET[ "fid" ], "x" ) !== false ) || ( strpos( $_SERVER[ "QUERY_STRING" ], "x" ) !== false && strpos( $_SERVER[ "QUERY_STRING" ], "=" ) === false ) )
{
## file pointer of a physical directory
$qs = ( isset( $_GET[ "fid" ] ) && strpos( $_GET[ "fid" ], "x" ) !== false ? $_GET[ "fid" ] : $_SERVER[ "QUERY_STRING" ] );
$cat_id = substr( $qs, 0, strpos( $qs, "x" ) );
$pointer = trim( substr( $qs, ( strpos( $qs, "x" ) + 1 ), 10000 ) );
unset( $qs );
$cat = new LibraryCat();
if( $cat->load( $cat_id ) )
{
if( substr( $cat->physical_path, -1 ) != "/" )
{
$cat->physical_path .= "/";
}
if( $dir = dir( $cat->physical_path ) )
{
$i = 0;
while( false !== ( $entry = $dir->read() ) )
{
if( !is_dir( $cat->physical_path.$entry ) && trim( $entry ) != "." && trim( $entry ) != ".." )
{
if( $i == $pointer )
{
if( ( file_exists( $cat->physical_path.$entry ) ) && ( trim( $entry ) != "" ) )
{
checkGoogleAnalytics( $cat, $entry );
if( strpos( strtolower( $_SERVER[ "HTTP_USER_AGENT" ] ), "gsa-crawler" ) === false && ( strtolower( $_SERVER[ "HTTPS" ] ) == "on" || $_SERVER[ "SERVER_PORT" ] == 443 ) )
{
header( "Cache-Control: maxage=1" );
header( "Pragma: public" );
}
header( "Content-Type: application/octet-stream" );
if( strpos( strtoupper( $_SERVER[ "SERVER_SOFTWARE" ] ), "IIS" ) === false )
{
header( "Content-Location: ".$cat->physical_path.$entry );
}
header( "Content-Disposition:".( strpos( $HTTP_USER_AGENT, "MSIE" ) === false ? " attachment;" : "" )." filename=".( function_exists( "method_exists" ) && method_exists( $cat, "simplifyFileName" ) ? $cat->simplifyFileName( $entry ) : $entry ) );
header( "Content-Length: ".filesize( $cat->physical_path.$entry ) );
if( $fp = fopen( $cat->physical_path.$entry, "rb" ) )
{
while( !feof( $fp ) && connection_status() == 0 )
{
print( fread( $fp, 1024 * 8 ) );
flush();
}
# fpassthru( $fp );
fclose( $fp );
if( !class_exists( "LogWriter" ) )
{
include_once( "mods/mod_main/class_logwriter.inc" );
}
if( class_exists( "LogWriter" ) && function_exists( "getMicroTimeForVAJCache" ) )
{
$fileobj = $cat;
$fileobj->classname = "Library";
$fileobj->id = "-1";
$fileobj->name = $cat->name."/".$entry;
$fileobj->filename = $cat->physical_path.$entry;
$log = new LogWriter( getMicroTimeForVAJCache() - $VAJ_cache_generation_time, EVENT_FILE, -1, $fileobj );
unset( $log, $fileobj );
}
}
# readfile( $cat->physical_path.$entry );
$dir->close();
unset( $cat );
@mysql_close( WSM_CONN );
exit;
}
}
$i++;
}
}
$dir->close();
}
}
}
else
{
$fid = $_SERVER[ "QUERY_STRING" ];
if( $_GET[ "fid" ] > 0 )
{
$fid = $_GET[ "fid" ];
}
elseif( $_GET[ "id" ] > 0 )
{
$fid = $_GET[ "id" ];
}
if( $_GET[ "library_id" ] > 0 )
{
$fid = $_GET[ "library_id" ];
}
if( $_POST[ "file_id" ] > 0 )
{
$fid = $_POST[ "file_id" ];
}
if( $_GET[ "file_id" ] > 0 )
{
$fid = $_GET[ "file_id" ];
}
if( $_GET[ "nolog" ] == 1 )
{
$nolog = 1;
}
if( $file->load( $fid, ( ( $nolog == 1 ) ? 0 : 1 ), 1 ) ) // lisätty cui_editor_override 26.7.2004
{
$cat = new LibraryCat();
if( $cat->load( $file->cat_id, 1 ) ) // lisätty cui_editor_override 26.7.2004
{
$domain = new Domain();
$domain_id = $file->domain_id;
if( $file->copy_id > 0 && false ) // ETä/JIs 27.9.2005 poistettu, koska muuten ei voida ladata päivitetyn tiedostoa
{
## ---------------------
## tarkastetaan onko kopio toisessa domainissa
$cfile = new Library();
if( $cfile->load( $file->copy_id, 0 ) )
{
$domain_id = $cfile->domain_id;
}
unset( $cfile );
}
if( $domain->load( $domain_id ) )
{
if( $cat->enable_backupcopy == 1 )
{
$serveurl = "";
$dom_ids = array();
if( $file->user->id > 0 )
{
$dom_ids = $file->user->domainIds();
}
else
{
$q = new QueryObject( WSM_CONN );
$query_string = "SELECT domain_id FROM domain ".
"WHERE active = 1 ".
"AND date_publish <= ".date( "YmdHi" )." ".
"AND ( date_expire < 1 OR date_expire > ".date( "YmdHi" )." )";# ".
#"AND cui_mode = 1";
$q->query( $query_string );
if( $q->numrows() > 0 )
{
$td = new Domain();
while( $q->fetchrow() )
{
if( $td->load( $q->field( "domain_id" ) ) )
{
if( $td->checkIPRestriction() )
{
$dom_ids[] = $td->id;
}
}
}
unset( $td );
}
unset( $q );
}
if( count( $dom_ids ) > 0 )
{
$file_domain_was_in = false;
$td = new Domain();
foreach( $dom_ids AS $did )
{
if( $td->load( $did ) )
{
if( $td->id == $file->domain_id )
{
$file_domain_was_in = true;
break;
}
if( trim( $file->module->getModulePropertyVal( $did, "FileServeURL" ) ) != "" && $serveurl == "" )
{
$serveurl = trim( $file->module->getModulePropertyVal( $did, "FileServeURL" ) );
}
}
}
if( $file_domain_was_in )
{
$serveurl = "";
}
unset( $did, $td, $file_domain_was_in );
}
unset( $dom_ids );
if( trim( $serveurl ) != "" )
{
global $REMOTE_ADDR;
$reloc_url = $serveurl."serve_file.php".
#"?checksum=".md5( date( "YmdH" ).",".$file->storename.",".$file->filename.",".$REMOTE_ADDR ).
#"?checksum=".md5( date( "YmdH" ).",".$file->storename.",".$file->filename ).
"?checksum=".md5( date( "Ymd" ).",".$file->storename.",".$file->filename ).
"&file=".$file->storename.
"&name=".$file->filename.
"&type=".$file->type;
header( "Location: ".$reloc_url );
unset( $serveurl, $reloc_url );
@mysql_close( WSM_CONN );
exit;
}
unset( $serveurl );
}
if( is_object( $file->module ) )
{
$alt_serve = $file->module->getModulePropertyVal( $file->domain_id, "FileServeURL" );
if( trim( $alt_serve ) != "" )
{
global $REMOTE_ADDR;
#$chk = md5( date( "YmdH" ).",".$file->storename.",".$file->filename.",".$REMOTE_ADDR );
#$chk = md5( date( "YmdH" ).",".$file->storename.",".$file->filename );
$chk = md5( date( "Ymd" ).",".$file->storename.",".$file->filename );
print "\n".
"\nrequesting file...".
"\n".
"\n".
"\n".
"\n";
@mysql_close( WSM_CONN );
exit;
}
unset( $alt_serve );
}
if( ( file_exists( $file->getStorePath( $domain ).$file->storename ) ) && ( trim( $file->storename ) != "" ) )
{
## ------------------------------------------------------------
## ETä, MSi 16.6.2009: tarkastetaan pitääkö pyytää tietoja lomake-editorin lomakkeella ennen lomakkeen latausta
$download_request_done = false;
$req_info_survey_id = $file->getCodeParams( "REQ_INFO_BEFORE_DOWNLOADING_FORM_ID", -1 );
$req_info_survey_post_action = $file->getCodeParams( "REQ_INFO_BEFORE_DOWNLOADING_FORM_ACTION", "allowDownload" );
if( $req_info_survey_id > 0 && $_GET[ "id" ] == $file->id && trim( $_GET[ "email" ] ) != "" )
{
if( !is_object( $q ) )
{
$q = new QueryObject( WSM_CONN );
}
$query_string = "SELECT answer_id FROM survey_answers WHERE survey_id = ".$req_info_survey_id." AND file_id = ".$file->id." AND MD5( CONCAT( 'FILE_REC: ', answer ) ) = '".trim( $_GET[ "email" ] )."' LIMIT 0, 1";
$q->query( $query_string );
if( $q->numrows() > 0 )
{
$download_request_done = true;
}
}
## ETä 16.11.2010: lisäsin tänne cookie-tunnistuksen, jotta tiedonannon voisi ohittaa kerran tiedot antaneena
if( !$download_request_done && isset( $_COOKIE[ "VJF_DOWNLOAD_".$file->id ] ) && trim( $_COOKIE[ "VJF_DOWNLOAD_".$file->id ] ) != "" )
{
$download_request_done = true;
}
if( !$download_request_done && $req_info_survey_id > 0 && trim( $req_info_survey_post_action ) != "" )
{
if( !headers_sent() )
{
header( "Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
header( "Last-Modified: ".gmdate( "D, d M Y H:i:s" )." GMT" );
header( "Cache-Control: no-cache, must-revalidate" );
header( "Pragma: no-cache" );
}
include_once( "mods/mod_newsurvey/class_survey.inc" );
include_once( "mods/mod_newsurvey/class_surveybutton.inc" );
include_once( "mods/mod_newsurvey/class_surveyelement.inc" );
include_once( "mods/mod_newsurvey/class_surveyoption.inc" );
include_once( "mods/mod_newsurvey/class_surveysheet.inc" );
include_once( "mods/mod_newsurvey/class_surveystyle.inc" );
include_once( "mods/mod_newsurvey/class_surveyanswer.inc" );
include_once( "mods/mod_newsurvey/class_surveyanswer.inc" );
include_once( "mods/mod_newsurvey/class_surveylayout.inc" );
include_once( "mods/mod_newsurvey/class_surveyparser.inc" );
global $_POST, $lang_id;
$lang_id = $file->lang_id;
$survey = new SurveyParser( $req_info_survey_id, $_POST[ "sheet_id" ], 0, false, "", -1, $file->id );
if( $survey->survey_final_submission_done === true )
{
## ETä 16.11.2010: lisäsin tänne cookie-tunnistuksen, jotta tiedonannon voisi ohittaa kerran tiedot antaneena
if( !headers_sent() )
{
setcookie( "VJF_DOWNLOAD_".$file->id, date( "YmdHis" ), 0, "/" ); //time() + ( 60 * 60 * 24 )
}
$_COOKIE[ "VJF_DOWNLOAD_".$file->id ] = date( "YmdHis" );
$download_request_done = true;
if( $req_info_survey_post_action == "sendAsEmail" )
{
$email_recipient = trim( $survey->survey->getRecipientEmailAddressFromEmailElement() );
$email_sender = $file->getCodeParams( "REQ_INFO_BEFORE_DOWNLOADING_EMAIL_SENDER", "" );
$email_subject = str_replace( "%nl%", " ", $file->getCodeParams( "REQ_INFO_BEFORE_DOWNLOADING_EMAIL_SUBJECT", "" ) );
$email_body = str_replace( "%nl%", "\n", $file->getCodeParams( "REQ_INFO_BEFORE_DOWNLOADING_EMAIL_MESSAGE", "" ) );
if( strpos( $email_recipient, "@" ) !== false && strpos( $email_sender, "@" ) !== false && trim( $email_subject ) != "" && trim( $email_body ) != "" )
{
if( !function_exists( "getMicroTimeForVAJCache" ) )
{
function getMicroTimeForVAJCache()
{
list( $usec, $sec ) = explode( " ", microtime() );
return ( ( float ) $usec + ( float ) $sec );
}
}
if( function_exists( "getMicroTimeForVAJCache" ) )
{
$VAJ_cache_generation_time = getMicroTimeForVAJCache();
}
#global $_SERVER;
#if( $_SERVER[ "REMOTE_ADDR" ] == "62.142.78.10" && strpos( $email_body, "%file_download_link%" ) === false )
#{
# $email_body .= "\n\nAutomatic addition shown only if request done from Verkkoasema IP:\nIf the copy is missing, please click the following link: %file_download_link%";
#}
if( strpos( $email_body, "%file_download_link%" ) !== false )
{
$email_body = str_replace( "%file_download_link%", $domain->base_url."file.php?id=".$file->id."&email=".md5( "FILE_REC: ".$email_recipient ), $email_body );
}
include_once( "mods/mod_emailer/class_emailer.inc" );
$e = new Emailer();
$e->clearExtraHeader();
$e->addToExtraHeader( "From: ".$email_sender."\r\n" );
$e->putSender( $email_sender );
$e->putRecipient( $email_recipient );
$e->putAttachment( $file->getStorePath( $domain ).$file->storename, $file->size, $file->filename, $file->type );
$e->putSubject( $email_subject );
if( strpos( $email_recipient, "@gmail." ) !== false )
{
$e->setCharacterEncoding( "iso-8859-15" );
}
$e->putBody( $email_body );
## ETä 13.7.2009: ei tarvita enää, kun quoted-printable-ongelma on ratkaistu googlemailissakin...
# $e->putHTMLcontent( "\r\n".strip_tags( $email_subject )."\r\n\r\n\r\n".trim( nl2br( $email_body ) )."\r\n\r\n\r\n" );
# $e->putHTMLcontent( nl2br( $email_body ) );
if( $e->sendMail() )
{
print $survey->printSurvey();
if( !class_exists( "LogWriter" ) )
{
include_once( "mods/mod_main/class_logwriter.inc" );
}
if( class_exists( "LogWriter" ) && function_exists( "getMicroTimeForVAJCache" ) && isset( $VAJ_cache_generation_time ) )
{
$log = new LogWriter( getMicroTimeForVAJCache() - $VAJ_cache_generation_time, EVENT_FILE, -1, $file );
unset( $log );
}
@mysql_close( WSM_CONN );
exit;
}
unset( $e );
}
unset( $email_sender, $email_recipient, $email_subject, $email_body );
}
}
else
{
## näytetään lomake
?>
print "FILE/".$file->name." (".$file->filename.") - ".$survey->survey->name; ?>
print ( $survey->survey->lang_id == 10 ? "\n\t" : "" ).
( $survey->survey->lang_id == 5 ? "\n\t" : "" ).
( $survey->survey->lang_id == 3 ? "\n\t" : "" ).
( $survey->survey->lang_id != 10 && $survey->survey->lang_id != 5 && $survey->survey->lang_id != 3 ? "\n\t" : "" )."\n";
?>
if( trim( $survey->max_allowed_answers_message ) != "" )
{
print $survey->max_allowed_answers_message;
}
else if( $survey->has_answered_already )
{
if( $survey->survey->nbr_allowed_one > 1 )
{
print ( $lang_id == 2 ? "Olet jo lähettänyt tämän lomakkeen ".$survey->survey->nbr_allowed_one." kertaa, mikä on sallittu enimmäismäärä." : "You have already submitted this form for ".$survey->survey->nbr_allowed_one." times, which is the maximum allowed amount." );
}
else
{
print ( $lang_id == 2 ? "Olet jo lähettänyt tämän lomakkeen kerran." : "You have already submitted this form once." );
}
}
else
{
$form = $survey->printSurvey();
$form = preg_replace( "/