Ejemplo n.º 1
0
 public static function mailer($route, $context = array(), $attachment = null)
 {
     return \Routerunner\Mail::mailer($route, $context, $attachment);
 }
Ejemplo n.º 2
0
             /*
             $address["open"] = "";
             $address["click"] = \runner::config("BASE");
             $address["unsubscribe"] = \runner::config("BASE") . "unsubscribe/";
             */
             $address["open"] = "<img alt='" . \runner::config("SITE") . "' src='" . \runner::config("BASE") . "nl/open/" . dechex($delivered) . "/" . $hash . "/" . "' style='display: none; width: 0; height: 0;'/>";
             $address["click"] = \runner::config("BASE") . "nl/click/" . dechex($delivered) . "/" . $hash . "/";
             $address["unsubscribe"] = \runner::config("BASE") . "nl/unsubscribe/" . dechex($delivered) . "/" . $hash . "/";
             $mail_content = urldecode($mail_raw);
             $mail_content_text = $mail_text;
             foreach ($address as $var => $value) {
                 $mail_content = str_replace('[' . $var . ']', $value, $mail_content);
                 $mail_content_text = str_replace('[' . $var . ']', $value, $mail_content_text);
             }
             // send mail
             \Routerunner\Mail::sender($address["email"], $header, $mail_content, null, $mail_content_text);
             $sent_email++;
             $sent_addresses[] = $address["email"];
         }
     } elseif (!(isset($address["email"]) && preg_match("~^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}\$~i", trim($address["email"])))) {
         $SQL_delete_address = 'UPDATE e_subscriber SET unsubscribe = 1 WHERE id = :id';
         \db::query($SQL_delete_address, array(':id' => $address["id"]));
     }
 }
 if ($SQL_addresses) {
     if (!\db::query($SQL_addresses, array(":campaign" => $cron["campaign_id"]))) {
         $close_cron = true;
     }
 }
 if ($close_cron) {
     $SQL = "UPDATE e_cron SET finish = :time WHERE id = :cron";
                $confirm = 'forgotten/' . implode('/', $user) . '/' . $secret;
                if (\Routerunner\Crypt::checker($confirm, $crypt_hash, $secret)) {
                    //\Routerunner\Crypt::delete_crypt($crypt_hash, $confirm);
                    $alphabet = "abcdefghijklmnpqrstuwxyzABCDEFGHIJKLMNPQRSTUWXYZ123456789";
                    $pwd = "";
                    for ($i = 0; $i < 8; $i++) {
                        $n = rand(0, strlen($alphabet) - 1);
                        $pwd .= substr($alphabet, $n, 1);
                    }
                    $user['pwd'] = $pwd;
                    $input = $user["email"] . ";" . $pwd;
                    $unique_salt = "4pp3t1z3r";
                    $unique_logarithm = "09";
                    $unique_method = "CRYPT_BLOWFISH";
                    $pwd_to_store = \Routerunner\Crypt::crypter($input, null, null, 0, $unique_salt, $unique_logarithm, $unique_method);
                    if (\Routerunner\Mail::mailer('/mail/newpwd', $user)) {
                        $SQL = 'UPDATE member SET pwd = :pwd WHERE id = :id AND email = :email';
                        $params = array(':pwd' => $pwd_to_store, ':id' => $user['id'], ':email' => $user['email']);
                        \db::query($SQL, $params);
                        $isOk = true;
                    }
                }
            }
        }
    }
    if ($isOk) {
        \runner::now("newpwd", "succeed");
    } else {
        \runner::now("newpwd", "error");
    }
}