[Vtigercrm-commits] [vtiger-commits] r10742 - in /vtigercrm/branches/5.0.3: Smarty/templates/ComposeEmail.tpl modules/Emails/EditView.php modules/Emails/Save.php modules/Emails/language/en_us.lang.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Fri Apr 20 04:32:41 EDT 2007


Author: richie
Date: Fri Apr 20 02:32:12 2007
New Revision: 10742

Log:
* Fixed the file validation issue, Fixed #3131

Modified:
    vtigercrm/branches/5.0.3/Smarty/templates/ComposeEmail.tpl
    vtigercrm/branches/5.0.3/modules/Emails/EditView.php
    vtigercrm/branches/5.0.3/modules/Emails/Save.php
    vtigercrm/branches/5.0.3/modules/Emails/language/en_us.lang.php

Modified: vtigercrm/branches/5.0.3/Smarty/templates/ComposeEmail.tpl
==============================================================================
--- vtigercrm/branches/5.0.3/Smarty/templates/ComposeEmail.tpl (original)
+++ vtigercrm/branches/5.0.3/Smarty/templates/ComposeEmail.tpl Fri Apr 20 02:32:12 2007
@@ -62,7 +62,7 @@
 	<td class="cellText" style="padding: 5px;">
  		<input name="{$elements.2.0}" type="hidden" value="{$IDLISTS}">
 		<input type="hidden" name="saved_toid" value="{$TO_MAIL}">
-		<input id="parent_name" readonly class="txtBox" type="text" value="{$TO_MAIL}" style="width:99%">&nbsp;
+		<input id="parent_name" name="to_add" readonly class="txtBox" type="text" value="{$TO_MAIL}" style="width:99%">&nbsp;
 	</td>
 	<td class="cellText" style="padding: 5px;" align="left" nowrap>
 		<select name="parent_type">
@@ -98,7 +98,7 @@
 	{elseif $elements.2.0 eq 'subject'}
    <tr>
 	<td class="mailSubHeader" style="padding: 5px;" align="right" nowrap><font color="red">*</font>{$elements.1.0}  :</td>
-        {if $WEBMAIL eq 'true'}
+        {if $WEBMAIL eq 'true' or $RET_ERROR eq 1}
                 <td class="cellText" style="padding: 5px;"><input type="text" class="txtBox" name="{$elements.2.0}" value="{$SUBJECT}" id="{$elements.2.0}" style="width:99%"></td>
         {else}
                 <td class="cellText" style="padding: 5px;"><input type="text" class="txtBox" name="{$elements.2.0}" value="{$elements.3.0}" id="{$elements.2.0}" style="width:99%"></td>
@@ -131,7 +131,7 @@
 	{elseif $elements.2.0 eq 'description'}
    <tr>
 	<td colspan="3" align="center" valign="top" height="320">
-        {if $WEBMAIL eq 'true'}
+        {if $WEBMAIL eq 'true' or $RET_ERROR eq 1}
                 <textarea style="display: none;" class="detailedViewTextBox" id="description" name="description" cols="90" rows="8">{$DESCRIPTION}</textarea>
         {else}
                 <textarea style="display: none;" class="detailedViewTextBox" id="description" name="description" cols="90" rows="16">{$elements.3.0}</textarea>        {/if}

Modified: vtigercrm/branches/5.0.3/modules/Emails/EditView.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Emails/EditView.php (original)
+++ vtigercrm/branches/5.0.3/modules/Emails/EditView.php Fri Apr 20 02:32:12 2007
@@ -288,7 +288,20 @@
         $smarty->assign("FILENAME_TEXT", "(".$focus->filename.")");
         $smarty->assign("FILENAME", $focus->filename);
 }
