PageRenderTime 64ms CodeModel.GetById 38ms RepoModel.GetById 0ms app.codeStats 0ms

/output_modules/other/rss.inc.php

https://github.com/adamfranco/segue-1.x
PHP | 96 lines | 52 code | 18 blank | 26 comment | 16 complexity | 0e5d7d9e5a5a3736d46ded73d6fd9800 MD5 | raw file
  1. <? /* $Id$ */
  2. include("output_modules/common.inc.php");
  3. include_once (dirname(__FILE__)."/carprss/carp.php");
  4. /* */
  5. /* if ($a[category]) { */
  6. /* printc("<div class='contentinfo' align='right'>"); */
  7. /* printc("Category: <b>".spchars($a[category])."</b>"); */
  8. /* printc("</div>"); */
  9. /* } */
  10. // print "<pre>";
  11. // print_r($o->data);
  12. // print "</pre>";
  13. ob_start();
  14. print "\n\n";
  15. $url = $o->getField("url");
  16. // if (ereg("^".$cfg[full_uri], $url)
  17. // || ereg("^".$cfg[personalsitesurl], $url)
  18. // || ereg("^".$cfg[classsitesurl], $url))
  19. // {
  20. // $replacement = "index.php?".session_name()."=".session_id();
  21. // $url = ereg_replace("index.php\?", $replacement, $url);
  22. // }
  23. MyCarpConfReset();
  24. MyCarpConfReset('rss_contentblock');
  25. if (is_numeric($o->getField("shorttext"))) {
  26. $num_per_page = $o->getField("shorttext");
  27. CarpConf('maxitems',$num_per_page);
  28. } else {
  29. CarpConf('maxitems',5);
  30. }
  31. // If we have an auser, create a cache just for them.
  32. if ($_SESSION['auser']) {
  33. CarpCacheShow($url, '', 1, $_SESSION['auser']);
  34. } else {
  35. // If the user has a valid campus ip-address, then they are a
  36. // member of 'institute'.
  37. $ipIsInInstitute = FALSE;
  38. $ip = $_SERVER[REMOTE_ADDR];
  39. // check if our IP is in inst_ips
  40. if (is_array($cfg[inst_ips])) {
  41. foreach ($cfg[inst_ips] as $i) {
  42. if (ereg("^$i",$ip))
  43. $ipIsInInstitute = TRUE;
  44. }
  45. }
  46. // if we are in the institute IPs, use the institute
  47. // cache.
  48. if ($ipIsInInstitute) {
  49. CarpCacheShow($url, '', 1, 'institute');
  50. }
  51. // If we aren't logged in or in the institute IPs, just use the
  52. // everyone cache.
  53. else {
  54. CarpCacheShow($url);
  55. }
  56. }
  57. printc("<div class='story'>");
  58. printc (ob_get_contents());
  59. printc("</div>");
  60. ob_clean();
  61. if ($o->getField("title")) {
  62. printc("\n\n<div class='contentinfo'>".spchars($o->getField("title"))."</div>\n");
  63. // printc("<div><a href='".$o->getField("url")."' target='_blank'>".$o->getField("url")."</a></div>");
  64. // if ($o->getField("shorttext")) printc("<div class='desc'>".stripslashes($o->getField("shorttext"))."</div>");
  65. }
  66. if ($o->getField("longertext") && !ereg("^[\n\r]*<br />$", $o->getField("longertext"))) {
  67. if ($action == 'viewsite')
  68. $discussAction = 'viewsite';
  69. else if (ereg("preview_edit_as|preview_as", $action))
  70. $discussAction = ereg_replace("preview_edit_as", "preview_as", $action);
  71. else
  72. $discussAction = 'site';
  73. $link = "index.php?$sid&amp;action=".$discussAction."&amp;site=$site&amp;section=$section&amp;page=$page&amp;story=".$o->id."&amp;detail=".$o->id;
  74. printc("<div align='right'><a href='".$link."'>"." More >></a></div>\n");
  75. }
  76. if ($o->getField("discuss")) {
  77. include (dirname(__FILE__)."/discussionLink.inc.php");
  78. }