Esempio n. 1
0
 public static function getInstance()
 {
     if (!self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Esempio n. 2
0
            unset( $_SESSION['captcha'] );
        }
    */
    if (!count($errors)) {
        // Generate a random password
        $new_pass = $users->generateRandomString(8);
        $md5_password = md5($new_pass);
        $result = $users->createUser($groups_id, $active, $username, $md5_password, $display_name, $email, CAT_Users::get_home_folder());
        if (!is_bool($result)) {
            $errors[] = $val->lang()->translate('Unable to create user account. Please contact the administrator.');
        } else {
            // Setup email to send
            $mail_to = $email;
            $mail_subject = $val->lang()->translate('Your login details...');
            $mail_message = $parser->get('account_signup_mail_body', array('LOGIN_DISPLAY_NAME' => $display_name, 'LOGIN_WEBSITE_TITLE' => WEBSITE_TITLE, 'LOGIN_NAME' => $username, 'LOGIN_PASSWORD' => $new_pass, 'SERVER_EMAIL' => SERVER_EMAIL));
            // Try sending the email
            if (!CAT_Helper_Mail::getInstance()->sendMail(SERVER_EMAIL, $mail_to, $mail_subject, $mail_message, CATMAILER_DEFAULT_SENDERNAME)) {
                $database->query("DELETE FROM `:prefix:users` WHERE username=:name", array('name' => $username));
                $errors[] = $val->lang()->translate('Unable to email password, please contact system administrator');
            } else {
                $message = $val->lang()->translate('Registration process completed!<br /><br />You should receive an eMail with your login data. If not, please contact {{SERVER_EMAIL}}.', array('SERVER_EMAIL' => SERVER_EMAIL));
                $form = false;
            }
        }
    }
    if (count($errors)) {
        $message = implode('<br />', $errors);
    }
}
$parser->output('account_signup_form', array('form' => $form, 'captcha' => CAT_Helper_Captcha::get(), 'message' => $message, 'ENABLED_ASP' => ENABLED_ASP, 'username' => $val->sanitizePost('username'), 'display_name' => $val->sanitizePost('display_name'), 'email' => $val->sanitizePost('email')));
Esempio n. 3
0
function call_captcha($action = 'all', $style = '', $sec_id = '')
{
    return CAT_Helper_Captcha::show($action, $style, $sec_id);
}