<?php
defined( '_JEXEC' ) or die( 'Restricted access' );


//require_once( $mosConfig_absolute_path . '/includes/database.php' );
header('Content-type: text/html; charset=iso-8859-1');

global $mainframe;

$db				=& JFactory::getDBO();


$axosection= JRequest::getVar('axosection', '');
$axo= JRequest::getVar('id', 0);
$cat= JRequest::getVar('cati', 0);

if ($cat > 0) {
	if ($axo) {
		$row =& JTable::getInstance('content');
		// load the row from the db table
		$row->load( $axo );
		$query = "SELECT section FROM #__categories"
			. "\n WHERE id = $cat"
			;
		$db->setQuery( $query );
		$section = $db->loadResult();
		$db->setQuery ("Update #__content set catid=$cat where id=$axo");
		$db->query();
		$db->setQuery ("Update #__content set sectionid=$section where id=$axo");
		$db->query();
		
		$row =& JTable::getInstance('content');
			// load the row from the db table
		$row->load( $axo );
		
		$yes			= fonctionGmaccess::TabGmaccess( $row, 'item', 1, 0, 0, 1, 0, 1, 0, 1, 1 );
	}else{
		$row =& JTable::getInstance('category');
			// load the row from the db table
		$row->load( $cat );
		
		$yes			= fonctionGmaccess::TabGmaccess( $row, 'category', 1, 0, 0, 1, 0, 1, 0, 1, 1, 99999, 1 );
	}
}else{

	if ( $cat == -1 ) {
		$yes = "Veuillez choisir une cat&eacute;gorie";
	} else {
		$row =& JTable::getInstance('category');
			// load the row from the db table
		$row->load( $cat );
		
		$yes			= fonctionGmaccess::TabGmaccess( $row, 'category', 1, 0, 0, 1, 0, 1, 0, 1, 1, 99999, 1 );
	}
}
//$yes = myaccess(62);	
echo $yes;

			
				
?>