Verzeichnisstruktur phpBB-2.0.0
- Veröffentlicht
- 03.04.2002
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
admin_mass_email.php
001 <?php
002 /***************************************************************************
003 * admin_mass_email.php
004 * -------------------
005 * begin : Thu May 31, 2001
006 * copyright : (C) 2001 The phpBB Group
007 * email : support@phpbb.com
008 *
009 * $Id$
010 *
011 ****************************************************************************/
012
013 /***************************************************************************
014 *
015 * This program is free software; you can redistribute it and/or modify
016 * it under the terms of the GNU General Public License as published by
017 * the Free Software Foundation; either version 2 of the License, or
018 * (at your option) any later version.
019 *
020 ***************************************************************************/
021
022 define('IN_PHPBB', 1);
023
024 if( !empty($setmodules) )
025 {
026 $filename = basename(__FILE__);
027 $module['General']['Mass_Email'] = $filename;
028
029 return;
030 }
031
032 //
033 // Load default header
034 //
035 $no_page_header = TRUE;
036 $phpbb_root_path = './../';
037 require($phpbb_root_path . 'extension.inc');
038 require('./pagestart.' . $phpEx);
039
040 //
041 // Increase maximum execution time in case of a lot of users, but don't complain about it if it isn't
042 // allowed.
043 //
044 @set_time_limit(1200);
045
046 $message = '';
047 $subject = '';
048
049 //
050 // Do the job ...
051 //
052 if ( isset($HTTP_POST_VARS['submit']) )
053 {
054 $subject = stripslashes(trim($HTTP_POST_VARS['subject']));
055 $message = stripslashes(trim($HTTP_POST_VARS['message']));
056
057 $error = FALSE;
058 $error_msg = '';
059
060 if ( empty($subject) )
061 {
062 $error = true;
063 $error_msg .= ( !empty($error_msg) ) ? '<br />' . $lang['Empty_subject'] : $lang['Empty_subject'];
064 }
065
066 if ( empty($message) )
067 {
068 $error = true;
069 $error_msg .= ( !empty($error_msg) ) ? '<br />' . $lang['Empty_message'] : $lang['Empty_message'];
070 }
071
072 $group_id = intval($HTTP_POST_VARS[POST_GROUPS_URL]);
073
074 $sql = ( $group_id != -1 ) ? "SELECT u.user_email 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" : "SELECT user_email FROM " . USERS_TABLE;
075 if ( !($result = $db->sql_query($sql)) )
076 {
077 message_die(GENERAL_ERROR, 'Could not select group members', '', __LINE__, __FILE__, $sql);
078 }
079
080 if ( $row = $db->sql_fetchrow($result) )
081 {
082 $bcc_list = array();
083 do
084 {
085 $bcc_list[] = $row['user_email'];
086 }
087 while ( $row = $db->sql_fetchrow($result) );
088
089 $db->sql_freeresult($result);
090 }
091 else
092 {
093 $message = ( $group_id != -1 ) ? $lang['Group_not_exist'] : $lang['No_such_user'];
094
095 $error = true;
096 $error_msg .= ( !empty($error_msg) ) ? '<br />' . $message : $message;
097 }
098
099 if ( !$error )
100 {
101 include($phpbb_root_path . 'includes/emailer.'.$phpEx);
102
103 //
104 // Let's do some checking to make sure that mass mail functions
105 // are working in win32 versions of php.
106 //
107 if ( preg_match('/[c-z]:\\\.*/i', getenv('PATH')) && !$board_config['smtp_delivery'])
108 {
109 $ini_val = ( @phpversion() >= '4.0.0' ) ? 'ini_get' : 'get_cfg_var';
110
111 // We are running on windows, force delivery to use our smtp functions
112 // since php's are broken by default
113 $board_config['smtp_delivery'] = 1;
114 $board_config['smtp_host'] = @$ini_val('SMTP');
115 }
116
117 $emailer = new emailer($board_config['smtp_delivery']);
118
119 $emailer->from($board_config['board_email']);
120 $emailer->replyto($board_config['board_email']);
121
122 for ($i = 0; $i < count($bcc_list); $i++)
123 {
124 $emailer->bcc($bcc_list[$i]);
125 }
126
127 $email_headers = 'X-AntiAbuse: Board servername - ' . $board_config['server_name'] . "\n";
128 $email_headers .= 'X-AntiAbuse: User_id - ' . $userdata['user_id'] . "\n";
129 $email_headers .= 'X-AntiAbuse: Username - ' . $userdata['username'] . "\n";
130 $email_headers .= 'X-AntiAbuse: User IP - ' . decode_ip($user_ip) . "\n";
131
132 $emailer->use_template('admin_send_email');
133 $emailer->email_address($board_config['board_email']);
134 $emailer->set_subject($subject);
135 $emailer->extra_headers($email_headers);
136
137 $emailer->assign_vars(array(
138 'SITENAME' => $board_config['sitename'],
139 'BOARD_EMAIL' => $board_config['board_email'],
140 'MESSAGE' => $message)
141 );
142 $emailer->send();
143 $emailer->reset();
144
145 message_die(GENERAL_MESSAGE, $lang['Email_sent'] . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . append_sid("index.$phpEx?pane=right") . '">', '</a>'));
146 }
147 }
148
149 if ( $error )
150 {
151 $template->set_filenames(array(
152 'reg_header' => 'error_body.tpl')
153 );
154 $template->assign_vars(array(
155 'ERROR_MESSAGE' => $error_msg)
156 );
157 $template->assign_var_from_handle('ERROR_BOX', 'reg_header');
158 }
159
160 //
161 // Initial selection
162 //
163
164 $sql = "SELECT group_id, group_name
165 FROM ".GROUPS_TABLE . "
166 WHERE group_single_user <> 1";
167 if ( !($result = $db->sql_query($sql)) )
168 {
169 message_die(GENERAL_ERROR, 'Could not obtain list of groups', '', __LINE__, __FILE__, $sql);
170 }
171
172 $select_list = '<select name = "' . POST_GROUPS_URL . '"><option value = "-1">' . $lang['All_users'] . '</option>';
173 if ( $row = $db->sql_fetchrow($result) )
174 {
175 do
176 {
177 $select_list .= '<option value = "' . $row['group_id'] . '">' . $row['group_name'] . '</option>';
178 }
179 while ( $row = $db->sql_fetchrow($result) );
180 }
181 $select_list .= '</select>';
182
183 //
184 // Generate page
185 //
186 include('./page_header_admin.'.$phpEx);
187
188 $template->set_filenames(array(
189 'body' => 'admin/user_email_body.tpl')
190 );
191
192 $template->assign_vars(array(
193 'MESSAGE' => $message,
194 'SUBJECT' => $subject,
195
196 'L_EMAIL_TITLE' => $lang['Email'],
197 'L_EMAIL_EXPLAIN' => $lang['Mass_email_explain'],
198 'L_COMPOSE' => $lang['Compose'],
199 'L_RECIPIENTS' => $lang['Recipients'],
200 'L_EMAIL_SUBJECT' => $lang['Subject'],
201 'L_EMAIL_MSG' => $lang['Message'],
202 'L_EMAIL' => $lang['Email'],
203 'L_NOTICE' => $notice,
204
205 'S_USER_ACTION' => append_sid('admin_mass_email.'.$phpEx),
206 'S_GROUP_SELECT' => $select_list)
207 );
208
209 $template->pparse('body');
210
211 include('./page_footer_admin.'.$phpEx);
212
213 ?>