Commit ce5e4ff0 authored by Christoph Zysik's avatar Christoph Zysik

some encapsulation

parent 73d25e87
......@@ -9,7 +9,7 @@ list($art, $tan) = explode('-', $_GET['data']); // yeah sorry ;)
$art = base64_decode($art);
$tan = base64_decode($tan);
$kampdaten = $campaigns->getByTanAndType( $tan, $art );
$kampdaten = $vms->campaigns->getByTanAndType( $tan, $art );
$result_color = 'red';
......@@ -40,5 +40,5 @@ if( $tan == $_SESSION['current_ad']['tan'] &&
</body>
</html><?php
$ptc->invalidateAlreadyRunningAd( $_SESSION['uid'], $ip );
$vms->ptc->invalidateAlreadyRunningAd( $_SESSION['uid'], $ip );
?>
......@@ -10,10 +10,10 @@ list($art, $tan) = explode('-', $_GET['data']); // yeah sorry ;)
$art = base64_decode($art);
$tan = base64_decode($tan);
$kampdaten = $campaigns->getByTanAndType( $tan, $art );
$kampdaten = $vms->campaigns->getByTanAndType( $tan, $art );
// TODO prevent malicious ziel urls
$ptc->invalidateAlreadyRunningAd( $_SESSION['uid'], $ip );
$ptc->setCurrentRunningAd( $art, $kampdaten->id, $tan );
$vms->ptc->invalidateAlreadyRunningAd( $_SESSION['uid'], $ip );
$vms->ptc->setCurrentRunningAd( $art, $kampdaten->id, $tan );
?><!DOCTYPE html>
<html>
......
......@@ -4,10 +4,10 @@ if (!isset($_GET['loeschen'])) $_GET['loeschen'] = '';
if ($_GET['loeschen'] == 'true' && isset($_GET['id']) )
{
echo $campaigns->delete( array( 'id' => $_GET['id'] ) ) .' Banner gel&ouml;scht';
echo $vms->campaigns->delete( array( 'id' => $_GET['id'] ) ) .' Banner gel&ouml;scht';
}
$forcedbanner = $campaigns->getAll( 'forcedbanner', 1, 'administrator');
$forcedbanner = $vms->campaigns->getAll( 'forcedbanner', 1, 'administrator');
foreach($forcedbanner['data'] as $anzeigen)
{
......
......@@ -6,14 +6,14 @@ if (!isset($_GET['blacklist'])) $_GET['blacklist'] = '';
if ($_GET['loeschen'] == 'true' && $_GET['id'])
{
$campaigns->delete( array( 'id' => $_GET['id'] ) );
$vms->campaigns->delete( array( 'id' => $_GET['id'] ) );
}
if ($_GET['blacklist'] == 'true' && $_GET['id'])
{
$campaigns->update( array( 'status' => 1 ), array( 'id' => $_GET['id'] ) );
$vms->campaigns->update( array( 'status' => 1 ), array( 'id' => $_GET['id'] ) );
}
$forcedbanner = $campaigns->getAll( 'forcedbanner', 2);
$forcedbanner = $vms->campaigns->getAll( 'forcedbanner', 2);
foreach( $forcedbanner['data'] as $anzeigen)
{
echo '
......
......@@ -58,7 +58,6 @@ foot();
if ($_POST['anzeigen'] == 'anzeigen !')
{
$ptc->delAllReloads();
$result=mysqli_query("SELECT t1.emailadresse AS email,t1.uid,t2.kontostand,t3.nickname FROM ".$db_prefix."_emaildaten AS t1, vms_kontodaten AS t2,vms_userdaten AS t3 WHERE t1.uid = t2.uid AND t2.uid = t3.uid AND last_active < ".$timestamp."");
$konto='0';
while($row=mysqli_fetch_array($result))
......@@ -81,6 +80,7 @@ foot();
db_query ('DELETE FROM '.$db_prefix.'_admin_abuse WHERE uid = '.$row['uid']);
db_query ('DELETE FROM vms_buchungen WHERE uid = '.$row['uid']);
db_query ('DELETE FROM vms_schnittstelle_anfragen WHERE uid = '.$row['uid']);
$vms->reloads->deleteByUserId( $row['uid'] );
echo '<font color="#00d000">User Gel&ouml;scht</font><br />';
$infotext= ' Hallo '.$row['nickname'].'
......
......@@ -33,7 +33,7 @@ if ($_POST['buchen'] == 'Jetzt Buchen') {
'reload' => $reload,
'sponsor' => 'administrator',
);
$campaigns->insert( $data );
$vms->campaigns->insert( $data );
$buchung = 'true';
}
}
......
<?php
class Campaigns
class zCampaigns
{
private $database;
public $parent;
const FIELDS_gebuchte_werbung = ' `t1`.`id`, `t1`.`uid`, `t1`.`tan`, `t1`.`kid`, `t1`.`ziel`, `t1`.`banner`,
`t1`.`verdienst`, `t1`.`preis`, `t1`.`aufendhalt`, `t1`.`menge`, `t1`.`reload`,
`t1`.`sponsor`, `t1`.`werbeart`, `t1`.`use_frame`, `t1`.`addata`, `t1`.`status`,
`t1`.`created`, `t1`.`modified`, `t1`.`expires` ';
public function __construct( $database )
public function __construct( $zVms )
{
$this->database = $database;
$this->parent = $zVms;
}
public function decreaseAvailCountById( $cid, $value = 1 )
......@@ -22,7 +22,7 @@ class Campaigns
':id' => $cid,
':value' => $value
);
return $this->database->sqlUpdate($sql, $sql_params);
return $this->parent->database->sqlUpdate($sql, $sql_params);
}
public function getIsClickableById( $cid, $ip, $uid, $time )
......@@ -53,7 +53,7 @@ class Campaigns
':t1cid' => $cid,
':t1uid' => $uid,
);
$result = $this->database->select( $sql, $sql_params );
$result = $this->parent->database->select( $sql, $sql_params );
return ( isset($result[0]) ) ? $result[0] : false;
}
......@@ -88,7 +88,7 @@ class Campaigns
':t1type' => $type,
':t1uid' => $uid,
);
$result = $this->database->select( $sql, $sql_params );
$result = $this->parent->database->select( $sql, $sql_params );
return ( isset($result[0]) ) ? $result[0] : false;
}
......@@ -107,10 +107,11 @@ class Campaigns
$sql_params[':status'] = $status;
}
$result = $this->database->select($sql, $sql_params);
$result = $this->parent->database->select($sql, $sql_params);
return ( isset($result[0]) ) ? $result[0] : false;
}
// TODO fix blacklisting
public function getNewAdData( $art, $uid, $ip, $limit = 3 )
{
$zeit = time();
......@@ -141,7 +142,7 @@ class Campaigns
':spuid' => $uid,
);
$result['data'] = $this->database->select($sql, $sql_params);
$result['data'] = $this->parent->database->select($sql, $sql_params);
$result['count'] = count($result['data']);
return $result;
......@@ -172,7 +173,7 @@ class Campaigns
$sql_params[':wart'] = $art;
$result['data'] = $this->database->select($sql, $sql_params);
$result['data'] = $this->parent->database->select($sql, $sql_params);
$result['count'] = count($result['data']);
return $result;
......@@ -180,17 +181,17 @@ class Campaigns
public function delete( $where )
{
return $this->database->delete( '`' . DB_PREFIX . '_gebuchte_werbung`' , $where );
return $this->parent->database->delete( '`' . DB_PREFIX . '_gebuchte_werbung`' , $where );
}
public function update( $data, $where )
{
return $this->database->update( '`' . DB_PREFIX . '_gebuchte_werbung`' , $data, $where );
return $this->parent->database->update( '`' . DB_PREFIX . '_gebuchte_werbung`' , $data, $where );
}
public function insert( $data )
{
return $this->database->insert( '`' . DB_PREFIX . '_gebuchte_werbung`' , $data );
return $this->parent->database->insert( '`' . DB_PREFIX . '_gebuchte_werbung`' , $data );
}
public function getTimeToFirstOffReloadAd( $art, $uid )
......@@ -209,7 +210,7 @@ class Campaigns
':ruid' => $uid,
':until' => $zeit,
);
$result = $this->database->select($sql, $sql_params);
$result = $this->parent->database->select($sql, $sql_params);
if( isset($result[0]) )
{
$res = $result[0];
......
<?php
/*
* TODO
* nothing checks wether user landed on blacklist...
* blacklist check is broken currently anyway
* please fix me
*/
class zPtc
{
public $parent;
public function __construct($zVms)
{
$this->parent = $zVms;
}
public function invalidateAlreadyRunningAd( $uid, $ip )
{
$result = false;
$zeit = time();
if( isset($_SESSION['current_ad']) )
{
$tan = ( isset($_SESSION['current_ad']['tan']) ) ? $_SESSION['current_ad']['tan'] : false;
$art = ( isset($_SESSION['current_ad']['art']) ) ? $_SESSION['current_ad']['art'] : '';
$id = ( isset($_SESSION['current_ad']['id']) ) ? $_SESSION['current_ad']['id'] : 0;
$result = true;
$_SESSION['current_ad'] = array();
if( 0 !== $id )
{
$kamp = $this->parent->campaigns->getIsClickableById( $id, $ip, $uid, $zeit );
if( false !== $kamp )
{
$until = $zeit + $kamp->reload;
$this->parent->reloads->addCampaign( $id, $uid, $ip, $until );
}
}
}
return $result;
}
public function setCurrentRunningAd( $art, $cid, $tan )
{
$_SESSION['current_ad']['art'] = $art;
$_SESSION['current_ad']['id'] = $cid;
$_SESSION['current_ad']['tan'] = $tan;
$_SESSION['current_ad']['time'] = time();
$_SESSION['current_ad']['paid'] = false;
}
public function handleAdPayout( $cid, $adtype, $uid, $ip, $preis, $verdienst, $msg = 'Paid4Action', $billanzcat = 'Werbebereich' )
{
$result = true;
// TODO adtype dependent counter table
db_query("UPDATE `".DB_PREFIX."_kontodaten` SET `klicks` = `klicks` + 1, `kv` = `kv` + ".$verdienst.", `fc_klicks` = `fc_klicks` + 1 WHERE `uid` = ".$uid); // Hier Zusatz für Fakeschutz
kontobuchung ('+', $verdienst, create_code(14), $uid, 1, $msg);
refumsatz ($verdienst, $uid);
// TODO add handler $adtype dependent
rallysystem ($uid, '1', $verdienst);
bilanz($preis, $verdienst, $billanzcat, $msg);
return $result;
}
function checkAdOkAndPay( $cid, $uid, $ip )
{
$result = false;
$time = time();
$data = $this->parent->campaigns->getIsClickableById( $cid, $ip, $uid, $time );
if ( false !== $data )
{
$timepassed = ( $time - $_SESSION['current_ad']['time'] ) +1;
if( $timepassed >= $data->aufendhalt )
{
$until = $time + $data->reload;
$this->handleAdPayout( $cid, $data->werbeart, $uid, $ip, $data->preis, $data->verdienst );
$this->parent->reloads->addCampaign( $cid, $uid, $ip, $until );
$this->parent->campaigns->decreaseAvailCountById( $cid, 1 );
$_SESSION['current_ad']['paid'] = true;
$result = true;
}
}
return $result;
}
}
<?php
/*
* TODO
* nothing checks wether user landed on blacklist...
* blacklist check is broken currently anyway
* please fix me
*/
class Ptc
class zReloads
{
private $database;
private $campaigns;
public $parent;
public function __construct($database, $campaigns)
public function __construct( $zVms )
{
$this->database = $database;
$this->campaigns = $campaigns;
$this->parent = $zVms;
}
public function delCampaignReloads( )
{
public function cleanCampaign( )
{
$zeit = time();
$sql = ' DELETE FROM `'.DB_PREIX.'_campaign_reloads` WHERE `until` <= :until ';
$sql_params = array( 'until' => $zeit );
return $database->rawDelete( $sql, $sql_params );
}
return $this->parent->database->rawDelete( $sql, $sql_params );
}
public function delContentReloads( )
public function cleanContent( )
{
$zeit = time();
$sql = ' DELETE FROM `'.DB_PREIX.'_content_reloads` WHERE `until` <= :until ';
$sql_params = array( 'until' => $zeit );
return $database->rawDelete( $sql, $sql_params );
}
return $this->parent->database->rawDelete( $sql, $sql_params );
}
public function delAllReloads( )
{
$this->delCampaignReloads( );
$this->delContentReloads( );
public function cleanAll( )
{
$this->cleanCampaign( );
$this->cleanContent( );
return true;
}
public function addCampaignToReload( $cid, $uid, $ip, $until )
public function deleteCampaignByUserId( $uid )
{
$sql = ' DELETE FROM `'.DB_PREIX.'_campaign_reloads` WHERE `uid` <= :uid ';
$sql_params = array( 'uid' => $uid );
return $this->parent->database->rawDelete( $sql, $sql_params );
}
public function deleteContentByUserId( $uid )
{
$sql = ' DELETE FROM `'.DB_PREIX.'_content_reloads` WHERE `uid` <= :uid ';
$sql_params = array( 'uid' => $uid );
return $this->parent->database->rawDelete( $sql, $sql_params );
}
public function deleteByUserId( $uid )
{
$this->deleteCampaignByUserId( $uid );
$this->deleteContentByUserId( $uid );
}
public function addCampaign( $cid, $uid, $ip, $until )
{
$sql = 'INSERT INTO `'.DB_PREFIX.'_campaign_reloads`
(`ip`, `uid`, `cid`, `until`) VALUES
(:aip, :auid, :acid, :auntil) ON DUPLICATE KEY UPDATE
......@@ -56,11 +73,11 @@ class Ptc
':auntil'=> $until,
':buntil'=> $until,
);
return $this->database->rawInsert( $sql, $sql_params );
return $this->parent->database->rawInsert( $sql, $sql_params );
}
public function addContentToReload( $cid, $uid, $ip, $until )
{
public function addContent( $cid, $uid, $ip, $until )
{
$sql = 'INSERT INTO `'.DB_PREFIX.'_content_reloads`
(`ip`, `uid`, `cid`, `until`) VALUES
(:aip, :auid, :acid, :auntil) ON DUPLICATE KEY UPDATE
......@@ -72,12 +89,12 @@ class Ptc
':auntil'=> $until,
':buntil'=> $until,
);
return $this->database->rawInsert( $sql, $sql_params );
return $this->parent->database->rawInsert( $sql, $sql_params );
}
public function isCampaignInReload( $cid, $uid, $ip, $time )
{
public function hasCampaign( $cid, $uid, $ip, $time )
{
$sql = ' COUNT(`until`) AS `c`, `until` FROM `'.DB_PREFIX.'_campaign_reloads` WHERE `until` >= :until AND ( (`uid` = :uid OR `ip` = :ip) AND `cid` = :cid ) LIMIT 1';
$sql_params = array(
':until' => $time,
......@@ -85,14 +102,14 @@ class Ptc
':ip' => inet_pton($ip),
':cid' => $cid,
);
$db_result = $this->database->select( $sql, $sql_params );
$db_result = $this->parent->database->select( $sql, $sql_params );
$in_reload = ( isset($db_result[0]) && 0 == $db_result[0]->c ) ? false : true;
$until = ( $in_reload ) ? $db_result[0]->until : 0;
return array('in_reload' => $in_reload, 'until' => $until);
}
}
public function isContentInReload( $cid, $uid, $ip, $time)
{
public function hasContent( $cid, $uid, $ip, $time)
{
$sql = ' COUNT(`until`) AS `c`, `until` FROM `'.DB_PREFIX.'_content_reloads` WHERE `until` >= :until AND ( (`uid` = :uid OR `ip` = :ip) AND `cid` = :cid ) LIMIT 1';
$sql_params = array(
':until' => $time,
......@@ -100,90 +117,10 @@ class Ptc
':ip' => inet_pton($ip),
':cid' => $cid,
);
$db_result = $this->database->select( $sql, $sql_params );
$db_result = $this->parent->database->select( $sql, $sql_params );
$in_reload = ( isset($db_result[0]) && 0 == $db_result[0]->c ) ? false : true;
$until = ( $in_reload ) ? $db_result[0]->until : 0;
return array('in_reload' => $in_reload, 'until' => $until);
}
public function invalidateAlreadyRunningAd( $uid, $ip )
{
$result = false;
$zeit = time();
if( isset($_SESSION['current_ad']) )
{
$tan = ( isset($_SESSION['current_ad']['tan']) ) ? $_SESSION['current_ad']['tan'] : false;
$art = ( isset($_SESSION['current_ad']['art']) ) ? $_SESSION['current_ad']['art'] : '';
$id = ( isset($_SESSION['current_ad']['id']) ) ? $_SESSION['current_ad']['id'] : 0;
$result = true;
$_SESSION['current_ad'] = array();
if( 0 !== $id )
{
$kamp = $this->campaigns->getIsClickableById( $id, $ip, $uid, $zeit );
if( false !== $kamp )
{
$until = $zeit + $kamp->reload;
$this->addCampaignToReload( $id, $uid, $ip, $until );
}
}
}
return $result;
}
public function setCurrentRunningAd( $art, $cid, $tan )
{
$_SESSION['current_ad']['art'] = $art;
$_SESSION['current_ad']['id'] = $cid;
$_SESSION['current_ad']['tan'] = $tan;
$_SESSION['current_ad']['time'] = time();
$_SESSION['current_ad']['paid'] = false;
}
public function handleAdPayout( $cid, $adtype, $uid, $ip, $preis, $verdienst, $msg = 'Paid4Action', $billanzcat = 'Werbebereich' )
{
$result = true;
// TODO adtype dependent counter table
db_query("UPDATE `".DB_PREFIX."_kontodaten` SET `klicks` = `klicks` + 1, `kv` = `kv` + ".$verdienst.", `fc_klicks` = `fc_klicks` + 1 WHERE `uid` = ".$uid); // Hier Zusatz für Fakeschutz
kontobuchung ('+', $verdienst, create_code(14), $uid, 1, $msg);
refumsatz ($verdienst, $uid);
// TODO add handler $adtype dependent
rallysystem ($uid, '1', $verdienst);
bilanz($preis, $verdienst, $billanzcat, $msg);
}
return $result;
}
function checkAdOkAndPay( $cid, $uid, $ip )
{
$result = false;
$time = time();
$data = $this->campaigns->getIsClickableById( $cid, $ip, $uid, $time );
if ( false !== $data )
{
$timepassed = ( $time - $_SESSION['current_ad']['time'] ) +1;
if( $timepassed >= $data->aufendhalt )
{
$until = $time + $data->reload;
$this->handleAdPayout( $cid, $data->werbeart, $uid, $ip, $data->preis, $data->verdienst );
$this->addCampaignToReload( $cid, $uid, $ip, $until );
$this->campaigns->decreaseAvailCountById( $cid, 1 );
$_SESSION['current_ad']['paid'] = true;
$result = true;
}
}
return $result;
}
}
<?php
class Stats
class zStats
{
private $database;
public $parent;
public function __construct( $database )
public function __construct( $zVms )
{
$this->database = $database;
$this->parent = $zVms;
}
public function adsTotalsCount( $art, $personal = false )
......@@ -40,7 +40,7 @@ class Stats
$sql_params[':spuid'] = $personal;
}
$result = $this->database->select( $sql, $sql_params );
$result = $this->parent->database->select( $sql, $sql_params );
return ( isset($result[0]) ) ? $result[0] : false;
}
......@@ -68,7 +68,7 @@ class Stats
':spuid' => $uid,
':wart' => $art,
);
$result = $this->database->select( $sql, $sql_params );
$result = $this->parent->database->select( $sql, $sql_params );
return ( isset($result[0]) ) ? $result[0] : false;
}
......
<?php
class zVms
{
public $database;
public $campaigns;
public $stats;
public $ptc;
public $reloads;
public function __construct($database)
{
$this->database = $database;
require_once( __DIR__ . '/zCampaigns.php' );
require_once( __DIR__ . '/zStats.php' );
require_once( __DIR__ . '/zPtc.php' );
require_once( __DIR__ . '/zReloads.php' );
$this->campaigns = new zCampaigns($this);
$this->stats = new zStats($this);
$this->ptc = new zPtc($this);
$this->reloads = new zReloads($this);
}
}
......@@ -8,7 +8,7 @@ if ($pageconfig['reload_betteln'] == 0) {
if ($_SESSION['uid'] == $_ref_id || $_ref_id == $_COOKIE['uid']) {
$betteltext = '<b><font color="#FF0000">Du kannst dich nicht selbst anbetteln!</font></b>';
} else {
$reloadcheck = $ptc->isContentInReload( 3, $_SESSION['uid'], $ip, $_zeit);
$reloadcheck = $vms->reloads->hasContent( 3, $_SESSION['uid'], $ip, $_zeit);
if (false == $reloadcheck['in_reload'])
{
......@@ -21,7 +21,7 @@ if ($pageconfig['reload_betteln'] == 0) {
$bettelsumme = rand($minimum * 100, $maximum * 100) / 100;
$new_reload = $_zeit + $pageconfig['reload_betteln'];
$ptc->addContentToReload( 3, $ref_id, $ip, $sperre );
$vms->reloads->addContent( 3, $ref_id, $ip, $sperre );
db_query("UPDATE " . DB_PREFIX . "_kontodaten SET angebettelt =angebettelt + 1, bv = bv + " . $bettelsumme . ", kontostand = kontostand + '" . $bettelsumme . "' WHERE uid = '" . $_ref_id . "'");
db_query("INSERT INTO ".DB_PREFIX."_bettel_buchung (zeit,betrag,refferer,uid) VALUES ('". $_zeit ."', '".$bettelsumme."', '".$_SERVER['HTTP_REFERER']."', '".$_ref_id."' )");
......
......@@ -82,7 +82,7 @@ foot();
head("Mediadaten - Werbung");?>
<table width="100%" border="0" cellpadding="1" cellspacing="1">
<?php
$forcedbanner_stats = $stats->adsTotalsCount( 'forcedbanner' );
$forcedbanner_stats = $vms->stats->adsTotalsCount( 'forcedbanner' );
?>
<tr class="tabellenbody_0">
<td width="50%">Forcedklick Kampagnen</td>
......
......@@ -8,7 +8,7 @@ if ($pageconfig['popup_start'] == 0)
// Reload setzen und Umstze schreiben
$new_reload = time()+$pageconfig['reload_start'];
$ptc->addContentToReload( 1, $_SESSION['uid'], $ip, $new_reload );
$vms->reloads->addContent( 1, $_SESSION['uid'], $ip, $new_reload );
db_query("UPDATE ".$db_prefix."_kontodaten SET s_aufrufe = s_aufrufe + 1, s_verdienst = s_verdienst + ".$pageconfig['verdienst_start']." WHERE uid = '".$_SESSION['uid']."'");
kontobuchung ('+', $pageconfig['verdienst_start'], create_code(14), $_SESSION['uid'], 1, 'System Startseitenverg&uuml;tung');
......
......@@ -8,13 +8,13 @@ require_once ('../lib/session.lib.php');
require_once ('../lib/layout.lib.php');
userstatus();
if ( md5($_SESSION['uid']."-".date("H:i")) == $_GET['key']) {
$start_reload = $ptc->isContentInReload( 1, $_SESSION['uid'], $ip, time());
$start_reload = $vms->reloads->hasContent( 1, $_SESSION['uid'], $ip, time());
if (false == $start_reload['in_reload'] )
{
// Reload setzen und Umstze schreiben
$new_reload = time()+$pageconfig['reload_start'];
$ptc->addContentToReload( 1, $_SESSION['uid'], $ip, $new_reload );
$vms->reloads->addContent( 1, $_SESSION['uid'], $ip, $new_reload );
db_query("UPDATE ".DB_PREFIX."_kontodaten SET s_aufrufe = s_aufrufe + 1, s_verdienst = s_verdienst + ".$pageconfig['verdienst_start']." WHERE uid = '".$_SESSION['uid']."'");
kontobuchung ('+', $pageconfig['verdienst_start'], create_code(14), $_SESSION['uid'], 1, 'System Startseitenverg&uuml;tung');
refumsatz ($pageconfig['verdienst_start'],$_SESSION['uid']);
......
......@@ -28,9 +28,9 @@ $( document )
}
}
$( "#loadAds_btn").on('click', function(e) { loadAds( 'forcedbanner', displayAds ) } );
$( "#loadAds_btn").on('click', function(e) { loadAds( 'forcedbanner', 'getNewPtcData', displayAds ) } );
loadAds( 'forcedbanner', displayAds );
loadAds( 'forcedbanner', 'getNewPtcData', displayAds );
/*
* gets executed on click on ad
......
......@@ -20,7 +20,7 @@ if($setting['buchungen_loeschen'] == 1){
}
## Alte Reloads löschen
$ptc->delAllReloads( );
$vms->reloads->cleanAll( );
## Abgelaufene Paidmails löschen
db_query('DELETE FROM '.$db_prefix.'_paidmails_empfaenger WHERE
status = 1 || status = 2 || gueltig < '.time().'');
......
......@@ -18,23 +18,30 @@ if( 0 == $sperre['forced_sperre'] )
{
switch( $_POST['action'] )
{
case 'getNewAdData':
$ptc->invalidateAlreadyRunningAd( $_SESSION['uid'], $ip );
case 'getNewPtcData':
$vms->ptc->invalidateAlreadyRunningAd( $_SESSION['uid'], $ip );
if( isset($_POST['adArt']) )
{
$result = $campaigns->getNewAdData( $_POST['adArt'], $_SESSION['uid'], $ip );
$result = $vms->campaigns->getNewAdData( $_POST['adArt'], $_SESSION['uid'], $ip );
}
break;
case 'getNewPtvData':
if( isset($_POST['adArt']) )
{
$result = $vms->campaigns->getNewAdData( $_POST['adArt'], $_SESSION['uid'], $ip, 1);
}
break;
case 'checkAdOk':
if( isset( $_SESSION['current_ad']['id'] ) )
$result = $ptc->checkAdOkAndPay( $_SESSION['current_ad']['id'], $_SESSION['uid'], $ip );
$result = $vms->ptc->checkAdOkAndPay( $_SESSION['current_ad']['id'], $_SESSION['uid'], $ip );
else
$result = false;
break;
case 'invalidateAd':
$result = $ptc->invalidateAlreadyRunningAd( $_SESSION['uid'], $ip );
$result = $vms->ptc->invalidateAlreadyRunningAd( $_SESSION['uid'], $ip );
break;
}
}
......
......@@ -161,12 +161,12 @@
/*
* gets executed first, loads available ads and prepares the bootstrap <ul>-list for display
*/
function loadAds( art, fn)
function loadAds( ad_type, ad_cat, fn)
{
$.post( "ext/ap/ads.php",
{