Blame Scripts/Newbb2Phpbb/classes/mail.php

61a2f1
61a2f1
/***
61a2f1
 * Mail
61a2f1
 */
61a2f1
61a2f1
class MAIL
61a2f1
{
61a2f1
61a2f1
    public $notification; 
61a2f1
    public $notification_subject;
61a2f1
    public $notification_message;
61a2f1
61a2f1
   /***
61a2f1
    * Class constructor
61a2f1
    */
61a2f1
61a2f1
    function __construct()
61a2f1
    {
61a2f1
        // Initialize variables with default values
61a2f1
        $this->notification = 'NO';
61a2f1
        $this->notification_subject         = '[CentOS Forum] User account notification.';
61a2f1
        $this->notification_message         = "Dear =USER_FIRST_NAME=,
61a2f1
61a2f1
The CentOS Forums (http://centos.org/forums/) were migrated from
61a2f1
Xoops+CBB(newbb) to phpBB3 and the user accounts were moved to an LDAP
61a2f1
server. As consequence your user account is now on that LDAP server.
61a2f1
61a2f1
In order to make this happen, it was needed to reset your account
61a2f1
password. Your password(userPassword) is here with the rest of your
61a2f1
user account information.
61a2f1
61a2f1
The following LDAP entry has the information of your user account:
61a2f1
61a2f1
               dn: =DN=
61a2f1
              uid: =UID1=
61a2f1
              uid: =UID2=
61a2f1
     userPassword: =PASS=
61a2f1
             mail: =MAIL=
61a2f1
               cn: =CN=
61a2f1
               sn: =SN=
61a2f1
     employeeType: =TYPE=
61a2f1
preferredLanguage: =LANG=
61a2f1
      displayName: =DISPLAYNAME=
61a2f1
61a2f1
With this migration we are preparing the ground to unify all CentOS
61a2f1
user accounts into a common place. If you need to authenticate
61a2f1
somewhere under centos.org domain use any of your uids and the
61a2f1
password provided above.
61a2f1
61a2f1
Best Regards,
61a2f1
--
61a2f1
The CentOS Team";
61a2f1
61a2f1
        // Reinitialize variables with form values
61a2f1
        $config = array('notification', 'notification_subject', 'notification_message');
61a2f1
        foreach ( $config as $param )
61a2f1
        {
61a2f1
            if ( ! isset($_SESSION[$param]))
61a2f1
            {
61a2f1
                $_SESSION[$param] = $this->$param;
61a2f1
            }   
61a2f1
61a2f1
            $_SESSION[$param] = isset($_POST[$param])?$_POST[$param]:$_SESSION[$param];
61a2f1
61a2f1
            $this->$param = $_SESSION[$param];
61a2f1
        }
61a2f1
    }
61a2f1
    
61a2f1
   /***
61a2f1
    * Send
61a2f1
    * -------
61a2f1
    * $info is an array with the following indexes:
61a2f1
    *  - mailto
61a2f1
    *  - name
61a2f1
    *  - dn
61a2f1
    *  - newpass
61a2f1
    */
61a2f1
61a2f1
    function send( $info )
61a2f1
    {
61a2f1
        // Do replacements in message template
61a2f1
        $this->notification_message = preg_replace('/=MAIL=/',  $info['mailto'],$this->notification_message);
61a2f1
        $this->notification_message = preg_replace('/=DN=/',    $info['dn'],$this->notification_message);
61a2f1
        $this->notification_message = preg_replace('/=UID1=/',  $info['uid1'],$this->notification_message);
61a2f1
        $this->notification_message = preg_replace('/=UID2=/',  $info['uid2'],$this->notification_message);
61a2f1
        $this->notification_message = preg_replace('/=PASS=/',  $info['userpassword'],$this->notification_message);
61a2f1
        $this->notification_message = preg_replace('/=CN=/',    $info['cn'],$this->notification_message);
61a2f1
        $this->notification_message = preg_replace('/=SN=/',    $info['sn'],$this->notification_message);
61a2f1
        $this->notification_message = preg_replace('/=TYPE=/',  $info['employeetype'],$this->notification_message);
61a2f1
        $this->notification_message = preg_replace('/=LANG=/',  $info['preferredlanguage'],$this->notification_message);
61a2f1
        $this->notification_message = preg_replace('/=DISPLAYNAME=/',$info['displayname'],$this->notification_message);
61a2f1
        $this->notification_message = preg_replace('/=USER_FIRST_NAME=/', preg_replace('/ .+$/','',$info['cn']), $this->notification_message);
61a2f1
61a2f1
        $to              = $info['mailto'];
61a2f1
        $subject         = $this->notification_subject;
61a2f1
        $message         = $this->notification_message;
61a2f1
        $headers         = 'From: webmaster';
61a2f1
        $extra_params    = '-fwebmaster';
61a2f1
        if ( $this->notification == 'YES' )
61a2f1
        {
61a2f1
            return mail( $to, $subject, $message, $headers, $extra_params );
61a2f1
        }
61a2f1
    }
61a2f1
61a2f1
   /***
61a2f1
    * Send notification ?
61a2f1
    * Show form selector
61a2f1
    */
61a2f1
61a2f1
    function get_configForm( $disabled = '' )
61a2f1
    {
61a2f1
        $htmlblock = array('

Mail Notification:

','
');
61a2f1
61a2f1
        // Mail template
61a2f1
        array_push($htmlblock, 
61a2f1
61a2f1
        '
Subject:
',
61a2f1
        '
<input name="notification_subject" size="70" '.$disabled.' value="'.$this->notification_subject.'" />
',
61a2f1
                               
61a2f1
       '
Message:
',
61a2f1
       '
<textarea name="notification_message" cols="70" rows="15" '.$disabled.'>'.$this->notification_message.'</textarea>
',
61a2f1
61a2f1
        '
Send notifications ?:
',
61a2f1
        '
<select name="notification" '.$disabled.'>');
61a2f1
61a2f1
        if ( $this->notification == 'YES' )
61a2f1
        {
61a2f1
            array_push($htmlblock,
61a2f1
                '<option value="NO">NO</option>',
61a2f1
                '<option value="YES" selected="selected">YES</option>');
61a2f1
        }
61a2f1
        else
61a2f1
        {
61a2f1
            array_push ( $htmlblock, 
61a2f1
                '<option value="NO" selected="selected">NO</option>',
61a2f1
                '<option value="YES">YES</option>');
61a2f1
        }
61a2f1
61a2f1
        array_push($htmlblock, '</select>Use it with care!');
61a2f1
61a2f1
        array_push($htmlblock, '');
61a2f1
61a2f1
        return $htmlblock;
61a2f1
    }
61a2f1
61a2f1
   /***
61a2f1
    * Class destructor
61a2f1
    */
61a2f1
61a2f1
    function __destruct()
61a2f1
    {
61a2f1
    
61a2f1
    }
61a2f1
}
61a2f1
61a2f1
$mail = new MAIL;
61a2f1
?>