コード例 #1
0
ファイル: _email.php プロジェクト: nopticon/noptc
    function home()
    {
        global $user;
        $sql = 'SELECT *
			FROM _email
			WHERE email_active = ??
			LIMIT ??';
        if (!($email = _fieldrow(sql_filter($sql, 1, 1)))) {
            $this->e('No queue emails.');
        }
        set_time_limit(0);
        if (!$email['email_start']) {
            $sql = 'UPDATE _email SET email_start = ?
				WHERE email_id = ?';
            _sql(sql_filter($sql, time(), $email['email_id']));
        }
        $sql = 'SELECT user_id, user_username, user_email
			FROM _members
			WHERE user_type = ?
				AND user_id <> ?
			ORDER BY user_username
			LIMIT ??, ??';
        $members = _rowset(sql_filter($sql, 1, 1, $email['email_last'], 100));
        $i = 0;
        foreach ($members as $row) {
            if (!preg_match('/^[a-z0-9\\.\\-_\\+]+@[a-z0-9\\-_]+\\.([a-z0-9\\-_]+\\.)*?[a-z]+$/is', $row['user_email'])) {
                continue;
            }
            if (!$i) {
                include XFS . 'core/emailer.php';
                $emailer = new emailer();
            }
            $emailer->use_template('mass');
            $emailer->format('plain');
            $emailer->from('TWC Kaulitz <*****@*****.**>');
            $emailer->set_subject(entity_decode($email['email_subject']));
            $emailer->email_address($row['user_email']);
            $emailer->assign_vars(array('USERNAME' => $row['user_username'], 'MESSAGE' => entity_decode($email['email_message'])));
            $emailer->send();
            $emailer->reset();
            sleep(2);
            $i++;
        }
        if ($i) {
            $email['email_last'] += $i;
            $sql = 'UPDATE _email SET email_last = ?
				WHERE email_id = ?';
            _sql(sql_filter($sql, $email['email_last'], $email['email_id']));
        } else {
            $sql = 'UPDATE _email SET email_active = ?, email_end = ?
				WHERE email_id = ?';
            _sql(sql_filter($sql, 0, time(), $email['email_id']));
            $this->e('Finished processing [' . $email['email_id'] . '] emails.');
        }
        $this->e('Processed ' . $i . ' emails.');
        return;
    }
コード例 #2
0
ファイル: user_name_change.php プロジェクト: nopticon/rockr
	public function _home() {
		global $config, $user, $cache;

		if (!_button()) {
			return false;
		}

		$username1 = request_var('username1', '');
		$username2 = request_var('username2', '');
		if (empty($username1) || empty($username2)) {
			fatal_error();
		}

		$username_base1 = get_username_base($username1);
		$username_base2 = get_username_base($username2);

		$sql = 'SELECT *
			FROM _members
			WHERE username_base = ?';
		if (!$userdata = sql_fieldrow(sql_filter($sql, $username_base1))) {
			_pre('El usuario no existe.', true);
		}

		$sql = 'SELECT *
			FROM _members
			WHERE username_base = ?';
		if ($void = sql_fieldrow(sql_filter($sql, $username_base2))) {
			_pre('El usuario ya existe.', true);
		}

		//
		$sql = 'UPDATE _members SET username = ?, username_base = ?
			WHERE user_id = ?';
		sql_query(sql_filter($sql, $username2, $username_base2, $userdata['user_id']));

		$emailer = new emailer();

		$emailer->from('info');
		$emailer->use_template('username_change', $config['default_lang']);
		$emailer->email_address($userdata['user_email']);

		$emailer->assign_vars(array(
			'USERNAME' => $userdata['username'],
			'NEW_USERNAME' => $username2,
			'U_USERNAME' => s_link('m', $username_base2))
		);
		$emailer->send();
		$emailer->reset();

		redirect(s_link('m', $username_base2));

		return;
	}
コード例 #3
0
ファイル: _birthday.php プロジェクト: nopticon/noptc
    function home()
    {
        $sql = 'SELECT *
			FROM _members
			WHERE user_type = ?
				AND user_birthday LIKE ?
				AND user_birthday_last < ?
			ORDER BY user_username
			LIMIT ??';
        $birthday = _rowset(sql_filter($sql, 1, '%' . date('md'), date('Y'), 10));
        if (!$birthday) {
            $this->e('None.');
        }
        $process = w();
        foreach ($birthday as $i => $row) {
            if (!$i) {
                @set_time_limit(0);
                require XFS . 'core/emailer.php';
                $emailer = new emailer();
            }
            $emailer->format('plain');
            $emailer->from('TWC Kaulitz <*****@*****.**>');
            $emailer->use_template('user_birthday');
            $emailer->email_address($row['user_email']);
            $emailer->assign_vars(array('USERNAME' => $row['user_username']));
            $emailer->send();
            $emailer->reset();
            $process[$row['user_id']] = $row['user_username'];
        }
        if (count($process)) {
            $sql = 'UPDATE _members SET user_birthday_last = ?
				WHERE user_id IN (??)';
            _sql(sql_filter($sql, date('Y'), _implode(',', array_keys($process))));
        }
        return $this->e('Done @ ' . implode(',', array_values($process)));
    }
コード例 #4
0
ファイル: privmsg.php プロジェクト: Nekrofage/FJR
 if ($mode != 'edit') {
     //
     // Add to the users new pm counter
     //
     $sql = "UPDATE " . USERS_TABLE . "\r\n\t\t\t\tSET user_new_privmsg = user_new_privmsg + 1, user_last_privmsg = " . time() . "  \r\n\t\t\t\tWHERE 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']) {
         $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']) . '/' : '/';
         include $phpbb_root_path . 'includes/emailer.' . $phpEx;
         $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' => stripslashes($to_username), 'SENDER_USERNAME' => htmlspecialchars($userdata['username']), 'PM_SUBJECT' => $privmsg_subject, 'PM_MESSAGE' => $message_text, '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();
     }
 }
 /*
 $template->assign_vars(array(
 	'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("privmsg.$phpEx?folder=inbox") . '">')
 );
 
コード例 #5
0
     $error_msg .= !empty($error_msg) ? '<br />' . $message : $message;
 }
 if (!$error) {
     include "../includes/emailer.php";
     //
     // Let's do some checking to make sure that mass mail functions
     // are working in win32 versions of php.
     //
     if (preg_match('/[c-z]:\\\\.*/i', getenv('PATH')) && !$board_config['smtp_delivery']) {
         $ini_val = @phpversion() >= '4.0.0' ? 'ini_get' : 'get_cfg_var';
         // We are running on windows, force delivery to use our smtp functions
         // since php's are broken by default
         $board_config['smtp_delivery'] = 1;
         $board_config['smtp_host'] = @$ini_val('SMTP');
     }
     $emailer = new emailer($board_config['smtp_delivery']);
     $emailer->from($board_config['board_email']);
     $emailer->replyto($board_config['board_email']);
     for ($i = 0; $i < count($bcc_list); $i++) {
         $emailer->bcc($bcc_list[$i]);
     }
     $email_headers = 'X-AntiAbuse: Board servername - ' . $board_config['server_name'] . "\n";
     $email_headers .= 'X-AntiAbuse: User_id - ' . $userdata['user_id'] . "\n";
     $email_headers .= 'X-AntiAbuse: Username - ' . $userdata['username'] . "\n";
     $email_headers .= 'X-AntiAbuse: User IP - ' . decode_ip($user_ip) . "\n";
     $emailer->use_template('admin_send_email');
     $emailer->email_address($board_config['board_email']);
     $emailer->set_subject($subject);
     $emailer->extra_headers($email_headers);
     $emailer->assign_vars(array('SITENAME' => $board_config['sitename'], 'BOARD_EMAIL' => $board_config['board_email'], 'MESSAGE' => $message));
     $emailer->send();
コード例 #6
0
 } else {
     if ($board_config['require_activation'] == USER_ACTIVATION_SELF) {
         $message = $lang['Account_inactive'];
         $email_template = 'user_welcome_inactive';
     } else {
         if ($board_config['require_activation'] == USER_ACTIVATION_ADMIN) {
             $message = $lang['Account_inactive_admin'];
             $email_template = 'admin_welcome_inactive';
         } else {
             $message = $lang['Account_added'];
             $email_template = 'user_welcome';
         }
     }
 }
 include "includes/emailer.php";
 $emailer = new emailer($board_config['smtp_delivery']);
 $emailer->from($board_config['board_email']);
 $emailer->replyto($board_config['board_email']);
 $emailer->use_template($email_template, stripslashes($user_lang));
 $emailer->email_address($email);
 $emailer->set_subject(sprintf($lang['Welcome_subject'], $board_config['sitename']));
 if ($coppa) {
     $emailer->assign_vars(array('SITENAME' => $board_config['sitename'], 'WELCOME_MSG' => sprintf($lang['Welcome_subject'], $board_config['sitename']), 'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\\'", "'", $username), 0, 25)), 'PASSWORD' => $password_confirm, 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']), 'FAX_INFO' => $board_config['coppa_fax'], 'MAIL_INFO' => $board_config['coppa_mail'], 'EMAIL_ADDRESS' => $email, 'ICQ' => $icq, 'AIM' => $aim, 'YIM' => $yim, 'MSN' => $msn, 'WEB_SITE' => $website, 'FROM' => $location, 'OCC' => $occupation, 'INTERESTS' => $interests, 'SITENAME' => $board_config['sitename']));
 } else {
     $emailer->assign_vars(array('SITENAME' => $board_config['sitename'], 'WELCOME_MSG' => sprintf($lang['Welcome_subject'], $board_config['sitename']), 'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\\'", "'", $username), 0, 25)), 'PASSWORD' => $password_confirm, 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']), 'U_ACTIVATE' => $server_url . '&mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey));
 }
 $emailer->send();
 $emailer->reset();
 if ($board_config['require_activation'] == USER_ACTIVATION_ADMIN) {
     $sql = "SELECT user_email, user_lang\n                                        FROM " . USERS_TABLE . "\n                                        WHERE user_level = " . ADMIN;
     if (!($result = $db->sql_query($sql))) {
コード例 #7
0
ファイル: group.php プロジェクト: ErR163/torrentpier
             } else {
                 if (!empty($_POST['deny']) || !empty($_POST['remove'])) {
                     DB()->query("\n\t\t\t\t\t\tDELETE FROM " . BB_USER_GROUP . "\n\t\t\t\t\t\tWHERE user_id IN({$sql_in})\n\t\t\t\t\t\t\tAND group_id = {$group_id}\n\t\t\t\t\t");
                     if (!empty($_POST['remove'])) {
                         update_user_level($sql_in);
                     }
                 }
             }
             // Email users when they are approved
             if (!empty($_POST['approve']) && $bb_cfg['group_send_email']) {
                 $sql_select = "SELECT username, user_email, user_lang\n\t\t\t\t\t\tFROM " . BB_USERS . "\n\t\t\t\t\t\tWHERE user_id IN({$sql_in})";
                 if (!($result = DB()->sql_query($sql_select))) {
                     bb_die('Could not get user email information');
                 }
                 require CLASS_DIR . 'emailer.php';
                 $emailer = new emailer($bb_cfg['smtp_delivery']);
                 $emailer->from($bb_cfg['sitename'] . " <{$bb_cfg['board_email']}>");
                 foreach (DB()->fetch_rowset($sql_select) as $row) {
                     $emailer->use_template('group_approved', $row['user_lang']);
                     $emailer->email_address($row['username'] . " <{$row['user_email']}>");
                 }
                 $emailer->assign_vars(array('SITENAME' => $bb_cfg['sitename'], 'GROUP_NAME' => $group_info['group_name'], 'U_GROUP' => make_url(GROUP_URL . $group_id)));
                 $emailer->send();
                 $emailer->reset();
             }
         }
     }
 }
 // END approve or deny
 // Get moderator details for this group
 $group_moderator = DB()->fetch_row("\n\t\tSELECT *\n\t\tFROM " . BB_USERS . "\n\t\tWHERE user_id = " . $group_info['group_moderator'] . "\n\t");
