aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/adm/index.php
diff options
context:
space:
mode:
authorPaul S. Owen <psotfx@users.sourceforge.net>2003-10-12 15:29:18 +0000
committerPaul S. Owen <psotfx@users.sourceforge.net>2003-10-12 15:29:18 +0000
commit9da094fec24666b80349cc73978c26ba76105153 (patch)
treea636b1626bd2bbc0e19b3bbf3b774105a7aeac9f /phpBB/adm/index.php
parent90ad130d48893a63aea1db7e61ea9d39c6018cb1 (diff)
downloadforums-9da094fec24666b80349cc73978c26ba76105153.tar
forums-9da094fec24666b80349cc73978c26ba76105153.tar.gz
forums-9da094fec24666b80349cc73978c26ba76105153.tar.bz2
forums-9da094fec24666b80349cc73978c26ba76105153.tar.xz
forums-9da094fec24666b80349cc73978c26ba76105153.zip
Updated the various "users of emailer", fixed issue(!) of jabber using the email address as the uid, blah fixes, blah, blah di blah yakety smackety
git-svn-id: file:///svn/phpbb/trunk@4583 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/adm/index.php')
-rw-r--r--phpBB/adm/index.php137
1 files changed, 64 insertions, 73 deletions
diff --git a/phpBB/adm/index.php b/phpBB/adm/index.php
index 5f1673269d..d5f4c05203 100644
--- a/phpBB/adm/index.php
+++ b/phpBB/adm/index.php
@@ -132,37 +132,31 @@ else if ($pane == 'left')
}
elseif ($pane == 'right')
{
- if ((isset($_POST['activate']) || isset($_POST['delete'])) && !empty($_POST['mark']))
+ $activate = (isset($_POST['activate'])) ? true : false;
+ $delete = (isset($_POST['delete'])) ? true : false;
+ $remind = (isset($_POST['remind'])) ? true : false;
+
+ $mark = implode(', ', request_var('mark', 0));
+
+ if (($activate || $delete) && $mark)
{
if (!$auth->acl_get('a_user'))
{
trigger_error($user->lang['NO_ADMIN']);
}
- if (is_array($_POST['mark']))
- {
- $in_sql = '';
- foreach ($_POST['mark'] as $user_id)
- {
- $in_sql .= (($in_sql != '') ? ', ' : '') . intval($user_id);
- }
-
- if ($in_sql != '')
- {
- $sql = (isset($_POST['activate'])) ? 'UPDATE ' . USERS_TABLE . " SET user_active = 1 WHERE user_id IN ($in_sql)" : "DELETE FROM " . USERS_TABLE . " WHERE user_id IN ($in_sql)";
- $db->sql_query($sql);
-
- if (!isset($_POST['delete']))
- {
- set_config('num_users', $config['num_users'] + sizeof($mark));
- }
+ $sql = ($activate) ? 'UPDATE ' . USERS_TABLE . " SET user_active = 1 WHERE user_id IN ($mark)" : 'DELETE FROM ' . USERS_TABLE . " WHERE user_id IN ($mark)";
+ $db->sql_query($sql);
- $log_action = (isset($_POST['activate'])) ? 'log_index_activate' : 'log_index_delete';
- add_log('admin', $log_action, sizeof($_POST['mark']));
- }
+ if (!$delete)
+ {
+ set_config('num_users', $config['num_users'] + $db->affected_rows());
}
+
+ $log_action = ($activate) ? 'log_index_activate' : 'log_index_delete';
+ add_log('admin', $log_action, $db->affected_rows());
}
- else if (isset($_POST['remind']))
+ else if ($remind && $mark)
{
if (!$auth->acl_get('a_user'))
{
@@ -174,55 +168,52 @@ elseif ($pane == 'right')
trigger_error($user->lang['EMAIL_DISABLED']);
}
- if (is_array($_POST['mark']))
+ $sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_method, user_regdate, user_actkey
+ FROM ' . USERS_TABLE . "
+ WHERE user_id IN ($mark)";
+ $result = $db->sql_query($sql);
+
+ if ($row = $db->sql_fetchrow($result))
{
- $in_sql = '';
- foreach ($_POST['mark'] as $user_id)
- {
- $in_sql .= (($in_sql != '') ? ', ' : '') . intval($user_id);
- }
+ // Send the messages
+ include_once($phpbb_root_path . 'includes/functions_messenger.'.$phpEx);
+
+ $messenger = new messenger();
+
+ $board_url = generate_board_url() . "/ucp.$phpEx?mode=activate";
+ $sig = str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']);
- if ($in_sql != '')
+ $usernames = array();
+ do
{
- $sql = "SELECT user_id, username, user_email, user_lang, user_regdate, user_actkey
- FROM " . USERS_TABLE . "
- WHERE user_id IN ($in_sql)";
- $result = $db->sql_query($sql);
+ $messenger->template('user_remind_inactive', $row['user_lang']);
- if ($row = $db->sql_fetchrow($result))
- {
- include($phpbb_root_path . 'includes/emailer.'.$phpEx);
- $emailer = new emailer();
-
- $board_url = generate_board_url() . '/ucp.' . $phpEx;
- $usernames = '';
+ $messenger->replyto($config['board_email']);
+ $messenger->to($row['user_email'], $row['username']);
+ $messenger->im($row['user_jabber'], $row['username']);
- do
- {
- $emailer->use_template('user_remind_inactive', $row['user_lang']);
- $emailer->to($row['user_email'], $row['username']);
+ $messenger->assign_vars(array(
+ 'EMAIL_SIG' => $sig,
+ 'USERNAME' => $row['username'],
+ 'SITENAME' => $config['sitename'],
+ 'REGISTER_DATE' => $user->format_date($row['user_regdate']),
- $emailer->assign_vars(array(
- 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']),
- 'USERNAME' => $row['username'],
- 'SITENAME' => $config['sitename'],
- 'REGISTER_DATE' => $user->format_date($row['user_regdate']),
-
- 'U_ACTIVATE' => $board_url . '&mode=activate&u=' . $row['user_id'] . '&k=' . $row['user_actkey'])
- );
-
- $emailer->send();
- $emailer->reset();
+ 'U_ACTIVATE' => "$board_url&mode=activate&u=" . $row['user_id'] . '&k=' . $row['user_actkey'])
+ );
- $usernames .= (($usernames != '') ? ', ' : '') . $row['username'];
- }
- while ($row = $db->sql_fetchrow($result));
+ $messenger->send($row['user_notify_type']);
- add_log('admin', 'LOG_INDEX_REMIND', $usernames);
- }
- $db->sql_freeresult($result);
+ $usernames[] = $row['username'];
}
+ while ($row = $db->sql_fetchrow($result));
+
+ $messenger->queue->save();
+ unset($email_list);
+
+ add_log('admin', 'LOG_INDEX_REMIND', implode(', ', $usernames));
+ unset($usernames);
}
+ $db->sql_freeresult($result);
}
else if (isset($_POST['online']))
{
@@ -242,27 +233,27 @@ elseif ($pane == 'right')
trigger_error($user->lang['NO_ADMIN']);
}
- $sql = "SELECT COUNT(post_id) AS stat
- FROM " . POSTS_TABLE . "
- WHERE post_approved = 1";
+ $sql = 'SELECT COUNT(post_id) AS stat
+ FROM ' . POSTS_TABLE . '
+ WHERE post_approved = 1';
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
set_config('num_posts', $row['stat']);
- $sql = "SELECT COUNT(topic_id) AS stat
- FROM " . TOPICS_TABLE . "
- WHERE topic_approved = 1";
+ $sql = 'SELECT COUNT(topic_id) AS stat
+ FROM ' . TOPICS_TABLE . '
+ WHERE topic_approved = 1';
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
set_config('num_topics', $row['stat']);
- $sql = "SELECT COUNT(user_id) AS stat
- FROM " . USERS_TABLE . "
- WHERE user_active = 1";
+ $sql = 'SELECT COUNT(user_id) AS stat
+ FROM ' . USERS_TABLE . '
+ WHERE user_active = 1';
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
@@ -349,7 +340,7 @@ elseif ($pane == 'right')
// DB size ... MySQL only
// This code is heavily influenced by a similar routine
// in phpMyAdmin 2.2.0
- if (preg_match('/^mysql/', SQL_LAYER))
+ if (preg_match('#^mysql#', SQL_LAYER))
{
$result = $db->sql_query('SELECT VERSION() AS mysql_version');
@@ -396,8 +387,8 @@ elseif ($pane == 'right')
}
else if (preg_match('#^mssql#', SQL_LAYER))
{
- $sql = "SELECT ((SUM(size) * 8.0) * 1024.0) as dbsize
- FROM sysfiles";
+ $sql = 'SELECT ((SUM(size) * 8.0) * 1024.0) as dbsize
+ FROM sysfiles';
$result = $db->sql_query($sql);
$dbsize = ($row = $db->sql_fetchrow($result)) ? intval($row['dbsize']) : $user->lang['NOT_AVAILABLE'];