-
+if($ret_error == 1) {
+	$smarty->assign("RET_ERROR",$ret_error);
+	if($ret_toadd != '')
+                $smarty->assign("TO_MAIL",$ret_toadd);
+	$ret_toadd = '';
+	if($ret_subject != '')
+		$smarty->assign("SUBJECT",$ret_subject);
+	if($ret_ccaddress != '')
+        	$smarty->assign("CC_MAIL",$ret_ccaddress);
+	if($ret_bccaddress != '')
+        	$smarty->assign("BCC_MAIL",$ret_bccaddress);
+	if($ret_description != '')
+        	$smarty->assign("DESCRIPTION", $ret_description);
+}
 $check_button = Button_Check($module);
 $smarty->assign("CHECK", $check_button);
 

Modified: vtigercrm/branches/5.0.3/modules/Emails/Save.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Emails/Save.php (original)
+++ vtigercrm/branches/5.0.3/modules/Emails/Save.php Fri Apr 20 02:32:12 2007
@@ -59,9 +59,46 @@
 
 $focus = new Emails();
 
-global $current_user;
+global $current_user,$mod_strings,$app_strings;
 setObjectValuesFromRequest(&$focus);
 //Check if the file is exist or not.
+//$file_name = '';
+$file_name = $_FILES['filename']['name'];//preg_replace('/\s+/', '_', $_FILES['filename']['name']);
+$errorCode =  $_FILES['filename']['error'];
+$errormessage = "";
+if($file_name != '' && $_FILES['filename']['size'] == 0){
+	if($errorCode == 4 || $errorCode == 0)
+	{
+		 if($_FILES['filename']['size'] == 0)
+			 $errormessage = "<B><font color='red'>".$mod_strings['LBL_PLEASE_ATTACH']."</font></B> <br>";
+	}
+	else if($errorCode == 2)
+	{
+		  $errormessage = "<B><font color='red'>".$mod_strings['LBL_EXCEED_MAX'].$upload_maxsize.$mod_strings['LBL_BYTES']." </font></B> <br>";
+	}
+	else if($errorCode == 6)
+	{
+	     $errormessage = "<B>".$mod_strings['LBL_KINDLY_UPLOAD']."</B> <br>" ;
+	}
+	else if($errorCode == 3 )
+	{
+	     if($_FILES['filename']['size'] == 0)
+		     $errormessage = "<b><font color='red'>".$mod_strings['LBL_PLEASE_ATTACH']."</font></b><br>";
+	}
+	else{}
+	if($errormessage != ""){
+		$ret_error = 1;
+		$ret_toadd = $_REQUEST['to_add'];
+		$ret_subject = $_REQUEST['subject'];
+		$ret_ccaddress = $_REQUEST['ccmail'];
+		$ret_bccaddress = $_REQUEST['bccmail'];
+		$ret_description = $_REQUEST['description'];
+		echo $errormessage;
+        	include("EditView.php");	
+		exit();
+	}
+}
+
 if($_FILES["filename"]["size"] == 0 && $_FILES["filename"]["name"] != '')
 {
         $file_upload_error = true;

Modified: vtigercrm/branches/5.0.3/modules/Emails/language/en_us.lang.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Emails/language/en_us.lang.php (original)
+++ vtigercrm/branches/5.0.3/modules/Emails/language/en_us.lang.php Fri Apr 20 02:32:12 2007
@@ -169,6 +169,10 @@
 'FEATURE_AVAILABLE_INFO' => 'This feature is currently only available for Microsoft Internet Explorer 5.5+ users\n\nWait f
 or an update!',
 'DOWNLOAD_CONFIRAMATION' => 'Do you want to download the file ?',
+'LBL_PLEASE_ATTACH' => 'Please give a valid file to attach and try again!',
+'LBL_KINDLY_UPLOAD' => 'Please configure <font color="red">upload_tmp_dir</font> variable in php.ini file.',
+'LBL_EXCEED_MAX' => 'Sorry, the uploaded file exceeds the maximum filesize limit. Please try a file smaller than ',
+'LBL_BYTES' => ' bytes',
 
 );
 





More information about the vtigercrm-commits mailing list