[svn r18940] FS#3797 fix user is displayed in outbox and several improvements in outbox and inbox

skala
Juan Carlos Raña 16 years ago
parent 1bcb725e22
commit e14d853de3
  1. BIN
      main/img/mail.png
  2. BIN
      main/img/mail_open.png
  3. BIN
      main/img/mail_send.png
  4. 397
      main/inc/lib/message.lib.php
  5. 825
      main/messages/message.class.php

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

@ -1,198 +1,201 @@
<?php
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2004-2008 Dokeos SPRL
Copyright (c) Julio Montoya <gugli100@gmail.com>
Copyright (c) Isaac Flores <florespaz_isaac@hotmail.com>
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
Mail: info@dokeos.com
==============================================================================
*/
include_once(api_get_path(LIBRARY_PATH).'/online.inc.php');
require_once '../messages/message.class.php';
function inbox_display() {
$table_message = Database::get_main_table(TABLE_MESSAGE);
$request=api_is_xml_http_request();
if ($_SESSION['social_exist']===true) {
$redirect="#remote-tab-2";
if (api_get_setting('allow_social_tool')=='true' && api_get_setting('allow_message_tool')=='true') {
$success= get_lang('SelectedMessagesDeleted').
"&nbsp
<br><a href=\"".
"../social/index.php?$redirect\">".
get_lang('BackToInbox').
"</a>";
} else {
$success= get_lang('SelectedMessagesDeleted').
"&nbsp
<br><a href=\"".
"../social/index.php?$redirect\">".
get_lang('BackToInbox').
"</a>";
}
} else {
$success= get_lang('SelectedMessagesDeleted').
"&nbsp
</b>".
"<br><a href=\"".
"inbox.php\">".
get_lang('BackToOutbox').
"</a>";
}
if (isset ($_REQUEST['action'])) {
switch ($_REQUEST['action']) {
case 'delete' :
$number_of_selected_messages = count($_POST['id']);
foreach ($_POST['id'] as $index => $message_id) {
MessageManager::delete_message_by_user_receiver(api_get_user_id(), $message_id);
}
Display::display_normal_message($success,false);
break;
case 'deleteone' :
MessageManager::delete_message_by_user_receiver(api_get_user_id(), $_GET['id']);
Display::display_confirmation_message($success,false);
echo '<br/>';
break;
}
}
// display sortable table with messages of the current user
$table = new SortableTable('messages', 'get_number_of_messages_mask', 'get_message_data_mask', 1);
$table->set_header(0, '', false);
if ($request===true) {
$title= utf8_encode(get_lang('Title'));
$action=utf8_encode(get_lang('Actions'));
} else {
$title= get_lang('Title');
$action=get_lang('Actions');
}
$table->set_header(1, get_lang('From'),false);
$table->set_header(2,$title,false);
$table->set_header(3, get_lang('Date'),false);
$table->set_header(4,$action,false);
echo '<div id="div_content_table_data">';
if ($request===true) {
echo '<form name="form_send" id="form_send" action="" method="post">';
echo '<input type="hidden" name="action" value="delete" />';
$table->display();
echo '</form>';
if (get_number_of_messages_mask() > 0) {
echo '<a href="javascript:void(0)" onclick="selectall_cheks()">'.get_lang('SelectAll').'</a>&nbsp;&nbsp;&nbsp;';
echo '<a href="javascript:void(0)" onclick="unselectall_cheks()">'.get_lang('UnSelectAll').'</a>&nbsp;&nbsp;&nbsp;';
echo '<input name="delete" type="button" value="'.get_lang('DeleteSelectedMessages').'" onclick="submit_form(\'inbox\')"/>';
}
} else {
$table->set_form_actions(array ('delete' => get_lang('DeleteSelectedMessages')));
$table->display();
}
echo '</div>';
}
function get_number_of_messages_mask() {
return MessageManager::get_number_of_messages();
}
function get_message_data_mask($from, $number_of_items, $column, $direction) {
return MessageManager::get_message_data($from, $number_of_items, $column, $direction);
}
function outbox_display() {
$table_message = Database::get_main_table(TABLE_MESSAGE);
$request=api_is_xml_http_request();
if ($_SESSION['social_exist']===true) {
$redirect="#remote-tab-3";
if (api_get_setting('allow_social_tool')=='true' && api_get_setting('allow_message_tool')=='true') {
$success= get_lang('SelectedMessagesDeleted').
"&nbsp
<br><a href=\"".
"../social/index.php?$redirect\">".
get_lang('BackToOutbox').
"</a>";
}else {
$success= get_lang('SelectedMessagesDeleted').
"&nbsp
<br><a href=\"".
"../social/index.php?$redirect\">".
get_lang('BackToOutbox').
"</a>";
}
} else {
$success= get_lang('SelectedMessagesDeleted').
"&nbsp
</b>".
"<br><a href=\"".
"outbox.php\">".
get_lang('BackToOutbox').
"</a>";
}
if (isset ($_REQUEST['action'])) {
switch ($_REQUEST['action']) {
case 'delete' :
$number_of_selected_messages = count($_POST['id']);
if ($number_of_selected_messages!=0) {
foreach ($_POST['id'] as $index => $message_id) {
MessageManager::delete_message_by_user_receiver(api_get_user_id(), $message_id);
}
}
Display::display_normal_message($success,false);
break;
case 'deleteone' :
MessageManager::delete_message_by_user_receiver(api_get_user_id(), $_GET['id']);
Display::display_confirmation_message($success,false);
echo '<br/>';
break;
}
}
// display sortable table with messages of the current user
$table = new SortableTable('messages', 'get_number_of_messages_send_mask', 'get_message_data_send_mask', 1);
if ($request===true) {
$title= utf8_encode(get_lang('Title'));
$action=utf8_encode(get_lang('Actions'));
} else {
$title= get_lang('Title');
$action=get_lang('Actions');
}
$table->set_header(0, '', false);
$table->set_header(1, get_lang('From'),false);
$table->set_header(2, $title,false);
$table->set_header(3, get_lang('Date'),false);
$table->set_header(4,$action, false);
echo '<div id="div_content_table_data_sent">';
if ($request===true) {
echo '<form name="form_send_out" id="form_send_out" action="" method="post">';
echo '<input type="hidden" name="action" value="delete" />';
$table->display();
echo '</form>';
if (get_number_of_messages_send_mask() > 0) {
echo '<a href="javascript:void(0)" onclick="selectall_cheks()">'.get_lang('SelectAll').'</a>&nbsp;&nbsp;&nbsp;';
echo '<a href="javascript:void(0)" onclick="unselectall_cheks()">'.get_lang('UnSelectAll').'</a>&nbsp;&nbsp;&nbsp;';
echo '<input name="delete" type="button" value="'.get_lang('DeleteSelectedMessages').'" onclick="submit_form(\'outbox\')"/>';
}
} else {
$table->set_form_actions(array ('delete' => get_lang('DeleteSelectedMessages')));
$table->display();
}
echo '</div>';
}
function get_number_of_messages_send_mask() {
return MessageManager::get_number_of_messages_sent();
}
function get_message_data_send_mask($from, $number_of_items, $column, $direction) {
return MessageManager::get_message_data_sent($from, $number_of_items, $column, $direction);
}
<?php
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2004-2008 Dokeos SPRL
Copyright (c) Julio Montoya <gugli100@gmail.com>
Copyright (c) Isaac Flores <florespaz_isaac@hotmail.com>
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
Mail: info@dokeos.com
==============================================================================
*/
include_once(api_get_path(LIBRARY_PATH).'/online.inc.php');
require_once '../messages/message.class.php';
function inbox_display() {
$table_message = Database::get_main_table(TABLE_MESSAGE);
$request=api_is_xml_http_request();
if ($_SESSION['social_exist']===true) {
$redirect="#remote-tab-2";
if (api_get_setting('allow_social_tool')=='true' && api_get_setting('allow_message_tool')=='true') {
$success= get_lang('SelectedMessagesDeleted').
"&nbsp
<br><a href=\"".
"../social/index.php?$redirect\">".
get_lang('BackToInbox').
"</a>";
} else {
$success= get_lang('SelectedMessagesDeleted').
"&nbsp
<br><a href=\"".
"../social/index.php?$redirect\">".
get_lang('BackToInbox').
"</a>";
}
} else {
$success= get_lang('SelectedMessagesDeleted').
"&nbsp
</b>".
"<br><a href=\"".
"inbox.php\">".
get_lang('BackToOutbox').
"</a>";
}
if (isset ($_REQUEST['action'])) {
switch ($_REQUEST['action']) {
case 'delete' :
$number_of_selected_messages = count($_POST['id']);
foreach ($_POST['id'] as $index => $message_id) {
MessageManager::delete_message_by_user_receiver(api_get_user_id(), $message_id);
}
Display::display_normal_message($success,false);
break;
case 'deleteone' :
MessageManager::delete_message_by_user_receiver(api_get_user_id(), $_GET['id']);
Display::display_confirmation_message($success,false);
echo '<br/>';
break;
}
}
// display sortable table with messages of the current user
$table = new SortableTable('messages', 'get_number_of_messages_mask', 'get_message_data_mask', 1);
$table->set_header(0, '', false,array ('style' => 'width:20px;'));
if ($request===true) {
$title= utf8_encode(get_lang('Title'));
$action=utf8_encode(get_lang('Actions'));
} else {
$title= get_lang('Title');
$action=get_lang('Actions');
}
$table->set_header(1, get_lang('Status'),false,array ('style' => 'width:30px;'));
$table->set_header(2, get_lang('From'),false);
$table->set_header(3,$title,false);
$table->set_header(4, get_lang('Date'),false,array ('style' => 'width:150px;'));
$table->set_header(5,$action,false,array ('style' => 'width:100px;'));
echo '<div id="div_content_table_data">';
if ($request===true) {
echo '<form name="form_send" id="form_send" action="" method="post">';
echo '<input type="hidden" name="action" value="delete" />';
$table->display();
echo '</form>';
if (get_number_of_messages_mask() > 0) {
echo '<a href="javascript:void(0)" onclick="selectall_cheks()">'.get_lang('SelectAll').'</a>&nbsp;&nbsp;&nbsp;';
echo '<a href="javascript:void(0)" onclick="unselectall_cheks()">'.get_lang('UnSelectAll').'</a>&nbsp;&nbsp;&nbsp;';
echo '<input name="delete" type="button" value="'.get_lang('DeleteSelectedMessages').'" onclick="submit_form(\'inbox\')"/>';
}
} else {
$table->set_form_actions(array ('delete' => get_lang('DeleteSelectedMessages')));
$table->display();
}
echo '</div>';
}
function get_number_of_messages_mask() {
return MessageManager::get_number_of_messages();
}
function get_message_data_mask($from, $number_of_items, $column, $direction) {
return MessageManager::get_message_data($from, $number_of_items, $column, $direction);
}
function outbox_display() {
$table_message = Database::get_main_table(TABLE_MESSAGE);
$request=api_is_xml_http_request();
if ($_SESSION['social_exist']===true) {
$redirect="#remote-tab-3";
if (api_get_setting('allow_social_tool')=='true' && api_get_setting('allow_message_tool')=='true') {
$success= get_lang('SelectedMessagesDeleted').
"&nbsp
<br><a href=\"".
"../social/index.php?$redirect\">".
get_lang('BackToOutbox').
"</a>";
}else {
$success= get_lang('SelectedMessagesDeleted').
"&nbsp
<br><a href=\"".
"../social/index.php?$redirect\">".
get_lang('BackToOutbox').
"</a>";
}
} else {
$success= get_lang('SelectedMessagesDeleted').
"&nbsp
</b>".
"<br><a href=\"".
"outbox.php\">".
get_lang('BackToOutbox').
"</a>";
}
if (isset ($_REQUEST['action'])) {
switch ($_REQUEST['action']) {
case 'delete' :
$number_of_selected_messages = count($_POST['id']);
if ($number_of_selected_messages!=0) {
foreach ($_POST['id'] as $index => $message_id) {
MessageManager::delete_message_by_user_receiver(api_get_user_id(), $message_id);
}
}
Display::display_normal_message($success,false);
break;
case 'deleteone' :
MessageManager::delete_message_by_user_receiver(api_get_user_id(), $_GET['id']);
Display::display_confirmation_message($success,false);
echo '<br/>';
break;
}
}
// display sortable table with messages of the current user
$table = new SortableTable('messages', 'get_number_of_messages_send_mask', 'get_message_data_send_mask', 1);
if ($request===true) {
$title= utf8_encode(get_lang('Title'));
$action=utf8_encode(get_lang('Actions'));
} else {
$title= get_lang('Title');
$action=get_lang('Actions');
}
$table->set_header(0, '', false,array ('style' => 'width:20px;'));
$table->set_header(1, get_lang('Status'),false,array ('style' => 'width:30px;'));
$table->set_header(2, get_lang('To'),false);
$table->set_header(3, $title,false);
$table->set_header(4, get_lang('Date'),false,array ('style' => 'width:150px;'));
$table->set_header(5,$action, false,array ('style' => 'width:100px;'));
echo '<div id="div_content_table_data_sent">';
if ($request===true) {
echo '<form name="form_send_out" id="form_send_out" action="" method="post">';
echo '<input type="hidden" name="action" value="delete" />';
$table->display();
echo '</form>';
if (get_number_of_messages_send_mask() > 0) {
echo '<a href="javascript:void(0)" onclick="selectall_cheks()">'.get_lang('SelectAll').'</a>&nbsp;&nbsp;&nbsp;';
echo '<a href="javascript:void(0)" onclick="unselectall_cheks()">'.get_lang('UnSelectAll').'</a>&nbsp;&nbsp;&nbsp;';
echo '<input name="delete" type="button" value="'.get_lang('DeleteSelectedMessages').'" onclick="submit_form(\'outbox\')"/>';
}
} else {
$table->set_form_actions(array ('delete' => get_lang('DeleteSelectedMessages')));
$table->display();
}
echo '</div>';
}
function get_number_of_messages_send_mask() {
return MessageManager::get_number_of_messages_sent();
}
function get_message_data_send_mask($from, $number_of_items, $column, $direction) {
return MessageManager::get_message_data_sent($from, $number_of_items, $column, $direction);
}
?>

