Write some code fast yesterday, code works but if messageID is empty it show a empty box one place, not so good...
so I have moved and added some code to it...
Hope it will work good to you now!!!
compose.php Dol.v.6.2 (only some part of the file)
Added code is bold.
function PageCompPageMainCode()
{
global $site;
$ret = '';
$en_inbox_notify = getParam("enable_inbox_notify");
$en_dest_choice = getParam("enable_msg_dest_choice");
$free_mode = getParam( "free_mode" );
$member['ID'] = (int)$_COOKIE['memberID'];
$member['Password'] = $_COOKIE['memberPassword'];
$recipientID = getID( $_REQUEST['ID'], 0 );
$messageID = (int)$_GET[messageID];
$recipient = getProfileInfo( $recipientID );
$contact_allowed = contact_allowed($member['ID'], $recipientID);
// Check if member can send messages
$check_res = checkAction( $member['ID'], ACTION_ID_SEND_MESSAGE );
if ( $check_res[CHECK_ACTION_RESULT] != CHECK_ACTION_RESULT_ALLOWED
&& !$contact_allowed )
{
$ret = '
<table width="100%" cellpadding="4" cellspacing="4" border="0">
<tr>
<td align="center">' . $check_res[CHECK_ACTION_MESSAGE] . '</td>
</tr>
</table>';
return $ret;
}
//ob_start();
$ret = '';
if ( $_POST['action'] == "send" && strlen($_POST['text']) )
{
$action_result = "";
// Check if recipient found
if( !$recipient )
{
$ret = "
<table width=\"100%\" cellpadding=\"4\" cellspacing=\"4\" align=\"center\">
<tr>
<td align=center>". _t("_COMPOSE_REJECT_MEMBER_NOT_FOUND") ."</td>
</tr>
</table>\n";
return $ret;
}
// Perform sending
$send_result = MemberSendMessage( $member, $recipient );
switch ( $send_result )
{
case 1:
$action_result .= _t_err( "_FAILED_TO_SEND_MESSAGE" );
$hide_form = '0';
break;
case 3:
$action_result .= _t_err( "_You have to wait for PERIOD minutes before you can write another message!", 1 );
$hide_form = '1';
break;
case 5:
$action_result .= _t_err( "_FAILED_TO_SEND_MESSAGE_BLOCK" );
$hide_form = '0';
break;
case 10:
$action_result .= _t_err( "_FAILED_TO_SEND_MESSAGE_NOT_ACTIVE" );
$hide_form = '0';
break;
default:
$action_result .= _t_action( "_MESSAGE_SENT" );
$hide_form = '1';
break;
}
}
$ret .= '<div class="com_box"">';
if ( strlen($action_result) )
{
$ret .= $action_result;
}
// Check if messageID found
if( $messageID )
{
$message_sql= "SELECT `Text`, `Subject`, `Date` FROM `Messages` WHERE `ID` = '$messageID'";
$message_arr= db_arr($message_sql);
$ret = '';
$ret .= '<div class="m_block">';
$ret .= '<div class="m_subject_date">';
$ret .= '<div class="name">';
$ret .= _t('_Date').':';
$ret .= '</div>';
$ret .= '<div class="value">';
$ret .= $message_arr['Date'];
$ret .= '</div>';
$ret .= '<div class="name">';
$ret .= _t('_Subject').':';
$ret .= '</div>';
$ret .= '<div class="value">';
$ret .= process_smiles( process_line_output($message_arr['Subject']) );
$ret .= '</div>';
$ret .= '</div>';
$ret .= '<div class="m_text">';
$ret .= process_html_output($message_arr['Text'], 150);
$ret .= '</div>';
$ret .= '<div class="clear_both"></div>';
$ret .= '</div>';
$ret .= '<br /><br />';
}
if ( $recipient && $hide_form != '1' )
{
$ret .= '<div class="clear_both"></div>';
$ret .= ProfileDetails( $recipient['ID'] );
$ret .= '<div class="clear_both"></div>';
}