Automatically exported from code.google.com/p/planningalerts
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

15 роки тому
15 роки тому
15 роки тому
15 роки тому
15 роки тому
15 роки тому
15 роки тому
15 роки тому
15 роки тому
15 роки тому
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. require_once('tools_ini.php');
  3. require_once('application.php');
  4. require_once('DB.php');
  5. //initialise
  6. $news_mailer = new news_mailer();
  7. $news_mailer->run();
  8. //class
  9. class news_mailer {
  10. //Run
  11. function run (){
  12. $db = DB::connect(DB_CONNECTION_STRING);
  13. //Grab all the users
  14. $sql = "select distinct email
  15. from user
  16. where confirmed = 1";
  17. $user_results = $db->getAll($sql);
  18. print "Found " . sizeof($user_results) . " to email ";
  19. if(sizeof($user_results) > 0){
  20. //Loop though users
  21. for ($i=0; $i < sizeof($user_results); $i++){
  22. //Smarty template
  23. $smarty = new Smarty;
  24. $smarty->force_compile = true;
  25. $smarty->compile_dir = SMARTY_COMPILE_DIRECTORY;
  26. //Get the email text
  27. $email_text = $smarty->fetch(SMARTY_TEMPLATE_DIRECTORY . 'news_mail.tpl');
  28. //Send the email
  29. if($email_text !=""){
  30. // send_text_email($user_results[$i][0], EMAIL_FROM_NAME, EMAIL_FROM_ADDRESS, "StreetWire - a new service from PlanningAlerts", $email_text);
  31. }
  32. }
  33. }
  34. }
  35. }
  36. ?>