Пример #1
0
/**
 * Get all those user threads and their recipients where the corresponding users have unread messages.
 * This function is used for the different email notifications.
 * 
 * @param array required user id list
 * @param integer a thread ID that should be skipped from the result list. Leave it to NULL if you don't want to skip any thread.
 * @param string Threads format ( string | array )
 * @param string User logins format ( text | html )
 * @return array ( user_ID -> (string or array) ) pairs, the string contains the users unread threads titles and their recipients list 
 */
function get_users_unread_threads($userid_list, $skip_thread_ID = NULL, $threads_format = 'string', $login_format = 'text')
{
    global $DB;
    $result = array();
    if (empty($userid_list)) {
        // requested user id list is empty, return empty result
        return $result;
    }
    // Get all those user threads where the corresponding user has unread messages, and sort descending by last modifiaction date
    $query = 'SELECT DISTINCT tsta_user_ID, GROUP_CONCAT( CONVERT( thrd_ID, CHAR(10) ) ORDER BY thrd_datemodified DESC SEPARATOR "," ) as threads
			FROM T_messaging__threadstatus
			LEFT JOIN T_messaging__thread ON thrd_ID = tsta_thread_ID
			WHERE tsta_first_unread_msg_ID IS NOT NULL AND tsta_user_ID IN ( ' . implode(',', $userid_list) . ')
			GROUP BY tsta_user_ID';
    $user_unread_threads = $DB->get_assoc($query, 'Get all threads where the corresponding users have unread messages');
    if (empty($user_unread_threads)) {
        // requested users have no unread threads
        return $result;
    }
    $all_involved_threads = array();
    $user_threads = array();
    // create an all involved threads array
    foreach ($user_unread_threads as $key => $threads) {
        $user_threads[$key] = explode(',', $threads);
        $all_involved_threads = array_merge($all_involved_threads, $user_threads[$key]);
    }
    $all_involved_threads = array_unique($all_involved_threads);
    // Get all required threads recipients and titles
    $recipients_query = 'SELECT tsta_thread_ID as thread_ID, thrd_title, user_login
			FROM T_messaging__threadstatus
			LEFT JOIN T_users ON user_ID = tsta_user_ID
			LEFT JOIN T_messaging__thread ON thrd_ID = tsta_thread_ID
				WHERE tsta_thread_ID IN ( ' . implode(',', $all_involved_threads) . ' )';
    $all_threads_recipients = $DB->get_results($recipients_query, OBJECT, 'Load all required threads title and recipients');
    $thread_recipients = array();
    $thread_titles = array();
    foreach ($all_threads_recipients as $row) {
        if (!isset($thread_recipients[$row->thread_ID])) {
            $thread_recipients[$row->thread_ID] = array();
        }
        if (empty($row->user_login)) {
            // User was deleted
            $thread_recipients[$row->thread_ID][] = 'Deleted user';
        } else {
            // User exists
            if ($login_format == 'text') {
                // Use simple login as text
                $thread_recipients[$row->thread_ID][] = $row->user_login;
            } else {
                // Use a colored login with avatar
                $thread_recipients[$row->thread_ID][] = get_user_colored_login($row->user_login);
            }
        }
        if (!isset($thread_titles[$row->thread_ID])) {
            $thread_titles[$row->thread_ID] = $row->thrd_title;
        }
    }
    foreach ($userid_list as $user_ID) {
        if (!isset($user_threads[$user_ID])) {
            $result[$user_ID] = NULL;
            continue;
        }
        $threads = $user_threads[$user_ID];
        $unread_threads = $threads_format == 'string' ? '' : array();
        // List all unread threads, starting with the most recent updated threads,
        // so that each new reminder looks as different as possible from the one from 72 hours before
        foreach ($threads as $thread_ID) {
            if ($skip_thread_ID == $thread_ID) {
                continue;
            }
            $recipient_names = implode(', ', $thread_recipients[$thread_ID]);
            if ($threads_format == 'string') {
                // Store all threads in one string
                $unread_threads .= "\t - " . sprintf('"%s" ( %s )', $thread_titles[$thread_ID], $recipient_names) . "\n";
            } else {
                // Store all threads in array
                $unread_threads[] = sprintf('"%s" ( %s )', $thread_titles[$thread_ID], $recipient_names);
            }
        }
        $result[$user_ID] = $unread_threads;
    }
    return $result;
}
Пример #2
0
 */
if (!defined('EVO_MAIN_INIT')) {
    die('Please, do not access this page directly.');
}
// ---------------------------- EMAIL HEADER INCLUDED HERE ----------------------------
emailskin_include('_email_header.inc.html.php', $params);
// ------------------------------- END OF EMAIL HEADER --------------------------------
global $admin_url, $htsrv_url;
// Default params:
$params = array_merge(array('login' => '', 'email' => '', 'reason' => '', 'user_ID' => '', 'closed_by_admin' => ''), $params);
echo '<p>';
if (empty($params['closed_by_admin'])) {
    // Current user closed own account
    echo T_('A user account was closed!');
} else {
    // Admin closed current user account
    printf(T_('A user account was closed by %s'), get_user_colored_login($params['closed_by_admin']));
}
echo "</p>\n";
echo '<p>' . T_('Login') . ": " . get_user_colored_login($params['login']) . "</p>\n";
echo '<p>' . T_('Email') . ": " . $params['email'] . "</p>\n";
echo '<p>' . T_('Account close reason') . ": " . nl2br($params['reason']) . "</p>\n";
// Buttons:
echo '<div class="buttons">' . "\n";
echo get_link_tag($admin_url . '?ctrl=user&user_tab=profile&user_ID=' . $params['user_ID'], T_('Edit User account'), 'button_yellow') . "\n";
echo "</div>\n";
// Footer vars:
$params['unsubscribe_text'] = T_('If you don\'t want to receive any more notification when an account was closed, click here:') . ' <a href="' . $htsrv_url . 'quick_unsubscribe.php?type=account_closed&user_ID=$user_ID$&key=$unsubscribe_key$">' . T_('instant unsubscribe') . '</a>.';
// ---------------------------- EMAIL FOOTER INCLUDED HERE ----------------------------
emailskin_include('_email_footer.inc.html.php', $params);
// ------------------------------- END OF EMAIL FOOTER --------------------------------
Пример #3
0
 *
 * @version $Id: comment_new.html.php 3908 2013-06-04 10:41:52Z attila $
 */
