Пример #1
0
             foreach ($users_with_email as $cur_hit) {
                 $forgot_pass_timeout = 3600;
                 ($hook = get_hook('li_forgot_pass_pre_flood_check')) ? eval($hook) : null;
                 if ($cur_hit['last_email_sent'] != '' && time() - $cur_hit['last_email_sent'] < $forgot_pass_timeout && time() - $cur_hit['last_email_sent'] >= 0) {
                     message(sprintf($lang_login['Email flood'], $forgot_pass_timeout));
                 }
                 // Generate a new password activation key
                 $new_password_key = random_key(8, true);
                 $query = array('UPDATE' => 'users', 'SET' => 'activate_key=\'' . $new_password_key . '\', last_email_sent = ' . time(), 'WHERE' => 'id=' . $cur_hit['id']);
                 ($hook = get_hook('li_forgot_pass_qr_set_activate_key')) ? eval($hook) : null;
                 $forum_db->query_build($query) or error(__FILE__, __LINE__);
                 // Do the user specific replacements to the template
                 $cur_mail_message = str_replace('<username>', $cur_hit['username'], $mail_message);
                 $cur_mail_message = str_replace('<activation_url>', str_replace('&amp;', '&', forum_link($forum_url['change_password_key'], array($cur_hit['id'], $new_password_key))), $cur_mail_message);
                 ($hook = get_hook('li_forgot_pass_new_user_replace_data')) ? eval($hook) : null;
                 forum_mail($email, $mail_subject, $cur_mail_message);
             }
             message(sprintf($lang_login['Forget mail'], '<a href="mailto:' . forum_htmlencode($forum_config['o_admin_email']) . '">' . forum_htmlencode($forum_config['o_admin_email']) . '</a>'));
         } else {
             $errors[] = sprintf($lang_login['No e-mail match'], forum_htmlencode($email));
         }
     }
 }
 // Setup form
 $forum_page['group_count'] = $forum_page['item_count'] = $forum_page['fld_count'] = 0;
 $forum_page['form_action'] = forum_link($forum_url['request_password']);
 // Setup breadcrumbs
 $forum_page['crumbs'] = array(array($forum_config['o_board_title'], forum_link($forum_url['index'])), $lang_login['New password request']);
 ($hook = get_hook('li_forgot_pass_pre_header_load')) ? eval($hook) : null;
 define('FORUM_PAGE', 'reqpass');
 require FORUM_ROOT . 'header.php';
 $user_info = array('username' => $username, 'pubkey' => $pubkey, 'btcaddress' => $btcaddress, 'invitedBy' => $username2, 'group_id' => $initial_group_id, 'salt' => $salt, 'password' => $password1, 'password_hash' => $password_hash, 'email' => $email1, 'email_setting' => $forum_config['o_default_email_setting'], 'timezone' => $timezone, 'dst' => $dst, 'language' => $language, 'style' => $forum_config['o_default_style'], 'registered' => time(), 'registration_ip' => get_remote_address(), 'activate_key' => $forum_config['o_regs_verify'] == '1' ? '\'' . random_key(8, true) . '\'' : 'NULL', 'require_verification' => $forum_config['o_regs_verify'] == '1', 'notify_admins' => $forum_config['o_regs_report'] == '1');
 ($hook = get_hook('rg_register_pre_add_user')) ? eval($hook) : null;
 add_user($user_info, $new_uid);
 // If we previously found out that the e-mail was banned
 if ($banned_email && $forum_config['o_mailing_list'] != '') {
     $mail_subject = 'Alert - Banned e-mail detected';
     $mail_message = 'User \'' . $username . '\' registered with banned e-mail address: ' . $email1 . "\n\n" . 'User profile: ' . forum_link($forum_url['user'], $new_uid) . "\n\n" . '-- ' . "\n" . 'Forum Mailer' . "\n" . '(Do not reply to this message)';
     ($hook = get_hook('rg_register_banned_email')) ? eval($hook) : null;
     forum_mail($forum_config['o_mailing_list'], $mail_subject, $mail_message);
 }
 // If we previously found out that the e-mail was a dupe
 if (!empty($dupe_list) && $forum_config['o_mailing_list'] != '') {
     $mail_subject = 'Alert - Duplicate e-mail detected';
     $mail_message = 'User \'' . $username . '\' registered with an e-mail address that also belongs to: ' . implode(', ', $dupe_list) . "\n\n" . 'User profile: ' . forum_link($forum_url['user'], $new_uid) . "\n\n" . '-- ' . "\n" . 'Forum Mailer' . "\n" . '(Do not reply to this message)';
     ($hook = get_hook('rg_register_dupe_email')) ? eval($hook) : null;
     forum_mail($forum_config['o_mailing_list'], $mail_subject, $mail_message);
 }
 ($hook = get_hook('rg_register_pre_login_redirect')) ? eval($hook) : null;
 // Must the user verify the registration or do we log him/her in right now?
 if ($forum_config['o_regs_verify'] == '1') {
     message(sprintf($lang_profile['Reg e-mail'], '<a href="mailto:' . forum_htmlencode($forum_config['o_admin_email']) . '">' . forum_htmlencode($forum_config['o_admin_email']) . '</a>'));
 } else {
     // Remove cache file with forum stats
     if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) {
         require FORUM_ROOT . 'include/cache.php';
     }
     clean_stats_cache();
 }
 $expire = time() + $forum_config['o_timeout_visit'];
 forum_setcookie($cookie_name, base64_encode($new_uid . '|' . $password_hash . '|' . $expire . '|' . sha1($salt . $password_hash . forum_hash($expire, $salt))), $expire);
 if (!isset($_SESSION['req_buyer_account'])) {
function send_forum_subscriptions($topic_info, $new_tid)
{
    global $forum_config, $forum_db, $forum_url, $lang_common;
    $return = ($hook = get_hook('fn_send_forum_subscriptions_start')) ? eval($hook) : null;
    if ($return != null) {
        return;
    }
    if ($forum_config['o_subscriptions'] != '1') {
        return;
    }
    // Get any subscribed users that should be notified (banned users are excluded)
    $query = array('SELECT' => 'u.id, u.email, u.notify_with_post, u.language', 'FROM' => 'users AS u', 'JOINS' => array(array('INNER JOIN' => 'forum_subscriptions AS fs', 'ON' => 'u.id=fs.user_id'), array('LEFT JOIN' => 'forum_perms AS fp', 'ON' => '(fp.forum_id=' . $topic_info['forum_id'] . ' AND fp.group_id=u.group_id)'), array('LEFT JOIN' => 'online AS o', 'ON' => 'u.id=o.user_id'), array('LEFT JOIN' => 'bans AS b', 'ON' => 'u.username=b.username')), 'WHERE' => 'b.username IS NULL AND (fp.read_forum IS NULL OR fp.read_forum=1) AND fs.forum_id=' . $topic_info['forum_id'] . ' AND u.id!=' . $topic_info['poster_id']);
    ($hook = get_hook('fn_send_forum_subscriptions_qr_get_users_to_notify')) ? eval($hook) : null;
    $result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
    $subscribers = array();
    while ($row = $forum_db->fetch_assoc($result)) {
        $subscribers[] = $row;
    }
    if (!empty($subscribers)) {
        if (!defined('FORUM_EMAIL_FUNCTIONS_LOADED')) {
            require FORUM_ROOT . 'include/email.php';
        }
        $notification_emails = array();
        // Loop through subscribed users and send e-mails
        foreach ($subscribers as $cur_subscriber) {
            // Is the subscription e-mail for $cur_subscriber['language'] cached or not?
            if (!isset($notification_emails[$cur_subscriber['language']]) && file_exists(FORUM_ROOT . 'lang/' . $cur_subscriber['language'] . '/mail_templates/new_topic.tpl')) {
                // Load the "new topic" template
                $mail_tpl = forum_trim(file_get_contents(FORUM_ROOT . 'lang/' . $cur_subscriber['language'] . '/mail_templates/new_topic.tpl'));
                // Load the "new topic full" template (with first post included)
                $mail_tpl_full = forum_trim(file_get_contents(FORUM_ROOT . 'lang/' . $cur_subscriber['language'] . '/mail_templates/new_topic_full.tpl'));
                // The first row contains the subject (it also starts with "Subject:")
                $first_crlf = strpos($mail_tpl, "\n");
                $mail_subject = forum_trim(substr($mail_tpl, 8, $first_crlf - 8));
                $mail_message = forum_trim(substr($mail_tpl, $first_crlf));
                $first_crlf = strpos($mail_tpl_full, "\n");
                $mail_subject_full = forum_trim(substr($mail_tpl_full, 8, $first_crlf - 8));
                $mail_message_full = forum_trim(substr($mail_tpl_full, $first_crlf));
                $mail_subject = str_replace('<forum_name>', '\'' . $topic_info['forum_name'] . '\'', $mail_subject);
                $mail_message = str_replace('<forum_name>', '\'' . $topic_info['forum_name'] . '\'', $mail_message);
                $mail_message = str_replace('<topic_starter>', $topic_info['poster'], $mail_message);
                $mail_message = str_replace('<topic_subject>', '\'' . $topic_info['subject'] . '\'', $mail_message);
                $mail_message = str_replace('<topic_url>', forum_link($forum_url['topic'], array($new_tid, sef_friendly($topic_info['subject']))), $mail_message);
                $mail_message = str_replace('<unsubscribe_url>', forum_link($forum_url['forum_unsubscribe'], array($topic_info['forum_id'], generate_form_token('forum_unsubscribe' . $topic_info['forum_id'] . $cur_subscriber['id']))), $mail_message);
                $mail_message = str_replace('<board_mailer>', sprintf($lang_common['Forum mailer'], $forum_config['o_board_title']), $mail_message);
                $mail_subject_full = str_replace('<forum_name>', '\'' . $topic_info['forum_name'] . '\'', $mail_subject_full);
                $mail_message_full = str_replace('<forum_name>', '\'' . $topic_info['forum_name'] . '\'', $mail_message_full);
                $mail_message_full = str_replace('<topic_starter>', $topic_info['poster'], $mail_message_full);
                $mail_message_full = str_replace('<topic_subject>', '\'' . $topic_info['subject'] . '\'', $mail_message_full);
                $mail_message_full = str_replace('<message>', $topic_info['message'], $mail_message_full);
                $mail_message_full = str_replace('<topic_url>', forum_link($forum_url['topic'], $new_tid), $mail_message_full);
                $mail_message_full = str_replace('<unsubscribe_url>', forum_link($forum_url['forum_unsubscribe'], array($topic_info['forum_id'], generate_form_token('forum_unsubscribe' . $topic_info['forum_id'] . $cur_subscriber['id']))), $mail_message_full);
                $mail_message_full = str_replace('<board_mailer>', sprintf($lang_common['Forum mailer'], $forum_config['o_board_title']), $mail_message_full);
                $notification_emails[$cur_subscriber['language']][0] = $mail_subject;
                $notification_emails[$cur_subscriber['language']][1] = $mail_message;
                $notification_emails[$cur_subscriber['language']][2] = $mail_subject_full;
                $notification_emails[$cur_subscriber['language']][3] = $mail_message_full;
                $mail_subject = $mail_message = $mail_subject_full = $mail_message_full = null;
            }
            // We have to double check here because the templates could be missing
            // Make sure the e-mail address format is valid before sending
            if (isset($notification_emails[$cur_subscriber['language']]) && is_valid_email($cur_subscriber['email'])) {
                if ($cur_subscriber['notify_with_post'] == '0') {
                    forum_mail($cur_subscriber['email'], $notification_emails[$cur_subscriber['language']][0], $notification_emails[$cur_subscriber['language']][1]);
                } else {
                    forum_mail($cur_subscriber['email'], $notification_emails[$cur_subscriber['language']][2], $notification_emails[$cur_subscriber['language']][3]);
                }
            }
        }
    }
    ($hook = get_hook('fn_send_forum_subscriptions_end')) ? eval($hook) : null;
}
             // Save new e-mail and activation key
             $query = array('UPDATE' => 'users', 'SET' => 'activate_string=\'' . $forum_db->escape($new_email) . '\', activate_key=\'' . $new_email_key . '\'', 'WHERE' => 'id=' . $id);
             ($hook = get_hook('pf_change_email_normal_qr_update_email_activation')) ? eval($hook) : null;
             $forum_db->query_build($query) or error(__FILE__, __LINE__);
             // Load the "activate e-mail" template
             $mail_tpl = forum_trim(file_get_contents(FORUM_ROOT . 'lang/' . $forum_user['language'] . '/mail_templates/activate_email.tpl'));
             // The first row contains the subject
             $first_crlf = strpos($mail_tpl, "\n");
             $mail_subject = forum_trim(substr($mail_tpl, 8, $first_crlf - 8));
             $mail_message = forum_trim(substr($mail_tpl, $first_crlf));
             $mail_message = str_replace('<username>', $forum_user['username'], $mail_message);
             $mail_message = str_replace('<base_url>', $base_url . '/', $mail_message);
             $mail_message = str_replace('<activation_url>', str_replace('&amp;', '&', forum_link($forum_url['change_email_key'], array($id, $new_email_key))), $mail_message);
             $mail_message = str_replace('<board_mailer>', sprintf($lang_common['Forum mailer'], $forum_config['o_board_title']), $mail_message);
             ($hook = get_hook('pf_change_email_normal_pre_activation_email_sent')) ? eval($hook) : null;
             forum_mail($new_email, $mail_subject, $mail_message);
             message(sprintf($lang_profile['Activate e-mail sent'], '<a href="mailto:' . forum_htmlencode($forum_config['o_admin_email']) . '">' . forum_htmlencode($forum_config['o_admin_email']) . '</a>'));
         }
     }
 }
 // Is this users own profile
 $forum_page['own_profile'] = $forum_user['id'] == $id ? true : false;
 // Setup form
 $forum_page['group_count'] = $forum_page['item_count'] = $forum_page['fld_count'] = 0;
 $forum_page['form_action'] = forum_link($forum_url['change_email'], $id);
 $forum_page['hidden_fields'] = array('form_sent' => '<input type="hidden" name="form_sent" value="1" />', 'csrf_token' => '<input type="hidden" name="csrf_token" value="' . generate_form_token($forum_page['form_action']) . '" />');
 // Setup form information
 $forum_page['frm_info'] = '<p class="important"><span>' . $lang_profile['E-mail info'] . '</span></p>';
 // Setup breadcrumbs
 $forum_page['crumbs'] = array(array($forum_config['o_board_title'], forum_link($forum_url['index'])), array(sprintf($lang_profile['Users profile'], $user['username'], $lang_profile['Section about']), forum_link($forum_url['profile_about'], $id)), $forum_page['own_profile'] ? $lang_profile['Change your e-mail'] : sprintf($lang_profile['Change user e-mail'], forum_htmlencode($user['username'])));
 ($hook = get_hook('pf_change_email_normal_pre_header_load')) ? eval($hook) : null;
