示例#1
0
文件: login.php 项目: istrwei/Luna
                $mail_message = str_replace('<base_url>', get_base_url() . '/', $mail_message);
                $mail_message = str_replace('<board_mailer>', $luna_config['o_board_title'], $mail_message);
                // Loop through users we found
                while ($cur_hit = $db->fetch_assoc($result)) {
                    if ($cur_hit['last_email_sent'] != '' && time() - $cur_hit['last_email_sent'] < 3600 && time() - $cur_hit['last_email_sent'] >= 0) {
                        message(sprintf(__('This account has already requested a password reset in the past hour. Please wait %s minutes before requesting a new password again.', 'luna'), intval((3600 - (time() - $cur_hit['last_email_sent'])) / 60)), true);
                    }
                    // Generate a new password and a new password activation code
                    $new_password = random_pass(12);
                    $new_password_key = random_pass(8);
                    $db->query('UPDATE ' . $db->prefix . 'users SET activate_string=\'' . luna_hash($new_password) . '\', activate_key=\'' . $new_password_key . '\', last_email_sent = ' . time() . ' WHERE id=' . $cur_hit['id']) or error('Unable to update activation data', __FILE__, __LINE__, $db->error());
                    // 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>', get_base_url() . '/settings.php?id=' . $cur_hit['id'] . '&action=change_pass&key=' . $new_password_key, $cur_mail_message);
                    $cur_mail_message = str_replace('<new_password>', $new_password, $cur_mail_message);
                    luna_mail($email, $mail_subject, $cur_mail_message);
                }
                message(__('An email has been sent to the specified address with instructions on how to change your password. If it does not arrive you can contact the forum administrator at', 'luna') . ' <a href="mailto:' . luna_htmlspecialchars($luna_config['o_admin_email']) . '">' . luna_htmlspecialchars($luna_config['o_admin_email']) . '</a>.', true);
            } else {
                message(__('There is no user registered with the email address', 'luna') . ' ' . htmlspecialchars($email) . '.');
            }
        }
    }
}
// Try to determine if the data in HTTP_REFERER is valid (if not, we redirect to index.php after login)
if (!empty($_SERVER['HTTP_REFERER'])) {
    $redirect_url = validate_redirect($_SERVER['HTTP_REFERER'], null);
}
if (!isset($redirect_url)) {
    $redirect_url = get_base_url(true) . '/index.php';
} elseif (preg_match('%viewtopic\\.php\\?pid=(\\d+)$%', $redirect_url, $matches)) {
示例#2
0
文件: post.php 项目: istrwei/Luna
User "<username>" commented with banned email address: <email>

Comment URL: <comment_url>

--
<board_mailer> Mailer
(Do not reply to this message)', 'luna'));
            // The first row contains the subject
            $first_crlf = strpos($mail_tpl, "\n");
            $mail_subject = trim(substr($mail_tpl, 8, $first_crlf - 8));
            $mail_message = trim(substr($mail_tpl, $first_crlf));
            $mail_message = str_replace('<username>', $username, $mail_message);
            $mail_message = str_replace('<email>', $email, $mail_message);
            $mail_message = str_replace('<comment_url>', get_base_url() . '/viewtopic.php?pid=' . $new_pid . '#p' . $new_pid, $mail_message);
            $mail_message = str_replace('<board_mailer>', $luna_config['o_board_title'], $mail_message);
            luna_mail($luna_config['o_mailing_list'], $mail_subject, $mail_message);
        }
        // If the commenting user is logged in, increment his/her post count
        if (!$luna_user['is_guest']) {
            $db->query('UPDATE ' . $db->prefix . 'users SET num_posts=num_posts+1, last_post=' . $now . ' WHERE id=' . $luna_user['id']) or error('Unable to update user', __FILE__, __LINE__, $db->error());
            $tracked_topics = get_tracked_topics();
            $tracked_topics['topics'][$new_tid] = time();
            set_tracked_topics($tracked_topics);
        } else {
            $db->query('UPDATE ' . $db->prefix . 'online SET last_post=' . $now . ' WHERE ident=\'' . $db->escape(get_remote_address()) . '\'') or error('Unable to update user', __FILE__, __LINE__, $db->error());
        }
        redirect('viewtopic.php?pid=' . $new_pid . '#p' . $new_pid);
    }
}
// If a thread ID was specified in the url (it's a reply)
if ($tid) {
示例#3
0
Login at <login_url> to activate the account.

--
<board_mailer> Mailer
(Do not reply to this message)', 'luna'));
        // The first row contains the subject
        $first_crlf = strpos($mail_tpl, "\n");
        $mail_subject = trim(substr($mail_tpl, 8, $first_crlf - 8));
        $mail_message = trim(substr($mail_tpl, $first_crlf));
        $mail_subject = str_replace('<board_title>', $luna_config['o_board_title'], $mail_subject);
        $mail_message = str_replace('<base_url>', $luna_config['o_base_url'] . '/', $mail_message);
        $mail_message = str_replace('<username>', $username, $mail_message);
        $mail_message = str_replace('<password>', $password, $mail_message);
        $mail_message = str_replace('<login_url>', $luna_config['o_base_url'] . '/login.php', $mail_message);
        $mail_message = str_replace('<board_mailer>', $luna_config['o_board_title'], $mail_message);
        luna_mail($email1, $mail_subject, $mail_message);
    }
    // Regenerate the users info cache
    if (!defined('LUNA_CACHE_FUNCTIONS_LOADED')) {
        require LUNA_ROOT . 'include/cache.php';
    }
    generate_users_info_cache();
    redirect('backstage/users.php?user_created=true');
}
$page_title = array(luna_htmlspecialchars($luna_config['o_board_title']), __('Admin', 'luna'), __('Users', 'luna'));
define('LUNA_ACTIVE_PAGE', 'admin');
require 'header.php';
load_admin_nav('users', 'tools');
if (isset($_GET['saved'])) {
    echo '<div class="alert alert-success">' . __('Your settings have been saved.', 'luna') . '</div>';
}
示例#4
0
                        $val_showed = '0';
                    }
                    $db->query('INSERT INTO ' . $db->prefix . 'messages (shared_id, owner, subject, message, sender, receiver, sender_id, receiver_id, sender_ip, hide_smilies, commented, show_message, showed) VALUES(\'' . $r . '\', \'' . $dest['id'] . '\', \'' . $db->escape($p_subject) . '\', \'' . $db->escape($p_message) . '\', \'' . $db->escape($luna_user['username']) . '\', \'' . $db->escape($usernames_list) . '\', \'' . $luna_user['id'] . '\', \'' . $db->escape($ids_list) . '\', \'' . get_remote_address() . '\', \'' . $hide_smilies . '\', \'' . $now . '\', \'0\', \'' . $val_showed . '\')') or error('Unable to send the message.', __FILE__, __LINE__, $db->error());
                    $new_mp = $db->insert_id();
                    $db->query('UPDATE ' . $db->prefix . 'messages SET last_comment_id=' . $new_mp . ', last_comment=' . $now . ', last_commenter=\'' . $db->escape($luna_user['username']) . '\' WHERE shared_id=' . $r . ' AND show_message=1 AND owner=' . $dest['id']) or error('Unable to update the message.', __FILE__, __LINE__, $db->error());
                    if ($dest['id'] != $luna_user['id']) {
                        $db->query('UPDATE ' . $db->prefix . 'messages SET showed = 0 WHERE shared_id=' . $r . ' AND show_message=1 AND owner=' . $dest['id']) or error('Unable to update the message.', __FILE__, __LINE__, $db->error());
                    }
                    // E-mail notification
                    if ($luna_config['o_inbox_notification'] == '1' && $dest['notify_inbox'] == '1' && $dest['id'] != $luna_user['id']) {
                        $mail_message = str_replace('<inbox_url>', $luna_config['o_base_url'] . '/viewinbox.php?tid=' . $r . '&mid=' . $new_mp . '&box=inbox', $mail_message);
                        $mail_message_full = str_replace('<inbox_url>', $luna_config['o_base_url'] . '/viewinbox.php?tid=' . $r . '&mid=' . $new_mp . '&box=inbox', $mail_message_full);
                        if ($dest['notify_inbox_full'] == '1') {
                            luna_mail($dest['email'], $mail_subject_full, $mail_message_full);
                        } else {
                            luna_mail($dest['email'], $mail_subject, $mail_message);
                        }
                    }
                }
                $db->query('UPDATE ' . $db->prefix . 'users SET last_comment=' . $now . ' WHERE id=' . $luna_user['id']) or error('Unable to update user', __FILE__, __LINE__, $db->error());
            }
            redirect('inbox.php');
        }
    }
} else {
    // To user(s)
    if (isset($_GET['uid'])) {
        $users_id = explode('-', $_GET['uid']);
        $users_id = array_map('intval', $users_id);
        foreach ($users_id as $k => $v) {
            if ($v <= 0) {
示例#5
0
To change your email address, please visit the following page:
<activation_url>

--
<board_mailer> Mailer
(Do not reply to this message)', 'luna'));
        // The first row contains the subject
        $first_crlf = strpos($mail_tpl, "\n");
        $mail_subject = trim(substr($mail_tpl, 8, $first_crlf - 8));
        $mail_message = trim(substr($mail_tpl, $first_crlf));
        $mail_message = str_replace('<username>', $luna_user['username'], $mail_message);
        $mail_message = str_replace('<base_url>', get_base_url(), $mail_message);
        $mail_message = str_replace('<activation_url>', get_base_url() . '/settings.php?action=change_email&id=' . $id . '&key=' . $new_email_key, $mail_message);
        $mail_message = str_replace('<board_mailer>', $luna_config['o_board_title'], $mail_message);
        luna_mail($new_email, $mail_subject, $mail_message);
        message(__('An email has been sent to the specified address with instructions on how to activate the new email address. If it doesn\'t arrive you can contact the forum administrator at', 'luna') . ' <a href="mailto:' . luna_htmlspecialchars($luna_config['o_admin_email']) . '">' . luna_htmlspecialchars($luna_config['o_admin_email']) . '</a>.', true);
    }
    $page_title = array(luna_htmlspecialchars($luna_config['o_board_title']), __('Profile', 'luna'), __('Change email address', 'luna'));
    $required_fields = array('req_new_email' => __('New email', 'luna'), 'req_password' => __('Password', 'luna'));
    $focus_element = array('change_email', 'req_new_email');
    define('FORUM_ACTIVE_PAGE', 'me');
    require load_page('header.php');
    require get_view_path('me-change_email.tpl.php');
} elseif ($action == 'upload_avatar' || $action == 'upload_avatar2') {
    if ($luna_config['o_avatars'] == '0') {
        message(__('The administrator has disabled avatar support.', 'luna'));
    }
    if ($luna_user['id'] != $id && !$luna_user['is_admmod']) {
        message(__('You do not have permission to access this page.', 'luna'), false, '403 Forbidden');
    }