1<?php
2
3if (!$GLOBALS['commandline']) {
4    $id = 0;
5    if (!empty($_GET['id'])) {
6        $id = sprintf('%d', $_GET['id']);
7    }
8}
9
10if (!$id) {
11    return;
12}
13
14if (isset($_POST['sendmethod']) && $_POST['sendmethod'] == 'inputhere') {
15    $_POST['sendurl'] = '';
16}
17
18if (!empty($_POST['sendurl'])) {
19    //# hard overwrite the message content, wipe all that was there.
20    //# check there's a protocol
21    //# @@@ do we want to allow other than http and https? Can't imagine, ppl would want to use ftp or something
22
23    if ($_POST['sendurl'] == 'e.g. https://www.phplist.com/testcampaign.html') {
24        $_POST['sendurl'] = '';
25    } else {
26        if (!preg_match('/^https?:\/\//i', $_POST['sendurl']) && !preg_match('/testcampaign/i',
27                $_POST['sendurl'])
28        ) {
29            $_POST['sendurl'] = 'http://'.$_POST['sendurl'];
30        }
31
32        $_POST['message'] = '[URL:'.$_POST['sendurl'].']';
33    }
34}
35
36//# checkboxes cannot be detected when unchecked, so they need registering in the "cb" array
37//# to be identified as listed, but not checked
38//# find the "cb" array and uncheck all checkboxes in it
39//# then the processing below will re-check them, if they were
40if (isset($_POST['cb']) && is_array($_POST['cb'])) {
41    foreach ($_POST['cb'] as $cbname => $cbval) {
42        //# $cbval is a dummy
43        setMessageData($id, $cbname, '0');
44    }
45}
46//# remember all data entered
47foreach ($_POST as $key => $val) { //#17566 - we are only interested in POST data, not all in REQUEST
48    /*
49      print $key .' '.$val;
50    */
51    setMessageData($id, $key, $val);
52    $messagedata[$key] = $val;
53}
54unset($GLOBALS['MD']);
55
56$messagedata = loadMessageData($id);
57
58/*
59if (!empty($_REQUEST["criteria_attribute"])) {
60  include dirname(__FILE__).'/addcriterion.php';
61}
62*/
63
64/*
65print '<hr/>';
66var_dump($messagedata);
67#exit;
68*/
69
70$status = 'OK';
71