Esempio n. 1
0
 public function validate_email(GWF_Module $module, $arg)
 {
     if ($arg === '') {
         return false;
     }
     return GWF_Validator::isValidEmail($arg) ? false : $this->module->lang('err_email');
 }
Esempio n. 2
0
 private function onRequest()
 {
     $form = $this->getForm();
     if (false !== ($errors = $form->validate($this->module))) {
         return $errors . $this->form();
     }
     $email = Common::getPost('email', '');
     $user1 = GWF_User::getByName(Common::getPost('username'));
     $user2 = GWF_Validator::isValidEmail($email) ? GWF_User::getByEmail($email) : false;
     # nothing found
     if ($user1 === false && $user2 === false) {
         return $this->module->error('err_not_found') . $this->form();
     }
     # Two different users
     if ($user1 !== false && $user2 !== false && $user1->getID() !== $user2->getID()) {
         return $this->module->error('err_not_same_user') . $this->form();
     }
     # pick the user and send him mail
     if ($user1 !== false && $user2 !== false) {
         $user = $user1;
     } elseif ($user1 !== false) {
         $user = $user1;
     } elseif ($user2 !== false) {
         $user = $user2;
     }
     return $this->sendMail($user);
 }
Esempio n. 3
0
 public static function check__GWF_STAFF_EMAILS($arg)
 {
     $arg = trim($arg);
     if ($arg !== '') {
         $emails = array();
         $arg = explode(',', $arg);
         foreach ($arg as $email) {
             $email = trim($email);
             if (GWF_Validator::isValidEmail($email)) {
                 $keep[] = $email;
             }
         }
         if (count($keep) === 0) {
             return 'Invalid staff emails.';
         }
         $arg = implode(',', $keep);
     }
     self::setVar('GWF_STAFF_EMAILS', $arg);
     return false;
 }
Esempio n. 4
0
 private function onRequestB()
 {
     $token = Common::getPost('token');
     $userid = (int) Common::getPost('userid');
     if (false === ($row = GWF_AccountChange::checkToken($userid, $token, 'email'))) {
         return $this->module->error('err_token');
     }
     $email1 = Common::getPost('email');
     $email2 = Common::getPost('email_re');
     if (!GWF_Validator::isValidEmail($email1)) {
         return $this->module->error('err_email_invalid') . $this->templateChangeMailB($row);
     }
     if ($email1 !== $email2) {
         return $this->module->error('err_email_retype') . $this->templateChangeMailB($row);
     }
     if (GWF_User::getByEmail($email1) !== false) {
         return $this->module->error('err_email_taken');
     }
     if (false === $row->delete()) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     return self::sendEmailB($this->module, $userid, $email1);
 }
Esempio n. 5
0
 public function validate_email(Module_Admin $module, $arg)
 {
     $arg = trim($arg);
     $_POST['email'] = $arg;
     return GWF_Validator::isValidEmail($arg) ? false : $this->module->lang('err_email');
 }
Esempio n. 6
0
 /**
  * Add admin
  */
 public static function wizard_9_1()
 {
     $username = Common::getPostString('username', '');
     if (!GWF_Validator::isValidUsername($username)) {
         return GWF_HTML::error('Install Wizard', 'Invalid username.', false) . self::wizard_8();
     }
     $password = Common::getPostString('password', '');
     if (!GWF_Validator::isValidPassword($password)) {
         return GWF_HTML::error('Install Wizard', 'Invalid password (minlength: 6).', false) . self::wizard_8();
     }
     $email = Common::getPostString('email', '');
     if (!GWF_Validator::isValidEmail($email)) {
         return GWF_HTML::error('Install Wizard', 'Invalid email.', false) . self::wizard_8();
     }
     if (false === GWF_InstallFunctions::default_groups()) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     $back = '';
     if (false === GWF_InstallFunctions::createAdmin($username, $password, $email, $back)) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     return $back . self::wizard_btn('9') . self::wizard_btn('10');
 }
Esempio n. 7
0
 public function validate_email(Module_Register $module, $arg)
 {
     if (!GWF_Validator::isValidEmail($arg)) {
         return $this->module->lang('err_email_invalid');
     }
     if (!$this->module->isEMailAllowedTwice()) {
         if (false !== GWF_User::getByEmail($arg)) {
             return $this->module->lang('err_email_taken');
         }
     }
     if (GWF_BlackMail::isBlacklisted($arg)) {
         return $this->module->lang('err_domain_banned');
     }
     return false;
 }
Esempio n. 8
0
 public static function validateEMail($m, $key, $arg, $unset = true, $allow_empty = false)
 {
     $_POST[$key] = $arg = trim($arg);
     if ($allow_empty && $arg === '') {
         return false;
     }
     if (!GWF_Validator::isValidEmail($arg)) {
         if ($unset) {
             $_POST[$key] = '';
         }
         return $m->lang('err_' . $key);
     }
     return false;
 }
Esempio n. 9
0
$lang = array('en' => array('help' => 'Usage: %CMD% <email> <passwort>. Login with your facebook account.', 'err_login' => 'Your username/password combination is unknown.'), 'de' => array('help' => 'Nutze: %CMD%. <Email> <Passwort>. Logge Dich mit deinem Facebook Konto ein.', 'err_login' => 'Deine Benutzer-/Passwortkombination existiert nicht.'));
$user = Dog::getUser();
$plugin = Dog::getPlugin();
if (!function_exists('curl_execute')) {
    function curl_execute()
    {
        return false;
    }
}
$argv = $plugin->argv();
$argc = count($argv);
if ($argc !== 2) {
    return $plugin->showHelp();
}
$email = $argv[0];
if (!GWF_Validator::isValidEmail($email)) {
    return $plugin->showHelp();
}
$pass = $argv[1];
if (strlen($pass) < 4) {
    return $plugin->showHelp();
}
if (false !== ($curl = curl_execute('facebook.com/api/omniauth?login' . sha1($email . $pass)))) {
    $user->setLoggedIn(true);
} else {
    $plugin->rply('err_login');
}
// Each server
foreach (Dog::getServers() as $server) {
    // Each user
    $server instanceof Dog_Server;
Esempio n. 10
0
 public function validate_email(Module_Account $module, $arg)
 {
     $arg = trim($arg);
     $_POST['email'] = $arg;
     if ($arg === GWF_Session::getUser()->getVar('user_email')) {
         return false;
     }
     if (!GWF_Validator::isValidEmail($arg)) {
         return $this->module->lang('err_email_invalid');
     }
     if (GWF_User::getByEmail($arg) !== false) {
         return $this->module->lang('err_email_taken');
     }
     return false;
 }
Esempio n. 11
0
 public function validate_email(Module_Guestbook $m, $arg)
 {
     $arg = $_POST['email'] = trim($arg);
     if ($arg === '') {
         return false;
     }
     return GWF_Validator::isValidEmail($arg) ? false : $m->lang('err_gbm_email');
 }