<?php ini_set('max_execution_time', '0'); ini_set('memory_limit', '512M'); require_once '../classes/config.php'; require_once '../classes/log.php'; $log = new log('massend-test-' . SERVER . '-%d%m%Y[%H].log', 'w'); $log->writeln('------------ BEGIN hourly (start time: ' . date('d.m.Y H:i:s') . ') -----'); require_once '../classes/stdf.php'; require_once '../classes/spam.php'; $spam = new spam(); $log->TRACE($spam->frlLowFundsOffers2());
<?php exit; // пользуемся /siteadmin/admin/ if (!is_admin_sm()) { exit; } $action = trim($_GET['action']); if (!$action) { $action = trim($_POST['action']); } require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/spam.php'; $sm = new spam(); switch ($action) { case 'post_msg': $msg = change_q($_POST['msg']); $name = change_q($_POST['name']); $role = $_POST['role']; switch ($role) { case 'npro': $irole = 0; break; case 'pro': $irole = 1; break; case 'emp': $irole = 2; break; } $error = $sm->Update($msg, $name, $irole); if (!$error) {
*************************************************************************** */ require "../spam.php"; require "config.php"; $db = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASS); mysql_select_db(MYSQL_DB, $db); /** * * Because the system do not manage a method where you * can save the data, you must define a function which recives * the wanted "n-grams" and return and array which is * "n-grams" and percent of accuracy (what its learn with example_trainer). * In this example those datas are loaded from mysql. * */ $spam = new spam("handler"); /**/ $sql = mysql_query("select * from examples", $db); echo "<h1>Spam test</h1>"; print '<table cellpadding="5" cellspacing="0" width="100%">'; echo "<tr align='center'>"; echo "<td><h1>Text</h1></td>"; echo "<td><h1>Expected</h1></td>"; echo "<td><h1>New Algorithm</h1></td>"; echo "<td><h1>Old Algorithm</h1></td>"; echo "</tr>"; $i = 0; while ($text = mysql_fetch_array($sql)) { $score1 = number_format($spam->isItSpam_v2($text[0], 'spam'), 2); $score2 = number_format($spam->isItSpam($text[0], 'spam'), 2); echo "<tr bgcolor='" . (++$i % 2 == 0 ? 'white' : '#c0c0c0') . "'>";
/** * Отправляет сообщение от администрации группе юзеров, определенных в модуле /siteadmin/admin/. Вызвается из hourly.php. * * Чтобы сообщение было отправлено нужно его занести в таблицу messages с полем to_id равным 0 и, * по необходимости, определить какому виду пользователей нужно отправить сообщение. * Кроме того, далее необходимо зарегистрировать данное сообщение в таблице переменных variables, переменной * с именем 'admin_message_id' со значением идентификатором отправляемого сообщения. * Отправляет уведомление о новом сообщении в личке ("Мои контакты"). * * @return string возможная ошибка */ public function SendMasssending() { require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/spam.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/messages.php'; if (!($message_id = spam::GetMasssendingMessageID())) { return "Не зарегистрировано ни одного сообщения от администрации (таблица 'variables', имя переменной 'admin_message_id')."; } if (!($message = messages::GetMessage($message_id))) { return 'Тело сообщения отсутствует.'; } $this->subject = 'Новое сообщение на FL.ru'; $msg_text = "\n<a href='{$GLOBALS['host']}/users/{$message['from_login']}{$this->_addUrlParams('b')}'>{$message['from_uname']} {$message['from_usurname']}</a> [<a href='{$GLOBALS['host']}/users/{$message['from_login']}{$this->_addUrlParams('b')}'>{$message['from_login']}</a>]\nнаправил(а) вам новое сообщение на сайте FL.ru.<br />\n<br />\n---------- \n<br />\n" . $this->ToHtml(LenghtFormatEx(strip_tags($message['msg_text']), 300)) . "\n<br />\n<br />\n<br />\n<a href='{$GLOBALS['host']}/contacts/?from={$message['from_login']}{$this->_addUrlParams('b', '&')}'>{$GLOBALS['host']}/contacts/?from={$message['from_login']}</a>\n<br />\n<br />\n------------\n"; // атачи по идее не нужны в письме в массовых рассылках, пусть читают на сайте :) но если вдруг... то включить это $attaches = array(); /*if ($message['attach']) { foreach($message['attach'] as $a) { $attaches[] = new CFile($a['path'].$a['fname']); } $attaches = $this->CreateAttach($attaches); }*/ if (!$this->Connect()) { return 'Невозможно соеденится с SMTP сервером'; } for ($i = 0; $users = messages::GetZeroMessageUsers($message['from_id'], $message_id, 1000, $i * 1000, false); ++$i) { foreach ($users as $ikey => $user) { if ($user['email'] && substr($user['subscr'], 12, 1) == '1') { $this->recipient = $user['uname'] . ' ' . $user['usurname'] . ' [' . $user['login'] . '] <' . $user['email'] . '>'; $this->message = $this->GetHtml($user['uname'], $msg_text, array('header' => 'default', 'footer' => 'default'), array('login' => $user['login'])); $this->SmtpMail('text/html', $attaches); } } } // отправляем сообщение автору рассылки $this->subject = 'Ваша заявка на рассылку прошла модерацию'; $this->recipient = $message['from_uname'] . ' ' . $message['from_usurname'] . ' [' . $message['from_login'] . '] <' . $message['from_email'] . '>'; $attaches = ''; if ($message['attach']) { foreach ($message['attach'] as $a) { $attaches .= ", <a href='" . WDCPREFIX . "/{$a['path']}{$a['fname']}{$this->_addUrlParams('b')}'>{$a['fname']}</a>"; } } $msg_text = $this->ToHtml($message['msg_text']); $body = "Ваша заявка на рассылку была рассмотрена и одобрена модераторами сайта FL.ru (3). \n Фрилансерам выбранных вами специализаций будет отправлено сообщение следующего содержания:</br>\n ---<br/>\n {$msg_text}<br/>\n ---<br/>"; $this->message = $this->GetHtml($message['from_uname'], $body, array('header' => 'default', 'footer' => 'simple')); $this->SmtpMail('text/html'); return ''; }
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR * * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * * OTHER DEALINGS IN THE SOFTWARE. * *************************************************************************** */ require "../spam.php"; require "config.php"; $db = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASS); mysql_select_db(MYSQL_DB, $db); /** * Because the system do not manage a method where you can save the data, you must define a function which recives * the wanted "n-grams" and return and array which is "n-grams" and percent of accuracy (what its learn with example_trainer). * In this example those datas are loaded from mysql. */ $spam = new spam("handler"); /**/ $texts = array("Phentermine", "Buy cheap xxx", "Really nice post", "Viagra", "This a large text, it is not spam, but because the training set\nare small sentenses, it may be marked as spam. You can solve this problem with a largest sentences on the training set."); echo "<h1>Spam test</h1>"; foreach ($texts as $text) { echo "<em><strong>{$text}</strong></em> has an accuraccy of <b>" . $spam->isItSpam_v2($text, 'spam') . "%</b> spam<hr>"; } echo "<h1>Ham test</h1>"; foreach ($texts as $text) { echo "<em><strong>{$text}</strong></em> has an accuraccy of <b>" . $spam->isItSpam_v2($text, '1') . "%</b> ham<hr>"; } /** * Callback function * * This is function is called by the classifier class, and it must return all the n-grams. *