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


PHP locale_restore_previous函数代码示例

本文整理汇总了PHP中locale_restore_previous函数的典型用法代码示例。如果您正苦于以下问题:PHP locale_restore_previous函数的具体用法?PHP locale_restore_previous怎么用?PHP locale_restore_previous使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: T_

 function T_($string, $req_locale = '')
 {
     global $current_locale, $locales, $evo_charset;
     if (empty($req_locale)) {
         if (empty($current_locale)) {
             // don't translate if we have no locale
             return $string;
         }
         $req_locale = $current_locale;
     }
     if ($req_locale == $current_locale) {
         // We have not asked for a different locale than the currently active one:
         $r = _($string);
         $messages_charset = $locales[$req_locale]['charset'];
     } else {
         // We have asked for another locale...
         if (locale_temp_switch($req_locale)) {
             global $current_charset;
             $r = _($string);
             $messages_charset = $current_charset;
             locale_restore_previous();
         } else {
             // Locale could not be activated:
             $r = $string;
             $messages_charset = 'iso-8859-1';
             // charset of our .php files
         }
     }
     if (!empty($evo_charset)) {
         $r = convert_charset($r, $evo_charset, $messages_charset);
     }
     return $r;
 }
开发者ID:LFSF,项目名称:oras,代码行数:33,代码来源:_locale.funcs.php

示例2: skin_include

}
?>
		
	</div>

	<?php 
// ------------------ FEEDBACK (COMMENTS/TRACKBACKS) INCLUDED HERE ------------------
skin_include('_item_feedback.inc.php', array('before_section_title' => '<h4>', 'after_section_title' => '</h4>', 'author_link_text' => 'preferredname'));
// Note: You can customize the default item feedback by copying the generic
// /skins/_item_feedback.inc.php file into the current skin folder.
// ---------------------- END OF FEEDBACK (COMMENTS/TRACKBACKS) ---------------------
?>

	<?php 
// ------------------ WORKFLOW PROPERTIES INCLUDED HERE ------------------
skin_include('_item_workflow.inc.php');
// ---------------------- END OF WORKFLOW PROPERTIES ---------------------
?>

	<?php 
// ------------------ META COMMENTS INCLUDED HERE ------------------
skin_include('_item_meta_comments.inc.php', array('comment_start' => '<article class="evo_comment evo_comment__meta panel panel-default">', 'comment_end' => '</article>'));
// ---------------------- END OF META COMMENTS ---------------------
?>

	<?php 
locale_restore_previous();
// Restore previous locale (Blog locale)
?>

</article>
开发者ID:b2evolution,项目名称:photo_mouse_skin,代码行数:31,代码来源:_item_block.inc.php

示例3: send_email_notifications


//.........这里部分代码省略.........
        }
        if (!count($notify_users)) {
            // No-one to notify:
            return false;
        }
        /*
         * We have a list of user IDs to notify:
         */
        // TODO: dh> this reveals the comments author's email address to all subscribers!!
        //           $notify_from should get used by default, unless the user has opted in to be the sender!
        // fp>If the subscriber has permission to moderate the comments, he SHOULD receive the email address.
        // Get author email address. It will be visible for moderators/blog/post owners only -- NOT for other subscribers
        if ($this->get_author_User()) {
            // Comment from a registered user:
            $reply_to = $this->author_User->get('email');
            $author_name = $this->author_User->get('login');
            $author_ID = $this->author_User->ID;
        } elseif (!empty($this->author_email)) {
            // non-member, but with email address:
            $reply_to = $this->author_email;
            $author_name = $this->dget('author');
            $author_ID = NULL;
        } else {
            // Fallback (we have no email address):  fp>TODO: or the subscriber is not allowed to view it.
            $reply_to = NULL;
            $author_name = $this->dget('author');
            $author_ID = NULL;
        }
        // Load all users who will be notified, becasuse another way the send_mail_to_User funtion would load them one by one
        $UserCache =& get_UserCache();
        $UserCache->load_list(array_keys($notify_users));
        // Load a list with the blocked emails  in cache
        load_blocked_emails(array_keys($notify_users));
        // Send emails:
        foreach ($notify_users as $notify_user_ID => $notify_type) {
            // get data content
            $notify_User = $UserCache->get_by_ID($notify_user_ID);
            $notify_email = $notify_User->get('email');
            // init notification setting
            locale_temp_switch($notify_User->get('locale'));
            $notify_user_Group = $notify_User->get_Group();
            $notify_full = $notify_type == 'moderator' && $notify_user_Group->check_perm('comment_moderation_notif', 'full') || $notify_user_Group->check_perm('comment_subscription_notif', 'full');
            switch ($this->type) {
                case 'trackback':
                    /* TRANS: Subject of the mail to send on new trackbacks. First %s is the blog's shortname, the second %s is the item's title. */
                    $subject = T_('[%s] New trackback on "%s"');
                    break;
                default:
                    /* TRANS: Subject of the mail to send on new comments. */
                    // In case of full notification the first %s is blog name, the second %s is the item's title.
                    // In case of short notification the first %s is author login, the second %s is the item's title.
                    $subject = $notify_full ? T_('[%s] New comment on "%s"') : T_('%s posted a new comment on "%s"');
                    if ($only_moderators) {
                        if ($this->status == 'draft') {
                            $subject = $notify_full ? T_('[%s] New comment awaiting moderation on "%s"') : T_('New comment awaiting moderation: ') . $subject;
                        } else {
                            $subject = $notify_full ? T_('[%s] New comment may need moderation on "%s"') : T_('New comment may need moderation: ') . $subject;
                        }
                    }
            }
            if ($notify_type == 'moderator') {
                // moderation email
                $user_reply_to = $reply_to;
            } else {
                if ($notify_type == 'blog_subscription') {
                    // blog subscription
                    $user_reply_to = NULL;
                } else {
                    if ($notify_type == 'item_subscription') {
                        // item subscription
                        $user_reply_to = NULL;
                    } else {
                        if ($notify_type == 'creator') {
                            // user is the creator of the post
                            $user_reply_to = $reply_to;
                        } else {
                            debug_die('Unknown user subscription type');
                        }
                    }
                }
            }
            $subject = sprintf($subject, $notify_full ? $edited_Blog->get('shortname') : $author_name, $edited_Item->get('title'));
            $email_template_params = array('notify_full' => $notify_full, 'Comment' => $this, 'Blog' => $edited_Blog, 'Item' => $edited_Item, 'author_name' => $author_name, 'author_ID' => $author_ID, 'notify_type' => $notify_type);
            if ($debug) {
                $notify_message = mail_template('comment_new', 'text', $email_template_params);
                $mail_dump = "Sending notification to {$notify_email}:<pre>Subject: {$subject}\n{$notify_message}</pre>";
                if ($debug >= 2) {
                    // output mail content - NOTE: this will kill sending of headers.
                    echo "<p>{$mail_dump}</p>";
                }
                $Debuglog->add($mail_dump, 'notification');
            }
            // Send the email:
            // Note: Note activated users won't get notification email
            send_mail_to_User($notify_user_ID, $subject, 'comment_new', $email_template_params, false, array('Reply-To' => $user_reply_to));
            blocked_emails_memorize($notify_User->email);
            locale_restore_previous();
        }
        blocked_emails_display();
    }
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:101,代码来源:_comment.class.php

