Subversion Repositories Applications.papyrus

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
831 florian 1
<?php
2
 
3
////////////////////////////////////////////////////////////////////////////////
4
//                                                                            //
5
//   Copyright (C) 2006  Phorum Development Team                              //
6
//   http://www.phorum.org                                                    //
7
//                                                                            //
8
//   This program is free software. You can redistribute it and/or modify     //
9
//   it under the terms of either the current Phorum License (viewable at     //
10
//   phorum.org) or the Phorum License that was distributed with this file    //
11
//                                                                            //
12
//   This program is distributed in the hope that it will be useful,          //
13
//   but WITHOUT ANY WARRANTY, without even the implied warranty of           //
14
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     //
15
//                                                                            //
16
//   You should have received a copy of the Phorum License                    //
17
//   along with this program.                                                 //
18
////////////////////////////////////////////////////////////////////////////////
19
 
20
if ( !defined( "PHORUM_CONTROL_CENTER" ) ) return;
21
// need this for banlist-checks
22
include_once("./include/profile_functions.php");
23
 
24
// email-verification
25
if($PHORUM['registration_control']) {
26
    //$PHORUM['DATA']['PROFILE']['email_temp']="email_address@bogus.com|bla";
27
    if (!empty($PHORUM['DATA']['PROFILE']['email_temp'])) {
28
            list($PHORUM['DATA']['PROFILE']['email_temp_part'],$bogus)=explode("|",$PHORUM['DATA']['PROFILE']['email_temp']);
29
    }
30
}
31
 
32
if ( count( $_POST ) ) {
33
 
34
    if ( empty( $_POST["email"] ) ) {
35
        $error = $PHORUM["DATA"]["LANG"]["ErrRequired"];
36
    } elseif (!phorum_valid_email( $_POST["email"])) {
37
        $error = $PHORUM["DATA"]["LANG"]["ErrEmail"];
38
    } elseif ($PHORUM['user']['email'] != $_POST["email"] && phorum_user_check_email($_POST["email"])) {
39
        $error = $PHORUM["DATA"]["LANG"]["ErrEmailExists"];
40
    } elseif (!phorum_check_ban_lists($_POST["email"], PHORUM_BAD_EMAILS)) {
41
        $error = $PHORUM["DATA"]["LANG"]["ErrBannedEmail"];
42
    } elseif (isset($PHORUM['DATA']['PROFILE']['email_temp_part']) && !empty($_POST['email_verify_code']) && $PHORUM['DATA']['PROFILE']['email_temp_part']."|".$_POST['email_verify_code'] != $PHORUM['DATA']['PROFILE']['email_temp']) {
43
        $error = $PHORUM['DATA']['LANG']['ErrWrongMailcode'];
44
    } else {
45
        // flip this due to db vs. UI wording.
46
        $_POST["hide_email"] = ( isset($_POST["hide_email"]) ) ? 0 : 1;
47
 
48
        $_POST['moderation_email'] = ( isset($_POST['moderation_email']) && phorum_user_moderate_allowed(PHORUM_MODERATE_ALLOWED_ANYWHERE) ) ? 1 : 0;
49
 
50
        // Remember this for the template.
51
        if (isset($PHORUM['DATA']['PROFILE']['email_temp_part'])) {
52
            $email_temp_part = $PHORUM['DATA']['PROFILE']['email_temp_part'];
53
        }
54
 
55
        // do we need to send a confirmation-mail?
56
        if(isset($PHORUM['DATA']['PROFILE']['email_temp_part']) && !empty($_POST['email_verify_code']) && $PHORUM['DATA']['PROFILE']['email_temp_part']."|".$_POST['email_verify_code'] == $PHORUM['DATA']['PROFILE']['email_temp']) {
57
               $_POST['email']=$PHORUM['DATA']['PROFILE']['email_temp_part'];
58
               $_POST['email_temp']="";
59
               unset($email_temp_part);
60
        } elseif($PHORUM['registration_control'] && !empty($_POST['email']) && strtolower($_POST['email']) != strtolower($PHORUM["DATA"]["PROFILE"]['email'])) {
61
            // ... generate the confirmation-code ... //
62
            $conf_code= mt_rand ( 1000000, 9999999);
63
            $_POST['email_temp']=$_POST['email']."|".$conf_code;
64
            // ... send email ... //
65
            $maildata=array(
66
            'mailmessage'   => wordwrap($PHORUM['DATA']['LANG']['EmailVerifyBody'], 72),
67
            'mailsubject'   => $PHORUM['DATA']['LANG']['EmailVerifySubject'],
68
            'uname'         => $PHORUM['DATA']['PROFILE']['username'],
69
            'newmail'       => $_POST['email'],
70
            'mailcode'      => $conf_code,
71
            'cc_url'        => phorum_get_url(PHORUM_CONTROLCENTER_URL, "panel=" . PHORUM_CC_MAIL)
72
            );
73
            phorum_email_user(array($_POST['email']),$maildata);
74
 
75
            // Remember this for the template.
76
            $email_temp_part = $_POST['email'];
77
            unset($_POST['email']);
78
        }
79
        list($error,$okmsg) = phorum_controlcenter_user_save( $panel );
80
    }
81
}
82
 
83
if (isset($email_temp_part)) {
84
$PHORUM['DATA']['PROFILE']['email_temp_part'] = $email_temp_part;
85
}
86
 
87
// flip this due to db vs. UI wording.
88
if ( !empty( $PHORUM['DATA']['PROFILE']["hide_email"] ) ) {
89
    $PHORUM["DATA"]["PROFILE"]["hide_email_checked"] = "";
90
} else {
91
    // more html stuff in the code. yuck.
92
    $PHORUM["DATA"]["PROFILE"]["hide_email_checked"] = " checked=\"checked\"";
93
}
94
 
95
if(phorum_user_moderate_allowed(PHORUM_MODERATE_ALLOWED_ANYWHERE)){
96
    $PHORUM["DATA"]["PROFILE"]["show_moderate_options"] = true;
97
 
98
    if ( !empty( $PHORUM['DATA']['PROFILE']["moderation_email"] ) ) {
99
        $PHORUM["DATA"]["PROFILE"]["moderation_email_checked"] = " checked=\"checked\"";
100
    } else {
101
        $PHORUM["DATA"]["PROFILE"]["moderation_email_checked"] = "";
102
    }
103
} else {
104
    $PHORUM["DATA"]["PROFILE"]["show_moderate_options"] = false;
105
}
106
 
107
$PHORUM["DATA"]["PROFILE"]["EMAIL_CONFIRM"]=$PHORUM["registration_control"];
108
 
109
 
110
$PHORUM["DATA"]["PROFILE"]["block_title"] = $PHORUM["DATA"]["LANG"]["EditMailsettings"];
111
 
112
$PHORUM['DATA']['PROFILE']['MAILSETTINGS'] = 1;
113
$template = "cc_usersettings";
114
 
115
?>