BUG 1: As the topic says, when I build a website with SC 7 it simply doesnt work unless I set my browser in desktop mode (android tested with chrome, maxthon, firefox).
A file download doesnt work either, the code that is generated is basically not tested well
if (is_file($trab_doc))
{
header("Pragma: public", true);
header("Content-type: application/force-download");
$sProtectedFilename = str_replace(array(' ', "'", '!', ',', '-', '+'), array('__SC_SPACE__', '__SC_QUOTES__', '__SC_EXCLAMATION__', '__SC_COMMA__', '__SC_MINUS__', '__SC_PLUS__'), $nm_nome_doc);
$sProtectedFilename = urlencode($sProtectedFilename);
$sProtectedFilename = str_replace(array('__SC_SPACE__', '__SC_QUOTES__', '__SC_EXCLAMATION__', '__SC_COMMA__', '__SC_MINUS__', '__SC_PLUS__'), array(' ', "'", '!', ',', '-', '+'), $sProtectedFilename);
if (isset($_SERVER['HTTP_USER_AGENT']) && false !== strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'chrome'))
{
header("Content-Disposition: attachment; filename=\"" . $sProtectedFilename . "\"");
}
elseif (isset($_SERVER['HTTP_USER_AGENT']) && false !== strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'applewebkit'))
{
header("Content-Disposition: attachment; filename=\"" . $nm_nome_doc . "\"");
}
elseif (function_exists('NM_utf8_urldecode') && $nm_nome_doc != NM_utf8_urldecode($nm_nome_doc))
{
header("Content-Disposition: attachment; filename=\"" . $nm_nome_doc . "\" filename*=UTF-8''" . $sProtectedFilename);
}
else
{
header("Content-Disposition: attachment; filename=\"" . $sProtectedFilename . "\"");
}
readfile($trab_doc);
}
BUG 2: This generated code does NOT allow ie 6,7,8 to download properly
This adapted one does:
if (is_file($trab_doc))
{
// header("Pragma: public", true);
// header("Content-type: application/force-download");
if (isset($_SERVER['HTTP_USER_AGENT']) && false !== strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'applewebkit')){
header("Content-Description: File Transfer");
header("Expires: 0");
header("Pragma: public");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
}else{
header("Pragma: public", true);
header("Content-type: application/force-download");
}
$sProtectedFilename = str_replace(array(' ', "'", '!', ',', '-', '+'), array('__SC_SPACE__', '__SC_QUOTES__', '__SC_EXCLAMATION__', '__SC_COMMA__', '__SC_MINUS__', '__SC_PLUS__'), $nm_nome_doc);
$sProtectedFilename = urlencode($sProtectedFilename);
$sProtectedFilename = str_replace(array('__SC_SPACE__', '__SC_QUOTES__', '__SC_EXCLAMATION__', '__SC_COMMA__', '__SC_MINUS__', '__SC_PLUS__'), array(' ', "'", '!', ',', '-', '+'), $sProtectedFilename);
if (isset($_SERVER['HTTP_USER_AGENT']) && false !== strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'chrome'))
{
header("Content-Disposition: attachment; filename=\"" . $sProtectedFilename . "\"");
}
elseif (isset($_SERVER['HTTP_USER_AGENT']) && false !== strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'applewebkit'))
{
header("Content-Disposition: attachment; filename=\"" . $nm_nome_doc . "\"");
}
elseif (function_exists('NM_utf8_urldecode') && $nm_nome_doc != NM_utf8_urldecode($nm_nome_doc))
{
header("Content-Disposition: attachment; filename=\"" . $nm_nome_doc . "\" filename*=UTF-8''" . $sProtectedFilename);
}
else
{
header("Content-Disposition: attachment; filename=\"" . $sProtectedFilename . "\"");
}
header('Content-Transfer-Encoding: binary');
header("Content-Length: ".filesize($trab_doc));
readfile($trab_doc);
}
in SC6 bug 1 didnt occur… There browsing with mobile firefox/maxthon/safari/chrome worked…
FIX IT NOW please… I dont want to hack in the generated code to circumvent your bugs.