Follow along with the video below to see how to install our site as a web app on your home screen.
Бележка: This feature may not be available in some browsers.
<?php
/***************************************************************************
* admin_mass_pm.php
* -------------------
* email : netzmeister@source-code.de
* www : http://www.source-code.de
*
* Bugfix : "wrong username" > Thx to buegelfalte, http://forum.beehave.de
****************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
define('IN_PHPBB', 1);
if( !empty($setmodules) )
{
$filename = basename(__FILE__);
$module['General']['Масово Л.С'] = $filename;
return;
}
//
// Load default header
//
$no_page_header = TRUE;
$phpbb_root_path = './../';
require($phpbb_root_path . 'extension.inc');
require($phpbb_root_path . 'includes/bbcode.'.$phpEx);
require($phpbb_root_path . 'includes/functions_post.'.$phpEx);
require('./pagestart.' . $phpEx);
// Bricht das Script nach 1200 Sekunden ab. Fьr Boards mit sehr vielen Usern.
@set_time_limit(1200);
$privmsg_message = '';
$privmsg_subject = '';
$error = FALSE;
//
// Versende PM
//
if ( isset($HTTP_POST_VARS['submit']) )
{
$privmsg_subject = trim(strip_tags($HTTP_POST_VARS['subject']));
if ( empty($privmsg_subject) )
{
$error = TRUE;
$error_msg .= ( ( !empty($error_msg) ) ? '<br />' : '' ) . $lang['Empty_subject'];
}
if ( !empty($HTTP_POST_VARS['message']) )
{
if ( !$error )
{
$bbcode_uid = make_bbcode_uid();
$privmsg_message = prepare_message($HTTP_POST_VARS['message'], 0, 1, 1, $bbcode_uid);
}
}
else
{
$error = TRUE;
$error_msg .= ( ( !empty($error_msg) ) ? '<br />' : '' ) . $lang['Empty_message'];
}
$group_id = intval($HTTP_POST_VARS[POST_GROUPS_URL]);
$sql = ( $group_id != -1 ) ? "SELECT u.user_id, u.username, u.user_notify_pm, u.user_email, u.user_lang, u.user_active FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug WHERE ug.group_id = $group_id AND ug.user_pending <> " . TRUE . " AND u.user_id = ug.user_id AND u.user_id > 0" : "SELECT user_id, username, user_notify_pm, user_email, user_lang, user_active FROM " . USERS_TABLE." WHERE user_id > 0";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not select group members', '', __LINE__, __FILE__, $sql);
}
else
{
include($phpbb_root_path . 'includes/emailer.'.$phpEx);
$script_name = preg_replace('/^\/?(.*?)\/?$/', "\\1", trim($board_config['script_path']));
$script_name = ( $script_name != '' ) ? $script_name . '/privmsg.'.$phpEx : 'privmsg.'.$phpEx;
$server_name = trim($board_config['server_name']);
$server_protocol = ( $board_config['cookie_secure'] ) ? 'https://' : 'http://';
$server_port = ( $board_config['server_port'] <> 80 ) ? ':' . trim($board_config['server_port']) . '/' : '/';
while( $to_userdata = $db->sql_fetchrow($result) )
{
// Hier versenden.
$msg_time = time();
$sql_info = "INSERT INTO " . PRIVMSGS_TABLE . " (privmsgs_type, privmsgs_subject, privmsgs_from_userid, privmsgs_to_userid, privmsgs_date, privmsgs_ip, privmsgs_enable_html, privmsgs_enable_bbcode, privmsgs_enable_smilies, privmsgs_attach_sig)
VALUES (" . PRIVMSGS_NEW_MAIL . ", '" . str_replace("\'", "''", $privmsg_subject) . "', " . $userdata['user_id'] . ", " . $to_userdata['user_id'] . ", $msg_time, '', 0, 1, 1, 0)";
if ( !($result1 = $db->sql_query($sql_info, BEGIN_TRANSACTION)) )
{
message_die(GENERAL_ERROR, "Could not insert/update private message sent info.", "", __LINE__, __FILE__, $sql_info);
}
$privmsg_sent_id = $db->sql_nextid();
$sql = "INSERT INTO " . PRIVMSGS_TEXT_TABLE . " (privmsgs_text_id, privmsgs_bbcode_uid, privmsgs_text)
VALUES ($privmsg_sent_id, '" . $bbcode_uid . "', '" . str_replace("\'", "''", $privmsg_message) . "')";
if ( !$db->sql_query($sql, END_TRANSACTION) )
{
message_die(GENERAL_ERROR, "Could not insert/update private message sent text.", "", __LINE__, __FILE__, $sql_info);
}
//
// Add to the users new pm counter
//
$sql = "UPDATE " . USERS_TABLE . "
SET user_new_privmsg = user_new_privmsg + 1, user_last_privmsg = " . time() . "
WHERE user_id = " . $to_userdata['user_id'];
if ( !$status = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not update private message new/read status for user', '', __LINE__, __FILE__, $sql);
}
if ( $to_userdata['user_notify_pm'] && !empty($to_userdata['user_email']) && $to_userdata['user_active'] )
{
// EMail versenden.
$emailer = new emailer($board_config['smtp_delivery']);
$emailer->from($board_config['board_email']);
$emailer->replyto($board_config['board_email']);
$emailer->use_template('privmsg_notify', $to_userdata['user_lang']);
$emailer->email_address($to_userdata['user_email']);
$emailer->set_subject($lang['Notification_subject']);
$emailer->assign_vars(array(
'USERNAME' => $to_userdata['username'],
'SITENAME' => $board_config['sitename'],
'EMAIL_SIG' => (!empty($board_config['board_email_sig'])) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '',
'U_INBOX' => $server_protocol . $server_name . $server_port . $script_name . '?folder=inbox')
);
$emailer->send();
$emailer->reset();
}
}
// Alle Nachrichten versendet..
message_die(GENERAL_MESSAGE, $lang['PM_sent'] . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . append_sid("index.$phpEx?pane=right") . '">', '</a>'));
}
}
if ( $error )
{
$template->set_filenames(array(
'reg_header' => 'error_body.tpl')
);
$template->assign_vars(array(
'ERROR_MESSAGE' => $error_msg)
);
$template->assign_var_from_handle('ERROR_BOX', 'reg_header');
}
//
// Initial selection
//
$sql = "SELECT group_id, group_name
FROM ".GROUPS_TABLE . "
WHERE group_single_user <> 1";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain list of groups', '', __LINE__, __FILE__, $sql);
}
$select_list = '<select name = "' . POST_GROUPS_URL . '"><option value = "-1">' . $lang['All_users'] . '</option>';
if ( $row = $db->sql_fetchrow($result) )
{
do
{
$select_list .= '<option value = "' . $row['group_id'] . '">' . $row['group_name'] . '</option>';
}
while ( $row = $db->sql_fetchrow($result) );
}
$select_list .= '</select>';
//
// Generate page
//
include('./page_header_admin.'.$phpEx);
$template->set_filenames(array(
'body' => 'admin/user_pm_body.tpl')
);
$template->assign_vars(array(
'L_PM_TITLE' => $lang['PM_Title'],
'L_PM_EXPLAIN' => $lang['PM_Explain'],
'L_COMPOSE' => $lang['PM_Compose'],
'L_RECIPIENTS' => $lang['Recipients'],
'L_PM_SUBJECT' => $lang['PM_Subject'],
'L_PM_MSG' => $lang['Message'],
'L_PM_SEND' => $lang['PM_Send'],
'L_NOTICE' => $lang['PM_Autor'],
'S_USER_ACTION' => append_sid('admin_mass_pm.'.$phpEx),
'S_GROUP_SELECT' => $select_list,
)
);
$template->pparse('body');
include('./page_footer_admin.'.$phpEx);
?>
drlevine каза:Абе търси в туриста има такъв мод аз си го сложих от тука, но май липсва![]()