本文整理汇总了PHP中messenger类的典型用法代码示例。如果您正苦于以下问题:PHP messenger类的具体用法?PHP messenger怎么用?PHP messenger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了messenger类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: main
function main($id, $mode)
{
global $config, $phpbb_root_path, $phpEx;
global $db, $user, $auth, $template;
$user_id = request_var('u', 0);
$key = request_var('k', '');
$sql = 'SELECT user_id, username, user_type, user_email, user_newpasswd, user_lang, user_notify_type, user_actkey
FROM ' . USERS_TABLE . "\n\t\t\tWHERE user_id = {$user_id}";
$result = $db->sql_query($sql);
$user_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if (!$user_row) {
trigger_error('NO_USER');
}
if ($user_row['user_type'] != USER_INACTIVE && !$user_row['user_newpasswd']) {
meta_refresh(3, append_sid("{$phpbb_root_path}index.{$phpEx}"));
trigger_error('ALREADY_ACTIVATED');
}
if ($user_row['user_actkey'] != $key) {
trigger_error('WRONG_ACTIVATION');
}
$update_password = $user_row['user_newpasswd'] ? true : false;
if ($update_password) {
$sql_ary = array('user_type' => USER_NORMAL, 'user_actkey' => '', 'user_password' => $user_row['user_newpasswd'], 'user_newpasswd' => '');
$sql = 'UPDATE ' . USERS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
WHERE user_id = ' . $user_row['user_id'];
$db->sql_query($sql);
}
if (!$update_password) {
include_once $phpbb_root_path . 'includes/functions_user.' . $phpEx;
// Now we need to demote the user from the inactive group and add him to the registered group
user_active_flip($user_row['user_id'], $user_row['user_type'], '', $user_row['username'], true);
// Update last username
update_last_username();
set_config('num_users', $config['num_users'] + 1, true);
}
if ($config['require_activation'] == USER_ACTIVATION_ADMIN && !$update_password) {
include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
$messenger = new messenger(false);
$messenger->template('admin_welcome_activated', $user_row['user_lang']);
$messenger->replyto($config['board_contact']);
$messenger->to($user_row['user_email'], $user_row['username']);
$messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
$messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
$messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']);
$messenger->headers('X-AntiAbuse: User IP - ' . $user->ip);
$messenger->assign_vars(array('SITENAME' => $config['sitename'], 'USERNAME' => html_entity_decode($user_row['username']), 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $config['board_email_sig'])));
$messenger->send($user_row['user_notify_type']);
$message = 'ACCOUNT_ACTIVE_ADMIN';
} else {
$message = !$update_password ? 'ACCOUNT_ACTIVE' : 'PASSWORD_ACTIVATED';
}
meta_refresh(3, append_sid("{$phpbb_root_path}index.{$phpEx}"));
trigger_error($user->lang[$message]);
}
开发者ID:yunsite,项目名称:gloryroad,代码行数:56,代码来源:ucp_activate.php
示例2: main
function main($id, $mode)
{
global $config, $phpbb_root_path, $phpEx;
global $db, $user, $auth, $template;
$user_id = request_var('u', 0);
$key = request_var('k', '');
$sql = 'SELECT user_id, username, user_type, user_email, user_newpasswd, user_lang, user_notify_type, user_actkey, user_inactive_reason
FROM ' . USERS_TABLE . "\n\t\t\tWHERE user_id = {$user_id}";
$result = $db->sql_query($sql);
$user_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if (!$user_row) {
trigger_error('NO_USER');
}
if ($user_row['user_type'] != USER_INACTIVE && !$user_row['user_newpasswd']) {
meta_refresh(3, append_sid("{$phpbb_root_path}index.{$phpEx}"));
trigger_error('ALREADY_ACTIVATED');
}
if ($user_row['user_inactive_reason'] == INACTIVE_MANUAL || $user_row['user_actkey'] != $key) {
trigger_error('WRONG_ACTIVATION');
}
$update_password = $user_row['user_newpasswd'] ? true : false;
if ($update_password) {
$sql_ary = array('user_actkey' => '', 'user_password' => $user_row['user_newpasswd'], 'user_newpasswd' => '', 'user_pass_convert' => 0, 'user_login_attempts' => 0);
$sql = 'UPDATE ' . USERS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
WHERE user_id = ' . $user_row['user_id'];
$db->sql_query($sql);
}
if (!$update_password) {
include_once $phpbb_root_path . 'includes/functions_user.' . $phpEx;
user_active_flip('activate', $user_row['user_id']);
$sql = 'UPDATE ' . USERS_TABLE . "\n\t\t\t\tSET user_actkey = ''\n\t\t\t\tWHERE user_id = {$user_row['user_id']}";
$db->sql_query($sql);
}
if ($config['require_activation'] == USER_ACTIVATION_ADMIN && !$update_password) {
include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
$messenger = new messenger(false);
$messenger->template('admin_welcome_activated', $user_row['user_lang']);
$messenger->to($user_row['user_email'], $user_row['username']);
$messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
$messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
$messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']);
$messenger->headers('X-AntiAbuse: User IP - ' . $user->ip);
$messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode($user_row['username'])));
$messenger->send($user_row['user_notify_type']);
$message = 'ACCOUNT_ACTIVE_ADMIN';
} else {
if (!$update_password) {
$message = $user_row['user_inactive_reason'] == INACTIVE_PROFILE ? 'ACCOUNT_ACTIVE_PROFILE' : 'ACCOUNT_ACTIVE';
} else {
$message = 'PASSWORD_ACTIVATED';
}
}
meta_refresh(3, append_sid("{$phpbb_root_path}index.{$phpEx}"));
trigger_error($user->lang[$message]);
}
开发者ID:jvinhit,项目名称:php,代码行数:57,代码来源:ucp_activate.php
示例3: testThePatternWillFailIfValueForATraversableValueIsFalse
/**
* @todo - this may be unwanted behaviour
*/
public function testThePatternWillFailIfValueForATraversableValueIsFalse()
{
$map = ['a' => ['b' => 'string']];
$test = ['a' => false];
$sut = new HasTypeMap($map);
$this->assertFalse($sut($test, $this->messenger));
$this->assertEquals("Value has invalid type map", $this->messenger->implode());
}
开发者ID:chippyash,项目名称:validation,代码行数:11,代码来源:HasTypeMapTest.php
示例4: test_email_parsing
/**
* @dataProvider email_parsing_data
*/
public function test_email_parsing($author_name, $forum_name, $topic_title, $username)
{
global $config, $phpEx, $user;
$this->messenger->set_addresses($user->data);
$this->messenger->assign_vars(array('EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . htmlspecialchars_decode($config['board_email_sig'])), 'SITENAME' => htmlspecialchars_decode($config['sitename']), 'AUTHOR_NAME' => $author_name, 'FORUM_NAME' => $forum_name, 'TOPIC_TITLE' => $topic_title, 'USERNAME' => $username, 'U_FORUM' => generate_board_url() . "/viewforum.{$phpEx}?f=1", 'U_STOP_WATCHING_FORUM' => generate_board_url() . "/viewforum.{$phpEx}?uid=2&f=1&unwatch=forum"));
$this->messenger->template('newtopic_notify', $user->data['user_lang'], '', '');
$reflection_template = $this->reflection_template_property->getValue($this->messenger);
$msg = trim($reflection_template->assign_display('body'));
$this->assertContains($author_name, $msg);
$this->assertContains($forum_name, $msg);
$this->assertContains($topic_title, $msg);
$this->assertContains($username, $msg);
$this->assertContains(htmlspecialchars_decode($config['sitename']), $msg);
$this->assertContains(str_replace('<br />', "\n", "-- \n" . htmlspecialchars_decode($config['board_email_sig'])), $msg);
$this->assertNotContains('EMAIL_SIG', $msg);
$this->assertNotContains('U_STOP_WATCHING_FORUM', $msg);
}
开发者ID:phpbb,项目名称:phpbb,代码行数:20,代码来源:email_parsing_test.php
示例5: exec
public function exec($params = null)
{
$result = messenger::sendEmail($params['email'], $params['tmpl'], $params['content']);
if ($result['rsp'] == "succ") {
return true;
} else {
return false;
}
}
开发者ID:453111208,项目名称:bbc,代码行数:9,代码来源:sendemail.php
示例6: notify_using_messenger
/**
* Notify using phpBB messenger
*
* @param int $notify_method Notify method for messenger (e.g. NOTIFY_IM)
* @param string $template_dir_prefix Base directory to prepend to the email template name
*
* @return null
*/
protected function notify_using_messenger($notify_method, $template_dir_prefix = '')
{
if (empty($this->queue)) {
return;
}
// Load all users we want to notify (we need their email address)
$user_ids = $users = array();
foreach ($this->queue as $notification) {
$user_ids[] = $notification->user_id;
}
// We do not send emails to banned users
if (!function_exists('phpbb_get_banned_user_ids')) {
include $this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext;
}
$banned_users = phpbb_get_banned_user_ids($user_ids);
// Load all the users we need
$this->user_loader->load_users($user_ids);
// Load the messenger
if (!class_exists('messenger')) {
include $this->phpbb_root_path . 'includes/functions_messenger.' . $this->php_ext;
}
$messenger = new \messenger();
// Time to go through the queue and send emails
/** @var \phpbb\notification\type\type_interface $notification */
foreach ($this->queue as $notification) {
if ($notification->get_email_template() === false) {
continue;
}
$user = $this->user_loader->get_user($notification->user_id);
if ($user['user_type'] == USER_IGNORE || $user['user_type'] == USER_INACTIVE && $user['user_inactive_reason'] == INACTIVE_MANUAL || in_array($notification->user_id, $banned_users)) {
continue;
}
$messenger->template($notification->get_email_template(), $user['user_lang'], '', $template_dir_prefix);
$messenger->set_addresses($user);
$messenger->assign_vars(array_merge(array('USERNAME' => $user['username'], 'U_NOTIFICATION_SETTINGS' => generate_board_url() . '/ucp.' . $this->php_ext . '?i=ucp_notifications&mode=notification_options'), $notification->get_email_template_variables()));
$messenger->send($notify_method);
}
// Save the queue in the messenger class (has to be called or these emails could be lost?)
$messenger->save_queue();
// We're done, empty the queue
$this->empty_queue();
}
开发者ID:phpbb,项目名称:phpbb-core,代码行数:50,代码来源:messenger_base.php
示例7: run
/**
* Runs this cron task.
*
* @return null
*/
public function run()
{
$time = $this->user->create_datetime();
$now = phpbb_gmgetdate($time->getTimestamp() + $time->getOffset());
// Display birthdays of 29th february on 28th february in non-leap-years
$leap_year_birthdays = '';
if ($now['mday'] == 28 && $now['mon'] == 2 && !$time->format('L')) {
$leap_year_birthdays = ' OR user_birthday LIKE "' . $this->db->sql_escape(sprintf("%2d-%2d-", 29, 2)) . '%"';
}
$sql = 'SELECT user_id, username, user_email, user_lang,
YEAR(CURRENT_TIMESTAMP) - YEAR(str_to_date(user_birthday, "%d-%m-%Y")) AS age
FROM ' . USERS_TABLE . '
WHERE user_birthday <> " 0- 0- 0" AND user_birthday <> "" AND
(user_birthday LIKE "' . $this->db->sql_escape(sprintf("%2d-%2d-", $now["mday"], $now["mon"])) . '%"' . $leap_year_birthdays . ') AND
email_on_birthday + 15778463 < UNIX_TIMESTAMP(now())';
$result = $this->db->sql_query($sql);
$msg_list = array();
while ($row = $this->db->sql_fetchrow($result)) {
$msg_list[] = array('user_id' => $row['user_id'], 'name' => $row['username'], 'email' => $row['user_email'], 'lang' => $row['user_lang'], 'age' => $this->convertNumber($row['age']) . $this->text_number($row['age']), 'time' => time());
}
if (sizeof($msg_list)) {
if ($this->config['email_enable']) {
if (!class_exists('messenger')) {
include $this->phpbb_root_path . 'includes/functions_messenger.' . $this->php_ext;
}
$server_url = generate_board_url();
$messenger = new \messenger(false);
foreach ($msg_list as $key => $value) {
$messenger->template('@forumhulp_emailonbirthday/emailonbirthday', $value['lang']);
$messenger->to($value['email'], $value['name']);
$messenger->headers('X-AntiAbuse: Board servername - ' . $this->config['server_name']);
$messenger->headers('X-AntiAbuse: User_id - ' . $value['user_id']);
$messenger->headers('X-AntiAbuse: Username - ' . $value['name']);
$messenger->headers('X-AntiAbuse: User IP - ' . '127.0.0.1');
$messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode($value['name']), 'BIRTHDAY' => $value['age'], 'SITENAME' => $this->config['sitename']));
$messenger->send(NOTIFY_EMAIL);
$sql = 'UPDATE ' . USERS_TABLE . ' SET email_on_birthday = ' . time() . ' WHERE user_id = ' . $value['user_id'];
$this->db->sql_query($sql);
}
$userlist = array_map(function ($entry) {
return $entry['name'];
}, $msg_list);
$this->log->add('admin', $this->user->data['user_id'], $this->user->data['session_ip'], 'BIRTHDAYSEND', false, array(implode(', ', $userlist)));
}
}
$this->config->set('email_on_birthday_last_gc', time());
}
开发者ID:Galixte,项目名称:emailonbirthday,代码行数:52,代码来源:birthday.php
示例8: testSend
public function testSend()
{
$content = array('vcode' => rand(1000, 9999));
$sendTo['sms'] = array('13816351212');
$sendTo['email'] = array("[email protected]");
$m = messenger::send($sendTo, 'account-member', $content);
if ($m['rsp'] == "fail") {
echo $m['err_msg'];
}
echo "加入队列成功";
}
开发者ID:453111208,项目名称:bbc,代码行数:11,代码来源:send.php
示例9: main
function main($id, $mode)
{
global $config, $phpbb_root_path, $phpEx;
global $db, $user, $auth, $template;
$username = request_var('username', '', true);
$email = strtolower(request_var('email', ''));
$submit = isset($_POST['submit']) ? true : false;
if ($submit) {
$sql = 'SELECT user_id, username, user_permissions, user_email, user_jabber, user_notify_type, user_type, user_lang, user_inactive_reason
FROM ' . USERS_TABLE . "\n\t\t\t\tWHERE user_email_hash = '" . $db->sql_escape(phpbb_email_hash($email)) . "'\n\t\t\t\t\tAND username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
$result = $db->sql_query($sql);
$user_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if (!$user_row) {
trigger_error('NO_EMAIL_USER');
}
if ($user_row['user_type'] == USER_IGNORE) {
trigger_error('NO_USER');
}
if ($user_row['user_type'] == USER_INACTIVE) {
if ($user_row['user_inactive_reason'] == INACTIVE_MANUAL) {
trigger_error('ACCOUNT_DEACTIVATED');
} else {
trigger_error('ACCOUNT_NOT_ACTIVATED');
}
}
// Check users permissions
$auth2 = new auth();
$auth2->acl($user_row);
if (!$auth2->acl_get('u_chgpasswd')) {
trigger_error('NO_AUTH_PASSWORD_REMINDER');
}
$server_url = generate_board_url();
// Make password at least 8 characters long, make it longer if admin wants to.
// gen_rand_string() however has a limit of 12 or 13.
$user_password = gen_rand_string_friendly(max(8, mt_rand((int) $config['min_pass_chars'], (int) $config['max_pass_chars'])));
// For the activation key a random length between 6 and 10 will do.
$user_actkey = gen_rand_string(mt_rand(6, 10));
$sql = 'UPDATE ' . USERS_TABLE . "\n\t\t\t\tSET user_newpasswd = '" . $db->sql_escape(phpbb_hash($user_password)) . "', user_actkey = '" . $db->sql_escape($user_actkey) . "'\n\t\t\t\tWHERE user_id = " . $user_row['user_id'];
$db->sql_query($sql);
include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
$messenger = new messenger(false);
$messenger->template('user_activate_passwd', $user_row['user_lang']);
$messenger->to($user_row['user_email'], $user_row['username']);
$messenger->im($user_row['user_jabber'], $user_row['username']);
$messenger->anti_abuse_headers($config, $user);
$messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode($user_row['username']), 'PASSWORD' => htmlspecialchars_decode($user_password), 'U_ACTIVATE' => "{$server_url}/ucp.{$phpEx}?mode=activate&u={$user_row['user_id']}&k={$user_actkey}"));
$messenger->send($user_row['user_notify_type']);
meta_refresh(3, append_sid("{$phpbb_root_path}index.{$phpEx}"));
$message = $user->lang['PASSWORD_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.{$phpEx}") . '">', '</a>');
trigger_error($message);
}
$template->assign_vars(array('USERNAME' => $username, 'EMAIL' => $email, 'S_PROFILE_ACTION' => append_sid($phpbb_root_path . 'ucp.' . $phpEx, 'mode=sendpassword')));
$this->tpl_name = 'ucp_remind';
$this->page_title = 'UCP_REMIND';
}
开发者ID:PetsFundation,项目名称:Pets,代码行数:56,代码来源:ucp_remind.php
示例10: testSend
public function testSend()
{
$content = array('vcode' => rand(1000, 9999));
$email = "[email protected]";
$m = messenger::sendEmail($email, 'account-member', $content);
if ($m['rsp'] == "fail") {
echo $m['err_msg'];
exit;
}
echo "发送邮件成功";
exit;
}
开发者ID:453111208,项目名称:bbc,代码行数:12,代码来源:send_email.php
示例11: testSend
public function testSend()
{
$content = array('vcode' => rand(1000, 9999));
$sms = "13816353470";
$m = messenger::sendSms($sms, 'account-member', $content);
if ($m['rsp'] == "fail") {
echo $m['err_msg'];
exit;
}
echo "发送短信成功";
exit;
}
开发者ID:453111208,项目名称:bbc,代码行数:12,代码来源:send_sms.php
示例12: ucp_register_user_row_after
public function ucp_register_user_row_after($event)
{
if ($this->config['require_activation'] != USER_ACTIVATION_ADMIN) {
// Grab an array of user_id's with a_user permissions ... these users can activate a user
$admin_ary = $this->auth->acl_get_list(false, 'a_user', false);
$admin_ary = !empty($admin_ary[0]['a_user']) ? $admin_ary[0]['a_user'] : array();
// Also include founders
$where_sql = ' WHERE user_type = ' . USER_FOUNDER;
if (sizeof($admin_ary)) {
$where_sql .= ' OR ' . $this->db->sql_in_set('user_id', $admin_ary);
}
$sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type
FROM ' . USERS_TABLE . ' ' . $where_sql;
$result = $this->db->sql_query($sql);
$data = array('username' => $this->request->variable('username', '', true), 'email' => strtolower($this->request->variable('email', '')), 'user_regdate' => time(), 'user_ip' => $this->user->ip, 'lang' => basename($this->request->variable('lang', $this->user->lang_name)));
while ($row = $this->db->sql_fetchrow($result)) {
if (!class_exists('messenger')) {
include $this->phpbb_root_path . 'includes/functions_messenger.' . $this->php_ext;
}
$messenger = new \messenger(false);
$server_url = generate_board_url();
$messenger->template('@dmzx_notifyadmin/admin_notify_registered', $data['lang']);
$messenger->to($row['user_email'], $row['username']);
$messenger->im($row['user_jabber'], $row['username']);
$messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode($data['username']), 'USER_MAIL' => $data['email'], 'USER_REGDATE' => date($this->config['default_dateformat'], $data['user_regdate']), 'USER_IP' => $data['user_ip']));
$messenger->send(NOTIFY_EMAIL);
}
$this->db->sql_freeresult($result);
}
}
开发者ID:alhitary,项目名称:notifyadmin,代码行数:30,代码来源:listener.php
示例13: run
/**
* {@inheritdoc}
*/
public function run()
{
$this->user->session_begin();
$this->user->setup('common');
if ($this->config['email_enable']) {
include $this->phpbb_root_path . 'includes/functions_messenger.' . $this->php_ext;
$messenger = new \messenger(false);
$messenger->template('installed', $this->install_config->get('language'));
$messenger->to($this->config['board_email'], $this->install_config->get('admin_name'));
$messenger->anti_abuse_headers($this->config, $this->user);
$messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode($this->install_config->get('admin_name')), 'PASSWORD' => htmlspecialchars_decode($this->install_config->get('admin_passwd'))));
$messenger->send(NOTIFY_EMAIL);
}
// Login admin
// Ugly but works
$this->auth->login($this->install_config->get('admin_name'), $this->install_config->get('admin_passwd'), false, true, true);
$this->iohandler->set_cookie($this->config['cookie_name'] . '_sid', $this->user->session_id);
$this->iohandler->set_cookie($this->config['cookie_name'] . '_u', $this->user->cookie_data['u']);
$this->iohandler->set_cookie($this->config['cookie_name'] . '_k', $this->user->cookie_data['k']);
// Create log
$this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_INSTALL_INSTALLED', false, array($this->config['version']));
// Remove install_lock
@unlink($this->phpbb_root_path . 'cache/install_lock');
}
开发者ID:hgchen,项目名称:phpbb,代码行数:27,代码来源:notify_user.php
示例14: __implement
private function __implement($data)
{
$tmpl = 'user-item';
foreach ($data as $key => $value) {
$sendData['vcode'] = $value['vcode'];
$result = messenger::sendEmail($value['email'], $tmpl, $sendData);
if ($result['rsp'] == "fail") {
throw new \LogicException(app::get('sysitem')->_('邮件发送失败'));
} else {
$params['gnotify_id'] = $value['gnotify_id'];
app::get('sysitem')->rpcCall('user.updatenotifyitem', $params);
}
}
return true;
}
开发者ID:453111208,项目名称:bbc,代码行数:15,代码来源:userItemNotify.php
示例15: main
function main($id, $mode)
{
global $config, $phpbb_root_path, $phpEx;
global $db, $user, $auth, $template;
$username = request_var('username', '', true);
$email = request_var('email', '');
$submit = isset($_POST['submit']) ? true : false;
if ($submit) {
$sql = 'SELECT user_id, username, user_email, user_jabber, user_notify_type, user_type, user_lang
FROM ' . USERS_TABLE . "\n\t\t\t\tWHERE user_email = '" . $db->sql_escape($email) . "'\n\t\t\t\t\tAND LOWER(username) = '" . $db->sql_escape(strtolower($username)) . "'";
$result = $db->sql_query($sql);
$user_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if (!$user_row) {
trigger_error('NO_EMAIL_USER');
}
if ($user_row['user_type'] == USER_INACTIVE) {
trigger_error('ACCOUNT_NOT_ACTIVATED');
}
$server_url = generate_board_url();
$key_len = 54 - strlen($server_url);
$key_len = $key_len < 6 ? 6 : $key_len;
$user_actkey = substr(gen_rand_string(10), 0, $key_len);
$user_password = gen_rand_string(8);
$sql = 'UPDATE ' . USERS_TABLE . "\n\t\t\t\tSET user_newpasswd = '" . $db->sql_escape(md5($user_password)) . "', user_actkey = '" . $db->sql_escape($user_actkey) . "'\n\t\t\t\tWHERE user_id = " . $user_row['user_id'];
$db->sql_query($sql);
include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
$messenger = new messenger(false);
$messenger->template('user_activate_passwd', $row['user_lang']);
$messenger->replyto($user->data['user_email']);
$messenger->to($user_row['user_email'], $user_row['username']);
$messenger->im($user_row['user_jabber'], $user_row['username']);
$messenger->assign_vars(array('SITENAME' => $config['sitename'], 'USERNAME' => html_entity_decode($user_row['username']), 'PASSWORD' => html_entity_decode($user_password), 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']), 'U_ACTIVATE' => "{$server_url}/ucp.{$phpEx}?mode=activate&u={$user_row['user_id']}&k={$user_actkey}"));
$messenger->send($user_row['user_notify_type']);
meta_refresh(3, append_sid("{$phpbb_root_path}index.{$phpEx}"));
$message = $user->lang['PASSWORD_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.{$phpEx}") . '">', '</a>');
trigger_error($message);
}
$template->assign_vars(array('USERNAME' => $username, 'EMAIL' => $email, 'S_PROFILE_ACTION' => append_sid($phpbb_root_path . 'ucp.' . $phpEx, 'mode=sendpassword')));
$this->tpl_name = 'ucp_remind';
$this->page_title = 'UCP_REMIND';
}
开发者ID:yunsite,项目名称:gloryroad,代码行数:42,代码来源:ucp_remind.php
示例16: main
//.........这里部分代码省略.........
break;
case 'banip':
$ban[] = $user_row['user_ip'];
$sql = 'SELECT DISTINCT poster_ip
FROM ' . POSTS_TABLE . "\n\t\t\t\t\t\t\t\t\t\tWHERE poster_id = {$user_id}";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$ban[] = $row['poster_ip'];
}
$db->sql_freeresult($result);
$reason = 'USER_ADMIN_BAN_IP_REASON';
break;
}
$ban_reason = $request->variable('ban_reason', $user->lang[$reason], true);
$ban_give_reason = $request->variable('ban_give_reason', '', true);
// Log not used at the moment, we simply utilize the ban function.
$result = user_ban(substr($action, 3), $ban, 0, 0, 0, $ban_reason, $ban_give_reason);
trigger_error(($result === false ? $user->lang['BAN_ALREADY_ENTERED'] : $user->lang['BAN_SUCCESSFUL']) . adm_back_link($this->u_action . '&u=' . $user_id));
break;
case 'reactivate':
if ($user_id == $user->data['user_id']) {
trigger_error($user->lang['CANNOT_FORCE_REACT_YOURSELF'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
}
if (!check_form_key($form_name)) {
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
}
if ($user_row['user_type'] == USER_FOUNDER) {
trigger_error($user->lang['CANNOT_FORCE_REACT_FOUNDER'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
}
if ($user_row['user_type'] == USER_IGNORE) {
trigger_error($user->lang['CANNOT_FORCE_REACT_BOT'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
}
if ($config['email_enable']) {
if (!class_exists('messenger')) {
include $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
}
$server_url = generate_board_url();
$user_actkey = gen_rand_string(mt_rand(6, 10));
$email_template = $user_row['user_type'] == USER_NORMAL ? 'user_reactivate_account' : 'user_resend_inactive';
if ($user_row['user_type'] == USER_NORMAL) {
user_active_flip('deactivate', $user_id, INACTIVE_REMIND);
$sql = 'UPDATE ' . USERS_TABLE . "\n\t\t\t\t\t\t\t\t\t\tSET user_actkey = '" . $db->sql_escape($user_actkey) . "'\n\t\t\t\t\t\t\t\t\t\tWHERE user_id = {$user_id}";
$db->sql_query($sql);
} else {
// Grabbing the last confirm key - we only send a reminder
$sql = 'SELECT user_actkey
FROM ' . USERS_TABLE . '
WHERE user_id = ' . $user_id;
$result = $db->sql_query($sql);
$user_actkey = (string) $db->sql_fetchfield('user_actkey');
$db->sql_freeresult($result);
}
$messenger = new messenger(false);
$messenger->template($email_template, $user_row['user_lang']);
$messenger->set_addresses($user_row);
$messenger->anti_abuse_headers($config, $user);
$messenger->assign_vars(array('WELCOME_MSG' => htmlspecialchars_decode(sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename'])), 'USERNAME' => htmlspecialchars_decode($user_row['username']), 'U_ACTIVATE' => "{$server_url}/ucp.{$phpEx}?mode=activate&u={$user_row['user_id']}&k={$user_actkey}"));
$messenger->send(NOTIFY_EMAIL);
$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_REACTIVATE', false, array($user_row['username']));
$phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_REACTIVATE_USER', false, array('reportee_id' => $user_id));
trigger_error($user->lang['FORCE_REACTIVATION_SUCCESS'] . adm_back_link($this->u_action . '&u=' . $user_id));
}
break;
case 'active':
if ($user_id == $user->data['user_id']) {
// It is only deactivation since the user is already activated (else he would not have reached this page)
开发者ID:bantu,项目名称:phpbb,代码行数:67,代码来源:acp_users.php
示例17: send
/**
* Send the email
*
* @param \messenger $messenger
* @param string $contact
* @return null
*/
public function send(\messenger $messenger, $contact)
{
if (!sizeof($this->recipients)) {
return;
}
foreach ($this->recipients as $recipient) {
$messenger->template($this->template, $recipient['lang']);
$messenger->replyto($this->sender_address);
$messenger->to($recipient['address'], $recipient['name']);
$messenger->im($recipient['jabber'], $recipient['username']);
$messenger->headers('X-AntiAbuse: Board servername - ' . $this->server_name);
$messenger->headers('X-AntiAbuse: User IP - ' . $this->sender_ip);
if ($this->sender_id) {
$messenger->headers('X-AntiAbuse: User_id - ' . $this->sender_id);
}
if ($this->sender_username) {
$messenger->headers('X-AntiAbuse: Username - ' . $this->sender_username);
}
$messenger->subject(htmlspecialchars_decode($this->subject));
$messenger->assign_vars(array('BOARD_CONTACT' => $contact, 'TO_USERNAME' => htmlspecialchars_decode($recipient['to_name']), 'FROM_USERNAME' => htmlspecialchars_decode($this->sender_name), 'MESSAGE' => htmlspecialchars_decode($this->body)));
if (sizeof($this->template_vars)) {
$messenger->assign_vars($this->template_vars);
}
$messenger->send($recipient['notify_type']);
}
}
开发者ID:Tarendai,项目名称:spring-website,代码行数:33,代码来源:message.php
示例18: time
$email = $row['user_email'];
} else {
if (!$email || !preg_match('/^' . get_preg_expression('email') . '$/i', $email)) {
$error[] = $user->lang['EMPTY_ADDRESS_EMAIL'];
}
if (!$name) {
$error[] = $user->lang['EMPTY_NAME_EMAIL'];
}
}
if (!sizeof($error)) {
$sql = 'UPDATE ' . USERS_TABLE . '
SET user_emailtime = ' . time() . '
WHERE user_id = ' . $user->data['user_id'];
$result = $db->sql_query($sql);
include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
$messenger = new messenger(false);
$email_tpl = $user_id ? 'profile_send_email' : 'email_notify';
$mail_to_users = array();
$mail_to_users[] = array('email_lang' => $email_lang, 'email' => $email, 'name' => $name, 'username' => $user_id ? $row['username'] : '', 'to_name' => $name, 'user_jabber' => $user_id ? $row['user_jabber'] : '', 'user_notify_type' => $user_id ? $row['user_notify_type'] : NOTIFY_EMAIL, 'topic_title' => !$user_id ? $row['topic_title'] : '', 'forum_id' => !$user_id ? $row['forum_id'] : 0);
// Ok, now the same email if CC specified, but without exposing the users email address
if ($cc) {
$mail_to_users[] = array('email_lang' => $user->data['user_lang'], 'email' => $user->data['user_email'], 'name' => $user->data['username'], 'username' => $user->data['username'], 'to_name' => $name, 'user_jabber' => $user->data['user_jabber'], 'user_notify_type' => $user_id ? $user->data['user_notify_type'] : NOTIFY_EMAIL, 'topic_title' => !$user_id ? $row['topic_title'] : '', 'forum_id' => !$user_id ? $row['forum_id'] : 0);
}
foreach ($mail_to_users as $row) {
$messenger->template($email_tpl, $row['email_lang']);
$messenger->replyto($user->data['user_email']);
$messenger->to($row['email'], $row['name']);
if ($user_id) {
$messenger->subject(htmlspecialchars_decode($subject));
$messenger->im($row['user_jabber'], $row['username']);
$notify_type = $row['user_notify_type'];
开发者ID:html,项目名称:PI,代码行数:31,代码来源:memberlist.php
示例19: pm_notification
/**
* PM Notification
*/
function pm_notification($mode, $author, $recipients, $subject, $message)
{
global $db, $user, $config, $phpbb_root_path, $phpEx, $auth;
$subject = censor_text($subject);
unset($recipients[ANONYMOUS], $recipients[$user->data['user_id']]);
if (!sizeof($recipients)) {
return;
}
// Get banned User ID's
$sql = 'SELECT ban_userid
FROM ' . BANLIST_TABLE . '
WHERE ' . $db->sql_in_set('ban_userid', array_map('intval', array_keys($recipients))) . '
AND ban_exclude = 0';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
unset($recipients[$row['ban_userid']]);
}
$db->sql_freeresult($result);
if (!sizeof($recipients)) {
return;
}
$sql = 'SELECT user_id, username, user_email, user_lang, user_notify_pm, user_notify_type, user_jabber
FROM ' . USERS_TABLE . '
WHERE ' . $db->sql_in_set('user_id', array_map('intval', array_keys($recipients)));
$result = $db->sql_query($sql);
$msg_list_ary = array();
while ($row = $db->sql_fetchrow($result)) {
if ($row['user_notify_pm'] == 1 && trim($row['user_email'])) {
$msg_list_ary[] = array('method' => $row['user_n
|
请发表评论