Exemplo n.º 1
0
Arquivo: banners.php Projeto: cwcw/cms
/**
/* Function to redirect the clicks to the correct url and add 1 click
*/
function clickbanner($bid)
{
    global $database, $mainframe;
    require_once $mainframe->getPath('class');
    $row = new mosBanner($database);
    $row->load($bid);
    $row->clicks();
    $pat = "http.*://";
    if (!eregi($pat, $row->clickurl)) {
        $clickurl = "http://{$row->clickurl}";
    } else {
        $clickurl = $row->clickurl;
    }
    mosRedirect($clickurl);
}
Exemplo n.º 2
0
function publishBanner($cid, $publish = 1)
{
    global $database, $my;
    if (!is_array($cid) || count($cid) < 1) {
        $action = $publish ? T_('publish') : T_('unpublish');
        echo "<script> alert('" . sprintf(T_('Select an item to %s'), $action) . "'); window.history.go(-1);</script>\n";
        exit;
    }
    $cids = implode(',', $cid);
    $database->setQuery("UPDATE #__banner SET showBanner='{$publish}'" . "\nWHERE bid IN ({$cids}) AND (checked_out=0 OR (checked_out='{$my->id}'))");
    if (!$database->query()) {
        echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n";
        exit;
    }
    if (count($cid) == 1) {
        $row = new mosBanner($database);
        $row->checkin($cid[0]);
    }
    mosRedirect('index2.php?option=com_banners');
}
Exemplo n.º 3
0
function publishBanner($cid, $publish = 1)
{
    global $database, $my;
    josSpoofCheck();
    if (!is_array($cid) || count($cid) < 1) {
        $action = $publish ? 'publish' : 'unpublish';
        echo "<script> alert('Selecione um item para {$action}'); window.history.go(-1);</script>\n";
        exit;
    }
    mosArrayToInts($cid);
    $cids = 'bid=' . implode(' OR bid=', $cid);
    $query = "UPDATE #__banner" . "\n SET showBanner = " . (int) $publish . "\n WHERE ( {$cids} )" . "\n AND ( checked_out = 0 OR ( checked_out = " . (int) $my->id . " ) )";
    $database->setQuery($query);
    if (!$database->query()) {
        echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n";
        exit;
    }
    if (count($cid) == 1) {
        $row = new mosBanner($database);
        $row->checkin($cid[0]);
    }
    mosRedirect('index2.php?option=com_banners');
}
Exemplo n.º 4
0
function publishBanner($cid, $publish = 1, $option)
{
    global $database, $my, $adminLanguage;
    if (!is_array($cid) || count($cid) < 1) {
        $action = $publish ? 'publish' : 'unpublish';
        echo "<script> alert('" . $adminLanguage->A_COMP_SEL_ITEM . " " . $action . "'); window.history.go(-1);</script>\n";
        exit;
    }
    $cids = implode(',', $cid);
    $database->setQuery("UPDATE #__banner SET showBanner='{$publish}'" . "\nWHERE bid IN ({$cids}) AND (checked_out=0 OR (checked_out='{$my->id}'))");
    if (!$database->query()) {
        echo "<script> alert('" . $database->getErrorMsg() . "'); window.history.go(-1); </script>\n";
        exit;
    }
    if (count($cid) == 1) {
        $row = new mosBanner($database);
        $row->checkin($cid[0]);
    }
    mosRedirect("index2.php?option={$option}");
}