Чистка + подготовка к Zend Mail

Удаление некоторых неиспользуемых функций; подготока к переделке класса отправки электронной почты силами ZF.
This commit is contained in:
Exile 2014-12-07 23:33:17 +03:00
commit 64044cf270
5 changed files with 23 additions and 128 deletions

View file

@ -25,7 +25,7 @@ require(BB_ROOT . 'library/Zend/Loader/StandardAutoloader.php');
$loader = new StandardAutoloader(array('autoregister_zf' => true));
$loader->register();
// ZF use
// ZF global use
use Zend\Json;
$server_protocol = ($bb_cfg['cookie_secure']) ? 'https://' : 'http://';

View file

@ -379,6 +379,18 @@ $bb_cfg['smtp_port'] = 25; // SMTP server port
$bb_cfg['smtp_username'] = ''; // enter a username if your SMTP server requires it
$bb_cfg['smtp_password'] = ''; // enter a password if your SMTP server requires it
$bb_cfg['smtp'] = array(
'name' => 'yandex.ru',
'host' => 'smtp.yandex.ru',
'port' => 465,
'connection_class' => 'login',
'connection_config' => array(
'username' => '',
'password' => '',
'ssl' => 'ssl',
),
);
$bb_cfg['board_email'] = "noreply@$domain_name"; // admin email address
$bb_cfg['board_email_form'] = false; // can users send email to each other via board
$bb_cfg['board_email_sig'] = ''; // this text will be attached to all emails the board sends
@ -494,8 +506,8 @@ $bb_cfg['spam_filter_file_path'] = ''; // BB_PATH .'/misc/spam_filte
$bb_cfg['autocorrect_wkl'] = true; // autocorrect wrong keyboard layout
// Posting
$bb_cfg['prevent_multiposting'] = true; // replace "reply" with "edit last msg" if user (not admin or mod) is last topic poster
$bb_cfg['max_smilies'] = 10; // Максимальное число смайлов в посте (0 - без ограничения)
$bb_cfg['prevent_multiposting'] = true; // replace "reply" with "edit last msg" if user (not admin or mod) is last topic poster
$bb_cfg['max_smilies'] = 10; // Максимальное число смайлов в посте (0 - без ограничения)
// PM
$bb_cfg['privmsg_disable'] = false; // отключить систему личных сообщений на форуме

View file

