?
Path : /home/admin/public_html/old/administrator/components/com_xijc/controllers/ |
Current File : /home/admin/public_html/old/administrator/components/com_xijc/controllers/configuration.php |
<?php // no direct access defined('_JEXEC') or die('Restricted access'); class XiJCControllerConfiguration extends JController { function __construct($config = array()) { parent::__construct($config); //registering some extra in all task list which we want to call $this->registerTask( 'reset' , 'reset' ); } function display() { parent::display(); } function edit() { $id = JRequest::getVar('editId', 0 , 'GET'); $viewName = JRequest::getCmd( 'view' , 'profiletypes' ); // Get the document object $document =& JFactory::getDocument(); // Get the view type $viewType = $document->getType(); $view =& $this->getView( $viewName , $viewType ); $layout = JRequest::getCmd( 'layout' , 'configuration.edit' ); $view->setLayout( $layout ); echo $view->edit($id); } function save() { global $mainframe; // Check for request forgeries JRequest::checkToken() or jexit( 'Invalid Token' ); $user =& JFactory::getUser(); if ( $user->get('guest')) { JError::raiseError( 403, JText::_('ACCESS FORBIDDEN') ); return; } $method = JRequest::getMethod(); if( $method == 'GET' ) { JError::raiseError( 500 , JText::_('ACCESS METHOD NOT ALLOWED') ); return; } $mainframe =& JFactory::getApplication(); $cModel =& XiJCFactory::getModel( 'configuration' ); // Try to save configurations if( $cModel->save() ) { $message = JText::_('CONFIGURATION UPDATED'); } else { JError::raiseWarning( 100 , JText::_( 'UNABLE TO SAVE CONFIGURATION INTO DATABASE. PLEASE ENSURE THAT THE TABLE JOS_COMMUNITY_CONFIG EXISTS' ) ); } $link = JRoute::_('index.php?option=com_xijc&view=configuration', false); $mainframe->redirect($link, $message); } function reset() { global $mainframe; // Check for request forgeries JRequest::checkToken() or jexit( 'Invalid Token' ); $user =& JFactory::getUser(); if ( $user->get('guest')) { JError::raiseError( 403, JText::_('ACCESS FORBIDDEN') ); return; } $mainframe =& JFactory::getApplication(); $cModel =& XiJCFactory::getModel( 'configuration' ); // Try to save configurations if( $cModel->reset() ) { $message = JText::_('CONFIGURATION HAS BEEN RESET TO DEFAULT SETTINGS'); } else { JError::raiseWarning( 100 , JText::_( 'UNABLE TO RESET CONFIGURATION' ) ); } $link = JRoute::_('index.php?option=com_xijc&view=configuration', false); $mainframe->redirect($link, $message); } }