function getForwardDestinations() { global $log; $forwards = getForwards($log); $destinations = array(); foreach ($forwards as $forward) { $exploded = explode(" ", trim($forward)); $dest = hasHostName($exploded[count($exploded) - 1]); if (isset($destinations[$dest])) { $destinations[$dest]++; } else { $destinations[$dest] = 1; } } return $destinations; }
function getForwardDestinations() { $log = readInLog(); $forwards = getForwards($log); $destinations = array(); foreach ($forwards as $forward) { $exploded = explode(" ", trim($forward)); $dest = $exploded[count($exploded) - 1]; if (isset($destinations[$dest])) { $destinations[$dest]++; } else { $destinations[$dest] = 0; } } return $destinations; }
<?php include_once '../lib/session.inc.php'; include_once '../lib/forwards.inc.php'; requireDomainAdmin(); $mode = $_POST['mode']; if ($mode == 'load') { print json_encode(array('success' => TRUE, 'forwards' => getForwards())); } else { if ($mode == 'save') { $update = $_POST['update']; $remove = $_POST['remove']; if ($update) { $updates = json_decode($update); foreach ($updates as $tmpForward) { $aliasId = $tmpForward->alias_id; $destination = trim($tmpForward->destination); $active = $tmpForward->active; modifyForward($aliasId, $destination, $active); } } if ($remove) { $aliasIds = split(',', $remove); foreach ($aliasIds as $aliasId) { removeForward($aliasId); } } print json_encode(array('success' => TRUE)); } else { if ($mode == 'add') { $userId = $_POST['email'];