[svn r17903] Adding/fixing the message tool FS#3503

skala
Julio Montoya 17 years ago
parent e9c0b6a9cf
commit 60a2720895
  1. 215
      main/messages/functions.inc.php
  2. BIN
      main/messages/images/newmsg.gif
  3. 59
      main/messages/inbox.php
  4. 78
      main/messages/index.php
  5. 99
      main/messages/new_message.php
  6. 24
      main/messages/notify.php
  7. 128
      main/messages/view_message.php

@ -1,215 +0,0 @@
<?php
/*
DOKEOS - elearning and course management software
For a full list of contributors, see documentation/credits.html
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 "documentation/licence.html" more details.
Contact:
Dokeos
Rue des Palais 44 Paleizenstraat
B-1030 Brussels - Belgium
Tel. +32 (2) 211 34 56
*/
/**
* @package dokeos.survey
* @author
* @version $Id: functions.inc.php 12281 2007-05-03 16:25:12Z yannoo $
* @todo use database library
*/
if(!function_exists('api_get_path')){header('location: view_message.php');die;}
include_once(api_get_path(LIBRARY_PATH).'/online.inc.php');
define ("MESSAGES_DATABASE", "messages");
function get_online_user_list($current_user_id)
{
$MINUTE=30;
global $_configuration;
$userlist = WhoIsOnline($current_user_id,$_configuration['statistics_database'],$MINUTE);
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.
*/
function display_success_message($uid)
{
$success= "<p style=\"text-align: center\">".
get_lang('MessageSentTo').
"&nbsp;<b>".
GetFullUserName($uid).
"</b>".
"<br><a href=\"".
"inbox.php\">".
get_lang('BackToInbox').
"</a>";
Display::display_confirmation_message($success, false);
}
/**
* @todo this function seems no longer user
* but is still mentioned in comments, what can be the use?
*/
function validate_text($texto)
{
$MAX_SIZE = 60; /*Tama<EFBFBD> m<EFBFBD>imo de caracteres por l<EFBFBD>ea*/
$i=0;
$lines = array(); /*Arreglo que contendr<EFBFBD>las l<EFBFBD>eas del texto*/
$token = strtok($texto, "\n");
while($token)
{
$lines[$i]= $token;
$token = strtok("\n");
$i++;
}
$modificado= "";
for($i=0; $i<count($lines); $i++ )
{
if(strlen($lines[$i])>$MAX_SIZE + 1)
{
$modificado2= substr($lines[$i], 0, $MAX_SIZE);
for($j=$MAX_SIZE; $j<strlen($lines[$i]); $j+=$MAX_SIZE)
{
$modificado2 = $modificado2."\n".substr($lines[$i], $j, $MAX_SIZE);
}
}
else
{
$modificado2= $lines[$i];
}
$modificado = $modificado.$modificado2."\n";
}
$modificado = substr($modificado, 0 ,strlen($modificado)-1);
$modificado = str_replace("&", "&#038", $modificado); // <EFBFBD>em
$modificado = str_replace("<", "&#60", $modificado); // para evitar que lo convierta en html
$modificado = str_replace(">", "&#62", $modificado); // <EFBFBD>em
return $modificado;
}
/**
* Displays the wysiwyg html editor.
*/
function display_html_editor_area($name,$resp)
{
api_disp_html_area($name, 'Type your message here.', '', '100%');
}
/**
* Get the new messages for the current user from the database.
*/
function get_new_messages()
{
if (!api_get_user_id())
{
return false;
}
$i=0;
$query = "SELECT * FROM `".MESSAGES_DATABASE."` WHERE id_receiver=".api_get_user_id()." AND status=1;";
$result = api_sql_query($query,__FILE__,__LINE__);
$i = mysql_num_rows($result);
return $i;
}
/**
* Get the list of user_ids of users who are online.
*/
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
*/
function get_number_of_messages()
{
$sql_query = "SELECT COUNT(*) as number_messages FROM `".MESSAGES_DATABASE."` WHERE id_receiver=".$_SESSION['_user']['user_id'];
$sql_result = api_sql_query($sql_query,__FILE__,__LINE__);
$result = mysql_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
*/
function get_message_data($from, $number_of_items, $column, $direction)
{
$sql_query = "SELECT id as col0, id_sender as col1, title as col2, date as col3 FROM `".MESSAGES_DATABASE."` WHERE id_receiver=".$_SESSION['_user']['user_id']." 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 = mysql_fetch_row($sql_result))
{
$message[0] = $result[0];
$message[1] = GetFullUserName($result[1]);
//$message[1] = "<a href=\"view_message.php?id=".$result[0]."\" title=\"$texto\">".GetFullUserName($result[1])."</a>";
$message[2] = '<a href="view_message.php?id='.$result[0].'">'.$result[2].'</a>';
$message[3] = $result[3]; //date stays the same
$message[4] = '<a href="new_message.php?re_id='.$result[0].'"><img src="'.api_get_path(WEB_IMG_PATH).'forum.gif" alt="'.get_lang("ReplyToMessage").'" align="middle"></img></a>';
$message_list[] = $message;
$i++;
}
return $message_list;
}
/**
* Displays the inbox of a user, listing all messages.
* In the process of moving towards sortable table.
*/
function inbox_display()
{
//delete messages if delete action was chosen
if (isset ($_POST['action']))
{
switch ($_POST['action'])
{
case 'delete' :
$number_of_selected_messages = count($_POST['id']);
foreach ($_POST['id'] as $index => $message_id)
{
$query = "DELETE FROM ".MESSAGES_DATABASE." WHERE id_receiver=".api_get_user_id()." AND id='".mysql_real_escape_string($message_id)."'";
api_sql_query($query,__FILE__,__LINE__);
}
Display :: display_normal_message(get_lang('SelectedMessagesDeleted'));
break;
}
}
// display sortable table with messages of the current user
$table = new SortableTable('messages', 'get_number_of_messages', 'get_message_data', 1);
$table->set_header(0, '', false);
$table->set_header(1, get_lang('From'));
$table->set_header(2, get_lang('Title'));
$table->set_header(3, get_lang('Date'));
$table->set_header(4, get_lang("ReplyToMessage"), false);
$table->set_form_actions(array ('delete' => get_lang('DeleteSelectedMessages')));
$table->display();
}
?>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

@ -1,24 +1,25 @@
<?php
// $Id: inbox.php 10204 2006-11-26 20:46:53Z pcool $
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2009 Dokeos SPRL
Copyright (c) 2009 Julio Montoya Armas <gugli100@gmail.com>
Copyright (c) Facultad de Matematicas, UADY (México)
Copyright (c) Evie, Free University of Brussels (Belgium)
Copyright (c) Evie, Free University of Brussels (Belgium)
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, 44 rue des palais, B-1030 Brussels, Belgium
Mail: info@dokeos.com
Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
Mail: info@dokeos.com
==============================================================================
*/
/*
@ -27,11 +28,17 @@
==============================================================================
*/
// name of the language file that needs to be included
$language_file= "messages";
$language_file= 'messages';
$cidReset=true;
include('../../main/inc/global.inc.php');
include('./functions.inc.php');
include_once ('../inc/global.inc.php');
require_once (api_get_path(LIBRARY_PATH).'message.lib.php');
api_block_anonymous_users();
if (api_get_setting('allow_message_tool')!='true'){
api_not_allowed();
}
$htmlHeadXtra[]='<script language="javascript">
<!--
function enviar(miforma)
@ -64,21 +71,25 @@ function deselect_all(formita)
MAIN CODE
==============================================================================
*/
$nameTools = get_lang('Messages');
Display::display_header($nameTools,"Inbox");
api_display_tool_title($nameTools);
echo $_SESSION['prueba'];
if(!isset($_GET[del_msg]))
Display::display_header($nameTools,get_lang('Inbox'));
api_display_tool_title(get_lang('Inbox'));
$table_message = Database::get_course_table(TABLE_MESSAGE);
echo '<div class=actions>';
echo '<a href="new_message.php">'.Display::return_icon('message_new.png',get_lang('ComposeMessage')).get_lang('ComposeMessage').'</a>';
echo '</div>';
if(!isset($_GET[del_msg])) {
inbox_display();
else
{
} else {
$num_msg = $_POST['total'];
for ($i=0;$i<$num_msg;$i++)
{
if($_POST[$i])
{
$query = "DELETE FROM `".MESSAGES_DATABASE."` WHERE id_receiver=".$_SESSION['_uid']." AND id='".$_POST['_'.$i]."';";
api_sql_query($query,__FILE__,__LINE__);
for ($i=0;$i<$num_msg;$i++) {
if($_POST[$i]) {
//the user_id was necesarry to delete a message??
delete_message_by_user_receiver(api_get_user_id(), $_POST['_'.$i]);
}
}
inbox_display();

@ -1,10 +1,12 @@
<?php // $Id: index.php 10675 2007-01-11 13:03:10Z bmol $
<?php // $Id: index.php 17903 2009-01-21 19:50:57Z juliomontoya $
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2009 Dokeos SPRL
Copyright (c) 2009 Julio Montoya Armas <gugli100@gmail.com>
Copyright (c) Facultad de Matematicas, UADY (México)
Copyright (c) Evie, Free University of Brussels (Belgium)
Copyright (c) Evie, Free University of Brussels (Belgium)
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
@ -16,59 +18,47 @@
See the GNU General Public License for more details.
Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
Mail: info@dokeos.com
Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
Mail: info@dokeos.com
==============================================================================
*/
include_once('functions.inc.php');
$e= api_get_path(WEB_PLUGIN_PATH).'messages/inbox.php';
$e2= api_get_path(WEB_PLUGIN_PATH).'messages/new_message.php';
$inb = get_lang("Inbox");
$newm = get_lang("ComposeMessage");
if(api_get_user_id())
{
$query = "CREATE TABLE IF NOT EXISTS `".MESSAGES_DATABASE."` (".
"`id` VARCHAR(150) NOT NULL,".
"`id_sender` INT( 10 ) NOT NULL ,".
"`id_receiver` INT( 10 ) NOT NULL ,".
"`status` BOOL NOT NULL,".
"`date` DATETIME NOT NULL ,".
"`title` VARCHAR(255) NOT NULL,".
"`content` TEXT NOT NULL,".
"INDEX ( `id`,`id_receiver` )".
") TYPE = MYISAM ;";
@api_sql_query($query,__FILE__,__LINE__);
$language_file= 'messages';
include_once('../inc/global.inc.php');
include (api_get_path(LIBRARY_PATH).'message.lib.php');
api_block_anonymous_users();
echo '<script language="javascript" type="text/javascript" src="'.api_get_path(WEB_PLUGIN_PATH).'messages/cookies.js"> </script> ';
echo '<script language="javascript" type="text/javascript">set_url("'.api_get_path(WEB_PLUGIN_PATH).'messages/notify.php") ; notificar()</script> ';
if (api_get_setting('allow_message_tool')!='true'){
api_not_allowed();
}
if(api_get_user_id()!=0) {
echo '<script language="javascript" type="text/javascript" src="'.api_get_path(WEB_CODE_PATH).'messages/cookies.js"> </script> ';
echo '<script language="javascript" type="text/javascript">set_url("'.api_get_path(WEB_CODE_PATH).'messages/notify.php") ; notificar()</script> ';
$number_of_new_messages = get_new_messages();
if(is_null($number_of_new_messages))
{
if(is_null($number_of_new_messages)) {
$number_of_new_messages = 0;
}
echo "<a href=$e>".$inb."(<span id=\"nuevos\" style=\"none\">".$number_of_new_messages."</span>)</a>";
echo "<a href=inbox.php>".get_lang('Inbox')."(<span id=\"nuevos\" style=\"none\">".$number_of_new_messages."</span>)</a>";
echo " - ";
echo "<a href=$e2>".$newm."</a>";
echo "<a href=new_message.php>".get_lang('ComposeMessage')."</a>";
if($number_of_new_messages > 0)
{
?>
<div id="box" style="background-color:white;border:1px solid black;position:absolute;width:200px;height:60px;z-index:3;visibility:hidden;top:85px;left:10px;margin: 0px;padding: 0px;">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="2" id="table" class="content">
<tr>
<td width="28%" height="16" class="content" id="ref"><a style="color:red;font-size:10px" href="javascript:;" onclick="ocultar_aviso()">Close</a></td>
<td width="72%" rowspan="2" class="content" id="ref"><?php echo '<a href="'.$e.'" style="color:#000000" onclick="ocultar_aviso()">'.get_lang('YouHaveNewMessage').'</a>'; ?></td>
</tr>
<tr>
<td class="content" id="ref"><?php echo'<img src="'.api_get_path(WEB_PLUGIN_PATH).'messages/images/newmsg.gif" alt="new message" align="middle" class="images"></p>';?> </td>
</tr>
</table>
</div>
<?php
<div id="box" style="background-color:white;border:1px solid black;position:absolute;width:200px;height:60px;z-index:3;visibility:hidden;top:85px;left:10px;margin: 0px;padding: 0px;">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="2" id="table" class="content">
<tr>
<td width="28%" height="16" class="content" id="ref"><a style="color:red;font-size:10px" href="javascript:;" onclick="ocultar_aviso()"><?php echo get_lang('Close');?></a></td>
<td width="72%" rowspan="2" class="content" id="ref"><?php echo '<a href="'.$e.'" style="color:#000000" onclick="ocultar_aviso()">'.get_lang('YouHaveNewMessage').'</a>'; ?></td>
</tr>
<tr>
<td class="content" id="ref"><?php Display::return_icon('message_new.gif',get_lang('NewMessage'));?> </td>
</tr>
</table>
</div>
<?php
}
}
else
{
echo '<script language="javascript" type="text/javascript" src="'.api_get_path(WEB_PLUGIN_PATH).'messages/cookies.js"> </script>';
} else {
echo '<script language="javascript" type="text/javascript" src="'.api_get_path(WEB_CODE_PATH).'messages/cookies.js"> </script>';
echo '<script language="javascript" type="text/javascript">Set_Cookie( "nuevos", 0, 0, "/","","")</script> ';
}
?>

@ -1,10 +1,12 @@
<?php // $Id: new_message.php 12996 2007-09-11 14:49:05Z elixir_inter $
<?php // $Id: new_message.php 17903 2009-01-21 19:50:57Z juliomontoya $
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2009 Dokeos SPRL
Copyright (c) 2009 Julio Montoya Armas <gugli100@gmail.com>
Copyright (c) Facultad de Matematicas, UADY (México)
Copyright (c) Evie, Free University of Brussels (Belgium)
Copyright (c) Evie, Free University of Brussels (Belgium)
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
@ -16,8 +18,8 @@
See the GNU General Public License for more details.
Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
Mail: info@dokeos.com
Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
Mail: info@dokeos.com
==============================================================================
*/
/**
@ -34,14 +36,21 @@
==============================================================================
*/
// name of the language file that needs to be included
$language_file= "messages";
$language_file= 'messages';
$cidReset=true;
include_once('../../main/inc/global.inc.php');
echo $_SESSION['prueba'];
include_once('../inc/global.inc.php');
api_block_anonymous_users();
require_once('./functions.inc.php');
if (api_get_setting('allow_message_tool')!='true'){
api_not_allowed();
}
require_once(api_get_path(LIBRARY_PATH).'message.lib.php');
require_once(api_get_path(LIBRARY_PATH).'/text.lib.php');
require_once(api_get_path(LIBRARY_PATH).'/formvalidator/FormValidator.class.php');
$table_message = Database::get_course_table(TABLE_MESSAGE);
/*
-----------------------------------------------------------
@ -82,19 +91,20 @@ function show_compose_to_any($user_id)
function show_compose_reply_to_message($message_id, $receiver_id)
{
$query = "SELECT * FROM `".MESSAGES_DATABASE."` WHERE id_receiver=".$receiver_id." AND id='".$message_id."';";
global $table_message;
$query = "SELECT * FROM $table_message WHERE user_receiver_id=".$receiver_id." AND id='".$message_id."';";
$result = api_sql_query($query,__FILE__,__LINE__);
$row = mysql_fetch_array($result);
$row = Database::fetch_array($result);
if(!isset($row[1]))
{
echo get_lang('InvalidMessageId');
die();
}
echo get_lang('To').':&nbsp;<strong>'. GetFullUserName($row[1]).'</strong>';
$default['title'] = "Please enter a title";
$default['title'] =get_lang('EnterTitle');
$default['user_list'] = $row[1];
manage_form($default);
@ -103,48 +113,36 @@ function show_compose_reply_to_message($message_id, $receiver_id)
function show_compose_to_user($receiver_id)
{
echo get_lang('To').':&nbsp;<strong>'. GetFullUserName($receiver_id).'</strong>';
$default['title'] = "Please enter a title";
$default['title'] = get_lang('EnterTitle');
$default['user_list'] = $receiver_id;
manage_form($default);
}
function manage_form($default, $select_from_user_list = null)
{
global $table_message;
$form = new FormValidator('compose_message');
if (isset($select_from_user_list))
{
$form->addElement('select', 'user_list', get_lang('SendMessageTo'), $select_from_user_list);
}
else
{
} else {
$form->addElement('hidden', 'user_list');
}
$form->add_textfield('title', get_lang('Title'));
$form->add_html_editor('content', get_lang('Content'));
$form->addElement('submit', 'compose', get_lang('Ok'));
$form->add_html_editor('content', '',false,false);
$form->addElement('submit', 'compose', get_lang('Send'));
$form->setDefaults($default);
if( $form->validate() )
{
if($form->validate()) {
$values = $form->exportValues();
$receiver_user_id = $values['user_list'];
$title = mysql_real_escape_string($values['title']);
$content = mysql_real_escape_string($values['content']);
$title = $values['title'];
$content = $values['content'];
//all is well, send the message
$id_tmp = api_get_user_id().$receiver_user_id.date('d-D-w-m-Y-H-s').microtime().rand();
$id_msg = md5($id_tmp);
$query = "INSERT INTO `".MESSAGES_DATABASE."` ( `id`, `id_sender`, `id_receiver`, `status`, `date`, `title`, `content` ) ".
" VALUES (".
"' ".$id_msg ."' , '".api_get_user_id()."', '".$receiver_user_id."', '1', '".date('Y-m-d H:i:s')."','".$title."','".$content."'".
");";
@api_sql_query($query,__FILE__,__LINE__);
send_message($receiver_user_id, $title, $content);
display_success_message($receiver_user_id);
}
else
{
} else {
$form->display();
}
}
@ -154,36 +152,27 @@ function manage_form($default, $select_from_user_list = null)
MAIN SECTION
==============================================================================
*/
$interbreadcrumb[] = array ("url" => 'inbox.php', "name" => get_lang('Messages'));
Display::display_header($nameTools, get_lang("ComposeMessage"));
$interbreadcrumb[] = array ('url' => 'inbox.php', 'name' => get_lang('Messages'));
Display::display_header($nameTools, get_lang('ComposeMessage'));
api_display_tool_title($nameTools);
if(!isset($_POST['compose']))
{
if(isset($_GET['re_id']))
{
if(!isset($_POST['compose'])) {
if(isset($_GET['re_id'])) {
$message_id = $_GET['re_id'];
$receiver_id = api_get_user_id();
show_compose_reply_to_message($message_id, $receiver_id);
}
else if(isset($_GET['send_to_user']))
{
} elseif(isset($_GET['send_to_user'])) {
show_compose_to_user($_GET['send_to_user']);
}
else
{
} else {
show_compose_to_any($_user['user_id']);
}
}
else
{
if(api_get_user_id() && isset($_POST['user_list']) && isset($_POST['content']))
{
} else {
if(api_get_user_id() && isset($_POST['user_list']) && isset($_POST['content'])) {
$default['title'] = $_POST['title'];
$default['user_list'] = $_POST['user_list'];
manage_form($default);
}
else
} else {
Display::display_error_message(get_lang('ErrorSendingMessage'));
}
}

@ -1,27 +1,29 @@
<?php // $Id: notify.php 9491 2006-10-13 09:03:16Z evie_em $
<?php // $Id: notify.php 17903 2009-01-21 19:50:57Z juliomontoya $
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2009 Dokeos SPRL
Copyright (c) 2009 Julio Montoya Armas <gugli100@gmail.com>
Copyright (c) Facultad de Matematicas, UADY (México)
Copyright (c) Evie, Free University of Brussels (Belgium)
Copyright (c) Evie, Free University of Brussels (Belgium)
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, 44 rue des palais, B-1030 Brussels, Belgium
Mail: info@dokeos.com
Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
Mail: info@dokeos.com
==============================================================================
*/
include_once('../../main/inc/global.inc.php');
include_once("functions.inc.php");
include_once('../inc/global.inc.php');
require_once(api_get_path(LIBRARY_PATH).'message.lib.php');
header("Cache-Control: no-cache, must-revalidate");
echo get_new_messages();
?>

@ -1,10 +1,12 @@
<?php // $Id: view_message.php 10675 2007-01-11 13:03:10Z bmol $
<?php // $Id: view_message.php 17903 2009-01-21 19:50:57Z juliomontoya $
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2009 Dokeos SPRL
Copyright (c) 2009 Julio Montoya Armas <gugli100@gmail.com>
Copyright (c) Facultad de Matematicas, UADY (México)
Copyright (c) Evie, Free University of Brussels (Belgium)
Copyright (c) Evie, Free University of Brussels (Belgium)
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
@ -16,10 +18,11 @@
See the GNU General Public License for more details.
Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
Mail: info@dokeos.com
Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
Mail: info@dokeos.com
==============================================================================
*/
/*
==============================================================================
INIT SECTION
@ -27,67 +30,66 @@
*/
// name of the language file that needs to be included
$language_file= "messages";
include('../../main/inc/global.inc.php');
$language_file= 'messages';
include_once('../inc/global.inc.php');
api_block_anonymous_users();
include('./functions.inc.php');
$nameTools = get_lang("Messages");
$interbredcrump[]=array("url" => "inbox.php","name" => get_lang("Inbox"));
Display::display_header($nameTools,"messages");
if (api_get_setting('allow_message_tool')!='true'){
api_not_allowed();
}
require_once(api_get_path(LIBRARY_PATH).'message.lib.php');
$nameTools = get_lang('Messages');
$interbredcrump[]=array('url' => 'inbox.php','name' => get_lang('Inbox'));
Display::display_header($nameTools,get_lang('Messages'));
$query = "UPDATE `".MESSAGES_DATABASE."` SET `status` = '0' WHERE `id_receiver`=".api_get_user_id()." AND `id`='".mysql_real_escape_string($_GET['id'])."';";
api_display_tool_title(get_lang('ReadMessage'));
$table_message = Database::get_course_table(TABLE_MESSAGE);
$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 `".MESSAGES_DATABASE."` WHERE id_receiver=".api_get_user_id()." AND id='".mysql_real_escape_string($_GET['id'])."';";
$query = "SELECT * FROM $table_message WHERE user_receiver_id=".api_get_user_id()." AND id='".Database::escape_string($_GET['id'])."';";
$result = api_sql_query($query,__FILE__,__LINE__);
$row = mysql_fetch_array($result);
$row = Database::fetch_array($result);
$user_con = 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)
$reply = '<a href="new_message.php?re_id='.$_GET['id'].'">'.Display::return_icon('message_reply.png',get_lang('ReplyToMessage')).get_lang('ReplyToMessage').'</a>';
echo '<div class=actions>';
echo '<a href="inbox.php">&laquo;&nbsp;'.get_lang('BackToInbox').'</a>';
echo $reply;
echo '<a href="inbox.php?action=deleteone&id='.$row[0].'" onclick="javascript:if(!confirm('."'".addslashes(htmlentities(get_lang('ConfirmDeleteMessage')))."'".')) return false;">'.Display::return_icon('message_delete.png',get_lang('DeleteMessage')).''.get_lang('Delete').'</a>';
echo '</div><br />';
echo '
<TABLE cellSpacing=0 cellPadding=0 width="100%" bgColor=#dbeaf5 border=0>
<TBODY>
<table class="message_view_table" >
<TR>
<TD width=10>&nbsp; </TD>
<TD vAlign=top width="100%">
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TABLE>
<TR>
<TD class=HT vAlign=top width="100%">
<TABLE class=TH>
<TBODY>
<TR>
<TD noWrap>'.get_lang("From").':&nbsp;</TD>
<TD>'.GetFullUserName($row[1],$mysqlMainDb).'</TD>
</TR>
<TR>
<TD noWrap>'.get_lang("Date").'&nbsp;</TD>
<TD>'.$row[4].'</TD>
</TR>
<TR>
<TD noWrap>'.get_lang("To").':&nbsp; </TD>
<TD>'.GetFullUserName($row[2],$mysqlMainDb).'</TD>
</TR>
<TR>
<TD noWrap>'.get_lang("Title").':&nbsp; </TD>
<TD>'.$row[5].'</TD>
</TR>
<TR>
<TD style="PADDING-BOTTOM: 0px"></TD>
<TD style="PADDING-BOTTOM: 0px"
width="100%"></TD>
</TR>
</TBODY>
</TABLE></TD>
<TD class=HT vAlign=top align=right>&nbsp; </TD>
</TR>
</TBODY>
</TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD style="PADDING-BOTTOM: 5px" width="100%"><HR border="1"></TD>
</TR>
</TBODY>
</TABLE>
<TD width="100%">
<TR> <h1>'.$row[5].'</h1></TR>
</TD>
<TR>
<TD>'.get_lang('From').'&nbsp;<b>'.GetFullUserName($row[1],$mysqlMainDb).'</b> '.strtolower(get_lang('To')).'&nbsp; <b>'.GetFullUserName($row[2],$mysqlMainDb).'</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>
@ -97,21 +99,11 @@ echo '
</TABLE>
<DIV class=HT style="PADDING-BOTTOM: 5px"> </DIV></TD>
<TD width=10>&nbsp;</TD>
<TD vAlign=top width=160></TD>
</TR>
</TBODY>
</TABLE>
<p><a href="inbox.php">'.get_lang("BackToInbox").'</a>
';
$user_con = users_connected_by_id();
$band=0;
for($i=0;$i<count($user_con);$i++)
if($row[1]==$user_con[$i])
$band=1;
if($band==1)
echo '- <a href="new_message.php?re_id='.$_GET['id'].'">'.get_lang("ReplyToMessage").'</a> </p>';
else
echo "</a> </p>";
</TABLE>';
/*
==============================================================================
FOOTER

Loading…
Cancel
Save