- md5
- a4785d90c95fe675f77d48c6dd9eea67
- sha1
- 3d85bdfd271c25e7032400e2fcb6438a8aed0fb2
- sha256
- 4017d2a8048e0f18c7c9fe180160c6e2dd27e82ab0d098fe141117e48286523c
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
<?php
/**
* @version $Id: component.php 10381 2008-06-01 03:35:53Z pasamio $
* @package Joomla
* @subpackage Config
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant to the
* GNU General Public License, and as distributed it includes or is derivative
* of works licensed under the GNU General Public License or other free or open
* source software licenses. See COPYRIGHT.php for copyright notices and
* details.
*/
require_once( JPATH_COMPONENT.DS.'views'.DS.'component'.DS.'view.php' );
/**
* Note: this view is intended only to be opened in a popup
* @package Joomla
* @subpackage Config
*/
class ConfigControllerComponent extends JController
{
/**
* Custom Constructor
*/
function __construct( $default = array())
{
$default['default_task'] = 'edit';
parent::__construct( $default );
$this->registerTask( 'apply', 'save' );
}
/**
* Show the configuration edit form
* @param string The URL option
*/
function edit()
{
JRequest::setVar('tmpl', 'component'); //force the component template
$component = JRequest::getCmd( 'component' );
if (empty( $component ))
{
JError::raiseWarning( 500, 'Not a valid component' );
return false;
}
// load the component's language file
$lang = & JFactory::getLanguage();
$lang->load( $component );
$model = $this->getModel('Component' );
$table =& JTable::getInstance('component');
if (!$table->loadByOption( $component ))
{
JError::raiseWarning( 500, 'Not a valid component' );
return false;
}
$view = new ConfigViewComponent( );
$view->assignRef('component', $table);
$view->setModel( $model, true );
$view->display();
}
/**
* Save the configuration
*/
function save()
{
// Check for request forgeries
JRequest::checkToken() or jexit( 'Invalid Token' );
$component = JRequest::getCmd( 'component' );
$table =& JTable::getInstance('component');
if (!$table->loadByOption( $component ))
{
JError::raiseWarning( 500, 'Not a valid component' );
return false;
}
$post = JRequest::get( 'post' );
$post['option'] = $component;
$table->bind( $post );
// pre-save checks
if (!$table->check()) {
JError::raiseWarning( 500, $table->getError() );
return false;
}
// save the changes
if (!$table->store()) {
JError::raiseWarning( 500, $table->getError() );
return false;
}
//$this->setRedirect( 'index.php?option=com_config', $msg );
$this->edit();
}
/**
* Cancel operation
*/
function cancel()
{
$this->setRedirect( 'index.php' );
}
}
The same content is in 8 releases, Joomla 1.5.4 to 1.5.11. See them all, or every version of this file.