BUG 7048 Solved question mark in email while using Russian Language

The problem was resolved sending characteres in url with base64
This commit is contained in:
Douglas Medrano Chura
2011-08-15 17:21:18 -04:00
parent e7dbd182b9
commit 3f12411e3a
3 changed files with 39 additions and 45 deletions

View File

@@ -376,21 +376,20 @@ class spoolRun {
$oPHPMailer->From = $this->fileData['from_email']; $oPHPMailer->From = $this->fileData['from_email'];
$oPHPMailer->FromName = utf8_decode($this->fileData['from_name']); $oPHPMailer->FromName = utf8_decode($this->fileData['from_name']);
$msSubject = $this->fileData['subject']; $msSubject = $this->fileData['subject'];
if(!(mb_detect_encoding($msSubject, "UTF-8") == "UTF-8")) { if(!(mb_detect_encoding($msSubject, "UTF-8") == "UTF-8")) {
$msSubject = utf8_encode($msSubject); $msSubject = utf8_encode($msSubject);
} }
$oPHPMailer->Subject = $msSubject; $oPHPMailer->Subject = $msSubject;
$msBody = $this->fileData['body']; $msBody = $this->fileData['body'];
if(!(mb_detect_encoding($msBody, "UTF-8") == "UTF-8")) { if(!(mb_detect_encoding($msBody, "UTF-8") == "UTF-8")) {
$msBody = utf8_encode($msBody); $msBody = utf8_encode($msBody);
} }
$oPHPMailer->Body = $msBody; $oPHPMailer->Body = $msBody;
if($this->fileData['attachments']) if($this->fileData['attachments'])
$oPHPMailer->AddAttachment($this->fileData['attachments']); $oPHPMailer->AddAttachment($this->fileData['attachments']);
foreach( $this->fileData['envelope_to'] as $sEmail ) { foreach( $this->fileData['envelope_to'] as $sEmail ) {
$evalMail = strpos($sEmail, '<'); $evalMail = strpos($sEmail, '<');
if( strpos($sEmail, '<') !== false ) { if( strpos($sEmail, '<') !== false ) {
preg_match($this->longMailEreg, $sEmail, $matches); preg_match($this->longMailEreg, $sEmail, $matches);
$sTo = trim($matches[3]); $sTo = trim($matches[3]);

View File

@@ -456,44 +456,44 @@ try {
break; break;
case 'saveFile': case 'saveFile':
global $G_PUBLISH; global $G_PUBLISH;
$G_PUBLISH = new Publisher(); $G_PUBLISH = new Publisher();
$sDir = ""; $sDir = "";
if(isset($_REQUEST['MAIN_DIRECTORY'])) if(isset($_REQUEST['MAIN_DIRECTORY']))
$sDir = $_REQUEST['MAIN_DIRECTORY']; $sDir = $_REQUEST['MAIN_DIRECTORY'];
switch($sDir){ switch($sDir){
case 'mailTemplates' : $sDirectory = PATH_DATA_MAILTEMPLATES . $_REQUEST['pro_uid'] . PATH_SEP . $_REQUEST['filename']; case 'mailTemplates' : $sDirectory = PATH_DATA_MAILTEMPLATES . $_REQUEST['pro_uid'] . PATH_SEP . $_REQUEST['filename'];
break; break;
case 'public' : $sDirectory = PATH_DATA_PUBLIC . $_REQUEST['pro_uid'] . PATH_SEP . $_REQUEST['filename']; case 'public' : $sDirectory = PATH_DATA_PUBLIC . $_REQUEST['pro_uid'] . PATH_SEP . $_REQUEST['filename'];
break; break;
default : $sDirectory = PATH_DATA_MAILTEMPLATES . $_REQUEST['pro_uid'] . PATH_SEP . $_REQUEST['filename']; default : $sDirectory = PATH_DATA_MAILTEMPLATES . $_REQUEST['pro_uid'] . PATH_SEP . $_REQUEST['filename'];
break; break;
} }
header("Content-Type: text/html; charset=utf-8");
$fp = fopen($sDirectory, 'w'); $fp = fopen($sDirectory, 'w');
$content = stripslashes($_REQUEST['fcontent']); $content = stripslashes($_REQUEST['fcontent']);
$content = str_replace("@amp@", "&", $content); $content = str_replace("@amp@", "&", $content);
$content = base64_decode($content); $content = base64_decode($content);
fwrite($fp, $content);
fwrite($fp, $content); fclose($fp);
fclose($fp); echo 'saved: '. $sDirectory;
echo 'saved: '. $sDirectory;
break; break;
case 'events': case 'events':
$oProcessMap->eventsList($oData->pro_uid, $oData->type); $oProcessMap->eventsList($oData->pro_uid, $oData->type);
break; break;
/* /*
case 'saveFile': case 'saveFile':
global $G_PUBLISH; global $G_PUBLISH;
$G_PUBLISH = new Publisher(); $G_PUBLISH = new Publisher();
$sDirectory = PATH_DATA_MAILTEMPLATES . $_REQUEST['pro_uid'] . PATH_SEP . $_REQUEST['filename']; $sDirectory = PATH_DATA_MAILTEMPLATES . $_REQUEST['pro_uid'] . PATH_SEP . $_REQUEST['filename'];
$fp = fopen($sDirectory, 'w'); $fp = fopen($sDirectory, 'w');
$content = stripslashes($_REQUEST['fcontent']); $content = stripslashes($_REQUEST['fcontent']);
$content = str_replace("@amp@", "&", $content); $content = str_replace("@amp@", "&", $content);
fwrite($fp, $content); fwrite($fp, $content);
fclose($fp); fclose($fp);
echo 'saved: '. $sDirectory; echo 'saved: '. $sDirectory;
break; break;
*/ */
case 'emptyFileOptions': case 'emptyFileOptions':
global $G_PUBLISH; global $G_PUBLISH;

View File

@@ -97,22 +97,17 @@ if( typofile[typofile.length-1].toLowerCase() != 'txt' && typofile[typofile.leng
function saveFile(pro_uid, fileName){ function saveFile(pro_uid, fileName){
var fc64 = base64_encode(getField('fcontent').value); var fc64 = base64_encode(getField('fcontent').value);
fc64 = fc64.replace(/&amp;/g, "@amp@"); fc64 = fc64.replace(/&amp;/g, "@amp@");
fc64 = fc64.replace(/\+/g, '%2B'); fc64 = fc64.replace(/\+/g, '%2B');
fc = getField('fcontent').value;
fc = escape(fc);
fc = fc.replace(/&amp;/g, "@amp@");
fc = fc.replace(/\+/g, '%2B');
var oRPC = new leimnud.module.rpc.xmlhttp({ var oRPC = new leimnud.module.rpc.xmlhttp({
url : 'processes_Ajax', url : 'processes_Ajax',
args: 'action=saveFile&filename='+fileName+'&pro_uid='+pro_uid+'&MAIN_DIRECTORY='+CURRENT_MAIN_DIRECTORY+'&fcontent='+fc64 args: 'action=saveFile&filename='+fileName+'&pro_uid='+pro_uid+'&MAIN_DIRECTORY='+CURRENT_MAIN_DIRECTORY+'&fcontent='+fc64
}); });
oPanel.loader.show(); oPanel.loader.show();
oRPC.callback = function(rpc) { oRPC.callback = function(rpc) {
oPanel.remove(); oPanel.remove();
}.extend(this); }.extend(this);
oRPC.make(); oRPC.make();
} }
var showCreateEmptyOptionsPanel; var showCreateEmptyOptionsPanel;