? GR0V Shell

GR0V shell

Linux www.koreapackagetour.com 2.6.32-042stab145.3 #1 SMP Thu Jun 11 14:05:04 MSK 2020 x86_64

Path : /home/admin/public_html/old/administrator/components/com_xijc/models/
File Upload :
Current File : /home/admin/public_html/old/administrator/components/com_xijc/models/configuration.php

<?php
/**
 * @package		JomSocial
 * @copyright (C) 2008 by Slashes & Dots Sdn Bhd - All rights reserved!
 * @license http://www.azrul.com Copyrighted Commercial Software
 */

// Disallow direct access to this file
defined('_JEXEC') or die('Restricted access');

jimport( 'joomla.application.component.model' );

class XiJCModelConfiguration extends JModel
{ 	 	 
	var $_params;
	var $_xml	= '';
	
	/**
	 * Constructor
	 */
	function __construct()
	{
		$mainframe	=& JFactory::getApplication();

		// Test if ini path is set
// 		if( empty( $this->_ini ) )
// 		{
// 			$this->_ini	= JPATH_COMPONENT . DS . 'config.ini';
// 		}

		// Test if ini path is set
		if( empty( $this->_xml ) )
		{
			$this->_xml	= JPATH_COMPONENT . DS . 'config.xml';
		}
		
		// Call the parents constructor
		parent::__construct();

		// Get the pagination request variables
		$limit		= $mainframe->getUserStateFromRequest( 'global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int' );
		$limitstart	= $mainframe->getUserStateFromRequest( 'com_xijc.limitstart', 'limitstart', 0, 'int' );

		// In case limit has been changed, adjust limitstart accordingly
		$limitstart = ($limit != 0 ? (floor($limitstart / $limit) * $limit) : 0);

		$this->setState('limit', $limit);
		$this->setState('limitstart', $limitstart);
	}
	
	/**
	 * Returns the configuration object
	 *
	 * @return object	JParameter object
	 **/	 
	function getParams()
	{
		// Test if the config is already loaded.
		if( !$this->_params )
		{
			jimport( 'joomla.filesystem.file');
			$ini	= JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_xijc' . DS . 'default.ini';
			$data	= JFile::read($ini);
			
			// Load default configuration
			$this->_params	= new JParameter( $data );

			$config		=& JTable::getInstance( 'configuration' , 'XiJCTable' );
			$config->load( 'config' );
			
			// Bind the user saved configuration.
			$this->_params->bind( $config->params );
		}
		return $this->_params;
	}
	
	/**
	 * Save the configuration to the config file
	 * 
	 * @return boolean	True on success false on failure.
	 **/
	function save()
	{
		jimport('joomla.filesystem.file');

		$config	=& JTable::getInstance( 'configuration' , 'XiJCTable' );
		$config->load( 'config' );
		
		$registry	=& JRegistry::getInstance( 'xijc' );
		$registry->loadINI( $config->params , 'xijc' );

		$postData	= JRequest::get( 'post' , 2 );
		
		$token		= JUtility::getToken();
		unset($postData[$token]);

		foreach( $postData as $key => $value )
		{
			
			if( $key != 'task' && $key != 'option' && $key != 'view' && $key != $token )
			{
				$registry->setValue( 'xijc.' . $key , $value );
			}
				
		}

		// Get the complete INI string
		$config->params	= $registry->toString( 'INI' , 'xijc' );
		
		// Save it
		if(!$config->store() )
		{
			return false;
		}
		return true;
	}
	
	function reset()
	{
		jimport('joomla.filesystem.file');
				
		JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.DS.'tables');
		$row	=& JTable::getInstance( 'configuration' , 'XiJCTable' );
		
		$row->load('config');

		// Get the complete INI string
		$row->params = '';
		
		// Save it
		if(!$row->store() )
		{
			return false;
		}
		return true;
	}
}

T1KUS90T
  root-grov@210.1.60.28:~$