コード例 #8
0
ファイル: mail_digests.php プロジェクト: ALTUN69/icy_phoenix
	{
		$msg .= '</table>' . $line_break;
	}

	if ($msg_count == 0)
	{
		$msg .= $parastart . $lang['digest_no_new_messages'] . $paraend;
	}

	// Send the email if there are messages or if user selected to send email anyhow
	if (($msg_count > 0) || ($row['send_on_no_messages'] == 'YES'))
	{

		if (!is_object($emailer))
		{
			$emailer = new emailer();
		}

		$emailer->use_template('mail_digests', $row['user_lang']);
		if ($html)
		{
			// Apply a style sheet if requested for HTML digest. If no style sheet is wanted then the
			// link tag pointing to the style sheet is not displayed. A custom style sheet gets first priority.
			/*
			if ($link_tag_unset)
			{
				$stylesheet = '';
				if (DIGEST_USE_CUSTOM_STYLESHEET)
				{
					$stylesheet = DIGEST_CUSTOM_STYLESHEET_PATH;
				}
コード例 #9
0
ファイル: _tree.php プロジェクト: nopticon/noptc
    public function home()
    {
        global $core, $user;
        $tree = $this->valid_tree();
        $v = $this->__(_array_keys(w('is_comment is_form'), 0));
        // Form posting enabled and form submitted
        if ($v['is_form'] && _button()) {
            if (!is_ghost()) {
                _fatal(405);
            }
            if (!$tree['tree_form']) {
                _fatal();
            }
            $sql_fields = 'SELECT form_alias, form_required, form_legend, form_regex, 
				FROM _form_fields
				WHERE form_tree = ?
				ORDER BY form_order';
            if (!($form = _rowset(sql_filter($sql_fields, $tree['tree_id']), 'form_alias'))) {
                $form = _rowset(sql_filter($sql_fields, 0), 'form_alias');
            }
            $form['secure'] = array('form_required' => 1, 'form_regex' => '^([a-zA-Z]+)$', 'form_alias' => 'secure', 'form_type' => 'text', 'form_legend' => _lang('XCF_LEGEND'));
            foreach ($form as $row) {
                $v = array_merge($v, $this->__(array($row['form_alias'])));
                if (!f($v[$row['form_alias']])) {
                    if ($row['form_required']) {
                        $this->_error(sprintf(_lang('E_COMMENT_FIELD_EMPTY'), $row['form_legend']), false);
                    }
                    continue;
                }
                if (f($row['form_regex']) && !preg_match('#' . $row['form_regex'] . '#is', $v[$row['form_alias']])) {
                    $this->_error(sprintf(_lang('E_COMMENT_FIELD_BAD'), $row['form_legend']), false);
                    if ($row['form_alias'] == 'secure') {
                        $v[$row['form_alias']] = '';
                    }
                }
            }
            require_once XFS . 'core/xcf.php';
            $xcf = new captcha();
            if ($xcf->check($v['secure']) === false) {
                $v['secure'] = '';
                $this->_error('#E_COMMENT_INVALID_CAPTCHA');
            }
            unset($xcf);
            require_once XFS . 'core/emailer.php';
            $emailer = new emailer();
            $emailer->set_decode(true);
            $emailer->format('plain');
            $emailer->from($v['address']);
            $emailer->set_subject(_rm_acute($v['subject']));
            $emailer->use_template('contact_email');
            if (f($core->v('default_email'))) {
                $tree['tree_form_email'] .= (f($tree['tree_form_email']) ? ';' : '') . $core->v('default_email');
            }
            $form_addresses = array_map('trim', array_unique(explode(';', $tree['tree_form_email'])));
            foreach ($form_addresses as $i => $address) {
                $row_f = !$i ? 'email_address' : 'cc';
                $emailer->{$row_f}($address);
            }
            unset($v['secure']);
            $content = w();
            foreach ($form as $row) {
                if (!f($v[$row['form_alias']])) {
                    continue;
                }
                $content[] = $row['form_legend'] . ":\n" . $v[$row['form_alias']];
            }
            $emailer->assign_vars(array('CONTENT' => implode("\n\n", $content), 'FORM_ARTICLE' => $tree['tree_subject']));
            $emailer->send();
            $emailer->reset();
            $response = array('lang' => _lang('FORM_SUCCESS'));
            $this->e(json_encode($response));
        }
        // Comment posting enabled and form submitted.
        if ($v['is_comment'] && _button()) {
            if (!$tree['tree_allow_comments']) {
                _fatal();
            }
            $cv = $this->__(w('comment_username comment_address comment_website comment_message comment_security'));
            $comment_time = time();
            if (!$user->v('is_member')) {
                foreach ($cv as $cv_k => $cv_v) {
                    if (!f($cv_v)) {
                        $this->error('E_COMMENT_FILL_FIELDS');
                        break;
                    }
                }
                if (!$this->errors()) {
                    $sql = 'SELECT comment_time
						FROM _comments
						WHERE comment_ip = ?
							AND comment_status = 0';
                    if ($row_flood = _fieldrow(sql_filter($sql, $user->ip))) {
                        if ($comment_time - $row_flood['comment_time'] < 30) {
                            $this->error('E_COMMENT_FLOOD_TIME');
                        }
                    }
                }
                // CAPTCHA verification
                require_once XFS . 'core/xcf.php';
                $xcf = new captcha();
                if ($xcf->check($cv['comment_security']) === false) {
                    $cv['comment_security'] = '';
                    $this->error('E_COMMENT_INVALID_CAPTCHA');
                }
                unset($xcf);
            }
            if (!$this->errors()) {
                $approve_comments = !$user->v('is_member') ? $tree['tree_approve_comments'] : 1;
                $sql_insert = array('tree' => (int) $tree['tree_id'], 'uid' => (int) $user->v('user_id'), 'username' => $cv['comment_username'], 'email' => $cv['comment_address'], 'website' => $cv['comment_website'], 'ip' => $user->ip, 'status' => (int) $approve_comments, 'time' => (int) $comment_time, 'message' => $cv['comment_message']);
                $sql = 'INSERT INTO _comments' . _build_array('INSERT', prefix('comment', $sql_insert));
                _sql($sql);
                if ($approve_comments) {
                    $sql = 'UPDATE _tree SET tree_comments = tree_comments + 1
						WHERE tree_id = ?';
                    _sql(sql_filter($sql, $tree['tree_id']));
                }
                // Send new comment email notification for approval.
                if (!$approve_comments) {
                    unset($cv['comment_security']);
                    require_once XFS . 'core/emailer.php';
                    $emailer = new emailer();
                    $emailer->from($cv['comment_address']);
                    $emailer->use_template('comment_approval');
                    if (f($tree['tree_form_email'])) {
                        $tree['tree_form_email'] = $core->v('default_comments_email');
                    }
                    foreach (explode(';', $tree['tree_form_email']) as $i => $row) {
                        $row_f = !$i ? 'email_address' : 'cc';
                        $emailer->{$row_f}($row);
                    }
                    $input = w();
                    foreach ($cv as $row_k => $row_v) {
                        if (!f($row_v)) {
                            continue;
                        }
                        if ($row_k == 'comment_message') {
                            $row_v = str_replace("\r\n", '<br />', $row_v);
                        }
                        $input[] = '&lt; ' . $row_v;
                    }
                    $emailer->assign_vars(array('U_APPROVAL' => _link(_rewrite($tree), array('x1' => 'comments')), 'INPUT_FIELDS' => implode('<br /><br />', $input), 'FROM_USERNAME' => $cv['comment_username']));
                    $emailer->send();
                    $emailer->reset();
                }
                redirect(_link(_rewrite($tree)));
            }
            if ($this->errors()) {
                if (is_ghost()) {
                    $this->e('!');
                }
                _style('comments_error', array('MESSAGE' => $this->get_errors()));
            }
        }
        //
        if (f($tree['tree_redirect'])) {
            if (preg_match('#^[a-z0-9\\-\\_]+$#is', $tree['tree_redirect'])) {
                $tree['tree_redirect'] = _link($tree['tree_redirect']);
            }
            redirect($tree['tree_redirect']);
        }
        //
        if ($tree['tree_parent']) {
            $sql = 'SELECT *
				FROM _tree
				WHERE tree_id = ?';
            $parent = _fieldrow(sql_filter($sql, $tree['tree_parent']));
            if ($tree['tree_level'] > 2) {
                $sql = 'SELECT *
					FROM _tree
					WHERE tree_id = ?';
                $subparent = _fieldrow(sql_filter($sql, $parent['tree_parent']));
            }
        }
        if ($tree['tree_node']) {
            $sql = 'SELECT *
				FROM _tree
				WHERE tree_id = ?';
            $node = _fieldrow(sql_filter($sql, $tree['tree_node']));
        }
        //
        if (@method_exists($this, 'cf_' . _rewrite($tree))) {
            $this->{'cf_' . _rewrite($tree)}($tree);
        }
        //
        $sql = 'SELECT *
			FROM _tree
			WHERE tree_parent = ?
				AND tree_child_hide = 0
			ORDER BY ??';
        $childs = _rowset(sql_filter($sql, $tree['tree_id'], $this->child_order($tree)));
        foreach ($childs as $i => $row) {
            if (!$i) {
                $sql = 'SELECT image_id, image_tree, image_extension
					FROM _images
					WHERE image_tree IN (??)
					ORDER BY RAND()';
                $images_child = _rowset(sql_filter($sql, _implode(',', array_keys($childs))), 'tree_id');
                _style('tree_child1', array('ORDER_URL' => _link($tree['tree_id'], array('order', 0, 0, 0, 0))));
            }
            _style('tree_child.row', array('ITEM' => $row['tree_id'], 'URL' => _link(_rewrite($row)), 'SUBJECT' => $row['tree_subject'], 'CONTENT' => $row['tree_content'], 'EDITED' => _format_date($row['tree_edited']), 'IMAGE' => isset($images_child[$row['tree_id']]) ? $images_child[$row['tree_id']]['image_id'] . '.' . $images_child[$row['tree_id']]['image_extension'] : 'default.gif'));
        }
        // Comments
        if ($tree['tree_allow_comments'] && $tree['tree_comments']) {
            $sql = 'SELECT c.comment_id, c.comment_username, c.comment_website, c.comment_time, c.comment_message, m.user_username
				FROM _comments c, _members m
				WHERE c.comment_tree = ?
					AND c.comment_status = 1
					AND c.comment_uid = m.user_id
				ORDER BY c.comment_time DESC';
            $comments = _rowset(sql_filter($sql, $tree['tree_id']));
            foreach ($comments as $i => $row) {
                if (!$i) {
                    _style('comments');
                }
                _style('comments.row', array('ID' => $row['comment_id'], 'SUSERNAME' => $row['user_username'], 'USERNAME' => $row['comment_username'], 'WEBSITE' => $row['comment_website'], 'TIME' => _format_date($row['comment_time']), 'MESSAGE' => str_replace("\n", '<br />', $row['comment_message'])));
            }
        }
        //
        if ($this->css_parent($tree)) {
            $sql = 'SELECT *
				FROM _tree
				WHERE tree_parent = ?
					AND tree_child_hide = 0
				ORDER BY ??';
            $childs_parent = _rowset(sql_filter($sql, $this->css_var($tree), $this->child_order($tree)));
            foreach ($childs_parent as $i => $row) {
                if (!$i) {
                    $sql = 'SELECT image_id, image_tree, image_extension
						FROM _images
						WHERE image_tree IN (??)
						ORDER BY RAND()';
                    $images_child_parent = _rowset(sql_filter($sql, _implode(',', array_keys($childs_parent))), 'tree_id');
                    _style('tree_child', array('ORDER_URL' => _link($tree['tree_id'], array('order', 0, 0, 0, 0))));
                }
                _style('tree_child_parent.row', array('ITEM' => $row['tree_id'], 'URL' => _link(_rewrite($row)), 'TITLE' => $row['tree_subject'], 'IMAGE' => isset($images_child_parent[$row['tree_id']]) ? $images_child_parent[$row['tree_id']]['image_id'] . '.' . $images_child_parent[$row['tree_id']]['image_extension'] : 'default.gif'));
            }
        }
        if ($tree['tree_downloads']) {
            $sql = 'SELECT *
				FROM _downloads
				WHERE download_tree = ?
				ORDER BY download_order';
            $downloads = _rowset(sql_filter($sql, $tree['tree_id']));
            foreach ($downloads as $i => $row) {
                if (!$i) {
                    _style('downloads', array('ORDER_URL' => _link($tree['tree_id'], array('orderd', 0, 0, 0, 0))));
                }
                _style('downloads.row', array('ITEM' => $row['download_id'], 'DOWNLOAD' => _link('get', $row['download_alias'] . '.' . $row['download_extension']), 'TITLE' => $row['download_title']));
            }
        }
        //
        if ($tree['tree_form']) {
            $sql = 'SELECT *
				FROM _form_fields
				WHERE form_tree = ?
				ORDER BY form_order';
            $form = _rowset(sql_filter($sql, $tree['tree_id']), 'form_alias');
            if (!count($form)) {
                $sql = 'SELECT *
					FROM _form_fields
					WHERE form_tree = 0
					ORDER BY form_order';
                $form = _rowset($sql, 'form_alias');
            }
            $form['secure'] = array('form_required' => 1, 'form_regex' => '^([a-zA-Z]+)$', 'form_alias' => 'secure', 'form_type' => 'text', 'form_legend' => 'Imagen de seguridad');
            _style('form', array('URL' => _link(_rewrite($tree))));
            foreach ($form as $row) {
                _style('form.row', array('ALIAS' => $row['form_alias'], 'REQUIRED' => $row['form_required'], 'LEGEND' => _lang($row['form_legend']), 'TYPE' => $row['form_type'], 'PAGE' => $tree['tree_alias']));
                foreach ($row as $row_k => $row_v) {
                    if (preg_match('#^form_(alias|type)$#is', $row_k)) {
                        if ($row_k == 'form_alias') {
                            $row_k = 'name';
                        }
                        _style('form.row.attrib', array('ATTRIB' => str_replace('form_', '', $row_k), 'VALUE' => $row_v));
                    }
                }
            }
        }
        $s_css_page = '';
        if (@file_exists('./style/css/_tree_' . _rewrite($tree) . '.css')) {
            $s_css_page = _rewrite($tree) . '/';
        } elseif ($this->css_parent($tree)) {
            if (!f($tree['tree_css_var'])) {
                $tree['tree_css_var'] = 'parent';
            }
            $ary_css_var = false;
            switch ($tree['tree_css_var']) {
                case 'parent':
                case 'subparent':
                case 'node':
                    $ary_css_var = ${$tree['tree_css_var']};
                    break;
                default:
                    if (is_numb($tree['tree_css_var'])) {
                        $sql = 'SELECT *
							FROM _tree
							WHERE tree_id = ?';
                        if ($css_var_row = _fieldrow(sql_filter($sql, $tree['tree_css_var']))) {
                            $ary_css_var = $css_var_row;
                        }
                    }
                    break;
            }
            if ($ary_css_var !== false) {
                $s_css_page = _rewrite($ary_css_var) . '/';
            }
        }
        v_style(array('S_IMAGES' => $core->v('address') . 'container/images/a_' . ($this->css_parent($tree) ? $this->css_var($tree) : $tree['tree_id']) . '/', 'V_TREE' => $tree['tree_id'], 'V_CSS' => $s_css_page, 'V_SUBJECT' => $tree['tree_subject'], 'V_CONTENT' => _message($tree['tree_content']), 'V_COMMENTS' => $tree['tree_comments'], 'V_ALLOW_COMMENTS' => $tree['tree_allow_comments'], 'V_ALLOW_FORM' => $tree['tree_form'], 'U_COMMENTS' => _link(_rewrite($tree)), 'U_XCF' => _link(_rewrite($tree) . '-xs.jpg', false, false)));
        $tree['tree_subject'] = strip_tags($tree['tree_subject']);
        //
        if ($tree['tree_alias'] != 'home') {
            if ($node['tree_id'] != $parent['tree_id']) {
                $this->navigation($node['tree_subject'], _rewrite($node));
            }
            if ($tree['tree_level'] > 2) {
                if ($parent['tree_id'] && $node['tree_id'] && $tree['tree_level'] > 3) {
                    $this->navigation('...');
                }
                $this->navigation($subparent['tree_subject'], _rewrite($subparent));
            }
            if ($parent['tree_id']) {
                $this->navigation($parent['tree_subject'], _rewrite($parent));
            }
            $this->navigation($tree['tree_subject'], _rewrite($tree));
        }
        if ($user->v('is_member')) {
            $tree['tree_cp'] = 1;
            $i = 0;
            $auth_tree = array('create', 'modify', 'remove');
            foreach ($auth_tree as $row) {
                if (_auth_get('cp_' . $row)) {
                    if (!$i) {
                        _style('auth');
                    }
                    _style('auth.row', array('U_AUTH' => _link('cp', array($row, _rewrite($tree))), 'V_NAME' => _lang('CP_AUTH_' . $row)));
                    $i++;
                }
            }
        }
        //
        $this->_template('tree');
        if (f($tree['tree_template']) && @file_exists('./style/custom/' . $tree['tree_template'] . '.htm')) {
            $this->_template('custom/' . $tree['tree_template']);
        }
        // TODO: 304 header response
        header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $tree['tree_edited']) . ' GMT');
        return;
    }
コード例 #10
0
         unset($user_id);
         $i++;
     }
     $template->set_filenames(array('body' => ADM_TPL . 'userlist_group.tpl'));
     $template->assign_vars(array('MESSAGE_TITLE' => $lang['Add_group'], 'MESSAGE_TEXT' => $lang['Add_group_explain'], 'L_GROUP' => $lang['Group'], 'S_GROUP_VARIABLE' => POST_GROUPS_URL, 'S_ACTION' => append_sid(IP_ROOT_PATH . ADM . '/admin_userlist.' . PHP_EXT . '?mode=group'), 'L_GO' => $lang['Go'], 'L_CANCEL' => $lang['Cancel'], 'L_SELECT' => $lang['Select_one'], 'S_HIDDEN_FIELDS' => $hidden_fields));
     $sql = "SELECT group_id, group_name FROM " . GROUPS_TABLE . "\n\t\t\t\tWHERE group_single_user <> " . TRUE . "\n\t\t\t\tORDER BY group_name";
     $result = $db->sql_query($sql);
     // loop through groups
     while ($row = $db->sql_fetchrow($result)) {
         $template->assign_block_vars('grouprow', array('GROUP_NAME' => $row['group_name'], 'GROUP_ID' => $row['group_id']));
     }
 } else {
     // add the users to the selected group
     $group_id = intval($_POST[POST_GROUPS_URL]);
     include IP_ROOT_PATH . 'includes/emailer.' . PHP_EXT;
     $emailer = new emailer();
     $i = 0;
     while ($i < sizeof($user_ids)) {
         $user_id = intval($user_ids[$i]);
         // For security, get the ID of the group moderator.
         $sql = "SELECT g.group_moderator, g.group_type, aa.auth_mod\n\t\t\t\t\tFROM (" . GROUPS_TABLE . " g\n\t\t\t\t\tLEFT JOIN " . AUTH_ACCESS_TABLE . " aa ON aa.group_id = g.group_id)\n\t\t\t\t\tWHERE g.group_id = {$group_id}";
         $result = $db->sql_query($sql);
         $group_info = $db->sql_fetchrow($result);
         $sql = "SELECT user_id, user_email, user_lang, user_level\n\t\t\t\t\tFROM " . USERS_TABLE . "\n\t\t\t\t\tWHERE user_id = {$user_id}";
         $result = $db->sql_query($sql);
         $row = $db->sql_fetchrow($result);
         $sql = "SELECT ug.user_id, u.user_level\n\t\t\t\t\tFROM " . USER_GROUP_TABLE . " ug, " . USERS_TABLE . " u\n\t\t\t\t\tWHERE u.user_id = " . $row['user_id'] . "\n\t\t\t\t\t\tAND ug.user_id = u.user_id\n\t\t\t\t\t\tAND ug.group_id = {$group_id}";
         $result = $db->sql_query($sql);
         if (!$db->sql_fetchrow($result)) {
             $sql = "INSERT INTO " . USER_GROUP_TABLE . " (user_id, group_id, user_pending)\n\t\t\t\t\t\tVALUES (" . $row['user_id'] . ", {$group_id}, 0)";
             $db->sql_query($sql);
コード例 #11
0
ファイル: auction_cron.php プロジェクト: wrtcoder/mini_isp
function notifyUser($user_id, $notify_type, $offer_id, $offer_title)
{
    global $db, $lang, $auction_config_data, $board_config;
    if ($auction_config_data['auction_end_notify_email']) {
        // BEGIN EMAIL-NOTIFY
        $sql = "SELECT user_email,\r\n                         username\r\n                  FROM " . USERS_TABLE . "\r\n                  WHERE user_id=" . $user_id . "";
        if (!($result = $db->sql_query($sql))) {
        }
        // if
        $user = $db->sql_fetchrow($result);
        $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']) . '/' : '/';
        $username = $user['username'];
        $email = $user['user_email'];
        $emailer = new emailer($board_config['smtp_delivery']);
        $emailer->from($board_config['board_email']);
        $emailer->replyto($board_config['board_email']);
        if ($notify_type == 'WON') {
            $emailer->use_template('auction_won', stripslashes($user_lang));
            $emailer->set_subject($lang['auction_won']);
            $emailer->assign_vars(array('AUCTION_WON' => $lang['auction_offer_won'], 'AUCTION_SITENAME' => $board_config['sitename'], 'AUCTION_OFFER' => prepare_message(addslashes(unprepare_message(htmlspecialchars(trim(stripslashes($offer_title))))), $board_config['allow_html'], $board_config['allow_bbcode'], $board_config['allow_smilies'], 0), 'U_AUCTION_OFFER' => $server_protocol . $server_name . $board_config['script_path'] . 'auction_offer_view.php?ao=' . $offer_id, 'AUCTION_EMAIL_SIG' => !empty($board_config['board_email_sig']) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : ''));
        }
        if ($notify_type == 'SOLD') {
            $emailer->use_template('auction_sold', stripslashes($user_lang));
            $emailer->set_subject($lang['auction_sold']);
            $emailer->assign_vars(array('AUCTION_SOLD' => $lang['auction_offer_sold'], 'AUCTION_SITENAME' => $board_config['sitename'], 'AUCTION_OFFER' => prepare_message(addslashes(unprepare_message(htmlspecialchars(trim(stripslashes($offer_title))))), $board_config['allow_html'], $board_config['allow_bbcode'], $board_config['allow_smilies'], 0), 'U_AUCTION_OFFER' => $server_protocol . $server_name . $board_config['script_path'] . 'auction_offer_view.php?ao=' . $offer_id, 'AUCTION_EMAIL_SIG' => !empty($board_config['board_email_sig']) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : ''));
        }
        if ($notify_type == 'NOT_SOLD') {
            $emailer->use_template('auction_not_sold', stripslashes($user_lang));
            $emailer->set_subject($lang['auction_not_sold']);
            $emailer->assign_vars(array('AUCTION_NOT_SOLD' => $lang['auction_offer_not_sold'], 'AUCTION_SITENAME' => $board_config['sitename'], 'AUCTION_OFFER' => prepare_message(addslashes(unprepare_message(htmlspecialchars(trim(stripslashes($offer_title))))), $board_config['allow_html'], $board_config['allow_bbcode'], $board_config['allow_smilies'], 0), 'U_AUCTION_OFFER' => $server_protocol . $server_name . $board_config['script_path'] . 'auction_offer_view.php?ao=' . $offer_id, 'AUCTION_EMAIL_SIG' => !empty($board_config['board_email_sig']) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : ''));
        }
        $emailer->email_address($email);
        // Try to send email...
        $emailer->send();
        //          $emailer->reset();
    }
    // END EMAIL-NOTIFY
    if ($auction_config_data['auction_end_notify_pm']) {
        // BEGIN PM-NOTIFY ON OUTBID
        if ($notify_type == 'WON') {
            $pm_subject = $lang['auction_won'];
            $pm_text = $lang['auction_won_text'];
        }
        if ($notify_type == 'SOLD') {
            $pm_subject = $lang['auction_sold'];
            $pm_text = $lang['auction_sold_text'];
        }
        if ($notify_type == 'NOT_SOLD') {
            $pm_subject = $lang['auction_not_sold'];
            $pm_text = $lang['auction_not_sold_text'];
        }
        $privmsgs_date = date("U");
        $sql = "INSERT INTO " . PRIVMSGS_TABLE . "\r\n                     (privmsgs_type,\r\n                      privmsgs_subject,\r\n                      privmsgs_from_userid,\r\n                      privmsgs_to_userid,\r\n                      privmsgs_date,\r\n                      privmsgs_enable_html,\r\n                      privmsgs_enable_bbcode,\r\n                      privmsgs_enable_smilies,\r\n                      privmsgs_attach_sig)\r\n                  VALUES ('0',\r\n                          '" . str_replace("\\'", "''", addslashes(sprintf($pm_subject, $board_config['sitename']))) . "',\r\n                          '2',\r\n                          " . $user_id . ",\r\n                          " . $privmsgs_date . ",\r\n                          '0',\r\n                          '1',\r\n                          '1',\r\n                          '0')";
        if (!$db->sql_query($sql)) {
        }
        // if
        $outbid_sent_id = $db->sql_nextid();
        $sql = "INSERT INTO " . PRIVMSGS_TEXT_TABLE . "\r\n                      (privmsgs_text_id,\r\n                       privmsgs_text)\r\n                   VALUES (" . $outbid_sent_id . ",\r\n                           '" . str_replace("\\'", "''", $pm_text . "</br></br><a href=\"auction_offer_view.php?ao=" . $offer_id . "\">" . prepare_message(addslashes(unprepare_message(htmlspecialchars(trim(stripslashes($offer_title))))), $board_config['allow_html'], $board_config['allow_bbcode'], $board_config['allow_smilies'], 0) . "</a></br>" . $board_config['board_email_sig']) . "')";
        if (!$db->sql_query($sql)) {
        }
        // if
        $sql = "UPDATE " . USERS_TABLE . "\r\n                   SET user_new_privmsg=user_new_privmsg+1\r\n                   WHERE user_id=" . $user_id;
        if (!$db->sql_query($sql)) {
        }
        // if
    }
    // End pm-notification
}
コード例 #12
0
ファイル: pm.php プロジェクト: themiddleearth/RPG.SU
                 $check = myquery("SELECT user_id FROM view_active_users WHERE user_id={$userid}");
                 if ($check != false and mysql_num_rows($check) > 0) {
                     $chat_mess = '<br><center>Для тебя пришло новое личное сообщение (тема: <font color=#0000FF>' . $theme . '</font>) от игрока <font size=2 color=#FF0000><b><u>' . $name . '</u></b></font> !&nbsp;&nbsp;&nbsp;&nbsp;</center><br>';
                     $say = myquery("insert into game_log (town,fromm,too,message,date,pm_id,ptype) values ('0',0,'{$userid}','" . iconv("Windows-1251", "UTF-8//IGNORE", $chat_mess) . "','" . time() . "'," . $id_pm . ",1)");
                 }
                 echo 'Сообщение игроку <b><font color=red>' . $komu[$i] . '</font></b> отправлено<br>';
                 list($send_pm_email, $email_komu, $send_ICQ, $ICQnumber, $ICQ_pm) = mysql_fetch_array(myquery("SELECT send_pm,email,send_ICQ,ICQnumber,ICQ_pm FROM game_users_data WHERE user_id={$userid}"));
                 if ($send_pm_email == 1) {
                     include "{$dirclass}/class_email.php";
                     $otkogo = $char['name'];
                     $message = "[http://" . domain_name . "] Средиземье :: Эпоха сражений. Письмо от {$otkogo}\n\n";
                     $message .= "Тема: {$theme}\n";
                     $message .= "Дата: " . date("H-i d-m-Y") . "\n";
                     $message .= "Содержание: \n{$post}\n";
                     $subject = 'Средиземье :: Эпоха сражений. Письмо от ' . $otkogo . '.';
                     $e_mail = new emailer();
                     $e_mail->email_init();
                     $e_mail->to = $email_komu;
                     $e_mail->subject = $subject;
                     $e_mail->message = $message;
                     $e_mail->send_mail();
                 }
             } else {
                 echo 'Игрока <b><font color=red>' . $komu[$i] . '</font></b> не существует!<br>';
             }
         }
     }
     echo '<meta http-equiv="refresh" content="3;url=act.php?func=pm&new">';
 } else {
     //Пишем письмо
     if (!isset($_GET['komu'])) {
コード例 #13
0
ファイル: privmsg.php プロジェクト: forummaks/forum_maks
     if ($mode != 'edit') {
         //
         // Add to the users new pm counter
         //
         $sql = "UPDATE " . USERS_TABLE . "\r\n\t\t\t\tSET user_new_privmsg = user_new_privmsg + 1, user_last_privmsg = " . time() . "\r\n\t\t\t\tWHERE 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']) {
             $script_name = preg_replace('/^\\/?(.*?)\\/?$/', "\\1", trim($ft_cfg['script_path']));
             $script_name = $script_name != '' ? $script_name . '/privmsg.php' : 'privmsg.php';
             $server_name = trim($ft_cfg['server_name']);
             $server_protocol = $ft_cfg['cookie_secure'] ? 'https://' : 'http://';
             $server_port = $ft_cfg['server_port'] != 80 ? ':' . trim($ft_cfg['server_port']) . '/' : '/';
             require FT_ROOT . 'includes/emailer.php';
             $emailer = new emailer($ft_cfg['smtp_delivery']);
             $emailer->from($ft_cfg['board_email']);
             $emailer->replyto($ft_cfg['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_username, 'SITENAME' => $ft_cfg['sitename'], 'EMAIL_SIG' => !empty($ft_cfg['board_email_sig']) ? str_replace('<br />', "\n", "-- \n" . $ft_cfg['board_email_sig']) : '', 'U_INBOX' => $server_protocol . $server_name . $server_port . $script_name . '?folder=inbox&mode=read&p=' . $privmsg_sent_id));
             $emailer->send();
             $emailer->reset();
         }
     }
     $template->assign_vars(array('META' => '<meta http-equiv="refresh" content="10;url=' . append_sid("privmsg.php?folder=inbox") . '">'));
     // orig		$msg = $lang['Message_sent'] . '<br /><br />' . sprintf($lang['Click_return_inbox'], '<a href="' . append_sid("privmsg.$phpEx?folder=inbox") . '">', '</a> ') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
     $msg = $lang['Message_sent'] . '<br /><br />' . sprintf($lang['Click_return_inbox'], '<a href="' . append_sid("privmsg.php?folder=inbox") . '">', '</a> ') . sprintf($lang['Click_return_sentbox'], '<a href="' . append_sid("privmsg.{$phpEx}?folder=sentbox") . '">', '</a> ') . sprintf($lang['Click_return_outbox'], '<a href="' . append_sid("privmsg.php?folder=outbox") . '">', '</a> ') . sprintf($lang['Click_return_savebox'], '<a href="' . append_sid("privmsg.php?folder=savebox") . '">', '</a> ') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.php") . '">', '</a>');
     message_die(GENERAL_MESSAGE, $msg);
 } else {
コード例 #14
0
ファイル: usercp_activate.php プロジェクト: bitweaver/phpbb
     if (!$userdata['session_logged_in']) {
         redirect(append_sid('login.' . $phpEx . '?redirect=profile.' . $phpEx . '&mode=activate&' . POST_USERS_URL . '=' . $row['user_id'] . '&act_key=' . trim($HTTP_GET_VARS['act_key'])));
     } else {
         if ($userdata['user_level'] != ADMIN) {
             message_die(GENERAL_MESSAGE, $lang['Not_Authorised']);
         }
     }
 }
 $sql_update_pass = $row['user_newpasswd'] != '' ? ", user_password = '******'", "''", $row['user_newpasswd']) . "', user_newpasswd = ''" : '';
 $sql = "UPDATE " . USERS_TABLE . "\n\t\t\tSET user_active = 1, user_actkey = ''" . $sql_update_pass . " \n\t\t\tWHERE user_id = " . $row['user_id'];
 if (!($result = $db->sql_query($sql))) {
     message_die(GENERAL_ERROR, 'Could not update users table', '', __LINE__, __FILE__, $sql_update);
 }
 if (intval($board_config['require_activation']) == USER_ACTIVATION_ADMIN && $sql_update_pass == '') {
     include $phpbb_root_path . 'includes/emailer.' . $phpEx;
     $emailer = new emailer($board_config['smtp_delivery']);
     $emailer->from($board_config['board_email']);
     $emailer->replyto($board_config['board_email']);
     $emailer->use_template('admin_welcome_activated', $row['user_lang']);
     $emailer->email_address($row['user_email']);
     $emailer->set_subject($lang['Account_activated_subject']);
     $emailer->assign_vars(array('SITENAME' => $board_config['sitename'], 'USERNAME' => $row['username'], 'PASSWORD' => $password_confirm, 'EMAIL_SIG' => !empty($board_config['board_email_sig']) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : ''));
     $emailer->send();
     $emailer->reset();
     $template->assign_vars(array('META' => '<meta http-equiv="refresh" content="10;url=' . append_sid("index.{$phpEx}") . '">'));
     message_die(GENERAL_MESSAGE, $lang['Account_active_admin']);
 } else {
     $template->assign_vars(array('META' => '<meta http-equiv="refresh" content="10;url=' . append_sid("index.{$phpEx}") . '">'));
     $message = $sql_update_pass == '' ? $lang['Account_active'] : $lang['Password_activated'];
     message_die(GENERAL_MESSAGE, $message);
 }
コード例 #15
0
ファイル: card.php プロジェクト: ALTUN69/icy_phoenix
        $e_temp = 'ban_warning';
        // $e_subj = $lang['Ban_warning'];
    }
} else {
    $no_error = false;
}
if ($no_error) {
    $sql = 'SELECT username, user_warnings, user_email, user_lang FROM ' . USERS_TABLE . ' WHERE user_id = "' . $poster_id . '"';
    $result = $db->sql_query($sql);
    $warning_data = $db->sql_fetchrow($result);
    if (!empty($warning_data['user_email'])) {
        $server_url = create_server_url();
        $viewtopic_server_url = $server_url . CMS_PAGE_VIEWTOPIC;
        $from_email = $user->data['user_email'] && $user->data['user_allow_viewemail'] ? $user->data['user_email'] : $config['board_email'];
        include_once IP_ROOT_PATH . 'includes/emailer.' . PHP_EXT;
        $emailer = new emailer();
        $emailer->headers('X-AntiAbuse: Board servername - ' . trim($config['server_name']));
        $emailer->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
        $emailer->headers('X-AntiAbuse: Username - ' . $user->data['username']);
        $emailer->headers('X-AntiAbuse: User IP - ' . $user_ip);
        $emailer->use_template($e_temp, $warning_data['user_lang']);
        $emailer->to($warning_data['user_email']);
        $emailer->from($from_email);
        $emailer->replyto($from_email);
        //$emailer->set_subject($e_subj);
        $email_sig = create_signature($config['board_email_sig']);
        $emailer->assign_vars(array('SITENAME' => $config['sitename'], 'WARNINGS' => $warning_data['user_warnings'], 'TOTAL_WARN' => $config['max_user_bancard'], 'POST_URL' => $viewtopic_server_url . '?' . $forum_id_append . $topic_id_append . POST_POST_URL . '=' . $post_id . '#p' . $post_id, 'EMAIL_SIG' => $email_sig, 'WARNER' => $user->data['username'], 'BLOCK_TIME' => $block_time, 'WARNED_POSTER' => $warning_data['username']));
        $emailer->send();
        $emailer->reset();
    } else {
        $message .= '<br /><br />' . $lang['user_no_email'];
コード例 #16
0
 /**
  * Send user notifications on new topic or reply
  */
 function send_notifications($mode, &$post_data, &$topic_title, &$forum_id, &$topic_id, &$post_id, &$notify_user)
 {
     global $config, $lang, $db, $user;
     global $bbcode;
     $current_time = time();
     include_once IP_ROOT_PATH . 'includes/bbcode.' . PHP_EXT;
     if ($mode != 'delete') {
         if ($mode == 'reply') {
             // Look for users with notification enabled
             $sql = "SELECT u.user_id, u.user_email, u.user_lang, u.username, f.forum_name\n\t\t\t\t\tFROM " . USERS_TABLE . " u, " . TOPICS_WATCH_TABLE . " tw, " . FORUMS_TABLE . " f\n\t\t\t\t\tWHERE tw.topic_id = " . $topic_id . "\n\t\t\t\t\t\tAND " . $db->sql_in_set('tw.user_id', $this->exclude_users, true, true) . "\n\t\t\t\t\t\tAND tw.notify_status = " . TOPIC_WATCH_UN_NOTIFIED . "\n\t\t\t\t\t\tAND f.forum_id = " . $forum_id . "\n\t\t\t\t\t\tAND u.user_id = tw.user_id\n\t\t\t\t\t\tAND u.user_active = 1";
             $result = $db->sql_query($sql);
             while ($row = $db->sql_fetchrow($result)) {
                 if (!in_array($row['user_id'], $this->notify_userid)) {
                     if ($row['user_email'] != '') {
                         $this->notify_userdata[] = array('username' => $row['username'], 'user_email' => $row['user_email'], 'user_lang' => $row['user_lang']);
                     }
                     $this->notify_userid[] = $row['user_id'];
                     $this->notify_forum_name = $row['forum_name'];
                 }
             }
             $db->sql_freeresult($result);
         }
         if ($mode == 'newtopic' || $mode == 'reply') {
             // Reply or New Topic forum notification
             $sql = "SELECT u.user_id, u.user_email, u.user_lang, f.forum_name\n\t\t\t\t\tFROM " . USERS_TABLE . " u, " . FORUMS_WATCH_TABLE . " fw, " . FORUMS_TABLE . " f\n\t\t\t\t\tWHERE fw.forum_id = " . $forum_id . "\n\t\t\t\t\t\tAND " . $db->sql_in_set('fw.user_id', array_merge($this->exclude_users, $this->notify_userid), true, true) . "\n\t\t\t\t\t\tAND fw.notify_status = " . TOPIC_WATCH_UN_NOTIFIED . "\n\t\t\t\t\t\tAND f.forum_id = " . $forum_id . "\n\t\t\t\t\t\tAND f.forum_notify = '1'\n\t\t\t\t\t\tAND u.user_id = fw.user_id\n\t\t\t\t\t\tAND u.user_active = 1";
             $result = $db->sql_query($sql);
             while ($row = $db->sql_fetchrow($result)) {
                 if (!in_array($row['user_id'], $this->notify_userid)) {
                     if ($row['user_email'] != '') {
                         $this->notify_userdata[] = array('username' => $row['username'], 'user_email' => $row['user_email'], 'user_lang' => $row['user_lang']);
                     }
                     $this->notify_userid[] = $row['user_id'];
                     $this->notify_forum_name = $row['forum_name'];
                 }
             }
             $db->sql_freeresult($result);
         }
         // Users array built, so start sending notifications
         if (sizeof($this->notify_userdata) > 0) {
             include_once IP_ROOT_PATH . 'includes/emailer.' . PHP_EXT;
             $emailer = new emailer();
             $server_url = create_server_url();
             $topic_title = unprepare_message($topic_title);
             $topic_title = censor_text($topic_title);
             $post_text = unprepare_message($post_data['message']);
             $post_text = censor_text($post_text);
             if (!empty($config['html_email'])) {
                 $bbcode->allow_bbcode = !empty($config['allow_bbcode']) ? $config['allow_bbcode'] : false;
                 $bbcode->allow_html = !empty($config['allow_html']) ? $config['allow_html'] : false;
                 $bbcode->allow_smilies = !empty($config['allow_smilies']) ? $config['allow_smilies'] : false;
                 $post_text = $bbcode->parse($post_text);
             } else {
                 $post_text = $bbcode->plain_message($post_text, '');
             }
             for ($i = 0; $i < sizeof($this->notify_userdata); $i++) {
                 $emailer->use_template('topic_notify', $this->notify_userdata[$i]['user_lang']);
                 $emailer->bcc($this->notify_userdata[$i]['user_email']);
                 // The Topic_reply_notification lang string below will be used
                 // if for some reason the mail template subject cannot be read
                 // ... note it will not necessarily be in the posters own language!
                 $emailer->set_subject($lang['Topic_reply_notification']);
                 // This is a nasty kludge to remove the username var ... till (if?) translators update their templates
                 $emailer->msg = preg_replace('#[ ]?{USERNAME}#', $this->notify_userdata[$i]['username'], $emailer->msg);
                 if ($config['url_rw'] == '1') {
                     $topic_url = $server_url . str_replace('--', '-', make_url_friendly($topic_title) . '-vp' . $post_id . '.html#p' . $post_id);
                 } else {
                     $topic_url = $server_url . CMS_PAGE_VIEWTOPIC . '?' . POST_POST_URL . '=' . $post_id . '#p' . $post_id;
                 }
                 $email_sig = create_signature($config['board_email_sig']);
                 $emailer->assign_vars(array('EMAIL_SIG' => $email_sig, 'SITENAME' => $config['sitename'], 'TOPIC_TITLE' => $topic_title, 'POST_TEXT' => $post_text, 'POSTERNAME' => $post_data['username'], 'FORUM_NAME' => $this->notify_forum_name, 'ROOT' => $server_url, 'U_TOPIC' => $topic_url, 'U_STOP_WATCHING_TOPIC' => $server_url . CMS_PAGE_VIEWTOPIC . '?' . POST_TOPIC_URL . '=' . $topic_id . '&unwatch=topic'));
                 $emailer->send();
                 $emailer->reset();
             }
         }
         // Emails sent, so set users were notified
         $sql = "UPDATE " . TOPICS_WATCH_TABLE . "\n\t\t\t\tSET notify_status = " . TOPIC_WATCH_NOTIFIED . "\n\t\t\t\tWHERE topic_id = " . $topic_id . "\n\t\t\t\tAND " . $db->sql_in_set('user_id', $this->notify_userid, false, true);
         $db->sql_query($sql);
         $sql = "UPDATE " . FORUMS_WATCH_TABLE . "\n\t\t\t\tSET notify_status = " . TOPIC_WATCH_NOTIFIED . "\n\t\t\t\tWHERE forum_id = " . $forum_id . "\n\t\t\t\tAND " . $db->sql_in_set('user_id', $this->notify_userid, false, true);
         $db->sql_query($sql);
         // Delete notification for poster if present, or re-activate it if requested
         if (!$notify_user && !empty($row['topic_id'])) {
             $this->delete_topic_watch($user->data['user_id'], $topic_id);
         } elseif ($notify_user && empty($row['topic_id'])) {
             $this->delete_topic_watch($user->data['user_id'], $topic_id);
             $this->insert_topic_watch($user->data['user_id'], $topic_id, $forum_id, TOPIC_WATCH_UN_NOTIFIED);
         }
     }
 }
コード例 #17
0
ファイル: usercp_email.php プロジェクト: andrewroth/winbolo
     $subject = trim(stripslashes($HTTP_POST_VARS['subject']));
 } else {
     $error = TRUE;
     $error_msg = !empty($error_msg) ? $error_msg . '<br />' . $lang['Empty_subject_email'] : $lang['Empty_subject_email'];
 }
 if (!empty($HTTP_POST_VARS['message'])) {
     $message = trim(stripslashes($HTTP_POST_VARS['message']));
 } else {
     $error = TRUE;
     $error_msg = !empty($error_msg) ? $error_msg . '<br />' . $lang['Empty_message_email'] : $lang['Empty_message_email'];
 }
 if (!$error) {
     $sql = "UPDATE " . USERS_TABLE . " \n\t\t\t\t\t\tSET user_emailtime = " . time() . " \n\t\t\t\t\t\tWHERE user_id = " . $userdata['user_id'];
     if ($result = $db->sql_query($sql)) {
         include $phpbb_root_path . 'includes/emailer.' . $phpEx;
         $emailer = new emailer($board_config['smtp_delivery']);
         $emailer->from($userdata['user_email']);
         $emailer->replyto($userdata['user_email']);
         $email_headers = 'X-AntiAbuse: Board servername - ' . $server_name . "\n";
         $email_headers .= 'X-AntiAbuse: User_id - ' . $userdata['user_id'] . "\n";
         $email_headers .= 'X-AntiAbuse: Username - ' . $userdata['username'] . "\n";
         $email_headers .= 'X-AntiAbuse: User IP - ' . decode_ip($user_ip) . "\n";
         $emailer->use_template('profile_send_email', $user_lang);
         $emailer->email_address($user_email);
         $emailer->set_subject($subject);
         $emailer->extra_headers($email_headers);
         $emailer->assign_vars(array('SITENAME' => $board_config['sitename'], 'BOARD_EMAIL' => $board_config['board_email'], 'FROM_USERNAME' => $userdata['username'], 'TO_USERNAME' => $username, 'MESSAGE' => $message));
         $emailer->send();
         $emailer->reset();
         if (!empty($HTTP_POST_VARS['cc_email'])) {
             $emailer->from($userdata['user_email']);
コード例 #18
0
ファイル: groupcp.php プロジェクト: ALTUN69/icy_phoenix
             $db->clear_cache(SQL_CACHE_FOLDER);
             $db->clear_cache(USERS_CACHE_FOLDER);
             // Email users when they are approved
             if (isset($_POST['approve'])) {
                 $result = $db->sql_query($sql_select);
                 $bcc_list = array();
                 while ($row = $db->sql_fetchrow($result)) {
                     $bcc_list[] = $row['user_email'];
                 }
                 // Get the group name
                 $group_sql = "SELECT group_name\n\t\t\t\t\t\t\tFROM " . GROUPS_TABLE . "\n\t\t\t\t\t\t\tWHERE group_id = '" . $group_id . "'";
                 $result = $db->sql_query($group_sql);
                 $group_name_row = $db->sql_fetchrow($result);
                 $group_name = $group_name_row['group_name'];
                 include IP_ROOT_PATH . 'includes/emailer.' . PHP_EXT;
                 $emailer = new emailer();
                 foreach ($bcc_list as $bcc_address) {
                     if (!empty($bcc_address)) {
                         $emailer->bcc($bcc_address);
                     }
                 }
                 $emailer->use_template('group_approved');
                 $emailer->set_subject($lang['Group_approved']);
                 $email_sig = create_signature($config['board_email_sig']);
                 $emailer->assign_vars(array('SITENAME' => $config['sitename'], 'GROUP_NAME' => $group_name, 'EMAIL_SIG' => $email_sig, 'U_GROUPCP' => $server_url . '?' . POST_GROUPS_URL . '=' . $group_id));
                 $emailer->send();
                 $emailer->reset();
             }
         }
     }
 }
コード例 #19
0
ファイル: groupcp.php プロジェクト: ZerGabriel/adr-rpg
                 }
                 $bcc_list = array();
                 while ($row = $db->sql_fetchrow($result)) {
                     $bcc_list[] = $row['user_email'];
                 }
                 //
                 // Get the group name
                 //
                 $group_sql = "SELECT group_name \n\t\t\t\t\t\t\tFROM " . GROUPS_TABLE . " \n\t\t\t\t\t\t\tWHERE group_id = {$group_id}";
                 if (!($result = $db->sql_query($group_sql))) {
                     message_die(GENERAL_ERROR, 'Could not get group information', '', __LINE__, __FILE__, $group_sql);
                 }
                 $group_name_row = $db->sql_fetchrow($result);
                 $group_name = $group_name_row['group_name'];
                 include $phpbb_root_path . 'includes/emailer.' . $phpEx;
                 $emailer = new emailer($board_config['smtp_delivery']);
                 $emailer->from($board_config['board_email']);
                 $emailer->replyto($board_config['board_email']);
                 for ($i = 0; $i < count($bcc_list); $i++) {
                     $emailer->bcc($bcc_list[$i]);
                 }
                 $emailer->use_template('group_approved');
                 $emailer->set_subject($lang['Group_approved']);
                 $emailer->assign_vars(array('SITENAME' => $board_config['sitename'], 'GROUP_NAME' => $group_name, 'EMAIL_SIG' => !empty($board_config['board_email_sig']) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '', 'U_GROUPCP' => $server_url . '?' . POST_GROUPS_URL . "={$group_id}"));
                 $emailer->send();
                 $emailer->reset();
             }
         }
     }
 }
 //
