/** * View all the custom email bounce templates. * * - Shows all the bounce templates in the system available to this user * - Provides for actions to add or delete them * - Accessed by ?action=admin;area=maillist;sa=emailtemplates; */ public function action_view_bounce_templates() { global $modSettings, $context, $txt, $scripturl; // We'll need this, because bounce templates are stored with warning templates. require_once SUBSDIR . '/Moderation.subs.php'; // Submitting a new one or editing an existing one then pass this request off if (isset($_POST['add']) || isset($_POST['save']) || isset($_REQUEST['tid'])) { return $this->action_modify_bounce_templates(); } elseif (isset($_POST['delete']) && !empty($_POST['deltpl'])) { checkSession('post'); validateToken('mod-mlt'); removeWarningTemplate($_POST['deltpl'], 'bnctpl'); } // This is all the information required for showing the email templates. $listOptions = array('id' => 'bounce_template_list', 'title' => $txt['ml_bounce_templates_title'], 'items_per_page' => $modSettings['defaultMaxMessages'], 'no_items_label' => $txt['ml_bounce_templates_none'], 'base_href' => $scripturl . '?action=admin;area=maillist;sa=emailtemplates;' . $context['session_var'] . '=' . $context['session_id'], 'default_sort_col' => 'title', 'get_items' => array('function' => array($this, 'list_getBounceTemplates')), 'get_count' => array('function' => array($this, 'list_getBounceTemplateCount'), 'params' => array('bnctpl')), 'columns' => array('title' => array('header' => array('value' => $txt['ml_bounce_templates_name']), 'data' => array('sprintf' => array('format' => '<a href="' . $scripturl . '?action=admin;area=maillist;sa=emailtemplates;tid=%1$d">%2$s</a>', 'params' => array('id_comment' => false, 'title' => false, 'body' => false))), 'sort' => array('default' => 'template_title', 'reverse' => 'template_title DESC')), 'creator' => array('header' => array('value' => $txt['ml_bounce_templates_creator']), 'data' => array('db' => 'creator'), 'sort' => array('default' => 'creator_name', 'reverse' => 'creator_name DESC')), 'time' => array('header' => array('value' => $txt['ml_bounce_templates_time']), 'data' => array('db' => 'time'), 'sort' => array('default' => 'lc.log_time DESC', 'reverse' => 'lc.log_time')), 'delete' => array('header' => array('value' => '<input type="checkbox" class="input_check" onclick="invertAll(this, this.form);" />', 'style' => 'width: 4%;', 'class' => 'centertext'), 'data' => array('function' => create_function('$rowData', ' return \'<input type="checkbox" name="deltpl[]" value="\' . $rowData[\'id_comment\'] . \'" class="input_check" />\'; '), 'class' => 'centertext'))), 'form' => array('href' => $scripturl . '?action=admin;area=maillist;sa=emailtemplates', 'token' => 'mod-mlt'), 'additional_rows' => array(array('class' => 'submitbutton', 'position' => 'below_table_data', 'value' => ' <input type="submit" name="delete" value="' . $txt['ml_bounce_template_delete'] . '" onclick="return confirm(\'' . $txt['ml_bounce_template_delete_confirm'] . '\');" class="right_submit" /> <input type="submit" name="add" value="' . $txt['ml_bounce_template_add'] . '" class="right_submit" />'))); // Create the template list. $context['page_title'] = $txt['ml_bounce_templates_title']; createToken('mod-mlt'); require_once SUBSDIR . '/GenericList.class.php'; createList($listOptions); // Show the list $context['sub_template'] = 'show_list'; $context['default_list'] = 'bounce_template_list'; }
/** * View all the custom warning templates. * - Shows all the templates in the system * - Provides for actions to add or delete them */ public function action_viewWarningTemplates() { global $modSettings, $context, $txt, $scripturl; require_once SUBSDIR . '/Moderation.subs.php'; // Submitting a new one? if (isset($_POST['add'])) { return $this->action_modifyWarningTemplate(); } elseif (isset($_POST['delete']) && !empty($_POST['deltpl'])) { checkSession('post'); validateToken('mod-wt'); removeWarningTemplate($_POST['deltpl']); } // Setup context as always. $context['page_title'] = $txt['mc_warning_templates_title']; require_once SUBSDIR . '/GenericList.class.php'; // This is all the information required for a watched user listing. $listOptions = array('id' => 'warning_template_list', 'title' => $txt['mc_warning_templates_title'], 'items_per_page' => $modSettings['defaultMaxMessages'], 'no_items_label' => $txt['mc_warning_templates_none'], 'base_href' => $scripturl . '?action=moderate;area=warnings;sa=templates;' . $context['session_var'] . '=' . $context['session_id'], 'default_sort_col' => 'title', 'get_items' => array('function' => array($this, 'list_getWarningTemplates')), 'get_count' => array('function' => array($this, 'list_getWarningTemplateCount')), 'columns' => array('title' => array('header' => array('value' => $txt['mc_warning_templates_name']), 'data' => array('sprintf' => array('format' => '<a href="' . $scripturl . '?action=moderate;area=warnings;sa=templateedit;tid=%1$d">%2$s</a>', 'params' => array('id_comment' => false, 'title' => false, 'body' => false))), 'sort' => array('default' => 'template_title', 'reverse' => 'template_title DESC')), 'creator' => array('header' => array('value' => $txt['mc_warning_templates_creator']), 'data' => array('db' => 'creator'), 'sort' => array('default' => 'creator_name', 'reverse' => 'creator_name DESC')), 'time' => array('header' => array('value' => $txt['mc_warning_templates_time']), 'data' => array('db' => 'time'), 'sort' => array('default' => 'lc.log_time DESC', 'reverse' => 'lc.log_time')), 'delete' => array('header' => array('value' => '<input type="checkbox" class="input_check" onclick="invertAll(this, this.form);" />', 'style' => 'width: 4%;text-align: center;'), 'data' => array('function' => create_function('$rowData', ' return \'<input type="checkbox" name="deltpl[]" value="\' . $rowData[\'id_comment\'] . \'" class="input_check" />\'; '), 'class' => 'centertext'))), 'form' => array('href' => $scripturl . '?action=moderate;area=warnings;sa=templates', 'token' => 'mod-wt'), 'additional_rows' => array(array('position' => 'below_table_data', 'value' => ' <input type="submit" name="delete" value="' . $txt['mc_warning_template_delete'] . '" onclick="return confirm(\'' . $txt['mc_warning_template_delete_confirm'] . '\');" class="right_submit" /> <input type="submit" name="add" value="' . $txt['mc_warning_template_add'] . '" class="right_submit" />'))); // Create the watched user list. createToken('mod-wt'); createList($listOptions); $context['sub_template'] = 'show_list'; $context['default_list'] = 'warning_template_list'; }