Mercurial > defr > drupal > ad
comparison serve.php @ 0:d8a3998dac8e ad
ajout module ad
| author | pierre |
|---|---|
| date | Fri, 20 Feb 2009 14:04:09 +0000 |
| parents | |
| children | 948362c2a207 |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:d8a3998dac8e |
|---|---|
| 1 <?php | |
| 2 // $Id: serve.php,v 1.1.2.2.2.1 2009/02/16 17:06:47 jeremy Exp $ | |
| 3 | |
| 4 /** | |
| 5 * @file | |
| 6 * Serve advertisements. | |
| 7 * | |
| 8 * Copyright (c) 2005-2009. | |
| 9 * Jeremy Andrews <jeremy@tag1consulting.com>. | |
| 10 */ | |
| 11 | |
| 12 // Provide adserve functions to external plugins. | |
| 13 require_once('adserve.inc'); | |
| 14 | |
| 15 if (isset($_GET['o'])) { | |
| 16 $output = preg_replace('/[^a-zA-Z0-9_-]/', '', $_GET['o']); | |
| 17 if ($output == 'image') { | |
| 18 require_once('imageserve.inc'); | |
| 19 adserve_counter_image(); | |
| 20 exit(0); | |
| 21 } | |
| 22 else if ($output) { | |
| 23 // TODO: Document how this hook allows external modules to use serve.php | |
| 24 $files = array( | |
| 25 "$output.inc", // search for file in main ad directory | |
| 26 "$output/$output.inc", // search for file in subdirectory | |
| 27 "../$output/$output.inc", // search for file in higher subdirectory | |
| 28 ); | |
| 29 foreach ($files as $file) { | |
| 30 $function = $output .'_serve'; | |
| 31 if (file_exists($file)) { | |
| 32 require_once("$file"); | |
| 33 if (function_exists($function)) { | |
| 34 $function(); | |
| 35 exit(0); | |
| 36 } | |
| 37 } | |
| 38 } | |
| 39 } | |
| 40 } | |
| 41 | |
| 42 // Default action. | |
| 43 adserve_ad(); |