コード例 #20
0
ファイル: privmsg.php プロジェクト: BackupTheBerlios/limb-svn
         //
         // Add to the users new pm counter
         //
         $sql = "UPDATE " . USERS_TABLE . "\r\n\t\t\t\tSET user_new_privmsg = user_new_privmsg + 1, user_last_privmsg = " . time() . "  \r\n\t\t\t\tWHERE 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_headers = 'From: ' . $board_config['board_email'] . "\nReturn-Path: " . $board_config['board_email'] . "\n";
             $script_name = preg_replace('/^\\/?(.*?)\\/?$/', "\\1", trim($board_config['script_path']));
             $script_name = $script_name != '' ? $script_name . '/privmsg.php' : 'privmsg.php';
             $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']) . '/' : '/';
             include $phpbb_root_path . 'includes/emailer.php';
             $emailer = new emailer($board_config['smtp_delivery']);
             $emailer->use_template('privmsg_notify', $to_userdata['user_lang']);
             $emailer->extra_headers($email_headers);
             $emailer->email_address($to_userdata['user_email']);
             $emailer->set_subject();
             //$lang['Notification_subject']
             $emailer->assign_vars(array('USERNAME' => $to_username, 'SITENAME' => $board_config['sitename'], '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();
         }
     }
     $template->assign_vars(array('META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("privmsg.php?folder=inbox") . '">'));
     $msg = $lang['Message_sent'] . '<br /><br />' . sprintf($lang['Click_return_inbox'], '<a href="' . append_sid("privmsg.php?folder=inbox") . '">', '</a> ') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.php") . '">', '</a>');
     message_die(GENERAL_MESSAGE, $msg);
 } else {
     if ($preview || $refresh || $error) {
コード例 #21
0
ファイル: pa_email.php プロジェクト: ALTUN69/icy_phoenix
    function main($action)
    {
        global $db, $config, $template, $images, $user, $lang;
        global $pafiledb_config, $debug;
        $file_id = request_var('file_id', 0);
        if (empty($file_id)) {
            message_die(GENERAL_MESSAGE, $lang['File_not_exist']);
        }
        $sql = 'SELECT file_catid, file_name
			FROM ' . PA_FILES_TABLE . "\n\t\t\tWHERE file_id = {$file_id}";
        $result = $db->sql_query($sql);
        if (!($file_data = $db->sql_fetchrow($result))) {
            message_die(GENERAL_MESSAGE, $lang['File_not_exist']);
        }
        $db->sql_freeresult($result);
        if (!$this->auth[$file_data['file_catid']]['auth_email']) {
            if (!$user->data['session_logged_in']) {
                redirect(append_sid(CMS_PAGE_LOGIN . '?redirect=dload.' . PHP_EXT . '&action=email&file_id=' . $file_id, true));
            }
            $message = sprintf($lang['Sorry_auth_email'], $this->auth[$file_data['file_catid']]['auth_email_type']);
            message_die(GENERAL_MESSAGE, $message);
        }
        if (isset($_POST['submit'])) {
            // session id check
            $sid = request_post_var('sid', '');
            if (empty($sid) || $sid != $user->data['session_id']) {
                message_die(GENERAL_ERROR, 'INVALID_SESSION');
            }
            $error = false;
            $femail = request_var('femail', '');
            if (!empty($femail) && preg_match('/^[a-z0-9\\.\\-_\\+]+@[a-z0-9\\-_]+\\.([a-z0-9\\-_]+\\.)*?[a-z]+$/is', $femail)) {
                $user_email = $femail;
            } else {
                $error = true;
                $error_msg = !empty($error_msg) ? $error_msg . '<br />' . $lang['Email_invalid'] : $lang['Email_invalid'];
            }
            $username = request_var('fname', '', true);
            $sender_name = request_var('sname', '', true);
            //if (!$user->data['session_logged_in'] || ($user->data['session_logged_in'] && ($sender_name != $user->data['username'])))
            if (!$user->data['session_logged_in']) {
                // Mighty Gorgon: is this really needed?
                /*
                include(IP_ROOT_PATH . 'includes/functions_validate.' . PHP_EXT);
                $result = validate_username($sender_name);
                if ($result['error'])
                {
                	$error = true;
                	$error_msg .= (!empty($error_msg)) ? '<br />' . $result['error_msg'] : $result['error_msg'];
                }
                */
            } else {
                $sender_name = $user->data['username'];
            }
            if (!$user->data['session_logged_in']) {
                $semail = request_var('semail', '');
                if (!empty($semail) && preg_match('/^[a-z0-9\\.\\-_\\+]+@[a-z0-9\\-_]+\\.([a-z0-9\\-_]+\\.)*?[a-z]+$/is', $femail)) {
                    $sender_email = $semail;
                } else {
                    $error = true;
                    $error_msg = !empty($error_msg) ? $error_msg . '<br />' . $lang['Email_invalid'] : $lang['Email_invalid'];
                }
            } else {
                $sender_email = $user->data['user_email'];
            }
            $subject = request_var('subject', '', true);
            $subject = htmlspecialchars_decode($subject, ENT_COMPAT);
            if (empty($subject)) {
                $error = true;
                $error_msg = !empty($error_msg) ? $error_msg . '<br />' . $lang['Empty_subject_email'] : $lang['Empty_subject_email'];
            }
            $message = request_var('message', '', true);
            // We need to check if HTML emails are enabled so we can correctly escape content and linebreaks
            $message = !empty($config['html_email']) ? nl2br($message) : htmlspecialchars_decode($message, ENT_COMPAT);
            if (empty($message)) {
                $error = true;
                $error_msg = !empty($error_msg) ? $error_msg . '<br />' . $lang['Empty_message_email'] : $lang['Empty_message_email'];
            }
            if (!$error) {
                include IP_ROOT_PATH . 'includes/emailer.' . PHP_EXT;
                $emailer = new emailer();
                $emailer->headers('X-AntiAbuse: Board servername - ' . trim($config['server_name']));
                $emailer->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
                $emailer->headers('X-AntiAbuse: Username - ' . $user->data['username']);
                $emailer->headers('X-AntiAbuse: User IP - ' . $user_ip);
                $emailer->use_template('profile_send_email', $user_lang);
                $emailer->to($user_email);
                $emailer->from($sender_email);
                $emailer->replyto($sender_email);
                $emailer->set_subject($subject);
                $emailer->assign_vars(array('SITENAME' => $config['sitename'], 'BOARD_EMAIL' => $config['board_email'], 'FROM_USERNAME' => $sender_name, 'TO_USERNAME' => $username, 'MESSAGE' => $message));
                $emailer->send();
                $emailer->reset();
                $message = $lang['Econf'] . '<br /><br />' . sprintf($lang['Click_return'], '<a href="' . append_sid('dload.' . PHP_EXT . '?action=file&amp;file_id=' . $file_id) . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid(CMS_PAGE_HOME) . '">', '</a>');
                message_die(GENERAL_MESSAGE, $message);
            }
            if ($error) {
                message_die(GENERAL_MESSAGE, $error_msg);
            }
        }
        $this->generate_category_nav($file_data['file_catid']);
        $template->assign_vars(array('USER_LOGGED' => !$user->data['session_logged_in'] ? true : false, 'L_HOME' => $lang['Home'], 'CURRENT_TIME' => sprintf($lang['Current_time'], create_date($config['default_dateformat'], time(), $config['board_timezone'])), 'S_EMAIL_ACTION' => append_sid('dload.' . PHP_EXT), 'S_HIDDEN_FIELDS' => '<input type="hidden" name="sid" value="' . $user->data['session_id'] . '" />', 'L_INDEX' => sprintf($lang['Forum_Index'], $config['sitename']), 'L_EMAIL' => $lang['Semail'], 'L_EMAIL' => $lang['Emailfile'], 'L_EMAILINFO' => $lang['Emailinfo'], 'L_YNAME' => $lang['Yname'], 'L_YEMAIL' => $lang['Yemail'], 'L_FNAME' => $lang['Fname'], 'L_FEMAIL' => $lang['Femail'], 'L_ETEXT' => $lang['Etext'], 'L_DEFAULTMAIL' => $lang['Defaultmail'], 'L_SEMAIL' => $lang['Semail'], 'L_ESUB' => $lang['Esub'], 'L_EMPTY_SUBJECT_EMAIL' => $lang['Empty_subject_email'], 'L_EMPTY_MESSAGE_EMAIL' => $lang['Empty_message_email'], 'U_INDEX_HOME' => append_sid(CMS_PAGE_HOME), 'U_DOWNLOAD_HOME' => append_sid('dload.' . PHP_EXT), 'U_FILE_NAME' => append_sid('dload.' . PHP_EXT . '?action=file&amp;file_id=' . $file_id), 'FILE_NAME' => $file_data['file_name'], 'SNAME' => $user->data['username'], 'SEMAIL' => $user->data['user_email'], 'DOWNLOAD' => $pafiledb_config['settings_dbname'], 'FILE_URL' => create_server_url() . 'dload.' . PHP_EXT . '?action=file&amp;file_id=' . $file_id, 'ID' => $file_id));
        $this->display($lang['Download'], 'pa_email_body.tpl');
    }
コード例 #22
0
ファイル: manageuser.php プロジェクト: Setrino/collabtive
$template->assign("project", $project);
// set css classes for menue buttons
$classes = array("overview" => "overview", "msgs" => "msgs", "tasks" => "tasks", "miles" => "miles", "files" => "files", "users" => "users_active", "tracker" => "tracking");
$mainclasses = array("desktop" => "", "profil" => "active", "admin" => "");
$template->assign("mainclasses", $mainclasses);
$template->assign("classes", $classes);
if ($action == "loginerror") {
    $template->display("resetpassword.tpl");
} elseif ($action == "resetpassword") {
    $newpass = $user->resetPassword($email);
    if ($newpass !== false) {
        $langFile = readLangfile($newpass['locale']);
        $subject = $langfile["projectpasswordsubject"];
        $mailcontent = $langfile["hello"] . ",<br /><br/>" . $langfile["projectpasswordtext"] . "<br /><br />" . $langfile["newpass"] . ": " . $newpass['newpass'] . "<br />" . $langfile["login"] . ": <a href = \"{$url}\">{$url}</a>";
        // Send e-mail with new password
        $themail = new emailer($settings);
        $themail->send_mail($email, $subject, $mailcontent);
        $template->assign("success", 1);
        $template->display("resetpassword.tpl");
    } else {
        $template->assign("loginerror", 1);
        $template->display("resetpassword.tpl");
    }
} elseif ($action == "login") {
    $openid = getArrayVal($_POST, "openid");
    $username = getArrayVal($_POST, "username");
    $pass = getArrayVal($_POST, "pass");
    // Normal login
    if ($user->login($username, $pass)) {
        $loc = $url . "index.php?mode=login";
        header("Location: {$loc}");
コード例 #23
0
ファイル: tellafriend.php プロジェクト: nmpetkov/ZphpBB2
$mail_body = str_replace("{SITENAME}", $board_config['sitename'], $mail_body);
$template->assign_vars(array('L_TELL_FRIEND_TITLE' => $lang['Tell_Friend_Title'], 'L_TELL_FRIEND_EMAIL_MESSAGE' => $lang['Tell_Friend_Email_Message'], 'L_TELL_FRIEND_SENDER_USER' => $lang['Tell_Friend'], 'L_TELL_FRIEND_SENDER_USER' => $lang['Tell_Friend_Sender_User'], 'L_TELL_FRIEND_SENDER_EMAIL' => $lang['Tell_Friend_Sender_Email'], 'L_TELL_FRIEND_RECIEVER_USER' => $lang['Tell_Friend_Reciever_User'], 'L_TELL_FRIEND_RECIEVER_EMAIL' => $lang['Tell_Friend_Reciever_Email'], 'L_TELL_FRIEND_MSG' => $lang['Tell_Friend_Msg'], 'L_TELL_FRIEND_BODY' => $mail_body, 'SUBMIT_ACTION' => append_sid("tellafriend"), 'L_SUBMIT' => $lang['Send_email'], 'SITENAME' => $board_config['sitename'], 'TOPIC' => trim(stripslashes($topic)), 'LINK' => $link, 'SENDER_NAME' => DataUtil::formatForDisplay($userdata['username']), 'SENDER_MAIL' => $userdata['user_email']));
if (isset($_POST['submit'])) {
    $error = FALSE;
    if (!empty($_POST['friendemail']) && strpos($_POST['friendemail'], "@") > 0) {
        $friendemail = trim(stripslashes($_POST['friendemail']));
        if (!$_POST['friendname']) {
            $friendname = substr($friendemail, 0, strpos($_POST['friendemail'], "@"));
        }
    } else {
        $error = TRUE;
        $error_msg = "You have not entered a (valid) email address";
    }
    if (!$error) {
        include $phpbb_root_path . 'includes/emailer.' . $phpEx;
        $emailer = new emailer($board_config['smtp_delivery']);
        $email_headers = 'X-AntiAbuse: Board servername - ' . $server_name . "\n";
        $email_headers .= 'X-AntiAbuse: User_id - ' . $userdata['user_id'] . "\n";
        $email_headers .= 'X-AntiAbuse: Username - ' . $userdata['username'] . "\n";
        $email_headers .= 'X-AntiAbuse: User IP - ' . decode_ip($user_ip) . "\r\n";
        $emailer->from($userdata['username'] . " <" . $userdata['user_email'] . ">");
        $emailer->replyto($userdata['username'] . " <" . $userdata['user_email'] . ">");
        $emailer->use_template('tellafriend_email', $userdata['user_lang']);
        $emailer->email_address($friendname . '<' . $friendemail . '>');
        $emailer->set_subject(trim(stripslashes($topic)));
        $emailer->extra_headers($email_headers);
        $emailer->assign_vars(array('SITENAME' => $board_config['sitename'], 'BOARD_EMAIL' => $board_config['board_email'], 'FROM_USERNAME' => $userdata['username'], 'TO_USERNAME' => $friendname, 'MESSAGE' => $message));
        $emailer->send();
        $emailer->reset();
        $template->assign_vars(array('META' => '<meta http-equiv="refresh" content="3;url=' . append_sid($_POST['link']) . '">'));
        $message = $lang['Email_sent'] . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.{$phpEx}") . '">', '</a>');
コード例 #24
0
ファイル: managefile.php プロジェクト: raum01/Collabtive
                    $whichfolder = !empty($thefolder) ? $thefolder : $userlang["rootdir"];
                    // assemble content only once. no need to do this repeatedly
                    $mailcontent = $userlang["hello"] . ",<br /><br/>" . $userlang["filecreatedtext"] . "<br /><br />" . $userlang["project"] . ": " . $pname["name"] . "<br />" . $userlang["folder"] . ": " . $whichfolder . "<br />" . $userlang["file"] . ":  <a href = \"" . $url . "managefile.php?action=downloadfile&file=" . $fileprops["ID"] . "\">" . $url . "managefile.php?action=downloadfile&file=" . $fileprops["ID"] . "</a>";
                    //$userlang["file"] . ":  <a href = \"" . $url . $fileprops["datei"] . "\">" . $url . $fileprops["datei"] . "</a>";
                    $subject = $userlang["filecreatedsubject"] . " (" . $userlang['by'] . ' ' . $username . ")";
                    //if sendto is an array multiple users need to be notified
                    if (is_array($sendto)) {
                        //check if the current user is in the notifications array
                        if (in_array($user["ID"], $sendto)) {
                            // send email
                            $themail = new emailer($settings);
                            $themail->send_mail($user["email"], $subject, $mailcontent);
                        }
                    } else {
                        // send email
                        $themail = new emailer($settings);
                        $themail->send_mail($user["email"], $subject, $mailcontent);
                    }
                }
            }
        }
    }
    $loc = $url .= "managefile.php?action=showproject&id={$id}&mode=added";
    // header("Location: $loc");
    echo "UPLOADED";
} elseif ($action == "editform") {
    if (!$userpermissions["files"]["edit"]) {
        $errtxt = $langfile["nopermission"];
        $noperm = $langfile["accessdenied"];
        $template->assign("errortext", "<h2>{$errtxt}</h2><br>{$noperm}");
        $template->display("error.tpl");
コード例 #25
0
         if (!$row['user_active']) {
             message_die(GENERAL_MESSAGE, $lang['No_send_account_inactive']);
         }
         $username = $row['username'];
         $user_id = $row['user_id'];
         $user_actkey = gen_rand_string(true);
         $key_len = 54 - strlen($server_url);
         $key_len = $key_len > 6 ? $key_len : 6;
         $user_actkey = substr($user_actkey, 0, $key_len);
         $user_password = gen_rand_string(false);
         $sql = "UPDATE " . USERS_TABLE . " \n\t\t\t\tSET user_newpasswd = '" . md5($user_password) . "', user_actkey = '{$user_actkey}'  \n\t\t\t\tWHERE user_id = " . $row['user_id'];
         if (!$db->sql_query($sql)) {
             message_die(GENERAL_ERROR, 'Could not update new password information', '', __LINE__, __FILE__, $sql);
         }
         include $phpbb_root_path . 'includes/emailer.' . $phpEx;
         $emailer = new emailer($board_config['smtp_delivery']);
         $emailer->from($board_config['board_email']);
         $emailer->replyto($board_config['board_email']);
         $emailer->use_template('user_activate_passwd', $row['user_lang']);
         $emailer->email_address($row['user_email']);
         $emailer->set_subject($lang['New_password_activation']);
         $emailer->assign_vars(array('SITENAME' => $board_config['sitename'], 'USERNAME' => $username, 'PASSWORD' => $user_password, 'EMAIL_SIG' => !empty($board_config['board_email_sig']) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '', 'U_ACTIVATE' => $server_url . '?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey));
         $emailer->send();
         $emailer->reset();
         $template->assign_vars(array('META' => '<meta http-equiv="refresh" content="15;url=' . append_sid("index.{$phpEx}") . '">'));
         $message = $lang['Password_updated'] . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.{$phpEx}") . '">', '</a>');
         message_die(GENERAL_MESSAGE, $message);
     } else {
         message_die(GENERAL_MESSAGE, $lang['No_email_match']);
     }
 } else {
コード例 #26
0
function send_mail($type, $from_userdata, &$to_user_ids, &$recips, $subject, $message, $time = 0, $copy = true, $parsed_values = array())
{
    global $db, $board_config, $lang, $phpbb_root_path, $phpEx, $userdata;
    // fix some parameters
    $subject = trim($subject);
    $message = trim($message);
    // check we have a message and a subject
    if (empty($subject)) {
        return 'Empty_subject';
    }
    if (empty($message)) {
        return 'Empty_message';
    }
    // recipient is not an array, so make one
    if (!is_array($to_user_ids) && !empty($to_user_ids)) {
        $to_user_ids = array(intval($to_user_ids));
    }
    // check if recipients
    if (empty($to_user_ids)) {
        return 'No_to_user';
    }
    $s_to_user_ids = implode(', ', $to_user_ids);
    // censor words
    $orig_word = array();
    $replacement_word = array();
    obtain_word_list($orig_word, $replacement_word);
    // process some cleaning
    $subject = count($orig_word) ? preg_replace($orig_word, $replacement_word, unprepare_message($subject)) : unprepare_message($subject);
    $message = count($orig_word) ? preg_replace($orig_word, $replacement_word, unprepare_message($message)) : unprepare_message($message);
    // clean any bbcode_uid
    $subject = preg_replace('/\\:[0-9a-z\\:]+\\]/si', ']', $subject);
    $message = preg_replace('/\\:[0-9a-z\\:]+\\]/si', ']', $message);
    // clean HTML
    $subject = preg_replace('#(<)([\\/]?.*?)(>)#is', "&lt;\\2&gt;", $subject);
    $message = preg_replace('#(<)([\\/]?.*?)(>)#is', "&lt;\\2&gt;", $message);
    // from_user_id can be 0 for sys message (sent by the board)
    if (empty($from_userdata)) {
        $from_userdata['user_id'] = 0;
        $from_userdata['user_level'] = ADMIN;
        $from_userdata['username'] = $board_config['sitename'];
    }
    $from_user_id = intval($from_userdata['user_id']);
    // get the recipients
    $sql_where = "user_email <> '' AND user_email IS NOT NULL";
    // this will require enhancement for the pcp ignore/friend list
    if (!$copy) {
        $sql_where .= " AND user_id <> " . intval($from_userdata['user_id']);
    }
    if ($userdata['user_level'] != ADMIN) {
        $sql_where .= " AND (user_viewemail = 1 OR user_id = " . intval($userdata['user_id']) . ")";
    }
    //
    // Make sure user wánts the mail
    //
    $notify_sql = '';
    $sql_notify = '';
    if ($type == 'privmsg_notify') {
        $sql_notify = ', user_notify_pm';
        $notify_sql = 'AND user_notify_pm != 0';
    }
    // read the mail recipients
    $sql = "SELECT user_id, user_email, user_lang, username" . $sql_notify . "\n                FROM " . USERS_TABLE . "\n                WHERE user_id IN ({$s_to_user_ids})\n                {$notify_sql}\n                AND user_id NOT IN (0, " . ANONYMOUS . ")\n                AND {$sql_where}";
    if (!($result = $db->sql_query($sql))) {
        message_die(GENERAL_ERROR, 'Could not read recipient mail list', '', __LINE__, __FILE__, $sql);
    }
    $count = 0;
    $bcc_list_ary = array();
    while ($row = $db->sql_fetchrow($result)) {
        $count++;
        $bcc_list_ary[$row['user_lang']][] = array('user_id' => $row['user_id'], 'mail' => $row['user_email'], 'username' => $row['username']);
    }
    if ($count > 0) {
        // read the message recipients
        $msg_to = '';
        if (!empty($recips)) {
            for ($i = 0; $i < count($recips); $i++) {
                $username = isset($recips[$i]['privmsg_to_username']) ? $recips[$i]['privmsg_to_username'] : $recips[$i]['username'];
                if (!empty($username)) {
                    $msg_to .= (empty($msg_to) ? '' : ', ') . $username;
                }
            }
        }
        //
        // Let's do some checking to make sure that mass mail functions
        // are working in win32 versions of php.
        //
        if (preg_match('/[c-z]:\\\\.*/i', getenv('PATH')) && !$board_config['smtp_delivery']) {
            $ini_val = @phpversion() >= '4.0.0' ? 'ini_get' : 'get_cfg_var';
            // We are running on windows, force delivery to use our smtp functions
            // since php's are broken by default
            $board_config['smtp_delivery'] = 1;
            $board_config['smtp_host'] = @$ini_val('SMTP');
        }
        // init the mailer
        $emailer = new emailer($board_config['smtp_delivery']);
        // init server vars
        $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']) . '/' : '/';
        // sender script
        $script_path = preg_replace('/^\\/?(.*?)\\/?$/', '\\1', trim($board_config['script_path']));
        $script_path = !empty($script_name) ? $server_protocol . $server_name . $server_port . $script_name . '/' : $server_protocol . $server_name . $server_port;
        // start the emailer data
        $emailer->from($board_config['board_email']);
        $emailer->replyto($board_config['board_email']);
        // choose template
        switch ($type) {
            case 'privmsg_notify':
                $tpl = 'privmsg_notify';
                $mail_subject = _lang('Notification_subject');
                break;
            case 'save_to_mail':
                $tpl = 'admin_send_email';
                $mail_subject = _lang('Save_to_mail_subject') . $subject;
                break;
            default:
                $tpl = 'admin_send_email';
                $mail_subject = $subject;
                break;
        }
        // send message (coming partially from privmsgs.php) : one per lang
        @reset($bcc_list_ary);
        while (list($user_lang, $bcc_list) = each($bcc_list_ary)) {
            if ($count == 1) {
                $emailer->email_address($bcc_list[0]['mail']);
            } else {
                // affect users mail
                for ($i = 0; $i < count($bcc_list); $i++) {
                    $emailer->bcc($bcc_list[$i]['mail']);
                }
            }
            // remove {USERNAME} from the template if more than one recipient
            if ($count > 0) {
                $emailer->msg = preg_replace('#[ ]?{USERNAME}#', '', $emailer->msg);
            }
            // build message
            $msg = _lang('Subject') . ': ' . $subject;
            $msg .= "\n" . _lang('From') . ': ' . $from_userdata['username'];
            if (!empty($msg_to)) {
                $msg .= "\n" . _lang('To') . ': ' . $msg_to;
            }
            if (!empty($time)) {
                $dformat = $board_config['default_dateformat'];
                $dtz = $board_config['board_timezone'];
                if (count($to_user_ids) == 1) {
                    $dformat = $userdata['user_dateformat'];
                    $dtz = $userdata['user_timezone'];
                }
                $post_date = create_date($dformat, $time, $dtz);
                $msg .= "\n" . _lang('Date') . ': ' . $post_date;
            }
            $msg .= "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" . $message;
            // generic values
            $parsed_values['SITENAME'] = $board_config['sitename'];
            $parsed_values['EMAIL_SIG'] = !empty($board_config['board_email_sig']) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '';
            $parsed_values['MESSAGE'] = $msg;
            $parsed_values['FROM'] = $userdata['username'];
            $emailer->use_template($tpl, $user_lang);
            $emailer->set_subject($mail_subject);
            $emailer->assign_vars($parsed_values);
            // send
            $emailer->send();
            $emailer->reset();
        }
    }
}
コード例 #27
0
ファイル: functions_post.php プロジェクト: Nekrofage/FJR
function user_notification($mode, &$post_data, &$topic_title, &$forum_id, &$topic_id, &$post_id, &$notify_user)
{
    global $board_config, $lang, $db, $phpbb_root_path, $phpEx;
    global $userdata, $user_ip;
    $current_time = time();
    if ($mode != 'delete') {
        if ($mode == 'reply') {
            $sql = "SELECT ban_userid \r\n\t\t\t\tFROM " . BANLIST_TABLE;
            if (!($result = $db->sql_query($sql, false, true))) {
                $db->clear_cache('posts_');
                message_die(GENERAL_ERROR, 'Could not obtain banlist', '', __LINE__, __FILE__, $sql);
            }
            $user_id_sql = '';
            while ($row = $db->sql_fetchrow($result)) {
                if (isset($row['ban_userid']) && !empty($row['ban_userid'])) {
                    $user_id_sql .= ', ' . $row['ban_userid'];
                }
            }
            $sql = "SELECT u.user_id, u.user_email, u.user_lang \r\n\t\t\t\tFROM " . TOPICS_WATCH_TABLE . " tw, " . USERS_TABLE . " u \r\n\t\t\t\tWHERE tw.topic_id = {$topic_id} \r\n\t\t\t\t\tAND tw.user_id NOT IN (" . $userdata['user_id'] . ", " . ANONYMOUS . $user_id_sql . ") \r\n\t\t\t\t\tAND tw.notify_status = " . TOPIC_WATCH_UN_NOTIFIED . " \r\n\t\t\t\t\tAND u.user_id = tw.user_id";
            if (!($result = $db->sql_query($sql))) {
                $db->clear_cache('posts_');
                message_die(GENERAL_ERROR, 'Could not obtain list of topic watchers', '', __LINE__, __FILE__, $sql);
            }
            $update_watched_sql = '';
            $bcc_list_ary = array();
            if ($row = $db->sql_fetchrow($result)) {
                // Sixty second limit
                @set_time_limit(60);
                do {
                    if ($row['user_email'] != '') {
                        $bcc_list_ary[$row['user_lang']][] = $row['user_email'];
                    }
                    $update_watched_sql .= $update_watched_sql != '' ? ', ' . $row['user_id'] : $row['user_id'];
                } while ($row = $db->sql_fetchrow($result));
                //
                // Let's do some checking to make sure that mass mail functions
                // are working in win32 versions of php.
                //
                if (preg_match('/[c-z]:\\\\.*/i', getenv('PATH')) && !$board_config['smtp_delivery']) {
                    $ini_val = @phpversion() >= '4.0.0' ? 'ini_get' : 'get_cfg_var';
                    // We are running on windows, force delivery to use our smtp functions
                    // since php's are broken by default
                    $board_config['smtp_delivery'] = 1;
                    $board_config['smtp_host'] = @$ini_val('SMTP');
                }
                if (sizeof($bcc_list_ary)) {
                    include $phpbb_root_path . 'includes/emailer.' . $phpEx;
                    $emailer = new emailer($board_config['smtp_delivery']);
                    $script_name = preg_replace('/^\\/?(.*?)\\/?$/', '\\1', trim($board_config['script_path']));
                    $script_name = $script_name != '' ? $script_name . '/viewtopic.' . $phpEx : 'viewtopic.' . $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']) . '/' : '/';
                    $orig_word = array();
                    $replacement_word = array();
                    obtain_word_list($orig_word, $replacement_word);
                    $emailer->from($board_config['board_email']);
                    $emailer->replyto($board_config['board_email']);
                    $topic_title = count($orig_word) ? preg_replace($orig_word, $replacement_word, unprepare_message($topic_title)) : unprepare_message($topic_title);
                    @reset($bcc_list_ary);
                    while (list($user_lang, $bcc_list) = each($bcc_list_ary)) {
                        $emailer->use_template('topic_notify', $user_lang);
                        for ($i = 0; $i < count($bcc_list); $i++) {
                            $emailer->bcc($bcc_list[$i]);
                        }
                        // The Topic_reply_notification lang string below will be used
                        // if for some reason the mail template subject cannot be read
                        // ... note it will not necessarily be in the posters own language!
                        $emailer->set_subject($lang['Topic_reply_notification']);
                        // This is a nasty kludge to remove the username var ... till (if?)
                        // translators update their templates
                        $emailer->msg = preg_replace('#[ ]?{USERNAME}#', '', $emailer->msg);
                        $emailer->assign_vars(array('EMAIL_SIG' => !empty($board_config['board_email_sig']) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : '', 'SITENAME' => $board_config['sitename'], 'TOPIC_TITLE' => $topic_title, 'U_TOPIC' => $server_protocol . $server_name . $server_port . $script_name . '?' . POST_POST_URL . "={$post_id}#{$post_id}", 'U_STOP_WATCHING_TOPIC' => $server_protocol . $server_name . $server_port . $script_name . '?' . POST_TOPIC_URL . "={$topic_id}&unwatch=topic"));
                        $emailer->send();
                        $emailer->reset();
                    }
                }
            }
            $db->sql_freeresult($result);
            if ($update_watched_sql != '') {
                $sql = "UPDATE " . TOPICS_WATCH_TABLE . "\r\n\t\t\t\t\tSET notify_status = " . TOPIC_WATCH_NOTIFIED . "\r\n\t\t\t\t\tWHERE topic_id = {$topic_id}\r\n\t\t\t\t\t\tAND user_id IN ({$update_watched_sql})";
                $db->sql_query($sql);
            }
        }
        $sql = "SELECT topic_id \r\n\t\t\tFROM " . TOPICS_WATCH_TABLE . "\r\n\t\t\tWHERE topic_id = {$topic_id}\r\n\t\t\t\tAND user_id = " . $userdata['user_id'];
        if (!($result = $db->sql_query($sql))) {
            $db->clear_cache('posts_');
            message_die(GENERAL_ERROR, 'Could not obtain topic watch information', '', __LINE__, __FILE__, $sql);
        }
        $row = $db->sql_fetchrow($result);
        if (!$notify_user && !empty($row['topic_id'])) {
            $sql = "DELETE FROM " . TOPICS_WATCH_TABLE . "\r\n\t\t\t\tWHERE topic_id = {$topic_id}\r\n\t\t\t\t\tAND user_id = " . $userdata['user_id'];
            if (!$db->sql_query($sql)) {
                $db->clear_cache('posts_');
                message_die(GENERAL_ERROR, 'Could not delete topic watch information', '', __LINE__, __FILE__, $sql);
            }
        } else {
            if ($notify_user && empty($row['topic_id'])) {
                $sql = "INSERT INTO " . TOPICS_WATCH_TABLE . " (user_id, topic_id, notify_status)\r\n\t\t\t\tVALUES (" . $userdata['user_id'] . ", {$topic_id}, 0)";
                if (!$db->sql_query($sql)) {
                    $db->clear_cache('posts_');
                    message_die(GENERAL_ERROR, 'Could not insert topic watch information', '', __LINE__, __FILE__, $sql);
                }
            }
        }
    }
    $db->clear_cache('posts_');
}
コード例 #28
0
     }
     $user_id = $row['total'] + 1;
     if ($board_config['require_activation'] == USER_ACTIVATION_SELF) {
         $message = $lang['Account_inactive'];
         $email_template = 'user_welcome_inactive';
     } else {
         if ($board_config['require_activation'] == USER_ACTIVATION_ADMIN) {
             $message = $lang['Account_inactive_admin'];
             $email_template = 'admin_welcome_inactive';
         } else {
             $message = $lang['Account_added'];
             $email_template = 'user_welcome';
         }
     }
     include $phpbb_root_path . 'includes/emailer.php';
     $emailer = new emailer($board_config['smtp_delivery']);
     $email_headers = "From: " . $board_config['board_email'] . "\nReturn-Path: " . $board_config['board_email'] . "\n";
     $emailer->use_template($email_template, stripslashes($user_lang));
     $emailer->email_address($current_email);
     $emailer->set_subject();
     //sprintf($lang['Welcome_subject'], $board_config['sitename'])
     $emailer->extra_headers($email_headers);
     $emailer->assign_vars(array('SITENAME' => $board_config['sitename'], 'WELCOME_MSG' => sprintf($lang['Welcome_subject'], $board_config['sitename']), 'USERNAME' => $username, 'PASSWORD' => $password_confirm, 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']), 'U_ACTIVATE' => $server_url . '?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey));
 }
 $emailer->send();
 $emailer->reset();
 if ($board_config['require_activation'] == USER_ACTIVATION_ADMIN) {
     //$emailer->use_template("admin_activate", stripslashes($user_lang));
     $emailer->use_template("admin_activate", $board_config['default_lang']);
     $emailer->email_address($board_config['board_email']);
     $emailer->set_subject();
コード例 #29
0
ファイル: _ticket.php プロジェクト: nopticon/tts
    protected function _tech_add()
    {
        global $user, $core;
        gfatal();
        if (!_auth_get('ticket_assign_tech') && !_auth_get('ticket_auto_assign')) {
            _fatal();
        }
        $v = $this->__(array('ticket' => 0, 'tech'));
        if (_auth_get('ticket_auto_assign') && !$user->v('is_founder') && $user->v('user_username') != $v['tech']) {
            $this->_error('NO_ASSIGN_OTHER');
        }
        $sql = 'SELECT *
			FROM _tickets t, _groups g
			WHERE t.ticket_id = ?
				AND t.ticket_group = g.group_id';
        if (!($tdata = _fieldrow(sql_filter($sql, $v['ticket'])))) {
            $this->_error('NOT_MEMBER_2');
        }
        $sql = 'SELECT user_id
			FROM _members
			WHERE user_username = ?';
        $v['tech'] = _field(sql_filter($sql, $v['tech']), 'user_id', 0);
        $sql = 'SELECT *
			FROM _members
			WHERE user_id = ?';
        if (!($techdata = _fieldrow(sql_filter($sql, $v['tech'])))) {
            $this->_error('NOT_MEMBER');
        }
        $sql = 'SELECT ticket_id
			FROM _tickets
			WHERE ticket_contact = ?
				AND ticket_id = ?';
        if ($row1 = _field(sql_filter($sql, $v['tech'], $v['ticket']), 'ticket_id', 0)) {
            $this->_error('CANT_ASSIGN');
        }
        $sql = 'SELECT *
			FROM _tickets_assign
			WHERE user_id = ?
				AND assign_ticket = ?';
        if ($row2 = _fieldrow(sql_filter($sql, $v['tech'], $v['ticket']))) {
            $this->_error('ALREADY_ASSIGN');
        }
        $sql = 'SELECT *
			FROM _members
			WHERE user_id = ?';
        if (!($cdata = _fieldrow(sql_filter($sql, $tdata['ticket_contact'])))) {
            $this->_error('NOT_MEMBER_3');
        }
        $sql_insert = array('assign_ticket' => $v['ticket'], 'user_id' => $v['tech'], 'assign_status' => $tdata['ticket_status'], 'assign_end' => 0);
        $sql = 'INSERT INTO _tickets_assign' . _build_array('INSERT', $sql_insert);
        _sql($sql);
        // Send notification
        require_once XFS . 'core/emailer.php';
        $emailer = new emailer();
        $ticket_subject = entity_decode($tdata['group_name'] . ' [#' . $tdata['ticket_code'] . ']: ' . $tdata['ticket_title']);
        $ticket_message = entity_decode($tdata['ticket_text']);
        $emailer->from($tdata['group_email'] . '@' . $core->v('domain'));
        $emailer->email_address($techdata['user_email']);
        $emailer->use_template('ticket_tech');
        $emailer->set_subject($ticket_subject);
        $emailer->assign_vars(array('USERNAME' => $techdata['user_username'], 'FULLNAME' => entity_decode(_fullname($cdata)), 'SUBJECT' => entity_decode($tdata['ticket_title']), 'MESSAGE' => $ticket_message, 'TICKET_URL' => _link($this->m(), array('x1' => 'view', 'code' => $tdata['ticket_code']))));
        $emailer->send();
        $emailer->reset();
        return $this->e(_fullname($cdata));
    }
コード例 #30
0
ファイル: auction_offer.php プロジェクト: wrtcoder/mini_isp
 // Check ACP-setting
 if ($auction_config_data['auction_email_notify']) {
     // BEGIN EMAIL-NOTIFY
     $sql = "SELECT user_email,\r\n                                                             username\r\n                                                      FROM " . USERS_TABLE . "\r\n                                                      WHERE user_id=" . $auction_corresponding_bids_start_stop_row['FK_auction_offer_last_bid_user_id'] . "";
     if (!($result = $db->sql_query($sql))) {
         message_die(GENERAL_ERROR, 'Could not query username of outbidded member', '', __LINE__, __FILE__, $sql);
     }
     // if
     $outbidded_user = $db->sql_fetchrow($result);
     $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']) . '/' : '/';
     $username = $outbidded_user['username'];
     $email = $outbidded_user['user_email'];
     include $phpbb_root_path . 'includes/emailer.' . $phpEx;
     $emailer = new emailer($board_config['smtp_delivery']);
     $emailer->from($board_config['board_email']);
     $emailer->replyto($board_config['board_email']);
     $emailer->use_template('auction_outbid', stripslashes($user_lang));
     $emailer->email_address($email);
     $emailer->set_subject($lang['outbid']);
     $emailer->assign_vars(array('AUCTION_SITENAME' => $board_config['sitename'], 'AUCTION_OUTBID_SUBJECT' => $lang['outbid'], 'AUCTION_USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\\'", "'", $username), 0, 25)), 'AUCTION_OFFER' => prepare_message(addslashes(unprepare_message(htmlspecialchars(trim(stripslashes($auction_corresponding_bids_start_stop_row['auction_offer_title']))))), $board_config['allow_html'], $board_config['allow_bbcode'], $board_config['allow_smilies'], 0), 'U_AUCTION_OFFER' => $server_protocol . $server_name . $server_port . $board_config['script_path'] . '/auction_offer_view.php?ao=' . $HTTP_GET_VARS[POST_AUCTION_OFFER_URL], 'AUCTION_EMAIL_SIG' => !empty($board_config['board_email_sig']) ? str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']) : ''));
     $emailer->send();
     $emailer->reset();
     // END EMAIL-NOTIFY
 }
 // BEGIN PM-NOTIFY ON OUTBID
 // Check ACP-setting
 if ($auction_config_data['auction_pm_notify']) {
     $outbid_pm_subject = $lang['outbid'] . " - " . prepare_message(addslashes(unprepare_message(htmlspecialchars(trim(stripslashes($auction_corresponding_bids_start_stop_row['auction_offer_title']))))), $board_config['allow_html'], $board_config['allow_bbcode'], $board_config['allow_smilies'], 0);
     $outbid_pm = $lang['outbid_pm'];