if (!defined('EVO_MAIN_INIT')) {
    die('Please, do not access this page directly.');
}
// ---------------------------- EMAIL HEADER INCLUDED HERE ----------------------------
emailskin_include('_email_header.inc.html.php', $params);
// ------------------------------- END OF EMAIL HEADER --------------------------------
global $htsrv_url, $admin_url;
// Default params:
$params = array_merge(array('notify_full' => false, 'Comment' => NULL, 'Blog' => NULL, 'Item' => NULL, 'author_ID' => NULL, 'author_name' => '', 'notify_type' => ''), $params);
$Comment = $params['Comment'];
$Blog = $params['Blog'];
$Item = $params['Item'];
$author_name = empty($params['author_ID']) ? $params['author_name'] : get_user_colored_login($params['author_name']);
$notify_message = '<p>' . sprintf(T_('%s posted a new comment on %s in %s.'), '<b>' . $author_name . '</b>', '<b>' . get_link_tag($Item->get_permanent_url(), $Item->get('title')) . '</b>', '<b>' . $Blog->get('shortname') . '</b>') . '</p>';
if ($params['notify_full']) {
    // Long format notification:
    switch ($Comment->type) {
        case 'trackback':
            $user_domain = gethostbyaddr($Comment->author_IP);
            $notify_message .= '<p>' . T_('Trackback IP') . ': ' . $Comment->author_IP . ', ' . $user_domain . "</p>\n";
            $notify_message .= '<p>' . T_('Url') . ': ' . get_link_tag($Comment->author_url) . "</p>\n";
            break;
        default:
            if (!$Comment->get_author_User()) {
                // Comment from visitor:
                $user_domain = gethostbyaddr($Comment->author_IP);
                $notify_message .= '<p>' . T_('Commenter IP') . ': ' . $Comment->author_IP . ', ' . $user_domain . "</p>\n";
                $notify_message .= '<p>' . T_('Email') . ': ' . $Comment->author_email . "</p>\n";
Пример #4
0
 * @copyright (c)2003-2013 by Francois Planque - {@link http://fplanque.com/}
 *
 * @version $Id: account_new.html.php 3183 2013-03-10 21:59:41Z fplanque $
 */
if (!defined('EVO_MAIN_INIT')) {
    die('Please, do not access this page directly.');
}
// ---------------------------- EMAIL HEADER INCLUDED HERE ----------------------------
emailskin_include('_email_header.inc.html.php', $params);
// ------------------------------- END OF EMAIL HEADER --------------------------------
global $admin_url, $htsrv_url;
// Default params:
$params = array_merge(array('country' => '', 'firstname' => '', 'gender' => '', 'locale' => '', 'source' => '', 'trigger_url' => '', 'initial_hit' => '', 'login' => '', 'email' => '', 'new_user_ID' => ''), $params);
echo '<p>' . T_('A new user has registered on the site') . ':</p>' . "\n";
echo '<table class="email_table">' . "\n";
echo '<tr><th>' . T_('Login') . ':</th><td>' . get_user_colored_login($params['login']) . '</td></tr>' . "\n";
echo '<tr><th>' . T_('Email') . ':</th><td>' . $params['email'] . '</td></tr>' . "\n";
if ($params['country'] > 0) {
    // Country field is entered
    load_class('regional/model/_country.class.php', 'Country');
    $CountryCache =& get_CountryCache();
    $user_Country = $CountryCache->get_by_ID($params['country']);
    echo '<tr><th>' . T_('Country') . ':</th><td>' . $user_Country->get_name() . '</td></tr>' . "\n";
}
if ($params['firstname'] != '') {
    // First name is entered
    echo '<tr><th>' . T_('First name') . ':</th><td>' . $params['firstname'] . '</td></tr>' . "\n";
}
if ($params['gender'] == 'M') {
    // Gender is Male
    echo '<tr><th>' . T_('I am') . ':</th><td>' . T_('A man') . '</td></tr>' . "\n";
Пример #5
0
/**
 * Get user's login link with gender color
 *
 * @param string Login
 * @param array Params
 * @return string A link to user page with text as user's preferred name with gender color if this available
 */
function get_user_colored_login_link($login, $params = array())
{
    $UserCache =& get_UserCache();
    if ($User =& $UserCache->get_by_login($login)) {
        // Get a link to user page in front office
        return $User->get_identity_link(array('user_tab' => 'userpage', 'use_style' => !empty($params['use_style'])));
    } else {
        // Get login as text
        return get_user_colored_login($login, $params);
    }
}