Beispiel #1
0
        exit_error('Error', 'Could Not Get User');
    } elseif ($u->isError()) {
        form_release_key(getStringFromRequest('form_key'));
        exit_error('Error', $u->getErrorMessage());
    }
    if (!$u->setNewEmailAndHash($newemail, $confirm_hash)) {
        form_release_key(getStringFromRequest('form_key'));
        exit_error('Could Not Complete Operation', $u->getErrorMessage());
    }
    $message = stripcslashes(sprintf(_('You have requested a change of email address on %1$s.
Please visit the following URL to complete the email change:

%2$s

 -- the %1$s staff'), $GLOBALS['sys_name'], util_make_url('/account/change_email-complete.php?ch=_' . $confirm_hash)));
    util_send_message($newemail, sprintf(_('%1$s Verification'), $GLOBALS['sys_name']), $message);
    site_user_header(array('title' => _('Email Change Confirmation')));
    printf(_('<p>An email has been sent to the new address. Follow the instructions in the email to complete the email change. </p><a href="%1$s">[ Home ]</a>'), util_make_url('/'));
    site_user_footer(array());
    exit;
}
site_user_header(array('title' => _('Email change')));
echo _('<p>Changing your email address will require confirmation from your new email address, so that we can ensure we have a good email address on file.</p><p>We need to maintain an accurate email address for each user due to the level of access we grant via this account. If we need to reach a user for issues arriving from a shell or project account, it is important that we be able to do so.</p>  <p>Submitting the form below will mail a confirmation URL to the new email address. Visiting this link will complete the email change.</p>');
?>

<form action="<?php 
echo getStringFromServer('PHP_SELF');
?>
" method="post">
<input type="hidden" name="form_key" value="<?php 
echo form_generate_key();
 /**
  *   sendNotice - Notifies of document submissions
  */
 function sendNotice($new = true)
 {
     $BCC = $this->Group->getDocEmailAddress();
     if (strlen($BCC) > 0) {
         $subject = '[' . $this->Group->getPublicName() . '] New document - ' . $this->getName();
         $body = "Project: " . $this->Group->getPublicName() . "\n";
         $body .= "Group: " . $groupname . "\n";
         $body .= "Document title: " . $this->getName() . "\n";
         $body .= "Document description: " . util_unconvert_htmlspecialchars($this->getDescription()) . "\n";
         $body .= "Submitter: " . $this->getCreatorRealName() . " (" . $this->getCreatorUserName() . ") \n";
         $body .= "\n\n-------------------------------------------------------" . "\nFor more info, visit:" . "\n\n" . util_make_url('/docman/index.php?group_id=' . $this->Group->getID());
         util_send_message('', $subject, $body, '', $BCC);
     }
     return true;
 }
Beispiel #3
0
    /**
     *	sendRegistrationEmail() - Send email for registration verification
     *
     *	@return true or false
     */
    function sendRegistrationEmail()
    {
        $message = stripcslashes(sprintf(_('Thank you for registering on the %3$s web site. You have
account with username %1$s created for you. In order
to complete your registration, visit the following url: 

<%2$s>

(If you don\'t see any URL above, it is likely due to a bug in your mail client.
Use one below, but make sure it is entered as the single line.)

%2$s

Enjoy the site.

-- the %3$s staff
'), $this->getUnixName(), util_make_url('/account/verify.php?confirm_hash=_' . $this->getConfirmHash()), $GLOBALS['sys_name']));
        util_send_message($this->getEmail(), sprintf(_('%1$s Account Registration'), $GLOBALS['sys_name']), $message);
    }
 /**
  *	sendAttachNotice - contains the logic to send out email attachement followups when a message is posted.
  *
  *	@param int	attach_id	- The id of the file that has been attached
  *
  *	@return boolean success.
  */
 function sendAttachNotice($attach_id)
 {
     if ($attach_id) {
         $ids =& $this->Forum->getMonitoringIDs();
         //
         //	See if there is anyone to send messages to
         //
         if (!count($ids) > 0 && !$this->Forum->getSendAllPostsTo()) {
             return true;
         }
         $body = "\nRead and respond to this message at: " . "\n" . util_make_url('/forum/message.php?msg_id=' . $this->getID()) . "\nBy: " . $this->getPosterRealName() . "\n\n";
         $body .= "A file has been uploaded to this message, you can download it at: " . "\n" . util_make_url('/forum/attachment.php?attachid=' . $attach_id . "&group_id=" . $this->Forum->Group->getID() . "&forum_id=" . $this->Forum->getID()) . "\n\n";
         $body .= "\n\n______________________________________________________________________" . "\nYou are receiving this email because you elected to monitor this forum." . "\nTo stop monitoring this forum, login to " . $GLOBALS['sys_name'] . " and visit: " . "\n" . util_make_url('/forum/monitor.php?forum_id=' . $this->Forum->getID() . '&group_id=' . $this->Forum->Group->getID() . '&stop=1');
         $extra_headers = "Return-Path: <noreply@" . $GLOBALS['sys_default_domain'] . ">\n";
         $extra_headers .= "Errors-To: <noreply@" . $GLOBALS['sys_default_domain'] . ">\n";
         $extra_headers .= "Sender: <noreply@" . $GLOBALS['sys_default_domain'] . ">\n";
         $extra_headers .= "Reply-To: " . $this->Forum->getReturnEmailAddress() . "\n";
         $extra_headers .= "Precedence: Bulk\n" . "List-Id: " . $this->Forum->getName() . " <forum" . $this->Forum->getId() . "@" . $GLOBALS['sys_default_domain'] . ">\n" . "List-Help: " . util_make_url('/forum/forum.php?id=' . $this->Forum->getId()) . "\n" . "Message-Id: <forumpost" . $this->getId() . "@" . $GLOBALS['sys_default_domain'] . ">";
         $parentid = $this->getParentId();
         if (!empty($parentid)) {
             $extra_headers .= "\nIn-Reply-To: " . $this->Forum->getReturnEmailAddress() . "\n" . "References: <forumpost" . $this->getParentId() . "@" . $GLOBALS['sys_default_domain'] . ">";
         }
         $subject = "[" . $this->Forum->getUnixName() . "][" . $this->getID() . "] " . util_unconvert_htmlspecialchars($this->getSubject());
         if (count($ids) != 0) {
             $sql = "SELECT email FROM users WHERE status='A' AND user_id IN ('" . implode($ids, '\',\'') . "')";
             $bccres = db_query($sql);
         }
         ($BCC =& implode(util_result_column_to_array($bccres), ',')) . ',' . $this->Forum->getSendAllPostsTo();
         $User = user_get_object($this->getPosterID());
         util_send_message('', $subject, $body, "noreply@" . $GLOBALS['sys_default_domain'], $BCC, 'Forum', $extra_headers);
         return true;
     }
     return false;
 }
    /**
     *	create - use this function to create a new entry in the database.
     *
     *	@param	string	The name of the mailing list
     *	@param	string	The description of the mailing list
     *	@param	int	Pass (1) if it should be public (0) for private.
     *
     *	@return	boolean	success.
     */
    function create($listName, $description, $isPublic = MAIL__MAILING_LIST_IS_PUBLIC, $creator_id = false)
    {
        //
        //	During the group creation, the current user_id will not match the admin's id
        //
        if (!$creator_id) {
            $creator_id = user_getid();
            if (!$this->userIsAdmin()) {
                $this->setPermissionDeniedError();
                return false;
            }
        }
        if (!$listName || strlen($listName) < MAIL__MAILING_LIST_NAME_MIN_LENGTH) {
            $this->setError(_('Must Provide List Name That Is 4 or More Characters Long'));
            return false;
        }
        $realListName = strtolower($this->Group->getUnixName() . '-' . $listName);
        if (!validate_email($realListName . '@' . $GLOBALS['sys_lists_host'])) {
            $this->setError(_('Invalid List Name') . ': ' . $realListName . '@' . $GLOBALS['sys_lists_host']);
            return false;
        }
        $result = db_query('SELECT 1 FROM mail_group_list WHERE lower(list_name)=\'' . $realListName . '\'');
        if (db_numrows($result) > 0) {
            $this->setError(_('List Already Exists'));
            return false;
        }
        $result_forum_samename = db_query('SELECT 1 FROM forum_group_list WHERE forum_name=\'' . $listName . '\' AND group_id=' . $this->Group->getID() . '');
        if (db_numrows($result_forum_samename) > 0) {
            $this->setError(_('Forum exists with the same name'));
            return false;
        }
        $listPassword = substr(md5($GLOBALS['session_hash'] . time() . rand(0, 40000)), 0, 16);
        $sql = 'INSERT INTO mail_group_list ' . '(group_id, list_name, is_public, password, list_admin, status, description) VALUES (' . $this->Group->getID() . ', ' . "'" . $realListName . "'," . "'" . $isPublic . "'," . "'" . $listPassword . "'," . "'" . $creator_id . "'," . "'" . MAIL__MAILING_LIST_IS_REQUESTED . "'," . "'" . $description . "')";
        db_begin();
        $result = db_query($sql);
        if (!$result) {
            db_rollback();
            $this->setError(sprintf(_('Error Creating %1$s'), _('Error Creating %1$s')) . db_error());
            return false;
        }
        $this->groupMailingListId = db_insertid($result, 'mail_group_list', 'group_list_id');
        $this->fetchData($this->groupMailingListId);
        $user =& user_get_object($creator_id);
        $userEmail = $user->getEmail();
        if (empty($userEmail) || !validate_email($userEmail)) {
            db_rollback();
            $this->setInvalidEmailError();
            return false;
        } else {
            $mailBody = stripcslashes(sprintf(_('A mailing list will be created on %1$s in 6-24 hours 
and you are the list administrator.

This list is: %3$s@%2$s .

Your mailing list info is at:
%4$s .

List administration can be found at:
%5$s .

Your list password is: %6$s .
You are encouraged to change this password as soon as possible.

Thank you for registering your project with %1$s.

-- the %1$s staff
'), $GLOBALS['sys_name'], $GLOBALS['sys_lists_host'], $realListName, $this->getExternalInfoUrl(), $this->getExternalAdminUrl(), $listPassword));
            $mailSubject = sprintf(_('%1$s New Mailing List'), $GLOBALS['sys_name']);
            util_send_message($userEmail, $mailSubject, $mailBody, 'admin@' . $GLOBALS['sys_default_domain']);
        }
        db_commit();
        return true;
    }
                    if ($group && is_object($group)) {
                        $debug_info .= 'Group ID: ' . $group->getID() . "\n";
                        if ($group->getID() != $last_group) {
                            echo $group->getPublicName() . ":\n";
                        }
                        if ($projectGroup->getID() != $last_projectgroup) {
                            echo $projectGroup->getName() . ":\n";
                        }
                        echo html_entity_decode($task->getSummary()) . ":\n";
                        echo '***' . ($now > $task->getEndDate() ? 'overdue' : "due {$end_date}") . "***\n";
                        echo util_make_url('/pm/task.php?func=detailtask&project_task_id=' . $task->getID() . '&group_id=' . $group->getID() . '&group_project_id=' . $projectGroup->getID());
                        echo "\n\n";
                        $last_group = $group->getID();
                        $last_projectgroup = $projectGroup->getID();
                        $valid_tasks++;
                    }
                }
                $debug_info .= "------------\n";
            }
            $messagebody = ob_get_contents();
            ob_end_clean();
            if ($valid_tasks > 0) {
                util_send_message($email, $subject, $messagebody);
            }
            /* else {
            				echo $debug_info."\n";
            			}*/
        }
    }
}
cron_entry(22, $err);
 /**
  *	mailFollowup - send out an email update for this artifact.
  *
  *	@param	int		(1) initial/creation (2) update.
  *	@param	array	Array of additional addresses to mail to.
  *	@param	array	Array of fields changed in this update .
  *	@access private.
  *	@return	boolean	success.
  */
 function mailFollowup($type, $more_addresses = false, $changes = '')
 {
     if (!$changes) {
         $changes = array();
     }
     $sess = session_get_user();
     if ($type == 1) {
         // Initial opening
         if ($sess) {
             $body = $this->ArtifactType->getName() . " item #" . $this->getID() . ", was opened at " . date(_('Y-m-d H:i'), $this->getOpenDate()) . " by " . $sess->getRealName();
         } else {
             $body = $this->ArtifactType->getName() . " item #" . $this->getID() . ", was opened at " . date(_('Y-m-d H:i'), $this->getOpenDate());
         }
     } else {
         if ($sess) {
             $body = $this->ArtifactType->getName() . " item #" . $this->getID() . ", was changed at " . date(_('Y-m-d H:i'), $this->getOpenDate()) . " by " . $sess->getRealName();
         } else {
             $body = $this->ArtifactType->getName() . " item #" . $this->getID() . ", was changed at " . date(_('Y-m-d H:i'), $this->getOpenDate());
         }
     }
     $body .= "\nYou can respond by visiting: " . "\n" . util_make_url('/tracker/?func=detail&atid=' . $this->ArtifactType->getID() . "&aid=" . $this->getID() . "&group_id=" . $this->ArtifactType->Group->getID()) . "\nOr by replying to this e-mail entering your response between the following markers: " . "\n" . ARTIFACT_MAIL_MARKER . "\n(enter your response here)" . "\n" . ARTIFACT_MAIL_MARKER . "\n\n" . $this->marker('status', $changes) . "Status: " . $this->getStatusName() . "\n" . $this->marker('priority', $changes) . "Priority: " . $this->getPriority() . "\n" . "Submitted By: " . $this->getSubmittedRealName() . " (" . $this->getSubmittedUnixName() . ")" . "\n" . $this->marker('assigned_to', $changes) . "Assigned to: " . $this->getAssignedRealName() . " (" . $this->getAssignedUnixName() . ")" . "\n" . $this->marker('summary', $changes) . "Summary: " . util_unconvert_htmlspecialchars($this->getSummary()) . " \n";
     // Now display the extra fields
     $efd = $this->getExtraFieldDataText();
     foreach ($efd as $efid => $ef) {
         $body .= $this->marker('extra_fields', $changes, $efid);
         $body .= $ef["name"] . ": " . $ef["value"] . "\n";
     }
     $subject = '[' . $this->ArtifactType->Group->getUnixName() . '-' . $this->ArtifactType->getName() . '][' . $this->getID() . '] ' . util_unconvert_htmlspecialchars($this->getSummary());
     if ($type > 1) {
         // get all the email addresses that are monitoring this request or the ArtifactType
         $monitor_ids =& $this->getMonitorIds();
     } else {
         // initial creation, we just get the users monitoring the ArtifactType
         $monitor_ids =& $this->ArtifactType->getMonitorIds();
     }
     $emails = array();
     if ($more_addresses) {
         $emails[] = $more_addresses;
     }
     //we don't email the current user
     if ($this->getAssignedTo() != user_getid()) {
         $monitor_ids[] = $this->getAssignedTo();
     }
     if ($this->getSubmittedBy() != user_getid()) {
         $monitor_ids[] = $this->getSubmittedBy();
     }
     //initial submission
     if ($type == 1) {
         //if an email is set for this ArtifactType
         //add that address to the BCC: list
         if ($this->ArtifactType->getEmailAddress()) {
             $emails[] = $this->ArtifactType->getEmailAddress();
         }
     } else {
         //update
         if ($this->ArtifactType->emailAll()) {
             $emails[] = $this->ArtifactType->getEmailAddress();
         }
     }
     $body .= "\n\nInitial Comment:" . "\n" . util_unconvert_htmlspecialchars($this->getDetails()) . "\n\n----------------------------------------------------------------------";
     if ($type > 1) {
         /*
         	Now include the followups
         */
         $result2 = $this->getMessages();
         $rows = db_numrows($result2);
         if ($result2 && $rows > 0) {
             for ($i = 0; $i < $rows; $i++) {
                 //
                 //	for messages posted by non-logged-in users,
                 //	we grab the email they gave us
                 //
                 //	otherwise we use the confirmed one from the users table
                 //
                 if (db_result($result2, $i, 'user_id') == 100) {
                     $emails[] = db_result($result2, $i, 'from_email');
                 } else {
                     $monitor_ids[] = db_result($result2, $i, 'user_id');
                 }
                 $body .= "\n\n";
                 if ($i == 0) {
                     $body .= $this->marker('details', $changes);
                 }
                 $body .= "Comment By: " . db_result($result2, $i, 'realname') . " (" . db_result($result2, $i, 'user_name') . ")" . "\nDate: " . date(_('Y-m-d H:i'), db_result($result2, $i, 'adddate')) . "\n\nMessage:" . "\n" . util_unconvert_htmlspecialchars(db_result($result2, $i, 'body')) . "\n\n----------------------------------------------------------------------";
             }
         }
     }
     $body .= "\n\nYou can respond by visiting: " . "\n" . util_make_url('/tracker/?func=detail&atid=' . $this->ArtifactType->getID() . "&aid=" . $this->getID() . "&group_id=" . $this->ArtifactType->Group->getID());
     //only send if some recipients were found
     if (count($emails) < 1 && count($monitor_ids) < 1) {
         return true;
     }
     if (count($monitor_ids) < 1) {
         $monitor_ids = array();
     } else {
         $monitor_ids = array_unique($monitor_ids);
     }
     $from = $this->ArtifactType->getReturnEmailAddress();
     $extra_headers = 'Reply-to: ' . $from;
     // load the e-mail addresses of the users
     $users =& user_get_objects($monitor_ids);
     if (count($users) > 0) {
         foreach ($users as $user) {
             if ($user->getStatus() == "A") {
                 //we are only sending emails to active users
                 $emails[] = $user->getEmail();
             }
         }
     }
     //		print($body);
     //now remove all duplicates from the email list
     if (count($emails) > 0) {
         $BCC = implode(',', array_unique($emails));
         util_send_message('', $subject, $body, $from, $BCC, '', $extra_headers);
     }
     //util_handle_message($monitor_ids,$subject,$body,$BCC);
     return true;
 }
Beispiel #8
0
/**
 *	util_handle_message() - a convenience wrapper which sends messages
 *	to either a jabber account or email account or both, depending on
 *	user preferences
 *
 *	@param	array	array of user_id's from the user table
 *	@param	string	subject of the message
 *	@param	string	the message body
 *	@param	string	a comma-separated list of email address
 *	@param	string	a comma-separated list of jabber address
 *	@param	string	From header
 */
function util_handle_message($id_arr, $subject, $body, $extra_emails = '', $extra_jabbers = '', $from = '')
{
    $address = array();
    if (count($id_arr) < 1) {
    } else {
        $res = db_query("SELECT user_id, jabber_address,email,jabber_only\n\t\t\tFROM users WHERE user_id IN (" . implode($id_arr, ',') . ")");
        $rows = db_numrows($res);
        for ($i = 0; $i < $rows; $i++) {
            if (db_result($res, $i, 'user_id') == 100) {
                // Do not send messages to "Nobody"
                continue;
            }
            //
            //  Build arrays of the jabber address
            //
            if (db_result($res, $i, 'jabber_address')) {
                $address['jabber_address'][] = db_result($res, $i, 'jabber_address');
                if (db_result($res, $i, 'jabber_only') != 1) {
                    $address['email'][] = db_result($res, $i, 'email');
                }
            } else {
                $address['email'][] = db_result($res, $i, 'email');
            }
        }
        if (isset($address['email']) && count($address['email']) > 0) {
            $extra_emails = implode($address['email'], ',') . ',' . $extra_emails;
        }
        if (isset($address['jabber_address']) && count($address['jabber_address']) > 0) {
            $extra_jabbers = implode($address['jabber_address'], ',') . ',' . $extra_jabbers;
        }
    }
    if ($extra_emails) {
        util_send_message('', $subject, $body, $from, $extra_emails);
    }
    if ($extra_jabbers) {
        util_send_jabber($extra_jabbers, $subject, $body);
    }
}
Beispiel #9
0
    if ($u->isError()) {
        form_release_key(getStringFromRequest('form_key'));
        exit_error('Error', $u->getErrorMessage());
    } else {
        $message = stripcslashes(sprintf(_('Someone (presumably you) on the %1$s site requested a
password change through email verification. If this was not you,
ignore this message and nothing will happen.

If you requested this verification, visit the following URL
to change your password:

<%2$s>

 -- the %1$s staff
'), util_make_url($GLOBALS['sys_name'], "/account/lostlogin.php?ch=_" . $confirm_hash)));
        util_send_message($u->getEmail(), sprintf(_('%1$s Verification'), $GLOBALS['sys_name']), $message);
        $HTML->header(array('title' => "Lost Password Confirmation"));
        echo '<p>' . printf(_('An email has been sent to the address you have on file. Follow the instructions in the email to change your account password.') . '</p><p><a href="%1$s">Home</a>', util_make_url('/')) . '</p>';
        $HTML->footer(array());
        exit;
    }
}
$HTML->header(array('title' => "Lost Account Password"));
echo _('<p>Hey... losing your password is serious business. It compromises the security of your account, your projects, and this site.</p><p>Clicking "Send Lost PW Hash" below will email a URL to the email address we have on file for you. In this URL is a 128-bit confirmation hash for your account. Visiting the URL will allow you to change your password online and login.</p>');
?>

<form action="<?php 
echo getStringFromServer('PHP_SELF');
?>
" method="post">
<input type="hidden" name="form_key" value="<?php 
function send_pending_tracker_items_mail()
{
    /* first, get all the items that are considered overdue */
    $time = time();
    $sql = 'SELECT artifact_id, submitted_by, group_id, assigned_to, summary,  details, description,  assigned_realname, submitted_realname, status_name, category_name, group_name, group_artifact_id, open_date	FROM artifact_vw a NATURAL JOIN artifact_group_list agl	WHERE (agl.due_period+a.open_date) < ' . $time . ' AND	a.status_id=1';
    $res = db_query($sql);
    for ($tmp = 0; $tmp < db_numrows($res); $tmp++) {
        $realopendate = date(_('Y-m-d H:i'), db_result($res, $tmp, 'open_date'));
        $status_name = db_result($res, $tmp, 'status_name');
        $details = db_result($res, $tmp, 'detail');
        $summary = db_result($res, $tmp, 'summary');
        $users = '(' . db_result($res, $tmp, "submitted_by") . ',' . db_result($res, $tmp, "assigned_to") . ')';
        $hyperlink = util_make_url('/tracker/index.php?func=detail&aid=' . db_result($res, $tmp, "artifact_id") . '&group_id=' . db_result($res, $tmp, "group_id") . '&atid=' . db_result($res, $tmp, "group_artifact_id"));
        $artifact = db_result($res, $tmp, "artifact_id");
        $opendate = db_result($res, $tmp, "open_date");
        /* now, get all the users */
        $sql2 = 'select * from users where user_id in ' . $users . ' and user_id>100';
        $userres = db_query($sql2);
        for ($usercount = 0; $usercount < db_numrows($userres); $usercount++) {
            $mailto = db_result($userres, $usercount, "email");
            $language = db_result($userres, $usercount, "language");
            setup_gettext_from_language_id($language);
            $subject = _('Pending tracker items notification');
            $messagebody = stripcslashes(sprintf(_('This mail is sent to you to remind you of pending/overdue tracker items. The item #%1$s is pending:
Summary: %3$s
Status: %5$s
Open Date:%6$s
Assigned To: %7$s
Submitted by: %8$s
Details: %9$s


Click here to visit the item: %4$s'), $artifact, $opendate, $summary, $hyperlink, $status_name, $realopendate, db_result($res, $tmp, 'assigned_realname'), db_result($res, $tmp, 'submitted_realname'), db_result($res, $tmp, 'details')));
            /* and finally send the email */
            util_send_message($mailto, $subject, $messagebody);
        }
    }
    cron_entry(19, db_error());
}
Beispiel #11
0
     $sql = "INSERT INTO user_diary (user_id,date_posted,summary,details,is_public) VALUES " . "('" . user_getid() . "','" . time() . "','" . htmlspecialchars($summary) . "','" . htmlspecialchars($details) . "','{$is_public}')";
     $res = db_query($sql);
     if ($res && db_affected_rows($res) > 0) {
         $feedback .= _('Item Added');
         if ($is_public) {
             //send an email if users are monitoring
             $sql = "SELECT users.email from user_diary_monitor,users " . "WHERE user_diary_monitor.user_id=users.user_id " . "AND user_diary_monitor.monitored_user='******'";
             $result = db_query($sql);
             $rows = db_numrows($result);
             if ($result && $rows > 0) {
                 $tolist = implode(util_result_column_to_array($result), ', ');
                 $to = '';
                 // send to noreply@
                 $subject = "[ SF User Notes: " . $u->getRealName() . "] " . stripslashes($summary);
                 $body = util_line_wrap(stripslashes($details)) . "\n\n______________________________________________________________________" . "\nYou are receiving this email because you elected to monitor this user." . "\nTo stop monitoring this user, login to " . $GLOBALS['sys_name'] . " and visit: " . "\nhttp://" . $GLOBALS['sys_default_domain'] . "/developer/monitor.php?diary_user="******" email sent - ({$rows}) people monitoring ";
             } else {
                 $feedback .= ' email not sent - no one monitoring ';
                 echo db_error();
             }
         } else {
             //don't send an email to monitoring users
             //since this is a private note
         }
     } else {
         form_release_key(getStringFromRequest("form_key"));
         $feedback .= _('Error Adding Item');
         echo db_error();
     }
 }
Beispiel #12
0
    /**
     *	sendNewProjectNotificationEmail - Send new project notification email.
     *
     *	This function sends out a notification email to the
     *	SourceForge admin user when a new project is
     *	submitted.
     *
     *	@return	boolean	success.
     *	@access public.
     */
    function sendNewProjectNotificationEmail()
    {
        // Get the user who wants to register the project
        $res = db_query("SELECT u.user_id\n\t\t\t\t FROM users u, user_group ug\n\t\t\t\t WHERE ug.group_id='" . $this->getID() . "' AND u.user_id=ug.user_id;");
        if (db_numrows($res) < 1) {
            $this->setError(_("Could not find user who has submitted the project."));
            return false;
        }
        $submitter =& user_get_object(db_result($res, 0, 'user_id'));
        $res = db_query("SELECT users.email, users.language, users.user_id\n\t \t\t\tFROM users,user_group\n\t\t\t\tWHERE group_id=1 \n\t\t\t\tAND user_group.admin_flags='A'\n\t\t\t\tAND users.user_id=user_group.user_id;");
        if (db_numrows($res) < 1) {
            $this->setError(_("There is no administrator to send the mail."));
            return false;
        }
        for ($i = 0; $i < db_numrows($res); $i++) {
            $admin_email = db_result($res, $i, 'email');
            $admin =& user_get_object(db_result($res, $i, 'user_id'));
            setup_gettext_for_user($admin);
            $message = stripcslashes(sprintf(_('New %1$s Project Submitted

Project Full Name:  %2$s
Submitted Description: %3$s
License: %4$s
Submitter: %6$s (%7$s)

Please visit the following URL to approve or reject this project:
%5$s'), $GLOBALS['sys_name'], $this->getPublicName(), util_unconvert_htmlspecialchars($this->getRegistrationPurpose()), $this->getLicenseName(), util_make_url('/admin/approve-pending.php'), $submitter->getRealName(), $submitter->getUnixName()));
            util_send_message($admin_email, sprintf(_('New %1$s Project Submitted'), $GLOBALS['sys_name']), $message);
            setup_gettext_from_browser();
        }
        $email = $submitter->getEmail();
        setup_gettext_for_user($submitter);
        $message = stripcslashes(sprintf(_('New %1$s Project Submitted

Project Full Name:  %2$s
Submitted Description: %3$s
License: %4$s

The %1$s admin team will now examine your project submission.  You will be notified of their decision.'), $GLOBALS['sys_name'], $this->getPublicName(), util_unconvert_htmlspecialchars($this->getRegistrationPurpose()), $this->getLicenseName(), $GLOBALS['sys_default_domain']));
        util_send_message($email, sprintf(_('New %1$s Project Submitted'), $GLOBALS['sys_name']), $message);
        setup_gettext_from_browser();
        return true;
    }
 /**
  *	send_accept_mail()
  *
  */
 function send_accept_mail()
 {
     $user =& user_get_object($this->getUserId());
     setup_gettext_for_user($user);
     $subject = sprintf(_('Request to Join Project %1$s'), $this->Group->getPublicName());
     $body = sprintf(_('Your request to join the %1$s project was granted by an administrator.'), $this->Group->getPublicName());
     util_send_message($user->getEmail(), $subject, $body);
     setup_gettext_from_browser();
 }
Beispiel #14
0
        */
        $to = eregi_replace('_maillink_', '@', $toaddress);
        $to = util_remove_CRLF($to);
        util_send_message($to, stripslashes($subject), stripslashes($body), $email, '', $name);
        $HTML->header(array('title' => $GLOBALS['sys_name'] . ' ' . _('Contact')));
        echo '<p>' . _('Message has been sent') . '.</p>';
        $HTML->footer(array());
        exit;
    } else {
        if ($touser) {
            /*
            	figure out the user's email and send it there
            */
            $to = db_result($result, 0, 'email');
            $to = util_remove_CRLF($to);
            util_send_message($to, stripslashes($subject), stripslashes($body), $email, '', $name);
            $HTML->header(array('title' => $GLOBALS['sys_name'] . ' ' . _('Contact')));
            echo '<p>' . _('Message has been sent') . '</p>';
            $HTML->footer(array());
            exit;
        }
    }
}
if ($toaddress) {
    $titleaddress = $toaddress;
} else {
    $titleaddress = db_result($result, 0, 'user_name');
}
if (session_loggedin()) {
    $user =& session_get_user();
    $name = $user->getRealName();
Beispiel #15
0
$compt = 0;
while ($row =& db_fetch_array($users_res)) {
    $compt++;
    if ($type == 'SITE' || $type == 'COMMNTY') {
        $tail = "\r\n==================================================================\r\n";
        $tail .= sprintf(_('You receive this message because you subscribed to %1$s
site mailing(s). You may opt out from some of them selectively
by logging in to %1$s and visiting your Account Maintenance
page (%2$s), or disable them altogether
by visiting following link:
<%3$s>
'), $GLOBALS['sys_name'], util_make_url('/account/'), util_make_url('/account/unsubscribe.php?ch=_' . $row['confirm_hash']));
    } else {
        $tail = "";
    }
    util_send_message($row['email'], $subj, $body . "\r\n" . $tail, 'noreply@' . $sys_default_domain);
    $last_userid = $row['user_id'];
    sleep($SLEEP);
}
$sql = "UPDATE massmail_queue\n\t\tSET failed_date=0,\n\t\tlast_userid='{$last_userid}',\n\t\tfinished_date='" . time() . "'\n\t\tWHERE id='{$mail_id}'";
db_query($sql);
if (db_error()) {
    $err .= $sql . db_error();
}
$mess = "massmail {$compt} mails sent";
m_exit($mess);
function m_exit($mess = '')
{
    global $err;
    if (!cron_remove_lock(__FILE__)) {
        $err .= "Could not remove lock\n";