[svn r19368] logic changes - allow messages send by user email - (partial FS#3914)

skala
Isaac Flores 16 years ago
parent c758facbd3
commit f04a90b1d9
  1. 16
      main/messages/inbox.php
  2. 16
      main/messages/message.class.php
  3. 1
      main/social/index.php

@ -97,11 +97,19 @@ if (isset($_GET['form_reply']) || isset($_GET['form_delete'])) {
$title = urldecode($info_reply[0]);
$content = urldecode($info_reply[1]);
$user_reply= $info_reply[2];
if ( isset($user_reply) && $user_reply>0 && strlen($info_reply[0]) >0) {
MessageManager::send_message($user_reply, $title, $content);
MessageManager::display_success_message($user_reply);
$user_email_base=str_replace(')','(',$info_reply[5]);
$user_email_prepare=explode('(',$user_email_base);
if (count($user_email_prepare)==1) {
$user_email=trim($user_email_prepare[0]);
} elseif (count($user_email_prepare)==3) {
$user_email=trim($user_email_prepare[1]);
}
$user_id_by_email=MessageManager::get_user_id_by_email($user_email);
if ( isset($user_reply) && !is_null($user_id_by_email) && strlen($info_reply[0]) >0) {
MessageManager::send_message($user_id_by_email, $title, $content);
MessageManager::display_success_message($user_id_by_email);
exit;
} elseif ( ($info_reply[2]==0) || strlen($info_reply[0])==0) {
} elseif (is_null($user_id_by_email)) {
$message_box=get_lang('ErrorSendingMessage').
' 
<br /><a href="../social/index.php?#remote-tab-2">'.

@ -417,5 +417,21 @@ class MessageManager {
</TR>
</TABLE>';
}
/**
* get user id by user email
* @param string $user_email
* @return int user id
*/
public static function get_user_id_by_email ($user_email) {
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$sql='SELECT user_id FROM '.$tbl_user.' WHERE email="'.Database::escape_string($user_email).'";';
$rs=api_sql_query($sql,__FILE__,__LINE__);
$row=Database::fetch_array($rs,'ASSOC');
if (isset($row['user_id'])) {
return $row['user_id'];
} else {
return null;
}
}
}
?>

@ -448,6 +448,7 @@ if (isset($_GET['sendform'])) {
$form_reply[]=$_POST['user_list'];
$form_reply[]=$_POST['re_id'];
$form_reply[]=urlencode($_POST['compose']);
$form_reply[]=urlencode($_POST['id_text_name']);
$form_info=implode(',',$form_reply);
$form_send_data_message='?form_reply='.$form_info;
} elseif (isset($_GET['inbox'])) {

Loading…
Cancel
Save