Caravel CMS PHP Cross Reference Content Management Systems

Source: /apps/RSS/RSS.php - 113 lines - 3256 bytes - Summary - Text - Print

   1  <?php
   2  
   3  require_once ('Channel.php');
   4  require_once ('RSSReader.php');
   5  require_once ('RSSNavigation.php');
   6  require_once ('RSSEditChannel.php');
   7  require_once ('RSSPost.php');
   8  
   9  /**
  10  * Name:      RSS.php
  11  * App:       RSS
  12  * Desc:      Designed to create, manage and display RSS news feeds.
  13  * Creator:   David Glick <david@nonsensesofware.com>
  14  */
  15  class RSS extends App
  16      {   
  17      var $orgName;
  18      var $messages = array();
  19  
  20      function getContent()
  21          {    
  22          if ( isset($this->params['mode'] ) )
  23              {
  24              // make sure we have proper permissions
  25              if ( $this->can('rss') )
  26                  {
  27                  switch ($this->params['mode'])
  28                      {
  29                      case 'editChannel':
  30                          $result = RSSEditChannel::getContent();
  31                          break;
  32                      case 'viewChannel':
  33                          $button = '<a href="' . $this->linkToSelf(array('mode' => 'nav')) . '">Back to Channel List</a><br>';
  34                          $this->colWidth -= 200;
  35                          $reader = RSSReader::init($this);
  36                          $reader->feedSrc = $this->params['channel'];
  37                          $result = '<h2>Previewing channel...</h2>' . $button . Widget::form_look('','','beginning') . $reader->viewChannel() . Widget::form_look('','','end');
  38                          break;
  39                      case 'deleteChannel':
  40                          break;
  41                      case 'post':
  42                          $result = RSSPost::getContent();
  43                          break;
  44                      default:
  45                          $result = RSSNavigation::getContent();
  46                          break;
  47                      }
  48  
  49                  if (count($this->messages))
  50                      new mnAlert(implode('<br />', $this->messages));
  51                  return $result;
  52                  }
  53              else
  54                  return new mnError('You are not allowed to modify RSS channels for this site.');
  55              }
  56          else
  57              {
  58              // if no mode set, we are in a block as an RSS reader
  59              $reader = RSSReader::init($this);
  60              return $reader->getContent();
  61              }
  62          }
  63  
  64  	function onSave()
  65          {
  66          if ($this->blockID == 'tmpRSS')
  67              return;
  68              
  69          $reader = RSSReader::init($this);
  70          return $reader->onSave();
  71          }
  72  
  73      function getConfig()
  74          {
  75          if ($this->blockID == 'tmpRSS')
  76              return $this->getContent();
  77          
  78          if ($this->httpVars['mode'] == 'fileRSSSelect')
  79              return RSSPost::pickChannel();
  80          
  81          $reader = RSSReader::init($this);
  82          return $reader->getConfig();
  83          }
  84          
  85      function addMessage($message)
  86          {
  87          array_push($this->messages, $message);
  88          }
  89  
  90  	function finish()
  91          {
  92          if ($this->blockID == 'tmpRSS')
  93              return RSSNavigation::getContent();
  94          else
  95              {
  96              if (T_SINGLE_BLOCK)
  97                  return implode('<br />', $this->messages) . Utility::getCloseRefreshJavascript();
  98              else
  99                  {
 100                  unset($this->params['mode']);
 101                  $this->httpVars = array();
 102                  return $this->getContent();
 103                  }
 104              }
 105          }
 106      
 107      function dnToNiceName($dn)
 108          {
 109          return DN::dnToName($dn) . ' (' . DN::dnToSiteDomain($dn) . ')';
 110          }
 111          
 112      } // end class RSS
 113  ?>

title

Description

title

Description

title

Description

title

title

Body