<?php
/* ***************************************************
Listings des variables les plus utilisées sous AEOS.
****************************************************/
header("Content-Type: text/html; charset=UTF-8"); 

//Check Admin
if (preg_match("/admin/", $_SERVER['SCRIPT_FILENAME']) || preg_match("/install/", $_SERVER['SCRIPT_FILENAME']))
{
	$subdir = "../";
	//Sécurisation
	foreach ($_GET as $a => $b){$_[$a] = $b;}
	foreach ($_POST as $a => $b){$_[$a] = $b;}
}
else
{
	$subdir = "";
	//Sécurisation
	foreach ($_GET as $a => $b){$_[$a] = CA20($b);}
	foreach ($_POST as $a => $b){$_[$a] = CA20($b);}
}

// Lecture de toutes les pages
$listing_pages = listing_dossier($subdir.'data/pages/');
$nbPages = count($listing_pages);

// Attribution des IDs
$lecture_pages = array();
for($i=0; $i<$nbPages; ++$i)
{
	$allid = explode('#', $listing_pages[$i]);
	$lecture_pages[$allid[0]] = substr($allid[0].'#'.$allid[1], 0, -4);
}

// Attribution des ordres
$ordre_pages = array();
for($i=0; $i<$nbPages; ++$i)
{
	$lecture_tmp = lecture_xml($subdir.'data/pages/'.$listing_pages[$i]);
	$ordre_pages[$lecture_tmp['page']['ordre']['#text']] = $listing_pages[$i];
}


// Lecture des fichiers de bases
$config = lecture_xml($subdir.'data/config.xml');
$data_pages = $subdir.'data/pages/';
if (isset($redirect)) $id=$redirect; else if(empty($_GET['id'])) $id=$config['configuration']['accueil']['#text']; else $id = $_GET['id'];
$page = lecture_xml($subdir.'data/pages/'.$lecture_pages[$id].'.xml');

// Admin
if (isset($_['pid'])) $pid=$_['pid']; else $pid = 1;
if (isset($_['sid'])) $sid=$_['sid']; else $sid = 1;
?>