More fixes while sending messages

skala
Julio Montoya 13 years ago
parent 6a82519972
commit 2bf55932d2
  1. 2
      main/inc/lib/mail.lib.inc.php
  2. 7
      main/inc/lib/message.lib.php
  3. 27
      main/inc/lib/social.lib.php
  4. 2
      main/inc/lib/tracking.lib.php
  5. 3
      main/messages/inbox.php

@ -197,7 +197,7 @@ function api_mail_html($recipient_name, $recipient_email, $subject, $message, $s
}
}
}
$message = str_replace(array('\n\r', '\n', '\r'), '<br />', $message);
$message = str_replace(array("\n\r", "\n", "\r"), '<br />', $message);
$mail->Body = '<html><head></head><body>'.$message.'</body></html>';
// Attachment ...

@ -237,6 +237,9 @@ class MessageManager
$inbox_last_id = null;
//Just in case we replace the and \n and \n\r while saving in the DB
$content = str_replace(array("\n", "\n\r"), '<br />', $content);
if (!empty($receiver_user_id) || !empty($group_id)) {
// message for user friend
@ -695,6 +698,7 @@ class MessageManager
* display message box in the inbox
* @param int the message id
* @param string inbox or outbox strings are available
* @todo replace numbers with letters in the $row array pff...
* @return string html with the message content
*/
public static function show_message_box($message_id, $source = 'inbox') {
@ -765,7 +769,6 @@ class MessageManager
$message_content .='<td>'.get_lang('From').'&nbsp;'.$name.'</b> '.api_strtolower(get_lang('To')).' <b>'.get_lang('Me').'</b> </td>';
}
}
$message_content .='</tr>
<tr>
<td>'.get_lang('Date').'&nbsp; '.$row[4].'</td>
@ -776,7 +779,7 @@ class MessageManager
<hr style="color:#ddd" />
<table height="209px" width="100%">
<tr>
<td valign=top class="view-message-content">'.str_replace("\\","",$row[6]).'</td>
<td valign=top class="view-message-content">'.str_replace("\\","",$row['content']).'</td>
</tr>
</table>
<div id="message-attach">'.(!empty($files_attachments)?implode('<br />',$files_attachments):'').'</div>

@ -28,7 +28,7 @@ class SocialManager extends UserManager {
/**
* Allow to see contacts list
* @author isaac flores paz <florespaz@bidsoftperu.com>
* @author isaac flores paz
* @return array
*/
public static function show_list_type_friends () {
@ -52,7 +52,7 @@ class SocialManager extends UserManager {
* Get relation type contact by name
* @param string names of the kind of relation
* @return int
* @author isaac flores paz <florespaz@bidsoftperu.com>
* @author isaac flores paz
*/
public static function get_relation_type_by_name ($relation_type_name) {
$list_type_friend=array();
@ -68,7 +68,7 @@ class SocialManager extends UserManager {
* @param int user id
* @param int user friend id
* @param string
* @author isaac flores paz <florespaz@bidsoftperu.com>
* @author isaac flores paz
*/
public static function get_relation_between_contacts ($user_id,$user_friend) {
$tbl_my_friend_relation_type = Database :: get_main_table(TABLE_MAIN_USER_FRIEND_RELATION_TYPE);
@ -92,7 +92,7 @@ class SocialManager extends UserManager {
* @param bool true will load firstname, lastname, and image name
* @return array
* @author Julio Montoya <gugli100@gmail.com> Cleaning code, function renamed, $load_extra_info option added
* @author isaac flores paz <florespaz@bidsoftperu.com>
* @author isaac flores paz
*/
public static function get_friends($user_id, $id_group = null, $search_name = null, $load_extra_info = true) {
$list_ids_friends=array();
@ -128,7 +128,7 @@ class SocialManager extends UserManager {
* @param int group id
* @param string name to search
* @param array
* @author isaac flores paz <florespaz@bidsoftperu.com>
* @author isaac flores paz
*/
public static function get_list_path_web_by_user_id ($user_id,$id_group=null,$search_name=null) {
$list_paths=array();
@ -170,13 +170,18 @@ class SocialManager extends UserManager {
* @param string title of the message
* @param string content of the message
* @return boolean
* @author isaac flores paz <florespaz@bidsoftperu.com>
* @author isaac flores paz
* @author Julio Montoya <gugli100@gmail.com> Cleaning code
*/
public static function send_invitation_friend ($user_id, $friend_id, $message_title, $message_content) {
$tbl_message = Database::get_main_table(TABLE_MAIN_MESSAGE);
$user_id = intval($user_id);
$friend_id = intval($friend_id);
//Just in case we replace the and \n and \n\r while saving in the DB
$message_content = str_replace(array("\n", "\n\r"), '<br />', $message_content);
$clean_message_title = Database::escape_string($message_title);
$clean_message_content = Database::escape_string($message_content);
@ -213,7 +218,7 @@ class SocialManager extends UserManager {
}
/**
* Get number messages of the inbox
* @author isaac flores paz <florespaz@bidsoftperu.com>
* @author isaac flores paz
* @param int user receiver id
* @return int
*/
@ -227,7 +232,7 @@ class SocialManager extends UserManager {
/**
* Get invitation list received by user
* @author isaac flores paz <florespaz@bidsoftperu.com>
* @author isaac flores paz
* @param int user id
* @return array()
*/
@ -264,7 +269,7 @@ class SocialManager extends UserManager {
* Accepts invitation
* @param int user sender id
* @param int user receiver id
* @author isaac flores paz <florespaz@bidsoftperu.com>
* @author isaac flores paz
* @author Julio Montoya <gugli100@gmail.com> Cleaning code
*/
public static function invitation_accepted ($user_send_id,$user_receiver_id) {
@ -276,7 +281,7 @@ class SocialManager extends UserManager {
* Denies invitation
* @param int user sender id
* @param int user receiver id
* @author isaac flores paz <florespaz@bidsoftperu.com>
* @author isaac flores paz
* @author Julio Montoya <gugli100@gmail.com> Cleaning code
*/
public static function invitation_denied ($user_send_id,$user_receiver_id) {
@ -288,7 +293,7 @@ class SocialManager extends UserManager {
}
/**
* allow attach to group
* @author isaac flores paz <florespaz@bidsoftperu.com>
* @author isaac flores paz
* @param int user to qualify
* @param int kind of rating
* @return void()

@ -1732,7 +1732,7 @@ class Tracking {
* @param int User id
* @param string Course id
* @return float average of test
* @author isaac flores paz <florespaz@bidsoftperu.com>
* @author isaac flores paz
* @deprecated get_avg_student_score should be use
*/
public static function get_average_test_scorm_and_lp ($user_id,$course_id) {

@ -135,10 +135,7 @@ if ($_GET['f']=='social' || api_get_setting('allow_social_tool') == 'true') {
echo '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php">'.Display::return_icon('message_new.png',get_lang('ComposeMessage')).get_lang('ComposeMessage').'</a>';
echo '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.Display::return_icon('inbox.png',get_lang('Inbox')).get_lang('Inbox').'</a>';
echo '<a href="'.api_get_path(WEB_PATH).'main/messages/outbox.php">'.Display::return_icon('outbox.png',get_lang('Outbox')).get_lang('Outbox').'</a>';
}
//echo '<a href="'.api_get_path(WEB_PATH).'main/auth/profile.php?type=reduced">'.Display::return_icon('edit.gif', get_lang('EditNormalProfile')).'&nbsp;'.get_lang('EditNormalProfile').'</a>';
echo '</div>';
}

Loading…
Cancel
Save