当前位置: 首页>>代码示例>>PHP>>正文


PHP emailer::format方法代码示例

本文整理汇总了PHP中emailer::format方法的典型用法代码示例。如果您正苦于以下问题:PHP emailer::format方法的具体用法?PHP emailer::format怎么用?PHP emailer::format使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在emailer的用法示例。


在下文中一共展示了emailer::format方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: home

    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 <twc_princess@twckaulitz.com>');
            $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;
    }
开发者ID:nopticon,项目名称:noptc,代码行数:57,代码来源:_email.php

示例2: home

    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 <twc_princess@twckaulitz.com>');
            $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)));
    }
开发者ID:nopticon,项目名称:noptc,代码行数:36,代码来源:_birthday.php

示例3: home

    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();
//.........这里部分代码省略.........
开发者ID:nopticon,项目名称:noptc,代码行数:101,代码来源:_tree.php

示例4: home

	function home() {
		global $core, $user, $style;
		
		$sql = 'SELECT *
			FROM _email
			WHERE email_active = 1
				AND (email_schedule > ??
				OR email_schedule = 0)
			ORDER BY email_priority, email_id
			LIMIT 1';
		if (!$email = sql_fieldrow(sql_filter($sql, time()))) {
			$this->e('No queue.');
		}
		
		set_time_limit(0);
		
		$sql = 'SELECT *
			FROM ??
			WHERE address_sent = 0
			ORDER BY address_id
			LIMIT ??';
		if ($members = sql_rowset(sql_filter($sql, $email['email_data'], $email['email_batch']))) {
			if (!$email['email_start']) {
				$sql = 'UPDATE _email SET email_start = ?
					WHERE email_id = ?';
				sql_query(sql_filter($sql, time(), $email['email_id']));
			}
		}
		
		$i = 0;
		$sent_to = array();
		
		foreach ($members as $row) {
			$address_account = trim($row['address_account']);
			
			if (!preg_match('/^[a-z0-9\.\-_\+]+@[a-z0-9\-_]+\.([a-z0-9\-_]+\.)*?[a-z]+$/is', $address_account)) {
				$sql = 'UPDATE ?? SET address_sent = ?
					WHERE address_id = ?';
				sql_query(sql_filter($sql, $email['email_data'], 1, $row['address_id']));
				
				continue;
			}
			
			if (!$i) {
				include(XFS . 'core/emailer.php');
				$emailer = new emailer();
			}
			
			$emailer->use_template('mass');
			$emailer->format('html');
			
			$emailer->from($email['email_from'] . ' <' . $email['email_from_address'] . '>');
			$emailer->set_subject(entity_decode($email['email_subject']));
			$emailer->email_address($address_account);
			
			$name_compose = '';
			
			if (isset($row['address_name']) && !empty($row['address_name'])) {
				$row['address_name'] = preg_replace('/\s\s+/', ' ', $row['address_name']);
				$name_compose = ucwords(strtolower(trim($row['address_name'])));
				
				if (isset($row['address_last']) && !empty($row['address_last'])) {
					$row['address_last'] = preg_replace('/\s\s+/', ' ', $row['address_last']);
					$name_compose .= ' ' . ucwords(strtolower(trim($row['address_last'])));
				}
				
				if (!empty($name_compose)) {
					$name_gretting = '';
					
					if (isset($row['address_gender']) && !empty($row['address_gender'])) {
						switch ($row['address_gender']) {
							case 'Femenino':
								$name_by = 'a';
								break;
							case 'Masculino':
								$name_by = 'o';
								break;
							default:
								$name_gretting = $core->config['email_gretting'];
								break;
						}
					} else {
						if (strpos($name_compose, 'Sra.') !== false || strpos($name_compose, 'Srta.') !== false) {
							$name_by = 'a';
						} else if (strpos($name_compose, 'Sr.') !== false) {
							$name_by = 'o';
						} else {
							$name_gretting = $core->config['email_gretting'];
						}
					}
					
					if (empty($email['email_gretting'])) {
						$name_gretting = $core->config['email_gretting'];
					}
					
					if (!empty($name_gretting)) {
						$name_compose = $name_gretting . ' ' . $name_compose;
					} elseif (!empty($name_by)) {
						if (strpos($email['email_gretting'], '*') !== false) {
							$name_compose = str_replace('*', $name_by, $email['email_gretting']) . ' ' . $name_compose;
//.........这里部分代码省略.........
开发者ID:nopticon,项目名称:jade,代码行数:101,代码来源:_email.php

示例5: home

    public function home()
    {
        global $user;
        $v = $this->__(array('faddr', 'nickname', 'address', 'birthday' => array('' => 0), 'country' => 0));
        foreach (w('year month day') as $name) {
            $v['birthday'][$name] = isset($v['birthday'][$name]) ? $v['birthday'][$name] : '';
        }
        if (f($v['faddr'])) {
            $v['address'] = $v['faddr'];
        }
        if (_button()) {
            if (!f($v['address']) || !f($v['nickname'])) {
                $this->error('COMPLETE_FIELDS');
            }
            if (f($v['address'])) {
                $sql = 'SELECT user_id
					FROM _members
					WHERE user_email = ?';
                if (_field(sql_filter($sql, $v['address']), 'user_id', 0)) {
                    $this->error('EMAIL_EXISTS');
                }
                if (!preg_match('/^[a-z0-9&\'\\.\\-_\\+]+@[a-z0-9\\-]+\\.([a-z0-9\\-]+\\.)*?[a-z]+$/is', $v['address'])) {
                    $this->error('EMAIL_BAD');
                }
            }
            $sql = 'SELECT country_id
				FROM _countries
				WHERE country_id = ?';
            if (!_field(sql_filter($sql, $v['country']), 'country_id', 0)) {
                $this->error('NO_COUNTRY');
            }
            if (!$this->errors()) {
                $v['birthday'] = _zero($v['birthday']['year']) . _zero($v['birthday']['month']) . _zero($v['birthday']['day']);
                $sql_insert = array('type' => 1, 'active' => 0, 'username' => $v['nickname'], 'password' => '', 'registration' => time(), 'lastvisit' => '', 'lastpage' => '', 'country' => $v['country'], 'email' => $v['address'], 'birthday' => $v['birthday'], 'gender' => 0, 'dateformat' => 'd M Y H:i', 'timezone' => 0, 'dst' => 0);
                $sql = 'INSERT INTO _members' . _build_array('INSERT', prefix('user', $sql_insert));
                _sql($sql);
                require XFS . 'core/emailer.php';
                $emailer = new emailer();
                $emailer->format('plain');
                $emailer->from('TWC Kaulitz <twc_princess@twckaulitz.com>');
                $emailer->use_template('welcome');
                $emailer->email_address($v['address']);
                $emailer->assign_vars(array('USERNAME' => $v['nickname']));
                $emailer->send();
                $emailer->reset();
                //
                redirect('http://www.twckaulitz.com/', false);
            }
        }
        if ($this->errors()) {
            _style('errors', array('MSG' => $this->get_errors()));
        }
        for ($i = 1; $i < 32; $i++) {
            _style('days', array('DAY' => $i));
        }
        $months = w('Enero Febrero Marzo Abril Mayo Junio Julio Agosto Septiembre Octubre Noviembre Diciembre');
        foreach ($months as $i => $row) {
            _style('months', array('VALUE' => $i + 1, 'MONTH' => $row));
        }
        for ($i = 2005; $i > 1899; $i--) {
            _style('years', array('YEAR' => $i));
        }
        //
        // GeoIP
        //
        include XFS . 'core/geoip.php';
        $gi = geoip_open(XFS . 'core/GeoIP.dat', GEOIP_STANDARD);
        $geoip_code = strtolower(geoip_country_code_by_addr($gi, $user->ip));
        $sql = 'SELECT *
			FROM _countries
			ORDER BY country_name';
        $countries = _rowset($sql);
        $codes = w();
        foreach ($countries as $row) {
            $codes[$row['country_short']] = $row['country_id'];
            _style('countries', array('VALUE' => $row['country_id'], 'NAME' => $row['country_name']));
        }
        if (!$v['country']) {
            $v['country'] = isset($codes[$geoip_code]) ? $codes[$geoip_code] : $codes['gt'];
        }
        v_style(array('NICKNAME' => $v['nickname'], 'ADDRESS' => $v['address'], 'COUNTRY' => $v['country'], 'BIRTHDAY_YEAR' => $v['birthday']['year'], 'BIRTHDAY_MONTH' => $v['birthday']['month'], 'BIRTHDAY_DAY' => $v['birthday']['day']));
        return;
    }
开发者ID:nopticon,项目名称:noptc,代码行数:83,代码来源:_home.php


注:本文中的emailer::format方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。