示例4: mail_template

/**
 * Get a mail message text by template name
 *
 * @param string Template name
 * @param string Email format ( auto | html | text )
 * @param array Params
 * @param object User
 * @return string Mail message
 */
function mail_template($template_name, $format = 'auto', $params = array(), $User = NULL)
{
    global $current_charset, $is_admin_page;
    if (!empty($params['locale'])) {
        // Switch to locale for current email template
        locale_temp_switch($params['locale']);
    }
    $value_is_admin_page = $is_admin_page;
    // Set TRUE to use gender settings from back office
    $is_admin_page = true;
    // Set extension of template
    $template_exts = array();
    switch ($format) {
        case 'auto':
            // $template_exts['non-mime'] = '.txt.php'; // The area that is ignored by MIME-compliant clients
            $template_exts['text'] = '.txt.php';
            $template_exts['html'] = '.html.php';
            $boundary = $params['boundary'];
            $boundary_alt = 'b2evo-alt-' . md5(rand());
            $template_headers = array('text' => 'Content-Type: text/plain; charset=' . $current_charset, 'html' => 'Content-Type: text/html; charset=' . $current_charset);
            break;
        case 'html':
            $template_exts['html'] = '.html.php';
            break;
        case 'text':
            $template_exts['text'] = '.txt.php';
            break;
    }
    $template_message = '';
    if (isset($boundary, $boundary_alt)) {
        // Start new boundary content
        $template_message .= "\n" . '--' . $boundary . "\n";
        $template_message .= 'Content-Type: multipart/alternative; boundary="' . $boundary_alt . '"' . "\n\n";
    }
    foreach ($template_exts as $format => $ext) {
        if (isset($boundary, $boundary_alt) && $format != 'non-mime') {
            // Start new boundary alt content
            $template_message .= "\n" . '--' . $boundary_alt . "\n";
        }
        if (isset($template_headers[$format])) {
            // Header data for each content
            $template_message .= $template_headers[$format] . "\n\n";
        }
        // Get mail template
        ob_start();
        emailskin_include($template_name . $ext, $params);
        $template_message .= ob_get_clean();
        if (!empty($User)) {
            // Replace $login$ with gender colored link + icon in HTML format,
            //   and with simple login text in PLAIN TEXT format
            $user_login = $format == 'html' ? $User->get_colored_login(array('mask' => '$avatar$ $login$')) : $User->login;
            $template_message = str_replace('$login$', $user_login, $template_message);
        }
    }
    if (isset($boundary, $boundary_alt)) {
        // End all boundary contents
        $template_message .= "\n" . '--' . $boundary_alt . '--' . "\n";
        $template_message .= "\n" . '--' . $boundary . '--' . "\n";
    }
    // Return back the value
    $is_admin_page = $value_is_admin_page;
    if (!empty($params['locale'])) {
        // Restore previous locale
        locale_restore_previous();
    }
    return $template_message;
}
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:76,代码来源:_misc.funcs.php

