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.")"; ?> "> function setdwnld() { var dwnldtmt = self.setTimeout( 'new function() { self.location = \'\' }', 1500 ); } onload = setdwnld; */ 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ä. 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!" ); ?>

" style="margin:0px;" autocomplete="off" onSubmit="return checkf( this );">
" onFocus="if( this.value == '**********' ) { this.value = ''; }" onBlur="if( this.value == '' ) { this.value = '**********'; }" class="txt">
" class="buttonHot">
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". "\nstorename."\">". "\nfilename."\">". "\nforce_download == 1 ? "application/octet-stream" : $file->type )."\">". "\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; ?> 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"; ?> 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( "/
]*>/i", "$0id."\">", $form ); print $form; unset( $form ); } ?> user->id > 0 &&*/ $cat->isFTPFolder() ) //vaihtoehtoinen tunnistustapa: $file->getStorePath( $domain ) != $domain->library_path ) { $ftp_ok = true; if( function_exists( "ftp_connect" ) && function_exists( "ftp_login" ) && trim( $cat->getFTPURI( "%host_from_server%" ) ) != "" ) { #$use_ftp_host = ( trim( $cat->getFTPURI( "%host_from_server%" ) ) != "" ? $cat->getFTPURI( "%host_from_server%" ) : $cat->getFTPURI( "%host%" ) ); $use_ftp_host = $cat->getFTPURI( "%host_from_server%" ); $ftp_conn = @ftp_connect( $use_ftp_host ); if( is_resource( $ftp_conn ) ) { # $ftp_ok = @ftp_login( $ftp_conn, "anonymous", "" ); //$cat->getFTPURI( "%username%" ), $cat->getFTPURI( "%password%" ) ); #print "pojmpom32344: ".( $ftp_ok ? "y" : "n" ); } @ftp_close( $ftp_conn ); unset( $ftp_conn, $use_ftp_host ); } if( $ftp_ok ) { /* ? > Ohjataan uudelleen/Relocating... getFTPURI( "%store_path%" )."/" ) ) ) { $ftp_path = str_replace( "//", "/", $cat->getFTPURI( "%store_path%" )."/" ); if( $dir = dir( $ftp_path ) ) { function deleteFTPDirsRecursively( $del_this = "" ) { if( is_file( $del_this ) ) { return unlink( $del_this ); } elseif( is_dir( $del_this ) ) { $subs = glob( rtrim( $del_this, "/" )."/*" ); foreach( $subs AS $del_this_sub ) { deleteFTPDirsRecursively( $del_this_sub ); } unset( $subs, $del_this_sub ); return rmdir( $del_this ); } } clearstatcache(); while( false !== ( $entry = $dir->read() ) ) { if( substr( $entry, 0, 2 ) == "d_" && is_dir( $ftp_path.$entry ) && filemtime( $ftp_path.$entry ) < time() - ( 2 * 60 * 60 ) ) { deleteFTPDirsRecursively( $ftp_path.$entry ); } } unset( $entry ); } unset( $ftp_path ); } $download_dir_name = "d_".strtolower( md5( time()."_".$file->user->id ) ); if( !is_dir( str_replace( "//", "/", $cat->getFTPURI( "%store_path%" )."/".$download_dir_name ) ) ) { mkdir( str_replace( "//", "/", $cat->getFTPURI( "%store_path%" )."/".$download_dir_name ) ); chmod( str_replace( "//", "/", $cat->getFTPURI( "%store_path%" )."/".$download_dir_name ), 0777 ); } @link( str_replace( "//", "/", $cat->getFTPURI( "%store_path%" )."/".$file->storename ), str_replace( "//", "/", $cat->getFTPURI( "%store_path%" )."/".$download_dir_name."/".$file->filename ) ); header( "Location: ftp://".str_replace( "//", "/", str_replace( "//", "/", $cat->getFTPURI( "%username%:%password%@%host%/%uri%" )."/".$download_dir_name."/".$file->filename ) ) ); //anonymous: exit; } unset( $$ftp_ok ); } if( strtolower( $_SERVER[ "HTTPS" ] ) == "on" || $_SERVER[ "SERVER_PORT" ] == 443 ) { header( "Cache-Control: maxage=1" ); header( "Pragma: public" ); } header( "Content-Type: ".( $file->force_download == 1 ? "application/octet-stream" : $file->type ) ); if( strpos( strtoupper( $_SERVER[ "SERVER_SOFTWARE" ] ), "IIS" ) === false ) { header( "Content-Location: ".$file->getStorePath( $domain ).$file->storename ); } header( "Content-Disposition:".( strpos( "Q".$_SERVER["HTTP_USER_AGENT"], "MSIE" ) == false ? " attachment;" : "" )." filename=".( function_exists( "method_exists" ) && method_exists( $file, "simplifyFileName" ) ? $file->simplifyFileName( $file->filename ) : $file->filename ) ); header( "Content-Length: ".filesize( $file->getStorePath( $domain ).$file->storename ) ); #@makeSpecialVJLog( "logs/special/files_".$_SERVER[ "REMOTE_ADDR" ].".log", "Serving file (force download: ".$file->force_download."; type: ".$file->type."; filename: ".$file->filename."; size: ".filesize( $file->getStorePath( $domain ).$file->storename )."; path: ".$file->getStorePath( $domain ).$file->storename.")" ); if( $fp = fopen( $file->getStorePath( $domain ).$file->storename, "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" ) ) { $log = new LogWriter( getMicroTimeForVAJCache() - $VAJ_cache_generation_time, EVENT_FILE, -1, $file ); unset( $log ); } } # readfile( $file->getStorePath( $domain ).$file->storename ); @mysql_close( WSM_CONN ); exit; } unset( $download_request_done ); } } } } } @mysql_close( WSM_CONN ); ?>