Example #1
0
/**
 * Send a notification email to all administrators.
 * current user (if admin) is not notified
 *
 * @param string|array $subject
 * @param string|array $content
 * @param boolean $send_technical_details - send user IP and browser
 * @return boolean
 */
function pwg_mail_notification_admins($subject, $content, $send_technical_details = true)
{
    if (empty($subject) or empty($content)) {
        return false;
    }
    global $conf, $user;
    if (is_array($subject) or is_array($content)) {
        switch_lang_to(get_default_language());
        if (is_array($subject)) {
            $subject = l10n_args($subject);
        }
        if (is_array($content)) {
            $content = l10n_args($content);
        }
        switch_lang_back();
    }
    $tpl_vars = array();
    if ($send_technical_details) {
        $tpl_vars['TECHNICAL'] = array('username' => stripslashes($user['username']), 'ip' => $_SERVER['REMOTE_ADDR'], 'user_agent' => $_SERVER['HTTP_USER_AGENT']);
    }
    return pwg_mail_admins(array('subject' => '[' . $conf['gallery_title'] . '] ' . $subject, 'mail_title' => $conf['gallery_title'], 'mail_subtitle' => $subject, 'content' => $content, 'content_format' => 'text/plain'), array('filename' => 'notification_admin', 'assign' => $tpl_vars));
}
/**
 * UAM_Copy2Admins
 * Send a copy of user's email to admins
 * 
 * Param : email subject and content
 */
function UAM_Copy2Admins($subject, $content)
{
    $adminsubject = "[Admins Copy] - " . $subject;
    pwg_mail_admins(array('content' => $content, 'content_format' => 'text/plain', 'subject' => $adminsubject));
}