Ejemplo n.º 1
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();
 }