PageRenderTime 23ms CodeModel.GetById 1ms RepoModel.GetById 1ms app.codeStats 0ms

/modules/sponsor/banner.php

http://lansuite.googlecode.com/
PHP | 41 lines | 26 code | 10 blank | 5 comment | 20 complexity | 5e440e0f7e5b82f89482d59257ea2961 MD5 | raw file
Possible License(s): LGPL-3.0, AGPL-1.0, LGPL-2.1
  1. <?php
  2. // 62.67.200.4 = Proxy IP of https://sslsites.de/lansuite.orgapage.de
  3. if ($_SERVER['HTTPS'] == 'on' or getenv(REMOTE_ADDR) == "62.67.200.4")
  4. $where = "rotation AND ((pic_path != '' AND pic_path != 'http://') OR pic_path_banner != '') AND !ssl_hide_banner";
  5. else $where = "rotation AND ((pic_path != '' AND pic_path != 'http://') OR pic_path_banner != '')";
  6. $banner = $db->qry_first("SELECT sponsorid, pic_path_banner, url, name
  7. FROM %prefix%sponsor
  8. WHERE %plain%
  9. ORDER BY RAND()", $where);
  10. unset($where);
  11. $file_name = '';
  12. $old_file_name = 'ext_inc/banner/banner_'. substr($banner['pic_path'], strrpos($banner["pic_path"], 'ext_inc/banner/') + 15, strlen($banner['pic_path']));
  13. if ($banner['sponsorid']) $db->qry("UPDATE %prefix%sponsor SET views_banner = views_banner + 1 WHERE sponsorid = %int%", $banner['sponsorid']);
  14. // If no specific rotation banner is given, use the banner from the sponsor page
  15. if ($banner['pic_path_banner'] == '' and file_exists($old_file_name)) $file_name = $old_file_name;
  16. else $file_name = $banner['pic_path_banner'];
  17. // If entry is HTML-Code
  18. if (substr($file_name, 0, 12) == 'html-code://') $smarty->assign('MainBanner', $func->AllowHTML(substr($file_name, 12, strlen($file_name) - 12)));
  19. else {
  20. // If no Banner-Thumb was found, use LanSuite default banner
  21. if ($file_name == '') $file_name = 'ext_inc/banner/one_network_banner.jpg';
  22. $code = '<img src="'. $file_name .'" border="1" width="468" height="60" class="img_border" title="'. $banner['name'] .'" alt="Sponsor Banner"/>';
  23. // Link banner, if in online mode
  24. if ($cfg['sys_internet'] and $banner["sponsorid"]) $code = '<a href="index.php?mod=sponsor&amp;action=bannerclick&amp;design=base&amp;type=banner&amp;sponsorid='. $banner["sponsorid"] .'" target="_blank">'. $code .'</a>';
  25. $smarty->assign('MainBanner', $code);
  26. unset($code);
  27. }
  28. unset($file_name);
  29. unset($old_file_name);
  30. unset($banner);
  31. ?>