diff --git a/upload/ajax/main.php b/upload/ajax/main.php index d013aa92..1488c42f 100644 --- a/upload/ajax/main.php +++ b/upload/ajax/main.php @@ -769,8 +769,8 @@ switch ($mode) { $uid = userid(); $requests = $userquery->get_friend_requests($uid, array('seen' => 'no')); - $userquery->mark_requests_seen($uid); - $userquery->read_notification($uid, 'friends'); + //$userquery->mark_requests_seen($uid); + //$userquery->read_notification($uid, 'friends'); if ($requests) { diff --git a/upload/includes/classes/pm.class.php b/upload/includes/classes/pm.class.php index 086091eb..5aceeb04 100644 --- a/upload/includes/classes/pm.class.php +++ b/upload/includes/classes/pm.class.php @@ -705,10 +705,11 @@ class cb_pm { $default_values = array( 'userid' => userid(), + 'subject' => "", 'thread_type' => 'private', 'recipients' => array() ); - + $data = array_merge($default_values, $params); $the_data = array(); //Keep only specific indexes foreach ($default_values as $key => $value) @@ -739,7 +740,7 @@ class cb_pm if($subject) $subject = strip_tags(replacer($subject)); - + $recipients_imploded = implode('|', $recipients); $recipient_md5 = md5($recipients_imploded); @@ -753,7 +754,7 @@ class cb_pm } $thread_id = $this->get_thread_from_md5($recipient_md5); - + if (!$thread_id) { $insert_array = array( diff --git a/upload/includes/functions_pm.php b/upload/includes/functions_pm.php index 52380107..25fb6a5a 100644 --- a/upload/includes/functions_pm.php +++ b/upload/includes/functions_pm.php @@ -4,26 +4,27 @@ function list_thread_recipients($thread) { $total_recipients = $thread['total_recipients']; - $recipients = json_decode($thread['main_recipients'],true); + $recipients = json_decode($thread['main_recipients'], true); $list = ""; - + switch ($total_recipients) { case 2: { foreach ($recipients as $user) { - + if ($user['userid'] == userid()) { //if($list) // $list .=" and "; //$list .= lang("You"); //Just show other recipient - }else + } + else { - if($list) + if ($list) $list .=" and "; $list .=name($user); } @@ -32,20 +33,20 @@ function list_thread_recipients($thread) break; case 3: { - $count=0; + $count = 0; foreach ($recipients as $user) { - if($count==1) + if ($count == 1) $list .=", "; - - if($count==2) + + if ($count == 2) $list .=" and "; - + if ($user['userid'] == userid()) $list .= lang("You"); else $list .=name($user); - + $count++; } } @@ -53,37 +54,50 @@ function list_thread_recipients($thread) case ($total_recipients > 3) : { + $count = 0; foreach ($recipients as $user) { + if ($count == 1) + $list .=", "; + + if ($count == 2) + $list .=" , "; + if ($user['userid'] == userid()) $list .= lang("You"); else $list .=name($user); + + $count++; } + + $others = $thread['total_recipients'] - 3; + + if($others>1) + $list .= sprintf(" and %d others"); + else + $list .= sprintf(" and 1 other"); } break; } - + return $list; } - /** * Get thread link */ function get_thread_link($thread) { - return BASEURL.'/private_message.php?mode=inbox&thread_id='.$thread['thread_id']; + return BASEURL . '/private_message.php?mode=inbox&thread_id=' . $thread['thread_id']; } /** * Function applies on a message.. */ - function message($in) { return nl2br($in); } - ?> diff --git a/upload/private_message.php b/upload/private_message.php index 2a7d6588..09475762 100644 --- a/upload/private_message.php +++ b/upload/private_message.php @@ -194,7 +194,7 @@ switch ($mode) if($mid) { $message_details = $cbpm->get_message($mid); - pr($message_details,true); + //pr($message_details,true); //$tid = thread id $tid = $message_details['thread_id']; //Redirect to thread..@todo work on this section diff --git a/upload/styles/cbv3/layout/private_message.html b/upload/styles/cbv3/layout/private_message.html index fc5f19da..434ccc39 100644 --- a/upload/styles/cbv3/layout/private_message.html +++ b/upload/styles/cbv3/layout/private_message.html @@ -71,7 +71,7 @@
+ data-loading-text="Sending.." >Send