Ejemplo n.º 1
0
                if (in_array($conf['guest_id'], $collection)) {
                    array_push($page['errors'], l10n('UAM_No_validation_for_Guest'));
                }
                if ($conf['guest_id'] != $conf['default_user_id'] and in_array($conf['default_user_id'], $collection)) {
                    array_push($page['errors'], l10n('UAM_No_validation_for_default_user'));
                }
                if (in_array($conf['webmaster_id'], $collection)) {
                    array_push($page['errors'], l10n('UAM_No_validation_for_Webmaster'));
                }
                if (in_array($user['id'], $collection)) {
                    array_push($page['errors'], l10n('UAM_No_validation_for_your_account'));
                }
                if (count($page['errors']) == 0) {
                    foreach ($collection as $user_id) {
                        ManualValidation($user_id);
                        validation_mail($user_id);
                    }
                    array_push($page['infos'], l10n_dec('UAM_%d_Validated_User', 'UAM_%d_Validated_Users', count($collection)));
                    $page['filtered_users'] = get_unvalid_user_list();
                }
            }
            // +-----------------------------------------------------------------------+
            // |                              groups list                              |
            // +-----------------------------------------------------------------------+
            global $uam_groups;
            // used in callback
            $uam_groups[-1] = '------------';
            $query = '
SELECT id, name
FROM ' . GROUPS_TABLE . '
ORDER BY name ASC
Ejemplo n.º 2
0
/**
 * Triggered on init
 * 
 * Check the key and display a message
 */
function UAM_ConfirmMail()
{
    global $conf;
    include_once PHPWG_ROOT_PATH . 'include/functions_mail.inc.php';
    if (isset($_GET['key']) and isset($_GET['userid'])) {
        global $user, $lang, $conf, $page;
        $key = $_GET['key'];
        $userid = $_GET['userid'];
        $conf_UAM_ConfirmMail = unserialize($conf['UserAdvManager_ConfirmMail']);
        $conf_UAM = unserialize($conf['UserAdvManager']);
        $query = '
SELECT ' . USERS_TABLE . '.username
FROM ' . USERS_TABLE . '
WHERE (' . USERS_TABLE . '.id =' . $userid . ')
;';
        $result = pwg_db_fetch_assoc(pwg_query($query));
        if (VerifyConfirmMail($key)) {
            if (isset($conf_UAM['CONFIRM_MAIL']) and $conf_UAM['CONFIRM_MAIL'] == 'local') {
                validation_mail($userid);
            }
            // We have to get the user's language in database
            // ----------------------------------------------
            $query = '
SELECT language
FROM ' . USER_INFOS_TABLE . '
WHERE ' . USER_INFOS_TABLE . '.user_id =' . $userid . '
;';
            $data = pwg_db_fetch_assoc(pwg_query($query));
            // Check if user is already registered (profile changing) - If not (new registration), language is set to current gallery language
            // -------------------------------------------------------------------------------------------------------------------------------
            if (empty($data)) {
                // And switch gallery to this language before using personalized and multilangual contents
                // ---------------------------------------------------------------------------------------
                $language = pwg_get_session_var('lang_switch', $user['language']);
                switch_lang_to($language);
            } else {
                // And switch gallery to this language before using personalized and multilangual contents
                // ---------------------------------------------------------------------------------------
                switch_lang_to($data['language']);
                load_language('plugin.lang', UAM_PATH);
            }
            if (isset($conf_UAM_ConfirmMail['CONFIRMMAIL_CUSTOM_TXT1']) and !empty($conf_UAM_ConfirmMail['CONFIRMMAIL_CUSTOM_TXT1'])) {
                // Management of Extension flags ([username], [mygallery], [myurl])
                // ----------------------------------------------------------------
                $patterns[] = '#\\[username\\]#i';
                $replacements[] = $result['username'];
                $patterns[] = '#\\[mygallery\\]#i';
                $replacements[] = $conf['gallery_title'];
                $patterns[] = '#\\[myurl\\]#i';
                $replacements[] = get_gallery_home_url();
                if (function_exists('get_user_language_desc')) {
                    $login_link = '<a href="' . get_gallery_home_url() . '" style="font-weight: bold;text-align: center;color: #FF0000;text-transform: uppercase;">' . l10n('UAM_Follow this link to access the gallery') . '</a>';
                    $custom_text = get_user_language_desc(preg_replace($patterns, $replacements, $conf_UAM_ConfirmMail['CONFIRMMAIL_CUSTOM_TXT1'])) . "<br/><br/>" . $login_link;
                } else {
                    $custom_text = l10n(preg_replace($patterns, $replacements, $conf_UAM_ConfirmMail['CONFIRMMAIL_CUSTOM_TXT1']));
                }
                $page['infos'][] = $custom_text;
            }
        } else {
            if (isset($conf_UAM_ConfirmMail['CONFIRMMAIL_CUSTOM_TXT2']) and !empty($conf_UAM_ConfirmMail['CONFIRMMAIL_CUSTOM_TXT2'])) {
                // Management of Extension flags ([username], [mygallery], [myurl])
                // ----------------------------------------------------------------
                $patterns[] = '#\\[username\\]#i';
                $replacements[] = $result['username'];
                $patterns[] = '#\\[mygallery\\]#i';
                $replacements[] = $conf['gallery_title'];
                $patterns[] = '#\\[myurl\\]#i';
                $replacements[] = get_gallery_home_url();
                if (function_exists('get_user_language_desc')) {
                    $custom_text = get_user_language_desc(preg_replace($patterns, $replacements, $conf_UAM_ConfirmMail['CONFIRMMAIL_CUSTOM_TXT2']));
                } else {
                    $custom_text = l10n(preg_replace($patterns, $replacements, $conf_UAM_ConfirmMail['CONFIRMMAIL_CUSTOM_TXT2']));
                }
                $page['errors'][] = $custom_text;
            }
        }
    }
}