".__FILE__." Error: $function does not exist."; return false; } return true; } } if (!function_exists('adshow_display_ad_file')){ function adshow_display_ad_file($adfile){ if (!adshow_functions_exist()){ return false; } if (adinj_config_debug_mode()){ echo ""; } $ad_path = dirname(__FILE__).'/ads/'.$adfile; adshow_display_ad_full_path($ad_path); } } if (!function_exists('adshow_display_ad_full_path')){ function adshow_display_ad_full_path($ad_path){ if (!adshow_functions_exist()){ return false; } $showads = adshow_show_adverts(); if ($showads !== true){ if (adinj_config_debug_mode()){ echo ""; } return; } if (file_exists($ad_path)){ $ad = file_get_contents($ad_path); if ($ad === false) die("could not read from file: $ad_path"); if (stripos($ad_path, 'random_1.txt') > 0){ // TODO something better than this echo adinj_config_add_tags_rnd(adshow_eval_php($ad)); } else if (stripos($ad_path, 'top_1.txt') > 0){ echo adinj_config_add_tags_top(adshow_eval_php($ad)); } else if (stripos($ad_path, 'bottom_1.txt') > 0){ echo adinj_config_add_tags_bottom(adshow_eval_php($ad)); } else { echo adshow_eval_php($ad); } } else { echo "ADINJ WARNING: file does not exist: $ad_path"; } } } ////////////////////////////////////////////////////////////////////////////// if (!function_exists('adshow_fromasearchengine')){ function adshow_fromasearchengine(){ if (!adshow_functions_exist()){ return false; } $referrer = $_SERVER['HTTP_REFERER']; $searchengines = adinj_config_search_engine_referrers(); foreach ($searchengines as $se) { if (stripos($referrer, $se) !== false) { return true; } } // Also return true if the visitor has recently come from a search engine // and has the adinj cookie set. return ($_COOKIE["adinj"]==1); } } if (!function_exists('adshow_blocked_ip')){ function adshow_blocked_ip(){ if (!adshow_functions_exist()){ return false; } $visitorIP = $_SERVER['REMOTE_ADDR']; return in_array($visitorIP, adinj_config_blocked_ips()); } } if (!function_exists('adshow_show_adverts')){ function adshow_show_adverts(){ if (!adshow_functions_exist()){ return false; } if (adshow_blocked_ip()) return "blockedip"; if (adinj_config_sevisitors_only()){ if (!adshow_fromasearchengine()) return "referrer"; } return true; } } // From: Exec-PHP plugin if (!function_exists('adshow_eval_php')){ function adshow_eval_php($code) { ob_start(); eval("?>$code