コード例 #1
0
function IndexMailTopicsSave()
{
    global $mail_selected, $user;
    if (!isset($_POST['mail_topics_form'])) {
        GO(GetSiteUrl() . Ufu('index.php?name=mail&op=topics', 'mail/{op}/'));
    }
    if (isset($_POST['topic'])) {
        $topics = SafeEnv($_POST['topic'], 11, int);
        $html = SafeEnv($_POST['html'], 1, int);
        $mls = System::database()->Select('mail_list', "`email`='{$mail_selected}'");
        $mail_list = array();
        foreach ($mls as $mail) {
            if (!isset($topics[$mail['topic_id']])) {
                System::database()->Delete('mail_list', "`email`='{$mail['email']}'");
                CalcListCounter($mail['topic_id'], false);
                continue;
            }
            $mail_list[$mail['topic_id']] = $mail;
        }
        if ($user->Auth) {
            $user_id = $user->Get('u_id');
        } else {
            $user_id = 0;
        }
        $c = count($topics);
        for ($i = 0; $i < $c; $i++) {
            if (!isset($mail_list[$topics[$i]])) {
                $vals = Values($user_id, $topics[$i], $mail_selected, $html[$i]);
                System::database()->Insert('mail_list', $vals);
                CalcListCounter($topics[$i], true);
            }
        }
    }
    $back = Ufu('index.php?name=mail&op=topics', 'mail/{op}/');
    System::site()->AddTextBox('Рассылки', "<p align=\"center\"><br />Ваш список рассылки сохранен.<br><br><a href=\"{$back}\">Назад</a><br><br></p>");
}
コード例 #2
0
function AdminMailDeleteEmail()
{
    $email = SafeEnv($_GET['email'], 50, str);
    $topic_id = SafeEnv($_GET['topic_id'], 11, int);
    System::database()->Select('mail_topics', "`id`='{$topic_id}'");
    $topic = System::database()->FetchRow();
    System::database()->Delete('mail_list', "`topic_id`='{$topic_id}' and `email`='{$email}'");
    Audit('Рассылки: Удаление адреса ' . $email . ' в список рассылки темы "' . $topic['title'] . '"');
    CalcListCounter(SafeEnv($_GET['topic_id'], 11, int), false);
    GO(ADMIN_FILE . '?exe=mail&a=list&topic_id=' . SafeEnv($_GET['topic_id'], 11, int));
}