Menu

[r8]: / users / emailusers.php  Maximize  Restore  History

Download this file

134 lines (105 with data), 4.4 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<?php
#Application name: PhpCollab
#Status page: 0
#Path by root: ../users/emailusers.php
$checkSession = "true";
include_once('../includes/library.php');
/*
//anyone can send a message
if ($profilSession != "0") {
header("Location:../general/permissiondenied.php?".session_name()."=".session_id());
exit;
}
*/
if ($action == "email")
{
global $root,$version,$setCharset;
// get name and email of user sending the email
$tmpquery = "WHERE mem.id = '$idSession'";
$userPrefs = new request();
$userPrefs->openMembers($tmpquery);
// get company name
$tmpquery = "WHERE org.id = '1'";
$clientDetail = new request();
$clientDetail->openOrganizations($tmpquery);
// get users to email
$id = str_replace("**",",",$id);
$tmpquery = "WHERE mem.id IN($id) ORDER BY mem.name";
$listMembers = new request();
$listMembers->openMembers($tmpquery);
$comptListMembers = count($listMembers->mem_id);
// format body and message
$subject = stripslashes($subject);
$message = stripslashes($message);
$message = str_replace("\r\n","\n",$message);
for ($i=0;$i<$comptListMembers;$i++)
{
// send email to each user
$email = $listMembers->mem_email_work[$i];
$priorityMail = "3";
$headers = "Content-type:text/plain;charset='$setCharset'\nFrom: '".$userPrefs->mem_name[0]."' <".$userPrefs->mem_email_work[0].">\nX-Priority: $priorityMail\nX-Mailer: PhpCollab $version";
$footer = "---\n".$strings["noti_foot1"];
$signature = $userPrefs->mem_name[0]."\n";
if ($userPrefs->mem_title[0] != "") { $signature .= $userPrefs->mem_title[0].", ".$clientDetail->org_name[0]."\n"; } else {$signature .= $clientDetail->org_name[0]."\n";}
if ($userPrefs->mem_phone_work[0] != "") { $signature .= "Phone: ".$userPrefs->mem_phone_work[0]."\n"; }
if ($userPrefs->mem_mobile[0] != "") { $signature .= "Mobile: ".$userPrefs->mem_mobile[0]."\n"; }
if ($userPrefs->mem_fax[0] != "") { $signature .= "Fax: ".$userPrefs->mem_fax[0]."\n"; }
$newmessage = $message;
$newmessage .= "\n\n".$signature;
$newmessage .= "\n".$footer;
@mail($email, $subject, $newmessage, $headers);
$newmessage = "";
}
if ($profilSession == "0")
{
header("Location:../users/listusers.php?id=$clod&msg=email&".session_name()."=".session_id());
exit;
}
else
{
header("Location:../general/home.php?msg=email&".session_name()."=".session_id());
exit;
}
}
// start main page
include('../themes/'.THEME.'/header.php');
$blockPage = new block();
$blockPage->openBreadcrumbs();
$blockPage->itemBreadcrumbs($blockPage->buildLink("../administration/admin.php?",$strings["administration"],in));
$blockPage->itemBreadcrumbs($blockPage->buildLink("../users/listusers.php?",$strings["user_management"],in));
$blockPage->itemBreadcrumbs($strings["email_users"]);
$blockPage->closeBreadcrumbs();
if ($msg != "") {
include("../themes/".THEME."/msg.php");
}
$block1 = new block();
$block1->form = "user_email";
$block1->openForm("../users/emailusers.php?action=email&".session_name()."=".session_id());
if ($error != "") {
$block1->headingError($strings["errors"]);
$block1->contentError($error);
}
$block1->heading($strings["email_users"]);
$block1->openContent();
$block1->contentTitle($strings["email_following"]);
$id = str_replace("**",",",$id);
$tmpquery = "WHERE mem.id IN($id) ORDER BY mem.name";
$listMembers = new request();
$listMembers->openMembers($tmpquery);
$comptListMembers = count($listMembers->mem_id);
for ($i=0;$i<$comptListMembers;$i++) {
if ($listMembers->mem_email_work[$i] != "") {
$block1->contentRow("",$listMembers->mem_login[$i]."&nbsp;(".$listMembers->mem_name[$i].")");
}
else {
$block1->contentRow("",$listMembers->mem_login[$i]."&nbsp;(".$listMembers->mem_name[$i].") ".$strings["no_email"]);
}
}
$block1->contentTitle($strings["email"]);
$block1->contentRow($strings["subject"],"<input size='44' style='width: 400px' name='subject' maxlength='100' type='text'>");
$block1->contentRow($strings["message"],"<textarea rows='10' style='width: 400px; height: 160px;' name='message' cols='47'></textarea>");
$block1->contentRow("","<input type='submit' name='delete' value='".$strings["email"]."'> <input type='button' name='cancel' value='".$strings["cancel"]."' onClick='history.back();'><input type='hidden' value='$id' name='id'>");
$block1->closeContent();
$block1->closeForm();
include('../themes/'.THEME.'/footer.php');
?>
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.