2011-01-26 22:33:41 +00:00
|
|
|
<?php
|
2025-10-07 11:13:49 -04:00
|
|
|
|
|
|
|
|
use ProcessMaker\Model\User;
|
|
|
|
|
|
|
|
|
|
|
2012-10-17 18:13:05 -04:00
|
|
|
if (($RBAC_Response = $RBAC->userCanAccess( "PM_LOGIN" )) != 1)
|
|
|
|
|
return $RBAC_Response;
|
2011-01-26 22:33:41 +00:00
|
|
|
|
2012-10-17 18:13:05 -04:00
|
|
|
$direction = PATH_IMAGES_ENVIRONMENT_USERS . $_REQUEST['pUID'] . ".gif";
|
2011-01-26 22:33:41 +00:00
|
|
|
// header('Pragma: ');
|
|
|
|
|
// header('Cache-Control: cache');
|
|
|
|
|
|
|
|
|
|
|
2012-10-17 18:13:05 -04:00
|
|
|
if (! file_exists( $direction )) {
|
2025-10-07 11:13:49 -04:00
|
|
|
$user = new User();
|
|
|
|
|
$filters = array(
|
|
|
|
|
'limit' => 1,
|
|
|
|
|
'fields' => ['USR_UID'],
|
|
|
|
|
'conditions' => [['USR_ID', '=', $_REQUEST['pUID']]]
|
|
|
|
|
);
|
|
|
|
|
$result = $user->show($filters);
|
|
|
|
|
if ($result['total'] == 1){
|
|
|
|
|
$direction = PATH_IMAGES_ENVIRONMENT_USERS . $result['data'][0]['USR_UID'] . ".gif";
|
|
|
|
|
if (! file_exists( $direction )) {
|
|
|
|
|
$direction = PATH_HOME . 'public_html/images/user.gif';
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$direction = PATH_HOME . 'public_html/images/user.gif';
|
|
|
|
|
}
|
2012-10-17 18:13:05 -04:00
|
|
|
}
|
2025-10-07 11:13:49 -04:00
|
|
|
|
2012-10-17 18:13:05 -04:00
|
|
|
G::sendHeaders( $direction );
|
2011-01-26 22:33:41 +00:00
|
|
|
|
2012-10-17 18:13:05 -04:00
|
|
|
DumpHeaders( $direction );
|
2011-01-26 22:33:41 +00:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* This function is verified to work with Netscape and the *very latest*
|
|
|
|
|
* version of IE. I don't know if it works with Opera, but it should now.
|
|
|
|
|
*/
|
2012-10-17 18:13:05 -04:00
|
|
|
function DumpHeaders ($filename)
|
2011-01-26 22:33:41 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
|
|
global $root_path;
|
|
|
|
|
|
2012-10-17 18:13:05 -04:00
|
|
|
if (! $filename)
|
|
|
|
|
return;
|
2011-01-26 22:33:41 +00:00
|
|
|
|
|
|
|
|
$HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT'];
|
|
|
|
|
|
|
|
|
|
$isIE = 0;
|
|
|
|
|
|
2012-10-17 18:13:05 -04:00
|
|
|
if (strstr( $HTTP_USER_AGENT, 'compatible; MSIE ' ) !== false && strstr( $HTTP_USER_AGENT, 'Opera' ) === false) {
|
2011-01-26 22:33:41 +00:00
|
|
|
$isIE = 1;
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-17 18:13:05 -04:00
|
|
|
if (strstr( $HTTP_USER_AGENT, 'compatible; MSIE 6' ) !== false && strstr( $HTTP_USER_AGENT, 'Opera' ) === false) {
|
2011-01-26 22:33:41 +00:00
|
|
|
$isIE6 = 1;
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-17 18:13:05 -04:00
|
|
|
$aux = preg_replace( '[^-a-zA-Z0-9\.]', '_', $filename );
|
|
|
|
|
$aux = explode( '_', $aux );
|
|
|
|
|
$downloadName = $aux[count( $aux ) - 1];
|
2011-01-26 22:33:41 +00:00
|
|
|
|
2012-10-17 18:13:05 -04:00
|
|
|
if ($isIE && ! isset( $isIE6 )) {
|
|
|
|
|
// http://support.microsoft.com/support/kb/articles/Q182/3/15.asp
|
|
|
|
|
// Do not have quotes around filename, but that applied to
|
|
|
|
|
// "attachment"... does it apply to inline too?
|
2011-01-26 22:33:41 +00:00
|
|
|
|
|
|
|
|
|
2012-10-17 18:13:05 -04:00
|
|
|
// This combination seems to work mostly. IE 5.5 SP 1 has
|
|
|
|
|
// known issues (see the Microsoft Knowledge Base)
|
|
|
|
|
header( "Content-Disposition: inline; filename=$downloadName" );
|
2011-01-26 22:33:41 +00:00
|
|
|
|
2012-10-17 18:13:05 -04:00
|
|
|
// This works for most types, but doesn't work with Word files
|
|
|
|
|
header( "Content-Type: application/download; name=\"$downloadName\"" );
|
2011-01-26 22:33:41 +00:00
|
|
|
|
2012-10-17 18:13:05 -04:00
|
|
|
//header("Content-Type: $type0/$type1; name=\"$downloadName\"");
|
|
|
|
|
//header("Content-Type: application/x-msdownload; name=\"$downloadName\"");
|
|
|
|
|
//header("Content-Type: application/octet-stream; name=\"$downloadName\"");
|
|
|
|
|
} else {
|
|
|
|
|
header( "Content-Disposition: attachment; filename=\"$downloadName\"" );
|
|
|
|
|
header( "Content-Type: application/octet-stream; name=\"$downloadName\"" );
|
2011-01-26 22:33:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//$filename = PATH_UPLOAD . "$filename";
|
2012-10-17 18:13:05 -04:00
|
|
|
readfile( $filename );
|
2011-01-26 22:33:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//G::header2( "location: /files/" .$_SESSION['ENVIRONMENT']. "/" .$appid, $filename);
|
2012-10-17 18:13:05 -04:00
|
|
|
|