<?php
/***************************************************************************
- * Copyright (C) 2003-2009 Polytechnique.org *
+ * Copyright (C) 2003-2010 Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
} else {
$res = XDB::query("SELECT * FROM newsletter WHERE bits='new'");
if (!$res->numRows()) {
- Newsletter::create();
+ NewsLetter::create();
}
- $res = XDB::query("SELECT * FROM newsletter WHERE bits='new'");
+ $res = XDB::query("SELECT * FROM newsletter WHERE bits='new' ORDER BY id DESC LIMIT 1");
}
if ($res->numRows() != 1) {
throw new MailNotFound();
$user = is_null($uid) ? S::v('uid') : $uid;
$res = XDB::query("SELECT 1
FROM newsletter_ins
- WHERE user_id={?}", $user);
+ WHERE uid={?}", $user);
return $res->fetchOneCell();
}
{
$user = is_null($uid) ? S::v('uid') : $uid;
XDB::execute("DELETE FROM newsletter_ins
- WHERE user_id={?}", $user);
+ WHERE uid={?}", $user);
}
static public function subscribe($uid = null)
{
$user = is_null($uid) ? S::v('uid') : $uid;
- XDB::execute("REPLACE INTO newsletter_ins (user_id,last)
+ XDB::execute("REPLACE INTO newsletter_ins (uid,last)
VALUES ({?}, 0)", $user);
}
// }}}
// {{{ function getLinkIps()
- public function getLinkIps(&$gethostbyname_count)
+ public function getLinkIps(&$blacklist_host_resolution_count)
{
$matches = $this->parseUrlsFromArticle();
$article_ips = array();
list(, $host) = explode('@', $match);
}
- if ($gethostbyname_count < $globals->mail->blacklist_host_resolution_limit) {
+ if ($blacklist_host_resolution_count >= $globals->mail->blacklist_host_resolution_limit) {
break;
}
- if ($host != $globals->mail->alias_dom && $host != $globals->mail->alias_dom2
- && $host != $globals->mail->domain && $host != $globals->mail->domain2) {
+ if (!preg_match('/^(' . str_replace(' ', '|', $globals->mail->domain_whitelist) . ')$/i', $host)) {
$article_ips = array_merge($article_ips, array(gethostbyname($host) => $host));
- ++$gethostbyname_count;
+ ++$blacklist_host_resolution_count;
}
}
}