示例5: preview_from_request

 /**
  * We want to preview a single post, we are going to fake a lot of things...
  */
 function preview_from_request()
 {
     global $current_User;
     if (empty($current_User)) {
         // dh> only logged in user's can preview. Alternatively we need those checks where $current_User gets used below.
         return;
     }
     global $DB, $localtimenow, $Messages, $BlogCache;
     global $Plugins;
     if ($this->Blog->get_setting('allow_html_post')) {
         // HTML is allowed for this post
         $text_format = 'html';
     } else {
         // HTML is disallowed for this post
         $text_format = 'htmlspecialchars';
     }
     $preview_userid = param('preview_userid', 'integer', true);
     $post_status = param('post_status', 'string', true);
     $post_locale = param('post_locale', 'string', $current_User->locale);
     $content = param('content', $text_format, true);
     $post_title = param('post_title', $text_format, true);
     $post_titletag = param('titletag', 'string', true);
     $post_excerpt = param('post_excerpt', 'string', true);
     $post_url = param('post_url', 'string', '');
     check_categories_nosave($post_category, $post_extracats);
     $post_views = param('post_views', 'integer', 0);
     $renderers = param('renderers', 'array/string', array('default'));
     if (!is_array($renderers)) {
         // dh> workaround for param() bug. See rev 1.93 of /inc/_misc/_misc.funcs.php
         $renderers = array('default');
     }
     if ($post_category == 0) {
         $post_category = $this->Blog->get_default_cat_ID();
     }
     $comment_Blog =& $BlogCache->get_by_ID(get_catblog($post_category));
     if ($comment_Blog->get_setting('allow_comments') != 'never' && $comment_Blog->get_setting('disable_comments_bypost')) {
         // param is required
         $post_comment_status = param('post_comment_status', 'string', true);
     } else {
         $post_comment_status = $comment_Blog->get_setting('allow_comments');
     }
     // Get issue date, using the user's locale (because it's entered like this in the form):
     locale_temp_switch($current_User->locale);
     param_date('item_issue_date', T_('Please enter a valid issue date.'), false);
     // TODO: dh> get_param() is always true here, also on invalid dates:
     if (strlen(get_param('item_issue_date'))) {
         // only set it, if a date was given:
         param_time('item_issue_time');
         $item_issue_date = form_date(get_param('item_issue_date'), get_param('item_issue_time'));
         // TODO: cleanup...
     } else {
         $item_issue_date = date('Y-m-d H:i:s', $localtimenow);
     }
     locale_restore_previous();
     $item_typ_ID = param('item_typ_ID', 'integer', NULL);
     $item_st_ID = param('item_st_ID', 'integer', NULL);
     $item_assigned_user_ID = param('item_assigned_user_ID', 'integer', NULL);
     $item_deadline = param('item_deadline', 'string', NULL);
     $item_priority = param('item_priority', 'integer', NULL);
     // QUESTION: can this be also empty/NULL?
     // Do some optional filtering on the content
     // Typically stuff that will help the content to validate
     // Useful for code display.
     // Will probably be used for validation also.
     $Plugins_admin =& get_Plugins_admin();
     $params = array('object_type' => 'Item', 'object_Blog' => &$comment_Blog);
     $Plugins_admin->filter_contents($post_title, $content, $renderers, $params);
     $post_title = format_to_post($post_title);
     $content = format_to_post($content);
     $post_ID = param('post_ID', 'integer', 0);
     $this->sql = "SELECT\n\t\t\t{$post_ID} AS post_ID,\n\t\t\t{$preview_userid} AS post_creator_user_ID,\n\t\t\t{$preview_userid} AS post_lastedit_user_ID,\n\t\t\t'{$item_issue_date}' AS post_datestart,\n\t\t\t'{$item_issue_date}' AS post_datecreated,\n\t\t\t'{$item_issue_date}' AS post_datemodified,\n\t\t\t'{$item_issue_date}' AS post_last_touched_ts,\n\t\t\t0 AS post_dateset,\n\t\t\t'" . $DB->escape($post_status) . "' AS post_status,\n\t\t\t'" . $DB->escape($post_locale) . "' AS post_locale,\n\t\t\t'" . $DB->escape($content) . "' AS post_content,\n\t\t\t'" . $DB->escape($post_title) . "' AS post_title,\n\t\t\t'" . $DB->escape($post_titletag) . "' AS post_titletag,\n\t\t\t'" . $DB->escape($post_excerpt) . "' AS post_excerpt,\n\t\t\tNULL AS post_excerpt_autogenerated,\n\t\t\tNULL AS post_urltitle,\n\t\t\tNULL AS post_canonical_slug_ID,\n\t\t\tNULL AS post_tiny_slug_ID,\n\t\t\t'" . $DB->escape($post_url) . "' AS post_url,\n\t\t\t{$post_category} AS post_main_cat_ID,\n\t\t\t{$post_views} AS post_views,\n\t\t\t'' AS post_flags,\n\t\t\t'noreq' AS post_notifications_status,\n\t\t\tNULL AS post_notifications_ctsk_ID,\n\t\t\t" . bpost_count_words($content) . " AS post_wordcount,\n\t\t\t" . $DB->quote($post_comment_status) . " AS post_comment_status,\n\t\t\t'" . $DB->escape(implode('.', $renderers)) . "' AS post_renderers,\n\t\t\t" . $DB->quote($item_assigned_user_ID) . " AS post_assigned_user_ID,\n\t\t\t" . $DB->quote($item_typ_ID) . " AS post_ptyp_ID,\n\t\t\t" . $DB->quote($item_st_ID) . " AS post_pst_ID,\n\t\t\t" . $DB->quote($item_deadline) . " AS post_datedeadline,\n\t\t\t" . $DB->quote($item_priority) . " AS post_priority,";
     $this->sql .= $DB->quote(param('item_order', 'double', NULL)) . ' AS post_order' . ",\n" . $DB->quote(param('item_featured', 'integer', NULL)) . ' AS post_featured' . "\n";
     $this->total_rows = 1;
     $this->total_pages = 1;
     $this->page = 1;
     // ATTENTION: we skip the parent on purpose here!! fp> refactor
     DataObjectList2::query(false, false, false, 'PREVIEW QUERY');
     $Item =& $this->Cache->instantiate($this->rows[0]);
     // set Item settings
     $Item->set_setting('hide_teaser', param('item_hideteaser', 'integer', 0));
     $Item->set_setting('post_metadesc', param('metadesc', 'string', true));
     $Item->set_setting('post_custom_headers', param('custom_headers', 'string', true));
     // set custom Item settings
     foreach (array('double', 'varchar') as $type) {
         $count_custom_field = $comment_Blog->get_setting('count_custom_' . $type);
         $param_type = $type == 'varchar' ? 'string' : $type;
         for ($i = 1; $i <= $count_custom_field; $i++) {
             // For each custom double field:
             $field_guid = $comment_Blog->get_setting('custom_' . $type . $i);
             $Item->set_setting('custom_' . $type . '_' . $field_guid, param('item_' . $type . '_' . $field_guid, $param_type, NULL));
         }
     }
     // Trigger plugin event, allowing to manipulate or validate the item before it gets previewed
     $Plugins->trigger_event('AppendItemPreviewTransact', array('Item' => &$Item));
     if ($Messages->has_errors()) {
         $errcontent = $Messages->display(T_('Invalid post, please correct these errors:'), '', false);
         $Item->content = $errcontent . "\n<hr />\n" . $content;
//.........这里部分代码省略.........
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:101,代码来源:_itemlist.class.php

示例6: newsletter_send

/**
 * Send newsletter emails
 */
function newsletter_send()
{
    global $DB, $Session;
    load_class('users/model/_userlist.class.php', 'UserList');
    // Initialize users list from session cache in order to get users IDs for newsletter
    $UserList = new UserList('admin');
    $UserList->memorize = false;
    $UserList->load_from_Request();
    $users_IDs = $UserList->filters['users'];
    // Get all active users which accept newsletter email
    $SQL = get_newsletter_users_sql($users_IDs);
    $users = $DB->get_col($SQL->get());
    echo sprintf(T_('Newsletter is sending for %s users...'), count($users)) . '<br /><br />';
    evo_flush();
    $email_newsletter_params = array('message' => $Session->get('newsletter_message'));
    foreach ($users as $user_ID) {
        $UserCache =& get_UserCache();
        $User = $UserCache->get_by_ID($user_ID);
        echo sprintf(T_('Email is sending for %s (%s)...'), $User->get_identity_link(), $User->get('email')) . ' ';
        // Send a newsletter in user's locale
        locale_temp_switch($User->get('locale'));
        $email_result = send_mail_to_User($user_ID, $Session->get('newsletter_title'), 'newsletter', $email_newsletter_params);
        locale_restore_previous();
        if ($email_result) {
            // Success sending
            echo T_('OK');
        } else {
            // Failed sending
            echo '<span class="red">' . T_('Failed') . '</span>';
        }
        echo '<br />';
        evo_flush();
    }
}
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:37,代码来源:_newsletter.funcs.php

示例7: send_validate_email

 /**
  * Send an email to the user with a link to validate/confirm his email address.
  *
  * If the email could get sent, it saves the used "request_id" into the user's Session.
  *
  * @param string URL, where to redirect the user after he clicked the validation link (gets saved in Session).
  * @return boolean True, if the email could get sent; false if not
  */
 function send_validate_email($redirect_to_after, $blog = NULL, $email_changed = false)
 {
     global $app_name, $Session, $secure_htsrv_url, $baseurl, $servertimenow;
     global $Settings, $UserSettings;
     // Display messages depending on user email status
     display_user_email_status_message($this->ID);
     if ($Settings->get('validation_process') == 'easy') {
         // validation process is set to easy, send and easy activation email
         return send_easy_validate_emails(array($this->ID), false, $email_changed);
     }
     if (mail_is_blocked($this->email)) {
         // prevent trying to send an email to a blocked email address ( Note this is checked in the send_easy_validate_emails too )
         return false;
     }
     if (empty($redirect_to_after)) {
         // redirect to was not set
         $redirect_to_after = param('redirect_to', 'url', '');
         if (empty($redirect_to_after)) {
             if (is_admin_page()) {
                 $redirect_to_after = regenerate_url('action');
             } else {
                 $redirect_to_after = $this->get_userpage_url();
             }
         }
     }
     $request_id = generate_random_key(22);
     $blog_param = empty($blog) ? '' : '&inskin=1&blog=' . $blog;
     // Change locale here to localize the email subject and content
     locale_temp_switch($this->get('locale'));
     $email_template_params = array('status' => $this->status, 'blog_param' => $blog_param, 'request_id' => $request_id);
     $r = send_mail_to_User($this->ID, T_('Activate your account: $login$'), 'account_activate', $email_template_params, true);
     locale_restore_previous();
     if ($r) {
         // save request_id into Session
         $request_ids = $Session->get('core.validatemail.request_ids');
         if (!is_array($request_ids) || $email_changed) {
             // create new request ids array if it doesn't exist yet, or if user email changed ( this way the old request into the old email address won't be valid )
             $request_ids = array();
         }
         $request_ids[] = $request_id;
         $Session->set('core.validatemail.request_ids', $request_ids, 86400 * 2);
         // expires in two days (or when clicked)
         // set a redirect_to session variable because this way after the account will be activated we will know where to redirect
         $Session->set('core.validatemail.redirect_to', $redirect_to_after);
         $Session->dbsave();
         // save immediately
         // update last activation email timestamp
         $UserSettings->set('last_activation_email', date2mysql($servertimenow), $this->ID);
         $UserSettings->dbupdate();
     }
     return $r;
 }
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:60,代码来源:_user.class.php

示例8: send_email_notifications

    /**
     * Send email notification to recipients on new thread or new message event.
     *
     * @param boolean true if new thread, false if new message in the current thread
     * @param boolean the User who sent the message, in case of current User it may be NULL ( This is not the current User e.g. in case of welcome messages )
     * @return boolean True if all messages could be sent, false otherwise.
     */
    function send_email_notifications($new_thread = true, $from_User = NULL)
    {
        global $DB, $current_User, $admin_url, $baseurl, $app_name;
        global $Settings, $UserSettings, $servertimenow;
        // Select recipients of the current thread:
        $SQL = new SQL();
        $SQL->SELECT('u.user_ID, us.uset_value as notify_messages');
        $SQL->FROM('T_messaging__threadstatus ts
						INNER JOIN T_messaging__contact c
							ON ts.tsta_user_ID = c.mct_to_user_ID AND c.mct_from_user_ID = ' . $this->author_user_ID . ' AND c.mct_blocked = 0
						INNER JOIN T_users u
							ON ts.tsta_user_ID = u.user_ID
						LEFT OUTER JOIN T_users__usersettings us ON u.user_ID = us.uset_user_ID AND us.uset_name = "notify_messages"');
        $SQL->WHERE('ts.tsta_thread_ID = ' . $this->Thread->ID . ' AND ts.tsta_user_ID <> ' . $this->author_user_ID);
        $thrd_recipients = $DB->get_assoc($SQL->get());
        // set message link:
        list($message_link, $prefs_link) = get_messages_link_to($this->thread_ID);
        // Construct message subject and body:
        if ($new_thread) {
            $subject = NT_('%s just sent you a new message!');
        } elseif (count($thrd_recipients) == 1) {
            $subject = NT_('%s just replied to your message!');
        } else {
            $subject = NT_('%s just replied to a conversation you are involved in!');
        }
        // Get other unread threads
        $other_unread_threads = get_users_unread_threads(array_keys($thrd_recipients), $this->thread_ID, 'array', 'html');
        // Load all users who will be notified
        $UserCache =& get_UserCache();
        $UserCache->load_list(array_keys($thrd_recipients));
        // Send email notifications.
        $ret = true;
        $def_notify_messages = $Settings->get('def_notify_messages');
        foreach ($thrd_recipients as $recipient_ID => $notify_messages) {
            // Send mail to recipients who needs to be notified. recipients are already loaded into the UserCache
            if (!($notify_messages || is_null($notify_messages) && $def_notify_messages)) {
                // User should NOT be notified
                continue;
            }
            $email_template_params = array('recipient_ID' => $recipient_ID, 'new_thread' => $new_thread, 'thrd_recipients' => $thrd_recipients, 'Message' => $this, 'message_link' => $message_link, 'other_unread_threads' => $other_unread_threads[$recipient_ID], 'from_User' => $from_User);
            $notify_User = $UserCache->get_by_ID($recipient_ID);
            // Change locale here to localize the email subject and content
            locale_temp_switch($notify_User->get('locale'));
            $sender_login = $from_User === NULL ? $current_User->login : $from_User->login;
            $localized_subject = sprintf(T_($subject), $sender_login);
            // Note: Not activated users won't get notification email
            if (send_mail_to_User($recipient_ID, $localized_subject, 'private_message_new', $email_template_params)) {
                // email sent successful, update las_unread_message_reminder timestamp, because the notification contains all unread messages
                $UserSettings->set('last_unread_messages_reminder', date2mysql($servertimenow), $recipient_ID);
            } else {
                // message was not sent
                $ret = false;
            }
            locale_restore_previous();
        }
        // update reminder timestamp changes
        $UserSettings->dbupdate();
        return $ret;
    }
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:66,代码来源:_message.class.php

示例9: send_email_notifications

    /**
     * Send email notifications to subscribed users
     *
     * @todo fp>> shall we notify suscribers of blog were this is in extra-cat? blueyed>> IMHO yes.
     *
     * @param boolean Display notification messages or not
     * @param array Already notified user ids, or NULL if it is not the case
     */
    function send_email_notifications($display = true, $already_notified = NULL)
    {
        global $DB, $admin_url, $baseurl, $debug, $Debuglog;
        $edited_Blog =& $this->get_Blog();
        if (!$edited_Blog->get_setting('allow_subscriptions')) {
            // Subscriptions not enabled!
            return;
        }
        if ($display) {
            echo "<div class=\"panelinfo\">\n";
            echo '<h3>', T_('Notifying subscribed users...'), "</h3>\n";
        }
        // Create condition to not select already notified modertor users
        $except_users_condition = empty($already_notified) ? '' : ' AND sub_user_ID NOT IN ( ' . implode(',', $already_notified) . ' )';
        // Get list of users who want to be notfied:
        // TODO: also use extra cats/blogs??
        $sql = 'SELECT DISTINCT sub_user_ID
							FROM T_subscriptions
						WHERE sub_coll_ID = ' . $this->get_blog_ID() . '
							AND sub_items <> 0' . $except_users_condition;
        $notify_users = $DB->get_col($sql);
        if (empty($notify_users)) {
            // No-one to notify:
            if ($display) {
                echo '<p>', T_('No-one to notify.'), "</p>\n</div>\n";
            }
            return false;
        }
        // Load all users who will be notified
        $UserCache =& get_UserCache();
        $UserCache->load_list($notify_users);
        /*
         * We have a list of user IDs to notify:
         */
        $this->get_creator_User();
        // Load a list with the blocked emails in cache
        load_blocked_emails($notify_users);
        // Send emails:
        $cache_by_locale = array();
        foreach ($notify_users as $user_ID) {
            $notify_User = $UserCache->get_by_ID($user_ID, false, false);
            if (empty($notify_User)) {
                // skip invalid users
                continue;
            }
            $notify_email = $notify_User->get('email');
            if (empty($notify_email)) {
                // skip users with empty email address
                continue;
            }
            $notify_locale = $notify_User->get('locale');
            $notify_user_Group = $notify_User->get_Group();
            $notify_full = $notify_user_Group->check_perm('post_subscription_notif', 'full');
            if (!isset($cache_by_locale[$notify_locale])) {
                // No message for this locale generated yet:
                locale_temp_switch($notify_locale);
                $cache_by_locale[$notify_locale]['subject']['short'] = sprintf(T_('%s created a new post in blog "%s"'), $this->creator_User->get('login'), $edited_Blog->get('shortname'));
                $cache_by_locale[$notify_locale]['subject']['full'] = sprintf(T_('[%s] New post: "%s"'), $edited_Blog->get('shortname'), $this->get('title'));
                locale_restore_previous();
            }
            $email_template_params = array('locale' => $notify_locale, 'notify_full' => $notify_full, 'Item' => $this, 'recipient_User' => $notify_User, 'notify_type' => 'subscription');
            if ($display) {
                echo T_('Notifying:') . $notify_email . "<br />\n";
            }
            if ($debug >= 2) {
                $message_content = mail_template('post_new', 'txt', $email_template_params);
                echo "<p>Sending notification to {$notify_email}:<pre>{$message_content}</pre>";
            }
            $subject_type = $notify_full ? 'full' : 'short';
            send_mail_to_User($user_ID, $cache_by_locale[$notify_locale]['subject'][$subject_type], 'post_new', $email_template_params);
            blocked_emails_memorize($notify_User->email);
        }
        blocked_emails_display();
        if ($display) {
            echo '<p>', T_('Done.'), "</p>\n</div>\n";
        }
    }
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:85,代码来源:_item.class.php

示例10: send_easy_validate_emails

/**
 * Send account validation email with a permanent validation link
 *
 * @param array user ids to send validation email
 * @param boolean true if this email is an account activation reminder, false if the account status was changed right now
 * @return integer the number of successfully sent emails
 */
function send_easy_validate_emails($user_ids, $is_reminder = true, $email_changed = false)
{
    global $UserSettings, $servertimenow, $secure_htsrv_url;
    $UserCache =& get_UserCache();
    if (isset($GLOBALS['messaging_Module'])) {
        // Get already received messages for each recepient user
        $already_received_messages = get_users_unread_threads($user_ids);
    }
    $cache_by_locale = array();
    $email_sent = 0;
    foreach ($user_ids as $user_ID) {
        // Iterate through user ids and send account activation reminder to all user
        $User = $UserCache->get_by_ID($user_ID, false);
        if (!$User) {
            // user not exists
            continue;
        }
        if (!$User->check_status('can_be_validated')) {
            // User is validated or it is not allowed to be validated
            continue;
        }
        if ($is_reminder && !$UserSettings->get('send_activation_reminder')) {
            // This is an activation reminder, but user wouldn't like to receive this kind of emails
            continue;
        }
        if (mail_is_blocked($User->get('email'))) {
            // prevent trying to send an email to a blocked email address
            continue;
        }
        $notify_locale = $User->get('locale');
        $reminder_key = $UserSettings->get('last_activation_reminder_key', $User->ID);
        if (empty($reminder_key) || $email_changed) {
            // reminder key was not generated yet, or the user email address was changed and we need a new one, to invalidate old requests
            $reminder_key = generate_random_key(32);
            $UserSettings->set('last_activation_reminder_key', $reminder_key, $User->ID);
        }
        if (!isset($cache_by_locale[$notify_locale])) {
            // No subject for this locale generated yet:
            locale_temp_switch($notify_locale);
            $cache_by_locale[$notify_locale]['subject'] = T_('Activate your account: $login$');
            locale_restore_previous();
        }
        $email_template_params = array('locale' => $notify_locale, 'status' => $User->get('status'), 'reminder_key' => $reminder_key, 'is_reminder' => $is_reminder);
        if (!empty($already_received_messages[$User->ID])) {
            // add already received message list to email body
            $email_template_params['already_received_messages'] = $already_received_messages[$User->ID];
        }
        // Update notification sender's info from General settings
        $User->update_sender(true);
        if (send_mail_to_User($User->ID, $cache_by_locale[$notify_locale]['subject'], 'account_activate', $email_template_params, true)) {
            // save corresponding user settings right after the email was sent, to prevent not saving if an eroor occurs
            $email_sent++;
            // Set last remind activation email date and increase sent reminder emails number in UserSettings
            $UserSettings->set('last_activation_email', date2mysql($servertimenow), $User->ID);
            if ($is_reminder) {
                $reminder_sent_to_user = $UserSettings->get('activation_reminder_count', $User->ID);
                $UserSettings->set('activation_reminder_count', $reminder_sent_to_user + 1, $User->ID);
            }
            $UserSettings->dbupdate();
        }
    }
    return $email_sent;
}
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:70,代码来源:_user.funcs.php

示例11: send_email_notifications

    /**
     * Send email notifications to subscribed users
     *
     * @todo fp>> shall we notify suscribers of blog were this is in extra-cat? blueyed>> IMHO yes.
     */
    function send_email_notifications($display = true)
    {
        global $DB, $admin_url, $debug, $Debuglog;
        $edited_Blog =& $this->get_Blog();
        if (!$edited_Blog->get_setting('allow_subscriptions')) {
            // Subscriptions not enabled!
            return;
        }
        if ($display) {
            echo "<div class=\"panelinfo\">\n";
            echo '<h3>', T_('Notifying subscribed users...'), "</h3>\n";
        }
        // Get list of users who want to be notfied:
        // TODO: also use extra cats/blogs??
        $sql = 'SELECT DISTINCT user_email, user_locale
							FROM T_subscriptions INNER JOIN T_users ON sub_user_ID = user_ID
						WHERE sub_coll_ID = ' . $this->blog_ID . '
							AND sub_items <> 0
							AND LENGTH(TRIM(user_email)) > 0';
        $notify_list = $DB->get_results($sql);
        // Preprocess list: (this comes form Comment::send_email_notifications() )
        $notify_array = array();
        foreach ($notify_list as $notification) {
            $notify_array[$notification->user_email] = $notification->user_locale;
        }
        if (empty($notify_array)) {
            // No-one to notify:
            if ($display) {
                echo '<p>', T_('No-one to notify.'), "</p>\n</div>\n";
            }
            return false;
        }
        /*
         * We have a list of email addresses to notify:
         */
        $this->get_creator_User();
        $mail_from = '"' . $this->creator_User->get('preferredname') . '" <' . $this->creator_User->get('email') . '>';
        // Send emails:
        $cache_by_locale = array();
        foreach ($notify_array as $notify_email => $notify_locale) {
            if (!isset($cache_by_locale[$notify_locale])) {
                // No message for this locale generated yet:
                locale_temp_switch($notify_locale);
                // Calculate length for str_pad to align labels:
                $pad_len = max(strlen(T_('Blog')), strlen(T_('Author')), strlen(T_('Title')), strlen(T_('Url')), strlen(T_('Content')));
                $cache_by_locale[$notify_locale]['subject'] = sprintf(T_('[%s] New post: "%s"'), $edited_Blog->get('shortname'), $this->get('title'));
                $cache_by_locale[$notify_locale]['message'] = str_pad(T_('Blog'), $pad_len) . ': ' . $edited_Blog->get('shortname') . ' ( ' . str_replace('&amp;', '&', $edited_Blog->gen_blogurl()) . " )\n" . str_pad(T_('Author'), $pad_len) . ': ' . $this->creator_User->get('preferredname') . ' (' . $this->creator_User->get('login') . ")\n" . str_pad(T_('Title'), $pad_len) . ': ' . $this->get('title') . "\n" . str_pad(T_('Url'), $pad_len) . ': ' . (empty($this->url) ? '-' : str_replace('&amp;', '&', $this->get('url'))) . "\n" . str_pad(T_('Content'), $pad_len) . ': ' . str_replace('&amp;', '&', $this->get_permanent_url()) . "\n\n" . $this->get('content') . "\n" . "\n-- \n" . T_('Edit/Delete') . ': ' . $admin_url . '?ctrl=items&blog=' . $this->blog_ID . '&p=' . $this->ID . "\n\n" . T_('Edit your subscriptions/notifications') . ': ' . str_replace('&amp;', '&', url_add_param($edited_Blog->gen_blogurl(), 'disp=subs')) . "\n";
                locale_restore_previous();
            }
            if ($display) {
                echo T_('Notifying:') . $notify_email . "<br />\n";
            }
            if ($debug >= 2) {
                echo "<p>Sending notification to {$notify_email}:<pre>{$cache_by_locale[$notify_locale]}['message']</pre>";
            }
            send_mail($notify_email, $cache_by_locale[$notify_locale]['subject'], $cache_by_locale[$notify_locale]['message'], $mail_from);
        }
        if ($display) {
            echo '<p>', T_('Done.'), "</p>\n</div>\n";
        }
    }
开发者ID:LFSF,项目名称:oras,代码行数:66,代码来源:_item.class.php

示例12: mail_template

/**
 * Get a mail message text by template name
 *
 * @param string Template name
 * @param string Email format ( auto | html | text )
 * @param array Params
 * @param object User
 * @return string|array Mail message OR Array of the email contents when message is multipart content
 */
function mail_template($template_name, $format = 'auto', $params = array(), $User = NULL)
{
    global $current_charset;
    if (!empty($params['locale'])) {
        // Switch to locale for current email template
        locale_temp_switch($params['locale']);
    }
    // Set extension of template
    $template_exts = array();
    switch ($format) {
        case 'auto':
            // $template_exts['non-mime'] = '.txt.php'; // The area that is ignored by MIME-compliant clients
            $template_exts['text'] = '.txt.php';
            $template_exts['html'] = '.html.php';
            $boundary = $params['boundary'];
            $boundary_alt = 'b2evo-alt-' . md5(rand());
            $template_headers = array('text' => 'Content-Type: text/plain; charset=' . $current_charset, 'html' => 'Content-Type: text/html; charset=' . $current_charset);
            // Store all contents in this array for multipart message
            $template_contents = array('charset' => $current_charset, 'full' => '', 'html' => '', 'text' => '');
            break;
        case 'html':
            $template_exts['html'] = '.html.php';
            break;
        case 'text':
            $template_exts['text'] = '.txt.php';
            break;
    }
    $template_message = '';
    if (isset($boundary, $boundary_alt)) {
        // Start new boundary content
        $template_message .= "\n" . '--' . $boundary . "\n";
        $template_message .= 'Content-Type: multipart/alternative; boundary="' . $boundary_alt . '"' . "\n\n";
    }
    foreach ($template_exts as $format => $ext) {
        $formated_message = '';
        if (isset($boundary, $boundary_alt) && $format != 'non-mime') {
            // Start new boundary alt content
            $template_message .= "\n" . '--' . $boundary_alt . "\n";
        }
        if (isset($template_headers[$format])) {
            // Header data for each content
            $template_message .= $template_headers[$format] . "\n\n";
        }
        // Get mail template
        ob_start();
        emailskin_include($template_name . $ext, $params);
        $formated_message .= ob_get_clean();
        if (!empty($User)) {
            // Replace $login$ with gender colored link + icon in HTML format,
            //   and with simple login text in PLAIN TEXT format
            $user_login = $format == 'html' ? $User->get_colored_login(array('mask' => '$avatar$ $login$', 'use_style' => true)) : $User->login;
            $formated_message = str_replace('$login$', $user_login, $formated_message);
        }
        if ($format == 'html') {
            // Use "http://" for protocol-relative urls because email browsers cannot load such urls:
            $formated_message = preg_replace('~(src|href)="//~', '$1="http://', $formated_message);
        }
        $template_message .= $formated_message;
        if (isset($template_contents)) {
            // Multipart content
            $template_contents[$format] = $formated_message;
        }
    }
    if (isset($boundary, $boundary_alt)) {
        // End all boundary contents
        $template_message .= "\n" . '--' . $boundary_alt . '--' . "\n";
        $template_message .= "\n" . '--' . $boundary . '--' . "\n";
    }
    if (!empty($params['locale'])) {
        // Restore previous locale
        locale_restore_previous();
    }
    if (isset($template_contents)) {
        // Return array for multipart content
        $template_contents['full'] = $template_message;
        return $template_contents;
    } else {
        // Return string if email message contains one content (html or text)
        return $template_message;
    }
}
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:90,代码来源:_misc.funcs.php

示例13: preview_from_request

 /**
  * We want to preview a single post, we are going to fake a lot of things...
  */
 function preview_from_request()
 {
     global $current_User;
     if (empty($current_User)) {
         // dh> only logged in user's can preview. Alternatively we need those checks where $current_User gets used below.
         return;
     }
     global $DB, $localtimenow, $Messages, $BlogCache;
     global $Plugins;
     $preview_userid = param('preview_userid', 'integer', true);
     $post_status = param('post_status', 'string', true);
     $post_locale = param('post_locale', 'string', $current_User->locale);
     $content = param('content', 'html', true);
     $post_title = param('post_title', 'html', true);
     $post_excerpt = param('post_excerpt', 'string', true);
     $post_url = param('post_url', 'string', '');
     $post_category = param('post_category', 'integer', true);
     $post_views = param('post_views', 'integer', 0);
     $renderers = param('renderers', 'array', array('default'));
     if (!is_array($renderers)) {
         // dh> workaround for param() bug. See rev 1.93 of /inc/_misc/_misc.funcs.php
         $renderers = array('default');
     }
     $comment_Blog =& $BlogCache->get_by_ID(get_catblog($post_category));
     if ($comment_Blog->allowcomments == 'post_by_post') {
         // param is required
         $post_comment_status = param('post_comment_status', 'string', true);
     } else {
         $post_comment_status = $comment_Blog->allowcomments;
     }
     // Get issue date, using the user's locale (because it's entered like this in the form):
     locale_temp_switch($current_User->locale);
     param_date('item_issue_date', T_('Please enter a valid issue date.'), false);
     // TODO: dh> get_param() is always true here, also on invalid dates:
     if (strlen(get_param('item_issue_date'))) {
         // only set it, if a date was given:
         param_time('item_issue_time');
         $item_issue_date = form_date(get_param('item_issue_date'), get_param('item_issue_time'));
         // TODO: cleanup...
     } else {
         $item_issue_date = date('Y-m-d H:i:s', $localtimenow);
     }
     locale_restore_previous();
     if (!($item_typ_ID = param('item_typ_ID', 'integer', NULL))) {
         $item_typ_ID = NULL;
     }
     if (!($item_st_ID = param('item_st_ID', 'integer', NULL))) {
         $item_st_ID = NULL;
     }
     if (!($item_assigned_user_ID = param('item_assigned_user_ID', 'integer', NULL))) {
         $item_assigned_user_ID = NULL;
     }
     if (!($item_deadline = param('item_deadline', 'string', NULL))) {
         $item_deadline = NULL;
     }
     $item_priority = param('item_priority', 'integer', NULL);
     // QUESTION: can this be also empty/NULL?
     // Do some optional filtering on the content
     // Typically stuff that will help the content to validate
     // Useful for code display.
     // Will probably be used for validation also.
     $Plugins_admin =& get_Cache('Plugins_admin');
     $Plugins_admin->filter_contents($post_title, $content, $renderers);
     $post_title = format_to_post($post_title);
     $content = format_to_post($content);
     $this->sql = "SELECT\r\n\t\t\t0 AS post_ID,\r\n\t\t\t{$preview_userid} AS post_creator_user_ID,\r\n\t\t\t{$preview_userid} AS post_lastedit_user_ID,\r\n\t\t\t'{$item_issue_date}' AS post_datestart,\r\n\t\t\t'{$item_issue_date}' AS post_datecreated,\r\n\t\t\t'{$item_issue_date}' AS post_datemodified,\r\n\t\t\t'" . $DB->escape($post_status) . "' AS post_status,\r\n\t\t\t'" . $DB->escape($post_locale) . "' AS post_locale,\r\n\t\t\t'" . $DB->escape($content) . "' AS post_content,\r\n\t\t\t'" . $DB->escape($post_title) . "' AS post_title,\r\n\t\t\t'" . $DB->escape($post_excerpt) . "' AS post_excerpt,\r\n\t\t\tNULL AS post_urltitle,\r\n\t\t\t'" . $DB->escape($post_url) . "' AS post_url,\r\n\t\t\t{$post_category} AS post_main_cat_ID,\r\n\t\t\t{$post_views} AS post_views,\r\n\t\t\t'' AS post_flags,\r\n\t\t\t'noreq' AS post_notifications_status,\r\n\t\t\tNULL AS post_notifications_ctsk_ID,\r\n\t\t\t" . bpost_count_words($content) . " AS post_wordcount,\r\n\t\t\t" . $DB->quote($post_comment_status) . " AS post_comment_status,\r\n\t\t\t'" . $DB->escape(implode('.', $renderers)) . "' AS post_renderers,\r\n\t\t\t" . $DB->quote($item_assigned_user_ID) . " AS post_assigned_user_ID,\r\n\t\t\t" . $DB->quote($item_typ_ID) . " AS post_ptyp_ID,\r\n\t\t\t" . $DB->quote($item_st_ID) . " AS post_pst_ID,\r\n\t\t\t" . $DB->quote($item_deadline) . " AS post_datedeadline,\r\n\t\t\t" . $DB->quote($item_priority) . " AS post_priority";
     $this->total_rows = 1;
     $this->total_pages = 1;
     $this->page = 1;
     // ATTENTION: we skip the parent on purpose here!! fp> refactor
     DataObjectList2::query(false, false, false, 'PREVIEW QUERY');
     $Item =& $this->Cache->instantiate($this->rows[0]);
     // Trigger plugin event, allowing to manipulate or validate the item before it gets previewed
     $Plugins->trigger_event('AppendItemPreviewTransact', array('Item' => &$Item));
     if ($errcontent = $Messages->display(T_('Invalid post, please correct these errors:'), '', false, 'error')) {
         $Item->content = $errcontent . "\n<hr />\n" . $content;
     }
     // little funky fix for IEwin, rawk on that code
     global $Hit;
     if ($Hit->is_winIE && !isset($IEWin_bookmarklet_fix)) {
         // QUESTION: Is this still needed? What about $IEWin_bookmarklet_fix? (blueyed)
         $Item->content = preg_replace('/\\%u([0-9A-F]{4,4})/e', "'&#'.base_convert('\\1',16,10). ';'", $Item->content);
     }
 }
开发者ID:LFSF,项目名称:oras,代码行数:87,代码来源:_itemlist.class.php

示例14: send_email_notifications


//.........这里部分代码省略.........
     */
    function send_email_notifications()
    {
        global $DB, $admin_url, $debug, $Debuglog;
        $edited_Item =& $this->get_Item();
        $edited_Blog =& $edited_Item->get_Blog();
        $notify_array = array();
        if ($edited_Blog->get_setting('allow_subscriptions')) {
            // Get list of users who want to be notfied:
            // TODO: also use extra cats/blogs??
            // So far you get notifications for everything. We'll need a setting to decide if you want to received unmoderated (aka unpublished) comments or not.
            // Note: users receive comments on their own posts. This is done on purpose. Otherwise they think it's broken when they test the app.
            $sql = 'SELECT DISTINCT user_email, user_locale
								FROM T_subscriptions INNER JOIN T_users ON sub_user_ID = user_ID
							 WHERE sub_coll_ID = ' . $this->Item->blog_ID . '
							   AND sub_comments <> 0
							   AND LENGTH(TRIM(user_email)) > 0';
            $notify_list = $DB->get_results($sql);
            // Preprocess list:
            foreach ($notify_list as $notification) {
                $notify_array[$notification->user_email] = $notification->user_locale;
            }
        }
        // Check if we need to include the author:
        $item_author_User =& $edited_Item->get_creator_User();
        if ($item_author_User->notify && !empty($item_author_User->email)) {
            // Author wants to be notified...
            if (!($this->get_author_User() && $item_author_User->login == $this->author_User->login)) {
                // Author is not commenting on his own post...
                $notify_array[$item_author_User->email] = $item_author_User->locale;
            }
        }
        if (!count($notify_array)) {
            // No-one to notify:
            return false;
        }
        /*
         * We have a list of email addresses to notify:
         */
        // TODO: dh> this reveals the comments author's email address to all subscribers!!
        //           $notify_from should get used by default, unless the user has opted in to be the sender!
        // fp>If the subscriber has permission to moderate the comments, he SHOULD receive the email address.
        if ($this->get_author_User()) {
            // Comment from a registered user:
            $mail_from = '"' . $this->author_User->get('preferredname') . '" <' . $this->author_User->get('email') . '>';
        } elseif (!empty($this->author_email)) {
            // non-member, but with email address:
            $mail_from = "\"{$this->author}\" <{$this->author_email}>";
        } else {
            // Fallback (we have no email address):  fp>TODO: or the subscriber is not allowed to view it.
            global $notify_from;
            $mail_from = $notify_from;
        }
        // Send emails:
        foreach ($notify_array as $notify_email => $notify_locale) {
            locale_temp_switch($notify_locale);
            switch ($this->type) {
                case 'trackback':
                    /* TRANS: Subject of the mail to send on new trackbacks. First %s is the blog's shortname, the second %s is the item's title. */
                    $subject = T_('[%s] New trackback on "%s"');
                    break;
                default:
                    /* TRANS: Subject of the mail to send on new comments. First %s is the blog's shortname, the second %s is the item's title. */
                    $subject = T_('[%s] New comment on "%s"');
            }
            $subject = sprintf($subject, $edited_Blog->get('shortname'), $edited_Item->get('title'));
            $notify_message = T_('Blog') . ': ' . $edited_Blog->get('shortname') . "\n" . T_('Post') . ': ' . $edited_Item->get('title') . "\n";
            // Mail bloat: .' ( '.str_replace('&amp;', '&', $edited_Item->get_permanent_url())." )\n";
            // TODO: fp> We MAY want to force short URL and avoid it to wrap on a new line in the mail which may prevent people from clicking
            switch ($this->type) {
                case 'trackback':
                    $user_domain = gethostbyaddr($this->author_IP);
                    $notify_message .= T_('Website') . ": {$this->author} (IP: {$this->author_IP}, {$user_domain})\n";
                    $notify_message .= T_('Url') . ": {$this->author_url}\n";
                    break;
                default:
                    if ($this->get_author_User()) {
                        // Comment from a registered user:
                        $notify_message .= T_('Author') . ': ' . $this->author_User->get('preferredname') . ' (' . $this->author_User->get('login') . ")\n";
                    } else {
                        // Comment from visitor:
                        $user_domain = gethostbyaddr($this->author_IP);
                        $notify_message .= T_('Author') . ": {$this->author} (IP: {$this->author_IP}, {$user_domain})\n";
                        $notify_message .= T_('Email') . ": {$this->author_email}\n";
                        $notify_message .= T_('Url') . ": {$this->author_url}\n";
                    }
            }
            $notify_message .= T_('Comment') . ': ' . str_replace('&amp;', '&', $this->get_permanent_url()) . "\n" . $this->get('content') . "\n\n" . T_('Edit/Delete') . ': ' . $admin_url . '?ctrl=items&blog=' . $edited_Blog->ID . '&p=' . $edited_Item->ID . '&c=1#c' . $this->ID . "\n\n" . T_('Edit your subscriptions/notifications') . ': ' . str_replace('&amp;', '&', url_add_param($edited_Blog->gen_blogurl(), 'disp=subs')) . "\n";
            if ($debug) {
                $mail_dump = "Sending notification to {$notify_email}:<pre>Subject: {$subject}\n{$notify_message}</pre>";
                if ($debug >= 2) {
                    // output mail content - NOTE: this will kill sending of headers.
                    echo "<p>{$mail_dump}</p>";
                }
                $Debuglog->add($mail_dump, 'notification');
            }
            send_mail($notify_email, $subject, $notify_message, $mail_from);
            locale_restore_previous();
        }
    }
开发者ID:LFSF,项目名称:oras,代码行数:101,代码来源:_comment.class.php


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