Mercurial > defr > drupal > ad
comparison external/external.inc @ 0:d8a3998dac8e ad
ajout module ad
author | pierre |
---|---|
date | Fri, 20 Feb 2009 14:04:09 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:d8a3998dac8e |
---|---|
1 <?php | |
2 // $Id: external.inc,v 1.1.2.1.2.2 2009/02/16 17:06:48 jeremy Exp $ | |
3 | |
4 /** | |
5 * @file | |
6 * Loads external ad. | |
7 * | |
8 * Copyright (c) 2006-2009. | |
9 * Jeremy Andrews <jeremy@tag1consulting.com>. | |
10 */ | |
11 | |
12 adserve_variable('ad_dir', getcwd() .'/'); | |
13 | |
14 // Attempt to utilize the file cache, if enabled. | |
15 if (function_exists('ad_cache_file_get_lock')) { | |
16 | |
17 // Find the top level Drupal directory so we can access the cache files. | |
18 for ($i = 1; $i <= 20; $i++) { | |
19 if (file_exists('./includes/bootstrap.inc')) { | |
20 break; | |
21 } | |
22 chdir('..'); | |
23 } | |
24 adserve_variable('root_dir', getcwd()); | |
25 | |
26 $cache_file = ad_cache_file_get_lock(); | |
27 if ($cache_file) { | |
28 $cache = unserialize(fread(adserve_variable('fd'), filesize($cache_file))); | |
29 if (isset($cache['ad_external'])) { | |
30 $aid = adserve_variable('nids'); | |
31 if ($aid && isset($cache['ad_external'][$aid]['contents'])) { | |
32 print $cache['ad_external'][$aid]['contents']; | |
33 exit(0); | |
34 } | |
35 } | |
36 } | |
37 } |