Skip to content

Commit cffbac3

Browse files
author
John Mertic
committed
Release 6.1.5
1 parent c49c378 commit cffbac3

File tree

109 files changed

+4192
-3082
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+4192
-3082
lines changed

crossdomain.xml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<!--
2+
/*********************************************************************************
3+
* SugarCRM is a customer relationship management program developed by
4+
* SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
5+
*
6+
* This program is free software; you can redistribute it and/or modify it under
7+
* the terms of the GNU Affero General Public License version 3 as published by the
8+
* Free Software Foundation with the addition of the following permission added
9+
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
10+
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
11+
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
12+
*
13+
* This program is distributed in the hope that it will be useful, but WITHOUT
14+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15+
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
16+
* details.
17+
*
18+
* You should have received a copy of the GNU Affero General Public License along with
19+
* this program; if not, see http://www.gnu.org/licenses or write to the Free
20+
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21+
* 02110-1301 USA.
22+
*
23+
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
24+
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
25+
*
26+
* The interactive user interfaces in modified source and object code versions
27+
* of this program must display Appropriate Legal Notices, as required under
28+
* Section 5 of the GNU Affero General Public License version 3.
29+
*
30+
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
31+
* these Appropriate Legal Notices must retain the display of the "Powered by
32+
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
33+
* technical reasons, the Appropriate Legal Notices must display the words
34+
* "Powered by SugarCRM".
35+
********************************************************************************/
36+
37+
-->
38+
<?xml version="1.0"?>
39+
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
40+
<cross-domain-policy>
41+
<site-control permitted-cross-domain-policies="none"/>
42+
</cross-domain-policy>

data/SugarBean.php

+12
Original file line numberDiff line numberDiff line change
@@ -2027,6 +2027,10 @@ function fixUpFormatting()
20272027
case 'datetime':
20282028
case 'datetimecombo':
20292029
if(empty($this->$field)) break;
2030+
if ($this->$field == 'NULL') {
2031+
$this->$field = '';
2032+
break;
2033+
}
20302034
if ( ! preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$/',$this->$field) ) {
20312035
// This appears to be formatted in user date/time
20322036
$this->$field = $timedate->to_db($this->$field);
@@ -2035,6 +2039,10 @@ function fixUpFormatting()
20352039
break;
20362040
case 'date':
20372041
if(empty($this->$field)) break;
2042+
if ($this->$field == 'NULL') {
2043+
$this->$field = '';
2044+
break;
2045+
}
20382046
if ( ! preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/',$this->$field) ) {
20392047
// This date appears to be formatted in the user's format
20402048
$this->$field = $timedate->to_db_date($this->$field, false);
@@ -2043,6 +2051,10 @@ function fixUpFormatting()
20432051
break;
20442052
case 'time':
20452053
if(empty($this->$field)) break;
2054+
if ($this->$field == 'NULL') {
2055+
$this->$field = '';
2056+
break;
2057+
}
20462058
if ( preg_match('/(am|pm)/i',$this->$field) ) {
20472059
// This time appears to be formatted in the user's format
20482060
$this->$field = $timedate->to_db_time($timedate->to_display_date(gmdate('Y-m-d')).' '.$this->$field);

download.php

+19-12
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@
7272
$local_location = (isset($_REQUEST['isTempFile'])) ? "{$GLOBALS['sugar_config']['cache_dir']}/modules/Emails/{$_REQUEST['ieId']}/attachments/{$_REQUEST['id']}"
7373
: $GLOBALS['sugar_config']['upload_dir']."/".$_REQUEST['id'];
7474

75-
if(isset($_REQUEST['isTempFile']) && ($_REQUEST['type']=="SugarFieldImage")) {
76-
$local_location = $GLOBALS['sugar_config']['upload_dir']."/".$_REQUEST['id'];
75+
if(isset($_REQUEST['isTempFile']) && ($_REQUEST['type']=="SugarFieldImage")) {
76+
$local_location = $GLOBALS['sugar_config']['upload_dir']."/".$_REQUEST['id'];
7777
}
78-
78+
7979
if(!file_exists( $local_location ) || strpos($local_location, "..")) {
8080
die($app_strings['ERR_INVALID_FILE_REFERENCE']);
8181
}
@@ -87,7 +87,7 @@
8787
$query = "SELECT filename name FROM document_revisions INNER JOIN documents ON documents.id = document_revisions.document_id ";
8888
$query .= "WHERE document_revisions.id = '" . $_REQUEST['id'] ."'";
8989
} elseif($file_type == 'kbdocuments') {
90-
$query="SELECT document_revisions.filename name FROM document_revisions INNER JOIN kbdocument_revisions ON document_revisions.id = kbdocument_revisions.document_revision_id INNER JOIN kbdocuments ON kbdocument_revisions.kbdocument_id = kbdocuments.id ";
90+
$query="SELECT document_revisions.filename name FROM document_revisions INNER JOIN kbdocument_revisions ON document_revisions.id = kbdocument_revisions.document_revision_id INNER JOIN kbdocuments ON kbdocument_revisions.kbdocument_id = kbdocuments.id ";
9191
$query .= "WHERE document_revisions.id = '" . $_REQUEST['id'] ."'";
9292
} elseif($file_type == 'notes') {
9393
$query = "SELECT filename name FROM notes ";
@@ -117,29 +117,36 @@
117117
$download_location = $local_location;
118118
$name = $_REQUEST['tempName'];
119119
}
120-
120+
121121
if(isset($_SERVER['HTTP_USER_AGENT']) && preg_match("/MSIE/", $_SERVER['HTTP_USER_AGENT']))
122-
{
122+
{
123123
$name = urlencode($name);
124124
$name = str_replace("+", "_", $name);
125125
}
126126

127127
header("Pragma: public");
128128
header("Cache-Control: maxage=1, post-check=0, pre-check=0");
129-
if(isset($_REQUEST['isTempFile']) && ($_REQUEST['type']=="SugarFieldImage"))
130-
header("Content-type: image");
131-
else {
132-
header("Content-type: application/force-download");
133-
header("Content-disposition: attachment; filename=\"".$name."\";");
129+
if(isset($_REQUEST['isTempFile']) && ($_REQUEST['type']=="SugarFieldImage")) {
130+
$mime = getimagesize($download_location);
131+
if(!empty($mime)) {
132+
header("Content-Type: {$mime['mime']}");
133+
} else {
134+
header("Content-Type: image/png");
135+
}
136+
} else {
137+
header("Content-Type: application/force-download");
138+
header("Content-Disposition: attachment; filename=\"".$name."\";");
134139
}
140+
// disable content type sniffing in MSIE
141+
header("X-Content-Type-Options: nosniff");
135142
header("Content-Length: " . filesize($local_location));
136143
header("Expires: 0");
137144
set_time_limit(0);
138145

139146
@ob_end_clean();
140147
ob_start();
141148

142-
echo file_get_contents($download_location);
149+
readfile($download_location);
143150
@ob_flush();
144151
}
145152
}

0 commit comments

Comments
 (0)