Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

The pun_broadcast_email extension removed from trunk, which was added…

… by mistake.

git-svn-id: http://punbb.informer.com/svn/punbb/trunk@1339 4dc816b1-62af-4023-b237-cae3452c1eb1
  • Loading branch information...
commit 071596afc1b8a7f63081afebd234a7c25116890e 1 parent 0fa1b38
SlavaK authored
View
51 extensions/pun_broadcast_email/functions.php
@@ -1,51 +0,0 @@
-<?php
-/**
- * pun_broadcast_email functions
- *
- * @copyright (C) 2008-2009 PunBB
- * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
- * @package pun_broadcast_email
- */
-
-// Make sure no one attempts to run this script "directly"
-if (!defined('FORUM'))
- exit;
-
-function pun_broadcast_email_parse_string($subject, $user_info)
-{
- $tpl_vars = pun_broadcast_email_gen_tpl_vars($user_info);
- foreach ($tpl_vars as $tpl_var => $tpl_value)
- $subject = str_ireplace($tpl_var, $tpl_value, $subject);
-
- return $subject;
-}
-
-function pun_broadcast_email_gen_tpl_vars($user_data)
-{
- global $forum_url;
-
- $tpl_vars = array();
- $tpl_vars['%_username_%'] = $user_data['username'];
- $tpl_vars['%_title_%'] = $user_data['title'];
- $tpl_vars['%_realname_%'] = $user_data['realname'];
- $tpl_vars['%_num_posts_%'] = $user_data['num_posts'];
- $tpl_vars['%_last_post_%'] = format_time($user_data['last_post']);
- $tpl_vars['%_registered_%'] = format_time($user_data['registered']);
- $tpl_vars['%_registration_ip_%'] = $user_data['registration_ip'];
- $tpl_vars['%_last_visit_%'] = format_time($user_data['last_visit']);
- $tpl_vars['%_admin_note_%'] = $user_data['admin_note'];
- $tpl_vars['%_profile_url_%'] = forum_link($forum_url['user'], $user_data['id']);
-
- return $tpl_vars;
-}
-
-function pun_broadcast_email_send_mail($subject, $message, $user_data, $parse_message = TRUE)
-{
- $tmp_subject = $parse_message ? pun_broadcast_email_parse_string($subject, $user_data) : $subject;
- $tmp_message = $parse_message ? pun_broadcast_email_parse_string($message, $user_data) : $message;
-
- forum_mail($user_data['email'], $tmp_subject, $tmp_message);
-}
-
-
-?>
View
8 extensions/pun_broadcast_email/index.html
@@ -1,8 +0,0 @@
-<html>
-<head>
-<title>.</title>
-</head>
-<body>
-.
-</body>
-</html>
View
8 extensions/pun_broadcast_email/lang/English/index.html
@@ -1,8 +0,0 @@
-<html>
-<head>
-<title>.</title>
-</head>
-<body>
-.
-</body>
-</html>
View
40 extensions/pun_broadcast_email/lang/English/pun_broadcast_email.php
@@ -1,40 +0,0 @@
-<?php
-
-if (!defined('FORUM'))
- exit;
-
-$lang_pun_broadcast_email = array(
- 'Email errors' => '<strong>Warning!</strong> The following errors must be corrected before sending e-mails:',
- 'Ext name' => 'Broadcast e-mail',
- 'Group' => 'Group',
- 'Group title' => 'Group title',
- 'Members count' => 'Members count',
- 'Tpl vars' => 'Template vars',
- 'Tpl vars info' => 'Enable this option if you are planning to use <a class="exthelp" href="%s">special vars</a> in the e-mail template.',
- 'Email subject' => 'E-mail subject',
- 'Email message' => 'E-mail message',
- 'Submit' => 'Submit',
- 'Preview' => 'Preview',
- 'Ext help' => 'Broadcast e-mail help',
- 'Ext help header'=> 'The list of special template variables which you can use in e-mails.',
- 'Err no groups' => 'No groups selected.',
- 'Err guest group' => 'You can\'t send e-mail to guest users.',
- 'Err no subject' => 'No e-mail subject.',
- 'Err long subject' => 'The subject is too long',
- 'Err no message' => 'No message',
- 'Err long message' => 'The length of your e-mail message is %s bytes. This exceeds the %s bytes limit.',
- 'Email sent' => 'E-mail message has been sent.',
- 'Table summary' => 'Groups',
- 'Help username' => 'produces username.',
- 'Help user title' => 'produces user title.',
- 'Help realname' => 'produces realname.',
- 'Help num posts' => 'produces number of user posts.',
- 'Help last post' => 'produces date of the last post of the user.',
- 'Help reg date' => 'produces registration date of the user.',
- 'Help reg IP' => 'produces the IP which was used by the user for registration.',
- 'Help last visit' => 'produces date of the last visit of the user.',
- 'Help admin note' => 'produces admin note for the user.',
- 'Help user profile' => 'produces url to the user profile.',
-);
-
-?>
View
8 extensions/pun_broadcast_email/lang/index.html
@@ -1,8 +0,0 @@
-<html>
-<head>
-<title>.</title>
-</head>
-<body>
-.
-</body>
-</html>
View
173 extensions/pun_broadcast_email/manifest.xml
@@ -1,173 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE extension SYSTEM "ext-1.0.dtd">
-
-<!--
-/**
- * Allows administrators to send e-mail messages to groups of users.
- *
- * @copyright (C) 2009 PunBB
- * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
- * @package pun_broadcast_email
- */
--->
-
-<extension engine="1.0">
- <id>pun_broadcast_email</id>
- <title>Broadcast e-mail.</title>
- <version>0.1</version>
- <description>Add posibility to send e-mail messages to groups of users.</description>
- <author>PunBB Development Team</author>
- <minversion>1.3</minversion>
- <maxtestedon>1.3.4</maxtestedon>
-
- <hooks>
- <hook id="co_modify_url_scheme"><![CDATA[
- $forum_url['pun_broadcast_email'] = 'admin/extensions.php?section=broadcast_email';
- $forum_url['pun_broadcast_email_help'] = 'admin/extensions.php?section=broadcast_email&amp;help';
- ]]></hook>
- <hook id="aex_new_action"><![CDATA[
- if ($section == 'broadcast_email')
- {
- if (file_exists($ext_info['path'].'/lang/'.$forum_user['language'].'/'.$ext_info['id'].'.php'))
- include $ext_info['path'].'/lang/'.$forum_user['language'].'/'.$ext_info['id'].'.php';
- else
- include $ext_info['path'].'/lang/English/'.$ext_info['id'].'.php';
-
- $forum_page = array();
- $forum_page['group_count'] = $forum_page['item_count'] = $forum_page['fld_count'] = 0;
-
- $forum_page['selected_groups'] = array();
- $forum_page['email_subject'] = '';
- $forum_page['email_message'] = '';
- $forum_page['errors'] = array();
- if (isset($_POST['form_sent']))
- {
- //Data validation
- $forum_page['selected_groups']= isset($_POST['groups']) && is_array($_POST['groups']) ? $_POST['groups'] : array();
- $forum_page['selected_groups'] = array_map('intval', $forum_page['selected_groups']);
-
- if (empty($forum_page['selected_groups']))
- $forum_page['errors'][] = $lang_pun_broadcast_email['Err no groups'];
- if (in_array(FORUM_GUEST, $forum_page['selected_groups']))
- $forum_page['errors'][] = $lang_pun_broadcast_email['Err guest group'];
-
- $forum_page['email_subject'] = forum_trim($_POST['req_subject']);
- if ($forum_page['email_subject'] == '')
- $forum_page['errors'][] = $lang_pun_broadcast_email['Err no subject'];
- else if (utf8_strlen($forum_page['email_subject']) > 70)
- $forum_page['errors'][] = $lang_pun_broadcast_email['Err long subject'];
-
- // Clean up message from POST
- $forum_page['email_message'] = forum_linebreaks(forum_trim($_POST['req_message']));
- if ($forum_page['email_message'] == '')
- $forum_page['errors'][] = $lang_pun_broadcast_email['Err no message'];
- if (strlen($forum_page['email_message']) > FORUM_MAX_POSTSIZE_BYTES)
- $forum_page['errors'][] = sprintf($lang_pun_broadcast_email['Err long message'], forum_number_format(strlen($forum_page['email_message'])), forum_number_format(FORUM_MAX_POSTSIZE_BYTES));
-
- include $ext_info['path'].'/functions.php';
- if (!defined('FORUM_EMAIL_FUNCTIONS_LOADED'))
- include FORUM_ROOT.'/include/email.php';
-
- $forum_page['parse_mail'] = isset($_POST['parse_mail']) && $_POST['parse_mail'] == '1' ? true : false;
- if (empty($forum_page['errors']) && !isset($_POST['preview']))
- {
- //Sending e-mails
- @set_time_limit(0);
- $pun_broadcast_query = array(
- 'SELECT' => '*',
- 'FROM' => 'users',
- 'WHERE' => 'group_id IN ('.implode(',', $forum_page['selected_groups']).')'
- );
- $pun_broadcast_result = $forum_db->query_build($pun_broadcast_query) or error(__FILE__, __LINE__);
-
- while ($cur_user = $forum_db->fetch_assoc($pun_broadcast_result))
- pun_broadcast_email_send_mail($forum_page['email_subject'], $forum_page['email_message'], $cur_user, $forum_page['parse_mail']);
-
- redirect(forum_link($forum_url['pun_broadcast_email']), $lang_pun_broadcast_email['Email sent'].' '.$lang_common['Redirecting']);
- }
- }
-
- if (isset($_GET['help']))
- {
- $forum_page['help_vars'] = array();
- $forum_page['help_vars']['%_username_%'] = array('description' => $lang_pun_broadcast_email['Help username'], 'example' => $forum_user['username']);
- $forum_page['help_vars']['%_title_%'] = array('description' => $lang_pun_broadcast_email['Help user title'], 'example' => $forum_user['title']);
- $forum_page['help_vars']['%_realname_%'] = array('description' => $lang_pun_broadcast_email['Help realname'], 'example' => $forum_user['realname']);
- $forum_page['help_vars']['%_num_posts_%'] = array('description' => $lang_pun_broadcast_email['Help num posts'], 'example' => $forum_user['num_posts']);
- $forum_page['help_vars']['%_last_post_%'] = array('description' => $lang_pun_broadcast_email['Help last post'], 'example' => format_time($forum_user['last_post']));
- $forum_page['help_vars']['%_registered_%'] = array('description' => $lang_pun_broadcast_email['Help reg date'], 'example' => format_time($forum_user['registered']));
- $forum_page['help_vars']['%_registration_ip_%'] = array('description' => $lang_pun_broadcast_email['Help reg IP'], 'example' => $forum_user['registration_ip']);
- $forum_page['help_vars']['%_last_visit_%'] = array('description' => $lang_pun_broadcast_email['Help last visit'], 'example' => format_time($forum_user['last_visit']));
- $forum_page['help_vars']['%_admin_note_%'] = array('description' => $lang_pun_broadcast_email['Help admin note'], 'example' => $forum_user['admin_note']);
- $forum_page['help_vars']['%_profile_url_%'] = array('description' => $lang_pun_broadcast_email['Help user profile'], 'example' => forum_link($forum_url['user'], $forum_user['id']));
- }
- else
- {
- //Fetch all groups
- $pun_broadcast_query = array(
- 'SELECT' => 'group_id, g_title, g_user_title, COUNT(id) AS user_count',
- 'FROM' => 'users AS u',
- 'JOINS' => array(
- array(
- 'LEFT JOIN' => 'groups AS g',
- 'ON' => 'u.group_id = g.g_id'
- )
- ),
- 'WHERE' => 'group_id <> '.FORUM_GUEST,
- 'GROUP BY' => 'group_id'
- );
- $pun_broadcast_result = $forum_db->query_build($pun_broadcast_query) or error(__FILE__, __LINE__);
-
- require FORUM_ROOT.'lang/'.$forum_user['language'].'/admin_users.php';
-
- $forum_page['groups'] = array();
- while ($cur_group = $forum_db->fetch_assoc($pun_broadcast_result))
- {
- if ($cur_group['group_id'] == FORUM_UNVERIFIED)
- $forum_page['groups'][] = array('group_id' => FORUM_UNVERIFIED, 'g_title' => $lang_admin_users['Unverified users'], 'g_user_title' => $lang_admin_users['Unverified users'], 'user_count' => $cur_group['user_count']);
- else
- $forum_page['groups'][] = $cur_group;
- }
-
- $forum_page['form_action'] = forum_link($forum_url['pun_broadcast_email']);
-
- $forum_page['hidden_fields'] = array();
- $forum_page['hidden_fields']['csrf_token'] = generate_form_token($forum_page['form_action']);
- $forum_page['hidden_fields']['form_sent'] = 1;
- }
- if (empty($forum_page['errors']) && isset($_POST['preview']))
- {
- $pattern = array("\n", "\t", ' ', ' ');
- $replace = array('<br />', '&nbsp; &nbsp; ', '&nbsp; ', ' &nbsp;');
- $forum_page['preview']['email_subject'] = str_replace($pattern, $replace, $forum_page['parse_mail'] ? pun_broadcast_email_parse_string($forum_page['email_subject'], $forum_user) : $forum_page['email_subject']);
- $forum_page['preview']['email_message'] = str_replace($pattern, $replace, $forum_page['parse_mail'] ? pun_broadcast_email_parse_string($forum_page['email_message'], $forum_user) : $forum_page['email_message']);
- }
- // Setup breadcrumbs
- $forum_page['crumbs'] = array(
- array($forum_config['o_board_title'], forum_link($forum_url['index'])),
- array($lang_admin_common['Forum administration'], forum_link($forum_url['admin_index'])),
- array($lang_admin_common['Management'], forum_link($forum_url['admin_reports'])),
- array('Broadcast email', forum_link($forum_url['pun_broadcast_email']))
- );
-
- define('FORUM_PAGE_SECTION', 'management');
- define('FORUM_PAGE', 'admin-broadcast_email');
- if (isset($_GET['help']))
- include $ext_info['path'].'/pages/help.php';
- else
- include $ext_info['path'].'/pages/main.php';
- }
- ]]></hook>
- <hook id="ca_fn_generate_admin_menu_new_sublink"><![CDATA[
- if ($forum_user['g_id'] == FORUM_ADMIN && FORUM_PAGE_SECTION == 'management')
- {
- if (file_exists($ext_info['path'].'/lang/'.$forum_user['language'].'/'.$ext_info['id'].'.php'))
- include $ext_info['path'].'/lang/'.$forum_user['language'].'/'.$ext_info['id'].'.php';
- else
- include $ext_info['path'].'/lang/English/'.$ext_info['id'].'.php';
-
- $forum_page['admin_submenu']['broadcast_mail'] = '<li class="'.((FORUM_PAGE == 'admin-broadcast_email') ? 'active' : 'normal').((empty($forum_page['admin_submenu'])) ? ' first-item' : '').'"><a href="'.forum_link($forum_url['pun_broadcast_email']).'">'.$lang_pun_broadcast_email['Ext name'].'</a></li>';
- }
- ]]></hook>
- </hooks>
-</extension>
View
47 extensions/pun_broadcast_email/pages/help.php
@@ -1,47 +0,0 @@
-<?php
-
-/**
- * pun_broadcast_email help page
- *
- * @copyright (C) 2009 PunBB
- * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
- * @package pun_broadcast_email
- */
-
-require FORUM_ROOT.'header.php';
-
-// START SUBST - <!-- forum_main -->
-ob_start();
-
-?>
-<div class="main-subhead">
- <h2 class="hn">
- <span><?php echo $lang_pun_broadcast_email['Ext help'] ?></span>
- </h2>
-</div>
-<div class="main-content main-forum">
- <div class="ct-box help-box">
- <h3 class="hn">
- <span><?php echo $lang_pun_broadcast_email['Ext help header'] ?></span>
- </h3>
- <?php foreach ($forum_page['help_vars'] as $var_name => $var_info) { ?>
- <div class="entry-content">
- <code><?php echo $var_name; ?></code>
- <span><?php echo $var_info['description']; ?></span>
- <samp>
- <strong><?php echo $var_info['example']; ?></strong>
- </samp>
- </div>
- <?php } ?>
- </div>
-</div>
-<?php
-
-$tpl_temp = forum_trim(ob_get_contents());
-$tpl_main = str_replace('<!-- forum_main -->', $tpl_temp, $tpl_main);
-ob_end_clean();
-// END SUBST - <!-- forum_main -->
-
-require FORUM_ROOT.'footer.php';
-
-?>
View
8 extensions/pun_broadcast_email/pages/index.html
@@ -1,8 +0,0 @@
-<html>
-<head>
-<title>.</title>
-</head>
-<body>
-.
-</body>
-</html>
View
124 extensions/pun_broadcast_email/pages/main.php
@@ -1,124 +0,0 @@
-<?php
-
-/**
- * pun_broadcast_email page
- *
- * @copyright (C) 2009 PunBB
- * @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
- * @package pun_broadcast_email
- */
-
-require FORUM_ROOT.'header.php';
-
-// START SUBST - <!-- forum_main -->
-ob_start();
-
-?>
-<div class="main-subhead">
- <h2 class="hn">
- <span><?php echo $lang_pun_broadcast_email['Ext name']; ?></span>
- </h2>
-</div>
-<div class="main-content main-forum">
-<?php if (!empty($forum_page['errors'])) : ?>
- <div class="ct-box error-box">
- <h2 class="warn hn"><?php echo $lang_pun_broadcast_email['Email errors'] ?></h2>
- <ul class="error-list">
- <?php foreach ($forum_page['errors'] as $cur_error) { ?>
- <li class="warn"><span><?php echo $cur_error; ?></span></li>
- <?php } ?>
- </ul>
- </div>
-<?php endif; ?>
-<?php if (empty($forum_page['errors']) && isset($_POST['preview'])): ?>
-<div>
- <p><?php echo $forum_page['preview']['email_subject']; ?></p>
- <p><?php echo $forum_page['preview']['email_message']; ?></p>
-</div>
-<?php endif; ?>
- <?php if (count($forum_page['groups']) > 0): ?>
- <form class="frm-form" id="broadcast-email-form" method="post" accept-charset="utf-8" action="<?php echo $forum_page['form_action'] ?>">
- <div class="hidden">
- <?php foreach ($forum_page['hidden_fields'] as $field_name => $field_value) {?>
- <input type="hidden" name="<?php echo $field_name; ?>" value="<?php echo $field_value; ?>" />
- <?php } ?>
- </div>
- <div class="ct-group">
- <table cellspacing="0" summary="<?php echo $lang_pun_broadcast_email['Table summary'] ?>">
- <thead>
- <tr>
- <th class="tc0" scope="col"><?php echo $lang_pun_broadcast_email['Group'] ?></th>
- <th class="tc1" scope="col"><?php echo $lang_pun_broadcast_email['Group title'] ?> </th>
- <th class="tc2" scope="col"><?php echo $lang_pun_broadcast_email['Members count'] ?> </th>
- <th class="tc3" scope="col"></th>
- </tr>
- </thead>
- <tbody>
- <?php foreach ($forum_page['groups'] as $cur_group) { ?>
- <tr>
- <td class="tc0"><?php echo $cur_group['g_title']; ?></td>
- <td class="tc1"><?php echo $cur_group['g_user_title']; ?></td>
- <td class="tc2"><?php echo $cur_group['user_count']; ?></td>
- <td class="tc3"><input <?php echo in_array($cur_group['group_id'], $forum_page['selected_groups']) ? 'checked' : ''; ?> type="checkbox" value="<?php echo $cur_group['group_id']; ?>" name="groups[]" /></td>
- </tr>
- <?php } ?>
- </tbody>
- </table>
- </div>
- <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>">
- <div class="sf-box checkbox">
- <span class="fld-input">
- <input id="fld<?php echo ++$forum_page['fld_count'] ?>" type="checkbox" <?php echo isset($forum_page['parse_mail']) && $forum_page['parse_mail'] ? 'checked="checked" ' : '';?>value="1" name="parse_mail" />
- </span>
- <label for="fld<?php echo $forum_page['fld_count'] ?>">
- <span><?php echo $lang_pun_broadcast_email['Tpl vars'] ?></span>
- <?php echo sprintf($lang_pun_broadcast_email['Tpl vars info'], forum_link($forum_url['pun_broadcast_email_help'])) ?>
- </label>
- </div>
- </div>
- <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>">
- <div class="sf-box text required">
- <label for="fld<?php echo ++$forum_page['fld_count'] ?>">
- <span>
- <?php echo $lang_pun_broadcast_email['Email subject'] ?>
- <em><?php echo $lang_common['Required'] ?></em>
- </span>
- </label>
- <br/>
- <span class="fld-input">
- <input id="fld<?php echo $forum_page['fld_count'] ?>" type="text" maxlength="70" size="70" name="req_subject" value="<?php echo $forum_page['email_subject'] ?>"/>
- </span>
- </div>
- </div>
- <div class="txt-set set<?php echo ++$forum_page['item_count'] ?>">
- <div class="txt-box textarea required">
- <label for="fld<?php echo ++$forum_page['fld_count'] ?>">
- <span>
- <?php echo $lang_pun_broadcast_email['Email message'] ?>
- <em><?php echo $lang_common['Required'] ?></em>
- </span>
- </label>
- <div class="txt-input">
- <span class="fld-input">
- <textarea id="fld<?php echo $forum_page['fld_count'] ?>" cols="95" rows="14" name="req_message"><?php echo $forum_page['email_message'] ?></textarea>
- </span>
- </div>
- </div>
- </div>
- <div class="frm-buttons">
- <span class="submit"><input type="submit" name="submit" value="<?php echo $lang_pun_broadcast_email['Submit'] ?>" /></span>
- <span class="submit"><input type="submit" name="preview" value="<?php echo $lang_pun_broadcast_email['Preview'] ?>" /></span>
- </div>
- </form>
- <?php endif; ?>
-</div>
-<?php
-
-$tpl_temp = forum_trim(ob_get_contents());
-$tpl_main = str_replace('<!-- forum_main -->', $tpl_temp, $tpl_main);
-ob_end_clean();
-// END SUBST - <!-- forum_main -->
-
-require FORUM_ROOT.'footer.php';
-
-?>
Please sign in to comment.
Something went wrong with that request. Please try again.