This repository was archived by the owner on Aug 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsendemail.php
More file actions
186 lines (180 loc) · 7.12 KB
/
sendemail.php
File metadata and controls
186 lines (180 loc) · 7.12 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
<?php
include_once('globals.php');
include_once('checklogin.php');
ini_set('memory_limit', '16M');
include_once('classes/subgroup.php');
include_once('classes/category.php');
include_once('classes/email.php');
function peopleSort($array)
{
$newArray = array();
foreach($array as $person)
$newArray[$person->getCommaName()] = $person;
ksort($newArray);
return $newArray;
}
$query = $db->query('select sSig from Profiles where iPersonID='.$currentUser->getID());
$arr = mysql_fetch_row($query);
unset($query);
$sig = $arr[0];
unset($arr);
if($sig)
$sig = "\n\n\n--\n$sig";
require('doctype.php');
require('appearance.php');
echo "<link rel=\"stylesheet\" href=\"skins/$skin/default.css\" type=\"text/css\" title=\"$skin\" />\n";
foreach($altskins as $altskin)
echo "<link rel=\"alternate stylesheet\" href=\"skins/$altskin/default.css\" type=\"text/css\" title=\"$altskin\" />\n";
?>
<title><?php echo $appname; ?> - Send Email</title>
</head>
<body onload="sendinit()">
<?php
$to = array();
if(is_numeric($_GET['replyid']))
$replyEmail = new Email($_GET['replyid'], $db);
else if(is_numeric($_GET['forward']))
$forwardEmail = new Email($_GET['forward'], $db);
if(isset($_GET['to']))
{
$exp = explode(',', $_GET['to']);
foreach($exp as $i)
$to[] = $i;
}
?>
<form method="post" action="email.php" enctype="multipart/form-data" id="mailform">
<div id="to">
<a href="#" onclick="toggleToDisplay()">+</a><fieldset><legend>To:</legend>
<table id="to-table" width="100%">
<?php
$members = $currentGroup->getGroupMembers();
$members = peopleSort($members);
$i = 1;
foreach($members as $person)
{
if($i == 1)
echo '<tr>';
if((isset($_GET['replyid']) && $person->getID() == $replyEmail->getSenderID()) || in_array($person->getID(), $to))
echo "<td><input type=\"checkbox\" name=\"sendto[".$person->getID()."]\" id=\"sendto[".$person->getID()."]\" checked=\"checked\" /></td>";
else
echo "<td><input type=\"checkbox\" name=\"sendto[".$person->getID()."]\" id=\"sendto[".$person->getID()."]\" /></td>";
echo "<td><label for=\"sendto[".$person->getID()."]\">".$person->getFullName()."</label></td>";
if($i == 3)
{
echo "</tr>\n";
$i = 1;
}
else
$i++;
}
?>
<tr><td colspan="2"><a href="javascript:checkedAll('mailform', true)">Check All</a> / <a href="javascript:checkedAll('mailform', false)">Uncheck All</a></td></tr>
</table></fieldset>
</div><br />
<?php
$subgroups = $currentGroup->getSubGroups();
if($subgroups)
{
?>
<div id="subgroups">
<a href="#" onclick="toggleSGDisplay()">+</a><fieldset><legend>Subgroups:</legend>
<table id="subgroups-table" width="100%">
<?php
$i = 1;
foreach ($subgroups as $subgroup)
{
if($i == 1)
echo "<tr>";
echo "<td><input type=\"checkbox\" id=\"subgroup".$subgroup->getID()."\" name=\"sendtosubgroup[".$subgroup->getID()."]\" /> ";
echo "<label for=\"subgroup".$subgroup->getID()."\">".$subgroup->getName()."</label></td>";
if($i == 3)
{
echo "</tr>\n";
$i = 1;
}
else
$i++;
}
?>
</table></fieldset>
</div>
<?php
}
?>
<div id="guests">
<?php
$members = $currentGroup->getGroupGuests();
if(count($members) > 0)
{
?>
<br /><a href="#" onclick="toggleGuestDisplay()">+</a><fieldset><legend>Guests:</legend>
<table id="guest-table" width="100%">
<?php
$members = peopleSort($members);
$i = 1;
foreach($members as $person)
{
if($i == 1)
echo '<tr>';
echo "<td><input type=\"checkbox\" id=\"guest".$person->getID()."\" name=\"sendtoguest[".$person->getID()."]\" /></td>";
echo "<td><label for=\"guest".$person->getID()."\">".$person->getFullName()."</label></td>";
if($i == 3)
{
echo "</tr>\n";
$i = 1;
}
else
$i++;
}
?>
<tr><td colspan="2"><a href="javascript:checkedAllGuest('mailform', true)">Check All</a> / <a href="javascript:checkedAllGuest('mailform', false)">Uncheck All</a></td></tr>
</table></fieldset>
</div>
<?php } ?>
<br />
<table>
<tr><td><label for="cc">CC:</label></td><td><input type="text" size="50" name="cc" id="cc" /></td></tr>
<?php
if(isset($replyEmail))
echo "<tr><td><label for=\"subject\">Subject:</label></td><td><input type=\"text\" size=\"50\" name=\"subject\" id=\"subject\" value=\"RE: {$replyEmail->getSubjectHTML()}\" /></td></tr>";
else if(isset($forwardEmail))
echo "<tr><td><label for=\"subject\">Subject:</label></td><td><input type=\"text\" size=\"50\" name=\"subject\" id=\"subject\" value=\"FW: {$forwardEmail->getSubjectHTML()}\" /></td></tr>";
else
echo "<tr><td><label for=\"subject\">Subject:</label></td><td><input type=\"text\" size=\"50\" name=\"subject\" id=\"subject\" /></td></tr>";
?>
<tr><td><input type="checkbox" name="confidential" id="confidential" /></td><td><label for="confidential">Keep confidential? (if checked, will not be stored in iGROUPS)</label></td></tr>
<tr><td><label for="category">Category</label></td><td><select name="category" id="category"><option value="0">No Category</option>
<?php
$categories = $currentGroup->getGroupCategories();
foreach($categories as $category)
echo "<option value=\"".$category->getID()."\">".$category->getName()."</option>\n";
?>
</select></td></tr>
<tr><td>Attachments:</td></tr>
<tr><td colspan="2">
<div id="files"><div class="stdBoldText" id="file1div"> <label for="attachment1">File 1:</label> <input type="file" name="attachment1" id="attachment1" onchange="fileAdd(1);" /></div></div></div>
<span onclick="fileAdd(document.getElementById('files').childNodes.length);" style="color:#00F;text-decoration:underline;cursor:pointer;">Click here to add another file.</span>
</td></tr>
<tr><td colspan="2"><label for="body">Body:</label></td></tr>
<?php
if(isset($replyEmail))
echo "<tr><td colspan=\"2\"><textarea name=\"body\" id=\"body\" cols=\"54\" rows=\"10\">$sig\n\n\n----Original E-mail Follows----\n{$replyEmail->getReplyBody()}</textarea></td></tr>";
else if(isset($forwardEmail))
echo "<tr><td colspan=\"2\"><textarea name=\"body\" id=\"body\" cols=\"54\" rows=\"10\">$sig\n\n\n----Original E-mail Follows----\n{$forwardEmail->getReplyBody()}</textarea></td></tr>";
else
echo "<tr><td colspan=\"2\"><textarea name=\"body\" id=\"body\" cols=\"54\" rows=\"10\">$sig</textarea></td></tr>";
?>
<tr><td colspan="2" align="center"><input type="button" value="Spell Check" onclick="openSpellChecker();" /> <input type="submit" name="send" value="Send Email" /></td></tr>
</table>
<?php
if(isset($_GET['replyid']))
echo "<input type=\"hidden\" name=\"replyid\" value=\"".intval($_GET['replyid'])."\" />";
else
echo "<input type=\"hidden\" name=\"replyid\" value=\"0\" />";
if(isset($_GET['forward']))
echo "<input type=\"hidden\" name=\"forwardid\" value=\"".intval($_GET['forward'])."\" />";
else
echo "<input type=\"hidden\" name=\"forwardid\" value=\"0\" />";
?>
</fieldset></form>
</body></html>