function saveBanner($task)
{
    global $database;
    josSpoofCheck();
    $row = new mosBanner($database);
    $msg = 'Informação do banner salva';
    if (!$row->bind($_POST)) {
        echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
        exit;
    }
    // Resets clicks when `Reset Clicks` button is used instead of `Save` button
    if ($task == 'resethits') {
        $row->clicks = 0;
        $msg = 'Reiniciar cliques no banner';
    }
    // Sets impressions to unlimited when `unlimited` checkbox ticked
    $unlimited = intval(mosGetParam($_POST, 'unlimited', 0));
    if ($unlimited) {
        $row->imptotal = 0;
    }
    if (!$row->check()) {
        echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
        exit;
    }
    if (!$row->store()) {
        echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
        exit;
    }
    $row->checkin();
    mosRedirect('index2.php?option=com_banners', $msg);
}
Beispiel #2
0
function saveBanner($task)
{
    global $database;
    $row = new mosBanner($database);
    $msg = T_('Saved Banner info');
    if ($task == 'resethits') {
        $row->clicks = 0;
        $msg = T_('Reset Banner clicks');
    }
    if (!$row->bind($_POST)) {
        echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
        exit;
    }
    if (!$row->check()) {
        echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
        exit;
    }
    if (!$row->store()) {
        echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
        exit;
    }
    $row->checkin();
    mosRedirect('index2.php?option=com_banners', $msg);
}
Beispiel #3
0
function saveBanner($option)
{
    global $database;
    $row = new mosBanner($database);
    if (!$row->bind($_POST)) {
        echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
        exit;
    }
    if (!$row->check()) {
        echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
        exit;
    }
    if (!$row->store()) {
        echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
        exit;
    }
    $row->checkin();
    mosRedirect("index2.php?option={$option}");
}