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
|
<?php
/*
* This file is part of Zoph.
*
* Zoph is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Zoph is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with Zoph; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
require_once("include.inc.php");
if (!$user->is_admin()) {
header("Location: " . add_sid("zoph.php"));
}
require_once("htmlMimeMail.php");
$title = translate("Notify");
$user_id = getvar("user_id");
$subject = getvar("subject");
$message = getvar("message");
if ($_action == "mail") {
$to_name = getvar("to_name");
$to_email = getvar("to_email");
$from_name = getvar("from_name");
$from_email = getvar("from_email");
$mail = new htmlMimeMail(array('X-Mailer: Html Mime Mail Class'));
$mail->setCrlf("\r\n");
$mail->setFrom("$from_name <$from_email>");
$mail->setSubject($subject);
if (strlen(BCC_ADDRESS) > 0) {
$mail->setBCC(BCC_ADDRESS);
}
$mail->settext($message);
if (!$mail->send(array("$to_name <$to_email>"), 'smtp')) {
$msg .= translate("Could not send mail.");
}
else {
$msg = translate("Your mail has been sent.");
$setlastmodified = getvar("setlastmodified");
if ($setlastmodified) {
$u = new user($user_id);
$u->set("lastnotify", "now()");
$u->update();
}
}
}
else {
$u = new user($user_id);
$u->lookup();
$u->lookup_person();
$from_name = $user->person->get_name();
$from_email = $user->person->get_email();
$to_name = $u->person->get_name();
$to_email = $u->person->get_email();
}
require_once("header.inc.php");
?>
<h1>
<?php echo translate("email") ?>
</h1>
<div class="main">
<form action="<?php echo $PHP_SELF ?>" method="POST">
<?php
if ($msg) {
?>
<?php echo $msg ?>
<?php
}
?>
<?php
if ($_action == "notify") {
$showusername = getvar("showusername");
$showpassword = getvar("showpassword");
$shownewalbums = getvar("shownewalbums");
$body = translate("Hi",0) . " " . $to_name . ",\n\n";
if ($shownewalbums) {
$date = $u->get_lastnotify();
$body .= translate("I have enabled access to the following albums for you:",0) . "\n\n";
$albums = get_newer_albums($user_id, $date);
$album_list = array();
while (list($id, $album) = each($albums)) {
$album_path = '';
$ancestors = $album->get_ancestors();
if ($ancestors) {
while ($parent = array_pop($ancestors)) {
$album_path .= $parent->get("album") . " > ";
}
}
$album_path .= $album->get("album");
$album_list[] = $album_path;
}
sort($album_list);
reset($album_list);
$body .= implode("\n", $album_list) . "\n";
$url = ZOPH_URL;
if (empty($url)) {
$url = get_url() . "login.php";
}
$body .= "\n" . translate("For accessing these Albums you have to use this URL:",0) . " " . $url . "\n";
}
if ($showusername) {
$body .=
translate("user name", 0) . ": " .
$u->get('user_name') . "\n";
}
$body .= "\n" . translate("Regards,",0) . "\n";
$body .= $from_name;
if (!$subject) {
$subject = translate("New Albums on") . " " . ZOPH_TITLE;
}
$message = $body;
}
if ($_action != "mail") {
?>
<input type="hidden" name="_action" value="mail">
<?php
if ($shownewalbums) {
?>
<input type="hidden" name="setlastmodified" value="1">
<?php
}
?>
<input type="hidden" name="user_id" value="<?php echo $user_id ?>">
<label for="to_name"><?php echo translate("to (name)") ?>:</label>
<?php echo create_text_input("to_name", $to_name, 24, 32) ?><br>
<label for="to_email"><?php echo translate("to (email)") ?>:</label>
<?php echo create_text_input("to_email", $to_email, 24, 32) ?><br>
<label for="from_name"><?php echo translate("from (your name)") ?>:</label>
<?php echo create_text_input("from_name", $from_name, 24, 32) ?><br>
<label for="from_email"><?php echo translate("from (your email)") ?>:</label>
<?php echo create_text_input("from_email", $from_email, 24, 64) ?><br>
<label for="subject"><?php echo translate("subject") ?>:</label>
<?php echo create_text_input("subject", $subject, 48, 64) ?><br>
<label for="message"><?php echo translate("message:") ?></label><br>
<textarea name="message" class="email" cols="70" rows="15"><?php echo $message ?></textarea><br>
<div class="center">
<input type="submit" name="_button" value="<?php echo translate("email", 0); ?>">
<br>
</div>
<?php
}
?>
</form>
</div>
<?php
require_once("footer.inc.php");
?>
|