/** * Setup Advertisements * * Grabs an advertisement for each available position and outputs it to the template. */ function setup_ads() { global $cache, $config, $db, $phpbb_root_path, $phpEx, $template, $user, $forum_id; if (!isset($config['ads_version'])) { return; } $user->add_lang('mods/ads'); // Automatically update if required if (version_compare($config['ads_version'], '1.0.12', '<')) { if (!class_exists('umil')) { if (!file_exists($phpbb_root_path . 'umil/umil.' . $phpEx)) { trigger_error('Please download the latest UMIL (Unified MOD Install Library) from: <a href="http://www.phpbb.com/mods/umil/">phpBB.com/mods/umil</a>', E_USER_ERROR); } include $phpbb_root_path . 'umil/umil.' . $phpEx; } $umil = new umil(true); include $phpbb_root_path . 'ads/versions.' . $phpEx; $umil->run_actions('update', $versions, 'ads_version'); unset($versions); } if (!$config['ads_enable']) { return; } $forum_id = $forum_id ? $forum_id : request_var('f', 0); $ads = get_ads($user->data['user_id'], $forum_id); if (sizeof($ads)) { foreach ($ads as $position_id => $code) { $template->assign_vars(array('ADS_' . $position_id => $code)); } } if (sizeof($ads) || isset($user->data['ad_owner']) && $user->data['ad_owner']) { if (isset($user->data['ad_owner']) && $user->data['ad_owner']) { $template->_tpldata['.'][0]['ADS_8'] = isset($template->_tpldata['.'][0]['ADS_8']) ? $template->_tpldata['.'][0]['ADS_8'] : ''; $template->_tpldata['.'][0]['ADS_8'] .= '<div class="copyright" style="text-align: center; margin-top: 5px;"><a href="' . append_sid("{$phpbb_root_path}ads/my_ads.{$phpEx}") . '">' . $user->lang['MY_ADS'] . '</a></div>'; } $template->assign_var('ADS_CLICK_FILE', $phpbb_root_path . 'ads/click.' . $phpEx); $template->assign_var('ADS_VIEW_FILE', $phpbb_root_path . 'ads/view.' . $phpEx); } }
} } elseif (isset($_GET['del_id'])) { // Удаление объявления delete_ad($_GET['del_id'], $db); header('Location: ' . $_SERVER['PHP_SELF']); } elseif (isset($_GET['id'])) { // Показать объявление $ad = get_ad($_GET['id'], $db); if ($ad) { $ad_flag = 2; } else { $msg_ad_status .= 'Не удалось отобразить объявление ' . (int) $_GET['id']; } } // Загрузка объявлений в массив для вывода на странице в виде таблицы $ads = get_ads($db); $smarty_dir = 'smarty/'; require $smarty_dir . '/libs/Smarty.class.php'; $smarty = new Smarty(); $smarty->compile_check = true; //$smarty->debugging = true; $smarty->template_dir = $smarty_dir . 'templates'; $smarty->compile_dir = $smarty_dir . 'templates_c'; $smarty->cache_dir = $smarty_dir . 'cache'; $smarty->config_dir = $smarty_dir . 'configs'; $smarty->assign('ads', $ads); $smarty->assign('err_msg', $err_msg); $smarty->assign('ad_flag', $ad_flag); $smarty->assign('cities', $cities); $smarty->assign('metro_stations', $metro_stations); $smarty->assign('categories', $categories);
require $phpbb_root_path . 'config.' . $phpEx; require $phpbb_root_path . 'includes/acm/acm_' . $acm_type . '.' . $phpEx; require $phpbb_root_path . 'includes/cache.' . $phpEx; require $phpbb_root_path . 'includes/constants.' . $phpEx; require $phpbb_root_path . 'ads/constants.' . $phpEx; require $phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx; require $phpbb_root_path . 'ads/functions.' . $phpEx; $cache = new cache(); $db = new $sql_db(); // Connect to DB $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, defined('PHPBB_DB_NEW_LINK') ? PHPBB_DB_NEW_LINK : false); // We do not need this any longer, unset for safety purposes unset($dbpasswd); // Grab global variables, re-cache if necessary $config = $cache->obtain_config(); $ads = get_ads($user_id, $forum_id, false); if ($config['gzip_compress']) { if (@extension_loaded('zlib') && !headers_sent()) { ob_start('ob_gzhandler'); } } // application/xhtml+xml not used because of IE header('Content-type: text/html; charset=UTF-8'); header('Cache-Control: private, no-cache="set-cookie"'); header('Expires: 0'); header('Pragma: no-cache'); if (isset($ads[$position_id])) { if (defined('OUTPUT_ADS_JS') || isset($_GET['display']) && $_GET['display'] == 'js') { echo 'document.write(\'' . $ads[$position_id] . '\')'; } else { echo $ads[$position_id];
<div id="menu-footer"> <ul> <?php if (isset($pages)) { foreach ($pages as $page) { echo $page->title; } } ?> </ul> </div> <p class="copyright">©copyright 2012 <a class="copyright" title="Lightning Digital Signage" href="http://www.lightningdigitalsignage.com">LDS</a>. All rights reserved.<br />Powered by <a class="copyright" href="http://www.lli.co.id" title="PT. Lucent Lestari Indah">LLI</a></p> <p align="right">Page rendered in <strong>{elapsed_time}</strong> seconds</p> </div> </div> <div id="sideAds-rightContainer"> <div id="sideAds-home3"><?php get_ads(ADS_TYPE_SIDE3, "121119"); ?> </div> <div id="sideAds-home4"><?php get_ads(ADS_TYPE_SIDE4, "121119"); ?> </div> </div> </div> </div> </div> </body> </html>
$intAlternate = 0; foreach ($rowRegions as $regionObject) { $intAlternate++; //$bigAd = $objDatabase->fetchRows("Select * FROM ".TBL_ADS." where type='1' and FIND_IN_SET (".$regionObject->id.", regions) order by rand() limit 1"); $bigAd = get_ads($regionObject->id); if (!empty($bigAd)) { $ext = substr($bigAd->image, strrpos($bigAd->image, '.') + 1); if ($ext == "mp4") { ?> <?php } else { ?> <?php } } else { $adBackground = get_ads(7); //$objFunctions->iFind(TBL_ADS, 'image', array('id'=>7)); $imgData = base64_encode(file_get_contents(base_url() . 'library/upload/' . $adBackground->image)); $src = base_url() . 'library/upload/' . $adBackground->image; //$smalladRs = $objDatabase->fetchRows("Select * FROM ".TBL_ADS." where type='2' and id<>7 and FIND_IN_SET (".$regionObject->id.", regions) order by rand() limit 1"); $smalladRs = get_ads_with_type($regionObject->id); if ($smalladRs != '') { } } if ($intAlternate > '1') { ?> <div data-id="<?php echo $regionObject->id; ?> " data-cnt="<?php echo $intAlternate;
$wonderful_third_data = get_third_login('projectwonderful', $db); if ($wonderful_third_data && $wonderful_third_data['active'] == 1) { @($file_data = $fileops->read_file($wonderful_file_path . $wonderful_third_data['user_info'])); if ($file_data) { $file_data = str_replace('pw:', '', $file_data); $fileops->set_file('../assets/data/projectwonderful.xml'); $fileops->set_contents($file_data); $fileops->save_file(); } } } /***** * ! Display logic */ // Get all ads. $ad_list = get_ads(null, $db); $current_theme = get_site_theme($milieu_list['tone_id']['value'], $db); ///////// Read PW data. // Get the login ID, if any. $wonderful_third_data ? $wonderful_third_data : ($wonderful_third_data = get_third_login('projectwonderful', $db)); if ($wonderful_third_data && $wonderful_third_data['active'] == 1) { // Find the saved XML file. $wonderful_xml = file_get_contents('../assets/data/projectwonderful.xml'); // Got a raw string? Interpret its XML. if ($wonderful_xml) { $wonderful_xml_obj = simplexml_load_string($wonderful_xml); $wonderful_ad_list = interpret_wonderful_xml($wonderful_xml_obj, $ad_list, $db); } // Got wonderful ads? Great! Build a list for the artist. if ($wonderful_ad_list) { $heading_list = array();
exit; break; case 'rules': $arr_offers = get_rules_offers(); list($js_last_offer_id, $js_offers_data) = get_offers_data_js($arr_offers); $js_sources_data = get_sources_data_js(); $js_countries_data = get_countries_data_js(); $js_langs_data = get_langs_data_js(); $page_content = 'rules_page.inc.php'; include _TRACK_SHOW_COMMON_PATH . "/templates/main.inc.php"; exit; break; case 'costs': $arr_sources = get_sources(); $arr_campaigns = get_campaigns(); $arr_ads = get_ads(); $page_content = 'costs_page.inc.php'; include _TRACK_SHOW_COMMON_PATH . "/templates/main.inc.php"; exit; break; case 'import': $page_content = 'import_page.inc.php'; include _TRACK_SHOW_COMMON_PATH . "/templates/main.inc.php"; exit; break; case 'adnets': $page_content = 'adnets_page.inc.php'; include _TRACK_SHOW_COMMON_PATH . "/templates/main.inc.php"; exit; break; case 'postback':
} else { echo '<h2>Не удалось удалить. Объявление ' . (int) $_GET['del_id'] . ' не найдено.</h2>'; echo '<h2><a href="' . $_SERVER['PHP_SELF'] . '">Назад<a></h2>'; exit; } } elseif (isset($_GET['id'])) { // Показать объявление $ad = get_ad((int) $_GET['id']); if ($ad) { $ad_flag = 2; } else { $msg_ad_status .= 'Не удалось отобразить объявление ' . (int) $_GET['id']; } } // Загрузка объявлений в массив для вывода на странице в виде таблицы $ads = get_ads(); mysql_close($conn); // Закрытие соединения с mysql $smarty_dir = 'smarty/'; require $smarty_dir . '/libs/Smarty.class.php'; $smarty = new Smarty(); $smarty->compile_check = true; //$smarty->debugging = true; $smarty->template_dir = $smarty_dir . 'templates'; $smarty->compile_dir = $smarty_dir . 'templates_c'; $smarty->cache_dir = $smarty_dir . 'cache'; $smarty->config_dir = $smarty_dir . 'configs'; $smarty->assign('ads', $ads); $smarty->assign('err_msg', $err_msg); $smarty->assign('ad_flag', $ad_flag); $smarty->assign('cities', $cities);
} else { echo '<h2>Не удалось удалить. Объявление ' . (int) $_GET['del_id'] . ' не найдено.</h2>'; echo '<h2><a href="' . $_SERVER['PHP_SELF'] . '">Назад<a></h2>'; exit; } } elseif (isset($_GET['id'])) { // Показать объявление $ad = get_ad((int) $_GET['id'], $mysqli); if ($ad) { $ad_flag = 2; } else { $msg_ad_status .= 'Не удалось отобразить объявление ' . (int) $_GET['id']; } } // Загрузка объявлений в массив для вывода на странице в виде таблицы $ads = get_ads($mysqli); $mysqli->close(); // Закрытие соединения с mysql $smarty_dir = 'smarty/'; require $smarty_dir . '/libs/Smarty.class.php'; $smarty = new Smarty(); $smarty->compile_check = true; //$smarty->debugging = true; $smarty->template_dir = $smarty_dir . 'templates'; $smarty->compile_dir = $smarty_dir . 'templates_c'; $smarty->cache_dir = $smarty_dir . 'cache'; $smarty->config_dir = $smarty_dir . 'configs'; $smarty->assign('ads', $ads); $smarty->assign('err_msg', $err_msg); $smarty->assign('ad_flag', $ad_flag); $smarty->assign('cities', $cities);
function show_adv_data($pos, $show = 1) { //$adv_content = super_cache::get('get_ads|'.$pos,'ads',1,0); $adv_content = get_ads($pos); $rtn = ''; switch ($pos) { case 'adv_bottom': if (count($adv_content)) { foreach ($adv_content as $v) { $rtn .= '<div align="center">' . $v['adv_str'] . '</div>'; } unset($adv_content); } break; default: if (count($adv_content)) { foreach ($adv_content as $v) { $rtn .= $v['adv_str']; } unset($adv_content); } } if ($show) { echo $rtn; } else { return $rtn; } }
include 'functions.php'; include 'libs/php-ga-1.1.1/src/autoload.php'; $pid = isset($_GET['postid']) ? $_GET['postid'] : 0; if (isset($_GET['site']) && isset($_GET['q']) && $_GET['site'] == 'google') { //choose ads $data = get_ads($pid, $_GET['site'], $_GET['q']); //dont need postid $data = str_replace('{{q}}', $_GET['q'], $data); echo $data; //print ads content } elseif (isset($_GET['site']) && isset($_GET['q']) && $_GET['site'] == 'bing') { } elseif (isset($_GET['site']) && isset($_GET['q']) && $_GET['site'] == 'yahoo') { } elseif (isset($_GET['postid'])) { //random ad $data = get_ads($pid); if (isset($_GET['q'])) { $data = str_replace('{{q}}', $_GET['q'], $data); } echo $data; } /*tracking ga*/ /* use UnitedPrototype\GoogleAnalytics; // Initilize GA Tracker $tracker = new GoogleAnalytics\Tracker('UA-46107816-1', 'http://app-ads.hoangweb.com'); // Assemble Visitor information // (could also get unserialized from database) $visitor = new GoogleAnalytics\Visitor();