registerTask( 'apply', 'save'); } function display( ) { parent::display(); } function cancel( ) { $this->setRedirect( JRoute::_( 'index.php?option=com_jce&client='. $client, false ) ); } function save() { // Check for request forgeries JRequest::checkToken() or die( 'Invalid Token' ); $db =& JFactory::getDBO(); $row =& JTable::getInstance('plugin'); $task = $this->getTask(); $client = JRequest::getWord( 'client', 'site' ); $query = 'SELECT id' . ' FROM #__plugins' . ' WHERE element = "jce"' ; $db->setQuery( $query ); $id = $db->loadResult(); $row->load( intval( $id ) ); if (!$row->bind(JRequest::get('post'))) { JError::raiseError(500, $row->getError() ); } if (!$row->check()) { JError::raiseError(500, $row->getError() ); } if (!$row->store()) { JError::raiseError(500, $row->getError() ); } $row->checkin(); if ($client == 'admin') { $where = "client_id=1"; } else { $where = "client_id=0"; } $row->reorder( 'folder = '.$db->Quote( $row->folder ).' AND ordering > -10000 AND ordering < 10000 AND ( '.$where.' )' ); $msg = JText::sprintf( 'Successfully Saved changes to JCE configuration' ); switch ( $task ) { case 'apply': $this->setRedirect( 'index.php?option=com_jce&type=config&client='. $client, $msg ); break; case 'save': default: $this->setRedirect( 'index.php?option=com_jce&client='. $client, $msg ); break; } } }