示例#1
0
if ($use_db) {
    // == 2. Initialize DB connection: ==
    require dirname(__FILE__) . '/_init_db.inc.php';
    // == 3. Initialize Modules: ==
    // Let the modules load/register what they need:
    $Timer->resume('init modules');
    modules_call_method('init');
    $Timer->pause('init modules');
    // == 4. Initialize Plugins: ==
    // At this point, the first hook is "SessionLoaded"
    // The dnsbl_antispam plugin is an example that uses this to check the user's IP against a list of DNS blacklists.
    load_class('plugins/model/_plugins.class.php', 'Plugins');
    /**
     * @global Plugins The Plugin management object
     */
    $Plugins = new Plugins();
    // This is the earliest event you can use
    $Plugins->trigger_event('AfterPluginsInit');
    // == 5. Initialize WWW HIT: ==
    if (!$is_cli) {
        require dirname(__FILE__) . '/_init_hit.inc.php';
    }
    $Plugins->trigger_event('AfterMainInit');
}
if (!$is_cli) {
    // Move user to suspect group by IP address
    antispam_suspect_user_by_IP();
}
$Timer->pause('_MAIN.inc');
// LOG with APM:
$Timer->log_duration('_MAIN.inc');
示例#2
0
        $UserSettings->set('created_fromIPv4', ip2int($Hit->IP), $new_User->ID);
        $UserSettings->set('user_domain', $Hit->get_remote_host(true), $new_User->ID);
        $UserSettings->set('user_browser', substr($Hit->get_user_agent(), 0, 200), $new_User->ID);
        $UserSettings->dbupdate();
        // Auto subscribe new user to current collection posts/comments:
        if ($auto_subscribe_posts || $auto_subscribe_comments) {
            // If at least one option is enabled
            $DB->query('REPLACE INTO T_subscriptions ( sub_coll_ID, sub_user_ID, sub_items, sub_comments )
					VALUES ( ' . $DB->quote($Blog->ID) . ', ' . $DB->quote($new_User->ID) . ', ' . $DB->quote(intval($auto_subscribe_posts)) . ', ' . $DB->quote(intval($auto_subscribe_comments)) . ' )');
        }
        // Send notification email about new user registrations to users with edit users permission
        $email_template_params = array('country' => $country, 'firstname' => $firstname, 'gender' => $gender, 'locale' => $locale, 'source' => $new_User->get('source'), 'trigger_url' => $session_registration_trigger_url, 'initial_hit' => $initial_hit, 'login' => $login, 'email' => $email, 'new_user_ID' => $new_User->ID);
        send_admin_notification(NT_('New user registration'), 'account_new', $email_template_params);
        $Plugins->trigger_event('AfterUserRegistration', array('User' => &$new_User));
        // Move user to suspect group by IP address. Make this move even if during the registration it was added to a trusted group.
        antispam_suspect_user_by_IP('', $new_User->ID, false);
        if ($Settings->get('newusers_mustvalidate')) {
            // We want that the user validates his email address:
            $inskin_blog = $inskin ? $blog : NULL;
            if ($new_User->send_validate_email($redirect_to, $inskin_blog)) {
                $activateinfo_link = 'href="' . get_activate_info_url(NULL, '&') . '"';
                $Messages->add(sprintf(T_('An email has been sent to your email address. Please click on the link therein to activate your account. <a %s>More info &raquo;</a>'), $activateinfo_link), 'success');
            } elseif ($demo_mode) {
                $Messages->add('Sorry, could not send email. Sending email in demo mode is disabled.', 'error');
            } else {
                $Messages->add(T_('Sorry, the email with the link to activate your account could not be sent.') . '<br />' . T_('Possible reason: the PHP mail() function may have been disabled on the server.'), 'error');
                // fp> TODO: allow to enter a different email address (just in case it's that kind of problem)
            }
        } else {
            // Display this message after successful registration and without validation email
            $Messages->add(T_('You have successfully registered on this site. Welcome!'), 'success');