@ -2,6 +2,8 @@
if (!defined('BB_ROOT')) die(basename(__FILE__));
use Zend\Mail;
class emailer
{
var $msg, $subject, $extra_headers;

View file

@ -950,7 +950,7 @@ function humn_size ($size, $rounder = null, $min = null, $space = ' ')
}
else
{
for ($i=1, $cnt=count($sizes); ($i < $cnt && $size >= 1024); $i++)
for ($i = 1, $cnt = count($sizes); ($i < $cnt && $size >= 1024); $i++)
{
$size = $size / 1024;
$ext = $sizes[$i];
@ -1075,6 +1075,7 @@ function set_var (&$result, $var, $type, $multibyte = false, $strip = true)
$result = ($strip) ? stripslashes($result) : $result;
}
}
/**
* request_var
*
@ -1748,18 +1749,6 @@ function generate_pagination ($base_url, $num_items, $per_page, $start_item, $ad
return $pagination;
}
//
// This does exactly what preg_quote() does in PHP 4-ish
// If you just need the 1-parameter preg_quote call, then don't bother using this.
//
function bb_preg_quote ($str, $delimiter)
{
$text = preg_quote($str);
$text = str_replace($delimiter, '\\' . $delimiter, $text);
return $text;
}
//
// Obtain list of naughty words and build preg style replacement arrays for use by the
// calling script, note that the vars are passed as references this just makes it easier
@ -1780,7 +1769,6 @@ function obtain_word_list (&$orig_word, &$replacement_word)
foreach($sql as $row)
{
//$orig_word[] = '#(?<!\S)(' . str_replace('\*', '\S*?', preg_quote($row['word'], '#')) . ')(?!\S)#iu';
$orig_word[] = '#(?<![\p{Nd}\p{L}_])(' . str_replace('\*', '[\p{Nd}\p{L}_]*?', preg_quote($row['word'], '#')) . ')(?![\p{Nd}\p{L}_])#iu';
$replacement_word[] = $row['replacement'];
}
@ -1920,12 +1908,12 @@ function get_forum_display_sort_option ($selected_row = 0, $action = 'list', $li
global $lang;
$forum_display_sort = array(
'lang_key' => array('LASTPOST', 'SORT_TOPIC_TITLE', 'SORT_TIME'),
'fields' => array('t.topic_last_post_time', 't.topic_title', 't.topic_time'),
'lang_key' => array('LASTPOST', 'SORT_TOPIC_TITLE', 'SORT_TIME'),
'fields' => array('t.topic_last_post_time', 't.topic_title', 't.topic_time'),
);
$forum_display_order = array(
'lang_key' => array('DESC', 'ASC'),
'fields' => array('DESC', 'ASC'),
'lang_key' => array('DESC', 'ASC'),
'fields' => array('DESC', 'ASC'),
);
// get the good list
@ -1957,110 +1945,6 @@ function get_forum_display_sort_option ($selected_row = 0, $action = 'list', $li
return $res;
}
function topic_attachment_image($switch_attachment)
{
global $is_auth;
if (!$switch_attachment || !($is_auth['auth_download'] && $is_auth['auth_view']))
{
return '';
}
return '<img src="styles/images/icon_clip.gif" alt="" border="0" /> ';
}
/**
* array_combine()
*
* @package PHP_Compat
* @link http://php.net/function.array_combine
* @author Aidan Lister <aidan@php.net>
* @version $Revision: 1.21 $
* @since PHP 5
*/
if (!function_exists('array_combine'))
{
function array_combine($keys, $values)
{
if (!is_array($keys)) {
user_error('array_combine() expects parameter 1 to be array, ' .
gettype($keys) . ' given', E_USER_WARNING);
return;
}
if (!is_array($values)) {
user_error('array_combine() expects parameter 2 to be array, ' .
gettype($values) . ' given', E_USER_WARNING);
return;
}
$key_count = count($keys);
$value_count = count($values);
if ($key_count !== $value_count) {
user_error('array_combine() both parameters should have equal number of elements', E_USER_WARNING);
return false;
}
if ($key_count === 0 || $value_count === 0) {
user_error('array_combine() both parameters should have number of elements at least 0', E_USER_WARNING);
return false;
}
$keys = array_values($keys);
$values = array_values($values);
$combined = array();
for ($i = 0; $i < $key_count; $i++) {
$combined[$keys[$i]] = $values[$i];
}
return $combined;
}
}
/**
* array_intersect_key()
*
* @package PHP_Compat
* @link http://php.net/function.array_intersect_key
* @author Tom Buskens <ortega@php.net>
* @version $Revision: 1.4 $
* @since PHP 5.0.2
*/
if (!function_exists('array_intersect_key')) {
function array_intersect_key()
{
$args = func_get_args();
if (count($args) < 2) {
user_error('Wrong parameter count for array_intersect_key()', E_USER_WARNING);
return;
}
// Check arrays
$array_count = count($args);
for ($i = 0; $i !== $array_count; $i++) {
if (!is_array($args[$i])) {
user_error('array_intersect_key() Argument #' .
($i + 1) . ' is not an array', E_USER_WARNING);
return;
}
}
// Compare entries
$result = array();
foreach ($args[0] as $key1 => $value1) {
for ($i = 1; $i !== $array_count; $i++) {
foreach ($args[$i] as $key2 => $value2) {
if ((string) $key1 === (string) $key2) {
$result[$key1] = $value1;
}
}
}
}
return $result;
}
}
function clear_dl_list ($topics_csv)
{
DB()->query("DELETE FROM ". BB_BT_DLSTATUS ." WHERE topic_id IN($topics_csv)");

View file

@ -654,7 +654,6 @@ if ($submit && !$errors)
$emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
$emailer->email_address($username ." <{$email}>");
$emailer->use_template($email_template, $user_lang);
$emailer->assign_vars(array(
@ -662,7 +661,6 @@ if ($submit && !$errors)
'WELCOME_MSG' => sprintf($lang['WELCOME_SUBJECT'], $bb_cfg['sitename']),
'USERNAME' => html_entity_decode($username),
'PASSWORD' => $new_pass,
'U_ACTIVATE' => make_url('profile.php?mode=activate&' . POST_USERS_URL . '=' . $new_user_id . '&act_key=' . $db_data['user_actkey'])
));
@ -693,7 +691,6 @@ if ($submit && !$errors)
$emailer->from($bb_cfg['sitename'] ." <{$bb_cfg['board_email']}>");
$emailer->email_address($username ." <{$email}>");
$emailer->use_template('user_activate', $pr_data['user_lang']);
$emailer->assign_vars(array(