Пример #5
0
            $mail_subject = forum_trim(substr($mail_tpl, 8, $first_crlf - 8));
            $mail_message = forum_trim(substr($mail_tpl, $first_crlf));
            // Do the generic replacements first (they apply to all e-mails sent out here)
            $mail_subject = str_replace('<username>', $username, $mail_subject);
            $mail_message = str_replace('<username>', $username, $mail_message);
            $mail_message = str_replace('<base_url>', $base_url . '/', $mail_message);
            $mail_message = str_replace('<warning_list>', str_replace('&amp;', '&', forum_link($forum_url['om_warnings_profile'], $user_id)), $mail_message);
            $mail_message = str_replace('<warning_help>', str_replace('&amp;', '&', forum_link($forum_url['help'], 'om_warnings')), $mail_message);
            $mail_message = str_replace('<message>', $message, $mail_message);
            $mail_message = str_replace('<board_mailer>', sprintf($lang_common['Forum mailer'], $forum_config['o_board_title']), $mail_message);
            if (!defined('FORUM_EMAIL_FUNCTIONS_LOADED')) {
                require FORUM_ROOT . 'include/email.php';
            }
            ($hook = get_hook('om_warnings_modify_message')) ? eval($hook) : null;
            // Send e-mail
            forum_mail($user_email, $mail_subject, $mail_message);
        }
        // Refresh user warnings cache
        om_warnings_refresh_user($topic_info['poster_id']);
        $forum_flash->add_info($lang_om_warnings['Warning reported']);
        ($hook = get_hook('om_warnings_report_pre_redirect')) ? eval($hook) : null;
        redirect($forum_page['redirect_page'], $lang_om_warnings['Warning reported']);
    }
}
// Setup form
$forum_page['group_count'] = $forum_page['item_count'] = $forum_page['fld_count'] = 0;
$forum_page['hidden_fields'] = array('form_sent' => '<input type="hidden" name="form_sent" value="1" />', 'csrf_token' => '<input type="hidden" name="csrf_token" value="' . generate_form_token($forum_page['form_action']) . '" />');
$om_warnings_types = om_warnings_get_warning_types();
if (!$om_warnings_types) {
    message($lang_om_warnings['Must define warning types']);
}
 private function register($user_info)
 {
     global $forum_config, $cookie_name, $forum_url, $lang_profile, $lang_profile, $forum_user;
     if (!isset($lang_profile)) {
         require FORUM_ROOT . 'lang/' . $forum_user['language'] . '/profile.php';
     }
     $new_id = 0;
     add_user($user_info, $new_uid);
     // Fill new user profile
     if ($new_uid > 1) {
         $this->user_update_profile($new_uid, $user_info['loginza_profile']);
     }
     // Add Loginza identity
     $this->user_add_identity($new_uid, $user_info['loginza_profile'], TRUE);
     // If we previously found out that the e-mail was banned
     if ($user_info['loginza_banned_email'] && $forum_config['o_mailing_list'] != '') {
         $mail_subject = 'Alert - Banned e-mail detected';
         $mail_message = 'User \'' . $user_info['username'] . '\' registered with banned e-mail address: ' . $user_info['email'] . "\n\n" . 'User profile: ' . forum_link($forum_url['user'], $new_uid) . "\n\n" . '-- ' . "\n" . 'Forum Mailer' . "\n" . '(Do not reply to this message)';
         ($hook = get_hook('rg_register_banned_email')) ? eval($hook) : null;
         forum_mail($forum_config['o_mailing_list'], $mail_subject, $mail_message);
     }
     // If we previously found out that the e-mail was a dupe
     $dupe_list = $user_info['loginza_dupe_list'];
     if (!empty($dupe_list) && $forum_config['o_mailing_list'] != '') {
         $mail_subject = 'Alert - Duplicate e-mail detected';
         $mail_message = 'User \'' . $user_info['username'] . '\' registered with an e-mail address that also belongs to: ' . implode(', ', $dupe_list) . "\n\n" . 'User profile: ' . forum_link($forum_url['user'], $new_uid) . "\n\n" . '-- ' . "\n" . 'Forum Mailer' . "\n" . '(Do not reply to this message)';
         ($hook = get_hook('rg_register_dupe_email')) ? eval($hook) : null;
         forum_mail($forum_config['o_mailing_list'], $mail_subject, $mail_message);
     }
     ($hook = get_hook('rg_register_pre_login_redirect')) ? eval($hook) : null;
     // Must the user verify the registration or do we log him/her in right now?
     if ($user_info['require_verification'] == TRUE) {
         message(sprintf($lang_profile['Reg e-mail'], '<a href="mailto:' . forum_htmlencode($forum_config['o_admin_email']) . '">' . forum_htmlencode($forum_config['o_admin_email']) . '</a>'));
     }
     // Login and redirect
     $this->user_login($new_uid);
 }