@ -1,406 +1,421 @@
<?php
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2004-2009 Dokeos SPRL
Copyright (c) Julio Montoya <gugli100@gmail.com>
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
Mail: info@dokeos.com
==============================================================================
*/
include_once(api_get_path(LIBRARY_PATH).'/main_api.lib.php');
include_once(api_get_path(LIBRARY_PATH).'/online.inc.php');
class MessageManager {
function MessageManager() {
}
public static function get_online_user_list($current_user_id) {
$min=30;
global $_configuration;
$userlist = WhoIsOnline($current_user_id,$_configuration['statistics_database'],$min);
foreach($userlist as $row) {
$receiver_id = $row[0];
$online_user_list[$receiver_id] = GetFullUserName($receiver_id).($current_user_id==$receiver_id?("&nbsp;(".get_lang('Myself').")"):(""));
}
return $online_user_list;
}
/**
* Displays info stating that the message is sent successfully.
*/
public static function display_success_message($uid) {
if ($_SESSION['social_exist']===true) {
$redirect="#remote-tab-2";
if (api_get_setting('allow_social_tool')=='true' && api_get_setting('allow_message_tool')=='true') {
$success= get_lang('MessageSentTo').
"&nbsp;<b>".
GetFullUserName($uid).
"</b>".
"<br><a href=\"".
"../social/index.php$redirect\">".
get_lang('BackToInbox').
"</a>";
}else {
$success= get_lang('MessageSentTo').
"&nbsp;<b>".
GetFullUserName($uid).
"</b>".
"<br><a href=\"".
"../social/index.php$redirect\">".
get_lang('BackToInbox').
"</a>";
}
} else {
$success= get_lang('MessageSentTo').
"&nbsp;<b>".
GetFullUserName($uid).
"</b>".
"<br><a href=\"".
"inbox.php\">".
get_lang('BackToInbox').
"</a>";
}
Display::display_confirmation_message($success, false);
}
/**
* Displays the wysiwyg html editor.
*/
public static function display_html_editor_area($name,$resp) {
api_disp_html_area($name, get_lang('TypeYourMessage'), '', '100%');
}
/**
* Get the new messages for the current user from the database.
*/
public static function get_new_messages() {
$table_message = Database::get_main_table(TABLE_MESSAGE);
if (!api_get_user_id()) {
return false;
}
$i=0;
$query = "SELECT * FROM $table_message WHERE user_receiver_id=".api_get_user_id()." AND msg_status=1";
$result = api_sql_query($query,__FILE__,__LINE__);
$i = Database::num_rows($result);
return $i;
}
/**
* Get the list of user_ids of users who are online.
*/
public static function users_connected_by_id() {
global $_configuration, $_user;
$minute=30;
$user_connect = WhoIsOnline($_user['user_id'],$_configuration['statistics_database'],$minute);
for ($i=0; $i<count($user_connect); $i++) {
$user_id_list[$i]=$user_connect[$i][0];
}
return $user_id_list;
}
/**
* Gets the total number of messages, used for the inbox sortable table
*/
public static function get_number_of_messages () {
$table_message = Database::get_main_table(TABLE_MESSAGE);
$sql_query = "SELECT COUNT(*) as number_messages FROM $table_message WHERE msg_status IN (0,1) AND user_receiver_id=".api_get_user_id();
$sql_result = api_sql_query($sql_query,__FILE__,__LINE__);
$result = Database::fetch_array($sql_result);
return $result['number_messages'];
}
/**
* Gets information about some messages, used for the inbox sortable table
* @param int $from
* @param int $number_of_items
* @param string $direction
*/
public static function get_message_data ($from, $number_of_items, $column, $direction) {
global $charset;
$table_message = Database::get_main_table(TABLE_MESSAGE);
$request=api_is_xml_http_request();
$sql_query = "SELECT id as col0, user_sender_id as col1, title as col2, send_date as col3 FROM $table_message " .
"WHERE user_receiver_id=".api_get_user_id()." AND msg_status IN (0,1)" .
"ORDER BY send_date desc, col$column $direction LIMIT $from,$number_of_items";
$sql_result = api_sql_query($sql_query,__FILE__,__LINE__);
$i = 0;
$message_list = array ();
while ($result = Database::fetch_row($sql_result)) {
if ($request===true) {
$message[0] = '<input type="checkbox" value='.$result[0].' name="id[]">';
} else {
$message[0] = ($result[0]);
}
if ($request===true) {
$message[1] = mb_convert_encoding(GetFullUserName($result[1]),'UTF-8',$charset);
$message[2] = '<a onclick="get_action_url_and_show_messages(1,'.$result[0].')" href="javascript:void(0)">'.str_replace("\\","",mb_convert_encoding($result[2],'UTF-8',$charset)).'</a>';
$message[4] = '<a onclick="reply_to_messages(\'show\','.$result[0].',\'\')" href="javascript:void(0)">'.Display::return_icon('message_reply.png',get_lang('ReplyToMessage')).'</a>'.
'&nbsp;&nbsp;<a onclick="delete_one_message('.$result[0].')" href="javascript:void(0)" >'.Display::return_icon('message_delete.png',get_lang('DeleteMessage')).'</a>';
} else {
$message[1] = GetFullUserName(($result[1]));
$message[2] = '<a href="view_message.php?id='.$result[0].'">'.$result[2].'</a>';
$message[4] = '<a href="new_message.php?re_id='.$result[0].'">'.Display::return_icon('message_reply.png',get_lang('ReplyToMessage')).'</a>'.
'&nbsp;&nbsp;<a delete_one_message('.$result[0].') href="#inbox.php?action=deleteone&id='.$result[0].'">'.Display::return_icon('message_delete.png',get_lang('DeleteMessage')).'</a>';
}
$message[3] = ($result[3]); //date stays the same
$message_list[] = $message;
$i++;
}
return $message_list;
}
public static function send_message ($receiver_user_id, $title, $content) {
$table_message = Database::get_main_table(TABLE_MESSAGE);
//message in inbox
$query = "INSERT INTO $table_message(user_sender_id, user_receiver_id, msg_status, send_date, title, content ) ".
" VALUES (".
"'".api_get_user_id()."', '".Database::escape_string($receiver_user_id)."', '1', '".date('Y-m-d H:i:s')."','".Database::escape_string($title)."','".Database::escape_string($content)."'".
")";
//message in outbox
$sql = "INSERT INTO $table_message(user_sender_id, user_receiver_id, msg_status, send_date, title, content ) ".
" VALUES (".
"'".api_get_user_id()."', '".Database::escape_string($receiver_user_id)."', '4', '".date('Y-m-d H:i:s')."','".Database::escape_string($title)."','".Database::escape_string($content)."'".
")";
$rs = api_sql_query($sql,__FILE__,__LINE__);
$result = api_sql_query($query,__FILE__,__LINE__);
return $result;
}
public static function delete_message_by_user_receiver ($user_receiver_id,$id) {
$table_message = Database::get_main_table(TABLE_MESSAGE);
$sql="SELECT COUNT(*) as count FROM $table_message WHERE id=".$id." AND msg_status<>4;";
$rs=api_sql_query($sql,__FILE__,__LINE__);
$row=Database::fetch_array($rs,'ASSOC');
if ($row['count']==1) {
$query = "DELETE FROM $table_message " .
"WHERE user_receiver_id=".Database::escape_string($user_receiver_id)." AND id=".Database::escape_string($id);
$result = api_sql_query($query,__FILE__,__LINE__);
return $result;
} else {
return false;
}
}
/**
* Set status deleted
* @author Isaac FLores Paz <isaac.flores@dokeos.com>
* @param integer
* @param integer
* @return array
*/
public static function delete_message_by_user_sender ($user_sender_id,$id) {
$table_message = Database::get_main_table(TABLE_MESSAGE);
$query = "DELETE FROM $table_message " .
"WHERE user_sender_id=".Database::escape_string($user_sender_id)." AND id=".Database::escape_string($id);
$result = api_sql_query($query,__FILE__,__LINE__);
return $result;
}
public static function update_message ($user_id, $id) {
$table_message = Database::get_main_table(TABLE_MESSAGE);
$query = "UPDATE $table_message SET msg_status = '0' WHERE msg_status<>4 AND user_receiver_id=".Database::escape_string($user_id)." AND id='".Database::escape_string($id)."'";
$result = api_sql_query($query,__FILE__,__LINE__);
}
public static function get_message_by_user ($user_id,$id) {
$table_message = Database::get_main_table(TABLE_MESSAGE);
$query = "SELECT * FROM $table_message WHERE user_receiver_id=".Database::escape_string($user_id)." AND id='".Database::escape_string($id)."'";
$result = api_sql_query($query,__FILE__,__LINE__);
return $row = Database::fetch_array($result);
}
/**
* Gets information about if exist messages
* @author Isaac FLores Paz <isaac.flores@dokeos.com>
* @param integer
* @param integer
* @return boolean
*/
public static function exist_message ($user_id, $id) {
$table_message = Database::get_main_table(TABLE_MESSAGE);
$query = "SELECT id FROM $table_message WHERE user_receiver_id=".Database::escape_string($user_id)." AND id='".Database::escape_string($id)."'";
$result = api_sql_query($query,__FILE__,__LINE__);
$num = Database::num_rows($result);
if ($num>0)
return true;
else
return false;
}
/**
* Gets information about messages sent
* @author Isaac FLores Paz <isaac.flores@dokeos.com>
* @param integer
* @param integer
* @param string
* @return array
*/
public static function get_message_data_sent ($from, $number_of_items, $column, $direction) {
global $charset;
$table_message = Database::get_main_table(TABLE_MESSAGE);
$request=api_is_xml_http_request();
$sql_query = "SELECT id as col0, user_sender_id as col1, title as col2, send_date as col3 FROM $table_message " .
"WHERE user_sender_id=".api_get_user_id()." AND msg_status=4 " .
"ORDER BY col$column $direction LIMIT $from,$number_of_items";
$sql_result = api_sql_query($sql_query,__FILE__,__LINE__);
$i = 0;
$message_list = array ();
while ($result = Database::fetch_row($sql_result)) {
if ($request===true) {
$message[0] = '<input type="checkbox" value='.$result[0].' name="out[]">';
} else {
$message[0] = ($result[0]);
}
if ($request===true) {
$message[1] = mb_convert_encoding(GetFullUserName($result[1]),'UTF-8',$charset);
$message[2] = '<a onclick="show_sent_message('.$result[0].')" href="javascript:void(0)">'.str_replace("\\","",mb_convert_encoding($result[2],'UTF-8',$charset)).'</a>';
$message[4] = '&nbsp;&nbsp;<a onclick="delete_one_message_outbox('.$result[0].')" href="javascript:void(0)" >'.Display::return_icon('message_delete.png',get_lang('DeleteMessage')).'</a>';
} else {
$message[1] = GetFullUserName($result[1]);
$message[2] = '<a onclick="show_sent_message ('.$result[0].')" href="#../messages/view_message.php?id_send='.$result[0].'">'.$result[2].'</a>';
$message[4] = '<a href="new_message.php?re_id='.$result[0].'">'.Display::return_icon('message_reply.png',get_lang('ReplyToMessage')).'</a>'.
'&nbsp;&nbsp;<a href="outbox.php?action=deleteone&id='.$result[0].'" onclick="javascript:if(!confirm('."'".addslashes(htmlentities(get_lang('ConfirmDeleteMessage')))."'".')) return false;">'.Display::return_icon('message_delete.png',get_lang('DeleteMessage')).'</a>';
}
$message[3] = $result[3]; //date stays the same
$message_list[] = $message;
$i++;
}
return $message_list;
}
/**
* Gets information about number messages sent
* @author Isaac FLores Paz <isaac.flores@dokeos.com>
* @param void
* @return integer
*/
public static function get_number_of_messages_sent () {
$table_message = Database::get_main_table(TABLE_MESSAGE);
$sql_query = "SELECT COUNT(*) as number_messages FROM $table_message WHERE msg_status=4 AND user_sender_id=".api_get_user_id();
$sql_result = api_sql_query($sql_query,__FILE__,__LINE__);
$result = Database::fetch_array($sql_result);
return $result['number_messages'];
}
public static function show_message_box () {
global $charset;
$table_message = Database::get_main_table(TABLE_MESSAGE);
if (isset($_GET['id_send'])) {
$query = "SELECT * FROM $table_message WHERE user_sender_id=".api_get_user_id()." AND id=".$_GET['id_send']." AND msg_status=4;";
$result = api_sql_query($query,__FILE__,__LINE__);
$path='outbox.php';
} else {
$query = "UPDATE $table_message SET msg_status = '0' WHERE user_receiver_id=".api_get_user_id()." AND id='".Database::escape_string($_GET['id'])."';";
$result = api_sql_query($query,__FILE__,__LINE__);
$query = "SELECT * FROM $table_message WHERE msg_status<>4 AND user_receiver_id=".api_get_user_id()." AND id='".Database::escape_string($_GET['id'])."';";
$result = api_sql_query($query,__FILE__,__LINE__);
$path='inbox.php';
}
$row = Database::fetch_array($result);
$user_con = self::users_connected_by_id();
$band=0;
$reply='';
for ($i=0;$i<count($user_con);$i++)
if ($row[1]==$user_con[$i])
$band=1;
if ($band==1 && !isset($_GET['id_send'])) {
$reply = '<a onclick="reply_to_messages(\'show\','.$_GET['id'].',\'\')" href="javascript:void(0)">'.Display::return_icon('message_reply.png',get_lang('ReplyToMessage')).get_lang('ReplyToMessage').'</a>';
}
echo '<div class=actions>';
echo '<a onclick="close_div_show(\'div_content_messages\')" href="javascript:void(0)">'.Display::return_icon('folder_up.gif',get_lang('BackToInbox')).get_lang('BackToInbox').'</a>';
echo $reply;
echo '<a onclick="delete_one_message('.$row[0].')" href="javascript:void(0)" >'.Display::return_icon('message_delete.png',get_lang('DeleteMessage')).''.get_lang('Delete').'</a>';
echo '</div><br />';
echo '
<table class="message_view_table" >
<TR>
<TD width=10>&nbsp; </TD>
<TD vAlign=top width="100%">
<TABLE>
<TR>
<TD width="100%">
<TR> <h1>'.str_replace("\\","",mb_convert_encoding($row[5],'UTF-8',$charset)).'</h1></TR>
</TD>
<TR>
<TD>'.mb_convert_encoding(get_lang('From'),'UTF-8',$charset).'&nbsp;<b>'.GetFullUserName($row[1]).'</b> '.mb_convert_encoding(strtolower(get_lang('To')),'UTF-8',$charset).'&nbsp; <b>'.mb_convert_encoding(GetFullUserName($row[2]),'UTF-8',$charset).'</b> </TD>
</TR>
<TR>
<TD >'.get_lang('Date').'&nbsp; '.$row[4].'</TD>
</TR>
</TR>
</TABLE>
<br />
<TABLE height=209 width="100%" bgColor=#ffffff>
<TBODY>
<TR>
<TD vAlign=top>'.mb_convert_encoding($row[6],'UTF-8',$charset).'</TD>
</TR>
</TBODY>
</TABLE>
<DIV class=HT style="PADDING-BOTTOM: 5px"> </DIV></TD>
<TD width=10>&nbsp;</TD>
</TR>
</TABLE>';
}
public static function show_message_box_sent () {
global $charset;
$table_message = Database::get_main_table(TABLE_MESSAGE);
$query = "SELECT * FROM $table_message WHERE user_sender_id=".api_get_user_id()." AND id=".$_GET['id_send']." AND msg_status=4;";
$result = api_sql_query($query,__FILE__,__LINE__);
$path='outbox.php';
$row = Database::fetch_array($result);
$user_con = self::users_connected_by_id();
$band=0;
$reply='';
for ($i=0;$i<count($user_con);$i++)
if ($row[1]==$user_con[$i])
$band=1;
echo '<div class=actions>';
echo '<a onclick="close_and_open_outbox()" href="javascript:void(0)">'.Display::return_icon('folder_up.gif',get_lang('BackToOutbox')).get_lang('BackToOutbox').'</a>';
echo '<a onclick="delete_one_message_outbox('.$row[0].')" href="javascript:void(0)" >'.Display::return_icon('message_delete.png',get_lang('DeleteMessage')).''.get_lang('Delete').'</a>';
echo '</div><br />';
echo '
<table class="message_view_table" >
<TR>
<TD width=10>&nbsp; </TD>
<TD vAlign=top width="100%">
<TABLE>
<TR>
<TD width="100%">
<TR> <h1>'.str_replace("\\","",mb_convert_encoding($row[5],'UTF-8',$charset)).'</h1></TR>
</TD>
<TR>
<TD>'.mb_convert_encoding(get_lang('From'),'UTF-8',$charset).'&nbsp;<b>'.GetFullUserName($row[1]).'</b> '.mb_convert_encoding(strtolower(get_lang('To')),'UTF-8',$charset).'&nbsp; <b>'.mb_convert_encoding(GetFullUserName($row[2]),'UTF-8',$charset).'</b> </TD>
</TR>
<TR>
<TD >'.get_lang('Date').'&nbsp; '.$row[4].'</TD>
</TR>
</TR>
</TABLE>
<br />
<TABLE height=209 width="100%" bgColor=#ffffff>
<TBODY>
<TR>
<TD vAlign=top>'.mb_convert_encoding($row[6],'UTF-8',$charset).'</TD>
</TR>
</TBODY>
</TABLE>
<DIV class=HT style="PADDING-BOTTOM: 5px"> </DIV></TD>
<TD width=10>&nbsp;</TD>
</TR>
</TABLE>';
}
}
<?php
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2004-2009 Dokeos SPRL
Copyright (c) Julio Montoya <gugli100@gmail.com>
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
Mail: info@dokeos.com
==============================================================================
*/
include_once(api_get_path(LIBRARY_PATH).'/main_api.lib.php');
include_once(api_get_path(LIBRARY_PATH).'/online.inc.php');
class MessageManager {
function MessageManager() {
}
public static function get_online_user_list($current_user_id) {
$min=30;
global $_configuration;
$userlist = WhoIsOnline($current_user_id,$_configuration['statistics_database'],$min);
foreach($userlist as $row) {
$receiver_id = $row[0];
$online_user_list[$receiver_id] = GetFullUserName($receiver_id).($current_user_id==$receiver_id?("&nbsp;(".get_lang('Myself').")"):(""));
}
return $online_user_list;
}
/**
* Displays info stating that the message is sent successfully.
*/
public static function display_success_message($uid) {
if ($_SESSION['social_exist']===true) {
$redirect="#remote-tab-2";
if (api_get_setting('allow_social_tool')=='true' && api_get_setting('allow_message_tool')=='true') {
$success= get_lang('MessageSentTo').
"&nbsp;<b>".
GetFullUserName($uid).
"</b>".
"<br><a href=\"".
"../social/index.php$redirect\">".
get_lang('BackToInbox').
"</a>";
}else {
$success= get_lang('MessageSentTo').
"&nbsp;<b>".
GetFullUserName($uid).
"</b>".
"<br><a href=\"".
"../social/index.php$redirect\">".
get_lang('BackToInbox').
"</a>";
}
} else {
$success= get_lang('MessageSentTo').
"&nbsp;<b>".
GetFullUserName($uid).
"</b>".
"<br><a href=\"".
"inbox.php\">".
get_lang('BackToInbox').
"</a>";
}
Display::display_confirmation_message($success, false);
}
/**
* Displays the wysiwyg html editor.
*/
public static function display_html_editor_area($name,$resp) {
api_disp_html_area($name, get_lang('TypeYourMessage'), '', '100%');
}
/**
* Get the new messages for the current user from the database.
*/
public static function get_new_messages() {
$table_message = Database::get_main_table(TABLE_MESSAGE);
if (!api_get_user_id()) {
return false;
}
$i=0;
$query = "SELECT * FROM $table_message WHERE user_receiver_id=".api_get_user_id()." AND msg_status=1";
$result = api_sql_query($query,__FILE__,__LINE__);
$i = Database::num_rows($result);
return $i;
}
/**
* Get the list of user_ids of users who are online.
*/
public static function users_connected_by_id() {
global $_configuration, $_user;
$minute=30;
$user_connect = WhoIsOnline($_user['user_id'],$_configuration['statistics_database'],$minute);
for ($i=0; $i<count($user_connect); $i++) {
$user_id_list[$i]=$user_connect[$i][0];
}
return $user_id_list;
}
/**
* Gets the total number of messages, used for the inbox sortable table
*/
public static function get_number_of_messages () {
$table_message = Database::get_main_table(TABLE_MESSAGE);
$sql_query = "SELECT COUNT(*) as number_messages FROM $table_message WHERE msg_status IN (0,1) AND user_receiver_id=".api_get_user_id();
$sql_result = api_sql_query($sql_query,__FILE__,__LINE__);
$result = Database::fetch_array($sql_result);
return $result['number_messages'];
}
/**
* Gets information about some messages, used for the inbox sortable table
* @param int $from
* @param int $number_of_items
* @param string $direction
*/
public static function get_message_data ($from, $number_of_items, $column, $direction) {
global $charset;
$table_message = Database::get_main_table(TABLE_MESSAGE);
$request=api_is_xml_http_request();
$sql_query = "SELECT id as col0, user_sender_id as col1, title as col2, send_date as col3, msg_status as col4 FROM $table_message " .
"WHERE user_receiver_id=".api_get_user_id()." AND msg_status IN (0,1)" .
"ORDER BY send_date desc, col$column $direction LIMIT $from,$number_of_items";
$sql_result = api_sql_query($sql_query,__FILE__,__LINE__);
$i = 0;
$message_list = array ();
while ($result = Database::fetch_row($sql_result)) {
if ($request===true) {
$message[0] = '<input type="checkbox" value='.$result[0].' name="id[]">';
} else {
$message[0] = ($result[0]);
}
if ($request===true) {
if($result[4]==0)
{
$message[1] = Display::return_icon('mail_open.png',get_lang('AlreadyReadMessage'));//Message already read
}
else
{
$message[1] = Display::return_icon('mail.png',get_lang('UnReadMessage'));//Message without reading
}
$message[2] = mb_convert_encoding(GetFullUserName($result[1]),'UTF-8',$charset);
$message[3] = '<a onclick="get_action_url_and_show_messages(1,'.$result[0].')" href="javascript:void(0)">'.str_replace("\\","",mb_convert_encoding($result[2],'UTF-8',$charset)).'</a>';
$message[5] = '<a onclick="reply_to_messages(\'show\','.$result[0].',\'\')" href="javascript:void(0)">'.Display::return_icon('message_reply.png',get_lang('ReplyToMessage')).'</a>'.
'&nbsp;&nbsp;<a onclick="delete_one_message('.$result[0].')" href="javascript:void(0)" >'.Display::return_icon('message_delete.png',get_lang('DeleteMessage')).'</a>';
} else {
$message[2] = GetFullUserName(($result[1]));
$message[3] = '<a href="view_message.php?id='.$result[0].'">'.$result[2].'</a>';
$message[5] = '<a href="new_message.php?re_id='.$result[0].'">'.Display::return_icon('message_reply.png',get_lang('ReplyToMessage')).'</a>'.
'&nbsp;&nbsp;<a delete_one_message('.$result[0].') href="#inbox.php?action=deleteone&id='.$result[0].'">'.Display::return_icon('message_delete.png',get_lang('DeleteMessage')).'</a>';
}
$message[4] = ($result[3]); //date stays the same
$message_list[] = $message;
$i++;
}
return $message_list;
}
public static function send_message ($receiver_user_id, $title, $content) {
$table_message = Database::get_main_table(TABLE_MESSAGE);
//message in inbox
$query = "INSERT INTO $table_message(user_sender_id, user_receiver_id, msg_status, send_date, title, content ) ".
" VALUES (".
"'".api_get_user_id()."', '".Database::escape_string($receiver_user_id)."', '1', '".date('Y-m-d H:i:s')."','".Database::escape_string($title)."','".Database::escape_string($content)."'".
")";
//message in outbox
$sql = "INSERT INTO $table_message(user_sender_id, user_receiver_id, msg_status, send_date, title, content ) ".
" VALUES (".
"'".api_get_user_id()."', '".Database::escape_string($receiver_user_id)."', '4', '".date('Y-m-d H:i:s')."','".Database::escape_string($title)."','".Database::escape_string($content)."'".
")";
$rs = api_sql_query($sql,__FILE__,__LINE__);
$result = api_sql_query($query,__FILE__,__LINE__);
return $result;
}
public static function delete_message_by_user_receiver ($user_receiver_id,$id) {
$table_message = Database::get_main_table(TABLE_MESSAGE);
$sql="SELECT COUNT(*) as count FROM $table_message WHERE id=".$id." AND msg_status<>4;";
$rs=api_sql_query($sql,__FILE__,__LINE__);
$row=Database::fetch_array($rs,'ASSOC');
if ($row['count']==1) {
$query = "DELETE FROM $table_message " .
"WHERE user_receiver_id=".Database::escape_string($user_receiver_id)." AND id=".Database::escape_string($id);
$result = api_sql_query($query,__FILE__,__LINE__);
return $result;
} else {
return false;
}
}
/**
* Set status deleted
* @author Isaac FLores Paz <isaac.flores@dokeos.com>
* @param integer
* @param integer
* @return array
*/
public static function delete_message_by_user_sender ($user_sender_id,$id) {
$table_message = Database::get_main_table(TABLE_MESSAGE);
$query = "DELETE FROM $table_message " .
"WHERE user_sender_id=".Database::escape_string($user_sender_id)." AND id=".Database::escape_string($id);
$result = api_sql_query($query,__FILE__,__LINE__);
return $result;
}
public static function update_message ($user_id, $id) {
$table_message = Database::get_main_table(TABLE_MESSAGE);
$query = "UPDATE $table_message SET msg_status = '0' WHERE msg_status<>4 AND user_receiver_id=".Database::escape_string($user_id)." AND id='".Database::escape_string($id)."'";
$result = api_sql_query($query,__FILE__,__LINE__);
}
public static function get_message_by_user ($user_id,$id) {
$table_message = Database::get_main_table(TABLE_MESSAGE);
$query = "SELECT * FROM $table_message WHERE user_receiver_id=".Database::escape_string($user_id)." AND id='".Database::escape_string($id)."'";
$result = api_sql_query($query,__FILE__,__LINE__);
return $row = Database::fetch_array($result);
}
/**
* Gets information about if exist messages
* @author Isaac FLores Paz <isaac.flores@dokeos.com>
* @param integer
* @param integer
* @return boolean
*/
public static function exist_message ($user_id, $id) {
$table_message = Database::get_main_table(TABLE_MESSAGE);
$query = "SELECT id FROM $table_message WHERE user_receiver_id=".Database::escape_string($user_id)." AND id='".Database::escape_string($id)."'";
$result = api_sql_query($query,__FILE__,__LINE__);
$num = Database::num_rows($result);
if ($num>0)
return true;
else
return false;
}
/**
* Gets information about messages sent
* @author Isaac FLores Paz <isaac.flores@dokeos.com>
* @param integer
* @param integer
* @param string
* @return array
*/
public static function get_message_data_sent ($from, $number_of_items, $column, $direction) {
global $charset;
$table_message = Database::get_main_table(TABLE_MESSAGE);
$request=api_is_xml_http_request();
$sql_query = "SELECT id as col0, user_sender_id as col1, title as col2, send_date as col3, user_receiver_id as col4, msg_status as col5 FROM $table_message " .
"WHERE user_sender_id=".api_get_user_id()." AND msg_status=4 " .
"ORDER BY col$column $direction LIMIT $from,$number_of_items";
$sql_result = api_sql_query($sql_query,__FILE__,__LINE__);
$i = 0;
$message_list = array ();
while ($result = Database::fetch_row($sql_result)) {
if ($request===true) {
$message[0] = '<input type="checkbox" value='.$result[0].' name="out[]">';
} else {
$message[0] = ($result[0]);
}
if ($request===true) {
if ($result[5]==4)
{
$message[1] = Display::return_icon('mail_send.png',get_lang('MessageSent'));//Message Sent
}
$message[2] = mb_convert_encoding(GetFullUserName($result[4]),'UTF-8',$charset);
$message[3] = '<a onclick="show_sent_message('.$result[0].')" href="javascript:void(0)">'.str_replace("\\","",mb_convert_encoding($result[2],'UTF-8',$charset)).'</a>';
$message[5] = '&nbsp;&nbsp;<a onclick="delete_one_message_outbox('.$result[0].')" href="javascript:void(0)" >'.Display::return_icon('message_delete.png',get_lang('DeleteMessage')).'</a>';
} else {
$message[2] = GetFullUserName($result[4]);
$message[3] = '<a onclick="show_sent_message ('.$result[0].')" href="#../messages/view_message.php?id_send='.$result[0].'">'.$result[2].'</a>';
$message[5] = '<a href="new_message.php?re_id='.$result[0].'">'.Display::return_icon('message_reply.png',get_lang('ReplyToMessage')).'</a>'.
'&nbsp;&nbsp;<a href="outbox.php?action=deleteone&id='.$result[0].'" onclick="javascript:if(!confirm('."'".addslashes(htmlentities(get_lang('ConfirmDeleteMessage')))."'".')) return false;">'.Display::return_icon('message_delete.png',get_lang('DeleteMessage')).'</a>';
}
$message[4] = $result[3]; //date stays the same
$message_list[] = $message;
$i++;
}
return $message_list;
}
/**
* Gets information about number messages sent
* @author Isaac FLores Paz <isaac.flores@dokeos.com>
* @param void
* @return integer
*/
public static function get_number_of_messages_sent () {
$table_message = Database::get_main_table(TABLE_MESSAGE);
$sql_query = "SELECT COUNT(*) as number_messages FROM $table_message WHERE msg_status=4 AND user_sender_id=".api_get_user_id();
$sql_result = api_sql_query($sql_query,__FILE__,__LINE__);
$result = Database::fetch_array($sql_result);
return $result['number_messages'];
}
public static function show_message_box () {
global $charset;
$table_message = Database::get_main_table(TABLE_MESSAGE);
if (isset($_GET['id_send'])) {
$query = "SELECT * FROM $table_message WHERE user_sender_id=".api_get_user_id()." AND id=".$_GET['id_send']." AND msg_status=4;";
$result = api_sql_query($query,__FILE__,__LINE__);
$path='outbox.php';
} else {
$query = "UPDATE $table_message SET msg_status = '0' WHERE user_receiver_id=".api_get_user_id()." AND id='".Database::escape_string($_GET['id'])."';";
$result = api_sql_query($query,__FILE__,__LINE__);
$query = "SELECT * FROM $table_message WHERE msg_status<>4 AND user_receiver_id=".api_get_user_id()." AND id='".Database::escape_string($_GET['id'])."';";
$result = api_sql_query($query,__FILE__,__LINE__);
$path='inbox.php';
}
$row = Database::fetch_array($result);
$user_con = self::users_connected_by_id();
$band=0;
$reply='';
for ($i=0;$i<count($user_con);$i++)
if ($row[1]==$user_con[$i])
$band=1;
if ($band==1 && !isset($_GET['id_send'])) {
$reply = '<a onclick="reply_to_messages(\'show\','.$_GET['id'].',\'\')" href="javascript:void(0)">'.Display::return_icon('message_reply.png',get_lang('ReplyToMessage')).get_lang('ReplyToMessage').'</a>';
}
echo '<div class=actions>';
echo '<a onclick="close_div_show(\'div_content_messages\')" href="javascript:void(0)">'.Display::return_icon('folder_up.gif',get_lang('BackToInbox')).get_lang('BackToInbox').'</a>';
echo $reply;
echo '<a onclick="delete_one_message('.$row[0].')" href="javascript:void(0)" >'.Display::return_icon('message_delete.png',get_lang('DeleteMessage')).''.get_lang('Delete').'</a>';
echo '</div><br />';
echo '
<table class="message_view_table" >
<TR>
<TD width=10>&nbsp; </TD>
<TD vAlign=top width="100%">
<TABLE>
<TR>
<TD width="100%">
<TR> <h1>'.str_replace("\\","",mb_convert_encoding($row[5],'UTF-8',$charset)).'</h1></TR>
</TD>
<TR>
<TD>'.mb_convert_encoding(get_lang('From'),'UTF-8',$charset).'&nbsp;<b>'.GetFullUserName($row[1]).'</b> '.mb_convert_encoding(strtolower(get_lang('To')),'UTF-8',$charset).'&nbsp; <b>'.mb_convert_encoding(GetFullUserName($row[2]),'UTF-8',$charset).'</b> </TD>
</TR>
<TR>
<TD >'.get_lang('Date').'&nbsp; '.$row[4].'</TD>
</TR>
</TR>
</TABLE>
<br />
<TABLE height=209 width="100%" bgColor=#ffffff>
<TBODY>
<TR>
<TD vAlign=top>'.mb_convert_encoding($row[6],'UTF-8',$charset).'</TD>
</TR>
</TBODY>
</TABLE>
<DIV class=HT style="PADDING-BOTTOM: 5px"> </DIV></TD>
<TD width=10>&nbsp;</TD>
</TR>
</TABLE>';
}
public static function show_message_box_sent () {
global $charset;
$table_message = Database::get_main_table(TABLE_MESSAGE);
$query = "SELECT * FROM $table_message WHERE user_sender_id=".api_get_user_id()." AND id=".$_GET['id_send']." AND msg_status=4;";
$result = api_sql_query($query,__FILE__,__LINE__);
$path='outbox.php';
$row = Database::fetch_array($result);
$user_con = self::users_connected_by_id();
$band=0;
$reply='';
for ($i=0;$i<count($user_con);$i++)
if ($row[1]==$user_con[$i])
$band=1;
echo '<div class=actions>';
echo '<a onclick="close_and_open_outbox()" href="javascript:void(0)">'.Display::return_icon('folder_up.gif',get_lang('BackToOutbox')).get_lang('BackToOutbox').'</a>';
echo '<a onclick="delete_one_message_outbox('.$row[0].')" href="javascript:void(0)" >'.Display::return_icon('message_delete.png',get_lang('DeleteMessage')).''.get_lang('Delete').'</a>';
echo '</div><br />';
echo '
<table class="message_view_table" >
<TR>
<TD width=10>&nbsp; </TD>
<TD vAlign=top width="100%">
<TABLE>
<TR>
<TD width="100%">
<TR> <h1>'.str_replace("\\","",mb_convert_encoding($row[5],'UTF-8',$charset)).'</h1></TR>
</TD>
<TR>
<TD>'.mb_convert_encoding(get_lang('From'),'UTF-8',$charset).'&nbsp;<b>'.GetFullUserName($row[1]).'</b> '.mb_convert_encoding(strtolower(get_lang('To')),'UTF-8',$charset).'&nbsp; <b>'.mb_convert_encoding(GetFullUserName($row[2]),'UTF-8',$charset).'</b> </TD>
</TR>
<TR>
<TD >'.get_lang('Date').'&nbsp; '.$row[4].'</TD>
</TR>
</TR>
</TABLE>
<br />
<TABLE height=209 width="100%" bgColor=#ffffff>
<TBODY>
<TR>
<TD vAlign=top>'.mb_convert_encoding($row[6],'UTF-8',$charset).'</TD>
</TR>
</TBODY>
</TABLE>
<DIV class=HT style="PADDING-BOTTOM: 5px"> </DIV></TD>
<TD width=10>&nbsp;</TD>
</TR>
</TABLE>';
}
}
?>
Loading…
Cancel
Save