PageRenderTime 51ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/modules/sponsor/boxes/sponsor.php

http://lansuite.googlecode.com/
PHP | 50 lines | 25 code | 10 blank | 15 comment | 16 complexity | 4d4da91158a5604027230d220a5f21f8 MD5 | raw file
Possible License(s): LGPL-3.0, AGPL-1.0, LGPL-2.1
  1. <?php
  2. /**
  3. * Show Sponsorpictures
  4. *
  5. * @package lansuite_core
  6. * @author knox, bytekilla
  7. * @version $Id: sponsor.php 1535 2008-07-27 22:36:01Z bytekilla $
  8. */
  9. $box->DotRow(t('Wir danken').':');
  10. if (!$cfg["sponsor_picwidth"]) $cfg["sponsor_picwidth"] = 120;
  11. $sponsoren = $db->qry("SELECT * FROM %prefix%sponsor
  12. WHERE active
  13. ORDER BY pos, sponsorid");
  14. $db->qry('UPDATE %prefix%sponsor SET views_box = views_box + 1 WHERE active');
  15. ### Loop Sponsors
  16. while ($sponsor = $db->fetch_array($sponsoren)){
  17. $out = '';
  18. // If entry is HTML-Code
  19. if (substr($sponsor['pic_path_button'], 0, 12) == 'html-code://') {
  20. $out = $func->AllowHTML(substr($sponsor["pic_path_button"], 12, strlen($sponsor["pic_path_button"]) - 12));
  21. // Else add Image-Tag
  22. } else {
  23. #$file_name = '';
  24. #$old_file_name = 'ext_inc/banner/button_'. substr($sponsor['pic_path'], strrpos($sponsor["pic_path"], 'ext_inc/banner/') + 15, strlen($sponsor['pic_path']));
  25. #if (file_exists($sponsor['pic_path_button'])) $file_name = $sponsor['pic_path_button'];
  26. #elseif (file_exists($old_file_name)) $file_name = $old_file_name;
  27. #else
  28. $file_name = $sponsor['pic_path_button'];
  29. if ($file_name != '') {
  30. if (is_file($file_name)) $ImgSize = GetImageSize($file_name);
  31. if (!$ImgSize[0]) $ImgSize[0] = $cfg["sponsor_picwidth_small"];
  32. if ($ImgSize[0] > $cfg["sponsor_picwidth_small"]) $ImgSize[0] = $cfg["sponsor_picwidth_small"];
  33. $out = "<img src=\"$file_name\" width=\"{$ImgSize[0]}\" style=\"max-width:{$cfg['sponsor_picwidth_small']}px;\" border=\"0\" alt=\"{$sponsor["name"]}\" title=\"{$sponsor["name"]}\" />";
  34. } elseif ($sponsor["name"] != '') $out = "<b>{$sponsor["name"]}</b>";
  35. if ($out and $sponsor["url"] != '' and $sponsor["url"] != "http://") $out = "<a href=\"index.php?mod=sponsor&amp;action=bannerclick&amp;design=base&amp;type=box&amp;sponsorid={$sponsor["sponsorid"]}\" target=\"_blank\">$out</a>";
  36. }
  37. if ($out != '') $box->Row($out."<br /><br />");
  38. }
  39. $db->free_result($sponsoren);
  40. ?>