[svn r20615] Fixed problems of messages in social red - partial FS#4204 (by jhp1411)

skala
Cristian Fasanando 16 years ago
parent 060911f600
commit d3f8606b89
  1. 10
      main/inc/lib/social.lib.php
  2. 4
      main/inc/lib/usermanager.lib.php
  3. 34
      main/messages/message.class.php
  4. 13
      main/social/select_options.php

@ -296,9 +296,13 @@ class UserFriend extends UserManager {
$user_info=api_get_user_info($userfriend_id);
$succes=get_lang('MessageSentTo');
$succes.= ' : '.$user_info['firstName'].' '.$user_info['lastName'];
if (isset($subject_message) && isset($content_message) && isset($userfriend_id)) {
MessageManager::send_message(Database::escape_string($userfriend_id),Database::escape_string($subject_message), Database::escape_string($content_message));
Display::display_confirmation_message($succes,true);
if (isset($subject_message) && isset($content_message) && isset($userfriend_id)) {
$send_message = MessageManager::send_message(Database::escape_string($userfriend_id),Database::escape_string($subject_message), Database::escape_string($content_message));
if($send_message) {
echo Display::display_confirmation_message($succes,true);
} else {
echo Display::display_error_message($succes,true);
}
exit;
} elseif(isset($userfriend_id) && !isset($subject_message)) {
$count_is_true=false;

@ -1,4 +1,4 @@
<?php // $Id: usermanager.lib.php 20561 2009-05-12 19:35:39Z juliomontoya $
<?php // $Id: usermanager.lib.php 20615 2009-05-13 23:00:33Z cfasanando $
/*
==============================================================================
Dokeos - elearning and course management software
@ -1916,7 +1916,7 @@ class UserManager
if ($height > 0) {
$dimension = getimagesize($picture['file']);
$margin = (($height - $dimension[1])/2);
$picture['style'] = ' style="padding-top:'.$margin.'px;" ';
$picture['style'] = ' style="padding-top:'.$margin.'px; width:'.$dimension[0].'px; height:'.$dimension[1].';" ';
}
} else {
$file = api_get_path(SYS_CODE_PATH).$patch_profile.$user_id.'/'.$picture_file;

@ -181,18 +181,24 @@ class MessageManager {
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;
$sql = "SELECT COUNT(*) as count FROM $table_message WHERE user_sender_id = ".api_get_user_id()." AND user_receiver_id='".Database::escape_string($receiver_user_id)."' AND title = '".Database::escape_string($title)."' AND content ='".Database::escape_string($content)."' ";
$res_exist = api_sql_query($sql,__FILE__,__LINE__);
$row_exist = Database::fetch_array($res_exist,'ASSOC');
if ($row_exist['count'] ==0) {
$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;
}
return false;
}
public static function delete_message_by_user_receiver ($user_receiver_id,$id) {
@ -365,7 +371,7 @@ class MessageManager {
<TABLE height=209 width="100%" bgColor=#ffffff>
<TBODY>
<TR>
<TD vAlign=top>'.api_xml_http_response_encode($row[6]).'</TD>
<TD vAlign=top>'.str_replace("\\","",api_xml_http_response_encode($row[6])).'</TD>
</TR>
</TBODY>
</TABLE>
@ -414,7 +420,7 @@ class MessageManager {
<TABLE height=209 width="100%" bgColor=#ffffff>
<TBODY>
<TR>
<TD vAlign=top>'.api_xml_http_response_encode($row[6]).'</TD>
<TD vAlign=top>'.str_replace("\\","",api_xml_http_response_encode($row[6])).'</TD>
</TR>
</TBODY>
</TABLE>

@ -7,11 +7,14 @@ $tbl_my_user = Database :: get_main_table(TABLE_MAIN_USER);
$tbl_my_user_friend = Database :: get_main_table(TABLE_MAIN_USER_FRIEND);
$search=$_POST['search'];
$date_inter=date('Y-m-d H:i:s',time()-120);
$html_form='<select id="id_search_name" name="id_search_name" size="8"" class="message-select-box" onmouseout="list_search_hide()">';
$sql='SELECT DISTINCT u.user_id as id,concat(u.firstname," ",u.lastname," ","( ",u.email," )") as name
FROM '.$tbl_my_user.' u INNER JOIN '.$track_online_table.' t ON u.user_id=t.login_user_id
WHERE t.login_date >'."'".$date_inter."'".' AND (u.firstname like "%'.$search.'%" OR u.lastname like "%'.$search.'%"
OR CONCAT(u.firstname," ",u.lastname) like CONCAT("%","'.$search.'","%"))';
$html_form='<select id="id_search_name" name="id_search_name" size="8"" class="message-select-box">';
$user_id = api_get_user_id();
$sql = 'SELECT u.user_id as id,concat(u.firstname," ",u.lastname," ","( ",u.email," )") as name ' .
'FROM '.$tbl_my_user_friend.' uf ' .
'INNER JOIN '.$tbl_my_user.' AS u ON uf.friend_user_id = u.user_id ' .
'WHERE relation_type<>6 AND friend_user_id<>'.(int)$user_id.' AND uf.user_id='.(int)$user_id.
' AND concat(u.firstName,u.lastName) like CONCAT("%","'.$search.'","%") ';
if (api_get_setting('allow_social_tool')=='true') {
//$sql.=' INNER JOIN '.$tbl_my_user_friend.' uf ON uf.friend_user_id=u.user_id ';
}

Loading…
Cancel
Save