File "admin.gmajax.php"

Full Path: /home/asmplong/www/ancien-site-2019/integ/administrator/components/com_gmajax/admin.gmajax.php
File size: 4.11 KB
MIME-type: text/x-php
Charset: utf-8

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



header('Content-type: text/html; charset=iso-8859-1');

global $mainframe;

$db				=& JFactory::getDBO();

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

if ($sec) {
	if ($axo > 0) {
		$row =& JTable::getInstance('category');
		// load the row from the db table
		$row->load( $axo );


		/*$db->setQuery ("DELETE FROM #__gmacl WHERE axosection='category' AND axo=$axo");
		$db->query();
		$db->setQuery ("Update #__categories set access=0 where id=$axo");
		$db->query();*/
		$db->setQuery ("Update #__categories set section=$sec where id=$axo");
		$db->query();
		
		$row =& JTable::getInstance('category');
			// load the row from the db table
		$row->load( $axo );
		
		$yes			= fonctionGmaccess::TabGmaccess( $row, 'category', 1, 1, 1, 1, 1, 1, 1, 1, 1, 99999, 1 );
	}else{
		$row =& JTable::getInstance('section');
			// load the row from the db table
		$row->load( $sec );
		
		$yes			= fonctionGmaccess::TabGmaccess( $row, 'section', 1, 1, 1, 1, 1, 1, 1, 1, 1, 99999, 1 );
	}
}elseif ($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 );
	}
}elseif ($catcont > 0) {
	
	if ($axo) {
		JTable::addIncludePath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_contact'.DS.'tables');
		$row =& JTable::getInstance('contact', 'Table');
		// load the row from the db table
		$row->load( $axo );

		$db->setQuery ("Update #__contact_details  set catid=$catcont where id=$axo");
		$db->query();
		
		$row =& JTable::getInstance('contact', 'Table');
		// load the row from the db table
		$row->load( $axo );
		$yes			= fonctionGmaccess::TabGmaccess( $row, 'contact', 1, 0, 0, 0, 0, 0, 0, 0, 0 );
		
	} else {
		$row =& JTable::getInstance('category');
			// load the row from the db table
		$row->load( $catcont );
		
		$yes			= fonctionGmaccess::TabGmaccess( $row, 'category', 1, 0, 0, 0, 0, 0, 0, 0, 0, 99999, 1, 1 );

		
	}
}elseif ($menutype) {
	
	if ($axo) {
		$row =& JTable::getInstance( 'menu' );
		$row->load($axo);

		$db->setQuery ("Update #__menu  set menutype='".$menutype."' where id=$axo");
		$db->query();
		
		$row =& JTable::getInstance( 'menu' );
		$row->load($axo);
		$yes			= fonctionGmaccess::TabGmaccess( $row, 'menu', 1, 0, 0, 0, 0, 0, 0, 0, 0 );
		
	} else {
		
		// query to get number of modules for menutype
			$query = 'SELECT id' .
					' FROM #__modules' .
					' WHERE module = "mod_mainmenu"' .
					' AND params LIKE '.$db->Quote('%menutype='.$menutype.'%');
			$db->setQuery( $query );
			$modules = $db->loadResult();

		$row =& JTable::getInstance('module');
			// load the row from the db table
		$row->load( $modules);
		
		$yes			= fonctionGmaccess::TabGmaccess( $row, 'module', 1, 0, 0, 0, 0, 0, 0, 0, 0, 99999, 1 );
	

		
	}
} else {

	if ( $cat == -1 || $axosection == 'contact') {
		$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 );
	}
		
}

echo $yes;

			
				
?>