comparison adcache.inc @ 2:e5584a19768b ad

maj module ad
author sly
date Wed, 15 Apr 2009 07:58:32 +0000
parents 948362c2a207
children 6aeff3329e01
comparison
equal deleted inserted replaced
1:948362c2a207 2:e5584a19768b
280 /** 280 /**
281 * Increment action directly in the database. 281 * Increment action directly in the database.
282 */ 282 */
283 function adserve_cache_increment($action, $aid) { 283 function adserve_cache_increment($action, $aid) {
284 $hostid = adserve_variable('hostid'); 284 $hostid = adserve_variable('hostid');
285 _debug_echo("adserve_increment action($action) aid($aid) hostid($hostid)"); 285 _debug_echo("adserve_cache_increment action($action) aid($aid) hostid($hostid)");
286 286
287 // be sure that drupal is bootstrapped 287 // be sure that drupal is bootstrapped
288 adserve_bootstrap(); 288 adserve_bootstrap();
289 289
290 // allow add-on modules to implement their own statistics granularity 290 // allow add-on modules to implement their own statistics granularity
291 $extra = adserve_invoke_hook('increment_extra', 'merge', $action, $aid); 291 $extra = adserve_invoke_hook('increment_extra', 'merge', $action, $aid);
292 if (is_array($extra)) { 292 if (is_array($extra)) {
293 $extra = implode('|,|', $extra); 293 $extra = implode('|,|', $extra);
294 } 294 }
295 adserve_variable('extra', $extra); 295 adserve_variable('extra', $extra);
296 _debug_echo("adserve_increment extra($extra)"); 296 _debug_echo("adserve_cache_increment extra($extra)");
297 297
298 // update statistics 298 // update statistics
299 db_query("UPDATE {ad_statistics} SET count = count + 1 WHERE aid = %d AND action = '%s' AND date = %d AND adgroup = '%s' AND extra = '%s' AND hostid = '%s'", $aid, $action, date('YmdH'), adserve_variable('group'), $extra, $hostid); 299 db_query("UPDATE {ad_statistics} SET count = count + 1 WHERE aid = %d AND action = '%s' AND date = %d AND adgroup = '%s' AND extra = '%s' AND hostid = '%s'", $aid, $action, date('YmdH'), adserve_variable('group'), $extra, $hostid);
300 // if column doesn't already exist, add it 300 // if column doesn't already exist, add it
301 if (!db_affected_rows()) { 301 if (!db_affected_rows()) {
461 } 461 }
462 // display advertisement 462 // display advertisement
463 $output .= $ad; 463 $output .= $ad;
464 // increment counters 464 // increment counters
465 if (adserve_variable('ad_display') == 'raw') { 465 if (adserve_variable('ad_display') == 'raw') {
466 $output .= ad_display_image($ad); 466 $output .= ad_display_image($id);
467 } 467 }
468 else { 468 else {
469 adserve_cache('increment', 'view', $id); 469 adserve_cache('increment', 'view', $id);
470 } 470 }
471 $ads++; 471 $ads++;