View of /branches/mambo5/app/controllers/content_controller.php
Parent Directory
|
Revision Log
Revision 2 -
(download)
(annotate)
Fri Dec 3 04:30:31 2010 UTC (2 years, 5 months ago) by enjoyman
File size: 3251 byte(s)
Fri Dec 3 04:30:31 2010 UTC (2 years, 5 months ago) by enjoyman
File size: 3251 byte(s)
first commit mambo5 with cakephp1.3.6.
<?php /** * @package Mambo * @author Mambo Foundation Inc see README.php * @copyright (C) 2000 - 2009 Mambo Foundation Inc. * See COPYRIGHT.php for copyright notices and details. * @license GNU/GPL Version 2, see http://www.opensource.org/licenses/gpl-2.0.php * * Redistributions of files must retain the above copyright notice. * * Mambo is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; version 2 of the License. */ /** * Handles content item management. Loads more to come... * */ class ContentController extends AppController { public $name = 'Content'; public $uses = array('Content', 'ContentTemplate'); public $components = array('Mostlyce'); public $helpers = array('Html', 'Form', 'Javascript', 'MamboHtml'); public $paginate = array('limit' => 5, 'page' => 1, 'order'=>array('created'=>'DESC')); /** * Displays a list of content items that can be viewed * */ public function index() { $this->set('content_items', $this->paginate('Content')); $this->pageTitle = 'List of Content Items'; } /** * Displays a list of content items that can be edited or removed * */ public function administrator_index() { $this->set('content_items', $this->paginate('Content')); $this->pageTitle = 'List of Content Items'; } /** * Displays the title, intro text, and main body of the content item it was passed * @param int $id */ public function view($id = null) { $requestedItem = $this->Content->read(null, $id); //Include the data sanitation code uses('Sanitize'); $mrClean = new Sanitize(); //Scrub on the way out as well to prevent xss hacks $mrClean->clean($requestedItem); $this->set('requested_item', $requestedItem); $this->pageTitle = $requestedItem['Content']['title']; } /** * Loads the selected content item for editing. Also builds a list of html templates for MOStlyCE. * @param int $id */ public function administrator_edit($id = null) { if(empty($this->data)) { if(!$id) { $this->Session->setFlash('Invalid content id'); $this->redirect('/content/index'); } $this->data = $this->Content->read(null, $id); //Build a list of html templates for MOStlyCE $this->set('tinymce_template_code', $this->Mostlyce->setContentTemplates()); } else { //Cleans up the date fields of the current model $this->cleanUpFields(); //Include the data sanitation code uses('Sanitize'); $mrClean = new Sanitize(); $mrClean->clean($this->data); if($this->Content->save($this->data)) { $this->Session->setFlash('The content item has been saved'); $this->redirect('/administrator/content/index'); } else { $this->Session->setFlash('Please correct errors below.'); } } } /** * Deletes the passed content item * @param int $id */ public function administrator_delete($id = null) { if(!$id) { $this->Session->setFlash('Invalid content item!'); $this->redirect('/administrator/content/index'); } if($this->Content->del($id)) { $this->Session->setFlash('The content item deleted: id '.$id.''); $this->redirect('/administrator/content/index'); } } } ?>
| ViewVC Help | |
| Powered by ViewVC 1.0.0 |

