Ejemplo n.º 1
0
     $wbAdvert_config->set('swf_jsloader', 0);
     // Load & Return Code
     $code = $wbAdvert->getAdvertCode((int) $_id);
     if (!strlen($code)) {
         die('<h1 alert="alert">' . JText::_('ERR_NOTFOUND') . '</h1>');
     }
     if (JRequest::getInt('track', 0)) {
         $wbAdvert->impression((int) $_id);
     }
     echo $code;
     exit;
     break;
 default:
     // Load Record
     if ($_id) {
         $wbAdvert->load($_id);
     }
     if (!(int) $wbAdvert->id) {
         die('<h1 alert="alert">' . JText::_('ERR_NOTFOUND') . '</h1>');
     }
     // Confirm Available
     if (!$wbAdvert->url) {
         die('
   <h1 alert="alert">' . JText::_('ERR_URLNOTFOUND') . '</h1>
   <a href="' . WBADVERT_SITE . '">' . JText::_('ERR_RETURNLINK') . '</a>
   ');
     }
     if (!$wbAdvert->published) {
         die('<h1 alert="alert">' . JText::_('ERR_NOTPUBLISHED') . '</h1>');
     }
     // Track Clicks
Ejemplo n.º 2
0
function advert_delete($cid)
{
    $app = JFactory::getApplication();
    $wbAdvert_config = wbAdvert_config::getInstance();
    $db =& JFactory::getDBO();
    if (count($cid)) {
        foreach ($cid as $id) {
            $row = new wbAdvert_advert($db);
            $row->load($id);
            if ($row->id) {
                if ($row->file_type) {
                    // $filePath = JPATH_ROOT.'/'.$wbAdvert_config->get('ad_path').$row->id.'.'.$row->file_type;
                    $filePath = $wbAdvert_config->getAdPath() . $row->id . '.' . $row->file_type;
                    if (file_exists($filePath) && !unlink($filePath)) {
                        echo "<script> alert('Failed to Remove " . $filePath . "'); window.history.go(-1); </script>\n";
                        exit;
                    }
                }
                if (!$row->delete()) {
                    echo "<script> alert('" . $db->getErrorMsg() . "'); window.history.go(-1); </script>\n";
                    exit;
                }
            }
        }
    }
    $app->redirect('index.php?option=' . WBADVERT_NAME . '&task=advert', JText::sprintf('MSG_DELETED', JText::_('Advertisement')));
}