*********************************/ require '../bootstrap.php'; require_once Pommo::$_baseDir . 'classes/Pommo_Subscribers.php'; require_once Pommo::$_baseDir . 'classes/Pommo_Validate.php'; Pommo::init(); $logger = Pommo::$_logger; $dbo = Pommo::$_dbo; /********************************** JSON OUTPUT INITIALIZATION *********************************/ require_once Pommo::$_baseDir . 'classes/Pommo_Json.php'; $json = new Pommo_Json(); // EXAMINE CALL switch ($_REQUEST['call']) { case 'addSubscriber': $json->setFailMsg(Pommo::_T('Error adding subscriber.')); // check if email is valid if (!Pommo_Helper::isEmail($_REQUEST['Email'])) { echo 1; $json->fail(Pommo::_T('Invalid email.')); } // check if email has unsubscribed if (!isset($_REQUEST['force'])) { $unsubscribed = Pommo_Subscribers::GetIDByEmail($_REQUEST['Email'], 0); if (!empty($unsubscribed)) { $json->fail(sprintf(Pommo::_T('%s has already unsubscribed. To add the subscriber anyway, check the box to force the addition.'), '<strong>' . $_REQUEST['Email'] . '</strong>')); } } // check if duplicate