Changeset 463
- Timestamp:
- 06/23/10 17:08:34 (20 months ago)
- Location:
- trunk
- Files:
-
- 1 added
- 1 deleted
- 3 edited
-
controllers/podcasts_controller.php (modified) (4 diffs)
-
views/layouts/rss/rss.ctp (modified) (1 diff)
-
views/podcasts/index.ctp (deleted)
-
views/podcasts/rss.ctp (modified) (3 diffs)
-
views/podcasts/view.ctp (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/controllers/podcasts_controller.php
r461 r463 29 29 * @var array 30 30 */ 31 public $components = array('RequestHandler' );31 public $components = array('RequestHandler', 'Blog'); 32 32 33 33 /** … … 39 39 { 40 40 parent::beforeFilter(); 41 $this->Auth->allow(array(' display', 'vote'));41 $this->Auth->allow(array('all', 'view', 'rss')); 42 42 } 43 43 … … 49 49 public function view($username, $podcast_id) 50 50 { 51 $this->layout = $this->blog->layout($username); 52 $this->set('blog', $this->blog->blog($user_id)); 53 $params = array( 54 'conditions' => array('Podcast.id'=>$podcast_id, 'Podcast.status'=>1), 55 'fields' => array('id', 'title', 'description', 'created', 'filename', 'length', 'size', 'duration') 56 ); 51 $this->layout = 'blog'; 52 $this->Blog->setUserId($username); # set blog sidebars 53 $user_id = $this->Blog->getUserId(); 54 $params = array( 55 'conditions' => array('Podcast.id'=>$podcast_id, 'Podcast.status'=>1), 56 'fields' => array('id', 'title', 'description', 'created', 'filename', 'length') 57 ); 57 58 $this->set('data', $this->Podcast->find('first', $params)); 58 59 } 59 60 60 61 /** 61 * 62 * View all podcast 62 63 * @access public 63 64 * @var array … … 90 91 'contain' => False, 91 92 'fields' => array('User.id', 'User.username','User.name','User.email', 'User.avatar')); 92 $ User = $this->Podcast->User->find('first', $params);93 $user = $this->Podcast->User->find('first', $params); 93 94 94 $this->set(' User', $User);95 $params = array('conditions' => array('Podcast.status'=>1, 'Podcast.user_id'=>$ User['User']['id']),95 $this->set('user', $user); 96 $params = array('conditions' => array('Podcast.status'=>1, 'Podcast.user_id'=>$user['User']['id']), 96 97 'fields' => array('Podcast.id', 'Podcast.title', 'Podcast.filename', 'Podcast.description', 'Podcast.created', 'Podcast.duration', 97 98 'Podcast.title', 'Podcast.length'), -
trunk/views/layouts/rss/rss.ctp
r461 r463 13 13 endif; 14 14 $channel = $this->Rss->channel(array(), $channelData, $content_for_layout); 15 #die(debug($channel)); 15 16 echo $this->Rss->document($documentData,$channel); 17 18 #echo $content_for_layout; 16 19 # ? > EOF -
trunk/views/podcasts/rss.ctp
r461 r463 1 1 <?php 2 # die(debug($podcasts));2 #die(debug($user)); 3 3 # You should import Sanitize 4 4 App::import('Sanitize'); 5 5 6 6 $this->set('documentData', array( 7 'xmlns:dc' => 'http://purl.org/dc/elements/1.1/')); 7 'xmlns:pod' => 'http://sw.deri.org/2005/07/podcast#', 8 'xmlns:dc' => 'http://purl.org/dc/elements/1.1/')); 8 9 9 10 $this->set('channelData', array( … … 14 15 foreach ($podcasts as $pod): 15 16 $postTime = strtotime($pod['Podcast']['created']); 16 $postLink = array( 17 'controller' => 'podcasts', 18 'action' => 'view', 19 'year' => date('Y', $postTime), 20 'month' => date('m', $postTime), 21 'day' => date('d', $postTime), 22 $pod['Podcast']['id']); 17 $postLink = array('controller' => 'podcasts', 'action' => 'view', $user['User']['username'].'/'.$pod['Podcast']['id']); 23 18 # This is the part where we clean the body text for output as the description 24 19 # of the rss item, this needs to have only text to make sure the feed validates 25 $bodyText = preg_replace('=\(.*?\)=is', '', $pod['Podcast']['description']); 26 $bodyText = $this->Text->stripLinks($bodyText); 27 $bodyText = Sanitize::stripAll($bodyText); 28 $bodyText = $this->Text->truncate($bodyText, 400, '...', True, True); 20 $bodyText = str_replace('nbsp', ' ', $pod['Podcast']['description']); 21 #$bodyText = preg_replace('=\(.*?\)=is', '', $bodyText); 22 #$bodyText = $this->Text->stripLinks($bodyText); 23 #$bodyText = Sanitize::stripAll($bodyText); 24 #$bodyText = $this->Text->truncate($bodyText, 400, '...', True, True); 29 25 30 26 echo $this->Rss->item(array(), array( … … 33 29 'guid' => array('url' => $postLink, 'isPermaLink' => True), 34 30 'description' => $bodyText, 35 'dc:creator' => 'username',31 'dc:creator' => $user['User']['username'], 36 32 'pubDate' => $pod['Podcast']['created'])); 37 33 endforeach;
Note: See TracChangeset
for help on using the changeset viewer.
