本文整理汇总了PHP中entities_to_ascii函数的典型用法代码示例。如果您正苦于以下问题:PHP entities_to_ascii函数的具体用法?PHP entities_to_ascii怎么用?PHP entities_to_ascii使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了entities_to_ascii函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getNewValue
/**
* if detect a $_POST["fieldname"] it acquire the new value
* this class override this method for "formatting" purposes
*
* @access private
* @return void
*/
function _getNewValue()
{
parent::_getNewValue();
if (isset($this->request[$this->name])) {
$this->newValue = entities_to_ascii($this->newValue);
}
}
示例2: test_entities_to_ascii
public function test_entities_to_ascii()
{
$strs = array('“‘ “test”' => '“‘ “test”', '†¥¨ˆøåß∂ƒ©˙∆˚¬' => '†¥¨ˆøåß∂ƒ©˙∆˚¬');
foreach ($strs as $str => $expect) {
$this->assertEquals($expect, entities_to_ascii($str));
}
}
示例3: _post_args
protected function _post_args($key, $type = ARGS_TYPE_STRING, $default = '', $params = array())
{
$value = '';
$post_default = '';
$key_exist = array_key_exists($key, $_POST);
$override = array_key_exists('override', $params) ? $params['override'] : FALSE;
$entities_to_ascii = array_key_exists('entities_to_ascii', $params) ? $params['entities_to_ascii'] : FALSE;
$gtzero = array_key_exists('gtzero', $params) ? $params['gtzero'] : TRUE;
switch ($type) {
case ARGS_TYPE_STRING:
$post_default = $override ? $default : '';
$value = $key_exist ? $this->input->post($key, TRUE) ? $this->input->post($key, TRUE) : $post_default : $default;
if ($entities_to_ascii) {
$value = entities_to_ascii($value);
}
break;
case ARGS_TYPE_INT:
$default = validate_integer($default) ? to_int($default) : 0;
$post_default = $override ? $default : 0;
$value = $key_exist ? ($value = $this->input->post($key)) && gtzero_integer($value) ? to_int($value) : $post_default : $default;
break;
case ARGS_TYPE_TRUE_FALSE:
$default = validate_integer($default) ? gtzero_integer($default) ? TRUE : FALSE : FALSE;
$post_default = $override ? $default : FALSE;
$value = $key_exist ? ($value = $this->input->post($key)) && ($gtzero && gtzero_integer($value) || !$gtzero && validate_integer($value)) ? TRUE : $post_default : $default;
break;
case ARGS_TYPE_ARRAY:
$value = $key_exist ? ($value = $this->input->post($key)) && is_array($value) ? $value : array() : (is_array($default) ? $default : array());
break;
case ARGS_TYPE_DECIMAL:
$default = gtzero_decimal($default) ? to_float($default) : 0;
$post_default = $override ? $default : 0;
$value = $key_exist ? ($value = $this->input->post($key)) && gtzero_decimal($value) ? to_float($value) : $post_default : $default;
break;
case ARGS_TYPE_DATE:
$default = validate_date($default) ? $default : '';
$post_default = $override ? $default : '';
$value = $key_exist ? ($value = $this->input->post($key)) && validate_date($value) ? $value : $post_default : $default;
break;
case ARGS_TYPE_DATETIME:
$default = validate_datetime($default) ? $default : '';
$post_default = $override ? $default : '';
$value = $key_exist ? ($value = $this->input->post($key)) && validate_date($value) ? $value : $post_default : $default;
break;
default:
$post_default = $override ? $default : '';
$value = $key_exist ? $this->input->post($key, TRUE) ? $this->input->post($key, TRUE) : $post_default : $default;
break;
}
unset($post_default);
return $value;
}
示例4: perform_actions
//.........这里部分代码省略.........
}
}
/*
/* -------------------------------------*/
if ($type == '') {
/* --------------------------------
/* Check Price
/* - There is a small chance the Admin changed the price between
/* purchase and the receipt of the IP, so we give a small bit of
/* wiggle room. About 10%...
/* --------------------------------*/
$price = $row->item_use_sale == 'y' ? $row->item_sale_price : $row->item_regular_price;
$cost = $subtotal / $qnty;
if ($cost < $price * 0.9) {
return;
}
$data = array('txn_id' => $this->post['txn_id'], 'member_id' => $this->post['custom'], 'item_id' => $row->item_id, 'purchase_date' => ee()->localize->now, 'item_cost' => $cost, 'paypal_details' => serialize($this->post));
if (!is_numeric($qnty) or $qnty == 1) {
ee()->db->insert('simple_commerce_purchases', $data);
ee()->db->where('item_id', $item_id);
ee()->db->set('item_purchases', "item_purchases + 1", FALSE);
ee()->db->update('simple_commerce_items');
} else {
for ($i = 0; $i < $qnty; ++$i) {
ee()->db->insert('simple_commerce_purchases', $data);
}
ee()->db->where('item_id', $item_id);
ee()->db->set('item_purchases', "item_purchases + {$qnty}", FALSE);
ee()->db->update('simple_commerce_items');
}
}
// end non-sub entry
// New Member Group
if ($new_member_group != '' && $new_member_group != 0) {
ee()->db->where('member_id', $this->post['custom']);
ee()->db->where('group_id !=', 1);
ee()->db->update('members', array('group_id' => $new_member_group));
}
// Send Emails!
ee()->load->library('email');
if ($customer_email_template != '' && $customer_email_template != 0) {
ee()->db->select('email');
$result = ee()->db->get_where('members', array('member_id' => $this->post['custom']));
$cust_row = $result->row();
$to = $cust_row->email;
ee()->db->select('email_subject, email_body');
$result = ee()->db->get_where('simple_commerce_emails', array('email_id' => $customer_email_template));
if ($result->num_rows() > 0) {
$email = $result->row();
$subject = $email->email_subject;
$message = $email->email_body;
foreach ($this->post as $key => $value) {
$subject = str_replace(LD . $key . RD, $value, $subject);
$message = str_replace(LD . $key . RD, $value, $message);
}
// Load the text helper
ee()->load->helper('text');
ee()->email->from(ee()->config->item('webmaster_email'), ee()->config->item('site_name'));
ee()->email->to($to);
ee()->email->subject($subject);
ee()->email->message(entities_to_ascii($message));
ee()->email->send();
ee()->email->EE_initialize();
}
}
if ($row->admin_email_address != '' && $admin_email_template != '' && $admin_email_template != 0) {
ee()->db->select('email_subject, email_body');
$result = ee()->db->get_where('simple_commerce_emails', array('email_id' => $admin_email_template));
if ($result->num_rows() > 0) {
$email = $result->row();
$subject = $email->email_subject;
$message = $email->email_body;
foreach ($this->post as $key => $value) {
$subject = str_replace(LD . $key . RD, $value, $subject);
$message = str_replace(LD . $key . RD, $value, $message);
}
// Load the text helper
ee()->load->helper('text');
ee()->email->from(ee()->config->item('webmaster_email'), ee()->config->item('site_name'));
ee()->email->to($row->admin_email_address);
ee()->email->subject($subject);
ee()->email->message(entities_to_ascii($message));
ee()->email->send();
ee()->email->EE_initialize();
}
}
/* -------------------------------------
/* 'simple_commerce_perform_actions_end' hook.
/* - After a purchase is recorded, do more processing
/* - Added EE 1.5.1
*/
if (ee()->extensions->active_hook('simple_commerce_perform_actions_end') === TRUE) {
ee()->extensions->universal_call('simple_commerce_perform_actions_end', $this, $query->row());
if (ee()->extensions->end_script === TRUE) {
return;
}
}
/*
/* -------------------------------------*/
}
示例5: send_checksum_notification
/**
* Send checksum notification
*
* Sends a notification email to the webmaster if a bootstrap file
* was changed.
*
* @access public
* @param string
* @param int
* @param int
*/
function send_checksum_notification($changed)
{
// Send email
ee()->load->library('email');
ee()->load->helper('text');
$subject = ee()->lang->line('checksum_email_subject');
$message = ee()->lang->line('checksum_email_message');
$message = str_replace(array('{url}', '{changed}'), array(ee()->config->item('base_url'), implode("\n", $changed)), $message);
ee()->email->EE_initialize();
ee()->email->wordwrap = false;
ee()->email->from(ee()->config->item('webmaster_email'), ee()->config->item('webmaster_name'));
ee()->email->to(ee()->config->item('webmaster_email'));
ee()->email->reply_to(ee()->config->item('webmaster_email'));
ee()->email->subject($subject);
ee()->email->message(entities_to_ascii($message));
ee()->email->send();
}
示例6: send_notification_emails
/**
* Send Notification Emails
*
* @return void
*/
public function send_notification_emails($comments)
{
// Load subscription class
ee()->load->library('subscription');
// Instantiate Typography class
ee()->load->library('typography');
ee()->typography->initialize(array('parse_images' => FALSE, 'word_censor' => ee()->config->item('comment_word_censoring') == 'y' ? TRUE : FALSE));
// Grab the required comments
ee()->db->select('comment, comment_id, author_id, name, email, comment_date, entry_id');
ee()->db->where_in('comment_id', $comments);
$query = ee()->db->get('comments');
// Sort based on entry
$entries = array();
foreach ($query->result() as $row) {
if (!isset($entries[$row->entry_id])) {
$entries[$row->entry_id] = array();
}
$entries[$row->entry_id][] = $row;
}
// Go through the entries and send subscriptions
foreach ($entries as $entry_id => $comments) {
ee()->subscription->init('comment', array('entry_id' => $entry_id), TRUE);
// Grab them all
$subscriptions = ee()->subscription->get_subscriptions();
ee()->load->model('comment_model');
$recipients = ee()->comment_model->fetch_email_recipients($entry_id, $subscriptions);
if (count($recipients)) {
// Grab generic entry info
$action_id = ee()->functions->fetch_action_id('Comment_mcp', 'delete_comment_notification');
ee()->db->select('channel_titles.title, channel_titles.entry_id, channel_titles.url_title, channels.channel_title, channels.comment_url, channels.channel_url, channels.channel_id');
ee()->db->join('channels', 'exp_channel_titles.channel_id = exp_channels.channel_id', 'left');
ee()->db->where('channel_titles.entry_id', $entry_id);
$results = ee()->db->get('channel_titles');
$com_url = $results->row('comment_url') == '' ? $results->row('channel_url') : $results->row('comment_url');
// Create an array of comments to add to the email
$comments_swap = array();
foreach ($comments as $c) {
$comment_text = ee()->typography->parse_type($c->comment, array('text_format' => 'none', 'html_format' => 'none', 'auto_links' => 'n', 'allow_img_url' => 'n'));
$comments_swap[] = array('name_of_commenter' => $c->name, 'name' => $c->name, 'comment' => $comment_text, 'comment_id' => $c->comment_id);
}
$swap = array('channel_name' => $results->row('channel_title'), 'entry_title' => $results->row('title'), 'site_name' => stripslashes(ee()->config->item('site_name')), 'site_url' => ee()->config->item('site_url'), 'comment_url' => reduce_double_slashes($com_url . '/' . $results->row('url_title') . '/'), 'channel_id' => $results->row('channel_id'), 'entry_id' => $results->row('entry_id'), 'url_title' => $results->row('url_title'), 'comment_url_title_auto_path' => reduce_double_slashes($com_url . '/' . $results->row('url_title')), 'comments' => $comments_swap);
$template = ee()->functions->fetch_email_template('comments_opened_notification');
ee()->load->library('template');
$email_tit = ee()->template->parse_variables_row($template['title'], $swap);
$email_msg = ee()->template->parse_variables_row($template['data'], $swap);
// Send email
ee()->load->library('email');
ee()->email->wordwrap = true;
// Load the text helper
ee()->load->helper('text');
$sent = array();
foreach ($recipients as $val) {
if (!in_array($val['0'], $sent)) {
$title = $email_tit;
$message = $email_msg;
$sub = $subscriptions[$val['1']];
$sub_qs = 'id=' . $sub['subscription_id'] . '&hash=' . $sub['hash'];
// Deprecate the {name} variable at some point
$title = str_replace('{name}', $val['2'], $title);
$message = str_replace('{name}', $val['2'], $message);
$title = str_replace('{name_of_recipient}', $val['2'], $title);
$message = str_replace('{name_of_recipient}', $val['2'], $message);
$title = str_replace('{notification_removal_url}', ee()->functions->fetch_site_index(0, 0) . QUERY_MARKER . 'ACT=' . $action_id . '&' . $sub_qs, $title);
$message = str_replace('{notification_removal_url}', ee()->functions->fetch_site_index(0, 0) . QUERY_MARKER . 'ACT=' . $action_id . '&' . $sub_qs, $message);
ee()->email->EE_initialize();
ee()->email->from(ee()->config->item('webmaster_email'), ee()->config->item('webmaster_name'));
ee()->email->to($val['0']);
ee()->email->subject($title);
ee()->email->message(entities_to_ascii($message));
ee()->email->send();
$sent[] = $val['0'];
}
}
}
}
return;
}
示例7: send_message
//.........这里部分代码省略.........
} else {
ee()->db->query(ee()->db->insert_string('exp_message_data', $data));
$message_id = ee()->db->insert_id();
}
/** -----------------------------------------
/** Send out Messages to Recipients and CC
/** -----------------------------------------*/
if ($status == 'sent') {
$copy_data = array('message_id' => $message_id, 'sender_id' => $this->member_id);
/** -----------------------------------------
/** Send out Messages to Recipients and CC
/** -----------------------------------------*/
for ($i = 0, $size = count($recipients); $i < $size; $i++) {
$copy_data['recipient_id'] = $recipients[$i];
$copy_data['message_authcode'] = ee()->functions->random('alnum', 10);
ee()->db->query(ee()->db->insert_string('exp_message_copies', $copy_data));
}
for ($i = 0, $size = count($cc); $i < $size; $i++) {
$copy_data['recipient_id'] = $cc[$i];
$copy_data['message_authcode'] = ee()->functions->random('alnum', 10);
ee()->db->query(ee()->db->insert_string('exp_message_copies', $copy_data));
}
/** ----------------------------------
/** Increment exp_members.private_messages
/** ----------------------------------*/
ee()->db->query("UPDATE exp_members SET private_messages = private_messages + 1\r\n\t\t\t\t\t\tWHERE member_id IN ('" . implode("','", array_merge($recipients, $cc)) . "')");
/** ----------------------------------
/** Send Any and All Email Notifications
/** ----------------------------------*/
$query = ee()->db->query("SELECT screen_name, email FROM exp_members\r\n\t\t\t\t\t\t\t\t WHERE member_id IN ('" . implode("','", array_merge($recipients, $cc)) . "')\r\n\t\t\t\t\t\t\t\t AND notify_of_pm = 'y'\r\n\t\t\t\t\t\t\t\t AND member_id != {$this->member_id}");
if ($query->num_rows() > 0) {
ee()->load->library('typography');
ee()->typography->initialize(array('parse_images' => FALSE, 'smileys' => FALSE, 'highlight_code' => TRUE));
if (ee()->config->item('enable_censoring') == 'y' and ee()->config->item('censored_words') != '') {
$subject = ee()->typography->filter_censored_words(ee()->security->xss_clean(ee()->input->get_post('subject')));
} else {
$subject = ee()->security->xss_clean(ee()->input->get_post('subject'));
}
$body = ee()->typography->parse_type(stripslashes(ee()->security->xss_clean(ee()->input->get_post('body'))), array('text_format' => 'none', 'html_format' => 'none', 'auto_links' => 'n', 'allow_img_url' => 'n'));
ee()->load->library('email');
ee()->email->wordwrap = true;
$swap = array('sender_name' => ee()->session->userdata('screen_name'), 'message_subject' => $subject, 'message_content' => $body, 'site_name' => stripslashes(ee()->config->item('site_name')), 'site_url' => ee()->config->item('site_url'));
$template = ee()->functions->fetch_email_template('private_message_notification');
$email_tit = ee()->functions->var_swap($template['title'], $swap);
$email_msg = ee()->functions->var_swap($template['data'], $swap);
// Load the text helper
ee()->load->helper('text');
foreach ($query->result_array() as $row) {
ee()->email->EE_initialize();
ee()->email->from(ee()->config->item('webmaster_email'), ee()->config->item('webmaster_name'));
ee()->email->to($row['email']);
ee()->email->subject($email_tit);
ee()->email->message(entities_to_ascii(ee()->functions->var_swap($email_msg, array('recipient_name' => $row['screen_name']))));
ee()->email->send();
}
}
}
/** -------------------------------------
/** Sent Copy?
/** -------------------------------------*/
if ($status == 'sent' && $data['message_sent_copy'] == 'y') {
$copy_data['recipient_id'] = $this->member_id;
$copy_data['message_authcode'] = ee()->functions->random('alnum', 10);
$copy_data['message_folder'] = '2';
// Sent Message Folder
$copy_data['message_read'] = 'y';
// Already read automatically
ee()->db->query(ee()->db->insert_string('exp_message_copies', $copy_data));
}
/** -------------------------------------
/** Replying or Forwarding?
/** -------------------------------------*/
if ($status == 'sent' && (ee()->input->get_post('replying') !== FALSE or ee()->input->get_post('forwarding') !== FALSE)) {
$copy_id = ee()->input->get_post('replying') !== FALSE ? ee()->input->get_post('replying') : ee()->input->get_post('forwarding');
$status = ee()->input->get_post('replying') !== FALSE ? 'replied' : 'forwarded';
ee()->db->query("UPDATE exp_message_copies SET message_status = '{$status}' WHERE copy_id = '{$copy_id}'");
}
/** -------------------------------------
/** Correct Member ID for Attachments
/** -------------------------------------*/
if (count($this->attachments) > 0) {
ee()->db->query("UPDATE exp_message_attachments SET message_id = '{$message_id}'\r\n\t\t\t\t\t\tWHERE attachment_id IN ('" . implode("','", $this->attachments) . "')");
}
/** -------------------------------------
/** Remove Temp Status for Attachments
/** -------------------------------------*/
if ($status == 'sent') {
ee()->db->query("UPDATE exp_message_attachments SET is_temp = 'n' WHERE message_id = '{$message_id}'");
}
/** -------------------------------------
/** Redirect Them
/** -------------------------------------*/
if ($status == 'preview') {
return $this->compose($message_id, $submission_error);
} elseif ($status == 'draft') {
$this->drafts();
} else {
ee()->functions->redirect($this->_create_path('inbox'));
}
}
示例8: _unserialize_cleanup
/**
* Unserialize Cleanup
*/
function _unserialize_cleanup($vals)
{
if (is_array($vals)) {
foreach ($vals as &$val) {
$val = FF2EE2::_unserialize_cleanup($val);
}
} else {
$vals = stripslashes($vals);
if (get_instance()->config->item('auto_convert_high_ascii') == 'y') {
get_instance()->load->helper('text');
$vals = entities_to_ascii($vals);
}
}
return $vals;
}
示例9: insert_new_entry
//.........这里部分代码省略.........
if (ee()->extensions->end_script === TRUE) return;
}
// ----------------------------------------
// ----------------------------------------
// Send email
// ----------------------------------------
ee()->email->wordwrap = $wordwrap;
ee()->email->mailtype = ( $this->check_yes($query->row('html')) ) ? 'html': 'text';
if ( count( $this->attachments ) > 0 AND $this->check_yes($this->_param('send_attachment')) )
{
foreach ( $this->attachments as $file_name )
{
ee()->email->attach( $file_name['filepath'] );
}
ee()->db->query(
ee()->db->update_string(
'exp_freeform_attachments',
array( 'emailed' => 'y' ),
array( 'entry_id' => $this->entry_id )
)
);
}
foreach ($recipients as $val)
{
ee()->email->initialize();
ee()->email->from($msg['from_email'], $msg['from_name']);
ee()->email->to($val);
ee()->email->subject($msg['subject']);
ee()->email->message(entities_to_ascii($msg['msg']));
ee()->email->send();
}
ee()->email->clear(TRUE);
$msg = array();
// ----------------------------------------
// Register the template used
// ----------------------------------------
ee()->db->query(
ee()->db->update_string(
'exp_freeform_entries',
array( 'template' => $template),
array( 'entry_id' => $this->entry_id )
)
);
}
// ----------------------------------------
// Send user email email_change
// ----------------------------------------
if ($this->check_yes($this->_param('recipients')) AND
( ee()->session->userdata['group_id'] == 1 OR ee()->input->ip_address() != '0.0.0.0' ) AND
ee()->input->post('recipient_email') !== FALSE)
{
$all_fields = '';
示例10: fulltext
static function fulltext($string)
{
global $ci;
$ci->load->helper('text');
$string = str_replace(array("\r\n", "\r", "\n"), ' ', strip_tags(nl2br($string)));
$string = convert_accented_characters(entities_to_ascii($string));
return trim(preg_replace('/\\s(?=\\s)/', '', $string));
}
示例11: register_member
//.........这里部分代码省略.........
ee()->lang->loadfile('mailinglist');
$action_id = ee()->functions->fetch_action_id('Mailinglist', 'authorize_email');
$swap = array('activation_url' => ee()->functions->fetch_site_index(0, 0) . QUERY_MARKER . 'ACT=' . $action_id . '&id=' . $code, 'site_name' => stripslashes(ee()->config->item('site_name')), 'site_url' => ee()->config->item('site_url'));
$template = ee()->functions->fetch_email_template('mailinglist_activation_instructions');
$email_tit = ee()->functions->var_swap($template['title'], $swap);
$email_msg = ee()->functions->var_swap($template['data'], $swap);
// Send email
ee()->load->library('email');
ee()->email->wordwrap = true;
ee()->email->mailtype = 'plain';
ee()->email->priority = '3';
ee()->email->from(ee()->config->item('webmaster_email'), ee()->config->item('webmaster_name'));
ee()->email->to($_POST['email']);
ee()->email->subject($email_tit);
ee()->email->message($email_msg);
ee()->email->send();
} else {
// Automatically Accepted
ee()->db->query("INSERT INTO exp_mailing_list (list_id, authcode, email, ip_address)\r\n\t\t\t\t\t\t\t\t\t\t VALUES ('" . ee()->db->escape_str($_POST['mailinglist_subscribe']) . "', '" . $code . "', '" . ee()->db->escape_str($_POST['email']) . "', '" . ee()->db->escape_str(ee()->input->ip_address()) . "')");
}
}
}
// Update
if (ee()->config->item('req_mbr_activation') == 'none') {
ee()->stats->update_member_stats();
}
// Send admin notifications
if (ee()->config->item('new_member_notification') == 'y' && ee()->config->item('mbr_notification_emails') != '') {
$name = $data['screen_name'] != '' ? $data['screen_name'] : $data['username'];
$swap = array('name' => $name, 'site_name' => stripslashes(ee()->config->item('site_name')), 'control_panel_url' => ee()->config->item('cp_url'), 'username' => $data['username'], 'email' => $data['email']);
$template = ee()->functions->fetch_email_template('admin_notify_reg');
$email_tit = $this->_var_swap($template['title'], $swap);
$email_msg = $this->_var_swap($template['data'], $swap);
// Remove multiple commas
$notify_address = reduce_multiples(ee()->config->item('mbr_notification_emails'), ',', TRUE);
// Send email
ee()->load->helper('text');
ee()->load->library('email');
ee()->email->wordwrap = true;
ee()->email->from(ee()->config->item('webmaster_email'), ee()->config->item('webmaster_name'));
ee()->email->to($notify_address);
ee()->email->subject($email_tit);
ee()->email->message(entities_to_ascii($email_msg));
ee()->email->Send();
}
// -------------------------------------------
// 'member_member_register' hook.
// - Additional processing when a member is created through the User Side
// - $member_id added in 2.0.1
//
ee()->extensions->call('member_member_register', $data, $member_id);
if (ee()->extensions->end_script === TRUE) {
return;
}
//
// -------------------------------------------
// Send user notifications
if (ee()->config->item('req_mbr_activation') == 'email') {
$action_id = ee()->functions->fetch_action_id('Member', 'activate_member');
$name = $data['screen_name'] != '' ? $data['screen_name'] : $data['username'];
$board_id = ee()->input->get_post('board_id') !== FALSE && is_numeric(ee()->input->get_post('board_id')) ? ee()->input->get_post('board_id') : 1;
$forum_id = ee()->input->get_post('FROM') == 'forum' ? '&r=f&board_id=' . $board_id : '';
$add = $mailinglist_subscribe !== TRUE ? '' : '&mailinglist=' . $_POST['mailinglist_subscribe'];
$swap = array('name' => $name, 'activation_url' => ee()->functions->fetch_site_index(0, 0) . QUERY_MARKER . 'ACT=' . $action_id . '&id=' . $data['authcode'] . $forum_id . $add, 'site_name' => stripslashes(ee()->config->item('site_name')), 'site_url' => ee()->config->item('site_url'), 'username' => $data['username'], 'email' => $data['email']);
$template = ee()->functions->fetch_email_template('mbr_activation_instructions');
$email_tit = $this->_var_swap($template['title'], $swap);
$email_msg = $this->_var_swap($template['data'], $swap);
// Send email
ee()->load->helper('text');
ee()->load->library('email');
ee()->email->wordwrap = true;
ee()->email->from(ee()->config->item('webmaster_email'), ee()->config->item('webmaster_name'));
ee()->email->to($data['email']);
ee()->email->subject($email_tit);
ee()->email->message(entities_to_ascii($email_msg));
ee()->email->Send();
$message = lang('mbr_membership_instructions_email');
} elseif (ee()->config->item('req_mbr_activation') == 'manual') {
$message = lang('mbr_admin_will_activate');
} else {
// Log user in (the extra query is a little annoying)
ee()->load->library('auth');
$member_data_q = ee()->db->get_where('members', array('member_id' => $member_id));
$incoming = new Auth_result($member_data_q->row());
$incoming->remember_me();
$incoming->start_session();
$message = lang('mbr_your_are_logged_in');
}
// Build the message
if (ee()->input->get_post('FROM') == 'forum') {
$query = $this->_do_form_query();
$site_name = $query->row('board_label');
$return = $query->row('board_forum_url');
} else {
$site_name = ee()->config->item('site_name') == '' ? lang('back') : stripslashes(ee()->config->item('site_name'));
$return = ee()->config->item('site_url');
}
$data = array('title' => lang('mbr_registration_complete'), 'heading' => lang('thank_you'), 'content' => lang('mbr_registration_completed') . "\n\n" . $message, 'redirect' => '', 'link' => array($return, $site_name));
ee()->output->show_message($data);
}
示例12: register_member
//.........这里部分代码省略.........
// Automatically Accepted
$this->EE->db->query("INSERT INTO exp_mailing_list (list_id, authcode, email, ip_address)\n\t\t\t\t\t\t\t\t\t\t VALUES ('" . $this->EE->db->escape_str($_POST['mailinglist_subscribe']) . "', '" . $code . "', '" . $this->EE->db->escape_str($_POST['email']) . "', '" . $this->EE->db->escape_str($this->EE->input->ip_address()) . "')");
}
}
}
/** -------------------------------------
/** Update
/** -------------------------------------*/
if ($this->EE->config->item('req_mbr_activation') == 'none') {
$this->EE->stats->update_member_stats();
}
/** -------------------------------------
/** Send admin notifications
/** -------------------------------------*/
if ($this->EE->config->item('new_member_notification') == 'y' and $this->EE->config->item('mbr_notification_emails') != '') {
$name = $data['screen_name'] != '' ? $data['screen_name'] : $data['username'];
$swap = array('name' => $name, 'site_name' => stripslashes($this->EE->config->item('site_name')), 'control_panel_url' => $this->EE->config->item('cp_url'), 'username' => $data['username'], 'email' => $data['email']);
$template = $this->EE->functions->fetch_email_template('admin_notify_reg');
$email_tit = $this->_var_swap($template['title'], $swap);
$email_msg = $this->_var_swap($template['data'], $swap);
$this->EE->load->helper('string');
// Remove multiple commas
$notify_address = reduce_multiples($this->EE->config->item('mbr_notification_emails'), ',', TRUE);
/** ----------------------------
/** Send email
/** ----------------------------*/
// Load the text helper
$this->EE->load->helper('text');
$this->EE->load->library('email');
$this->EE->email->wordwrap = true;
$this->EE->email->from($this->EE->config->item('webmaster_email'), $this->EE->config->item('webmaster_name'));
$this->EE->email->to($notify_address);
$this->EE->email->subject($email_tit);
$this->EE->email->message(entities_to_ascii($email_msg));
$this->EE->email->Send();
}
// -------------------------------------------
// 'member_member_register' hook.
// - Additional processing when a member is created through the User Side
// - $member_id added in 2.0.1
//
$edata = $this->EE->extensions->call('member_member_register', $data, $member_id);
if ($this->EE->extensions->end_script === TRUE) {
return;
}
//
// -------------------------------------------
/** -------------------------------------
/** Zoo Visitor assignment
/** -------------------------------------*/
$member_data = $data;
$member_data["member_id"] = $member_id;
/** -------------------------------------
/** Send user notifications
/** -------------------------------------*/
if ($this->EE->config->item('req_mbr_activation') == 'email') {
$action_id = $this->EE->functions->fetch_action_id('Member', 'activate_member');
$name = $data['screen_name'] != '' ? $data['screen_name'] : $data['username'];
$board_id = $this->EE->input->get_post('board_id') !== FALSE && is_numeric($this->EE->input->get_post('board_id')) ? $this->EE->input->get_post('board_id') : 1;
$forum_id = $this->EE->input->get_post('FROM') == 'forum' ? '&r=f&board_id=' . $board_id : '';
$add = $mailinglist_subscribe !== TRUE ? '' : '&mailinglist=' . $_POST['mailinglist_subscribe'];
$swap = array('name' => $name, 'activation_url' => $this->EE->functions->fetch_site_index(0, 0) . QUERY_MARKER . 'ACT=' . $action_id . '&id=' . $data['authcode'] . $forum_id . $add, 'site_name' => stripslashes($this->EE->config->item('site_name')), 'site_url' => $this->EE->config->item('site_url'), 'username' => $data['username'], 'email' => $data['email']);
$template = $this->EE->functions->fetch_email_template('mbr_activation_instructions');
$email_tit = $this->_var_swap($template['title'], $swap);
$email_msg = $this->_var_swap($template['data'], $swap);
/** ----------------------------
示例13: cp_welcome_email_send
function cp_welcome_email_send($member_id) {
$this->EE =& get_instance();
$this->EE->load->library('email');
$this->EE->load->helper('text');
$password_string = "abcdefghijklmnopqrstuvwxyz1234567890";
$password = "";
for($i=0; $i<8; $i++) {
$password .= $password_string[ rand(0, strlen($password_string)-1) ];
}
$message = $this->settings["welcome_email_body"];
$from = $this->settings["welcome_email_from"];
$subject = $this->settings["welcome_email_subject"];
$subject = str_replace("{site_name}", $this->EE->config->item('site_name'), $subject);
$query = $this->EE->db->query("SELECT username, screen_name, email from exp_members WHERE member_id = " . $member_id);
$message = str_replace("{password}", $password, $message);
$message = str_replace("{username}", $query->row("username"), $message);
$message = str_replace("{name}", $query->row("screen_name"), $message);
$message = str_replace("{site_name}", $this->EE->config->item('site_name'), $message);
$message = str_replace("{site_url}", $this->EE->config->item('site_url'), $message);
$this->EE->db->query("UPDATE exp_members SET password = SHA('". $password . "') WHERE member_id = " . $member_id);
$to = $query->row("email");
$this->EE->email->wordwrap = false;
$this->EE->email->mailtype = 'text';
$this->EE->email->from( $from );
$this->EE->email->to( $to );
if ($this->settings["welcome_email_bcc"]=="yes") {
$this->EE->email->bcc( $this->EE->config->item('webmaster_email') );
}
$this->EE->email->subject( $subject );
$this->EE->email->message(entities_to_ascii( $message ));
$this->EE->email->Send();
}
示例14: delete_account
//.........这里部分代码省略.........
foreach (array_unique($channel_ids) as $channel_id) {
if (APP_VER < 2.0) {
ee()->stats->update_weblog_stats($channel_id);
} else {
ee()->stats->update_channel_stats($channel_id);
}
ee()->stats->update_comment_stats($channel_id);
}
}
// END conditional for EE versions below EE 2.4.0
/** -------------------------------------
/** Email notification recipients
/** -------------------------------------*/
if ($mbr_delete_notify_emails != '') {
$notify_address = $mbr_delete_notify_emails;
$swap = array('name' => $screen_name, 'email' => $email, 'site_name' => stripslashes(ee()->config->item('site_name')));
$email_tit = ee()->functions->var_swap(ee()->lang->line('mbr_delete_notify_title'), $swap);
$email_msg = ee()->functions->var_swap(ee()->lang->line('mbr_delete_notify_message'), $swap);
// No notification for the user themselves, if they're in the list
if (stristr($notify_address, $email)) {
$notify_address = str_replace($email, "", $notify_address);
}
ee()->load->helper('string');
$notify_address = reduce_multiples($notify_address, ',', TRUE);
if ($notify_address != '') {
/** ----------------------------
/** Send email
/** ----------------------------*/
ee()->load->library('email');
ee()->load->helper('text');
foreach (explode(',', $notify_address) as $addy) {
ee()->email->initialize();
ee()->email->wordwrap = false;
ee()->email->from(ee()->config->item('webmaster_email'), ee()->config->item('webmaster_name'));
ee()->email->to($addy);
ee()->email->reply_to(ee()->config->item('webmaster_email'));
ee()->email->subject($email_tit);
ee()->email->message(entities_to_ascii($email_msg));
ee()->email->Send();
}
}
}
/** -------------------------------------
/** Trash the Session and cookies
/** -------------------------------------*/
ee()->db->query("DELETE FROM exp_online_users \n\t\t\t\t\t\t WHERE site_id = '" . ee()->db->escape_str(ee()->config->item('site_id')) . "' \n\t\t\t\t\t\t AND ip_address = '{ee()->input->ip_address()}' \n\t\t\t\t\t\t AND member_id = '{$id}'");
ee()->db->query("DELETE FROM exp_sessions WHERE member_id = '" . $id . "'");
if ($admin === FALSE) {
if (APP_VER < '2.2.0') {
ee()->functions->set_cookie(ee()->session->c_password);
}
ee()->functions->set_cookie(ee()->session->c_session);
ee()->functions->set_cookie(ee()->session->c_expire);
ee()->functions->set_cookie(ee()->session->c_anon);
ee()->functions->set_cookie('read_topics');
ee()->functions->set_cookie('tracker');
}
if (ee()->extensions->active_hook('user_delete_account_end') === TRUE) {
$edata = ee()->extensions->universal_call('user_delete_account_end', $this);
if (ee()->extensions->end_script === TRUE) {
return;
}
}
/** ----------------------------------------
/** Override Return
/** ----------------------------------------*/
if ($this->_param('override_return') !== FALSE and $this->_param('override_return') != '' && $this->is_ajax_request() === FALSE) {
ee()->functions->redirect($this->_param('override_return'));
exit;
}
/** ----------------------------------------
/** Set return
/** ----------------------------------------*/
if (ee()->input->get_post('return') !== FALSE and ee()->input->get_post('return') != '') {
$return = ee()->input->get_post('return');
} elseif (ee()->input->get_post('RET') !== FALSE and ee()->input->get_post('RET') != '') {
$return = ee()->input->get_post('RET');
} else {
$return = ee()->config->item('site_url');
}
if (preg_match("/" . LD . "\\s*path=(.*?)" . RD . "/", $return, $match)) {
$return = ee()->functions->create_url($match['1']);
}
/** ----------------------------------------
/** Return
/** ----------------------------------------*/
$return = $this->_chars_decode($return);
// --------------------------------------------
// AJAX Response
// --------------------------------------------
if ($this->is_ajax_request()) {
$this->send_ajax_response(array('success' => TRUE, 'heading' => lang('user_successful_submission'), 'message' => lang('mbr_account_deleted'), 'content' => lang('mbr_account_deleted')));
}
/** -------------------------------------
/** Build Success Message
/** -------------------------------------*/
$name = stripslashes(ee()->config->item('site_name'));
$data = array('title' => ee()->lang->line('mbr_delete'), 'heading' => ee()->lang->line('thank_you'), 'content' => ee()->lang->line('mbr_account_deleted'), 'redirect' => $return);
ee()->output->show_message($data);
}
示例15: upload_asset
//.........这里部分代码省略.........
$this->EE->db->where('id', $this->EE->input->post("id"));
$this->EE->db->update('exp_ajw_client_downloads_asset', $data);
$asset_id = $this->EE->input->post("id");
// Get existing folders
$this->EE->db->select("folder_id");
$this->EE->db->where("asset_id", $this->EE->input->post("id"));
$query = $this->EE->db->get("exp_ajw_client_downloads_folder_assets");
$existing = array();
foreach ($query->result_array() as $row) {
$existing[] = $row["folder_id"];
}
if ($this->EE->input->post('folders') !== FALSE) {
$folders = $this->EE->input->post('folders');
} else {
$folders = array();
}
$delete = array_diff($existing, $folders);
$insert = array_diff($folders, $existing);
$update = array_intersect($folders, $existing);
// Add new folders
foreach ($insert as $folder_id) {
$data = array("site_id" => $this->EE->config->item('site_id'), "folder_id" => $folder_id, "asset_id" => $asset_id, "created" => $this->EE->localize->now);
$this->EE->db->insert('exp_ajw_client_downloads_folder_assets', $data);
}
// Remove old folders
if (count($delete)) {
$this->EE->db->where("site_id", $this->EE->config->item('site_id'));
$this->EE->db->where("asset_id", $asset_id);
$this->EE->db->where_in("folder_id", $delete);
$this->EE->db->delete("exp_ajw_client_downloads_folder_assets");
}
$this->EE->functions->redirect($this->base . AMP . "method=assets");
} else {
// Add a new asset
// $this->EE->form_validation->set_rules('file_upload', 'File', 'callback__file_uploaded');
if ($this->EE->form_validation->run() === FALSE) {
return $this->asset($this->EE->input->post("id"));
}
// Fetch the file
if (isset($_FILES["file_upload"]) && $_FILES["file_upload"]["name"] != "") {
// Do file upload
$config['upload_path'] = $settings["basepath"];
$config['allowed_types'] = '*';
$this->EE->load->library('upload', $config);
if (!$this->EE->upload->do_upload("file_upload")) {
// todo: handle this error properly
print_r($this->EE->upload->display_errors());
exit;
} else {
$upload = $this->EE->upload->data();
$data = array("site_id" => $this->EE->config->item('site_id'), "title" => $this->EE->input->post("title"), "keywords" => $this->EE->input->post("keywords"), "description" => $this->EE->input->post("description"), "path" => $upload["file_name"], "created" => $this->EE->localize->now);
}
} elseif ($this->EE->input->post("file") !== FALSE) {
// Move file from temporary folder
$target_path = $this->settings["basepath"] . $this->EE->input->post("file");
rename($this->settings["temp_path"] . $this->EE->input->post("file"), $target_path);
$data = array("site_id" => $this->EE->config->item('site_id'), "title" => $this->EE->input->post("title"), "keywords" => $this->EE->input->post("keywords"), "description" => $this->EE->input->post("description"), "path" => $this->EE->input->post("file"), "created" => $this->EE->localize->now);
}
$this->EE->db->insert('exp_ajw_client_downloads_asset', $data);
$asset_id = $this->EE->db->insert_id();
if ($this->EE->input->post('folders') !== FALSE) {
foreach ($this->EE->input->post('folders') as $folder_id) {
$data = array("site_id" => $this->EE->config->item('site_id'), "folder_id" => $folder_id, "asset_id" => $asset_id, "created" => $this->EE->localize->now);
$this->EE->db->insert('exp_ajw_client_downloads_folder_assets', $data);
}
}
// Send email notification to all members assigned to this folder
if ($this->EE->input->post("notify_upload") == "y" && $this->settings["new_asset_email_body"] != "") {
$this->EE->db->distinct();
$this->EE->db->select("email");
$this->EE->db->from("exp_ajw_client_downloads_asset");
$this->EE->db->join("exp_ajw_client_downloads_folder_assets", "exp_ajw_client_downloads_asset.id = exp_ajw_client_downloads_folder_assets.asset_id");
$this->EE->db->join("exp_ajw_client_downloads_users", " exp_ajw_client_downloads_folder_assets.folder_id = exp_ajw_client_downloads_users.folder_id");
$this->EE->db->join("exp_members", "exp_ajw_client_downloads_users.member_id = exp_members.member_id");
$this->EE->db->where("exp_ajw_client_downloads_asset.id", $asset_id);
$query = $this->EE->db->get();
$this->EE->load->library('email');
$this->EE->load->helper('text');
$this->EE->email->wordwrap = true;
$this->EE->email->mailtype = 'text';
$message = $this->settings["new_asset_email_body"];
// todo: any more variables?
$message = str_replace('{title}', $this->EE->input->post("title"), $message);
foreach ($query->result_array() as $row) {
$recipient = $row["email"];
$this->EE->email->initialize();
if (preg_match('/(.*)\\<(.*)\\>/', $this->settings["new_asset_email_from"], $match)) {
$this->EE->email->from(trim($match[2]), trim($match[1]));
} else {
$this->EE->email->from($this->settings["new_asset_email_from"]);
}
$this->EE->email->to($recipient);
$this->EE->email->subject($this->settings["new_asset_email_subject"]);
$this->EE->email->message(entities_to_ascii($message));
$this->EE->email->Send();
}
}
$this->EE->functions->redirect($this->base . AMP . "method=assets");
}
}