function rpc_quarantine_list_items($msg) { global $xmlrpcerruser; $input = php_xmlrpc_decode(array_shift($msg->params)); if (!is_string($input)) { return new xmlrpcresp(0, $xmlrpcerruser + 1, "Parameter type " . gettype($input) . " mismatch expected type."); } $return = quarantine_list_items($input); $output = array(); $struct = array(); foreach ($return as $array) { foreach ($array as $key => $val) { $struct[$key] = new xmlrpcval($val); } $output[] = new xmlrpcval($struct, 'struct'); } //var_dump($output); return new xmlrpcresp(new xmlrpcval($output, 'array')); }
} else { echo ' <td class="detail" align="left">' . $row[2], '</td>' . "\n"; } echo ' <td class="detail">' . $row[3] . '</td>' . "\n"; // Delay echo ' <td class="detail">' . $row[4] . '</td>' . "\n"; // Status echo ' </tr>' . "\n"; } echo " </table>\n"; echo " </td></tr>\n"; } echo "</table>\n"; flush(); $quarantinedir = get_conf_var('QuarantineDir'); $quarantined = quarantine_list_items($url_id, RPC_ONLY); if (is_array($quarantined) && count($quarantined) > 0) { echo "<br>\n"; if (isset($_GET['submit']) && $_GET['submit'] == __('submit04')) { debug("submit branch taken"); // Reset error status $error = 0; $status = array(); // Release if (isset($_GET['release'])) { // Send to the original recipient(s) or to an alternate address if (isset($_GET['alt_recpt_yn']) && $_GET['alt_recpt_yn'] == "y") { $to = sanitizeInput($_GET['alt_recpt']); $to = htmlentities($to); } else { $to = $quarantined[0]['to'];
break; case 'R': $type = 'release'; break; default: continue; } $items = quarantine_list_items($id, RPC_ONLY); // Commenting out the below line since it shouldn't make a table for every message // echo "<TABLE WIDTH=\"100%\">\n"; if (count($items) > 0) { $num = 0; $itemnum = array($num); echo '<tr><td><a href="detail.php?id=' . $id . '">' . $id . '</a></td><td>' . $type . '</td><td>'; if ($type == 'release') { if ($quarantined = quarantine_list_items($id, RPC_ONLY)) { $to = $quarantined[0]['to']; } echo quarantine_release($quarantined, $itemnum, $to, RPC_ONLY); } else { echo quarantine_learn($items, $itemnum, $type, RPC_ONLY); } echo '</td></tr>' . "\n"; } } } else { echo '<tr><td colspan="3">Message not found in quarantine</td></tr>' . "\n"; } echo '</table>' . "\n"; echo ' </td>' . "\n"; echo ' </tr>' . "\n";
/** * @param $list * @param $num * @param bool|false $rpc_only * @return string */ function quarantine_delete($list, $num, $rpc_only = false) { if (!is_array($list) || !isset($list[0]['msgid'])) { return "Invalid argument"; } else { $new = quarantine_list_items($list[0]['msgid']); $list =& $new; } if (!$rpc_only && is_local($list[0]['host'])) { foreach ($num as $key => $val) { if (@unlink($list[$val]['path'])) { $status[] = "Delete: deleted file " . $list[$val]['path']; dbquery("UPDATE maillog SET quarantined=NULL WHERE id='" . $list[$val]['msgid'] . "'"); audit_log('Deleted file from quarantine: ' . $list[$val]['path']); } else { $status[] = "Delete: error deleting file " . $list[$val]['path']; global $error; $error = true; } } return join("\n", $status); } else { // Call by RPC debug("Calling quarantine_delete on " . $list[0]['host'] . " by XML-RPC"); //$client = new xmlrpc_client(constant('RPC_RELATIVE_PATH').'/rpcserver.php',$list[0]['host'],80); // Convert input parameters foreach ($list as $list_array) { foreach ($list_array as $key => $val) { $list_struct[$key] = new xmlrpcval($val); } $list_output[] = new xmlrpcval($list_struct, 'struct'); } foreach ($num as $key => $val) { $num_output[$key] = new xmlrpcval($val); } // Build input parameters $param1 = new xmlrpcval($list_output, 'array'); $param2 = new xmlrpcval($num_output, 'array'); $parameters = array($param1, $param2); $msg = new xmlrpcmsg('quarantine_delete', $parameters); $rsp = xmlrpc_wrapper($list[0]['host'], $msg); //$client->send($msg); if ($rsp->faultcode() == 0) { $response = php_xmlrpc_decode($rsp->value()); } else { $response = "XML-RPC Error: " . $rsp->faultstring(); } return $response . " (RPC)"; } }
<tr> <td align="center"><b><a href="javascript:window.close()">Close Window</a></td> </tr> </table> </td> </tr> </table> <?php } if (!isset($_GET['id'])) { die("Error: No Message ID"); } if (!isset($_GET['action'])) { die("Error: No action"); } $list = quarantine_list_items(sanitizeInput($_GET['id'])); if (count($list) == 0) { die("Error: Message not found in quarantine"); } switch ($_GET['action']) { case 'release': $result = ''; if (count($list) == 1) { $to = $list[0]['to']; $result = quarantine_release($list, array(0), $to); } else { for ($i = 0; $i < count($list); $i++) { if (preg_match('/message\\/rfc822/', $list[$i]['type'])) { $result = quarantine_release($list, array($i), $list[$i]['to']); } }