public function subscribeAction() { $email = system::POST('email', isEmail); if (empty($email)) { $answer = array('error' => 1, 'msg' => lang::get('SUBSCRIPTION_EMPTY_EMAIL')); } else { if (empty($_POST['subscribes'])) { $answer = array('error' => 2, 'msg' => lang::get('SUBSCRIPTION_EMPTY_LIST')); } else { $sid = mailingProcess::addEmail($email, $_POST['subscribes'], true); if ($sid) { $answer = array('error' => 0, 'msg' => lang::get('SUBSCRIPTION_MSG')); } else { $answer = array('error' => 3, 'msg' => lang::get('SUBSCRIPTION_ERROR')); } } } if (!system::isAjax()) { if (!empty($answer['error'])) { system::saveErrorToSession('subscription', $answer); if (!empty($_POST['back_url'])) { system::redirect($_POST['back_url'], true); } } else { system::redirect('/subscription/ok'); } } else { system::json($answer); } }
public function proc_addlist() { $count = 0; if (!empty($_POST['emails']) && !empty($_POST['subscribes'])) { preg_match_all("/[-0-9a-z_\\.]+@[-0-9a-z^\\.]+\\.[a-z]{2,4}/i", $_POST['emails'], $mas); while (list($num, $email) = each($mas[0])) { $id = mailingProcess::addEmail($email, $_POST['subscribes']); if ($id) { $count++; } } } ui::MessageBox(lang::get('SUBSCRIBE_ADDED_EMAILS') . ruNumbers::decl($count, lang::get('SUBSCRIBE_AE')) . '.'); system::redirect('/subscription/user/' . system::POST('parent_id', isInt)); }