You are here

function ad_cache_file_variables in Advertisement 6

Same name and namespace in other branches
  1. 5.2 cache/file/ad_cache_file.inc \ad_cache_file_variables()
  2. 5 cache/file/ad_cache_file.inc \ad_cache_file_variables()
  3. 6.3 cache/file/ad_cache_file.inc \ad_cache_file_variables()
  4. 6.2 cache/file/ad_cache_file.inc \ad_cache_file_variables()
  5. 7 cache/file/ad_cache_file.inc \ad_cache_file_variables()

Additional variables required by the filecache.

File

cache/file/ad_cache_file.inc, line 362
A plug in for the ad.module, providing a file cache mechanism for improved performance when displaying ads.

Code

function ad_cache_file_variables() {

  // paths are comprised of alphanumerics, underscores, dashes, periods and
  // slashes.
  $variables = array();
  $variables['path'] = isset($_GET['p']) ? preg_replace('/[^_\\-\\.\\/\\0-9a-zA-Z]/', '', $_GET['p']) : 'files';

  // files is an integer.
  $variables['files'] = isset($_GET['f']) ? (int) $_GET['f'] : 1;
  if ($variables['files'] > 15) {
    echo "Invalid value 'f=" . $variables['files'] . "', exiting.<br />\n";
    exit;
  }
  return $variables;
}