Changeset 461
- Timestamp:
- 06/23/10 16:29:34 (20 months ago)
- Location:
- trunk
- Files:
-
- 1 added
- 8 edited
-
config/core.php (modified) (3 diffs)
-
controllers/podcasts_controller.php (modified) (5 diffs)
-
controllers/users_controller.php (modified) (2 diffs)
-
views/layouts/portal.ctp (modified) (1 diff)
-
views/layouts/rss/default.ctp (modified) (1 diff)
-
views/layouts/rss/rss.ctp (modified) (1 diff)
-
views/podcasts/rss.ctp (modified) (1 diff)
-
views/podcasts/rss/rss.ctp (modified) (1 diff)
-
views/users/listing.ctp (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/config/core.php
r460 r461 245 245 * 246 246 * Xcache (http://xcache.lighttpd.net/) */ 247 247 /* 248 248 Cache::config('default', array( 249 249 'engine' => 'Xcache', # [required] … … 254 254 'password' => 'password', # plaintext password (xcache.admin.pass) 255 255 )); 256 */ 256 257 /* 257 258 * Memcache (http://www.danga.com/memcached/) … … 269 270 * 270 271 */ 271 #Cache::config('default', array('engine' => 'File'));272 Cache::config('default', array('engine' => 'File')); 272 273 # ? > EOF -
trunk/controllers/podcasts_controller.php
r459 r461 17 17 public $name = 'Podcasts'; 18 18 19 public $helpers = array('Rss'); 20 19 /** 20 * Load CakePHP helpers 21 * @access public 22 * @var array 23 */ 24 public $helpers = array('Rss', 'Text'); 25 26 /** 27 * Load CakePHP helpers 28 * @access public 29 * @var array 30 */ 21 31 public $components = array('RequestHandler'); 22 32 33 /** 34 * Load CakePHP Acl-Auth 35 * @access public 36 * @var array 37 */ 23 38 public function beforeFilter() 24 39 { … … 26 41 $this->Auth->allow(array('display', 'vote')); 27 42 } 28 29 public function index($username=null, $entry_id=null) 30 { 31 $conditions = array('status'=>1); # podcast must be actived 32 if ($username != null): 33 $user_id = $this->User->field('id', array('username'=>$username)); 34 $conditions['user_id'] = $user_id; 35 $this->set('username', $username); 36 endif; 37 $params = array( 38 'conditions' => $conditions, 39 'fields' => array('id', 'title', 'description', 'created', 'lenght', 'user_id', 'filename'), 40 'order' => 'id DESC', 41 'limit' => 12); 42 $this->set('data', $this->Podcast->find('all', $params)); 43 } 44 45 public function show($user_id, $id) 43 44 /** 45 * View one podcast 46 * @access public 47 * @var array 48 */ 49 public function view($username, $podcast_id) 46 50 { 47 $this->layout = $this->blog->layout($user _id);51 $this->layout = $this->blog->layout($username); 48 52 $this->set('blog', $this->blog->blog($user_id)); 49 53 $params = array( 50 'conditions' => array('Podcast.id'=>$ id, 'Podcast.status'=>1),54 'conditions' => array('Podcast.id'=>$podcast_id, 'Podcast.status'=>1), 51 55 'fields' => array('id', 'title', 'description', 'created', 'filename', 'length', 'size', 'duration') 52 56 ); 53 $this->set('data', $this->Podcast->find(' all', $params));57 $this->set('data', $this->Podcast->find('first', $params)); 54 58 } 55 56 public function all($username=null, $entry_id=null) 59 60 /** 61 * 62 * @access public 63 * @var array 64 */ 65 public function all($username=null, $podcast_id=null) 57 66 { 58 67 $conditions = array('status'=>1); … … 71 80 72 81 /** 73 * 74 * 82 * RSS feeder 83 * @access public 84 * @return void 75 85 */ 76 86 public function rss($username) 77 87 { 78 $this->layout = 'rss'; 88 $this->layout = 'rss'; 79 89 $params = array('conditions' => array('username'=>$username), 90 'contain' => False, 80 91 'fields' => array('User.id', 'User.username','User.name','User.email', 'User.avatar')); 81 92 $User = $this->Podcast->User->find('first', $params); 82 93 83 $channelData = array('title' => $username.' Podcasts', 84 'link' => array('controller' => 'blog', 'action' => $username), 85 'description' => 'Audio from '. $username .' edublog', 86 'itunes:summary' => 'Audio from '. $username .' edublog', 87 'language' => 'en-us', 88 'copyright' => 'Chipotle Software, 2008', 89 'generator' => 'Karamelo Platform', 90 'managingEditor' => 'podcasts@chipotle-software.com', 91 'itunes:owner' => $username, 92 'itunes:image' => '/images/avatars/'.$User['User']['avatar'], 93 'itunes:author' => $User['User']['name'] 94 ); 95 94 $this->set('User', $User); 96 95 $params = array('conditions' => array('Podcast.status'=>1, 'Podcast.user_id'=>$User['User']['id']), 97 96 'fields' => array('Podcast.id', 'Podcast.title', 'Podcast.filename', 'Podcast.description', 'Podcast.created', 'Podcast.duration', … … 99 98 'order' => 'Podcast.created DESC', 100 99 'contain' => False, 101 'limit' => 12);100 'limit' => 30); 102 101 $podcasts = $this->Podcast->find('all', $params); 103 $this->set(compact(' channelData', 'podcasts'));102 $this->set(compact('podcasts')); 104 103 } 105 104 … … 114 113 $fields = array('Podcast.id', 'Podcast.title', 'Podcast.description', 'Podcast.created', 'Podcast.length', 'Podcast.status', 'Podcast.filename'); 115 114 $order = 'Podcast.id DESC'; 116 $limit = 12;115 $limit = 30; 117 116 118 117 $this->paginate = array('conditions' => $conditions, -
trunk/controllers/users_controller.php
r456 r461 21 21 { 22 22 parent::beforeFilter(); 23 $perms = array('bloggers', 'blogger', 'about', 'entry', 'register', 'insert', 'newMembers', 'topNews', 'topBloggers', 'topNews' );23 $perms = array('bloggers', 'blogger', 'about', 'entry', 'register', 'insert', 'newMembers', 'topNews', 'topBloggers', 'topNews', 'listing'); 24 24 $this->Auth->allow($perms); 25 25 … … 222 222 $this->set(compact('data')); 223 223 } 224 public function listing() 225 { 226 $this->layout = 'portal'; 227 $this->pageTitle = __('Users', True); 228 $this->paginate['conditions'] = array('User.id != 2'); 229 $this->paginate['fields'] = array('User.group_id','User.name','User.created','User.email','User.active','User.id','User.username'); 230 $this->paginate['order'] = 'User.created DESC'; 231 $this->paginate['limit'] = 40; 232 $this->paginate['contain'] = array('Group'); 233 $data = $this->paginate('User'); 234 #die(debug($data)); 235 $this->set(compact('data')); 236 } 224 237 225 238 /** -
trunk/views/layouts/portal.ctp
r458 r461 45 45 endif; 46 46 echo $this->Html->div('sidepanel', $this->element('lastentries')); 47 echo $this->Html->div('sidepanel', $this->Html->image('admin/your-users.png', array('alt'=>'MN', 'title'=>'MN', 'height'=> '25px', 'width'=>'25px'))."".$this->Html->link('Mononeurones Registrados', '/u 48 sers/listing')); 49 50 47 51 echo $this->element('adsense'); 48 52 echo $this->Html->div('sidepanel', $this->element('lastdownloads'));/*, array('cache' => True));*/ -
trunk/views/layouts/rss/default.ctp
r214 r461 1 1 <?php 2 echo $rss->header();3 $channel = $rss->channel(array(), $channelData, $items);4 echo $rss->document(array(), $channel);5 ?> 2 #echo $rss->header(); 3 #$channel = $rss->channel(array(), $channelData, $items); 4 #echo $rss->document(array(), $channel); 5 # ? > EOF -
trunk/views/layouts/rss/rss.ctp
r459 r461 1 1 <?php 2 echo $rss->header(); 3 $channel = $rss->channel(array(), $channelData, $items); 4 echo $rss->document(array(), $channel); 5 ?> 2 # Chipotle Software (c) 2006-2010 3 # http://book.cakephp.org/view/1461/Creating-an-RSS-feed-with-the-RssHelper 4 echo $this->Rss->header(); 5 if (!isset($documentData)): 6 $documentData = array(); 7 endif; 8 if (!isset($channelData)): 9 $channelData = array(); 10 endif; 11 if (!isset($channelData['title'])): 12 $channelData['title'] = $title_for_layout; 13 endif; 14 $channel = $this->Rss->channel(array(), $channelData, $content_for_layout); 15 echo $this->Rss->document($documentData,$channel); 16 # ? > EOF -
trunk/views/podcasts/rss.ctp
r459 r461 1 1 <?php 2 #debug($podcasts); 3 function rss_transform($item) 4 { 5 return array( 6 'title' => $item['Podcast']['title'], 7 'guid' => '/files/podcasts/'. $item['Podcast']['filename'], 8 'enclosure' => array('url'=>'/files/podcasts/'. $item['Podcast']['filename'], 'length'=> $item['Podcast']['length']), 9 'description' => strip_tags($item['Podcast']['description']), 10 'pubDate' => $item['Podcast']['created'], 11 'itunes:author' => 'Centauro', 12 'itunes:summary' => strip_tags($item['Podcast']['description']) 13 ); 14 } 15 $this->Rss->addNs('itunes'); 16 $this->set('items', $this->Rss->items($podcasts, 'rss_transform')); 2 # die(debug($podcasts)); 3 # You should import Sanitize 4 App::import('Sanitize'); 5 6 $this->set('documentData', array( 7 'xmlns:dc' => 'http://purl.org/dc/elements/1.1/')); 8 9 $this->set('channelData', array( 10 'title' => __('Most Recent Posts', True), 11 'link' => $this->Html->url('/', True), 12 'description' => __("Most recent posts.", True), 13 'language' => 'en-us')); 14 foreach ($podcasts as $pod): 15 $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']); 23 # This is the part where we clean the body text for output as the description 24 # 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); 29 30 echo $this->Rss->item(array(), array( 31 'title' => $pod['Podcast']['title'], 32 'link' => $postLink, 33 'guid' => array('url' => $postLink, 'isPermaLink' => True), 34 'description' => $bodyText, 35 'dc:creator' => 'username', 36 'pubDate' => $pod['Podcast']['created'])); 37 endforeach; 38 17 39 # ? > EOF -
trunk/views/podcasts/rss/rss.ctp
r459 r461 3 3 { 4 4 return array( 5 'title' => $item['Podcast']['title'],6 'guid' => '/files/podcasts/'. $item['Podcast']['filename'],7 'enclosure' => array('url'=>'/files/podcasts/'. $item['Podcast']['filename'], 'length'=> $item['Podcast']['length']),8 'description' => strip_tags($item['Podcast']['description']),9 'pubDate' => $item['Podcast']['created'],10 'itunes:author' => 'Karamelo',5 'title' => $item['Podcast']['title'], 6 'guid' => '/files/podcasts/'. $item['Podcast']['filename'], 7 'enclosure' => array('url'=>'/files/podcasts/'. $item['Podcast']['filename'], 'length'=> $item['Podcast']['length']), 8 'description' => Sanitize::stripAll($item['Podcast']['description']), 9 'pubDate' => $item['Podcast']['created'], 10 'itunes:author' => 'Karamelo', 11 11 'itunes:summary' => strip_tags($item['Podcast']['description']) 12 12 ); 13 13 } 14 $this->Rss->addNs(' itunes');14 $this->Rss->addNs('dc'); 15 15 $this->set('items', $this->Rss->items($podcasts, 'rss_transform')); 16 # ? > 16 # ? > EOF
Note: See TracChangeset
for help on using the changeset viewer.
